@dxos/plugin-deck 0.9.1-main.c7dcc2e112 → 0.10.0

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 (258) hide show
  1. package/PLUGIN.mdl +3 -1
  2. package/dist/lib/neutral/{DeckLayout-VX2BP4Q2.mjs → DeckLayout-B3RUUV5P.mjs} +4 -3
  3. package/dist/lib/neutral/DeckLayout-B3RUUV5P.mjs.map +7 -0
  4. package/dist/lib/neutral/DeckPlugin.mjs +2 -6
  5. package/dist/lib/neutral/DeckPlugin.mjs.map +3 -3
  6. package/dist/lib/neutral/DeckSettings-Z7GMB7XJ.mjs +32 -0
  7. package/dist/lib/neutral/DeckSettings-Z7GMB7XJ.mjs.map +7 -0
  8. package/dist/lib/neutral/{add-toast-APKTCLIA.mjs → add-toast-BHNEH5UY.mjs} +2 -2
  9. package/dist/lib/neutral/{adjust-7CZI4GK3.mjs → adjust-MJB6UMRQ.mjs} +16 -10
  10. package/dist/lib/neutral/adjust-MJB6UMRQ.mjs.map +7 -0
  11. package/dist/lib/neutral/{app-graph-builder-6HTXRTU2.mjs → app-graph-builder-2F7P4IFQ.mjs} +4 -3
  12. package/dist/lib/neutral/app-graph-builder-2F7P4IFQ.mjs.map +7 -0
  13. package/dist/lib/neutral/capabilities/index.mjs +5 -5
  14. package/dist/lib/neutral/chunk-FKGYHBUB.mjs +8 -0
  15. package/dist/lib/neutral/{chunk-CL7JIOI5.mjs → chunk-ICOJ4GMB.mjs} +10 -6
  16. package/dist/lib/neutral/chunk-ICOJ4GMB.mjs.map +7 -0
  17. package/dist/lib/neutral/{chunk-NGX6RXNV.mjs → chunk-PP32NEVY.mjs} +2 -2
  18. package/dist/lib/neutral/chunk-PP32NEVY.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-SONATB35.mjs +20 -0
  20. package/dist/lib/neutral/chunk-SONATB35.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-Z2B5RSVI.mjs +1096 -0
  22. package/dist/lib/neutral/chunk-Z2B5RSVI.mjs.map +7 -0
  23. package/dist/lib/neutral/{close-KJUCFIJ5.mjs → close-2YGB5IIP.mjs} +4 -3
  24. package/dist/lib/neutral/{close-KJUCFIJ5.mjs.map → close-2YGB5IIP.mjs.map} +1 -1
  25. package/dist/lib/neutral/components/index.mjs +201 -16
  26. package/dist/lib/neutral/components/index.mjs.map +4 -4
  27. package/dist/lib/neutral/containers/index.mjs +6 -11
  28. package/dist/lib/neutral/containers/index.mjs.map +3 -3
  29. package/dist/lib/neutral/hooks/index.mjs +101 -17
  30. package/dist/lib/neutral/hooks/index.mjs.map +4 -4
  31. package/dist/lib/neutral/index.mjs +7 -1
  32. package/dist/lib/neutral/meta.json +1 -1
  33. package/dist/lib/neutral/{notification-tracker-CUDFRDCF.mjs → notification-tracker-Y5CRTWJM.mjs} +4 -2
  34. package/dist/lib/neutral/notification-tracker-Y5CRTWJM.mjs.map +7 -0
  35. package/dist/lib/neutral/{open-VU7YS3HB.mjs → open-P6XQ56M7.mjs} +4 -3
  36. package/dist/lib/neutral/{open-VU7YS3HB.mjs.map → open-P6XQ56M7.mjs.map} +1 -1
  37. package/dist/lib/neutral/operations/index.mjs +1 -1
  38. package/dist/lib/neutral/plugin.mjs +1 -1
  39. package/dist/lib/neutral/{react-surface-O4POQWYL.mjs → react-surface-H63FXUK3.mjs} +2 -2
  40. package/dist/lib/neutral/{react-surface-O4POQWYL.mjs.map → react-surface-H63FXUK3.mjs.map} +1 -1
  41. package/dist/lib/neutral/{revert-workspace-24TKG3I7.mjs → revert-workspace-RXWP2TEE.mjs} +2 -2
  42. package/dist/lib/neutral/{scroll-into-view-3VXT6TWC.mjs → scroll-into-view-HFV5EGYZ.mjs} +2 -2
  43. package/dist/lib/neutral/{set-RFOLTI57.mjs → set-HOOVB7E4.mjs} +4 -3
  44. package/dist/lib/neutral/{set-RFOLTI57.mjs.map → set-HOOVB7E4.mjs.map} +1 -1
  45. package/dist/lib/neutral/{set-layout-mode-AZ73W52Z.mjs → set-layout-mode-XAGSZZGB.mjs} +2 -2
  46. package/dist/lib/neutral/{state-D3YXB5NP.mjs → state-F4X5GPGZ.mjs} +3 -2
  47. package/dist/lib/neutral/{state-D3YXB5NP.mjs.map → state-F4X5GPGZ.mjs.map} +1 -1
  48. package/dist/lib/neutral/{switch-workspace-TBPT23CZ.mjs → switch-workspace-PA7N6EUX.mjs} +2 -2
  49. package/dist/lib/neutral/translations.mjs +2 -2
  50. package/dist/lib/neutral/translations.mjs.map +2 -2
  51. package/dist/lib/neutral/types/index.mjs +1 -1
  52. package/dist/lib/neutral/{update-companion-5LCY6QME.mjs → update-companion-6A2SKQAI.mjs} +14 -6
  53. package/dist/lib/neutral/update-companion-6A2SKQAI.mjs.map +7 -0
  54. package/dist/lib/neutral/{update-complementary-HZ7QXZYE.mjs → update-complementary-K55I5EV5.mjs} +2 -2
  55. package/dist/lib/neutral/{update-dialog-A7W3R5EI.mjs → update-dialog-Z3GEXMVV.mjs} +2 -2
  56. package/dist/lib/neutral/{update-plank-size-XHTYBLSD.mjs → update-plank-size-BTESVV7N.mjs} +2 -2
  57. package/dist/lib/neutral/{update-popover-RDIHG73B.mjs → update-popover-QEVDSZSH.mjs} +2 -2
  58. package/dist/lib/neutral/{update-sidebar-GEI7USA5.mjs → update-sidebar-VSRCN47U.mjs} +2 -2
  59. package/dist/lib/neutral/{url-handler-PUS4X33T.mjs → url-handler-ERZXXEYR.mjs} +3 -2
  60. package/dist/lib/neutral/{url-handler-PUS4X33T.mjs.map → url-handler-ERZXXEYR.mjs.map} +1 -1
  61. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -2
  63. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  64. package/dist/types/src/capabilities/notification-tracker.d.ts +1 -1
  65. package/dist/types/src/capabilities/notification-tracker.d.ts.map +1 -1
  66. package/dist/types/src/capabilities/react-root.d.ts +1 -5
  67. package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
  68. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  69. package/dist/types/src/capabilities/settings.d.ts +1 -3
  70. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/state.d.ts +1 -187
  72. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/tools.d.ts +1 -1
  74. package/dist/types/src/capabilities/url-handler.d.ts +1 -1
  75. package/dist/types/src/components/Companion/Companion.d.ts +17 -0
  76. package/dist/types/src/components/Companion/Companion.d.ts.map +1 -0
  77. package/dist/types/src/components/Companion/index.d.ts +2 -0
  78. package/dist/types/src/components/Companion/index.d.ts.map +1 -0
  79. package/dist/types/src/components/Matrix/Matrix.d.ts +1 -1
  80. package/dist/types/src/components/Matrix/Matrix.d.ts.map +1 -1
  81. package/dist/types/src/components/Matrix/Matrix.stories.d.ts +2 -2
  82. package/dist/types/src/components/Matrix/Matrix.stories.d.ts.map +1 -1
  83. package/dist/types/src/components/Matrix/index.d.ts +1 -1
  84. package/dist/types/src/components/Matrix/index.d.ts.map +1 -1
  85. package/dist/types/src/components/Pane/Pane.d.ts +45 -0
  86. package/dist/types/src/components/Pane/Pane.d.ts.map +1 -0
  87. package/dist/types/src/components/Pane/Pane.stories.d.ts +7 -0
  88. package/dist/types/src/components/Pane/Pane.stories.d.ts.map +1 -0
  89. package/dist/types/src/components/Pane/index.d.ts +2 -0
  90. package/dist/types/src/components/Pane/index.d.ts.map +1 -0
  91. package/dist/types/src/components/Plank/Plank.d.ts +74 -0
  92. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -0
  93. package/dist/types/src/components/Plank/Plank.stories.d.ts +6 -0
  94. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -0
  95. package/dist/types/src/components/Plank/index.d.ts +2 -0
  96. package/dist/types/src/components/Plank/index.d.ts.map +1 -0
  97. package/dist/types/src/components/index.d.ts +3 -2
  98. package/dist/types/src/components/index.d.ts.map +1 -1
  99. package/dist/types/src/containers/Deck/Deck.d.ts +1 -1
  100. package/dist/types/src/containers/Deck/Deck.d.ts.map +1 -1
  101. package/dist/types/src/containers/Deck/Deck.stories.d.ts +2 -2
  102. package/dist/types/src/containers/Deck/DeckPlank.d.ts +21 -0
  103. package/dist/types/src/containers/Deck/DeckPlank.d.ts.map +1 -0
  104. package/dist/types/src/containers/Deck/DeckViewport.d.ts +3 -1
  105. package/dist/types/src/containers/Deck/DeckViewport.d.ts.map +1 -1
  106. package/dist/types/src/containers/{Plank → Deck}/PlankControls.d.ts +3 -10
  107. package/dist/types/src/containers/Deck/PlankControls.d.ts.map +1 -0
  108. package/dist/types/src/containers/Deck/PlankFallback.d.ts +6 -0
  109. package/dist/types/src/containers/Deck/PlankFallback.d.ts.map +1 -0
  110. package/dist/types/src/containers/Deck/useDeckPlank.d.ts +49 -0
  111. package/dist/types/src/containers/Deck/useDeckPlank.d.ts.map +1 -0
  112. package/dist/types/src/containers/DeckLayout/DeckLayout.stories.d.ts +2 -2
  113. package/dist/types/src/containers/DeckLayout/DeckLayout.stories.d.ts.map +1 -1
  114. package/dist/types/src/{components → containers}/DeckSettings/DeckSettings.d.ts +1 -1
  115. package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts.map +1 -0
  116. package/dist/types/src/{components → containers}/DeckSettings/DeckSettings.stories.d.ts +2 -2
  117. package/dist/types/src/{components → containers}/DeckSettings/DeckSettings.stories.d.ts.map +1 -1
  118. package/dist/types/src/containers/DeckSettings/index.d.ts.map +1 -0
  119. package/dist/types/src/containers/index.d.ts +1 -1
  120. package/dist/types/src/containers/index.d.ts.map +1 -1
  121. package/dist/types/src/hooks/index.d.ts +2 -0
  122. package/dist/types/src/hooks/index.d.ts.map +1 -1
  123. package/dist/types/src/hooks/useCompanionSplit.d.ts +28 -0
  124. package/dist/types/src/hooks/useCompanionSplit.d.ts.map +1 -0
  125. package/dist/types/src/hooks/useCompanions.d.ts +11 -7
  126. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
  127. package/dist/types/src/hooks/useDeckCompanions.d.ts +2 -2
  128. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  129. package/dist/types/src/hooks/useDeckState.d.ts +1 -1
  130. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -1
  131. package/dist/types/src/hooks/useSelectedCompanionVariant.d.ts +6 -0
  132. package/dist/types/src/hooks/useSelectedCompanionVariant.d.ts.map +1 -0
  133. package/dist/types/src/index.d.ts +1 -0
  134. package/dist/types/src/index.d.ts.map +1 -1
  135. package/dist/types/src/meta.d.ts +4 -0
  136. package/dist/types/src/meta.d.ts.map +1 -1
  137. package/dist/types/src/operations/adjust.d.ts.map +1 -1
  138. package/dist/types/src/operations/update-companion.d.ts.map +1 -1
  139. package/dist/types/src/translations.d.ts +2 -2
  140. package/dist/types/src/translations.d.ts.map +1 -1
  141. package/dist/types/src/types/DeckCapabilities.d.ts +2 -2
  142. package/dist/types/src/types/DeckCapabilities.d.ts.map +1 -1
  143. package/dist/types/src/types/DeckOperation.d.ts +2 -2
  144. package/dist/types/src/types/DeckOperation.d.ts.map +1 -1
  145. package/dist/types/src/types/schema.d.ts +7 -7
  146. package/dist/types/src/types/schema.d.ts.map +1 -1
  147. package/dist/types/src/util/companion-view-state.d.ts +16 -0
  148. package/dist/types/src/util/companion-view-state.d.ts.map +1 -0
  149. package/dist/types/src/util/index.d.ts +1 -0
  150. package/dist/types/src/util/index.d.ts.map +1 -1
  151. package/dist/types/src/util/plank-url-params.d.ts +2 -0
  152. package/dist/types/src/util/plank-url-params.d.ts.map +1 -1
  153. package/dist/types/tsconfig.tsbuildinfo +1 -1
  154. package/package.json +49 -47
  155. package/src/DeckPlugin.ts +1 -2
  156. package/src/capabilities/app-graph-builder.ts +3 -2
  157. package/src/capabilities/notification-tracker.ts +3 -1
  158. package/src/capabilities/react-surface.tsx +1 -1
  159. package/src/components/Companion/Companion.tsx +91 -0
  160. package/src/components/Companion/index.ts +5 -0
  161. package/src/components/Matrix/Matrix.stories.tsx +13 -26
  162. package/src/components/Matrix/Matrix.tsx +3 -3
  163. package/src/components/Matrix/SPEC.md +1 -1
  164. package/src/components/Matrix/index.ts +1 -1
  165. package/src/components/Pane/Pane.stories.tsx +92 -0
  166. package/src/components/Pane/Pane.tsx +178 -0
  167. package/src/components/Pane/index.ts +5 -0
  168. package/src/components/Plank/Plank.stories.tsx +103 -0
  169. package/src/components/Plank/Plank.tsx +149 -0
  170. package/src/components/Plank/index.ts +5 -0
  171. package/src/components/index.ts +3 -4
  172. package/src/containers/Deck/Deck.tsx +3 -3
  173. package/src/containers/Deck/DeckPlank.tsx +187 -0
  174. package/src/containers/Deck/DeckViewport.tsx +116 -243
  175. package/src/containers/{Plank → Deck}/PlankControls.tsx +19 -17
  176. package/src/containers/Deck/PlankFallback.tsx +42 -0
  177. package/src/containers/Deck/useDeckPlank.ts +219 -0
  178. package/src/containers/DeckLayout/DeckLayout.stories.tsx +38 -51
  179. package/src/containers/DeckLayout/Dialog.tsx +1 -1
  180. package/src/{components → containers}/DeckSettings/DeckSettings.stories.tsx +1 -1
  181. package/src/containers/DeckSettings/DeckSettings.tsx +42 -0
  182. package/src/containers/Sidebar/ComplementarySidebar.tsx +2 -2
  183. package/src/containers/index.ts +1 -1
  184. package/src/hooks/index.ts +2 -0
  185. package/src/hooks/useCompanionSplit.ts +78 -0
  186. package/src/hooks/useCompanions.ts +39 -7
  187. package/src/hooks/useDeckCompanions.ts +3 -3
  188. package/src/hooks/useDeckState.ts +1 -1
  189. package/src/hooks/useSelectedCompanionVariant.ts +14 -0
  190. package/src/index.ts +7 -0
  191. package/src/operations/adjust.ts +23 -12
  192. package/src/operations/update-companion.ts +10 -6
  193. package/src/translations.ts +2 -2
  194. package/src/types/DeckCapabilities.ts +1 -1
  195. package/src/types/DeckOperation.ts +2 -1
  196. package/src/types/schema.ts +5 -4
  197. package/src/util/companion-view-state.ts +28 -0
  198. package/src/util/index.ts +1 -0
  199. package/src/util/plank-url-params.test.ts +5 -0
  200. package/src/util/plank-url-params.ts +3 -1
  201. package/src/util/sanitize-persisted-state.test.ts +1 -1
  202. package/src/util/set-active.test.ts +1 -1
  203. package/dist/lib/neutral/DeckLayout-VX2BP4Q2.mjs.map +0 -7
  204. package/dist/lib/neutral/DeckSettings-CQQZJ2YS.mjs +0 -27
  205. package/dist/lib/neutral/DeckSettings-CQQZJ2YS.mjs.map +0 -7
  206. package/dist/lib/neutral/adjust-7CZI4GK3.mjs.map +0 -7
  207. package/dist/lib/neutral/app-graph-builder-6HTXRTU2.mjs.map +0 -7
  208. package/dist/lib/neutral/chunk-CL7JIOI5.mjs.map +0 -7
  209. package/dist/lib/neutral/chunk-DNG3L5QN.mjs +0 -1304
  210. package/dist/lib/neutral/chunk-DNG3L5QN.mjs.map +0 -7
  211. package/dist/lib/neutral/chunk-NGX6RXNV.mjs.map +0 -7
  212. package/dist/lib/neutral/chunk-UZLAR4DR.mjs +0 -8
  213. package/dist/lib/neutral/notification-tracker-CUDFRDCF.mjs.map +0 -7
  214. package/dist/lib/neutral/update-companion-5LCY6QME.mjs.map +0 -7
  215. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +0 -1
  216. package/dist/types/src/components/DeckSettings/index.d.ts.map +0 -1
  217. package/dist/types/src/containers/Plank/Plank.d.ts +0 -17
  218. package/dist/types/src/containers/Plank/Plank.d.ts.map +0 -1
  219. package/dist/types/src/containers/Plank/Plank.stories.d.ts +0 -67
  220. package/dist/types/src/containers/Plank/Plank.stories.d.ts.map +0 -1
  221. package/dist/types/src/containers/Plank/PlankComponent.d.ts +0 -17
  222. package/dist/types/src/containers/Plank/PlankComponent.d.ts.map +0 -1
  223. package/dist/types/src/containers/Plank/PlankContent.d.ts +0 -10
  224. package/dist/types/src/containers/Plank/PlankContent.d.ts.map +0 -1
  225. package/dist/types/src/containers/Plank/PlankControls.d.ts.map +0 -1
  226. package/dist/types/src/containers/Plank/PlankError.d.ts +0 -15
  227. package/dist/types/src/containers/Plank/PlankError.d.ts.map +0 -1
  228. package/dist/types/src/containers/Plank/PlankHeading.d.ts +0 -22
  229. package/dist/types/src/containers/Plank/PlankHeading.d.ts.map +0 -1
  230. package/dist/types/src/containers/Plank/PlankLoading.d.ts +0 -3
  231. package/dist/types/src/containers/Plank/PlankLoading.d.ts.map +0 -1
  232. package/dist/types/src/containers/Plank/PlankRoot.d.ts +0 -37
  233. package/dist/types/src/containers/Plank/PlankRoot.d.ts.map +0 -1
  234. package/dist/types/src/containers/Plank/index.d.ts +0 -4
  235. package/dist/types/src/containers/Plank/index.d.ts.map +0 -1
  236. package/src/components/DeckSettings/DeckSettings.tsx +0 -34
  237. package/src/containers/Plank/Plank.stories.tsx +0 -108
  238. package/src/containers/Plank/Plank.tsx +0 -22
  239. package/src/containers/Plank/PlankComponent.tsx +0 -223
  240. package/src/containers/Plank/PlankContent.tsx +0 -45
  241. package/src/containers/Plank/PlankError.tsx +0 -82
  242. package/src/containers/Plank/PlankHeading.tsx +0 -236
  243. package/src/containers/Plank/PlankLoading.tsx +0 -10
  244. package/src/containers/Plank/PlankRoot.tsx +0 -49
  245. package/src/containers/Plank/index.ts +0 -7
  246. /package/dist/lib/neutral/{add-toast-APKTCLIA.mjs.map → add-toast-BHNEH5UY.mjs.map} +0 -0
  247. /package/dist/lib/neutral/{chunk-UZLAR4DR.mjs.map → chunk-FKGYHBUB.mjs.map} +0 -0
  248. /package/dist/lib/neutral/{revert-workspace-24TKG3I7.mjs.map → revert-workspace-RXWP2TEE.mjs.map} +0 -0
  249. /package/dist/lib/neutral/{scroll-into-view-3VXT6TWC.mjs.map → scroll-into-view-HFV5EGYZ.mjs.map} +0 -0
  250. /package/dist/lib/neutral/{set-layout-mode-AZ73W52Z.mjs.map → set-layout-mode-XAGSZZGB.mjs.map} +0 -0
  251. /package/dist/lib/neutral/{switch-workspace-TBPT23CZ.mjs.map → switch-workspace-PA7N6EUX.mjs.map} +0 -0
  252. /package/dist/lib/neutral/{update-complementary-HZ7QXZYE.mjs.map → update-complementary-K55I5EV5.mjs.map} +0 -0
  253. /package/dist/lib/neutral/{update-dialog-A7W3R5EI.mjs.map → update-dialog-Z3GEXMVV.mjs.map} +0 -0
  254. /package/dist/lib/neutral/{update-plank-size-XHTYBLSD.mjs.map → update-plank-size-BTESVV7N.mjs.map} +0 -0
  255. /package/dist/lib/neutral/{update-popover-RDIHG73B.mjs.map → update-popover-QEVDSZSH.mjs.map} +0 -0
  256. /package/dist/lib/neutral/{update-sidebar-GEI7USA5.mjs.map → update-sidebar-VSRCN47U.mjs.map} +0 -0
  257. /package/dist/types/src/{components → containers}/DeckSettings/index.d.ts +0 -0
  258. /package/src/{components → containers}/DeckSettings/index.ts +0 -0
