@tearleads/windowing 0.2.42 → 0.2.44

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.
Files changed (50) hide show
  1. package/desktop/DesktopIconMenu.d.ts +2 -1
  2. package/desktop/DesktopIconMenu.js +2 -2
  3. package/desktop/DesktopIconMenu.js.map +1 -1
  4. package/display/AppSwitch.d.ts +10 -0
  5. package/display/AppSwitch.js +5 -0
  6. package/display/AppSwitch.js.map +1 -0
  7. package/display/DisplayProperties.css +16 -4
  8. package/display/DisplayProperties.d.ts +3 -1
  9. package/display/DisplayProperties.js +18 -4
  10. package/display/DisplayProperties.js.map +1 -1
  11. package/docs/launcher.md +24 -0
  12. package/index.d.ts +2 -0
  13. package/index.js +2 -0
  14. package/index.js.map +1 -1
  15. package/launcher/LauncherMenuItem.d.ts +6 -0
  16. package/launcher/LauncherMenuItem.js +8 -0
  17. package/launcher/LauncherMenuItem.js.map +1 -0
  18. package/launcher/launcherDefinition.d.ts +2 -0
  19. package/launcher/launcherDefinition.js.map +1 -1
  20. package/launcher/storedPreference.d.ts +2 -1
  21. package/launcher/storedPreference.js +8 -4
  22. package/launcher/storedPreference.js.map +1 -1
  23. package/launcher/useLauncherEntryMenu.d.ts +14 -0
  24. package/launcher/useLauncherEntryMenu.js +23 -0
  25. package/launcher/useLauncherEntryMenu.js.map +1 -0
  26. package/menu/Menu.d.ts +2 -1
  27. package/menu/Menu.js +13 -14
  28. package/menu/Menu.js.map +1 -1
  29. package/menu/MenuItem.d.ts +3 -3
  30. package/menu/MenuItem.js +2 -2
  31. package/menu/MenuItem.js.map +1 -1
  32. package/menu/StartMenu.js +5 -1
  33. package/menu/StartMenu.js.map +1 -1
  34. package/menu/StartMenuPreferencesProvider.d.ts +18 -0
  35. package/menu/StartMenuPreferencesProvider.js +33 -0
  36. package/menu/StartMenuPreferencesProvider.js.map +1 -0
  37. package/menu/menuOwnership.d.ts +4 -0
  38. package/menu/menuOwnership.js +25 -0
  39. package/menu/menuOwnership.js.map +1 -0
  40. package/menu/startMenuStore.d.ts +8 -0
  41. package/menu/startMenuStore.js +92 -0
  42. package/menu/startMenuStore.js.map +1 -0
  43. package/menu/useMenuKeyboard.js +2 -1
  44. package/menu/useMenuKeyboard.js.map +1 -1
  45. package/package.json +1 -1
  46. package/routed/RoutedPane.js +6 -1
  47. package/routed/RoutedPane.js.map +1 -1
  48. package/routed/RoutedPaneNav.css +2 -0
  49. package/routed/RoutedPaneNav.js +37 -10
  50. package/routed/RoutedPaneNav.js.map +1 -1
@@ -9,7 +9,8 @@ export interface DesktopIconMenuItem {
9
9
  onSelect: () => void;
10
10
  }
11
11
  /** An icon's context menu: Open, then the host's items. Each closes it. */
