@tearleads/windowing 0.2.11 → 0.2.12

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 (106) hide show
  1. package/README.md +93 -1
  2. package/index.d.ts +19 -0
  3. package/index.js +20 -1
  4. package/index.js.map +1 -1
  5. package/launcher/LauncherNavigationProvider.d.ts +71 -0
  6. package/launcher/LauncherNavigationProvider.js +253 -0
  7. package/launcher/LauncherNavigationProvider.js.map +1 -0
  8. package/launcher/MiniAppRouteSegmentsContext.d.ts +19 -0
  9. package/launcher/MiniAppRouteSegmentsContext.js +26 -0
  10. package/launcher/MiniAppRouteSegmentsContext.js.map +1 -0
  11. package/launcher/MiniAppWindow.d.ts +18 -0
  12. package/launcher/MiniAppWindow.js +41 -0
  13. package/launcher/MiniAppWindow.js.map +1 -0
  14. package/launcher/NavigationModeOverrideProvider.d.ts +23 -0
  15. package/launcher/NavigationModeOverrideProvider.js +31 -0
  16. package/launcher/NavigationModeOverrideProvider.js.map +1 -0
  17. package/launcher/NavigationModeSwitch.css +22 -0
  18. package/launcher/NavigationModeSwitch.d.ts +24 -0
  19. package/launcher/NavigationModeSwitch.js +40 -0
  20. package/launcher/NavigationModeSwitch.js.map +1 -0
  21. package/launcher/breakpoints.d.ts +17 -0
  22. package/launcher/breakpoints.js +18 -0
  23. package/launcher/breakpoints.js.map +1 -0
  24. package/launcher/launcherDefinition.d.ts +39 -0
  25. package/launcher/launcherDefinition.js +18 -0
  26. package/launcher/launcherDefinition.js.map +1 -0
  27. package/launcher/navigationHistory.d.ts +16 -0
  28. package/launcher/navigationHistory.js +48 -0
  29. package/launcher/navigationHistory.js.map +1 -0
  30. package/launcher/navigationMode.d.ts +31 -0
  31. package/launcher/navigationMode.js +35 -0
  32. package/launcher/navigationMode.js.map +1 -0
  33. package/launcher/routePaths.d.ts +17 -0
  34. package/launcher/routePaths.js +46 -0
  35. package/launcher/routePaths.js.map +1 -0
  36. package/launcher/routedPathNavigator.d.ts +20 -0
  37. package/launcher/routedPathNavigator.js +36 -0
  38. package/launcher/routedPathNavigator.js.map +1 -0
  39. package/launcher/storedPreference.d.ts +7 -0
  40. package/launcher/storedPreference.js +43 -0
  41. package/launcher/storedPreference.js.map +1 -0
  42. package/launcher/useActiveLauncherRoute.d.ts +14 -0
  43. package/launcher/useActiveLauncherRoute.js +41 -0
  44. package/launcher/useActiveLauncherRoute.js.map +1 -0
  45. package/launcher/useCompactRoutedMode.d.ts +2 -0
  46. package/launcher/useCompactRoutedMode.js +9 -0
  47. package/launcher/useCompactRoutedMode.js.map +1 -0
  48. package/launcher/useMiniAppRouteState.d.ts +14 -0
  49. package/launcher/useMiniAppRouteState.js +15 -0
  50. package/launcher/useMiniAppRouteState.js.map +1 -0
  51. package/launcher/useNavigationMode.d.ts +23 -0
  52. package/launcher/useNavigationMode.js +34 -0
  53. package/launcher/useNavigationMode.js.map +1 -0
  54. package/launcher/useNavigationModeDocumentAttribute.d.ts +16 -0
  55. package/launcher/useNavigationModeDocumentAttribute.js +24 -0
  56. package/launcher/useNavigationModeDocumentAttribute.js.map +1 -0
  57. package/launcher/useRoutedLayoutActive.d.ts +25 -0
  58. package/launcher/useRoutedLayoutActive.js +69 -0
  59. package/launcher/useRoutedLayoutActive.js.map +1 -0
  60. package/launcher/useRoutedLayoutTier.d.ts +17 -0
  61. package/launcher/useRoutedLayoutTier.js +24 -0
  62. package/launcher/useRoutedLayoutTier.js.map +1 -0
  63. package/package.json +1 -1
  64. package/routed/RoutedPane.css +393 -0
  65. package/routed/RoutedPane.d.ts +63 -0
  66. package/routed/RoutedPane.js +91 -0
  67. package/routed/RoutedPane.js.map +1 -0
  68. package/routed/RoutedPaneAppBar.d.ts +8 -0
  69. package/routed/RoutedPaneAppBar.js +23 -0
  70. package/routed/RoutedPaneAppBar.js.map +1 -0
  71. package/routed/RoutedPaneMain.d.ts +15 -0
  72. package/routed/RoutedPaneMain.js +27 -0
  73. package/routed/RoutedPaneMain.js.map +1 -0
  74. package/routed/RoutedPaneNav.css +298 -0
  75. package/routed/RoutedPaneNav.d.ts +20 -0
  76. package/routed/RoutedPaneNav.js +106 -0
  77. package/routed/RoutedPaneNav.js.map +1 -0
  78. package/routed/RoutedPaneOverlayHost.d.ts +37 -0
  79. package/routed/RoutedPaneOverlayHost.js +29 -0
  80. package/routed/RoutedPaneOverlayHost.js.map +1 -0
  81. package/routed/RoutedPanePlacementButton.d.ts +5 -0
  82. package/routed/RoutedPanePlacementButton.js +10 -0
  83. package/routed/RoutedPanePlacementButton.js.map +1 -0
  84. package/routed/RoutedPaneSidebar.css +61 -0
  85. package/routed/RoutedPaneSidebar.d.ts +7 -0
  86. package/routed/RoutedPaneSidebar.js +18 -0
  87. package/routed/RoutedPaneSidebar.js.map +1 -0
  88. package/routed/RoutedPaneTaskBar.d.ts +24 -0
  89. package/routed/RoutedPaneTaskBar.js +24 -0
  90. package/routed/RoutedPaneTaskBar.js.map +1 -0
  91. package/routed/classNames.d.ts +2 -0
  92. package/routed/classNames.js +6 -0
  93. package/routed/classNames.js.map +1 -0
  94. package/routed/launcherPlacement.d.ts +7 -0
  95. package/routed/launcherPlacement.js +8 -0
  96. package/routed/launcherPlacement.js.map +1 -0
  97. package/routed/useMobileKeyboardVisible.d.ts +7 -0
  98. package/routed/useMobileKeyboardVisible.js +78 -0
  99. package/routed/useMobileKeyboardVisible.js.map +1 -0
  100. package/routed/useMobileSheetDrag.d.ts +10 -0
  101. package/routed/useMobileSheetDrag.js +83 -0
  102. package/routed/useMobileSheetDrag.js.map +1 -0
  103. package/routed/useRoutedPaneOverlays.d.ts +25 -0
  104. package/routed/useRoutedPaneOverlays.js +72 -0
  105. package/routed/useRoutedPaneOverlays.js.map +1 -0
  106. package/tokens.css +24 -0
