@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
package/README.md CHANGED
@@ -107,7 +107,8 @@ Most windows want the whole desk when filled and whatever they are dragged to wh
107
107
  what `null` says. A window whose content has a natural size — an About box, a short form — says so
108
108
  and is never stretched past it, however it is filled, arranged or dragged; filled, it sits in the
109
109
  middle of the room it was given rather than in a corner of it. `minWidth` and `minHeight` work the
110
- same way.
110
+ same way. `fitContent` makes such a window as tall as its content, up to `maxHeight`, while it sits in the
111
+ middle, so a short form is not a tall window with room to spare under it; longer content scrolls inside it.
111
112
 
112
113
  ### What a window is looking at
113
114
 
@@ -632,6 +633,9 @@ Inside the page, the bridge gives it a small `desk` object: `desk.on(topic, …)
632
633
  origin, and talks only through messages. The host grants each app its topics, drop types and windows;
633
634
  anything else it sends is dropped, and messages from anywhere but its own frame are ignored.
634
635
 
636
+ An app its window allows to (`menus`) can add menus to the bar while that window is in front: see
637
+ [Menus from the window in front](#menus-from-the-window-in-front).
638
+
635
639
  ## Search
636
640
 
637
641
  ![A search palette over the desk, showing matching windows](https://raw.githubusercontent.com/liberation-data/desk/main/docs/screenshots/search.png)
@@ -848,6 +852,157 @@ const host: MenuHost = {
848
852
  <MenuBar menus={menus} status={status} host={window.inShell ? host : undefined} />
849
853
  ```
850
854
 
