@dxos/plugin-simple-layout 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced

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