@dxos/plugin-deck 0.8.4-main.406dc2a → 0.8.4-main.4a85c3132b

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 (327) 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-7I6H3N4Q.mjs → chunk-OAPMV5ZR.mjs} +145 -27
  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 +84 -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.map +1 -1
  124. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +2 -1
  125. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -1
  126. package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -1
  127. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
  128. package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
  129. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
  130. package/dist/types/src/components/DeckLayout/Toast.d.ts +3 -3
  131. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  132. package/dist/types/src/components/Plank/Plank.d.ts +5 -5
  133. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  134. package/dist/types/src/components/Plank/Plank.stories.d.ts +26 -7
  135. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
  136. package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
  137. package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
  138. package/dist/types/src/components/Plank/PlankError.d.ts +6 -4
  139. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  140. package/dist/types/src/components/Plank/PlankHeading.d.ts +2 -2
  141. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  142. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  143. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
  144. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  145. package/dist/types/src/components/fragments.d.ts +4 -1
  146. package/dist/types/src/components/fragments.d.ts.map +1 -1
  147. package/dist/types/src/components/index.d.ts +0 -1
  148. package/dist/types/src/components/index.d.ts.map +1 -1
  149. package/dist/types/src/containers/Banner/Banner.d.ts +2 -0
  150. package/dist/types/src/containers/Banner/Banner.d.ts.map +1 -0
  151. package/dist/types/src/containers/Banner/index.d.ts +3 -0
  152. package/dist/types/src/containers/Banner/index.d.ts.map +1 -0
  153. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts +8 -0
  154. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts.map +1 -0
  155. package/dist/types/src/containers/DeckSettings/index.d.ts +3 -0
  156. package/dist/types/src/containers/DeckSettings/index.d.ts.map +1 -0
  157. package/dist/types/src/containers/index.d.ts +4 -0
  158. package/dist/types/src/containers/index.d.ts.map +1 -0
  159. package/dist/types/src/hooks/index.d.ts +2 -0
  160. package/dist/types/src/hooks/index.d.ts.map +1 -1
  161. package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -3
  162. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  163. package/dist/types/src/hooks/useDeckState.d.ts +17 -0
  164. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
  165. package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
  166. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
  167. package/dist/types/src/hooks/useMainSize.d.ts +2 -2
  168. package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
  169. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  170. package/dist/types/src/hooks/useSelectedCompanion.d.ts +13 -0
  171. package/dist/types/src/hooks/useSelectedCompanion.d.ts.map +1 -0
  172. package/dist/types/src/index.d.ts +1 -2
  173. package/dist/types/src/index.d.ts.map +1 -1
  174. package/dist/types/src/meta.d.ts +2 -2
  175. package/dist/types/src/meta.d.ts.map +1 -1
  176. package/dist/types/src/translations.d.ts +2 -1
  177. package/dist/types/src/translations.d.ts.map +1 -1
  178. package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
  179. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  180. package/dist/types/src/types/events.d.ts +7 -0
  181. package/dist/types/src/types/events.d.ts.map +1 -0
  182. package/dist/types/src/types/index.d.ts +2 -0
  183. package/dist/types/src/types/index.d.ts.map +1 -1
  184. package/dist/types/src/types/schema.d.ts +92 -31
  185. package/dist/types/src/types/schema.d.ts.map +1 -1
  186. package/dist/types/src/util/set-active.d.ts +18 -3
  187. package/dist/types/src/util/set-active.d.ts.map +1 -1
  188. package/dist/types/tsconfig.tsbuildinfo +1 -1
  189. package/package.json +56 -48
  190. package/src/DeckPlugin.ts +28 -48
  191. package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
  192. package/src/capabilities/app-graph-builder/index.ts +7 -0
  193. package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
  194. package/src/capabilities/check-app-scheme/index.ts +7 -0
  195. package/src/capabilities/index.ts +9 -14
  196. package/src/capabilities/operation-resolver/index.ts +10 -0
  197. package/src/capabilities/operation-resolver/operation-resolver.ts +560 -0
  198. package/src/capabilities/react-root/index.ts +7 -0
  199. package/src/capabilities/react-root/react-root.tsx +47 -0
  200. package/src/capabilities/react-surface/index.ts +7 -0
  201. package/src/capabilities/react-surface/react-surface.tsx +38 -0
  202. package/src/capabilities/settings/index.ts +7 -0
  203. package/src/capabilities/settings/settings.ts +39 -0
  204. package/src/capabilities/state/index.ts +7 -0
  205. package/src/capabilities/state/state.ts +105 -0
  206. package/src/capabilities/toolkit/index.ts +7 -0
  207. package/src/capabilities/toolkit/toolkit.ts +64 -0
  208. package/src/capabilities/tools/index.ts +7 -0
  209. package/src/capabilities/tools/tools.ts +91 -0
  210. package/src/capabilities/url-handler/index.ts +7 -0
  211. package/src/capabilities/url-handler/url-handler.ts +96 -0
  212. package/src/components/DeckLayout/ActiveNode.tsx +3 -2
  213. package/src/components/DeckLayout/Banner.tsx +9 -9
  214. package/src/components/DeckLayout/ContentEmpty.tsx +5 -6
  215. package/src/components/DeckLayout/DeckLayout.stories.tsx +23 -34
  216. package/src/components/DeckLayout/DeckLayout.tsx +13 -11
  217. package/src/components/DeckLayout/DeckMain.tsx +67 -65
  218. package/src/components/DeckLayout/Dialog.tsx +22 -13
  219. package/src/components/DeckLayout/Fallback.tsx +2 -6
  220. package/src/components/DeckLayout/Popover.tsx +70 -32
  221. package/src/components/DeckLayout/StatusBar.tsx +4 -4
  222. package/src/components/DeckLayout/Toast.tsx +5 -5
  223. package/src/components/Plank/Plank.stories.tsx +19 -9
  224. package/src/components/Plank/Plank.tsx +85 -66
  225. package/src/components/Plank/PlankControls.tsx +9 -11
  226. package/src/components/Plank/PlankError.tsx +31 -17
  227. package/src/components/Plank/PlankHeading.tsx +35 -42
  228. package/src/components/Plank/PlankLoading.tsx +1 -1
  229. package/src/components/Sidebar/ComplementarySidebar.tsx +71 -40
  230. package/src/components/Sidebar/Sidebar.tsx +7 -7
  231. package/src/components/Sidebar/SidebarButton.tsx +36 -29
  232. package/src/components/fragments.ts +10 -5
  233. package/src/components/index.ts +0 -1
  234. package/src/containers/Banner/Banner.tsx +5 -0
  235. package/src/containers/Banner/index.ts +7 -0
  236. package/src/{components → containers}/DeckSettings/DeckSettings.tsx +41 -31
  237. package/src/containers/DeckSettings/index.ts +7 -0
  238. package/src/containers/index.ts +8 -0
  239. package/src/hooks/index.ts +2 -0
  240. package/src/hooks/useCompanions.ts +2 -2
  241. package/src/hooks/useDeckCompanions.ts +6 -4
  242. package/src/hooks/useDeckState.ts +82 -0
  243. package/src/hooks/useHoistStatusbar.ts +3 -5
  244. package/src/hooks/useMainSize.ts +2 -2
  245. package/src/hooks/useNodeActionExpander.ts +4 -4
  246. package/src/hooks/useSelectedCompanion.ts +38 -0
  247. package/src/index.ts +1 -2
  248. package/src/meta.ts +7 -2
  249. package/src/translations.ts +2 -1
  250. package/src/types/capabilities.ts +33 -0
  251. package/src/types/events.ts +21 -0
  252. package/src/types/index.ts +2 -0
  253. package/src/types/schema.ts +91 -18
  254. package/src/util/layoutAppliesTopbar.ts +1 -1
  255. package/src/util/overscroll.ts +3 -3
  256. package/src/util/set-active.ts +49 -29
  257. package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs +0 -153
  258. package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs.map +0 -7
  259. package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs +0 -32
  260. package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs.map +0 -7
  261. package/dist/lib/browser/chunk-7I6H3N4Q.mjs.map +0 -7
  262. package/dist/lib/browser/chunk-CNTGBCMK.mjs +0 -145
  263. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  264. package/dist/lib/browser/chunk-HUWUYTOI.mjs +0 -16
  265. package/dist/lib/browser/chunk-HUWUYTOI.mjs.map +0 -7
  266. package/dist/lib/browser/chunk-JQKOS2HB.mjs +0 -1531
  267. package/dist/lib/browser/chunk-JQKOS2HB.mjs.map +0 -7
  268. package/dist/lib/browser/chunk-MHP4GPX5.mjs +0 -11
  269. package/dist/lib/browser/chunk-MHP4GPX5.mjs.map +0 -7
  270. package/dist/lib/browser/chunk-RJP5R7PY.mjs +0 -127
  271. package/dist/lib/browser/chunk-RJP5R7PY.mjs.map +0 -7
  272. package/dist/lib/browser/chunk-VX7MMQOW.mjs +0 -129
  273. package/dist/lib/browser/chunk-VX7MMQOW.mjs.map +0 -7
  274. package/dist/lib/browser/intent-resolver-7XNOEPVN.mjs +0 -524
  275. package/dist/lib/browser/intent-resolver-7XNOEPVN.mjs.map +0 -7
  276. package/dist/lib/browser/react-root-OJEF7YCH.mjs +0 -43
  277. package/dist/lib/browser/react-root-OJEF7YCH.mjs.map +0 -7
  278. package/dist/lib/browser/react-surface-XN2NJYHO.mjs +0 -40
  279. package/dist/lib/browser/react-surface-XN2NJYHO.mjs.map +0 -7
  280. package/dist/lib/browser/settings-M3KSKRAP.mjs +0 -30
  281. package/dist/lib/browser/settings-M3KSKRAP.mjs.map +0 -7
  282. package/dist/lib/browser/state-6ZSDTF6Q.mjs +0 -12
  283. package/dist/lib/browser/toolkit-L7C3UAEU.mjs +0 -63
  284. package/dist/lib/browser/toolkit-L7C3UAEU.mjs.map +0 -7
  285. package/dist/lib/browser/url-handler-EHTLXZRR.mjs +0 -70
  286. package/dist/lib/browser/url-handler-EHTLXZRR.mjs.map +0 -7
  287. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  288. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  289. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  290. package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
  291. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  292. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  293. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  294. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  295. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  296. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  297. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  298. package/dist/types/src/capabilities/settings.d.ts +0 -4
  299. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  300. package/dist/types/src/capabilities/state.d.ts +0 -104
  301. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  302. package/dist/types/src/capabilities/toolkit.d.ts +0 -6
  303. package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
  304. package/dist/types/src/capabilities/tools.d.ts +0 -11
  305. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  306. package/dist/types/src/capabilities/url-handler.d.ts +0 -4
  307. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  308. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +0 -6
  309. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +0 -1
  310. package/dist/types/src/components/DeckSettings/index.d.ts +0 -2
  311. package/dist/types/src/components/DeckSettings/index.d.ts.map +0 -1
  312. package/dist/types/src/events.d.ts +0 -4
  313. package/dist/types/src/events.d.ts.map +0 -1
  314. package/src/capabilities/app-graph-builder.ts +0 -143
  315. package/src/capabilities/capabilities.ts +0 -14
  316. package/src/capabilities/check-app-scheme.ts +0 -40
  317. package/src/capabilities/intent-resolver.ts +0 -472
  318. package/src/capabilities/react-root.tsx +0 -39
  319. package/src/capabilities/react-surface.tsx +0 -30
  320. package/src/capabilities/settings.ts +0 -27
  321. package/src/capabilities/state.ts +0 -108
  322. package/src/capabilities/toolkit.ts +0 -57
  323. package/src/capabilities/tools.ts +0 -84
  324. package/src/capabilities/url-handler.ts +0 -60
  325. package/src/components/DeckSettings/index.ts +0 -5
  326. package/src/events.ts +0 -11
  327. /package/dist/lib/{browser/state-6ZSDTF6Q.mjs.map → node-esm/types/index.mjs.map} +0 -0