855
+ ### Hosted mode
856
+
857
+ A host — a native shell, or a web page that frames several apps — can run more than one Desk app side by
858
+ side and draw one menu bar and one dock above all of them, so that moving between apps changes only what
859
+ fills the desktop. Each app is hosted when the page has a `globalThis.deskHost` (a `DeskHostBridge`, which
860
+ the host provides: an Electron preload, or `postMessage` between frames), or when `DeskProvider` or
861
+ `DeskShell` is given one as `host`. Nothing else in the app changes:
862
+
863
+ - `MenuBar` and `Dock` draw nothing, and send their contents to the host as data (`DeskChrome`). The host
864
+ sends back what was chosen, which runs as a click would. Shortcuts are shared as with any host's menu
865
+ bar: the host gives those with `mod` a key, as a native menu's key equivalents work whichever app has
866
+ focus, and the app binds the rest. Give a dock item an `image` (a URL or `data:` URI) for the host to
867
+ draw, since `icon` is a React node and cannot cross. Widgets stay on the app's desktop.
868
+ - The host's frame has one Settings and one About for every app, so a hosted app draws no gear and no
869
+ About item. It sends what its `app` declares instead: its Settings sections by id, title, group and
870
+ badge (their controls stay in the app, which opens its own Settings at a section when the host asks),
871
+ and its name, version, links, note (when it is text) and facts, each fact's link and `copy: false`
872
+ kept. ⌘, is the host's too: Desk steps aside for it, as it does for any host's menu bar, so it is
873
+ bound once.
874
+ - One app, the primary, sets the look every app wears: it publishes a `DeskTheme` (`mode`, `look`,
875
+ `tokens`, `fonts`, `wallpaper`) with `usePublishTheme(theme)`, and every other app wears it through
876
+ `applyTheme`, so their Appearance offers no scheme, look or theme of its own. The primary declares
877
+ `themeFromHost: false`: it keeps its Appearance and wears no theme but its own. An app that keeps some
878
+ looks of its own passes `onTheme`; light or dark and the look apply whatever it does, since one
879
+ desktop light and the next dark would look broken side by side.
880
+ - Apps never talk to each other directly. `useHost()` gives the connection: `publish(topic, payload)`,
881
+ and `subscribe(publisher, topic, handler)` for another app's broadcasts, by its id or by `'primary'`
882
+ (`useHostBroadcast` does it while a component is mounted). The host stamps who each broadcast came
883
+ from and passes on only topics that app was granted. It keeps the last broadcast of each publisher on
884
+ each topic, so an app that starts late hears it at once. The primary's theme outlives it: an app that
885
+ starts while the primary is down still wears its last look.
886
+
887
+ A page without React connects with `connectHost(bridge)`, from the core entry.
888
+
889
+ ```tsx
890
+ <DeskShell onTheme={theme => keepMyAccent(theme)}> {/* hosted when the page has a deskHost */}
891
+ <MenuBar menus={menus} />
892
+ <Dock entries={[dockItem({ id: 'notes', label: 'Notes', icon: <NotesIcon />, image: '/notes.png' })]} />
893
+ <Desktop … />
894
+ </DeskShell>
895
+ ```
896
+
897
+ The host's half is `@liberation-data/desk/host`, which no app loads. `createBroadcastRouter` holds the
898
+ rules above, so every transport keeps them alike:
899
+
900
+ - The host registers each app (`id`, `origin`, `primary`, `publishes`) and hands the router every message
901
+ the app sends, identified by the transport, never by the message. The primary's `publishes` must
902
+ include `theme`. When the host unregisters an app, `chrome` is called with null for it, and the host
903
+ stops drawing its menus and dock.
904
+ - A theme is checked before it is passed on (`checkTheme`): tokens must be plain values (colours,
905
+ lengths, font names, gradients) with nothing that loads, such as `url(…)`, and fonts and image
906
+ wallpaper must come from the primary's own origin or be `data:` URIs.
907
+ - An app's chrome is checked too (`checkChrome`), since the host draws it in its own frame: text and
908
+ lists are bounded, links must be http(s), `mailto:` or on the app's origin, and dock images must be on
909
+ the app's origin or `data:` PNG, JPEG, WebP, AVIF or GIF (no SVG). Relative ones come back resolved
910
+ against the app. A part that fails costs only itself: a menu item, dock item, Settings section, link or
911
+ fact is dropped, a bad image or fact link is dropped from its item, and the rest is drawn. `chrome`
912
+ gets the reasons as its third argument (`dropped`), for the host to log. Chrome of the wrong shape (a
913
+ top-level field that is not a list, over 2 MiB, or a stack in a stack) is not drawn at all, so the app
914
+ keeps what it last sent. A host opens About links in the system browser or mail app, or in a new
915
+ window with `rel="noopener noreferrer"`, never in its own frame.
916
+ - Broadcasts are rate limited per publisher and topic (`limits`): a burst of 20, then 10 a second, and
917
+ for the theme 2 then 1 a second, since it changes on a person's choice. Over the limit nothing is
918
+ queued or lost: the latest payload is held, replacing any held before, and goes out when the bucket
919
+ allows, so every subscriber still ends on the last value, and so does the kept one. Order holds within a
920
+ topic; across topics only while under the limits, since a held topic's latest can go out after a later
921
+ broadcast on another. A publisher may have 64 topics going at once (`maxTopics`), so a flood across
922
+ topics is bounded too: past that, a new topic is refused (`'rate limited'`) unless an idle one makes
923
+ room. `limited(appId)` counts what an app had held and replaced or refused, for the host to see one
924
+ that floods. `topics` sets other rates by topic (`burst` and `perSecond` alone leave the theme's),
925
+ and `clock` is the time, for tests. Registering an app again drops what it held, since that was
926
+ vetted under its old grants. A rate that cannot refill (`perSecond` 0, a negative or NaN) throws.
927
+ - Payloads over 64 KiB (`maxPayload`) are refused, and `check` lets a host vet the topics it knows. A
928
+ `deliver` that throws for one app (a window already gone) does not keep the others from hearing: the
929
+ first error is thrown once the broadcast has reached them.
930
+
931
+ `createMemoryHost` is a whole host in one page, for tests.
932
+
933
+ ### The host's shell
934
+
935
+ `@liberation-data/desk/shell` draws the chrome a host shares among its apps: one dock (the current app's,
936
+ from its `DeskChrome`) and a switcher between workspaces. Only the host's own page loads it, with
937
+ `css/shell.css` after desk.css; no app does. `HostShell` draws and moves nothing: it says what the person
938
+ asked for, and the host does it and then passes the new `current`.
939
+
940
+ ```tsx
941
+ import { HostShell } from '@liberation-data/desk/shell'
942
+ import '@liberation-data/desk/css/shell.css'
943
+
944
+ <HostShell
945
+ workspaces={[{ id: 'notes', title: 'Notes', primary: true, state: 'live' }, …]} // switcher order
946
+ current="notes"
947
+ chrome={chromeByApp} // each app's DeskChrome, as the router's `chrome` hands it over
948
+ theme={primaryTheme}
949
+ onSwitch={(id, how) => …} // how: 'slide' (or 'zoom', from the overview to come)
950
+ onCommand={(appId, target, itemId) => …}
951
+ onInsets={insets => …} // bound the apps' views inside these
952
+ />
953
+ ```
954
+
955
+ - The switcher is one Tab stop, moved through with the arrow keys, Home and End; arriving on a workspace
956
+ says its title once through a polite live region.
957
+ - The switching keys step around each OS's own: Ctrl+Option+←/→ on a Mac, Super+Alt+←/→ on Linux,
958
+ Ctrl+Alt+←/→ on Windows (`switchKeys(platform)`; pass `keys` for others, or null for none). A key goes
959
+ to whichever view has focus, so the host catches it first (in Electron, `before-input-event`) and asks
960
+ `switchKeyAction(input, keys)`, which reads a page's key event and Electron's input alike and ignores
961
+ the key's release. `neighbour(workspaces, current, step)` is the one to go to, or null at either end.
962
+ - The host moves the views itself, on the shell's curve: `slidePlan(reducedMotion)` is a 350 ms slide or,
963
+ under reduced motion, a 120 ms fade; `spring(duration, from, velocity)` arrives without overshooting and
964
+ can start mid-flight; `slideOffsets(progress, direction, width)` places both views in whole pixels with
965
+ no gap. Mid-slide they reach past the desktop area, so the host clips them to it, or they cover the
966
+ dock. `animate({ durationMs, step, clock: timerClock() })` steps them from a main process, and jumps to
967
+ the end if frames stop, as they do for a hidden window.
968
+
969
+ ### Menus from the window in front
970
+
971
+ As on a Mac, the menu bar follows what is in front. A window, or an app embedded in one, can add menus of
972
+ its own, which join the bar while that window has focus and leave when it loses it. They go after the
973
+ app's own menus and before Window and Help (the menus with ids `window` and `help`), by the same path
974
+ whether Desk draws the bar or a host does:
975
+
976
+ - A window adds them with `useWindowMenus(menus)` inside its content, passing a stable array (`useMemo`).
977
+ Each menu's id is given the window's in front of it, so two windows, or a window and the app, can each
978
+ have an "Edit". Their command shortcuts are bound while the menus are shown.
979
+ - An embedded app adds them through its `AppFrame`, when the window allows it with `menus`. Inside the
980
+ page, `desk.setMenus(menus)` sends them as hosted mode's apps send theirs (`HostMenu` data, in a
981
+ `chrome` message), and `desk.onCommand(id => …)` hears which item was chosen. The frame checks them as
982
+ a host checks any app's chrome (`checkChrome`): a bad menu or item is dropped and the rest kept, and a
983
+ frame adds four menus at most. Each item becomes a command named for its frame, enabled only while the
984
+ frame's window is in front, so its shortcut works through the bar like any other (while focus is in the
985
+ page around the frame: keys pressed inside the frame stay in the frame, which handles its own), its ids never meet
986
+ the page's or another frame's, and a choice goes back to that frame alone. An embedded app's shortcut
987
+ must hold ⌘/Ctrl (`mod` or `ctrl`) or ⌥ (`alt`), or be a function key (F1–F24): a bare letter, Enter,
988
+ Escape or an arrow belongs to whatever has focus, so such an item keeps its label and loses the key, said
989
+ once on the console. A window's own menus, from the app's code, are not held to this.
990
+ - Nothing added this way takes a shortcut from the app. An item that asks for a key the app's own menus
991
+ (status menus too) or Desk (⌘, for Settings) already use keeps its label and loses the key, and the clash is said once on
992
+ the console. A host's menu bar gets the joined menus through `hostMenuModel`, with the usual shortcut
993
+ ownership.
994
+
995
+ ```tsx
996
+ function RideWindow() {
997
+ useWindowMenus(useMemo(() => [{ id: 'ride', label: 'Ride', items: [menuCommand('Next Ride', 'rides.next', { shortcut: 'mod+j' })] }], []))
998
+ …
999
+ }
1000
+
1001
+ <AppFrame title="Ride Card" srcDoc={RIDE_CARD} menus />
1002
+ // in the card's page:
1003
+ desk.setMenus([{ id: 'card', label: 'Card', items: [{ type: 'item', id: 'clear', label: 'Clear Card', shortcut: 'mod+k' }] }])
1004
+ desk.onCommand(id => { if (id === 'clear') clearCard() })
1005
+ ```
851
1006
 
