@dxos/plugin-deck 0.8.4-main.1f223c7 → 0.8.4-main.2244d791bb

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 (283) hide show
  1. package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs +121 -0
  2. package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs.map +7 -0
  3. package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs +32 -0
  4. package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-DONG2FYU.mjs +295 -0
  6. package/dist/lib/browser/chunk-DONG2FYU.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-JGC4ZLG3.mjs +1469 -0
  8. package/dist/lib/browser/chunk-JGC4ZLG3.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-YT3AJVUU.mjs +161 -0
  12. package/dist/lib/browser/chunk-YT3AJVUU.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +83 -76
  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-XJFR3PNQ.mjs +597 -0
  17. package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs.map +7 -0
  18. package/dist/lib/browser/react-root-AJFHKHRL.mjs +47 -0
  19. package/dist/lib/browser/react-root-AJFHKHRL.mjs.map +7 -0
  20. package/dist/lib/browser/react-surface-KBRBGEXY.mjs +43 -0
  21. package/dist/lib/browser/react-surface-KBRBGEXY.mjs.map +7 -0
  22. package/dist/lib/browser/settings-ES42FGLG.mjs +38 -0
  23. package/dist/lib/browser/settings-ES42FGLG.mjs.map +7 -0
  24. package/dist/lib/browser/state-YMI6IDEL.mjs +104 -0
  25. package/dist/lib/browser/state-YMI6IDEL.mjs.map +7 -0
  26. package/dist/lib/browser/toolkit-VRD54KY3.mjs +54 -0
  27. package/dist/lib/browser/toolkit-VRD54KY3.mjs.map +7 -0
  28. package/dist/lib/browser/types/index.mjs +11 -4
  29. package/dist/lib/browser/url-handler-37UPOB3U.mjs +94 -0
  30. package/dist/lib/browser/url-handler-37UPOB3U.mjs.map +7 -0
  31. package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs +122 -0
  32. package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs.map +7 -0
  33. package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs +33 -0
  34. package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-7NPS347C.mjs +1470 -0
  36. package/dist/lib/node-esm/chunk-7NPS347C.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-ADPMWKLL.mjs +154 -0
  38. package/dist/lib/node-esm/chunk-ADPMWKLL.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-CVYHPJIN.mjs +297 -0
  40. package/dist/lib/node-esm/chunk-CVYHPJIN.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs +162 -0
  42. package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +183 -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-ZQGNATPX.mjs +598 -0
  47. package/dist/lib/node-esm/operation-resolver-ZQGNATPX.mjs.map +7 -0
  48. package/dist/lib/node-esm/react-root-2S77ABBS.mjs +48 -0
  49. package/dist/lib/node-esm/react-root-2S77ABBS.mjs.map +7 -0
  50. package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs +44 -0
  51. package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs.map +7 -0
  52. package/dist/lib/node-esm/settings-E3TH3FAW.mjs +39 -0
  53. package/dist/lib/node-esm/settings-E3TH3FAW.mjs.map +7 -0
  54. package/dist/lib/node-esm/state-WQEFBQMD.mjs +105 -0
  55. package/dist/lib/node-esm/state-WQEFBQMD.mjs.map +7 -0
  56. package/dist/lib/node-esm/toolkit-ME546G5T.mjs +55 -0
  57. package/dist/lib/node-esm/toolkit-ME546G5T.mjs.map +7 -0
  58. package/dist/lib/node-esm/types/index.mjs +40 -0
  59. package/dist/lib/node-esm/url-handler-2KYHXINK.mjs +95 -0
  60. package/dist/lib/node-esm/url-handler-2KYHXINK.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 +22 -0
  88. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/state/index.d.ts +174 -0
  90. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/state/state.d.ts +177 -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 +27 -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/ActiveNode.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 +75 -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 +3 -3
  120. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  121. package/dist/types/src/components/Plank/Plank.stories.d.ts +26 -6
  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 +2 -2
  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 +98 -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 +92 -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 +55 -48
  160. package/src/DeckPlugin.ts +45 -66
  161. package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
  162. package/src/capabilities/app-graph-builder/index.ts +7 -0
  163. package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
  164. package/src/capabilities/check-app-scheme/index.ts +7 -0
  165. package/src/capabilities/index.ts +9 -14
  166. package/src/capabilities/operation-resolver/index.ts +10 -0
  167. package/src/capabilities/operation-resolver/operation-resolver.ts +570 -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 +38 -0
  172. package/src/capabilities/settings/index.ts +7 -0
  173. package/src/capabilities/settings/settings.ts +39 -0
  174. package/src/capabilities/state/index.ts +7 -0
  175. package/src/capabilities/state/state.ts +105 -0
  176. package/src/capabilities/toolkit/index.ts +7 -0
  177. package/src/capabilities/toolkit/toolkit.ts +64 -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 +96 -0
  182. package/src/components/DeckLayout/ActiveNode.tsx +3 -2
  183. package/src/components/DeckLayout/Banner.tsx +8 -8
  184. package/src/components/DeckLayout/ContentEmpty.tsx +4 -5
  185. package/src/components/DeckLayout/DeckLayout.stories.tsx +52 -0
  186. package/src/components/DeckLayout/DeckLayout.tsx +17 -285
  187. package/src/components/DeckLayout/DeckMain.tsx +286 -0
  188. package/src/components/DeckLayout/Dialog.tsx +21 -12
  189. package/src/components/DeckLayout/Fallback.tsx +4 -4
  190. package/src/components/DeckLayout/Popover.tsx +60 -32
  191. package/src/components/DeckLayout/StatusBar.tsx +3 -3
  192. package/src/components/DeckLayout/Toast.tsx +30 -5
  193. package/src/components/DeckSettings/DeckSettings.tsx +44 -28
  194. package/src/components/Plank/Plank.stories.tsx +18 -11
  195. package/src/components/Plank/Plank.tsx +88 -55
  196. package/src/components/Plank/PlankControls.tsx +9 -9
  197. package/src/components/Plank/PlankError.tsx +4 -4
  198. package/src/components/Plank/PlankHeading.tsx +38 -42
  199. package/src/components/Sidebar/ComplementarySidebar.tsx +67 -36
  200. package/src/components/Sidebar/Sidebar.tsx +7 -7
  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 +6 -4
  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 +21 -0
  214. package/src/types/index.ts +2 -0
  215. package/src/types/schema.ts +90 -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-DVEKLXB4.mjs +0 -152
  219. package/dist/lib/browser/app-graph-builder-DVEKLXB4.mjs.map +0 -7
  220. package/dist/lib/browser/check-app-scheme-3BQJXWEY.mjs +0 -32
  221. package/dist/lib/browser/check-app-scheme-3BQJXWEY.mjs.map +0 -7
  222. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-F5BQOOEG.mjs +0 -160
  224. package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
  226. package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
  227. package/dist/lib/browser/chunk-NRCPV6AV.mjs +0 -129
  228. package/dist/lib/browser/chunk-NRCPV6AV.mjs.map +0 -7
  229. package/dist/lib/browser/chunk-NU7H23SK.mjs +0 -1498
  230. package/dist/lib/browser/chunk-NU7H23SK.mjs.map +0 -7
  231. package/dist/lib/browser/chunk-WILMPGDV.mjs +0 -127
  232. package/dist/lib/browser/chunk-WILMPGDV.mjs.map +0 -7
  233. package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
  234. package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
  235. package/dist/lib/browser/intent-resolver-2SUIIV6N.mjs +0 -521
  236. package/dist/lib/browser/intent-resolver-2SUIIV6N.mjs.map +0 -7
  237. package/dist/lib/browser/react-root-7PRVDLF7.mjs +0 -43
  238. package/dist/lib/browser/react-root-7PRVDLF7.mjs.map +0 -7
  239. package/dist/lib/browser/react-surface-FNY2YC2F.mjs +0 -40
  240. package/dist/lib/browser/react-surface-FNY2YC2F.mjs.map +0 -7
  241. package/dist/lib/browser/settings-LUPQPZ27.mjs +0 -29
  242. package/dist/lib/browser/settings-LUPQPZ27.mjs.map +0 -7
  243. package/dist/lib/browser/state-CRXR7X63.mjs +0 -12
  244. package/dist/lib/browser/toolkit-XGJSBY67.mjs +0 -61
  245. package/dist/lib/browser/toolkit-XGJSBY67.mjs.map +0 -7
  246. package/dist/lib/browser/url-handler-LROZYQ26.mjs +0 -70
  247. package/dist/lib/browser/url-handler-LROZYQ26.mjs.map +0 -7
  248. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  249. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  250. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  251. package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
  252. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  253. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  254. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  255. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  256. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  257. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  258. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  259. package/dist/types/src/capabilities/settings.d.ts +0 -4
  260. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  261. package/dist/types/src/capabilities/state.d.ts +0 -101
  262. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  263. package/dist/types/src/capabilities/toolkit.d.ts +0 -5
  264. package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
  265. package/dist/types/src/capabilities/tools.d.ts +0 -11
  266. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  267. package/dist/types/src/capabilities/url-handler.d.ts +0 -4
  268. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  269. package/dist/types/src/events.d.ts +0 -4
  270. package/dist/types/src/events.d.ts.map +0 -1
  271. package/src/capabilities/app-graph-builder.ts +0 -142
  272. package/src/capabilities/capabilities.ts +0 -14
  273. package/src/capabilities/check-app-scheme.ts +0 -40
  274. package/src/capabilities/intent-resolver.ts +0 -469
  275. package/src/capabilities/react-root.tsx +0 -39
  276. package/src/capabilities/react-surface.tsx +0 -30
  277. package/src/capabilities/settings.ts +0 -26
  278. package/src/capabilities/state.ts +0 -105
  279. package/src/capabilities/toolkit.ts +0 -55
  280. package/src/capabilities/tools.ts +0 -84
  281. package/src/capabilities/url-handler.ts +0 -60
  282. package/src/events.ts +0 -11
  283. /package/dist/lib/{browser/state-CRXR7X63.mjs.map → node-esm/types/index.mjs.map} +0 -0
