@dxos/plugin-deck 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8

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 (504) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +541 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/DeckLayout-DEURA3KR.mjs +291 -0
  5. package/dist/lib/neutral/DeckLayout-DEURA3KR.mjs.map +7 -0
  6. package/dist/lib/neutral/DeckPlugin.mjs +87 -0
  7. package/dist/lib/neutral/DeckPlugin.mjs.map +7 -0
  8. package/dist/lib/neutral/DeckPlugin.node.mjs +18 -0
  9. package/dist/lib/neutral/DeckPlugin.node.mjs.map +7 -0
  10. package/dist/lib/neutral/DeckPlugin.workerd.mjs +16 -0
  11. package/dist/lib/neutral/DeckPlugin.workerd.mjs.map +7 -0
  12. package/dist/lib/neutral/DeckSettings-W5I57OXM.mjs +27 -0
  13. package/dist/lib/neutral/DeckSettings-W5I57OXM.mjs.map +7 -0
  14. package/dist/lib/neutral/add-toast-TNB6DXWU.mjs +24 -0
  15. package/dist/lib/neutral/add-toast-TNB6DXWU.mjs.map +7 -0
  16. package/dist/lib/neutral/adjust-HNU5CCRO.mjs +93 -0
  17. package/dist/lib/neutral/adjust-HNU5CCRO.mjs.map +7 -0
  18. package/dist/lib/neutral/app-graph-builder-HMLT627T.mjs +129 -0
  19. package/dist/lib/neutral/app-graph-builder-HMLT627T.mjs.map +7 -0
  20. package/dist/lib/neutral/capabilities/index.mjs +25 -0
  21. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  22. package/dist/lib/neutral/check-app-scheme-INSOF72J.mjs +10 -0
  23. package/dist/lib/neutral/chunk-324PPIZB.mjs +101 -0
  24. package/dist/lib/neutral/chunk-324PPIZB.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-BS4EOYMK.mjs +282 -0
  26. package/dist/lib/neutral/chunk-BS4EOYMK.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-GBIGQKYW.mjs +112 -0
  28. package/dist/lib/neutral/chunk-GBIGQKYW.mjs.map +7 -0
  29. package/dist/lib/neutral/chunk-GLB73Q6U.mjs +22 -0
  30. package/dist/lib/neutral/chunk-GLB73Q6U.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  32. package/dist/lib/neutral/chunk-PYEY5SEC.mjs +37 -0
  33. package/dist/lib/neutral/chunk-PYEY5SEC.mjs.map +7 -0
  34. package/dist/lib/neutral/chunk-Q4W6B4IB.mjs +8 -0
  35. package/dist/lib/neutral/chunk-Q4W6B4IB.mjs.map +7 -0
  36. package/dist/lib/neutral/chunk-WAXJPQJI.mjs +1306 -0
  37. package/dist/lib/neutral/chunk-WAXJPQJI.mjs.map +7 -0
  38. package/dist/lib/neutral/chunk-ZYYOSX5I.mjs +69 -0
  39. package/dist/lib/neutral/chunk-ZYYOSX5I.mjs.map +7 -0
  40. package/dist/lib/neutral/close-ASKR22A6.mjs +44 -0
  41. package/dist/lib/neutral/close-ASKR22A6.mjs.map +7 -0
  42. package/dist/lib/neutral/components/index.mjs +126 -0
  43. package/dist/lib/neutral/components/index.mjs.map +7 -0
  44. package/dist/lib/neutral/containers/index.mjs +32 -0
  45. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  46. package/dist/lib/neutral/hooks/index.mjs +159 -0
  47. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  48. package/dist/lib/neutral/index.mjs +38 -0
  49. package/dist/lib/neutral/index.mjs.map +7 -0
  50. package/dist/lib/neutral/meta.json +1 -0
  51. package/dist/lib/neutral/meta.mjs +8 -0
  52. package/dist/lib/neutral/meta.mjs.map +7 -0
  53. package/dist/lib/neutral/notification-tracker-P36322BH.mjs +182 -0
  54. package/dist/lib/neutral/notification-tracker-P36322BH.mjs.map +7 -0
  55. package/dist/lib/neutral/open-5OYNO3RT.mjs +159 -0
  56. package/dist/lib/neutral/open-5OYNO3RT.mjs.map +7 -0
  57. package/dist/lib/neutral/operation-handler-266CVMTW.mjs +13 -0
  58. package/dist/lib/neutral/operation-handler-266CVMTW.mjs.map +7 -0
  59. package/dist/lib/neutral/operations/index.mjs +8 -0
  60. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  61. package/dist/lib/neutral/plugin.mjs +16 -0
  62. package/dist/lib/neutral/plugin.mjs.map +7 -0
  63. package/dist/lib/neutral/react-root-HH5DEUOG.mjs +44 -0
  64. package/dist/lib/neutral/react-root-HH5DEUOG.mjs.map +7 -0
  65. package/dist/lib/neutral/react-surface-3UVVCK3O.mjs +34 -0
  66. package/dist/lib/neutral/react-surface-3UVVCK3O.mjs.map +7 -0
  67. package/dist/lib/neutral/revert-workspace-B2QLT2C4.mjs +21 -0
  68. package/dist/lib/neutral/revert-workspace-B2QLT2C4.mjs.map +7 -0
  69. package/dist/lib/neutral/scroll-into-view-B52C3PJO.mjs +21 -0
  70. package/dist/lib/neutral/scroll-into-view-B52C3PJO.mjs.map +7 -0
  71. package/dist/lib/neutral/set-PA35ONXO.mjs +37 -0
  72. package/dist/lib/neutral/set-PA35ONXO.mjs.map +7 -0
  73. package/dist/lib/neutral/set-layout-mode-RPCCPQRB.mjs +85 -0
  74. package/dist/lib/neutral/set-layout-mode-RPCCPQRB.mjs.map +7 -0
  75. package/dist/lib/neutral/settings-EGNYUM4T.mjs +33 -0
  76. package/dist/lib/neutral/settings-EGNYUM4T.mjs.map +7 -0
  77. package/dist/lib/neutral/state-IIDXMQUO.mjs +86 -0
  78. package/dist/lib/neutral/state-IIDXMQUO.mjs.map +7 -0
  79. package/dist/lib/neutral/switch-workspace-LZF4KZXH.mjs +60 -0
  80. package/dist/lib/neutral/switch-workspace-LZF4KZXH.mjs.map +7 -0
  81. package/dist/lib/neutral/translations.mjs +63 -0
  82. package/dist/lib/neutral/translations.mjs.map +7 -0
  83. package/dist/lib/neutral/types/index.mjs +34 -0
  84. package/dist/lib/neutral/types/index.mjs.map +7 -0
  85. package/dist/lib/neutral/update-companion-YUCZZVGY.mjs +32 -0
  86. package/dist/lib/neutral/update-companion-YUCZZVGY.mjs.map +7 -0
  87. package/dist/lib/neutral/update-complementary-7FZNB55J.mjs +28 -0
  88. package/dist/lib/neutral/update-complementary-7FZNB55J.mjs.map +7 -0
  89. package/dist/lib/neutral/update-dialog-FNQTSSAP.mjs +29 -0
  90. package/dist/lib/neutral/update-dialog-FNQTSSAP.mjs.map +7 -0
  91. package/dist/lib/neutral/update-plank-size-3YW4NXEY.mjs +26 -0
  92. package/dist/lib/neutral/update-plank-size-3YW4NXEY.mjs.map +7 -0
  93. package/dist/lib/neutral/update-popover-G2VUD7E6.mjs +33 -0
  94. package/dist/lib/neutral/update-popover-G2VUD7E6.mjs.map +7 -0
  95. package/dist/lib/neutral/update-sidebar-KRHPUHUB.mjs +25 -0
  96. package/dist/lib/neutral/update-sidebar-KRHPUHUB.mjs.map +7 -0
  97. package/dist/lib/neutral/url-handler-A6HLW4RB.mjs +229 -0
  98. package/dist/lib/neutral/url-handler-A6HLW4RB.mjs.map +7 -0
  99. package/dist/types/src/DeckPlugin.d.ts +3 -1
  100. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  101. package/dist/types/src/DeckPlugin.node.d.ts +4 -0
  102. package/dist/types/src/DeckPlugin.node.d.ts.map +1 -0
  103. package/dist/types/src/DeckPlugin.test.d.ts +2 -0
  104. package/dist/types/src/DeckPlugin.test.d.ts.map +1 -0
  105. package/dist/types/src/DeckPlugin.workerd.d.ts +4 -0
  106. package/dist/types/src/DeckPlugin.workerd.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  108. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/check-app-scheme.d.ts +17 -2
  110. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/index.d.ts +197 -12
  112. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/notification-tracker.d.ts +13 -0
  114. package/dist/types/src/capabilities/notification-tracker.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  116. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  117. package/dist/types/src/capabilities/react-root.d.ts +4 -2
  118. package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
  119. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  120. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  121. package/dist/types/src/capabilities/settings.d.ts +5 -2
  122. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  123. package/dist/types/src/capabilities/state.d.ts +141 -54
  124. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  125. package/dist/types/src/capabilities/tools.d.ts +4 -3
  126. package/dist/types/src/capabilities/tools.d.ts.map +1 -1
  127. package/dist/types/src/capabilities/url-handler.d.ts +3 -2
  128. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
  129. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +4 -4
  130. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
  131. package/dist/types/src/components/DeckSettings/DeckSettings.stories.d.ts +67 -0
  132. package/dist/types/src/components/DeckSettings/DeckSettings.stories.d.ts.map +1 -0
  133. package/dist/types/src/components/DeckSettings/index.d.ts +1 -1
  134. package/dist/types/src/components/DeckSettings/index.d.ts.map +1 -1
  135. package/dist/types/src/components/Matrix/Matrix.d.ts +41 -0
  136. package/dist/types/src/components/Matrix/Matrix.d.ts.map +1 -0
  137. package/dist/types/src/components/Matrix/Matrix.stories.d.ts +17 -0
  138. package/dist/types/src/components/Matrix/Matrix.stories.d.ts.map +1 -0
  139. package/dist/types/src/components/Matrix/index.d.ts +3 -0
  140. package/dist/types/src/components/Matrix/index.d.ts.map +1 -0
  141. package/dist/types/src/components/index.d.ts +3 -2
  142. package/dist/types/src/components/index.d.ts.map +1 -1
  143. package/dist/types/src/{components/DeckLayout → containers/Deck}/Banner.d.ts +1 -1
  144. package/dist/types/src/containers/Deck/Banner.d.ts.map +1 -0
  145. package/dist/types/src/containers/Deck/Deck.d.ts +25 -0
  146. package/dist/types/src/containers/Deck/Deck.d.ts.map +1 -0
  147. package/dist/types/src/containers/Deck/Deck.stories.d.ts +67 -0
  148. package/dist/types/src/containers/Deck/Deck.stories.d.ts.map +1 -0
  149. package/dist/types/src/containers/Deck/DeckContent.d.ts +7 -0
  150. package/dist/types/src/containers/Deck/DeckContent.d.ts.map +1 -0
  151. package/dist/types/src/containers/Deck/DeckRoot.d.ts +39 -0
  152. package/dist/types/src/containers/Deck/DeckRoot.d.ts.map +1 -0
  153. package/dist/types/src/containers/Deck/DeckViewport.d.ts +16 -0
  154. package/dist/types/src/containers/Deck/DeckViewport.d.ts.map +1 -0
  155. package/dist/types/src/containers/Deck/StatusBar.d.ts.map +1 -0
  156. package/dist/types/src/containers/Deck/index.d.ts +2 -0
  157. package/dist/types/src/containers/Deck/index.d.ts.map +1 -0
  158. package/dist/types/src/containers/DeckLayout/ActiveNode.d.ts.map +1 -0
  159. package/dist/types/src/containers/DeckLayout/DeckLayout.d.ts.map +1 -0
  160. package/dist/types/src/containers/DeckLayout/DeckLayout.stories.d.ts +69 -0
  161. package/dist/types/src/containers/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
  162. package/dist/types/src/containers/DeckLayout/Dialog.d.ts.map +1 -0
  163. package/dist/types/src/containers/DeckLayout/Fallback.d.ts +2 -0
  164. package/dist/types/src/containers/DeckLayout/Fallback.d.ts.map +1 -0
  165. package/dist/types/src/containers/DeckLayout/Popover.d.ts +5 -0
  166. package/dist/types/src/containers/DeckLayout/Popover.d.ts.map +1 -0
  167. package/dist/types/src/{components → containers}/DeckLayout/Toast.d.ts +3 -3
  168. package/dist/types/src/containers/DeckLayout/Toast.d.ts.map +1 -0
  169. package/dist/types/src/containers/DeckLayout/constants.d.ts.map +1 -0
  170. package/dist/types/src/containers/DeckLayout/index.d.ts +4 -0
  171. package/dist/types/src/containers/DeckLayout/index.d.ts.map +1 -0
  172. package/dist/types/src/containers/Plank/Plank.d.ts +17 -0
  173. package/dist/types/src/containers/Plank/Plank.d.ts.map +1 -0
  174. package/dist/types/src/containers/Plank/Plank.stories.d.ts +67 -0
  175. package/dist/types/src/containers/Plank/Plank.stories.d.ts.map +1 -0
  176. package/dist/types/src/containers/Plank/PlankComponent.d.ts +17 -0
  177. package/dist/types/src/containers/Plank/PlankComponent.d.ts.map +1 -0
  178. package/dist/types/src/containers/Plank/PlankContent.d.ts +10 -0
  179. package/dist/types/src/containers/Plank/PlankContent.d.ts.map +1 -0
  180. package/dist/types/src/{components → containers}/Plank/PlankControls.d.ts +5 -6
  181. package/dist/types/src/containers/Plank/PlankControls.d.ts.map +1 -0
  182. package/dist/types/src/containers/Plank/PlankError.d.ts +15 -0
  183. package/dist/types/src/containers/Plank/PlankError.d.ts.map +1 -0
  184. package/dist/types/src/{components → containers}/Plank/PlankHeading.d.ts +5 -4
  185. package/dist/types/src/containers/Plank/PlankHeading.d.ts.map +1 -0
  186. package/dist/types/src/{components → containers}/Plank/PlankLoading.d.ts.map +1 -1
  187. package/dist/types/src/containers/Plank/PlankRoot.d.ts +37 -0
  188. package/dist/types/src/containers/Plank/PlankRoot.d.ts.map +1 -0
  189. package/dist/types/src/containers/Plank/index.d.ts +4 -0
  190. package/dist/types/src/containers/Plank/index.d.ts.map +1 -0
  191. package/dist/types/src/containers/Sidebar/ComplementarySidebar.d.ts.map +1 -0
  192. package/dist/types/src/containers/Sidebar/Sidebar.d.ts.map +1 -0
  193. package/dist/types/src/{components → containers}/Sidebar/SidebarButton.d.ts +1 -1
  194. package/dist/types/src/containers/Sidebar/SidebarButton.d.ts.map +1 -0
  195. package/dist/types/src/{components → containers}/Sidebar/index.d.ts.map +1 -1
  196. package/dist/types/src/containers/index.d.ts +6 -0
  197. package/dist/types/src/containers/index.d.ts.map +1 -0
  198. package/dist/types/src/hooks/index.d.ts +2 -1
  199. package/dist/types/src/hooks/index.d.ts.map +1 -1
  200. package/dist/types/src/hooks/useBreakpoints.d.ts +1 -1
  201. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
  202. package/dist/types/src/hooks/useDeckCompanions.d.ts +4 -4
  203. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  204. package/dist/types/src/hooks/useDeckState.d.ts +17 -0
  205. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
  206. package/dist/types/src/hooks/useMainSize.d.ts +2 -2
  207. package/dist/types/src/hooks/useMainSize.d.ts.map +1 -1
  208. package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
  209. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  210. package/dist/types/src/hooks/useSelectedCompanion.d.ts +13 -0
  211. package/dist/types/src/hooks/useSelectedCompanion.d.ts.map +1 -0
  212. package/dist/types/src/index.d.ts +1 -4
  213. package/dist/types/src/index.d.ts.map +1 -1
  214. package/dist/types/src/layout.d.ts +20 -9
  215. package/dist/types/src/layout.d.ts.map +1 -1
  216. package/dist/types/src/layout.test.d.ts +2 -0
  217. package/dist/types/src/layout.test.d.ts.map +1 -0
  218. package/dist/types/src/meta.d.ts +2 -2
  219. package/dist/types/src/meta.d.ts.map +1 -1
  220. package/dist/types/src/operations/add-toast.d.ts +5 -0
  221. package/dist/types/src/operations/add-toast.d.ts.map +1 -0
  222. package/dist/types/src/operations/adjust.d.ts +5 -0
  223. package/dist/types/src/operations/adjust.d.ts.map +1 -0
  224. package/dist/types/src/operations/close.d.ts +5 -0
  225. package/dist/types/src/operations/close.d.ts.map +1 -0
  226. package/dist/types/src/operations/helpers.d.ts +3 -0
  227. package/dist/types/src/operations/helpers.d.ts.map +1 -0
  228. package/dist/types/src/operations/index.d.ts +3 -0
  229. package/dist/types/src/operations/index.d.ts.map +1 -0
  230. package/dist/types/src/operations/open.d.ts +5 -0
  231. package/dist/types/src/operations/open.d.ts.map +1 -0
  232. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  233. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  234. package/dist/types/src/operations/scroll-into-view.d.ts +5 -0
  235. package/dist/types/src/operations/scroll-into-view.d.ts.map +1 -0
  236. package/dist/types/src/operations/set-layout-mode.d.ts +9 -0
  237. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  238. package/dist/types/src/operations/set.d.ts +5 -0
  239. package/dist/types/src/operations/set.d.ts.map +1 -0
  240. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  241. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  242. package/dist/types/src/operations/update-companion.d.ts +5 -0
  243. package/dist/types/src/operations/update-companion.d.ts.map +1 -0
  244. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  245. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  246. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  247. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  248. package/dist/types/src/operations/update-plank-size.d.ts +5 -0
  249. package/dist/types/src/operations/update-plank-size.d.ts.map +1 -0
  250. package/dist/types/src/operations/update-popover.d.ts +5 -0
  251. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  252. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  253. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  254. package/dist/types/src/plugin.d.ts +4 -0
  255. package/dist/types/src/plugin.d.ts.map +1 -0
  256. package/dist/types/src/translations.d.ts +48 -55
  257. package/dist/types/src/translations.d.ts.map +1 -1
  258. package/dist/types/src/types/DeckCapabilities.d.ts +188 -0
  259. package/dist/types/src/types/DeckCapabilities.d.ts.map +1 -0
  260. package/dist/types/src/types/DeckEvents.d.ts +5 -0
  261. package/dist/types/src/types/DeckEvents.d.ts.map +1 -0
  262. package/dist/types/src/types/DeckOperation.d.ts +15 -0
  263. package/dist/types/src/types/DeckOperation.d.ts.map +1 -0
  264. package/dist/types/src/types/Settings.d.ts +10 -0
  265. package/dist/types/src/types/Settings.d.ts.map +1 -0
  266. package/dist/types/src/types/index.d.ts +4 -0
  267. package/dist/types/src/types/index.d.ts.map +1 -1
  268. package/dist/types/src/types/schema.d.ts +69 -69
  269. package/dist/types/src/types/schema.d.ts.map +1 -1
  270. package/dist/types/src/util/index.d.ts +2 -1
  271. package/dist/types/src/util/index.d.ts.map +1 -1
  272. package/dist/types/src/util/layoutAppliesTopbar.d.ts +1 -1
  273. package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
  274. package/dist/types/src/util/plank-url-params.d.ts +14 -0
  275. package/dist/types/src/util/plank-url-params.d.ts.map +1 -0
  276. package/dist/types/src/util/plank-url-params.test.d.ts +2 -0
  277. package/dist/types/src/util/plank-url-params.test.d.ts.map +1 -0
  278. package/dist/types/src/util/sanitize-persisted-state.d.ts +19 -0
  279. package/dist/types/src/util/sanitize-persisted-state.d.ts.map +1 -0
  280. package/dist/types/src/util/sanitize-persisted-state.test.d.ts +2 -0
  281. package/dist/types/src/util/sanitize-persisted-state.test.d.ts.map +1 -0
  282. package/dist/types/src/util/set-active.d.ts +19 -4
  283. package/dist/types/src/util/set-active.d.ts.map +1 -1
  284. package/dist/types/src/util/set-active.test.d.ts +2 -0
  285. package/dist/types/src/util/set-active.test.d.ts.map +1 -0
  286. package/dist/types/tsconfig.tsbuildinfo +1 -1
  287. package/package.json +126 -62
  288. package/src/DeckPlugin.node.ts +17 -0
  289. package/src/DeckPlugin.test.ts +27 -0
  290. package/src/DeckPlugin.ts +43 -56
  291. package/src/DeckPlugin.workerd.ts +16 -0
  292. package/src/capabilities/app-graph-builder.ts +111 -127
  293. package/src/capabilities/check-app-scheme.ts +123 -24
  294. package/src/capabilities/index.ts +14 -14
  295. package/src/capabilities/notification-tracker.ts +170 -0
  296. package/src/capabilities/operation-handler.ts +16 -0
  297. package/src/capabilities/react-root.tsx +40 -28
  298. package/src/capabilities/react-surface.tsx +28 -22
  299. package/src/capabilities/settings.ts +29 -20
  300. package/src/capabilities/state.ts +74 -96
  301. package/src/capabilities/tools.ts +57 -50
  302. package/src/capabilities/url-handler.ts +290 -48
  303. package/src/components/DeckSettings/DeckSettings.stories.tsx +37 -0
  304. package/src/components/DeckSettings/DeckSettings.tsx +19 -88
  305. package/src/components/DeckSettings/index.ts +2 -2
  306. package/src/components/Matrix/Matrix.stories.tsx +220 -0
  307. package/src/components/Matrix/Matrix.tsx +205 -0
  308. package/src/components/Matrix/SPEC.md +219 -0
  309. package/src/components/Matrix/index.ts +6 -0
  310. package/src/components/index.ts +6 -3
  311. package/src/containers/Deck/Banner.tsx +41 -0
  312. package/src/containers/Deck/Deck.stories.tsx +81 -0
  313. package/src/containers/Deck/Deck.tsx +21 -0
  314. package/src/containers/Deck/DeckContent.tsx +102 -0
  315. package/src/containers/Deck/DeckRoot.tsx +50 -0
  316. package/src/containers/Deck/DeckViewport.tsx +450 -0
  317. package/src/{components/DeckLayout → containers/Deck}/StatusBar.tsx +4 -4
  318. package/src/containers/Deck/index.ts +5 -0
  319. package/src/{components → containers}/DeckLayout/ActiveNode.tsx +9 -4
  320. package/src/containers/DeckLayout/DeckLayout.stories.tsx +395 -0
  321. package/src/containers/DeckLayout/DeckLayout.tsx +62 -0
  322. package/src/containers/DeckLayout/Dialog.tsx +52 -0
  323. package/src/containers/DeckLayout/Fallback.tsx +24 -0
  324. package/src/containers/DeckLayout/Popover.tsx +166 -0
  325. package/src/containers/DeckLayout/Toast.tsx +76 -0
  326. package/src/{components → containers}/DeckLayout/constants.ts +1 -0
  327. package/src/{components → containers}/DeckLayout/index.ts +3 -2
  328. package/src/containers/Plank/Plank.stories.tsx +108 -0
  329. package/src/containers/Plank/Plank.tsx +22 -0
  330. package/src/containers/Plank/PlankComponent.tsx +223 -0
  331. package/src/containers/Plank/PlankContent.tsx +45 -0
  332. package/src/{components → containers}/Plank/PlankControls.tsx +43 -37
  333. package/src/containers/Plank/PlankError.tsx +82 -0
  334. package/src/{components → containers}/Plank/PlankHeading.tsx +67 -64
  335. package/src/{components → containers}/Plank/PlankLoading.tsx +1 -1
  336. package/src/containers/Plank/PlankRoot.tsx +49 -0
  337. package/src/{components → containers}/Plank/index.ts +0 -2
  338. package/src/containers/Sidebar/ComplementarySidebar.tsx +189 -0
  339. package/src/containers/Sidebar/Sidebar.tsx +39 -0
  340. package/src/containers/Sidebar/SidebarButton.tsx +100 -0
  341. package/src/containers/index.ts +11 -0
  342. package/src/hooks/index.ts +2 -1
  343. package/src/hooks/useCompanions.ts +3 -3
  344. package/src/hooks/useDeckCompanions.ts +8 -11
  345. package/src/hooks/useDeckState.ts +73 -0
  346. package/src/hooks/useMainSize.ts +2 -2
  347. package/src/hooks/useNodeActionExpander.ts +4 -4
  348. package/src/hooks/useSelectedCompanion.ts +32 -0
  349. package/src/index.ts +1 -4
  350. package/src/layout.test.ts +59 -0
  351. package/src/layout.ts +38 -40
  352. package/src/meta.ts +24 -6
  353. package/src/operations/add-toast.ts +24 -0
  354. package/src/operations/adjust.ts +82 -0
  355. package/src/operations/close.ts +35 -0
  356. package/src/operations/helpers.ts +22 -0
  357. package/src/operations/index.ts +23 -0
  358. package/src/operations/open.ts +201 -0
  359. package/src/operations/revert-workspace.ts +22 -0
  360. package/src/operations/scroll-into-view.ts +24 -0
  361. package/src/operations/set-layout-mode.ts +84 -0
  362. package/src/operations/set.ts +36 -0
  363. package/src/operations/switch-workspace.ts +66 -0
  364. package/src/operations/update-companion.ts +35 -0
  365. package/src/operations/update-complementary.ts +33 -0
  366. package/src/operations/update-dialog.ts +34 -0
  367. package/src/operations/update-plank-size.ts +28 -0
  368. package/src/operations/update-popover.ts +36 -0
  369. package/src/operations/update-sidebar.ts +28 -0
  370. package/src/plugin.ts +11 -0
  371. package/src/translations.ts +48 -54
  372. package/src/types/DeckCapabilities.ts +34 -0
  373. package/src/types/DeckEvents.ts +21 -0
  374. package/src/types/DeckOperation.ts +56 -0
  375. package/src/types/Settings.ts +36 -0
  376. package/src/types/index.ts +5 -0
  377. package/src/types/schema.ts +49 -58
  378. package/src/util/index.ts +2 -1
  379. package/src/util/layoutAppliesTopbar.ts +2 -2
  380. package/src/util/plank-url-params.test.ts +85 -0
  381. package/src/util/plank-url-params.ts +36 -0
  382. package/src/util/sanitize-persisted-state.test.ts +79 -0
  383. package/src/util/sanitize-persisted-state.ts +52 -0
  384. package/src/util/set-active.test.ts +106 -0
  385. package/src/util/set-active.ts +50 -30
  386. package/src/vite-env.d.ts +10 -0
  387. package/dist/lib/browser/app-graph-builder-D74NTOMK.mjs +0 -128
  388. package/dist/lib/browser/app-graph-builder-D74NTOMK.mjs.map +0 -7
  389. package/dist/lib/browser/check-app-scheme-HIEVFAAX.mjs +0 -32
  390. package/dist/lib/browser/check-app-scheme-HIEVFAAX.mjs.map +0 -7
  391. package/dist/lib/browser/chunk-5KMJPIQC.mjs +0 -16
  392. package/dist/lib/browser/chunk-5KMJPIQC.mjs.map +0 -7
  393. package/dist/lib/browser/chunk-CNTGBCMK.mjs +0 -145
  394. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  395. package/dist/lib/browser/chunk-F3VCCHVL.mjs +0 -162
  396. package/dist/lib/browser/chunk-F3VCCHVL.mjs.map +0 -7
  397. package/dist/lib/browser/chunk-QKCGZ45E.mjs +0 -128
  398. package/dist/lib/browser/chunk-QKCGZ45E.mjs.map +0 -7
  399. package/dist/lib/browser/chunk-UXLU6CMW.mjs +0 -16
  400. package/dist/lib/browser/chunk-UXLU6CMW.mjs.map +0 -7
  401. package/dist/lib/browser/chunk-VBYJ664A.mjs +0 -132
  402. package/dist/lib/browser/chunk-VBYJ664A.mjs.map +0 -7
  403. package/dist/lib/browser/chunk-VUJ6UNIJ.mjs +0 -1553
  404. package/dist/lib/browser/chunk-VUJ6UNIJ.mjs.map +0 -7
  405. package/dist/lib/browser/index.mjs +0 -174
  406. package/dist/lib/browser/index.mjs.map +0 -7
  407. package/dist/lib/browser/intent-resolver-UA4YQGAC.mjs +0 -524
  408. package/dist/lib/browser/intent-resolver-UA4YQGAC.mjs.map +0 -7
  409. package/dist/lib/browser/meta.json +0 -1
  410. package/dist/lib/browser/react-root-JAMHKYWN.mjs +0 -44
  411. package/dist/lib/browser/react-root-JAMHKYWN.mjs.map +0 -7
  412. package/dist/lib/browser/react-surface-6LW337ZT.mjs +0 -40
  413. package/dist/lib/browser/react-surface-6LW337ZT.mjs.map +0 -7
  414. package/dist/lib/browser/settings-SDPTOCCM.mjs +0 -30
  415. package/dist/lib/browser/settings-SDPTOCCM.mjs.map +0 -7
  416. package/dist/lib/browser/state-7IFAGZQO.mjs +0 -12
  417. package/dist/lib/browser/toolkit-L5CFXJCF.mjs +0 -52
  418. package/dist/lib/browser/toolkit-L5CFXJCF.mjs.map +0 -7
  419. package/dist/lib/browser/types/index.mjs +0 -32
  420. package/dist/lib/browser/url-handler-QEYGYE2H.mjs +0 -70
  421. package/dist/lib/browser/url-handler-QEYGYE2H.mjs.map +0 -7
  422. package/dist/types/src/capabilities/capabilities.d.ts +0 -184
  423. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  424. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  425. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  426. package/dist/types/src/capabilities/toolkit.d.ts +0 -25
  427. package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
  428. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +0 -1
  429. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +0 -1
  430. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts +0 -3
  431. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +0 -1
  432. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +0 -1
  433. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +0 -74
  434. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +0 -1
  435. package/dist/types/src/components/DeckLayout/DeckMain.d.ts +0 -3
  436. package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +0 -1
  437. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +0 -1
  438. package/dist/types/src/components/DeckLayout/Fallback.d.ts +0 -3
  439. package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +0 -1
  440. package/dist/types/src/components/DeckLayout/Popover.d.ts +0 -5
  441. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +0 -1
  442. package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +0 -1
  443. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +0 -1
  444. package/dist/types/src/components/DeckLayout/Topbar.d.ts +0 -3
  445. package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +0 -1
  446. package/dist/types/src/components/DeckLayout/constants.d.ts.map +0 -1
  447. package/dist/types/src/components/DeckLayout/index.d.ts +0 -4
  448. package/dist/types/src/components/DeckLayout/index.d.ts.map +0 -1
  449. package/dist/types/src/components/Plank/Plank.d.ts +0 -27
  450. package/dist/types/src/components/Plank/Plank.d.ts.map +0 -1
  451. package/dist/types/src/components/Plank/Plank.stories.d.ts +0 -89
  452. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +0 -1
  453. package/dist/types/src/components/Plank/PlankControls.d.ts.map +0 -1
  454. package/dist/types/src/components/Plank/PlankError.d.ts +0 -13
  455. package/dist/types/src/components/Plank/PlankError.d.ts.map +0 -1
  456. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +0 -1
  457. package/dist/types/src/components/Plank/index.d.ts +0 -6
  458. package/dist/types/src/components/Plank/index.d.ts.map +0 -1
  459. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +0 -1
  460. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +0 -1
  461. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +0 -1
  462. package/dist/types/src/components/fragments.d.ts +0 -4
  463. package/dist/types/src/components/fragments.d.ts.map +0 -1
  464. package/dist/types/src/events.d.ts +0 -4
  465. package/dist/types/src/events.d.ts.map +0 -1
  466. package/dist/types/src/hooks/useHoistStatusbar.d.ts +0 -3
  467. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +0 -1
  468. package/dist/types/src/util/overscroll.d.ts +0 -47
  469. package/dist/types/src/util/overscroll.d.ts.map +0 -1
  470. package/src/capabilities/capabilities.ts +0 -14
  471. package/src/capabilities/intent-resolver.ts +0 -471
  472. package/src/capabilities/toolkit.ts +0 -66
  473. package/src/components/DeckLayout/Banner.tsx +0 -39
  474. package/src/components/DeckLayout/ContentEmpty.tsx +0 -31
  475. package/src/components/DeckLayout/DeckLayout.stories.tsx +0 -63
  476. package/src/components/DeckLayout/DeckLayout.tsx +0 -32
  477. package/src/components/DeckLayout/DeckMain.tsx +0 -281
  478. package/src/components/DeckLayout/Dialog.tsx +0 -36
  479. package/src/components/DeckLayout/Fallback.tsx +0 -28
  480. package/src/components/DeckLayout/Popover.tsx +0 -95
  481. package/src/components/DeckLayout/Toast.tsx +0 -86
  482. package/src/components/DeckLayout/Topbar.tsx +0 -11
  483. package/src/components/Plank/Plank.stories.tsx +0 -54
  484. package/src/components/Plank/Plank.tsx +0 -299
  485. package/src/components/Plank/PlankError.tsx +0 -49
  486. package/src/components/Sidebar/ComplementarySidebar.tsx +0 -214
  487. package/src/components/Sidebar/Sidebar.tsx +0 -42
  488. package/src/components/Sidebar/SidebarButton.tsx +0 -88
  489. package/src/components/fragments.ts +0 -14
  490. package/src/events.ts +0 -11
  491. package/src/hooks/useHoistStatusbar.ts +0 -27
  492. package/src/util/overscroll.ts +0 -69
  493. /package/dist/lib/{browser/state-7IFAGZQO.mjs.map → neutral/check-app-scheme-INSOF72J.mjs.map} +0 -0
  494. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  495. /package/dist/types/src/{components/DeckLayout → containers/Deck}/StatusBar.d.ts +0 -0
  496. /package/dist/types/src/{components → containers}/DeckLayout/ActiveNode.d.ts +0 -0
  497. /package/dist/types/src/{components → containers}/DeckLayout/DeckLayout.d.ts +0 -0
  498. /package/dist/types/src/{components → containers}/DeckLayout/Dialog.d.ts +0 -0
  499. /package/dist/types/src/{components → containers}/DeckLayout/constants.d.ts +0 -0
  500. /package/dist/types/src/{components → containers}/Plank/PlankLoading.d.ts +0 -0
  501. /package/dist/types/src/{components → containers}/Sidebar/ComplementarySidebar.d.ts +0 -0
  502. /package/dist/types/src/{components → containers}/Sidebar/Sidebar.d.ts +0 -0
  503. /package/dist/types/src/{components → containers}/Sidebar/index.d.ts +0 -0
  504. /package/src/{components → containers}/Sidebar/index.ts +0 -0
