@dxos/plugin-simple-layout 0.8.4-main.69d29f4 → 0.8.4-main.7996785055

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