@@ -1,37 +0,0 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { type Graph } from '@dxos/plugin-graph';
3
- import { type DeckOperation } from '#types';
4
- import { type LayoutMode, type PlankSizing, type ResolvedPart, type Settings } from '#types';
5
- export type PlankContextValue = {
6
- /** The application graph. */
7
- graph: Graph.ExpandableGraph;
8
- /** Which part of the layout this plank occupies. */
9
- part: ResolvedPart;
10
- /** Current layout mode. */
11
- layoutMode: LayoutMode;
12
- /** Deck settings. */
13
- settings?: Settings.Settings;
14
- /** Popover anchor ID for heading menus. */
15
- popoverAnchorId?: string;
16
- /** ID of plank that should be scrolled into view. */
17
- scrollIntoView?: string;
18
- /** Persisted plank sizes keyed by plank ID. */
19
- plankSizing?: PlankSizing;
20
- /** Callback for plank adjustments (close, solo, increment, companion). */
21
- onAdjust?: (id: string, type: DeckOperation.PartAdjustment) => void;
22
- /** Callback for plank resize. */
23
- onResize?: (id: string, size: number) => void;
24
- /** Callback to clear scroll-into-view state. */
25
- onScrollIntoView?: (id?: string) => void;
26
- /** Callback to update the companion. */
27
- onUpdateCompanion?: (companion: string | null) => void;
28
- };
29
- export declare const PlankProvider: React.FC<PlankContextValue & {
30
- children: React.ReactNode;
31
- }>, usePlankContext: (consumerName: string) => PlankContextValue;
32
- export type PlankRootProps = PropsWithChildren<PlankContextValue>;
33
- /**
34
- * Headless root that provides plank context.
35
- */
36
- export declare const PlankRoot: ({ children, ...context }: PlankRootProps) => React.JSX.Element;
37
- //# sourceMappingURL=PlankRoot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlankRoot.d.ts","sourceRoot":"","sources":["../../../../../src/containers/Plank/PlankRoot.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAI7F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,6BAA6B;IAC7B,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC;IAC7B,oDAAoD;IACpD,IAAI,EAAE,YAAY,CAAC;IACnB,2BAA2B;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,2CAA2C;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,cAAc,KAAK,IAAI,CAAC;IACpE,iCAAiC;IACjC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,eAAO,MAAO,aAAa;;IAAE,eAAe,6CAAgD,CAAC;AAE7F,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,SAAS,6BAA8B,cAAc,sBAEjE,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from './Plank';
2
- export * from './PlankError';
3
- export * from './PlankLoading';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/containers/Plank/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
@@ -1,34 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { type AppSurface } from '@dxos/app-toolkit/ui';
8
- import { useTranslation } from '@dxos/react-ui';
9
- import { Settings as SettingsForm } from '@dxos/react-ui-form';
10
-
11
- import { meta } from '#meta';
12
- import { Settings } from '#types';
13
-
14
- const isSocket = !!(globalThis as any).__args;
15
-
16
- export type DeckSettingsProps = AppSurface.SettingsArticleProps<Settings.Settings>;
17
-
18
- export const DeckSettings = ({ settings, onSettingsChange }: DeckSettingsProps) => {
19
- const { t } = useTranslation(meta.profile.key);
20
-
21
- return (
22
- <SettingsForm.Viewport>
23
- <SettingsForm.Section title={t('settings.title', { ns: meta.profile.key })}>
24
- <SettingsForm.FieldSet
25
- readonly={!onSettingsChange}
26
- schema={Settings.Settings}
27
- visible={(path) => path !== 'enableNativeRedirect' || !isSocket}
28
- values={settings}
29
- onValuesChanged={(values) => onSettingsChange?.(() => values)}
30
- />
31
- </SettingsForm.Section>
32
- </SettingsForm.Viewport>
33
- );
34
- };
@@ -1,108 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Meta, type StoryObj } from '@storybook/react-vite';
6
- import React, { useMemo } from 'react';
7
-
8
- import { Capabilities, Capability, Plugin } from '@dxos/app-framework';
9
- import { withPluginManager } from '@dxos/app-framework/testing';
10
- import { Surface } from '@dxos/app-framework/ui';
11
- import { AppActivationEvents } from '@dxos/app-toolkit';
12
- import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
13
- import { corePlugins } from '@dxos/plugin-testing';
14
- import { random } from '@dxos/random';
15
- import { Main } from '@dxos/react-ui';
16
- import { StackContext } from '@dxos/react-ui-stack';
17
- import { Syntax } from '@dxos/react-ui-syntax-highlighter';
18
- import { Loading } from '@dxos/react-ui/testing';
19
- import { Organization } from '@dxos/types';
20
-
21
- import { DeckSettings, DeckState } from '#capabilities';
22
- import { meta as pluginMeta } from '#meta';
23
- import { translations } from '#translations';
24
-
25
- import { Plank } from './Plank';
26
-
27
- const TestPlugin = Plugin.define(pluginMeta).pipe(
28
- Plugin.addModule({
29
- activatesOn: AppActivationEvents.SetupSettings,
30
- activate: DeckSettings,
31
- }),
32
- Plugin.addModule({
33
- id: Capability.getModuleTag(DeckState),
34
- activatesOn: AppActivationEvents.AppGraphReady,
35
- activate: () => DeckState(),
36
- }),
37
- Plugin.make,
38
- );
39
-
40
- random.seed(101);
41
-
42
- const storySurfaceExtension = Capability.contributes(
43
- Capabilities.ReactSurface,
44
- Surface.create({
45
- id: 'storyArticle',
46
- filter: Surface.makeFilter(AppSurface.Article),
47
- component: ({ data }) => {
48
- const subject = (data as any)?.subject;
49
- if (!subject) {
50
- return <Loading />;
51
- }
52
-
53
- return (
54
- <Syntax.Root data={subject}>
55
- <Syntax.Content>
56
- <Syntax.Viewport>
57
- <Syntax.Code />
58
- </Syntax.Viewport>
59
- </Syntax.Content>
60
- </Syntax.Root>
61
- );
62
- },
63
- }),
64
- );
65
-
66
- const DefaultStory = () => {
67
- const { graph } = useAppGraph();
68
- const item = useMemo(() => Organization.make({ name: random.company.name() }), []);
69
- const node = useMemo(() => ({ id: item.id, data: item, type: 'test', properties: { label: item.name } }), [item]);
70
-
71
- return (
72
- <Main.Root>
73
- <Main.Content bounce handlesFocus classNames='grid' style={{ '--main-spacing': '0' } as any}>
74
- <div className='relative overflow-hidden bg-deck-surface'>
75
- <StackContext.Provider value={{ orientation: 'horizontal', size: 'contain', rail: true }}>
76
- <Plank.Root graph={graph} part='solo' layoutMode='solo'>
77
- <Plank.Content solo companion={false} encapsulate={false}>
78
- <Plank.Component id={item.id} part='solo-primary' node={node as any} />
79
- </Plank.Content>
80
- </Plank.Root>
81
- </StackContext.Provider>
82
- </div>
83
- </Main.Content>
84
- </Main.Root>
85
- );
86
- };
87
-
88
- const meta = {
89
- title: 'plugins/plugin-deck/containers/Plank',
90
- component: DefaultStory,
91
- decorators: [
92
- withPluginManager({
93
- plugins: [...corePlugins(), TestPlugin()],
94
- capabilities: [storySurfaceExtension],
95
- setupEvents: [AppActivationEvents.SetupSettings],
96
- }),
97
- ],
98
- parameters: {
99
- layout: 'fullscreen',
100
- translations,
101
- },
102
- } satisfies Meta<typeof DefaultStory>;
103
-
104
- export default meta;
105
-
106
- type Story = StoryObj<typeof meta>;
107
-
108
- export const Default: Story = {};
@@ -1,22 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { PlankComponent, PlankComponentProps } from './PlankComponent';
6
- import { PlankContent, PlankContentProps } from './PlankContent';
7
- import { PlankControls } from './PlankControls';
8
- import { PlankHeading } from './PlankHeading';
9
- import { PlankRoot, PlankRootProps } from './PlankRoot';
10
-
11
- /**
12
- * Radix-style composite Plank component.
13
- */
14
- export const Plank = {
15
- Root: PlankRoot,
16
- Content: PlankContent,
17
- Component: PlankComponent,
18
- Heading: PlankHeading,
19
- Controls: PlankControls,
20
- };
21
-
22
- export type { PlankRootProps, PlankComponentProps, PlankContentProps };
@@ -1,223 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { useFocusFinders } from '@fluentui/react-tabster';
6
- import React, { type KeyboardEvent, memo, useCallback, useLayoutEffect, useMemo, useRef } from 'react';
7
-
8
- import { Surface } from '@dxos/app-framework/ui';
9
- import { AppSurface } from '@dxos/app-toolkit/ui';
10
- import { debounce } from '@dxos/async';
11
- import { type Node } from '@dxos/plugin-graph';
12
- import { mainIntrinsicSize } from '@dxos/react-ui';
13
- import { getLinkedVariant } from '@dxos/react-ui-attention';
14
- import { useAttentionAttributes } from '@dxos/react-ui-attention';
15
- import { StackItem, type StackItemSize, railGridHorizontal } from '@dxos/react-ui-stack';
16
- import { mx } from '@dxos/ui-theme';
17
-
18
- import { useMainSize } from '#hooks';
19
- import { PLANK_COMPANION_TYPE } from '#types';
20
-
21
- import { PlankError, PlankErrorFallback } from './PlankError';
22
- import { PlankHeading } from './PlankHeading';
23
- import { PlankLoading } from './PlankLoading';
24
- import { PlankRootProps, usePlankContext } from './PlankRoot';
25
-
26
- /**
27
- * JS-based smooth scroll that won't be interrupted by MutationObserver or layout changes.
28
- */
29
- const smoothScrollTo = (element: HTMLElement, target: number, duration: number) => {
30
- const start = element.scrollLeft;
31
- const distance = target - start;
32
- const startTime = performance.now();
33
-
34
- const step = (currentTime: number) => {
35
- const elapsed = currentTime - startTime;
36
- const progress = Math.min(elapsed / duration, 1);
37
- // Ease-out cubic.
38
- const eased = 1 - Math.pow(1 - progress, 3);
39
- element.scrollLeft = start + distance * eased;
40
- if (progress < 1) {
41
- requestAnimationFrame(step);
42
- }
43
- };
44
-
45
- requestAnimationFrame(step);
46
- };
47
-
48
- // NOTE: Calibrated to show PLANK + COMPANION on MBP 16" screen.
49
- export const DEFAULT_SIZE = 48 satisfies StackItemSize;
50
- export const DEFAULT_COMPANION_SIZE = 35 satisfies StackItemSize;
51
-
52
- export type PlankComponentProps = Pick<PlankRootProps, 'part'> & {
53
- id: string;
54
- path?: string[];
55
- order?: number;
56
- active?: string[];
57
- node?: Node.Node;
58
- primary?: Node.Node;
59
- companions?: Node.Node[];
60
- companioned?: 'primary' | 'companion';
61
- };
62
-
63
- export const PlankComponent = memo(
64
- ({ part, id, path, order, active, node, primary, companions, companioned }: PlankComponentProps) => {
65
- const { layoutMode, settings, popoverAnchorId, scrollIntoView, plankSizing, onResize, onScrollIntoView } =
66
- usePlankContext('PlankComponent');
67
-
68
- const canResize = layoutMode === 'multi';
69
- const { findFirstFocusable } = useFocusFinders();
70
- const isCompanion = companioned === 'companion';
71
- // Companions share attention with their primary; non-companions key attention to their own id.
72
- const attentionId = isCompanion ? (primary?.id ?? id) : id;
73
- const attentionAttrs = useAttentionAttributes(attentionId);
74
- const orderId = isCompanion ? primary?.id : id;
75
- const index = orderId && active ? active.findIndex((entryId) => entryId === orderId) : -1;
76
- const length = active?.length ?? 1;
77
- const isOrdered = !!active && index >= 0;
78
- const canIncrementStart = isOrdered && index > 0;
79
- const canIncrementEnd = isOrdered && index < length - 1;
80
- const rootElement = useRef<HTMLDivElement | null>(null);
81
- const variant = node?.type === PLANK_COMPANION_TYPE ? getLinkedVariant(id) : undefined;
82
-
83
- // Sizing.
84
- const sizeAttrs = useMainSize();
85
- const sizeKey = id.split('+')[0];
86
- const size = isCompanion
87
- ? DEFAULT_COMPANION_SIZE
88
- : ((plankSizing?.[sizeKey] as number | undefined) ?? DEFAULT_SIZE);
89
- const handleSizeChange = useCallback(
90
- debounce((nextSize: number) => {
91
- const size = Math.round(nextSize);
92
- onResize?.(sizeKey, size);
93
- }, 200),
94
- [sizeKey, onResize],
95
- );
96
-
97
- // TODO(thure): Tabster's focus group should handle moving focus to Main, but something is blocking it.
98
- const handleKeyDown = useCallback((event: KeyboardEvent) => {
99
- if (event.target === event.currentTarget) {
100
- switch (event.key) {
101
- case 'Escape':
102
- rootElement.current?.closest('main')?.focus();
103
- break;
104
- case 'Enter':
105
- rootElement.current && findFirstFocusable(rootElement.current)?.focus();
106
- break;
107
- }
108
- }
109
- }, []);
110
-
111
- useLayoutEffect(() => {
112
- if (scrollIntoView === id && layoutMode === 'multi' && rootElement.current) {
113
- const element = rootElement.current;
114
- const scrollParent = element.closest('[style*="overflow"], .overflow-x-auto') as HTMLElement | null;
115
- if (scrollParent) {
116
- const elementRect = element.getBoundingClientRect();
117
- const parentRect = scrollParent.getBoundingClientRect();
118
- const targetScrollLeft = scrollParent.scrollLeft + (elementRect.left - parentRect.left);
119
-
120
- smoothScrollTo(scrollParent, targetScrollLeft, 300);
121
- }
122
-
123
- onScrollIntoView?.(undefined);
124
- }
125
- }, [id, scrollIntoView, layoutMode, onScrollIntoView]);
126
-
127
- const isSolo = layoutMode.startsWith('solo') && part === 'solo';
128
- const isAttendable =
129
- (layoutMode.startsWith('solo') && part.startsWith('solo')) || (layoutMode === 'multi' && part === 'multi');
130
-
131
- // Companions share attention with their primary, so they attend to the primary's id
132
- // (matching the plank's attention container, which keys to `primary?.id ?? id`).
133
- const attendableId = isCompanion ? (primary?.id ?? id) : id;
134
- const data = useMemo<AppSurface.ArticleData | undefined>(
135
- () =>
136
- node && {
137
- attendableId,
138
- subject: node.data,
139
- companionTo: primary?.data,
140
- properties: node.properties,
141
- variant,
142
- path,
143
- popoverAnchorId,
144
- },
145
- [node, node?.data, node?.properties, path, popoverAnchorId, primary?.data, variant, attendableId],
146
- );
147
-
148
- // TODO(wittjosiah): Change prop to accept a component.
149
- const placeholder = useMemo(() => <PlankLoading />, []);
150
-
151
- const Root = part.startsWith('solo') ? 'article' : StackItem.Root;
152
- const fullscreen = layoutMode === 'solo--fullscreen';
153
- const classNames = [
154
- 'dx-attention-surface relative dx-focus-ring-inset-over-all dx-density-lg',
155
- isSolo && 'absolute inset-0',
156
- isSolo && mainIntrinsicSize,
157
- railGridHorizontal,
158
- part.startsWith('solo') && 'grid',
159
- part.startsWith('solo-') && 'grid-rows-subgrid row-span-2 min-w-0',
160
- fullscreen && 'grid-rows-1',
161
- part === 'multi' && (isCompanion ? 'border-separator! border-e' : 'border-separator! border-x'),
162
- part === 'solo-companion' && 'border-separator! border-s',
163
- settings?.encapsulatedPlanks &&
164
- !part.startsWith('solo') &&
165
- 'mx-(--main-spacing) border-separator! border rounded-sm overflow-hidden',
166
- ];
167
-
168
- return (
169
- <Root
170
- ref={rootElement}
171
- data-testid='deck.plank'
172
- data-popover-collision-boundary={true}
173
- tabIndex={0}
174
- {...(part.startsWith('solo')
175
- ? ({
176
- className: mx(classNames),
177
- ...sizeAttrs,
178
- } as any)
179
- : {
180
- role: 'article',
181
- item: { id },
182
- classNames,
183
- order,
184
- size,
185
- onSizeChange: handleSizeChange,
186
- })}
187
- {...(isAttendable ? attentionAttrs : {})}
188
- onKeyDown={handleKeyDown}
189
- >
190
- {node ? (
191
- <>
192
- {!fullscreen && (
193
- <PlankHeading
194
- id={id}
195
- part={part.startsWith('solo-') ? 'solo' : part}
196
- node={node}
197
- layoutMode={layoutMode}
198
- deckEnabled={settings?.enableDeck}
199
- canIncrementStart={canIncrementStart}
200
- canIncrementEnd={canIncrementEnd}
201
- popoverAnchorId={popoverAnchorId}
202
- primaryId={primary?.id}
203
- companioned={companioned}
204
- companions={companions}
205
- />
206
- )}
207
- <Surface.Surface
208
- key={node.id}
209
- type={AppSurface.Article}
210
- data={data}
211
- limit={1}
212
- fallback={PlankErrorFallback}
213
- placeholder={placeholder}
214
- />
215
- </>
216
- ) : (
217
- <PlankError id={id} part={part} />
218
- )}
219
- {canResize && <StackItem.ResizeHandle />}
220
- </Root>
221
- );
222
- },
223
- );
@@ -1,45 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React, { type PropsWithChildren } from 'react';
6
-
7
- import { composable, composableProps, mainIntrinsicSize } from '@dxos/react-ui';
8
- import { railGridHorizontal } from '@dxos/react-ui-stack';
9
-
10
- import { useMainSize } from '#hooks';
11
-
12
- export type PlankContentProps = PropsWithChildren<{
13
- solo: boolean;
14
- companion: boolean;
15
- encapsulate: boolean;
16
- }>;
17
-
18
- export const PlankContent = composable<HTMLDivElement, PlankContentProps>(
19
- ({ children, solo, companion, encapsulate, ...props }, forwardedRef) => {
20
- const sizeAttrs = useMainSize();
21
- if (!solo) {
22
- return children;
23
- }
24
-
25
- return (
26
- <div
27
- {...sizeAttrs}
28
- {...composableProps(props, {
29
- role: 'none',
30
- classNames: [
31
- 'absolute inset-(--main-spacing) grid',
32
- railGridHorizontal,
33
- mainIntrinsicSize,
34
- companion && 'grid-cols-[6fr_4fr]', // Ration of primary to companion.
35
- encapsulate && 'border border-separator rounded-sm overflow-hidden',
36
- ],
37
- })}
38
- data-popover-collision-boundary={true}
39
- ref={forwardedRef}
40
- >
41
- {children}
42
- </div>
43
- );
44
- },
45
- );
@@ -1,82 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React, { useEffect, useMemo, useState } from 'react';
6
-
7
- import { TimeoutError } from '@dxos/errors';
8
- import { log } from '@dxos/log';
9
- import { type Node } from '@dxos/plugin-graph';
10
- import { ErrorFallback, type ErrorFallbackProps, useTranslation } from '@dxos/react-ui';
11
- import { descriptionMessage, mx } from '@dxos/ui-theme';
12
-
13
- import { meta } from '#meta';
14
-
15
- import { PlankHeading, type PlankHeadingProps } from './PlankHeading';
16
- import { PlankLoading } from './PlankLoading';
17
-
18
- export const PlankError = ({
19
- id,
20
- part,
21
- node,
22
- error: errorProp,
23
- }: {
24
- id: string;
25
- part: PlankHeadingProps['part'];
26
- node?: Node.Node;
27
- error?: Error;
28
- }) => {
29
- const [timedOut, setTimedOut] = useState(false);
30
- useEffect(() => {
31
- const timer = setTimeout(() => setTimedOut(true), 5_000);
32
- return () => clearTimeout(timer);
33
- }, []);
34
-
35
- const error = useMemo(() => {
36
- if (timedOut) {
37
- return new TimeoutError({ message: 'Timeout loading content' });
38
- }
39
-
40
- return errorProp;
41
- }, [timedOut, errorProp]);
42
-
43
- return (
44
- <>
45
- <PlankHeading id={id} part={part} node={node} pending={!timedOut} />
46
- {timedOut ? <PlankErrorFallback error={error} /> : <PlankLoading />}
47
- </>
48
- );
49
- };
50
-
51
- /**
52
- * User facing error fallback.
53
- */
54
- export const PlankErrorFallback = ({ error }: ErrorFallbackProps) => {
55
- const { t } = useTranslation(meta.profile.key);
56
-
57
- useEffect(() => {
58
- if (error) {
59
- log.error('plank error', { error });
60
- }
61
- }, [error]);
62
-
63
- if (process.env.NODE_ENV === 'development') {
64
- return <ErrorFallback title='Plank Error' error={error} />;
65
- } else {
66
- const errorString = error?.toString() ?? '';
67
-
68
- return (
69
- <div
70
- role='alert'
71
- data-testid='plank-content-error'
72
- className='dx-attention-surface overflow-y-auto p-8 grid place-items-center'
73
- >
74
- <div className='flex flex-col items-center gap-2'>
75
- <p className={mx(descriptionMessage, 'break-all rounded-md p-4')}>
76
- {error ? errorString : t('error-fallback.message')}
77
- </p>
78
- </div>
79
- </div>
80
- );
81
- }
82
- };