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

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