@tearleads/windowing 0.2.23 → 0.2.25
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.
- package/README.md +60 -0
- package/display/DisplayProperties.css +114 -0
- package/display/DisplayProperties.d.ts +8 -0
- package/display/DisplayProperties.js +36 -0
- package/display/DisplayProperties.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +6 -1
- package/index.js.map +1 -1
- package/launcher/LauncherNavigationProvider.js +1 -0
- package/launcher/LauncherNavigationProvider.js.map +1 -1
- package/launcher/launcherDefinition.d.ts +6 -0
- package/launcher/launcherDefinition.js.map +1 -1
- package/package.json +1 -1
- package/wallpaper/DesktopWallpaper.d.ts +15 -0
- package/wallpaper/DesktopWallpaper.js +22 -0
- package/wallpaper/DesktopWallpaper.js.map +1 -0
- package/wallpaper/Wallpaper.css +34 -0
- package/wallpaper/WallpaperProvider.d.ts +33 -0
- package/wallpaper/WallpaperProvider.js +37 -0
- package/wallpaper/WallpaperProvider.js.map +1 -0
- package/wallpaper/tessellations.d.ts +13 -0
- package/wallpaper/tessellations.js +151 -0
- package/wallpaper/tessellations.js.map +1 -0
- package/wallpaper/wallpapers.d.ts +52 -0
- package/wallpaper/wallpapers.js +28 -0
- package/wallpaper/wallpapers.js.map +1 -0
- package/window/Window.js +2 -2
- package/window/Window.js.map +1 -1
- package/window/useWindowFit.d.ts +2 -1
- package/window/useWindowFit.js +4 -4
- package/window/useWindowFit.js.map +1 -1
- package/window/useWindowGeometry.d.ts +2 -1
- package/window/useWindowGeometry.js +10 -2
- package/window/useWindowGeometry.js.map +1 -1
package/README.md
CHANGED
|
@@ -363,6 +363,66 @@ the browser paints and removes them on unmount; under a dark scheme,
|
|
|
363
363
|
`tokens.css` sets `color-scheme: dark`. Tearleads sets its themes per host
|
|
364
364
|
profile in `packages/app/src/host/AppHostConfig.ts`.
|
|
365
365
|
|
|
366
|
+
## Wallpapers and Display Properties
|
|
367
|
+
|
|
368
|
+
A host offers its own desktop wallpapers. A `WallpaperDefinition` is
|
|
369
|
+
`{ id, label, tile?, base?, ink? }`: `tile` is one cell of a repeating
|
|
370
|
+
pattern, as SVG markup with its `width` and `height` in CSS pixels. The tile's
|
|
371
|
+
SVG is a mask rather than a picture: opaque shapes paint the ink, translucent
|
|
372
|
+
ones (`fill-opacity`) a share of it, and the base shows elsewhere. Unless a
|
|
373
|
+
wallpaper names its colors, they come from the theme, resolved on the
|
|
374
|
+
wallpaper's own element: the `--desktop-wallpaper-base` and
|
|
375
|
+
`--desktop-wallpaper-ink` tokens where a host sets them, else the desk color
|
|
376
|
+
(`--desktop-background`, then `--color-light`) under a faint wash of
|
|
377
|
+
`--color-dark`. So one tile suits every theme.
|
|
378
|
+
A wallpaper without a tile is its base alone.
|
|
379
|
+
|
|
380
|
+
The package ships quiet tessellations to choose from: `BLOCKS_WALLPAPER`,
|
|
381
|
+
`HONEYCOMB_WALLPAPER`, `TRIANGLES_WALLPAPER`, `HARLEQUIN_WALLPAPER`,
|
|
382
|
+
`CHEVRON_WALLPAPER`, and `PLAIN_WALLPAPER` (no pattern). List them with the
|
|
383
|
+
host's own in a `WallpaperProvider`, and render `DesktopWallpaper` as the
|
|
384
|
+
first child of the desktop surface, before `DesktopIcons`:
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
const BRICKS: WallpaperDefinition<"bricks"> = {
|
|
388
|
+
id: "bricks",
|
|
389
|
+
label: "Bricks",
|
|
390
|
+
tile: {
|
|
391
|
+
height: 24,
|
|
392
|
+
svg: `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="24">…</svg>`,
|
|
393
|
+
width: 48,
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
const WALLPAPERS = [BRICKS, HONEYCOMB_WALLPAPER, PLAIN_WALLPAPER];
|
|
397
|
+
|
|
398
|
+
<WallpaperProvider
|
|
399
|
+
defaultWallpaper="bricks"
|
|
400
|
+
storageKey="notes.wallpaper"
|
|
401
|
+
wallpapers={WALLPAPERS}
|
|
402
|
+
>
|
|
403
|
+
<div style={{ position: "relative", isolation: "isolate", height: "100%" }}>
|
|
404
|
+
<DesktopWallpaper />
|
|
405
|
+
<DesktopIcons appIds={APP_IDS} />
|
|
406
|
+
{windows}
|
|
407
|
+
</div>
|
|
408
|
+
</WallpaperProvider>;
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The wallpaper paints on a layer below everything on the surface, including
|
|
412
|
+
content laid out in flow, so the surface must be a stacking context: give it
|
|
413
|
+
`isolation: isolate` beside its `position`. The wallpaper takes no pointer
|
|
414
|
+
input, so a right-click on it reaches the surface, where a host opens its
|
|
415
|
+
desktop menu. The choice persists under
|
|
416
|
+
`storageKey` like a theme's; `useWallpaper` and `useOptionalWallpaper` read
|
|
417
|
+
and set it. `DesktopWallpaper` paints its `wallpaper` prop instead when given
|
|
418
|
+
one, and nothing without a provider.
|
|
419
|
+
|
|
420
|
+
`DisplayProperties` is the content of a host's Display Properties mini-app: a
|
|
421
|
+
Background section listing the provider's wallpapers as previews, and a Theme
|
|
422
|
+
section listing the theme provider's themes. Each choice applies at once; a
|
|
423
|
+
section whose provider is missing, or a theme list of one, is left out. Both
|
|
424
|
+
Tearleads and a2f0.net open it from their desktop's context menu.
|
|
425
|
+
|
|
366
426
|
## Styles
|
|
367
427
|
|
|
368
428
|
Each component imports its own stylesheet, so a bundler that handles CSS imports
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Display Properties: a column of fieldsets. Each option is a labeled radio
|
|
3
|
+
* drawn as a card; the radio itself stays in the tab order and the
|
|
4
|
+
* accessibility tree but is visually hidden, and the card shows its focus and
|
|
5
|
+
* checked state.
|
|
6
|
+
*/
|
|
7
|
+
.display-properties {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: var(--space-md);
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
padding: var(--space-md);
|
|
13
|
+
font-size: var(--font-size-sm);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.display-properties-section {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: var(--space-sm);
|
|
20
|
+
min-width: 0;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
border: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.display-properties-section > legend {
|
|
27
|
+
margin-bottom: var(--space-sm);
|
|
28
|
+
padding: 0;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.display-properties-wallpapers {
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
|
|
35
|
+
gap: var(--space-sm);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.display-properties-themes {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-wrap: wrap;
|
|
41
|
+
gap: var(--space-sm);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.display-properties-wallpaper,
|
|
45
|
+
.display-properties-theme {
|
|
46
|
+
position: relative;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: var(--space-xs);
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
padding: var(--space-xs);
|
|
52
|
+
border: var(--border-width) solid var(--color-hairline);
|
|
53
|
+
border-radius: var(--app-radius-control);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.display-properties-wallpaper {
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.display-properties-theme {
|
|
62
|
+
padding: var(--space-xs) var(--space-sm);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.display-properties-wallpaper:hover,
|
|
66
|
+
.display-properties-theme:hover {
|
|
67
|
+
background: var(--app-hover-surface);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.display-properties-wallpaper:has(:checked),
|
|
71
|
+
.display-properties-theme:has(:checked) {
|
|
72
|
+
border-color: var(--color-dark);
|
|
73
|
+
box-shadow: inset 0 0 0 1px var(--color-dark);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.display-properties-wallpaper:has(:focus-visible),
|
|
77
|
+
.display-properties-theme:has(:focus-visible) {
|
|
78
|
+
outline: 2px solid var(--color-dark);
|
|
79
|
+
outline-offset: 2px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.display-properties-input {
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 1px;
|
|
86
|
+
margin: 0;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
clip-path: inset(50%);
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
opacity: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.display-properties-swatch {
|
|
94
|
+
position: relative;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 3.5rem;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
border-radius: calc(var(--app-radius-control) - 2px);
|
|
99
|
+
box-shadow: inset 0 0 0 1px var(--color-hairline);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Fit a complete tile vertically, repeating across the preview instead of
|
|
103
|
+
* cropping large artwork at desktop scale. Outrank Wallpaper.css regardless
|
|
104
|
+
* of the host's import order; the desktop keeps its natural pixel tile size. */
|
|
105
|
+
.display-properties-swatch.wallpaper-pattern[data-pattern]::before {
|
|
106
|
+
-webkit-mask-size: auto 100%;
|
|
107
|
+
mask-size: auto 100%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.display-properties-label {
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
text-overflow: ellipsis;
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The display settings, for a host's Display Properties mini-app: the
|
|
3
|
+
* desktop's background, from the nearest {@link WallpaperProvider}, and the
|
|
4
|
+
* color theme, from the nearest {@link ThemeProvider}. Each choice applies at
|
|
5
|
+
* once. A section whose provider is missing, or that offers one option, is
|
|
6
|
+
* left out. It has no toolbar actions, so its window shows no toolbar row.
|
|
7
|
+
*/
|
|
8
|
+
export declare function DisplayProperties(): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { useOptionalTheme } from "../theme/ThemeProvider.js";
|
|
4
|
+
import { useOptionalWallpaper } from "../wallpaper/WallpaperProvider.js";
|
|
5
|
+
import { wallpaperStyle } from "../wallpaper/wallpapers.js";
|
|
6
|
+
import { useSuppressWindowToolbar } from "../window/CurrentWindowContext.js";
|
|
7
|
+
import "../wallpaper/Wallpaper.css";
|
|
8
|
+
import "./DisplayProperties.css";
|
|
9
|
+
function BackgroundSection() {
|
|
10
|
+
const wallpaper = useOptionalWallpaper();
|
|
11
|
+
const name = useId();
|
|
12
|
+
if (!wallpaper) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (_jsxs("fieldset", { className: "display-properties-section", children: [_jsx("legend", { children: "Background" }), _jsx("div", { className: "display-properties-wallpapers", children: wallpaper.wallpapers.map((option) => (_jsxs("label", { className: "display-properties-wallpaper", children: [_jsx("input", { checked: option.id === wallpaper.activeWallpaper.id, className: "display-properties-input", name: name, onChange: () => wallpaper.setWallpaper(option.id), type: "radio", value: option.id }), _jsx("span", { "aria-hidden": "true", className: "display-properties-swatch wallpaper-pattern", "data-pattern": option.tile ? "" : undefined, style: wallpaperStyle(option) }), _jsx("span", { className: "display-properties-label", children: option.label })] }, option.id))) })] }));
|
|
16
|
+
}
|
|
17
|
+
function ThemeSection() {
|
|
18
|
+
const theme = useOptionalTheme();
|
|
19
|
+
const name = useId();
|
|
20
|
+
if (!theme || theme.themes.length < 2) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return (_jsxs("fieldset", { className: "display-properties-section", children: [_jsx("legend", { children: "Theme" }), _jsx("div", { className: "display-properties-themes", children: theme.themes.map((option) => (_jsxs("label", { className: "display-properties-theme", children: [_jsx("input", { checked: option.id === theme.activeTheme.id, className: "display-properties-input", name: name, onChange: () => theme.setTheme(option.id), type: "radio", value: option.id }), _jsx("span", { className: "display-properties-label", children: option.label })] }, option.id))) })] }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The display settings, for a host's Display Properties mini-app: the
|
|
27
|
+
* desktop's background, from the nearest {@link WallpaperProvider}, and the
|
|
28
|
+
* color theme, from the nearest {@link ThemeProvider}. Each choice applies at
|
|
29
|
+
* once. A section whose provider is missing, or that offers one option, is
|
|
30
|
+
* left out. It has no toolbar actions, so its window shows no toolbar row.
|
|
31
|
+
*/
|
|
32
|
+
export function DisplayProperties() {
|
|
33
|
+
useSuppressWindowToolbar(true);
|
|
34
|
+
return (_jsxs("div", { className: "display-properties", children: [_jsx(BackgroundSection, {}), _jsx(ThemeSection, {})] }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=DisplayProperties.js.map
|
|
@@ -0,0 +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,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,GA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A2B,YACvC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,iBAAO,SAAS,EAAC,0BAA0B,aACzC,gBACE,OAAO,EAAE,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC,WAAW,CAAC,EAAE,EAC3C,SAAS,EAAC,0BAA0B,EACpC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EACzC,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,MAAM,CAAC,EAAE,GAChB,EACF,eAAM,SAAS,EAAC,0BAA0B,YAAE,MAAM,CAAC,KAAK,GAAQ,KATjB,MAAM,CAAC,EAAE,CAUlD,CACT,CAAC,GACE,IACG,CACZ,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;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,IACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useId } from \"react\";\nimport { useOptionalTheme } from \"../theme/ThemeProvider\";\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\n/**\n * The display settings, for a host's Display Properties mini-app: the\n * desktop's background, from the nearest {@link WallpaperProvider}, and the\n * color theme, from the nearest {@link ThemeProvider}. Each choice applies at\n * once. A section whose provider is missing, or that offers one option, is\n * left out. It has no toolbar actions, so its window shows no toolbar row.\n */\nexport function DisplayProperties() {\n useSuppressWindowToolbar(true);\n return (\n <div className=\"display-properties\">\n <BackgroundSection />\n <ThemeSection />\n </div>\n );\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { DesktopIconMenuItem } from "./desktop/DesktopIconMenu.js";
|
|
|
3
3
|
export { DesktopIcons, type DesktopIconsProps, } from "./desktop/DesktopIcons.js";
|
|
4
4
|
export type { DesktopIconPosition, DesktopState, } from "./desktop/desktopState.js";
|
|
5
5
|
export { createMemoryDesktopStateStorage, createOpfsDesktopStateStorage, type DesktopStateStorage, type OpfsDesktopStateStorageOptions, } from "./desktop/desktopStateStorage.js";
|
|
6
|
+
export { DisplayProperties } from "./display/DisplayProperties.js";
|
|
6
7
|
export { type WindowingIcons, WindowingIconsProvider, } from "./icons/WindowingIcons.js";
|
|
7
8
|
export type { WindowingIcon, WindowingIconProps } from "./icons/windowingIcon.js";
|
|
8
9
|
export { ROUTED_TABLET_BREAKPOINT_PX, ROUTED_TABLET_QUERY, WINDOWED_LAYOUT_MIN_WIDTH_PX, } from "./launcher/breakpoints.js";
|
|
@@ -32,6 +33,10 @@ export { SidebarResizeHandle, useSidebarResize } from "./sidebar/SidebarResize.j
|
|
|
32
33
|
export { ThemeProvider, useOptionalTheme, useTheme, } from "./theme/ThemeProvider.js";
|
|
33
34
|
export { ThemeSwitch } from "./theme/ThemeSwitch.js";
|
|
34
35
|
export type { DefaultTheme, ThemeDefinition, ThemeScheme, } from "./theme/themes.js";
|
|
36
|
+
export { DesktopWallpaper, type DesktopWallpaperProps, } from "./wallpaper/DesktopWallpaper.js";
|
|
37
|
+
export { BLOCKS_WALLPAPER, CHEVRON_WALLPAPER, HARLEQUIN_WALLPAPER, HONEYCOMB_WALLPAPER, PLAIN_WALLPAPER, TRIANGLES_WALLPAPER, } from "./wallpaper/tessellations.js";
|
|
38
|
+
export { useOptionalWallpaper, useWallpaper, WallpaperProvider, } from "./wallpaper/WallpaperProvider.js";
|
|
39
|
+
export type { WallpaperDefinition, WallpaperTile, } from "./wallpaper/wallpapers.js";
|
|
35
40
|
export { CurrentWindowProvider, useCurrentWindow, useSuppressWindowToolbar, useWindowBackground, useWindowContentSize, } from "./window/CurrentWindowContext.js";
|
|
36
41
|
export { Window, type WindowContentBoundary } from "./window/Window.js";
|
|
37
42
|
export { WindowTitleBarActionButtons } from "./window/WindowChromeActions.js";
|
package/index.js
CHANGED
|
@@ -3,10 +3,12 @@ import "./tokens.css";
|
|
|
3
3
|
// hooks, the menu and sidebar primitives the chrome renders with, a taskbar's
|
|
4
4
|
// start menu and theme switch, the icons the chrome draws, a launcher of
|
|
5
5
|
// mini-apps that shows them in windows or in the routed (iPad / phone) shell,
|
|
6
|
-
// and desktop icons that open them, with a storage adapter for their layout
|
|
6
|
+
// and desktop icons that open them, with a storage adapter for their layout,
|
|
7
|
+
// over a wallpaper chosen in Display Properties.
|
|
7
8
|
export { createRequiredContext, } from "./createRequiredContext.js";
|
|
8
9
|
export { DesktopIcons, } from "./desktop/DesktopIcons.js";
|
|
9
10
|
export { createMemoryDesktopStateStorage, createOpfsDesktopStateStorage, } from "./desktop/desktopStateStorage.js";
|
|
11
|
+
export { DisplayProperties } from "./display/DisplayProperties.js";
|
|
10
12
|
export { WindowingIconsProvider, } from "./icons/WindowingIcons.js";
|
|
11
13
|
export { ROUTED_TABLET_BREAKPOINT_PX, ROUTED_TABLET_QUERY, WINDOWED_LAYOUT_MIN_WIDTH_PX, } from "./launcher/breakpoints.js";
|
|
12
14
|
export { DEFAULT_MINI_APP_POSITION, LauncherNavigationProvider, useLauncherNavigationActions, useLauncherNavigationState, useMiniAppRouteSegments, useOptionalLauncherNavigationState, } from "./launcher/LauncherNavigationProvider.js";
|
|
@@ -33,6 +35,9 @@ export { RoutedPaneOverlayHostProvider, useRoutedPaneOverlayHost, } from "./rout
|
|
|
33
35
|
export { SidebarResizeHandle, useSidebarResize } from "./sidebar/SidebarResize.js";
|
|
34
36
|
export { ThemeProvider, useOptionalTheme, useTheme, } from "./theme/ThemeProvider.js";
|
|
35
37
|
export { ThemeSwitch } from "./theme/ThemeSwitch.js";
|
|
38
|
+
export { DesktopWallpaper, } from "./wallpaper/DesktopWallpaper.js";
|
|
39
|
+
export { BLOCKS_WALLPAPER, CHEVRON_WALLPAPER, HARLEQUIN_WALLPAPER, HONEYCOMB_WALLPAPER, PLAIN_WALLPAPER, TRIANGLES_WALLPAPER, } from "./wallpaper/tessellations.js";
|
|
40
|
+
export { useOptionalWallpaper, useWallpaper, WallpaperProvider, } from "./wallpaper/WallpaperProvider.js";
|
|
36
41
|
export { CurrentWindowProvider, useCurrentWindow, useSuppressWindowToolbar, useWindowBackground, useWindowContentSize, } from "./window/CurrentWindowContext.js";
|
|
37
42
|
export { Window } from "./window/Window.js";
|
|
38
43
|
export { WindowTitleBarActionButtons } from "./window/WindowChromeActions.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,yEAAyE;AACzE,8EAA8E;AAC9E,6EAA6E;AAC7E,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,EAEL,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,EAEzB,0BAA0B,EAG1B,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,EACL,gBAAgB,EAEhB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL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ACxB,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 and theme switch, the icons the chrome draws, a launcher of\n// mini-apps that shows them in windows or in the routed (iPad / phone) shell,\n// and desktop icons that open them, with a storage adapter for their layout.\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 {\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 DEFAULT_MINI_APP_POSITION,\n type LauncherNavigationActions,\n LauncherNavigationProvider,\n type LauncherNavigationState,\n type OpenMiniAppRequest,\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 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 { 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 { 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 {\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":"A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BAA2B,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 and theme switch, the icons the chrome draws, a launcher of\n// mini-apps that shows them in windows or in the routed (iPad / phone) shell,\n// and desktop icons that open them, with a storage adapter for their layout,\n// over a wallpaper chosen in Display Properties.\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 DEFAULT_MINI_APP_POSITION,\n type LauncherNavigationActions,\n LauncherNavigationProvider,\n type LauncherNavigationState,\n type OpenMiniAppRequest,\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 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 { 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 { 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 {\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"]}
|
|
@@ -154,6 +154,7 @@ function useLauncherNavigationActionValue(runtimeRef, goBack, goForward, navigat
|
|
|
154
154
|
appId,
|
|
155
155
|
initialShowSidebar: app.initialShowSidebar,
|
|
156
156
|
...(pathSegments ? { pathSegments } : {}),
|
|
157
|
+
...(app.windowSize ? { size: app.windowSize } : {}),
|
|
157
158
|
});
|
|
158
159
|
}, [navigateMiniAppRoute, runtimeRef]);
|
|
159
160
|
const getMiniAppHref = useCallback(buildMiniAppPath, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LauncherNavigationProvider.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/LauncherNavigationProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GAGnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAGhC,2BAA2B,GAC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useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createRequiredContext } from \"../createRequiredContext\";\nimport {\n findTopWindow,\n useWindowActions,\n useWindowStateData,\n type WindowStateActions,\n type WindowStateData,\n} from \"../window/WindowStateProvider\";\nimport type { LauncherDefinition } from \"./launcherDefinition\";\nimport { useMiniAppWindowRouteSegments } from \"./MiniAppRouteSegmentsContext\";\nimport {\n DEFAULT_NAVIGATION_HISTORY_CURSOR,\n getNavigationHistoryAvailability,\n type NavigationHistoryAvailability,\n type NavigationHistoryCursor,\n readNavigationHistoryCursor,\n} from \"./navigationHistory\";\nimport type { NavigationMode } from \"./navigationMode\";\nimport {\n replaceWindowHistoryCursor,\n useRoutedPathNavigator,\n} from \"./routedPathNavigator\";\nimport {\n buildMiniAppPath,\n LAUNCHER_HOME_PATH,\n type LauncherRoute,\n parseLauncherRoute,\n} from \"./routePaths\";\nimport { useDefaultWindow } from \"./useDefaultWindow\";\n\n/** Where a new window opens when a request names no position. */\nexport const DEFAULT_MINI_APP_POSITION = { x: 200, y: 160 };\n\n/** A request to show an app: in a window, or as the routed shell's page. */\nexport interface OpenMiniAppRequest<AppId extends string = string> {\n appId: AppId;\n pathSegments?: ReadonlyArray<string> | undefined;\n /** Where a new window opens. */\n position?: { x: number; y: number } | undefined;\n /** Raise the app's open window instead of opening another. Defaults to true. */\n reuseExisting?: boolean | undefined;\n}\n\nexport interface LauncherNavigationActions<AppId extends string = string> {\n getMiniAppHref: (\n appId: AppId,\n pathSegments?: ReadonlyArray<string> | undefined,\n ) => string;\n goBack: () => void;\n goForward: () => void;\n navigateMiniAppRoute: (input: {\n appId: AppId;\n pathSegments?: ReadonlyArray<string> | undefined;\n replace?: boolean | undefined;\n }) => void;\n navigateHome: (input?: { replace?: boolean | undefined }) => void;\n // Returns the window the app opened in or was raised to, or null when the\n // routed shell shows it instead.\n openMiniApp: (request: OpenMiniAppRequest<AppId>) => string | null;\n}\n\nexport interface LauncherNavigationState<AppId extends string = string> {\n definition: LauncherDefinition<AppId>;\n history: NavigationHistoryAvailability;\n mode: NavigationMode;\n route: LauncherRoute<AppId>;\n}\n\ninterface LauncherNavigationProviderProps extends PropsWithChildren {\n /** Defers the default window while false, for example in a hidden workspace. */\n defaultWindowEnabled?: boolean | undefined;\n definition: LauncherDefinition;\n mode: NavigationMode;\n}\n\ninterface LauncherNavigationRuntime {\n actions: Pick<\n WindowStateActions,\n \"bringToFront\" | \"create\" | \"restore\" | \"updateRoute\"\n >;\n definition: LauncherDefinition;\n mode: NavigationMode;\n windows: WindowStateData[\"windows\"];\n}\n\nconst launcherNavigationActionsContext =\n createRequiredContext<LauncherNavigationActions>(\n \"useLauncherNavigationActions requires LauncherNavigationProvider.\",\n );\nconst launcherNavigationStateContext =\n createRequiredContext<LauncherNavigationState>(\n \"useLauncherNavigationState requires LauncherNavigationProvider.\",\n );\nconst EMPTY_ROUTE_SEGMENTS: ReadonlyArray<string> = [];\n\nfunction readCurrentRoute(definition: LauncherDefinition): LauncherRoute {\n return parseLauncherRoute(window.location.pathname, definition);\n}\n\nfunction readWindowHistoryCursor(): NavigationHistoryCursor {\n return (\n readNavigationHistoryCursor(window.history.state) ??\n DEFAULT_NAVIGATION_HISTORY_CURSOR\n );\n}\n\nfunction ensureWindowHistoryCursor(): NavigationHistoryCursor {\n const cursor = readWindowHistoryCursor();\n if (readNavigationHistoryCursor(window.history.state) === null) {\n replaceWindowHistoryCursor(cursor);\n }\n\n return cursor;\n}\n\nfunction LauncherNavigationWindowRuntimeBridge({\n defaultWindowEnabled,\n definition,\n mode,\n openMiniApp,\n runtimeRef,\n}: {\n defaultWindowEnabled: boolean;\n definition: LauncherDefinition;\n mode: NavigationMode;\n openMiniApp: LauncherNavigationActions[\"openMiniApp\"];\n runtimeRef: MutableRefObject<LauncherNavigationRuntime>;\n}) {\n const { bringToFront, create, restore, updateRoute } = useWindowActions();\n const { windows } = useWindowStateData();\n\n useEffect(() => {\n runtimeRef.current = {\n actions: { bringToFront, create, restore, updateRoute },\n definition,\n mode,\n windows,\n };\n }, [\n bringToFront,\n create,\n definition,\n mode,\n restore,\n runtimeRef,\n updateRoute,\n windows,\n ]);\n\n useDefaultWindow({\n definition,\n enabled: defaultWindowEnabled,\n mode,\n openMiniApp,\n windowCount: windows.length,\n });\n\n return null;\n}\n\nfunction useLauncherRouteController({\n definition,\n mode,\n runtimeRef,\n}: {\n definition: LauncherDefinition;\n mode: NavigationMode;\n runtimeRef: MutableRefObject<LauncherNavigationRuntime>;\n}) {\n const [route, setRoute] = useState<LauncherRoute>(() =>\n readCurrentRoute(definition),\n );\n const [historyCursor, setHistoryCursorState] =\n useState<NavigationHistoryCursor>(readWindowHistoryCursor);\n const historyCursorRef = useRef(historyCursor);\n const setHistoryCursor = useCallback((cursor: NavigationHistoryCursor) => {\n historyCursorRef.current = cursor;\n setHistoryCursorState(cursor);\n }, []);\n const navigateRoutedPath = useRoutedPathNavigator({\n historyCursorRef,\n runtimeRef,\n setHistoryCursor,\n setRoute,\n });\n\n useEffect(() => {\n if (mode !== \"routed\") {\n return;\n }\n\n const handlePopState = (event: PopStateEvent) => {\n setHistoryCursor(\n readNavigationHistoryCursor(event.state) ??\n DEFAULT_NAVIGATION_HISTORY_CURSOR,\n );\n setRoute(readCurrentRoute(runtimeRef.current.definition));\n };\n\n setHistoryCursor(ensureWindowHistoryCursor());\n setRoute(readCurrentRoute(runtimeRef.current.definition));\n window.addEventListener(\"popstate\", handlePopState);\n return () => window.removeEventListener(\"popstate\", handlePopState);\n }, [mode, runtimeRef, setHistoryCursor]);\n\n const navigateMiniAppRoute = useCallback(\n ({\n appId,\n pathSegments = [],\n replace = false,\n }: {\n appId: string;\n pathSegments?: ReadonlyArray<string> | undefined;\n replace?: boolean | undefined;\n }) => {\n navigateRoutedPath({\n path: buildMiniAppPath(appId, pathSegments),\n replace,\n route: { appId, pathSegments: [...pathSegments] },\n });\n },\n [navigateRoutedPath],\n );\n const navigateHome = useCallback(\n ({ replace = false }: { replace?: boolean | undefined } = {}) => {\n navigateRoutedPath({\n path: LAUNCHER_HOME_PATH,\n replace,\n route: { appId: null, pathSegments: [] },\n });\n },\n [navigateRoutedPath],\n );\n\n const goBack = useCallback(() => {\n if (historyCursorRef.current.index > 0) {\n setHistoryCursor({\n ...historyCursorRef.current,\n index: historyCursorRef.current.index - 1,\n });\n window.history.back();\n }\n }, [setHistoryCursor]);\n const goForward = useCallback(() => {\n const { entries, index } = historyCursorRef.current;\n if (index < entries - 1) {\n setHistoryCursor({\n ...historyCursorRef.current,\n index: index + 1,\n });\n window.history.forward();\n }\n }, [setHistoryCursor]);\n const history = useMemo(\n () => getNavigationHistoryAvailability(historyCursor),\n [historyCursor],\n );\n\n return {\n goBack,\n goForward,\n history,\n navigateHome,\n navigateMiniAppRoute,\n route,\n };\n}\n\nfunction useLauncherNavigationActionValue(\n runtimeRef: MutableRefObject<LauncherNavigationRuntime>,\n goBack: LauncherNavigationActions[\"goBack\"],\n goForward: LauncherNavigationActions[\"goForward\"],\n navigateHome: LauncherNavigationActions[\"navigateHome\"],\n navigateMiniAppRoute: LauncherNavigationActions[\"navigateMiniAppRoute\"],\n): LauncherNavigationActions {\n const openMiniApp = useCallback(\n ({\n appId,\n pathSegments,\n position = DEFAULT_MINI_APP_POSITION,\n reuseExisting = true,\n }: OpenMiniAppRequest) => {\n const {\n actions,\n definition,\n mode: currentMode,\n windows: currentWindows,\n } = runtimeRef.current;\n\n if (currentMode === \"routed\") {\n navigateMiniAppRoute({ appId, pathSegments });\n return null;\n }\n\n const existingWindow = reuseExisting\n ? findTopWindow(currentWindows, (windowEntry) => {\n return windowEntry.appId === appId;\n })\n : null;\n if (existingWindow) {\n actions.restore(existingWindow.id);\n actions.bringToFront(existingWindow.id);\n if (pathSegments) {\n actions.updateRoute(existingWindow.id, pathSegments);\n }\n return existingWindow.id;\n }\n\n const app = definition.apps[appId];\n if (!app) {\n throw new Error(`Unknown mini-app: ${appId}`);\n }\n return actions.create(\n app.title,\n position.x,\n position.y,\n app.createComponent(),\n {\n appId,\n initialShowSidebar: app.initialShowSidebar,\n ...(pathSegments ? { pathSegments } : {}),\n },\n );\n },\n [navigateMiniAppRoute, runtimeRef],\n );\n const getMiniAppHref = useCallback(buildMiniAppPath, []);\n return useMemo<LauncherNavigationActions>(\n () => ({\n getMiniAppHref,\n goBack,\n goForward,\n navigateHome,\n navigateMiniAppRoute,\n openMiniApp,\n }),\n [\n getMiniAppHref,\n goBack,\n goForward,\n navigateHome,\n navigateMiniAppRoute,\n openMiniApp,\n ],\n );\n}\n\n/**\n * Navigation for a launcher's mini-apps, in either mode. In `windowed` mode,\n * opening an app opens or raises its window (inside a\n * {@link WindowStateProvider}); in `routed` mode it navigates the browser to\n * the app's route, `/app/<app id>/…`, which the routed shell shows.\n */\nexport function LauncherNavigationProvider({\n children,\n defaultWindowEnabled = true,\n definition,\n mode,\n}: LauncherNavigationProviderProps) {\n const runtimeRef = useRef<LauncherNavigationRuntime>({\n actions: {\n bringToFront: () => {},\n create: () => \"\",\n restore: () => {},\n updateRoute: () => {},\n },\n definition,\n mode,\n windows: [],\n });\n const {\n goBack,\n goForward,\n history,\n navigateHome,\n navigateMiniAppRoute,\n route,\n } = useLauncherRouteController({\n definition,\n mode,\n runtimeRef,\n });\n const actions = useLauncherNavigationActionValue(\n runtimeRef,\n goBack,\n goForward,\n navigateHome,\n navigateMiniAppRoute,\n );\n const state = useMemo<LauncherNavigationState>(\n () => ({ definition, history, mode, route }),\n [definition, history, mode, route],\n );\n\n return (\n <launcherNavigationActionsContext.context.Provider value={actions}>\n <launcherNavigationStateContext.context.Provider value={state}>\n <LauncherNavigationWindowRuntimeBridge\n defaultWindowEnabled={defaultWindowEnabled}\n definition={definition}\n mode={mode}\n openMiniApp={actions.openMiniApp}\n runtimeRef={runtimeRef}\n />\n {children}\n </launcherNavigationStateContext.context.Provider>\n </launcherNavigationActionsContext.context.Provider>\n );\n}\n\n// The context names apps by their string ids. The actions accept a host's own\n// narrower id type as they are; a host narrows the route's id with\n// isLauncherAppId (or its own guard) to read it back as that type.\nexport const useLauncherNavigationActions =\n launcherNavigationActionsContext.useRequired;\n\nexport const useLauncherNavigationState =\n launcherNavigationStateContext.useRequired;\n\nexport const useOptionalLauncherNavigationState =\n launcherNavigationStateContext.useOptional;\n\n/**\n * The route of `appId` where it is hosted: the browser route in the routed\n * shell, or its window's own route and Back stack in a window. Mini-apps read\n * this rather than branching on navigation mode.\n */\nexport function useMiniAppRouteSegments(appId: string) {\n const actions = launcherNavigationActionsContext.useOptional();\n const state = launcherNavigationStateContext.useOptional();\n const windowRoute = useMiniAppWindowRouteSegments(appId);\n const isGlobalRouted = actions !== null && state?.mode === \"routed\";\n const isRouted = isGlobalRouted || windowRoute !== null;\n const pathSegments =\n isGlobalRouted && state.route.appId === appId\n ? state.route.pathSegments\n : (windowRoute?.pathSegments ?? EMPTY_ROUTE_SEGMENTS);\n const windowSetPathSegments = windowRoute?.setPathSegments;\n const setPathSegments = useCallback(\n (\n nextPathSegments: ReadonlyArray<string>,\n options: { replace?: boolean | undefined } = {},\n ) => {\n if (isGlobalRouted) {\n actions?.navigateMiniAppRoute({\n appId,\n pathSegments: nextPathSegments,\n ...(options.replace === undefined\n ? {}\n : { replace: options.replace }),\n });\n return;\n }\n\n windowSetPathSegments?.(nextPathSegments, options);\n },\n [actions, appId, isGlobalRouted, windowSetPathSegments],\n );\n // \"Can this mini-app step back where it is hosted?\" — browser history in the\n // routed shell, the window's own Back stack in a window. Mini-apps read this\n // rather than branching on navigation mode, so a detail surface that must\n // yield to a real Back affordance asks one question and gets the right answer\n // in both shells.\n const windowGoBack = windowRoute?.goBack;\n const canGoBack = isGlobalRouted\n ? state.history.canGoBack\n : (windowRoute?.canGoBack ?? false);\n const goBack = useCallback(() => {\n if (isGlobalRouted) {\n actions?.goBack();\n return;\n }\n\n windowGoBack?.();\n }, [actions, isGlobalRouted, windowGoBack]);\n\n return useMemo(\n () => ({\n canGoBack,\n goBack,\n isRouted,\n pathSegments,\n setPathSegments,\n }),\n [canGoBack, goBack, isRouted, pathSegments, setPathSegments],\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LauncherNavigationProvider.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/LauncherNavigationProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GAGnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAGhC,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAElB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,iEAAiE;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AAsD5D,MAAM,gCAAgC,GACpC,qBAAqB,CACnB,mEAAmE,CACpE,CAAC;AACJ,MAAM,8BAA8B,GAClC,qBAAqB,CACnB,iEAAiE,CAClE,CAAC;AACJ,MAAM,oBAAoB,GAA0B,EAAE,CAAC;AAEvD,SAAS,gBAAgB,CAAC,UAA8B;IACtD,OAAO,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO,CACL,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QACjD,iCAA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B,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS;QACzB,CAAC,CAAC,CAAC,WAAW,EAAE,SAAS,IAAI,KAAK,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,EAAE,MAAM,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,YAAY,EAAE,EAAE,CAAC;IACnB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;IAE5C,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,SAAS;QACT,MAAM;QACN,QAAQ;QACR,YAAY;QACZ,eAAe;KAChB,CAAC,EACF,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,CAC7D,CAAC;AACJ,CAAC","sourcesContent":["import {\n type MutableRefObject,\n type PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createRequiredContext } from \"../createRequiredContext\";\nimport {\n findTopWindow,\n useWindowActions,\n useWindowStateData,\n type WindowStateActions,\n type WindowStateData,\n} from \"../window/WindowStateProvider\";\nimport type { LauncherDefinition } from \"./launcherDefinition\";\nimport { useMiniAppWindowRouteSegments } from \"./MiniAppRouteSegmentsContext\";\nimport {\n DEFAULT_NAVIGATION_HISTORY_CURSOR,\n getNavigationHistoryAvailability,\n type NavigationHistoryAvailability,\n type NavigationHistoryCursor,\n readNavigationHistoryCursor,\n} from \"./navigationHistory\";\nimport type { NavigationMode } from \"./navigationMode\";\nimport {\n replaceWindowHistoryCursor,\n useRoutedPathNavigator,\n} from \"./routedPathNavigator\";\nimport {\n buildMiniAppPath,\n LAUNCHER_HOME_PATH,\n type LauncherRoute,\n parseLauncherRoute,\n} from \"./routePaths\";\nimport { useDefaultWindow } from \"./useDefaultWindow\";\n\n/** Where a new window opens when a request names no position. */\nexport const DEFAULT_MINI_APP_POSITION = { x: 200, y: 160 };\n\n/** A request to show an app: in a window, or as the routed shell's page. */\nexport interface OpenMiniAppRequest<AppId extends string = string> {\n appId: AppId;\n pathSegments?: ReadonlyArray<string> | undefined;\n /** Where a new window opens. */\n position?: { x: number; y: number } | undefined;\n /** Raise the app's open window instead of opening another. Defaults to true. */\n reuseExisting?: boolean | undefined;\n}\n\nexport interface LauncherNavigationActions<AppId extends string = string> {\n getMiniAppHref: (\n appId: AppId,\n pathSegments?: ReadonlyArray<string> | undefined,\n ) => string;\n goBack: () => void;\n goForward: () => void;\n navigateMiniAppRoute: (input: {\n appId: AppId;\n pathSegments?: ReadonlyArray<string> | undefined;\n replace?: boolean | undefined;\n }) => void;\n navigateHome: (input?: { replace?: boolean | undefined }) => void;\n // Returns the window the app opened in or was raised to, or null when the\n // routed shell shows it instead.\n openMiniApp: (request: OpenMiniAppRequest<AppId>) => string | null;\n}\n\nexport interface LauncherNavigationState<AppId extends string = string> {\n definition: LauncherDefinition<AppId>;\n history: NavigationHistoryAvailability;\n mode: NavigationMode;\n route: LauncherRoute<AppId>;\n}\n\ninterface LauncherNavigationProviderProps extends PropsWithChildren {\n /** Defers the default window while false, for example in a hidden workspace. */\n defaultWindowEnabled?: boolean | undefined;\n definition: LauncherDefinition;\n mode: NavigationMode;\n}\n\ninterface LauncherNavigationRuntime {\n actions: Pick<\n WindowStateActions,\n \"bringToFront\" | \"create\" | \"restore\" | \"updateRoute\"\n >;\n definition: LauncherDefinition;\n mode: NavigationMode;\n windows: WindowStateData[\"windows\"];\n}\n\nconst launcherNavigationActionsContext =\n createRequiredContext<LauncherNavigationActions>(\n \"useLauncherNavigationActions requires LauncherNavigationProvider.\",\n );\nconst launcherNavigationStateContext =\n createRequiredContext<LauncherNavigationState>(\n \"useLauncherNavigationState requires LauncherNavigationProvider.\",\n );\nconst EMPTY_ROUTE_SEGMENTS: ReadonlyArray<string> = [];\n\nfunction readCurrentRoute(definition: LauncherDefinition): LauncherRoute {\n return parseLauncherRoute(window.location.pathname, definition);\n}\n\nfunction readWindowHistoryCursor(): NavigationHistoryCursor {\n return (\n readNavigationHistoryCursor(window.history.state) ??\n DEFAULT_NAVIGATION_HISTORY_CURSOR\n );\n}\n\nfunction ensureWindowHistoryCursor(): NavigationHistoryCursor {\n const cursor = readWindowHistoryCursor();\n if (readNavigationHistoryCursor(window.history.state) === null) {\n replaceWindowHistoryCursor(cursor);\n }\n\n return cursor;\n}\n\nfunction LauncherNavigationWindowRuntimeBridge({\n defaultWindowEnabled,\n definition,\n mode,\n openMiniApp,\n runtimeRef,\n}: {\n defaultWindowEnabled: boolean;\n definition: LauncherDefinition;\n mode: NavigationMode;\n openMiniApp: LauncherNavigationActions[\"openMiniApp\"];\n runtimeRef: MutableRefObject<LauncherNavigationRuntime>;\n}) {\n const { bringToFront, create, restore, updateRoute } = useWindowActions();\n const { windows } = useWindowStateData();\n\n useEffect(() => {\n runtimeRef.current = {\n actions: { bringToFront, create, restore, updateRoute },\n definition,\n mode,\n windows,\n };\n }, [\n bringToFront,\n create,\n definition,\n mode,\n restore,\n runtimeRef,\n updateRoute,\n windows,\n ]);\n\n useDefaultWindow({\n definition,\n enabled: defaultWindowEnabled,\n mode,\n openMiniApp,\n windowCount: windows.length,\n });\n\n return null;\n}\n\nfunction useLauncherRouteController({\n definition,\n mode,\n runtimeRef,\n}: {\n definition: LauncherDefinition;\n mode: NavigationMode;\n runtimeRef: MutableRefObject<LauncherNavigationRuntime>;\n}) {\n const [route, setRoute] = useState<LauncherRoute>(() =>\n readCurrentRoute(definition),\n );\n const [historyCursor, setHistoryCursorState] =\n useState<NavigationHistoryCursor>(readWindowHistoryCursor);\n const historyCursorRef = useRef(historyCursor);\n const setHistoryCursor = useCallback((cursor: NavigationHistoryCursor) => {\n historyCursorRef.current = cursor;\n setHistoryCursorState(cursor);\n }, []);\n const navigateRoutedPath = useRoutedPathNavigator({\n historyCursorRef,\n runtimeRef,\n setHistoryCursor,\n setRoute,\n });\n\n useEffect(() => {\n if (mode !== \"routed\") {\n return;\n }\n\n const handlePopState = (event: PopStateEvent) => {\n setHistoryCursor(\n readNavigationHistoryCursor(event.state) ??\n DEFAULT_NAVIGATION_HISTORY_CURSOR,\n );\n setRoute(readCurrentRoute(runtimeRef.current.definition));\n };\n\n setHistoryCursor(ensureWindowHistoryCursor());\n setRoute(readCurrentRoute(runtimeRef.current.definition));\n window.addEventListener(\"popstate\", handlePopState);\n return () => window.removeEventListener(\"popstate\", handlePopState);\n }, [mode, runtimeRef, setHistoryCursor]);\n\n const navigateMiniAppRoute = useCallback(\n ({\n appId,\n pathSegments = [],\n replace = false,\n }: {\n appId: string;\n pathSegments?: ReadonlyArray<string> | undefined;\n replace?: boolean | undefined;\n }) => {\n navigateRoutedPath({\n path: buildMiniAppPath(appId, pathSegments),\n replace,\n route: { appId, pathSegments: [...pathSegments] },\n });\n },\n [navigateRoutedPath],\n );\n const navigateHome = useCallback(\n ({ replace = false }: { replace?: boolean | undefined } = {}) => {\n navigateRoutedPath({\n path: LAUNCHER_HOME_PATH,\n replace,\n route: { appId: null, pathSegments: [] },\n });\n },\n [navigateRoutedPath],\n );\n\n const goBack = useCallback(() => {\n if (historyCursorRef.current.index > 0) {\n setHistoryCursor({\n ...historyCursorRef.current,\n index: historyCursorRef.current.index - 1,\n });\n window.history.back();\n }\n }, [setHistoryCursor]);\n const goForward = useCallback(() => {\n const { entries, index } = historyCursorRef.current;\n if (index < entries - 1) {\n setHistoryCursor({\n ...historyCursorRef.current,\n index: index + 1,\n });\n window.history.forward();\n }\n }, [setHistoryCursor]);\n const history = useMemo(\n () => getNavigationHistoryAvailability(historyCursor),\n [historyCursor],\n );\n\n return {\n goBack,\n goForward,\n history,\n navigateHome,\n navigateMiniAppRoute,\n route,\n };\n}\n\nfunction useLauncherNavigationActionValue(\n runtimeRef: MutableRefObject<LauncherNavigationRuntime>,\n goBack: LauncherNavigationActions[\"goBack\"],\n goForward: LauncherNavigationActions[\"goForward\"],\n navigateHome: LauncherNavigationActions[\"navigateHome\"],\n navigateMiniAppRoute: LauncherNavigationActions[\"navigateMiniAppRoute\"],\n): LauncherNavigationActions {\n const openMiniApp = useCallback(\n ({\n appId,\n pathSegments,\n position = DEFAULT_MINI_APP_POSITION,\n reuseExisting = true,\n }: OpenMiniAppRequest) => {\n const {\n actions,\n definition,\n mode: currentMode,\n windows: currentWindows,\n } = runtimeRef.current;\n\n if (currentMode === \"routed\") {\n navigateMiniAppRoute({ appId, pathSegments });\n return null;\n }\n\n const existingWindow = reuseExisting\n ? findTopWindow(currentWindows, (windowEntry) => {\n return windowEntry.appId === appId;\n })\n : null;\n if (existingWindow) {\n actions.restore(existingWindow.id);\n actions.bringToFront(existingWindow.id);\n if (pathSegments) {\n actions.updateRoute(existingWindow.id, pathSegments);\n }\n return existingWindow.id;\n }\n\n const app = definition.apps[appId];\n if (!app) {\n throw new Error(`Unknown mini-app: ${appId}`);\n }\n return actions.create(\n app.title,\n position.x,\n position.y,\n app.createComponent(),\n {\n appId,\n initialShowSidebar: app.initialShowSidebar,\n ...(pathSegments ? { pathSegments } : {}),\n ...(app.windowSize ? { size: app.windowSize } : {}),\n },\n );\n },\n [navigateMiniAppRoute, runtimeRef],\n );\n const getMiniAppHref = useCallback(buildMiniAppPath, []);\n return useMemo<LauncherNavigationActions>(\n () => ({\n getMiniAppHref,\n goBack,\n goForward,\n navigateHome,\n navigateMiniAppRoute,\n openMiniApp,\n }),\n [\n getMiniAppHref,\n goBack,\n goForward,\n navigateHome,\n navigateMiniAppRoute,\n openMiniApp,\n ],\n );\n}\n\n/**\n * Navigation for a launcher's mini-apps, in either mode. In `windowed` mode,\n * opening an app opens or raises its window (inside a\n * {@link WindowStateProvider}); in `routed` mode it navigates the browser to\n * the app's route, `/app/<app id>/…`, which the routed shell shows.\n */\nexport function LauncherNavigationProvider({\n children,\n defaultWindowEnabled = true,\n definition,\n mode,\n}: LauncherNavigationProviderProps) {\n const runtimeRef = useRef<LauncherNavigationRuntime>({\n actions: {\n bringToFront: () => {},\n create: () => \"\",\n restore: () => {},\n updateRoute: () => {},\n },\n definition,\n mode,\n windows: [],\n });\n const {\n goBack,\n goForward,\n history,\n navigateHome,\n navigateMiniAppRoute,\n route,\n } = useLauncherRouteController({\n definition,\n mode,\n runtimeRef,\n });\n const actions = useLauncherNavigationActionValue(\n runtimeRef,\n goBack,\n goForward,\n navigateHome,\n navigateMiniAppRoute,\n );\n const state = useMemo<LauncherNavigationState>(\n () => ({ definition, history, mode, route }),\n [definition, history, mode, route],\n );\n\n return (\n <launcherNavigationActionsContext.context.Provider value={actions}>\n <launcherNavigationStateContext.context.Provider value={state}>\n <LauncherNavigationWindowRuntimeBridge\n defaultWindowEnabled={defaultWindowEnabled}\n definition={definition}\n mode={mode}\n openMiniApp={actions.openMiniApp}\n runtimeRef={runtimeRef}\n />\n {children}\n </launcherNavigationStateContext.context.Provider>\n </launcherNavigationActionsContext.context.Provider>\n );\n}\n\n// The context names apps by their string ids. The actions accept a host's own\n// narrower id type as they are; a host narrows the route's id with\n// isLauncherAppId (or its own guard) to read it back as that type.\nexport const useLauncherNavigationActions =\n launcherNavigationActionsContext.useRequired;\n\nexport const useLauncherNavigationState =\n launcherNavigationStateContext.useRequired;\n\nexport const useOptionalLauncherNavigationState =\n launcherNavigationStateContext.useOptional;\n\n/**\n * The route of `appId` where it is hosted: the browser route in the routed\n * shell, or its window's own route and Back stack in a window. Mini-apps read\n * this rather than branching on navigation mode.\n */\nexport function useMiniAppRouteSegments(appId: string) {\n const actions = launcherNavigationActionsContext.useOptional();\n const state = launcherNavigationStateContext.useOptional();\n const windowRoute = useMiniAppWindowRouteSegments(appId);\n const isGlobalRouted = actions !== null && state?.mode === \"routed\";\n const isRouted = isGlobalRouted || windowRoute !== null;\n const pathSegments =\n isGlobalRouted && state.route.appId === appId\n ? state.route.pathSegments\n : (windowRoute?.pathSegments ?? EMPTY_ROUTE_SEGMENTS);\n const windowSetPathSegments = windowRoute?.setPathSegments;\n const setPathSegments = useCallback(\n (\n nextPathSegments: ReadonlyArray<string>,\n options: { replace?: boolean | undefined } = {},\n ) => {\n if (isGlobalRouted) {\n actions?.navigateMiniAppRoute({\n appId,\n pathSegments: nextPathSegments,\n ...(options.replace === undefined\n ? {}\n : { replace: options.replace }),\n });\n return;\n }\n\n windowSetPathSegments?.(nextPathSegments, options);\n },\n [actions, appId, isGlobalRouted, windowSetPathSegments],\n );\n // \"Can this mini-app step back where it is hosted?\" — browser history in the\n // routed shell, the window's own Back stack in a window. Mini-apps read this\n // rather than branching on navigation mode, so a detail surface that must\n // yield to a real Back affordance asks one question and gets the right answer\n // in both shells.\n const windowGoBack = windowRoute?.goBack;\n const canGoBack = isGlobalRouted\n ? state.history.canGoBack\n : (windowRoute?.canGoBack ?? false);\n const goBack = useCallback(() => {\n if (isGlobalRouted) {\n actions?.goBack();\n return;\n }\n\n windowGoBack?.();\n }, [actions, isGlobalRouted, windowGoBack]);\n\n return useMemo(\n () => ({\n canGoBack,\n goBack,\n isRouted,\n pathSegments,\n setPathSegments,\n }),\n [canGoBack, goBack, isRouted, pathSegments, setPathSegments],\n );\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
2
|
import type { WindowingIcon } from "../icons/windowingIcon.js";
|
|
3
|
+
import type { WindowSize } from "../window/WindowStateProvider/index.js";
|
|
3
4
|
/** One app a launcher opens: in a window, or as the routed shell's page. */
|
|
4
5
|
export interface MiniAppDefinition {
|
|
5
6
|
/**
|
|
@@ -16,6 +17,11 @@ export interface MiniAppDefinition {
|
|
|
16
17
|
*/
|
|
17
18
|
initialShowSidebar?: boolean | undefined;
|
|
18
19
|
title: string;
|
|
20
|
+
/**
|
|
21
|
+
* The size a new window opens at, in CSS pixels. Defaults to the
|
|
22
|
+
* stylesheet's window size.
|
|
23
|
+
*/
|
|
24
|
+
windowSize?: WindowSize | undefined;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* A launcher application: the mini-apps it can open, the order its launchers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcherDefinition.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/launcherDefinition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcherDefinition.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/launcher/launcherDefinition.ts"],"names":[],"mappings":"AAgDA,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 * 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 * 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, 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 /**\n * Opens when entering windowed mode with no windows, including on mount.\n * Closing the last window leaves the desktop empty until the next entry.\n * Omit to leave window startup to the host. Unknown app ids are ignored.\n */\n defaultWindowAppId?: 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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tearleads/windowing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
4
4
|
"description": "App-agnostic window management for React: window state, window chrome, and the menu and sidebar primitives it renders with.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type WallpaperDefinition } from "./wallpapers.js";
|
|
2
|
+
export interface DesktopWallpaperProps {
|
|
3
|
+
/** Paints this wallpaper instead of the nearest provider's choice. */
|
|
4
|
+
wallpaper?: WallpaperDefinition | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The wallpaper behind the desktop's icons and windows: the nearest
|
|
8
|
+
* {@link WallpaperProvider}'s choice, or `wallpaper`. Render it as the first
|
|
9
|
+
* child of the positioned surface the windows lay out on, before
|
|
10
|
+
* `DesktopIcons`, and make that surface a stacking context (`isolation:
|
|
11
|
+
* isolate`): the wallpaper sits on a layer below the surface's content. It
|
|
12
|
+
* takes no pointer input, so presses reach the surface. Without a provider or
|
|
13
|
+
* a `wallpaper` it renders nothing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function DesktopWallpaper({ wallpaper }: DesktopWallpaperProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useOptionalWallpaper } from "./WallpaperProvider.js";
|
|
3
|
+
import { wallpaperStyle } from "./wallpapers.js";
|
|
4
|
+
import "./Wallpaper.css";
|
|
5
|
+
/**
|
|
6
|
+
* The wallpaper behind the desktop's icons and windows: the nearest
|
|
7
|
+
* {@link WallpaperProvider}'s choice, or `wallpaper`. Render it as the first
|
|
8
|
+
* child of the positioned surface the windows lay out on, before
|
|
9
|
+
* `DesktopIcons`, and make that surface a stacking context (`isolation:
|
|
10
|
+
* isolate`): the wallpaper sits on a layer below the surface's content. It
|
|
11
|
+
* takes no pointer input, so presses reach the surface. Without a provider or
|
|
12
|
+
* a `wallpaper` it renders nothing.
|
|
13
|
+
*/
|
|
14
|
+
export function DesktopWallpaper({ wallpaper }) {
|
|
15
|
+
const context = useOptionalWallpaper();
|
|
16
|
+
const shown = wallpaper ?? context?.activeWallpaper;
|
|
17
|
+
if (!shown) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (_jsx("div", { "aria-hidden": "true", className: "desktop-wallpaper wallpaper-pattern", "data-pattern": shown.tile ? "" : undefined, "data-wallpaper": shown.id, style: wallpaperStyle(shown) }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=DesktopWallpaper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesktopWallpaper.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/wallpaper/DesktopWallpaper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAA4B,cAAc,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,iBAAiB,CAAC;AAOzB;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAyB;IACnE,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,SAAS,IAAI,OAAO,EAAE,eAAe,CAAC;IACpD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,6BACc,MAAM,EAClB,SAAS,EAAC,qCAAqC,kBACjC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,oBACzB,KAAK,CAAC,EAAE,EACxB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAC5B,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useOptionalWallpaper } from \"./WallpaperProvider\";\nimport { type WallpaperDefinition, wallpaperStyle } from \"./wallpapers\";\nimport \"./Wallpaper.css\";\n\nexport interface DesktopWallpaperProps {\n /** Paints this wallpaper instead of the nearest provider's choice. */\n wallpaper?: WallpaperDefinition | undefined;\n}\n\n/**\n * The wallpaper behind the desktop's icons and windows: the nearest\n * {@link WallpaperProvider}'s choice, or `wallpaper`. Render it as the first\n * child of the positioned surface the windows lay out on, before\n * `DesktopIcons`, and make that surface a stacking context (`isolation:\n * isolate`): the wallpaper sits on a layer below the surface's content. It\n * takes no pointer input, so presses reach the surface. Without a provider or\n * a `wallpaper` it renders nothing.\n */\nexport function DesktopWallpaper({ wallpaper }: DesktopWallpaperProps) {\n const context = useOptionalWallpaper();\n const shown = wallpaper ?? context?.activeWallpaper;\n if (!shown) {\n return null;\n }\n return (\n <div\n aria-hidden=\"true\"\n className=\"desktop-wallpaper wallpaper-pattern\"\n data-pattern={shown.tile ? \"\" : undefined}\n data-wallpaper={shown.id}\n style={wallpaperStyle(shown)}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A wallpaper paints from the custom properties wallpaperStyle() sets: the
|
|
3
|
+
* base color fills the element, and a layer of ink above it shows through the
|
|
4
|
+
* tile's mask, repeated at the tile's size. A wallpaper with no tile has no
|
|
5
|
+
* data-pattern, and so no ink layer.
|
|
6
|
+
*/
|
|
7
|
+
.wallpaper-pattern {
|
|
8
|
+
background: var(--wallpaper-base);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.wallpaper-pattern[data-pattern]::before {
|
|
12
|
+
content: "";
|
|
13
|
+
position: absolute;
|
|
14
|
+
inset: 0;
|
|
15
|
+
background: var(--wallpaper-ink);
|
|
16
|
+
-webkit-mask-image: var(--wallpaper-mask);
|
|
17
|
+
mask-image: var(--wallpaper-mask);
|
|
18
|
+
-webkit-mask-repeat: repeat;
|
|
19
|
+
mask-repeat: repeat;
|
|
20
|
+
-webkit-mask-size: var(--wallpaper-size);
|
|
21
|
+
mask-size: var(--wallpaper-size);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* The desktop's wallpaper fills the window surface beneath everything on it,
|
|
25
|
+
positioned or not (icons, windows, and content laid out in flow, such as a
|
|
26
|
+
pinned panel), and lets presses through to the surface. Its negative layer
|
|
27
|
+
needs the surface to be a stacking context (`isolation: isolate`), or it
|
|
28
|
+
falls behind the surface's own background. */
|
|
29
|
+
.desktop-wallpaper {
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset: 0;
|
|
32
|
+
z-index: -1;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import { type WallpaperDefinition } from "./wallpapers.js";
|
|
3
|
+
interface WallpaperContextValue {
|
|
4
|
+
/** The wallpaper showing: the user's choice, or the host's default. */
|
|
5
|
+
activeWallpaper: WallpaperDefinition;
|
|
6
|
+
/** Records a wallpaper the host offers as the user's choice. */
|
|
7
|
+
setWallpaper: (id: string) => void;
|
|
8
|
+
/** Every wallpaper the host offers, in order. */
|
|
9
|
+
wallpapers: readonly WallpaperDefinition[];
|
|
10
|
+
}
|
|
11
|
+
interface WallpaperProviderProps<Id extends string> extends PropsWithChildren {
|
|
12
|
+
/** The wallpaper until the user picks one. Defaults to the first. */
|
|
13
|
+
defaultWallpaper?: NoInfer<Id> | undefined;
|
|
14
|
+
/** Where the user's choice persists in localStorage. */
|
|
15
|
+
storageKey: string;
|
|
16
|
+
/**
|
|
17
|
+
* The wallpapers the host offers, in the order Display Properties lists
|
|
18
|
+
* them. Define the list once, outside render.
|
|
19
|
+
*/
|
|
20
|
+
wallpapers: readonly WallpaperDefinition<Id>[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Owns the desktop wallpaper: the host's `wallpapers` and the user's choice
|
|
24
|
+
* among them, which {@link DesktopWallpaper} paints and Display Properties
|
|
25
|
+
* changes. Mount one above every desktop that shares the choice.
|
|
26
|
+
*
|
|
27
|
+
* Only an explicit choice persists. A stored id the host no longer offers
|
|
28
|
+
* counts as no choice, so the default shows.
|
|
29
|
+
*/
|
|
30
|
+
export declare function WallpaperProvider<Id extends string>({ children, defaultWallpaper, storageKey, wallpapers, }: WallpaperProviderProps<Id>): import("react").JSX.Element;
|
|
31
|
+
export declare const useWallpaper: () => WallpaperContextValue;
|
|
32
|
+
export declare const useOptionalWallpaper: () => WallpaperContextValue | null;
|
|
33
|
+
export {};
|