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