@@ -3,12 +3,15 @@
3
3
  //
4
4
 
5
5
  import { createContext } from '@radix-ui/react-context';
6
- import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
+ import React, { type PropsWithChildren, useCallback, useEffect, useRef, useState } from 'react';
7
7
 
8
- import { Surface, useCapability } from '@dxos/app-framework';
9
- import { Popover, type PopoverContentInteractOutsideEvent } from '@dxos/react-ui';
8
+ import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
9
+ import { LayoutOperation } from '@dxos/app-toolkit';
10
+ import { Popover, type PopoverContentInteractOutsideEvent, toLocalizedString, useTranslation } from '@dxos/react-ui';
11
+ import { Card } from '@dxos/react-ui-mosaic';
10
12
 
11
- import { DeckCapabilities } from '../../capabilities';
13
+ import { useDeckState } from '../../hooks';
14
+ import { meta } from '../../meta';
12
15
 
13
16
  export type DeckPopoverRootProps = PropsWithChildren<{}>;
14
17
 
@@ -21,32 +24,32 @@ type DeckPopoverContextValue = {
21
24
  const [DeckPopoverProvider, useDeckPopoverContext] = createContext<DeckPopoverContextValue>('DeckPopover');
22
25
 
23
26
  export const PopoverRoot = ({ children }: DeckPopoverRootProps) => {
24
- const layout = useCapability(DeckCapabilities.MutableDeckState);
27
+ const { state } = useDeckState();
25
28
  const virtualRef = useRef<HTMLButtonElement | null>(null);
26
29
  const [virtualIter, setVirtualIter] = useState(0);
27
30
  const [open, setOpen] = useState(false);
28
31
  const debounceRef = useRef<NodeJS.Timeout | null>(null);
29
32
 
30
33
  // TODO(thure): This is a workaround for the race condition between displaying a Popover and either rendering
31
- // the anchor further down the tree or measuring the virtual triggers client rect.
34
+ // the anchor further down the tree or measuring the virtual trigger's client rect.
32
35
  useEffect(() => {
33
36
  setOpen(false);
34
- if (layout.popoverOpen) {
37
+ if (state.popoverOpen) {
35
38
  if (debounceRef.current) {
36
39
  clearTimeout(debounceRef.current);
37
40
  }
38
- if (layout.popoverAnchor && virtualRef.current !== layout.popoverAnchor) {
39
- virtualRef.current = layout.popoverAnchor ?? null;
41
+ if (state.popoverAnchor && virtualRef.current !== state.popoverAnchor) {
42
+ virtualRef.current = state.popoverAnchor ?? null;
40
43
  setVirtualIter((iter) => iter + 1);
41
44
  }
42
45
  debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
43
46
  }
44
- }, [layout.popoverOpen, layout.popoverAnchorId, layout.popoverAnchor, layout.popoverContent]);
47
+ }, [state.popoverOpen, state.popoverAnchorId, state.popoverAnchor, state.popoverContent]);
45
48
 
46
49
  return (
47
50
  <DeckPopoverProvider setOpen={setOpen}>
48
51
  <Popover.Root modal={false} open={open}>
49
- {layout.popoverAnchor && <Popover.VirtualTrigger key={virtualIter} virtualRef={virtualRef} />}
52
+ {state.popoverAnchor && <Popover.VirtualTrigger key={virtualIter} virtualRef={virtualRef} />}
50
53
  {children}
51
54
  </Popover.Root>
52
55
  </DeckPopoverProvider>
@@ -54,10 +57,23 @@ export const PopoverRoot = ({ children }: DeckPopoverRootProps) => {
54
57
  };
55
58
 
56
59
  export const PopoverContent = () => {
57
- const layout = useCapability(DeckCapabilities.MutableDeckState);
60
+ const { t } = useTranslation(meta.id);
61
+ const { state, updateEphemeral } = useDeckState();
58
62
  const { setOpen } = useDeckPopoverContext('PopoverContent');
63
+ const { invokeSync } = useOperationInvoker();
59
64
 
60
- const handleClose = useCallback(
65
+ const handleClose = useCallback(() => {
66
+ setOpen(false);
67
+ updateEphemeral((state) => ({
68
+ ...state,
69
+ popoverOpen: false,
70
+ popoverAnchor: undefined,
71
+ popoverAnchorId: undefined,
72
+ popoverSide: undefined,
73
+ }));
74
+ }, [updateEphemeral]);
75
+
76
+ const handleInteractOutside = useCallback(
61
77
  (event: KeyboardEvent | PopoverContentInteractOutsideEvent) => {
62
78
  if (
63
79
  // TODO(thure): CodeMirror should not focus itself when it updates.
@@ -66,36 +82,48 @@ export const PopoverContent = () => {
66
82
  ) {
67
83
  event.preventDefault();
68
84
  } else {
69
- setOpen(false);
70
- layout.popoverOpen = false;
71
- layout.popoverAnchor = undefined;
72
- layout.popoverAnchorId = undefined;
73
- layout.popoverSide = undefined;
85
+ handleClose();
74
86
  }
75
87
  },
76
- [setOpen],
88
+ [handleClose],
77
89
  );
78
90
 
79
- const collisionBoundaries: HTMLElement[] = useMemo(() => {
80
- const closest = layout.popoverAnchor?.closest('[data-popover-collision-boundary]') as
81
- | HTMLElement
82
- | null
83
- | undefined;
84
- return closest ? [closest] : [];
85
- }, [layout.popoverAnchor]);
86
-
87
91
  return (
88
92
  <Popover.Portal>
89
93
  <Popover.Content
90
- side={layout.popoverSide}
91
- onInteractOutside={handleClose}
92
- onEscapeKeyDown={handleClose}
93
- collisionBoundary={collisionBoundaries}
94
+ side={state.popoverSide}
94
95
  sticky='always'
95
96
  hideWhenDetached
97
+ onInteractOutside={handleInteractOutside}
98
+ onEscapeKeyDown={handleInteractOutside}
96
99
  >
97
100
  <Popover.Viewport>
98
- <Surface role='card--popover' data={layout.popoverContent} limit={1} />
101
+ {/* TODO(burdon): Set/disable column context. */}
102
+ {state.popoverKind === 'base' && <Surface.Surface role='popover' data={state.popoverContent} limit={1} />}
103
+ {state.popoverKind === 'card' && (
104
+ <Card.Root border={false} classNames='popover-card-max-width'>
105
+ <Card.Toolbar>
106
+ {/* TODO(wittjosiah): Cleaner way to handle no drag handle in toolbar? */}
107
+ {state.popoverContentRef ? (
108
+ <Card.ToolbarIconButton
109
+ icon='ph--arrow-square-out--regular'
110
+ iconOnly
111
+ label={t('open item label')}
112
+ onClick={() => {
113
+ invokeSync(LayoutOperation.Open, {
114
+ subject: [state.popoverContentRef!],
115
+ });
116
+ }}
117
+ />
118
+ ) : (
119
+ <div />
120
+ )}
121
+ {state.popoverTitle ? <Card.Title>{toLocalizedString(state.popoverTitle, t)}</Card.Title> : <span />}
122
+ <Card.Close onClick={handleClose} />
123
+ </Card.Toolbar>
124
+ <Surface.Surface role='card--content' data={state.popoverContent} limit={1} />
125
+ </Card.Root>
126
+ )}
99
127
  </Popover.Viewport>
100
128
  <Popover.Arrow />
101
129
  </Popover.Content>
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { Surface } from '@dxos/app-framework';
7
+ import { Surface } from '@dxos/app-framework/ui';
8
8
  import { useLandmarkMover } from '@dxos/react-ui';
9
9
 
10
10
  export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
@@ -15,8 +15,8 @@ export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
15
15
  className='fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description'
16
16
  {...mover}
17
17
  >
18
- {showHints && <Surface role='hints' limit={1} />}
19
- <Surface role='status-bar' limit={1} />
18
+ {showHints && <Surface.Surface role='hints' limit={1} />}
19
+ <Surface.Surface role='status-bar' limit={1} />
20
20
  </div>
21
21
  );
22
22
  };
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { type LayoutAction } from '@dxos/app-framework';
7
+ import { type LayoutOperation } from '@dxos/app-toolkit';
8
8
  import {
9
9
  Button,
10
10
  Icon,
@@ -14,7 +14,7 @@ import {
14
14
  useTranslation,
15
15
  } from '@dxos/react-ui';
16
16
 
17
- import { DECK_PLUGIN } from '../../meta';
17
+ import { meta } from '../../meta';
18
18
 
19
19
  // TODO(wittjosiah): Render remaining duration as a progress bar within the toast.
20
20
  export const Toast = ({
@@ -28,14 +28,14 @@ export const Toast = ({
28
28
  closeLabel,
29
29
  onAction,
30
30
  onOpenChange,
31
- }: LayoutAction.Toast & Pick<ToastRootProps, 'onOpenChange'>) => {
32
- const { t } = useTranslation(DECK_PLUGIN);
31
+ }: LayoutOperation.Toast & Pick<ToastRootProps, 'onOpenChange'>) => {
32
+ const { t } = useTranslation(meta.id);
33
33
 
34
34
  return (
35
35
  <NaturalToast.Root data-testid={id} defaultOpen duration={duration} onOpenChange={onOpenChange}>
36
36
  <NaturalToast.Body>
37
37
  <NaturalToast.Title classNames='items-center'>
38
- {icon && <Icon icon={icon} size={5} classNames='inline mr-1' />}
38
+ {icon && <Icon icon={icon} classNames='inline mr-1' />}
39
39
  {title && <span>{toLocalizedString(title, t)}</span>}
40
40
  </NaturalToast.Title>
41
41
  {description && (
@@ -59,3 +59,28 @@ export const Toast = ({
59
59
  </NaturalToast.Root>
60
60
  );
61
61
  };
62
+
63
+ export type ToasterProps = {
64
+ toasts?: LayoutOperation.Toast[];
65
+ onDismissToast?: (id: string) => void;
66
+ };
67
+
68
+ export const Toaster = ({ toasts, onDismissToast }: ToasterProps) => {
69
+ return (
70
+ <>
71
+ {toasts?.map((toast) => (
72
+ <Toast
73
+ {...toast}
74
+ key={toast.id}
75
+ onOpenChange={(open: boolean) => {
76
+ if (!open) {
77
+ onDismissToast?.(toast.id);
78
+ }
79
+
80
+ return open;
81
+ }}
82
+ />
83
+ ))}
84
+ </>
85
+ );
86
+ };
@@ -5,9 +5,9 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { Input, Select, useTranslation } from '@dxos/react-ui';
8
- import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
8
+ import { Settings } from '@dxos/react-ui-form';
9
9
 
10
- import { DECK_PLUGIN } from '../../meta';
10
+ import { meta } from '../../meta';
11
11
  import {
12
12
  type DeckSettingsProps,
13
13
  type NewPlankPositioning,
@@ -18,24 +18,37 @@ import {
18
18
 
19
19
  const isSocket = !!(globalThis as any).__args;
20
20
 
21
- export const DeckSettings = ({ settings }: { settings: DeckSettingsProps }) => {
22
- const { t } = useTranslation(DECK_PLUGIN);
21
+ export type DeckSettingsComponentProps = {
22
+ settings: DeckSettingsProps;
23
+ onSettingsChange: (fn: (current: DeckSettingsProps) => DeckSettingsProps) => void;
24
+ };
25
+
26
+ export const DeckSettings = ({ settings, onSettingsChange }: DeckSettingsComponentProps) => {
27
+ const { t } = useTranslation(meta.id);
23
28
 
24
29
  return (
25
- <ControlPage>
26
- <ControlSection title={t('settings title', { ns: DECK_PLUGIN })}>
27
- <ControlGroup>
28
- <ControlItemInput title={t('settings enable deck label')}>
30
+ <Settings.Root>
31
+ <Settings.Section title={t('settings title', { ns: meta.id })}>
32
+ <Settings.Group>
33
+ <Settings.ItemInput title={t('settings enable deck label')}>
29
34
  <Input.Switch
30
35
  checked={settings.enableDeck}
31
- onCheckedChange={(checked) => (settings.enableDeck = checked)}
36
+ onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableDeck: checked }))}
37
+ />
38
+ </Settings.ItemInput>
39
+ <Settings.ItemInput title={t('settings encapsulated planks label')}>
40
+ <Input.Switch
41
+ checked={settings.encapsulatedPlanks ?? false}
42
+ onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, encapsulatedPlanks: checked }))}
32
43
  />
33
- </ControlItemInput>
34
- <ControlItemInput title={t('select new plank positioning label')}>
44
+ </Settings.ItemInput>
45
+ <Settings.ItemInput title={t('select new plank positioning label')}>
35
46
  <Select.Root
36
47
  disabled={!settings.enableDeck}
37
48
  value={settings.newPlankPositioning ?? 'start'}
38
- onValueChange={(value) => (settings.newPlankPositioning = value as NewPlankPositioning)}
49
+ onValueChange={(value) =>
50
+ onSettingsChange((s) => ({ ...s, newPlankPositioning: value as NewPlankPositioning }))
51
+ }
39
52
  >
40
53
  <Select.TriggerButton placeholder={t('select new plank positioning placeholder')} />
41
54
  <Select.Portal>
@@ -51,12 +64,12 @@ export const DeckSettings = ({ settings }: { settings: DeckSettingsProps }) => {
51
64
  </Select.Content>
52
65
  </Select.Portal>
53
66
  </Select.Root>
54
- </ControlItemInput>
55
- <ControlItemInput title={t('settings overscroll label')}>
67
+ </Settings.ItemInput>
68
+ <Settings.ItemInput title={t('settings overscroll label')}>
56
69
  <Select.Root
57
70
  disabled={!settings.enableDeck}
58
71
  value={settings.overscroll ?? 'none'}
59
- onValueChange={(value) => (settings.overscroll = value as Overscroll)}
72
+ onValueChange={(value) => onSettingsChange((s) => ({ ...s, overscroll: value as Overscroll }))}
60
73
  >
61
74
  <Select.TriggerButton placeholder={t('select overscroll placeholder')} />
62
75
  <Select.Portal>
@@ -72,26 +85,29 @@ export const DeckSettings = ({ settings }: { settings: DeckSettingsProps }) => {
72
85
  </Select.Content>
73
86
  </Select.Portal>
74
87
  </Select.Root>
75
- </ControlItemInput>
76
- <ControlItemInput title={t('settings enable statusbar label')}>
88
+ </Settings.ItemInput>
89
+ <Settings.ItemInput title={t('settings enable statusbar label')}>
77
90
  <Input.Switch
78
91
  checked={settings.enableStatusbar}
79
- onCheckedChange={(checked) => (settings.enableStatusbar = checked)}
92
+ onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableStatusbar: checked }))}
93
+ />
94
+ </Settings.ItemInput>
95
+ <Settings.ItemInput title={t('settings show hints label')}>
96
+ <Input.Switch
97
+ checked={settings.showHints}
98
+ onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, showHints: checked }))}
80
99
  />
81
- </ControlItemInput>
82
- <ControlItemInput title={t('settings show hints label')}>
83
- <Input.Switch checked={settings.showHints} onCheckedChange={(checked) => (settings.showHints = checked)} />
84
- </ControlItemInput>
100
+ </Settings.ItemInput>
85
101
  {!isSocket && (
86
- <ControlItemInput title={t('settings native redirect label')}>
102
+ <Settings.ItemInput title={t('settings native redirect label')}>
87
103
  <Input.Switch
88
104
  checked={settings.enableNativeRedirect}
89
- onCheckedChange={(checked) => (settings.enableNativeRedirect = checked)}
105
+ onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, enableNativeRedirect: checked }))}
90
106
  />
