@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,236 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React, { Fragment, type MouseEvent, memo, useCallback, useEffect, useMemo } from 'react';
6
-
7
- import { Surface } from '@dxos/app-framework/ui';
8
- import { AppSurface } from '@dxos/app-toolkit/ui';
9
- import { Graph, type Node, useActionRunner } from '@dxos/plugin-graph';
10
- import { Icon, IconButton, Popover, TextTooltip, toLocalizedString, useTranslation } from '@dxos/react-ui';
11
- import { getLinkedVariant } from '@dxos/react-ui-attention';
12
- import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
13
- import { hoverableControls, hoverableFocusedWithinControls, iconSize } from '@dxos/ui-theme';
14
-
15
- import { useBreakpoints } from '#hooks';
16
- import { meta } from '#meta';
17
- import { DeckOperation } from '#types';
18
- import { type LayoutMode, PLANK_COMPANION_TYPE, type ResolvedPart } from '#types';
19
-
20
- import { PlankCompanionControls, PlankControls } from './PlankControls';
21
- import { usePlankContext } from './PlankRoot';
22
-
23
- const MAX_COMPANIONS = 5;
24
-
25
- export type PlankHeadingProps = {
26
- id: string;
27
- part: ResolvedPart;
28
- layoutMode?: LayoutMode;
29
- node?: Node.Node;
30
- deckEnabled?: boolean;
31
- canIncrementStart?: boolean;
32
- canIncrementEnd?: boolean;
33
- popoverAnchorId?: string;
34
- primaryId?: string;
35
- pending?: boolean;
36
- companioned?: 'primary' | 'companion';
37
- companions?: Node.Node[];
38
- actions?: StackItemSigilAction[];
39
- debug?: boolean;
40
- };
41
-
42
- export const PlankHeading = memo(
43
- ({
44
- id,
45
- part,
46
- node,
47
- deckEnabled,
48
- canIncrementStart,
49
- canIncrementEnd,
50
- popoverAnchorId,
51
- primaryId,
52
- pending,
53
- companioned,
54
- companions,
55
- layoutMode,
56
- actions = [],
57
- debug = false,
58
- }: PlankHeadingProps) => {
59
- const { t } = useTranslation(meta.profile.key);
60
- const { graph, onAdjust, onUpdateCompanion } = usePlankContext('PlankHeading');
61
- const runAction = useActionRunner();
62
- const breakpoint = useBreakpoints();
63
- const icon = node?.properties?.icon ?? 'ph--circle-dashed--regular';
64
- const label = pending
65
- ? t('pending.heading')
66
- : toLocalizedString(node?.properties?.label ?? ['plank-heading-fallback.label', { ns: meta.profile.key }], t);
67
-
68
- const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
69
-
70
- useEffect(() => {
71
- const frame = requestAnimationFrame(() => {
72
- // Load actions for the node.
73
- if (node) {
74
- void Graph.expand(graph, node.id, 'child');
75
- }
76
- });
77
-
78
- return () => cancelAnimationFrame(frame);
79
- }, [node]);
80
-
81
- const attendableId = primaryId ?? id;
82
- const capabilities = useMemo(
83
- () => ({
84
- deck: deckEnabled ?? true,
85
- solo: breakpoint !== 'mobile' && (part === 'solo' || part === 'multi'),
86
- incrementStart: canIncrementStart,
87
- incrementEnd: canIncrementEnd,
88
- fullscreen: !isCompanionNode,
89
- companion: layoutMode !== 'multi' && !isCompanionNode && companions && companions.length > 0,
90
- }),
91
- [breakpoint, part, companions, canIncrementStart, canIncrementEnd, isCompanionNode, deckEnabled, layoutMode],
92
- );
93
-
94
- const variant = isCompanionNode ? getLinkedVariant(id) : undefined;
95
- const sigilActions = useMemo(() => {
96
- if (!node) {
97
- return undefined;
98
- } else if (variant) {
99
- return [];
100
- } else {
101
- return [
102
- actions,
103
- Graph.getActions(graph, node.id).filter((action) =>
104
- ['list-item', 'list-item-primary', 'heading-list-item'].includes(action.properties.disposition),
105
- ),
106
- ].filter((a) => a.length > 0);
107
- }
108
- }, [actions, node, variant, graph]);
109
-
110
- const handleAction = useCallback(
111
- (action: StackItemSigilAction) => {
112
- if (typeof action.data === 'function') {
113
- void runAction(action as Node.Action, { parent: node, caller: meta.profile.key });
114
- }
115
- },
116
- [node, runAction],
117
- );
118
-
119
- const handlePlankAction = useCallback(
120
- (eventType: DeckOperation.PartAdjustment) => {
121
- onAdjust?.(id, eventType);
122
- },
123
- [onAdjust, id],
124
- );
125
-
126
- const ActionRoot = node && popoverAnchorId === `${meta.profile.key}:${node.id}` ? Popover.Anchor : Fragment;
127
-
128
- const handleTabClick = useCallback(
129
- (event: MouseEvent) => {
130
- const target = (event.target as HTMLElement).closest('[data-id]') as HTMLElement | null;
131
- const tabId = target?.dataset?.id;
132
- if (tabId) {
133
- onUpdateCompanion?.(tabId);
134
- }
135
- },
136
- [onUpdateCompanion],
137
- );
138
-
139
- return (
140
- <StackItem.Heading
141
- data-tauri-drag-region
142
- data-plank-heading
143
- style={iconSize(5)}
144
- classNames={[
145
- 'py-1 items-stretch gap-1 sticky left-12 dx-app-drag min-w-0 dx-contain-layout dx-density-lg',
146
- part === 'solo'
147
- ? 'ps-[calc(env(safe-area-inset-left)+.25rem)] pe-[calc(env(safe-area-inset-right)+.25rem)]'
148
- : 'px-1',
149
- ...(layoutMode === 'solo--fullscreen'
150
- ? [
151
- hoverableControls,
152
- hoverableFocusedWithinControls,
153
- '*:transition-opacity *:opacity-(--controls-opacity) bg-transparent',
154
- 'border-transparent transition-[background-color,border-color]',
155
- 'hover-hover:hover:bg-header-surface focus-within:bg-header-surface',
156
- 'hover-hover:hover:border-subdued-separator focus-within:border-subdued-separator',
157
- ]
158
- : []),
159
- ]}
160
- >
161
- {companions && isCompanionNode ? (
162
- /* TODO(thure): IMPORTANT: This is a tablist; it should be implemented as such. */
163
- <div data-tauri-drag-region className='flex-1 min-w-0 overflow-x-auto scrollbar-none flex gap-1'>
164
- {companions.map(({ id, properties: { icon, label } }) => (
165
- <IconButton
166
- key={id}
167
- data-id={id}
168
- icon={icon}
169
- iconOnly={companions.length > MAX_COMPANIONS && node?.id !== id}
170
- label={toLocalizedString(label, t)}
171
- variant={node?.id === id ? 'primary' : 'ghost'}
172
- onClick={handleTabClick}
173
- />
174
- ))}
175
- </div>
176
- ) : (
177
- <>
178
- <ActionRoot>
179
- {node && sigilActions ? (
180
- <StackItem.Sigil
181
- icon={icon}
182
- related={part === 'complementary'}
183
- attendableId={attendableId}
184
- triggerLabel={t('actions-menu.label')}
185
- actions={sigilActions}
186
- onAction={handleAction}
187
- >
188
- <Surface.Surface
189
- type={AppSurface.MenuFooter}
190
- data={{ subject: node.data } satisfies AppSurface.MenuFooterData}
191
- />
192
- </StackItem.Sigil>
193
- ) : (
194
- <StackItem.SigilButton>
195
- <span className='sr-only'>{label}</span>
196
- <Icon icon={icon} />
197
- </StackItem.SigilButton>
198
- )}
199
- </ActionRoot>
200
- <TextTooltip text={label} onlyWhenTruncating>
201
- <StackItem.HeadingLabel
202
- data-tauri-drag-region
203
- attendableId={attendableId}
204
- related={part === 'complementary'}
205
- {...(pending && { classNames: 'text-description' })}
206
- >
207
- {label}
208
- </StackItem.HeadingLabel>
209
- </TextTooltip>
210
- </>
211
- )}
212
- {debug && (
213
- <div className='flex items-center text-sm text-info-text'>
214
- {layoutMode}:{part}:{companioned}
215
- </div>
216
- )}
217
- {node && part !== 'complementary' && (
218
- <Surface.Surface
219
- type={AppSurface.NavbarEnd}
220
- data={{ subject: node.data } satisfies AppSurface.NavbarEndData}
221
- />
222
- )}
223
- {companioned === 'companion' ? (
224
- <PlankCompanionControls primary={primaryId} />
225
- ) : (
226
- <PlankControls
227
- capabilities={capabilities}
228
- layoutMode={layoutMode}
229
- close={part === 'complementary' ? 'minify-end' : true}
230
- onClick={handlePlankAction}
231
- />
232
- )}
233
- </StackItem.Heading>
234
- );
235
- },
236
- );
@@ -1,10 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- // TODO(burdon): Show skeleton: https://github.com/dxos/dxos/issues/8259
8
- export const PlankLoading = () => {
9
- return <div className='grid place-items-center dx-attention-surface' />;
10
- };
@@ -1,49 +0,0 @@
1
- //
2
- // Copyright 2026 DXOS.org
3
- //
4
-
5
- import { createContext } from '@radix-ui/react-context';
6
- import React, { PropsWithChildren } from 'react';
7
-
8
- import { type Graph } from '@dxos/plugin-graph';
9
-
10
- import { type DeckOperation } from '#types';
11
- import { type LayoutMode, type PlankSizing, type ResolvedPart, type Settings } from '#types';
12
-
13
- const PLANK_NAME = 'Plank';
14
-
15
- export type PlankContextValue = {
16
- /** The application graph. */
17
- graph: Graph.ExpandableGraph;
18
- /** Which part of the layout this plank occupies. */
19
- part: ResolvedPart;
20
- /** Current layout mode. */
21
- layoutMode: LayoutMode;
22
- /** Deck settings. */
23
- settings?: Settings.Settings;
24
- /** Popover anchor ID for heading menus. */
25
- popoverAnchorId?: string;
26
- /** ID of plank that should be scrolled into view. */
27
- scrollIntoView?: string;
28
- /** Persisted plank sizes keyed by plank ID. */
29
- plankSizing?: PlankSizing;
30
- /** Callback for plank adjustments (close, solo, increment, companion). */
31
- onAdjust?: (id: string, type: DeckOperation.PartAdjustment) => void;
32
- /** Callback for plank resize. */
33
- onResize?: (id: string, size: number) => void;
34
- /** Callback to clear scroll-into-view state. */
35
- onScrollIntoView?: (id?: string) => void;
36
- /** Callback to update the companion. */
37
- onUpdateCompanion?: (companion: string | null) => void;
38
- };
39
-
40
- export const [PlankProvider, usePlankContext] = createContext<PlankContextValue>(PLANK_NAME);
41
-
42
- export type PlankRootProps = PropsWithChildren<PlankContextValue>;
43
-
44
- /**
45
- * Headless root that provides plank context.
46
- */
47
- export const PlankRoot = ({ children, ...context }: PlankRootProps) => {
48
- return <PlankProvider {...context}>{children}</PlankProvider>;
49
- };
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- export * from './Plank';
6
- export * from './PlankError';
7
- export * from './PlankLoading';