@dxos/plugin-deck 0.8.4-main.b97322e → 0.8.4-main.bc674ce

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 (277) hide show
  1. package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs +120 -0
  2. package/dist/lib/browser/app-graph-builder-DTVCULQ4.mjs.map +7 -0
  3. package/dist/lib/browser/{check-app-scheme-57U62A3A.mjs → check-app-scheme-JSRXXIYF.mjs} +9 -9
  4. package/dist/lib/browser/check-app-scheme-JSRXXIYF.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-F5BQOOEG.mjs → chunk-ATFPDN6J.mjs} +155 -23
  6. package/dist/lib/browser/chunk-ATFPDN6J.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-CNTGBCMK.mjs → chunk-NHABISX2.mjs} +40 -33
  8. package/dist/lib/browser/chunk-NHABISX2.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-S4A5UO4K.mjs +1448 -0
  10. package/dist/lib/browser/chunk-S4A5UO4K.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-UNG4CLLP.mjs +161 -0
  12. package/dist/lib/browser/chunk-UNG4CLLP.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +79 -67
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs +595 -0
  17. package/dist/lib/browser/operation-resolver-CDYBLZJ4.mjs.map +7 -0
  18. package/dist/lib/browser/react-root-XDCMNENQ.mjs +47 -0
  19. package/dist/lib/browser/react-root-XDCMNENQ.mjs.map +7 -0
  20. package/dist/lib/browser/react-surface-HODERLOL.mjs +42 -0
  21. package/dist/lib/browser/react-surface-HODERLOL.mjs.map +7 -0
  22. package/dist/lib/browser/settings-OMHVGZ6V.mjs +37 -0
  23. package/dist/lib/browser/settings-OMHVGZ6V.mjs.map +7 -0
  24. package/dist/lib/browser/state-OC3BSB6E.mjs +103 -0
  25. package/dist/lib/browser/state-OC3BSB6E.mjs.map +7 -0
  26. package/dist/lib/browser/toolkit-R53LD3EA.mjs +53 -0
  27. package/dist/lib/browser/toolkit-R53LD3EA.mjs.map +7 -0
  28. package/dist/lib/browser/types/index.mjs +11 -4
  29. package/dist/lib/browser/url-handler-53TE6JZO.mjs +93 -0
  30. package/dist/lib/browser/url-handler-53TE6JZO.mjs.map +7 -0
  31. package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs +121 -0
  32. package/dist/lib/node-esm/app-graph-builder-473BNZDJ.mjs.map +7 -0
  33. package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs +33 -0
  34. package/dist/lib/node-esm/check-app-scheme-IVYRHKRH.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-ADPMWKLL.mjs +154 -0
  36. package/dist/lib/node-esm/chunk-ADPMWKLL.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-D34L3ECT.mjs +1449 -0
  38. package/dist/lib/node-esm/chunk-D34L3ECT.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs +162 -0
  40. package/dist/lib/node-esm/chunk-SKEVPQ7E.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-XAKTY3EB.mjs +294 -0
  42. package/dist/lib/node-esm/chunk-XAKTY3EB.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +181 -0
  44. package/dist/lib/node-esm/index.mjs.map +7 -0
  45. package/dist/lib/node-esm/meta.json +1 -0
  46. package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs +596 -0
  47. package/dist/lib/node-esm/operation-resolver-WUOE33ID.mjs.map +7 -0
  48. package/dist/lib/node-esm/react-root-O6GZO62Z.mjs +48 -0
  49. package/dist/lib/node-esm/react-root-O6GZO62Z.mjs.map +7 -0
  50. package/dist/lib/node-esm/react-surface-IHDJDGC5.mjs +43 -0
  51. package/dist/lib/node-esm/react-surface-IHDJDGC5.mjs.map +7 -0
  52. package/dist/lib/node-esm/settings-2HB6FKIK.mjs +38 -0
  53. package/dist/lib/node-esm/settings-2HB6FKIK.mjs.map +7 -0
  54. package/dist/lib/node-esm/state-JRQ45ACJ.mjs +104 -0
  55. package/dist/lib/node-esm/state-JRQ45ACJ.mjs.map +7 -0
  56. package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs +54 -0
  57. package/dist/lib/node-esm/toolkit-JLPZNNKB.mjs.map +7 -0
  58. package/dist/lib/node-esm/types/index.mjs +40 -0
  59. package/dist/lib/node-esm/url-handler-QGF2R24T.mjs +94 -0
  60. package/dist/lib/node-esm/url-handler-QGF2R24T.mjs.map +7 -0
  61. package/dist/types/src/DeckPlugin.d.ts +2 -1
  62. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  64. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  66. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
  68. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
  70. package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/index.d.ts +8 -13
  72. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  74. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  76. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
  78. package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
  80. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  84. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  85. package/dist/types/src/capabilities/settings/index.d.ts +19 -0
  86. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/settings/settings.d.ts +21 -0
  88. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/state/index.d.ts +172 -0
  90. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/state/state.d.ts +175 -0
  92. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
  94. package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/toolkit/toolkit.d.ts +26 -0
  96. package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/tools/index.d.ts +3 -0
  98. package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
  99. package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
  100. package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
  102. package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
  104. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
  105. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
  106. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  107. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
  108. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  109. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +74 -0
  110. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
  111. package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
  112. package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
  113. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
  114. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
  115. package/dist/types/src/components/DeckLayout/Toast.d.ts +7 -2
  116. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  117. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +4 -2
  118. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
  119. package/dist/types/src/components/Plank/Plank.d.ts +4 -4
  120. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  121. package/dist/types/src/components/Plank/Plank.stories.d.ts +104 -5
  122. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
  123. package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
  124. package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
  125. package/dist/types/src/components/Plank/PlankError.d.ts +1 -1
  126. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  127. package/dist/types/src/components/Plank/PlankHeading.d.ts +3 -3
  128. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  129. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  130. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
  131. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  132. package/dist/types/src/hooks/index.d.ts +1 -0
  133. package/dist/types/src/hooks/index.d.ts.map +1 -1
  134. package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -3
  135. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  136. package/dist/types/src/hooks/useDeckState.d.ts +17 -0
  137. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
  138. package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
  139. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
  140. package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
  141. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  142. package/dist/types/src/index.d.ts +1 -2
  143. package/dist/types/src/index.d.ts.map +1 -1
  144. package/dist/types/src/meta.d.ts +2 -3
  145. package/dist/types/src/meta.d.ts.map +1 -1
  146. package/dist/types/src/translations.d.ts +3 -1
  147. package/dist/types/src/translations.d.ts.map +1 -1
  148. package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
  149. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  150. package/dist/types/src/types/events.d.ts +7 -0
  151. package/dist/types/src/types/events.d.ts.map +1 -0
  152. package/dist/types/src/types/index.d.ts +2 -0
  153. package/dist/types/src/types/index.d.ts.map +1 -1
  154. package/dist/types/src/types/schema.d.ts +90 -30
  155. package/dist/types/src/types/schema.d.ts.map +1 -1
  156. package/dist/types/src/util/set-active.d.ts +18 -3
  157. package/dist/types/src/util/set-active.d.ts.map +1 -1
  158. package/dist/types/tsconfig.tsbuildinfo +1 -1
  159. package/package.json +56 -46
  160. package/src/DeckPlugin.ts +45 -61
  161. package/src/capabilities/app-graph-builder/app-graph-builder.ts +118 -0
  162. package/src/capabilities/app-graph-builder/index.ts +7 -0
  163. package/src/capabilities/{check-app-scheme.ts → check-app-scheme/check-app-scheme.ts} +12 -11
  164. package/src/capabilities/check-app-scheme/index.ts +7 -0
  165. package/src/capabilities/index.ts +9 -13
  166. package/src/capabilities/operation-resolver/index.ts +10 -0
  167. package/src/capabilities/operation-resolver/operation-resolver.ts +555 -0
  168. package/src/capabilities/react-root/index.ts +7 -0
  169. package/src/capabilities/react-root/react-root.tsx +47 -0
  170. package/src/capabilities/react-surface/index.ts +7 -0
  171. package/src/capabilities/react-surface/react-surface.tsx +37 -0
  172. package/src/capabilities/settings/index.ts +7 -0
  173. package/src/capabilities/settings/settings.ts +38 -0
  174. package/src/capabilities/state/index.ts +7 -0
  175. package/src/capabilities/state/state.ts +104 -0
  176. package/src/capabilities/toolkit/index.ts +7 -0
  177. package/src/capabilities/toolkit/toolkit.ts +63 -0
  178. package/src/capabilities/tools/index.ts +7 -0
  179. package/src/capabilities/tools/tools.ts +92 -0
  180. package/src/capabilities/url-handler/index.ts +7 -0
  181. package/src/capabilities/url-handler/url-handler.ts +95 -0
  182. package/src/components/DeckLayout/ActiveNode.tsx +1 -1
  183. package/src/components/DeckLayout/Banner.tsx +6 -6
  184. package/src/components/DeckLayout/ContentEmpty.tsx +4 -5
  185. package/src/components/DeckLayout/DeckLayout.stories.tsx +51 -0
  186. package/src/components/DeckLayout/DeckLayout.tsx +18 -285
  187. package/src/components/DeckLayout/DeckMain.tsx +286 -0
  188. package/src/components/DeckLayout/Dialog.tsx +13 -10
  189. package/src/components/DeckLayout/Fallback.tsx +4 -4
  190. package/src/components/DeckLayout/Popover.tsx +44 -32
  191. package/src/components/DeckLayout/StatusBar.tsx +1 -1
  192. package/src/components/DeckLayout/Toast.tsx +30 -5
  193. package/src/components/DeckSettings/DeckSettings.tsx +91 -66
  194. package/src/components/Plank/Plank.stories.tsx +23 -16
  195. package/src/components/Plank/Plank.tsx +89 -56
  196. package/src/components/Plank/PlankControls.tsx +9 -9
  197. package/src/components/Plank/PlankError.tsx +5 -4
  198. package/src/components/Plank/PlankHeading.tsx +38 -42
  199. package/src/components/Sidebar/ComplementarySidebar.tsx +61 -33
  200. package/src/components/Sidebar/Sidebar.tsx +6 -6
  201. package/src/components/Sidebar/SidebarButton.tsx +39 -32
  202. package/src/components/fragments.ts +1 -1
  203. package/src/hooks/index.ts +1 -0
  204. package/src/hooks/useCompanions.ts +1 -1
  205. package/src/hooks/useDeckCompanions.ts +7 -5
  206. package/src/hooks/useDeckState.ts +82 -0
  207. package/src/hooks/useHoistStatusbar.ts +4 -5
  208. package/src/hooks/useNodeActionExpander.ts +4 -4
  209. package/src/index.ts +1 -2
  210. package/src/meta.ts +8 -5
  211. package/src/translations.ts +3 -1
  212. package/src/types/capabilities.ts +33 -0
  213. package/src/types/events.ts +20 -0
  214. package/src/types/index.ts +2 -0
  215. package/src/types/schema.ts +86 -14
  216. package/src/util/layoutAppliesTopbar.ts +1 -1
  217. package/src/util/set-active.ts +49 -29
  218. package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs +0 -152
  219. package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
  220. package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
  221. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  222. package/dist/lib/browser/chunk-D7KTFCUV.mjs +0 -1494
  223. package/dist/lib/browser/chunk-D7KTFCUV.mjs.map +0 -7
  224. package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-JFTXENFN.mjs +0 -129
  226. package/dist/lib/browser/chunk-JFTXENFN.mjs.map +0 -7
  227. package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
  228. package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
  229. package/dist/lib/browser/chunk-QDZO4AJ4.mjs +0 -127
  230. package/dist/lib/browser/chunk-QDZO4AJ4.mjs.map +0 -7
  231. package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
  232. package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
  233. package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs +0 -521
  234. package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs.map +0 -7
  235. package/dist/lib/browser/react-root-PO64J7ML.mjs +0 -43
  236. package/dist/lib/browser/react-root-PO64J7ML.mjs.map +0 -7
  237. package/dist/lib/browser/react-surface-E45YOVF5.mjs +0 -40
  238. package/dist/lib/browser/react-surface-E45YOVF5.mjs.map +0 -7
  239. package/dist/lib/browser/settings-6AJZPZPM.mjs +0 -29
  240. package/dist/lib/browser/settings-6AJZPZPM.mjs.map +0 -7
  241. package/dist/lib/browser/state-MVDYX77Y.mjs +0 -12
  242. package/dist/lib/browser/tools-TKQDPCHJ.mjs +0 -88
  243. package/dist/lib/browser/tools-TKQDPCHJ.mjs.map +0 -7
  244. package/dist/lib/browser/url-handler-7L7M6IKH.mjs +0 -70
  245. package/dist/lib/browser/url-handler-7L7M6IKH.mjs.map +0 -7
  246. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  247. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  248. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  249. package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
  250. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  251. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  252. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  253. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  254. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  255. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  256. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  257. package/dist/types/src/capabilities/settings.d.ts +0 -4
  258. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  259. package/dist/types/src/capabilities/state.d.ts +0 -101
  260. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  261. package/dist/types/src/capabilities/tools.d.ts +0 -11
  262. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  263. package/dist/types/src/capabilities/url-handler.d.ts +0 -4
  264. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  265. package/dist/types/src/events.d.ts +0 -4
  266. package/dist/types/src/events.d.ts.map +0 -1
  267. package/src/capabilities/app-graph-builder.ts +0 -141
  268. package/src/capabilities/capabilities.ts +0 -14
  269. package/src/capabilities/intent-resolver.ts +0 -468
  270. package/src/capabilities/react-root.tsx +0 -38
  271. package/src/capabilities/react-surface.tsx +0 -30
  272. package/src/capabilities/settings.ts +0 -26
  273. package/src/capabilities/state.ts +0 -104
  274. package/src/capabilities/tools.ts +0 -81
  275. package/src/capabilities/url-handler.ts +0 -59
  276. package/src/events.ts +0 -11
  277. /package/dist/lib/{browser/state-MVDYX77Y.mjs.map → node-esm/types/index.mjs.map} +0 -0