91
- </ControlItemInput>
107
+ </Settings.ItemInput>
92
108
  )}
93
- </ControlGroup>
94
- </ControlSection>
95
- </ControlPage>
109
+ </Settings.Group>
110
+ </Settings.Section>
111
+ </Settings.Root>
96
112
  );
97
113
  };
@@ -2,23 +2,31 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
10
- import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
8
+ import { Capability, Plugin } from '@dxos/app-framework';
11
9
  import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { AttentionPlugin } from '@dxos/plugin-attention';
13
- import { GraphPlugin } from '@dxos/plugin-graph';
10
+ import { AppActivationEvents } from '@dxos/app-toolkit';
11
+ import { corePlugins } from '@dxos/plugin-testing';
12
+ import { withTheme } from '@dxos/react-ui/testing';
14
13
  import { Stack } from '@dxos/react-ui-stack';
15
- import { withLayout, withTheme } from '@dxos/storybook-utils';
16
14
 
17
- import { DeckStateFactory } from '../../capabilities';
15
+ import { DeckState } from '../../capabilities';
16
+ import { meta as pluginMeta } from '../../meta';
18
17
  import { translations } from '../../translations';
19
18
 
20
19
  import { Plank } from './Plank';
21
20
 
21
+ const TestPlugin = Plugin.define(pluginMeta).pipe(
22
+ Plugin.addModule({
23
+ id: Capability.getModuleTag(DeckState),
24
+ activatesOn: AppActivationEvents.AppGraphReady,
25
+ activate: () => DeckState(),
26
+ }),
27
+ Plugin.make,
28
+ );
29
+
22
30
  const meta = {
23
31
  title: 'plugins/plugin-deck/Plank',
24
32
  component: Plank,
@@ -30,14 +38,13 @@ const meta = {
30
38
  );
31
39
  },
32
40
  decorators: [
41
+ withTheme(),
33
42
  withPluginManager({
34
- plugins: [AttentionPlugin(), SettingsPlugin(), IntentPlugin(), GraphPlugin()],
35
- capabilities: () => DeckStateFactory(),
43
+ plugins: [...corePlugins(), TestPlugin()],
36
44
  }),
37
- withTheme,
38
- withLayout({ fullscreen: true }),
39
45
  ],
40
46
  parameters: {
47
+ layout: 'fullscreen',
41
48
  translations,
42
49
  },
43
50
  } satisfies Meta<typeof Plank>;