@dxos/plugin-deck 0.8.4-main.c1de068 → 0.8.4-main.c351d160a8

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 (328) hide show
  1. package/dist/lib/browser/Banner-AJW6225V.mjs +14 -0
  2. package/dist/lib/browser/Banner-AJW6225V.mjs.map +7 -0
  3. package/dist/lib/browser/DeckSettings-HSSQKFNE.mjs +96 -0
  4. package/dist/lib/browser/DeckSettings-HSSQKFNE.mjs.map +7 -0
  5. package/dist/lib/browser/app-graph-builder-MP6INIM2.mjs +123 -0
  6. package/dist/lib/browser/app-graph-builder-MP6INIM2.mjs.map +7 -0
  7. package/dist/lib/browser/check-app-scheme-AUNCD2Y6.mjs +33 -0
  8. package/dist/lib/browser/check-app-scheme-AUNCD2Y6.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-3P2FJVXC.mjs +278 -0
  10. package/dist/lib/browser/chunk-3P2FJVXC.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-BJDEG7YZ.mjs +74 -0
  12. package/dist/lib/browser/chunk-BJDEG7YZ.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-L3RYMAV7.mjs +16 -0
  14. package/dist/lib/browser/chunk-L3RYMAV7.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-TAHLKBDO.mjs +187 -0
  16. package/dist/lib/browser/chunk-TAHLKBDO.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-WTNYSXY5.mjs +1388 -0
  18. package/dist/lib/browser/chunk-WTNYSXY5.mjs.map +7 -0
  19. package/dist/lib/browser/index.mjs +90 -74
  20. package/dist/lib/browser/index.mjs.map +4 -4
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/operation-resolver-2TEGT4PG.mjs +639 -0
  23. package/dist/lib/browser/operation-resolver-2TEGT4PG.mjs.map +7 -0
  24. package/dist/lib/browser/react-root-XBFHPSCP.mjs +48 -0
  25. package/dist/lib/browser/react-root-XBFHPSCP.mjs.map +7 -0
  26. package/dist/lib/browser/react-surface-4J3BZNT2.mjs +44 -0
  27. package/dist/lib/browser/react-surface-4J3BZNT2.mjs.map +7 -0
  28. package/dist/lib/browser/settings-PTMGCSJH.mjs +40 -0
  29. package/dist/lib/browser/settings-PTMGCSJH.mjs.map +7 -0
  30. package/dist/lib/browser/state-MA4SQ7BE.mjs +106 -0
  31. package/dist/lib/browser/state-MA4SQ7BE.mjs.map +7 -0
  32. package/dist/lib/browser/toolkit-6B34QFU3.mjs +55 -0
  33. package/dist/lib/browser/toolkit-6B34QFU3.mjs.map +7 -0
  34. package/dist/lib/browser/types/index.mjs +14 -8
  35. package/dist/lib/browser/url-handler-FEUFPQIP.mjs +98 -0
  36. package/dist/lib/browser/url-handler-FEUFPQIP.mjs.map +7 -0
  37. package/dist/lib/node-esm/Banner-XBH2IIDR.mjs +15 -0
  38. package/dist/lib/node-esm/Banner-XBH2IIDR.mjs.map +7 -0
  39. package/dist/lib/node-esm/DeckSettings-DJRFLKQS.mjs +97 -0
  40. package/dist/lib/node-esm/DeckSettings-DJRFLKQS.mjs.map +7 -0
  41. package/dist/lib/node-esm/app-graph-builder-ACHG5HY7.mjs +124 -0
  42. package/dist/lib/node-esm/app-graph-builder-ACHG5HY7.mjs.map +7 -0
  43. package/dist/lib/node-esm/check-app-scheme-WN76GWVC.mjs +34 -0
  44. package/dist/lib/node-esm/check-app-scheme-WN76GWVC.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-CQ3XYTNJ.mjs +1389 -0
  46. package/dist/lib/node-esm/chunk-CQ3XYTNJ.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-EMU4VIPH.mjs +188 -0
  50. package/dist/lib/node-esm/chunk-EMU4VIPH.mjs.map +7 -0
  51. package/dist/lib/node-esm/chunk-GZJAQ5IP.mjs +279 -0
  52. package/dist/lib/node-esm/chunk-GZJAQ5IP.mjs.map +7 -0
  53. package/dist/lib/node-esm/chunk-XCNF4COU.mjs +18 -0
  54. package/dist/lib/node-esm/chunk-XCNF4COU.mjs.map +7 -0
  55. package/dist/lib/node-esm/index.mjs +185 -0
  56. package/dist/lib/node-esm/index.mjs.map +7 -0
  57. package/dist/lib/node-esm/meta.json +1 -0
  58. package/dist/lib/node-esm/operation-resolver-GCMCCI7A.mjs +640 -0
  59. package/dist/lib/node-esm/operation-resolver-GCMCCI7A.mjs.map +7 -0
  60. package/dist/lib/node-esm/react-root-32LZ6APH.mjs +49 -0
  61. package/dist/lib/node-esm/react-root-32LZ6APH.mjs.map +7 -0
  62. package/dist/lib/node-esm/react-surface-CO4ZDZKM.mjs +45 -0
  63. package/dist/lib/node-esm/react-surface-CO4ZDZKM.mjs.map +7 -0
  64. package/dist/lib/node-esm/settings-LPPFLXNJ.mjs +41 -0
  65. package/dist/lib/node-esm/settings-LPPFLXNJ.mjs.map +7 -0
  66. package/dist/lib/node-esm/state-KNRU3GDC.mjs +107 -0
  67. package/dist/lib/node-esm/state-KNRU3GDC.mjs.map +7 -0
  68. package/dist/lib/node-esm/toolkit-SOWYKJY3.mjs +56 -0
  69. package/dist/lib/node-esm/toolkit-SOWYKJY3.mjs.map +7 -0
  70. package/dist/lib/node-esm/types/index.mjs +39 -0
  71. package/dist/lib/node-esm/url-handler-4LEB7UWF.mjs +99 -0
  72. package/dist/lib/node-esm/url-handler-4LEB7UWF.mjs.map +7 -0
  73. package/dist/types/src/DeckPlugin.d.ts +2 -1
  74. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  76. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  78. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
  80. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/index.d.ts +8 -13
  84. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  86. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  88. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
  90. package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
  92. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  94. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  96. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/settings/index.d.ts +19 -0
  98. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  99. package/dist/types/src/capabilities/settings/settings.d.ts +22 -0
  100. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/state/index.d.ts +172 -0
  102. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/state/state.d.ts +175 -0
  104. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  105. package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
  106. package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/toolkit/toolkit.d.ts +27 -0
  108. package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
  109. package/dist/types/src/capabilities/tools/index.d.ts +3 -0
  110. package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
  112. package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
  114. package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
  116. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
  117. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
  118. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
  119. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  120. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
  121. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  122. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +75 -0
  123. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
  124. package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
  125. package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
  126. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
  127. package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
  128. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
  129. package/dist/types/src/components/DeckLayout/Toast.d.ts +7 -2
  130. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  131. package/dist/types/src/components/Plank/Plank.d.ts +6 -6
  132. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  133. package/dist/types/src/components/Plank/Plank.stories.d.ts +105 -5
  134. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
  135. package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
  136. package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
  137. package/dist/types/src/components/Plank/PlankError.d.ts +6 -4
  138. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  139. package/dist/types/src/components/Plank/PlankHeading.d.ts +3 -3
  140. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  141. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  142. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
  143. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  144. package/dist/types/src/components/fragments.d.ts +4 -1
  145. package/dist/types/src/components/fragments.d.ts.map +1 -1
  146. package/dist/types/src/components/index.d.ts +0 -1
  147. package/dist/types/src/components/index.d.ts.map +1 -1
  148. package/dist/types/src/containers/Banner/Banner.d.ts +2 -0
  149. package/dist/types/src/containers/Banner/Banner.d.ts.map +1 -0
  150. package/dist/types/src/containers/Banner/index.d.ts +3 -0
  151. package/dist/types/src/containers/Banner/index.d.ts.map +1 -0
  152. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts +8 -0
  153. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts.map +1 -0
  154. package/dist/types/src/containers/DeckSettings/index.d.ts +3 -0
  155. package/dist/types/src/containers/DeckSettings/index.d.ts.map +1 -0
  156. package/dist/types/src/containers/index.d.ts +4 -0
  157. package/dist/types/src/containers/index.d.ts.map +1 -0
  158. package/dist/types/src/hooks/index.d.ts +2 -0
  159. package/dist/types/src/hooks/index.d.ts.map +1 -1
  160. package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -4
  161. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  162. package/dist/types/src/hooks/useDeckState.d.ts +17 -0
  163. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
  164. package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
  165. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
  166. package/dist/types/src/hooks/useMainSize.d.ts +2 -2
  167. package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
  168. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  169. package/dist/types/src/hooks/useSelectedCompanion.d.ts +13 -0
  170. package/dist/types/src/hooks/useSelectedCompanion.d.ts.map +1 -0
  171. package/dist/types/src/index.d.ts +1 -2
  172. package/dist/types/src/index.d.ts.map +1 -1
  173. package/dist/types/src/layout.d.ts +1 -7
  174. package/dist/types/src/layout.d.ts.map +1 -1
  175. package/dist/types/src/meta.d.ts +2 -3
  176. package/dist/types/src/meta.d.ts.map +1 -1
  177. package/dist/types/src/translations.d.ts +4 -1
  178. package/dist/types/src/translations.d.ts.map +1 -1
  179. package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
  180. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  181. package/dist/types/src/types/events.d.ts +7 -0
  182. package/dist/types/src/types/events.d.ts.map +1 -0
  183. package/dist/types/src/types/index.d.ts +2 -0
  184. package/dist/types/src/types/index.d.ts.map +1 -1
  185. package/dist/types/src/types/schema.d.ts +103 -41
  186. package/dist/types/src/types/schema.d.ts.map +1 -1
  187. package/dist/types/src/util/set-active.d.ts +18 -3
  188. package/dist/types/src/util/set-active.d.ts.map +1 -1
  189. package/dist/types/tsconfig.tsbuildinfo +1 -1
  190. package/package.json +61 -47
  191. package/src/DeckPlugin.ts +46 -61
  192. package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
  193. package/src/capabilities/app-graph-builder/index.ts +7 -0
  194. package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
  195. package/src/capabilities/check-app-scheme/index.ts +7 -0
  196. package/src/capabilities/index.ts +9 -13
  197. package/src/capabilities/operation-resolver/index.ts +10 -0
  198. package/src/capabilities/operation-resolver/operation-resolver.ts +558 -0
  199. package/src/capabilities/react-root/index.ts +7 -0
  200. package/src/capabilities/react-root/react-root.tsx +47 -0
  201. package/src/capabilities/react-surface/index.ts +7 -0
  202. package/src/capabilities/react-surface/react-surface.tsx +38 -0
  203. package/src/capabilities/settings/index.ts +7 -0
  204. package/src/capabilities/settings/settings.ts +39 -0
  205. package/src/capabilities/state/index.ts +7 -0
  206. package/src/capabilities/state/state.ts +105 -0
  207. package/src/capabilities/toolkit/index.ts +7 -0
  208. package/src/capabilities/toolkit/toolkit.ts +64 -0
  209. package/src/capabilities/tools/index.ts +7 -0
  210. package/src/capabilities/tools/tools.ts +91 -0
  211. package/src/capabilities/url-handler/index.ts +7 -0
  212. package/src/capabilities/url-handler/url-handler.ts +98 -0
  213. package/src/components/DeckLayout/ActiveNode.tsx +3 -2
  214. package/src/components/DeckLayout/Banner.tsx +12 -12
  215. package/src/components/DeckLayout/ContentEmpty.tsx +6 -7
  216. package/src/components/DeckLayout/DeckLayout.stories.tsx +53 -0
  217. package/src/components/DeckLayout/DeckLayout.tsx +18 -285
  218. package/src/components/DeckLayout/DeckMain.tsx +287 -0
  219. package/src/components/DeckLayout/Dialog.tsx +22 -13
  220. package/src/components/DeckLayout/Fallback.tsx +4 -8
  221. package/src/components/DeckLayout/Popover.tsx +76 -32
  222. package/src/components/DeckLayout/StatusBar.tsx +4 -4
  223. package/src/components/DeckLayout/Toast.tsx +30 -5
  224. package/src/components/Plank/Plank.stories.tsx +26 -17
  225. package/src/components/Plank/Plank.tsx +111 -70
  226. package/src/components/Plank/PlankControls.tsx +12 -14
  227. package/src/components/Plank/PlankError.tsx +33 -18
  228. package/src/components/Plank/PlankHeading.tsx +45 -51
  229. package/src/components/Plank/PlankLoading.tsx +1 -1
  230. package/src/components/Sidebar/ComplementarySidebar.tsx +80 -53
  231. package/src/components/Sidebar/Sidebar.tsx +9 -9
  232. package/src/components/Sidebar/SidebarButton.tsx +40 -33
  233. package/src/components/fragments.ts +10 -5
  234. package/src/components/index.ts +0 -1
  235. package/src/containers/Banner/Banner.tsx +5 -0
  236. package/src/containers/Banner/index.ts +7 -0
  237. package/src/containers/DeckSettings/DeckSettings.tsx +113 -0
  238. package/src/containers/DeckSettings/index.ts +7 -0
  239. package/src/containers/index.ts +8 -0
  240. package/src/hooks/index.ts +2 -0
  241. package/src/hooks/useCompanions.ts +2 -2
  242. package/src/hooks/useDeckCompanions.ts +8 -11
  243. package/src/hooks/useDeckState.ts +82 -0
  244. package/src/hooks/useHoistStatusbar.ts +4 -5
  245. package/src/hooks/useMainSize.ts +2 -2
  246. package/src/hooks/useNodeActionExpander.ts +4 -4
  247. package/src/hooks/useSelectedCompanion.ts +32 -0
  248. package/src/index.ts +1 -2
  249. package/src/layout.ts +1 -14
  250. package/src/meta.ts +8 -5
  251. package/src/translations.ts +4 -1
  252. package/src/types/capabilities.ts +33 -0
  253. package/src/types/events.ts +21 -0
  254. package/src/types/index.ts +2 -0
  255. package/src/types/schema.ts +99 -26
  256. package/src/util/layoutAppliesTopbar.ts +1 -1
  257. package/src/util/overscroll.ts +3 -3
  258. package/src/util/set-active.ts +49 -29
  259. package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs +0 -152
  260. package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
  261. package/dist/lib/browser/check-app-scheme-57U62A3A.mjs +0 -32
  262. package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
  263. package/dist/lib/browser/chunk-CNTGBCMK.mjs +0 -145
  264. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  265. package/dist/lib/browser/chunk-D7KTFCUV.mjs +0 -1494
  266. package/dist/lib/browser/chunk-D7KTFCUV.mjs.map +0 -7
  267. package/dist/lib/browser/chunk-F5BQOOEG.mjs +0 -160
  268. package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
  269. package/dist/lib/browser/chunk-JFTXENFN.mjs +0 -129
  270. package/dist/lib/browser/chunk-JFTXENFN.mjs.map +0 -7
  271. package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
  272. package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
  273. package/dist/lib/browser/chunk-QDZO4AJ4.mjs +0 -127
  274. package/dist/lib/browser/chunk-QDZO4AJ4.mjs.map +0 -7
  275. package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
  276. package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
  277. package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs +0 -521
  278. package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs.map +0 -7
  279. package/dist/lib/browser/react-root-PO64J7ML.mjs +0 -43
  280. package/dist/lib/browser/react-root-PO64J7ML.mjs.map +0 -7
  281. package/dist/lib/browser/react-surface-E45YOVF5.mjs +0 -40
  282. package/dist/lib/browser/react-surface-E45YOVF5.mjs.map +0 -7
  283. package/dist/lib/browser/settings-6AJZPZPM.mjs +0 -29
  284. package/dist/lib/browser/settings-6AJZPZPM.mjs.map +0 -7
  285. package/dist/lib/browser/state-MVDYX77Y.mjs +0 -12
  286. package/dist/lib/browser/tools-TKQDPCHJ.mjs +0 -88
  287. package/dist/lib/browser/tools-TKQDPCHJ.mjs.map +0 -7
  288. package/dist/lib/browser/url-handler-7L7M6IKH.mjs +0 -70
  289. package/dist/lib/browser/url-handler-7L7M6IKH.mjs.map +0 -7
  290. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  291. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  292. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  293. package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
  294. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  295. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  296. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  297. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  298. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  299. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  300. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  301. package/dist/types/src/capabilities/settings.d.ts +0 -4
  302. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  303. package/dist/types/src/capabilities/state.d.ts +0 -101
  304. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  305. package/dist/types/src/capabilities/tools.d.ts +0 -11
  306. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  307. package/dist/types/src/capabilities/url-handler.d.ts +0 -4
  308. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  309. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +0 -6
  310. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +0 -1
  311. package/dist/types/src/components/DeckSettings/index.d.ts +0 -2
  312. package/dist/types/src/components/DeckSettings/index.d.ts.map +0 -1
  313. package/dist/types/src/events.d.ts +0 -4
  314. package/dist/types/src/events.d.ts.map +0 -1
  315. package/src/capabilities/app-graph-builder.ts +0 -141
  316. package/src/capabilities/capabilities.ts +0 -14
  317. package/src/capabilities/check-app-scheme.ts +0 -40
  318. package/src/capabilities/intent-resolver.ts +0 -468
  319. package/src/capabilities/react-root.tsx +0 -38
  320. package/src/capabilities/react-surface.tsx +0 -30
  321. package/src/capabilities/settings.ts +0 -26
  322. package/src/capabilities/state.ts +0 -104
  323. package/src/capabilities/tools.ts +0 -81
  324. package/src/capabilities/url-handler.ts +0 -59
  325. package/src/components/DeckSettings/DeckSettings.tsx +0 -88
  326. package/src/components/DeckSettings/index.ts +0 -5
  327. package/src/events.ts +0 -11
  328. /package/dist/lib/{browser/state-MVDYX77Y.mjs.map → node-esm/types/index.mjs.map} +0 -0
