@liberation-data/desk 0.42.0 → 0.44.0

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 (200) hide show
  1. package/README.md +312 -5
  2. package/dist/core/hosted.d.ts +222 -0
  3. package/dist/core/hosted.d.ts.map +1 -0
  4. package/dist/core/hosted.js +166 -0
  5. package/dist/core/hosted.js.map +1 -0
  6. package/dist/core/index.d.ts +10 -0
  7. package/dist/core/index.d.ts.map +1 -1
  8. package/dist/core/index.js +5 -0
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/core/location.d.ts +8 -1
  11. package/dist/core/location.d.ts.map +1 -1
  12. package/dist/core/location.js +18 -2
  13. package/dist/core/location.js.map +1 -1
  14. package/dist/core/preferences.d.ts +27 -0
  15. package/dist/core/preferences.d.ts.map +1 -0
  16. package/dist/core/preferences.js +121 -0
  17. package/dist/core/preferences.js.map +1 -0
  18. package/dist/core/scheme.d.ts +18 -0
  19. package/dist/core/scheme.d.ts.map +1 -0
  20. package/dist/core/scheme.js +24 -0
  21. package/dist/core/scheme.js.map +1 -0
  22. package/dist/core/theme.d.ts +41 -0
  23. package/dist/core/theme.d.ts.map +1 -0
  24. package/dist/core/theme.js +56 -0
  25. package/dist/core/theme.js.map +1 -0
  26. package/dist/core/themeChange.d.ts +25 -0
  27. package/dist/core/themeChange.d.ts.map +1 -0
  28. package/dist/core/themeChange.js +49 -0
  29. package/dist/core/themeChange.js.map +1 -0
  30. package/dist/core/types.d.ts +6 -0
  31. package/dist/core/types.d.ts.map +1 -1
  32. package/dist/css/apps.css +183 -0
  33. package/dist/css/overlays.css +6 -0
  34. package/dist/css/shell.css +100 -0
  35. package/dist/css/tokens.css +10 -0
  36. package/dist/css/windows.css +21 -0
  37. package/dist/desk.css +220 -0
  38. package/dist/fx/fx.d.ts.map +1 -1
  39. package/dist/fx/fx.js +7 -31
  40. package/dist/fx/fx.js.map +1 -1
  41. package/dist/host/checkChrome.d.ts +20 -0
  42. package/dist/host/checkChrome.d.ts.map +1 -0
  43. package/dist/host/checkChrome.js +219 -0
  44. package/dist/host/checkChrome.js.map +1 -0
  45. package/dist/host/checkTheme.d.ts +35 -0
  46. package/dist/host/checkTheme.d.ts.map +1 -0
  47. package/dist/host/checkTheme.js +128 -0
  48. package/dist/host/checkTheme.js.map +1 -0
  49. package/dist/host/index.d.ts +7 -0
  50. package/dist/host/index.d.ts.map +1 -0
  51. package/dist/host/index.js +8 -0
  52. package/dist/host/index.js.map +1 -0
  53. package/dist/host/router.d.ts +99 -0
  54. package/dist/host/router.d.ts.map +1 -0
  55. package/dist/host/router.js +279 -0
  56. package/dist/host/router.js.map +1 -0
  57. package/dist/react/Desktop.d.ts.map +1 -1
  58. package/dist/react/Desktop.js +13 -2
  59. package/dist/react/Desktop.js.map +1 -1
  60. package/dist/react/Dock.d.ts +26 -2
  61. package/dist/react/Dock.d.ts.map +1 -1
  62. package/dist/react/Dock.js +23 -27
  63. package/dist/react/Dock.js.map +1 -1
  64. package/dist/react/MenuBar.d.ts +1 -1
  65. package/dist/react/MenuBar.d.ts.map +1 -1
  66. package/dist/react/MenuBar.js +36 -6
  67. package/dist/react/MenuBar.js.map +1 -1
  68. package/dist/react/app.d.ts +215 -0
  69. package/dist/react/app.d.ts.map +1 -0
  70. package/dist/react/app.js +192 -0
  71. package/dist/react/app.js.map +1 -0
  72. package/dist/react/appFrame.d.ts +11 -7
  73. package/dist/react/appFrame.d.ts.map +1 -1
  74. package/dist/react/appFrame.js +24 -6
  75. package/dist/react/appFrame.js.map +1 -1
  76. package/dist/react/appPanels.d.ts +25 -0
  77. package/dist/react/appPanels.d.ts.map +1 -0
  78. package/dist/react/appPanels.js +123 -0
  79. package/dist/react/appPanels.js.map +1 -0
  80. package/dist/react/appearance.d.ts +61 -0
  81. package/dist/react/appearance.d.ts.map +1 -0
  82. package/dist/react/appearance.js +119 -0
  83. package/dist/react/appearance.js.map +1 -0
  84. package/dist/react/codeBlock.d.ts.map +1 -1
  85. package/dist/react/codeBlock.js +6 -60
  86. package/dist/react/codeBlock.js.map +1 -1
  87. package/dist/react/context.d.ts +23 -1
  88. package/dist/react/context.d.ts.map +1 -1
  89. package/dist/react/context.js +108 -5
  90. package/dist/react/context.js.map +1 -1
  91. package/dist/react/copy.d.ts +22 -0
  92. package/dist/react/copy.d.ts.map +1 -0
  93. package/dist/react/copy.js +68 -0
  94. package/dist/react/copy.js.map +1 -0
  95. package/dist/react/dockStatus.d.ts +19 -0
  96. package/dist/react/dockStatus.d.ts.map +1 -0
  97. package/dist/react/dockStatus.js +25 -0
  98. package/dist/react/dockStatus.js.map +1 -0
  99. package/dist/react/documentTitle.d.ts.map +1 -1
  100. package/dist/react/documentTitle.js +4 -1
  101. package/dist/react/documentTitle.js.map +1 -1
  102. package/dist/react/frameMenus.d.ts +28 -0
  103. package/dist/react/frameMenus.d.ts.map +1 -0
  104. package/dist/react/frameMenus.js +85 -0
  105. package/dist/react/frameMenus.js.map +1 -0
  106. package/dist/react/hostApp.d.ts +15 -0
  107. package/dist/react/hostApp.d.ts.map +1 -0
  108. package/dist/react/hostApp.js +77 -0
  109. package/dist/react/hostApp.js.map +1 -0
  110. package/dist/react/hostDock.d.ts +25 -0
  111. package/dist/react/hostDock.d.ts.map +1 -0
  112. package/dist/react/hostDock.js +98 -0
  113. package/dist/react/hostDock.js.map +1 -0
  114. package/dist/react/hostMenu.d.ts +2 -36
  115. package/dist/react/hostMenu.d.ts.map +1 -1
  116. package/dist/react/hostMenu.js.map +1 -1
  117. package/dist/react/hosted.d.ts +28 -0
  118. package/dist/react/hosted.d.ts.map +1 -0
  119. package/dist/react/hosted.js +53 -0
  120. package/dist/react/hosted.js.map +1 -0
  121. package/dist/react/index.d.ts +12 -0
  122. package/dist/react/index.d.ts.map +1 -1
  123. package/dist/react/index.js +8 -0
  124. package/dist/react/index.js.map +1 -1
  125. package/dist/react/layers.d.ts.map +1 -1
  126. package/dist/react/layers.js +7 -2
  127. package/dist/react/layers.js.map +1 -1
  128. package/dist/react/overlays.d.ts.map +1 -1
  129. package/dist/react/overlays.js +29 -12
  130. package/dist/react/overlays.js.map +1 -1
  131. package/dist/react/shell.d.ts +16 -1
  132. package/dist/react/shell.d.ts.map +1 -1
  133. package/dist/react/shell.js +19 -3
  134. package/dist/react/shell.js.map +1 -1
  135. package/dist/react/windowMenus.d.ts +19 -0
  136. package/dist/react/windowMenus.d.ts.map +1 -0
  137. package/dist/react/windowMenus.js +88 -0
  138. package/dist/react/windowMenus.js.map +1 -0
  139. package/dist/shell/HostShell.d.ts +53 -0
  140. package/dist/shell/HostShell.d.ts.map +1 -0
  141. package/dist/shell/HostShell.js +116 -0
  142. package/dist/shell/HostShell.js.map +1 -0
  143. package/dist/shell/index.d.ts +7 -0
  144. package/dist/shell/index.d.ts.map +1 -0
  145. package/dist/shell/index.js +9 -0
  146. package/dist/shell/index.js.map +1 -0
  147. package/dist/shell/keys.d.ts +47 -0
  148. package/dist/shell/keys.d.ts.map +1 -0
  149. package/dist/shell/keys.js +68 -0
  150. package/dist/shell/keys.js.map +1 -0
  151. package/dist/shell/motion.d.ts +72 -0
  152. package/dist/shell/motion.d.ts.map +1 -0
  153. package/dist/shell/motion.js +118 -0
  154. package/dist/shell/motion.js.map +1 -0
  155. package/llms.txt +84 -9
  156. package/package.json +10 -1
  157. package/src/core/hosted.ts +351 -0
  158. package/src/core/index.ts +29 -0
  159. package/src/core/location.ts +23 -3
  160. package/src/core/preferences.ts +132 -0
  161. package/src/core/scheme.ts +32 -0
  162. package/src/core/theme.ts +91 -0
  163. package/src/core/themeChange.ts +59 -0
  164. package/src/core/types.ts +6 -0
  165. package/src/css/apps.css +183 -0
  166. package/src/css/overlays.css +6 -0
  167. package/src/css/shell.css +99 -0
  168. package/src/css/tokens.css +10 -0
  169. package/src/css/windows.css +21 -0
  170. package/src/fx/fx.ts +7 -25
  171. package/src/host/checkChrome.ts +257 -0
  172. package/src/host/checkTheme.ts +134 -0
  173. package/src/host/index.ts +10 -0
  174. package/src/host/router.ts +374 -0
  175. package/src/react/Desktop.tsx +21 -3
  176. package/src/react/Dock.tsx +40 -24
  177. package/src/react/MenuBar.tsx +39 -6
  178. package/src/react/app.tsx +354 -0
  179. package/src/react/appFrame.tsx +39 -14
  180. package/src/react/appPanels.tsx +210 -0
  181. package/src/react/appearance.tsx +195 -0
  182. package/src/react/codeBlock.tsx +7 -65
  183. package/src/react/context.tsx +131 -4
  184. package/src/react/copy.ts +81 -0
  185. package/src/react/dockStatus.ts +42 -0
  186. package/src/react/documentTitle.ts +4 -1
  187. package/src/react/frameMenus.ts +100 -0
  188. package/src/react/hostApp.tsx +89 -0
  189. package/src/react/hostDock.tsx +118 -0
  190. package/src/react/hostMenu.ts +3 -38
  191. package/src/react/hosted.tsx +65 -0
  192. package/src/react/index.ts +34 -0
  193. package/src/react/layers.ts +7 -2
  194. package/src/react/overlays.tsx +30 -12
  195. package/src/react/shell.tsx +33 -3
  196. package/src/react/windowMenus.ts +107 -0
  197. package/src/shell/HostShell.tsx +220 -0
  198. package/src/shell/index.ts +11 -0
  199. package/src/shell/keys.ts +101 -0
  200. package/src/shell/motion.ts +163 -0