@@ -0,0 +1,82 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useAtomValue } from '@effect-atom/atom-react';
6
+ import { useCallback, useMemo } from 'react';
7
+
8
+ import { Capabilities } from '@dxos/app-framework';
9
+ import { useCapability } from '@dxos/app-framework/ui';
10
+ import { invariant } from '@dxos/invariant';
11
+
12
+ import {
13
+ DeckCapabilities,
14
+ type DeckEphemeralStateProps,
15
+ type DeckPluginState,
16
+ type DeckState,
17
+ type DeckStateProps,
18
+ } from '../types';
19
+
20
+ export type DeckStateHook = {
21
+ /** Combined state value (reactive). Includes both persisted and ephemeral state. */
22
+ state: DeckPluginState;
23
+ /** The active deck, computed from decks[activeDeck]. */
24
+ deck: DeckState;
25
+ /** Update persisted state. */
26
+ updateState: (fn: (current: DeckStateProps) => DeckStateProps) => void;
27
+ /** Update ephemeral state. */
28
+ updateEphemeral: (fn: (current: DeckEphemeralStateProps) => DeckEphemeralStateProps) => void;
29
+ };
30
+
31
+ /**
32
+ * Hook to access the deck plugin state reactively.
33
+ * Returns the combined state, the active deck, and update functions for each atom.
34
+ */
35
+ export const useDeckState = (): DeckStateHook => {
36
+ const registry = useCapability(Capabilities.AtomRegistry);
37
+ const stateAtom = useCapability(DeckCapabilities.State);
38
+ const ephemeralAtom = useCapability(DeckCapabilities.EphemeralState);
39
+
40
+ const persistedState = useAtomValue(stateAtom);
41
+ const ephemeralState = useAtomValue(ephemeralAtom);
42
+
43
+ // Compute deck from decks[activeDeck] to ensure it's always current.
44
+ const deck = useMemo(() => {
45
+ const d = persistedState.decks[persistedState.activeDeck];
46
+ invariant(d, `Deck not found: ${persistedState.activeDeck}`);
47
+ return d;
48
+ }, [persistedState.decks, persistedState.activeDeck]);
49
+
50
+ // Combine persisted and ephemeral state into a unified view.
51
+ const state = useMemo(
52
+ (): DeckPluginState => ({
53
+ ...persistedState,
54
+ ...ephemeralState,
55
+ }),
56
+ [persistedState, ephemeralState],
57
+ );
58
+
59
+ const updateState = useCallback(
60
+ (fn: (current: DeckStateProps) => DeckStateProps) => {
61
+ registry.set(stateAtom, fn(registry.get(stateAtom)));
62
+ },
63
+ [registry, stateAtom],
64
+ );
65
+
66
+ const updateEphemeral = useCallback(
67
+ (fn: (current: DeckEphemeralStateProps) => DeckEphemeralStateProps) => {
68
+ registry.set(ephemeralAtom, fn(registry.get(ephemeralAtom)));
69
+ },
70
+ [registry, ephemeralAtom],
71
+ );
72
+
73
+ return useMemo(
74
+ () => ({
75
+ state,
76
+ deck,
77
+ updateState,
78
+ updateEphemeral,
79
+ }),
80
+ [state, deck, updateState, updateEphemeral],
81
+ );
82
+ };
@@ -4,16 +4,14 @@
4
4
 
