@dxos/plugin-simple-layout 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29

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 (299) hide show
  1. package/dist/lib/neutral/SimpleLayoutPlugin.mjs +52 -0
  2. package/dist/lib/neutral/SimpleLayoutPlugin.mjs.map +7 -0
  3. package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs +21 -0
  4. package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs.map +7 -0
  5. package/dist/lib/neutral/capabilities/index.mjs +21 -0
  6. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-7UDV3JDT.mjs +22 -0
  8. package/dist/lib/neutral/chunk-7UDV3JDT.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-AMTEDJHG.mjs +19 -0
  10. package/dist/lib/neutral/chunk-AMTEDJHG.mjs.map +7 -0
  11. package/dist/lib/neutral/chunk-FD2CAY4Q.mjs +26 -0
  12. package/dist/lib/neutral/chunk-FD2CAY4Q.mjs.map +7 -0
  13. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  14. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-XVUAQHKU.mjs +8 -0
  16. package/dist/lib/neutral/chunk-XVUAQHKU.mjs.map +7 -0
  17. package/dist/lib/neutral/close-WKMURGUB.mjs +35 -0
  18. package/dist/lib/neutral/close-WKMURGUB.mjs.map +7 -0
  19. package/dist/lib/neutral/components/index.mjs +924 -0
  20. package/dist/lib/neutral/components/index.mjs.map +7 -0
  21. package/dist/lib/neutral/hooks/index.mjs +332 -0
  22. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  23. package/dist/lib/neutral/index.mjs +14 -0
  24. package/dist/lib/neutral/index.mjs.map +7 -0
  25. package/dist/lib/neutral/meta.json +1 -0
  26. package/dist/lib/neutral/meta.mjs +8 -0
  27. package/dist/lib/neutral/meta.mjs.map +7 -0
  28. package/dist/lib/neutral/open-XI2T7D5O.mjs +49 -0
  29. package/dist/lib/neutral/open-XI2T7D5O.mjs.map +7 -0
  30. package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs +13 -0
  31. package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs.map +7 -0
  32. package/dist/lib/neutral/operations/index.mjs +8 -0
  33. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  34. package/dist/lib/neutral/plugin.mjs +16 -0
  35. package/dist/lib/neutral/plugin.mjs.map +7 -0
  36. package/dist/lib/{browser/react-root-MMB575WY.mjs → neutral/react-root-VE265VX4.mjs} +5 -8
  37. package/dist/lib/neutral/react-root-VE265VX4.mjs.map +7 -0
  38. package/dist/lib/{node-esm/react-surface-ITVNQYLG.mjs → neutral/react-surface-REZMYKQV.mjs} +20 -16
  39. package/dist/lib/neutral/react-surface-REZMYKQV.mjs.map +7 -0
  40. package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs +22 -0
  41. package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs.map +7 -0
  42. package/dist/lib/neutral/set-6ZRLWPJS.mjs +22 -0
  43. package/dist/lib/neutral/set-6ZRLWPJS.mjs.map +7 -0
  44. package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs +13 -0
  45. package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs.map +7 -0
  46. package/dist/lib/{browser/spotlight-dismiss-67PHYS5B.mjs → neutral/spotlight-dismiss-EIYW5E7M.mjs} +7 -15
  47. package/dist/lib/{node-esm/spotlight-dismiss-RMLRZUVY.mjs.map → neutral/spotlight-dismiss-EIYW5E7M.mjs.map} +3 -3
  48. package/dist/lib/{browser/state-A3PGDWWZ.mjs → neutral/state-7NXKBLPY.mjs} +5 -6
  49. package/dist/lib/neutral/state-7NXKBLPY.mjs.map +7 -0
  50. package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs +25 -0
  51. package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs.map +7 -0
  52. package/dist/lib/neutral/translations.mjs +36 -0
  53. package/dist/lib/neutral/translations.mjs.map +7 -0
  54. package/dist/lib/neutral/types/index.mjs +10 -0
  55. package/dist/lib/neutral/types/index.mjs.map +7 -0
  56. package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs +33 -0
  57. package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs.map +7 -0
  58. package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs +30 -0
  59. package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs.map +7 -0
  60. package/dist/lib/neutral/update-popover-REAKC2GN.mjs +34 -0
  61. package/dist/lib/neutral/update-popover-REAKC2GN.mjs.map +7 -0
  62. package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs +12 -0
  63. package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs.map +7 -0
  64. package/dist/lib/neutral/url-handler-GZXUUAHD.mjs +129 -0
  65. package/dist/lib/neutral/url-handler-GZXUUAHD.mjs.map +7 -0
  66. package/dist/types/src/SimpleLayoutPlugin.d.ts +2 -1
  67. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
  68. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  69. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/index.d.ts +21 -6
  71. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  72. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  73. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  74. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  76. package/dist/types/src/capabilities/{spotlight-dismiss/spotlight-dismiss.d.ts → spotlight-dismiss.d.ts} +1 -1
  77. package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
  78. package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +3 -3
  79. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  80. package/dist/types/src/capabilities/{url-handler/url-handler.d.ts → url-handler.d.ts} +3 -3
  81. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
  82. package/dist/types/src/components/ContentError.stories.d.ts +26 -19
  83. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
  84. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
  85. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
  86. package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
  87. package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
  88. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
  89. package/dist/types/src/components/Home/Home.d.ts.map +1 -1
  90. package/dist/types/src/components/Loading/Loading.d.ts +3 -0
  91. package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
  92. package/dist/types/src/components/{ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
  93. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
  94. package/dist/types/src/components/Loading/index.d.ts +2 -0
  95. package/dist/types/src/components/Loading/index.d.ts.map +1 -0
  96. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +2 -2
  97. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -1
  98. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
  100. package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
  101. package/dist/types/src/components/NavBranch/index.d.ts +2 -0
  102. package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
  103. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  104. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +5 -7
  105. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
  106. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +29 -22
  107. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -1
  108. package/dist/types/src/components/SimpleLayout/Drawer.d.ts +4 -7
  109. package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
  110. package/dist/types/src/components/SimpleLayout/Main.d.ts +4 -7
  111. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
  112. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +5 -7
  113. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
  114. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +29 -23
  115. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
  116. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
  117. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +26 -25
  118. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
  119. package/dist/types/src/components/hooks.d.ts +4 -2
  120. package/dist/types/src/components/hooks.d.ts.map +1 -1
  121. package/dist/types/src/components/index.d.ts +3 -2
  122. package/dist/types/src/components/index.d.ts.map +1 -1
  123. package/dist/types/src/hooks/actions.d.ts +5 -6
  124. package/dist/types/src/hooks/actions.d.ts.map +1 -1
  125. package/dist/types/src/hooks/useAppBarProps.d.ts +2 -2
  126. package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
  127. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
  128. package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -1
  129. package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -1
  130. package/dist/types/src/hooks/useSimpleLayoutState.d.ts +3 -3
  131. package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
  132. package/dist/types/src/index.d.ts +2 -1
  133. package/dist/types/src/index.d.ts.map +1 -1
  134. package/dist/types/src/meta.d.ts.map +1 -1
  135. package/dist/types/src/operations/close.d.ts +5 -0
  136. package/dist/types/src/operations/close.d.ts.map +1 -0
  137. package/dist/types/src/operations/index.d.ts +3 -0
  138. package/dist/types/src/operations/index.d.ts.map +1 -0
  139. package/dist/types/src/operations/open.d.ts +5 -0
  140. package/dist/types/src/operations/open.d.ts.map +1 -0
  141. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  142. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  143. package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
  144. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  145. package/dist/types/src/operations/set.d.ts +5 -0
  146. package/dist/types/src/operations/set.d.ts.map +1 -0
  147. package/dist/types/src/operations/state-access.d.ts +8 -0
  148. package/dist/types/src/operations/state-access.d.ts.map +1 -0
  149. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  150. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  151. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  152. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  153. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  154. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  155. package/dist/types/src/operations/update-popover.d.ts +5 -0
  156. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  157. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  158. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  159. package/dist/types/src/plugin.d.ts +4 -0
  160. package/dist/types/src/plugin.d.ts.map +1 -0
  161. package/dist/types/src/translations.d.ts +26 -20
  162. package/dist/types/src/translations.d.ts.map +1 -1
  163. package/dist/types/src/types/{capabilities.d.ts → SimpleLayoutCapabilities.d.ts} +12 -10
  164. package/dist/types/src/types/SimpleLayoutCapabilities.d.ts.map +1 -0
  165. package/dist/types/src/types/SimpleLayoutEvents.d.ts +4 -0
  166. package/dist/types/src/types/SimpleLayoutEvents.d.ts.map +1 -0
  167. package/dist/types/src/types/index.d.ts +2 -2
  168. package/dist/types/src/types/index.d.ts.map +1 -1
  169. package/dist/types/tsconfig.tsbuildinfo +1 -1
  170. package/package.json +87 -33
  171. package/src/SimpleLayoutPlugin.ts +18 -7
  172. package/src/capabilities/app-graph-builder.ts +21 -0
  173. package/src/capabilities/index.ts +13 -6
  174. package/src/capabilities/operation-handler.ts +14 -0
  175. package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +2 -2
  176. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +17 -8
  177. package/src/capabilities/{state/state.tsx → state.tsx} +5 -6
  178. package/src/capabilities/url-handler.ts +164 -0
  179. package/src/components/ContentError.stories.tsx +1 -1
  180. package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
  181. package/src/components/DebugOverlay/index.ts +5 -0
  182. package/src/components/Dialog/Dialog.tsx +14 -3
  183. package/src/components/Home/Home.tsx +32 -32
  184. package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +4 -4
  185. package/src/components/{ContentLoading.tsx → Loading/Loading.tsx} +2 -2
  186. package/src/components/Loading/index.ts +5 -0
  187. package/src/components/MobileLayout/MobileLayout.stories.tsx +21 -17
  188. package/src/components/MobileLayout/MobileLayout.tsx +118 -51
  189. package/src/components/{Workspace/Workspace.tsx → NavBranch/NavBranch.tsx} +40 -41
  190. package/src/components/{Workspace → NavBranch}/index.ts +1 -1
  191. package/src/components/Popover/Popover.tsx +10 -16
  192. package/src/components/SimpleLayout/AppBar.stories.tsx +10 -10
  193. package/src/components/SimpleLayout/AppBar.tsx +60 -60
  194. package/src/components/SimpleLayout/Drawer.tsx +30 -31
  195. package/src/components/SimpleLayout/Main.tsx +21 -26
  196. package/src/components/SimpleLayout/NavBar.stories.tsx +2 -2
  197. package/src/components/SimpleLayout/NavBar.tsx +8 -9
  198. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +46 -69
  199. package/src/components/SimpleLayout/SimpleLayout.tsx +33 -34
  200. package/src/components/hooks.ts +8 -8
  201. package/src/components/index.ts +3 -2
  202. package/src/hooks/actions.ts +18 -17
  203. package/src/hooks/useAppBarProps.ts +10 -31
  204. package/src/hooks/useDrawerActions.ts +14 -12
  205. package/src/hooks/useNavbarActions.ts +9 -8
  206. package/src/hooks/useSimpleLayoutState.ts +7 -5
  207. package/src/index.ts +2 -1
  208. package/src/meta.ts +2 -1
  209. package/src/operations/close.ts +34 -0
  210. package/src/operations/index.ts +16 -0
  211. package/src/operations/open.ts +63 -0
  212. package/src/operations/revert-workspace.ts +22 -0
  213. package/src/operations/set-layout-mode.ts +12 -0
  214. package/src/operations/set.ts +23 -0
  215. package/src/operations/state-access.ts +21 -0
  216. package/src/operations/switch-workspace.ts +26 -0
  217. package/src/operations/update-complementary.ts +35 -0
  218. package/src/operations/update-dialog.ts +28 -0
  219. package/src/operations/update-popover.ts +35 -0
  220. package/src/operations/update-sidebar.ts +12 -0
  221. package/src/plugin.ts +11 -0
  222. package/src/translations.ts +21 -19
  223. package/src/types/{capabilities.ts → SimpleLayoutCapabilities.ts} +6 -18
  224. package/src/types/SimpleLayoutEvents.ts +15 -0
  225. package/src/types/index.ts +2 -2
  226. package/dist/lib/browser/chunk-7VLT3S46.mjs +0 -29
  227. package/dist/lib/browser/chunk-7VLT3S46.mjs.map +0 -7
  228. package/dist/lib/browser/chunk-TMZNLVT2.mjs +0 -1170
  229. package/dist/lib/browser/chunk-TMZNLVT2.mjs.map +0 -7
  230. package/dist/lib/browser/index.mjs +0 -101
  231. package/dist/lib/browser/index.mjs.map +0 -7
  232. package/dist/lib/browser/meta.json +0 -1
  233. package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs +0 -205
  234. package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +0 -7
  235. package/dist/lib/browser/react-root-MMB575WY.mjs.map +0 -7
  236. package/dist/lib/browser/react-surface-M6CURANW.mjs +0 -41
  237. package/dist/lib/browser/react-surface-M6CURANW.mjs.map +0 -7
  238. package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +0 -7
  239. package/dist/lib/browser/state-A3PGDWWZ.mjs.map +0 -7
  240. package/dist/lib/browser/url-handler-HTIUY6WL.mjs +0 -152
  241. package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-FLOYBAHE.mjs +0 -1171
  243. package/dist/lib/node-esm/chunk-FLOYBAHE.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-VIDE5UMB.mjs +0 -31
  245. package/dist/lib/node-esm/chunk-VIDE5UMB.mjs.map +0 -7
  246. package/dist/lib/node-esm/index.mjs +0 -102
  247. package/dist/lib/node-esm/index.mjs.map +0 -7
  248. package/dist/lib/node-esm/meta.json +0 -1
  249. package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs +0 -206
  250. package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +0 -7
  251. package/dist/lib/node-esm/react-root-ENZKVSY4.mjs +0 -22
  252. package/dist/lib/node-esm/react-root-ENZKVSY4.mjs.map +0 -7
  253. package/dist/lib/node-esm/react-surface-ITVNQYLG.mjs.map +0 -7
  254. package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +0 -68
  255. package/dist/lib/node-esm/state-ZCFZTTPL.mjs +0 -49
  256. package/dist/lib/node-esm/state-ZCFZTTPL.mjs.map +0 -7
  257. package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs +0 -153
  258. package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs.map +0 -7
  259. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  260. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  261. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  262. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  263. package/dist/types/src/capabilities/react-root/index.d.ts +0 -6
  264. package/dist/types/src/capabilities/react-root/index.d.ts.map +0 -1
  265. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +0 -1
  266. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  267. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  268. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  269. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +0 -3
  270. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +0 -1
  271. package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +0 -1
  272. package/dist/types/src/capabilities/state/index.d.ts +0 -13
  273. package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
  274. package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
  275. package/dist/types/src/capabilities/url-handler/index.d.ts +0 -3
  276. package/dist/types/src/capabilities/url-handler/index.d.ts.map +0 -1
  277. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +0 -1
  278. package/dist/types/src/components/ContentLoading.d.ts +0 -3
  279. package/dist/types/src/components/ContentLoading.d.ts.map +0 -1
  280. package/dist/types/src/components/ContentLoading.stories.d.ts.map +0 -1
  281. package/dist/types/src/components/Workspace/Workspace.d.ts +0 -11
  282. package/dist/types/src/components/Workspace/Workspace.d.ts.map +0 -1
  283. package/dist/types/src/components/Workspace/index.d.ts +0 -2
  284. package/dist/types/src/components/Workspace/index.d.ts.map +0 -1
  285. package/dist/types/src/types/capabilities.d.ts.map +0 -1
  286. package/dist/types/src/types/events.d.ts +0 -6
  287. package/dist/types/src/types/events.d.ts.map +0 -1
  288. package/src/capabilities/operation-resolver/index.ts +0 -10
  289. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -217
  290. package/src/capabilities/react-root/index.ts +0 -7
  291. package/src/capabilities/react-surface/index.ts +0 -7
  292. package/src/capabilities/spotlight-dismiss/index.ts +0 -7
  293. package/src/capabilities/state/index.ts +0 -9
  294. package/src/capabilities/url-handler/index.ts +0 -7
  295. package/src/capabilities/url-handler/url-handler.ts +0 -157
  296. package/src/types/events.ts +0 -15
  297. /package/dist/types/src/capabilities/{react-root/react-root.d.ts → react-root.d.ts} +0 -0
  298. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  299. /package/src/capabilities/{spotlight-dismiss/spotlight-dismiss.ts → spotlight-dismiss.ts} +0 -0
@@ -1,1171 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- SimpleLayoutState,
4
- meta
5
- } from "./chunk-VIDE5UMB.mjs";
6
-
7
- // src/components/Home/Home.tsx
8
- import React, { useCallback, useEffect as useEffect2, useMemo, useRef } from "react";
9
- import { useOperationInvoker } from "@dxos/app-framework/ui";
10
- import { LayoutOperation } from "@dxos/app-toolkit";
11
- import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
12
- import { Node, useConnections } from "@dxos/plugin-graph";
13
- import { Avatar, Icon, Panel, ScrollArea, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
14
- import { Card } from "@dxos/react-ui";
15
- import { Mosaic } from "@dxos/react-ui-mosaic";
16
- import { SearchList, useSearchListItem, useSearchListResults } from "@dxos/react-ui-searchlist";
17
- import { mx } from "@dxos/ui-theme";
18
- import { byPosition } from "@dxos/util";
19
-
20
- // src/components/hooks.ts
21
- import { useEffect } from "react";
22
- import { useAppGraph } from "@dxos/app-toolkit/ui";
23
- import { Graph } from "@dxos/plugin-graph";
24
- var useLoadDescendents = (nodeId) => {
25
- const { graph } = useAppGraph();
26
- useEffect(() => {
27
- if (nodeId) {
28
- Graph.expand(graph, nodeId, "child");
29
- Graph.getConnections(graph, nodeId, "child").forEach((child) => {
30
- Graph.expand(graph, child.id, "child");
31
- });
32
- }
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(SearchList.Root, {
62
- onSearch: handleSearch
63
- }, /* @__PURE__ */ React.createElement(Panel.Root, null, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
64
- asChild: true
65
- }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(SearchList.Input, {
66
- placeholder: t("search placeholder"),
67
- autoFocus: true
68
- }))), /* @__PURE__ */ React.createElement(Panel.Content, {
69
- asChild: true
70
- }, /* @__PURE__ */ React.createElement(SearchList.Content, null, /* @__PURE__ */ React.createElement(Mosaic.Container, {
71
- asChild: true
72
- }, /* @__PURE__ */ React.createElement(ScrollArea.Root, {
73
- orientation: "vertical"
74
- }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
75
- classNames: "p-2"
76
- }, /* @__PURE__ */ React.createElement(Mosaic.Stack, {
77
- items: results,
78
- getId: (node) => node.id,
79
- Tile: WorkspaceTile
80
- }))))))));
81
- };
82
- var WorkspaceTile = (props) => {
83
- const data = props.data;
84
- const { t } = useTranslation(meta.id);
85
- const { invokePromise } = useOperationInvoker();
86
- const { selectedValue, registerItem, unregisterItem } = useSearchListItem();
87
- const name = toLocalizedString(data.properties.label, t);
88
- const isSelected = selectedValue === data.id;
89
- const cardRef = useRef(null);
90
- useLoadDescendents(data.id);
91
- const handleSelect = useCallback(() => invokePromise(LayoutOperation.SwitchWorkspace, {
92
- subject: data.id
93
- }), [
94
- invokePromise,
95
- data.id
96
- ]);
97
- useEffect2(() => {
98
- if (cardRef.current) {
99
- registerItem(data.id, cardRef.current, handleSelect);
100
- }
101
- return () => unregisterItem(data.id);
102
- }, [
103
- data.id,
104
- handleSelect,
105
- registerItem,
106
- unregisterItem
107
- ]);
108
- useEffect2(() => {
109
- if (isSelected && cardRef.current) {
110
- cardRef.current.scrollIntoView({
111
- block: "nearest",
112
- behavior: "smooth"
113
- });
114
- }
115
- }, [
116
- isSelected
117
- ]);
118
- return /* @__PURE__ */ React.createElement(Card.Root, {
119
- role: "button",
120
- fullWidth: true,
121
- tabIndex: -1,
122
- "data-selected": isSelected,
123
- classNames: mx("dx-focus-ring", isSelected && "bg-hover-overlay"),
124
- onClick: handleSelect,
125
- ref: cardRef
126
- }, /* @__PURE__ */ React.createElement(Card.Toolbar, {
127
- density: "coarse"
128
- }, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement(Avatar.Content, {
129
- icon: data.properties.icon,
130
- hue: data.properties.hue,
131
- hueVariant: "transparent",
132
- variant: "square",
133
- size: 12,
134
- fallback: name
135
- }), /* @__PURE__ */ React.createElement(Avatar.Label, null, name), /* @__PURE__ */ React.createElement(Icon, {
136
- icon: "ph--caret-right--regular"
137
- }))));
138
- };
139
- var filterItems = (node, disposition) => {
140
- return node.properties.disposition === disposition;
141
- };
142
- var useItemsByDisposition = (disposition, sort = false) => {
143
- const { graph } = useAppGraph2();
144
- const connections = useConnections(graph, Node.RootId, "child");
145
- const filtered = connections.filter((node) => filterItems(node, disposition));
146
- return sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
147
- };
148
-
149
- // src/components/SimpleLayout/SimpleLayout.tsx
150
- import React11, { useEffect as useEffect6, useRef as useRef4, useState as useState3 } from "react";
151
- import { Splitter } from "@dxos/react-ui";
152
- import { Mosaic as Mosaic3 } from "@dxos/react-ui-mosaic";
153
-
154
- // src/hooks/useAppBarProps.ts
155
- import { Atom, useAtomValue } from "@effect-atom/atom-react";
156
- import * as Effect from "effect/Effect";
157
- import * as Option from "effect/Option";
158
- import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
159
- import { useCapability, useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/ui";
160
- import { LayoutOperation as LayoutOperation2 } from "@dxos/app-toolkit";
161
- import { useAppGraph as useAppGraph3 } from "@dxos/app-toolkit/ui";
162
- import { Graph as Graph2, Node as Node2, useActionRunner, useNode } from "@dxos/plugin-graph";
163
- import { toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
164
- var useAppBarProps = () => {
165
- const { t } = useTranslation2(meta.id);
166
- const stateAtom = useCapability(SimpleLayoutState);
167
- const state = useAtomValue(stateAtom);
168
- const { graph } = useAppGraph3();
169
- const { invokeSync } = useOperationInvoker2();
170
- const runAction = useActionRunner();
171
- const activeId = state.active ?? state.workspace;
172
- const node = useNode(graph, activeId);
173
- const title = node ? toLocalizedString2(node.properties.label, t) : void 0;
174
- const actionsAtom = useMemo2(() => Atom.make((get) => {
175
- const state2 = get(stateAtom);
176
- const activeId2 = state2.active ?? state2.workspace;
177
- const allActions = activeId2 ? get(graph.actions(activeId2)) : [];
178
- const filtered = allActions.filter((action) => [
179
- "list-item",
180
- "list-item-primary",
181
- "heading-list-item"
182
- ].includes(action.properties.disposition));
183
- const nodes = filtered;
184
- const edges = filtered.map((action) => ({
185
- source: "root",
186
- target: action.id,
187
- relation: "child"
188
- }));
189
- const workspaceConnections = state2.workspace ? get(graph.connections(state2.workspace, "child")) : [];
190
- const alternateTreeNode = workspaceConnections.find((node2) => node2.properties.disposition === "alternate-tree");
191
- if (alternateTreeNode && activeId2 !== alternateTreeNode.id) {
192
- const settingsAction = {
193
- id: `appbar-settings-${alternateTreeNode.id}`,
194
- type: Node2.ActionType,
195
- data: () => Effect.sync(() => invokeSync(LayoutOperation2.Open, {
196
- subject: [
197
- alternateTreeNode.id
198
- ]
199
- })),
200
- properties: {
201
- label: alternateTreeNode.properties.label ?? alternateTreeNode.id,
202
- icon: alternateTreeNode.properties.icon ?? "ph--placeholder--regular"
203
- }
204
- };
205
- nodes.push(settingsAction);
206
- edges.push({
207
- source: "root",
208
- target: settingsAction.id,
209
- relation: "child"
210
- });
211
- }
212
- return {
213
- nodes,
214
- edges
215
- };
216
- }), [
217
- graph,
218
- stateAtom
219
- ]);
220
- const showBackButton = activeId !== void 0 && activeId !== Node2.RootId;
221
- const onBack = useCallback2(() => {
222
- if (state.active) {
223
- const isWorkspace = Graph2.getNode(graph, state.active).pipe(Option.map((node2) => node2.properties.disposition === "workspace"), Option.getOrElse(() => false));
224
- if (state.history.length === 0 && isWorkspace) {
225
- invokeSync(LayoutOperation2.SwitchWorkspace, {
226
- subject: Node2.RootId
227
- });
228
- } else {
229
- invokeSync(LayoutOperation2.Close, {
230
- subject: [
231
- state.active
232
- ]
233
- });
234
- }
235
- } else {
236
- invokeSync(LayoutOperation2.SwitchWorkspace, {
237
- subject: Node2.RootId
238
- });
239
- }
240
- }, [
241
- graph,
242
- invokeSync,
243
- state.active,
244
- state.history.length
245
- ]);
246
- const popoverAnchorId = node && state.popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? state.popoverAnchorId : void 0;
247
- return {
248
- title,
249
- actions: actionsAtom,
250
- showBackButton,
251
- popoverAnchorId,
252
- onBack,
253
- onAction: runAction
254
- };
255
- };
256
-
257
- // src/hooks/useCompanions.ts
258
- import { useMemo as useMemo3 } from "react";
259
- import { useAppGraph as useAppGraph4 } from "@dxos/app-toolkit/ui";
260
- import { useConnections as useConnections2 } from "@dxos/plugin-graph";
261
- import { byPosition as byPosition3 } from "@dxos/util";
262
-
263
- // src/hooks/actions.ts
264
- import * as Effect2 from "effect/Effect";
265
- import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
266
- import { Node as Node3 } from "@dxos/plugin-graph";
267
- import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/react-ui-attention";
268
- import { byPosition as byPosition2 } from "@dxos/util";
269
- var PLANK_COMPANION_TYPE = "dxos.org/plugin/deck/plank-companion";
270
- var createCompanionActions = (graph, stateAtom, get, config) => {
271
- const { idPrefix, selectedVariant, invokeSync } = config;
272
- const state = get(stateAtom);
273
- const activeId = state.active ?? state.workspace;
274
- const activeConnections = activeId ? get(graph.connections(activeId, "child")) : [];
275
- const companions = activeConnections.filter((node) => node.type === PLANK_COMPANION_TYPE).toSorted((a, b) => byPosition2(a.properties, b.properties));
276
- const nodes = [];
277
- const edges = [];
278
- companions.forEach((companion) => {
279
- const [, companionVariant] = companion.id.split(ATTENDABLE_PATH_SEPARATOR);
280
- const companionAction = {
281
- id: `${idPrefix}-companion-${companion.id}`,
282
- type: Node3.ActionType,
283
- properties: {
284
- icon: companion.properties.icon ?? "ph--placeholder--regular",
285
- label: companion.properties.label,
286
- iconOnly: true,
287
- // Conditionally add variant highlighting.
288
- ...selectedVariant !== void 0 && {
289
- variant: selectedVariant === companionVariant ? "primary" : "ghost"
290
- }
291
- },
292
- data: () => Effect2.sync(() => invokeSync(LayoutOperation3.Open, {
293
- subject: [
294
- companion.id
295
- ]
296
- }))
297
- };
298
- nodes.push(companionAction);
299
- edges.push({
300
- source: "root",
301
- target: companionAction.id,
302
- relation: "child"
303
- });
304
- });
305
- return {
306
- nodes,
307
- edges
308
- };
309
- };
310
-
311
- // src/hooks/useCompanions.ts
312
- var useCompanions = (nodeId) => {
313
- const { graph } = useAppGraph4();
314
- const nodes = useConnections2(graph, nodeId, "child");
315
- const companions = nodes.filter((node) => node.type === PLANK_COMPANION_TYPE);
316
- return useMemo3(() => companions.toSorted((a, b) => byPosition3(a.properties, b.properties)), [
317
- companions
318
- ]);
319
- };
320
-
321
- // src/hooks/useDrawerActions.ts
322
- import { Atom as Atom2 } from "@effect-atom/atom-react";
323
- import * as Effect3 from "effect/Effect";
324
- import { useMemo as useMemo6 } from "react";
325
- import { useCapability as useCapability3, useOperationInvoker as useOperationInvoker4 } from "@dxos/app-framework/ui";
326
- import { useAppGraph as useAppGraph7 } from "@dxos/app-toolkit/ui";
327
- import { Node as Node4, useActionRunner as useActionRunner2 } from "@dxos/plugin-graph";
328
- import { useTranslation as useTranslation6 } from "@dxos/react-ui";
329
- import { createGapSeparator } from "@dxos/react-ui-menu";
330
-
331
- // src/components/ContentLoading.tsx
332
- import React2 from "react";
333
- var ContentLoading = () => {
334
- return /* @__PURE__ */ React2.createElement("div", {
335
- role: "none",
336
- className: "grid place-items-center dx-attention-surface"
337
- });
338
- };
339
-
340
- // src/components/MobileLayout/MobileLayout.tsx
341
- import { createContext } from "@radix-ui/react-context";
342
- import React3, { forwardRef, useEffect as useEffect3, useState } from "react";
343
- import { addEventListener, combine } from "@dxos/async";
344
- import { log } from "@dxos/log";
345
- import { mx as mx2 } from "@dxos/ui-theme";
346
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-simple-layout/src/components/MobileLayout/MobileLayout.tsx";
347
- var MOBILE_LAYOUT_NAME = "MobileLayout";
348
- var MOBILE_LAYOUT_ROOT_NAME = "MobileLayout.Root";
349
- var MOBILE_LAYOUT_PANEL_NAME = "MobileLayout.Panel";
350
- var [MobileLayoutProvider, useMobileLayout] = createContext(MOBILE_LAYOUT_NAME);
351
- var MobileLayoutRoot = /* @__PURE__ */ forwardRef(({ classNames, children, transition = 250, onKeyboardOpenChange, ...props }, forwardedRef) => {
352
- const { open: keyboardOpen } = useIOSKeyboard();
353
- useAutoScroll();
354
- useEffect3(() => onKeyboardOpenChange?.(keyboardOpen), [
355
- onKeyboardOpenChange,
356
- keyboardOpen
357
- ]);
358
- useLockBodyScroll(keyboardOpen);
359
- return /* @__PURE__ */ React3.createElement(MobileLayoutProvider, {
360
- keyboardOpen
361
- }, /* @__PURE__ */ React3.createElement("div", {
362
- ...props,
363
- role: "none",
364
- style: {
365
- transition: `h-size ${transition}ms ease-out`,
366
- blockSize: "calc(100vh - var(--kb-height, 0px))"
367
- },
368
- className: mx2("absolute top-0 left-0 right-0 flex flex-col", classNames),
369
- ref: forwardedRef
370
- }, children));
371
- });
372
- MobileLayoutRoot.displayName = MOBILE_LAYOUT_ROOT_NAME;
373
- var MobileLayoutPanel = /* @__PURE__ */ forwardRef(({ classNames, children, safe, ...props }, forwardedRef) => {
374
- return /* @__PURE__ */ React3.createElement("div", {
375
- ...props,
376
- role: "none",
377
- style: {
378
- paddingTop: safe?.top ? "env(safe-area-inset-top)" : void 0,
379
- paddingBottom: safe?.bottom ? `calc((1 - var(--kb-open, 0)) * env(safe-area-inset-bottom))` : void 0
380
- },
381
- className: mx2("relative h-full flex flex-col overflow-hidden", classNames),
382
- ref: forwardedRef
383
- }, children);
384
- });
385
- MobileLayoutPanel.displayName = MOBILE_LAYOUT_PANEL_NAME;
386
- var MobileLayout = {
387
- Root: MobileLayoutRoot,
388
- Panel: MobileLayoutPanel
389
- };
390
- var useAutoScroll = () => {
391
- useEffect3(() => {
392
- return addEventListener(
393
- document,
394
- "focus",
395
- (event) => {
396
- const target = event.target;
397
- if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "DIV" && target.isContentEditable) {
398
- event.preventDefault();
399
- target.focus({
400
- preventScroll: true
401
- });
402
- const scrollX = window.scrollX;
403
- const scrollY = window.scrollY;
404
- requestAnimationFrame(() => {
405
- window.scrollTo(scrollX, scrollY);
406
- });
407
- }
408
- },
409
- // Important: focus events don't bubble, so capture phase is required.
410
- {
411
- capture: true
412
- }
413
- );
414
- }, []);
415
- };
416
- var useLockBodyScroll = (enabled) => {
417
- useEffect3(() => {
418
- if (!enabled) {
419
- return;
420
- }
421
- const isScrollable = (el, axis) => {
422
- while (el && el !== document.body) {
423
- const style = getComputedStyle(el);
424
- if (axis === "y") {
425
- const overflow = style.overflowY;
426
- if ((overflow === "auto" || overflow === "scroll") && el.scrollHeight > el.clientHeight) {
427
- return true;
428
- }
429
- } else {
430
- const overflow = style.overflowX;
431
- if ((overflow === "auto" || overflow === "scroll") && el.scrollWidth > el.clientWidth) {
432
- return true;
433
- }
434
- }
435
- el = el.parentElement;
436
- }
437
- return false;
438
- };
439
- let touchStartX = 0;
440
- let touchStartY = 0;
441
- return combine(
442
- // Record initial touch position.
443
- addEventListener(document, "touchstart", (event) => {
444
- const touch = event.touches[0];
445
- touchStartX = touch.clientX;
446
- touchStartY = touch.clientY;
447
- }, {
448
- passive: true
449
- }),
450
- // Prevent scrolling the viewport.
451
- addEventListener(document, "touchmove", (event) => {
452
- const touch = event.touches[0];
453
- const dx = Math.abs(touch.clientX - touchStartX);
454
- const dy = Math.abs(touch.clientY - touchStartY);
455
- if (!isScrollable(event.target, dx > dy ? "x" : "y")) {
456
- event.preventDefault();
457
- }
458
- }, {
459
- passive: false
460
- })
461
- );
462
- }, [
463
- enabled
464
- ]);
465
- };
466
- var useIOSKeyboard = () => {
467
- const [open, setOpen] = useState(false);
468
- const [height, setHeight] = useState(0);
469
- useEffect3(() => {
470
- const viewport = window.visualViewport;
471
- if (!viewport) {
472
- return;
473
- }
474
- const initialHeight = viewport.height ?? window.innerHeight;
475
- const updateState = (keyboardHeight, keyboardOpen) => {
476
- setOpen(keyboardOpen);
477
- setHeight(keyboardHeight);
478
- const vvh = initialHeight - keyboardHeight;
479
- document.documentElement.style.setProperty("--vvh", `${vvh}px`);
480
- document.documentElement.style.setProperty("--kb-height", `${keyboardHeight}px`);
481
- document.documentElement.style.setProperty("--kb-open", keyboardOpen ? "1" : "0");
482
- log.info("viewport size", {
483
- initialHeight,
484
- vvh,
485
- keyboardHeight,
486
- keyboardOpen
487
- }, {
488
- F: __dxlog_file,
489
- L: 287,
490
- S: void 0,
491
- C: (f, a) => f(...a)
492
- });
493
- };
494
- return combine(
495
- // Handler for native iOS keyboard events (from KeyboardObserver.swift).
496
- addEventListener(window, "keyboard", (event) => {
497
- const { type, height: height2 } = event.detail;
498
- log.info("keyboard event", {
499
- type,
500
- height: height2
501
- }, {
502
- F: __dxlog_file,
503
- L: 297,
504
- S: void 0,
505
- C: (f, a) => f(...a)
506
- });
507
- updateState(height2, type === "show");
508
- })
509
- );
510
- }, []);
511
- return {
512
- open,
513
- height
514
- };
515
- };
516
-
517
- // src/components/Popover/Popover.tsx
518
- import { createContext as createContext2 } from "@radix-ui/react-context";
519
- import React4, { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
520
- import { Surface } from "@dxos/app-framework/ui";
521
- import { useObjectNavigate } from "@dxos/app-toolkit/ui";
522
- import { Popover, toLocalizedString as toLocalizedString3, useTranslation as useTranslation3 } from "@dxos/react-ui";
523
- import { Card as Card2 } from "@dxos/react-ui";
524
- var DEBOUNCE_DELAY = 40;
525
- var [LayoutPopoverProvider, useLayoutPopoverContext] = createContext2("LayoutPopover");
526
- var PopoverRoot = ({ children }) => {
527
- const { state } = useSimpleLayoutState();
528
- const [open, setOpen] = useState2(false);
529
- const virtualRef = useRef2(null);
530
- const [virtualIter, setVirtualIter] = useState2(0);
531
- const debounceRef = useRef2(null);
532
- useEffect4(() => {
533
- setOpen(false);
534
- if (state.popoverOpen) {
535
- if (debounceRef.current) {
536
- clearTimeout(debounceRef.current);
537
- }
538
- if (state.popoverAnchor && virtualRef.current !== state.popoverAnchor) {
539
- virtualRef.current = state.popoverAnchor ?? null;
540
- setVirtualIter((iter) => iter + 1);
541
- }
542
- debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
543
- }
544
- }, [
545
- state.popoverOpen,
546
- state.popoverAnchorId,
547
- state.popoverAnchor,
548
- state.popoverContent
549
- ]);
550
- return /* @__PURE__ */ React4.createElement(LayoutPopoverProvider, {
551
- setOpen
552
- }, /* @__PURE__ */ React4.createElement(Popover.Root, {
553
- modal: false,
554
- open
555
- }, state.popoverAnchor && /* @__PURE__ */ React4.createElement(Popover.VirtualTrigger, {
556
- key: virtualIter,
557
- virtualRef
558
- }), children));
559
- };
560
- var getPopoverSubject = (content) => content && typeof content === "object" && "subject" in content ? content.subject : content;
561
- var PopoverContent = () => {
562
- const { t } = useTranslation3(meta.id);
563
- const { state, updateState } = useSimpleLayoutState();
564
- const { setOpen } = useLayoutPopoverContext("PopoverContent");
565
- const handleNavigate = useObjectNavigate(getPopoverSubject(state.popoverContent));
566
- const handleClose = useCallback3(() => {
567
- setOpen(false);
568
- updateState((s) => ({
569
- ...s,
570
- popoverOpen: false,
571
- popoverAnchor: void 0,
572
- popoverAnchorId: void 0,
573
- popoverSide: void 0
574
- }));
575
- }, [
576
- setOpen,
577
- updateState
578
- ]);
579
- const handleInteractOutside = useCallback3((event) => {
580
- if (
581
- // TODO(thure): CodeMirror should not focus itself when it updates.
582
- event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
583
- ) {
584
- event.preventDefault();
585
- } else {
586
- handleClose();
587
- }
588
- }, [
589
- handleClose
590
- ]);
591
- const collisionBoundaries = useMemo4(() => {
592
- const closest = state.popoverAnchor?.closest("[data-popover-collision-boundary]");
593
- return closest ? [
594
- closest
595
- ] : [];
596
- }, [
597
- state.popoverAnchor
598
- ]);
599
- return /* @__PURE__ */ React4.createElement(Popover.Portal, null, /* @__PURE__ */ React4.createElement(Popover.Content, {
600
- side: state.popoverSide,
601
- sticky: "always",
602
- hideWhenDetached: true,
603
- collisionBoundary: collisionBoundaries,
604
- onInteractOutside: handleInteractOutside,
605
- onEscapeKeyDown: handleInteractOutside
606
- }, /* @__PURE__ */ React4.createElement(Popover.Viewport, null, state.popoverKind === "base" && /* @__PURE__ */ React4.createElement(Surface.Surface, {
607
- role: "popover",
608
- data: state.popoverContent,
609
- limit: 1
610
- }), state.popoverKind === "card" && /* @__PURE__ */ React4.createElement(Card2.Root, {
611
- border: false,
612
- classNames: "dx-card-popover"
613
- }, /* @__PURE__ */ React4.createElement(Card2.Toolbar, null, /* @__PURE__ */ React4.createElement("span", null), state.popoverTitle ? /* @__PURE__ */ React4.createElement(Card2.Title, {
614
- onClick: handleNavigate
615
- }, toLocalizedString3(state.popoverTitle, t)) : /* @__PURE__ */ React4.createElement("span", null), /* @__PURE__ */ React4.createElement(Card2.CloseIconButton, {
616
- onClick: handleClose
617
- })), /* @__PURE__ */ React4.createElement(Surface.Surface, {
618
- role: "card--content",
619
- data: state.popoverContent,
620
- limit: 1
621
- }))), /* @__PURE__ */ React4.createElement(Popover.Arrow, null)));
622
- };
623
-
624
- // src/components/SimpleLayout/AppBar.tsx
625
- import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
626
- import React5, { Fragment } from "react";
627
- import { IconButton, Popover as Popover2, Toolbar as Toolbar2, useTranslation as useTranslation4 } from "@dxos/react-ui";
628
- import { Menu, useMenuActions } from "@dxos/react-ui-menu";
629
- import { mx as mx3, osTranslations } from "@dxos/ui-theme";
630
- var APP_BAR_NAME = "SimpleLayout.AppBar";
631
- var AppBar = ({ classNames, title, actions, showBackButton, popoverAnchorId, onAction, onBack }) => {
632
- const { t } = useTranslation4(meta.id);
633
- const menu = useMenuActions(actions);
634
- const actionsValue = useAtomValue2(actions);
635
- const hasActions = actionsValue.nodes.length > 0;
636
- const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
637
- const displayTitle = title ?? t("current app name", {
638
- ns: osTranslations
639
- });
640
- const AnchorRoot = popoverAnchorId ? Popover2.Anchor : Fragment;
641
- return /* @__PURE__ */ React5.createElement(Toolbar2.Root, {
642
- role: "banner",
643
- classNames: mx3("grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center", "dx-density-fine", classNames)
644
- }, keyboardOpen ? /* @__PURE__ */ React5.createElement(IconButton, {
645
- variant: "ghost",
646
- icon: "ph--x--regular",
647
- iconOnly: true,
648
- label: t("done label")
649
- }) : showBackButton ? /* @__PURE__ */ React5.createElement(IconButton, {
650
- variant: "ghost",
651
- icon: "ph--caret-left--regular",
652
- iconOnly: true,
653
- label: t("back label"),
654
- onClick: onBack
655
- }) : /* @__PURE__ */ React5.createElement("div", null), /* @__PURE__ */ React5.createElement("h1", {
656
- className: "text-center truncate font-thin uppercase"
657
- }, displayTitle), hasActions ? /* @__PURE__ */ React5.createElement(AnchorRoot, null, /* @__PURE__ */ React5.createElement(Menu.Root, {
658
- ...menu,
659
- caller: meta.id,
660
- onAction
661
- }, /* @__PURE__ */ React5.createElement(Menu.Trigger, {
662
- asChild: true
663
- }, /* @__PURE__ */ React5.createElement(IconButton, {
664
- variant: "ghost",
665
- icon: "ph--dots-three-vertical--regular",
666
- iconOnly: true,
667
- label: t("actions menu label")
668
- })), /* @__PURE__ */ React5.createElement(Menu.Content, null))) : /* @__PURE__ */ React5.createElement("span", null));
669
- };
670
- AppBar.displayName = APP_BAR_NAME;
671
-
672
- // src/components/SimpleLayout/Main.tsx
673
- import React7, { useMemo as useMemo5 } from "react";
674
- import { Surface as Surface2 } from "@dxos/app-framework/ui";
675
- import { useAppGraph as useAppGraph5 } from "@dxos/app-toolkit/ui";
676
- import { useNode as useNode2 } from "@dxos/plugin-graph";
677
- import { ErrorFallback } from "@dxos/react-ui";
678
- import { useAttentionAttributes } from "@dxos/react-ui-attention";
679
- import { mx as mx5 } from "@dxos/ui-theme";
680
-
681
- // src/components/SimpleLayout/NavBar.tsx
682
- import React6 from "react";
683
- import { Menu as Menu2, useMenuActions as useMenuActions2 } from "@dxos/react-ui-menu";
684
- import { mx as mx4 } from "@dxos/ui-theme";
685
- var NAVBAR_NAME = "SimpleLayout.NavBar";
686
- var NavBar = ({ classNames, actions, onAction }) => {
687
- const menu = useMenuActions2(actions);
688
- return /* @__PURE__ */ React6.createElement(Menu2.Root, {
689
- ...menu,
690
- alwaysActive: true,
691
- onAction
692
- }, /* @__PURE__ */ React6.createElement(Menu2.Toolbar, {
693
- density: "coarse",
694
- classNames: mx4(classNames)
695
- }));
696
- };
697
- NavBar.displayName = NAVBAR_NAME;
698
-
699
- // src/components/SimpleLayout/Main.tsx
700
- var MAIN_NAME = "SimpleLayout.Main";
701
- var Main = () => {
702
- const { state } = useSimpleLayoutState();
703
- const id = state.active ?? state.workspace;
704
- const attentionAttrs = useAttentionAttributes(id);
705
- const { keyboardOpen } = useMobileLayout(MAIN_NAME);
706
- const { actions, onAction } = useNavbarActions();
707
- const appBarProps = useAppBarProps();
708
- const placeholder = useMemo5(() => /* @__PURE__ */ React7.createElement(ContentLoading, null), []);
709
- const { graph } = useAppGraph5();
710
- const node = useNode2(graph, id);
711
- const data = useMemo5(() => {
712
- return node && {
713
- attendableId: id,
714
- subject: node.data,
715
- properties: node.properties,
716
- popoverAnchorId: state.popoverAnchorId
717
- };
718
- }, [
719
- id,
720
- node,
721
- node?.data,
722
- node?.properties,
723
- state.popoverAnchorId
724
- ]);
725
- useLoadDescendents(id);
726
- const showNavBar = !keyboardOpen && !state.isPopover && state.drawerState === "closed";
727
- return /* @__PURE__ */ React7.createElement("div", {
728
- role: "none",
729
- className: mx5("h-full grid overflow-hidden bg-toolbar-surface", showNavBar ? "grid-rows-[var(--dx-rail-action)_1fr_var(--dx-toolbar-size)]" : "grid-rows-[var(--dx-rail-action)_1fr]"),
730
- ...attentionAttrs
731
- }, /* @__PURE__ */ React7.createElement(AppBar, appBarProps), /* @__PURE__ */ React7.createElement("article", {
732
- className: "h-full overflow-hidden bg-base-surface"
733
- }, /* @__PURE__ */ React7.createElement(Surface2.Surface, {
734
- key: id,
735
- role: "article",
736
- data,
737
- limit: 1,
738
- fallback: ErrorFallback,
739
- placeholder
740
- })), showNavBar && /* @__PURE__ */ React7.createElement(NavBar, {
741
- classNames: "border-y border-subdued-separator",
742
- actions,
743
- onAction
744
- }));
745
- };
746
- Main.displayName = MAIN_NAME;
747
-
748
- // src/components/Workspace/Workspace.tsx
749
- import React8, { useCallback as useCallback4, useEffect as useEffect5, useRef as useRef3 } from "react";
750
- import { useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
751
- import { LayoutOperation as LayoutOperation4 } from "@dxos/app-toolkit";
752
- import { useAppGraph as useAppGraph6 } from "@dxos/app-toolkit/ui";
753
- import { useConnections as useConnections3 } from "@dxos/plugin-graph";
754
- import { Avatar as Avatar2, Icon as Icon2, Panel as Panel2, ScrollArea as ScrollArea2, Toolbar as Toolbar3, toLocalizedString as toLocalizedString4, useTranslation as useTranslation5 } from "@dxos/react-ui";
755
- import { Card as Card3 } from "@dxos/react-ui";
756
- import { Mosaic as Mosaic2 } from "@dxos/react-ui-mosaic";
757
- import { SearchList as SearchList2, useSearchListItem as useSearchListItem2, useSearchListResults as useSearchListResults2 } from "@dxos/react-ui-searchlist";
758
- import { mx as mx6 } from "@dxos/ui-theme";
759
- var Workspace = ({ id }) => {
760
- const { t } = useTranslation5(meta.id);
761
- const { graph } = useAppGraph6();
762
- useLoadDescendents(id);
763
- const children = useConnections3(graph, id, "child");
764
- const { results, handleSearch } = useSearchListResults2({
765
- items: children,
766
- extract: (child) => toLocalizedString4(child.properties.label, t)
767
- });
768
- return /* @__PURE__ */ React8.createElement(SearchList2.Root, {
769
- onSearch: handleSearch
770
- }, /* @__PURE__ */ React8.createElement(Panel2.Root, null, /* @__PURE__ */ React8.createElement(Panel2.Toolbar, {
771
- asChild: true
772
- }, /* @__PURE__ */ React8.createElement(Toolbar3.Root, null, /* @__PURE__ */ React8.createElement(SearchList2.Input, {
773
- placeholder: t("search placeholder"),
774
- autoFocus: true
775
- }))), /* @__PURE__ */ React8.createElement(Panel2.Content, {
776
- asChild: true
777
- }, /* @__PURE__ */ React8.createElement(SearchList2.Content, null, /* @__PURE__ */ React8.createElement(Mosaic2.Container, {
778
- asChild: true
779
- }, /* @__PURE__ */ React8.createElement(ScrollArea2.Root, {
780
- orientation: "vertical"
781
- }, /* @__PURE__ */ React8.createElement(ScrollArea2.Viewport, {
782
- classNames: "p-2"
783
- }, /* @__PURE__ */ React8.createElement(Mosaic2.Stack, {
784
- items: results,
785
- getId: (child) => child.id,
786
- Tile: WorkspaceChildTile
787
- }))))))));
788
- };
789
- var WorkspaceChildTile = (props) => {
790
- const data = props.data;
791
- const { t } = useTranslation5(meta.id);
792
- const { invokeSync } = useOperationInvoker3();
793
- const ref = useRef3(null);
794
- const { selectedValue, registerItem, unregisterItem } = useSearchListItem2();
795
- const isSelected = selectedValue === data.id;
796
- const name = toLocalizedString4(data.properties.label, t);
797
- const handleSelect = useCallback4(() => invokeSync(LayoutOperation4.Open, {
798
- subject: [
799
- data.id
800
- ]
801
- }), [
802
- invokeSync,
803
- data.id
804
- ]);
805
- useEffect5(() => {
806
- if (ref.current) {
807
- registerItem(data.id, ref.current, handleSelect);
808
- }
809
- return () => unregisterItem(data.id);
810
- }, [
811
- data.id,
812
- handleSelect,
813
- registerItem,
814
- unregisterItem
815
- ]);
816
- useEffect5(() => {
817
- if (isSelected && ref.current) {
818
- ref.current.scrollIntoView({
819
- block: "nearest",
820
- behavior: "smooth"
821
- });
822
- }
823
- }, [
824
- isSelected
825
- ]);
826
- return /* @__PURE__ */ React8.createElement(Card3.Root, {
827
- ref,
828
- role: "button",
829
- fullWidth: true,
830
- tabIndex: -1,
831
- "data-selected": isSelected,
832
- classNames: mx6("dx-focus-ring", isSelected && "bg-hover-overlay"),
833
- onClick: handleSelect
834
- }, /* @__PURE__ */ React8.createElement(Card3.Toolbar, {
835
- density: "coarse"
836
- }, /* @__PURE__ */ React8.createElement(Avatar2.Root, null, /* @__PURE__ */ React8.createElement(Avatar2.Content, {
837
- hue: data.properties.hue,
838
- icon: data.properties.icon,
839
- hueVariant: "transparent",
840
- variant: "square",
841
- size: 12,
842
- fallback: name
843
- }), /* @__PURE__ */ React8.createElement(Avatar2.Label, null, name), /* @__PURE__ */ React8.createElement(Icon2, {
844
- icon: "ph--caret-right--regular"
845
- }))));
846
- };
847
-
848
- // src/hooks/useSimpleLayoutState.ts
849
- import { RegistryContext, useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
850
- import { useCallback as useCallback5, useContext } from "react";
851
- import { useCapability as useCapability2 } from "@dxos/app-framework/ui";
852
- var useSimpleLayoutState = () => {
853
- const registry = useContext(RegistryContext);
854
- const stateAtom = useCapability2(SimpleLayoutState);
855
- const state = useAtomValue3(stateAtom);
856
- const updateState = useCallback5((fn) => {
857
- registry.set(stateAtom, fn(registry.get(stateAtom)));
858
- }, [
859
- registry,
860
- stateAtom
861
- ]);
862
- return {
863
- state,
864
- updateState
865
- };
866
- };
867
-
868
- // src/hooks/useDrawerActions.ts
869
- var useDrawerActions = (consumerName) => {
870
- const { t } = useTranslation6(meta.id);
871
- const stateAtom = useCapability3(SimpleLayoutState);
872
- const { graph } = useAppGraph7();
873
- const runAction = useActionRunner2();
874
- const { invokeSync } = useOperationInvoker4();
875
- const { updateState } = useSimpleLayoutState();
876
- const { keyboardOpen } = useMobileLayout(consumerName);
877
- const actionsAtom = useMemo6(() => Atom2.make((get) => {
878
- const state = get(stateAtom);
879
- const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
880
- idPrefix: "drawer",
881
- selectedVariant: state.companionVariant,
882
- invokeSync
883
- });
884
- const gapSeparator = createGapSeparator("drawer-gap");
885
- nodes.push(...gapSeparator.nodes);
886
- edges.push(...gapSeparator.edges);
887
- if (!keyboardOpen) {
888
- const isExpanded = state.drawerState === "expanded";
889
- const toggleExpandAction = {
890
- id: "drawer-toggle-expand",
891
- type: Node4.ActionType,
892
- properties: {
893
- icon: isExpanded ? "ph--arrow-down--regular" : "ph--arrow-up--regular",
894
- label: isExpanded ? t("collapse drawer label") : t("expand drawer label"),
895
- iconOnly: true
896
- },
897
- data: () => Effect3.sync(() => updateState((state2) => ({
898
- ...state2,
899
- drawerState: isExpanded ? "open" : "expanded"
900
- })))
901
- };
902
- nodes.push(toggleExpandAction);
903
- edges.push({
904
- source: "root",
905
- target: toggleExpandAction.id,
906
- relation: "child"
907
- });
908
- }
909
- const closeAction = {
910
- id: "drawer-close",
911
- type: Node4.ActionType,
912
- properties: {
913
- icon: "ph--x--regular",
914
- label: t("close drawer label"),
915
- iconOnly: true
916
- },
917
- data: () => Effect3.sync(() => updateState((state2) => ({
918
- ...state2,
919
- drawerState: "closed"
920
- })))
921
- };
922
- nodes.push(closeAction);
923
- edges.push({
924
- source: "root",
925
- target: closeAction.id,
926
- relation: "child"
927
- });
928
- return {
929
- nodes,
930
- edges
931
- };
932
- }), [
933
- graph,
934
- stateAtom,
935
- invokeSync,
936
- updateState,
937
- keyboardOpen,
938
- t
939
- ]);
940
- return {
941
- actions: actionsAtom,
942
- onAction: runAction
943
- };
944
- };
945
-
946
- // src/hooks/useNavbarActions.ts
947
- import { Atom as Atom3 } from "@effect-atom/atom-react";
948
- import { useMemo as useMemo7 } from "react";
949
- import { useCapability as useCapability4, useOperationInvoker as useOperationInvoker5 } from "@dxos/app-framework/ui";
950
- import { useAppGraph as useAppGraph8 } from "@dxos/app-toolkit/ui";
951
- import { Node as Node5, useActionRunner as useActionRunner3 } from "@dxos/plugin-graph";
952
- import { useTranslation as useTranslation7 } from "@dxos/react-ui";
953
- import { createGapSeparator as createGapSeparator2, createMenuItemGroup } from "@dxos/react-ui-menu";
954
- var MAIN_MENU_GROUP_ID = "navbar-main-menu";
955
- var useNavbarActions = () => {
956
- const { t } = useTranslation7(meta.id);
957
- const { graph } = useAppGraph8();
958
- const runAction = useActionRunner3();
959
- const { invokeSync } = useOperationInvoker5();
960
- const stateAtom = useCapability4(SimpleLayoutState);
961
- const actionsAtom = useMemo7(() => Atom3.make((get) => {
962
- const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
963
- idPrefix: "navbar",
964
- invokeSync
965
- });
966
- const gapSeparator = createGapSeparator2("navbar-gap");
967
- nodes.push(...gapSeparator.nodes);
968
- edges.push(...gapSeparator.edges);
969
- const mainMenuGroup = createMenuItemGroup(MAIN_MENU_GROUP_ID, {
970
- variant: "dropdownMenu",
971
- icon: "ph--list--regular",
972
- iconOnly: true,
973
- label: t("main menu label"),
974
- testId: "simpleLayoutPlugin.addSpace"
975
- });
976
- nodes.push(mainMenuGroup);
977
- edges.push({
978
- source: "root",
979
- target: mainMenuGroup.id,
980
- relation: "child"
981
- });
982
- const rootActions = get(graph.actions(Node5.RootId));
983
- const menuActions = rootActions.filter((node) => node.properties.disposition === "menu");
984
- menuActions.forEach((menuAction) => {
985
- nodes.push(menuAction);
986
- edges.push({
987
- source: MAIN_MENU_GROUP_ID,
988
- target: menuAction.id,
989
- relation: "child"
990
- });
991
- });
992
- return {
993
- nodes,
994
- edges
995
- };
996
- }), [
997
- graph,
998
- stateAtom,
999
- invokeSync,
1000
- t
1001
- ]);
1002
- return {
1003
- actions: actionsAtom,
1004
- onAction: runAction
1005
- };
1006
- };
1007
-
1008
- // src/components/Dialog/Dialog.tsx
1009
- import React9 from "react";
1010
- import { Surface as Surface3 } from "@dxos/app-framework/ui";
1011
- import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
1012
- import { ErrorFallback as ErrorFallback2 } from "@dxos/react-ui";
1013
- var Dialog = () => {
1014
- const { state, updateState } = useSimpleLayoutState();
1015
- const DialogRoot = state.dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
1016
- const DialogOverlay = state.dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
1017
- return /* @__PURE__ */ React9.createElement(DialogRoot, {
1018
- modal: state.dialogBlockAlign !== "end",
1019
- open: state.dialogOpen,
1020
- onOpenChange: (nextOpen) => updateState((state2) => ({
1021
- ...state2,
1022
- dialogOpen: nextOpen
1023
- }))
1024
- }, state.dialogBlockAlign === "end" ? /* @__PURE__ */ React9.createElement(Surface3.Surface, {
1025
- role: "dialog",
1026
- data: state.dialogContent,
1027
- limit: 1,
1028
- fallback: ErrorFallback2
1029
- }) : /* @__PURE__ */ React9.createElement(DialogOverlay, {
1030
- blockAlign: state.dialogBlockAlign,
1031
- classNames: state.dialogOverlayClasses,
1032
- style: state.dialogOverlayStyle
1033
- }, /* @__PURE__ */ React9.createElement(Surface3.Surface, {
1034
- role: "dialog",
1035
- data: state.dialogContent,
1036
- limit: 1,
1037
- fallback: ErrorFallback2
1038
- })));
1039
- };
1040
-
1041
- // src/components/SimpleLayout/Drawer.tsx
1042
- import React10, { useMemo as useMemo8 } from "react";
1043
- import { Surface as Surface4 } from "@dxos/app-framework/ui";
1044
- import { useAppGraph as useAppGraph9 } from "@dxos/app-toolkit/ui";
1045
- import { useNode as useNode3 } from "@dxos/plugin-graph";
1046
- import { ErrorFallback as ErrorFallback3, Panel as Panel3 } from "@dxos/react-ui";
1047
- import { ATTENDABLE_PATH_SEPARATOR as ATTENDABLE_PATH_SEPARATOR2 } from "@dxos/react-ui-attention";
1048
- import { Menu as Menu3, useMenuActions as useMenuActions3 } from "@dxos/react-ui-menu";
1049
- var DRAWER_NAME = "SimpleLayout.Drawer";
1050
- var Drawer = () => {
1051
- const { graph } = useAppGraph9();
1052
- const { state: layoutState } = useSimpleLayoutState();
1053
- const placeholder = useMemo8(() => /* @__PURE__ */ React10.createElement(ContentLoading, null), []);
1054
- const activeId = layoutState.active ?? layoutState.workspace;
1055
- const companions = useCompanions(activeId);
1056
- const { companionId, variant } = useSelectedCompanion(companions, layoutState.companionVariant);
1057
- const node = useNode3(graph, companionId);
1058
- const parentNode = useNode3(graph, activeId);
1059
- const data = useMemo8(() => {
1060
- return node && {
1061
- attendableId: companionId,
1062
- subject: node.data,
1063
- companionTo: parentNode?.data,
1064
- properties: node.properties,
1065
- variant
1066
- };
1067
- }, [
1068
- companionId,
1069
- node,
1070
- parentNode,
1071
- variant
1072
- ]);
1073
- const { actions, onAction } = useDrawerActions(DRAWER_NAME);
1074
- const menu = useMenuActions3(actions);
1075
- return /* @__PURE__ */ React10.createElement(Panel3.Root, null, /* @__PURE__ */ React10.createElement(Panel3.Toolbar, null, /* @__PURE__ */ React10.createElement(Menu3.Root, {
1076
- ...menu,
1077
- alwaysActive: true,
1078
- onAction
1079
- }, /* @__PURE__ */ React10.createElement(Menu3.Toolbar, {
1080
- density: "coarse"
1081
- }))), /* @__PURE__ */ React10.createElement(Panel3.Content, {
1082
- asChild: true
1083
- }, /* @__PURE__ */ React10.createElement(Surface4.Surface, {
1084
- role: "article",
1085
- data,
1086
- limit: 1,
1087
- fallback: ErrorFallback3,
1088
- placeholder
1089
- })));
1090
- };
1091
- Drawer.displayName = DRAWER_NAME;
1092
- var parseEntryId = (entryId) => {
1093
- const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR2);
1094
- return {
1095
- id,
1096
- variant
1097
- };
1098
- };
1099
- var useSelectedCompanion = (companions, preferredVariant) => {
1100
- const selectedCompanion = useMemo8(() => {
1101
- if (companions.length === 0) {
1102
- return void 0;
1103
- }
1104
- if (preferredVariant) {
1105
- const preferred = companions.find((c) => {
1106
- const { variant: variant2 } = parseEntryId(c.id);
1107
- return variant2 === preferredVariant;
1108
- });
1109
- if (preferred) {
1110
- return preferred;
1111
- }
1112
- }
1113
- return companions[0];
1114
- }, [
1115
- companions,
1116
- preferredVariant
1117
- ]);
1118
- const companionId = selectedCompanion?.id;
1119
- const { variant } = parseEntryId(companionId ?? "");
1120
- return {
1121
- selectedCompanion,
1122
- companionId,
1123
- variant
1124
- };
1125
- };
1126
-
1127
- // src/components/SimpleLayout/SimpleLayout.tsx
1128
- var SimpleLayout = () => {
1129
- const { state } = useSimpleLayoutState();
1130
- const [keyboardOpen, setKeyboardOpen] = useState3(false);
1131
- const [splitterMode, setSplitterMode] = useState3("upper");
1132
- const drawerRef = useRef4(null);
1133
- useEffect6(() => {
1134
- if (keyboardOpen) {
1135
- const activeElement = document.activeElement;
1136
- const drawerHasFocus = drawerRef.current?.contains(activeElement);
1137
- setSplitterMode(drawerHasFocus ? "lower" : "upper");
1138
- } else {
1139
- setSplitterMode(state.drawerState === "closed" ? "upper" : state.drawerState === "open" ? "both" : "lower");
1140
- }
1141
- }, [
1142
- state.drawerState,
1143
- keyboardOpen
1144
- ]);
1145
- return /* @__PURE__ */ React11.createElement(Mosaic3.Root, {
1146
- classNames: "contents"
1147
- }, /* @__PURE__ */ React11.createElement(MobileLayout.Root, {
1148
- classNames: "bg-toolbar-surface",
1149
- onKeyboardOpenChange: (keyboardOpen2) => setKeyboardOpen(keyboardOpen2)
1150
- }, /* @__PURE__ */ React11.createElement(MobileLayout.Panel, {
1151
- safe: {
1152
- top: true,
1153
- bottom: splitterMode === "upper"
1154
- }
1155
- }, /* @__PURE__ */ React11.createElement(PopoverRoot, null, /* @__PURE__ */ React11.createElement(Splitter.Root, {
1156
- mode: splitterMode,
1157
- ratio: 0.55
1158
- }, /* @__PURE__ */ React11.createElement(Splitter.Panel, {
1159
- position: "upper"
1160
- }, /* @__PURE__ */ React11.createElement(Main, null)), /* @__PURE__ */ React11.createElement(Splitter.Panel, {
1161
- position: "lower",
1162
- ref: drawerRef
1163
- }, /* @__PURE__ */ React11.createElement(Drawer, null))), /* @__PURE__ */ React11.createElement(Dialog, null), /* @__PURE__ */ React11.createElement(PopoverContent, null)))));
1164
- };
1165
-
1166
- export {
1167
- Home,
1168
- SimpleLayout,
1169
- Workspace
1170
- };
1171
- //# sourceMappingURL=chunk-FLOYBAHE.mjs.map