@@ -0,0 +1,215 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Desk } from '../core/desk.js';
3
+ import type { Keymap } from '../core/shortcuts.js';
4
+ import type { WindowId, WindowLimits } from '../core/types.js';
5
+ import type { AppearanceRows } from './appearance.js';
6
+ import type { DockEntry, DockItem } from './Dock.js';
7
+ import type { Menu } from './MenuBar.js';
8
+ /** A link on the About panel: the website, the source, where to report an issue. */
9
+ export interface AppLink {
10
+ readonly label: string;
11
+ readonly url: string;
12
+ /** A heading the link is listed under on About, such as "Social". Links with none come first, unheaded. */
13
+ readonly group?: string;
14
+ }
15
+ /** One line of the About panel's facts: what something is, and its value. */
16
+ export interface AboutFact {
17
+ readonly name: string;
18
+ readonly value: string;
19
+ /** What Copy copies in place of `value`, which is what is shown: a short commit shown, the full one copied. */
20
+ readonly copyValue?: string;
21
+ /** What the person might want to know of it. Shown under the value, never copied. */
22
+ readonly note?: ReactNode;
23
+ /** Where to read more, shown after the note as a link: the guide to a setup that could be faster. Never copied. */
24
+ readonly link?: AppLink;
25
+ /**
26
+ * `false` keeps this fact out of what Copy copies: a path with a person's name in it, an account. It is
27
+ * still shown. Facts are for a bug report, so never put a key or a password in one, copied or not.
28
+ */
29
+ readonly copy?: boolean;
30
+ }
31
+ /** A titled group of facts; the first is often untitled. */
32
+ export interface AboutSection {
33
+ readonly title?: string;
34
+ readonly facts: readonly AboutFact[];
35
+ /**
36
+ * Still being worked out: the section shows "Checking" under its title, while the others are shown,
37
+ * and Copy leaves it out until it is ready.
38
+ */
39
+ readonly pending?: boolean;
40
+ }
41
+ /** One section of Settings: a heading and the controls under it. */
42
+ export interface SettingsSection {
43
+ /** Names it in a link: `desk.open('settings', { route: id })` opens Settings on it. */
44
+ readonly id: string;
45
+ readonly title: string;
46
+ /** In the sidebar layout, the heading it is listed under. Sections of one group are listed together. */
47
+ readonly group?: string;
48
+ /** In the sidebar layout, beside its name. */
49
+ readonly icon?: ReactNode;
50
+ readonly badge?: ReactNode;
51
+ readonly content: ReactNode;
52
+ }
53
+ /** What an app with settings declares: Desk's Appearance, its own sections, and how Settings is laid out and opened. */
54
+ export interface AppSettings {
55
+ /**
56
+ * Desk's own Appearance section, first: `true` for light, dark or the system's, or the rows the app wants
57
+ * (`scheme`, `look`, `sounds`, and `theme` for a picker of its own). It hides what comes from a host when
58
+ * the app receives its theme from one; with nothing left it goes, and with no other section so does Settings.
59
+ */
60
+ readonly appearance?: boolean | AppearanceRows;
61
+ /** The app's own sections, in order. They may change at runtime: a group that grows with plugins. */
62
+ readonly sections?: readonly SettingsSection[];
63
+ /**
64
+ * `panel` (the default): every section on one page, in a panel of one size, for a handful of settings.
65
+ * `sidebar`: a list of sections beside the one chosen, in a bigger window, for many.
66
+ */
67
+ readonly layout?: 'panel' | 'sidebar';
68
+ /** A count on the gear in the dock, as any dock item's badge: updates waiting, a plugin to finish setting up. */
69
+ readonly badge?: ReactNode;
70
+ /**
71
+ * The app's own way of opening Settings, for an app whose Settings window is its own code. Desk then
72
+ * draws no window: the gear, the menu item and ⌘, call this, with the section a link asked for.
73
+ * `<SettingsContent>` draws Desk's sections inside a window of the app's, if it wants them.
74
+ */
75
+ readonly open?: (route?: string) => void;
76
+ }
77
+ /** What an app declares about itself, given once to `DeskShell` or `DeskProvider` as `app`. */
78
+ export interface DeskApp {
79
+ /** As people read it: "About Garage", and the heading of the About panel. */
80
+ readonly name: string;
81
+ /** The app's mark, drawn large on the About panel. */
82
+ readonly icon?: ReactNode;
83
+ /**
84
+ * The app's name as a wide mark, for a brand that is a wordmark: drawn under the icon at its own width
85
+ * rather than squeezed into a square, in place of the name as text, which stays for screen readers.
86
+ */
87
+ readonly wordmark?: ReactNode;
88
+ readonly version?: string;
89
+ /** A line under the name: what the app is for. */
90
+ readonly description?: ReactNode;
91
+ readonly links?: readonly AppLink[];
92
+ /** The small print at the foot of About: the licence, the copyright. */
93
+ readonly legal?: ReactNode;
94
+ /**
95
+ * A short line under the links, never copied: what this build can and cannot say, such as that the desktop
96
+ * app reports what is running and this is a browser. For something that is not a fact about what runs.
97
+ */
98
+ readonly note?: ReactNode;
99
+ /**
100
+ * What is running, for a bug report: a hook, called inside the About panel, so it may read state and
101
+ * change. Return `null` while it is still being read, and the panel says so; `[]` when there is nothing to
102
+ * report, and there is no Copy. With facts, About has a Copy button that copies the name, the version and
103
+ * every fact not marked `copy: false`, as text.
104
+ */
105
+ readonly facts?: () => readonly AboutSection[] | null;
106
+ /** Leave out for an app with no settings: then there is no gear, no menu item and no ⌘,. */
107
+ readonly settings?: AppSettings;
108
+ /**
109
+ * This app receives its theme from a host, which chose it: Appearance offers no scheme, look or theme of
110
+ * its own. Left out, Desk finds it from the bridge an `AppFrame` puts in the page, once a theme arrives.
111
+ * The app that is the theme's source keeps them.
112
+ */
113
+ readonly themeFromHost?: boolean;
114
+ }
115
+ /** The window Desk opens for Settings. An app that declares settings without an `open` of its own gives this id to Desk. */
116
+ export declare const SETTINGS_WINDOW = "settings";
117
+ /** The window Desk opens for About. An app that declares itself gives this id to Desk. */
118
+ export declare const ABOUT_WINDOW = "about";
119
+ /** The command "Settings…" and ⌘, perform. It answers at the top of the chain while the app has settings. */
120
+ export declare const SettingsCommand = "desk.settings";
121
+ export declare const DESK_SHORTCUTS: Keymap;
122
+ /** Whether a menu item's shortcut is one Desk binds on the command already, so the menu only shows it. */
123
+ export declare const boundByDesk: (shortcut: string, command: string) => boolean;
124
+ /** Binds Desk's own shortcuts on this desk, less those a host's menu bar owns. Returns a function that unbinds them. */
125
+ export declare const bindDeskShortcuts: (desk: Desk) => (() => void);
126
+ /** While a host's menu bar is up, it gives these shortcuts their keys, so Desk leaves them alone. Returns a function that hands them back. */
127
+ export declare function hostOwnsShortcuts(desk: Desk, owns: (shortcut: string) => boolean): () => void;
128
+ /** Panels have one size: the desk centres them, filled or not. About is one, and Settings on one page. */
129
+ export declare const PANEL_LIMITS: WindowLimits;
130
+ /** The sidebar layout of Settings is bigger, for many sections and the list of them. */
131
+ export declare const SIDEBAR_LIMITS: WindowLimits;
132
+ /** Gives the declaration, with Appearance in place, to everything inside `DeskProvider`. */
133
+ export declare const AppProvider: import("react").Provider<DeskApp | null>;
134
+ /** What the app declared about itself, or null when it declared nothing. */
135
+ export declare const useDeskApp: () => DeskApp | null;
136
+ /** Whether the app has any Settings to show: its own window, or at least one section. */
137
+ export declare const hasSettings: (app: DeskApp | null) => boolean;
138
+ /**
139
+ * Which of Desk's own windows this is, for an app that declared itself: About always, and Settings when the
140
+ * app declared settings and does not open a window of its own for them. Null for every other window, which
141
+ * stays the app's, as `settings` does for an app that declared only its About.
142
+ */
143
+ export declare function desksWindow(app: DeskApp | null, id: WindowId): 'about' | 'settings' | null;
144
+ /**
145
+ * The title Desk gives its own windows, or null for every other window. `Desktop` and `useDocumentTitle` use
146
+ * it already; a Window menu's title function can too: `id => appWindowTitle(APP, id) ?? TITLES[id]`.
147
+ */
148
+ export declare function appWindowTitle(app: DeskApp | null, id: WindowId): string | null;
149
+ /** How big Desk's own window may be: a panel, or the bigger sidebar layout of Settings. */
150
+ export declare const appWindowLimits: (app: DeskApp | null, which: 'about' | 'settings') => WindowLimits;
151
+ /**
152
+ * Opens one of Desk's panels: filled, so it sits centred at its one size. A panel already open is brought
153
+ * forward where it is, and moved to `route` if one is given.
154
+ */
155
+ export declare function openPanel(desk: Desk, id: WindowId, route?: string): void;
156
+ /**
157
+ * Opens About as the dock and the menu do: a centred panel, or brought forward where it is. For a link or a
158
+ * query string that names it, so the app need not know how a panel is opened.
159
+ */
160
+ export declare const openAbout: (desk: Desk) => void;
161
+ /** Opens Settings for this declaration, in the app's own window if it has one, on `route` if given. */
162
+ export declare function openAppSettings(desk: Desk, app: DeskApp | null, route?: string): void;
163
+ /** The provider says what the app on this desk declared. Returns a function that forgets it. */
164
+ export declare function declareOn(desk: Desk, app: () => DeskApp | null): () => void;
165
+ /**
166
+ * Opens Settings as the gear, the menu item and ⌘, do, on the section `route` names: Desk's panel, or the
167
+ * app's own window. For a caller outside React, such as a search result or a link handler; inside, use
168
+ * `useOpenSettings()`. Nothing when the app has no Settings to show, or no provider has declared it.
169
+ */
170
+ export declare const openSettings: (desk: Desk, route?: string) => void;
171
+ /**
172
+ * Where the gear goes, when the app wants it somewhere other than just before About: put this among its own
173
+ * system items, or among the items of a stack, a System stack. It is dropped when the app has no settings.
174
+ */
175
+ export declare const dockSettings: () => AppDockMarker;
176
+ /**
177
+ * Where About goes, when the app wants it somewhere other than last in the system group: among its own items,
178
+ * or in a stack. Placed either way, the app's own place is the only one: Desk adds no loose About.
179
+ */
180
+ export declare const dockAbout: () => AppDockMarker;
181
+ /**
182
+ * The marker `dockSettings()` and `dockAbout()` give: a dock entry, and a stack item too, so either can stand
183
+ * in a stack's items. Desk puts the real item in its place.
184
+ */
185
+ export type AppDockMarker = {
186
+ readonly type: 'settings' | 'about';
187
+ readonly id: string;
188
+ } & DockItem;
189
+ /** The separator the system group starts after. An app that has none gets one before Settings and About. */
190
+ export declare const SYSTEM_GROUP = "system";
191
+ type Placed = Exclude<DockEntry, {
192
+ readonly type: 'settings' | 'about';
193
+ }>;
194
+ type Marker = AppDockMarker['type'];
195
+ /** Which marker an entry or stack item is, `dockSettings()` or `dockAbout()`, or null for any other. */
196
+ export declare const markerOf: (entry: object) => Marker | null;
197
+ /**
198
+ * The app's dock entries with Settings and About in place. Where the app put `dockSettings()` or `dockAbout()`,
199
+ * among its entries or in a stack, each goes there. What it did not place goes at the end of the system group
200
+ * (the entries after the separator with id `system`, up to the next separator): Settings, then About. The
201
+ * app's own items keep their order. Without a declaration, only the markers go, and a stack they leave empty.
202
+ */
203
+ export declare function placeAppDockItems(entries: readonly DockEntry[], app: DeskApp | null, open: {
204
+ settings: () => void;
205
+ about: () => void;
206
+ }): Placed[];
207
+ /**
208
+ * The app's menus with About and Settings at the top of the app menu, as a Mac app has them: "About <App>",
209
+ * a separator, "Settings…" (⌘,), a separator, then the app's own items. The app menu is the first one with
210
+ * `emphasis`; an app with none gets one, named for the app, in front. Items given as a function stay one, so
211
+ * a menu that is re-read on opening still is.
212
+ */
213
+ export declare function placeAppMenuItems(menus: readonly Menu[], app: DeskApp | null, openAbout: () => void): Menu[];
214
+ export {};
215
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/react/app.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,SA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,GAAG,IAAI,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,MAAM,EAAE,CAgCjJ;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI,GAAG,IAAI,EAAE,CAa5G"}
@@ -0,0 +1,192 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ import { isOpen } from '../core/desk.js';
4
+ import { bindShortcuts } from '../core/shortcuts.js';
5
+ /** The window Desk opens for Settings. An app that declares settings without an `open` of its own gives this id to Desk. */
6
+ export const SETTINGS_WINDOW = 'settings';
7
+ /** The window Desk opens for About. An app that declares itself gives this id to Desk. */
8
+ export const ABOUT_WINDOW = 'about';
9
+ /** The command "Settings…" and ⌘, perform. It answers at the top of the chain while the app has settings. */
10
+ export const SettingsCommand = 'desk.settings';
11
+ /*
12
+ * ⌘, is bound on the command itself, so it opens Settings in an app with no MenuBar. A menu item for one of
13
+ * these shows the shortcut and leaves the binding to this, so one press is one command. A host's native menu
14
+ * bar that gives the shortcut a key of its own takes it over while it is up, so the page does not do it too.
15
+ */
16
+ export const DESK_SHORTCUTS = { 'mod+comma': SettingsCommand };
17
+ const hostOwns = new WeakMap();
18
+ /** Whether a menu item's shortcut is one Desk binds on the command already, so the menu only shows it. */
19
+ export const boundByDesk = (shortcut, command) => DESK_SHORTCUTS[shortcut] === command;
20
+ /** Binds Desk's own shortcuts on this desk, less those a host's menu bar owns. Returns a function that unbinds them. */
21
+ export const bindDeskShortcuts = (desk) => bindShortcuts(desk, () => Object.fromEntries(Object.entries(DESK_SHORTCUTS).filter(([shortcut]) => !hostOwns.get(desk)?.(shortcut))));
22
+ /** While a host's menu bar is up, it gives these shortcuts their keys, so Desk leaves them alone. Returns a function that hands them back. */
23
+ export function hostOwnsShortcuts(desk, owns) {
24
+ hostOwns.set(desk, owns);
25
+ return () => {
26
+ if (hostOwns.get(desk) === owns)
27
+ hostOwns.delete(desk);
28
+ };
29
+ }
30
+ /** Panels have one size: the desk centres them, filled or not. About is one, and Settings on one page. */
31
+ export const PANEL_LIMITS = { minWidth: 360, minHeight: 200, maxWidth: 560, maxHeight: 560, fitContent: true };
32
+ /** The sidebar layout of Settings is bigger, for many sections and the list of them. */
33
+ export const SIDEBAR_LIMITS = { minWidth: 600, minHeight: 400, maxWidth: 880, maxHeight: 640 };
34
+ const AppContext = createContext(null);
35
+ /** Gives the declaration, with Appearance in place, to everything inside `DeskProvider`. */
36
+ export const AppProvider = AppContext.Provider;
37
+ /** What the app declared about itself, or null when it declared nothing. */
38
+ export const useDeskApp = () => useContext(AppContext);
39
+ /** Whether the app has any Settings to show: its own window, or at least one section. */
40
+ export const hasSettings = (app) => Boolean(app?.settings && (app.settings.open || (app.settings.sections?.length ?? 0) > 0));
41
+ /**
42
+ * Which of Desk's own windows this is, for an app that declared itself: About always, and Settings when the
43
+ * app declared settings and does not open a window of its own for them. Null for every other window, which
44
+ * stays the app's, as `settings` does for an app that declared only its About.
45
+ */
46
+ export function desksWindow(app, id) {
47
+ if (!app)
48
+ return null;
49
+ if (id === ABOUT_WINDOW)
50
+ return 'about';
51
+ if (id === SETTINGS_WINDOW && app.settings && !app.settings.open)
52
+ return 'settings';
53
+ return null;
54
+ }
55
+ /**
56
+ * The title Desk gives its own windows, or null for every other window. `Desktop` and `useDocumentTitle` use
57
+ * it already; a Window menu's title function can too: `id => appWindowTitle(APP, id) ?? TITLES[id]`.
58
+ */
59
+ export function appWindowTitle(app, id) {
60
+ const which = desksWindow(app, id);
61
+ return which === 'about' ? 'About' : which === 'settings' ? 'Settings' : null;
62
+ }
63
+ /** How big Desk's own window may be: a panel, or the bigger sidebar layout of Settings. */
64
+ export const appWindowLimits = (app, which) => which === 'settings' && app?.settings?.layout === 'sidebar' ? SIDEBAR_LIMITS : PANEL_LIMITS;
65
+ /**
66
+ * Opens one of Desk's panels: filled, so it sits centred at its one size. A panel already open is brought
67
+ * forward where it is, and moved to `route` if one is given.
68
+ */
69
+ export function openPanel(desk, id, route) {
70
+ const at = route === undefined ? {} : { route };
71
+ if (isOpen(desk.getState(), id))
72
+ desk.open(id, at);
73
+ else
74
+ desk.open(id, { mode: 'filled', ...at });
75
+ }
76
+ /**
77
+ * Opens About as the dock and the menu do: a centred panel, or brought forward where it is. For a link or a
78
+ * query string that names it, so the app need not know how a panel is opened.
79
+ */
80
+ export const openAbout = (desk) => openPanel(desk, ABOUT_WINDOW);
81
+ /** Opens Settings for this declaration, in the app's own window if it has one, on `route` if given. */
82
+ export function openAppSettings(desk, app, route) {
83
+ if (!hasSettings(app))
84
+ return;
85
+ if (app?.settings?.open)
86
+ app.settings.open(route);
87
+ else
88
+ openPanel(desk, SETTINGS_WINDOW, route);
89
+ }
90
+ /* The declaration each desk's provider holds, as shown (Appearance in place, less what a host themes). */
91
+ const declarations = new WeakMap();
92
+ /** The provider says what the app on this desk declared. Returns a function that forgets it. */
93
+ export function declareOn(desk, app) {
94
+ declarations.set(desk, app);
95
+ return () => {
96
+ if (declarations.get(desk) === app)
97
+ declarations.delete(desk);
98
+ };
99
+ }
100
+ /**
101
+ * Opens Settings as the gear, the menu item and ⌘, do, on the section `route` names: Desk's panel, or the
102
+ * app's own window. For a caller outside React, such as a search result or a link handler; inside, use
103
+ * `useOpenSettings()`. Nothing when the app has no Settings to show, or no provider has declared it.
104
+ */
105
+ export const openSettings = (desk, route) => openAppSettings(desk, declarations.get(desk)?.() ?? null, route);
106
+ const glyph = (path) => (_jsx("svg", { viewBox: "0 0 24 24", width: "22", height: "22", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: path }) }));
107
+ const GEAR = glyph('M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z');
108
+ const INFO = glyph('M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 11v5M12 8h.01');
109
+ /**
110
+ * Where the gear goes, when the app wants it somewhere other than just before About: put this among its own
111
+ * system items, or among the items of a stack, a System stack. It is dropped when the app has no settings.
112
+ */
113
+ export const dockSettings = () => ({ type: 'settings', id: SETTINGS_WINDOW, label: 'Settings', icon: GEAR });
114
+ /**
115
+ * Where About goes, when the app wants it somewhere other than last in the system group: among its own items,
116
+ * or in a stack. Placed either way, the app's own place is the only one: Desk adds no loose About.
117
+ */
118
+ export const dockAbout = () => ({ type: 'about', id: ABOUT_WINDOW, label: 'About', icon: INFO });
119
+ /** The separator the system group starts after. An app that has none gets one before Settings and About. */
120
+ export const SYSTEM_GROUP = 'system';
121
+ /** Which marker an entry or stack item is, `dockSettings()` or `dockAbout()`, or null for any other. */
122
+ export const markerOf = (entry) => {
123
+ const type = entry.type;
124
+ return type === 'settings' || type === 'about' ? type : null;
125
+ };
126
+ /**
127
+ * The app's dock entries with Settings and About in place. Where the app put `dockSettings()` or `dockAbout()`,
128
+ * among its entries or in a stack, each goes there. What it did not place goes at the end of the system group
129
+ * (the entries after the separator with id `system`, up to the next separator): Settings, then About. The
130
+ * app's own items keep their order. Without a declaration, only the markers go, and a stack they leave empty.
131
+ */
132
+ export function placeAppDockItems(entries, app, open) {
133
+ const settings = hasSettings(app)
134
+ ? { id: SETTINGS_WINDOW, label: 'Settings', icon: GEAR, onSelect: open.settings, ...(app?.settings?.badge != null ? { badge: app.settings.badge } : {}) }
135
+ : null;
136
+ const about = app ? { id: ABOUT_WINDOW, label: 'About', icon: INFO, onSelect: open.about } : null;
137
+ const marked = new Set();
138
+ // A marker placed twice gives one item, where it first stands.
139
+ const replace = (marker) => {
140
+ const item = marked.has(marker) ? null : marker === 'settings' ? settings : about;
141
+ marked.add(marker);
142
+ return item ? [item] : [];
143
+ };
144
+ const placed = entries.flatMap((entry) => {
145
+ const marker = markerOf(entry);
146
+ if (marker)
147
+ return replace(marker).map(item => ({ type: 'item', ...item }));
148
+ if (entry.type !== 'stack')
149
+ return [entry];
150
+ if (!entry.items.some(markerOf))
151
+ return [entry];
152
+ const items = entry.items.flatMap(item => {
153
+ const inStack = markerOf(item);
154
+ return inStack ? replace(inStack) : [item];
155
+ });
156
+ return items.length ? [{ ...entry, items }] : [];
157
+ });
158
+ const ending = [...(settings && !marked.has('settings') ? [settings] : []), ...(about && !marked.has('about') ? [about] : [])].map(item => ({ type: 'item', ...item }));
159
+ if (!ending.length)
160
+ return placed;
161
+ const start = placed.findIndex(e => e.type === 'separator' && e.id === SYSTEM_GROUP);
162
+ if (start < 0)
163
+ return [...placed, ...(placed.length ? [{ type: 'separator', id: SYSTEM_GROUP }] : []), ...ending];
164
+ const next = placed.findIndex((e, i) => i > start && e.type === 'separator');
165
+ const end = next < 0 ? placed.length : next;
166
+ return [...placed.slice(0, end), ...ending, ...placed.slice(end)];
167
+ }
168
+ const SEPARATOR = { type: 'separator' };
169
+ /**
170
+ * The app's menus with About and Settings at the top of the app menu, as a Mac app has them: "About <App>",
171
+ * a separator, "Settings…" (⌘,), a separator, then the app's own items. The app menu is the first one with
172
+ * `emphasis`; an app with none gets one, named for the app, in front. Items given as a function stay one, so
173
+ * a menu that is re-read on opening still is.
174
+ */
175
+ export function placeAppMenuItems(menus, app, openAbout) {
176
+ if (!app)
177
+ return [...menus];
178
+ const head = [{ type: 'action', label: `About ${app.name}`, onSelect: openAbout }];
179
+ if (hasSettings(app))
180
+ head.push(SEPARATOR, { type: 'command', label: 'Settings…', command: SettingsCommand, shortcut: 'mod+comma' });
181
+ const withHead = (items) => items.length === 0 ? head : [...head, ...(items[0]?.type === 'separator' ? [] : [SEPARATOR]), ...items];
182
+ const at = menus.findIndex(m => m.emphasis);
183
+ if (at < 0)
184
+ return [{ id: 'app', label: app.name, emphasis: true, items: head }, ...menus];
185
+ return menus.map((menu, i) => {
186
+ if (i !== at)
187
+ return menu;
188
+ const { items } = menu;
189
+ return { ...menu, items: typeof items === 'function' ? () => withHead(items()) : withHead(items) };
190
+ });
191
+ }
192
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/react/app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAsIpD,4HAA4H;AAC5H,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAA;AACzC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAA;AAEnC,6GAA6G;AAC7G,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAA;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAW,EAAE,WAAW,E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,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAA;IACpG,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,9 +1,5 @@
1
+ import type { AppTheme } from '../core/theme.js';
1
2
  import type { Accepts } from './dnd.js';
