diff --git a/README.md b/README.md
index f4af019..8980781 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,8 @@ npm create waybetter app -- --site kick.com # a whole app: Tauri 2 + waybetter
takes every answer as a flag (`--help`). The app skeleton is this README in code: the native
`SiteSpec`, the page `SiteAdapter`, the app on `waybetter_host::app` (its config, site hooks and
its own commands), the three capability files and a `tests/security.rs` on `waybetter_host::testkit`,
-a shell that reports the tab rectangle (`tabs_sync`), the plugin store, one site-only command, the
+the shell (the framework's shell frame through `createShell`, with the site's pages and a plugins
+panel), the plugin store, one site-only command, the
runtime bundled with `waybetter/build` and a `waybetter.release.json` for `waybetter release`, with presets for
youtube.com, kick.com and twitch.tv and every site selector marked as a placeholder. Its tests
generate each kind into a temp folder and check it against the real contracts: plugin headers with
@@ -104,7 +105,7 @@ packages/runtime/src/ page runtime core (TypeScript, no dependencies)
column.ts deck columns: hide site chrome, fill the width, filters, unread count
linkRouting.ts divert in-page clicks to a pane/tab/browser per setting
accountReport.ts report the signed-in account of this tab's profile
-packages/shell/src/ shell core (TypeScript, no dependencies)
+packages/shell/src/ shell core (TypeScript) and the shell frame (React)
addressModel.ts address bar chips (site pages named by the adapter)
paneModel.ts beside-pane reuse, redundant rails, navRedundant for tabs_sync
deckModel.ts decks of site columns: bounded storage model, paging layout, focus
@@ -117,6 +118,7 @@ packages/shell/src/ shell core (TypeScript, no dependencies)
storeModel.ts storeMessages.ts Store wire types, item states, permission words; wb.store/install/permission.*
installController.ts the install screen's state machine (links, drops, store items, confirm)
InstallDialog.tsx StoreView.tsx store.css the install screen and the Store view (React peer, --wb-* tokens)
+ frame/ the shell frame: createShell(site) (see "The shell frame" below)
packages/waybetter/ the published npm package (runtime + shell as ESM + .d.ts, theme.schema.json,
store-catalog.schema.json, the `waybetter store build|sign|verify` and
`waybetter release windows|macos` commands, `waybetter/build`)
@@ -126,7 +128,64 @@ packages/create-waybetter/ `npm create waybetter`: plugin, theme and app scaffo
Both TypeScript packages are plain source (`.ts`, ESM, `type: module`) with no runtime
dependencies, so an app can bundle them with esbuild/Vite and run their tests with Node's type
-stripping. Anything that needs the Tauri API (window controls) takes it as a parameter.
+stripping. Anything that needs the Tauri API (window controls, the shell frame) takes it as a
+parameter. The React parts (the Store screens, the shell frame) have React, and the frame dockview,
+as optional peers: the app's copies are used.
+
+## The shell frame
+
+`packages/shell/src/frame` (`waybetter/shell/frame`) is the whole shell of a wayBetter app. An app
+describes its site and gets tabs in the titlebar row, split panes and link drags into the dock, the
+smart address bar, the new-tab page, the command palette, the account switcher, decks of site
+columns, workspaces, the developer-mode and sync chips, the gallery/clipboard panel, pane themes,
+its own panel tab, keyboard shortcuts, overlays that raise the shell above the tab webviews, the
+one-layout-in-flight `tabs_sync` and session restore:
+
+```tsx
+import { invoke } from '@tauri-apps/api/core'; // or window.__TAURI__ (withGlobalTauri)
+import { listen } from '@tauri-apps/api/event';
+import { getCurrentWindow } from '@tauri-apps/api/window';
+import { createShell, type ShellSite } from 'waybetter/shell/frame';
+
+const site: ShellSite = { name: 'Kick', product: 'wayBetter for Kick', homeUrl, loginUrl, logoutUrl,
+ isSiteUrl, accounts, searchUrl, address, panel: { id, title, component }, newTab, palette,
+ deck, media, themes, overlays, features, start };
+const Shell = createShell(site, { native: { invoke, listen, currentWindow: getCurrentWindow }, i18n });
+createRoot(root).render();
+```
+
+What the site supplies (`frame/site.ts`, every field documented there):
+
+- names and pages: `name` (in messages as `{site}`), `product`, `logo`, `homeUrl`, `loginUrl`,
+ `logoutUrl`, `isSiteUrl`, the account rules, `searchUrl` for typed text;
+- the address bar: `address(url)` (chips, usually `parseAddress` with an `AddressSite`) and an
+ optional `addressCompleter` (inline completions, e.g. search operators);
+- slots: `panel` (the app's own tab and its sections), `newTab` (search label, quick links),
+ `palette` (placeholder, the literal search, completions, the panel's sections, the site's pages),
+ `deck` (column kinds with labels and icons, the page each loads, titles, value parsing and
+ completions, column flags and presets, an optional compose dock), `media` (which pages have a
+ composer), `themes` (a `createThemeStore(adapter)`: the app's theme documents, chrome colors via
+ `chromeVars`, pane themes), `overlays` (the app's own dialogs), `start()` (read site settings,
+ call `siteChanged()` when site text changes);
+- `features`: the native features the app wires up (workspaces, sync, developer mode, plugin
+ palette commands); an app without them shows nothing of them.
+
+The frame's words are `wb.*` messages in the framework catalogs (51 languages; English source in
+`frame/frameMessages.ts`): the app passes its i18n instance with the framework catalogs merged in.
+Styles come with the components (dockview's, then `shell.css`, `deck.css`, `workspaces.css`,
+`accountSwitcher.css`, `paneTheme.css`); colors are `--wb-c-*` tokens with Night Ink fallbacks,
+set by the theme store (the chrome and each pane group) and cached for the first frame:
+`bootScript()` (`frame/boot.ts`) is the `boot.js` an app serves before its modules (a Vite plugin or
+a build step writes it). `installPreviewMocks(handlers)` answers native commands from memory, so
+the real shell renders in a plain browser for development previews and screenshots.
+
+Native commands the frame calls: the host's (`tabs_sync`, `tab_navigate`, `tab_action`,
+`shell_focus`, `shell_raise`, `open_external_url`, `window_system_menu`, `profiles_*`), and for the
+features an app turns on `settings_get`, `column_configure`, `workspaces_*`, `sync_*`, `dev_*`,
+`plugins_list`, `tab_run_command`, `media_get`/`gallery_*`/`clip_*`/`tab_attach_image`/
+`tab_insert_text`, `theme_scopes_*` and `gfonts_*`, `app_ready`/`update_status`/`apply_update`. It
+listens to `tab-state`, `tab-open`, `tab-shortcut`, `link-drag`, `open-panel`, `profiles-changed`,
+`tab-commands`, `dev-event`, `update-status`, `tab-still` and `clipboard-changed`.
## The site adapter
@@ -300,7 +359,10 @@ wayBetter for X adds this repository as a git submodule at `waybetter/` and cons
- Rust: a path dependency, `waybetter-host = { path = "../../../waybetter/crates/waybetter-host" }`,
with `features = ["app", "net", "macos-private-api"]` enabled by the app's desktop feature (and
as a build-dependency for `commands::manifest`).
-- TypeScript: relative imports of `waybetter/packages/*/src/*.ts` from a few adapter modules. The
+- TypeScript: relative imports of `waybetter/packages/*/src/*.ts`: the X site for the shell frame
+ (`src/shell/site.tsx`), the page runtime's adapter and a few X modules. Its Vite config dedupes
+ React, dockview and the Tauri API (the frame's imports use the app's copies) and serves
+ `bootScript()` as `/boot.js`. The
packages are not Bun workspace members of the app on purpose: the app's server CI clones without
submodules and runs `bun i`, which fails when a declared workspace package is missing; and Node's
type stripping refuses `.ts` files under `node_modules`, while sources outside it work with Bun's
diff --git a/packages/waybetter/README.md b/packages/waybetter/README.md
index 26dc72c..f634095 100644
--- a/packages/waybetter/README.md
+++ b/packages/waybetter/README.md
@@ -14,10 +14,15 @@ heavy Electron client alike: every wayBetter app is the same shell, runtime and
ranking and window controls. The Tauri window API is passed in by the caller, never imported.
And the wayBetter Store: the install screen and the Store view as React components (React is an
optional peer; everything else has no dependencies), their controller and models.
+- **`waybetter/shell/frame`**: the whole shell of an app, `createShell(site, { native, i18n })`:
+ tabs in the titlebar, split panes, the smart address bar, the new-tab page, the command palette,
+ the account switcher, decks of site columns, workspaces, pane themes, overlays and the native
+ layout sync. The app describes its site (pages, address chips, palette items, column kinds, its
+ own panel tab); React, React DOM and dockview are optional peers, the Tauri API is passed in.
- **`waybetter store build|sign|verify`** and **`waybetter/store-catalog.schema.json`**: the tooling
and JSON Schema of the shared, signed wayBetter Store catalog.
-Plain ESM with `.d.ts` types. Zero dependencies.
+Plain ESM with `.d.ts` types. Zero dependencies (the React parts use your React; the shell frame also dockview).
## Install
@@ -71,6 +76,20 @@ pieces. The source comments document each module's contract.
- `installController`: the install screen's state (install links, dropped files, store items, confirm), given the app's native bridge and theme adapter.
- `InstallDialog` (`InstallHost`), `StoreView`, `store.css`: the install screen, the window drop target and the Store view, themed with `--wb-*` tokens. See docs/STORE.md in the repository.
+**Shell frame** (`waybetter/shell/frame`, modules also as `waybetter/shell/frame/*`, styles as `waybetter/shell/frame/*.css`)
+
+```tsx
+import { createShell, type ShellSite } from 'waybetter/shell/frame';
+const Shell = createShell(site, { native: { invoke, listen, currentWindow: getCurrentWindow }, i18n });
+createRoot(document.getElementById('root')!).render();
+```
+
+- `ShellSite` (`frame/site`): the site's names and pages, `address(url)` chips, slots for the app's panel tab, the new-tab page, palette items, deck column kinds, the media panel, themes (`createThemeStore`) and overlays, and the native `features` the app serves.
+- `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.
+- 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.
+
**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).