@dxos/plugin-deck 0.8.4-main.1da679c → 0.8.4-main.21d9917

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