// The wayBetter shell frame: `createShell(site, options)` gives an app the whole shell (tabs in the // titlebar row, splits, the smart address bar, the new-tab page, the command palette, the account // switcher, decks of site columns, workspaces, developer mode and sync chips, the media panel, // pane themes, overlays and the native layout sync). The app describes its site (`ShellSite`) and // passes its Tauri API and i18n instance; styles come with the components (`--wb-*` tokens). // // const Shell = createShell(site, { native: { invoke, listen, currentWindow: getCurrentWindow }, i18n }); // createRoot(root).render(); import type { ComponentType } from 'react'; import { setNative, type NativeApi } from './bridge.ts'; import { decks, defaultDeckSettings } from './deckStore.ts'; import { setShellI18n, setTextDefaults, type ShellI18n } from './i18n.ts'; import Shell, { setDevBuild } from './Shell.tsx'; import { configureSite, type ShellSite } from './site.ts'; import { probeLayer, shell } from './state.ts'; export type ShellOptions = { /** The app's Tauri API: `invoke` and `listen` from @tauri-apps/api, and `getCurrentWindow`. */ native: NativeApi; /** The app's i18n instance (waybetter/i18n `createI18n`, the framework catalogs merged in). */ i18n: ShellI18n; /** A development build (keeps the devtools shortcut). */ dev?: boolean; }; /** * Sets the site and the app's native API and language for every frame module, and returns the * shell's root component. Call once, before anything of the frame renders (the app's own panel * may render the frame's pieces, e.g. in a preview, without the shell). */ export function createShell(site: ShellSite, options: ShellOptions): ComponentType { setNative(options.native); setShellI18n(options.i18n); setTextDefaults({ site: site.name }); configureSite(site); setDevBuild(!!options.dev); shell.homeUrl = site.homeUrl; decks.settings = defaultDeckSettings(); probeLayer(); return Shell; } export type { ShellSite, DeckSite, PaletteSite, ColumnKind, ColumnFlag, DeckPreset, Completer, Suggestion } from './site.ts'; export { site, siteChanged } from './site.ts'; export type { NativeApi, Invoke, Listen, ShellWindow, MockHandler } from './bridge.ts'; export { invoke, listen, isNative, installPreviewMocks } from './bridge.ts'; export type { ShellI18n } from './i18n.ts'; export { setShellI18n } from './i18n.ts'; export { bootScript, BOOT_CACHE_KEY } from './boot.ts'; export { createThemeStore, type ThemeAdapter, type ThemeStore, type ThemeDoc, type InstalledFont, type Weights } from './themeStore.ts'; export { chromeVars, CHROME_VAR_NAMES, SHELL_UI_FONT, SHELL_MONO_FONT, type ChromeTheme } from './chromeTheme.ts'; export { shell, setOverlay, scheduleSync, flushSync, isWeb, tabAction, setProfiles, type TabParams, type WebParams } from './state.ts'; export type { PaletteItem, PaletteAction, PaletteContext } from './paletteModel.ts'; export { Icon, Avatar, ICONS, type IconName } from './icons.tsx'; export { DEFAULT_MENU, MENU_BUILTINS, MENU_MESSAGES, menuWith, menuWithout, type BuiltinMenuItem, type MenuEntry, type MenuGroups, type MenuItemSpec, type MenuLanguages, type MenuModes, type ReportDetails, type ShellMenu, } from './menuModel.ts'; export { openAppMenu, type AppMenuRequest } from './AppMenu.tsx'; export { createLanguage, resolveLocale, type Language, type LanguageOptions, type LanguagePreference } from './language.ts'; export { createAppI18n, type AppI18n, type AppI18nOptions, type AppLanguage } from './appI18n.ts';