852
1007
  ### Context menus
853
1008
 
@@ -887,6 +1042,128 @@ opens the item's context menu. With `drag`, an icon can be carried to a drop tar
887
1042
  With `drag`, every icon can be picked up except one whose item says `draggable: false`: something no
888
1043
  target would take stays where it is.
889
1044
 
1045
+ ## Settings and About
1046
+
1047
+ ```tsx
1048
+ const GARAGE: DeskApp = {
1049
+ name: 'Garage',
1050
+ icon: <GarageMark />,
1051
+ wordmark: <GarageWordmark />, // optional: the name as a wide mark, beside the icon
1052
+ version: '2.1.0',
1053
+ description: 'Rides, bikes and what they need next.',
1054
+ links: [{ label: 'Website', url: 'https://example.com' }, { label: 'Mastodon', url: 'https://example.social/@garage', group: 'Social' }],
1055
+ facts: useRunningFacts, // optional: a hook returning AboutSection[], or null while reading
1056
+ settings: { sections: [
1057
+ { id: 'units', title: 'Units', content: <Units /> },
1058
+ { id: 'reminders', title: 'Reminders', content: <Reminders /> },
1059
+ ] },
1060
+ }
1061
+
1062
+ <DeskShell desk={desk} app={GARAGE}>…</DeskShell>
1063
+ ```
1064
+
1065
+ Every app has an About and many have Settings, and each used to wire up its own: a gear in the dock, a
1066
+ menu item, ⌘, and a window of the right size. Declared once, Desk puts them where every Desk app has
1067
+ them. The dock's system group (the entries after `dockSeparator('system')`, or a group of its own when
1068
+ there is none) ends with the gear and then About. The app menu, the first with `emphasis`, starts with
1069
+ "About Garage", a separator and "Settings…" with ⌘,. Each opens as a panel of one size, centred, and is
1070
+ brought forward if it is open already. ⌘, is bound on the Settings command itself, so it works in an app with
1071
+ no `MenuBar`; the menu item shows it and does not bind it again.
1072
+
1073
+ **An app with no settings shows none of it**: no gear, no menu item and no ⌘,, as a Mac app without
1074
+ preferences leaves the item out. About is always there, built from the name, icon, version and links.
1075
+ A brand that is a wordmark gives `wordmark`, drawn under the icon at its own width rather than squeezed into
1076
+ a square; the name stays as the heading, for screen readers. A link with a `group` (`'Social'`) is listed
1077
+ under that heading, after the links with none. `legal` adds the small print at its foot.
1078
+
1079
+ `facts` is what is running, for a bug report: engines, versions, the machine. It is a hook, called inside
1080
+ the About panel, so it can read state and follow it; return `null` while it is still being read, and `[]`
1081
+ when there is nothing to report. With facts, About has **Copy**, which copies the name, the version and every
1082
+ fact as text. A fact with `copy: false` is shown and not copied: a path with someone's name in it, an
1083
+ account. Never put a key or a password in a fact. A fact's `copyValue` is copied in place of the `value`
1084
+ shown: a short commit shown, the full one copied. A section still being worked out sets `pending: true`: it
1085
+ shows "Checking" under its title while the others are shown, and Copy leaves it out until it is ready. A fact's `note` says what someone might want to know of it,
1086
+ and its `link` (`{ label, url }`, as the app's links are) where to read more; neither is copied. The names of
1087
+ every section line up in one column. `note` on the declaration is a short line under the links, also not
1088
+ copied, for what this build cannot say: that the desktop app reports what is running, and this is a browser.
1089
+
1090
+ A handful of settings sit on one page. Many take `layout: 'sidebar'`: a list of sections, grouped by each
1091
+ section's `group`, beside the one chosen, in a bigger window. Sections may change while the app runs, such
1092
+ as a group that grows as plugins are installed. A section's `id` is its route, so
1093
+ `useOpenSettings()('plugins')` opens Settings on it, as the gear does, and the address says where Settings
1094
+ is. `openAbout(desk)` opens About as the dock does, for a link that names it, and `openSettings(desk, route?)`
1095
+ opens Settings, for a caller outside React such as a search result; inside, `useOpenSettings()` does the same.
1096
+ Both do nothing that the gear would not: no Settings when the app has none to show. `syncWithLocation` keeps a
1097
+ link to `settings` or `about` once the app is declared, so its `isKnown` lists only the app's own windows. The one-page panel and About are
1098
+ as tall as their content, up to the panel's height.
1099
+ `badge` puts a count on the gear, as on any dock item.
1100
+
1101
+ The gear goes just before About unless the app puts `dockSettings()` somewhere else among its system
1102
+ items, and About goes last unless it puts `dockAbout()` somewhere. Either may go in a stack too, a System
1103
+ stack beside the app's own Shortcuts, which keeps a long dock short; what the app placed, Desk does not add
1104
+ again. The app's own items keep their order.
1105
+
1106
+ ```tsx
1107
+ dockStack({ id: 'system', label: 'System', items: [shortcuts, dockSettings(), dockAbout()] })
1108
+ ```
1109
+
1110
+ An app whose Settings window is its own code keeps it: `settings: { open: route => … }` and the gear, the
1111
+ menu item and ⌘, call that instead, and Desk draws no window. `<SettingsContent />` draws the declared
1112
+ sections inside a window of the app's, if it wants them.
1113
+
1114
+ ### Appearance
1115
+
1116
+ ```tsx
1117
+ settings: { appearance: true } // light, dark or the system's
1118
+ settings: { appearance: { scheme: true, look: true, sounds: fx, theme: <Palette /> }, sections }
1119
+ settings: { appearance: { scheme: true, defaultScheme: 'dark' } } // dark until someone chooses
1120
+ ```
1121
+
1122
+ Desk owns the theme and the look, so it can offer them as a ready-made first section of Settings, and a
1123
+ small app whose only setting is how it looks gets a Settings window with nothing written. The app chooses
1124
+ the rows: `scheme` (light, dark or follow the system), `look` (the window chrome: automatic, Mac, GNOME or
1125
+ Windows), `sounds` (the one `SoundsToggle` for its `createFx`), and `theme`, a slot for a picker of its own.
1126
+ An app whose named themes decide light or dark leaves `scheme` out.
1127
+
1128
+ Both choices are remembered in this browser, under `desk.scheme` and `desk.look` (`COLOR_SCHEME_KEY` and
1129
+ `LOOK_KEY`, for an app moving a choice it kept under its own key). The scheme is `data-theme`
1130
+ on the root, which the stylesheet already reads, and the chosen look stands in for the one the app passes.
1131
+ `useColorScheme()` and `useLookChoice()` follow them, for an app that tells a native shell or themes
1132
+ something of its own. While nothing is chosen, `defaultScheme` applies: the system's unless the app says, as an
1133
+ app made dark does. Put `COLOR_SCHEME_SCRIPT` in the page's `<head>` so a dark choice does not open light
1134
+ for a moment while the app loads, or `colorSchemeScript('dark')` for an app whose default is dark. The keys and the script are in the core entry too, which has no React, for
1135
+ a layout rendered on a server.
1136
+
1137
+ Choices are kept in this browser's localStorage, following other tabs. An app that keeps preferences with
1138
+ the person's account gives `DeskShell` a store of its own, used for every choice Desk remembers (the scheme,
1139
+ the look, the sounds' mute) under the same keys: `COLOR_SCHEME_KEY`, `LOOK_KEY` and `createFx`'s
1140
+ `storageKey`:
1141
+
1142
+ ```tsx
1143
+ const preferences: PreferenceStore = {
1144
+ get: key => account.preferences.get(key), // undefined while not loaded yet: Desk uses this browser's copy
1145
+ set: (key, value) => account.preferences.set(key, value), // null forgets it
1146
+ subscribe: listener => account.preferences.onChange(listener), // a value arrived; listener(null) for any
1147
+ }
1148
+ <DeskShell preferences={preferences}>…</DeskShell>
1149
+ ```
1150
+
1151
+ `get` is synchronous, so a remote store keeps a local copy and calls `subscribe`'s listeners when the
1152
+ server's value arrives. The head script can only read localStorage, so Desk writes each of the store's
1153
+ values through to localStorage under the same key: the store is the truth, localStorage the copy the next
1154
+ first paint reads. `setPreferenceStore(store)` in the core entry does the same without React.
1155
+
1156
+ An app that **receives** its theme from a host, such as one in an `AppFrame` given a `theme`, does not
1157
+ choose it: the scheme, the look and the theme slot are neither offered nor applied, and only sounds stay.
1158
+ Desk finds this from the bridge once the first theme arrives; `themeFromHost` on the declaration says it
1159
+ outright. The app that is the theme's source keeps them all. If that leaves no section, the gear and the
1160
+ menu item go too.
1161
+
1162
+ The window ids are `settings` and `about`, and Desk draws and names those two (`settings` only for an app that declares settings without an `open` of its own). A Window menu's title function
1163
+ can name them with `appWindowTitle(GARAGE, id)`; `useDocumentTitle` already does. With a `host`, About and
1164
+ Settings… are published with the other menus, and the host owns ⌘, as it owns every `mod` shortcut, so
1165
+ they are in the native menu once and the key works once.
1166
+
890
1167
  ## Commands and the responder chain
891
1168
 
892
1169
  Some commands name no target — Copy, Close, Find. They go to whoever is responsible, the way AppKit's
@@ -1022,9 +1299,38 @@ import '@liberation-data/desk/css/overlays.css' // popovers, sheets, alerts, to
1022
1299
  import '@liberation-data/desk/css/conversation.css'
1023
1300
  import '@liberation-data/desk/css/search.css'
1024
1301
  import '@liberation-data/desk/css/setup.css' // the wizard and tours
1025
- import '@liberation-data/desk/css/apps.css' // app frames and dragging between windows
1302
+ import '@liberation-data/desk/css/apps.css' // app frames, About and Settings, and dragging between windows
1026
1303
  import '@liberation-data/desk/css/looks.css' // GNOME and Windows chrome: last, it restyles the rest
1027
- ``` Light and dark follow `prefers-color-scheme`, and `data-theme="light|dark"` on the root wins.
1304
+ ``` Light and dark follow `prefers-color-scheme`, and `data-theme="light|dark"` on the root wins. [Appearance](#appearance) lets
1305
+ the person choose, and sets it.
1306
+
1307
+ A workspace switcher's overview, where each workspace is a tile floating over a soft background, has
1308
+ three tokens of its own, so the background matches whichever theme is on without each theme writing one:
1309
+
1310
+ - `--desk-overview-fog`: the background's centre. By default the ground with 18% of the accent, moved a
1311
+ little toward mid grey so it reads as haze rather than as the desktop.
1312
+ - `--desk-overview-fog-far`: its edge, for a radial gradient from one to the other with no image. By
1313
+ default the fog 8% darker in light, 10% in dark.
1314
+ - `--desk-overview-shadow`: the tiles' shadow colour, for a tinted shadow drawn once rather than a
1315
+ `box-shadow` on a full-size layer. `rgb(0 0 0 / 0.28)` in light, `0.55` in dark.
1316
+
1317
+ The defaults are worked out in CSS from `--desk-ground` and `--desk-accent`, in every look. A theme may set
1318
+ any of them itself, and its value wins. In hosted mode they travel in the published theme like any other
1319
+ token, and the host's theme check takes them as plain colours.
1320
+
1321
+ In React, the hooks are the way to follow a change: `useLook()`, `useColorScheme()`, and in hosted mode the
1322
+ theme the provider wears, each re-render what reads them. Code outside React that draws its own pixels, such
1323
+ as a canvas, listens for `desk-themechange` on `document` instead. It fires once whenever the scheme or look
1324
+ drawn changes, whatever changed it: a host's theme (through Desk's handler or the app's own), the person's
1325
+ light, dark or system choice, the system flipping while the page follows it, or a change of look. A host's
1326
+ theme with new colours under the same scheme and look fires too, through Desk's handler; an app's own
1327
+ handler that sets colours repaints itself. Its `detail` is the scheme and look now drawn; `drawnTheme()`
1328
+ reads them at any time. Desk starts listening when a desk mounts or a theme is applied; a page with neither
1329
+ calls `watchThemeChanges()` to start it.
1330
+
1331
+ ```ts
1332
+ document.addEventListener('desk-themechange', event => repaint(event.detail)) // { scheme: 'light' | 'dark', look }
1333
+ ```
1028
1334
 
1029
1335
  ## Looks
1030
1336
 
@@ -1047,7 +1353,8 @@ are drawn: that is the look. It is separate from the theme, so every look comes
1047
1353
  `auto` reads the device: Macs, iPhones and iPads get `mac`, Windows gets `windows`, Linux and ChromeOS get
1048
1354
  `gnome`, and anything else gets `mac`. The look is set as `data-look` on the root, so menus and popovers
1049
1355
  portalled out of the desk get it too. The desk does not remember a choice: keep it where the app keeps its
1050
- other preferences and pass it back in, as the garage sample's Settings does.
1356
+ other preferences and pass it back in, as the garage sample's Settings does, or offer the `look` row of
1357
+ [Appearance](#appearance), which remembers it for you.
1051
1358
 
1052
1359
  A look changes chrome, not brand: it never touches `--desk-accent` or `--desk-ground`. Nor the keyboard —
1053
1360
  somebody on a Mac who picks the GNOME look still presses ⌘, and menus still say so. An app drawing chrome
@@ -1096,7 +1403,7 @@ npm install
1096
1403
  npm test # vitest
1097
1404
  npm run typecheck
1098
1405
  npm run example # the Garage sample in examples/garage
1099
- npm run size # the gzipped budget: core 16 KiB, react 76, css 22, fx 5
1406
+ npm run size # the budget, gzipped without comments: core 15 KiB, react 70.5, css 14, fx 4, host 7.5
1100
1407
  npm run check # everything CI runs
1101
1408
  npm run check:browser # the generated-app bridge in real Chrome, against a running sample
1102
1409
  npm run build # dist/
@@ -0,0 +1,222 @@
1
+ /** The protocol version. Every message carries it as `desk`, framed apps' messages included. */
2
+ export declare const DESK_PROTOCOL = 1;
3
+ /** The topic of the look every app wears: a `DeskTheme`. Only the primary may publish it. */
4
+ export declare const THEME_TOPIC = "theme";
5
+ /** One row of a menu a host draws. Plain data, so it can cross a process boundary. */
6
+ export interface HostMenuItem {
7
+ readonly type: 'item' | 'separator' | 'header';
8
+ /**
9
+ * Present on 'item'; unique within one publish. Opaque to a host, which only sends it back: it
10
+ * names the item's menu, place and label, so a choice from a menu that has since changed runs
11
+ * nothing rather than whatever took that place.
12
+ */
13
+ readonly id?: string;
14
+ /** Present on 'item' and 'header'. */
15
+ readonly label?: string;
16
+ readonly detail?: string;
17
+ /** In desk's format: 'mod+k', 'mod+alt+a', 'alt+]'. */
18
+ readonly shortcut?: string;
19
+ /**
20
+ * The page handles this item's shortcut itself, so a host draws it beside the item and gives it
21
+ * no key (Electron: `registerAccelerator: false`). Set on an action's shortcut, which the drawn
22
+ * bar only shows too: binding it as well would fire the action twice.
23
+ */
24
+ readonly showOnly?: boolean;
25
+ /** Defaults to true. */
26
+ readonly enabled?: boolean;
27
+ /** Absent means the item is not checkable. */
28
+ readonly checked?: boolean;
29
+ }
30
+ /** A whole menu as a host sees it. */
31
+ export interface HostMenu {
32
+ readonly id: string;
33
+ /** The menu's `label`: a host draws text, so a status menu's richer `title` stays behind. */
34
+ readonly label: string;
35
+ /** The app's own menu, which a `Menu` calls `emphasis`. */
36
+ readonly primary?: boolean;
37
+ /** One of the bar's status menus, which a host puts after the others. */
38
+ readonly status?: boolean;
39
+ readonly items: readonly HostMenuItem[];
40
+ }
41
+ /** One dock item as a host draws it: what the app's dock would show, as data. */
42
+ export interface HostDockItem {
43
+ readonly type: 'item';
44
+ /** Sent back in a `command` when the item is chosen. */
45
+ readonly id: string;
46
+ readonly label: string;
47
+ readonly description?: string;
48
+ /** An image URL or `data:` URI from the item's `image`; a host without one draws the label. */
49
+ readonly image?: string;
50
+ /** The badge as text; `''` for a badge that is not text, which a host draws as a dot. */
51
+ readonly badge?: string;
52
+ readonly disabled?: boolean;
53
+ readonly running: boolean;
54
+ readonly focused: boolean;
55
+ readonly minimized: boolean;
56
+ }
57
+ /** A dock stack as a host draws it: a folder of items that opens on the host's dock. */
58
+ export interface HostDockStack {
59
+ readonly type: 'stack';
60
+ readonly id: string;
61
+ readonly label: string;
62
+ readonly image?: string;
63
+ readonly items: readonly HostDockItem[];
64
+ }
65
+ /** One place on the dock a host draws. */
66
+ export type HostDockEntry = HostDockItem | HostDockStack | {
67
+ readonly type: 'separator';
68
+ readonly id: string;
69
+ };
70
+ /**
71
+ * A section of the app's Settings, for the host's one Settings, which lists each app's sections. Its
72
+ * controls are the app's and stay in the app: choosing one sends a `settings` command with its id, and
73
+ * the app opens its own Settings there.
74
+ */
75
+ export interface HostSettingsSection {
76
+ readonly id: string;
77
+ readonly title: string;
78
+ /** The heading it is listed under, as in a sidebar of sections. */
79
+ readonly group?: string;
80
+ /** As text; `''` for a badge that is not text. */
81
+ readonly badge?: string;
82
+ }
83
+ /** One fact of the app's About: what something is, and its value. */
84
+ export interface HostAboutFact {
85
+ readonly name: string;
86
+ readonly value: string;
87
+ /** Where to read more, shown with the fact as a link. Never copied. */
88
+ readonly link?: {
89
+ readonly label: string;
90
+ readonly url: string;
91
+ };
92
+ /** `false` keeps it out of what the host copies for a bug report. It is still shown. */
93
+ readonly copy?: false;
94
+ }
95
+ export interface HostAboutSection {
96
+ readonly title?: string;
97
+ readonly facts: readonly HostAboutFact[];
98
+ }
99
+ /**
100
+ * What the app says about itself, for its section of the host's one About. Its links, and its facts',
101
+ * are http(s), `mailto:` or on the app's origin (`checkChrome`); a host opens them in the system
102
+ * browser or mail app, or in a new window with `rel="noopener noreferrer"`, never in its own frame.
103
+ */
104
+ export interface HostAbout {
105
+ readonly name: string;
106
+ readonly version?: string;
107
+ readonly links: readonly {
108
+ readonly label: string;
109
+ readonly url: string;
110
+ }[];
111
+ /** A short line under the links, never copied: what this build can and cannot say. Text only. */
112
+ readonly note?: string;
113
+ /** Null while the app is still reading them; `[]` when there is nothing to report, and nothing to copy. */
114
+ readonly facts: readonly HostAboutSection[] | null;
115
+ }
116
+ /**
117
+ * Everything an app would draw around its desktop, for the host to draw instead. The host's frame has
118
+ * the one Settings and About: an app sends its sections and facts, and draws no gear and no About item
119
+ * of its own. Widgets are not in it: they stay on the app's desktop.
120
+ */
121
+ export interface DeskChrome {
122
+ readonly menus: readonly HostMenu[];
123
+ readonly dock: readonly HostDockEntry[];
124
+ /** Empty for an app with no settings; one entry with the id `''` for one whose Settings is a window of its own. */
125
+ readonly settings: readonly HostSettingsSection[];
126
+ /** Null for an app that declared nothing about itself. */
127
+ readonly about: HostAbout | null;
128
+ }
129
+ /** Who sent a broadcast, as the host stamped it. */
130
+ export interface BroadcastSender {
131
+ readonly id: string;
132
+ /** Present when the sender is the app whose theme every app wears. */
133
+ readonly role?: 'primary';
134
+ }
135
+ /**
136
+ * Whose broadcasts a subscription is for: an app's id, or `'primary'` for whichever app is the
137
+ * primary, so a subscriber need not change when the host makes another app primary.
138
+ */
139
+ export type Publisher = 'primary' | (string & {});
140
+ /** What a host's command is for: the app's menus, its dock, or its Settings. */
141
+ export type CommandTarget = 'menu' | 'dock' | 'settings';
142
+ /** What an app sends its host. Untrusted at the host's end: check it with `isAppToHost`. */
143
+ export type AppToHost = {
144
+ readonly desk: 1;
145
+ readonly kind: 'chrome';
146
+ readonly chrome: DeskChrome;
147
+ } | {
148
+ readonly desk: 1;
149
+ readonly kind: 'publish';
150
+ readonly topic: string;
151
+ readonly payload: unknown;
152
+ } | {
153
+ readonly desk: 1;
154
+ readonly kind: 'subscribe';
155
+ readonly publisher: Publisher;
156
+ readonly topic: string;
157
+ } | {
158
+ readonly desk: 1;
159
+ readonly kind: 'unsubscribe';
160
+ readonly publisher: Publisher;
161
+ readonly topic: string;
162
+ };
163
+ /** What a host sends an app: a choice from the chrome it draws, or another app's broadcast, stamped. */
164
+ export type HostToApp =
165
+ /** A menu item or dock item chosen by its id, or Settings opened at a section's id (`''` for the first). */
166
+ {
167
+ readonly desk: 1;
168
+ readonly kind: 'command';
169
+ readonly target: CommandTarget;
170
+ readonly id: string;
171
+ } | {
172
+ readonly desk: 1;
173
+ readonly kind: 'broadcast';
174
+ readonly from: BroadcastSender;
175
+ readonly topic: string;
176
+ readonly payload: unknown;
177
+ };
178
+ /**
179
+ * The app's end of the connection to its host. The host provides it — an Electron preload through
180
+ * `contextBridge`, a framed page through `postMessage` — as `globalThis.deskHost`.
181
+ */
182
+ export interface DeskHostBridge {
183
+ /** The protocol the host speaks. An app that does not speak it runs unhosted. */
184
+ readonly version: number;
185
+ send(message: AppToHost): void;
186
+ /** Calls the listener with each message from the host; returns an unsubscribe. */
187
+ onMessage(listener: (message: HostToApp) => void): () => void;
188
+ }
189
+ /** Whether `value` has a bridge's shape: `globalThis.deskHost` is set by code this page does not own. */
190
+ export declare function isDeskHostBridge(value: unknown): value is DeskHostBridge;
191
+ /** The host this page runs in, when one put a bridge that speaks this protocol on `globalThis.deskHost`; null otherwise. */
192
+ export declare function findDeskHost(): DeskHostBridge | null;
193
+ /** Whether a message from an app has the shape of one. A host checks before acting on it: the app is not trusted. */
194
+ export declare function isAppToHost(value: unknown): value is AppToHost;
195
+ /** Whether a message from a host has the shape of one. */
196
+ export declare function isHostToApp(value: unknown): value is HostToApp;
197
+ /** A broadcast as an app hears it. */
198
+ export interface Broadcast<T = unknown> {
199
+ readonly from: BroadcastSender;
200
+ readonly topic: string;
201
+ readonly payload: T;
202
+ }
203
+ /** The app's side of hosted mode, over a bridge: what it sends the host, and what it hears back. */
204
+ export interface HostClient {
205
+ readonly bridge: DeskHostBridge;
206
+ /** Replaces part of the chrome. Changes made in one task go to the host as one message. */
207
+ setChrome(part: Partial<DeskChrome>): void;
208
+ /** Calls the listener with the id of each menu item, dock item or Settings section the host says was chosen. */
209
+ onCommand(target: CommandTarget, listener: (id: string) => void): () => void;
210
+ /** Says something on a topic. The host passes it on only if this app may publish it. */
211
+ publish(topic: string, payload: unknown): void;
212
+ /**
213
+ * Hears `publisher`'s broadcasts on `topic` (`ride.*` takes a branch). The host replays the last
214
+ * one straight away, so an app that starts late still hears the current theme.
215
+ */
216
+ subscribe<T = unknown>(publisher: Publisher, topic: string, handler: (broadcast: Broadcast<T>) => void): () => void;
217
+ /** Stops listening, and takes the chrome away. */
218
+ close(): void;
219
+ }
220
+ /** Connects an app to its host over `bridge`. `DeskProvider` does this for a React app; a page without React calls it itself. */
221
+ export declare function connectHost(bridge: DeskHostBridge): HostClient;
222
+ //# sourceMappingURL=hosted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted.d.ts","sourceRoot":"","sources":["../../src/core/hosted.ts"],"names":[],"mappings":"AAoBA,gGAAgG;AAChG,eAAO,MAAM,aAAa,IAAI,CAAA;AAE9B,6FAA6F;AAC7F,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC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