@dxos/plugin-simple-layout 0.8.4-main.2244d791bb → 0.8.4-main.3fbcb4aa9b

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