@dxos/plugin-deck 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae

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 (331) hide show
  1. package/dist/lib/browser/Banner-DR6B7XTO.mjs +15 -0
  2. package/dist/lib/browser/Banner-DR6B7XTO.mjs.map +7 -0
  3. package/dist/lib/browser/DeckSettings-HB5TKG2F.mjs +96 -0
  4. package/dist/lib/browser/DeckSettings-HB5TKG2F.mjs.map +7 -0
  5. package/dist/lib/browser/app-graph-builder-22XAL7YE.mjs +123 -0
  6. package/dist/lib/browser/app-graph-builder-22XAL7YE.mjs.map +7 -0
  7. package/dist/lib/browser/check-app-scheme-ZV3QWNNZ.mjs +33 -0
  8. package/dist/lib/browser/check-app-scheme-ZV3QWNNZ.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-BJDEG7YZ.mjs +74 -0
  10. package/dist/lib/browser/chunk-BJDEG7YZ.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-FBL4WVYZ.mjs +16 -0
  12. package/dist/lib/browser/chunk-FBL4WVYZ.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-OAPMV5ZR.mjs +280 -0
  14. package/dist/lib/browser/chunk-OAPMV5ZR.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-Q4GUCIRE.mjs +200 -0
  16. package/dist/lib/browser/chunk-Q4GUCIRE.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-SKBPLX5T.mjs +81 -0
  18. package/dist/lib/browser/chunk-SKBPLX5T.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-YGOOWRJE.mjs +1390 -0
  20. package/dist/lib/browser/chunk-YGOOWRJE.mjs.map +7 -0
  21. package/dist/lib/browser/index.mjs +85 -73
  22. package/dist/lib/browser/index.mjs.map +4 -4
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/operation-resolver-BLZGJWLO.mjs +580 -0
  25. package/dist/lib/browser/operation-resolver-BLZGJWLO.mjs.map +7 -0
  26. package/dist/lib/browser/react-root-4ESZAM6D.mjs +49 -0
  27. package/dist/lib/browser/react-root-4ESZAM6D.mjs.map +7 -0
  28. package/dist/lib/browser/react-surface-KYQGCALN.mjs +44 -0
  29. package/dist/lib/browser/react-surface-KYQGCALN.mjs.map +7 -0
  30. package/dist/lib/browser/settings-RY2TBSGP.mjs +40 -0
  31. package/dist/lib/browser/settings-RY2TBSGP.mjs.map +7 -0
  32. package/dist/lib/browser/state-CSTTMJ43.mjs +106 -0
  33. package/dist/lib/browser/state-CSTTMJ43.mjs.map +7 -0
  34. package/dist/lib/browser/toolkit-EONRPYA5.mjs +55 -0
  35. package/dist/lib/browser/toolkit-EONRPYA5.mjs.map +7 -0
  36. package/dist/lib/browser/types/index.mjs +14 -6
  37. package/dist/lib/browser/url-handler-EM3SYHHX.mjs +95 -0
  38. package/dist/lib/browser/url-handler-EM3SYHHX.mjs.map +7 -0
  39. package/dist/lib/node-esm/Banner-HR7DPUZU.mjs +16 -0
  40. package/dist/lib/node-esm/Banner-HR7DPUZU.mjs.map +7 -0
  41. package/dist/lib/node-esm/DeckSettings-MWTR7HU2.mjs +97 -0
  42. package/dist/lib/node-esm/DeckSettings-MWTR7HU2.mjs.map +7 -0
  43. package/dist/lib/node-esm/app-graph-builder-GNNNCWGN.mjs +124 -0
  44. package/dist/lib/node-esm/app-graph-builder-GNNNCWGN.mjs.map +7 -0
  45. package/dist/lib/node-esm/check-app-scheme-ZNISVRFH.mjs +34 -0
  46. package/dist/lib/node-esm/check-app-scheme-ZNISVRFH.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-DGTRKKWZ.mjs +76 -0
  48. package/dist/lib/node-esm/chunk-DGTRKKWZ.mjs.map +7 -0
  49. package/dist/lib/node-esm/chunk-EGFOT3DE.mjs +18 -0
  50. package/dist/lib/node-esm/chunk-EGFOT3DE.mjs.map +7 -0
  51. package/dist/lib/node-esm/chunk-IR6ODCNC.mjs +83 -0
  52. package/dist/lib/node-esm/chunk-IR6ODCNC.mjs.map +7 -0
  53. package/dist/lib/node-esm/chunk-L2NPJPGL.mjs +281 -0
  54. package/dist/lib/node-esm/chunk-L2NPJPGL.mjs.map +7 -0
  55. package/dist/lib/node-esm/chunk-O4IOJICP.mjs +201 -0
  56. package/dist/lib/node-esm/chunk-O4IOJICP.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-Z43MBISY.mjs +1391 -0
  58. package/dist/lib/node-esm/chunk-Z43MBISY.mjs.map +7 -0
  59. package/dist/lib/node-esm/index.mjs +186 -0
  60. package/dist/lib/node-esm/index.mjs.map +7 -0
  61. package/dist/lib/node-esm/meta.json +1 -0
  62. package/dist/lib/node-esm/operation-resolver-5BYDNQND.mjs +581 -0
  63. package/dist/lib/node-esm/operation-resolver-5BYDNQND.mjs.map +7 -0
  64. package/dist/lib/node-esm/react-root-YO7IIC75.mjs +50 -0
  65. package/dist/lib/node-esm/react-root-YO7IIC75.mjs.map +7 -0
  66. package/dist/lib/node-esm/react-surface-G7VRKT4U.mjs +45 -0
  67. package/dist/lib/node-esm/react-surface-G7VRKT4U.mjs.map +7 -0
  68. package/dist/lib/node-esm/settings-GYLWWOBK.mjs +41 -0
  69. package/dist/lib/node-esm/settings-GYLWWOBK.mjs.map +7 -0
  70. package/dist/lib/node-esm/state-RQXTBWUX.mjs +107 -0
  71. package/dist/lib/node-esm/state-RQXTBWUX.mjs.map +7 -0
  72. package/dist/lib/node-esm/toolkit-EU3Z2R4H.mjs +56 -0
  73. package/dist/lib/node-esm/toolkit-EU3Z2R4H.mjs.map +7 -0
  74. package/dist/lib/node-esm/types/index.mjs +41 -0
  75. package/dist/lib/node-esm/url-handler-VUK2LBJV.mjs +96 -0
  76. package/dist/lib/node-esm/url-handler-VUK2LBJV.mjs.map +7 -0
  77. package/dist/types/src/DeckPlugin.d.ts +2 -1
  78. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  80. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
  84. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
  85. package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
  86. package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/index.d.ts +8 -13
  88. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  90. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  92. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
  94. package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
  96. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  98. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  99. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  100. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/settings/index.d.ts +19 -0
  102. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/settings/settings.d.ts +22 -0
  104. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  105. package/dist/types/src/capabilities/state/index.d.ts +172 -0
  106. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/state/state.d.ts +175 -0
  108. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  109. package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
  110. package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/toolkit/toolkit.d.ts +27 -0
  112. package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/tools/index.d.ts +3 -0
  114. package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
  116. package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
  117. package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
  118. package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
  120. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
  121. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
  122. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  123. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
  124. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  125. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +75 -0
  126. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
  127. package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
  128. package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
  129. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
  130. package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
  131. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
  132. package/dist/types/src/components/DeckLayout/Toast.d.ts +7 -2
  133. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  134. package/dist/types/src/components/Plank/Plank.d.ts +5 -5
  135. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  136. package/dist/types/src/components/Plank/Plank.stories.d.ts +27 -7
  137. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
  138. package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
  139. package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
  140. package/dist/types/src/components/Plank/PlankError.d.ts +6 -4
  141. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  142. package/dist/types/src/components/Plank/PlankHeading.d.ts +2 -2
  143. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  144. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  145. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
  146. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  147. package/dist/types/src/components/fragments.d.ts +4 -1
  148. package/dist/types/src/components/fragments.d.ts.map +1 -1
  149. package/dist/types/src/components/index.d.ts +0 -1
  150. package/dist/types/src/components/index.d.ts.map +1 -1
  151. package/dist/types/src/containers/Banner/Banner.d.ts +2 -0
  152. package/dist/types/src/containers/Banner/Banner.d.ts.map +1 -0
  153. package/dist/types/src/containers/Banner/index.d.ts +3 -0
  154. package/dist/types/src/containers/Banner/index.d.ts.map +1 -0
  155. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts +8 -0
  156. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts.map +1 -0
  157. package/dist/types/src/containers/DeckSettings/index.d.ts +3 -0
  158. package/dist/types/src/containers/DeckSettings/index.d.ts.map +1 -0
  159. package/dist/types/src/containers/index.d.ts +4 -0
  160. package/dist/types/src/containers/index.d.ts.map +1 -0
  161. package/dist/types/src/hooks/index.d.ts +2 -0
  162. package/dist/types/src/hooks/index.d.ts.map +1 -1
  163. package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -3
  164. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  165. package/dist/types/src/hooks/useDeckState.d.ts +17 -0
  166. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
  167. package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
  168. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
  169. package/dist/types/src/hooks/useMainSize.d.ts +2 -2
  170. package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
  171. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  172. package/dist/types/src/hooks/useSelectedCompanion.d.ts +13 -0
  173. package/dist/types/src/hooks/useSelectedCompanion.d.ts.map +1 -0
  174. package/dist/types/src/index.d.ts +1 -2
  175. package/dist/types/src/index.d.ts.map +1 -1
  176. package/dist/types/src/meta.d.ts +2 -2
  177. package/dist/types/src/meta.d.ts.map +1 -1
  178. package/dist/types/src/translations.d.ts +3 -1
  179. package/dist/types/src/translations.d.ts.map +1 -1
  180. package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
  181. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  182. package/dist/types/src/types/events.d.ts +7 -0
  183. package/dist/types/src/types/events.d.ts.map +1 -0
  184. package/dist/types/src/types/index.d.ts +2 -0
  185. package/dist/types/src/types/index.d.ts.map +1 -1
  186. package/dist/types/src/types/schema.d.ts +93 -31
  187. package/dist/types/src/types/schema.d.ts.map +1 -1
  188. package/dist/types/src/util/set-active.d.ts +18 -3
  189. package/dist/types/src/util/set-active.d.ts.map +1 -1
  190. package/dist/types/tsconfig.tsbuildinfo +1 -1
  191. package/package.json +56 -48
  192. package/src/DeckPlugin.ts +28 -48
  193. package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
  194. package/src/capabilities/app-graph-builder/index.ts +7 -0
  195. package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
  196. package/src/capabilities/check-app-scheme/index.ts +7 -0
  197. package/src/capabilities/index.ts +9 -14
  198. package/src/capabilities/operation-resolver/index.ts +10 -0
  199. package/src/capabilities/operation-resolver/operation-resolver.ts +560 -0
  200. package/src/capabilities/react-root/index.ts +7 -0
  201. package/src/capabilities/react-root/react-root.tsx +47 -0
  202. package/src/capabilities/react-surface/index.ts +7 -0
  203. package/src/capabilities/react-surface/react-surface.tsx +38 -0
  204. package/src/capabilities/settings/index.ts +7 -0
  205. package/src/capabilities/settings/settings.ts +39 -0
  206. package/src/capabilities/state/index.ts +7 -0
  207. package/src/capabilities/state/state.ts +105 -0
  208. package/src/capabilities/toolkit/index.ts +7 -0
  209. package/src/capabilities/toolkit/toolkit.ts +64 -0
  210. package/src/capabilities/tools/index.ts +7 -0
  211. package/src/capabilities/tools/tools.ts +91 -0
  212. package/src/capabilities/url-handler/index.ts +7 -0
  213. package/src/capabilities/url-handler/url-handler.ts +96 -0
  214. package/src/components/DeckLayout/ActiveNode.tsx +3 -2
  215. package/src/components/DeckLayout/Banner.tsx +9 -9
  216. package/src/components/DeckLayout/ContentEmpty.tsx +5 -6
  217. package/src/components/DeckLayout/DeckLayout.stories.tsx +53 -0
  218. package/src/components/DeckLayout/DeckLayout.tsx +17 -285
  219. package/src/components/DeckLayout/DeckMain.tsx +287 -0
  220. package/src/components/DeckLayout/Dialog.tsx +22 -13
  221. package/src/components/DeckLayout/Fallback.tsx +2 -6
  222. package/src/components/DeckLayout/Popover.tsx +70 -32
  223. package/src/components/DeckLayout/StatusBar.tsx +4 -4
  224. package/src/components/DeckLayout/Toast.tsx +28 -3
  225. package/src/components/Plank/Plank.stories.tsx +19 -9
  226. package/src/components/Plank/Plank.tsx +96 -59
  227. package/src/components/Plank/PlankControls.tsx +9 -11
  228. package/src/components/Plank/PlankError.tsx +31 -17
  229. package/src/components/Plank/PlankHeading.tsx +35 -42
  230. package/src/components/Plank/PlankLoading.tsx +1 -1
  231. package/src/components/Sidebar/ComplementarySidebar.tsx +71 -40
  232. package/src/components/Sidebar/Sidebar.tsx +7 -7
  233. package/src/components/Sidebar/SidebarButton.tsx +36 -29
  234. package/src/components/fragments.ts +10 -5
  235. package/src/components/index.ts +0 -1
  236. package/src/containers/Banner/Banner.tsx +5 -0
  237. package/src/containers/Banner/index.ts +7 -0
  238. package/src/containers/DeckSettings/DeckSettings.tsx +113 -0
  239. package/src/containers/DeckSettings/index.ts +7 -0
  240. package/src/containers/index.ts +8 -0
  241. package/src/hooks/index.ts +2 -0
  242. package/src/hooks/useCompanions.ts +2 -2
  243. package/src/hooks/useDeckCompanions.ts +6 -4
  244. package/src/hooks/useDeckState.ts +82 -0
  245. package/src/hooks/useHoistStatusbar.ts +4 -5
  246. package/src/hooks/useMainSize.ts +2 -2
  247. package/src/hooks/useNodeActionExpander.ts +4 -4
  248. package/src/hooks/useSelectedCompanion.ts +38 -0
  249. package/src/index.ts +1 -2
  250. package/src/meta.ts +7 -2
  251. package/src/translations.ts +3 -1
  252. package/src/types/capabilities.ts +33 -0
  253. package/src/types/events.ts +21 -0
  254. package/src/types/index.ts +2 -0
  255. package/src/types/schema.ts +93 -18
  256. package/src/util/layoutAppliesTopbar.ts +1 -1
  257. package/src/util/overscroll.ts +3 -3
  258. package/src/util/set-active.ts +49 -29
  259. package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs +0 -153
  260. package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs.map +0 -7
  261. package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs +0 -32
  262. package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs.map +0 -7
  263. package/dist/lib/browser/chunk-3SV2V3AN.mjs +0 -1495
  264. package/dist/lib/browser/chunk-3SV2V3AN.mjs.map +0 -7
  265. package/dist/lib/browser/chunk-A4SRCSJX.mjs +0 -160
  266. package/dist/lib/browser/chunk-A4SRCSJX.mjs.map +0 -7
  267. package/dist/lib/browser/chunk-CNTGBCMK.mjs +0 -145
  268. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  269. package/dist/lib/browser/chunk-HUWUYTOI.mjs +0 -16
  270. package/dist/lib/browser/chunk-HUWUYTOI.mjs.map +0 -7
  271. package/dist/lib/browser/chunk-JH4ZCG5I.mjs +0 -129
  272. package/dist/lib/browser/chunk-JH4ZCG5I.mjs.map +0 -7
  273. package/dist/lib/browser/chunk-MHP4GPX5.mjs +0 -11
  274. package/dist/lib/browser/chunk-MHP4GPX5.mjs.map +0 -7
  275. package/dist/lib/browser/chunk-YRDCQS7E.mjs +0 -127
  276. package/dist/lib/browser/chunk-YRDCQS7E.mjs.map +0 -7
  277. package/dist/lib/browser/intent-resolver-2NFDKRFG.mjs +0 -524
  278. package/dist/lib/browser/intent-resolver-2NFDKRFG.mjs.map +0 -7
  279. package/dist/lib/browser/react-root-JTWYCDJT.mjs +0 -43
  280. package/dist/lib/browser/react-root-JTWYCDJT.mjs.map +0 -7
  281. package/dist/lib/browser/react-surface-PZKJ73JS.mjs +0 -40
  282. package/dist/lib/browser/react-surface-PZKJ73JS.mjs.map +0 -7
  283. package/dist/lib/browser/settings-JK7UIZSB.mjs +0 -29
  284. package/dist/lib/browser/settings-JK7UIZSB.mjs.map +0 -7
  285. package/dist/lib/browser/state-IFKFOBBX.mjs +0 -12
  286. package/dist/lib/browser/toolkit-L7C3UAEU.mjs +0 -63
  287. package/dist/lib/browser/toolkit-L7C3UAEU.mjs.map +0 -7
  288. package/dist/lib/browser/url-handler-MRYBE3HF.mjs +0 -70
  289. package/dist/lib/browser/url-handler-MRYBE3HF.mjs.map +0 -7
  290. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  291. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  292. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  293. package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
  294. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  295. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  296. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  297. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  298. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  299. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  300. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  301. package/dist/types/src/capabilities/settings.d.ts +0 -4
  302. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  303. package/dist/types/src/capabilities/state.d.ts +0 -101
  304. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  305. package/dist/types/src/capabilities/toolkit.d.ts +0 -6
  306. package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
  307. package/dist/types/src/capabilities/tools.d.ts +0 -11
  308. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  309. package/dist/types/src/capabilities/url-handler.d.ts +0 -4
  310. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  311. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +0 -6
  312. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +0 -1
  313. package/dist/types/src/components/DeckSettings/index.d.ts +0 -2
  314. package/dist/types/src/components/DeckSettings/index.d.ts.map +0 -1
  315. package/dist/types/src/events.d.ts +0 -4
  316. package/dist/types/src/events.d.ts.map +0 -1
  317. package/src/capabilities/app-graph-builder.ts +0 -143
  318. package/src/capabilities/capabilities.ts +0 -14
  319. package/src/capabilities/check-app-scheme.ts +0 -40
  320. package/src/capabilities/intent-resolver.ts +0 -472
  321. package/src/capabilities/react-root.tsx +0 -39
  322. package/src/capabilities/react-surface.tsx +0 -30
  323. package/src/capabilities/settings.ts +0 -26
  324. package/src/capabilities/state.ts +0 -105
  325. package/src/capabilities/toolkit.ts +0 -57
  326. package/src/capabilities/tools.ts +0 -84
  327. package/src/capabilities/url-handler.ts +0 -60
  328. package/src/components/DeckSettings/DeckSettings.tsx +0 -97
  329. package/src/components/DeckSettings/index.ts +0 -5
  330. package/src/events.ts +0 -11
  331. /package/dist/lib/{browser/state-IFKFOBBX.mjs.map → node-esm/types/index.mjs.map} +0 -0
