@dxos/plugin-simple-layout 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe

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 (247) hide show
  1. package/dist/lib/browser/index.mjs +44 -58
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +44 -57
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/SimpleLayoutPlugin.d.ts +1 -1
  8. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
  9. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  10. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  11. package/dist/types/src/capabilities/index.d.ts +21 -6
  12. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  14. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  15. package/dist/types/src/capabilities/{react-root/react-root.d.ts → react-root.d.ts} +1 -1
  16. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  17. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  18. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  19. package/dist/types/src/capabilities/{spotlight-dismiss/spotlight-dismiss.d.ts → spotlight-dismiss.d.ts} +1 -1
  20. package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
  21. package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +2 -2
  22. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  23. package/dist/types/src/capabilities/url-handler.d.ts +12 -0
  24. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
  25. package/dist/types/src/components/ContentError.stories.d.ts +26 -15
  26. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
  28. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
  29. package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
  30. package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
  31. package/dist/types/src/components/Home/Home.d.ts.map +1 -1
  32. package/dist/types/src/components/Loading/Loading.d.ts +3 -0
  33. package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
  34. package/dist/types/src/components/{ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
  35. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
  36. package/dist/types/src/components/Loading/index.d.ts +2 -0
  37. package/dist/types/src/components/Loading/index.d.ts.map +1 -0
  38. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
  39. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
  40. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
  41. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
  42. package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
  43. package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
  44. package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
  45. package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
  46. package/dist/types/src/components/NavBranch/index.d.ts +2 -0
  47. package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
  48. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  49. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +24 -0
  50. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
  51. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +54 -0
  52. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
  53. package/dist/types/src/components/SimpleLayout/Drawer.d.ts +9 -0
  54. package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -0
  55. package/dist/types/src/components/SimpleLayout/Main.d.ts +1 -1
  56. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
  57. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +14 -6
  58. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
  59. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +31 -21
  60. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
  61. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
  62. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +26 -15
  63. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
  64. package/dist/types/src/components/SimpleLayout/index.d.ts +3 -0
  65. package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -1
  66. package/dist/types/src/components/hooks.d.ts +4 -2
  67. package/dist/types/src/components/hooks.d.ts.map +1 -1
  68. package/dist/types/src/components/index.d.ts +4 -2
  69. package/dist/types/src/components/index.d.ts.map +1 -1
  70. package/dist/types/src/hooks/actions.d.ts +19 -0
  71. package/dist/types/src/hooks/actions.d.ts.map +1 -0
  72. package/dist/types/src/hooks/index.d.ts +5 -0
  73. package/dist/types/src/hooks/index.d.ts.map +1 -1
  74. package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
  75. package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
  76. package/dist/types/src/hooks/useCompanions.d.ts +12 -0
  77. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
  78. package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
  79. package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
  80. package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
  81. package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
  82. package/dist/types/src/hooks/useSimpleLayoutState.d.ts +3 -3
  83. package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
  84. package/dist/types/src/operations/close.d.ts +5 -0
  85. package/dist/types/src/operations/close.d.ts.map +1 -0
  86. package/dist/types/src/operations/index.d.ts +3 -0
  87. package/dist/types/src/operations/index.d.ts.map +1 -0
  88. package/dist/types/src/operations/open.d.ts +5 -0
  89. package/dist/types/src/operations/open.d.ts.map +1 -0
  90. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  91. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  92. package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
  93. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  94. package/dist/types/src/operations/set.d.ts +5 -0
  95. package/dist/types/src/operations/set.d.ts.map +1 -0
  96. package/dist/types/src/operations/state-access.d.ts +8 -0
  97. package/dist/types/src/operations/state-access.d.ts.map +1 -0
  98. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  99. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  100. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  101. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  102. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  103. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  104. package/dist/types/src/operations/update-popover.d.ts +5 -0
  105. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  106. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  107. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  108. package/dist/types/src/translations.d.ts +26 -13
  109. package/dist/types/src/translations.d.ts.map +1 -1
  110. package/dist/types/src/types/capabilities.d.ts +18 -5
  111. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  112. package/dist/types/src/types/events.d.ts.map +1 -1
  113. package/dist/types/tsconfig.tsbuildinfo +1 -1
  114. package/package.json +46 -30
  115. package/src/SimpleLayoutPlugin.ts +24 -13
  116. package/src/capabilities/app-graph-builder.ts +21 -0
  117. package/src/capabilities/index.ts +13 -6
  118. package/src/capabilities/operation-handler.ts +14 -0
  119. package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +4 -4
  120. package/src/capabilities/react-surface.tsx +50 -0
  121. package/src/capabilities/{spotlight-dismiss/spotlight-dismiss.ts → spotlight-dismiss.ts} +2 -2
  122. package/src/capabilities/{state/state.tsx → state.tsx} +8 -5
  123. package/src/capabilities/url-handler.ts +161 -0
  124. package/src/components/ContentError.stories.tsx +8 -7
  125. package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
  126. package/src/components/DebugOverlay/index.ts +5 -0
  127. package/src/components/Dialog/Dialog.tsx +6 -6
  128. package/src/components/Home/Home.tsx +51 -43
  129. package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +5 -5
  130. package/src/components/{ContentLoading.tsx → Loading/Loading.tsx} +2 -2
  131. package/src/components/Loading/index.ts +5 -0
  132. package/src/components/MobileLayout/MobileLayout.stories.tsx +133 -0
  133. package/src/components/MobileLayout/MobileLayout.tsx +374 -0
  134. package/src/components/MobileLayout/index.ts +5 -0
  135. package/src/components/NavBranch/NavBranch.tsx +128 -0
  136. package/src/components/{Workspace → NavBranch}/index.ts +1 -1
  137. package/src/components/Popover/Popover.tsx +10 -9
  138. package/src/components/SimpleLayout/AppBar.stories.tsx +143 -0
  139. package/src/components/SimpleLayout/AppBar.tsx +94 -0
  140. package/src/components/SimpleLayout/Drawer.tsx +98 -0
  141. package/src/components/SimpleLayout/Main.tsx +45 -48
  142. package/src/components/SimpleLayout/NavBar.stories.tsx +131 -27
  143. package/src/components/SimpleLayout/NavBar.tsx +21 -62
  144. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +45 -55
  145. package/src/components/SimpleLayout/SimpleLayout.tsx +45 -7
  146. package/src/components/SimpleLayout/index.ts +3 -0
  147. package/src/components/hooks.ts +10 -14
  148. package/src/components/index.ts +4 -2
  149. package/src/hooks/actions.ts +84 -0
  150. package/src/hooks/index.ts +5 -0
  151. package/src/hooks/useAppBarProps.ts +115 -0
  152. package/src/hooks/useCompanions.ts +22 -0
  153. package/src/hooks/useDrawerActions.ts +100 -0
  154. package/src/hooks/useNavbarActions.ts +87 -0
  155. package/src/hooks/useSimpleLayoutState.ts +5 -5
  156. package/src/meta.ts +1 -1
  157. package/src/operations/close.ts +34 -0
  158. package/src/operations/index.ts +16 -0
  159. package/src/operations/open.ts +63 -0
  160. package/src/operations/revert-workspace.ts +22 -0
  161. package/src/operations/set-layout-mode.ts +12 -0
  162. package/src/operations/set.ts +23 -0
  163. package/src/operations/state-access.ts +19 -0
  164. package/src/operations/switch-workspace.ts +26 -0
  165. package/src/operations/update-complementary.ts +35 -0
  166. package/src/operations/update-dialog.ts +28 -0
  167. package/src/operations/update-popover.ts +35 -0
  168. package/src/operations/update-sidebar.ts +12 -0
  169. package/src/translations.ts +21 -13
  170. package/src/types/capabilities.ts +16 -7
  171. package/src/types/events.ts +3 -2
  172. package/dist/lib/browser/chunk-CLPGTNWJ.mjs +0 -29
  173. package/dist/lib/browser/chunk-CLPGTNWJ.mjs.map +0 -7
  174. package/dist/lib/browser/chunk-FK4M7GJV.mjs +0 -613
  175. package/dist/lib/browser/chunk-FK4M7GJV.mjs.map +0 -7
  176. package/dist/lib/browser/operation-resolver-LTB63NKP.mjs +0 -168
  177. package/dist/lib/browser/operation-resolver-LTB63NKP.mjs.map +0 -7
  178. package/dist/lib/browser/react-root-6ARAPH3O.mjs +0 -21
  179. package/dist/lib/browser/react-root-6ARAPH3O.mjs.map +0 -7
  180. package/dist/lib/browser/react-surface-SO7B23GS.mjs +0 -39
  181. package/dist/lib/browser/react-surface-SO7B23GS.mjs.map +0 -7
  182. package/dist/lib/browser/spotlight-dismiss-VSNOPETH.mjs +0 -66
  183. package/dist/lib/browser/spotlight-dismiss-VSNOPETH.mjs.map +0 -7
  184. package/dist/lib/browser/state-H4IGICBB.mjs +0 -45
  185. package/dist/lib/browser/state-H4IGICBB.mjs.map +0 -7
  186. package/dist/lib/browser/url-handler-7CFGTLNG.mjs +0 -54
  187. package/dist/lib/browser/url-handler-7CFGTLNG.mjs.map +0 -7
  188. package/dist/lib/node-esm/chunk-EGFZAVBD.mjs +0 -614
  189. package/dist/lib/node-esm/chunk-EGFZAVBD.mjs.map +0 -7
  190. package/dist/lib/node-esm/chunk-MUVVYBUE.mjs +0 -31
  191. package/dist/lib/node-esm/chunk-MUVVYBUE.mjs.map +0 -7
  192. package/dist/lib/node-esm/operation-resolver-7O6O7T4Q.mjs +0 -169
  193. package/dist/lib/node-esm/operation-resolver-7O6O7T4Q.mjs.map +0 -7
  194. package/dist/lib/node-esm/react-root-2CPA2ZUS.mjs +0 -22
  195. package/dist/lib/node-esm/react-root-2CPA2ZUS.mjs.map +0 -7
  196. package/dist/lib/node-esm/react-surface-FKAV56MO.mjs +0 -40
  197. package/dist/lib/node-esm/react-surface-FKAV56MO.mjs.map +0 -7
  198. package/dist/lib/node-esm/spotlight-dismiss-L5PCWIJG.mjs +0 -68
  199. package/dist/lib/node-esm/spotlight-dismiss-L5PCWIJG.mjs.map +0 -7
  200. package/dist/lib/node-esm/state-QIU2LMLT.mjs +0 -46
  201. package/dist/lib/node-esm/state-QIU2LMLT.mjs.map +0 -7
  202. package/dist/lib/node-esm/url-handler-4LYP3JM7.mjs +0 -55
  203. package/dist/lib/node-esm/url-handler-4LYP3JM7.mjs.map +0 -7
  204. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  205. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  206. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  207. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  208. package/dist/types/src/capabilities/react-root/index.d.ts +0 -6
  209. package/dist/types/src/capabilities/react-root/index.d.ts.map +0 -1
  210. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +0 -1
  211. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  212. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  213. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  214. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  215. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +0 -3
  216. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +0 -1
  217. package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +0 -1
  218. package/dist/types/src/capabilities/state/index.d.ts +0 -13
  219. package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
  220. package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
  221. package/dist/types/src/capabilities/url-handler/index.d.ts +0 -3
  222. package/dist/types/src/capabilities/url-handler/index.d.ts.map +0 -1
  223. package/dist/types/src/capabilities/url-handler/url-handler.d.ts +0 -10
  224. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +0 -1
  225. package/dist/types/src/components/ContentError.d.ts +0 -5
  226. package/dist/types/src/components/ContentError.d.ts.map +0 -1
  227. package/dist/types/src/components/ContentLoading.d.ts +0 -3
  228. package/dist/types/src/components/ContentLoading.d.ts.map +0 -1
  229. package/dist/types/src/components/ContentLoading.stories.d.ts.map +0 -1
  230. package/dist/types/src/components/SimpleLayout/Banner.d.ts +0 -8
  231. package/dist/types/src/components/SimpleLayout/Banner.d.ts.map +0 -1
  232. package/dist/types/src/components/Workspace/Workspace.d.ts +0 -9
  233. package/dist/types/src/components/Workspace/Workspace.d.ts.map +0 -1
  234. package/dist/types/src/components/Workspace/index.d.ts +0 -2
  235. package/dist/types/src/components/Workspace/index.d.ts.map +0 -1
  236. package/src/capabilities/operation-resolver/index.ts +0 -10
  237. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -178
  238. package/src/capabilities/react-root/index.ts +0 -7
  239. package/src/capabilities/react-surface/index.ts +0 -7
  240. package/src/capabilities/react-surface/react-surface.tsx +0 -40
  241. package/src/capabilities/spotlight-dismiss/index.ts +0 -7
  242. package/src/capabilities/state/index.ts +0 -9
  243. package/src/capabilities/url-handler/index.ts +0 -7
  244. package/src/capabilities/url-handler/url-handler.ts +0 -80
  245. package/src/components/ContentError.tsx +0 -23
  246. package/src/components/SimpleLayout/Banner.tsx +0 -82
  247. package/src/components/Workspace/Workspace.tsx +0 -115
@@ -2,13 +2,14 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { type ActivationEvent, Common } from '@dxos/app-framework';
5
+ import { type ActivationEvent } from '@dxos/app-framework';
6
+ import { AppActivationEvents } from '@dxos/app-toolkit';
6
7
 
7
8
  import { SimpleLayoutState } from './capabilities';
8
9
 
9
10
  export namespace SimpleLayoutEvents {
10
11
  /** Fired when SimpleLayoutState capability is ready. */
11
- export const StateReady: ActivationEvent.ActivationEvent = Common.ActivationEvent.createStateEvent(
12
+ export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
12
13
  SimpleLayoutState.identifier,
13
14
  );
14
15
  }
@@ -1,29 +0,0 @@
1
- // src/meta.ts
2
- import { trim } from "@dxos/util";
3
- var meta = {
4
- id: "dxos.org/plugin/simple-layout",
5
- name: "Simple Layout",
6
- description: trim`
7
- Minimal layout plugin for simplified UI contexts like popover windows.
8
- Provides basic content rendering without sidebars or complex navigation.
9
- `,
10
- icon: "ph--layout--regular"
11
- };
12
-
13
- // src/types/capabilities.ts
14
- import { Capability } from "@dxos/app-framework";
15
- var SimpleLayoutState = Capability.make(`${meta.id}/state`);
16
-
17
- // src/types/events.ts
18
- import { Common } from "@dxos/app-framework";
19
- (function(SimpleLayoutEvents2) {
20
- SimpleLayoutEvents2.StateReady = Common.ActivationEvent.createStateEvent(SimpleLayoutState.identifier);
21
- })(SimpleLayoutEvents || (SimpleLayoutEvents = {}));
22
- var SimpleLayoutEvents;
23
-
24
- export {
25
- meta,
26
- SimpleLayoutState,
27
- SimpleLayoutEvents
28
- };
29
- //# sourceMappingURL=chunk-CLPGTNWJ.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts", "../../../src/types/capabilities.ts", "../../../src/types/events.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/simple-layout',\n name: 'Simple Layout',\n description: trim`\n Minimal layout plugin for simplified UI contexts like popover windows.\n Provides basic content rendering without sidebars or complex navigation.\n `,\n icon: 'ph--layout--regular',\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\n\nimport { Capability } from '@dxos/app-framework';\nimport { type Label } from '@dxos/react-ui';\n\nimport { meta } from '../meta';\n\n// TODO(wittjosiah): Handle toasts.\nexport type SimpleLayoutState = {\n /** Data to be passed to the main content Surface. */\n content?: any;\n\n dialogOpen: boolean;\n dialogType?: 'default' | 'alert';\n dialogBlockAlign?: 'start' | 'center' | 'end';\n dialogOverlayClasses?: string;\n dialogOverlayStyle?: Record<string, any>;\n /** Data to be passed to the dialog Surface. */\n dialogContent?: any;\n\n popoverOpen?: boolean;\n popoverSide?: 'top' | 'right' | 'bottom' | 'left';\n popoverVariant?: 'virtual' | 'react';\n popoverAnchor?: HTMLButtonElement;\n popoverAnchorId?: string;\n popoverKind?: 'base' | 'card';\n popoverTitle?: Label;\n popoverContent?: any;\n\n workspace: string;\n previousWorkspace: string;\n active?: string;\n /** Stack of previously active item IDs for back navigation. */\n history: string[];\n\n /** Whether running in popover window context (hides mobile-specific UI). */\n isPopover?: boolean;\n};\n\nexport const SimpleLayoutState = Capability.make<Atom.Writable<SimpleLayoutState>>(`${meta.id}/state`);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ActivationEvent, Common } from '@dxos/app-framework';\n\nimport { SimpleLayoutState } from './capabilities';\n\nexport namespace SimpleLayoutEvents {\n /** Fired when SimpleLayoutState capability is ready. */\n export const StateReady: ActivationEvent.ActivationEvent = Common.ActivationEvent.createStateEvent(\n SimpleLayoutState.identifier,\n );\n}\n"],
5
- "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;AACR;;;ACTA,SAASC,kBAAkB;AAqCpB,IAAMC,oBAAoBC,WAAWC,KAAuC,GAAGC,KAAKC,EAAE,QAAQ;;;ACvCrG,SAA+BC,cAAc;UAI5BC,qBAAAA;sBAEFC,aAA8CC,OAAOC,gBAAgBC,iBAChFC,kBAAkBC,UAAU;AAEhC,GALiBN,uBAAAA,qBAAAA,CAAAA,EAAAA;;",
6
- "names": ["trim", "meta", "id", "name", "description", "trim", "icon", "Capability", "SimpleLayoutState", "Capability", "make", "meta", "id", "Common", "SimpleLayoutEvents", "StateReady", "Common", "ActivationEvent", "createStateEvent", "SimpleLayoutState", "identifier"]
7
- }
@@ -1,613 +0,0 @@
1
- import {
2
- SimpleLayoutState,
3
- meta
4
- } from "./chunk-CLPGTNWJ.mjs";
5
-
6
- // src/components/Home/Home.tsx
7
- import React, { useCallback, useEffect as useEffect2, useMemo, useRef } from "react";
8
- import { Common } from "@dxos/app-framework";
9
- import { useAppGraph as useAppGraph2, useOperationInvoker } from "@dxos/app-framework/react";
10
- import { Node, useConnections } from "@dxos/plugin-graph";
11
- import { Avatar, Icon, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
12
- import { Card, Layout, Mosaic } from "@dxos/react-ui-mosaic";
13
- import { SearchList, useSearchListItem, useSearchListResults } from "@dxos/react-ui-searchlist";
14
- import { mx } from "@dxos/ui-theme";
15
- import { byPosition } from "@dxos/util";
16
-
17
- // src/components/hooks.ts
18
- import { useEffect } from "react";
19
- import { useAppGraph } from "@dxos/app-framework/react";
20
- import { Graph } from "@dxos/plugin-graph";
21
- var useLoadDescendents = (nodeId) => {
22
- const { graph } = useAppGraph();
23
- useEffect(() => {
24
- const frame = requestAnimationFrame(() => {
25
- if (nodeId) {
26
- Graph.expand(graph, nodeId, "outbound");
27
- Graph.getConnections(graph, nodeId, "outbound").forEach((child) => {
28
- Graph.expand(graph, child.id, "outbound");
29
- });
30
- }
31
- });
32
- return () => cancelAnimationFrame(frame);
33
- }, [
34
- nodeId,
35
- graph
36
- ]);
37
- };
38
-
39
- // src/components/Home/Home.tsx
40
- var Home = (_) => {
41
- const { t } = useTranslation(meta.id);
42
- const userAccountItem = useItemsByDisposition("user-account")[0];
43
- const pinnedItems = useItemsByDisposition("pin-end", true);
44
- const workspaceItems = useItemsByDisposition("workspace");
45
- useLoadDescendents(Node.RootId);
46
- const items = useMemo(() => [
47
- ...userAccountItem ? [
48
- userAccountItem
49
- ] : [],
50
- ...pinnedItems,
51
- ...workspaceItems
52
- ], [
53
- userAccountItem,
54
- pinnedItems,
55
- workspaceItems
56
- ]);
57
- const { results, handleSearch } = useSearchListResults({
58
- items,
59
- extract: (node) => toLocalizedString(node.properties.label, t)
60
- });
61
- return /* @__PURE__ */ React.createElement(Layout.Main, {
62
- toolbar: true
63
- }, /* @__PURE__ */ React.createElement(SearchList.Root, {
64
- onSearch: handleSearch
65
- }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(SearchList.Input, {
66
- placeholder: t("search placeholder"),
67
- autoFocus: true
68
- })), /* @__PURE__ */ React.createElement(SearchList.Content, null, /* @__PURE__ */ React.createElement(Mosaic.Container, {
69
- asChild: true
70
- }, /* @__PURE__ */ React.createElement(Mosaic.Viewport, {
71
- padding: true
72
- }, /* @__PURE__ */ React.createElement(Mosaic.Stack, {
73
- items: results,
74
- getId: (node) => node.id,
75
- Tile: WorkspaceTile
76
- }))))));
77
- };
78
- var WorkspaceTile = ({ data }) => {
79
- const { t } = useTranslation(meta.id);
80
- const { invokePromise } = useOperationInvoker();
81
- const { selectedValue, registerItem, unregisterItem } = useSearchListItem();
82
- const ref = useRef(null);
83
- const handleSelect = useCallback(() => invokePromise(Common.LayoutOperation.SwitchWorkspace, {
84
- subject: data.id
85
- }), [
86
- invokePromise,
87
- data.id
88
- ]);
89
- useLoadDescendents(data.id);
90
- const name = toLocalizedString(data.properties.label, t);
91
- const isSelected = selectedValue === data.id;
92
- useEffect2(() => {
93
- if (ref.current) {
94
- registerItem(data.id, ref.current, handleSelect);
95
- }
96
- return () => unregisterItem(data.id);
97
- }, [
98
- data.id,
99
- handleSelect,
100
- registerItem,
101
- unregisterItem
102
- ]);
103
- useEffect2(() => {
104
- if (isSelected && ref.current) {
105
- ref.current.scrollIntoView({
106
- block: "nearest",
107
- behavior: "smooth"
108
- });
109
- }
110
- }, [
111
- isSelected
112
- ]);
113
- return /* @__PURE__ */ React.createElement(Card.Root, {
114
- ref,
115
- role: "button",
116
- fullWidth: true,
117
- tabIndex: -1,
118
- "data-selected": isSelected,
119
- classNames: mx("dx-focus-ring", isSelected && "bg-hoverOverlay"),
120
- onClick: handleSelect
121
- }, /* @__PURE__ */ React.createElement(Card.Toolbar, {
122
- density: "coarse"
123
- }, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement(Avatar.Content, {
124
- icon: data.properties.icon,
125
- hue: data.properties.hue,
126
- hueVariant: "transparent",
127
- variant: "square",
128
- size: 12,
129
- fallback: name
130
- }), /* @__PURE__ */ React.createElement(Avatar.Label, null, name), /* @__PURE__ */ React.createElement(Icon, {
131
- icon: "ph--caret-right--regular"
132
- }))));
133
- };
134
- var filterItems = (node, disposition) => {
135
- return node.properties.disposition === disposition;
136
- };
137
- var useItemsByDisposition = (disposition, sort = false) => {
138
- const { graph } = useAppGraph2();
139
- const connections = useConnections(graph, Node.RootId);
140
- const filtered = connections.filter((node) => filterItems(node, disposition));
141
- return sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
142
- };
143
-
144
- // src/components/SimpleLayout/SimpleLayout.tsx
145
- import React9 from "react";
146
-
147
- // src/components/Dialog/Dialog.tsx
148
- import React3 from "react";
149
- import { Surface } from "@dxos/app-framework/react";
150
- import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
151
-
152
- // src/hooks/useSimpleLayoutState.ts
153
- import { RegistryContext, useAtomValue } from "@effect-atom/atom-react";
154
- import { useCallback as useCallback2, useContext } from "react";
155
- import { useCapability } from "@dxos/app-framework/react";
156
- var useSimpleLayoutState = () => {
157
- const registry = useContext(RegistryContext);
158
- const stateAtom = useCapability(SimpleLayoutState);
159
- const state = useAtomValue(stateAtom);
160
- const updateState = useCallback2((fn) => {
161
- registry.set(stateAtom, fn(registry.get(stateAtom)));
162
- }, [
163
- registry,
164
- stateAtom
165
- ]);
166
- return {
167
- state,
168
- updateState
169
- };
170
- };
171
-
172
- // src/components/ContentError.tsx
173
- import React2 from "react";
174
- import { useTranslation as useTranslation2 } from "@dxos/react-ui";
175
- import { descriptionMessage, mx as mx2 } from "@dxos/ui-theme";
176
- var ContentError = ({ error }) => {
177
- const { t } = useTranslation2(meta.id);
178
- const errorString = error?.toString() ?? "";
179
- return /* @__PURE__ */ React2.createElement("div", {
180
- role: "none",
181
- className: "grid place-items-center overflow-y-auto attention-surface"
182
- }, /* @__PURE__ */ React2.createElement("p", {
183
- role: "alert",
184
- className: mx2(descriptionMessage, "p-2 break-all rounded-sm")
185
- }, error ? errorString : t("error fallback message")));
186
- };
187
-
188
- // src/components/Dialog/Dialog.tsx
189
- var Dialog = () => {
190
- const { state, updateState } = useSimpleLayoutState();
191
- const DialogRoot = state.dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
192
- const DialogOverlay = state.dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
193
- return /* @__PURE__ */ React3.createElement(DialogRoot, {
194
- modal: state.dialogBlockAlign !== "end",
195
- open: state.dialogOpen,
196
- onOpenChange: (nextOpen) => updateState((s) => ({
197
- ...s,
198
- dialogOpen: nextOpen
199
- }))
200
- }, state.dialogBlockAlign === "end" ? /* @__PURE__ */ React3.createElement(Surface, {
201
- role: "dialog",
202
- data: state.dialogContent,
203
- limit: 1,
204
- fallback: ContentError
205
- }) : /* @__PURE__ */ React3.createElement(DialogOverlay, {
206
- blockAlign: state.dialogBlockAlign,
207
- classNames: state.dialogOverlayClasses,
208
- style: state.dialogOverlayStyle
209
- }, /* @__PURE__ */ React3.createElement(Surface, {
210
- role: "dialog",
211
- data: state.dialogContent,
212
- limit: 1,
213
- fallback: ContentError
214
- })));
215
- };
216
-
217
- // src/components/Popover/Popover.tsx
218
- import { createContext } from "@radix-ui/react-context";
219
- import React4, { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState } from "react";
220
- import { Surface as Surface2 } from "@dxos/app-framework/react";
221
- import { Popover, toLocalizedString as toLocalizedString2, useTranslation as useTranslation3 } from "@dxos/react-ui";
222
- import { Card as Card2 } from "@dxos/react-ui-mosaic";
223
- var DEBOUNCE_DELAY = 40;
224
- var [LayoutPopoverProvider, useLayoutPopoverContext] = createContext("LayoutPopover");
225
- var PopoverRoot = ({ children }) => {
226
- const { state } = useSimpleLayoutState();
227
- const [open, setOpen] = useState(false);
228
- const virtualRef = useRef2(null);
229
- const [virtualIter, setVirtualIter] = useState(0);
230
- const debounceRef = useRef2(null);
231
- useEffect3(() => {
232
- setOpen(false);
233
- if (state.popoverOpen) {
234
- if (debounceRef.current) {
235
- clearTimeout(debounceRef.current);
236
- }
237
- if (state.popoverAnchor && virtualRef.current !== state.popoverAnchor) {
238
- virtualRef.current = state.popoverAnchor ?? null;
239
- setVirtualIter((iter) => iter + 1);
240
- }
241
- debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
242
- }
243
- }, [
244
- state.popoverOpen,
245
- state.popoverAnchorId,
246
- state.popoverAnchor,
247
- state.popoverContent
248
- ]);
249
- return /* @__PURE__ */ React4.createElement(LayoutPopoverProvider, {
250
- setOpen
251
- }, /* @__PURE__ */ React4.createElement(Popover.Root, {
252
- modal: false,
253
- open
254
- }, state.popoverAnchor && /* @__PURE__ */ React4.createElement(Popover.VirtualTrigger, {
255
- key: virtualIter,
256
- virtualRef
257
- }), children));
258
- };
259
- var PopoverContent = () => {
260
- const { t } = useTranslation3(meta.id);
261
- const { state, updateState } = useSimpleLayoutState();
262
- const { setOpen } = useLayoutPopoverContext("PopoverContent");
263
- const handleClose = useCallback3(() => {
264
- setOpen(false);
265
- updateState((s) => ({
266
- ...s,
267
- popoverOpen: false,
268
- popoverAnchor: void 0,
269
- popoverAnchorId: void 0,
270
- popoverSide: void 0
271
- }));
272
- }, [
273
- setOpen,
274
- updateState
275
- ]);
276
- const handleInteractOutside = useCallback3((event) => {
277
- if (
278
- // TODO(thure): CodeMirror should not focus itself when it updates.
279
- event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
280
- ) {
281
- event.preventDefault();
282
- } else {
283
- handleClose();
284
- }
285
- }, [
286
- handleClose
287
- ]);
288
- const collisionBoundaries = useMemo2(() => {
289
- const closest = state.popoverAnchor?.closest("[data-popover-collision-boundary]");
290
- return closest ? [
291
- closest
292
- ] : [];
293
- }, [
294
- state.popoverAnchor
295
- ]);
296
- return /* @__PURE__ */ React4.createElement(Popover.Portal, null, /* @__PURE__ */ React4.createElement(Popover.Content, {
297
- side: state.popoverSide,
298
- sticky: "always",
299
- hideWhenDetached: true,
300
- collisionBoundary: collisionBoundaries,
301
- onInteractOutside: handleInteractOutside,
302
- onEscapeKeyDown: handleInteractOutside
303
- }, /* @__PURE__ */ React4.createElement(Popover.Viewport, null, state.popoverKind === "card" && /* @__PURE__ */ React4.createElement(Card2.Root, null, /* @__PURE__ */ React4.createElement(Card2.Toolbar, null, /* @__PURE__ */ React4.createElement("span", null), state.popoverTitle ? /* @__PURE__ */ React4.createElement(Card2.Title, null, toLocalizedString2(state.popoverTitle, t)) : /* @__PURE__ */ React4.createElement("span", null), /* @__PURE__ */ React4.createElement(Card2.Close, {
304
- onClick: handleClose
305
- })), /* @__PURE__ */ React4.createElement(Surface2, {
306
- role: "card--content",
307
- data: state.popoverContent,
308
- limit: 1
309
- })), state.popoverKind === "base" && /* @__PURE__ */ React4.createElement(Surface2, {
310
- role: "popover",
311
- data: state.popoverContent,
312
- limit: 1
313
- })), /* @__PURE__ */ React4.createElement(Popover.Arrow, null)));
314
- };
315
-
316
- // src/components/SimpleLayout/Main.tsx
317
- import React8, { useCallback as useCallback5, useMemo as useMemo4 } from "react";
318
- import { Surface as Surface3, useAppGraph as useAppGraph5 } from "@dxos/app-framework/react";
319
- import { log } from "@dxos/log";
320
- import { useNode } from "@dxos/plugin-graph";
321
- import { Main as NaturalMain } from "@dxos/react-ui";
322
- import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/react-ui-attention";
323
- import { Mosaic as Mosaic2 } from "@dxos/react-ui-mosaic";
324
- import { mx as mx5 } from "@dxos/ui-theme";
325
-
326
- // src/components/ContentLoading.tsx
327
- import React5 from "react";
328
- var ContentLoading = () => {
329
- return /* @__PURE__ */ React5.createElement("div", {
330
- role: "none",
331
- className: "grid place-items-center attention-surface"
332
- });
333
- };
334
-
335
- // src/components/SimpleLayout/Banner.tsx
336
- import React6, { useCallback as useCallback4, useMemo as useMemo3 } from "react";
337
- import { Common as Common2 } from "@dxos/app-framework";
338
- import { useAppGraph as useAppGraph3, useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/react";
339
- import { Graph as Graph2, Node as Node2 } from "@dxos/plugin-graph";
340
- import { IconButton, Toolbar as Toolbar2, toLocalizedString as toLocalizedString3, useTranslation as useTranslation4 } from "@dxos/react-ui";
341
- import { mx as mx3, osTranslations } from "@dxos/ui-theme";
342
- var isWorkspaceOrCollectionChild = (graph, itemId) => {
343
- const parents = Graph2.getConnections(graph, itemId, "inbound");
344
- return parents.some((node) => node.properties.disposition === "workspace" || node.properties.disposition === "collection");
345
- };
346
- var Banner = ({ node, classNames }) => {
347
- const { t } = useTranslation4(meta.id);
348
- const { state } = useSimpleLayoutState();
349
- const { invokePromise } = useOperationInvoker2();
350
- const { graph } = useAppGraph3();
351
- const label = (node && toLocalizedString3(node.properties.label, t)) ?? t("current app name", {
352
- ns: osTranslations
353
- });
354
- const isTopLevelItem = useMemo3(() => {
355
- if (!state.active) {
356
- return false;
357
- }
358
- return isWorkspaceOrCollectionChild(graph, state.active);
359
- }, [
360
- graph,
361
- state.active
362
- ]);
363
- const handleClick = useCallback4(async () => {
364
- if (state.active) {
365
- if (state.history.length === 0 && isTopLevelItem) {
366
- await invokePromise(Common2.LayoutOperation.SwitchWorkspace, {
367
- subject: Node2.RootId
368
- });
369
- } else {
370
- await invokePromise(Common2.LayoutOperation.Close, {
371
- subject: [
372
- state.active
373
- ]
374
- });
375
- }
376
- } else {
377
- await invokePromise(Common2.LayoutOperation.SwitchWorkspace, {
378
- subject: Node2.RootId
379
- });
380
- }
381
- }, [
382
- invokePromise,
383
- state.active,
384
- state.history.length,
385
- isTopLevelItem
386
- ]);
387
- if (!node) {
388
- return null;
389
- }
390
- return /* @__PURE__ */ React6.createElement(Toolbar2.Root, {
391
- role: "banner",
392
- classNames: mx3("grid grid-cols-[var(--rail-size)_1fr_var(--rail-size)]", classNames)
393
- }, node.id !== Node2.RootId ? /* @__PURE__ */ React6.createElement(IconButton, {
394
- iconOnly: true,
395
- variant: "ghost",
396
- icon: "ph--caret-left--regular",
397
- label: t("back label"),
398
- onClick: handleClick
399
- }) : /* @__PURE__ */ React6.createElement("div", null), /* @__PURE__ */ React6.createElement("h1", {
400
- className: "grow text-center truncate font-medium"
401
- }, label), /* @__PURE__ */ React6.createElement(IconButton, {
402
- iconOnly: true,
403
- variant: "ghost",
404
- icon: "ph--dots-three-vertical--regular",
405
- label: t("menu label")
406
- }));
407
- };
408
-
409
- // src/components/SimpleLayout/NavBar.tsx
410
- import React7 from "react";
411
- import { useAppGraph as useAppGraph4 } from "@dxos/app-framework/react";
412
- import { Node as Node3, useActionRunner, useConnections as useConnections2 } from "@dxos/plugin-graph";
413
- import { IconButton as IconButton2, Toolbar as Toolbar3, Tooltip, useTranslation as useTranslation5 } from "@dxos/react-ui";
414
- import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
415
- import { mx as mx4 } from "@dxos/ui-theme";
416
- var NavBar = ({ classNames, activeId, onActiveIdChange }) => {
417
- const { t } = useTranslation5(meta.id);
418
- const { graph } = useAppGraph4();
419
- const runAction = useActionRunner();
420
- const connections = useConnections2(graph, Node3.RootId);
421
- const menuActions = connections.filter((node) => node.properties.disposition === "menu");
422
- const isBrowseActive = activeId !== "notifications" && activeId !== "profile";
423
- return /* @__PURE__ */ React7.createElement(Toolbar3.Root, {
424
- classNames: mx4("justify-center", classNames)
425
- }, /* @__PURE__ */ React7.createElement(MenuProvider, {
426
- onAction: runAction
427
- }, /* @__PURE__ */ React7.createElement(DropdownMenu.Root, {
428
- items: menuActions
429
- }, /* @__PURE__ */ React7.createElement(Tooltip.Trigger, {
430
- asChild: true,
431
- content: t("app menu label")
432
- }, /* @__PURE__ */ React7.createElement(DropdownMenu.Trigger, {
433
- asChild: true,
434
- "data-testid": "spacePlugin.addSpace"
435
- }, /* @__PURE__ */ React7.createElement(IconButton2, {
436
- icon: "ph--plus--regular",
437
- iconOnly: true,
438
- label: t("main menu label")
439
- }))))));
440
- };
441
-
442
- // src/components/SimpleLayout/Main.tsx
443
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-simple-layout/src/components/SimpleLayout/Main.tsx";
444
- var Main = () => {
445
- const { state } = useSimpleLayoutState();
446
- const id = state.active ?? state.workspace;
447
- const showNavBar = !state.isPopover;
448
- const { graph } = useAppGraph5();
449
- const node = useNode(graph, id);
450
- const placeholder = useMemo4(() => /* @__PURE__ */ React8.createElement(ContentLoading, null), []);
451
- const data = useMemo4(() => {
452
- const { variant } = parseEntryId(id);
453
- return node && {
454
- attendableId: id,
455
- subject: node.data,
456
- properties: node.properties,
457
- popoverAnchorId: state.popoverAnchorId,
458
- variant
459
- };
460
- }, [
461
- id,
462
- node,
463
- node?.data,
464
- node?.properties,
465
- state.popoverAnchorId
466
- ]);
467
- const handleActiveIdChange = useCallback5((nextActiveId) => {
468
- log.info("navigate", {
469
- nextActiveId
470
- }, {
471
- F: __dxlog_file,
472
- L: 48,
473
- S: void 0,
474
- C: (f, a) => f(...a)
475
- });
476
- }, []);
477
- return /* @__PURE__ */ React8.createElement(Mosaic2.Root, null, /* @__PURE__ */ React8.createElement(NaturalMain.Root, {
478
- complementarySidebarState: "closed",
479
- navigationSidebarState: "closed"
480
- }, /* @__PURE__ */ React8.createElement(NaturalMain.Content, {
481
- bounce: true,
482
- classNames: mx5("dx-mobile-main dx-mobile-main-scroll-area--flush", "grid bs-full overflow-hidden", showNavBar ? "grid-rows-[min-content_1fr_min-content]" : "grid-rows-[min-content_1fr]")
483
- }, /* @__PURE__ */ React8.createElement(Banner, {
484
- classNames: "border-be border-separator",
485
- node
486
- }), /* @__PURE__ */ React8.createElement("article", {
487
- className: "contents"
488
- }, /* @__PURE__ */ React8.createElement(Surface3, {
489
- key: id,
490
- role: "article",
491
- data,
492
- limit: 1,
493
- fallback: ContentError,
494
- placeholder
495
- })), showNavBar && /* @__PURE__ */ React8.createElement(NavBar, {
496
- classNames: "border-bs border-separator",
497
- activeId: id,
498
- onActiveIdChange: handleActiveIdChange
499
- }))));
500
- };
501
- var parseEntryId = (entryId) => {
502
- const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR);
503
- return {
504
- id,
505
- variant
506
- };
507
- };
508
- Main.displayName = "SimpleLayout.Main";
509
-
510
- // src/components/SimpleLayout/SimpleLayout.tsx
511
- var SimpleLayout = () => {
512
- return /* @__PURE__ */ React9.createElement(PopoverRoot, null, /* @__PURE__ */ React9.createElement(Main, null), /* @__PURE__ */ React9.createElement(Dialog, null), /* @__PURE__ */ React9.createElement(PopoverContent, null));
513
- };
514
-
515
- // src/components/Workspace/Workspace.tsx
516
- import React10, { useCallback as useCallback6, useEffect as useEffect4, useRef as useRef3 } from "react";
517
- import { Common as Common3 } from "@dxos/app-framework";
518
- import { useAppGraph as useAppGraph6, useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/react";
519
- import { useConnections as useConnections3 } from "@dxos/plugin-graph";
520
- import { Avatar as Avatar2, Icon as Icon2, Toolbar as Toolbar4, toLocalizedString as toLocalizedString4, useTranslation as useTranslation6 } from "@dxos/react-ui";
521
- import { Card as Card3, Layout as Layout2, Mosaic as Mosaic3 } from "@dxos/react-ui-mosaic";
522
- import { SearchList as SearchList2, useSearchListItem as useSearchListItem2, useSearchListResults as useSearchListResults2 } from "@dxos/react-ui-searchlist";
523
- import { mx as mx6 } from "@dxos/ui-theme";
524
- var Workspace = ({ id }) => {
525
- const { t } = useTranslation6(meta.id);
526
- const { graph } = useAppGraph6();
527
- useLoadDescendents(id);
528
- const children = useConnections3(graph, id, "outbound");
529
- const { results, handleSearch } = useSearchListResults2({
530
- items: children,
531
- extract: (child) => toLocalizedString4(child.properties.label, t)
532
- });
533
- return /* @__PURE__ */ React10.createElement(Layout2.Main, {
534
- toolbar: true
535
- }, /* @__PURE__ */ React10.createElement(SearchList2.Root, {
536
- onSearch: handleSearch
537
- }, /* @__PURE__ */ React10.createElement(Toolbar4.Root, null, /* @__PURE__ */ React10.createElement(SearchList2.Input, {
538
- placeholder: t("search placeholder"),
539
- autoFocus: true
540
- })), /* @__PURE__ */ React10.createElement(SearchList2.Content, null, /* @__PURE__ */ React10.createElement(Mosaic3.Container, {
541
- asChild: true
542
- }, /* @__PURE__ */ React10.createElement(Mosaic3.Viewport, {
543
- padding: true
544
- }, /* @__PURE__ */ React10.createElement(Mosaic3.Stack, {
545
- items: results,
546
- getId: (child) => child.id,
547
- Tile: WorkspaceChildTile
548
- }))))));
549
- };
550
- var WorkspaceChildTile = ({ data }) => {
551
- const { t } = useTranslation6(meta.id);
552
- const { invokeSync } = useOperationInvoker3();
553
- const ref = useRef3(null);
554
- const { selectedValue, registerItem, unregisterItem } = useSearchListItem2();
555
- const isSelected = selectedValue === data.id;
556
- const name = toLocalizedString4(data.properties.label, t);
557
- const handleSelect = useCallback6(() => invokeSync(Common3.LayoutOperation.Open, {
558
- subject: [
559
- data.id
560
- ]
561
- }), [
562
- invokeSync,
563
- data.id
564
- ]);
565
- useEffect4(() => {
566
- if (ref.current) {
567
- registerItem(data.id, ref.current, handleSelect);
568
- }
569
- return () => unregisterItem(data.id);
570
- }, [
571
- data.id,
572
- handleSelect,
573
- registerItem,
574
- unregisterItem
575
- ]);
576
- useEffect4(() => {
577
- if (isSelected && ref.current) {
578
- ref.current.scrollIntoView({
579
- block: "nearest",
580
- behavior: "smooth"
581
- });
582
- }
583
- }, [
584
- isSelected
585
- ]);
586
- return /* @__PURE__ */ React10.createElement(Card3.Root, {
587
- ref,
588
- role: "button",
589
- fullWidth: true,
590
- tabIndex: -1,
591
- "data-selected": isSelected,
592
- classNames: mx6("dx-focus-ring", isSelected && "bg-hoverOverlay"),
593
- onClick: handleSelect
594
- }, /* @__PURE__ */ React10.createElement(Card3.Toolbar, {
595
- density: "coarse"
596
- }, /* @__PURE__ */ React10.createElement(Avatar2.Root, null, /* @__PURE__ */ React10.createElement(Avatar2.Content, {
597
- hue: data.properties.hue,
598
- icon: data.properties.icon,
599
- hueVariant: "transparent",
600
- variant: "square",
601
- size: 12,
602
- fallback: name
603
- }), /* @__PURE__ */ React10.createElement(Avatar2.Label, null, name), /* @__PURE__ */ React10.createElement(Icon2, {
604
- icon: "ph--caret-right--regular"
605
- }))));
606
- };
607
-
608
- export {
609
- Home,
610
- SimpleLayout,
611
- Workspace
612
- };
613
- //# sourceMappingURL=chunk-FK4M7GJV.mjs.map