5
5
  import { useMemo } from 'react';
6
6
 
7
- import { Capabilities, useCapability } from '@dxos/app-framework';
7
+ import { useAtomCapability } from '@dxos/app-framework/ui';
8
8
  import { useThemeContext } from '@dxos/react-ui';
9
9
 
10
- import { meta } from '../meta';
11
- import type { DeckSettingsProps, LayoutMode } from '../types';
10
+ import { DeckCapabilities, type LayoutMode } from '../types';
12
11
 
13
12
  export const useHoistStatusbar = (breakpoint: string, layoutMode?: LayoutMode): boolean => {
14
13
  const { safeAreaPadding } = useThemeContext();
15
- const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(meta.id)?.value
16
- .enableStatusbar;
14
+ const enableStatusbar = useAtomCapability(DeckCapabilities.Settings).enableStatusbar;
17
15
 
18
16
  return useMemo(() => {
19
17
  return (
@@ -7,7 +7,7 @@ import { useMainContext } from '@dxos/react-ui';
7
7
  export const useMainSize = () => {
8
8
  const { navigationSidebarState, complementarySidebarState } = useMainContext('DeckPluginPlank');
9
9
  return {
10
- 'data-sidebar-inline-start-state': navigationSidebarState,
11
- 'data-sidebar-inline-end-state': complementarySidebarState,
10
+ 'data-sidebar-left-state': navigationSidebarState,
11
+ 'data-sidebar-right-state': complementarySidebarState,
12
12
  };
13
13
  };
@@ -4,14 +4,14 @@
4
4
 
5
5
  import { useEffect } from 'react';
6
6
 
7
- import { type Node, getGraph } from '@dxos/plugin-graph';
7
+ import { Graph, type Node } from '@dxos/plugin-graph';
8
8
 
9
- export const useNodeActionExpander = (node?: Node) => {
9
+ export const useNodeActionExpander = (node?: Node.Node) => {
10
10
  useEffect(() => {
11
11
  if (node) {
12
12
  const frame = requestAnimationFrame(() => {
13
- const graph = getGraph(node);
14
- void graph.expand(node.id);
13
+ const graph = Graph.getGraph(node);
14
+ void Graph.expand(graph, node.id, 'action');
15
15
  });
16
16
  return () => cancelAnimationFrame(frame);
17
17
  }
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { useMemo } from 'react';
6
+
7
+ import { type Node } from '@dxos/plugin-graph';
8
+
9
+ import { parseEntryId } from '../layout';
10
+
11
+ /**
12
+ * Resolves which companion to show based on variant preference.
13
+ * Falls back to first available if preferred variant not found.
14
+ */
15
+ export const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string) => {
16
+ return useMemo(() => {
17
+ if (companions.length === 0) {
18
+ return { companionId: undefined, variant: undefined };
19
+ }
20
+
21
+ // Try to find companion matching the preferred variant.
22
+ if (preferredVariant) {
23
+ const preferred = companions.find((companion) => {
24
+ const { variant } = parseEntryId(companion.id);
25
+ return variant === preferredVariant;
26
+ });
27
+ if (preferred) {
28
+ const { variant } = parseEntryId(preferred.id);
29
+ return { companionId: preferred.id, variant };
30
+ }
31
+ }
32
+
33
+ // Fallback to first companion.
34
+ const first = companions[0];
35
+ const { variant } = parseEntryId(first.id);
36
+ return { companionId: first.id, variant };
37
+ }, [companions, preferredVariant]);
38
+ };
package/src/index.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export { DeckCapabilities } from './capabilities';
6
- export { DeckEvents } from './events';
5
+ export { DeckCapabilities, DeckEvents } from './types';
7
6
  export * from './DeckPlugin';
8
7
  export * from './meta';
9
8
  export { useCompanions } from './hooks';
package/src/meta.ts CHANGED
@@ -2,10 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const meta: PluginMeta = {
8
+ export const meta: Plugin.Meta = {
8
9
  id: 'dxos.org/plugin/deck',
9
10
  name: 'Layout',
11
+ description: trim`
12
+ Flexible layout system for arranging workspace views in tabs, splits, and panels.
13
+ Customize your workspace organization with drag-and-drop layout management.
14
+ `,
10
15
  icon: 'ph--layout--regular',
11
16
  };
@@ -34,7 +34,7 @@ export const translations = [
34
34
  'undo action label': 'Undo',
35
35
  'undo action alt': 'Undo previous action',
36
36
  'undo close label': 'Dismiss',
37
- 'error fallback message': 'Unable to open this item',
37
+ 'error fallback message': 'Unable to open this object',
38
38
  'plank heading fallback label': 'Untitled',
39
39
  'actions menu label': 'Options',
40
40
  'settings deck label': 'Disable deck',
@@ -64,6 +64,7 @@ export const translations = [
64
64
  'close others label': 'Close other planks',
65
65
  'close all label': 'Close all planks',
66
66
  'companion plank heading fallback label': 'Related',
67
+ 'open item label': 'Open',
67
68
  },
68
69
  },
69
70
  },
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Atom } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { invariant } from '@dxos/invariant';
10
+
11
+ import { meta } from '../meta';
12
+ import { type DeckEphemeralStateProps, type DeckSettingsProps, type DeckState, type DeckStateProps } from '../types';
13
+
14
+ export namespace DeckCapabilities {
15
+ export const Settings = Capability.make<Atom.Writable<DeckSettingsProps>>(`${meta.id}/capability/settings`);
16
+
17
+ /** Persisted state (stored in KVS/localStorage). */
18
+ export const State = Capability.make<Atom.Writable<DeckStateProps>>(`${meta.id}/capability/state`);
19
+
20
+ /** Transient/ephemeral state (not persisted). */
21
+ export const EphemeralState = Capability.make<Atom.Writable<DeckEphemeralStateProps>>(
22
+ `${meta.id}/capability/ephemeral-state`,
23
+ );
24
+
25
+ /** Get the current active deck from state. */
26
+ export const getDeck = (): Effect.Effect<DeckState, Error, Capability.Service> =>
27
+ Effect.gen(function* () {
28
+ const state = yield* Capabilities.getAtomValue(State);
29
+ const deck = state.decks[state.activeDeck];
30
+ invariant(deck, `Deck not found: ${state.activeDeck}`);
31
+ return deck;
32
+ });
33
+ }
@@ -0,0 +1,21 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ActivationEvent } from '@dxos/app-framework';
6
+ import { AppActivationEvents } from '@dxos/app-toolkit';
7
+
8
+ import { meta } from '../meta';
9
+
10
+ import { DeckCapabilities } from './capabilities';
11
+
12
+ export namespace DeckEvents {
13
+ export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
14
+ `${meta.id}/state-ready`,
15
+ );
16
+
17
+ /** Fired when DeckSettings capability is ready. */
18
+ export const SettingsReady: ActivationEvent.ActivationEvent = AppActivationEvents.createSettingsEvent(
19
+ DeckCapabilities.Settings.identifier,
20
+ );
21
+ }
@@ -2,4 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ export * from './capabilities';
6
+ export * from './events';
5
7
  export * from './schema';
@@ -4,7 +4,9 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { LayoutAction } from '@dxos/app-framework';
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Label, LayoutOperation } from '@dxos/app-toolkit';
9
+ import { Operation } from '@dxos/operation';
8
10
  import { type DeepReadonly } from '@dxos/util';
9
11
 
10
12
  import { meta } from '../meta';
@@ -18,8 +20,8 @@ export const DECK_COMPANION_TYPE = `${meta.id}/deck-companion`;
18
20
  export const NewPlankPositions = ['start', 'end'] as const;
19
21
  export type NewPlankPositioning = (typeof NewPlankPositions)[number];
20
22
 
21
- export const OverscrollOptions = ['none', 'centering'] as const;
22
- export type Overscroll = (typeof OverscrollOptions)[number];
23
+ export const OverScrollToProps = ['none', 'centering'] as const;
24
+ export type Overscroll = (typeof OverScrollToProps)[number];
23
25
 
24
26
  export type Part = 'solo' | 'deck' | 'complementary';
25
27
  export type ResolvedPart = Part | 'solo-primary' | 'solo-companion';
@@ -30,7 +32,7 @@ export const DeckSettingsSchema = Schema.Struct({
30
32
  enableStatusbar: Schema.optional(Schema.Boolean),
31
33
  enableNativeRedirect: Schema.optional(Schema.Boolean),
32
34
  newPlankPositioning: Schema.optional(Schema.Literal(...NewPlankPositions)),
33
- overscroll: Schema.optional(Schema.Literal(...OverscrollOptions)),
35
+ overscroll: Schema.optional(Schema.Literal(...OverScrollToProps)),
34
36
  // TODO(burdon): Rename layoutMode? (e.g., bento | encapsulated?)
35
37
  encapsulatedPlanks: Schema.optional(Schema.Boolean),
36
38
  }).pipe(Schema.mutable);
@@ -44,8 +46,8 @@ export const DeckState = Schema.Struct({
44
46
  /** If false, the deck has not yet left solo mode and new planks should be soloed. */
45
47
  initialized: Schema.Boolean,
46
48
  active: Schema.mutable(Schema.Array(Schema.String)),
47
- // TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
48
- activeCompanions: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.String }))),
49
+ companionOpen: Schema.Boolean,
50
+ companionVariant: Schema.optional(Schema.String),
49
51
  inactive: Schema.mutable(Schema.Array(Schema.String)),
50
52
  solo: Schema.optional(Schema.String),
51
53
  fullscreen: Schema.Boolean,
@@ -57,7 +59,8 @@ export type DeckState = Schema.Schema.Type<typeof DeckState>;
57
59
  export const defaultDeck: DeckState = {
58
60
  initialized: false,
59
61
  active: [],
60
- activeCompanions: {},
62
+ companionOpen: false,
63
+ companionVariant: undefined,
61
64
  inactive: [],
62
65
  solo: undefined,
63
66
  fullscreen: false,
@@ -77,12 +80,21 @@ export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode =
77
80
  return 'deck';
78
81
  };
79
82
 
80
- // State of the deck plugin.
81
- export const DeckPluginState = Schema.Struct({
83
+ // Persisted plugin state (stored in KVS/localStorage).
84
+ export const DeckStateSchema = Schema.Struct({
82
85
  sidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
83
86
  complementarySidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
84
87
  complementarySidebarPanel: Schema.optional(Schema.String),
88
+ activeDeck: Schema.String,
89
+ previousDeck: Schema.String,
90
+ decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
91
+ previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
92
+ }).pipe(Schema.mutable);
93
+ export type DeckStateProps = Schema.Schema.Type<typeof DeckStateSchema>;
85
94
 
95
+ // TODO(burdon): Factor out state (in common with other layouts?)
96
+ // Transient/ephemeral plugin state (not persisted).
97
+ export const DeckEphemeralStateSchema = Schema.Struct({
86
98
  dialogOpen: Schema.Boolean,
87
99
  dialogType: Schema.optional(Schema.Literal('default', 'alert')),
88
100
  dialogBlockAlign: Schema.optional(Schema.Literal('start', 'center', 'end')),
@@ -95,23 +107,23 @@ export const DeckPluginState = Schema.Struct({
95
107
  popoverSide: Schema.optional(Schema.Literal('top', 'right', 'bottom', 'left')),
96
108
  popoverAnchor: Schema.optional(Schema.Any),
97
109
  popoverAnchorId: Schema.optional(Schema.String),
110
+ popoverKind: Schema.optional(Schema.Literal('base', 'card')),
111
+ popoverTitle: Schema.optional(Label.annotations({ description: 'The title of the popover.' })),
112
+ /** Ref of the subject to be passed to the popover Surface. */
113
+ popoverContentRef: Schema.optional(Schema.String),
98
114
  /** Data to be passed to the popover Surface. */
99
115
  popoverContent: Schema.optional(Schema.Any),
100
116
 
101
- toasts: Schema.mutable(Schema.Array(LayoutAction.Toast)),
117
+ toasts: Schema.mutable(Schema.Array(LayoutOperation.Toast)),
102
118
  currentUndoId: Schema.optional(Schema.String),
103
119
 
104
- activeDeck: Schema.String,
105
- previousDeck: Schema.String,
106
- decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
107
- previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
108
- deck: Schema.mutable(DeckState),
109
-
110
120
  /** The identifier of a component to scroll into view when it is mounted. */
111
121
  scrollIntoView: Schema.optional(Schema.String),
112
122
  }).pipe(Schema.mutable);
123
+ export type DeckEphemeralStateProps = Schema.Schema.Type<typeof DeckEphemeralStateSchema>;
113
124
 
114
- export type DeckPluginState = Schema.Schema.Type<typeof DeckPluginState>;
125
+ // Combined state type (for convenience in components that need both).
126
+ export type DeckPluginState = DeckStateProps & DeckEphemeralStateProps;
115
127
 
116
128
  export namespace DeckAction {
117
129
  const PartAdjustmentSchema = Schema.Union(
@@ -142,9 +154,70 @@ export namespace DeckAction {
142
154
 
143
155
  export class ChangeCompanion extends Schema.TaggedClass<ChangeCompanion>()(`${meta.id}/action/change-companion`, {
144
156
  input: Schema.Struct({
145
- primary: Schema.String,
146
157
  companion: Schema.Union(Schema.String, Schema.Null),
147
158
  }),
148
159
  output: Schema.Void,
149
160
  }) {}
150
161
  }
162
+
163
+ /**
164
+ * Operations for the Deck plugin.
165
+ */
166
+ export namespace DeckOperation {
167
+ const PartAdjustmentSchema = Schema.Union(
168
+ Schema.Literal('close').annotations({ description: 'Close the plank.' }),
169
+ Schema.Literal('companion').annotations({ description: 'Open the companion plank.' }),
170
+ Schema.Literal('solo').annotations({ description: 'Solo the plank.' }),
171
+ Schema.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
172
+ Schema.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
173
+ Schema.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
174
+ );
175
+ export type PartAdjustment = Schema.Schema.Type<typeof PartAdjustmentSchema>;
176
+
177
+ export const Adjust = Operation.make({
178
+ meta: {
179
+ key: `${meta.id}/operation/adjust`,
180
+ name: 'Adjust',
181
+ description: 'Adjust the layout of a plank.',
182
+ },
183
+ services: [Capability.Service],
184
+ schema: {
185
+ input: Schema.Struct({
186
+ id: Schema.String.annotations({ description: 'The id of the plank to adjust.' }),
187
+ type: PartAdjustmentSchema.annotations({ description: 'The type of adjustment to make.' }),
188
+ }),
189
+ output: Schema.Void,
190
+ },
191
+ });
192
+
193
+ export const UpdatePlankSize = Operation.make({
194
+ meta: {
195
+ key: `${meta.id}/operation/update-plank-size`,
196
+ name: 'Update Plank Size',
197
+ description: 'Update the size of a plank.',
198
+ },
199
+ services: [Capability.Service],
200
+ schema: {
201
+ input: Schema.Struct({
202
+ id: Schema.String.annotations({ description: 'The id of the plank to resize.' }),
203
+ size: Schema.Number.annotations({ description: 'The new size of the plank.' }),
204
+ }),
205
+ output: Schema.Void,
206
+ },
207
+ });
208
+
209
+ export const ChangeCompanion = Operation.make({
210
+ meta: {
211
+ key: `${meta.id}/operation/change-companion`,
212
+ name: 'Change Companion',
213
+ description: 'Change the companion plank for a primary plank.',
214
+ },
215
+ services: [Capability.Service],
216
+ schema: {
217
+ input: Schema.Struct({
218
+ companion: Schema.Union(Schema.String, Schema.Null),
219
+ }),
220
+ output: Schema.Void,
221
+ },
222
+ });
223
+ }
@@ -6,7 +6,7 @@ import { type LayoutMode } from '../types';
6
6
 
7
7
  export const layoutAppliesTopbar = (breakpoint: string, layoutMode?: LayoutMode) => {
8
8
  return (
9
- document.body.getAttribute('data-platform') === 'win' &&
9
+ document.body.getAttribute('data-platform') === 'windows' &&
10
10
  breakpoint === 'desktop' &&
11
11
  layoutMode !== 'solo--fullscreen'
12
12
  );
@@ -56,14 +56,14 @@ export const calculateOverscroll = (
56
56
  }
57
57
  if (planksCount === 1) {
58
58
  const overscrollPadding =
59
- 'max(0px, calc(((100dvw - var(--dx-main-sidebarWidth) - var(--dx-main-complementaryWidth) - (var(--dx-main-contentFirstWidth) + 1px)) / 2)))';
59
+ 'max(0px, calc(((100dvw - var(--dx-main-sidebar-width) - var(--dx-main-complementary-width) - (var(--dx-main-content-first-width) + 1px)) / 2)))';
60
60
  return { paddingInlineStart: overscrollPadding, paddingInlineEnd: overscrollPadding };
61
61
  } else {
62
62
  return {
63
63
  paddingInlineStart:
64
- 'max(0px, calc(((100dvw - (var(--dx-main-contentFirstWidth) + 1px)) / 2) - var(--dx-main-sidebarWidth)))',
64
+ 'max(0px, calc(((100dvw - (var(--dx-main-content-first-width) + 1px)) / 2) - var(--dx-main-sidebar-width)))',
65
65
  paddingInlineEnd:
66
- 'max(0px, calc(((100dvw - (var(--dx-main-contentLastWidth) + 1px)) / 2) - var(--dx-main-complementaryWidth)))',
66
+ 'max(0px, calc(((100dvw - (var(--dx-main-content-last-width) + 1px)) / 2) - var(--dx-main-complementary-width)))',
67
67
  };
68
68
  }
69
69
  };
@@ -2,46 +2,66 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { batch } from '@preact/signals-core';
6
-
7
5
  import { type AttentionManager } from '@dxos/plugin-attention';
8
6
 
9
- import { type DeckPluginState } from '../types';
7
+ import { type DeckState } from '../types';
10
8
 
11
9
  export type SetActiveOptions = {
12
10
  next: string[];
13
- state: DeckPluginState;
11
+ deck: DeckState;
14
12
  attention?: AttentionManager;
15
13
  };
16
14
 
17
- export const setActive = ({ next, state, attention }: SetActiveOptions) => {
18
- return batch(() => {
19
- const active = state.deck.solo ? [state.deck.solo] : state.deck.active;
20
- const removed = active.filter((id) => !next.includes(id));
21
- const closed = Array.from(new Set([...state.deck.inactive.filter((id) => !next.includes(id)), ...removed]));
15
+ export type SetActiveResult = {
16
+ /** Updates to apply to the deck. */
17
+ deckUpdates: {
18
+ inactive: string[];
19
+ solo: string | undefined;
20
+ active: string[];
21
+ fullscreen: boolean;
22
+ };
23
+ /** ID of the item to attend (scroll into view) if attention changed. */
24
+ toAttend?: string;
25
+ };
22
26
 
23
- state.deck.inactive = closed;
27
+ /**
28
+ * Computes the new active state for the deck without mutating.
29
+ * Returns the updates to apply and optionally an item to attend.
30
+ */
31
+ export const computeActiveUpdates = ({ next, deck, attention }: SetActiveOptions): SetActiveResult => {
32
+ const active = deck.solo ? [deck.solo] : deck.active;
33
+ const removed = active.filter((id) => !next.includes(id));
34
+ const closed = Array.from(new Set([...deck.inactive.filter((id) => !next.includes(id)), ...removed]));
24
35
 
25
- if (state.deck.solo || !state.deck.initialized) {
26
- state.deck.solo = next[0];
27
- } else {
28
- state.deck.active = next;
29
- }
36
+ const updates = {
37
+ inactive: closed,
38
+ solo: deck.solo,
39
+ active: deck.active,
40
+ fullscreen: deck.fullscreen,
41
+ };
30
42
 
31
- if (state.deck.fullscreen && !state.deck.solo) {
32
- state.deck.fullscreen = false;
33
- }
43
+ if (deck.solo || !deck.initialized) {
44
+ updates.solo = next[0];
45
+ } else {
46
+ updates.active = next;
47
+ }
48
+
49
+ if (deck.fullscreen && !updates.solo) {
50
+ updates.fullscreen = false;
51
+ }
34
52
 
35
- if (attention) {
36
- const attended = attention.current;
37
- const [attendedId] = Array.from(attended);
38
- const isAttendedAvailable = !!attendedId && next.includes(attendedId);
39
- if (!isAttendedAvailable) {
40
- const attendedIndex = active.indexOf(attendedId);
41
- // If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.
42
- const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;
43
- return next[index];
44
- }
53
+ let toAttend: string | undefined;
54
+ if (attention) {
55
+ const attended = attention.getCurrent();
56
+ const [attendedId] = Array.from(attended);
57
+ const isAttendedAvailable = !!attendedId && next.includes(attendedId);
58
+ if (!isAttendedAvailable) {
59
+ const attendedIndex = active.indexOf(attendedId);
60
+ // If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.
61
+ const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;
62
+ toAttend = next[index];
45
63
  }
46
- });
64
+ }
65
+
66
+ return { deckUpdates: updates, toAttend };
47
67
  };