@@ -0,0 +1,1306 @@
1
+ import {
2
+ layoutAppliesTopbar
3
+ } from "./chunk-GBIGQKYW.mjs";
4
+
5
+ // src/containers/Plank/PlankLoading.tsx
6
+ import React from "react";
7
+ var PlankLoading = () => {
8
+ return /* @__PURE__ */ React.createElement("div", {
9
+ className: "grid place-items-center dx-attention-surface"
10
+ });
11
+ };
12
+
13
+ // src/containers/Plank/PlankError.tsx
14
+ import React5, { useEffect as useEffect2, useMemo as useMemo2, useState } from "react";
15
+ import { TimeoutError } from "@dxos/errors";
16
+ import { log } from "@dxos/log";
17
+ import { ErrorFallback, useTranslation as useTranslation3 } from "@dxos/react-ui";
18
+ import { descriptionMessage, mx } from "@dxos/ui-theme";
19
+ import { meta as meta3 } from "#meta";
20
+
21
+ // src/containers/Plank/PlankHeading.tsx
22
+ import React4, { Fragment, memo, useCallback as useCallback2, useEffect, useMemo } from "react";
23
+ import { Surface } from "@dxos/app-framework/ui";
24
+ import { AppSurface } from "@dxos/app-toolkit/ui";
25
+ import { Graph, useActionRunner } from "@dxos/plugin-graph";
26
+ import { Icon, IconButton as IconButton2, Popover, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
27
+ import { getLinkedVariant } from "@dxos/react-ui-attention";
28
+ import { StackItem } from "@dxos/react-ui-stack";
29
+ import { TextTooltip } from "@dxos/react-ui-text-tooltip";
30
+ import { hoverableControls, hoverableFocusedWithinControls, iconSize } from "@dxos/ui-theme";
31
+ import { useBreakpoints } from "#hooks";
32
+ import { meta as meta2 } from "#meta";
33
+ import { PLANK_COMPANION_TYPE } from "#types";
34
+
35
+ // src/containers/Plank/PlankControls.tsx
36
+ import React2, { forwardRef, useCallback } from "react";
37
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
38
+ import { LayoutOperation } from "@dxos/app-toolkit";
39
+ import { ButtonGroup, IconButton, useTranslation } from "@dxos/react-ui";
40
+ import { meta } from "#meta";
41
+ var plankControlSpacing = "px-2";
42
+ var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
43
+ const { t } = useTranslation(meta.id);
44
+ const { invokePromise } = useOperationInvoker();
45
+ const handleCloseCompanion = useCallback(() => {
46
+ return invokePromise(LayoutOperation.UpdateCompanion, {
47
+ subject: null
48
+ });
49
+ }, [
50
+ invokePromise
51
+ ]);
52
+ return /* @__PURE__ */ React2.createElement("div", {
53
+ ref: forwardedRef,
54
+ className: "contents dx-app-no-drag"
55
+ }, /* @__PURE__ */ React2.createElement(PlankControl, {
56
+ label: t("close-companion.label"),
57
+ variant: "ghost",
58
+ icon: "ph--x--regular",
59
+ onClick: handleCloseCompanion,
60
+ classNames: plankControlSpacing
61
+ }));
62
+ });
63
+ var PlankControl = ({ icon, label: label3, ...props }) => {
64
+ return /* @__PURE__ */ React2.createElement(IconButton, {
65
+ label: label3,
66
+ icon,
67
+ iconOnly: true,
68
+ variant: "ghost",
69
+ tooltipSide: "bottom",
70
+ ...props
71
+ });
72
+ };
73
+ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, layoutMode, pin, close = false, onClick, ...props }, forwardedRef) => {
74
+ const { t } = useTranslation(meta.id);
75
+ const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
76
+ const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
77
+ return /* @__PURE__ */ React2.createElement(ButtonGroup, {
78
+ ...props,
79
+ classNames: [
80
+ "dx-app-no-drag opacity-100!",
81
+ classNames
82
+ ],
83
+ ref: forwardedRef
84
+ }, capabilities.deck ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React2.createElement(PlankControl, {
85
+ label: t("show-fullscreen-plank.label"),
86
+ classNames: buttonClassNames,
87
+ icon: "ph--corners-out--regular",
88
+ onClick: () => onClick?.("solo--fullscreen")
89
+ }), /* @__PURE__ */ React2.createElement(PlankControl, {
90
+ label: t(layoutMode === "solo--fullscreen" ? "exit-fullscreen.label" : layoutIsAnySolo ? "show-deck-plank.label" : "show-solo-plank.label"),
91
+ classNames: buttonClassNames,
92
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : layoutIsAnySolo ? "ph--arrows-in-line-horizontal--regular" : "ph--arrows-out-line-horizontal--regular",
93
+ onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
94
+ })), !layoutIsAnySolo && layoutMode !== "multi" && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
95
+ label: t("increment-start.label"),
96
+ disabled: !capabilities.incrementStart,
97
+ classNames: buttonClassNames,
98
+ icon: "ph--caret-left--regular",
99
+ onClick: () => onClick?.("increment-start")
100
+ }), /* @__PURE__ */ React2.createElement(PlankControl, {
101
+ label: t("increment-end.label"),
102
+ disabled: !capabilities.incrementEnd,
103
+ classNames: buttonClassNames,
104
+ icon: "ph--caret-right--regular",
105
+ onClick: () => onClick?.("increment-end")
106
+ }))) : capabilities.fullscreen && /* @__PURE__ */ React2.createElement(PlankControl, {
107
+ label: t(layoutMode === "solo--fullscreen" ? "exit-fullscreen.label" : "show-fullscreen-plank.label"),
108
+ classNames: buttonClassNames,
109
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : "ph--corners-out--regular",
110
+ onClick: () => onClick?.("solo--fullscreen")
111
+ }), close && !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(PlankControl, {
112
+ label: t(`${typeof close === "string" ? "minify" : "close"}.label`),
113
+ classNames: buttonClassNames,
114
+ "data-testid": "plankHeading.close",
115
+ icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular",
116
+ onClick: () => onClick?.("close")
117
+ }), capabilities.companion && /* @__PURE__ */ React2.createElement(PlankControl, {
118
+ label: t("open-companion.label"),
119
+ classNames: buttonClassNames,
120
+ "data-testid": "plankHeading.companion",
121
+ icon: "ph--square-split-horizontal--regular",
122
+ onClick: () => onClick?.("companion")
123
+ }), children);
124
+ });
125
+
126
+ // src/containers/Plank/PlankRoot.tsx
127
+ import { createContext } from "@radix-ui/react-context";
128
+ import React3 from "react";
129
+ var PLANK_NAME = "Plank";
130
+ var [PlankProvider, usePlankContext] = createContext(PLANK_NAME);
131
+ var PlankRoot = ({ children, ...context }) => {
132
+ return /* @__PURE__ */ React3.createElement(PlankProvider, context, children);
133
+ };
134
+
135
+ // src/containers/Plank/PlankHeading.tsx
136
+ var MAX_COMPANIONS = 5;
137
+ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [], debug = false }) => {
138
+ const { t } = useTranslation2(meta2.id);
139
+ const { graph, onAdjust, onUpdateCompanion } = usePlankContext("PlankHeading");
140
+ const runAction = useActionRunner();
141
+ const breakpoint = useBreakpoints();
142
+ const icon = node?.properties?.icon ?? "ph--circle-dashed--regular";
143
+ const label3 = pending ? t("pending.heading") : toLocalizedString(node?.properties?.label ?? [
144
+ "plank-heading-fallback.label",
145
+ {
146
+ ns: meta2.id
147
+ }
148
+ ], t);
149
+ const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
150
+ useEffect(() => {
151
+ const frame = requestAnimationFrame(() => {
152
+ if (node) {
153
+ void Graph.expand(graph, node.id, "child");
154
+ }
155
+ });
156
+ return () => cancelAnimationFrame(frame);
157
+ }, [
158
+ node
159
+ ]);
160
+ const attendableId = primaryId ?? id;
161
+ const capabilities = useMemo(() => ({
162
+ deck: deckEnabled ?? true,
163
+ solo: breakpoint !== "mobile" && (part === "solo" || part === "multi"),
164
+ incrementStart: canIncrementStart,
165
+ incrementEnd: canIncrementEnd,
166
+ fullscreen: !isCompanionNode,
167
+ companion: layoutMode !== "multi" && !isCompanionNode && companions && companions.length > 0
168
+ }), [
169
+ breakpoint,
170
+ part,
171
+ companions,
172
+ canIncrementStart,
173
+ canIncrementEnd,
174
+ isCompanionNode,
175
+ deckEnabled,
176
+ layoutMode
177
+ ]);
178
+ const variant = isCompanionNode ? getLinkedVariant(id) : void 0;
179
+ const sigilActions = useMemo(() => {
180
+ if (!node) {
181
+ return void 0;
182
+ } else if (variant) {
183
+ return [];
184
+ } else {
185
+ return [
186
+ actions,
187
+ Graph.getActions(graph, node.id).filter((action) => [
188
+ "list-item",
189
+ "list-item-primary",
190
+ "heading-list-item"
191
+ ].includes(action.properties.disposition))
192
+ ].filter((a) => a.length > 0);
193
+ }
194
+ }, [
195
+ actions,
196
+ node,
197
+ variant,
198
+ graph
199
+ ]);
200
+ const handleAction = useCallback2((action) => {
201
+ if (typeof action.data === "function") {
202
+ void runAction(action, {
203
+ parent: node,
204
+ caller: meta2.id
205
+ });
206
+ }
207
+ }, [
208
+ node,
209
+ runAction
210
+ ]);
211
+ const handlePlankAction = useCallback2((eventType) => {
212
+ onAdjust?.(id, eventType);
213
+ }, [
214
+ onAdjust,
215
+ id
216
+ ]);
217
+ const ActionRoot = node && popoverAnchorId === `${meta2.id}:${node.id}` ? Popover.Anchor : Fragment;
218
+ const handleTabClick = useCallback2((event) => {
219
+ const target = event.target.closest("[data-id]");
220
+ const tabId = target?.dataset?.id;
221
+ if (tabId) {
222
+ onUpdateCompanion?.(tabId);
223
+ }
224
+ }, [
225
+ onUpdateCompanion
226
+ ]);
227
+ return /* @__PURE__ */ React4.createElement(StackItem.Heading, {
228
+ "data-tauri-drag-region": true,
229
+ "data-plank-heading": true,
230
+ style: iconSize(5),
231
+ classNames: [
232
+ "py-1 items-stretch gap-1 sticky left-12 dx-app-drag min-w-0 dx-contain-layout dx-density-lg",
233
+ part === "solo" ? "ps-[calc(env(safe-area-inset-left)+.25rem)] pe-[calc(env(safe-area-inset-right)+.25rem)]" : "px-1",
234
+ ...layoutMode === "solo--fullscreen" ? [
235
+ hoverableControls,
236
+ hoverableFocusedWithinControls,
237
+ "*:transition-opacity *:opacity-(--controls-opacity) bg-transparent",
238
+ "border-transparent transition-[background-color,border-color]",
239
+ "hover-hover:hover:bg-header-surface focus-within:bg-header-surface",
240
+ "hover-hover:hover:border-subdued-separator focus-within:border-subdued-separator"
241
+ ] : []
242
+ ]
243
+ }, companions && isCompanionNode ? (
244
+ /* TODO(thure): IMPORTANT: This is a tablist; it should be implemented as such. */
245
+ /* @__PURE__ */ React4.createElement("div", {
246
+ "data-tauri-drag-region": true,
247
+ className: "flex-1 min-w-0 overflow-x-auto scrollbar-none flex gap-1"
248
+ }, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React4.createElement(IconButton2, {
249
+ key: id2,
250
+ "data-id": id2,
251
+ icon: icon2,
252
+ iconOnly: companions.length > MAX_COMPANIONS && node?.id !== id2,
253
+ label: toLocalizedString(label4, t),
254
+ variant: node?.id === id2 ? "primary" : "ghost",
255
+ onClick: handleTabClick
256
+ })))
257
+ ) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React4.createElement(StackItem.Sigil, {
258
+ icon,
259
+ related: part === "complementary",
260
+ attendableId,
261
+ triggerLabel: t("actions-menu.label"),
262
+ actions: sigilActions,
263
+ onAction: handleAction
264
+ }, /* @__PURE__ */ React4.createElement(Surface.Surface, {
265
+ type: AppSurface.MenuFooter,
266
+ data: {
267
+ subject: node.data
268
+ }
269
+ })) : /* @__PURE__ */ React4.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React4.createElement("span", {
270
+ className: "sr-only"
271
+ }, label3), /* @__PURE__ */ React4.createElement(Icon, {
272
+ icon
273
+ }))), /* @__PURE__ */ React4.createElement(TextTooltip, {
274
+ text: label3,
275
+ onlyWhenTruncating: true
276
+ }, /* @__PURE__ */ React4.createElement(StackItem.HeadingLabel, {
277
+ "data-tauri-drag-region": true,
278
+ attendableId,
279
+ related: part === "complementary",
280
+ ...pending && {
281
+ classNames: "text-description"
282
+ }
283
+ }, label3))), debug && /* @__PURE__ */ React4.createElement("div", {
284
+ className: "flex items-center text-sm text-info-text"
285
+ }, layoutMode, ":", part, ":", companioned), node && part !== "complementary" && /* @__PURE__ */ React4.createElement(Surface.Surface, {
286
+ type: AppSurface.NavbarEnd,
287
+ data: {
288
+ subject: node.data
289
+ }
290
+ }), companioned === "companion" ? /* @__PURE__ */ React4.createElement(PlankCompanionControls, {
291
+ primary: primaryId
292
+ }) : /* @__PURE__ */ React4.createElement(PlankControls, {
293
+ capabilities,
294
+ layoutMode,
295
+ close: part === "complementary" ? "minify-end" : true,
296
+ onClick: handlePlankAction
297
+ }));
298
+ });
299
+
300
+ // src/containers/Plank/PlankError.tsx
301
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-deck/src/containers/Plank/PlankError.tsx";
302
+ var PlankError = ({ id, part, node, error: errorProp }) => {
303
+ const [timedOut, setTimedOut] = useState(false);
304
+ useEffect2(() => {
305
+ const timer = setTimeout(() => setTimedOut(true), 5e3);
306
+ return () => clearTimeout(timer);
307
+ }, []);
308
+ const error = useMemo2(() => {
309
+ if (timedOut) {
310
+ return new TimeoutError({
311
+ message: "Timeout loading content"
312
+ });
313
+ }
314
+ return errorProp;
315
+ }, [
316
+ timedOut,
317
+ errorProp
318
+ ]);
319
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(PlankHeading, {
320
+ id,
321
+ part,
322
+ node,
323
+ pending: !timedOut
324
+ }), timedOut ? /* @__PURE__ */ React5.createElement(PlankErrorFallback, {
325
+ error
326
+ }) : /* @__PURE__ */ React5.createElement(PlankLoading, null));
327
+ };
328
+ var PlankErrorFallback = ({ error }) => {
329
+ const { t } = useTranslation3(meta3.id);
330
+ useEffect2(() => {
331
+ if (error) {
332
+ log.error("plank error", {
333
+ error
334
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 44, S: void 0 });
335
+ }
336
+ }, [
337
+ error
338
+ ]);
339
+ if (process.env.NODE_ENV === "development") {
340
+ return /* @__PURE__ */ React5.createElement(ErrorFallback, {
341
+ title: "Plank Error",
342
+ error
343
+ });
344
+ } else {
345
+ const errorString = error?.toString() ?? "";
346
+ return /* @__PURE__ */ React5.createElement("div", {
347
+ role: "alert",
348
+ "data-testid": "plank-content-error",
349
+ className: "dx-attention-surface overflow-y-auto p-8 grid place-items-center"
350
+ }, /* @__PURE__ */ React5.createElement("div", {
351
+ className: "flex flex-col items-center gap-2"
352
+ }, /* @__PURE__ */ React5.createElement("p", {
353
+ className: mx(descriptionMessage, "break-all rounded-md p-4")
354
+ }, error ? errorString : t("error-fallback.message"))));
355
+ }
356
+ };
357
+
358
+ // src/containers/Plank/PlankComponent.tsx
359
+ import { useFocusFinders } from "@fluentui/react-tabster";
360
+ import React6, { memo as memo2, useCallback as useCallback3, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
361
+ import { Surface as Surface2 } from "@dxos/app-framework/ui";
362
+ import { AppSurface as AppSurface2 } from "@dxos/app-toolkit/ui";
363
+ import { debounce } from "@dxos/async";
364
+ import { mainIntrinsicSize } from "@dxos/react-ui";
365
+ import { getLinkedVariant as getLinkedVariant2 } from "@dxos/react-ui-attention";
366
+ import { useAttentionAttributes } from "@dxos/react-ui-attention";
367
+ import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
368
+ import { mx as mx2 } from "@dxos/ui-theme";
369
+ import { useMainSize } from "#hooks";
370
+ import { PLANK_COMPANION_TYPE as PLANK_COMPANION_TYPE2 } from "#types";
371
+ var smoothScrollTo = (element, target, duration) => {
372
+ const start = element.scrollLeft;
373
+ const distance = target - start;
374
+ const startTime = performance.now();
375
+ const step = (currentTime) => {
376
+ const elapsed = currentTime - startTime;
377
+ const progress = Math.min(elapsed / duration, 1);
378
+ const eased = 1 - Math.pow(1 - progress, 3);
379
+ element.scrollLeft = start + distance * eased;
380
+ if (progress < 1) {
381
+ requestAnimationFrame(step);
382
+ }
383
+ };
384
+ requestAnimationFrame(step);
385
+ };
386
+ var DEFAULT_SIZE = 48;
387
+ var DEFAULT_COMPANION_SIZE = 35;
388
+ var PlankComponent = /* @__PURE__ */ memo2(({ part, id, path, order, active, node, primary, companions, companioned }) => {
389
+ const { layoutMode, settings, popoverAnchorId, scrollIntoView, plankSizing, onResize, onScrollIntoView } = usePlankContext("PlankComponent");
390
+ const canResize = layoutMode === "multi";
391
+ const { findFirstFocusable } = useFocusFinders();
392
+ const isCompanion = companioned === "companion";
393
+ const attentionId = isCompanion ? primary?.id ?? id : id;
394
+ const attentionAttrs = useAttentionAttributes(attentionId);
395
+ const orderId = isCompanion ? primary?.id : id;
396
+ const index = orderId && active ? active.findIndex((entryId) => entryId === orderId) : -1;
397
+ const length = active?.length ?? 1;
398
+ const isOrdered = !!active && index >= 0;
399
+ const canIncrementStart = isOrdered && index > 0;
400
+ const canIncrementEnd = isOrdered && index < length - 1;
401
+ const rootElement = useRef(null);
402
+ const variant = node?.type === PLANK_COMPANION_TYPE2 ? getLinkedVariant2(id) : void 0;
403
+ const sizeAttrs = useMainSize();
404
+ const sizeKey = id.split("+")[0];
405
+ const size = isCompanion ? DEFAULT_COMPANION_SIZE : plankSizing?.[sizeKey] ?? DEFAULT_SIZE;
406
+ const handleSizeChange = useCallback3(debounce((nextSize) => {
407
+ const size2 = Math.round(nextSize);
408
+ onResize?.(sizeKey, size2);
409
+ }, 200), [
410
+ sizeKey,
411
+ onResize
412
+ ]);
413
+ const handleKeyDown = useCallback3((event) => {
414
+ if (event.target === event.currentTarget) {
415
+ switch (event.key) {
416
+ case "Escape":
417
+ rootElement.current?.closest("main")?.focus();
418
+ break;
419
+ case "Enter":
420
+ rootElement.current && findFirstFocusable(rootElement.current)?.focus();
421
+ break;
422
+ }
423
+ }
424
+ }, []);
425
+ useLayoutEffect(() => {
426
+ if (scrollIntoView === id && layoutMode === "multi" && rootElement.current) {
427
+ const element = rootElement.current;
428
+ const scrollParent = element.closest('[style*="overflow"], .overflow-x-auto');
429
+ if (scrollParent) {
430
+ const elementRect = element.getBoundingClientRect();
431
+ const parentRect = scrollParent.getBoundingClientRect();
432
+ const targetScrollLeft = scrollParent.scrollLeft + (elementRect.left - parentRect.left);
433
+ smoothScrollTo(scrollParent, targetScrollLeft, 300);
434
+ }
435
+ onScrollIntoView?.(void 0);
436
+ }
437
+ }, [
438
+ id,
439
+ scrollIntoView,
440
+ layoutMode,
441
+ onScrollIntoView
442
+ ]);
443
+ const isSolo = layoutMode.startsWith("solo") && part === "solo";
444
+ const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "multi" && part === "multi";
445
+ const attendableId = isCompanion ? primary?.id ?? id : id;
446
+ const data = useMemo3(() => node && {
447
+ attendableId,
448
+ subject: node.data,
449
+ companionTo: primary?.data,
450
+ properties: node.properties,
451
+ variant,
452
+ path,
453
+ popoverAnchorId
454
+ }, [
455
+ node,
456
+ node?.data,
457
+ node?.properties,
458
+ path,
459
+ popoverAnchorId,
460
+ primary?.data,
461
+ variant,
462
+ attendableId
463
+ ]);
464
+ const placeholder = useMemo3(() => /* @__PURE__ */ React6.createElement(PlankLoading, null), []);
465
+ const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
466
+ const fullscreen = layoutMode === "solo--fullscreen";
467
+ const classNames = [
468
+ "dx-attention-surface relative dx-focus-ring-inset-over-all dx-density-lg",
469
+ isSolo && "absolute inset-0",
470
+ isSolo && mainIntrinsicSize,
471
+ railGridHorizontal,
472
+ part.startsWith("solo") && "grid",
473
+ part.startsWith("solo-") && "grid-rows-subgrid row-span-2 min-w-0",
474
+ fullscreen && "grid-rows-1",
475
+ part === "multi" && (isCompanion ? "border-separator! border-e" : "border-separator! border-x"),
476
+ part === "solo-companion" && "border-separator! border-s",
477
+ settings?.encapsulatedPlanks && !part.startsWith("solo") && "mx-(--main-spacing) border-separator! border rounded-sm overflow-hidden"
478
+ ];
479
+ return /* @__PURE__ */ React6.createElement(Root, {
480
+ ref: rootElement,
481
+ "data-testid": "deck.plank",
482
+ "data-popover-collision-boundary": true,
483
+ tabIndex: 0,
484
+ ...part.startsWith("solo") ? {
485
+ className: mx2(classNames),
486
+ ...sizeAttrs
487
+ } : {
488
+ role: "article",
489
+ item: {
490
+ id
491
+ },
492
+ classNames,
493
+ order,
494
+ size,
495
+ onSizeChange: handleSizeChange
496
+ },
497
+ ...isAttendable ? attentionAttrs : {},
498
+ onKeyDown: handleKeyDown
499
+ }, node ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, !fullscreen && /* @__PURE__ */ React6.createElement(PlankHeading, {
500
+ id,
501
+ part: part.startsWith("solo-") ? "solo" : part,
502
+ node,
503
+ layoutMode,
504
+ deckEnabled: settings?.enableDeck,
505
+ canIncrementStart,
506
+ canIncrementEnd,
507
+ popoverAnchorId,
508
+ primaryId: primary?.id,
509
+ companioned,
510
+ companions
511
+ }), /* @__PURE__ */ React6.createElement(Surface2.Surface, {
512
+ key: node.id,
513
+ type: AppSurface2.Article,
514
+ data,
515
+ limit: 1,
516
+ fallback: PlankErrorFallback,
517
+ placeholder
518
+ })) : /* @__PURE__ */ React6.createElement(PlankError, {
519
+ id,
520
+ part
521
+ }), canResize && /* @__PURE__ */ React6.createElement(StackItem2.ResizeHandle, null));
522
+ });
523
+
524
+ // src/containers/Plank/PlankContent.tsx
525
+ import React7 from "react";
526
+ import { composable, composableProps, mainIntrinsicSize as mainIntrinsicSize2 } from "@dxos/react-ui";
527
+ import { railGridHorizontal as railGridHorizontal2 } from "@dxos/react-ui-stack";
528
+ import { useMainSize as useMainSize2 } from "#hooks";
529
+ var PlankContent = composable(({ children, solo, companion, encapsulate, ...props }, forwardedRef) => {
530
+ const sizeAttrs = useMainSize2();
531
+ if (!solo) {
532
+ return children;
533
+ }
534
+ return /* @__PURE__ */ React7.createElement("div", {
535
+ ...sizeAttrs,
536
+ ...composableProps(props, {
537
+ role: "none",
538
+ classNames: [
539
+ "absolute inset-(--main-spacing) grid",
540
+ railGridHorizontal2,
541
+ mainIntrinsicSize2,
542
+ companion && "grid-cols-[6fr_4fr]",
543
+ encapsulate && "border border-separator rounded-sm overflow-hidden"
544
+ ]
545
+ }),
546
+ "data-popover-collision-boundary": true,
547
+ ref: forwardedRef
548
+ }, children);
549
+ });
550
+
551
+ // src/containers/Plank/Plank.tsx
552
+ var Plank = {
553
+ Root: PlankRoot,
554
+ Content: PlankContent,
555
+ Component: PlankComponent,
556
+ Heading: PlankHeading,
557
+ Controls: PlankControls
558
+ };
559
+
560
+ // src/containers/Sidebar/SidebarButton.tsx
561
+ import React8, { useCallback as useCallback4 } from "react";
562
+ import { useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/ui";
563
+ import { LayoutOperation as LayoutOperation2 } from "@dxos/app-toolkit";
564
+ import { IconButton as IconButton3, useTranslation as useTranslation4 } from "@dxos/react-ui";
565
+ import { getLinkedVariant as getLinkedVariant3 } from "@dxos/react-ui-attention";
566
+ import { useDeckCompanions, useDeckState } from "#hooks";
567
+ import { meta as meta4 } from "#meta";
568
+ var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
569
+ const { updateState } = useDeckState();
570
+ const { t } = useTranslation4(meta4.id);
571
+ const handleClick = useCallback4(() => {
572
+ updateState((state) => ({
573
+ ...state,
574
+ sidebarState: state.sidebarState === "expanded" ? "collapsed" : "expanded"
575
+ }));
576
+ }, [
577
+ updateState
578
+ ]);
579
+ return /* @__PURE__ */ React8.createElement(IconButton3, {
580
+ variant,
581
+ icon: "ph--sidebar--regular",
582
+ iconOnly: true,
583
+ size: 4,
584
+ label: t("open-navigation-sidebar.label"),
585
+ onClick: handleClick,
586
+ classNames
587
+ });
588
+ };
589
+ var CloseSidebarButton = () => {
590
+ const { updateState } = useDeckState();
591
+ const { t } = useTranslation4(meta4.id);
592
+ const handleClick = useCallback4(() => {
593
+ updateState((state) => ({
594
+ ...state,
595
+ sidebarState: "collapsed"
596
+ }));
597
+ }, [
598
+ updateState
599
+ ]);
600
+ return /* @__PURE__ */ React8.createElement(IconButton3, {
601
+ variant: "ghost",
602
+ icon: "ph--caret-line-left--regular",
603
+ iconOnly: true,
604
+ size: 4,
605
+ label: t("close-navigation-sidebar.button"),
606
+ onClick: handleClick,
607
+ classNames: "rounded-none px-1 dx-focus-ring-inset pe-[max(.5rem,env(safe-area-inset-left))]"
608
+ });
609
+ };
610
+ var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
611
+ const { invokePromise } = useOperationInvoker2();
612
+ const { state, updateState } = useDeckState();
613
+ const { t } = useTranslation4(meta4.id);
614
+ const companions = useDeckCompanions();
615
+ const handleClick = useCallback4(() => {
616
+ const nextState = state.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
617
+ updateState((state2) => ({
618
+ ...state2,
619
+ complementarySidebarState: nextState
620
+ }));
621
+ const subject = state.complementarySidebarPanel ?? (companions[0] && getLinkedVariant3(companions[0].id));
622
+ if (nextState === "expanded" && !current && subject) {
623
+ void invokePromise(LayoutOperation2.UpdateComplementary, {
624
+ subject
625
+ });
626
+ }
627
+ }, [
628
+ state,
629
+ updateState,
630
+ current,
631
+ companions,
632
+ invokePromise
633
+ ]);
634
+ const label3 = t(state.complementarySidebarState === "expanded" ? "close-complementary-sidebar.label" : "open-complementary-sidebar.label");
635
+ return /* @__PURE__ */ React8.createElement(IconButton3, {
636
+ variant: "ghost",
637
+ classNames: [
638
+ "[&>svg]:-scale-x-100",
639
+ classNames
640
+ ],
641
+ icon: "ph--sidebar-simple--regular",
642
+ iconOnly: true,
643
+ label: label3,
644
+ tooltipSide: inR0 ? "left" : void 0,
645
+ onClick: handleClick
646
+ });
647
+ };
648
+
649
+ // src/containers/Sidebar/ComplementarySidebar.tsx
650
+ import React9, { useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo4, useState as useState2 } from "react";
651
+ import { Surface as Surface3, useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
652
+ import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
653
+ import { IconButton as IconButton4, Main, Panel, toLocalizedString as toLocalizedString2, Toolbar, useTranslation as useTranslation5 } from "@dxos/react-ui";
654
+ import { getLinkedVariant as getLinkedVariant4 } from "@dxos/react-ui-attention";
655
+ import { Tabs } from "@dxos/react-ui-tabs";
656
+ import { iconSize as iconSize2, mx as mx3 } from "@dxos/ui-theme";
657
+ import { useBreakpoints as useBreakpoints2, useDeckCompanions as useDeckCompanions2, useDeckState as useDeckState2 } from "#hooks";
658
+ import { meta as meta5 } from "#meta";
659
+ import { getMode } from "#types";
660
+ var label = [
661
+ "complementary-sidebar.title",
662
+ {
663
+ ns: meta5.id
664
+ }
665
+ ];
666
+ var ComplementarySidebar = ({ current }) => {
667
+ const { invokePromise } = useOperationInvoker3();
668
+ const { t } = useTranslation5(meta5.id);
669
+ const { state, deck, updateState } = useDeckState2();
670
+ const layoutMode = getMode(deck);
671
+ const breakpoint = useBreakpoints2();
672
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
673
+ const companions = useDeckCompanions2();
674
+ const activeCompanion = companions.find((companion) => getLinkedVariant4(companion.id) === current);
675
+ const activeId = activeCompanion && getLinkedVariant4(activeCompanion.id);
676
+ const [internalValue, setInternalValue] = useState2(activeId);
677
+ useEffect3(() => {
678
+ setInternalValue(activeId);
679
+ }, [
680
+ activeId
681
+ ]);
682
+ const handleTabClick = useCallback5((event) => {
683
+ const nextValue = event.currentTarget.getAttribute("data-value");
684
+ if (nextValue === activeId) {
685
+ updateState((state2) => ({
686
+ ...state2,
687
+ complementarySidebarState: state2.complementarySidebarState === "expanded" ? "collapsed" : "expanded"
688
+ }));
689
+ } else {
690
+ setInternalValue(nextValue);
691
+ updateState((state2) => ({
692
+ ...state2,
693
+ complementarySidebarState: "expanded"
694
+ }));
695
+ void invokePromise(LayoutOperation3.UpdateComplementary, {
696
+ subject: nextValue
697
+ });
698
+ }
699
+ }, [
700
+ state.complementarySidebarState,
701
+ activeId,
702
+ invokePromise,
703
+ updateState
704
+ ]);
705
+ const data = useMemo4(() => activeCompanion && {
706
+ id: activeCompanion.id,
707
+ subject: activeCompanion.data
708
+ }, [
709
+ activeCompanion?.id,
710
+ activeCompanion?.data
711
+ ]);
712
+ useEffect3(() => {
713
+ if (!activeId) {
714
+ void invokePromise(LayoutOperation3.UpdateComplementary, {
715
+ state: "collapsed"
716
+ });
717
+ }
718
+ }, [
719
+ activeId,
720
+ invokePromise
721
+ ]);
722
+ return /* @__PURE__ */ React9.createElement(Main.ComplementarySidebar, {
723
+ label,
724
+ classNames: [
725
+ topbar && "top-[calc(env(safe-area-inset-top)+var(--dx-rail-size))]"
726
+ ]
727
+ }, /* @__PURE__ */ React9.createElement(Tabs.Root, {
728
+ classNames: "contents",
729
+ orientation: "vertical",
730
+ value: internalValue
731
+ }, /* @__PURE__ */ React9.createElement("div", {
732
+ "data-tauri-drag-region": true,
733
+ style: iconSize2(5),
734
+ className: mx3("absolute z-1 inset-y-0 end-0 w-(--dx-r0-size)!", "py-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] border-s border-subdued-separator", "grid grid-cols-1 grid-rows-[1fr_min-content] bg-r0-surface dx-contain-layout dx-app-drag")
735
+ }, /* @__PURE__ */ React9.createElement(Tabs.Tablist, {
736
+ classNames: "grid grid-cols-1 auto-rows-(--dx-rail-action) overflow-y-auto scrollbar-none gap-1 p-1"
737
+ }, companions.map((companion) => /* @__PURE__ */ React9.createElement(Tabs.Tab, {
738
+ key: getLinkedVariant4(companion.id),
739
+ value: getLinkedVariant4(companion.id),
740
+ asChild: true
741
+ }, /* @__PURE__ */ React9.createElement(IconButton4, {
742
+ classNames: "w-(--dx-rail-action) h-(--dx-rail-action) min-h-0 px-0",
743
+ label: toLocalizedString2(companion.properties.label, t),
744
+ icon: companion.properties.icon,
745
+ iconOnly: true,
746
+ tooltipSide: "left",
747
+ "data-value": getLinkedVariant4(companion.id),
748
+ ...companion.properties.joyride && {
749
+ "data-joyride": companion.properties.joyride
750
+ },
751
+ variant: activeId === getLinkedVariant4(companion.id) ? state.complementarySidebarState === "expanded" ? "primary" : "ghost" : "ghost",
752
+ onClick: handleTabClick
753
+ })))), /* @__PURE__ */ React9.createElement("div", {
754
+ className: "grid grid-cols-1 auto-rows-(--dx-rail-item) py-0.5 gap-0.5 overflow-y-auto scrollbar-none",
755
+ style: iconSize2(4)
756
+ }, /* @__PURE__ */ React9.createElement(Surface3.Surface, {
757
+ role: "status-indicator"
758
+ })), /* @__PURE__ */ React9.createElement("div", {
759
+ className: "hidden lg:grid grid-cols-1 auto-rows-(--dx-rail-action) p-1"
760
+ }, /* @__PURE__ */ React9.createElement(ToggleComplementarySidebarButton, null))), activeId && companions.map((companion) => /* @__PURE__ */ React9.createElement(Tabs.Panel, {
761
+ key: getLinkedVariant4(companion.id),
762
+ value: getLinkedVariant4(companion.id),
763
+ classNames: [
764
+ 'absolute data-[state="inactive"]:-z-[1] overflow-hidden',
765
+ "inset-y-0 start-0 w-full lg:w-(--dx-r1-size)"
766
+ ],
767
+ ...state.complementarySidebarState !== "expanded" && {
768
+ inert: true
769
+ }
770
+ }, /* @__PURE__ */ React9.createElement(ComplementarySidebarPanel, {
771
+ companion,
772
+ activeId,
773
+ data
774
+ })))));
775
+ };
776
+ var ComplementarySidebarPanel = ({ companion, activeId, data }) => {
777
+ const { t } = useTranslation5(meta5.id);
778
+ if (getLinkedVariant4(companion.id) !== activeId && !data) {
779
+ return null;
780
+ }
781
+ return /* @__PURE__ */ React9.createElement(Panel.Root, null, /* @__PURE__ */ React9.createElement(Panel.Toolbar, {
782
+ asChild: true,
783
+ size: "lg"
784
+ }, /* @__PURE__ */ React9.createElement(Toolbar.Root, {
785
+ style: iconSize2(5),
786
+ classNames: "bg-header-surface"
787
+ }, /* @__PURE__ */ React9.createElement(IconButton4, {
788
+ classNames: "w-(--dx-rail-action) h-(--dx-rail-action) min-h-0 px-0",
789
+ label: toLocalizedString2(companion.properties.label, t),
790
+ icon: companion.properties.icon,
791
+ iconOnly: true,
792
+ tooltipSide: "left",
793
+ "data-value": getLinkedVariant4(companion.id),
794
+ variant: "default"
795
+ }), /* @__PURE__ */ React9.createElement("div", {
796
+ className: "px-1"
797
+ }, toLocalizedString2(companion.properties.label, t)))), /* @__PURE__ */ React9.createElement(Panel.Content, {
798
+ classNames: "bg-r1-surface"
799
+ }, /* @__PURE__ */ React9.createElement(Surface3.Surface, {
800
+ role: `deck-companion--${getLinkedVariant4(companion.id)}`,
801
+ data,
802
+ fallback: PlankErrorFallback,
803
+ placeholder: /* @__PURE__ */ React9.createElement(PlankLoading, null)
804
+ })));
805
+ };
806
+
807
+ // src/containers/Sidebar/Sidebar.tsx
808
+ import React10, { useMemo as useMemo5 } from "react";
809
+ import { Surface as Surface4 } from "@dxos/app-framework/ui";
810
+ import { AppSurface as AppSurface3 } from "@dxos/app-toolkit/ui";
811
+ import { Main as Main2 } from "@dxos/react-ui";
812
+ import { useBreakpoints as useBreakpoints3, useDeckState as useDeckState3 } from "#hooks";
813
+ import { meta as meta6 } from "#meta";
814
+ import { getMode as getMode2 } from "#types";
815
+ var label2 = [
816
+ "sidebar.title",
817
+ {
818
+ ns: meta6.id
819
+ }
820
+ ];
821
+ var Sidebar = () => {
822
+ const { state, deck } = useDeckState3();
823
+ const { popoverAnchorId, activeDeck: current } = state;
824
+ const breakpoint = useBreakpoints3();
825
+ const layoutMode = getMode2(deck);
826
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
827
+ const navigationData = useMemo5(() => ({
828
+ popoverAnchorId,
829
+ topbar,
830
+ current
831
+ }), [
832
+ popoverAnchorId,
833
+ topbar,
834
+ current
835
+ ]);
836
+ return /* @__PURE__ */ React10.createElement(Main2.NavigationSidebar, {
837
+ label: label2,
838
+ classNames: [
839
+ "grid",
840
+ topbar && "top-[calc(env(safe-area-inset-top)+var(--dx-rail-size))]"
841
+ ]
842
+ }, /* @__PURE__ */ React10.createElement(Surface4.Surface, {
843
+ type: AppSurface3.Navigation,
844
+ data: navigationData,
845
+ limit: 1
846
+ }));
847
+ };
848
+
849
+ // src/containers/Deck/DeckContent.tsx
850
+ import React13, { useCallback as useCallback6, useEffect as useEffect4, useRef as useRef2 } from "react";
851
+ import { AttentionCapabilities } from "@dxos/plugin-attention";
852
+ import { Main as Main3, useMediaQuery } from "@dxos/react-ui";
853
+ import { useBreakpoints as useBreakpoints4 } from "#hooks";
854
+
855
+ // src/containers/Deck/Banner.tsx
856
+ import React11 from "react";
857
+ import { Surface as Surface5 } from "@dxos/app-framework/ui";
858
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
859
+ import { mx as mx4, osTranslations } from "@dxos/ui-theme";
860
+ import { meta as meta7 } from "#meta";
861
+ var Banner = ({ variant, classNames }) => {
862
+ const { t } = useTranslation6(meta7.id);
863
+ return /* @__PURE__ */ React11.createElement("header", {
864
+ className: mx4("flex items-stretch relative py-1 ps-1 pe-2", variant === "topbar" && "fixed inset-x-0 top-[env(safe-area-inset-top)] h-(--dx-rail-size) border-b border-separator", classNames)
865
+ }, variant === "sidebar" ? /* @__PURE__ */ React11.createElement(CloseSidebarButton, null) : /* @__PURE__ */ React11.createElement(ToggleSidebarButton, null), /* @__PURE__ */ React11.createElement("span", {
866
+ className: "self-center grow ms-1"
867
+ }, t("current-app.name", {
868
+ ns: osTranslations
869
+ })), variant === "topbar" && /* @__PURE__ */ React11.createElement("div", {
870
+ className: "absolute inset-0 pointer-events-none"
871
+ }, /* @__PURE__ */ React11.createElement("div", {
872
+ className: "grid h-full pointer-fine:p-1 max-w-md mx-auto pointer-events-auto"
873
+ }, /* @__PURE__ */ React11.createElement(Surface5.Surface, {
874
+ role: "search-input",
875
+ limit: 1
876
+ }))), /* @__PURE__ */ React11.createElement("span", {
877
+ className: "grow"
878
+ }), /* @__PURE__ */ React11.createElement(Surface5.Surface, {
879
+ role: "version-info",
880
+ limit: 1
881
+ }), /* @__PURE__ */ React11.createElement(Surface5.Surface, {
882
+ role: "notch-start",
883
+ limit: 1
884
+ }));
885
+ };
886
+
887
+ // src/containers/Deck/DeckRoot.tsx
888
+ import { createContext as createContext2 } from "@radix-ui/react-context";
889
+ import React12 from "react";
890
+ var DECK_NAME = "Deck";
891
+ var DECK_ROOT_NAME = "DeckRoot";
892
+ var [DeckProvider, useDeckContext] = createContext2(DECK_NAME);
893
+ var DeckRoot = ({ children, ...context }) => {
894
+ return /* @__PURE__ */ React12.createElement(DeckProvider, context, children);
895
+ };
896
+ DeckRoot.displayName = DECK_ROOT_NAME;
897
+
898
+ // src/containers/Deck/DeckContent.tsx
899
+ var DECK_CONTENT_NAME = "DeckContent";
900
+ var DeckContent = ({ children }) => {
901
+ const { state: { sidebarState, complementarySidebarState, complementarySidebarPanel }, deck: { active, fullscreen, solo }, updateState, layoutMode, settings, pluginManager, onLayoutChange } = useDeckContext(DECK_CONTENT_NAME);
902
+ const breakpoint = useBreakpoints4();
903
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
904
+ useEffect4(() => {
905
+ const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
906
+ const attended = attention.getCurrent();
907
+ const firstId = solo ?? active[0];
908
+ if (attended.length === 0 && firstId) {
909
+ document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
910
+ }
911
+ }, []);
912
+ const [isNotMobile] = useMediaQuery("md");
913
+ const shouldRevert = useRef2(false);
914
+ useEffect4(() => {
915
+ if (!isNotMobile && layoutMode === "multi") {
916
+ const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
917
+ const attended = attention.getCurrent();
918
+ shouldRevert.current = true;
919
+ onLayoutChange({
920
+ subject: attended[0],
921
+ mode: "solo"
922
+ });
923
+ } else if (isNotMobile && layoutMode === "solo" && shouldRevert.current) {
924
+ onLayoutChange({
925
+ revert: true
926
+ });
927
+ }
928
+ }, [
929
+ isNotMobile,
930
+ layoutMode,
931
+ onLayoutChange
932
+ ]);
933
+ useEffect4(() => {
934
+ if (!settings?.enableDeck && layoutMode === "multi") {
935
+ onLayoutChange({
936
+ subject: active[0],
937
+ mode: "solo"
938
+ });
939
+ }
940
+ }, [
941
+ settings?.enableDeck,
942
+ onLayoutChange,
943
+ active,
944
+ layoutMode
945
+ ]);
946
+ const handleNavigationSidebarStateChange = useCallback6((next) => {
947
+ updateState((s) => ({
948
+ ...s,
949
+ sidebarState: next
950
+ }));
951
+ }, [
952
+ updateState
953
+ ]);
954
+ const handleComplementarySidebarStateChange = useCallback6((next) => {
955
+ updateState((s) => ({
956
+ ...s,
957
+ complementarySidebarState: next
958
+ }));
959
+ }, [
960
+ updateState
961
+ ]);
962
+ return /* @__PURE__ */ React13.createElement(Main3.Root, {
963
+ navigationSidebarState: fullscreen ? "closed" : sidebarState,
964
+ complementarySidebarState: fullscreen ? "closed" : complementarySidebarState,
965
+ onNavigationSidebarStateChange: handleNavigationSidebarStateChange,
966
+ onComplementarySidebarStateChange: handleComplementarySidebarStateChange
967
+ }, /* @__PURE__ */ React13.createElement(Sidebar, null), /* @__PURE__ */ React13.createElement(ComplementarySidebar, {
968
+ current: complementarySidebarPanel
969
+ }), /* @__PURE__ */ React13.createElement(Main3.Overlay, null), children, topbar && /* @__PURE__ */ React13.createElement(Banner, {
970
+ variant: "topbar"
971
+ }));
972
+ };
973
+ DeckContent.displayName = DECK_CONTENT_NAME;
974
+
975
+ // src/containers/Deck/DeckViewport.tsx
976
+ import React14, { Fragment as Fragment2, memo as memo3, useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3 } from "react";
977
+ import { Surface as Surface6, useOperationInvoker as useOperationInvoker4 } from "@dxos/app-framework/ui";
978
+ import { LayoutOperation as LayoutOperation4 } from "@dxos/app-toolkit";
979
+ import { useAppGraph } from "@dxos/app-toolkit/ui";
980
+ import { addEventListener } from "@dxos/async";
981
+ import { invariant } from "@dxos/invariant";
982
+ import { useNode } from "@dxos/plugin-graph";
983
+ import { IconButton as IconButton5, Main as Main4, useOnTransition, useTranslation as useTranslation7 } from "@dxos/react-ui";
984
+ import { mainPaddingTransitions } from "@dxos/react-ui";
985
+ import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from "@dxos/react-ui-stack";
986
+ import { hoverableControls as hoverableControls2, hoverableFocusedWithinControls as hoverableFocusedWithinControls2, mx as mx5 } from "@dxos/ui-theme";
987
+ import { useBreakpoints as useBreakpoints5, useCompanions, useDeckState as useDeckState4, useSelectedCompanion } from "#hooks";
988
+ import { meta as meta8 } from "#meta";
989
+ import { DeckOperation } from "#types";
990
+ import { getMode as getMode3 } from "#types";
991
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-deck/src/containers/Deck/DeckViewport.tsx";
992
+ var DECK_VIEWPORT_NAME = "DeckViewport";
993
+ var DeckViewport = ({ children }) => {
994
+ const { deck: { active, plankSizing }, state: { sidebarState, complementarySidebarState }, settings, layoutMode } = useDeckContext(DECK_VIEWPORT_NAME);
995
+ const breakpoint = useBreakpoints5();
996
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
997
+ return /* @__PURE__ */ React14.createElement(Main4.Content, {
998
+ bounce: true,
999
+ handlesFocus: true,
1000
+ classNames: [
1001
+ "grid top-[env(safe-area-inset-top)]!",
1002
+ topbar && "top-[calc(env(safe-area-inset-top)+var(--dx-rail-size))]!"
1003
+ ],
1004
+ style: {
1005
+ "--main-spacing": settings?.encapsulatedPlanks ? "0.75rem" : "0",
1006
+ "--main-sidebar-width": sidebarState === "expanded" ? "var(--dx-nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--dx-l0-size)" : "0",
1007
+ "--main-complementary-width": complementarySidebarState === "expanded" ? "var(--dx-complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--dx-rail-size)" : "0",
1008
+ "--main-content-first-width": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
1009
+ "--main-content-last-width": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
1010
+ }
1011
+ }, children);
1012
+ };
1013
+ DeckViewport.displayName = DECK_VIEWPORT_NAME;
1014
+ var DeckContentEmpty = () => {
1015
+ const breakpoint = useBreakpoints5();
1016
+ const { deck } = useDeckState4();
1017
+ const layoutMode = getMode3(deck);
1018
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
1019
+ return /* @__PURE__ */ React14.createElement("div", {
1020
+ className: "grid place-items-center p-8 relative bg-deck-surface",
1021
+ "data-testid": "layoutPlugin.firstRunMessage"
1022
+ }, /* @__PURE__ */ React14.createElement(Surface6.Surface, {
1023
+ role: "keyshortcuts"
1024
+ }), !topbar && /* @__PURE__ */ React14.createElement(ToggleSidebarButton2, null));
1025
+ };
1026
+ var DeckSoloMode = () => {
1027
+ const { deck, settings, layoutMode, onLayoutChange } = useDeckContext("DeckSoloMode");
1028
+ const { companionOpen, companionVariant, fullscreen, solo } = deck;
1029
+ const effectiveCompanionVariant = fullscreen ? void 0 : companionOpen ? companionVariant : void 0;
1030
+ const breakpoint = useBreakpoints5();
1031
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
1032
+ invariant(solo, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 73, S: void 0, A: ["solo", ""] });
1033
+ useEffect5(() => {
1034
+ if (!fullscreen) {
1035
+ return;
1036
+ }
1037
+ const handleKeyDown = (event) => {
1038
+ if (event.key === "Escape") {
1039
+ event.preventDefault();
1040
+ event.stopPropagation();
1041
+ onLayoutChange({
1042
+ mode: "solo--fullscreen"
1043
+ });
1044
+ }
1045
+ };
1046
+ document.addEventListener("keydown", handleKeyDown);
1047
+ return () => document.removeEventListener("keydown", handleKeyDown);
1048
+ }, [
1049
+ fullscreen,
1050
+ onLayoutChange
1051
+ ]);
1052
+ return /* @__PURE__ */ React14.createElement("div", {
1053
+ className: "relative overflow-hidden bg-deck-surface"
1054
+ }, /* @__PURE__ */ React14.createElement(DeckSidebarToggles, {
1055
+ topbar,
1056
+ fullscreen
1057
+ }), fullscreen && /* @__PURE__ */ React14.createElement(ExitFullscreenButton, {
1058
+ onExit: () => onLayoutChange({
1059
+ mode: "solo--fullscreen"
1060
+ })
1061
+ }), /* @__PURE__ */ React14.createElement(StackContext.Provider, {
1062
+ value: {
1063
+ orientation: "horizontal",
1064
+ size: "contain",
1065
+ rail: true
1066
+ }
1067
+ }, /* @__PURE__ */ React14.createElement(PlankContainer, {
1068
+ id: solo,
1069
+ part: "solo",
1070
+ layoutMode,
1071
+ companionVariant: effectiveCompanionVariant,
1072
+ settings
1073
+ })));
1074
+ };
1075
+ var DeckMultiMode = () => {
1076
+ const { deck: { active, companionVariant, fullscreen }, settings, layoutMode } = useDeckContext("DeckMultiMode");
1077
+ const effectiveCompanionVariant = companionVariant;
1078
+ const lastPlankId = active[active.length - 1];
1079
+ const lastPlankCompanions = useCompanions(lastPlankId);
1080
+ const breakpoint = useBreakpoints5();
1081
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
1082
+ const deckRef = useRef3(null);
1083
+ const scrollLeftRef = useRef3(null);
1084
+ useEffect5(() => addEventListener(window, "resize", () => {
1085
+ scrollLeftRef.current = null;
1086
+ }), []);
1087
+ const restoreScroll = useCallback7(() => {
1088
+ if (deckRef.current && scrollLeftRef.current != null) {
1089
+ deckRef.current.scrollLeft = scrollLeftRef.current;
1090
+ }
1091
+ }, []);
1092
+ useOnTransition(layoutMode, (mode) => mode !== "multi", "multi", restoreScroll);
1093
+ const handleScroll = useCallback7((event) => {
1094
+ if (event.currentTarget === event.target) {
1095
+ scrollLeftRef.current = event.target.scrollLeft;
1096
+ }
1097
+ }, []);
1098
+ const { order, itemsCount } = useMemo6(() => {
1099
+ const lastHasCompanions = lastPlankCompanions.length > 0;
1100
+ return active.reduce((acc, entryId, index) => {
1101
+ const isLastPlank = index === active.length - 1;
1102
+ acc.order[entryId] = acc.itemsCount + 1;
1103
+ acc.itemsCount += lastHasCompanions && isLastPlank ? 3 : 2;
1104
+ return acc;
1105
+ }, {
1106
+ order: {},
1107
+ itemsCount: 0
1108
+ });
1109
+ }, [
1110
+ active,
1111
+ lastPlankCompanions.length
1112
+ ]);
1113
+ return /* @__PURE__ */ React14.createElement("div", {
1114
+ className: "relative bg-deck-surface overflow-hidden"
1115
+ }, /* @__PURE__ */ React14.createElement(DeckSidebarToggles, {
1116
+ topbar,
1117
+ fullscreen
1118
+ }), /* @__PURE__ */ React14.createElement(Stack, {
1119
+ classNames: [
1120
+ "absolute h-[calc(100%-2*var(--main-spacing))] w-full inset-y-(--main-spacing) -inset-w-px",
1121
+ mainPaddingTransitions
1122
+ ],
1123
+ orientation: "horizontal",
1124
+ size: "contain",
1125
+ itemsCount: itemsCount - 1,
1126
+ onScroll: handleScroll,
1127
+ ref: deckRef
1128
+ }, active.map((entryId) => /* @__PURE__ */ React14.createElement(Fragment2, {
1129
+ key: entryId
1130
+ }, /* @__PURE__ */ React14.createElement(PlankSeparator, {
1131
+ hidden: true,
1132
+ order: order[entryId] - 1,
1133
+ encapsulate: !!settings?.encapsulatedPlanks
1134
+ }), /* @__PURE__ */ React14.createElement(PlankContainer, {
1135
+ id: entryId,
1136
+ part: "multi",
1137
+ active,
1138
+ order: order[entryId],
1139
+ layoutMode,
1140
+ companionVariant: effectiveCompanionVariant,
1141
+ settings
1142
+ })))));
1143
+ };
1144
+ var sidebarToggleStyles = "h-(--dx-rail-item) w-(--dx-rail-item) absolute bottom-2 z-[1] bg-deck-surface! lg:hidden";
1145
+ var ToggleSidebarButton2 = () => /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
1146
+ classNames: mx5(sidebarToggleStyles, "left-2")
1147
+ });
1148
+ var ToggleComplementarySidebarButton2 = () => /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
1149
+ classNames: mx5(sidebarToggleStyles, "right-2")
1150
+ });
1151
+ var ExitFullscreenButton = ({ onExit }) => {
1152
+ const { t } = useTranslation7(meta8.id);
1153
+ return /* @__PURE__ */ React14.createElement("div", {
1154
+ className: mx5("fixed top-2 right-2 z-[1]", hoverableControls2, hoverableFocusedWithinControls2, "transition-opacity opacity-(--controls-opacity)")
1155
+ }, /* @__PURE__ */ React14.createElement(IconButton5, {
1156
+ label: t("exit-fullscreen.label"),
1157
+ icon: "ph--corners-in--regular",
1158
+ iconOnly: true,
1159
+ variant: "ghost",
1160
+ tooltipSide: "bottom",
1161
+ onClick: onExit
1162
+ }));
1163
+ };
1164
+ var DeckSidebarToggles = ({ topbar, fullscreen }) => {
1165
+ if (topbar || fullscreen) {
1166
+ return null;
1167
+ }
1168
+ return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(ToggleSidebarButton2, null), /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton2, null));
1169
+ };
1170
+ var PlankSeparator = ({ order, hidden, encapsulate }) => order > 0 && /* @__PURE__ */ React14.createElement("span", {
1171
+ role: "separator",
1172
+ className: mx5("row-span-2 bg-deck-surface", hidden && "hidden", encapsulate ? "w-0" : "w-4"),
1173
+ style: {
1174
+ gridColumn: order
1175
+ }
1176
+ });
1177
+ var PlankContainer = /* @__PURE__ */ memo3(({ id, layoutMode, part, order, settings, companionVariant, active, ...props }) => {
1178
+ const { graph } = useAppGraph();
1179
+ const { invokePromise } = useOperationInvoker4();
1180
+ const { state, deck } = useDeckState4();
1181
+ const node = useNode(graph, id);
1182
+ const companions = useCompanions(id);
1183
+ const isLastPlankInMulti = layoutMode === "multi" && active && active.length > 0 && active[active.length - 1] === id;
1184
+ const variantForThisPlank = layoutMode === "multi" ? isLastPlankInMulti ? companionVariant : void 0 : companionVariant;
1185
+ const { companionId } = useSelectedCompanion(companions, variantForThisPlank);
1186
+ const resolvedCompanionId = layoutMode === "multi" && isLastPlankInMulti && companions.length > 0 ? companionId : variantForThisPlank ? companionId : void 0;
1187
+ const currentCompanion = companions.find(({ id: id2 }) => id2 === resolvedCompanionId);
1188
+ const hasCompanion = !!(resolvedCompanionId && currentCompanion);
1189
+ const handleAdjust = useCallback7((plankId, type) => {
1190
+ if (type === "close") {
1191
+ if (part === "complementary") {
1192
+ return invokePromise(LayoutOperation4.UpdateComplementary, {
1193
+ state: "collapsed"
1194
+ });
1195
+ } else if (active) {
1196
+ const index = active.indexOf(plankId);
1197
+ const toClose = index !== -1 ? active.slice(index) : [
1198
+ plankId
1199
+ ];
1200
+ return invokePromise(LayoutOperation4.Close, {
1201
+ subject: toClose
1202
+ });
1203
+ } else {
1204
+ return invokePromise(LayoutOperation4.Close, {
1205
+ subject: [
1206
+ plankId
1207
+ ]
1208
+ });
1209
+ }
1210
+ } else {
1211
+ return invokePromise(DeckOperation.Adjust, {
1212
+ type,
1213
+ id: plankId
1214
+ });
1215
+ }
1216
+ }, [
1217
+ invokePromise,
1218
+ part,
1219
+ active
1220
+ ]);
1221
+ const handleResize = useCallback7((plankId, size) => invokePromise(DeckOperation.UpdatePlankSize, {
1222
+ id: plankId,
1223
+ size
1224
+ }), [
1225
+ invokePromise
1226
+ ]);
1227
+ const handleScrollIntoView = useCallback7((subject) => invokePromise(LayoutOperation4.ScrollIntoView, {
1228
+ subject
1229
+ }), [
1230
+ invokePromise
1231
+ ]);
1232
+ const handleUpdateCompanion = useCallback7((companion) => invokePromise(LayoutOperation4.UpdateCompanion, {
1233
+ subject: companion
1234
+ }), [
1235
+ invokePromise
1236
+ ]);
1237
+ return /* @__PURE__ */ React14.createElement(Plank.Root, {
1238
+ graph,
1239
+ layoutMode,
1240
+ part,
1241
+ settings,
1242
+ popoverAnchorId: state.popoverAnchorId,
1243
+ scrollIntoView: state.scrollIntoView,
1244
+ plankSizing: deck.plankSizing,
1245
+ onAdjust: handleAdjust,
1246
+ onResize: handleResize,
1247
+ onScrollIntoView: handleScrollIntoView,
1248
+ onUpdateCompanion: handleUpdateCompanion
1249
+ }, /* @__PURE__ */ React14.createElement(Plank.Content, {
1250
+ solo: part === "solo",
1251
+ companion: hasCompanion,
1252
+ encapsulate: !!settings?.encapsulatedPlanks
1253
+ }, /* @__PURE__ */ React14.createElement(Plank.Component, {
1254
+ ...props,
1255
+ active,
1256
+ id,
1257
+ node,
1258
+ companioned: hasCompanion ? "primary" : void 0,
1259
+ companions: hasCompanion ? [] : companions,
1260
+ order,
1261
+ ...part === "solo" ? {
1262
+ part: "solo-primary"
1263
+ } : {
1264
+ part
1265
+ }
1266
+ }), hasCompanion && /* @__PURE__ */ React14.createElement(Plank.Component, {
1267
+ ...props,
1268
+ active,
1269
+ id: resolvedCompanionId,
1270
+ node: currentCompanion,
1271
+ companions,
1272
+ companioned: "companion",
1273
+ primary: node,
1274
+ ...part === "solo" ? {
1275
+ order,
1276
+ part: "solo-companion"
1277
+ } : {
1278
+ order: (order ?? 0) + 1,
1279
+ part
1280
+ }
1281
+ })));
1282
+ });
1283
+
1284
+ // src/containers/Deck/Deck.tsx
1285
+ var Deck = {
1286
+ Root: DeckRoot,
1287
+ Content: DeckContent,
1288
+ Viewport: DeckViewport,
1289
+ ContentEmpty: DeckContentEmpty,
1290
+ MultiMode: DeckMultiMode,
1291
+ SoloMode: DeckSoloMode
1292
+ };
1293
+
1294
+ export {
1295
+ PlankLoading,
1296
+ PlankError,
1297
+ PlankErrorFallback,
1298
+ Plank,
1299
+ ToggleSidebarButton,
1300
+ CloseSidebarButton,
1301
+ ToggleComplementarySidebarButton,
1302
+ ComplementarySidebar,
1303
+ Sidebar,
1304
+ Deck
1305
+ };
1306
+ //# sourceMappingURL=chunk-WAXJPQJI.mjs.map