@@ -0,0 +1,1390 @@
1
+ import {
2
+ getCompanionId,
3
+ useBreakpoints,
4
+ useCompanions,
5
+ useDeckCompanions,
6
+ useDeckState,
7
+ useHoistStatusbar,
8
+ useMainSize,
9
+ useNodeActionExpander,
10
+ useSelectedCompanion
11
+ } from "./chunk-Q4GUCIRE.mjs";
12
+ import {
13
+ calculateOverscroll,
14
+ layoutAppliesTopbar
15
+ } from "./chunk-BJDEG7YZ.mjs";
16
+ import {
17
+ parseEntryId
18
+ } from "./chunk-SKBPLX5T.mjs";
19
+ import {
20
+ DeckCapabilities,
21
+ DeckOperation,
22
+ PLANK_COMPANION_TYPE,
23
+ getMode
24
+ } from "./chunk-OAPMV5ZR.mjs";
25
+ import {
26
+ meta
27
+ } from "./chunk-FBL4WVYZ.mjs";
28
+
29
+ // src/components/DeckLayout/Banner.tsx
30
+ import React9 from "react";
31
+ import { Surface as Surface5 } from "@dxos/app-framework/ui";
32
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
33
+ import { mx as mx5, osTranslations } from "@dxos/ui-theme";
34
+
35
+ // src/components/Sidebar/ComplementarySidebar.tsx
36
+ import React7, { Fragment as Fragment2, useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
37
+ import { Surface as Surface3, useOperationInvoker as useOperationInvoker5 } from "@dxos/app-framework/ui";
38
+ import { LayoutOperation as LayoutOperation4 } from "@dxos/app-toolkit";
39
+ import { IconButton as IconButton4, Main, ScrollArea, toLocalizedString as toLocalizedString2, useTranslation as useTranslation5 } from "@dxos/react-ui";
40
+ import { Tabs } from "@dxos/react-ui-tabs";
41
+ import { mx as mx4 } from "@dxos/ui-theme";
42
+
43
+ // src/components/Plank/Plank.tsx
44
+ import { useFocusFinders } from "@fluentui/react-tabster";
45
+ import React5, { memo as memo2, useCallback as useCallback3, useLayoutEffect, useMemo as useMemo2, useRef } from "react";
46
+ import { Surface as Surface2, useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
47
+ import { LayoutOperation as LayoutOperation2 } from "@dxos/app-toolkit";
48
+ import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
49
+ import { debounce } from "@dxos/async";
50
+ import { useNode } from "@dxos/plugin-graph";
51
+ import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from "@dxos/react-ui-attention";
52
+ import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
53
+ import { mainIntrinsicSize, mx as mx3 } from "@dxos/ui-theme";
54
+
55
+ // src/components/Plank/PlankError.tsx
56
+ import React4, { useEffect as useEffect2, useState } from "react";
57
+ import { ErrorFallback, useTranslation as useTranslation3 } from "@dxos/react-ui";
58
+ import "@dxos/ui-theme";
59
+
60
+ // src/components/Plank/PlankHeading.tsx
61
+ import React2, { Fragment, memo, useCallback as useCallback2, useEffect, useMemo } from "react";
62
+ import { Surface, useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/ui";
63
+ import { LayoutOperation } from "@dxos/app-toolkit";
64
+ import { useAppGraph } from "@dxos/app-toolkit/ui";
65
+ import { Graph, useActionRunner } from "@dxos/plugin-graph";
66
+ import { Icon, IconButton as IconButton2, Popover, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
67
+ import { StackItem } from "@dxos/react-ui-stack";
68
+ import { TextTooltip } from "@dxos/react-ui-text-tooltip";
69
+ import { hoverableControls, hoverableFocusedWithinControls } from "@dxos/ui-theme";
70
+
71
+ // src/components/fragments.ts
72
+ import { mx } from "@dxos/ui-theme";
73
+ var soloInlinePadding = "ps-[calc(env(safe-area-inset-left)+.25rem)] pe-[calc(env(safe-area-inset-right)+.25rem)]";
74
+ var sidebarToggleStyles = "h-(--dx-rail-item) w-(--dx-rail-item) absolute bottom-2 z-[1] !bg-deck-surface lg:hidden";
75
+ var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "left-2");
76
+ var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "right-2");
77
+
78
+ // src/components/Plank/PlankControls.tsx
79
+ import React, { forwardRef, useCallback } from "react";
80
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
81
+ import { ButtonGroup, IconButton, useTranslation } from "@dxos/react-ui";
82
+ var PlankControl = ({ icon, label: label3, ...props }) => {
83
+ return /* @__PURE__ */ React.createElement(IconButton, {
84
+ label: label3,
85
+ icon,
86
+ iconOnly: true,
87
+ variant: "ghost",
88
+ tooltipSide: "bottom",
89
+ ...props
90
+ });
91
+ };
92
+ var plankControlSpacing = "px-2";
93
+ var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
94
+ const { t } = useTranslation(meta.id);
95
+ const { invokePromise } = useOperationInvoker();
96
+ const handleCloseCompanion = useCallback(() => {
97
+ return invokePromise(DeckOperation.ChangeCompanion, {
98
+ companion: null
99
+ });
100
+ }, [
101
+ invokePromise
102
+ ]);
103
+ return /* @__PURE__ */ React.createElement("div", {
104
+ ref: forwardedRef,
105
+ className: "contents dx-app-no-drag"
106
+ }, /* @__PURE__ */ React.createElement(PlankControl, {
107
+ label: t("close companion label"),
108
+ variant: "ghost",
109
+ icon: "ph--x--regular",
110
+ onClick: handleCloseCompanion,
111
+ classNames: plankControlSpacing
112
+ }));
113
+ });
114
+ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, layoutMode, pin, close = false, onClick, ...props }, forwardedRef) => {
115
+ const { t } = useTranslation(meta.id);
116
+ const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
117
+ const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
118
+ return /* @__PURE__ */ React.createElement(ButtonGroup, {
119
+ ...props,
120
+ classNames: [
121
+ "dx-app-no-drag opacity-100!",
122
+ classNames
123
+ ],
124
+ ref: forwardedRef
125
+ }, capabilities.deck ? /* @__PURE__ */ React.createElement(React.Fragment, null, capabilities.solo && /* @__PURE__ */ React.createElement(React.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React.createElement(PlankControl, {
126
+ label: t("show fullscreen plank label"),
127
+ classNames: buttonClassNames,
128
+ icon: "ph--corners-out--regular",
129
+ onClick: () => onClick?.("solo--fullscreen")
130
+ }), /* @__PURE__ */ React.createElement(PlankControl, {
131
+ label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : layoutIsAnySolo ? "show deck plank label" : "show solo plank label"),
132
+ classNames: buttonClassNames,
133
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : layoutIsAnySolo ? "ph--arrows-in-line-horizontal--regular" : "ph--arrows-out-line-horizontal--regular",
134
+ onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
135
+ })), !layoutIsAnySolo && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PlankControl, {
136
+ label: t("increment start label"),
137
+ disabled: !capabilities.incrementStart,
138
+ classNames: buttonClassNames,
139
+ icon: "ph--caret-left--regular",
140
+ onClick: () => onClick?.("increment-start")
141
+ }), /* @__PURE__ */ React.createElement(PlankControl, {
142
+ label: t("increment end label"),
143
+ disabled: !capabilities.incrementEnd,
144
+ classNames: buttonClassNames,
145
+ icon: "ph--caret-right--regular",
146
+ onClick: () => onClick?.("increment-end")
147
+ }))) : capabilities.fullscreen && /* @__PURE__ */ React.createElement(PlankControl, {
148
+ label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : "show fullscreen plank label"),
149
+ classNames: buttonClassNames,
150
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : "ph--corners-out--regular",
151
+ onClick: () => onClick?.("solo--fullscreen")
152
+ }), close && !layoutIsAnySolo && /* @__PURE__ */ React.createElement(PlankControl, {
153
+ label: t(`${typeof close === "string" ? "minify" : "close"} label`),
154
+ classNames: buttonClassNames,
155
+ "data-testid": "plankHeading.close",
156
+ icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular",
157
+ onClick: () => onClick?.("close")
158
+ }), capabilities.companion && /* @__PURE__ */ React.createElement(PlankControl, {
159
+ label: t("open companion label"),
160
+ classNames: buttonClassNames,
161
+ "data-testid": "plankHeading.companion",
162
+ icon: "ph--square-split-horizontal--regular",
163
+ onClick: () => onClick?.("companion")
164
+ }), children);
165
+ });
166
+
167
+ // src/components/Plank/PlankHeading.tsx
168
+ var MAX_COMPANIONS = 5;
169
+ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
170
+ const { t } = useTranslation2(meta.id);
171
+ const { invokePromise, invokeSync } = useOperationInvoker2();
172
+ const runAction = useActionRunner();
173
+ const { graph } = useAppGraph();
174
+ const breakpoint = useBreakpoints();
175
+ const icon = node?.properties?.icon ?? "ph--placeholder--regular";
176
+ const label3 = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
177
+ "plank heading fallback label",
178
+ {
179
+ ns: meta.id
180
+ }
181
+ ], t);
182
+ const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
183
+ useEffect(() => {
184
+ const frame = requestAnimationFrame(() => {
185
+ if (node) {
186
+ void Graph.expand(graph, node.id, "child");
187
+ }
188
+ });
189
+ return () => cancelAnimationFrame(frame);
190
+ }, [
191
+ node
192
+ ]);
193
+ const attendableId = primaryId ?? id;
194
+ const capabilities = useMemo(() => ({
195
+ deck: deckEnabled ?? true,
196
+ solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
197
+ incrementStart: canIncrementStart,
198
+ incrementEnd: canIncrementEnd,
199
+ fullscreen: !isCompanionNode,
200
+ companion: !isCompanionNode && companions && companions.length > 0
201
+ }), [
202
+ breakpoint,
203
+ part,
204
+ companions,
205
+ canIncrementStart,
206
+ canIncrementEnd,
207
+ isCompanionNode,
208
+ deckEnabled
209
+ ]);
210
+ const { variant } = parseEntryId(id);
211
+ const sigilActions = useMemo(() => {
212
+ if (!node) {
213
+ return void 0;
214
+ } else if (variant) {
215
+ return [];
216
+ } else {
217
+ return [
218
+ actions,
219
+ Graph.getActions(graph, node.id).filter((a) => [
220
+ "list-item",
221
+ "list-item-primary",
222
+ "heading-list-item"
223
+ ].includes(a.properties.disposition))
224
+ ].filter((a) => a.length > 0);
225
+ }
226
+ }, [
227
+ actions,
228
+ node,
229
+ variant,
230
+ graph
231
+ ]);
232
+ const handleAction = useCallback2((action) => {
233
+ if (typeof action.data === "function") {
234
+ void runAction(action, {
235
+ parent: node,
236
+ caller: meta.id
237
+ });
238
+ }
239
+ }, [
240
+ node,
241
+ runAction
242
+ ]);
243
+ const handlePlankAction = useCallback2((eventType) => {
244
+ if (eventType.startsWith("solo")) {
245
+ return invokePromise(DeckOperation.Adjust, {
246
+ type: eventType,
247
+ id
248
+ });
249
+ } else if (eventType === "close") {
250
+ if (part === "complementary") {
251
+ return invokeSync(LayoutOperation.UpdateComplementary, {
252
+ state: "collapsed"
253
+ });
254
+ } else {
255
+ return invokeSync(LayoutOperation.Close, {
256
+ subject: [
257
+ id
258
+ ]
259
+ });
260
+ }
261
+ } else {
262
+ return invokePromise(DeckOperation.Adjust, {
263
+ type: eventType,
264
+ id
265
+ });
266
+ }
267
+ }, [
268
+ invokePromise,
269
+ invokeSync,
270
+ id,
271
+ part
272
+ ]);
273
+ const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? Popover.Anchor : Fragment;
274
+ const handleTabClick = useCallback2((event) => {
275
+ const target = event.target.closest("[data-id]");
276
+ const tabId = target?.dataset?.id;
277
+ if (tabId) {
278
+ void invokePromise(DeckOperation.ChangeCompanion, {
279
+ companion: tabId
280
+ });
281
+ }
282
+ }, [
283
+ invokePromise
284
+ ]);
285
+ return /* @__PURE__ */ React2.createElement(StackItem.Heading, {
286
+ classNames: [
287
+ "py-1 items-stretch gap-1 sticky left-12 dx-app-drag min-w-0 dx-contain-layout dx-density-coarse",
288
+ part === "solo" ? soloInlinePadding : "px-1",
289
+ ...layoutMode === "solo--fullscreen" ? [
290
+ hoverableControls,
291
+ hoverableFocusedWithinControls,
292
+ "*:transition-opacity *:opacity-(--controls-opacity) bg-transparent border-transparent transition-[background-color,border-color]",
293
+ "hover-hover:hover:bg-header-surface focus-within:bg-header-surface hover-hover:hover:border-subdued-separator focus-within:border-subdued-separator"
294
+ ] : []
295
+ ],
296
+ "data-plank-heading": true
297
+ }, companions && isCompanionNode ? (
298
+ /* TODO(thure): IMPORTANT: This is a tablist; it should be implemented as such. */
299
+ /* @__PURE__ */ React2.createElement("div", {
300
+ role: "none",
301
+ className: "flex-1 min-w-0 overflow-x-auto scrollbar-none flex gap-1"
302
+ }, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React2.createElement(IconButton2, {
303
+ key: id2,
304
+ "data-id": id2,
305
+ icon: icon2,
306
+ iconOnly: companions.length > MAX_COMPANIONS && node?.id !== id2,
307
+ label: toLocalizedString(label4, t),
308
+ variant: node?.id === id2 ? "primary" : "ghost",
309
+ onClick: handleTabClick
310
+ })))
311
+ ) : /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React2.createElement(StackItem.Sigil, {
312
+ icon,
313
+ related: part === "complementary",
314
+ attendableId,
315
+ triggerLabel: t("actions menu label"),
316
+ actions: sigilActions,
317
+ onAction: handleAction
318
+ }, /* @__PURE__ */ React2.createElement(Surface.Surface, {
319
+ role: "menu-footer",
320
+ data: {
321
+ subject: node.data
322
+ }
323
+ })) : /* @__PURE__ */ React2.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React2.createElement("span", {
324
+ className: "sr-only"
325
+ }, label3), /* @__PURE__ */ React2.createElement(Icon, {
326
+ icon
327
+ }))), /* @__PURE__ */ React2.createElement(TextTooltip, {
328
+ text: label3,
329
+ onlyWhenTruncating: true
330
+ }, /* @__PURE__ */ React2.createElement(StackItem.HeadingLabel, {
331
+ attendableId,
332
+ related: part === "complementary",
333
+ ...pending && {
334
+ classNames: "text-description"
335
+ }
336
+ }, label3))), node && part !== "complementary" && /* @__PURE__ */ React2.createElement(Surface.Surface, {
337
+ role: "navbar-end",
338
+ data: {
339
+ subject: node.data
340
+ }
341
+ }), companioned === "companion" ? /* @__PURE__ */ React2.createElement(PlankCompanionControls, {
342
+ primary: primaryId
343
+ }) : /* @__PURE__ */ React2.createElement(PlankControls, {
344
+ capabilities,
345
+ layoutMode,
346
+ close: part === "complementary" ? "minify-end" : true,
347
+ onClick: handlePlankAction
348
+ }));
349
+ });
350
+
351
+ // src/components/Plank/PlankLoading.tsx
352
+ import React3 from "react";
353
+ var PlankLoading = () => {
354
+ return /* @__PURE__ */ React3.createElement("div", {
355
+ role: "none",
356
+ className: "grid place-items-center dx-attention-surface"
357
+ });
358
+ };
359
+
360
+ // src/components/Plank/PlankError.tsx
361
+ var PlankError = ({ id, part, node, error }) => {
362
+ const [timedOut, setTimedOut] = useState(false);
363
+ useEffect2(() => {
364
+ const timer = setTimeout(() => setTimedOut(true), 5e3);
365
+ return () => clearTimeout(timer);
366
+ }, []);
367
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(PlankHeading, {
368
+ id,
369
+ part,
370
+ node,
371
+ pending: !timedOut
372
+ }), timedOut ? /* @__PURE__ */ React4.createElement(PlankErrorFallback, {
373
+ error
374
+ }) : /* @__PURE__ */ React4.createElement(PlankLoading, null));
375
+ };
376
+ var PlankErrorFallback = ({ error }) => {
377
+ const { t } = useTranslation3(meta.id);
378
+ if (true) {
379
+ return /* @__PURE__ */ React4.createElement(ErrorFallback, {
380
+ title: "Plank Error",
381
+ error
382
+ });
383
+ } else {
384
+ const errorString = error?.toString() ?? "";
385
+ return /* @__PURE__ */ React4.createElement("div", {
386
+ role: "alert",
387
+ "data-testid": "plank-content-error",
388
+ className: "dx-attention-surface overflow-y-auto p-8 grid place-items-center"
389
+ }, /* @__PURE__ */ React4.createElement("p", {
390
+ className: mx2(descriptionMessage, "break-all rounded-md p-4")
391
+ }, error ? errorString : t("error fallback message")));
392
+ }
393
+ };
394
+
395
+ // src/components/Plank/Plank.tsx
396
+ var UNKNOWN_ID = "unknown_id";
397
+ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionVariant, ...props }) => {
398
+ const { graph } = useAppGraph2();
399
+ const node = useNode(graph, id);
400
+ const companions = useCompanions(id);
401
+ const { companionId } = useSelectedCompanion(companions, companionVariant);
402
+ const resolvedCompanionId = companionVariant ? companionId : void 0;
403
+ const currentCompanion = companions.find(({ id: id2 }) => id2 === resolvedCompanionId);
404
+ const hasCompanion = !!(resolvedCompanionId && currentCompanion);
405
+ return /* @__PURE__ */ React5.createElement(PlankContainer, {
406
+ solo: props.part === "solo",
407
+ companion: hasCompanion,
408
+ encapsulate: !!props.settings?.encapsulatedPlanks
409
+ }, /* @__PURE__ */ React5.createElement(PlankComponent, {
410
+ id,
411
+ node,
412
+ companioned: hasCompanion ? "primary" : void 0,
413
+ companions: hasCompanion ? [] : companions,
414
+ ...props,
415
+ ...props.part === "solo" ? {
416
+ part: "solo-primary"
417
+ } : {}
418
+ }), hasCompanion && /* @__PURE__ */ React5.createElement(PlankComponent, {
419
+ id: resolvedCompanionId,
420
+ node: currentCompanion,
421
+ primary: node,
422
+ companions,
423
+ companioned: "companion",
424
+ ...props,
425
+ ...props.part === "solo" ? {
426
+ part: "solo-companion"
427
+ } : {
428
+ order: (props.order ?? 0) + 1
429
+ }
430
+ }));
431
+ });
432
+ var PlankContainer = ({ children, solo, companion, encapsulate }) => {
433
+ const sizeAttrs = useMainSize();
434
+ if (!solo) {
435
+ return children;
436
+ }
437
+ return /* @__PURE__ */ React5.createElement("div", {
438
+ role: "none",
439
+ "data-popover-collision-boundary": true,
440
+ className: mx3("absolute inset-(--main-spacing) grid", encapsulate && "border border-separator rounded-sm overflow-hidden", companion && "grid-cols-[6fr_4fr]", railGridHorizontal, mainIntrinsicSize),
441
+ ...sizeAttrs
442
+ }, children);
443
+ };
444
+ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order, active, companioned, node, primary, companions, settings }) => {
445
+ const { invokePromise } = useOperationInvoker3();
446
+ const { state, deck } = useDeckState();
447
+ const { popoverAnchorId, scrollIntoView } = state;
448
+ const { findFirstFocusable } = useFocusFinders();
449
+ const canResize = layoutMode === "deck";
450
+ const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
451
+ const index = active ? active.findIndex((entryId) => entryId === id) : 0;
452
+ const length = active?.length ?? 1;
453
+ const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
454
+ const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
455
+ const rootElement = useRef(null);
456
+ const { variant } = parseEntryId(id);
457
+ const sizeKey = `${id.split("+")[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR}${variant}` : ""}`;
458
+ const size = deck.plankSizing[sizeKey];
459
+ const handleSizeChange = useCallback3(debounce((nextSize) => {
460
+ return invokePromise(DeckOperation.UpdatePlankSize, {
461
+ id: sizeKey,
462
+ size: nextSize
463
+ });
464
+ }, 200), [
465
+ invokePromise,
466
+ sizeKey
467
+ ]);
468
+ const handleKeyDown = useCallback3((event) => {
469
+ if (event.target === event.currentTarget) {
470
+ switch (event.key) {
471
+ case "Escape":
472
+ rootElement.current?.closest("main")?.focus();
473
+ break;
474
+ case "Enter":
475
+ rootElement.current && findFirstFocusable(rootElement.current)?.focus();
476
+ break;
477
+ }
478
+ }
479
+ }, []);
480
+ useLayoutEffect(() => {
481
+ if (scrollIntoView === id) {
482
+ layoutMode === "deck" && rootElement.current?.scrollIntoView({
483
+ behavior: "smooth",
484
+ inline: "center"
485
+ });
486
+ void invokePromise(LayoutOperation2.ScrollIntoView, {
487
+ subject: void 0
488
+ });
489
+ }
490
+ }, [
491
+ id,
492
+ scrollIntoView,
493
+ layoutMode,
494
+ invokePromise
495
+ ]);
496
+ const isSolo = layoutMode.startsWith("solo") && part === "solo";
497
+ const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
498
+ const sizeAttrs = useMainSize();
499
+ const data = useMemo2(() => node && {
500
+ attendableId: id,
501
+ subject: node.data,
502
+ companionTo: primary?.data,
503
+ properties: node.properties,
504
+ variant,
505
+ path,
506
+ popoverAnchorId
507
+ }, [
508
+ node,
509
+ node?.data,
510
+ node?.properties,
511
+ path,
512
+ popoverAnchorId,
513
+ primary?.data,
514
+ variant
515
+ ]);
516
+ const placeholder = useMemo2(() => /* @__PURE__ */ React5.createElement(PlankLoading, null), []);
517
+ const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
518
+ const fullscreen = layoutMode === "solo--fullscreen";
519
+ const className = mx3("dx-attention-surface relative dx-focus-ring-inset-over-all dx-density-coarse", isSolo && "absolute inset-0", isSolo && mainIntrinsicSize, railGridHorizontal, part.startsWith("solo") && "grid", part.startsWith("solo-") && "grid-rows-subgrid row-span-2 min-w-0", fullscreen && "grid-rows-1", part === "deck" && (companioned === "companion" ? "border-separator! border-e" : "border-separator! border-x"), part === "solo-companion" && "border-separator! border-s", settings?.encapsulatedPlanks && !part.startsWith("solo") && "mx-(--main-spacing) border-separator! border rounded-sm overflow-hidden");
520
+ return /* @__PURE__ */ React5.createElement(Root, {
521
+ ref: rootElement,
522
+ "data-testid": "deck.plank",
523
+ "data-popover-collision-boundary": true,
524
+ tabIndex: 0,
525
+ ...part.startsWith("solo") ? {
526
+ ...sizeAttrs,
527
+ className
528
+ } : {
529
+ item: {
530
+ id
531
+ },
532
+ size,
533
+ onSizeChange: handleSizeChange,
534
+ classNames: className,
535
+ order,
536
+ role: "article"
537
+ },
538
+ ...isAttendable ? attentionAttrs : {},
539
+ onKeyDown: handleKeyDown
540
+ }, node ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, !fullscreen && /* @__PURE__ */ React5.createElement(PlankHeading, {
541
+ id,
542
+ part: part.startsWith("solo-") ? "solo" : part,
543
+ node,
544
+ layoutMode,
545
+ deckEnabled: settings?.enableDeck,
546
+ canIncrementStart,
547
+ canIncrementEnd,
548
+ popoverAnchorId,
549
+ primaryId: primary?.id,
550
+ companioned,
551
+ companions
552
+ }), /* @__PURE__ */ React5.createElement(Surface2.Surface, {
553
+ key: node.id,
554
+ role: "article",
555
+ data,
556
+ limit: 1,
557
+ fallback: PlankErrorFallback,
558
+ placeholder
559
+ })) : /* @__PURE__ */ React5.createElement(PlankError, {
560
+ id,
561
+ part
562
+ }), canResize && /* @__PURE__ */ React5.createElement(StackItem2.ResizeHandle, null));
563
+ });
564
+
565
+ // src/components/Sidebar/SidebarButton.tsx
566
+ import React6, { useCallback as useCallback4 } from "react";
567
+ import { useOperationInvoker as useOperationInvoker4 } from "@dxos/app-framework/ui";
568
+ import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
569
+ import { IconButton as IconButton3, useTranslation as useTranslation4 } from "@dxos/react-ui";
570
+ var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
571
+ const { updateState } = useDeckState();
572
+ const { t } = useTranslation4(meta.id);
573
+ const handleClick = useCallback4(() => {
574
+ updateState((state) => ({
575
+ ...state,
576
+ sidebarState: state.sidebarState === "expanded" ? "collapsed" : "expanded"
577
+ }));
578
+ }, [
579
+ updateState
580
+ ]);
581
+ return /* @__PURE__ */ React6.createElement(IconButton3, {
582
+ variant,
583
+ icon: "ph--sidebar--regular",
584
+ iconOnly: true,
585
+ size: 4,
586
+ label: t("open navigation sidebar label"),
587
+ onClick: handleClick,
588
+ classNames
589
+ });
590
+ };
591
+ var CloseSidebarButton = () => {
592
+ const { updateState } = useDeckState();
593
+ const { t } = useTranslation4(meta.id);
594
+ const handleClick = useCallback4(() => {
595
+ updateState((state) => ({
596
+ ...state,
597
+ sidebarState: "collapsed"
598
+ }));
599
+ }, [
600
+ updateState
601
+ ]);
602
+ return /* @__PURE__ */ React6.createElement(IconButton3, {
603
+ variant: "ghost",
604
+ icon: "ph--caret-line-left--regular",
605
+ iconOnly: true,
606
+ size: 4,
607
+ label: t("close navigation sidebar label"),
608
+ onClick: handleClick,
609
+ classNames: "rounded-none px-1 dx-focus-ring-inset pe-[max(.5rem,env(safe-area-inset-left))]"
610
+ });
611
+ };
612
+ var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
613
+ const { invokeSync } = useOperationInvoker4();
614
+ const { state, updateState } = useDeckState();
615
+ const { t } = useTranslation4(meta.id);
616
+ const companions = useDeckCompanions();
617
+ const handleClick = useCallback4(() => {
618
+ const nextState = state.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
619
+ updateState((state2) => ({
620
+ ...state2,
621
+ complementarySidebarState: nextState
622
+ }));
623
+ const subject = state.complementarySidebarPanel ?? (companions[0] && getCompanionId(companions[0].id));
624
+ if (nextState === "expanded" && !current && subject) {
625
+ invokeSync(LayoutOperation3.UpdateComplementary, {
626
+ subject
627
+ });
628
+ }
629
+ }, [
630
+ state,
631
+ updateState,
632
+ current,
633
+ companions,
634
+ invokeSync
635
+ ]);
636
+ return /* @__PURE__ */ React6.createElement(IconButton3, {
637
+ variant: "ghost",
638
+ classNames: [
639
+ "[&>svg]:-scale-x-100",
640
+ classNames
641
+ ],
642
+ icon: "ph--sidebar-simple--regular",
643
+ iconOnly: true,
644
+ label: t("open complementary sidebar label"),
645
+ size: inR0 ? 5 : 4,
646
+ tooltipSide: inR0 ? "left" : void 0,
647
+ onClick: handleClick
648
+ });
649
+ };
650
+
651
+ // src/components/Sidebar/ComplementarySidebar.tsx
652
+ var label = [
653
+ "complementary sidebar title",
654
+ {
655
+ ns: meta.id
656
+ }
657
+ ];
658
+ var ComplementarySidebar = ({ current }) => {
659
+ const { t } = useTranslation5(meta.id);
660
+ const { invokeSync } = useOperationInvoker5();
661
+ const { state, deck, updateState } = useDeckState();
662
+ const layoutMode = getMode(deck);
663
+ const breakpoint = useBreakpoints();
664
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
665
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
666
+ const companions = useDeckCompanions();
667
+ const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
668
+ const activeId = activeCompanion && getCompanionId(activeCompanion.id);
669
+ const [internalValue, setInternalValue] = useState2(activeId);
670
+ useEffect3(() => {
671
+ setInternalValue(activeId);
672
+ }, [
673
+ activeId
674
+ ]);
675
+ const handleTabClick = useCallback5((event) => {
676
+ const nextValue = event.currentTarget.getAttribute("data-value");
677
+ if (nextValue === activeId) {
678
+ updateState((state2) => ({
679
+ ...state2,
680
+ complementarySidebarState: state2.complementarySidebarState === "expanded" ? "collapsed" : "expanded"
681
+ }));
682
+ } else {
683
+ setInternalValue(nextValue);
684
+ updateState((state2) => ({
685
+ ...state2,
686
+ complementarySidebarState: "expanded"
687
+ }));
688
+ invokeSync(LayoutOperation4.UpdateComplementary, {
689
+ subject: nextValue
690
+ });
691
+ }
692
+ }, [
693
+ state.complementarySidebarState,
694
+ activeId,
695
+ invokeSync,
696
+ updateState
697
+ ]);
698
+ const data = useMemo3(() => activeCompanion && {
699
+ id: activeCompanion.id,
700
+ subject: activeCompanion.data
701
+ }, [
702
+ activeCompanion?.id,
703
+ activeCompanion?.data
704
+ ]);
705
+ useEffect3(() => {
706
+ if (!activeId) {
707
+ invokeSync(LayoutOperation4.UpdateComplementary, {
708
+ state: "collapsed"
709
+ });
710
+ }
711
+ }, [
712
+ activeId,
713
+ invokeSync
714
+ ]);
715
+ return /* @__PURE__ */ React7.createElement(Main.ComplementarySidebar, {
716
+ label,
717
+ classNames: [
718
+ topbar && "top-[calc(env(safe-area-inset-top)+var(--dx-rail-size))]",
719
+ hoistStatusbar && "bottom-(--dx-statusbar-size)"
720
+ ]
721
+ }, /* @__PURE__ */ React7.createElement(Tabs.Root, {
722
+ orientation: "vertical",
723
+ verticalVariant: "stateless",
724
+ value: internalValue,
725
+ classNames: "contents"
726
+ }, /* @__PURE__ */ React7.createElement("div", {
727
+ role: "none",
728
+ className: mx4("absolute z-[1] inset-y-0 end-0 !w-(--dx-r0-size)", "py-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] border-s border-subdued-separator", "grid grid-cols-1 grid-rows-[1fr_min-content] bg-toolbar-surface dx-contain-layout dx-app-drag")
729
+ }, /* @__PURE__ */ React7.createElement(Tabs.Tablist, {
730
+ classNames: "grid grid-cols-1 auto-rows-(--dx-rail-action) p-1 gap-1 overflow-y-auto!"
731
+ }, companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tab, {
732
+ key: getCompanionId(companion.id),
733
+ value: getCompanionId(companion.id),
734
+ asChild: true
735
+ }, /* @__PURE__ */ React7.createElement(IconButton4, {
736
+ label: toLocalizedString2(companion.properties.label, t),
737
+ icon: companion.properties.icon,
738
+ iconOnly: true,
739
+ tooltipSide: "left",
740
+ "data-value": getCompanionId(companion.id),
741
+ variant: activeId === getCompanionId(companion.id) ? state.complementarySidebarState === "expanded" ? "primary" : "default" : "ghost",
742
+ onClick: handleTabClick
743
+ })))), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
744
+ role: "none",
745
+ className: "grid grid-cols-1 auto-rows-(--dx-rail-item) p-1 overflow-y-auto"
746
+ }, /* @__PURE__ */ React7.createElement(Surface3.Surface, {
747
+ role: "status-bar--r0-footer",
748
+ limit: 1
749
+ })), /* @__PURE__ */ React7.createElement("div", {
750
+ role: "none",
751
+ className: "hidden lg:grid grid-cols-1 auto-rows-(--dx-rail-action) p-1"
752
+ }, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), activeId && companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
753
+ key: getCompanionId(companion.id),
754
+ value: getCompanionId(companion.id),
755
+ classNames: [
756
+ 'absolute data-[state="inactive"]:-z-[1] overflow-hidden',
757
+ "inset-y-0 start-0 w-[calc(100%-var(--dx-r0-size))] lg:w-(--dx-r1-size)",
758
+ "grid grid-cols-1 grid-rows-[var(--dx-rail-size)_1fr_min-content] py-[env(safe-area-inset-top)]"
759
+ ],
760
+ ...state.complementarySidebarState !== "expanded" && {
761
+ inert: true
762
+ }
763
+ }, /* @__PURE__ */ React7.createElement(ComplementarySidebarPanel, {
764
+ companion,
765
+ activeId,
766
+ data,
767
+ hoistStatusbar
768
+ })))));
769
+ };
770
+ var ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }) => {
771
+ const { t } = useTranslation5(meta.id);
772
+ if (getCompanionId(companion.id) !== activeId && !data) {
773
+ return null;
774
+ }
775
+ const Wrapper = companion.properties.fixed ? Fragment2 : ScrollAreaWrapper;
776
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("div", {
777
+ role: "none",
778
+ className: "flex items-center p-1 gap-1 border-b border-subdued-separator"
779
+ }, /* @__PURE__ */ React7.createElement(IconButton4, {
780
+ label: toLocalizedString2(companion.properties.label, t),
781
+ icon: companion.properties.icon,
782
+ iconOnly: true,
783
+ tooltipSide: "left",
784
+ "data-value": getCompanionId(companion.id),
785
+ classNames: "h-10 w-10",
786
+ variant: "default"
787
+ }), /* @__PURE__ */ React7.createElement("div", {
788
+ role: "none",
789
+ className: "px-1"
790
+ }, toLocalizedString2(companion.properties.label, t))), /* @__PURE__ */ React7.createElement(Wrapper, null, /* @__PURE__ */ React7.createElement(Surface3.Surface, {
791
+ role: `deck-companion--${getCompanionId(companion.id)}`,
792
+ data,
793
+ fallback: PlankErrorFallback,
794
+ placeholder: /* @__PURE__ */ React7.createElement(PlankLoading, null)
795
+ })), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
796
+ role: "contentinfo",
797
+ className: "flex flex-wrap justify-center items-center border-y border-subdued-separator pt-1 pb-[max(env(safe-area-inset-bottom),0.25rem)]"
798
+ }, /* @__PURE__ */ React7.createElement(Surface3.Surface, {
799
+ role: "status-bar--r1-footer",
800
+ limit: 1
801
+ })));
802
+ };
803
+ var ScrollAreaWrapper = ({ children }) => {
804
+ return /* @__PURE__ */ React7.createElement(ScrollArea.Root, {
805
+ thin: true,
806
+ orientation: "vertical",
807
+ classNames: "grow"
808
+ }, /* @__PURE__ */ React7.createElement(ScrollArea.Viewport, null, children));
809
+ };
810
+
811
+ // src/components/Sidebar/Sidebar.tsx
812
+ import React8, { useMemo as useMemo4 } from "react";
813
+ import { Surface as Surface4 } from "@dxos/app-framework/ui";
814
+ import { Main as Main2 } from "@dxos/react-ui";
815
+ var label2 = [
816
+ "sidebar title",
817
+ {
818
+ ns: meta.id
819
+ }
820
+ ];
821
+ var Sidebar = () => {
822
+ const { state, deck } = useDeckState();
823
+ const { popoverAnchorId, activeDeck: current } = state;
824
+ const breakpoint = useBreakpoints();
825
+ const layoutMode = getMode(deck);
826
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
827
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
828
+ const navigationData = useMemo4(() => ({
829
+ popoverAnchorId,
830
+ topbar,
831
+ hoistStatusbar,
832
+ current
833
+ }), [
834
+ popoverAnchorId,
835
+ topbar,
836
+ hoistStatusbar,
837
+ current
838
+ ]);
839
+ return /* @__PURE__ */ React8.createElement(Main2.NavigationSidebar, {
840
+ label: label2,
841
+ classNames: [
842
+ "grid",
843
+ topbar && "top-[calc(env(safe-area-inset-top)+var(--dx-rail-size))]",
844
+ hoistStatusbar && "bottom-(--dx-statusbar-size)"
845
+ ]
846
+ }, /* @__PURE__ */ React8.createElement(Surface4.Surface, {
847
+ role: "navigation",
848
+ data: navigationData,
849
+ limit: 1
850
+ }));
851
+ };
852
+
853
+ // src/components/DeckLayout/Banner.tsx
854
+ var Banner = ({ variant, classNames }) => {
855
+ const { t } = useTranslation6(meta.id);
856
+ return /* @__PURE__ */ React9.createElement("header", {
857
+ className: mx5("flex items-stretch relative py-1 ps-1 pe-2", variant === "topbar" && "fixed inset-x-0 top-[env(safe-area-inset-top)] h-(--dx-rail-size) border-b border-separator", classNames)
858
+ }, variant === "sidebar" ? /* @__PURE__ */ React9.createElement(CloseSidebarButton, null) : /* @__PURE__ */ React9.createElement(ToggleSidebarButton, null), /* @__PURE__ */ React9.createElement("span", {
859
+ className: "self-center grow ms-1"
860
+ }, t("current app name", {
861
+ ns: osTranslations
862
+ })), variant === "topbar" && /* @__PURE__ */ React9.createElement("div", {
863
+ role: "none",
864
+ className: "absolute inset-0 pointer-events-none"
865
+ }, /* @__PURE__ */ React9.createElement("div", {
866
+ role: "none",
867
+ className: "grid h-full pointer-fine:p-1 max-w-md mx-auto pointer-events-auto"
868
+ }, /* @__PURE__ */ React9.createElement(Surface5.Surface, {
869
+ role: "search-input",
870
+ limit: 1
871
+ }))), /* @__PURE__ */ React9.createElement("span", {
872
+ role: "none",
873
+ className: "grow"
874
+ }), /* @__PURE__ */ React9.createElement(Surface5.Surface, {
875
+ role: "header-end",
876
+ limit: 1
877
+ }), /* @__PURE__ */ React9.createElement(Surface5.Surface, {
878
+ role: "notch-start",
879
+ limit: 1
880
+ }));
881
+ };
882
+
883
+ // src/components/DeckLayout/DeckLayout.tsx
884
+ import React18 from "react";
885
+ import { Mosaic } from "@dxos/react-ui-mosaic";
886
+
887
+ // src/components/DeckLayout/ActiveNode.tsx
888
+ import React10 from "react";
889
+ import { Surface as Surface6 } from "@dxos/app-framework/ui";
890
+ import { useAppGraph as useAppGraph3 } from "@dxos/app-toolkit/ui";
891
+ import { useNode as useNode2 } from "@dxos/plugin-graph";
892
+ import { useAttended } from "@dxos/react-ui-attention";
893
+ var ActiveNode = () => {
894
+ const [id] = useAttended();
895
+ const { graph } = useAppGraph3();
896
+ const activeNode = useNode2(graph, id);
897
+ useNodeActionExpander(activeNode);
898
+ return /* @__PURE__ */ React10.createElement("div", {
899
+ role: "none",
900
+ className: "sr-only"
901
+ }, /* @__PURE__ */ React10.createElement(Surface6.Surface, {
902
+ role: "document-title",
903
+ data: {
904
+ subject: activeNode
905
+ },
906
+ limit: 1
907
+ }));
908
+ };
909
+
910
+ // src/components/DeckLayout/DeckMain.tsx
911
+ import React14, { Fragment as Fragment3, useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2 } from "react";
912
+ import { useAtomCapability, useOperationInvoker as useOperationInvoker6, usePluginManager } from "@dxos/app-framework/ui";
913
+ import { LayoutOperation as LayoutOperation5 } from "@dxos/app-toolkit";
914
+ import { AttentionCapabilities } from "@dxos/plugin-attention";
915
+ import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
916
+ import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from "@dxos/react-ui-stack";
917
+ import { mainPaddingTransitions, mx as mx6 } from "@dxos/ui-theme";
918
+
919
+ // src/components/DeckLayout/ContentEmpty.tsx
920
+ import React11 from "react";
921
+ import { Surface as Surface7 } from "@dxos/app-framework/ui";
922
+ var ContentEmpty = () => {
923
+ const breakpoint = useBreakpoints();
924
+ const { deck } = useDeckState();
925
+ const layoutMode = getMode(deck);
926
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
927
+ return /* @__PURE__ */ React11.createElement("div", {
928
+ role: "none",
929
+ className: "grid place-items-center p-8 relative bg-deck-surface",
930
+ "data-testid": "layoutPlugin.firstRunMessage"
931
+ }, /* @__PURE__ */ React11.createElement(Surface7.Surface, {
932
+ role: "keyshortcuts"
933
+ }), !topbar && /* @__PURE__ */ React11.createElement(ToggleSidebarButton, {
934
+ variant: "default",
935
+ classNames: fixedSidebarToggleStyles
936
+ }));
937
+ };
938
+
939
+ // src/components/DeckLayout/StatusBar.tsx
940
+ import React12 from "react";
941
+ import { Surface as Surface8 } from "@dxos/app-framework/ui";
942
+ import { useLandmarkMover } from "@dxos/react-ui";
943
+ var StatusBar = ({ showHints }) => {
944
+ const mover = useLandmarkMover(void 0, "3");
945
+ return /* @__PURE__ */ React12.createElement("div", {
946
+ role: "contentinfo",
947
+ className: "fixed bottom-0 inset-x-0 h-(--dx-statusbar-size) border-y border-separator z-[2] flex text-description",
948
+ ...mover
949
+ }, showHints && /* @__PURE__ */ React12.createElement(Surface8.Surface, {
950
+ role: "hints",
951
+ limit: 1
952
+ }), /* @__PURE__ */ React12.createElement(Surface8.Surface, {
953
+ role: "status-bar",
954
+ limit: 1
955
+ }));
956
+ };
957
+
958
+ // src/components/DeckLayout/Topbar.tsx
959
+ import React13 from "react";
960
+ var Topbar = () => {
961
+ return /* @__PURE__ */ React13.createElement(Banner, {
962
+ variant: "topbar"
963
+ });
964
+ };
965
+
966
+ // src/components/DeckLayout/DeckMain.tsx
967
+ var DeckMain = () => {
968
+ const { invokeSync } = useOperationInvoker6();
969
+ const settings = useAtomCapability(DeckCapabilities.Settings);
970
+ const { state, deck, updateState } = useDeckState();
971
+ const { sidebarState, complementarySidebarState, complementarySidebarPanel } = state;
972
+ const { active, companionOpen, companionVariant, fullscreen, solo, plankSizing } = deck;
973
+ const effectiveCompanionVariant = companionOpen ? companionVariant : void 0;
974
+ const layoutMode = getMode(deck);
975
+ const breakpoint = useBreakpoints();
976
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
977
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
978
+ const pluginManager = usePluginManager();
979
+ const scrollLeftRef = useRef2(null);
980
+ const deckRef = useRef2(null);
981
+ useEffect4(() => {
982
+ const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
983
+ const attended = attention.getCurrent();
984
+ const firstId = solo ?? active[0];
985
+ if (attended.length === 0 && firstId) {
986
+ document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
987
+ }
988
+ }, []);
989
+ const [isNotMobile] = useMediaQuery("md");
990
+ const shouldRevert = useRef2(false);
991
+ useEffect4(() => {
992
+ if (!isNotMobile && layoutMode === "deck") {
993
+ const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
994
+ const attended = attention.getCurrent();
995
+ shouldRevert.current = true;
996
+ invokeSync(LayoutOperation5.SetLayoutMode, {
997
+ subject: attended[0],
998
+ mode: "solo"
999
+ });
1000
+ } else if (isNotMobile && layoutMode === "solo" && shouldRevert.current) {
1001
+ invokeSync(LayoutOperation5.SetLayoutMode, {
1002
+ revert: true
1003
+ });
1004
+ }
1005
+ }, [
1006
+ isNotMobile,
1007
+ layoutMode,
1008
+ invokeSync
1009
+ ]);
1010
+ useEffect4(() => {
1011
+ if (!settings?.enableDeck && layoutMode === "deck") {
1012
+ invokeSync(LayoutOperation5.SetLayoutMode, {
1013
+ subject: active[0],
1014
+ mode: "solo"
1015
+ });
1016
+ }
1017
+ }, [
1018
+ settings?.enableDeck,
1019
+ invokeSync,
1020
+ active,
1021
+ layoutMode
1022
+ ]);
1023
+ const handleResize = useCallback6(() => {
1024
+ scrollLeftRef.current = null;
1025
+ }, []);
1026
+ useEffect4(() => {
1027
+ window.addEventListener("resize", handleResize);
1028
+ return () => window.removeEventListener("resize", handleResize);
1029
+ }, [
1030
+ handleResize
1031
+ ]);
1032
+ const restoreScroll = useCallback6(() => {
1033
+ if (deckRef.current && scrollLeftRef.current != null) {
1034
+ deckRef.current.scrollLeft = scrollLeftRef.current;
1035
+ }
1036
+ }, []);
1037
+ useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
1038
+ const handleScroll = useCallback6((event) => {
1039
+ if (!solo && event.currentTarget === event.target) {
1040
+ scrollLeftRef.current = event.target.scrollLeft;
1041
+ }
1042
+ }, [
1043
+ solo
1044
+ ]);
1045
+ const isEmpty = !solo && active.length === 0;
1046
+ const padding = useMemo5(() => {
1047
+ if (!solo && settings?.overscroll === "centering") {
1048
+ return calculateOverscroll(active.length);
1049
+ }
1050
+ return {};
1051
+ }, [
1052
+ solo,
1053
+ settings?.overscroll,
1054
+ deck
1055
+ ]);
1056
+ const mainPosition = useMemo5(() => [
1057
+ "grid !top-[env(safe-area-inset-top)]",
1058
+ topbar && "!top-[calc(env(safe-area-inset-top)+var(--dx-rail-size))]",
1059
+ hoistStatusbar && "lg:bottom-(--dx-statusbar-size)"
1060
+ ], [
1061
+ topbar,
1062
+ hoistStatusbar
1063
+ ]);
1064
+ const { order, itemsCount } = useMemo5(() => {
1065
+ return active.reduce((acc, entryId) => {
1066
+ acc.order[entryId] = acc.itemsCount + 1;
1067
+ acc.itemsCount += companionOpen ? 3 : 2;
1068
+ return acc;
1069
+ }, {
1070
+ order: {},
1071
+ itemsCount: 0
1072
+ });
1073
+ }, [
1074
+ active,
1075
+ companionOpen
1076
+ ]);
1077
+ const handleNavigationSidebarStateChange = useCallback6((next) => {
1078
+ updateState((s) => ({
1079
+ ...s,
1080
+ sidebarState: next
1081
+ }));
1082
+ }, [
1083
+ updateState
1084
+ ]);
1085
+ const handleComplementarySidebarStateChange = useCallback6((next) => {
1086
+ updateState((s) => ({
1087
+ ...s,
1088
+ complementarySidebarState: next
1089
+ }));
1090
+ }, [
1091
+ updateState
1092
+ ]);
1093
+ return /* @__PURE__ */ React14.createElement(Main3.Root, {
1094
+ navigationSidebarState: fullscreen ? "closed" : sidebarState,
1095
+ complementarySidebarState: fullscreen ? "closed" : complementarySidebarState,
1096
+ onNavigationSidebarStateChange: handleNavigationSidebarStateChange,
1097
+ onComplementarySidebarStateChange: handleComplementarySidebarStateChange
1098
+ }, /* @__PURE__ */ React14.createElement(Sidebar, null), /* @__PURE__ */ React14.createElement(ComplementarySidebar, {
1099
+ current: complementarySidebarPanel
1100
+ }), /* @__PURE__ */ React14.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
1101
+ bounce: true,
1102
+ handlesFocus: true,
1103
+ classNames: mainPosition
1104
+ }, /* @__PURE__ */ React14.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
1105
+ bounce: true,
1106
+ handlesFocus: true,
1107
+ classNames: mainPosition,
1108
+ style: {
1109
+ "--main-spacing": settings?.encapsulatedPlanks ? "0.75rem" : "0",
1110
+ "--dx-main-sidebar-width": sidebarState === "expanded" ? "var(--dx-nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--dx-l0-size)" : "0",
1111
+ "--dx-main-complementary-width": complementarySidebarState === "expanded" ? "var(--dx-complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--dx-rail-size)" : "0",
1112
+ "--dx-main-content-first-width": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
1113
+ "--dx-main-content-last-width": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
1114
+ }
1115
+ }, /* @__PURE__ */ React14.createElement("div", {
1116
+ role: "none",
1117
+ className: !solo ? "relative bg-deck-surface overflow-hidden" : "sr-only",
1118
+ ...solo && {
1119
+ inert: true
1120
+ }
1121
+ }, !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
1122
+ classNames: fixedSidebarToggleStyles
1123
+ }), !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
1124
+ classNames: fixedComplementarySidebarToggleStyles
1125
+ }), /* @__PURE__ */ React14.createElement(Stack, {
1126
+ ref: deckRef,
1127
+ orientation: "horizontal",
1128
+ size: "contain",
1129
+ itemsCount: itemsCount - 1,
1130
+ classNames: [
1131
+ "absolute inset-y-(--main-spacing) -inset-w-px h-[calc(100%-2*var(--main-spacing))]",
1132
+ mainPaddingTransitions
1133
+ ],
1134
+ style: padding,
1135
+ onScroll: handleScroll
1136
+ }, active.map((entryId) => /* @__PURE__ */ React14.createElement(Fragment3, {
1137
+ key: entryId
1138
+ }, /* @__PURE__ */ React14.createElement(PlankSeparator, {
1139
+ order: order[entryId] - 1,
1140
+ encapsulate: !!settings?.enableDeck
1141
+ }), /* @__PURE__ */ React14.createElement(Plank, {
1142
+ id: entryId,
1143
+ companionVariant: effectiveCompanionVariant,
1144
+ part: "deck",
1145
+ order: order[entryId],
1146
+ active,
1147
+ layoutMode,
1148
+ settings
1149
+ }))))), /* @__PURE__ */ React14.createElement("div", {
1150
+ role: "none",
1151
+ className: solo ? "relative overflow-hidden bg-deck-surface" : "sr-only",
1152
+ ...!solo && {
1153
+ inert: true
1154
+ }
1155
+ }, !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
1156
+ classNames: fixedSidebarToggleStyles
1157
+ }), !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
1158
+ classNames: fixedComplementarySidebarToggleStyles
1159
+ }), /* @__PURE__ */ React14.createElement(StackContext.Provider, {
1160
+ value: {
1161
+ orientation: "horizontal",
1162
+ size: "contain",
1163
+ rail: true
1164
+ }
1165
+ }, /* @__PURE__ */ React14.createElement(Plank, {
1166
+ id: solo,
1167
+ companionVariant: effectiveCompanionVariant,
1168
+ part: "solo",
1169
+ layoutMode,
1170
+ settings
1171
+ })))), topbar && /* @__PURE__ */ React14.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React14.createElement(StatusBar, {
1172
+ showHints: settings?.showHints
1173
+ }));
1174
+ };
1175
+ var PlankSeparator = ({ order, encapsulate }) => order > 0 ? /* @__PURE__ */ React14.createElement("span", {
1176
+ role: "separator",
1177
+ className: mx6("row-span-2 bg-deck-surface", encapsulate ? "w-0" : "w-4"),
1178
+ style: {
1179
+ gridColumn: order
1180
+ }
1181
+ }) : null;
1182
+
1183
+ // src/components/DeckLayout/Dialog.tsx
1184
+ import React15, { useCallback as useCallback7 } from "react";
1185
+ import { Surface as Surface9 } from "@dxos/app-framework/ui";
1186
+ import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
1187
+ var Dialog = () => {
1188
+ const { state, updateEphemeral } = useDeckState();
1189
+ const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = state;
1190
+ const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
1191
+ const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
1192
+ const handleOpenChange = useCallback7((nextOpen) => {
1193
+ updateEphemeral((s) => ({
1194
+ ...s,
1195
+ dialogOpen: nextOpen
1196
+ }));
1197
+ }, [
1198
+ updateEphemeral
1199
+ ]);
1200
+ return /* @__PURE__ */ React15.createElement(Root, {
1201
+ modal: dialogBlockAlign !== "end",
1202
+ open: dialogOpen,
1203
+ onOpenChange: handleOpenChange
1204
+ }, dialogBlockAlign === "end" ? (
1205
+ // TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
1206
+ /* @__PURE__ */ React15.createElement(Surface9.Surface, {
1207
+ role: "dialog",
1208
+ data: dialogContent,
1209
+ limit: 1,
1210
+ fallback: PlankErrorFallback,
1211
+ placeholder: /* @__PURE__ */ React15.createElement("div", null)
1212
+ })
1213
+ ) : /* @__PURE__ */ React15.createElement(Overlay, {
1214
+ blockAlign: dialogBlockAlign,
1215
+ classNames: dialogOverlayClasses,
1216
+ style: dialogOverlayStyle
1217
+ }, /* @__PURE__ */ React15.createElement(Surface9.Surface, {
1218
+ role: "dialog",
1219
+ data: dialogContent,
1220
+ limit: 1,
1221
+ fallback: PlankErrorFallback
1222
+ })));
1223
+ };
1224
+
1225
+ // src/components/DeckLayout/Popover.tsx
1226
+ import { createContext } from "@radix-ui/react-context";
1227
+ import React16, { useCallback as useCallback8, useEffect as useEffect5, useRef as useRef3, useState as useState3 } from "react";
1228
+ import { Surface as Surface10, useOperationInvoker as useOperationInvoker7 } from "@dxos/app-framework/ui";
1229
+ import { LayoutOperation as LayoutOperation6 } from "@dxos/app-toolkit";
1230
+ import { useObjectNavigate } from "@dxos/app-toolkit/ui";
1231
+ import { Popover as Popover2, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
1232
+ import { Card } from "@dxos/react-ui";
1233
+ var DEBOUNCE_DELAY = 40;
1234
+ var [DeckPopoverProvider, useDeckPopoverContext] = createContext("DeckPopover");
1235
+ var PopoverRoot = ({ children }) => {
1236
+ const { state } = useDeckState();
1237
+ const virtualRef = useRef3(null);
1238
+ const [virtualIter, setVirtualIter] = useState3(0);
1239
+ const [open, setOpen] = useState3(false);
1240
+ const debounceRef = useRef3(null);
1241
+ useEffect5(() => {
1242
+ setOpen(false);
1243
+ if (state.popoverOpen) {
1244
+ if (debounceRef.current) {
1245
+ clearTimeout(debounceRef.current);
1246
+ }
1247
+ if (state.popoverAnchor && virtualRef.current !== state.popoverAnchor) {
1248
+ virtualRef.current = state.popoverAnchor ?? null;
1249
+ setVirtualIter((iter) => iter + 1);
1250
+ }
1251
+ debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
1252
+ }
1253
+ }, [
1254
+ state.popoverOpen,
1255
+ state.popoverAnchorId,
1256
+ state.popoverAnchor,
1257
+ state.popoverContent
1258
+ ]);
1259
+ return /* @__PURE__ */ React16.createElement(DeckPopoverProvider, {
1260
+ setOpen
1261
+ }, /* @__PURE__ */ React16.createElement(Popover2.Root, {
1262
+ modal: false,
1263
+ open
1264
+ }, state.popoverAnchor && /* @__PURE__ */ React16.createElement(Popover2.VirtualTrigger, {
1265
+ key: virtualIter,
1266
+ virtualRef
1267
+ }), children));
1268
+ };
1269
+ var getPopoverSubject = (content) => content && typeof content === "object" && "subject" in content ? content.subject : content;
1270
+ var PopoverContent = () => {
1271
+ const { t } = useTranslation7(meta.id);
1272
+ const { state, updateEphemeral } = useDeckState();
1273
+ const { setOpen } = useDeckPopoverContext("PopoverContent");
1274
+ const { invokeSync } = useOperationInvoker7();
1275
+ const handleNavigate = useObjectNavigate(getPopoverSubject(state.popoverContent));
1276
+ const handleClose = useCallback8(() => {
1277
+ setOpen(false);
1278
+ updateEphemeral((state2) => ({
1279
+ ...state2,
1280
+ popoverOpen: false,
1281
+ popoverAnchor: void 0,
1282
+ popoverAnchorId: void 0,
1283
+ popoverSide: void 0
1284
+ }));
1285
+ }, [
1286
+ updateEphemeral
1287
+ ]);
1288
+ const handleInteractOutside = useCallback8((event) => {
1289
+ if (
1290
+ // TODO(thure): CodeMirror should not focus itself when it updates.
1291
+ event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
1292
+ ) {
1293
+ event.preventDefault();
1294
+ } else {
1295
+ handleClose();
1296
+ }
1297
+ }, [
1298
+ handleClose
1299
+ ]);
1300
+ return /* @__PURE__ */ React16.createElement(Popover2.Portal, null, /* @__PURE__ */ React16.createElement(Popover2.Content, {
1301
+ side: state.popoverSide,
1302
+ sticky: "always",
1303
+ hideWhenDetached: true,
1304
+ onInteractOutside: handleInteractOutside,
1305
+ onEscapeKeyDown: handleInteractOutside
1306
+ }, /* @__PURE__ */ React16.createElement(Popover2.Viewport, null, state.popoverKind === "base" && /* @__PURE__ */ React16.createElement(Surface10.Surface, {
1307
+ role: "popover",
1308
+ data: state.popoverContent,
1309
+ limit: 1
1310
+ }), state.popoverKind === "card" && /* @__PURE__ */ React16.createElement(Card.Root, {
1311
+ border: false,
1312
+ classNames: "dx-card-popover"
1313
+ }, /* @__PURE__ */ React16.createElement(Card.Toolbar, null, state.popoverContentRef ? /* @__PURE__ */ React16.createElement(Card.ToolbarIconButton, {
1314
+ icon: "ph--arrow-square-out--regular",
1315
+ iconOnly: true,
1316
+ label: t("open item label"),
1317
+ onClick: () => {
1318
+ invokeSync(LayoutOperation6.Open, {
1319
+ subject: [
1320
+ state.popoverContentRef
1321
+ ]
1322
+ });
1323
+ }
1324
+ }) : /* @__PURE__ */ React16.createElement("div", null), state.popoverTitle ? /* @__PURE__ */ React16.createElement(Card.Title, {
1325
+ onClick: handleNavigate
1326
+ }, toLocalizedString3(state.popoverTitle, t)) : /* @__PURE__ */ React16.createElement("span", null), /* @__PURE__ */ React16.createElement(Card.CloseIconButton, {
1327
+ onClick: handleClose
1328
+ })), /* @__PURE__ */ React16.createElement(Surface10.Surface, {
1329
+ role: "card--content",
1330
+ data: state.popoverContent,
1331
+ limit: 1
1332
+ }))), /* @__PURE__ */ React16.createElement(Popover2.Arrow, null)));
1333
+ };
1334
+
1335
+ // src/components/DeckLayout/Toast.tsx
1336
+ import React17 from "react";
1337
+ import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString4, useTranslation as useTranslation8 } from "@dxos/react-ui";
1338
+ var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
1339
+ const { t } = useTranslation8(meta.id);
1340
+ return /* @__PURE__ */ React17.createElement(NaturalToast.Root, {
1341
+ "data-testid": id,
1342
+ defaultOpen: true,
1343
+ duration,
1344
+ onOpenChange
1345
+ }, /* @__PURE__ */ React17.createElement(NaturalToast.Body, null, /* @__PURE__ */ React17.createElement(NaturalToast.Title, {
1346
+ classNames: "items-center"
1347
+ }, icon && /* @__PURE__ */ React17.createElement(Icon2, {
1348
+ icon,
1349
+ classNames: "inline mr-1"
1350
+ }), title && /* @__PURE__ */ React17.createElement("span", null, toLocalizedString4(title, t))), description && /* @__PURE__ */ React17.createElement(NaturalToast.Description, null, description && toLocalizedString4(description, t))), /* @__PURE__ */ React17.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React17.createElement(NaturalToast.Action, {
1351
+ altText: toLocalizedString4(actionAlt, t),
1352
+ asChild: true
1353
+ }, /* @__PURE__ */ React17.createElement(Button, {
1354
+ "data-testid": "toast.action",
1355
+ variant: "primary",
1356
+ onClick: () => onAction?.()
1357
+ }, toLocalizedString4(actionLabel, t))), closeLabel && /* @__PURE__ */ React17.createElement(NaturalToast.Close, {
1358
+ asChild: true
1359
+ }, /* @__PURE__ */ React17.createElement(Button, {
1360
+ "data-testid": "toast.close"
1361
+ }, toLocalizedString4(closeLabel, t)))));
1362
+ };
1363
+ var Toaster = ({ toasts, onDismissToast }) => {
1364
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
1365
+ ...toast,
1366
+ key: toast.id,
1367
+ onOpenChange: (open) => {
1368
+ if (!open) {
1369
+ onDismissToast?.(toast.id);
1370
+ }
1371
+ return open;
1372
+ }
1373
+ })));
1374
+ };
1375
+
1376
+ // src/components/DeckLayout/DeckLayout.tsx
1377
+ var DeckLayout = ({ onDismissToast }) => {
1378
+ const { state } = useDeckState();
1379
+ const { toasts } = state;
1380
+ return /* @__PURE__ */ React18.createElement(Mosaic.Root, null, /* @__PURE__ */ React18.createElement(PopoverRoot, null, /* @__PURE__ */ React18.createElement(ActiveNode, null), /* @__PURE__ */ React18.createElement(DeckMain, null), /* @__PURE__ */ React18.createElement(PopoverContent, null), /* @__PURE__ */ React18.createElement(Dialog, null), /* @__PURE__ */ React18.createElement(Toaster, {
1381
+ toasts,
1382
+ onDismissToast
1383
+ })));
1384
+ };
1385
+
1386
+ export {
1387
+ Banner,
1388
+ DeckLayout
1389
+ };
1390
+ //# sourceMappingURL=chunk-YGOOWRJE.mjs.map