@@ -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,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
- ]);
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useCallback } from 'react';
6
-
7
- import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
8
-
9
- import { DeckCapabilities } from './capabilities';
10
- import { DeckLayout } from '../components';
11
- import { DECK_PLUGIN } from '../meta';
12
-
13
- export default () =>
14
- contributes(Capabilities.ReactRoot, {
15
- id: DECK_PLUGIN,
16
- root: () => {
17
- const layout = useCapability(DeckCapabilities.MutableDeckState);
18
-
19
- const handleDismissToast = useCallback(
20
- (id: string) => {
21
- const index = layout.toasts.findIndex((toast) => toast.id === id);
22
- if (index !== -1) {
23
- // Allow time for the toast to animate out.
24
- // TODO(burdon): Factor out and unregister timeout.
25
- setTimeout(() => {
26
- if (layout.toasts[index].id === layout.currentUndoId) {
27
- layout.currentUndoId = undefined;
28
- }
29
- layout.toasts.splice(index, 1);
30
- }, 1_000);
31
- }
32
- },
33
- [layout.toasts],
34
- );
35
-
36
- return <DeckLayout onDismissToast={handleDismissToast} />;
37
- },
38
- });
@@ -1,30 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
- import { SettingsStore } from '@dxos/local-storage';
9
-
10
- import { DeckSettings, Banner } from '../components';
11
- import { DECK_PLUGIN } from '../meta';
12
- import { type DeckSettingsProps } from '../types';
13
-
14
- export default () =>
15
- contributes(Capabilities.ReactSurface, [
16
- createSurface({
17
- id: `${DECK_PLUGIN}/plugin-settings`,
18
- role: 'article',
19
- filter: (data): data is { subject: SettingsStore<DeckSettingsProps> } =>
20
- data.subject instanceof SettingsStore && data.subject.prefix === DECK_PLUGIN,
21
- component: ({ data: { subject } }) => <DeckSettings settings={subject.value} />,
22
- }),
23
- createSurface({
24
- id: `${DECK_PLUGIN}/banner`,
25
- role: 'banner',
26
- component: ({ data }) => {
27
- return <Banner variant={data.variant} />;
28
- },
29
- }),
30
- ]);
@@ -1,26 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capabilities, contributes } from '@dxos/app-framework';
6
- import { live } from '@dxos/live-object';
7
-
8
- import { meta } from '../meta';
9
- import { DeckSettingsSchema, type DeckSettingsProps } from '../types';
10
-
11
- export default () => {
12
- const settings = live<DeckSettingsProps>({
13
- showHints: false,
14
- enableDeck: false,
15
- enableStatusbar: false,
16
- enableNativeRedirect: false,
17
- newPlankPositioning: 'start',
18
- overscroll: 'none',
19
- });
20
-
21
- return contributes(Capabilities.Settings, {
22
- prefix: meta.id,
23
- schema: DeckSettingsSchema,
24
- value: settings,
25
- });
26
- };
@@ -1,104 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capabilities, contributes } from '@dxos/app-framework';
6
- import { invariant } from '@dxos/invariant';
7
- import { live } from '@dxos/live-object';
8
- import { LocalStorageStore } from '@dxos/local-storage';
9
- import { type SidebarState } from '@dxos/react-ui';
10
-
11
- import { DeckCapabilities } from './capabilities';
12
- import { DECK_PLUGIN } from '../meta';
13
- import { getMode, type DeckPluginState, defaultDeck, type DeckState } from '../types';
14
-
15
- const boolean = /true|false/;
16
-
17
- // TODO(thure, 18 Feb 2025): Remove after the next release.
18
-
19
- const migrateSidebarStateDefaults = {
20
- [`${DECK_PLUGIN}/complementary-sidebar-state`]: 'expanded',
21
- [`${DECK_PLUGIN}/sidebar-state`]: 'collapsed',
22
- };
23
-
24
- const migrateSidebarState = () => {
25
- Object.entries(migrateSidebarStateDefaults).forEach(([key, defaultValue]) => {
26
- if (boolean.test(localStorage.getItem(key) ?? 'never')) {
27
- localStorage.setItem(key, defaultValue);
28
- }
29
- });
30
- };
31
-
32
- export const DeckStateFactory = () => {
33
- migrateSidebarState();
34
-
35
- const state = new LocalStorageStore<DeckPluginState>(DECK_PLUGIN, {
36
- sidebarState: 'expanded',
37
- complementarySidebarState: 'collapsed',
38
- complementarySidebarPanel: undefined,
39
- dialogContent: null,
40
- dialogOpen: false,
41
- dialogBlockAlign: undefined,
42
- dialogType: undefined,
43
- popoverContent: null,
44
- popoverAnchor: undefined,
45
- popoverAnchorId: undefined,
46
- popoverOpen: false,
47
- toasts: [],
48
- currentUndoId: undefined,
49
- activeDeck: 'default',
50
- previousDeck: 'default',
51
- decks: {
52
- default: { ...defaultDeck },
53
- },
54
- get deck() {
55
- const deck = this.decks[this.activeDeck];
56
- invariant(deck, `Deck not found: ${this.activeDeck}`);
57
- return deck;
58
- },
59
- previousMode: {},
60
- scrollIntoView: undefined,
61
- });
62
-
63
- state
64
- .prop({ key: 'sidebarState', type: LocalStorageStore.enum<SidebarState>() })
65
- .prop({ key: 'complementarySidebarState', type: LocalStorageStore.enum<SidebarState>() })
66
- .prop({ key: 'complementarySidebarPanel', type: LocalStorageStore.string({ allowUndefined: true }) })
67
- .prop({ key: 'decks', type: LocalStorageStore.json<Record<string, DeckState>>() })
68
- .prop({ key: 'activeDeck', type: LocalStorageStore.string() })
69
- .prop({ key: 'previousDeck', type: LocalStorageStore.string() });
70
-
71
- const layout = live<Capabilities.Layout>({
72
- get mode() {
73
- return getMode(state.values.deck);
74
- },
75
- get dialogOpen() {
76
- return state.values.dialogOpen;
77
- },
78
- get sidebarOpen() {
79
- return state.values.sidebarState === 'expanded';
80
- },
81
- get complementarySidebarOpen() {
82
- return state.values.complementarySidebarState === 'expanded';
83
- },
84
- get workspace() {
85
- return state.values.activeDeck;
86
- },
87
- get active() {
88
- return state.values.deck.solo ? [state.values.deck.solo] : state.values.deck.active;
89
- },
90
- get inactive() {
91
- return state.values.deck.inactive;
92
- },
93
- get scrollIntoView() {
94
- return state.values.scrollIntoView;
95
- },
96
- });
97
-
98
- return [
99
- contributes(DeckCapabilities.DeckState, state.values, () => state.close()),
100
- contributes(Capabilities.Layout, layout),
101
- ];
102
- };
103
-
104
- export default DeckStateFactory;