12
- export declare function DesktopIconMenu({ icon, items, onClose, onOpen, position, }: {
12
+ export declare function DesktopIconMenu({ id, icon, items, onClose, onOpen, position, }: {
13
+ id?: string | undefined;
13
14
  icon: WindowingIcon | undefined;
14
15
  items: ReadonlyArray<DesktopIconMenuItem>;
15
16
  onClose: () => void;
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Menu } from "../menu/Menu.js";
3
3
  import { MenuItem } from "../menu/MenuItem.js";
4
4
  /** An icon's context menu: Open, then the host's items. Each closes it. */
5
- export function DesktopIconMenu({ icon, items, onClose, onOpen, position, }) {
6
- return (_jsxs(Menu, { direction: "down", onClose: onClose, position: position, children: [_jsx(MenuItem, { icon: icon, label: "Open", onClick: () => {
5
+ export function DesktopIconMenu({ id, icon, items, onClose, onOpen, position, }) {
6
+ return (_jsxs(Menu, { id: id, direction: "down", onClose: onClose, position: position, children: [_jsx(MenuItem, { icon: icon, label: "Open", onClick: () => {
7
7
  onClose();
8
8
  onOpen();
9
9
  } }), items.map((item) => (_jsx(MenuItem, { disabled: item.disabled, icon: item.icon, label: item.label, onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"DesktopIconMenu.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/desktop/DesktopIconMenu.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAqB,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAW5C,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAOT;IACC,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,aACzD,KAAC,QAAQ,IACP,IAAI,EAAE,IAAI,EACV,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;oBACV,MAAM,EAAE,CAAC;gBACX,CAAC,GACD,EACD,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,KAAC,QAAQ,IACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EAEf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;oBACV,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,CAAC,IALI,IAAI,CAAC,EAAE,CAMZ,CACH,CAAC,IACG,CACR,CAAC;AACJ,CAAC","sourcesContent":["import type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { Menu, type MenuPosition } from \"../menu/Menu\";\nimport { MenuItem } from \"../menu/MenuItem\";\n\n/** An item a host adds to an icon's context menu, below Open. */\nexport interface DesktopIconMenuItem {\n disabled?: boolean | undefined;\n icon?: WindowingIcon | undefined;\n id: string;\n label: string;\n onSelect: () => void;\n}\n\n/** An icon's context menu: Open, then the host's items. Each closes it. */\nexport function DesktopIconMenu({\n icon,\n items,\n onClose,\n onOpen,\n position,\n}: {\n icon: WindowingIcon | undefined;\n items: ReadonlyArray<DesktopIconMenuItem>;\n onClose: () => void;\n onOpen: () => void;\n position: MenuPosition;\n}) {\n return (\n <Menu direction=\"down\" onClose={onClose} position={position}>\n <MenuItem\n icon={icon}\n label=\"Open\"\n onClick={() => {\n onClose();\n onOpen();\n }}\n />\n {items.map((item) => (\n <MenuItem\n disabled={item.disabled}\n icon={item.icon}\n key={item.id}\n label={item.label}\n onClick={() => {\n onClose();\n item.onSelect();\n }}\n />\n ))}\n </Menu>\n );\n}\n"]}
1
+ {"version":3,"file":"DesktopIconMenu.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/desktop/DesktopIconMenu.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAqB,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAW5C,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,EAC9B,EAAE,EACF,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAQT;IACC,OAAO,CACL,MAAC,IAAI,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,aACjE,KAAC,QAAQ,IACP,IAAI,EAAE,IAAI,EACV,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;oBACV,MAAM,EAAE,CAAC;gBACX,CAAC,GACD,EACD,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,KAAC,QAAQ,IACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EAEf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;oBACV,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,CAAC,IALI,IAAI,CAAC,EAAE,CAMZ,CACH,CAAC,IACG,CACR,CAAC;AACJ,CAAC","sourcesContent":["import type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { Menu, type MenuPosition } from \"../menu/Menu\";\nimport { MenuItem } from \"../menu/MenuItem\";\n\n/** An item a host adds to an icon's context menu, below Open. */\nexport interface DesktopIconMenuItem {\n disabled?: boolean | undefined;\n icon?: WindowingIcon | undefined;\n id: string;\n label: string;\n onSelect: () => void;\n}\n\n/** An icon's context menu: Open, then the host's items. Each closes it. */\nexport function DesktopIconMenu({\n id,\n icon,\n items,\n onClose,\n onOpen,\n position,\n}: {\n id?: string | undefined;\n icon: WindowingIcon | undefined;\n items: ReadonlyArray<DesktopIconMenuItem>;\n onClose: () => void;\n onOpen: () => void;\n position: MenuPosition;\n}) {\n return (\n <Menu id={id} direction=\"down\" onClose={onClose} position={position}>\n <MenuItem\n icon={icon}\n label=\"Open\"\n onClick={() => {\n onClose();\n onOpen();\n }}\n />\n {items.map((item) => (\n <MenuItem\n disabled={item.disabled}\n icon={item.icon}\n key={item.id}\n label={item.label}\n onClick={() => {\n onClose();\n item.onSelect();\n }}\n />\n ))}\n </Menu>\n );\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { WindowingIcon } from "../icons/windowingIcon.js";
2
+ interface AppSwitchProps {
3
+ checked: boolean;
4
+ className: string;
5
+ icon?: WindowingIcon | undefined;
6
+ onChange: (checked: boolean) => void;
7
+ title: string;
8
+ }
9
+ export declare function AppSwitch({ checked, className, icon: Icon, onChange, title, }: AppSwitchProps): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function AppSwitch({ checked, className, icon: Icon, onChange, title, }) {
3
+ return (_jsxs("label", { className: `display-properties-app-switch ${className}`, children: [Icon && (_jsx(Icon, { className: `${className}-icon`, "aria-hidden": "true", focusable: "false", size: 16 })), _jsx("span", { className: "display-properties-label", children: title }), _jsx("input", { "aria-checked": checked, checked: checked, className: "display-properties-switch", onChange: (event) => onChange(event.currentTarget.checked), role: "switch", type: "checkbox" })] }));
4
+ }
5
+ //# sourceMappingURL=AppSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppSwitch.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/display/AppSwitch.tsx"],"names":[],"mappings":";AAUA,MAAM,UAAU,SAAS,CAAC,EACxB,OAAO,EACP,SAAS,EACT,IAAI,EAAE,IAAI,EACV,QAAQ,EACR,KAAK,GACU;IACf,OAAO,CACL,iBAAO,SAAS,EAAE,iCAAiC,SAAS,EAAE,aAC3D,IAAI,IAAI,CACP,KAAC,IAAI,IACH,SAAS,EAAE,GAAG,SAAS,OAAO,iBAClB,MAAM,EAClB,SAAS,EAAC,OAAO,EACjB,IAAI,EAAE,EAAE,GACR,CACH,EACD,eAAM,SAAS,EAAC,0BAA0B,YAAE,KAAK,GAAQ,EACzD,gCACgB,OAAO,EACrB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,2BAA2B,EACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,EAC1D,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,GACf,IACI,CACT,CAAC;AACJ,CAAC","sourcesContent":["import type { WindowingIcon } from \"../icons/windowingIcon\";\n\ninterface AppSwitchProps {\n checked: boolean;\n className: string;\n icon?: WindowingIcon | undefined;\n onChange: (checked: boolean) => void;\n title: string;\n}\n\nexport function AppSwitch({\n checked,\n className,\n icon: Icon,\n onChange,\n title,\n}: AppSwitchProps) {\n return (\n <label className={`display-properties-app-switch ${className}`}>\n {Icon && (\n <Icon\n className={`${className}-icon`}\n aria-hidden=\"true\"\n focusable=\"false\"\n size={16}\n />\n )}\n <span className=\"display-properties-label\">{title}</span>\n <input\n aria-checked={checked}\n checked={checked}\n className=\"display-properties-switch\"\n onChange={(event) => onChange(event.currentTarget.checked)}\n role=\"switch\"\n type=\"checkbox\"\n />\n </label>\n );\n}\n"]}
@@ -122,7 +122,14 @@
122
122
  max-width: 24rem;
123
123
  }
124
124
 
125
- .display-properties-tray-app {
125
+ .display-properties-menu-apps {
126
+ display: grid;
127
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
128
+ gap: var(--space-2xs);
129
+ }
130
+
131
+ .display-properties-app-switch {
132
+ min-width: 0;
126
133
  display: flex;
127
134
  align-items: center;
128
135
  gap: var(--space-sm);
@@ -131,15 +138,20 @@
131
138
  cursor: pointer;
132
139
  }
133
140
 
134
- .display-properties-tray-app:hover {
141
+ .display-properties-app-switch:hover {
135
142
  background: var(--app-hover-surface);
136
143
  }
137
144
 
138
- .display-properties-tray-app .display-properties-label {
145
+ .display-properties-app-switch .display-properties-label {
139
146
  flex: 1 1 auto;
140
147
  }
141
148
 
142
- .display-properties-tray-app-icon {
149
+ .display-properties-menu-app .display-properties-label {
150
+ overflow-wrap: anywhere;
151
+ white-space: normal;
152
+ }
153
+
154
+ .display-properties-app-switch svg {
143
155
  flex: 0 0 auto;
144
156
  }
145
157
 
@@ -7,4 +7,6 @@
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(): import("react").JSX.Element;
10
+ export declare function DisplayProperties({ startMenuAppIds, }?: {
11
+ startMenuAppIds?: readonly string[];
12
+ }): import("react").JSX.Element;
@@ -1,10 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
+ import { resolveLauncherOrder } from "../launcher/launcherDefinition.js";
4
+ import { useOptionalStartMenuPreferences } from "../menu/StartMenuPreferencesProvider.js";
3
5
  import { useOptionalTheme } from "../theme/ThemeProvider.js";
4
6
  import { useOptionalSystemTray } from "../tray/SystemTrayProvider.js";
5
7
  import { useOptionalWallpaper } from "../wallpaper/WallpaperProvider.js";
6
8
  import { wallpaperStyle } from "../wallpaper/wallpapers.js";
7
9
  import { useSuppressWindowToolbar } from "../window/CurrentWindowContext.js";
10
+ import { AppSwitch } from "./AppSwitch.js";
8
11
  import "../wallpaper/Wallpaper.css";
9
12
  import "./DisplayProperties.css";
10
13
  function BackgroundSection() {
@@ -34,8 +37,19 @@ function SystemTraySection() {
34
37
  if (!app) {
35
38
  return null;
36
39
  }
37
- const { icon: Icon, title } = app;
38
- return (_jsxs("label", { className: "display-properties-tray-app", children: [Icon && (_jsx(Icon, { "aria-hidden": "true", className: "display-properties-tray-app-icon", focusable: "false", size: 16 })), _jsx("span", { className: "display-properties-label", children: title }), _jsx("input", { "aria-checked": isEnabled(id), checked: isEnabled(id), className: "display-properties-switch", onChange: (event) => setEnabled(id, event.currentTarget.checked), role: "switch", type: "checkbox" })] }, id));
40
+ return (_jsx(AppSwitch, { className: "display-properties-tray-app", icon: app.icon, title: app.title, checked: isEnabled(id), onChange: (enabled) => setEnabled(id, enabled) }, id));
41
+ }) })] }));
42
+ }
43
+ function StartMenuSection({ appIds, }) {
44
+ const preferences = useOptionalStartMenuPreferences();
45
+ if (!preferences)
46
+ return null;
47
+ const ids = (appIds ?? resolveLauncherOrder(preferences.definition)).filter((id) => preferences.configurableIds.includes(id));
48
+ if (!ids.length)
49
+ return null;
50
+ return (_jsxs("fieldset", { className: "display-properties-section", children: [_jsx("legend", { children: "Start menu" }), _jsx("div", { className: "display-properties-menu-apps", children: ids.map((id) => {
51
+ const app = preferences.definition.apps[id];
52
+ return (app && (_jsx(AppSwitch, { icon: app.icon, className: "display-properties-menu-app", title: app.iconLabel ?? app.title, checked: preferences.isVisible(id), onChange: (visible) => preferences.setVisible(id, visible) }, id)));
39
53
  }) })] }));
40
54
  }
41
55
  /**
@@ -47,8 +61,8 @@ function SystemTraySection() {
47
61
  * apps, is left out. It has no toolbar actions, so its window shows no
48
62
  * toolbar row.
49
63
  */
50
- export function DisplayProperties() {
64
+ export function DisplayProperties({ startMenuAppIds, } = {}) {
51
65
  useSuppressWindowToolbar(true);
52
- return (_jsxs("div", { className: "display-properties", children: [_jsx(BackgroundSection, {}), _jsx(ThemeSection, {}), _jsx(SystemTraySection, {})] }));
66
+ return (_jsxs("div", { className: "display-properties", children: [_jsx(BackgroundSection, {}), _jsx(ThemeSection, {}), _jsx(SystemTraySection, {}), _jsx(StartMenuSection, { appIds: startMenuAppIds })] }));
53
67
  }
54
68
  //# sourceMappingURL=DisplayProperties.js.map
@@ -1 +1 @@
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,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,4BAA4B,CAAC;AACpC,OAAO,yBAAyB,CAAC;AAEjC,SAAS,iBAAiB;IACxB,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC;IACrB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,oBAAU,SAAS,EAAC,4BAA4B,aAC9C,0CAA2B,EAC3B,cAAK,SAAS,EAAC,+BAA+B,YAC3C,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACpC,iBAAO,SAAS,EAAC,8BAA8B,aAC7C,gBACE,OAAO,EAAE,MAAM,CAAC,EAAE,KA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CAAC,EAE7C,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,GACf,KAnBgD,EAAE,CAoB9C,CACT,CAAC;gBACJ,CAAC,CAAC,GACE,IACG,CACZ,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB;IAC/B,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,IACjB,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useId } from \"react\";\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 \"../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 const { icon: Icon, title } = app;\n return (\n <label className=\"display-properties-tray-app\" key={id}>\n {Icon && (\n <Icon\n aria-hidden=\"true\"\n className=\"display-properties-tray-app-icon\"\n focusable=\"false\"\n size={16}\n />\n )}\n <span className=\"display-properties-label\">{title}</span>\n <input\n aria-checked={isEnabled(id)}\n checked={isEnabled(id)}\n className=\"display-properties-switch\"\n onChange={(event) =>\n setEnabled(id, event.currentTarget.checked)\n }\n role=\"switch\"\n type=\"checkbox\"\n />\n </label>\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 useSuppressWindowToolbar(true);\n return (\n <div className=\"display-properties\">\n <BackgroundSection />\n <ThemeSection />\n <SystemTraySection />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"DisplayProperties.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/wind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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"]}
package/docs/launcher.md CHANGED
@@ -34,6 +34,30 @@ host's own button styles apply alone. A menu that needs more than a list passes
34
34
  and a `close` callback. Tearleads' footer does this in
35
35
  [`packages/app/src/shell/pane/footer/PaneFooter.tsx`][pane-footer].
36
36
 
37
+ ### Start menu preferences
38
+
39
+ Wrap the desktop and routed shells in a shared provider to let users choose
40
+ which mini-apps appear in their launchers.
41
+
42
+ ```tsx
43
+ <StartMenuPreferencesProvider definition={LAUNCHER} storageKey="myApp.startMenu">
44
+ <Desktop />
45
+ </StartMenuPreferencesProvider>
46
+ ```
47
+
48
+ Each mini-app can set `startMenuVisibility` in its launcher definition.
49
+ The default is `"visible"`. Use `"hidden"` to let users opt in or `"pinned"`
50
+ to keep an entry such as Settings available. The provider uses launcher order
51
+ for the default switches. It saves each choice under the host's storage key
52
+ prefix and shares changes across tabs.
53
+
54
+ `DisplayProperties` renders the switches and accepts `startMenuAppIds` to match
55
+ a custom launcher's eligible apps and order. `StartMenu` matches item IDs to
56
+ mini-app IDs, and `RoutedPane` filters its launcher links. A custom
57
+ `renderMenu` can filter app entries with `useStartMenuPreferences().isVisible`.
58
+ Call `reset()` on the same preferences to restore the host's defaults.
59
+ Desktop icons, direct routes, and open windows remain available.
60
+
37
61
  ## Launching mini-apps
38
62
 
39
63
  A launcher application is a set of mini-apps, defined once and shown either in
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { DisplayProperties } from "./display/DisplayProperties.js";
7
7
  export { type WindowingIcons, WindowingIconsProvider, } from "./icons/WindowingIcons.js";
8
8
  export type { WindowingIcon, WindowingIconProps } from "./icons/windowingIcon.js";
9
9
  export { ROUTED_TABLET_BREAKPOINT_PX, ROUTED_TABLET_QUERY, WINDOWED_LAYOUT_MIN_WIDTH_PX, } from "./launcher/breakpoints.js";
10
+ export { LauncherMenuItem } from "./launcher/LauncherMenuItem.js";
10
11
  export { type LauncherNavigationActions, LauncherNavigationProvider, type LauncherNavigationState, useLauncherNavigationActions, useLauncherNavigationState, useMiniAppRouteSegments, useOptionalLauncherNavigationState, } from "./launcher/LauncherNavigationProvider.js";
11
12
  export { isLauncherAppId, type LauncherDefinition, type MiniAppDefinition, resolveLauncherHomeAppId, resolveLauncherOrder, } from "./launcher/launcherDefinition.js";
12
13
  export { MiniAppRouteSegmentsProvider, useMiniAppWindowRouteSegments, } from "./launcher/MiniAppRouteSegmentsContext.js";
@@ -26,6 +27,7 @@ export { type RoutedLayoutTier, useRoutedLayoutTier, } from "./launcher/useRoute
26
27
  export { Menu, type MenuPosition } from "./menu/Menu.js";
27
28
  export { MenuItem, type MenuItemProps } from "./menu/MenuItem.js";
28
29
  export { StartMenu, type StartMenuItem, type StartMenuProps, } from "./menu/StartMenu.js";
30
+ export { StartMenuPreferencesProvider, useOptionalStartMenuPreferences, useStartMenuPreferences, } from "./menu/StartMenuPreferencesProvider.js";
29
31
  export { type ContextMenuState, useContextMenuPositionState, useContextMenuState, } from "./menu/useContextMenuState.js";
30
32
  export { useLongPress } from "./menu/useLongPress.js";
31
33
  export { RoutedPane, type RoutedPaneProps } from "./routed/RoutedPane.js";
package/index.js CHANGED
@@ -12,6 +12,7 @@ export { createMemoryDesktopStateStorage, createOpfsDesktopStateStorage, } from
12
12
  export { DisplayProperties } from "./display/DisplayProperties.js";
13
13
  export { WindowingIconsProvider, } from "./icons/WindowingIcons.js";
14
14
  export { ROUTED_TABLET_BREAKPOINT_PX, ROUTED_TABLET_QUERY, WINDOWED_LAYOUT_MIN_WIDTH_PX, } from "./launcher/breakpoints.js";
15
+ export { LauncherMenuItem } from "./launcher/LauncherMenuItem.js";
15
16
  export { LauncherNavigationProvider, useLauncherNavigationActions, useLauncherNavigationState, useMiniAppRouteSegments, useOptionalLauncherNavigationState, } from "./launcher/LauncherNavigationProvider.js";
16
17
  export { isLauncherAppId, resolveLauncherHomeAppId, resolveLauncherOrder, } from "./launcher/launcherDefinition.js";
17
18
  export { MiniAppRouteSegmentsProvider, useMiniAppWindowRouteSegments, } from "./launcher/MiniAppRouteSegmentsContext.js";
@@ -31,6 +32,7 @@ export { useRoutedLayoutTier, } from "./launcher/useRoutedLayoutTier.js";
31
32
  export { Menu } from "./menu/Menu.js";
32
33
  export { MenuItem } from "./menu/MenuItem.js";
33
34
  export { StartMenu, } from "./menu/StartMenu.js";
35
+ export { StartMenuPreferencesProvider, useOptionalStartMenuPreferences, useStartMenuPreferences, } from "./menu/StartMenuPreferencesProvider.js";
34
36
  export { useContextMenuPositionState, useContextMenuState, } from "./menu/useContextMenuState.js";
35
37
  export { useLongPress } from "./menu/useLongPress.js";
36
38
  export { RoutedPane } from "./routed/RoutedPane.js";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../home/runner/work/tearleads/tearleads/packages/windowing/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,sEAAsE;AACtE,6BAA6B;AAC7B,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,YAAY,GAEb,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,GAG9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAEL,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,0BAA0B,EAE1B,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,kCAAkC,GACnC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,eAAe,EAGf,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAwB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACL,wBAAwB,EAGxB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO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AMlD,OAAO,EAAE,UAAU,EAA2B,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,GACd,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,gBAAgB,GAEjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAA8B,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAQlB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["import \"./tokens.css\";\n\n// The public windowing API: window state, window chrome and its registration\n// hooks, the menu and sidebar primitives the chrome renders with, a taskbar's\n// start menu, theme switch, and system tray, the icons the chrome draws, a\n// launcher of mini-apps that shows them in windows or in the routed (iPad /\n// phone) shell, and desktop icons that open them, with a storage adapter for\n// their layout, over a wallpaper chosen in Display Properties, plus a\n// host-supplied screensaver.\nexport {\n createRequiredContext,\n type RequiredContext,\n} from \"./createRequiredContext\";\nexport type { DesktopIconMenuItem } from \"./desktop/DesktopIconMenu\";\nexport {\n DesktopIcons,\n type DesktopIconsProps,\n} from \"./desktop/DesktopIcons\";\nexport type {\n DesktopIconPosition,\n DesktopState,\n} from \"./desktop/desktopState\";\nexport {\n createMemoryDesktopStateStorage,\n createOpfsDesktopStateStorage,\n type DesktopStateStorage,\n type OpfsDesktopStateStorageOptions,\n} from \"./desktop/desktopStateStorage\";\nexport { DisplayProperties } from \"./display/DisplayProperties\";\nexport {\n type WindowingIcons,\n WindowingIconsProvider,\n} from \"./icons/WindowingIcons\";\nexport type { WindowingIcon, WindowingIconProps } from \"./icons/windowingIcon\";\nexport {\n ROUTED_TABLET_BREAKPOINT_PX,\n ROUTED_TABLET_QUERY,\n WINDOWED_LAYOUT_MIN_WIDTH_PX,\n} from \"./launcher/breakpoints\";\nexport {\n type LauncherNavigationActions,\n LauncherNavigationProvider,\n type LauncherNavigationState,\n useLauncherNavigationActions,\n useLauncherNavigationState,\n useMiniAppRouteSegments,\n useOptionalLauncherNavigationState,\n} from \"./launcher/LauncherNavigationProvider\";\nexport {\n isLauncherAppId,\n type LauncherDefinition,\n type MiniAppDefinition,\n resolveLauncherHomeAppId,\n resolveLauncherOrder,\n} from \"./launcher/launcherDefinition\";\nexport {\n MiniAppRouteSegmentsProvider,\n useMiniAppWindowRouteSegments,\n} from \"./launcher/MiniAppRouteSegmentsContext\";\nexport { type MiniAppBoundary, MiniAppWindow } from \"./launcher/MiniAppWindow\";\nexport {\n NavigationModeOverrideProvider,\n useNavigationModeOverride,\n useOptionalNavigationModeOverride,\n} from \"./launcher/NavigationModeOverrideProvider\";\nexport { NavigationModeSwitch } from \"./launcher/NavigationModeSwitch\";\nexport {\n isWindowedLayoutEligible,\n type NavigationEnvironment,\n type NavigationMode,\n readNavigationEnvironment,\n resolveNavigationMode,\n} from \"./launcher/navigationMode\";\nexport {\n DEFAULT_MINI_APP_POSITION,\n type MiniAppWindowPlacement,\n type OpenMiniAppRequest,\n type PlaceMiniAppWindow,\n} from \"./launcher/openMiniAppWindow\";\nexport {\n buildMiniAppPath,\n type LauncherRoute,\n parseLauncherRoute,\n} from \"./launcher/routePaths\";\nexport {\n resolveActiveLauncherRoute,\n useActiveLauncherRoute,\n} from \"./launcher/useActiveLauncherRoute\";\nexport { useCompactRoutedMode } from \"./launcher/useCompactRoutedMode\";\nexport {\n type MiniAppRouteSetOptions,\n useMiniAppRouteState,\n} from \"./launcher/useMiniAppRouteState\";\nexport { useNavigationMode } from \"./launcher/useNavigationMode\";\nexport { useNavigationModeDocumentAttribute } from \"./launcher/useNavigationModeDocumentAttribute\";\nexport {\n useRoutedLayoutActive,\n useWindowedLayoutActive,\n} from \"./launcher/useRoutedLayoutActive\";\nexport {\n type RoutedLayoutTier,\n useRoutedLayoutTier,\n} from \"./launcher/useRoutedLayoutTier\";\nexport { Menu, type MenuPosition } from \"./menu/Menu\";\nexport { MenuItem, type MenuItemProps } from \"./menu/MenuItem\";\nexport {\n StartMenu,\n type StartMenuItem,\n type StartMenuProps,\n} from \"./menu/StartMenu\";\nexport {\n type ContextMenuState,\n useContextMenuPositionState,\n useContextMenuState,\n} from \"./menu/useContextMenuState\";\nexport { useLongPress } from \"./menu/useLongPress\";\nexport { RoutedPane, type RoutedPaneProps } from \"./routed/RoutedPane\";\nexport {\n RoutedPaneOverlayHostProvider,\n type RoutedPaneOverlayHostValue,\n useRoutedPaneOverlayHost,\n} from \"./routed/RoutedPaneOverlayHost\";\nexport type { SubscribeKeyboardVisibility } from \"./routed/useMobileKeyboardVisible\";\nexport { LaserScreensaver } from \"./screensaver/LaserScreensaver\";\nexport {\n type ScreensaverControls,\n ScreensaverProvider,\n type ScreensaverProviderProps,\n useOptionalScreensaver,\n useScreensaver,\n} from \"./screensaver/ScreensaverProvider\";\nexport type { ScreensaverPinVerifier } from \"./screensaver/screensaverPinVerifier\";\nexport { SidebarResizeHandle, useSidebarResize } from \"./sidebar/SidebarResize\";\nexport {\n ThemeProvider,\n useOptionalTheme,\n useTheme,\n} from \"./theme/ThemeProvider\";\nexport { ThemeSwitch } from \"./theme/ThemeSwitch\";\nexport type {\n DefaultTheme,\n ThemeDefinition,\n ThemeScheme,\n} from \"./theme/themes\";\nexport { SystemTray, type SystemTrayMenuItem } from \"./tray/SystemTray\";\nexport {\n SystemTrayProvider,\n useOptionalSystemTray,\n useSystemTray,\n} from \"./tray/SystemTrayProvider\";\nexport type {\n SystemTrayDefinition,\n TrayAppDefinition,\n} from \"./tray/systemTrayDefinition\";\nexport {\n DesktopWallpaper,\n type DesktopWallpaperProps,\n} from \"./wallpaper/DesktopWallpaper\";\nexport {\n BLOCKS_WALLPAPER,\n CHEVRON_WALLPAPER,\n HARLEQUIN_WALLPAPER,\n HONEYCOMB_WALLPAPER,\n PLAIN_WALLPAPER,\n TRIANGLES_WALLPAPER,\n} from \"./wallpaper/tessellations\";\nexport {\n useOptionalWallpaper,\n useWallpaper,\n WallpaperProvider,\n} from \"./wallpaper/WallpaperProvider\";\nexport type {\n WallpaperDefinition,\n WallpaperTile,\n} from \"./wallpaper/wallpapers\";\nexport {\n CurrentWindowProvider,\n useCurrentWindow,\n useSuppressWindowToolbar,\n useWindowBackground,\n useWindowContentSize,\n} from \"./window/CurrentWindowContext\";\nexport { Window, type WindowContentBoundary } from \"./window/Window\";\nexport { WindowTitleBarActionButtons } from \"./window/WindowChromeActions\";\nexport { WindowCloseButton } from \"./window/WindowCloseButton\";\nexport {\n useWindowBackAction,\n useWindowBackActionValue,\n useWindowFileMenuItem,\n useWindowRefreshMenuItem,\n useWindowRefreshMenuItemValue,\n useWindowTitleBarAction,\n useWindowTitleBarActions,\n useWindowToolbarReservation,\n useWindowViewMenuItem,\n WindowMenuProvider,\n} from \"./window/WindowMenuContext\";\nexport {\n hasWindowSidebar,\n useRegisteredWindowSidebar,\n useWindowSidebar,\n WindowSidebarProvider,\n} from \"./window/WindowSidebarContext\";\nexport {\n findTopWindow,\n useWindowActions,\n useWindowStateData,\n type WindowCreateOptions,\n type WindowEntry,\n type WindowGeometry,\n type WindowPosition,\n type WindowSize,\n type WindowStateActions,\n type WindowStateData,\n WindowStateProvider,\n} from \"./window/WindowStateProvider\";\nexport { WindowToolBar } from \"./window/WindowToolBar\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../home/runner/work/tearleads/tearleads/packages/windowing/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,sEAAsE;AACtE,6BAA6B;AAC7B,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,YAAY,GAEb,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,GAG9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAEL,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAEL,0BAA0B,EAE1B,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,kCAAkC,GACnC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,eAAe,EAGf,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAwB,aAAa,EAAE,MAAM,0BAA0B,CAAC;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BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAQlB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["import \"./tokens.css\";\n\n// The public windowing API: window state, window chrome and its registration\n// hooks, the menu and sidebar primitives the chrome renders with, a taskbar's\n// start menu, theme switch, and system tray, the icons the chrome draws, a\n// launcher of mini-apps that shows them in windows or in the routed (iPad /\n// phone) shell, and desktop icons that open them, with a storage adapter for\n// their layout, over a wallpaper chosen in Display Properties, plus a\n// host-supplied screensaver.\nexport {\n createRequiredContext,\n type RequiredContext,\n} from \"./createRequiredContext\";\nexport type { DesktopIconMenuItem } from \"./desktop/DesktopIconMenu\";\nexport {\n DesktopIcons,\n type DesktopIconsProps,\n} from \"./desktop/DesktopIcons\";\nexport type {\n DesktopIconPosition,\n DesktopState,\n} from \"./desktop/desktopState\";\nexport {\n createMemoryDesktopStateStorage,\n createOpfsDesktopStateStorage,\n type DesktopStateStorage,\n type OpfsDesktopStateStorageOptions,\n} from \"./desktop/desktopStateStorage\";\nexport { DisplayProperties } from \"./display/DisplayProperties\";\nexport {\n type WindowingIcons,\n WindowingIconsProvider,\n} from \"./icons/WindowingIcons\";\nexport type { WindowingIcon, WindowingIconProps } from \"./icons/windowingIcon\";\nexport {\n ROUTED_TABLET_BREAKPOINT_PX,\n ROUTED_TABLET_QUERY,\n WINDOWED_LAYOUT_MIN_WIDTH_PX,\n} from \"./launcher/breakpoints\";\nexport { LauncherMenuItem } from \"./launcher/LauncherMenuItem\";\nexport {\n type LauncherNavigationActions,\n LauncherNavigationProvider,\n type LauncherNavigationState,\n useLauncherNavigationActions,\n useLauncherNavigationState,\n useMiniAppRouteSegments,\n useOptionalLauncherNavigationState,\n} from \"./launcher/LauncherNavigationProvider\";\nexport {\n isLauncherAppId,\n type LauncherDefinition,\n type MiniAppDefinition,\n resolveLauncherHomeAppId,\n resolveLauncherOrder,\n} from \"./launcher/launcherDefinition\";\nexport {\n MiniAppRouteSegmentsProvider,\n useMiniAppWindowRouteSegments,\n} from \"./launcher/MiniAppRouteSegmentsContext\";\nexport { type MiniAppBoundary, MiniAppWindow } from \"./launcher/MiniAppWindow\";\nexport {\n NavigationModeOverrideProvider,\n useNavigationModeOverride,\n useOptionalNavigationModeOverride,\n} from \"./launcher/NavigationModeOverrideProvider\";\nexport { NavigationModeSwitch } from \"./launcher/NavigationModeSwitch\";\nexport {\n isWindowedLayoutEligible,\n type NavigationEnvironment,\n type NavigationMode,\n readNavigationEnvironment,\n resolveNavigationMode,\n} from \"./launcher/navigationMode\";\nexport {\n DEFAULT_MINI_APP_POSITION,\n type MiniAppWindowPlacement,\n type OpenMiniAppRequest,\n type PlaceMiniAppWindow,\n} from \"./launcher/openMiniAppWindow\";\nexport {\n buildMiniAppPath,\n type LauncherRoute,\n parseLauncherRoute,\n} from \"./launcher/routePaths\";\nexport {\n resolveActiveLauncherRoute,\n useActiveLauncherRoute,\n} from \"./launcher/useActiveLauncherRoute\";\nexport { useCompactRoutedMode } from \"./launcher/useCompactRoutedMode\";\nexport {\n type MiniAppRouteSetOptions,\n useMiniAppRouteState,\n} from \"./launcher/useMiniAppRouteState\";\nexport { useNavigationMode } from \"./launcher/useNavigationMode\";\nexport { useNavigationModeDocumentAttribute } from \"./launcher/useNavigationModeDocumentAttribute\";\nexport {\n useRoutedLayoutActive,\n useWindowedLayoutActive,\n} from \"./launcher/useRoutedLayoutActive\";\nexport {\n type RoutedLayoutTier,\n useRoutedLayoutTier,\n} from \"./launcher/useRoutedLayoutTier\";\nexport { Menu, type MenuPosition } from \"./menu/Menu\";\nexport { MenuItem, type MenuItemProps } from \"./menu/MenuItem\";\nexport {\n StartMenu,\n type StartMenuItem,\n type StartMenuProps,\n} from \"./menu/StartMenu\";\nexport {\n StartMenuPreferencesProvider,\n useOptionalStartMenuPreferences,\n useStartMenuPreferences,\n} from \"./menu/StartMenuPreferencesProvider\";\nexport {\n type ContextMenuState,\n useContextMenuPositionState,\n useContextMenuState,\n} from \"./menu/useContextMenuState\";\nexport { useLongPress } from \"./menu/useLongPress\";\nexport { RoutedPane, type RoutedPaneProps } from \"./routed/RoutedPane\";\nexport {\n RoutedPaneOverlayHostProvider,\n type RoutedPaneOverlayHostValue,\n useRoutedPaneOverlayHost,\n} from \"./routed/RoutedPaneOverlayHost\";\nexport type { SubscribeKeyboardVisibility } from \"./routed/useMobileKeyboardVisible\";\nexport { LaserScreensaver } from \"./screensaver/LaserScreensaver\";\nexport {\n type ScreensaverControls,\n ScreensaverProvider,\n type ScreensaverProviderProps,\n useOptionalScreensaver,\n useScreensaver,\n} from \"./screensaver/ScreensaverProvider\";\nexport type { ScreensaverPinVerifier } from \"./screensaver/screensaverPinVerifier\";\nexport { SidebarResizeHandle, useSidebarResize } from \"./sidebar/SidebarResize\";\nexport {\n ThemeProvider,\n useOptionalTheme,\n useTheme,\n} from \"./theme/ThemeProvider\";\nexport { ThemeSwitch } from \"./theme/ThemeSwitch\";\nexport type {\n DefaultTheme,\n ThemeDefinition,\n ThemeScheme,\n} from \"./theme/themes\";\nexport { SystemTray, type SystemTrayMenuItem } from \"./tray/SystemTray\";\nexport {\n SystemTrayProvider,\n useOptionalSystemTray,\n useSystemTray,\n} from \"./tray/SystemTrayProvider\";\nexport type {\n SystemTrayDefinition,\n TrayAppDefinition,\n} from \"./tray/systemTrayDefinition\";\nexport {\n DesktopWallpaper,\n type DesktopWallpaperProps,\n} from \"./wallpaper/DesktopWallpaper\";\nexport {\n BLOCKS_WALLPAPER,\n CHEVRON_WALLPAPER,\n HARLEQUIN_WALLPAPER,\n HONEYCOMB_WALLPAPER,\n PLAIN_WALLPAPER,\n TRIANGLES_WALLPAPER,\n} from \"./wallpaper/tessellations\";\nexport {\n useOptionalWallpaper,\n useWallpaper,\n WallpaperProvider,\n} from \"./wallpaper/WallpaperProvider\";\nexport type {\n WallpaperDefinition,\n WallpaperTile,\n} from \"./wallpaper/wallpapers\";\nexport {\n CurrentWindowProvider,\n useCurrentWindow,\n useSuppressWindowToolbar,\n useWindowBackground,\n useWindowContentSize,\n} from \"./window/CurrentWindowContext\";\nexport { Window, type WindowContentBoundary } from \"./window/Window\";\nexport { WindowTitleBarActionButtons } from \"./window/WindowChromeActions\";\nexport { WindowCloseButton } from \"./window/WindowCloseButton\";\nexport {\n useWindowBackAction,\n useWindowBackActionValue,\n useWindowFileMenuItem,\n useWindowRefreshMenuItem,\n useWindowRefreshMenuItemValue,\n useWindowTitleBarAction,\n useWindowTitleBarActions,\n useWindowToolbarReservation,\n useWindowViewMenuItem,\n WindowMenuProvider,\n} from \"./window/WindowMenuContext\";\nexport {\n hasWindowSidebar,\n useRegisteredWindowSidebar,\n useWindowSidebar,\n WindowSidebarProvider,\n} from \"./window/WindowSidebarContext\";\nexport {\n findTopWindow,\n useWindowActions,\n useWindowStateData,\n type WindowCreateOptions,\n type WindowEntry,\n type WindowGeometry,\n type WindowPosition,\n type WindowSize,\n type WindowStateActions,\n type WindowStateData,\n WindowStateProvider,\n} from \"./window/WindowStateProvider\";\nexport { WindowToolBar } from \"./window/WindowToolBar\";\n"]}
@@ -0,0 +1,6 @@
1
+ import type { WindowingIcon } from "../icons/windowingIcon.js";
2
+ export declare function LauncherMenuItem({ icon, label, onClick, }: {
3
+ icon?: WindowingIcon | undefined;
4
+ label: string;
5
+ onClick: () => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MenuItem } from "../menu/MenuItem.js";
3
+ import { useLauncherEntryMenu } from "./useLauncherEntryMenu.js";
4
+ export function LauncherMenuItem({ icon, label, onClick, }) {
5
+ const { menu, triggerProps } = useLauncherEntryMenu(icon, onClick);
6
+ return (_jsxs(_Fragment, { children: [_jsx(MenuItem, { ...triggerProps, icon: icon, label: label, onClick: onClick }), menu] }));
7
+ }
8
+ //# sourceMappingURL=LauncherMenuItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LauncherMenuItem.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/LauncherMenuItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,UAAU,gBAAgB,CAAC,EAC/B,IAAI,EACJ,KAAK,EACL,OAAO,GAKR;IACC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,OAAO,CACL,8BACE,KAAC,QAAQ,OAAK,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAI,EACzE,IAAI,IACJ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { MenuItem } from \"../menu/MenuItem\";\nimport { useLauncherEntryMenu } from \"./useLauncherEntryMenu\";\n\nexport function LauncherMenuItem({\n icon,\n label,\n onClick,\n}: {\n icon?: WindowingIcon | undefined;\n label: string;\n onClick: () => void;\n}) {\n const { menu, triggerProps } = useLauncherEntryMenu(icon, onClick);\n return (\n <>\n <MenuItem {...triggerProps} icon={icon} label={label} onClick={onClick} />\n {menu}\n </>\n );\n}\n"]}
@@ -21,6 +21,8 @@ export interface MiniAppDefinition {
21
21
  * the sidebar hidden.
22
22
  */
23
23
  initialShowSidebar?: boolean | undefined;
24
+ /** Initial Start menu visibility. Defaults to visible. Pinned entries stay visible. */
25
+ startMenuVisibility?: "visible" | "hidden" | "pinned" | undefined;
24
26
  /** The window title and routed content heading. */
25
27
  title: string;
26
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"launcherDefinition.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/launcherDefinition.ts"],"names":[],"mappings":"AAwDA,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAC7B,UAAqC,EACrC,KAAgC;IAEhC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5E,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAClC,UAAqC;IAErC,MAAM,KAAK,GACT,UAAU,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,wBAAwB,CACtC,UAAqC;IAErC,IACE,UAAU,CAAC,SAAS,KAAK,SAAS;QAClC,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,EACjD,CAAC;QACD,OAAO,UAAU,CAAC,SAAS,CAAC;IAC9B,CAAC;IACD,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACrD,CAAC","sourcesContent":["import type { ComponentType } from \"react\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport type { WindowSize } from \"../window/WindowStateProvider\";\n\n/** One app a launcher opens: in a window, or as the routed shell's page. */\nexport interface MiniAppDefinition {\n /**\n * Builds the app's component. A window calls it when it opens, and the\n * routed shell when it shows the app, so each gets its own component.\n */\n createComponent: () => ComponentType;\n /** The app's glyph in the launchers and the taskbar. */\n icon?: WindowingIcon | undefined;\n /**\n * Label for desktop icons and launcher navigation. Defaults to `title`.\n * Does not change window titles, routed headings, app ids, or routes.\n */\n iconLabel?: string | undefined;\n /**\n * Whether the app's sidebar starts shown, in a new window and on the routed\n * shell's tablet tier. Defaults to shown. The phone tier always starts with\n * the sidebar hidden.\n */\n initialShowSidebar?: boolean | undefined;\n /** The window title and routed content heading. */\n title: string;\n /**\n * The size a new window opens at, in CSS pixels. Defaults to the\n * stylesheet's window size.\n */\n windowSize?: WindowSize | undefined;\n}\n\n/**\n * A launcher application: the mini-apps it can open, the order its launchers\n * list them in, the ones the windowed desktop opens on entry, and the one the\n * routed shell shows at the root route.\n */\nexport interface LauncherDefinition<AppId extends string = string> {\n apps: Readonly<Record<AppId, MiniAppDefinition>>;\n /**\n * Open, in this order, when entering windowed mode with no windows,\n * including on mount, so the last opens in front. Closing the last window\n * leaves the desktop empty until the next entry. Omit to leave window\n * startup to the host. Unknown app ids are skipped.\n */\n defaultWindowAppIds?: ReadonlyArray<AppId> | undefined;\n /** Shown at the root route. Defaults to the first app in `order`. */\n homeAppId?: AppId | undefined;\n /**\n * The order the launchers list the apps in. Ids with no app in `apps` are\n * skipped. Defaults to the order of `apps`' keys.\n */\n order?: ReadonlyArray<AppId> | undefined;\n}\n\n/** Narrows an opaque window `appId` to one of the launcher's apps. */\nexport function isLauncherAppId<AppId extends string>(\n definition: LauncherDefinition<AppId>,\n value: string | null | undefined,\n): value is AppId {\n return typeof value === \"string\" && Object.hasOwn(definition.apps, value);\n}\n\n/** The launcher's apps in the order its launchers list them. */\nexport function resolveLauncherOrder<AppId extends string>(\n definition: LauncherDefinition<AppId>,\n): ReadonlyArray<AppId> {\n const order: ReadonlyArray<string> =\n definition.order ?? Object.keys(definition.apps);\n return order.filter((appId) => isLauncherAppId(definition, appId));\n}\n\n/** The app the routed shell shows at the root route, if the launcher has any. */\nexport function resolveLauncherHomeAppId<AppId extends string>(\n definition: LauncherDefinition<AppId>,\n): AppId | null {\n if (\n definition.homeAppId !== undefined &&\n isLauncherAppId(definition, definition.homeAppId)\n ) {\n return definition.homeAppId;\n }\n return resolveLauncherOrder(definition)[0] ?? null;\n}\n"]}
1
+ {"version":3,"file":"launcherDefinition.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/launcherDefinition.ts"],"names":[],"mappings":"AA0DA,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAC7B,UAAqC,EACrC,KAAgC;IAEhC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5E,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAClC,UAAqC;IAErC,MAAM,KAAK,GACT,UAAU,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,wBAAwB,CACtC,UAAqC;IAErC,IACE,UAAU,CAAC,SAAS,KAAK,SAAS;QAClC,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,EACjD,CAAC;QACD,OAAO,UAAU,CAAC,SAAS,CAAC;IAC9B,CAAC;IACD,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACrD,CAAC","sourcesContent":["import type { ComponentType } from \"react\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport type { WindowSize } from \"../window/WindowStateProvider\";\n\n/** One app a launcher opens: in a window, or as the routed shell's page. */\nexport interface MiniAppDefinition {\n /**\n * Builds the app's component. A window calls it when it opens, and the\n * routed shell when it shows the app, so each gets its own component.\n */\n createComponent: () => ComponentType;\n /** The app's glyph in the launchers and the taskbar. */\n icon?: WindowingIcon | undefined;\n /**\n * Label for desktop icons and launcher navigation. Defaults to `title`.\n * Does not change window titles, routed headings, app ids, or routes.\n */\n iconLabel?: string | undefined;\n /**\n * Whether the app's sidebar starts shown, in a new window and on the routed\n * shell's tablet tier. Defaults to shown. The phone tier always starts with\n * the sidebar hidden.\n */\n initialShowSidebar?: boolean | undefined;\n /** Initial Start menu visibility. Defaults to visible. Pinned entries stay visible. */\n startMenuVisibility?: \"visible\" | \"hidden\" | \"pinned\" | undefined;\n /** The window title and routed content heading. */\n title: string;\n /**\n * The size a new window opens at, in CSS pixels. Defaults to the\n * stylesheet's window size.\n */\n windowSize?: WindowSize | undefined;\n}\n\n/**\n * A launcher application: the mini-apps it can open, the order its launchers\n * list them in, the ones the windowed desktop opens on entry, and the one the\n * routed shell shows at the root route.\n */\nexport interface LauncherDefinition<AppId extends string = string> {\n apps: Readonly<Record<AppId, MiniAppDefinition>>;\n /**\n * Open, in this order, when entering windowed mode with no windows,\n * including on mount, so the last opens in front. Closing the last window\n * leaves the desktop empty until the next entry. Omit to leave window\n * startup to the host. Unknown app ids are skipped.\n */\n defaultWindowAppIds?: ReadonlyArray<AppId> | undefined;\n /** Shown at the root route. Defaults to the first app in `order`. */\n homeAppId?: AppId | undefined;\n /**\n * The order the launchers list the apps in. Ids with no app in `apps` are\n * skipped. Defaults to the order of `apps`' keys.\n */\n order?: ReadonlyArray<AppId> | undefined;\n}\n\n/** Narrows an opaque window `appId` to one of the launcher's apps. */\nexport function isLauncherAppId<AppId extends string>(\n definition: LauncherDefinition<AppId>,\n value: string | null | undefined,\n): value is AppId {\n return typeof value === \"string\" && Object.hasOwn(definition.apps, value);\n}\n\n/** The launcher's apps in the order its launchers list them. */\nexport function resolveLauncherOrder<AppId extends string>(\n definition: LauncherDefinition<AppId>,\n): ReadonlyArray<AppId> {\n const order: ReadonlyArray<string> =\n definition.order ?? Object.keys(definition.apps);\n return order.filter((appId) => isLauncherAppId(definition, appId));\n}\n\n/** The app the routed shell shows at the root route, if the launcher has any. */\nexport function resolveLauncherHomeAppId<AppId extends string>(\n definition: LauncherDefinition<AppId>,\n): AppId | null {\n if (\n definition.homeAppId !== undefined &&\n isLauncherAppId(definition, definition.homeAppId)\n ) {\n return definition.homeAppId;\n }\n return resolveLauncherOrder(definition)[0] ?? null;\n}\n"]}
@@ -1,7 +1,8 @@
1
+ export declare function getLocalStorage(): Pick<Storage, "getItem" | "setItem" | "removeItem"> | null;
1
2
  /**
2
3
  * Loads a stored preference, funneling every failure mode (no storage,
3
4
  * storage throws, `parse` throws) into `parse(null)` so the parser's
4
5
  * null-branch is the single source of the fallback value.
5
6
  */
6
7
  export declare function loadStoredPreference<T>(storageKey: string, parse: (stored: string | null) => T): T;
7
- export declare function saveStoredPreference(storageKey: string, value: string): void;
8
+ export declare function saveStoredPreference(storageKey: string, value: string | null): boolean;
@@ -1,7 +1,7 @@
1
1
  // Best-effort localStorage persistence for the launcher's display preferences
2
2
  // (the navigation-mode choice, the launcher's placement). Unavailable or
3
3
  // throwing storage degrades to the caller's fallback.
4
- function getLocalStorage() {
4
+ export function getLocalStorage() {
5
5
  try {
6
6
  return typeof globalThis.localStorage === "undefined"
7
7
  ? null
@@ -31,13 +31,17 @@ export function loadStoredPreference(storageKey, parse) {
31
31
  export function saveStoredPreference(storageKey, value) {
32
32
  const storage = getLocalStorage();
33
33
  if (!storage) {
34
- return;
34
+ return false;
35
35
  }
36
36
  try {
37
- storage.setItem(storageKey, value);
37
+ if (value === null)
38
+ storage.removeItem(storageKey);
39
+ else
40
+ storage.setItem(storageKey, value);
41
+ return true;
38
42
  }
39
43
  catch {
40
- // Persistence is best-effort; ignore disabled storage and quota errors.
44
+ return false;
41
45
  }
42
46
  }
43
47
  //# sourceMappingURL=storedPreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storedPreference.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/storedPreference.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,yEAAyE;AACzE,sDAAsD;AAEtD,SAAS,eAAe;IACtB,IAAI,CAAC;QACH,OAAO,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW;YACnD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,KAAmC;IAEnC,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,UAAkB,EAAE,KAAa;IACpE,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,wEAAwE;IAC1E,CAAC;AACH,CAAC","sourcesContent":["// Best-effort localStorage persistence for the launcher's display preferences\n// (the navigation-mode choice, the launcher's placement). Unavailable or\n// throwing storage degrades to the caller's fallback.\n\nfunction getLocalStorage(): Pick<Storage, \"getItem\" | \"setItem\"> | null {\n try {\n return typeof globalThis.localStorage === \"undefined\"\n ? null\n : globalThis.localStorage;\n } catch {\n return null;\n }\n}\n\n/**\n * Loads a stored preference, funneling every failure mode (no storage,\n * storage throws, `parse` throws) into `parse(null)` so the parser's\n * null-branch is the single source of the fallback value.\n */\nexport function loadStoredPreference<T>(\n storageKey: string,\n parse: (stored: string | null) => T,\n): T {\n const storage = getLocalStorage();\n if (!storage) {\n return parse(null);\n }\n try {\n return parse(storage.getItem(storageKey));\n } catch {\n return parse(null);\n }\n}\n\nexport function saveStoredPreference(storageKey: string, value: string): void {\n const storage = getLocalStorage();\n if (!storage) {\n return;\n }\n try {\n storage.setItem(storageKey, value);\n } catch {\n // Persistence is best-effort; ignore disabled storage and quota errors.\n }\n}\n"]}
1
+ {"version":3,"file":"storedPreference.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/storedPreference.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,yEAAyE;AACzE,sDAAsD;AAEtD,MAAM,UAAU,eAAe;IAI7B,IAAI,CAAC;QACH,OAAO,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW;YACnD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,KAAmC;IAEnC,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,KAAoB;IAEpB,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;;YAC9C,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["// Best-effort localStorage persistence for the launcher's display preferences\n// (the navigation-mode choice, the launcher's placement). Unavailable or\n// throwing storage degrades to the caller's fallback.\n\nexport function getLocalStorage(): Pick<\n Storage,\n \"getItem\" | \"setItem\" | \"removeItem\"\n> | null {\n try {\n return typeof globalThis.localStorage === \"undefined\"\n ? null\n : globalThis.localStorage;\n } catch {\n return null;\n }\n}\n\n/**\n * Loads a stored preference, funneling every failure mode (no storage,\n * storage throws, `parse` throws) into `parse(null)` so the parser's\n * null-branch is the single source of the fallback value.\n */\nexport function loadStoredPreference<T>(\n storageKey: string,\n parse: (stored: string | null) => T,\n): T {\n const storage = getLocalStorage();\n if (!storage) {\n return parse(null);\n }\n try {\n return parse(storage.getItem(storageKey));\n } catch {\n return parse(null);\n }\n}\n\nexport function saveStoredPreference(\n storageKey: string,\n value: string | null,\n): boolean {\n const storage = getLocalStorage();\n if (!storage) {\n return false;\n }\n try {\n if (value === null) storage.removeItem(storageKey);\n else storage.setItem(storageKey, value);\n return true;\n } catch {\n return false;\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { type MouseEvent } from "react";
2
+ import type { WindowingIcon } from "../icons/windowingIcon.js";
3
+ /** Secondary activation offers the same Open action as the entry itself. */
4
+ export declare function useLauncherEntryMenu(icon: WindowingIcon | undefined, onOpen: () => void): {
5
+ triggerProps: {
6
+ "aria-controls": string | undefined;
7
+ onContextMenu(event: MouseEvent<HTMLElement>): void;
8
+ onPointerCancel: (event: import("react").PointerEvent<HTMLElement>) => void;
9
+ onPointerDown: (event: import("react").PointerEvent<HTMLElement>) => void;
10
+ onPointerMove: (event: import("react").PointerEvent<HTMLElement>) => void;
11
+ onPointerUp: (event: import("react").PointerEvent<HTMLElement>) => void;
12
+ };
13
+ menu: import("react").JSX.Element | null;
14
+ };
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { DesktopIconMenu } from "../desktop/DesktopIconMenu.js";
4
+ import { useContextMenuState } from "../menu/useContextMenuState.js";
5
+ import { useLongPress } from "../menu/useLongPress.js";
6
+ /** Secondary activation offers the same Open action as the entry itself. */
7
+ export function useLauncherEntryMenu(icon, onOpen) {
8
+ const menuId = useId();
9
+ const { closeContextMenu, contextMenu, openContextMenu } = useContextMenuState();
10
+ const longPress = useLongPress(true, { emulateRightClick: true });
11
+ return {
12
+ triggerProps: {
13
+ ...longPress,
14
+ "aria-controls": contextMenu ? menuId : undefined,
15
+ onContextMenu(event) {
16
+ event.currentTarget.focus({ preventScroll: true });
17
+ openContextMenu(event, null);
18
+ },
19
+ },
20
+ menu: contextMenu && (_jsx(DesktopIconMenu, { id: menuId, icon: icon, items: [], onClose: closeContextMenu, onOpen: onOpen, position: contextMenu.position })),
21
+ };
22
+ }
23
+ //# sourceMappingURL=useLauncherEntryMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLauncherEntryMenu.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/useLauncherEntryMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,KAAK,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,4EAA4E;AAC5E,MAAM,UAAU,oBAAoB,CAClC,IAA+B,EAC/B,MAAkB;IAElB,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;IACvB,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,GACtD,mBAAmB,EAAQ,CAAC;IAC9B,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,OAAO;QACL,YAAY,EAAE;YACZ,GAAG,SAAS;YACZ,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACjD,aAAa,CAAC,KAA8B;gBAC1C,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnD,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC/B,CAAC;SACF;QACD,IAAI,EAAE,WAAW,IAAI,CACnB,KAAC,eAAe,IACd,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,EAAE,EACT,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,CAAC,QAAQ,GAC9B,CACH;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { type MouseEvent, useId } from \"react\";\nimport { DesktopIconMenu } from \"../desktop/DesktopIconMenu\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { useContextMenuState } from \"../menu/useContextMenuState\";\nimport { useLongPress } from \"../menu/useLongPress\";\n\n/** Secondary activation offers the same Open action as the entry itself. */\nexport function useLauncherEntryMenu(\n icon: WindowingIcon | undefined,\n onOpen: () => void,\n) {\n const menuId = useId();\n const { closeContextMenu, contextMenu, openContextMenu } =\n useContextMenuState<null>();\n const longPress = useLongPress(true, { emulateRightClick: true });\n return {\n triggerProps: {\n ...longPress,\n \"aria-controls\": contextMenu ? menuId : undefined,\n onContextMenu(event: MouseEvent<HTMLElement>) {\n event.currentTarget.focus({ preventScroll: true });\n openContextMenu(event, null);\n },\n },\n menu: contextMenu && (\n <DesktopIconMenu\n id={menuId}\n icon={icon}\n items={[]}\n onClose={closeContextMenu}\n onOpen={onOpen}\n position={contextMenu.position}\n />\n ),\n };\n}\n"]}
package/menu/Menu.d.ts CHANGED
@@ -3,7 +3,8 @@ export interface MenuPosition {
3
3
  x: number;
4
4
  y: number;
5
5
  }
6
- export declare function Menu({ position, onClose, direction, keyboardNavigation, children, }: PropsWithChildren<{
6
+ export declare function Menu({ id, position, onClose, direction, keyboardNavigation, children, }: PropsWithChildren<{
7
+ id?: string | undefined;
7
8
  position: MenuPosition;
8
9
  onClose: () => void;
9
10
  direction?: "up" | "down";
package/menu/Menu.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState, } from "react";
2
+ import { useContext, useEffect, useEffectEvent, useLayoutEffect, useRef, useState, } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import "./Menu.css";
5
+ import { menuContainsTarget, ParentMenu, registerMenuParent, } from "./menuOwnership.js";
5
6
  import { useMenuKeyboard } from "./useMenuKeyboard.js";
6
7
  const MENU_VIEWPORT_MARGIN_PX = 8;
7
8
  const MEASUREMENT_MENU_STYLE = {
@@ -46,12 +47,7 @@ function useMenuOutsideDismissal(menuRef, onClose) {
46
47
  const close = useEffectEvent(onClose);
47
48
  useEffect(() => {
48
49
  function handleClick(e) {
49
- const target = e.target;
50
- if (!(target instanceof Node)) {
51
- close();
52
- return;
53
- }
54
- if (menuRef.current && !menuRef.current.contains(target)) {
50
+ if (menuRef.current && !menuContainsTarget(menuRef.current, e.target)) {
55
51
  close();
56
52
  }
57
53
  }
@@ -62,13 +58,10 @@ function useMenuOutsideDismissal(menuRef, onClose) {
62
58
  // anywhere else would leave it floating where the trigger used to be. Close
63
59
  // it instead. Scrolls inside the menu — its own overflow, or a list it
64
60
  // hosts — are the menu working as intended. Capture phase, because scroll
65
- // events do not bubble. The check covers this menu's own subtree only: a
66
- // nested Menu is portaled to the body too, so scrolling one would close its
67
- // parent. Nothing nests menus today; revisit here if that changes.
61
+ // events do not bubble. Include any child menus portaled to the body.
68
62
  useEffect(() => {
69
63
  function handleScroll(e) {
70
- const target = e.target;
71
- if (target instanceof Node && menuRef.current?.contains(target)) {
64
+ if (menuRef.current && menuContainsTarget(menuRef.current, e.target)) {
72
65
  return;
73
66
  }
74
67
  close();
@@ -113,8 +106,14 @@ function placeMenuInViewport(input) {
113
106
  top: clamp(preferredTop, MENU_VIEWPORT_MARGIN_PX, maxTop),
114
107
  };
115
108
  }
116
- export function Menu({ position, onClose, direction = "up", keyboardNavigation = true, children, }) {
109
+ export function Menu({ id, position, onClose, direction = "up", keyboardNavigation = true, children, }) {
117
110
  const menuRef = useRef(null);
111
+ const parent = useContext(ParentMenu);
112
+ useLayoutEffect(() => {
113
+ return parent && menuRef.current
114
+ ? registerMenuParent(menuRef.current, parent)
115
+ : undefined;
116
+ }, [parent]);
118
117
  useMenuOutsideDismissal(menuRef, onClose);
119
118
  const { x, y } = position;
120
119
  const [placement, setPlacement] = useState(() => createInitialMenuPlacement(position, direction));
@@ -170,6 +169,6 @@ export function Menu({ position, onClose, direction = "up", keyboardNavigation =
170
169
  top: placement.top,
171
170
  }
172
171
  : MEASUREMENT_MENU_STYLE;
173
- return createPortal(_jsx("div", { ref: menuRef, className: "menu", "data-scrollable": scrollable || undefined, style: menuStyle, tabIndex: -1, children: children }), document.body);
172
+ return createPortal(_jsx("div", { id: id, ref: menuRef, className: "menu", "data-scrollable": scrollable || undefined, style: menuStyle, tabIndex: -1, children: _jsx(ParentMenu.Provider, { value: menuRef, children: children }) }), document.body);
174
173
  }
175
174
  //# sourceMappingURL=Menu.js.map