shell: the shell frame, createShell(site) (moved from wayBetter for X)
packages/shell/src/frame (waybetter/shell/frame): the whole shell of an app. An app describes its site (ShellSite: names and pages, account rules, search, address chips and completions, its panel tab, the new-tab page, palette items, deck column kinds and flags and an optional compose dock, the media panel's composer rule, a theme store, overlays, the native features it serves) and passes its Tauri API and i18n instance; createShell returns the root component. - Shell.tsx: dockview host (tabs in the titlebar row, splits, drag-link drops, shortcuts, context menu, deck back-and-forth, session restore, workspace on start, overlay raise); state.ts (pane placeholders, tabs_sync one-in-flight via syncGate, shell_raise layer, profiles, layout). - WebPanel (address bar), NewTabPage, CommandPalette + paletteModel (frame groups; site items), DeckView + AddColumnDialog + deckStore (site column kinds), PaneTheme + themeStore (createThemeStore over the app's ThemeAdapter) + chromeTheme (ChromeTheme input) + themeScopes, Titlebar + TitlebarExtras + icons + brand (wB mark data URI), AccountSwitcher + accountModel, workspaces + workspaceModel, backupModel, syncHost, devHost + devModel, pluginCommandStore, MediaPanel + mediaModel, searchInput, hooks, bridge (installPreviewMocks), i18n, boot.ts (bootScript: the first-frame boot.js), CSS themed with --wb-* tokens. - paneModel: paneVisibility, raiseSupported, cssRgb; deckModel: isSourcePage. - Includes the live-QA titlebar fix (dock ResizeObserver + rAF titlebar marks, dock sized by its insets). - tests/frame.test.ts: every frame key has English and is used, palette order with a site, address fallback, layout gate, boot script, chrome variables, switcher rules, workspaces, deck settings with site flags. - npm package 0.4.0: exports ./shell/frame, ./shell/frame/*, ./shell/frame/*.css (copied by the build); dockview and acorn optional peers; root devDependencies dockview, acorn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
37e3d8e5fc
commit
60faed66be
49 changed files with 6442 additions and 6 deletions
61
packages/shell/src/frame/icons.tsx
Normal file
61
packages/shell/src/frame/icons.tsx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// Shared 24px stroke glyphs for the shell chrome (1.75 stroke, round joins; sized by CSS).
|
||||
|
||||
export const ICONS = {
|
||||
back: 'M15 5l-7 7 7 7',
|
||||
forward: 'M9 5l7 7-7 7',
|
||||
reload: 'M20 12a8 8 0 1 1-2.34-5.66M20 4v5h-5',
|
||||
stop: 'M6 6l12 12M18 6L6 18',
|
||||
close: 'M7 7l10 10M17 7L7 17',
|
||||
plus: 'M12 5v14M5 12h14',
|
||||
external: 'M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5',
|
||||
split: 'M4 5h16v14H4zM12 5v14',
|
||||
splitDown: 'M4 5h16v14H4zM4 12h16',
|
||||
chevron: 'M7 10l5 5 5-5',
|
||||
check: 'M5 12.5l4.5 4.5L19 7.5',
|
||||
pin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7',
|
||||
unpin: 'M9 4h6l-1 6 3 3H7l3-3zM12 13v7M4 4l16 16',
|
||||
copy: 'M9 9h10v11H9zM5 15V4h10',
|
||||
duplicate: 'M8 8h11v11H8zM5 16V5h11',
|
||||
closeOthers: 'M4 6h16M4 12h10M4 18h7M15 15l5 5M20 15l-5 5',
|
||||
search: 'M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4',
|
||||
home: 'M4 11l8-7 8 7M6 9.5V20h4.5v-5.5h3V20H18V9.5',
|
||||
bell: 'M6 16V11a6 6 0 1 1 12 0v5l1.5 2h-15zM10 20.5h4',
|
||||
bookmark: 'M7 4h10v16l-5-4-5 4z',
|
||||
mail: 'M4 6h16v12H4zM4 7l8 6 8-6',
|
||||
list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',
|
||||
explore: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM15.5 8.5l-2 5-5 2 2-5z',
|
||||
globe: 'M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18',
|
||||
settings: 'M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zM19.4 13.5l1.6 1.2-2 3.4-1.9-.7a7 7 0 0 1-2 1.2L14.8 21h-4l-.3-2.4a7 7 0 0 1-2-1.2l-1.9.7-2-3.4 1.6-1.2a7 7 0 0 1 0-2.4L4.6 9.9l2-3.4 1.9.7a7 7 0 0 1 2-1.2L10.8 3.6h4l.3 2.4a7 7 0 0 1 2 1.2l1.9-.7 2 3.4-1.6 1.2a7 7 0 0 1 0 2.4z',
|
||||
palette: 'M12 21a9 9 0 1 1 9-9c0 2-1.5 3-3.5 3H16a2 2 0 0 0-1.5 3.3A1.6 1.6 0 0 1 12 21zM7.5 11h.01M10 7.5h.01M14.5 7.5h.01',
|
||||
image: 'M4 5h16v14H4zM4 16l5-5 4 4 2-2 5 5M15 9.5h.01',
|
||||
draft: 'M5 20h4L20 9l-4-4L5 16zM14 7l4 4',
|
||||
user: 'M12 12a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM4.5 20a7.5 7.5 0 0 1 15 0',
|
||||
sparkle: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z',
|
||||
bolt: 'M13 3L5 14h6l-1 7 8-11h-6z',
|
||||
filter: 'M4 5h16l-6 7v6l-4 2v-8z',
|
||||
history: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5M12 8v4l3 2',
|
||||
trash: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
|
||||
edit: 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4',
|
||||
grid: 'M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z',
|
||||
} as const;
|
||||
|
||||
export type IconName = keyof typeof ICONS;
|
||||
|
||||
export const Icon = ({ name, className }: { name: IconName; className?: string }) =>
|
||||
<svg className={className ? `bt-glyph ${className}` : 'bt-glyph'} viewBox="0 0 24 24" aria-hidden="true"><path d={ICONS[name]}/></svg>;
|
||||
|
||||
/** Readable initial on a profile color: dark ink on light colors, white on dark ones. */
|
||||
export function inkOn(hex: string): string {
|
||||
const value = Number.parseInt(hex.slice(1), 16);
|
||||
const [r, g, b] = [(value >> 16) & 255, (value >> 8) & 255, value & 255];
|
||||
return (0.299 * r + 0.587 * g + 0.114 * b) > 150 ? '#0b0d12' : '#ffffff';
|
||||
}
|
||||
|
||||
export const initial = (name: string) => ([...name.trim()][0] ?? '?').toUpperCase();
|
||||
|
||||
/** Round account avatar: the profile's initial on its color. */
|
||||
/** An account's X profile picture when known (`src`), else its initial on the profile color. */
|
||||
export const Avatar = ({ name, color, size = 20, className = '', src }: { name: string; color: string; size?: number; className?: string; src?: string }) =>
|
||||
<span className={`bt-avatar ${src ? 'bt-avatar--image' : ''} ${className}`} aria-hidden="true"
|
||||
style={{ width: size, height: size, flexBasis: size, background: color, color: inkOn(color), fontSize: Math.round(size * 0.46) }}>
|
||||
{src ? <img src={src} alt="" width={size} height={size} draggable={false} referrerPolicy="no-referrer"/> : initial(name)}</span>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue