docs: the panel in the framework (what an app supplies, which sections it gets, words, native commands)

This commit is contained in:
CRTkafa 2026-09-30 07:03:41 +00:00
parent 1e853e8eff
commit 4987faa4f0
3 changed files with 91 additions and 4 deletions

View file

@ -1,6 +1,14 @@
# shell (internal)
Sources of `waybetter/shell/*`: the shell models, the Store screens and the shell frame
(`src/frame`, `createShell`). Published as part of the [`waybetter`](../waybetter/README.md) package;
not published on its own. The repository README's "The shell frame" section describes what an app
supplies.
Sources of `waybetter/shell/*`: the shell models, the Store screens, the shell frame (`src/frame`,
`createShell`) and the panel (`src/panel`, `createPanel`: the app's own tab). Published as part of
the [`waybetter`](../waybetter/README.md) package; not published on its own. The repository README's
"The shell frame" and "The panel" sections describe what an app supplies.
The panel is here rather than in a package of its own because it is drawn inside the frame and
shares its state: the frame's profile, deck, theme, sync and developer-mode stores, its native
bridge and its language. It imports the theme document model from `../runtime` by source path;
the package build (`packages/waybetter/scripts/build.mjs`) points those imports at `dist/runtime`.
`scripts/google-fonts-catalog.mjs` regenerates the font browser's offline Google Fonts list
(`src/panel/fonts/googleFontsCatalog.json`).

View file

@ -88,8 +88,22 @@ createRoot(document.getElementById('root')!).render(<Shell/>);
- `i18n`: the app's `createI18n` instance with `waybetter/locales/*.json` merged in; the frame's words are `wb.*` messages in 51 languages.
- `bootScript()` (`frame/boot`): the first-frame `boot.js` (the last theme's chrome colors before the modules load).
- `installPreviewMocks(handlers)`: native commands answered from memory, for development previews in a plain browser.
- `createLanguage(options)` (`frame/language`): which language the app speaks (follow the site, follow the system, or one language), switched live and handed to native code and site tabs (`i18n_set`); `createAppI18n(options)` (`frame/appI18n`): the app's i18n instance with typed keys, `useT`, dates and numbers.
- Everything else is exported for apps that build their own settings on it: the shared state (`shell`, `setOverlay`, `scheduleSync`), stores (decks, workspaces, sync, developer mode), models (palette, accounts, workspaces, backup, media) and hooks.
**Panel** (`waybetter/shell/panel`, modules also as `waybetter/shell/panel/*`, styles as `waybetter/shell/panel/*.css`)
```tsx
import { createPanel, type PanelSite } from 'waybetter/shell/panel';
const Panel = createPanel({ brand: { name: 'wayBetter', logo }, home, themes, sections, make, languages });
const Shell = createShell({ ...site, panel: { id: 'app', title: 'wayBetter', component: Panel } }, options);
```
- The app's own tab: home, Appearance and the Theme Builder (with the Google Fonts browser), plugins and custom CSS, the Store, Make, accounts, Power User, settings, backup and sync, developer mode, updates, and a search across every setting. Each section shows only when the app serves what it needs.
- `PanelSite` (`panel/site`): the brand and the home page's words, the app's own `sections` and their `order`, `themes` (the theme store and catalog, the preview component a theme document is drawn in, the site font), `make` (example plugins, an example theme, bundled docs), `store`, `languages`, and what its native side serves (`settings.alerts`, `backup`, `updates`).
- For the app's own sections: the panel's controls (`panel/controls`: `Section`, `Row`, `Toggle`, `Segmented`, `Select`, `Slider`, `ColorField`, `Button`, ...), `useFeatures` and `FeatureGroups` (`panel/FeatureToggles`: on/off rows over the host's `features_get/set`), `compareLines`.
- The panel's words are `wb.*` messages in 51 languages (`waybetter/locales/*.json`; translator notes in `waybetter/locales/en.meta.json`).
**Command line**
- `waybetter store build --config store.config.mjs`: builds an app's part of the shared store folder (its items only, validated with the apps' own rules).