2
- export interface AppTheme {
3
- readonly mode: 'light' | 'dark';
4
- /** Custom properties, named as they will be set: `{ '--sb-bg-dark': '#0b0f1a' }`. */
5
- readonly tokens: Readonly<Record<string, string>>;
6
- }
7
3
  export interface AppFrameProps {
8
4
  /** The accessible name of the frame: what the app is. */
9
5
  readonly title: string;
@@ -20,6 +16,12 @@ export interface AppFrameProps {
20
16
  readonly accepts?: Accepts;
21
17
  /** Windows the app may ask to open. Default: none. */
22
18
  readonly opens?: readonly string[];
19
+ /**
20
+ * The app may add menus to the bar, which join it while this frame's window is in front. Its items
21
+ * go back to it alone when chosen, and never take a shortcut the page uses, nor one without a modifier
22
+ * (only `mod`, `ctrl`, `alt` or F1–F24 bind). Default: false.
23
+ */
24
+ readonly menus?: boolean;
23
25
  /**
24
26
  * The frame's sandbox. The default lets the app run its own scripts and forms, and
25
27
  * nothing more: no same-origin access, no top-level navigation, no pop-ups.
@@ -27,7 +29,7 @@ export interface AppFrameProps {
27
29
  readonly sandbox?: string;
28
30
  readonly className?: string;
29
31
  }
30
- export declare function AppFrame({ title, src, srcDoc, listens, says, theme, accepts, opens, sandbox, className, }: AppFrameProps): import("react").JSX.Element;
32
+ export declare function AppFrame({ title, src, srcDoc, listens, says, theme, accepts, opens, menus: addsMenus, sandbox, className, }: AppFrameProps): import("react").JSX.Element;
31
33
  /**
32
34
  * The app's half of the bridge, as a script to put in its page. It gives the page a
33
35
  * small `desk` object:
@@ -36,9 +38,11 @@ export declare function AppFrame({ title, src, srcDoc, listens, says, theme, acc
36
38
  * desk.onDrop(drop => …) take what is dropped on the window
37
39
  * desk.publish('ride.selected', ride) say something, if it was granted
38
40
  * desk.open('map') ask for a window, if it was granted
41
+ * desk.setMenus([{ id, label, items }]) add menus to the bar, if it was granted
42
+ * desk.onCommand(id => …) hear which of its menu items was chosen
39
43
  * desk.window which window this is, once connected
40
44
  */
41
- export declare const APP_BRIDGE_SCRIPT = "(() => {\n const handlers = new Map();\n const drops = [];\n const send = message => parent.postMessage(Object.assign({ desk: 1 }, message), '*');\n const applyTheme = theme => {\n if (!theme) return;\n desk.theme = theme;\n const root = document.documentElement;\n root.dataset.theme = theme.mode;\n root.style.colorScheme = theme.mode;\n for (const [name, value] of Object.entries(theme.tokens || {})) root.style.setProperty(name, value);\n themed.forEach(h => h(theme));\n };\n const themed = [];\n const desk = {\n window: null,\n listens: [],\n says: [],\n theme: null,\n onTheme(handler) { themed.push(handler); if (desk.theme) handler(desk.theme); },\n on(topic, handler) { (handlers.get(topic) || handlers.set(topic, []).get(topic)).push(handler); },\n onDrop(handler) { drops.push(handler); },\n publish(topic, payload) { send({ kind: 'publish', topic, payload }); },\n open(window) { send({ kind: 'open', window }); },\n };\n const matches = (pattern, topic) =>\n pattern === '*' || pattern === topic || (pattern.endsWith('.*') && (topic === pattern.slice(0, -2) || topic.startsWith(pattern.slice(0, -1))));\n addEventListener('message', event => {\n if (event.source !== parent || !event.data || event.data.desk !== 1) return;\n const message = event.data;\n if (message.kind === 'hello') { desk.window = message.window; desk.listens = message.listens; desk.says = message.says; applyTheme(message.theme); }\n if (message.kind === 'theme') applyTheme(message.theme);\n if (message.kind === 'event') for (const [pattern, list] of handlers) if (matches(pattern, message.topic)) list.forEach(h => h(message));\n if (message.kind === 'drop') drops.forEach(h => h(message));\n });\n window.desk = desk;\n send({ kind: 'ready' });\n})();";
45
+ export declare const APP_BRIDGE_SCRIPT = "(() => {\n const handlers = new Map();\n const drops = [];\n const commands = [];\n const send = message => parent.postMessage(Object.assign({ desk: 1 }, message), '*');\n const applyTheme = theme => {\n if (!theme) return;\n desk.theme = theme;\n const root = document.documentElement;\n root.dataset.theme = theme.mode;\n root.style.colorScheme = theme.mode;\n for (const [name, value] of Object.entries(theme.tokens || {})) root.style.setProperty(name, value);\n themed.forEach(h => h(theme));\n };\n const themed = [];\n const desk = {\n window: null,\n listens: [],\n says: [],\n theme: null,\n onTheme(handler) { themed.push(handler); if (desk.theme) handler(desk.theme); },\n on(topic, handler) { (handlers.get(topic) || handlers.set(topic, []).get(topic)).push(handler); },\n onDrop(handler) { drops.push(handler); },\n publish(topic, payload) { send({ kind: 'publish', topic, payload }); },\n open(window) { send({ kind: 'open', window }); },\n setMenus(menus) { send({ kind: 'chrome', chrome: { menus } }); },\n onCommand(handler) { commands.push(handler); },\n };\n const matches = (pattern, topic) =>\n pattern === '*' || pattern === topic || (pattern.endsWith('.*') && (topic === pattern.slice(0, -2) || topic.startsWith(pattern.slice(0, -1))));\n addEventListener('message', event => {\n if (event.source !== parent || !event.data || event.data.desk !== 1) return;\n const message = event.data;\n if (message.kind === 'hello') { desk.window = message.window; desk.listens = message.listens; desk.says = message.says; applyTheme(message.theme); }\n if (message.kind === 'theme') applyTheme(message.theme);\n if (message.kind === 'event') for (const [pattern, list] of handlers) if (matches(pattern, message.topic)) list.forEach(h => h(message));\n if (message.kind === 'drop') drops.forEach(h => h(message));\n if (message.kind === 'command' && message.target === 'menu') commands.forEach(h => h(message.id));\n });\n window.desk = desk;\n send({ kind: 'ready' });\n})();";
42
46
  /** Puts the bridge into a page of HTML, so a generated app needs nothing added by hand. */
43
47
  export declare function withAppBridge(html: string): string;
44
48
  //# sourceMappingURL=appFrame.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appFrame.d.ts","sourceRoot":"","sources":["../../src/react/appFrame.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAiCvC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;IAC/B,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA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,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,gEAAgE;IAChE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,oFAAoF;IACpF,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,sGAAsG;IACtG,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAA;IACzB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAY,EACZ,IAAS,EACT,KAAK,EACL,OAAO,EACP,KAAU,EACV,KAAK,EAAE,SAAiB,EACxB,OAAqC,EACrC,SAAS,GACV,EAAE,aAAa,+BA0Ff;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,iiEAyCxB,CAAA;AAEN,2FAA2F;AAC3F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGlD"}
@@ -1,9 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef } from 'react';
2
+ import { useEffect, useId, useRef, useState } from 'react';
3
3
  import { topicMatches } from '../core/events.js';
4
+ import { DESK_PROTOCOL } from '../core/hosted.js';
4
5
  import { useDragging, useDropTarget } from './dnd.js';
5
6
  import { useDesk, useWindowId } from './context.js';
6
7
  import { useBus } from './events.js';
8
+ import { frameMenus, useFrameMenus } from './frameMenus.js';
7
9
  /*
8
10
  * A generated app — a self-contained page — running inside a window, and taking
9
11
  * part in the desk as a native window does: hearing events, saying things, and
@@ -13,10 +15,10 @@ import { useBus } from './events.js';
13
15
  * only through messages. The host decides, per app, which topics it may hear,
14
16
  * which it may say, and what may be dropped on it. Nothing else crosses.
15
17
  */
16
- /** The protocol version. Every message carries it, so a mismatch is ignored rather than misread. */
17
- const PROTOCOL = 1;
18
+ /** Every message carries the protocol version, shared with hosted mode, so a mismatch is ignored rather than misread. */
19
+ const PROTOCOL = DESK_PROTOCOL;
18
20
  const isAppMessage = (data) => typeof data === 'object' && data !== null && data.desk === PROTOCOL && typeof data.kind === 'string';
19
- export function AppFrame({ title, src, srcDoc, listens = [], says = [], theme, accepts, opens = [], sandbox = 'allow-scripts allow-forms', className, }) {
21
+ export function AppFrame({ title, src, srcDoc, listens = [], says = [], theme, accepts, opens = [], menus: addsMenus = false, sandbox = 'allow-scripts allow-forms', className, }) {
20
22
  const desk = useDesk();
21
23
  const bus = useBus();
22
24
  const windowId = useWindowId();
@@ -28,8 +30,12 @@ export function AppFrame({ title, src, srcDoc, listens = [], says = [], theme, a
28
30
  // window and no other.
29
31
  frame.current?.contentWindow?.postMessage(message, '*');
30
32
  };
31
- const latest = useRef({ listens, says, opens, windowId, theme });
32
- latest.current = { listens, says, opens, windowId, theme };
33
+ const latest = useRef({ listens, says, opens, windowId, theme, addsMenus });
34
+ latest.current = { listens, says, opens, windowId, theme, addsMenus };
35
+ // The app's menus, named for this frame so they never meet the page's or another frame's.
36
+ const prefix = `frame${useId()}`;
37
+ const [menus, setMenus] = useState(null);
38
+ useFrameMenus(desk, addsMenus ? windowId : null, menus, id => post({ desk: PROTOCOL, kind: 'command', target: 'menu', id }));
33
39
  // What the app says: only from this frame, only on topics it was granted.
34
40
  useEffect(() => {
35
41
  const onMessage = (event) => {
@@ -38,6 +44,8 @@ export function AppFrame({ title, src, srcDoc, listens = [], says = [], theme, a
38
44
  const message = event.data;
39
45
  const granted = latest.current;
40
46
  if (message.kind === 'ready') {
47
+ // A page loading in the frame, perhaps a new one: the menus it had are gone with the old.
48
+ setMenus(null);
41
49
  post({ desk: PROTOCOL, kind: 'hello', window: granted.windowId, listens: granted.listens, says: granted.says, theme: granted.theme ?? null });
42
50
  }
43
51
  else if (message.kind === 'publish') {
@@ -45,6 +53,10 @@ export function AppFrame({ title, src, srcDoc, listens = [], says = [], theme, a
45
53
  bus.publish(message.topic, message.payload, { from: granted.windowId });
46
54
  }
47
55
  }
56
+ else if (message.kind === 'chrome') {
57
+ if (granted.addsMenus)
58
+ setMenus(frameMenus(message.chrome?.menus, prefix));
59
+ }
48
60
  else if (message.kind === 'open') {
49
61
  if (typeof message.window === 'string' && granted.opens.includes(message.window))
50
62
  desk.open(message.window);
@@ -92,11 +104,14 @@ export function AppFrame({ title, src, srcDoc, listens = [], says = [], theme, a
92
104
  * desk.onDrop(drop => …) take what is dropped on the window
93
105
  * desk.publish('ride.selected', ride) say something, if it was granted
94
106
  * desk.open('map') ask for a window, if it was granted
107
+ * desk.setMenus([{ id, label, items }]) add menus to the bar, if it was granted
108
+ * desk.onCommand(id => …) hear which of its menu items was chosen
95
109
  * desk.window which window this is, once connected
96
110
  */
97
111
  export const APP_BRIDGE_SCRIPT = `(() => {
98
112
  const handlers = new Map();
99
113
  const drops = [];
114
+ const commands = [];
100
115
  const send = message => parent.postMessage(Object.assign({ desk: ${PROTOCOL} }, message), '*');
101
116
  const applyTheme = theme => {
102
117
  if (!theme) return;
@@ -118,6 +133,8 @@ export const APP_BRIDGE_SCRIPT = `(() => {
118
133
  onDrop(handler) { drops.push(handler); },
119
134
  publish(topic, payload) { send({ kind: 'publish', topic, payload }); },
120
135
  open(window) { send({ kind: 'open', window }); },
136
+ setMenus(menus) { send({ kind: 'chrome', chrome: { menus } }); },
137
+ onCommand(handler) { commands.push(handler); },
121
138
  };
122
139
  const matches = (pattern, topic) =>
123
140
  pattern === '*' || pattern === topic || (pattern.endsWith('.*') && (topic === pattern.slice(0, -2) || topic.startsWith(pattern.slice(0, -1))));
@@ -128,6 +145,7 @@ export const APP_BRIDGE_SCRIPT = `(() => {
128
145
  if (message.kind === 'theme') applyTheme(message.theme);
129
146
  if (message.kind === 'event') for (const [pattern, list] of handlers) if (matches(pattern, message.topic)) list.forEach(h => h(message));
130
147
  if (message.kind === 'drop') drops.forEach(h => h(message));
148
+ if (message.kind === 'command' && message.target === 'menu') commands.forEach(h => h(message.id));
131
149
  });
132
150
  window.desk = desk;
133
151
  send({ kind: 'ready' });
@@ -1 +1 @@
1
- {"version":3,"file":"appFrame.js","sourceRoot":"","sources":["../../src/react/appFrame.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAErD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC;;;;;;;;GAQG;AAEH,oGAAoG;AACpG,MAAM,QAAQ,GAAG,CAAC,CAAA;AAmClB,MAAM,YAAY,GAAG,CAAC,IAAa,EAAsB,EAAE,CACzD,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAK,IAA2B,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAQ,IAA2B,CAAC,IAAI,KAAK,QAAQ,CAAA;AA0BtJ,MAAM,UAAU,QAAQ,CAAC,EACvB,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,GAAG,EAAE,EACZ,IAAI,GAAG,EAAE,EACT,KAAK,EACL,OAAO,EACP,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,2BAA2B,EACr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