The app menu's "Report a problem…" opens a small dialog with the summary (reportModel.ts, English on purpose: the people who read reports do): the app and framework versions, the system and webview (coarse, from the user agent), the language and how it was chosen, the mode, the theme and icon pack ids, the file names of the plugins that are on, what paused itself (the panel's `reportDetails`), and safe mode. The model has no field for an account, a handle, an address, a tab or a path, and a value that is not made of id characters is left out rather than trimmed into shape, so nothing of that kind can ride along (tested with hostile input). The dialog sends nothing: Copy puts the text on the clipboard, and "Open the issue page" opens `ShellSite.menu.report.issueUrl` bare in the system browser (the summary is never put in a URL). Without an issue page the button is off and the dialog says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
3.5 KiB
TypeScript
62 lines
3.5 KiB
TypeScript
// 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(<Shell/>);
|
|
|
|
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';
|