@@ -0,0 +1,18 @@
1
+ import { type ComponentType, type PropsWithChildren } from "react";
2
+ /**
3
+ * Wraps a mini-app wherever the launcher renders one, in a window or the
4
+ * routed shell, such as an error boundary that fails inside the app. It
5
+ * receives the app's id as the definition names it.
6
+ */
7
+ export type MiniAppBoundary = ComponentType<PropsWithChildren<{
8
+ appId: string;
9
+ }>>;
10
+ /**
11
+ * A window for one of the launcher's mini-apps, inside a
12
+ * {@link LauncherNavigationProvider}. The app reads its route with
13
+ * {@link useMiniAppRouteSegments}, backed by the window's own Back stack.
14
+ */
15
+ export declare function MiniAppWindow({ AppBoundary, windowId, }: {
16
+ AppBoundary?: MiniAppBoundary | undefined;
17
+ windowId: string;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, } from "react";
3
+ import { Window } from "../window/Window.js";
4
+ import { useWindowActions, } from "../window/WindowStateProvider/index.js";
5
+ import { useLauncherNavigationState } from "./LauncherNavigationProvider.js";
6
+ import { isLauncherAppId } from "./launcherDefinition.js";
7
+ import { MiniAppRouteSegmentsProvider } from "./MiniAppRouteSegmentsContext.js";
8
+ const EMPTY_ROUTE_SEGMENTS = [];
9
+ function PassThroughBoundary({ children }) {
10
+ return children;
11
+ }
12
+ const AppBoundaryContext = createContext(PassThroughBoundary);
13
+ // Gives a mini-app window its route (backed by the window's own Back stack) and
14
+ // the host's app boundary. Windows that no mini-app owns render bare.
15
+ function MiniAppWindowBoundary({ children, entry, }) {
16
+ const AppBoundary = useContext(AppBoundaryContext);
17
+ const { definition } = useLauncherNavigationState();
18
+ const { goBackRoute, updateRoute } = useWindowActions();
19
+ const setPathSegments = useCallback((pathSegments, options = {}) => {
20
+ // Forward `replace` rather than dropping it: it is what keeps a transient
21
+ // step (a picker, a corrected unavailable route) out of this window's
22
+ // Back stack.
23
+ updateRoute(entry.id, pathSegments, options);
24
+ }, [entry.id, updateRoute]);
25
+ const goBack = useCallback(() => {
26
+ goBackRoute(entry.id);
27
+ }, [entry.id, goBackRoute]);
28
+ if (!isLauncherAppId(definition, entry.appId)) {
29
+ return children;
30
+ }
31
+ return (_jsx(MiniAppRouteSegmentsProvider, { appId: entry.appId, canGoBack: (entry.routeHistory?.length ?? 0) > 0, goBack: goBack, pathSegments: entry.pathSegments ?? EMPTY_ROUTE_SEGMENTS, setPathSegments: setPathSegments, windowId: entry.id, children: _jsx(AppBoundary, { appId: entry.appId, children: children }) }));
32
+ }
33
+ /**
34
+ * A window for one of the launcher's mini-apps, inside a
35
+ * {@link LauncherNavigationProvider}. The app reads its route with
36
+ * {@link useMiniAppRouteSegments}, backed by the window's own Back stack.
37
+ */
38
+ export function MiniAppWindow({ AppBoundary = PassThroughBoundary, windowId, }) {
39
+ return (_jsx(AppBoundaryContext.Provider, { value: AppBoundary, children: _jsx(Window, { ContentBoundary: MiniAppWindowBoundary, windowId: windowId }) }));
40
+ }
41
+ //# sourceMappingURL=MiniAppWindow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MiniAppWindow.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/MiniAppWindow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,aAAa,EAEb,WAAW,EACX,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAW7E,MAAM,oBAAoB,GAA0B,EAAE,CAAC;AAEvD,SAAS,mBAAmB,CAAC,EAAE,QAAQ,EAAqB;IAC1D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,kBAAkB,GAAG,aAAa,CAAkB,mBAAmB,CAAC,CAAC;AAE/E,gFAAgF;AAChF,sEAAsE;AACtE,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,KAAK,GACqC;IAC1C,MAAM,WAAW,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACnD,MAAM,EAAE,UAAU,EAAE,GAAG,0BAA0B,EAAE,CAAC;IACpD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACxD,MAAM,eAAe,GAAG,WAAW,CACjC,CACE,YAAmC,EACnC,UAA6C,EAAE,EAC/C,EAAE;QACF,0EAA0E;QAC1E,sEAAsE;QACtE,cAAc;QACd,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,CACxB,CAAC;IACF,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;IAE5B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,CACL,KAAC,4BAA4B,IAC3B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,EAChD,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,oBAAoB,EACxD,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,KAAK,CAAC,EAAE,YAElB,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YAAG,QAAQ,GAAe,GAC5B,CAChC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,WAAW,GAAG,mBAAmB,EACjC,QAAQ,GAIT;IACC,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAC7C,KAAC,MAAM,IAAC,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAC1C,CAC/B,CAAC;AACJ,CAAC","sourcesContent":["import {\n type ComponentType,\n createContext,\n type PropsWithChildren,\n useCallback,\n useContext,\n} from \"react\";\nimport { Window } from \"../window/Window\";\nimport {\n useWindowActions,\n type WindowEntry,\n} from \"../window/WindowStateProvider\";\nimport { useLauncherNavigationState } from \"./LauncherNavigationProvider\";\nimport { isLauncherAppId } from \"./launcherDefinition\";\nimport { MiniAppRouteSegmentsProvider } from \"./MiniAppRouteSegmentsContext\";\n\n/**\n * Wraps a mini-app wherever the launcher renders one, in a window or the\n * routed shell, such as an error boundary that fails inside the app. It\n * receives the app's id as the definition names it.\n */\nexport type MiniAppBoundary = ComponentType<\n PropsWithChildren<{ appId: string }>\n>;\n\nconst EMPTY_ROUTE_SEGMENTS: ReadonlyArray<string> = [];\n\nfunction PassThroughBoundary({ children }: PropsWithChildren) {\n return children;\n}\n\nconst AppBoundaryContext = createContext<MiniAppBoundary>(PassThroughBoundary);\n\n// Gives a mini-app window its route (backed by the window's own Back stack) and\n// the host's app boundary. Windows that no mini-app owns render bare.\nfunction MiniAppWindowBoundary({\n children,\n entry,\n}: PropsWithChildren<{ entry: WindowEntry }>) {\n const AppBoundary = useContext(AppBoundaryContext);\n const { definition } = useLauncherNavigationState();\n const { goBackRoute, updateRoute } = useWindowActions();\n const setPathSegments = useCallback(\n (\n pathSegments: ReadonlyArray<string>,\n options: { replace?: boolean | undefined } = {},\n ) => {\n // Forward `replace` rather than dropping it: it is what keeps a transient\n // step (a picker, a corrected unavailable route) out of this window's\n // Back stack.\n updateRoute(entry.id, pathSegments, options);\n },\n [entry.id, updateRoute],\n );\n const goBack = useCallback(() => {\n goBackRoute(entry.id);\n }, [entry.id, goBackRoute]);\n\n if (!isLauncherAppId(definition, entry.appId)) {\n return children;\n }\n\n return (\n <MiniAppRouteSegmentsProvider\n appId={entry.appId}\n canGoBack={(entry.routeHistory?.length ?? 0) > 0}\n goBack={goBack}\n pathSegments={entry.pathSegments ?? EMPTY_ROUTE_SEGMENTS}\n setPathSegments={setPathSegments}\n windowId={entry.id}\n >\n <AppBoundary appId={entry.appId}>{children}</AppBoundary>\n </MiniAppRouteSegmentsProvider>\n );\n}\n\n/**\n * A window for one of the launcher's mini-apps, inside a\n * {@link LauncherNavigationProvider}. The app reads its route with\n * {@link useMiniAppRouteSegments}, backed by the window's own Back stack.\n */\nexport function MiniAppWindow({\n AppBoundary = PassThroughBoundary,\n windowId,\n}: {\n AppBoundary?: MiniAppBoundary | undefined;\n windowId: string;\n}) {\n return (\n <AppBoundaryContext.Provider value={AppBoundary}>\n <Window ContentBoundary={MiniAppWindowBoundary} windowId={windowId} />\n </AppBoundaryContext.Provider>\n );\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { type PropsWithChildren } from "react";
2
+ import type { NavigationMode } from "./navigationMode.js";
3
+ type NavigationModeOverride = NavigationMode | null;
4
+ interface NavigationModeOverrideContextValue {
5
+ override: NavigationModeOverride;
6
+ setOverride: (next: NavigationMode) => void;
7
+ }
8
+ interface NavigationModeOverrideProviderProps extends PropsWithChildren {
9
+ /** Where the choice persists in localStorage. */
10
+ storageKey: string;
11
+ }
12
+ /**
13
+ * Owns the user's windowed/routed choice. Mount a single instance above the
14
+ * whole launcher so every mode switch drives the one choice, and so the layout
15
+ * reads from the same source (pass `override` to {@link useNavigationMode}).
16
+ *
17
+ * A manual choice persists across reloads. With no saved choice, the host
18
+ * default still decides the layout.
19
+ */
20
+ export declare function NavigationModeOverrideProvider({ children, storageKey, }: NavigationModeOverrideProviderProps): import("react").JSX.Element;
21
+ export declare const useNavigationModeOverride: () => NavigationModeOverrideContextValue;
22
+ export declare const useOptionalNavigationModeOverride: () => NavigationModeOverrideContextValue | null;
23
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useState } from "react";
3
+ import { createRequiredContext } from "../createRequiredContext.js";
4
+ import { loadStoredPreference, saveStoredPreference } from "./storedPreference.js";
5
+ const navigationModeOverrideContext = createRequiredContext("useNavigationModeOverride must be used within a NavigationModeOverrideProvider");
6
+ function loadOverride(storageKey) {
7
+ return loadStoredPreference(storageKey, (stored) => stored === "routed" || stored === "windowed" ? stored : null);
8
+ }
9
+ /**
10
+ * Owns the user's windowed/routed choice. Mount a single instance above the
11
+ * whole launcher so every mode switch drives the one choice, and so the layout
12
+ * reads from the same source (pass `override` to {@link useNavigationMode}).
13
+ *
14
+ * A manual choice persists across reloads. With no saved choice, the host
15
+ * default still decides the layout.
16
+ */
17
+ export function NavigationModeOverrideProvider({ children, storageKey, }) {
18
+ const [override, setCurrentOverride] = useState(() => loadOverride(storageKey));
19
+ const setOverride = useCallback((next) => {
20
+ setCurrentOverride(next);
21
+ saveStoredPreference(storageKey, next);
22
+ }, [storageKey]);
23
+ const value = useMemo(() => ({ override, setOverride }), [override, setOverride]);
24
+ return (_jsx(navigationModeOverrideContext.context.Provider, { value: value, children: children }));
25
+ }
26
+ export const useNavigationModeOverride = navigationModeOverrideContext.useRequired;
27
+ // Non-throwing accessor: surfaces that may render outside the provider (e.g. a
28
+ // pane mounted standalone in tests) get null instead of a crash. A switch
29
+ // rendered there simply hides itself.
30
+ export const useOptionalNavigationModeOverride = navigationModeOverrideContext.useOptional;
31
+ //# sourceMappingURL=NavigationModeOverrideProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationModeOverrideProvider.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/NavigationModeOverrideProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0B,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAUhF,MAAM,6BAA6B,GACjC,qBAAqB,CACnB,gFAAgF,CACjF,CAAC;AAOJ,SAAS,YAAY,CAAC,UAAkB;IACtC,OAAO,oBAAoB,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CACjD,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAC7D,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAAC,EAC7C,QAAQ,EACR,UAAU,GAC0B;IACpC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAyB,GAAG,EAAE,CAC3E,YAAY,CAAC,UAAU,CAAC,CACzB,CAAC;IACF,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,IAAoB,EAAE,EAAE;QACvB,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzB,oBAAoB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,EACjC,CAAC,QAAQ,EAAE,WAAW,CAAC,CACxB,CAAC;IAEF,OAAO,CACL,KAAC,6BAA6B,CAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzD,QAAQ,GACsC,CAClD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GACpC,6BAA6B,CAAC,WAAW,CAAC;AAE5C,+EAA+E;AAC/E,0EAA0E;AAC1E,sCAAsC;AACtC,MAAM,CAAC,MAAM,iCAAiC,GAC5C,6BAA6B,CAAC,WAAW,CAAC","sourcesContent":["import { type PropsWithChildren, useCallback, useMemo, useState } from \"react\";\nimport { createRequiredContext } from \"../createRequiredContext\";\nimport type { NavigationMode } from \"./navigationMode\";\nimport { loadStoredPreference, saveStoredPreference } from \"./storedPreference\";\n\ntype NavigationModeOverride = NavigationMode | null;\n\ninterface NavigationModeOverrideContextValue {\n // The manual windowed/routed choice, or `null` to use the host/default mode.\n override: NavigationModeOverride;\n setOverride: (next: NavigationMode) => void;\n}\n\nconst navigationModeOverrideContext =\n createRequiredContext<NavigationModeOverrideContextValue>(\n \"useNavigationModeOverride must be used within a NavigationModeOverrideProvider\",\n );\n\ninterface NavigationModeOverrideProviderProps extends PropsWithChildren {\n /** Where the choice persists in localStorage. */\n storageKey: string;\n}\n\nfunction loadOverride(storageKey: string): NavigationModeOverride {\n return loadStoredPreference(storageKey, (stored) =>\n stored === \"routed\" || stored === \"windowed\" ? stored : null,\n );\n}\n\n/**\n * Owns the user's windowed/routed choice. Mount a single instance above the\n * whole launcher so every mode switch drives the one choice, and so the layout\n * reads from the same source (pass `override` to {@link useNavigationMode}).\n *\n * A manual choice persists across reloads. With no saved choice, the host\n * default still decides the layout.\n */\nexport function NavigationModeOverrideProvider({\n children,\n storageKey,\n}: NavigationModeOverrideProviderProps) {\n const [override, setCurrentOverride] = useState<NavigationModeOverride>(() =>\n loadOverride(storageKey),\n );\n const setOverride = useCallback(\n (next: NavigationMode) => {\n setCurrentOverride(next);\n saveStoredPreference(storageKey, next);\n },\n [storageKey],\n );\n\n const value = useMemo<NavigationModeOverrideContextValue>(\n () => ({ override, setOverride }),\n [override, setOverride],\n );\n\n return (\n <navigationModeOverrideContext.context.Provider value={value}>\n {children}\n </navigationModeOverrideContext.context.Provider>\n );\n}\n\nexport const useNavigationModeOverride =\n navigationModeOverrideContext.useRequired;\n\n// Non-throwing accessor: surfaces that may render outside the provider (e.g. a\n// pane mounted standalone in tests) get null instead of a crash. A switch\n// rendered there simply hides itself.\nexport const useOptionalNavigationModeOverride =\n navigationModeOverrideContext.useOptional;\n"]}
@@ -0,0 +1,22 @@
1
+ /* The windowed/routed switch: a square, borderless control the height of the
2
+ bar's controls, lit while hovered or focused, as the start menu's button. */
3
+ .navigation-mode-switch {
4
+ display: inline-flex;
5
+ flex: 0 0 auto;
6
+ align-items: center;
7
+ justify-content: center;
8
+ width: var(--control-height);
9
+ height: var(--control-height);
10
+ padding: 0;
11
+ border: 0;
12
+ border-radius: var(--app-radius-control);
13
+ background: transparent;
14
+ color: inherit;
15
+ cursor: pointer;
16
+ }
17
+
18
+ .navigation-mode-switch:hover,
19
+ .navigation-mode-switch:focus-visible {
20
+ background: var(--emphasis-surface);
21
+ color: var(--emphasis-text);
22
+ }
@@ -0,0 +1,24 @@
1
+ import { type NavigationMode } from "./navigationMode.js";
2
+ interface NavigationModeSwitchProps {
3
+ /**
4
+ * Offer windows even where they do not suit the screen, such as when the
5
+ * host fixes the windowed layout.
6
+ */
7
+ allowWindowed?: boolean | undefined;
8
+ /**
9
+ * Classes for the button. They replace the default
10
+ * `navigation-mode-switch` styling, so a host's own button styles apply
11
+ * alone.
12
+ */
13
+ className?: string | undefined;
14
+ /** The layout showing the switch; a click chooses the other. */
15
+ mode: NavigationMode;
16
+ }
17
+ /**
18
+ * The windowed/routed switch, for a taskbar's corner: a click records the
19
+ * other layout as the user's choice with the nearest
20
+ * {@link NavigationModeOverrideProvider}. It renders nothing outside one, and
21
+ * the routed layout's switch hides where windows do not suit the screen.
22
+ */
23
+ export declare function NavigationModeSwitch({ allowWindowed, className, mode, }: NavigationModeSwitchProps): import("react").JSX.Element | null;
24
+ export {};
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AppWindowIcon } from "@phosphor-icons/react/dist/csr/AppWindow";
3
+ import { DeviceTabletIcon } from "@phosphor-icons/react/dist/csr/DeviceTablet";
4
+ import { useOptionalNavigationModeOverride } from "./NavigationModeOverrideProvider.js";
5
+ import { isWindowedLayoutEligible, readNavigationEnvironment, } from "./navigationMode.js";
6
+ import "./NavigationModeSwitch.css";
7
+ const OTHER_MODE = {
8
+ windowed: "routed",
9
+ routed: "windowed",
10
+ };
11
+ const MODE_LABEL = {
12
+ windowed: "windowed",
13
+ routed: "iPad / mobile",
14
+ };
15
+ // Show the glyph of the layout the click switches *to*, so the control reads as
16
+ // an action ("go to iPad / mobile").
17
+ const TARGET_ICON = {
18
+ windowed: AppWindowIcon,
19
+ routed: DeviceTabletIcon,
20
+ };
21
+ /**
22
+ * The windowed/routed switch, for a taskbar's corner: a click records the
23
+ * other layout as the user's choice with the nearest
24
+ * {@link NavigationModeOverrideProvider}. It renders nothing outside one, and
25
+ * the routed layout's switch hides where windows do not suit the screen.
26
+ */
27
+ export function NavigationModeSwitch({ allowWindowed = false, className, mode, }) {
28
+ const override = useOptionalNavigationModeOverride();
29
+ if (!override ||
30
+ (mode === "routed" &&
31
+ !allowWindowed &&
32
+ !isWindowedLayoutEligible(readNavigationEnvironment()))) {
33
+ return null;
34
+ }
35
+ const target = OTHER_MODE[mode];
36
+ const TargetIcon = TARGET_ICON[target];
37
+ const label = `Switch to ${MODE_LABEL[target]} layout`;
38
+ return (_jsx("button", { "aria-label": label, className: className ?? "navigation-mode-switch", title: label, type: "button", onClick: () => override.setOverride(target), children: _jsx(TargetIcon, { "aria-hidden": "true", focusable: "false", size: 20 }) }));
39
+ }
40
+ //# sourceMappingURL=NavigationModeSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationModeSwitch.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/NavigationModeSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EACL,wBAAwB,EAExB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,4BAA4B,CAAC;AAEpC,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,UAAU;CAC8B,CAAC;AAEnD,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,eAAe;CACiB,CAAC;AAE3C,gFAAgF;AAChF,qCAAqC;AACrC,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,gBAAgB;CACuB,CAAC;AAkBlD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,aAAa,GAAG,KAAK,EACrB,SAAS,EACT,IAAI,GACsB;IAC1B,MAAM,QAAQ,GAAG,iCAAiC,EAAE,CAAC;IACrD,IACE,CAAC,QAAQ;QACT,CAAC,IAAI,KAAK,QAAQ;YAChB,CAAC,aAAa;YACd,CAAC,wBAAwB,CAAC,yBAAyB,EAAE,CAAC,CAAC,EACzD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,aAAa,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC;IAEvD,OAAO,CACL,+BACc,KAAK,EACjB,SAAS,EAAE,SAAS,IAAI,wBAAwB,EAChD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,YAE3C,KAAC,UAAU,mBAAa,MAAM,EAAC,SAAS,EAAC,OAAO,EAAC,IAAI,EAAE,EAAE,GAAI,GACtD,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { AppWindowIcon } from \"@phosphor-icons/react/dist/csr/AppWindow\";\nimport { DeviceTabletIcon } from \"@phosphor-icons/react/dist/csr/DeviceTablet\";\nimport type { WindowingIcon } from \"../icons/windowingIcon\";\nimport { useOptionalNavigationModeOverride } from \"./NavigationModeOverrideProvider\";\nimport {\n isWindowedLayoutEligible,\n type NavigationMode,\n readNavigationEnvironment,\n} from \"./navigationMode\";\nimport \"./NavigationModeSwitch.css\";\n\nconst OTHER_MODE = {\n windowed: \"routed\",\n routed: \"windowed\",\n} satisfies Record<NavigationMode, NavigationMode>;\n\nconst MODE_LABEL = {\n windowed: \"windowed\",\n routed: \"iPad / mobile\",\n} satisfies Record<NavigationMode, string>;\n\n// Show the glyph of the layout the click switches *to*, so the control reads as\n// an action (\"go to iPad / mobile\").\nconst TARGET_ICON = {\n windowed: AppWindowIcon,\n routed: DeviceTabletIcon,\n} satisfies Record<NavigationMode, WindowingIcon>;\n\ninterface NavigationModeSwitchProps {\n /**\n * Offer windows even where they do not suit the screen, such as when the\n * host fixes the windowed layout.\n */\n allowWindowed?: boolean | undefined;\n /**\n * Classes for the button. They replace the default\n * `navigation-mode-switch` styling, so a host's own button styles apply\n * alone.\n */\n className?: string | undefined;\n /** The layout showing the switch; a click chooses the other. */\n mode: NavigationMode;\n}\n\n/**\n * The windowed/routed switch, for a taskbar's corner: a click records the\n * other layout as the user's choice with the nearest\n * {@link NavigationModeOverrideProvider}. It renders nothing outside one, and\n * the routed layout's switch hides where windows do not suit the screen.\n */\nexport function NavigationModeSwitch({\n allowWindowed = false,\n className,\n mode,\n}: NavigationModeSwitchProps) {\n const override = useOptionalNavigationModeOverride();\n if (\n !override ||\n (mode === \"routed\" &&\n !allowWindowed &&\n !isWindowedLayoutEligible(readNavigationEnvironment()))\n ) {\n return null;\n }\n\n const target = OTHER_MODE[mode];\n const TargetIcon = TARGET_ICON[target];\n const label = `Switch to ${MODE_LABEL[target]} layout`;\n\n return (\n <button\n aria-label={label}\n className={className ?? \"navigation-mode-switch\"}\n title={label}\n type=\"button\"\n onClick={() => override.setOverride(target)}\n >\n <TargetIcon aria-hidden=\"true\" focusable=\"false\" size={20} />\n </button>\n );\n}\n"]}
@@ -0,0 +1,17 @@
1
+ /** Windows need desktop width; narrower screens use the routed shell. */
2
+ export declare const WINDOWED_LAYOUT_MIN_WIDTH_PX = 1024;
3
+ export declare const WINDOWED_LAYOUT_NARROW_QUERY = "(max-width: 1023px)";
4
+ /**
5
+ * Within the routed layout, the divider between the two responsive tiers:
6
+ *
7
+ * - Below this width the shell is a phone-style chrome: a top app bar, and a
8
+ * bottom sheet of launcher tiles.
9
+ * - At or above it the shell is a tablet/iPad-style chrome with a launcher that
10
+ * can use a left rail or bottom sheet.
11
+ *
12
+ * Mirrors the `759px` media queries in the routed stylesheets; a test keeps the
13
+ * two in sync.
14
+ */
15
+ export declare const ROUTED_TABLET_BREAKPOINT_PX = 760;
16
+ /** Matches routed viewports wide enough for the persistent side-rail layout. */
17
+ export declare const ROUTED_TABLET_QUERY = "(min-width: 760px)";
@@ -0,0 +1,18 @@
1
+ /** Windows need desktop width; narrower screens use the routed shell. */
2
+ export const WINDOWED_LAYOUT_MIN_WIDTH_PX = 1024;
3
+ export const WINDOWED_LAYOUT_NARROW_QUERY = `(max-width: ${WINDOWED_LAYOUT_MIN_WIDTH_PX - 1}px)`;
4
+ /**
5
+ * Within the routed layout, the divider between the two responsive tiers:
6
+ *
7
+ * - Below this width the shell is a phone-style chrome: a top app bar, and a
8
+ * bottom sheet of launcher tiles.
9
+ * - At or above it the shell is a tablet/iPad-style chrome with a launcher that
10
+ * can use a left rail or bottom sheet.
11
+ *
12
+ * Mirrors the `759px` media queries in the routed stylesheets; a test keeps the
13
+ * two in sync.
14
+ */
15
+ export const ROUTED_TABLET_BREAKPOINT_PX = 760;
16
+ /** Matches routed viewports wide enough for the persistent side-rail layout. */
17
+ export const ROUTED_TABLET_QUERY = `(min-width: ${ROUTED_TABLET_BREAKPOINT_PX}px)`;
18
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/breakpoints.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD,MAAM,CAAC,MAAM,4BAA4B,GAAG,eAAe,4BAA4B,GAAG,CAAC,KAAK,CAAC;AAEjG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,2BAA2B,KAAK,CAAC","sourcesContent":["/** Windows need desktop width; narrower screens use the routed shell. */\nexport const WINDOWED_LAYOUT_MIN_WIDTH_PX = 1024;\n\nexport const WINDOWED_LAYOUT_NARROW_QUERY = `(max-width: ${WINDOWED_LAYOUT_MIN_WIDTH_PX - 1}px)`;\n\n/**\n * Within the routed layout, the divider between the two responsive tiers:\n *\n * - Below this width the shell is a phone-style chrome: a top app bar, and a\n * bottom sheet of launcher tiles.\n * - At or above it the shell is a tablet/iPad-style chrome with a launcher that\n * can use a left rail or bottom sheet.\n *\n * Mirrors the `759px` media queries in the routed stylesheets; a test keeps the\n * two in sync.\n */\nexport const ROUTED_TABLET_BREAKPOINT_PX = 760;\n\n/** Matches routed viewports wide enough for the persistent side-rail layout. */\nexport const ROUTED_TABLET_QUERY = `(min-width: ${ROUTED_TABLET_BREAKPOINT_PX}px)`;\n"]}
@@ -0,0 +1,39 @@
1
+ import type { ComponentType } from "react";
2
+ import type { WindowingIcon } from "../icons/windowingIcon.js";
3
+ /** One app a launcher opens: in a window, or as the routed shell's page. */
4
+ export interface MiniAppDefinition {
5
+ /**
6
+ * Builds the app's component. A window calls it when it opens, and the
7
+ * routed shell when it shows the app, so each gets its own component.
8
+ */
9
+ createComponent: () => ComponentType;
10
+ /** The app's glyph in the launchers and the taskbar. */
11
+ icon?: WindowingIcon | undefined;
12
+ /**
13
+ * Whether the app's sidebar starts shown, in a new window and on the routed
14
+ * shell's tablet tier. Defaults to shown. The phone tier always starts with
15
+ * the sidebar hidden.
16
+ */
17
+ initialShowSidebar?: boolean | undefined;
18
+ title: string;
19
+ }
20
+ /**
21
+ * A launcher application: the mini-apps it can open, the order its launchers
22
+ * list them in, and the one the routed shell shows at the root route.
23
+ */
24
+ export interface LauncherDefinition<AppId extends string = string> {
25
+ apps: Readonly<Record<AppId, MiniAppDefinition>>;
26
+ /** Shown at the root route. Defaults to the first app in `order`. */
27
+ homeAppId?: AppId | undefined;
28
+ /**
29
+ * The order the launchers list the apps in. Ids with no app in `apps` are
30
+ * skipped. Defaults to the order of `apps`' keys.
31
+ */
32
+ order?: ReadonlyArray<AppId> | undefined;
33
+ }
34
+ /** Narrows an opaque window `appId` to one of the launcher's apps. */
35
+ export declare function isLauncherAppId<AppId extends string>(definition: LauncherDefinition<AppId>, value: string | null | undefined): value is AppId;
36
+ /** The launcher's apps in the order its launchers list them. */
37
+ export declare function resolveLauncherOrder<AppId extends string>(definition: LauncherDefinition<AppId>): ReadonlyArray<AppId>;
38
+ /** The app the routed shell shows at the root route, if the launcher has any. */
39
+ export declare function resolveLauncherHomeAppId<AppId extends string>(definition: LauncherDefinition<AppId>): AppId | null;
@@ -0,0 +1,18 @@
1
+ /** Narrows an opaque window `appId` to one of the launcher's apps. */
2
+ export function isLauncherAppId(definition, value) {
3
+ return typeof value === "string" && Object.hasOwn(definition.apps, value);
4
+ }
5
+ /** The launcher's apps in the order its launchers list them. */
6
+ export function resolveLauncherOrder(definition) {
7
+ const order = definition.order ?? Object.keys(definition.apps);
8
+ return order.filter((appId) => isLauncherAppId(definition, appId));
9
+ }
10
+ /** The app the routed shell shows at the root route, if the launcher has any. */
11
+ export function resolveLauncherHomeAppId(definition) {
12
+ if (definition.homeAppId !== undefined &&
13
+ isLauncherAppId(definition, definition.homeAppId)) {
14
+ return definition.homeAppId;
15
+ }
16
+ return resolveLauncherOrder(definition)[0] ?? null;
17
+ }
18
+ //# sourceMappingURL=launcherDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcherDefinition.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/launcherDefinition.ts"],"names":[],"mappings":"AAoCA,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\";\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 * 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 title: string;\n}\n\n/**\n * A launcher application: the mini-apps it can open, the order its launchers\n * list them in, and the one the routed shell shows at the root route.\n */\nexport interface LauncherDefinition<AppId extends string = string> {\n apps: Readonly<Record<AppId, MiniAppDefinition>>;\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"]}
@@ -0,0 +1,16 @@
1
+ export interface NavigationHistoryCursor {
2
+ entries: number;
3
+ index: number;
4
+ }
5
+ export interface NavigationHistoryAvailability {
6
+ canGoBack: boolean;
7
+ canGoForward: boolean;
8
+ }
9
+ export declare const DEFAULT_NAVIGATION_HISTORY_CURSOR: {
10
+ entries: number;
11
+ index: number;
12
+ };
13
+ export declare function getNavigationHistoryAvailability({ entries, index, }: NavigationHistoryCursor): NavigationHistoryAvailability;
14
+ export declare function readNavigationHistoryCursor(state: unknown): NavigationHistoryCursor | null;
15
+ export declare function createNavigationHistoryState(currentState: unknown, cursor: NavigationHistoryCursor): Record<string, unknown>;
16
+ export declare function getNextNavigationHistoryCursor({ index, }: NavigationHistoryCursor): NavigationHistoryCursor;
@@ -0,0 +1,48 @@
1
+ export const DEFAULT_NAVIGATION_HISTORY_CURSOR = {
2
+ entries: 1,
3
+ index: 0,
4
+ };
5
+ const NAVIGATION_HISTORY_STATE_KEY = "__tearleadsAppNavigation";
6
+ function isRecord(value) {
7
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8
+ }
9
+ function isValidHistoryCursor(value) {
10
+ if (!isRecord(value)) {
11
+ return false;
12
+ }
13
+ const { entries, index } = value;
14
+ return (Number.isInteger(entries) &&
15
+ Number.isInteger(index) &&
16
+ typeof entries === "number" &&
17
+ typeof index === "number" &&
18
+ entries > 0 &&
19
+ index >= 0 &&
20
+ index < entries);
21
+ }
22
+ export function getNavigationHistoryAvailability({ entries, index, }) {
23
+ return {
24
+ canGoBack: index > 0,
25
+ canGoForward: index < entries - 1,
26
+ };
27
+ }
28
+ export function readNavigationHistoryCursor(state) {
29
+ if (!isRecord(state)) {
30
+ return null;
31
+ }
32
+ const cursor = state[NAVIGATION_HISTORY_STATE_KEY];
33
+ return isValidHistoryCursor(cursor) ? cursor : null;
34
+ }
35
+ export function createNavigationHistoryState(currentState, cursor) {
36
+ return {
37
+ ...(isRecord(currentState) ? currentState : {}),
38
+ [NAVIGATION_HISTORY_STATE_KEY]: cursor,
39
+ };
40
+ }
41
+ export function getNextNavigationHistoryCursor({ index, }) {
42
+ const nextIndex = index + 1;
43
+ return {
44
+ entries: nextIndex + 1,
45
+ index: nextIndex,
46
+ };
47
+ }
48
+ //# sourceMappingURL=navigationHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigationHistory.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/navigationHistory.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;CACyB,CAAC;AAEpC,MAAM,4BAA4B,GAAG,0BAA0B,CAAC;AAEhE,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAc;IAEd,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACjC,OAAO,CACL,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC;QACzB,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;QACvB,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,GAAG,CAAC;QACX,KAAK,IAAI,CAAC;QACV,KAAK,GAAG,OAAO,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,EAC/C,OAAO,EACP,KAAK,GACmB;IACxB,OAAO;QACL,SAAS,EAAE,KAAK,GAAG,CAAC;QACpB,YAAY,EAAE,KAAK,GAAG,OAAO,GAAG,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACnD,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,YAAqB,EACrB,MAA+B;IAE/B,OAAO;QACL,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,CAAC,4BAA4B,CAAC,EAAE,MAAM;KACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,EAC7C,KAAK,GACmB;IACxB,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;IAC5B,OAAO;QACL,OAAO,EAAE,SAAS,GAAG,CAAC;QACtB,KAAK,EAAE,SAAS;KACjB,CAAC;AACJ,CAAC","sourcesContent":["export interface NavigationHistoryCursor {\n entries: number;\n index: number;\n}\n\nexport interface NavigationHistoryAvailability {\n canGoBack: boolean;\n canGoForward: boolean;\n}\n\nexport const DEFAULT_NAVIGATION_HISTORY_CURSOR = {\n entries: 1,\n index: 0,\n} satisfies NavigationHistoryCursor;\n\nconst NAVIGATION_HISTORY_STATE_KEY = \"__tearleadsAppNavigation\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isValidHistoryCursor(\n value: unknown,\n): value is NavigationHistoryCursor {\n if (!isRecord(value)) {\n return false;\n }\n\n const { entries, index } = value;\n return (\n Number.isInteger(entries) &&\n Number.isInteger(index) &&\n typeof entries === \"number\" &&\n typeof index === \"number\" &&\n entries > 0 &&\n index >= 0 &&\n index < entries\n );\n}\n\nexport function getNavigationHistoryAvailability({\n entries,\n index,\n}: NavigationHistoryCursor): NavigationHistoryAvailability {\n return {\n canGoBack: index > 0,\n canGoForward: index < entries - 1,\n };\n}\n\nexport function readNavigationHistoryCursor(\n state: unknown,\n): NavigationHistoryCursor | null {\n if (!isRecord(state)) {\n return null;\n }\n\n const cursor = state[NAVIGATION_HISTORY_STATE_KEY];\n return isValidHistoryCursor(cursor) ? cursor : null;\n}\n\nexport function createNavigationHistoryState(\n currentState: unknown,\n cursor: NavigationHistoryCursor,\n): Record<string, unknown> {\n return {\n ...(isRecord(currentState) ? currentState : {}),\n [NAVIGATION_HISTORY_STATE_KEY]: cursor,\n };\n}\n\nexport function getNextNavigationHistoryCursor({\n index,\n}: NavigationHistoryCursor): NavigationHistoryCursor {\n const nextIndex = index + 1;\n return {\n entries: nextIndex + 1,\n index: nextIndex,\n };\n}\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * How a launcher presents its apps: `windowed` as movable windows on a desktop,
3
+ * or `routed` as one app at a time in the routed shell, the iPad / phone
4
+ * layout, with browser history for navigation.
5
+ */
6
+ export type NavigationMode = "routed" | "windowed";
7
+ export interface NavigationEnvironment {
8
+ innerWidth: number;
9
+ maxTouchPoints: number;
10
+ pointerCoarse: boolean;
11
+ userAgent: string;
12
+ }
13
+ interface ResolveNavigationModeInput {
14
+ environment?: NavigationEnvironment | undefined;
15
+ /** A mode that wins over `preferredMode`, such as a host's fixed layout. */
16
+ forcedMode?: NavigationMode | undefined;
17
+ /**
18
+ * The mode to use when nothing forces one. `windowed` applies only while the
19
+ * environment can show windows (see {@link isWindowedLayoutEligible}).
20
+ * Defaults to `routed`.
21
+ */
22
+ preferredMode?: NavigationMode | undefined;
23
+ }
24
+ export declare function readNavigationEnvironment(): NavigationEnvironment;
25
+ /**
26
+ * Whether windows suit the environment: a desktop-width screen with a fine
27
+ * pointer, and not an iPad, which reports a desktop user agent.
28
+ */
29
+ export declare function isWindowedLayoutEligible(environment: NavigationEnvironment): boolean;
30
+ export declare function resolveNavigationMode({ environment, forcedMode, preferredMode, }: ResolveNavigationModeInput): NavigationMode;
31
+ export {};
@@ -0,0 +1,35 @@
1
+ import { WINDOWED_LAYOUT_MIN_WIDTH_PX } from "./breakpoints.js";
2
+ function isIPadLikeEnvironment(environment) {
3
+ const userAgent = environment.userAgent.toLowerCase();
4
+ return (userAgent.includes("ipad") ||
5
+ (userAgent.includes("macintosh") && environment.maxTouchPoints > 1));
6
+ }
7
+ export function readNavigationEnvironment() {
8
+ return {
9
+ innerWidth: window.innerWidth,
10
+ maxTouchPoints: navigator.maxTouchPoints,
11
+ pointerCoarse: window.matchMedia("(pointer: coarse)").matches,
12
+ userAgent: navigator.userAgent,
13
+ };
14
+ }
15
+ /**
16
+ * Whether windows suit the environment: a desktop-width screen with a fine
17
+ * pointer, and not an iPad, which reports a desktop user agent.
18
+ */
19
+ export function isWindowedLayoutEligible(environment) {
20
+ return (environment.innerWidth >= WINDOWED_LAYOUT_MIN_WIDTH_PX &&
21
+ !environment.pointerCoarse &&
22
+ !isIPadLikeEnvironment(environment));
23
+ }
24
+ export function resolveNavigationMode({ environment, forcedMode, preferredMode = "routed", }) {
25
+ if (forcedMode) {
26
+ return forcedMode;
27
+ }
28
+ if (preferredMode === "windowed" &&
29
+ environment &&
30
+ isWindowedLayoutEligible(environment)) {
31
+ return "windowed";
32
+ }
33
+ return "routed";
34
+ }
35
+ //# sourceMappingURL=navigationMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigationMode.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/navigationMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AA4B7D,SAAS,qBAAqB,CAAC,WAAkC;IAC/D,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;IACtD,OAAO,CACL,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC1B,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,cAAc,GAAG,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,cAAc,EAAE,SAAS,CAAC,cAAc;QACxC,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,OAAO;QAC7D,SAAS,EAAE,SAAS,CAAC,SAAS;KAC/B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,WAAkC;IAElC,OAAO,CACL,WAAW,CAAC,UAAU,IAAI,4BAA4B;QACtD,CAAC,WAAW,CAAC,aAAa;QAC1B,CAAC,qBAAqB,CAAC,WAAW,CAAC,CACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,EACpC,WAAW,EACX,UAAU,EACV,aAAa,GAAG,QAAQ,GACG;IAC3B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IACE,aAAa,KAAK,UAAU;QAC5B,WAAW;QACX,wBAAwB,CAAC,WAAW,CAAC,EACrC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { WINDOWED_LAYOUT_MIN_WIDTH_PX } from \"./breakpoints\";\n\n/**\n * How a launcher presents its apps: `windowed` as movable windows on a desktop,\n * or `routed` as one app at a time in the routed shell, the iPad / phone\n * layout, with browser history for navigation.\n */\nexport type NavigationMode = \"routed\" | \"windowed\";\n\nexport interface NavigationEnvironment {\n innerWidth: number;\n maxTouchPoints: number;\n pointerCoarse: boolean;\n userAgent: string;\n}\n\ninterface ResolveNavigationModeInput {\n environment?: NavigationEnvironment | undefined;\n /** A mode that wins over `preferredMode`, such as a host's fixed layout. */\n forcedMode?: NavigationMode | undefined;\n /**\n * The mode to use when nothing forces one. `windowed` applies only while the\n * environment can show windows (see {@link isWindowedLayoutEligible}).\n * Defaults to `routed`.\n */\n preferredMode?: NavigationMode | undefined;\n}\n\nfunction isIPadLikeEnvironment(environment: NavigationEnvironment): boolean {\n const userAgent = environment.userAgent.toLowerCase();\n return (\n userAgent.includes(\"ipad\") ||\n (userAgent.includes(\"macintosh\") && environment.maxTouchPoints > 1)\n );\n}\n\nexport function readNavigationEnvironment(): NavigationEnvironment {\n return {\n innerWidth: window.innerWidth,\n maxTouchPoints: navigator.maxTouchPoints,\n pointerCoarse: window.matchMedia(\"(pointer: coarse)\").matches,\n userAgent: navigator.userAgent,\n };\n}\n\n/**\n * Whether windows suit the environment: a desktop-width screen with a fine\n * pointer, and not an iPad, which reports a desktop user agent.\n */\nexport function isWindowedLayoutEligible(\n environment: NavigationEnvironment,\n): boolean {\n return (\n environment.innerWidth >= WINDOWED_LAYOUT_MIN_WIDTH_PX &&\n !environment.pointerCoarse &&\n !isIPadLikeEnvironment(environment)\n );\n}\n\nexport function resolveNavigationMode({\n environment,\n forcedMode,\n preferredMode = \"routed\",\n}: ResolveNavigationModeInput): NavigationMode {\n if (forcedMode) {\n return forcedMode;\n }\n\n if (\n preferredMode === \"windowed\" &&\n environment &&\n isWindowedLayoutEligible(environment)\n ) {\n return \"windowed\";\n }\n\n return \"routed\";\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { type LauncherDefinition } from "./launcherDefinition.js";
2
+ export declare const LAUNCHER_HOME_PATH = "/";
3
+ /**
4
+ * Where the routed shell is: the app it shows (or `null` at the root route)
5
+ * and the app's own path within it.
6
+ */
7
+ export interface LauncherRoute<AppId extends string = string> {
8
+ appId: AppId | null;
9
+ pathSegments: ReadonlyArray<string>;
10
+ }
11
+ /** The URL of an app's route: `/app/<app id>/<path segments…>`. */
12
+ export declare function buildMiniAppPath(appId: string, pathSegments?: ReadonlyArray<string>): string;
13
+ /**
14
+ * Reads a URL path back into a route. Paths outside `/app/`, and apps the
15
+ * launcher does not have, read as the root route.
16
+ */
17
+ export declare function parseLauncherRoute<AppId extends string>(pathname: string, definition: LauncherDefinition<AppId>): LauncherRoute<AppId>;
@@ -0,0 +1,46 @@
1
+ import { isLauncherAppId } from "./launcherDefinition.js";
2
+ export const LAUNCHER_HOME_PATH = "/";
3
+ const LAUNCHER_ROUTE_PREFIX = "/app/";
4
+ function decodeRouteSegment(segment) {
5
+ try {
6
+ return decodeURIComponent(segment);
7
+ }
8
+ catch {
9
+ return null;
10
+ }
11
+ }
12
+ /** The URL of an app's route: `/app/<app id>/<path segments…>`. */
13
+ export function buildMiniAppPath(appId, pathSegments = []) {
14
+ const encodedSegments = [
15
+ encodeURIComponent(appId),
16
+ ...pathSegments.map((segment) => encodeURIComponent(segment)),
17
+ ];
18
+ return `${LAUNCHER_ROUTE_PREFIX}${encodedSegments.join("/")}`;
19
+ }
20
+ /**
21
+ * Reads a URL path back into a route. Paths outside `/app/`, and apps the
22
+ * launcher does not have, read as the root route.
23
+ */
24
+ export function parseLauncherRoute(pathname, definition) {
25
+ if (!pathname.startsWith(LAUNCHER_ROUTE_PREFIX)) {
26
+ return { appId: null, pathSegments: [] };
27
+ }
28
+ const [encodedAppId = "", ...encodedPathSegments] = pathname
29
+ .slice(LAUNCHER_ROUTE_PREFIX.length)
30
+ .split("/")
31
+ .filter((segment) => segment.length > 0);
32
+ const rawAppId = decodeRouteSegment(encodedAppId);
33
+ if (!isLauncherAppId(definition, rawAppId)) {
34
+ return { appId: null, pathSegments: [] };
35
+ }
36
+ const pathSegments = [];
37
+ for (const segment of encodedPathSegments) {
38
+ const decodedSegment = decodeRouteSegment(segment);
39
+ if (decodedSegment === null) {
40
+ return { appId: rawAppId, pathSegments: [] };
41
+ }
42
+ pathSegments.push(decodedSegment);
43
+ }
44
+ return { appId: rawAppId, pathSegments };
45
+ }
46
+ //# sourceMappingURL=routePaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routePaths.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/routePaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA2B,MAAM,sBAAsB,CAAC;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAWtC,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,eAAsC,EAAE;IAExC,MAAM,eAAe,GAAG;QACtB,kBAAkB,CAAC,KAAK,CAAC;QACzB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;KAC9D,CAAC;IACF,OAAO,GAAG,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,UAAqC;IAErC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAChD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,EAAE,EAAE,GAAG,mBAAmB,CAAC,GAAG,QAAQ;SACzD,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAClD,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC3C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,KAAK,MAAM,OAAO,IAAI,mBAAmB,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;YAC5B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;QAC/C,CAAC;QACD,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["import { isLauncherAppId, type LauncherDefinition } from \"./launcherDefinition\";\n\nexport const LAUNCHER_HOME_PATH = \"/\";\nconst LAUNCHER_ROUTE_PREFIX = \"/app/\";\n\n/**\n * Where the routed shell is: the app it shows (or `null` at the root route)\n * and the app's own path within it.\n */\nexport interface LauncherRoute<AppId extends string = string> {\n appId: AppId | null;\n pathSegments: ReadonlyArray<string>;\n}\n\nfunction decodeRouteSegment(segment: string): string | null {\n try {\n return decodeURIComponent(segment);\n } catch {\n return null;\n }\n}\n\n/** The URL of an app's route: `/app/<app id>/<path segments…>`. */\nexport function buildMiniAppPath(\n appId: string,\n pathSegments: ReadonlyArray<string> = [],\n): string {\n const encodedSegments = [\n encodeURIComponent(appId),\n ...pathSegments.map((segment) => encodeURIComponent(segment)),\n ];\n return `${LAUNCHER_ROUTE_PREFIX}${encodedSegments.join(\"/\")}`;\n}\n\n/**\n * Reads a URL path back into a route. Paths outside `/app/`, and apps the\n * launcher does not have, read as the root route.\n */\nexport function parseLauncherRoute<AppId extends string>(\n pathname: string,\n definition: LauncherDefinition<AppId>,\n): LauncherRoute<AppId> {\n if (!pathname.startsWith(LAUNCHER_ROUTE_PREFIX)) {\n return { appId: null, pathSegments: [] };\n }\n\n const [encodedAppId = \"\", ...encodedPathSegments] = pathname\n .slice(LAUNCHER_ROUTE_PREFIX.length)\n .split(\"/\")\n .filter((segment) => segment.length > 0);\n const rawAppId = decodeRouteSegment(encodedAppId);\n if (!isLauncherAppId(definition, rawAppId)) {\n return { appId: null, pathSegments: [] };\n }\n\n const pathSegments: string[] = [];\n for (const segment of encodedPathSegments) {\n const decodedSegment = decodeRouteSegment(segment);\n if (decodedSegment === null) {\n return { appId: rawAppId, pathSegments: [] };\n }\n pathSegments.push(decodedSegment);\n }\n\n return { appId: rawAppId, pathSegments };\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { type Dispatch, type MutableRefObject, type SetStateAction } from "react";
2
+ import { type NavigationHistoryCursor } from "./navigationHistory.js";
3
+ import type { NavigationMode } from "./navigationMode.js";
4
+ import type { LauncherRoute } from "./routePaths.js";
5
+ interface RoutedNavigationRuntime {
6
+ mode: NavigationMode;
7
+ }
8
+ interface RoutedPathNavigatorInput {
9
+ path: string;
10
+ replace?: boolean | undefined;
11
+ route: LauncherRoute;
12
+ }
13
+ export declare function replaceWindowHistoryCursor(cursor: NavigationHistoryCursor, path?: string): void;
14
+ export declare function useRoutedPathNavigator({ historyCursorRef, runtimeRef, setHistoryCursor, setRoute, }: {
15
+ historyCursorRef: MutableRefObject<NavigationHistoryCursor>;
16
+ runtimeRef: MutableRefObject<RoutedNavigationRuntime>;
17
+ setHistoryCursor: (cursor: NavigationHistoryCursor) => void;
18
+ setRoute: Dispatch<SetStateAction<LauncherRoute>>;
19
+ }): ({ path, replace, route }: RoutedPathNavigatorInput) => void;
20
+ export {};