@@ -1,141 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Rx } from '@effect-rx/rx-react';
6
- import { Option, pipe } from 'effect';
7
-
8
- import { Capabilities, contributes, createIntent, LayoutAction, type PluginContext } from '@dxos/app-framework';
9
- import { AttentionCapabilities } from '@dxos/plugin-attention';
10
- import { createExtension, ROOT_ID, rxFromSignal } from '@dxos/plugin-graph';
11
-
12
- import { DeckCapabilities } from './capabilities';
13
- import { DECK_PLUGIN } from '../meta';
14
-
15
- export default (context: PluginContext) =>
16
- contributes(
17
- Capabilities.AppGraphBuilder,
18
- createExtension({
19
- id: DECK_PLUGIN,
20
- actions: (node) =>
21
- Rx.make((get) =>
22
- pipe(
23
- get(node),
24
- Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
25
- Option.map(() => {
26
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
27
-
28
- // NOTE(Zan): This is currently disabled.
29
- // TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.
30
- const _fullscreen = {
31
- id: `${LayoutAction.UpdateLayout._tag}/fullscreen`,
32
- data: async () => {
33
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
34
- await dispatch(
35
- createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'fullscreen' } }),
36
- );
37
- },
38
- properties: {
39
- label: ['toggle fullscreen label', { ns: DECK_PLUGIN }],
40
- icon: 'ph--arrows-out--regular',
41
- keyBinding: {
42
- macos: 'ctrl+meta+f',
43
- windows: 'shift+ctrl+f',
44
- },
45
- },
46
- };
47
-
48
- const closeCurrent = {
49
- id: `${LayoutAction.Close._tag}/current`,
50
- data: async () => {
51
- const attention = context.getCapability(AttentionCapabilities.Attention);
52
- const attended = attention.current.at(-1);
53
- if (attended) {
54
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
55
- await dispatch(
56
- createIntent(LayoutAction.Close, {
57
- part: 'main',
58
- subject: [attended],
59
- options: { state: false },
60
- }),
61
- );
62
- }
63
- },
64
- properties: {
65
- label: ['close current label', { ns: DECK_PLUGIN }],
66
- icon: 'ph--x--regular',
67
- },
68
- };
69
-
70
- const closeOthers = {
71
- id: `${LayoutAction.Close._tag}/others`,
72
- data: async () => {
73
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
74
- const attention = context.getCapability(AttentionCapabilities.Attention);
75
- const attended = attention.current.at(-1);
76
- const ids = state.deck.active.filter((id) => id !== attended) ?? [];
77
- await dispatch(
78
- createIntent(LayoutAction.Close, { part: 'main', subject: ids, options: { state: false } }),
79
- );
80
- },
81
- properties: {
82
- label: ['close others label', { ns: DECK_PLUGIN }],
83
- icon: 'ph--x-square--regular',
84
- },
85
- };
86
-
87
- const closeAll = {
88
- id: `${LayoutAction.Close._tag}/all`,
89
- data: async () => {
90
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
91
- await dispatch(
92
- createIntent(LayoutAction.Close, {
93
- part: 'main',
94
- subject: state.deck.active,
95
- options: { state: false },
96
- }),
97
- );
98
- },
99
- properties: {
100
- label: ['close all label', { ns: DECK_PLUGIN }],
101
- icon: 'ph--x-circle--regular',
102
- },
103
- };
104
-
105
- const toggleSidebar = {
106
- id: `${LayoutAction.UpdateSidebar._tag}/nav`,
107
- data: async () => {
108
- state.sidebarState = state.sidebarState === 'expanded' ? 'collapsed' : 'expanded';
109
- },
110
- properties: {
111
- label: [
112
- get(
113
- rxFromSignal(() =>
114
- state.sidebarState === 'expanded'
115
- ? 'collapse navigation sidebar label'
116
- : 'open navigation sidebar label',
117
- ),
118
- ),
119
- { ns: DECK_PLUGIN },
120
- ],
121
- icon: 'ph--sidebar--regular',
122
- keyBinding: {
123
- macos: "meta+'",
124
- },
125
- disposition: 'pin-end',
126
- position: 'hoist',
127
- l0Breakpoint: 'lg',
128
- },
129
- };
130
-
131
- return get(
132
- rxFromSignal(() =>
133
- !state.deck.solo ? [closeCurrent, closeOthers, closeAll, toggleSidebar] : [toggleSidebar],
134
- ),
135
- );
136
- }),
137
- Option.getOrElse(() => []),
138
- ),
139
- ),
140
- }),
141
- );
@@ -1,14 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { defineCapability } from '@dxos/app-framework';
6
- import { type DeepReadonly } from '@dxos/util';
7
-
8
- import { DECK_PLUGIN } from '../meta';
9
- import { type DeckPluginState } from '../types';
10
-
11
- export namespace DeckCapabilities {
12
- export const DeckState = defineCapability<DeepReadonly<DeckPluginState>>(`${DECK_PLUGIN}/capability/state`);
13
- export const MutableDeckState = defineCapability<DeckPluginState>(`${DECK_PLUGIN}/capability/state`);
14
- }
@@ -1,40 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
6
-
7
- import { DECK_PLUGIN } from '../meta';
8
- import { type DeckSettingsProps } from '../types';
9
-
10
- const isSocket = !!(globalThis as any).__args;
11
-
12
- // TODO(mjamesderocher): Can we get this directly from Socket?
13
- const appScheme = 'composer://';
14
-
15
- // TODO(mjamesderocher): Factor out as part of NavigationPlugin.
16
- const checkAppScheme = (url: string) => {
17
- const iframe = document.createElement('iframe');
18
- iframe.style.display = 'none';
19
- document.body.appendChild(iframe);
20
-
21
- iframe.src = url + window.location.pathname.replace(/^\/+/, '') + window.location.search;
22
-
23
- const timer = setTimeout(() => {
24
- document.body.removeChild(iframe);
25
- }, 3000);
26
-
27
- window.addEventListener('pagehide', (event) => {
28
- clearTimeout(timer);
29
- document.body.removeChild(iframe);
30
- });
31
- };
32
-
33
- export default async (context: PluginContext) => {
34
- const settings = context.getCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;
35
- if (!isSocket && settings?.enableNativeRedirect) {
36
- checkAppScheme(appScheme);
37
- }
38
-
39
- return contributes(Capabilities.Null, null);
40
- };
@@ -1,468 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { batch } from '@preact/signals-core';
6
- import { Schema, Effect, pipe, Option } from 'effect';
7
-
8
- import {
9
- Capabilities,
10
- createResolver,
11
- contributes,
12
- IntentAction,
13
- LayoutAction,
14
- type PluginContext,
15
- createIntent,
16
- chain,
17
- } from '@dxos/app-framework';
18
- import { Obj } from '@dxos/echo';
19
- import { invariant } from '@dxos/invariant';
20
- import { isLiveObject } from '@dxos/live-object';
21
- import { log } from '@dxos/log';
22
- import { AttentionCapabilities } from '@dxos/plugin-attention';
23
- import { isActionLike } from '@dxos/plugin-graph';
24
- import { ObservabilityAction } from '@dxos/plugin-observability/types';
25
- import { byPosition, isNonNullable } from '@dxos/util';
26
-
27
- import { DeckCapabilities } from './capabilities';
28
- import { closeEntry, createEntryId, incrementPlank, openEntry } from '../layout';
29
- import { DECK_PLUGIN } from '../meta';
30
- import {
31
- DeckAction,
32
- type LayoutMode,
33
- type DeckSettingsProps,
34
- isLayoutMode,
35
- getMode,
36
- defaultDeck,
37
- PLANK_COMPANION_TYPE,
38
- } from '../types';
39
- import { setActive } from '../util';
40
-
41
- export default (context: PluginContext) =>
42
- contributes(Capabilities.IntentResolver, [
43
- createResolver({
44
- intent: IntentAction.ShowUndo,
45
- resolve: (data) => {
46
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
47
- const { undoPromise: undo } = context.getCapability(Capabilities.IntentDispatcher);
48
-
49
- // TODO(wittjosiah): Support undoing further back than the last action.
50
- if (layout.currentUndoId) {
51
- layout.toasts = layout.toasts.filter((toast) => toast.id !== layout.currentUndoId);
52
- }
53
- layout.currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;
54
- layout.toasts = [
55
- ...layout.toasts,
56
- {
57
- id: layout.currentUndoId,
58
- title: data.message ?? ['undo available label', { ns: DECK_PLUGIN }],
59
- duration: 10_000,
60
- actionLabel: ['undo action label', { ns: DECK_PLUGIN }],
61
- actionAlt: ['undo action alt', { ns: DECK_PLUGIN }],
62
- closeLabel: ['undo close label', { ns: DECK_PLUGIN }],
63
- onAction: () => undo(),
64
- },
65
- ];
66
- },
67
- }),
68
- createResolver({
69
- intent: LayoutAction.UpdateLayout,
70
- // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateSidebar.fields.input)`
71
- // but the filter is not being applied correctly.
72
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateSidebar.fields.input> =>
73
- Schema.is(LayoutAction.UpdateSidebar.fields.input)(data),
74
- resolve: ({ options }) => {
75
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
76
- const next = options?.state ?? layout.sidebarState;
77
- if (next !== layout.sidebarState) {
78
- layout.sidebarState = next;
79
- }
80
- },
81
- }),
82
- createResolver({
83
- intent: LayoutAction.UpdateLayout,
84
- // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateComplementary.fields.input)`
85
- // but the filter is not being applied correctly.
86
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateComplementary.fields.input> =>
87
- Schema.is(LayoutAction.UpdateComplementary.fields.input)(data),
88
- resolve: ({ subject, options }) => {
89
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
90
-
91
- if (layout.complementarySidebarPanel !== subject) {
92
- layout.complementarySidebarPanel = subject;
93
- }
94
-
95
- const next = subject ? 'expanded' : (options?.state ?? layout.complementarySidebarState);
96
- if (next !== layout.complementarySidebarState) {
97
- layout.complementarySidebarState = next;
98
- }
99
- },
100
- }),
101
- createResolver({
102
- intent: LayoutAction.UpdateLayout,
103
- // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateDialog.fields.input)`
104
- // but the filter is not being applied correctly.
105
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>
106
- Schema.is(LayoutAction.UpdateDialog.fields.input)(data),
107
- resolve: ({ subject, options }) => {
108
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
109
- layout.dialogOpen = options.state ?? Boolean(subject);
110
- layout.dialogType = options.type ?? 'default';
111
- layout.dialogBlockAlign = options.blockAlign ?? 'center';
112
- layout.dialogOverlayClasses = options.overlayClasses;
113
- layout.dialogOverlayStyle = options.overlayStyle;
114
- layout.dialogContent = subject ? { component: subject, props: options.props } : null;
115
- },
116
- }),
117
- createResolver({
118
- intent: LayoutAction.UpdateLayout,
119
- // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdatePopover.fields.input)`
120
- // but the filter is not being applied correctly.
121
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdatePopover.fields.input> =>
122
- Schema.is(LayoutAction.UpdatePopover.fields.input)(data),
123
- resolve: ({ subject, options }) => {
124
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
125
- layout.popoverOpen = options.state ?? Boolean(subject);
126
- layout.popoverContent =
127
- typeof subject === 'string' ? { component: subject, props: options.props } : subject ? { subject } : null;
128
- layout.popoverSide = options.side;
129
- if (options.variant === 'virtual') {
130
- layout.popoverAnchor = options.anchor;
131
- } else {
132
- layout.popoverAnchorId = options.anchorId;
133
- }
134
- },
135
- }),
136
- createResolver({
137
- intent: LayoutAction.UpdateLayout,
138
- // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.AddToast.fields.input)`
139
- // but the filter is not being applied correctly.
140
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.AddToast.fields.input> =>
141
- Schema.is(LayoutAction.AddToast.fields.input)(data),
142
- resolve: ({ subject }) => {
143
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
144
- layout.toasts.push(subject);
145
- },
146
- }),
147
- createResolver({
148
- intent: LayoutAction.UpdateLayout,
149
- // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.SetLayoutMode.fields.input)`
150
- // but the filter is not being applied correctly.
151
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SetLayoutMode.fields.input> => {
152
- if (!Schema.is(LayoutAction.SetLayoutMode.fields.input)(data)) {
153
- return false;
154
- }
155
-
156
- if ('mode' in data.options) {
157
- return isLayoutMode(data.options.mode);
158
- }
159
-
160
- return true;
161
- },
162
- resolve: ({ subject, options }) => {
163
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
164
-
165
- const setMode = (mode: LayoutMode) => {
166
- const deck = state.deck;
167
- const current = deck.solo ? [deck.solo] : deck.active;
168
- // When un-soloing, the solo entry is added to the deck.
169
- const next = (
170
- mode !== 'deck' ? [subject ?? deck.solo ?? deck.active[0]] : [...deck.active, deck.solo]
171
- ).filter(isNonNullable);
172
-
173
- const removed = current.filter((id) => !next.includes(id));
174
- const closed = Array.from(new Set([...deck.inactive.filter((id) => !next.includes(id)), ...removed]));
175
- deck.inactive = closed;
176
-
177
- if (mode !== 'deck' && next[0]) {
178
- deck.solo = next[0];
179
- } else if (mode === 'deck' && deck.solo) {
180
- deck.solo = undefined;
181
- deck.initialized = true;
182
- }
183
-
184
- if (mode === 'solo--fullscreen') {
185
- deck.fullscreen = !deck.fullscreen;
186
- }
187
- };
188
-
189
- return batch(() => {
190
- if ('mode' in options) {
191
- const current = getMode(state.deck);
192
- if (current !== options.mode) {
193
- state.previousMode[state.activeDeck] = current;
194
- }
195
- setMode(options.mode as LayoutMode);
196
- } else if ('revert' in options) {
197
- const last = state.previousMode[state.activeDeck];
198
- setMode(last ?? 'solo');
199
- } else {
200
- log.warn('Invalid layout mode', options);
201
- }
202
- });
203
- },
204
- }),
205
- createResolver({
206
- intent: LayoutAction.UpdateLayout,
207
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>
208
- Schema.is(LayoutAction.SwitchWorkspace.fields.input)(data),
209
- resolve: ({ subject }) => {
210
- const { graph } = context.getCapability(Capabilities.AppGraph);
211
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
212
- batch(() => {
213
- // TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
214
- // Ideally this should be worked into the data model in a generic way.
215
- if (!state.activeDeck.startsWith('!')) {
216
- state.previousDeck = state.activeDeck;
217
- }
218
- state.activeDeck = subject;
219
- if (!state.decks[subject]) {
220
- state.decks[subject] = { ...defaultDeck };
221
- }
222
- });
223
-
224
- const first = state.deck.solo ? state.deck.solo : state.deck.active[0];
225
- if (first) {
226
- return {
227
- intents: [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: first })],
228
- };
229
- } else {
230
- const [item] = graph
231
- .getConnections(subject)
232
- .filter((node) => !isActionLike(node) && !node.properties.disposition);
233
- if (item) {
234
- return {
235
- intents: [createIntent(LayoutAction.Open, { part: 'main', subject: [item.id] })],
236
- };
237
- }
238
- }
239
- },
240
- }),
241
- createResolver({
242
- intent: LayoutAction.UpdateLayout,
243
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.RevertWorkspace.fields.input> =>
244
- Schema.is(LayoutAction.RevertWorkspace.fields.input)(data),
245
- resolve: () => {
246
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
247
- return {
248
- intents: [createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: state.previousDeck })],
249
- };
250
- },
251
- }),
252
- createResolver({
253
- intent: LayoutAction.UpdateLayout,
254
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Open.fields.input> =>
255
- Schema.is(LayoutAction.Open.fields.input)(data),
256
- resolve: ({ subject, options }) =>
257
- Effect.gen(function* () {
258
- const { graph } = context.getCapability(Capabilities.AppGraph);
259
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
260
- const attention = context.getCapability(AttentionCapabilities.Attention);
261
- const settings = context
262
- .getCapabilities(Capabilities.SettingsStore)[0]
263
- ?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;
264
-
265
- if (options?.workspace && state.activeDeck !== options?.workspace) {
266
- const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
267
- yield* dispatch(
268
- createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: options.workspace }),
269
- );
270
- }
271
-
272
- const previouslyOpenIds = new Set<string>(state.deck.solo ? [state.deck.solo] : state.deck.active);
273
- batch(() => {
274
- const next = state.deck.solo
275
- ? (subject as string[]).map((id) => createEntryId(id, options?.variant))
276
- : subject.reduce(
277
- (acc, entryId) =>
278
- openEntry(acc, entryId, {
279
- key: options?.key,
280
- positioning: options?.positioning ?? settings?.newPlankPositioning,
281
- pivotId: options?.pivotId,
282
- variant: options?.variant,
283
- }),
284
- state.deck.active,
285
- );
286
-
287
- return setActive({ next, state, attention });
288
- });
289
-
290
- const ids = state.deck.solo ? [state.deck.solo] : state.deck.active;
291
- const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
292
-
293
- return {
294
- intents: [
295
- ...(options?.scrollIntoView !== false
296
- ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: newlyOpen[0] ?? subject[0] })]
297
- : []),
298
- createIntent(LayoutAction.Expose, { part: 'navigation', subject: newlyOpen[0] ?? subject[0] }),
299
- ...newlyOpen.map((subjectId) => {
300
- const typename = Option.match(graph.getNode(subjectId), {
301
- onNone: () => undefined,
302
- onSome: (node) => {
303
- const active = node.data;
304
- return isLiveObject(active) ? Obj.getTypename(active) : undefined;
305
- },
306
- });
307
- return createIntent(ObservabilityAction.SendEvent, {
308
- name: 'navigation.activate',
309
- properties: {
310
- subjectId,
311
- typename,
312
- },
313
- });
314
- }),
315
- ],
316
- };
317
- }),
318
- }),
319
- createResolver({
320
- intent: LayoutAction.UpdateLayout,
321
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Close.fields.input> =>
322
- Schema.is(LayoutAction.Close.fields.input)(data),
323
- resolve: ({ subject }) => {
324
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
325
- const attention = context.getCapability(AttentionCapabilities.Attention);
326
- const active = state.deck.solo ? [state.deck.solo] : state.deck.active;
327
- const next = subject.reduce((acc, id) => closeEntry(acc, id), active);
328
- const toAttend = setActive({ next, state, attention });
329
-
330
- const clearCompanionIntents = subject
331
- .filter((id) => state.deck.activeCompanions && id in state.deck.activeCompanions)
332
- .map((primary) => createIntent(DeckAction.ChangeCompanion, { primary, companion: null }));
333
-
334
- return {
335
- intents: [
336
- ...clearCompanionIntents,
337
- ...(toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : []),
338
- ],
339
- };
340
- },
341
- }),
342
- createResolver({
343
- intent: LayoutAction.UpdateLayout,
344
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Set.fields.input> =>
345
- Schema.is(LayoutAction.Set.fields.input)(data),
346
- resolve: ({ subject }) => {
347
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
348
- const attention = context.getCapability(AttentionCapabilities.Attention);
349
- const toAttend = setActive({ next: subject as string[], state, attention });
350
- return {
351
- intents: toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : [],
352
- };
353
- },
354
- }),
355
- createResolver({
356
- intent: LayoutAction.UpdateLayout,
357
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.ScrollIntoView.fields.input> =>
358
- Schema.is(LayoutAction.ScrollIntoView.fields.input)(data),
359
- resolve: ({ subject }) => {
360
- const layout = context.getCapability(DeckCapabilities.MutableDeckState);
361
- layout.scrollIntoView = subject;
362
- },
363
- }),
364
- createResolver({
365
- intent: DeckAction.UpdatePlankSize,
366
- resolve: (data) => {
367
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
368
- state.deck.plankSizing[data.id] = data.size;
369
- },
370
- }),
371
- createResolver({
372
- intent: DeckAction.ChangeCompanion,
373
- resolve: (data) => {
374
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
375
- // TODO(thure): Reactivity only works when creating a lexically new `activeCompanions`… Are these not proxy objects?
376
- if (data.companion === null) {
377
- const { [data.primary]: _, ...nextActiveCompanions } = state.deck.activeCompanions ?? {};
378
- state.deck.activeCompanions = nextActiveCompanions;
379
- } else {
380
- invariant(data.companion !== data.primary);
381
- state.deck.activeCompanions = {
382
- ...state.deck.activeCompanions,
383
- [data.primary]: data.companion,
384
- };
385
- }
386
- },
387
- }),
388
- createResolver({
389
- intent: DeckAction.Adjust,
390
- resolve: (adjustment) => {
391
- const state = context.getCapability(DeckCapabilities.MutableDeckState);
392
- const attention = context.getCapability(AttentionCapabilities.Attention);
393
- const { graph } = context.getCapability(Capabilities.AppGraph);
394
-
395
- return batch(() => {
396
- if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {
397
- setActive({
398
- next: incrementPlank(state.deck.active, adjustment),
399
- state,
400
- attention,
401
- });
402
- }
403
-
404
- if (adjustment.type === 'companion') {
405
- return pipe(
406
- graph.getNode(adjustment.id),
407
- Option.map((node) =>
408
- graph
409
- .getConnections(node.id)
410
- .filter((n) => n.type === PLANK_COMPANION_TYPE)
411
- .toSorted((a, b) => byPosition(a.properties, b.properties)),
412
- ),
413
- Option.flatMap((companions) => (companions.length > 0 ? Option.some(companions[0]) : Option.none())),
414
- Option.match({
415
- onNone: () => ({}),
416
- onSome: (companion) => ({
417
- intents: [
418
- // TODO(wittjosiah): This should remember the previously selected companion.
419
- createIntent(DeckAction.ChangeCompanion, { primary: adjustment.id, companion: companion.id }),
420
- ],
421
- }),
422
- }),
423
- );
424
- }
425
-
426
- if (adjustment.type.startsWith('solo')) {
427
- const entryId = adjustment.id;
428
- if (!state.deck.solo) {
429
- // Solo the entry.
430
- return {
431
- intents: [
432
- createIntent(LayoutAction.SetLayoutMode, {
433
- part: 'mode',
434
- subject: entryId,
435
- options: { mode: adjustment.type },
436
- }),
437
- ],
438
- };
439
- } else {
440
- if (adjustment.type === 'solo--fullscreen') {
441
- // Toggle fullscreen on the current entry.
442
- return {
443
- intents: [
444
- createIntent(LayoutAction.SetLayoutMode, {
445
- part: 'mode',
446
- subject: entryId,
447
- options: { mode: 'solo--fullscreen' },
448
- }),
449
- ],
450
- };
451
- } else if (adjustment.type === 'solo') {
452
- // Un-solo the current entry.
453
- return {
454
- intents: [
455
- // NOTE: The order of these is important.
456
- pipe(
457
- createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'deck' } }),
458
- chain(LayoutAction.Open, { part: 'main', subject: [entryId] }),
459
- ),
460
- ],
461
- };
462
- }
463
- }
464
- }
465
- });
466
- },
467
- }),
468
- ]);