@tearleads/windowing 0.2.45 → 0.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,8 @@
7
7
  * apps, is left out. It has no toolbar actions, so its window shows no
8
8
  * toolbar row.
9
9
  */
10
- export declare function DisplayProperties({ startMenuAppIds, }?: {
10
+ export declare function DisplayProperties({ section, startMenuAppIds, }?: {
11
+ /** Limit a tabbed host to the controls on its selected tab. */
12
+ section?: "desktop" | "system-tray" | "start-menu";
11
13
  startMenuAppIds?: readonly string[];
12
14
  }): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
3
  import { resolveLauncherOrder } from "../launcher/launcherDefinition.js";
4
4
  import { useOptionalStartMenuPreferences } from "../menu/StartMenuPreferencesProvider.js";
@@ -61,8 +61,8 @@ function StartMenuSection({ appIds, }) {
61
61
  * apps, is left out. It has no toolbar actions, so its window shows no
62
62
  * toolbar row.
63
63
  */
64
- export function DisplayProperties({ startMenuAppIds, } = {}) {
64
+ export function DisplayProperties({ section, startMenuAppIds, } = {}) {
65
65
  useSuppressWindowToolbar(true);
66
- return (_jsxs("div", { className: "display-properties", children: [_jsx(BackgroundSection, {}), _jsx(ThemeSection, {}), _jsx(SystemTraySection, {}), _jsx(StartMenuSection, { appIds: startMenuAppIds })] }));
66
+ return (_jsxs("div", { className: "display-properties", children: [(!section || section === "desktop") && (_jsxs(_Fragment, { children: [_jsx(BackgroundSection, {}), _jsx(ThemeSection, {})] })), (!section || section === "system-tray") && _jsx(SystemTraySection, {}), (!section || section === "start-menu") && (_jsx(StartMenuSection, { appIds: startMenuAppIds }))] }));
67
67
  }
68
68
  //# sourceMappingURL=DisplayProperties.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayProperties.js","sour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AAC;IAC7B,OAAO,CACL,oBAAU,SAAS,EAAC,4BAA4B,aAC9C,0CAA2B,EAC3B,cAAK,SAAS,EAAC,8BAA8B,YAC1C,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;oBACd,MAAM,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAC5C,OAAO,CACL,GAAG,IAAI,CACL,KAAC,SAAS,IAER,IAAI,EAAE,GAAG,CAAC,IAAI,EACd,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,KAAK,EACjC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,EAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,IALrD,EAAE,CAMP,CACH,CACF,CAAC;gBACJ,CAAC,CAAC,GACE,IACG,CACZ,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,eAAe,MAGb,EAAE;IACJ,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,CACL,eAAK,SAAS,EAAC,oBAAoB,aACjC,KAAC,iBAAiB,KAAG,EACrB,KAAC,YAAY,KAAG,EAChB,KAAC,iBAAiB,KAAG,EACrB,KAAC,gBAAgB,IAAC,MAAM,EAAE,eAAe,GAAI,IACzC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useId } from \"react\";\nimport { resolveLauncherOrder } from \"../launcher/launcherDefinition\";\nimport { useOptionalStartMenuPreferences } from \"../menu/StartMenuPreferencesProvider\";\nimport { useOptionalTheme } from \"../theme/ThemeProvider\";\nimport { useOptionalSystemTray } from \"../tray/SystemTrayProvider\";\nimport { useOptionalWallpaper } from \"../wallpaper/WallpaperProvider\";\nimport { wallpaperStyle } from \"../wallpaper/wallpapers\";\nimport { useSuppressWindowToolbar } from \"../window/CurrentWindowContext\";\nimport { AppSwitch } from \"./AppSwitch\";\nimport \"../wallpaper/Wallpaper.css\";\nimport \"./DisplayProperties.css\";\n\nfunction BackgroundSection() {\n const wallpaper = useOptionalWallpaper();\n const name = useId();\n if (!wallpaper) {\n return null;\n }\n return (\n <fieldset className=\"display-properties-section\">\n <legend>Background</legend>\n <div className=\"display-properties-wallpapers\">\n {wallpaper.wallpapers.map((option) => (\n <label className=\"display-properties-wallpaper\" key={option.id}>\n <input\n checked={option.id === wallpaper.activeWallpaper.id}\n className=\"display-properties-input\"\n name={name}\n onChange={() => wallpaper.setWallpaper(option.id)}\n type=\"radio\"\n value={option.id}\n />\n <span\n aria-hidden=\"true\"\n className=\"display-properties-swatch wallpaper-pattern\"\n data-pattern={option.tile ? \"\" : undefined}\n style={wallpaperStyle(option)}\n />\n <span className=\"display-properties-label\">{option.label}</span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n\nfunction ThemeSection() {\n const theme = useOptionalTheme();\n const name = useId();\n if (!theme || theme.themes.length < 2) {\n return null;\n }\n return (\n <fieldset className=\"display-properties-section\">\n <legend>Theme</legend>\n <div className=\"display-properties-themes\">\n {theme.themes.map((option) => (\n <label className=\"display-properties-theme\" key={option.id}>\n <input\n checked={option.id === theme.activeTheme.id}\n className=\"display-properties-input\"\n name={name}\n onChange={() => theme.setTheme(option.id)}\n type=\"radio\"\n value={option.id}\n />\n <span className=\"display-properties-label\">{option.label}</span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n\nfunction SystemTraySection() {\n const tray = useOptionalSystemTray();\n if (!tray || tray.definition.order.length === 0) {\n return null;\n }\n const { definition, isEnabled, setEnabled } = tray;\n return (\n <fieldset className=\"display-properties-section\">\n <legend>System Tray</legend>\n <div className=\"display-properties-tray-apps\">\n {definition.order.map((id) => {\n const app = definition.apps[id];\n if (!app) {\n return null;\n }\n return (\n <AppSwitch\n key={id}\n className=\"display-properties-tray-app\"\n icon={app.icon}\n title={app.title}\n checked={isEnabled(id)}\n onChange={(enabled) => setEnabled(id, enabled)}\n />\n );\n })}\n </div>\n </fieldset>\n );\n}\n\nfunction StartMenuSection({\n appIds,\n}: {\n appIds?: readonly string[] | undefined;\n}) {\n const preferences = useOptionalStartMenuPreferences();\n if (!preferences) return null;\n const ids = (appIds ?? resolveLauncherOrder(preferences.definition)).filter(\n (id) => preferences.configurableIds.includes(id),\n );\n if (!ids.length) return null;\n return (\n <fieldset className=\"display-properties-section\">\n <legend>Start menu</legend>\n <div className=\"display-properties-menu-apps\">\n {ids.map((id) => {\n const app = preferences.definition.apps[id];\n return (\n app && (\n <AppSwitch\n key={id}\n icon={app.icon}\n className=\"display-properties-menu-app\"\n title={app.iconLabel ?? app.title}\n checked={preferences.isVisible(id)}\n onChange={(visible) => preferences.setVisible(id, visible)}\n />\n )\n );\n })}\n </div>\n </fieldset>\n );\n}\n\n/**\n * The display settings, for a host's Display Properties mini-app: the\n * desktop's background, from the nearest {@link WallpaperProvider}; the color\n * theme, from the nearest {@link ThemeProvider}; and a switch per tray app,\n * from the nearest {@link SystemTrayProvider}. Each choice applies at once. A\n * section whose provider is missing, or that offers one theme or no tray\n * apps, is left out. It has no toolbar actions, so its window shows no\n * toolbar row.\n */\nexport function DisplayProperties({\n startMenuAppIds,\n}: {\n startMenuAppIds?: readonly string[];\n} = {}) {\n useSuppressWindowToolbar(true);\n return (\n <div className=\"display-properties\">\n <BackgroundSection />\n <ThemeSection />\n <SystemTraySection />\n <StartMenuSection appIds={startMenuAppIds} />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"DisplayProperties.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/display/DisplayProperties.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,C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AC;oBAC5C,OAAO,CACL,GAAG,IAAI,CACL,KAAC,SAAS,IAER,IAAI,EAAE,GAAG,CAAC,IAAI,EACd,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,KAAK,EACjC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,EAClC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,IALrD,EAAE,CAMP,CACH,CACF,CAAC;gBACJ,CAAC,CAAC,GACE,IACG,CACZ,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,EACP,eAAe,MAKb,EAAE;IACJ,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,CACL,eAAK,SAAS,EAAC,oBAAoB,aAChC,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,SAAS,CAAC,IAAI,CACtC,8BACE,KAAC,iBAAiB,KAAG,EACrB,KAAC,YAAY,KAAG,IACf,CACJ,EACA,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,aAAa,CAAC,IAAI,KAAC,iBAAiB,KAAG,EAChE,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,YAAY,CAAC,IAAI,CACzC,KAAC,gBAAgB,IAAC,MAAM,EAAE,eAAe,GAAI,CAC9C,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useId } from \"react\";\nimport { resolveLauncherOrder } from \"../launcher/launcherDefinition\";\nimport { useOptionalStartMenuPreferences } from \"../menu/StartMenuPreferencesProvider\";\nimport { useOptionalTheme } from \"../theme/ThemeProvider\";\nimport { useOptionalSystemTray } from \"../tray/SystemTrayProvider\";\nimport { useOptionalWallpaper } from \"../wallpaper/WallpaperProvider\";\nimport { wallpaperStyle } from \"../wallpaper/wallpapers\";\nimport { useSuppressWindowToolbar } from \"../window/CurrentWindowContext\";\nimport { AppSwitch } from \"./AppSwitch\";\nimport \"../wallpaper/Wallpaper.css\";\nimport \"./DisplayProperties.css\";\n\nfunction BackgroundSection() {\n const wallpaper = useOptionalWallpaper();\n const name = useId();\n if (!wallpaper) {\n return null;\n }\n return (\n <fieldset className=\"display-properties-section\">\n <legend>Background</legend>\n <div className=\"display-properties-wallpapers\">\n {wallpaper.wallpapers.map((option) => (\n <label className=\"display-properties-wallpaper\" key={option.id}>\n <input\n checked={option.id === wallpaper.activeWallpaper.id}\n className=\"display-properties-input\"\n name={name}\n onChange={() => wallpaper.setWallpaper(option.id)}\n type=\"radio\"\n value={option.id}\n />\n <span\n aria-hidden=\"true\"\n className=\"display-properties-swatch wallpaper-pattern\"\n data-pattern={option.tile ? \"\" : undefined}\n style={wallpaperStyle(option)}\n />\n <span className=\"display-properties-label\">{option.label}</span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n\nfunction ThemeSection() {\n const theme = useOptionalTheme();\n const name = useId();\n if (!theme || theme.themes.length < 2) {\n return null;\n }\n return (\n <fieldset className=\"display-properties-section\">\n <legend>Theme</legend>\n <div className=\"display-properties-themes\">\n {theme.themes.map((option) => (\n <label className=\"display-properties-theme\" key={option.id}>\n <input\n checked={option.id === theme.activeTheme.id}\n className=\"display-properties-input\"\n name={name}\n onChange={() => theme.setTheme(option.id)}\n type=\"radio\"\n value={option.id}\n />\n <span className=\"display-properties-label\">{option.label}</span>\n </label>\n ))}\n </div>\n </fieldset>\n );\n}\n\nfunction SystemTraySection() {\n const tray = useOptionalSystemTray();\n if (!tray || tray.definition.order.length === 0) {\n return null;\n }\n const { definition, isEnabled, setEnabled } = tray;\n return (\n <fieldset className=\"display-properties-section\">\n <legend>System Tray</legend>\n <div className=\"display-properties-tray-apps\">\n {definition.order.map((id) => {\n const app = definition.apps[id];\n if (!app) {\n return null;\n }\n return (\n <AppSwitch\n key={id}\n className=\"display-properties-tray-app\"\n icon={app.icon}\n title={app.title}\n checked={isEnabled(id)}\n onChange={(enabled) => setEnabled(id, enabled)}\n />\n );\n })}\n </div>\n </fieldset>\n );\n}\n\nfunction StartMenuSection({\n appIds,\n}: {\n appIds?: readonly string[] | undefined;\n}) {\n const preferences = useOptionalStartMenuPreferences();\n if (!preferences) return null;\n const ids = (appIds ?? resolveLauncherOrder(preferences.definition)).filter(\n (id) => preferences.configurableIds.includes(id),\n );\n if (!ids.length) return null;\n return (\n <fieldset className=\"display-properties-section\">\n <legend>Start menu</legend>\n <div className=\"display-properties-menu-apps\">\n {ids.map((id) => {\n const app = preferences.definition.apps[id];\n return (\n app && (\n <AppSwitch\n key={id}\n icon={app.icon}\n className=\"display-properties-menu-app\"\n title={app.iconLabel ?? app.title}\n checked={preferences.isVisible(id)}\n onChange={(visible) => preferences.setVisible(id, visible)}\n />\n )\n );\n })}\n </div>\n </fieldset>\n );\n}\n\n/**\n * The display settings, for a host's Display Properties mini-app: the\n * desktop's background, from the nearest {@link WallpaperProvider}; the color\n * theme, from the nearest {@link ThemeProvider}; and a switch per tray app,\n * from the nearest {@link SystemTrayProvider}. Each choice applies at once. A\n * section whose provider is missing, or that offers one theme or no tray\n * apps, is left out. It has no toolbar actions, so its window shows no\n * toolbar row.\n */\nexport function DisplayProperties({\n section,\n startMenuAppIds,\n}: {\n /** Limit a tabbed host to the controls on its selected tab. */\n section?: \"desktop\" | \"system-tray\" | \"start-menu\";\n startMenuAppIds?: readonly string[];\n} = {}) {\n useSuppressWindowToolbar(true);\n return (\n <div className=\"display-properties\">\n {(!section || section === \"desktop\") && (\n <>\n <BackgroundSection />\n <ThemeSection />\n </>\n )}\n {(!section || section === \"system-tray\") && <SystemTraySection />}\n {(!section || section === \"start-menu\") && (\n <StartMenuSection appIds={startMenuAppIds} />\n )}\n </div>\n );\n}\n"]}
@@ -23,6 +23,8 @@ export interface StartMenuProps {
23
23
  icon: ReactNode;
24
24
  /** The menu's entries, in order. Ignored when `renderMenu` is given. */
25
25
  items?: readonly StartMenuItem[] | undefined;
26
+ /** Offer Start menu settings on a secondary click. */
27
+ onOpenSettings?: (() => void) | undefined;
26
28
  /** The button's accessible name. */
27
29
  label?: string | undefined;
28
30
  /**
@@ -39,4 +41,4 @@ export interface StartMenuProps {
39
41
  * opens a menu above its top-left corner. Give it `items` for a list of
40
42
  * entries, or `renderMenu` to render the menu yourself.
41
43
  */
42
- export declare function StartMenu({ className, icon, items, label, renderMenu, }: StartMenuProps): import("react").JSX.Element;
44
+ export declare function StartMenu({ className, icon, items, label, onOpenSettings, renderMenu, }: StartMenuProps): import("react").JSX.Element;
package/menu/StartMenu.js CHANGED
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { Menu } from "./Menu.js";
3
3
  import { MenuItem } from "./MenuItem.js";
4
4
  import "./StartMenu.css";
5
+ import { StartMenuButton } from "./StartMenuButton.js";
5
6
  import { useOptionalStartMenuPreferences } from "./StartMenuPreferencesProvider.js";
6
7
  import { useContextMenuPositionState } from "./useContextMenuState.js";
7
8
  /**
@@ -9,10 +10,10 @@ import { useContextMenuPositionState } from "./useContextMenuState.js";
9
10
  * opens a menu above its top-left corner. Give it `items` for a list of
10
11
  * entries, or `renderMenu` to render the menu yourself.
11
12
  */
12
- export function StartMenu({ className, icon, items = [], label = "Menu", renderMenu, }) {
13
+ export function StartMenu({ className, icon, items = [], label = "Menu", onOpenSettings, renderMenu, }) {
13
14
  const preferences = useOptionalStartMenuPreferences();
14
15
  const { closeContextMenu: close, contextMenu: position, openContextMenuAt, } = useContextMenuPositionState();
15
- return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: className ?? "start-menu-button", "aria-label": label, "aria-haspopup": "menu", "aria-expanded": position !== null, onClick: (event) => {
16
+ return (_jsxs(_Fragment, { children: [_jsx(StartMenuButton, { onOpenSettings: onOpenSettings, className: className ?? "start-menu-button", "aria-label": label, "aria-haspopup": "menu", "aria-expanded": position !== null, onClick: (event) => {
16
17
  const bounds = event.currentTarget.getBoundingClientRect();
17
18
  openContextMenuAt({ x: bounds.left, y: bounds.top });
18
19
  }, children: icon }), position &&
@@ -1 +1 @@
1
- {"version":3,"file":"StartMenu.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/menu/StartMenu.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAqB,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAoCpE;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,SAAS,EACT,IAAI,EACJ,KAAK,GAAG,EAAE,EACV,KAAK,GAAG,MAAM,EACd,UAAU,GACK;IACf,MAAM,WAAW,GAAG,+BAA+B,EAAE,CAAC;IACtD,MAAM,EACJ,gBAAgB,EAAE,KAAK,EACvB,WAAW,EAAE,QAAQ,EACrB,iBAAiB,GAClB,GAAG,2BAA2B,EAAE,CAAC;IAElC,OAAO,CACL,8BACE,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,SAAS,IAAI,mBAAmB,gBAC/B,KAAK,mBACH,MAAM,mBACL,QAAQ,KAAK,IAAI,EAChC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBACjB,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;oBAC3D,iBAAiB,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;gBACvD,CAAC,YAEA,IAAI,GACE,EACR,QAAQ;gBACP,CAAC,UAAU,CAAC,CAAC,CAAC,CACZ,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAChC,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,YACrC,KAAK;yBACH,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;yBACzD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACb,KAAC,QAAQ,IAEP,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,EAAE,CAAC;4BACR,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;wBAC1B,CAAC,IAPI,IAAI,CAAC,EAAE,CAQZ,CACH,CAAC,GACC,CACR,CAAC,IACH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { Menu, type MenuPosition } from \"./Menu\";\nimport { MenuItem } from \"./MenuItem\";\nimport \"./StartMenu.css\";\nimport { useOptionalStartMenuPreferences } from \"./StartMenuPreferencesProvider\";\nimport { useContextMenuPositionState } from \"./useContextMenuState\";\n\n/** One entry in a {@link StartMenu}. */\nexport interface StartMenuItem {\n disabled?: boolean | undefined;\n icon?: WindowingIcon | undefined;\n id: string;\n label: string;\n /**\n * Runs when the item is chosen, after the menu closes. `position` is where\n * the menu opened, for placing what the item opens near it.\n */\n onSelect: (position: MenuPosition) => void;\n}\n\nexport interface StartMenuProps {\n /**\n * Classes for the button. They replace the default `start-menu-button`\n * styling, so a host's own button styles apply alone.\n */\n className?: string | undefined;\n /** What the button shows, such as a logo or an icon. */\n icon: ReactNode;\n /** The menu's entries, in order. Ignored when `renderMenu` is given. */\n items?: readonly StartMenuItem[] | undefined;\n /** The button's accessible name. */\n label?: string | undefined;\n /**\n * Renders the open menu itself, such as a `Menu` whose content needs more\n * than a list of items, in place of `items`. Call `close` to close it.\n */\n renderMenu?:\n | ((menu: { close: () => void; position: MenuPosition }) => ReactNode)\n | undefined;\n}\n\n/**\n * A taskbar's start menu: a button, usually at the bar's leading edge, that\n * opens a menu above its top-left corner. Give it `items` for a list of\n * entries, or `renderMenu` to render the menu yourself.\n */\nexport function StartMenu({\n className,\n icon,\n items = [],\n label = \"Menu\",\n renderMenu,\n}: StartMenuProps) {\n const preferences = useOptionalStartMenuPreferences();\n const {\n closeContextMenu: close,\n contextMenu: position,\n openContextMenuAt,\n } = useContextMenuPositionState();\n\n return (\n <>\n <button\n type=\"button\"\n className={className ?? \"start-menu-button\"}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={position !== null}\n onClick={(event) => {\n const bounds = event.currentTarget.getBoundingClientRect();\n openContextMenuAt({ x: bounds.left, y: bounds.top });\n }}\n >\n {icon}\n </button>\n {position &&\n (renderMenu ? (\n renderMenu({ close, position })\n ) : (\n <Menu position={position} onClose={close}>\n {items\n .filter((item) => preferences?.isVisible(item.id) ?? true)\n .map((item) => (\n <MenuItem\n key={item.id}\n disabled={item.disabled}\n icon={item.icon}\n label={item.label}\n onClick={() => {\n close();\n item.onSelect(position);\n }}\n />\n ))}\n </Menu>\n ))}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"StartMenu.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/menu/StartMenu.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAqB,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAsCpE;;;;GAIG;AACH,MAAM,U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IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;wBAC1B,CAAC,IAPI,IAAI,CAAC,EAAE,CAQZ,CACH,CAAC,GACC,CACR,CAAC,IACH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { Menu, type MenuPosition } from \"./Menu\";\nimport { MenuItem } from \"./MenuItem\";\nimport \"./StartMenu.css\";\nimport { StartMenuButton } from \"./StartMenuButton\";\nimport { useOptionalStartMenuPreferences } from \"./StartMenuPreferencesProvider\";\nimport { useContextMenuPositionState } from \"./useContextMenuState\";\n\n/** One entry in a {@link StartMenu}. */\nexport interface StartMenuItem {\n disabled?: boolean | undefined;\n icon?: WindowingIcon | undefined;\n id: string;\n label: string;\n /**\n * Runs when the item is chosen, after the menu closes. `position` is where\n * the menu opened, for placing what the item opens near it.\n */\n onSelect: (position: MenuPosition) => void;\n}\n\nexport interface StartMenuProps {\n /**\n * Classes for the button. They replace the default `start-menu-button`\n * styling, so a host's own button styles apply alone.\n */\n className?: string | undefined;\n /** What the button shows, such as a logo or an icon. */\n icon: ReactNode;\n /** The menu's entries, in order. Ignored when `renderMenu` is given. */\n items?: readonly StartMenuItem[] | undefined;\n /** Offer Start menu settings on a secondary click. */\n onOpenSettings?: (() => void) | undefined;\n /** The button's accessible name. */\n label?: string | undefined;\n /**\n * Renders the open menu itself, such as a `Menu` whose content needs more\n * than a list of items, in place of `items`. Call `close` to close it.\n */\n renderMenu?:\n | ((menu: { close: () => void; position: MenuPosition }) => ReactNode)\n | undefined;\n}\n\n/**\n * A taskbar's start menu: a button, usually at the bar's leading edge, that\n * opens a menu above its top-left corner. Give it `items` for a list of\n * entries, or `renderMenu` to render the menu yourself.\n */\nexport function StartMenu({\n className,\n icon,\n items = [],\n label = \"Menu\",\n onOpenSettings,\n renderMenu,\n}: StartMenuProps) {\n const preferences = useOptionalStartMenuPreferences();\n const {\n closeContextMenu: close,\n contextMenu: position,\n openContextMenuAt,\n } = useContextMenuPositionState();\n\n return (\n <>\n <StartMenuButton\n onOpenSettings={onOpenSettings}\n className={className ?? \"start-menu-button\"}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={position !== null}\n onClick={(event) => {\n const bounds = event.currentTarget.getBoundingClientRect();\n openContextMenuAt({ x: bounds.left, y: bounds.top });\n }}\n >\n {icon}\n </StartMenuButton>\n {position &&\n (renderMenu ? (\n renderMenu({ close, position })\n ) : (\n <Menu position={position} onClose={close}>\n {items\n .filter((item) => preferences?.isVisible(item.id) ?? true)\n .map((item) => (\n <MenuItem\n key={item.id}\n disabled={item.disabled}\n icon={item.icon}\n label={item.label}\n onClick={() => {\n close();\n item.onSelect(position);\n }}\n />\n ))}\n </Menu>\n ))}\n </>\n );\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { ComponentProps } from "react";
2
+ /** Both taskbars offer the host's Start menu settings on secondary click. */
3
+ export declare function StartMenuButton({ onOpenSettings, ...button }: ComponentProps<"button"> & {
4
+ onOpenSettings?: (() => void) | undefined;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Menu } from "./Menu.js";
3
+ import { MenuItem } from "./MenuItem.js";
4
+ import { useContextMenuState } from "./useContextMenuState.js";
5
+ import { useLongPress } from "./useLongPress.js";
6
+ /** Both taskbars offer the host's Start menu settings on secondary click. */
7
+ export function StartMenuButton({ onOpenSettings, ...button }) {
8
+ const { contextMenu, openContextMenu, closeContextMenu } = useContextMenuState();
9
+ const longPress = useLongPress(Boolean(onOpenSettings), {
10
+ emulateRightClick: true,
11
+ });
12
+ return (_jsxs(_Fragment, { children: [_jsx("button", { ...button, ...longPress, type: "button", onContextMenu: onOpenSettings && ((event) => openContextMenu(event, "settings")) }), contextMenu && onOpenSettings && (_jsx(Menu, { position: contextMenu.position, onClose: closeContextMenu, children: _jsx(MenuItem, { label: "Start menu settings", onClick: () => {
13
+ closeContextMenu();
14
+ onOpenSettings();
15
+ } }) }))] }));
16
+ }
17
+ //# sourceMappingURL=StartMenuButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StartMenuButton.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/menu/StartMenuButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAAC,EAC9B,cAAc,EACd,GAAG,MAAM,EACgE;IACzE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,GACtD,mBAAmB,EAAE,CAAC;IACxB,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;QACtD,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,OAAO,CACL,8BACE,oBACM,MAAM,KACN,SAAS,EACb,IAAI,EAAC,QAAQ,EACb,aAAa,EACX,cAAc,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,GAEnE,EACD,WAAW,IAAI,cAAc,IAAI,CAChC,KAAC,IAAI,IAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,YAC7D,KAAC,QAAQ,IACP,KAAK,EAAC,qBAAqB,EAC3B,OAAO,EAAE,GAAG,EAAE;wBACZ,gBAAgB,EAAE,CAAC;wBACnB,cAAc,EAAE,CAAC;oBACnB,CAAC,GACD,GACG,CACR,IACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import type { ComponentProps } from \"react\";\nimport { Menu } from \"./Menu\";\nimport { MenuItem } from \"./MenuItem\";\nimport { useContextMenuState } from \"./useContextMenuState\";\nimport { useLongPress } from \"./useLongPress\";\n\n/** Both taskbars offer the host's Start menu settings on secondary click. */\nexport function StartMenuButton({\n onOpenSettings,\n ...button\n}: ComponentProps<\"button\"> & { onOpenSettings?: (() => void) | undefined }) {\n const { contextMenu, openContextMenu, closeContextMenu } =\n useContextMenuState();\n const longPress = useLongPress(Boolean(onOpenSettings), {\n emulateRightClick: true,\n });\n\n return (\n <>\n <button\n {...button}\n {...longPress}\n type=\"button\"\n onContextMenu={\n onOpenSettings && ((event) => openContextMenu(event, \"settings\"))\n }\n />\n {contextMenu && onOpenSettings && (\n <Menu position={contextMenu.position} onClose={closeContextMenu}>\n <MenuItem\n label=\"Start menu settings\"\n onClick={() => {\n closeContextMenu();\n onOpenSettings();\n }}\n />\n </Menu>\n )}\n </>\n );\n}\n"]}
@@ -29,11 +29,8 @@ interface LongPressOptions {
29
29
  * verbatim. Mouse and pen pointers are ignored so right-click stays the desktop
30
30
  * affordance.
31
31
  *
32
- * After the long press fires we register a one-shot capturing `click` listener
33
- * on `window` to swallow the click the browser synthesizes on touch release —
34
- * `preventDefault()` on `pointerup` does NOT suppress that click per the Pointer
35
- * Events spec, so without this the element's `onClick` (navigate/select) would
36
- * also run.
32
+ * After the hold fires, consume the mouse events synthesized on touch release
33
+ * so they cannot dismiss the menu or also activate its trigger.
37
34
  *
38
35
  * Pass `enabled: false` (e.g. when no context-menu handler is wired) to make the
39
36
  * returned handlers no-ops.
@@ -31,6 +31,39 @@ function deliverLongPress(element, point, emulateRightClick) {
31
31
  }
32
32
  element.dispatchEvent(new MouseEvent("contextmenu", init));
33
33
  }
34
+ // On release a browser may send mousedown (which dismisses an outside menu)
35
+ // and click (which activates the trigger). Consume that gesture through click,
36
+ // and always yield to the next genuine pointer or keyboard interaction.
37
+ function suppressLongPressRelease() {
38
+ let timeout;
39
+ const remove = () => {
40
+ clearTimeout(timeout);
41
+ window.removeEventListener("mousedown", suppressMouse, true);
42
+ window.removeEventListener("click", suppressMouse, true);
43
+ window.removeEventListener("pointerup", expire, true);
44
+ window.removeEventListener("pointercancel", remove, true);
45
+ window.removeEventListener("pointerdown", remove, true);
46
+ window.removeEventListener("keydown", remove, true);
47
+ };
48
+ const suppressMouse = (event) => {
49
+ if (event.button !== 0)
50
+ return;
51
+ event.preventDefault();
52
+ event.stopPropagation();
53
+ if (event.type === "click")
54
+ remove();
55
+ };
56
+ const expire = () => {
57
+ timeout = setTimeout(remove, SYNTHESIZED_CLICK_WINDOW_MS);
58
+ };
59
+ window.addEventListener("mousedown", suppressMouse, true);
60
+ window.addEventListener("click", suppressMouse, true);
61
+ window.addEventListener("pointerup", expire, { capture: true, once: true });
62
+ window.addEventListener("pointercancel", remove, true);
63
+ window.addEventListener("pointerdown", remove, true);
64
+ window.addEventListener("keydown", remove, true);
65
+ return remove;
66
+ }
34
67
  /**
35
68
  * Returns pointer handlers that, when a **touch** pointer is held still for
36
69
  * {@link LONG_PRESS_DELAY_MS}, dispatch a native `contextmenu` event on the
@@ -43,11 +76,8 @@ function deliverLongPress(element, point, emulateRightClick) {
43
76
  * verbatim. Mouse and pen pointers are ignored so right-click stays the desktop
44
77
  * affordance.
45
78
  *
46
- * After the long press fires we register a one-shot capturing `click` listener
47
- * on `window` to swallow the click the browser synthesizes on touch release —
48
- * `preventDefault()` on `pointerup` does NOT suppress that click per the Pointer
49
- * Events spec, so without this the element's `onClick` (navigate/select) would
50
- * also run.
79
+ * After the hold fires, consume the mouse events synthesized on touch release
80
+ * so they cannot dismiss the menu or also activate its trigger.
51
81
  *
52
82
  * Pass `enabled: false` (e.g. when no context-menu handler is wired) to make the
53
83
  * returned handlers no-ops.
@@ -64,29 +94,6 @@ export function useLongPress(enabled, options) {
64
94
  }
65
95
  originRef.current = null;
66
96
  }, []);
67
- // Swallow exactly the next click (the one the browser synthesizes from the
68
- // touch release after a long press) and then detach. A timeout detaches the
69
- // suppressor if that click never arrives, so a later genuine tap still works.
70
- const armClickSuppressor = useCallback(() => {
71
- removeClickSuppressorRef.current?.();
72
- let fallbackTimer = null;
73
- const onClickCapture = (clickEvent) => {
74
- clickEvent.preventDefault();
75
- clickEvent.stopPropagation();
76
- removeClickSuppressorRef.current?.();
77
- };
78
- const remove = () => {
79
- window.removeEventListener("click", onClickCapture, true);
80
- if (fallbackTimer !== null) {
81
- clearTimeout(fallbackTimer);
82
- fallbackTimer = null;
83
- }
84
- removeClickSuppressorRef.current = null;
85
- };
86
- removeClickSuppressorRef.current = remove;
87
- window.addEventListener("click", onClickCapture, true);
88
- fallbackTimer = setTimeout(remove, SYNTHESIZED_CLICK_WINDOW_MS);
89
- }, []);
90
97
  // Tear down on unmount, and also when `enabled` flips off mid-press so a
91
98
  // scheduled long-press timer / click suppressor never fires after the hook
92
99
  // is disabled.
@@ -109,11 +116,12 @@ export function useLongPress(enabled, options) {
109
116
  timerRef.current = null;
110
117
  const element = resolvePressedElement(pressed, holder, point);
111
118
  if (element) {
112
- armClickSuppressor();
119
+ removeClickSuppressorRef.current?.();
120
+ removeClickSuppressorRef.current = suppressLongPressRelease();
113
121
  deliverLongPress(element, point, emulateRightClick);
114
122
  }
115
123
  }, LONG_PRESS_DELAY_MS);
116
- }, [armClickSuppressor, clearTimer, emulateRightClick, enabled]);
124
+ }, [clearTimer, emulateRightClick, enabled]);
117
125
  const onPointerMove = useCallback((event) => {
118
126
  const origin = originRef.current;
119
127
  if (!origin) {
@@ -1 +1 @@
1
- {"version":3,"file":"useLongPress.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/menu/useLongPress.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,sFAAsF;AACtF,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,oFAAoF;AACpF,MAAM,2BAA2B,GAAG,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E,iBAAiB,EAAE,OAAO,CAAC,CAC7D,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,KAAqC,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,4BAA4B;YACjE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,4BAA4B,CAAC;QACpE,IAAI,WAAW,EAAE,CAAC;YAChB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO;QACL,eAAe,EAAE,UAAU;QAC3B,aAAa;QACb,aAAa;QACb,WAAW,EAAE,UAAU;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import {\n type PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\n\nconst LONG_PRESS_DELAY_MS = 450;\n/** Cancel the press if the finger drifts past this many px (a scroll, not a hold). */\nconst LONG_PRESS_MOVE_TOLERANCE_PX = 10;\n/** Drop the click-suppressor if no synthesized click arrives within this window. */\nconst SYNTHESIZED_CLICK_WINDOW_MS = 700;\n\ninterface LongPressHandlers {\n onPointerCancel: (event: ReactPointerEvent<HTMLElement>) => void;\n onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;\n onPointerMove: (event: ReactPointerEvent<HTMLElement>) => void;\n onPointerUp: (event: ReactPointerEvent<HTMLElement>) => void;\n}\n\ninterface LongPressOptions {\n /**\n * Deliver the gesture as a mouse right-click arrives: a secondary-button\n * `mousedown`, then `contextmenu`, on the element the finger pressed rather\n * than the element holding these handlers. Open menus then close as they do\n * on any press outside them, and a control inside a wrapper sees the event\n * first, before it bubbles to the wrapper's menu. If the pressed element\n * left the page during the hold (an icon redrawn for a new state), the\n * element now under the finger receives both, or else the holder.\n */\n emulateRightClick?: boolean | undefined;\n}\n\ninterface Point {\n x: number;\n y: number;\n}\n\n// The element to deliver to: the pressed element, else (when a re-render\n// replaced it) the one now under the finger inside the holder, else the\n// holder; null when even the holder has left the page.\nfunction resolvePressedElement(\n pressed: Element | null,\n holder: HTMLElement,\n point: Point,\n): Element | null {\n if (pressed?.isConnected) {\n return pressed;\n }\n const underFinger = pressed\n ? holder.ownerDocument.elementFromPoint(point.x, point.y)\n : null;\n if (underFinger && holder.contains(underFinger)) {\n return underFinger;\n }\n return holder.isConnected ? holder : null;\n}\n\nfunction deliverLongPress(\n element: Element,\n point: Point,\n emulateRightClick: boolean,\n): void {\n const init = {\n bubbles: true,\n cancelable: true,\n clientX: point.x,\n clientY: point.y,\n };\n if (emulateRightClick) {\n element.dispatchEvent(\n new MouseEvent(\"mousedown\", { ...init, button: 2, buttons: 2 }),\n );\n }\n element.dispatchEvent(new MouseEvent(\"contextmenu\", init));\n}\n\n/**\n * Returns pointer handlers that, when a **touch** pointer is held still for\n * {@link LONG_PRESS_DELAY_MS}, dispatch a native `contextmenu` event on the\n * element holding them at the touch point (or, with `emulateRightClick`, a\n * right-click's `mousedown` and `contextmenu` on the pressed element).\n *\n * Dispatching the real event (rather than calling a handler directly) means the\n * element's existing `onContextMenu` — the same one a right-click triggers —\n * fires with a genuine event, so touch reuses the desktop context-menu path\n * verbatim. Mouse and pen pointers are ignored so right-click stays the desktop\n * affordance.\n *\n * After the long press fires we register a one-shot capturing `click` listener\n * on `window` to swallow the click the browser synthesizes on touch release —\n * `preventDefault()` on `pointerup` does NOT suppress that click per the Pointer\n * Events spec, so without this the element's `onClick` (navigate/select) would\n * also run.\n *\n * Pass `enabled: false` (e.g. when no context-menu handler is wired) to make the\n * returned handlers no-ops.\n */\nexport function useLongPress(\n enabled: boolean,\n options?: LongPressOptions,\n): LongPressHandlers {\n const emulateRightClick = options?.emulateRightClick === true;\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const originRef = useRef<{ x: number; y: number } | null>(null);\n const removeClickSuppressorRef = useRef<(() => void) | null>(null);\n\n const clearTimer = useCallback(() => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n originRef.current = null;\n }, []);\n\n // Swallow exactly the next click (the one the browser synthesizes from the\n // touch release after a long press) and then detach. A timeout detaches the\n // suppressor if that click never arrives, so a later genuine tap still works.\n const armClickSuppressor = useCallback(() => {\n removeClickSuppressorRef.current?.();\n\n let fallbackTimer: ReturnType<typeof setTimeout> | null = null;\n const onClickCapture = (clickEvent: MouseEvent) => {\n clickEvent.preventDefault();\n clickEvent.stopPropagation();\n removeClickSuppressorRef.current?.();\n };\n\n const remove = () => {\n window.removeEventListener(\"click\", onClickCapture, true);\n if (fallbackTimer !== null) {\n clearTimeout(fallbackTimer);\n fallbackTimer = null;\n }\n removeClickSuppressorRef.current = null;\n };\n\n removeClickSuppressorRef.current = remove;\n window.addEventListener(\"click\", onClickCapture, true);\n fallbackTimer = setTimeout(remove, SYNTHESIZED_CLICK_WINDOW_MS);\n }, []);\n\n // Tear down on unmount, and also when `enabled` flips off mid-press so a\n // scheduled long-press timer / click suppressor never fires after the hook\n // is disabled.\n useEffect(\n () => () => {\n clearTimer();\n removeClickSuppressorRef.current?.();\n },\n [clearTimer, enabled],\n );\n\n const onPointerDown = useCallback(\n (event: ReactPointerEvent<HTMLElement>) => {\n if (!enabled || event.pointerType !== \"touch\") {\n return;\n }\n\n clearTimer();\n const point = { x: event.clientX, y: event.clientY };\n originRef.current = point;\n const holder = event.currentTarget;\n const pressed =\n emulateRightClick && event.target instanceof Element\n ? event.target\n : null;\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n const element = resolvePressedElement(pressed, holder, point);\n if (element) {\n armClickSuppressor();\n deliverLongPress(element, point, emulateRightClick);\n }\n }, LONG_PRESS_DELAY_MS);\n },\n [armClickSuppressor, clearTimer, emulateRightClick, enabled],\n );\n\n const onPointerMove = useCallback(\n (event: ReactPointerEvent<HTMLElement>) => {\n const origin = originRef.current;\n if (!origin) {\n return;\n }\n\n const movedTooFar =\n Math.abs(event.clientX - origin.x) > LONG_PRESS_MOVE_TOLERANCE_PX ||\n Math.abs(event.clientY - origin.y) > LONG_PRESS_MOVE_TOLERANCE_PX;\n if (movedTooFar) {\n clearTimer();\n }\n },\n [clearTimer],\n );\n\n return {\n onPointerCancel: clearTimer,\n onPointerDown,\n onPointerMove,\n onPointerUp: clearTimer,\n };\n}\n"]}
1
+ {"version":3,"file":"useLongPress.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/menu/useLongPress.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,sFAAsF;AACtF,MAAM,4BAA4B,GAAG,EAAE,CAAC;AACxC,oFAAoF;AACpF,MAAM,2BAA2B,GAAG,GAAG,CAAC;AA2BxC,yEAAyE;AACzE,wEAAwE;AACxE,uDAAuD;AACvD,SAAS,qBAAqB,CAC5B,OAAuB,EACvB,MAAmB,EACnB,KAAY;IAEZ,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,WAAW,GAAG,OAAO;QACzB,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,IAAI,CAAC;IACT,IAAI,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAChD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,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;gBAC9D,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;YACtD,CAAC;QACH,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAC1B,CAAC,EACD,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,CAAC,CACzC,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,KAAqC,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,4BAA4B;YACjE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,4BAA4B,CAAC;QACpE,IAAI,WAAW,EAAE,CAAC;YAChB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO;QACL,eAAe,EAAE,UAAU;QAC3B,aAAa;QACb,aAAa;QACb,WAAW,EAAE,UAAU;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import {\n type PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\n\nconst LONG_PRESS_DELAY_MS = 450;\n/** Cancel the press if the finger drifts past this many px (a scroll, not a hold). */\nconst LONG_PRESS_MOVE_TOLERANCE_PX = 10;\n/** Drop the click-suppressor if no synthesized click arrives within this window. */\nconst SYNTHESIZED_CLICK_WINDOW_MS = 700;\n\ninterface LongPressHandlers {\n onPointerCancel: (event: ReactPointerEvent<HTMLElement>) => void;\n onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;\n onPointerMove: (event: ReactPointerEvent<HTMLElement>) => void;\n onPointerUp: (event: ReactPointerEvent<HTMLElement>) => void;\n}\n\ninterface LongPressOptions {\n /**\n * Deliver the gesture as a mouse right-click arrives: a secondary-button\n * `mousedown`, then `contextmenu`, on the element the finger pressed rather\n * than the element holding these handlers. Open menus then close as they do\n * on any press outside them, and a control inside a wrapper sees the event\n * first, before it bubbles to the wrapper's menu. If the pressed element\n * left the page during the hold (an icon redrawn for a new state), the\n * element now under the finger receives both, or else the holder.\n */\n emulateRightClick?: boolean | undefined;\n}\n\ninterface Point {\n x: number;\n y: number;\n}\n\n// The element to deliver to: the pressed element, else (when a re-render\n// replaced it) the one now under the finger inside the holder, else the\n// holder; null when even the holder has left the page.\nfunction resolvePressedElement(\n pressed: Element | null,\n holder: HTMLElement,\n point: Point,\n): Element | null {\n if (pressed?.isConnected) {\n return pressed;\n }\n const underFinger = pressed\n ? holder.ownerDocument.elementFromPoint(point.x, point.y)\n : null;\n if (underFinger && holder.contains(underFinger)) {\n return underFinger;\n }\n return holder.isConnected ? holder : null;\n}\n\nfunction deliverLongPress(\n element: Element,\n point: Point,\n emulateRightClick: boolean,\n): void {\n const init = {\n bubbles: true,\n cancelable: true,\n clientX: point.x,\n clientY: point.y,\n };\n if (emulateRightClick) {\n element.dispatchEvent(\n new MouseEvent(\"mousedown\", { ...init, button: 2, buttons: 2 }),\n );\n }\n element.dispatchEvent(new MouseEvent(\"contextmenu\", init));\n}\n\n// On release a browser may send mousedown (which dismisses an outside menu)\n// and click (which activates the trigger). Consume that gesture through click,\n// and always yield to the next genuine pointer or keyboard interaction.\nfunction suppressLongPressRelease(): () => void {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n const remove = () => {\n clearTimeout(timeout);\n window.removeEventListener(\"mousedown\", suppressMouse, true);\n window.removeEventListener(\"click\", suppressMouse, true);\n window.removeEventListener(\"pointerup\", expire, true);\n window.removeEventListener(\"pointercancel\", remove, true);\n window.removeEventListener(\"pointerdown\", remove, true);\n window.removeEventListener(\"keydown\", remove, true);\n };\n const suppressMouse = (event: MouseEvent) => {\n if (event.button !== 0) return;\n event.preventDefault();\n event.stopPropagation();\n if (event.type === \"click\") remove();\n };\n const expire = () => {\n timeout = setTimeout(remove, SYNTHESIZED_CLICK_WINDOW_MS);\n };\n window.addEventListener(\"mousedown\", suppressMouse, true);\n window.addEventListener(\"click\", suppressMouse, true);\n window.addEventListener(\"pointerup\", expire, { capture: true, once: true });\n window.addEventListener(\"pointercancel\", remove, true);\n window.addEventListener(\"pointerdown\", remove, true);\n window.addEventListener(\"keydown\", remove, true);\n return remove;\n}\n\n/**\n * Returns pointer handlers that, when a **touch** pointer is held still for\n * {@link LONG_PRESS_DELAY_MS}, dispatch a native `contextmenu` event on the\n * element holding them at the touch point (or, with `emulateRightClick`, a\n * right-click's `mousedown` and `contextmenu` on the pressed element).\n *\n * Dispatching the real event (rather than calling a handler directly) means the\n * element's existing `onContextMenu` — the same one a right-click triggers —\n * fires with a genuine event, so touch reuses the desktop context-menu path\n * verbatim. Mouse and pen pointers are ignored so right-click stays the desktop\n * affordance.\n *\n * After the hold fires, consume the mouse events synthesized on touch release\n * so they cannot dismiss the menu or also activate its trigger.\n *\n * Pass `enabled: false` (e.g. when no context-menu handler is wired) to make the\n * returned handlers no-ops.\n */\nexport function useLongPress(\n enabled: boolean,\n options?: LongPressOptions,\n): LongPressHandlers {\n const emulateRightClick = options?.emulateRightClick === true;\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const originRef = useRef<{ x: number; y: number } | null>(null);\n const removeClickSuppressorRef = useRef<(() => void) | null>(null);\n\n const clearTimer = useCallback(() => {\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n originRef.current = null;\n }, []);\n\n // Tear down on unmount, and also when `enabled` flips off mid-press so a\n // scheduled long-press timer / click suppressor never fires after the hook\n // is disabled.\n useEffect(\n () => () => {\n clearTimer();\n removeClickSuppressorRef.current?.();\n },\n [clearTimer, enabled],\n );\n\n const onPointerDown = useCallback(\n (event: ReactPointerEvent<HTMLElement>) => {\n if (!enabled || event.pointerType !== \"touch\") {\n return;\n }\n\n clearTimer();\n const point = { x: event.clientX, y: event.clientY };\n originRef.current = point;\n const holder = event.currentTarget;\n const pressed =\n emulateRightClick && event.target instanceof Element\n ? event.target\n : null;\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n const element = resolvePressedElement(pressed, holder, point);\n if (element) {\n removeClickSuppressorRef.current?.();\n removeClickSuppressorRef.current = suppressLongPressRelease();\n deliverLongPress(element, point, emulateRightClick);\n }\n }, LONG_PRESS_DELAY_MS);\n },\n [clearTimer, emulateRightClick, enabled],\n );\n\n const onPointerMove = useCallback(\n (event: ReactPointerEvent<HTMLElement>) => {\n const origin = originRef.current;\n if (!origin) {\n return;\n }\n\n const movedTooFar =\n Math.abs(event.clientX - origin.x) > LONG_PRESS_MOVE_TOLERANCE_PX ||\n Math.abs(event.clientY - origin.y) > LONG_PRESS_MOVE_TOLERANCE_PX;\n if (movedTooFar) {\n clearTimer();\n }\n },\n [clearTimer],\n );\n\n return {\n onPointerCancel: clearTimer,\n onPointerDown,\n onPointerMove,\n onPointerUp: clearTimer,\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tearleads/windowing",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "description": "App-agnostic window management for React: window state, window chrome, and the menu and sidebar primitives it renders with.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -35,6 +35,8 @@ export interface RoutedPaneProps {
35
35
  * launcher sheet, or the rail on the tablet tier in side mode.
36
36
  */
37
37
  menuIcon: ReactNode;
38
+ /** Offer Start menu settings from the taskbar menu button. */
39
+ onOpenStartMenuSettings?: (() => void) | undefined;
38
40
  /**
39
41
  * A strip in its own row directly above the taskbar, such as a deployment
40
42
  * warning. It is told whether the phone's software keyboard is open, while
@@ -33,7 +33,7 @@ export function initialRoutedSidebarExpanded(definition, tier, activeAppId) {
33
33
  }
34
34
  return definition.apps[activeAppId]?.initialShowSidebar ?? true;
35
35
  }
36
- function RoutedPaneSurface({ activeAppId, AppBoundary, appIds, contentTop, launcherPlacement, menuIcon, navigationRailExpanded, onToggleLauncherPlacement, onToggleNavigationRail, renderAboveTaskbar, subscribeKeyboardVisibility, taskbarTray, tier, }) {
36
+ function RoutedPaneSurface({ activeAppId, AppBoundary, appIds, contentTop, launcherPlacement, menuIcon, navigationRailExpanded, onOpenStartMenuSettings, onToggleLauncherPlacement, onToggleNavigationRail, renderAboveTaskbar, subscribeKeyboardVisibility, taskbarTray, tier, }) {
37
37
  const { definition } = useLauncherNavigationState();
38
38
  const { sidebar } = useWindowSidebar();
39
39
  const hasSidebar = hasWindowSidebar(sidebar);
@@ -46,7 +46,11 @@ function RoutedPaneSurface({ activeAppId, AppBoundary, appIds, contentTop, launc
46
46
  tier,
47
47
  });
48
48
  const sidebarVisible = hasSidebar && sidebarExpanded;
49
- return (_jsxs("section", { className: `routed-pane routed-pane--${tier}`, "data-keyboard": mobileKeyboardVisible ? "open" : "closed", "data-launcher-placement": launcherPlacement, "data-sidebar": sidebarVisible ? "open" : "closed", role: "application", children: [_jsx(RoutedPaneAppBar, { activeAppId: activeAppId, hasSidebar: hasSidebar, onToggleSidebar: toggleSidebar, sidebarExpanded: sidebarExpanded, tier: tier }), _jsx(RoutedPaneNav, { activeAppId: activeAppId, appIds: appIds, drawerOpen: drawerOpen, launcherPlacement: launcherPlacement, onCloseDrawer: dismissDrawer, onNavigateRail: closeDrawer, onToggleLauncherPlacement: moveLauncher, onToggleRail: onToggleNavigationRail, railExpanded: navigationRailExpanded, tier: tier }), sidebarVisible && (_jsx(RoutedPaneSidebar, { onClose: closeSidebar, tier: tier, children: sidebar })), _jsx(RoutedPaneMain, { activeAppId: activeAppId, AppBoundary: AppBoundary, contentTop: contentTop, tier: tier }), renderAboveTaskbar && (_jsx("div", { className: "routed-pane-above-taskbar", children: renderAboveTaskbar({ keyboardVisible: mobileKeyboardVisible }) })), _jsx(RoutedPaneTaskBar, { drawerOpen: drawerOpen, hidden: mobileKeyboardVisible, launcherPlacement: launcherPlacement, menuButtonRef: menuButtonRef, menuIcon: menuIcon, onToggleDrawer: toggleDrawer, onToggleRail: onToggleNavigationRail, railExpanded: navigationRailExpanded, tier: tier, tray: taskbarTray })] }));
49
+ return (_jsxs("section", { className: `routed-pane routed-pane--${tier}`, "data-keyboard": mobileKeyboardVisible ? "open" : "closed", "data-launcher-placement": launcherPlacement, "data-sidebar": sidebarVisible ? "open" : "closed", role: "application", children: [_jsx(RoutedPaneAppBar, { activeAppId: activeAppId, hasSidebar: hasSidebar, onToggleSidebar: toggleSidebar, sidebarExpanded: sidebarExpanded, tier: tier }), _jsx(RoutedPaneNav, { activeAppId: activeAppId, appIds: appIds, drawerOpen: drawerOpen, launcherPlacement: launcherPlacement, onCloseDrawer: dismissDrawer, onNavigateRail: closeDrawer, onToggleLauncherPlacement: moveLauncher, onToggleRail: onToggleNavigationRail, railExpanded: navigationRailExpanded, tier: tier }), sidebarVisible && (_jsx(RoutedPaneSidebar, { onClose: closeSidebar, tier: tier, children: sidebar })), _jsx(RoutedPaneMain, { activeAppId: activeAppId, AppBoundary: AppBoundary, contentTop: contentTop, tier: tier }), renderAboveTaskbar && (_jsx("div", { className: "routed-pane-above-taskbar", children: renderAboveTaskbar({ keyboardVisible: mobileKeyboardVisible }) })), _jsx(RoutedPaneTaskBar, { drawerOpen: drawerOpen, hidden: mobileKeyboardVisible, launcherPlacement: launcherPlacement, menuButtonRef: menuButtonRef, menuIcon: menuIcon, onOpenStartMenuSettings: onOpenStartMenuSettings &&
50
+ (() => {
51
+ closeDrawer();
52
+ onOpenStartMenuSettings();
53
+ }), onToggleDrawer: toggleDrawer, onToggleRail: onToggleNavigationRail, railExpanded: navigationRailExpanded, tier: tier, tray: taskbarTray })] }));
50
54
  }
51
55
  /**
52
56
  * Hosts the per-app chrome registries (toolbar actions and the mini-app
@@ -1 +1 @@
1
- {"version":3,"file":"RoutedPane.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPane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BAA2B,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC,EACD,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CACjD,CAAC;IAEF,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,wBAAwB,OAEnB,KAAK,EACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,sBAAsB,EAAE,sBAAsB,EAC9C,yBAAyB,EAAE,uBAAuB,EAClD,sBAAsB,EAAE,oBAAoB,EAC5C,IAAI,EAAE,IAAI,IATL,WAAW,CAUhB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport { useLauncherNavigationState } from \"../launcher/LauncherNavigationProvider\";\nimport {\n type LauncherDefinition,\n resolveLauncherHomeAppId,\n resolveLauncherOrder,\n} from \"../launcher/launcherDefinition\";\nimport type { MiniAppBoundary } from \"../launcher/MiniAppWindow\";\nimport {\n type RoutedLayoutTier,\n useRoutedLayoutTier,\n} from \"../launcher/useRoutedLayoutTier\";\nimport { useOptionalStartMenuPreferences } from \"../menu/StartMenuPreferencesProvider\";\nimport { WindowMenuProvider } from \"../window/WindowMenuContext\";\nimport {\n hasWindowSidebar,\n useWindowSidebar,\n WindowSidebarProvider,\n} from \"../window/WindowSidebarContext\";\nimport \"./RoutedPane.css\";\nimport {\n type LauncherPlacement,\n loadLauncherPlacement,\n saveLauncherPlacement,\n} from \"./launcherPlacement\";\nimport { RoutedPaneAppBar } from \"./RoutedPaneAppBar\";\nimport { RoutedPaneMain } from \"./RoutedPaneMain\";\nimport { RoutedPaneNav } from \"./RoutedPaneNav\";\nimport { RoutedPaneSidebar } from \"./RoutedPaneSidebar\";\nimport { RoutedPaneTaskBar } from \"./RoutedPaneTaskBar\";\nimport {\n type SubscribeKeyboardVisibility,\n useMobileKeyboardVisible,\n} from \"./useMobileKeyboardVisible\";\nimport { invertBoolean, useRoutedPaneOverlays } from \"./useRoutedPaneOverlays\";\n\nconst DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY = \"windowing.launcherPlacement\";\n\nfunction PassThroughBoundary({ children }: { children?: ReactNode }) {\n return children;\n}\n\n/**\n * Whether a freshly mounted routed mini-app shows its sidebar.\n *\n * On mobile the sidebar is a dismissable overlay (dialog + scrim), so it must\n * never open on its own when an app loads — it starts collapsed and the user\n * reveals it from the app bar. The tablet rail honours each app's configured\n * {@link MiniAppDefinition.initialShowSidebar} default (defaulting to shown).\n */\nexport function initialRoutedSidebarExpanded(\n definition: LauncherDefinition,\n tier: RoutedLayoutTier,\n activeAppId: string,\n): boolean {\n if (tier === \"mobile\") {\n return false;\n }\n\n return definition.apps[activeAppId]?.initialShowSidebar ?? true;\n}\n\nexport interface RoutedPaneProps {\n /**\n * Wraps the active mini-app, such as an error boundary that fails inside the\n * app rather than the shell.\n */\n AppBoundary?: MiniAppBoundary | undefined;\n /**\n * The apps the launcher offers, in order, such as the definition's order less\n * the apps the session may not see. Defaults to the definition's order.\n */\n appIds?: ReadonlyArray<string> | undefined;\n /** Rides above the active app in the content pane. */\n contentTop?: ReactNode;\n /**\n * Where the tablet tier's launcher placement persists in localStorage.\n * Defaults to `windowing.launcherPlacement`.\n */\n launcherPlacementStorageKey?: string | undefined;\n /**\n * The taskbar's menu button, centered: the product's logo, which opens the\n * launcher sheet, or the rail on the tablet tier in side mode.\n */\n menuIcon: ReactNode;\n /**\n * A strip in its own row directly above the taskbar, such as a deployment\n * warning. It is told whether the phone's software keyboard is open, while\n * the taskbar itself hides.\n */\n renderAboveTaskbar?:\n | ((state: { keyboardVisible: boolean }) => ReactNode)\n | undefined;\n /** Native keyboard state, for a WebView whose resizing hides it. */\n subscribeKeyboardVisibility?: SubscribeKeyboardVisibility | undefined;\n /** The taskbar's end-aligned tray, such as the windowed/routed switch. */\n taskbarTray?: ReactNode;\n}\n\ninterface RoutedPaneSurfaceProps\n extends Omit<\n RoutedPaneProps,\n \"AppBoundary\" | \"appIds\" | \"launcherPlacementStorageKey\"\n > {\n AppBoundary: MiniAppBoundary;\n activeAppId: string;\n appIds: ReadonlyArray<string>;\n launcherPlacement: LauncherPlacement;\n navigationRailExpanded: boolean;\n onToggleLauncherPlacement: (wasOpen: boolean) => void;\n onToggleNavigationRail: () => void;\n tier: RoutedLayoutTier;\n}\n\nfunction RoutedPaneSurface({\n activeAppId,\n AppBoundary,\n appIds,\n contentTop,\n launcherPlacement,\n menuIcon,\n navigationRailExpanded,\n onToggleLauncherPlacement,\n onToggleNavigationRail,\n renderAboveTaskbar,\n subscribeKeyboardVisibility,\n taskbarTray,\n tier,\n}: RoutedPaneSurfaceProps) {\n const { definition } = useLauncherNavigationState();\n const { sidebar } = useWindowSidebar();\n const hasSidebar = hasWindowSidebar(sidebar);\n const mobileKeyboardVisible = useMobileKeyboardVisible(\n tier === \"mobile\",\n subscribeKeyboardVisibility,\n );\n\n const {\n closeDrawer,\n closeSidebar,\n dismissDrawer,\n drawerOpen,\n menuButtonRef,\n moveLauncher,\n sidebarExpanded,\n toggleDrawer,\n toggleSidebar,\n } = useRoutedPaneOverlays({\n initialSidebarExpanded: () =>\n initialRoutedSidebarExpanded(definition, tier, activeAppId),\n launcherPlacement,\n navigationRailExpanded,\n onToggleLauncherPlacement,\n tier,\n });\n const sidebarVisible = hasSidebar && sidebarExpanded;\n\n return (\n <section\n className={`routed-pane routed-pane--${tier}`}\n data-keyboard={mobileKeyboardVisible ? \"open\" : \"closed\"}\n data-launcher-placement={launcherPlacement}\n data-sidebar={sidebarVisible ? \"open\" : \"closed\"}\n role=\"application\"\n >\n <RoutedPaneAppBar\n activeAppId={activeAppId}\n hasSidebar={hasSidebar}\n onToggleSidebar={toggleSidebar}\n sidebarExpanded={sidebarExpanded}\n tier={tier}\n />\n <RoutedPaneNav\n activeAppId={activeAppId}\n appIds={appIds}\n drawerOpen={drawerOpen}\n launcherPlacement={launcherPlacement}\n onCloseDrawer={dismissDrawer}\n onNavigateRail={closeDrawer}\n onToggleLauncherPlacement={moveLauncher}\n onToggleRail={onToggleNavigationRail}\n railExpanded={navigationRailExpanded}\n tier={tier}\n />\n {sidebarVisible && (\n <RoutedPaneSidebar onClose={closeSidebar} tier={tier}>\n {sidebar}\n </RoutedPaneSidebar>\n )}\n <RoutedPaneMain\n activeAppId={activeAppId}\n AppBoundary={AppBoundary}\n contentTop={contentTop}\n tier={tier}\n />\n {renderAboveTaskbar && (\n <div className=\"routed-pane-above-taskbar\">\n {renderAboveTaskbar({ keyboardVisible: mobileKeyboardVisible })}\n </div>\n )}\n <RoutedPaneTaskBar\n drawerOpen={drawerOpen}\n hidden={mobileKeyboardVisible}\n launcherPlacement={launcherPlacement}\n menuButtonRef={menuButtonRef}\n menuIcon={menuIcon}\n onToggleDrawer={toggleDrawer}\n onToggleRail={onToggleNavigationRail}\n railExpanded={navigationRailExpanded}\n tier={tier}\n tray={taskbarTray}\n />\n </section>\n );\n}\n\n/**\n * Hosts the per-app chrome registries (toolbar actions and the mini-app\n * sidebar). Keyed by the active app id upstream so each mini-app mounts against\n * fresh registries.\n */\nfunction RoutedPaneWithRegistries(props: RoutedPaneSurfaceProps) {\n return (\n <WindowMenuProvider>\n <WindowSidebarProvider>\n <RoutedPaneSurface {...props} />\n </WindowSidebarProvider>\n </WindowMenuProvider>\n );\n}\n\n/**\n * The routed shell, the iPad / phone layout: one mini-app at a time, chosen by\n * the route, with an app bar, a launcher, and a taskbar. Render it inside a\n * {@link LauncherNavigationProvider} in `routed` mode, in a container that\n * gives it its size.\n *\n * Below 760px it is a phone layout whose launcher is a bottom sheet of tiles;\n * at or above it, a tablet layout whose launcher is a left rail or, at the\n * user's choice, the same sheet. The app's sidebar and toolbar actions, which\n * it registers with the window hooks, appear in the shell's sidebar and app\n * bar.\n */\nexport function RoutedPane({\n AppBoundary = PassThroughBoundary,\n appIds,\n launcherPlacementStorageKey = DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY,\n ...props\n}: RoutedPaneProps) {\n const tier = useRoutedLayoutTier();\n const {\n definition,\n route: { appId },\n } = useLauncherNavigationState();\n const [launcherPlacement, setLauncherPlacement] = useState<LauncherPlacement>(\n () => loadLauncherPlacement(launcherPlacementStorageKey),\n );\n const [navigationRailExpanded, setNavigationRailExpanded] = useState(false);\n // The route only ever names one of the launcher's apps, so the root route is\n // the one case that falls back to the home app.\n const activeAppId = appId ?? resolveLauncherHomeAppId(definition);\n const preferences = useOptionalStartMenuPreferences();\n const offeredAppIds = useMemo(() => {\n const ids = appIds ?? resolveLauncherOrder(definition);\n return preferences ? ids.filter(preferences.isVisible) : ids;\n }, [appIds, definition, preferences]);\n const toggleNavigationRail = useCallback(\n () => setNavigationRailExpanded(invertBoolean),\n [],\n );\n const toggleLauncherPlacement = useCallback(\n (wasOpen: boolean) => {\n const next = launcherPlacement === \"side\" ? \"bottom\" : \"side\";\n setNavigationRailExpanded(next === \"side\" && wasOpen);\n setLauncherPlacement(next);\n saveLauncherPlacement(launcherPlacementStorageKey, next);\n },\n [launcherPlacement, launcherPlacementStorageKey],\n );\n\n if (activeAppId === null) {\n return null;\n }\n\n return (\n <RoutedPaneWithRegistries\n key={activeAppId}\n {...props}\n AppBoundary={AppBoundary}\n activeAppId={activeAppId}\n appIds={offeredAppIds}\n launcherPlacement={launcherPlacement}\n navigationRailExpanded={navigationRailExpanded}\n onToggleLauncherPlacement={toggleLauncherPlacement}\n onToggleNavigationRail={toggleNavigationRail}\n tier={tier}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"RoutedPane.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPane.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAEL,wB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AAC;IAC3D,CAAC,EACD,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CACjD,CAAC;IAEF,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,wBAAwB,OAEnB,KAAK,EACT,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,sBAAsB,EAAE,sBAAsB,EAC9C,yBAAyB,EAAE,uBAAuB,EAClD,sBAAsB,EAAE,oBAAoB,EAC5C,IAAI,EAAE,IAAI,IATL,WAAW,CAUhB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport { useLauncherNavigationState } from \"../launcher/LauncherNavigationProvider\";\nimport {\n type LauncherDefinition,\n resolveLauncherHomeAppId,\n resolveLauncherOrder,\n} from \"../launcher/launcherDefinition\";\nimport type { MiniAppBoundary } from \"../launcher/MiniAppWindow\";\nimport {\n type RoutedLayoutTier,\n useRoutedLayoutTier,\n} from \"../launcher/useRoutedLayoutTier\";\nimport { useOptionalStartMenuPreferences } from \"../menu/StartMenuPreferencesProvider\";\nimport { WindowMenuProvider } from \"../window/WindowMenuContext\";\nimport {\n hasWindowSidebar,\n useWindowSidebar,\n WindowSidebarProvider,\n} from \"../window/WindowSidebarContext\";\nimport \"./RoutedPane.css\";\nimport {\n type LauncherPlacement,\n loadLauncherPlacement,\n saveLauncherPlacement,\n} from \"./launcherPlacement\";\nimport { RoutedPaneAppBar } from \"./RoutedPaneAppBar\";\nimport { RoutedPaneMain } from \"./RoutedPaneMain\";\nimport { RoutedPaneNav } from \"./RoutedPaneNav\";\nimport { RoutedPaneSidebar } from \"./RoutedPaneSidebar\";\nimport { RoutedPaneTaskBar } from \"./RoutedPaneTaskBar\";\nimport {\n type SubscribeKeyboardVisibility,\n useMobileKeyboardVisible,\n} from \"./useMobileKeyboardVisible\";\nimport { invertBoolean, useRoutedPaneOverlays } from \"./useRoutedPaneOverlays\";\n\nconst DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY = \"windowing.launcherPlacement\";\n\nfunction PassThroughBoundary({ children }: { children?: ReactNode }) {\n return children;\n}\n\n/**\n * Whether a freshly mounted routed mini-app shows its sidebar.\n *\n * On mobile the sidebar is a dismissable overlay (dialog + scrim), so it must\n * never open on its own when an app loads — it starts collapsed and the user\n * reveals it from the app bar. The tablet rail honours each app's configured\n * {@link MiniAppDefinition.initialShowSidebar} default (defaulting to shown).\n */\nexport function initialRoutedSidebarExpanded(\n definition: LauncherDefinition,\n tier: RoutedLayoutTier,\n activeAppId: string,\n): boolean {\n if (tier === \"mobile\") {\n return false;\n }\n\n return definition.apps[activeAppId]?.initialShowSidebar ?? true;\n}\n\nexport interface RoutedPaneProps {\n /**\n * Wraps the active mini-app, such as an error boundary that fails inside the\n * app rather than the shell.\n */\n AppBoundary?: MiniAppBoundary | undefined;\n /**\n * The apps the launcher offers, in order, such as the definition's order less\n * the apps the session may not see. Defaults to the definition's order.\n */\n appIds?: ReadonlyArray<string> | undefined;\n /** Rides above the active app in the content pane. */\n contentTop?: ReactNode;\n /**\n * Where the tablet tier's launcher placement persists in localStorage.\n * Defaults to `windowing.launcherPlacement`.\n */\n launcherPlacementStorageKey?: string | undefined;\n /**\n * The taskbar's menu button, centered: the product's logo, which opens the\n * launcher sheet, or the rail on the tablet tier in side mode.\n */\n menuIcon: ReactNode;\n /** Offer Start menu settings from the taskbar menu button. */\n onOpenStartMenuSettings?: (() => void) | undefined;\n /**\n * A strip in its own row directly above the taskbar, such as a deployment\n * warning. It is told whether the phone's software keyboard is open, while\n * the taskbar itself hides.\n */\n renderAboveTaskbar?:\n | ((state: { keyboardVisible: boolean }) => ReactNode)\n | undefined;\n /** Native keyboard state, for a WebView whose resizing hides it. */\n subscribeKeyboardVisibility?: SubscribeKeyboardVisibility | undefined;\n /** The taskbar's end-aligned tray, such as the windowed/routed switch. */\n taskbarTray?: ReactNode;\n}\n\ninterface RoutedPaneSurfaceProps\n extends Omit<\n RoutedPaneProps,\n \"AppBoundary\" | \"appIds\" | \"launcherPlacementStorageKey\"\n > {\n AppBoundary: MiniAppBoundary;\n activeAppId: string;\n appIds: ReadonlyArray<string>;\n launcherPlacement: LauncherPlacement;\n navigationRailExpanded: boolean;\n onToggleLauncherPlacement: (wasOpen: boolean) => void;\n onToggleNavigationRail: () => void;\n tier: RoutedLayoutTier;\n}\n\nfunction RoutedPaneSurface({\n activeAppId,\n AppBoundary,\n appIds,\n contentTop,\n launcherPlacement,\n menuIcon,\n navigationRailExpanded,\n onOpenStartMenuSettings,\n onToggleLauncherPlacement,\n onToggleNavigationRail,\n renderAboveTaskbar,\n subscribeKeyboardVisibility,\n taskbarTray,\n tier,\n}: RoutedPaneSurfaceProps) {\n const { definition } = useLauncherNavigationState();\n const { sidebar } = useWindowSidebar();\n const hasSidebar = hasWindowSidebar(sidebar);\n const mobileKeyboardVisible = useMobileKeyboardVisible(\n tier === \"mobile\",\n subscribeKeyboardVisibility,\n );\n\n const {\n closeDrawer,\n closeSidebar,\n dismissDrawer,\n drawerOpen,\n menuButtonRef,\n moveLauncher,\n sidebarExpanded,\n toggleDrawer,\n toggleSidebar,\n } = useRoutedPaneOverlays({\n initialSidebarExpanded: () =>\n initialRoutedSidebarExpanded(definition, tier, activeAppId),\n launcherPlacement,\n navigationRailExpanded,\n onToggleLauncherPlacement,\n tier,\n });\n const sidebarVisible = hasSidebar && sidebarExpanded;\n\n return (\n <section\n className={`routed-pane routed-pane--${tier}`}\n data-keyboard={mobileKeyboardVisible ? \"open\" : \"closed\"}\n data-launcher-placement={launcherPlacement}\n data-sidebar={sidebarVisible ? \"open\" : \"closed\"}\n role=\"application\"\n >\n <RoutedPaneAppBar\n activeAppId={activeAppId}\n hasSidebar={hasSidebar}\n onToggleSidebar={toggleSidebar}\n sidebarExpanded={sidebarExpanded}\n tier={tier}\n />\n <RoutedPaneNav\n activeAppId={activeAppId}\n appIds={appIds}\n drawerOpen={drawerOpen}\n launcherPlacement={launcherPlacement}\n onCloseDrawer={dismissDrawer}\n onNavigateRail={closeDrawer}\n onToggleLauncherPlacement={moveLauncher}\n onToggleRail={onToggleNavigationRail}\n railExpanded={navigationRailExpanded}\n tier={tier}\n />\n {sidebarVisible && (\n <RoutedPaneSidebar onClose={closeSidebar} tier={tier}>\n {sidebar}\n </RoutedPaneSidebar>\n )}\n <RoutedPaneMain\n activeAppId={activeAppId}\n AppBoundary={AppBoundary}\n contentTop={contentTop}\n tier={tier}\n />\n {renderAboveTaskbar && (\n <div className=\"routed-pane-above-taskbar\">\n {renderAboveTaskbar({ keyboardVisible: mobileKeyboardVisible })}\n </div>\n )}\n <RoutedPaneTaskBar\n drawerOpen={drawerOpen}\n hidden={mobileKeyboardVisible}\n launcherPlacement={launcherPlacement}\n menuButtonRef={menuButtonRef}\n menuIcon={menuIcon}\n onOpenStartMenuSettings={\n onOpenStartMenuSettings &&\n (() => {\n closeDrawer();\n onOpenStartMenuSettings();\n })\n }\n onToggleDrawer={toggleDrawer}\n onToggleRail={onToggleNavigationRail}\n railExpanded={navigationRailExpanded}\n tier={tier}\n tray={taskbarTray}\n />\n </section>\n );\n}\n\n/**\n * Hosts the per-app chrome registries (toolbar actions and the mini-app\n * sidebar). Keyed by the active app id upstream so each mini-app mounts against\n * fresh registries.\n */\nfunction RoutedPaneWithRegistries(props: RoutedPaneSurfaceProps) {\n return (\n <WindowMenuProvider>\n <WindowSidebarProvider>\n <RoutedPaneSurface {...props} />\n </WindowSidebarProvider>\n </WindowMenuProvider>\n );\n}\n\n/**\n * The routed shell, the iPad / phone layout: one mini-app at a time, chosen by\n * the route, with an app bar, a launcher, and a taskbar. Render it inside a\n * {@link LauncherNavigationProvider} in `routed` mode, in a container that\n * gives it its size.\n *\n * Below 760px it is a phone layout whose launcher is a bottom sheet of tiles;\n * at or above it, a tablet layout whose launcher is a left rail or, at the\n * user's choice, the same sheet. The app's sidebar and toolbar actions, which\n * it registers with the window hooks, appear in the shell's sidebar and app\n * bar.\n */\nexport function RoutedPane({\n AppBoundary = PassThroughBoundary,\n appIds,\n launcherPlacementStorageKey = DEFAULT_LAUNCHER_PLACEMENT_STORAGE_KEY,\n ...props\n}: RoutedPaneProps) {\n const tier = useRoutedLayoutTier();\n const {\n definition,\n route: { appId },\n } = useLauncherNavigationState();\n const [launcherPlacement, setLauncherPlacement] = useState<LauncherPlacement>(\n () => loadLauncherPlacement(launcherPlacementStorageKey),\n );\n const [navigationRailExpanded, setNavigationRailExpanded] = useState(false);\n // The route only ever names one of the launcher's apps, so the root route is\n // the one case that falls back to the home app.\n const activeAppId = appId ?? resolveLauncherHomeAppId(definition);\n const preferences = useOptionalStartMenuPreferences();\n const offeredAppIds = useMemo(() => {\n const ids = appIds ?? resolveLauncherOrder(definition);\n return preferences ? ids.filter(preferences.isVisible) : ids;\n }, [appIds, definition, preferences]);\n const toggleNavigationRail = useCallback(\n () => setNavigationRailExpanded(invertBoolean),\n [],\n );\n const toggleLauncherPlacement = useCallback(\n (wasOpen: boolean) => {\n const next = launcherPlacement === \"side\" ? \"bottom\" : \"side\";\n setNavigationRailExpanded(next === \"side\" && wasOpen);\n setLauncherPlacement(next);\n saveLauncherPlacement(launcherPlacementStorageKey, next);\n },\n [launcherPlacement, launcherPlacementStorageKey],\n );\n\n if (activeAppId === null) {\n return null;\n }\n\n return (\n <RoutedPaneWithRegistries\n key={activeAppId}\n {...props}\n AppBoundary={AppBoundary}\n activeAppId={activeAppId}\n appIds={offeredAppIds}\n launcherPlacement={launcherPlacement}\n navigationRailExpanded={navigationRailExpanded}\n onToggleLauncherPlacement={toggleLauncherPlacement}\n onToggleNavigationRail={toggleNavigationRail}\n tier={tier}\n />\n );\n}\n"]}
@@ -7,6 +7,7 @@ interface RoutedPaneTaskBarProps {
7
7
  launcherPlacement: LauncherPlacement;
8
8
  menuButtonRef: RefObject<HTMLButtonElement | null>;
9
9
  menuIcon: ReactNode;
10
+ onOpenStartMenuSettings?: (() => void) | undefined;
10
11
  onToggleDrawer: () => void;
11
12
  onToggleRail: () => void;
12
13
  railExpanded: boolean;
@@ -20,5 +21,5 @@ interface RoutedPaneTaskBarProps {
20
21
  * The corner hosts the tray. On mobile it hides while a text-editing control
21
22
  * has focus to leave room for the software keyboard.
22
23
  */
23
- export declare function RoutedPaneTaskBar({ drawerOpen, hidden, launcherPlacement, menuButtonRef, menuIcon, onToggleDrawer, onToggleRail, railExpanded, tier, tray, }: RoutedPaneTaskBarProps): import("react").JSX.Element;
24
+ export declare function RoutedPaneTaskBar({ drawerOpen, hidden, launcherPlacement, menuButtonRef, menuIcon, onOpenStartMenuSettings, onToggleDrawer, onToggleRail, railExpanded, tier, tray, }: RoutedPaneTaskBarProps): import("react").JSX.Element;
24
25
  export {};
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { StartMenuButton } from "../menu/StartMenuButton.js";
2
3
  import { ROUTED_PANE_NAV_PANEL_ID, ROUTED_PANE_SHEET_ID, } from "./RoutedPaneNav.js";
3
4
  /**
4
5
  * The routed shell's bottom taskbar — the routed counterpart of a desktop's
@@ -7,7 +8,7 @@ import { ROUTED_PANE_NAV_PANEL_ID, ROUTED_PANE_SHEET_ID, } from "./RoutedPaneNav
7
8
  * The corner hosts the tray. On mobile it hides while a text-editing control
8
9
  * has focus to leave room for the software keyboard.
9
10
  */
10
- export function RoutedPaneTaskBar({ drawerOpen, hidden, launcherPlacement, menuButtonRef, menuIcon, onToggleDrawer, onToggleRail, railExpanded, tier, tray, }) {
11
+ export function RoutedPaneTaskBar({ drawerOpen, hidden, launcherPlacement, menuButtonRef, menuIcon, onOpenStartMenuSettings, onToggleDrawer, onToggleRail, railExpanded, tier, tray, }) {
11
12
  const usesSheet = tier === "mobile" || launcherPlacement === "bottom";
12
13
  const expanded = usesSheet ? drawerOpen : railExpanded;
13
14
  // The launcher sheet stays mounted (just hidden), so keep its disclosure
@@ -19,6 +20,6 @@ export function RoutedPaneTaskBar({ drawerOpen, hidden, launcherPlacement, menuB
19
20
  : expanded
20
21
  ? ROUTED_PANE_NAV_PANEL_ID
21
22
  : undefined;
22
- return (_jsxs("footer", { className: "routed-pane-taskbar", hidden: hidden, children: [_jsx("button", { "aria-controls": controls, "aria-expanded": expanded, "aria-label": "Menu", className: "routed-pane-taskbar-menu-button", ref: menuButtonRef, type: "button", onClick: usesSheet ? onToggleDrawer : onToggleRail, children: menuIcon }), _jsx("div", { className: "routed-pane-taskbar-end", children: tray })] }));
23
+ return (_jsxs("footer", { className: "routed-pane-taskbar", hidden: hidden, children: [_jsx(StartMenuButton, { onOpenSettings: onOpenStartMenuSettings, "aria-controls": controls, "aria-expanded": expanded, "aria-label": "Menu", className: "routed-pane-taskbar-menu-button", ref: menuButtonRef, onClick: usesSheet ? onToggleDrawer : onToggleRail, children: menuIcon }), _jsx("div", { className: "routed-pane-taskbar-end", children: tray })] }));
23
24
  }
24
25
  //# sourceMappingURL=RoutedPaneTaskBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RoutedPaneTaskBar.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPaneTaskBar.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAezB;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,IAAI,GACmB;IACvB,MAAM,SAAS,GAAG,IAAI,KAAK,QAAQ,IAAI,iBAAiB,KAAK,QAAQ,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;IACvD,yEAAyE;IACzE,iEAAiE;IACjE,6EAA6E;IAC7E,4EAA4E;IAC5E,MAAM,QAAQ,GAAG,SAAS;QACxB,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,QAAQ;YACR,CAAC,CAAC,wBAAwB;YAC1B,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,CACL,kBAAQ,SAAS,EAAC,qBAAqB,EAAC,MAAM,EAAE,MAAM,aACpD,kCACiB,QAAQ,mBACR,QAAQ,gBACZ,MAAM,EACjB,SAAS,EAAC,iCAAiC,EAC3C,GAAG,EAAE,aAAa,EAClB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,YAEjD,QAAQ,GACF,EACT,cAAK,SAAS,EAAC,yBAAyB,YAAE,IAAI,GAAO,IAC9C,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode, RefObject } from \"react\";\nimport type { RoutedLayoutTier } from \"../launcher/useRoutedLayoutTier\";\nimport type { LauncherPlacement } from \"./launcherPlacement\";\nimport {\n ROUTED_PANE_NAV_PANEL_ID,\n ROUTED_PANE_SHEET_ID,\n} from \"./RoutedPaneNav\";\n\ninterface RoutedPaneTaskBarProps {\n drawerOpen: boolean;\n hidden: boolean;\n launcherPlacement: LauncherPlacement;\n menuButtonRef: RefObject<HTMLButtonElement | null>;\n menuIcon: ReactNode;\n onToggleDrawer: () => void;\n onToggleRail: () => void;\n railExpanded: boolean;\n tier: RoutedLayoutTier;\n tray: ReactNode;\n}\n\n/**\n * The routed shell's bottom taskbar — the routed counterpart of a desktop's\n * taskbar. Present in both tiers: the centered menu icon opens the launcher\n * sheet on mobile or in bottom mode, and reveals the rail in tablet side mode.\n * The corner hosts the tray. On mobile it hides while a text-editing control\n * has focus to leave room for the software keyboard.\n */\nexport function RoutedPaneTaskBar({\n drawerOpen,\n hidden,\n launcherPlacement,\n menuButtonRef,\n menuIcon,\n onToggleDrawer,\n onToggleRail,\n railExpanded,\n tier,\n tray,\n}: RoutedPaneTaskBarProps) {\n const usesSheet = tier === \"mobile\" || launcherPlacement === \"bottom\";\n const expanded = usesSheet ? drawerOpen : railExpanded;\n // The launcher sheet stays mounted (just hidden), so keep its disclosure\n // relationship wired regardless of open state. The tablet rail's\n // nav panel only exists while expanded, so reference it only then (mirroring\n // the rail toggle) rather than pointing aria-controls at an absent element.\n const controls = usesSheet\n ? ROUTED_PANE_SHEET_ID\n : expanded\n ? ROUTED_PANE_NAV_PANEL_ID\n : undefined;\n\n return (\n <footer className=\"routed-pane-taskbar\" hidden={hidden}>\n <button\n aria-controls={controls}\n aria-expanded={expanded}\n aria-label=\"Menu\"\n className=\"routed-pane-taskbar-menu-button\"\n ref={menuButtonRef}\n type=\"button\"\n onClick={usesSheet ? onToggleDrawer : onToggleRail}\n >\n {menuIcon}\n </button>\n <div className=\"routed-pane-taskbar-end\">{tray}</div>\n </footer>\n );\n}\n"]}
1
+ {"version":3,"file":"RoutedPaneTaskBar.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/routed/RoutedPaneTaskBar.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAgBzB;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,IAAI,GACmB;IACvB,MAAM,SAAS,GAAG,IAAI,KAAK,QAAQ,IAAI,iBAAiB,KAAK,QAAQ,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;IACvD,yEAAyE;IACzE,iEAAiE;IACjE,6EAA6E;IAC7E,4EAA4E;IAC5E,MAAM,QAAQ,GAAG,SAAS;QACxB,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,QAAQ;YACR,CAAC,CAAC,wBAAwB;YAC1B,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO,CACL,kBAAQ,SAAS,EAAC,qBAAqB,EAAC,MAAM,EAAE,MAAM,aACpD,KAAC,eAAe,IACd,cAAc,EAAE,uBAAuB,mBACxB,QAAQ,mBACR,QAAQ,gBACZ,MAAM,EACjB,SAAS,EAAC,iCAAiC,EAC3C,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,YAEjD,QAAQ,GACO,EAClB,cAAK,SAAS,EAAC,yBAAyB,YAAE,IAAI,GAAO,IAC9C,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode, RefObject } from \"react\";\nimport type { RoutedLayoutTier } from \"../launcher/useRoutedLayoutTier\";\nimport { StartMenuButton } from \"../menu/StartMenuButton\";\nimport type { LauncherPlacement } from \"./launcherPlacement\";\nimport {\n ROUTED_PANE_NAV_PANEL_ID,\n ROUTED_PANE_SHEET_ID,\n} from \"./RoutedPaneNav\";\n\ninterface RoutedPaneTaskBarProps {\n drawerOpen: boolean;\n hidden: boolean;\n launcherPlacement: LauncherPlacement;\n menuButtonRef: RefObject<HTMLButtonElement | null>;\n menuIcon: ReactNode;\n onOpenStartMenuSettings?: (() => void) | undefined;\n onToggleDrawer: () => void;\n onToggleRail: () => void;\n railExpanded: boolean;\n tier: RoutedLayoutTier;\n tray: ReactNode;\n}\n\n/**\n * The routed shell's bottom taskbar — the routed counterpart of a desktop's\n * taskbar. Present in both tiers: the centered menu icon opens the launcher\n * sheet on mobile or in bottom mode, and reveals the rail in tablet side mode.\n * The corner hosts the tray. On mobile it hides while a text-editing control\n * has focus to leave room for the software keyboard.\n */\nexport function RoutedPaneTaskBar({\n drawerOpen,\n hidden,\n launcherPlacement,\n menuButtonRef,\n menuIcon,\n onOpenStartMenuSettings,\n onToggleDrawer,\n onToggleRail,\n railExpanded,\n tier,\n tray,\n}: RoutedPaneTaskBarProps) {\n const usesSheet = tier === \"mobile\" || launcherPlacement === \"bottom\";\n const expanded = usesSheet ? drawerOpen : railExpanded;\n // The launcher sheet stays mounted (just hidden), so keep its disclosure\n // relationship wired regardless of open state. The tablet rail's\n // nav panel only exists while expanded, so reference it only then (mirroring\n // the rail toggle) rather than pointing aria-controls at an absent element.\n const controls = usesSheet\n ? ROUTED_PANE_SHEET_ID\n : expanded\n ? ROUTED_PANE_NAV_PANEL_ID\n : undefined;\n\n return (\n <footer className=\"routed-pane-taskbar\" hidden={hidden}>\n <StartMenuButton\n onOpenSettings={onOpenStartMenuSettings}\n aria-controls={controls}\n aria-expanded={expanded}\n aria-label=\"Menu\"\n className=\"routed-pane-taskbar-menu-button\"\n ref={menuButtonRef}\n onClick={usesSheet ? onToggleDrawer : onToggleRail}\n >\n {menuIcon}\n </StartMenuButton>\n <div className=\"routed-pane-taskbar-end\">{tray}</div>\n </footer>\n );\n}\n"]}