@dxos/plugin-deck 0.8.4-main.3f58842 → 0.8.4-main.52d7546f51

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 (281) hide show
  1. package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs +121 -0
  2. package/dist/lib/browser/app-graph-builder-X7LCO5KE.mjs.map +7 -0
  3. package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs +32 -0
  4. package/dist/lib/browser/check-app-scheme-PGISDJX7.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-DONG2FYU.mjs +295 -0
  6. package/dist/lib/browser/chunk-DONG2FYU.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-JGC4ZLG3.mjs +1469 -0
  8. package/dist/lib/browser/chunk-JGC4ZLG3.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-CNTGBCMK.mjs → chunk-NHABISX2.mjs} +40 -33
  10. package/dist/lib/browser/chunk-NHABISX2.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-YT3AJVUU.mjs +161 -0
  12. package/dist/lib/browser/chunk-YT3AJVUU.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +89 -75
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs +597 -0
  17. package/dist/lib/browser/operation-resolver-XJFR3PNQ.mjs.map +7 -0
  18. package/dist/lib/browser/react-root-AJFHKHRL.mjs +47 -0
  19. package/dist/lib/browser/react-root-AJFHKHRL.mjs.map +7 -0
  20. package/dist/lib/browser/react-surface-KBRBGEXY.mjs +43 -0
  21. package/dist/lib/browser/react-surface-KBRBGEXY.mjs.map +7 -0
  22. package/dist/lib/browser/settings-ES42FGLG.mjs +38 -0
  23. package/dist/lib/browser/settings-ES42FGLG.mjs.map +7 -0
  24. package/dist/lib/browser/state-YMI6IDEL.mjs +104 -0
  25. package/dist/lib/browser/state-YMI6IDEL.mjs.map +7 -0
  26. package/dist/lib/browser/toolkit-VRD54KY3.mjs +54 -0
  27. package/dist/lib/browser/toolkit-VRD54KY3.mjs.map +7 -0
  28. package/dist/lib/browser/types/index.mjs +11 -4
  29. package/dist/lib/browser/url-handler-37UPOB3U.mjs +94 -0
  30. package/dist/lib/browser/url-handler-37UPOB3U.mjs.map +7 -0
  31. package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs +122 -0
  32. package/dist/lib/node-esm/app-graph-builder-US54I64T.mjs.map +7 -0
  33. package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs +33 -0
  34. package/dist/lib/node-esm/check-app-scheme-CK6EVG5D.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-7NPS347C.mjs +1470 -0
  36. package/dist/lib/node-esm/chunk-7NPS347C.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-ADPMWKLL.mjs +154 -0
  38. package/dist/lib/node-esm/chunk-ADPMWKLL.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-CVYHPJIN.mjs +297 -0
  40. package/dist/lib/node-esm/chunk-CVYHPJIN.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs +162 -0
  42. package/dist/lib/node-esm/chunk-ZMJPCZ3V.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +183 -0
  44. package/dist/lib/node-esm/index.mjs.map +7 -0
  45. package/dist/lib/node-esm/meta.json +1 -0
  46. package/dist/lib/node-esm/operation-resolver-ZQGNATPX.mjs +598 -0
  47. package/dist/lib/node-esm/operation-resolver-ZQGNATPX.mjs.map +7 -0
  48. package/dist/lib/node-esm/react-root-2S77ABBS.mjs +48 -0
  49. package/dist/lib/node-esm/react-root-2S77ABBS.mjs.map +7 -0
  50. package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs +44 -0
  51. package/dist/lib/node-esm/react-surface-FIHMAFXH.mjs.map +7 -0
  52. package/dist/lib/node-esm/settings-E3TH3FAW.mjs +39 -0
  53. package/dist/lib/node-esm/settings-E3TH3FAW.mjs.map +7 -0
  54. package/dist/lib/node-esm/state-WQEFBQMD.mjs +105 -0
  55. package/dist/lib/node-esm/state-WQEFBQMD.mjs.map +7 -0
  56. package/dist/lib/node-esm/toolkit-ME546G5T.mjs +55 -0
  57. package/dist/lib/node-esm/toolkit-ME546G5T.mjs.map +7 -0
  58. package/dist/lib/node-esm/types/index.mjs +40 -0
  59. package/dist/lib/node-esm/url-handler-2KYHXINK.mjs +95 -0
  60. package/dist/lib/node-esm/url-handler-2KYHXINK.mjs.map +7 -0
  61. package/dist/types/src/DeckPlugin.d.ts +2 -1
  62. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  64. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  66. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
  68. package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
  70. package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/index.d.ts +8 -13
  72. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  74. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  76. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
  78. package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
  80. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  84. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  85. package/dist/types/src/capabilities/settings/index.d.ts +19 -0
  86. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/settings/settings.d.ts +22 -0
  88. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/state/index.d.ts +174 -0
  90. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/state/state.d.ts +177 -0
  92. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
  94. package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/toolkit/toolkit.d.ts +27 -0
  96. package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/tools/index.d.ts +3 -0
  98. package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
  99. package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
  100. package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
  102. package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
  104. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
  105. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
  106. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
  107. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  108. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
  109. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  110. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +75 -0
  111. package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
  112. package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
  113. package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
  114. package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
  115. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
  116. package/dist/types/src/components/DeckLayout/Toast.d.ts +7 -2
  117. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  118. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +4 -2
  119. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
  120. package/dist/types/src/components/Plank/Plank.d.ts +4 -4
  121. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  122. package/dist/types/src/components/Plank/Plank.stories.d.ts +105 -5
  123. package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
  124. package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
  125. package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
  126. package/dist/types/src/components/Plank/PlankError.d.ts +1 -1
  127. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  128. package/dist/types/src/components/Plank/PlankHeading.d.ts +3 -3
  129. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  130. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  131. package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
  132. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  133. package/dist/types/src/hooks/index.d.ts +1 -0
  134. package/dist/types/src/hooks/index.d.ts.map +1 -1
  135. package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -3
  136. package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
  137. package/dist/types/src/hooks/useDeckState.d.ts +17 -0
  138. package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
  139. package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
  140. package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
  141. package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
  142. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  143. package/dist/types/src/index.d.ts +1 -2
  144. package/dist/types/src/index.d.ts.map +1 -1
  145. package/dist/types/src/meta.d.ts +2 -3
  146. package/dist/types/src/meta.d.ts.map +1 -1
  147. package/dist/types/src/translations.d.ts +4 -1
  148. package/dist/types/src/translations.d.ts.map +1 -1
  149. package/dist/types/src/{capabilities → types}/capabilities.d.ts +98 -90
  150. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  151. package/dist/types/src/types/events.d.ts +7 -0
  152. package/dist/types/src/types/events.d.ts.map +1 -0
  153. package/dist/types/src/types/index.d.ts +2 -0
  154. package/dist/types/src/types/index.d.ts.map +1 -1
  155. package/dist/types/src/types/schema.d.ts +92 -30
  156. package/dist/types/src/types/schema.d.ts.map +1 -1
  157. package/dist/types/src/util/set-active.d.ts +18 -3
  158. package/dist/types/src/util/set-active.d.ts.map +1 -1
  159. package/dist/types/tsconfig.tsbuildinfo +1 -1
  160. package/package.json +57 -46
  161. package/src/DeckPlugin.ts +46 -61
  162. package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
  163. package/src/capabilities/app-graph-builder/index.ts +7 -0
  164. package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
  165. package/src/capabilities/check-app-scheme/index.ts +7 -0
  166. package/src/capabilities/index.ts +9 -13
  167. package/src/capabilities/operation-resolver/index.ts +10 -0
  168. package/src/capabilities/operation-resolver/operation-resolver.ts +570 -0
  169. package/src/capabilities/react-root/index.ts +7 -0
  170. package/src/capabilities/react-root/react-root.tsx +47 -0
  171. package/src/capabilities/react-surface/index.ts +7 -0
  172. package/src/capabilities/react-surface/react-surface.tsx +38 -0
  173. package/src/capabilities/settings/index.ts +7 -0
  174. package/src/capabilities/settings/settings.ts +39 -0
  175. package/src/capabilities/state/index.ts +7 -0
  176. package/src/capabilities/state/state.ts +105 -0
  177. package/src/capabilities/toolkit/index.ts +7 -0
  178. package/src/capabilities/toolkit/toolkit.ts +64 -0
  179. package/src/capabilities/tools/index.ts +7 -0
  180. package/src/capabilities/tools/tools.ts +92 -0
  181. package/src/capabilities/url-handler/index.ts +7 -0
  182. package/src/capabilities/url-handler/url-handler.ts +96 -0
  183. package/src/components/DeckLayout/ActiveNode.tsx +3 -2
  184. package/src/components/DeckLayout/Banner.tsx +9 -9
  185. package/src/components/DeckLayout/ContentEmpty.tsx +5 -6
  186. package/src/components/DeckLayout/DeckLayout.stories.tsx +52 -0
  187. package/src/components/DeckLayout/DeckLayout.tsx +18 -285
  188. package/src/components/DeckLayout/DeckMain.tsx +286 -0
  189. package/src/components/DeckLayout/Dialog.tsx +21 -12
  190. package/src/components/DeckLayout/Fallback.tsx +4 -4
  191. package/src/components/DeckLayout/Popover.tsx +60 -32
  192. package/src/components/DeckLayout/StatusBar.tsx +3 -3
  193. package/src/components/DeckLayout/Toast.tsx +30 -5
  194. package/src/components/DeckSettings/DeckSettings.tsx +91 -66
  195. package/src/components/Plank/Plank.stories.tsx +24 -16
  196. package/src/components/Plank/Plank.tsx +91 -57
  197. package/src/components/Plank/PlankControls.tsx +9 -9
  198. package/src/components/Plank/PlankError.tsx +5 -4
  199. package/src/components/Plank/PlankHeading.tsx +41 -44
  200. package/src/components/Sidebar/ComplementarySidebar.tsx +69 -37
  201. package/src/components/Sidebar/Sidebar.tsx +7 -7
  202. package/src/components/Sidebar/SidebarButton.tsx +39 -32
  203. package/src/components/fragments.ts +1 -1
  204. package/src/hooks/index.ts +1 -0
  205. package/src/hooks/useCompanions.ts +1 -1
  206. package/src/hooks/useDeckCompanions.ts +7 -5
  207. package/src/hooks/useDeckState.ts +82 -0
  208. package/src/hooks/useHoistStatusbar.ts +4 -5
  209. package/src/hooks/useNodeActionExpander.ts +4 -4
  210. package/src/index.ts +1 -2
  211. package/src/meta.ts +8 -5
  212. package/src/translations.ts +4 -1
  213. package/src/types/capabilities.ts +33 -0
  214. package/src/types/events.ts +21 -0
  215. package/src/types/index.ts +2 -0
  216. package/src/types/schema.ts +90 -14
  217. package/src/util/layoutAppliesTopbar.ts +1 -1
  218. package/src/util/set-active.ts +49 -29
  219. package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs +0 -152
  220. package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
  221. package/dist/lib/browser/check-app-scheme-57U62A3A.mjs +0 -32
  222. package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
  224. package/dist/lib/browser/chunk-D7KTFCUV.mjs +0 -1494
  225. package/dist/lib/browser/chunk-D7KTFCUV.mjs.map +0 -7
  226. package/dist/lib/browser/chunk-F5BQOOEG.mjs +0 -160
  227. package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
  228. package/dist/lib/browser/chunk-JFTXENFN.mjs +0 -129
  229. package/dist/lib/browser/chunk-JFTXENFN.mjs.map +0 -7
  230. package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
  231. package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
  232. package/dist/lib/browser/chunk-QDZO4AJ4.mjs +0 -127
  233. package/dist/lib/browser/chunk-QDZO4AJ4.mjs.map +0 -7
  234. package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
  235. package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
  236. package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs +0 -521
  237. package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs.map +0 -7
  238. package/dist/lib/browser/react-root-PO64J7ML.mjs +0 -43
  239. package/dist/lib/browser/react-root-PO64J7ML.mjs.map +0 -7
  240. package/dist/lib/browser/react-surface-E45YOVF5.mjs +0 -40
  241. package/dist/lib/browser/react-surface-E45YOVF5.mjs.map +0 -7
  242. package/dist/lib/browser/settings-6AJZPZPM.mjs +0 -29
  243. package/dist/lib/browser/settings-6AJZPZPM.mjs.map +0 -7
  244. package/dist/lib/browser/state-MVDYX77Y.mjs +0 -12
  245. package/dist/lib/browser/tools-TKQDPCHJ.mjs +0 -88
  246. package/dist/lib/browser/tools-TKQDPCHJ.mjs.map +0 -7
  247. package/dist/lib/browser/url-handler-7L7M6IKH.mjs +0 -70
  248. package/dist/lib/browser/url-handler-7L7M6IKH.mjs.map +0 -7
  249. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  250. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  251. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  252. package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
  253. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  254. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  255. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  256. package/dist/types/src/capabilities/react-root.d.ts +0 -7
  257. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  258. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  259. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  260. package/dist/types/src/capabilities/settings.d.ts +0 -4
  261. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  262. package/dist/types/src/capabilities/state.d.ts +0 -101
  263. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  264. package/dist/types/src/capabilities/tools.d.ts +0 -11
  265. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  266. package/dist/types/src/capabilities/url-handler.d.ts +0 -4
  267. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  268. package/dist/types/src/events.d.ts +0 -4
  269. package/dist/types/src/events.d.ts.map +0 -1
  270. package/src/capabilities/app-graph-builder.ts +0 -141
  271. package/src/capabilities/capabilities.ts +0 -14
  272. package/src/capabilities/check-app-scheme.ts +0 -40
  273. package/src/capabilities/intent-resolver.ts +0 -468
  274. package/src/capabilities/react-root.tsx +0 -38
  275. package/src/capabilities/react-surface.tsx +0 -30
  276. package/src/capabilities/settings.ts +0 -26
  277. package/src/capabilities/state.ts +0 -104
  278. package/src/capabilities/tools.ts +0 -81
  279. package/src/capabilities/url-handler.ts +0 -59
  280. package/src/events.ts +0 -11
  281. /package/dist/lib/{browser/state-MVDYX77Y.mjs.map → node-esm/types/index.mjs.map} +0 -0
@@ -0,0 +1,1470 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ getCompanionId,
4
+ useBreakpoints,
5
+ useCompanions,
6
+ useDeckCompanions,
7
+ useDeckState,
8
+ useHoistStatusbar,
9
+ useMainSize,
10
+ useNodeActionExpander
11
+ } from "./chunk-ZMJPCZ3V.mjs";
12
+ import {
13
+ calculateOverscroll,
14
+ layoutAppliesTopbar,
15
+ parseEntryId
16
+ } from "./chunk-ADPMWKLL.mjs";
17
+ import {
18
+ DeckCapabilities,
19
+ DeckOperation,
20
+ NewPlankPositions,
21
+ OverscrollOptions,
22
+ PLANK_COMPANION_TYPE,
23
+ getMode,
24
+ meta
25
+ } from "./chunk-CVYHPJIN.mjs";
26
+
27
+ // src/components/DeckLayout/Banner.tsx
28
+ import React9 from "react";
29
+ import { Surface as Surface5 } from "@dxos/app-framework/ui";
30
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
31
+ import { mx as mx5, osTranslations } from "@dxos/ui-theme";
32
+
33
+ // src/components/Sidebar/ComplementarySidebar.tsx
34
+ import React7, { Fragment as Fragment2, useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
35
+ import { Surface as Surface3, useOperationInvoker as useOperationInvoker5 } from "@dxos/app-framework/ui";
36
+ import { LayoutOperation as LayoutOperation4 } from "@dxos/app-toolkit";
37
+ import { IconButton as IconButton4, Main, ScrollArea, toLocalizedString as toLocalizedString2, useTranslation as useTranslation5 } from "@dxos/react-ui";
38
+ import { Tabs } from "@dxos/react-ui-tabs";
39
+ import { mx as mx4 } from "@dxos/ui-theme";
40
+
41
+ // src/components/Plank/Plank.tsx
42
+ import { useFocusFinders } from "@fluentui/react-tabster";
43
+ import React5, { memo as memo2, useCallback as useCallback3, useLayoutEffect, useMemo as useMemo2, useRef } from "react";
44
+ import { Surface as Surface2, useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
45
+ import { LayoutOperation as LayoutOperation2 } from "@dxos/app-toolkit";
46
+ import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
47
+ import { debounce } from "@dxos/async";
48
+ import { useNode } from "@dxos/plugin-graph";
49
+ import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from "@dxos/react-ui-attention";
50
+ import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
51
+ import { mainIntrinsicSize, mx as mx3 } from "@dxos/ui-theme";
52
+
53
+ // src/components/Plank/PlankError.tsx
54
+ import React4, { useEffect as useEffect2, useState } from "react";
55
+ import { useTranslation as useTranslation3 } from "@dxos/react-ui";
56
+ import { descriptionMessage, mx as mx2 } from "@dxos/ui-theme";
57
+
58
+ // src/components/Plank/PlankHeading.tsx
59
+ import React2, { Fragment, memo, useCallback as useCallback2, useEffect, useMemo } from "react";
60
+ import { Surface, useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/ui";
61
+ import { LayoutOperation } from "@dxos/app-toolkit";
62
+ import { useAppGraph } from "@dxos/app-toolkit/ui";
63
+ import { Graph, useActionRunner } from "@dxos/plugin-graph";
64
+ import { Icon, IconButton as IconButton2, Popover, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
65
+ import { StackItem } from "@dxos/react-ui-stack";
66
+ import { TextTooltip } from "@dxos/react-ui-text-tooltip";
67
+ import { hoverableControls, hoverableFocusedWithinControls } from "@dxos/ui-theme";
68
+
69
+ // src/components/fragments.ts
70
+ import { mx } from "@dxos/ui-theme";
71
+ var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
72
+ var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deckSurface lg:hidden";
73
+ var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "inline-start-2");
74
+ var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-2");
75
+
76
+ // src/components/Plank/PlankControls.tsx
77
+ import React, { forwardRef, useCallback } from "react";
78
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
79
+ import { invariant } from "@dxos/invariant";
80
+ import { ButtonGroup, IconButton, useTranslation } from "@dxos/react-ui";
81
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx";
82
+ var PlankControl = ({ icon, label: label3, ...props }) => {
83
+ return /* @__PURE__ */ React.createElement(IconButton, {
84
+ label: label3,
85
+ icon,
86
+ iconOnly: true,
87
+ variant: "ghost",
88
+ tooltipSide: "bottom",
89
+ ...props
90
+ });
91
+ };
92
+ var plankControlSpacing = "pli-2";
93
+ var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
94
+ const { t } = useTranslation(meta.id);
95
+ const { invokePromise } = useOperationInvoker();
96
+ const handleCloseCompanion = useCallback(() => {
97
+ invariant(primary, void 0, {
98
+ F: __dxlog_file,
99
+ L: 49,
100
+ S: void 0,
101
+ A: [
102
+ "primary",
103
+ ""
104
+ ]
105
+ });
106
+ return invokePromise(DeckOperation.ChangeCompanion, {
107
+ primary,
108
+ companion: null
109
+ });
110
+ }, [
111
+ invokePromise,
112
+ primary
113
+ ]);
114
+ return /* @__PURE__ */ React.createElement("div", {
115
+ ref: forwardedRef,
116
+ className: "contents app-no-drag"
117
+ }, /* @__PURE__ */ React.createElement(PlankControl, {
118
+ label: t("close companion label"),
119
+ variant: "ghost",
120
+ icon: "ph--x--regular",
121
+ onClick: handleCloseCompanion,
122
+ classNames: plankControlSpacing
123
+ }));
124
+ });
125
+ var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, layoutMode, pin, close = false, onClick, ...props }, forwardedRef) => {
126
+ const { t } = useTranslation(meta.id);
127
+ const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
128
+ const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
129
+ return /* @__PURE__ */ React.createElement(ButtonGroup, {
130
+ ...props,
131
+ classNames: [
132
+ "app-no-drag !opacity-100",
133
+ classNames
134
+ ],
135
+ ref: forwardedRef
136
+ }, capabilities.deck ? /* @__PURE__ */ React.createElement(React.Fragment, null, capabilities.solo && /* @__PURE__ */ React.createElement(React.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React.createElement(PlankControl, {
137
+ label: t("show fullscreen plank label"),
138
+ classNames: buttonClassNames,
139
+ icon: "ph--corners-out--regular",
140
+ onClick: () => onClick?.("solo--fullscreen")
141
+ }), /* @__PURE__ */ React.createElement(PlankControl, {
142
+ label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : layoutIsAnySolo ? "show deck plank label" : "show solo plank label"),
143
+ classNames: buttonClassNames,
144
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : layoutIsAnySolo ? "ph--arrows-in-line-horizontal--regular" : "ph--arrows-out-line-horizontal--regular",
145
+ onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
146
+ })), !layoutIsAnySolo && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PlankControl, {
147
+ label: t("increment start label"),
148
+ disabled: !capabilities.incrementStart,
149
+ classNames: buttonClassNames,
150
+ icon: "ph--caret-left--regular",
151
+ onClick: () => onClick?.("increment-start")
152
+ }), /* @__PURE__ */ React.createElement(PlankControl, {
153
+ label: t("increment end label"),
154
+ disabled: !capabilities.incrementEnd,
155
+ classNames: buttonClassNames,
156
+ icon: "ph--caret-right--regular",
157
+ onClick: () => onClick?.("increment-end")
158
+ }))) : capabilities.fullscreen && /* @__PURE__ */ React.createElement(PlankControl, {
159
+ label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : "show fullscreen plank label"),
160
+ classNames: buttonClassNames,
161
+ icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : "ph--corners-out--regular",
162
+ onClick: () => onClick?.("solo--fullscreen")
163
+ }), close && !layoutIsAnySolo && /* @__PURE__ */ React.createElement(PlankControl, {
164
+ label: t(`${typeof close === "string" ? "minify" : "close"} label`),
165
+ classNames: buttonClassNames,
166
+ "data-testid": "plankHeading.close",
167
+ icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular",
168
+ onClick: () => onClick?.("close")
169
+ }), capabilities.companion && /* @__PURE__ */ React.createElement(PlankControl, {
170
+ label: t("open companion label"),
171
+ classNames: buttonClassNames,
172
+ "data-testid": "plankHeading.companion",
173
+ icon: "ph--square-split-horizontal--regular",
174
+ onClick: () => onClick?.("companion")
175
+ }), children);
176
+ });
177
+
178
+ // src/components/Plank/PlankHeading.tsx
179
+ var MAX_COMPANIONS = 5;
180
+ var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
181
+ const { t } = useTranslation2(meta.id);
182
+ const { invokePromise, invokeSync } = useOperationInvoker2();
183
+ const runAction = useActionRunner();
184
+ const { graph } = useAppGraph();
185
+ const breakpoint = useBreakpoints();
186
+ const icon = node?.properties?.icon ?? "ph--placeholder--regular";
187
+ const label3 = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
188
+ "plank heading fallback label",
189
+ {
190
+ ns: meta.id
191
+ }
192
+ ], t);
193
+ const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
194
+ useEffect(() => {
195
+ const frame = requestAnimationFrame(() => {
196
+ if (node) {
197
+ void Graph.expand(graph, node.id);
198
+ }
199
+ });
200
+ return () => cancelAnimationFrame(frame);
201
+ }, [
202
+ node
203
+ ]);
204
+ const attendableId = primaryId ?? id;
205
+ const capabilities = useMemo(() => ({
206
+ deck: deckEnabled ?? true,
207
+ solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
208
+ incrementStart: canIncrementStart,
209
+ incrementEnd: canIncrementEnd,
210
+ fullscreen: !isCompanionNode,
211
+ companion: !isCompanionNode && companions && companions.length > 0
212
+ }), [
213
+ breakpoint,
214
+ part,
215
+ companions,
216
+ canIncrementStart,
217
+ canIncrementEnd,
218
+ isCompanionNode,
219
+ deckEnabled
220
+ ]);
221
+ const { variant } = parseEntryId(id);
222
+ const sigilActions = useMemo(() => {
223
+ if (!node) {
224
+ return void 0;
225
+ } else if (variant) {
226
+ return [];
227
+ } else {
228
+ return [
229
+ actions,
230
+ Graph.getActions(graph, node.id).filter((a) => [
231
+ "list-item",
232
+ "list-item-primary",
233
+ "heading-list-item"
234
+ ].includes(a.properties.disposition))
235
+ ].filter((a) => a.length > 0);
236
+ }
237
+ }, [
238
+ actions,
239
+ node,
240
+ variant,
241
+ graph
242
+ ]);
243
+ const handleAction = useCallback2((action) => {
244
+ if (typeof action.data === "function") {
245
+ void runAction(action, {
246
+ parent: node,
247
+ caller: meta.id
248
+ });
249
+ }
250
+ }, [
251
+ node,
252
+ runAction
253
+ ]);
254
+ const handlePlankAction = useCallback2((eventType) => {
255
+ if (eventType.startsWith("solo")) {
256
+ return invokePromise(DeckOperation.Adjust, {
257
+ type: eventType,
258
+ id
259
+ });
260
+ } else if (eventType === "close") {
261
+ if (part === "complementary") {
262
+ return invokeSync(LayoutOperation.UpdateComplementary, {
263
+ state: "collapsed"
264
+ });
265
+ } else {
266
+ return invokeSync(LayoutOperation.Close, {
267
+ subject: [
268
+ id
269
+ ]
270
+ });
271
+ }
272
+ } else {
273
+ return invokePromise(DeckOperation.Adjust, {
274
+ type: eventType,
275
+ id
276
+ });
277
+ }
278
+ }, [
279
+ invokePromise,
280
+ invokeSync,
281
+ id,
282
+ part
283
+ ]);
284
+ const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? Popover.Anchor : Fragment;
285
+ const handleTabClick = useCallback2((event) => {
286
+ const target = event.target.closest("[data-id]");
287
+ const tabId = target?.dataset?.id;
288
+ if (primaryId && tabId) {
289
+ void invokePromise(DeckOperation.ChangeCompanion, {
290
+ primary: primaryId,
291
+ companion: tabId
292
+ });
293
+ }
294
+ }, [
295
+ primaryId,
296
+ invokePromise
297
+ ]);
298
+ return /* @__PURE__ */ React2.createElement(StackItem.Heading, {
299
+ classNames: [
300
+ "plb-1 items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain-layout density-coarse",
301
+ part === "solo" ? soloInlinePadding : "pli-1",
302
+ ...layoutMode === "solo--fullscreen" ? [
303
+ hoverableControls,
304
+ hoverableFocusedWithinControls,
305
+ "*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color]",
306
+ "hover-hover:hover:bg-headerSurface focus-within:bg-headerSurface hover-hover:hover:border-subduedSeparator focus-within:border-subduedSeparator"
307
+ ] : []
308
+ ],
309
+ "data-plank-heading": true
310
+ }, companions && isCompanionNode ? (
311
+ /* TODO(thure): IMPORTANT: This is a tablist; it should be implemented as such. */
312
+ /* @__PURE__ */ React2.createElement("div", {
313
+ role: "none",
314
+ className: "flex-1 min-is-0 overflow-x-auto scrollbar-none flex gap-1"
315
+ }, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React2.createElement(IconButton2, {
316
+ key: id2,
317
+ "data-id": id2,
318
+ icon: icon2,
319
+ iconOnly: companions.length > MAX_COMPANIONS && node?.id !== id2,
320
+ label: toLocalizedString(label4, t),
321
+ variant: node?.id === id2 ? "primary" : "ghost",
322
+ onClick: handleTabClick
323
+ })))
324
+ ) : /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React2.createElement(StackItem.Sigil, {
325
+ icon,
326
+ related: part === "complementary",
327
+ attendableId,
328
+ triggerLabel: t("actions menu label"),
329
+ actions: sigilActions,
330
+ onAction: handleAction
331
+ }, /* @__PURE__ */ React2.createElement(Surface.Surface, {
332
+ role: "menu-footer",
333
+ data: {
334
+ subject: node.data
335
+ }
336
+ })) : /* @__PURE__ */ React2.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React2.createElement("span", {
337
+ className: "sr-only"
338
+ }, label3), /* @__PURE__ */ React2.createElement(Icon, {
339
+ icon
340
+ }))), /* @__PURE__ */ React2.createElement(TextTooltip, {
341
+ text: label3,
342
+ onlyWhenTruncating: true
343
+ }, /* @__PURE__ */ React2.createElement(StackItem.HeadingLabel, {
344
+ attendableId,
345
+ related: part === "complementary",
346
+ ...pending && {
347
+ classNames: "text-description"
348
+ }
349
+ }, label3))), node && part !== "complementary" && /* @__PURE__ */ React2.createElement(Surface.Surface, {
350
+ role: "navbar-end",
351
+ data: {
352
+ subject: node.data
353
+ }
354
+ }), companioned === "companion" ? /* @__PURE__ */ React2.createElement(PlankCompanionControls, {
355
+ primary: primaryId
356
+ }) : /* @__PURE__ */ React2.createElement(PlankControls, {
357
+ capabilities,
358
+ layoutMode,
359
+ close: part === "complementary" ? "minify-end" : true,
360
+ onClick: handlePlankAction
361
+ }));
362
+ });
363
+
364
+ // src/components/Plank/PlankLoading.tsx
365
+ import React3 from "react";
366
+ var PlankLoading = () => {
367
+ return /* @__PURE__ */ React3.createElement("div", {
368
+ role: "none",
369
+ className: "grid place-items-center attention-surface"
370
+ });
371
+ };
372
+
373
+ // src/components/Plank/PlankError.tsx
374
+ var PlankContentError = ({ error }) => {
375
+ const { t } = useTranslation3(meta.id);
376
+ const errorString = error?.toString() ?? "";
377
+ return /* @__PURE__ */ React4.createElement("div", {
378
+ role: "none",
379
+ className: "overflow-y-auto p-8 attention-surface grid place-items-center"
380
+ }, /* @__PURE__ */ React4.createElement("p", {
381
+ role: "alert",
382
+ className: mx2(descriptionMessage, "break-all rounded-md p-4")
383
+ }, error ? errorString : t("error fallback message")));
384
+ };
385
+ var PlankError = ({ id, part, node, error }) => {
386
+ const [timedOut, setTimedOut] = useState(false);
387
+ useEffect2(() => {
388
+ setTimeout(() => setTimedOut(true), 5e3);
389
+ }, []);
390
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(PlankHeading, {
391
+ id,
392
+ part,
393
+ node,
394
+ pending: !timedOut
395
+ }), timedOut ? /* @__PURE__ */ React4.createElement(PlankContentError, {
396
+ error
397
+ }) : /* @__PURE__ */ React4.createElement(PlankLoading, null));
398
+ };
399
+
400
+ // src/components/Plank/Plank.tsx
401
+ var UNKNOWN_ID = "unknown_id";
402
+ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionId, ...props }) => {
403
+ const { graph } = useAppGraph2();
404
+ const node = useNode(graph, id);
405
+ const companions = useCompanions(id);
406
+ const currentCompanion = companions.find(({ id: id2 }) => id2 === companionId);
407
+ const hasCompanion = !!(companionId && currentCompanion);
408
+ return /* @__PURE__ */ React5.createElement(PlankContainer, {
409
+ solo: props.part === "solo",
410
+ companion: hasCompanion,
411
+ encapsulate: !!props.settings?.encapsulatedPlanks
412
+ }, /* @__PURE__ */ React5.createElement(PlankComponent, {
413
+ id,
414
+ node,
415
+ companioned: hasCompanion ? "primary" : void 0,
416
+ companions: hasCompanion ? [] : companions,
417
+ ...props,
418
+ ...props.part === "solo" ? {
419
+ part: "solo-primary"
420
+ } : {}
421
+ }), hasCompanion && /* @__PURE__ */ React5.createElement(PlankComponent, {
422
+ id: companionId,
423
+ node: currentCompanion,
424
+ primary: node,
425
+ companions,
426
+ companioned: "companion",
427
+ ...props,
428
+ ...props.part === "solo" ? {
429
+ part: "solo-companion"
430
+ } : {
431
+ order: (props.order ?? 0) + 1
432
+ }
433
+ }));
434
+ });
435
+ var PlankContainer = ({ children, solo, companion, encapsulate }) => {
436
+ const sizeAttrs = useMainSize();
437
+ if (!solo) {
438
+ return children;
439
+ }
440
+ return /* @__PURE__ */ React5.createElement("div", {
441
+ role: "none",
442
+ "data-popover-collision-boundary": true,
443
+ className: mx3("absolute inset-[--main-spacing] grid", encapsulate && "border border-separator rounded overflow-hidden", companion && "grid-cols-[6fr_4fr]", railGridHorizontal, mainIntrinsicSize),
444
+ ...sizeAttrs
445
+ }, children);
446
+ };
447
+ var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order, active, companioned, node, primary, companions, settings }) => {
448
+ const { invokePromise } = useOperationInvoker3();
449
+ const { state, deck } = useDeckState();
450
+ const { popoverAnchorId, scrollIntoView } = state;
451
+ const { findFirstFocusable } = useFocusFinders();
452
+ const canResize = layoutMode === "deck";
453
+ const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
454
+ const index = active ? active.findIndex((entryId) => entryId === id) : 0;
455
+ const length = active?.length ?? 1;
456
+ const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
457
+ const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
458
+ const rootElement = useRef(null);
459
+ const { variant } = parseEntryId(id);
460
+ const sizeKey = `${id.split("+")[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR}${variant}` : ""}`;
461
+ const size = deck.plankSizing[sizeKey];
462
+ const handleSizeChange = useCallback3(debounce((nextSize) => {
463
+ return invokePromise(DeckOperation.UpdatePlankSize, {
464
+ id: sizeKey,
465
+ size: nextSize
466
+ });
467
+ }, 200), [
468
+ invokePromise,
469
+ sizeKey
470
+ ]);
471
+ const handleKeyDown = useCallback3((event) => {
472
+ if (event.target === event.currentTarget) {
473
+ switch (event.key) {
474
+ case "Escape":
475
+ rootElement.current?.closest("main")?.focus();
476
+ break;
477
+ case "Enter":
478
+ rootElement.current && findFirstFocusable(rootElement.current)?.focus();
479
+ break;
480
+ }
481
+ }
482
+ }, []);
483
+ useLayoutEffect(() => {
484
+ if (scrollIntoView === id) {
485
+ layoutMode === "deck" && rootElement.current?.scrollIntoView({
486
+ behavior: "smooth",
487
+ inline: "center"
488
+ });
489
+ void invokePromise(LayoutOperation2.ScrollIntoView, {
490
+ subject: void 0
491
+ });
492
+ }
493
+ }, [
494
+ id,
495
+ scrollIntoView,
496
+ layoutMode,
497
+ invokePromise
498
+ ]);
499
+ const isSolo = layoutMode.startsWith("solo") && part === "solo";
500
+ const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
501
+ const sizeAttrs = useMainSize();
502
+ const data = useMemo2(() => node && {
503
+ attendableId: id,
504
+ subject: node.data,
505
+ companionTo: primary?.data,
506
+ properties: node.properties,
507
+ variant,
508
+ path,
509
+ popoverAnchorId
510
+ }, [
511
+ node,
512
+ node?.data,
513
+ node?.properties,
514
+ path,
515
+ popoverAnchorId,
516
+ primary?.data,
517
+ variant
518
+ ]);
519
+ const placeholder = useMemo2(() => /* @__PURE__ */ React5.createElement(PlankLoading, null), []);
520
+ const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
521
+ const fullscreen = layoutMode === "solo--fullscreen";
522
+ const className = mx3("attention-surface relative dx-focus-ring-inset-over-all density-coarse", isSolo && "absolute inset-0", isSolo && mainIntrinsicSize, railGridHorizontal, part.startsWith("solo") && "grid", part.startsWith("solo-") && "grid-rows-subgrid row-span-2 min-is-0", fullscreen && "grid-rows-1", part === "deck" && (companioned === "companion" ? "!border-separator border-ie" : "!border-separator border-li"), part === "solo-companion" && "!border-separator border-is", settings?.encapsulatedPlanks && !part.startsWith("solo") && "mli-[--main-spacing] !border-separator border rounded overflow-hidden");
523
+ return /* @__PURE__ */ React5.createElement(Root, {
524
+ ref: rootElement,
525
+ "data-testid": "deck.plank",
526
+ "data-popover-collision-boundary": true,
527
+ tabIndex: 0,
528
+ ...part.startsWith("solo") ? {
529
+ ...sizeAttrs,
530
+ className
531
+ } : {
532
+ item: {
533
+ id
534
+ },
535
+ size,
536
+ onSizeChange: handleSizeChange,
537
+ classNames: className,
538
+ order,
539
+ role: "article"
540
+ },
541
+ ...isAttendable ? attentionAttrs : {},
542
+ onKeyDown: handleKeyDown
543
+ }, node ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, !fullscreen && /* @__PURE__ */ React5.createElement(PlankHeading, {
544
+ id,
545
+ part: part.startsWith("solo-") ? "solo" : part,
546
+ node,
547
+ layoutMode,
548
+ deckEnabled: settings?.enableDeck,
549
+ canIncrementStart,
550
+ canIncrementEnd,
551
+ popoverAnchorId,
552
+ primaryId: primary?.id,
553
+ companioned,
554
+ companions
555
+ }), /* @__PURE__ */ React5.createElement(Surface2.Surface, {
556
+ key: node.id,
557
+ role: "article",
558
+ data,
559
+ limit: 1,
560
+ fallback: PlankContentError,
561
+ placeholder
562
+ })) : /* @__PURE__ */ React5.createElement(PlankError, {
563
+ id,
564
+ part
565
+ }), canResize && /* @__PURE__ */ React5.createElement(StackItem2.ResizeHandle, null));
566
+ });
567
+
568
+ // src/components/Sidebar/SidebarButton.tsx
569
+ import React6, { useCallback as useCallback4 } from "react";
570
+ import { useOperationInvoker as useOperationInvoker4 } from "@dxos/app-framework/ui";
571
+ import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
572
+ import { IconButton as IconButton3, useTranslation as useTranslation4 } from "@dxos/react-ui";
573
+ var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
574
+ const { updateState } = useDeckState();
575
+ const { t } = useTranslation4(meta.id);
576
+ const handleClick = useCallback4(() => {
577
+ updateState((state) => ({
578
+ ...state,
579
+ sidebarState: state.sidebarState === "expanded" ? "collapsed" : "expanded"
580
+ }));
581
+ }, [
582
+ updateState
583
+ ]);
584
+ return /* @__PURE__ */ React6.createElement(IconButton3, {
585
+ variant,
586
+ icon: "ph--sidebar--regular",
587
+ iconOnly: true,
588
+ size: 4,
589
+ label: t("open navigation sidebar label"),
590
+ onClick: handleClick,
591
+ classNames
592
+ });
593
+ };
594
+ var CloseSidebarButton = () => {
595
+ const { updateState } = useDeckState();
596
+ const { t } = useTranslation4(meta.id);
597
+ const handleClick = useCallback4(() => {
598
+ updateState((state) => ({
599
+ ...state,
600
+ sidebarState: "collapsed"
601
+ }));
602
+ }, [
603
+ updateState
604
+ ]);
605
+ return /* @__PURE__ */ React6.createElement(IconButton3, {
606
+ variant: "ghost",
607
+ icon: "ph--caret-line-left--regular",
608
+ iconOnly: true,
609
+ size: 4,
610
+ label: t("close navigation sidebar label"),
611
+ onClick: handleClick,
612
+ classNames: "rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]"
613
+ });
614
+ };
615
+ var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
616
+ const { invokeSync } = useOperationInvoker4();
617
+ const { state, updateState } = useDeckState();
618
+ const { t } = useTranslation4(meta.id);
619
+ const companions = useDeckCompanions();
620
+ const handleClick = useCallback4(() => {
621
+ const nextState = state.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
622
+ updateState((state2) => ({
623
+ ...state2,
624
+ complementarySidebarState: nextState
625
+ }));
626
+ const subject = state.complementarySidebarPanel ?? (companions[0] && getCompanionId(companions[0].id));
627
+ if (nextState === "expanded" && !current && subject) {
628
+ invokeSync(LayoutOperation3.UpdateComplementary, {
629
+ subject
630
+ });
631
+ }
632
+ }, [
633
+ state,
634
+ updateState,
635
+ current,
636
+ companions,
637
+ invokeSync
638
+ ]);
639
+ return /* @__PURE__ */ React6.createElement(IconButton3, {
640
+ variant: "ghost",
641
+ classNames: [
642
+ "[&>svg]:-scale-x-100",
643
+ classNames
644
+ ],
645
+ icon: "ph--sidebar-simple--regular",
646
+ iconOnly: true,
647
+ label: t("open complementary sidebar label"),
648
+ size: inR0 ? 5 : 4,
649
+ tooltipSide: inR0 ? "left" : void 0,
650
+ onClick: handleClick
651
+ });
652
+ };
653
+
654
+ // src/components/Sidebar/ComplementarySidebar.tsx
655
+ var label = [
656
+ "complementary sidebar title",
657
+ {
658
+ ns: meta.id
659
+ }
660
+ ];
661
+ var ComplementarySidebar = ({ current }) => {
662
+ const { t } = useTranslation5(meta.id);
663
+ const { invokeSync } = useOperationInvoker5();
664
+ const { state, deck, updateState } = useDeckState();
665
+ const layoutMode = getMode(deck);
666
+ const breakpoint = useBreakpoints();
667
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
668
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
669
+ const companions = useDeckCompanions();
670
+ const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
671
+ const activeId = activeCompanion && getCompanionId(activeCompanion.id);
672
+ const [internalValue, setInternalValue] = useState2(activeId);
673
+ useEffect3(() => {
674
+ setInternalValue(activeId);
675
+ }, [
676
+ activeId
677
+ ]);
678
+ const handleTabClick = useCallback5((event) => {
679
+ const nextValue = event.currentTarget.getAttribute("data-value");
680
+ if (nextValue === activeId) {
681
+ updateState((state2) => ({
682
+ ...state2,
683
+ complementarySidebarState: state2.complementarySidebarState === "expanded" ? "collapsed" : "expanded"
684
+ }));
685
+ } else {
686
+ setInternalValue(nextValue);
687
+ updateState((state2) => ({
688
+ ...state2,
689
+ complementarySidebarState: "expanded"
690
+ }));
691
+ invokeSync(LayoutOperation4.UpdateComplementary, {
692
+ subject: nextValue
693
+ });
694
+ }
695
+ }, [
696
+ state.complementarySidebarState,
697
+ activeId,
698
+ invokeSync,
699
+ updateState
700
+ ]);
701
+ const data = useMemo3(() => activeCompanion && {
702
+ id: activeCompanion.id,
703
+ subject: activeCompanion.data
704
+ }, [
705
+ activeCompanion?.id,
706
+ activeCompanion?.data
707
+ ]);
708
+ useEffect3(() => {
709
+ if (!activeId) {
710
+ invokeSync(LayoutOperation4.UpdateComplementary, {
711
+ state: "collapsed"
712
+ });
713
+ }
714
+ }, [
715
+ activeId,
716
+ invokeSync
717
+ ]);
718
+ return /* @__PURE__ */ React7.createElement(Main.ComplementarySidebar, {
719
+ label,
720
+ classNames: [
721
+ topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
722
+ hoistStatusbar && "block-end-[--statusbar-size]"
723
+ ]
724
+ }, /* @__PURE__ */ React7.createElement(Tabs.Root, {
725
+ orientation: "vertical",
726
+ verticalVariant: "stateless",
727
+ value: internalValue,
728
+ classNames: "contents"
729
+ }, /* @__PURE__ */ React7.createElement("div", {
730
+ role: "none",
731
+ className: mx4("absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size]", "pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-subduedSeparator", "grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag")
732
+ }, /* @__PURE__ */ React7.createElement(Tabs.Tablist, {
733
+ classNames: "grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto"
734
+ }, companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tab, {
735
+ key: getCompanionId(companion.id),
736
+ value: getCompanionId(companion.id),
737
+ asChild: true
738
+ }, /* @__PURE__ */ React7.createElement(IconButton4, {
739
+ label: toLocalizedString2(companion.properties.label, t),
740
+ icon: companion.properties.icon,
741
+ iconOnly: true,
742
+ tooltipSide: "left",
743
+ "data-value": getCompanionId(companion.id),
744
+ variant: activeId === getCompanionId(companion.id) ? state.complementarySidebarState === "expanded" ? "primary" : "default" : "ghost",
745
+ onClick: handleTabClick
746
+ })))), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
747
+ role: "none",
748
+ className: "grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto"
749
+ }, /* @__PURE__ */ React7.createElement(Surface3.Surface, {
750
+ role: "status-bar--r0-footer",
751
+ limit: 1
752
+ })), /* @__PURE__ */ React7.createElement("div", {
753
+ role: "none",
754
+ className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
755
+ }, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), activeId && companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
756
+ key: getCompanionId(companion.id),
757
+ value: getCompanionId(companion.id),
758
+ classNames: [
759
+ 'absolute data-[state="inactive"]:-z-[1] overflow-hidden',
760
+ "inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size]",
761
+ "grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]"
762
+ ],
763
+ ...state.complementarySidebarState !== "expanded" && {
764
+ inert: true
765
+ }
766
+ }, /* @__PURE__ */ React7.createElement(ComplementarySidebarPanel, {
767
+ companion,
768
+ activeId,
769
+ data,
770
+ hoistStatusbar
771
+ })))));
772
+ };
773
+ var ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }) => {
774
+ const { t } = useTranslation5(meta.id);
775
+ if (getCompanionId(companion.id) !== activeId && !data) {
776
+ return null;
777
+ }
778
+ const Wrapper = companion.properties.fixed ? Fragment2 : ScrollAreaWrapper;
779
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("div", {
780
+ role: "none",
781
+ className: "flex items-center p-1 gap-1 border-be border-subduedSeparator"
782
+ }, /* @__PURE__ */ React7.createElement(IconButton4, {
783
+ label: toLocalizedString2(companion.properties.label, t),
784
+ icon: companion.properties.icon,
785
+ iconOnly: true,
786
+ tooltipSide: "left",
787
+ "data-value": getCompanionId(companion.id),
788
+ classNames: "bs-10 is-10",
789
+ variant: "default"
790
+ }), /* @__PURE__ */ React7.createElement("div", {
791
+ role: "none",
792
+ className: "pli-1"
793
+ }, toLocalizedString2(companion.properties.label, t))), /* @__PURE__ */ React7.createElement(Wrapper, null, /* @__PURE__ */ React7.createElement(Surface3.Surface, {
794
+ role: `deck-companion--${getCompanionId(companion.id)}`,
795
+ data,
796
+ fallback: PlankContentError,
797
+ placeholder: /* @__PURE__ */ React7.createElement(PlankLoading, null)
798
+ })), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
799
+ role: "contentinfo",
800
+ className: "flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]"
801
+ }, /* @__PURE__ */ React7.createElement(Surface3.Surface, {
802
+ role: "status-bar--r1-footer",
803
+ limit: 1
804
+ })));
805
+ };
806
+ var ScrollAreaWrapper = ({ children }) => {
807
+ return /* @__PURE__ */ React7.createElement(ScrollArea.Root, {
808
+ thin: true,
809
+ orientation: "vertical",
810
+ classNames: "grow"
811
+ }, /* @__PURE__ */ React7.createElement(ScrollArea.Viewport, null, children));
812
+ };
813
+
814
+ // src/components/Sidebar/Sidebar.tsx
815
+ import React8, { useMemo as useMemo4 } from "react";
816
+ import { Surface as Surface4 } from "@dxos/app-framework/ui";
817
+ import { Main as Main2 } from "@dxos/react-ui";
818
+ var label2 = [
819
+ "sidebar title",
820
+ {
821
+ ns: meta.id
822
+ }
823
+ ];
824
+ var Sidebar = () => {
825
+ const { state, deck } = useDeckState();
826
+ const { popoverAnchorId, activeDeck: current } = state;
827
+ const breakpoint = useBreakpoints();
828
+ const layoutMode = getMode(deck);
829
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
830
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
831
+ const navigationData = useMemo4(() => ({
832
+ popoverAnchorId,
833
+ topbar,
834
+ hoistStatusbar,
835
+ current
836
+ }), [
837
+ popoverAnchorId,
838
+ topbar,
839
+ hoistStatusbar,
840
+ current
841
+ ]);
842
+ return /* @__PURE__ */ React8.createElement(Main2.NavigationSidebar, {
843
+ label: label2,
844
+ classNames: [
845
+ "grid",
846
+ topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
847
+ hoistStatusbar && "block-end-[--statusbar-size]"
848
+ ]
849
+ }, /* @__PURE__ */ React8.createElement(Surface4.Surface, {
850
+ role: "navigation",
851
+ data: navigationData,
852
+ limit: 1
853
+ }));
854
+ };
855
+
856
+ // src/components/DeckLayout/Banner.tsx
857
+ var Banner = ({ variant, classNames }) => {
858
+ const { t } = useTranslation6(meta.id);
859
+ return /* @__PURE__ */ React9.createElement("header", {
860
+ className: mx5("flex items-stretch relative plb-1 pis-1 pie-2", variant === "topbar" && "fixed inset-inline-0 block-start-[env(safe-area-inset-top)] bs-[--rail-size] border-be border-separator", classNames)
861
+ }, variant === "sidebar" ? /* @__PURE__ */ React9.createElement(CloseSidebarButton, null) : /* @__PURE__ */ React9.createElement(ToggleSidebarButton, null), /* @__PURE__ */ React9.createElement("span", {
862
+ className: "self-center grow mis-1"
863
+ }, t("current app name", {
864
+ ns: osTranslations
865
+ })), variant === "topbar" && /* @__PURE__ */ React9.createElement("div", {
866
+ role: "none",
867
+ className: "absolute inset-0 pointer-events-none"
868
+ }, /* @__PURE__ */ React9.createElement("div", {
869
+ role: "none",
870
+ className: "grid bs-full pointer-fine:p-1 max-is-md mli-auto pointer-events-auto"
871
+ }, /* @__PURE__ */ React9.createElement(Surface5.Surface, {
872
+ role: "search-input",
873
+ limit: 1
874
+ }))), /* @__PURE__ */ React9.createElement("span", {
875
+ role: "none",
876
+ className: "grow"
877
+ }), /* @__PURE__ */ React9.createElement(Surface5.Surface, {
878
+ role: "header-end",
879
+ limit: 1
880
+ }), /* @__PURE__ */ React9.createElement(Surface5.Surface, {
881
+ role: "notch-start",
882
+ limit: 1
883
+ }));
884
+ };
885
+
886
+ // src/components/DeckLayout/DeckLayout.tsx
887
+ import React18 from "react";
888
+ import { Mosaic } from "@dxos/react-ui-mosaic";
889
+
890
+ // src/components/DeckLayout/ActiveNode.tsx
891
+ import React10 from "react";
892
+ import { Surface as Surface6 } from "@dxos/app-framework/ui";
893
+ import { useAppGraph as useAppGraph3 } from "@dxos/app-toolkit/ui";
894
+ import { useNode as useNode2 } from "@dxos/plugin-graph";
895
+ import { useAttended } from "@dxos/react-ui-attention";
896
+ var ActiveNode = () => {
897
+ const [id] = useAttended();
898
+ const { graph } = useAppGraph3();
899
+ const activeNode = useNode2(graph, id);
900
+ useNodeActionExpander(activeNode);
901
+ return /* @__PURE__ */ React10.createElement("div", {
902
+ role: "none",
903
+ className: "sr-only"
904
+ }, /* @__PURE__ */ React10.createElement(Surface6.Surface, {
905
+ role: "document-title",
906
+ data: {
907
+ subject: activeNode
908
+ },
909
+ limit: 1
910
+ }));
911
+ };
912
+
913
+ // src/components/DeckLayout/DeckMain.tsx
914
+ import React14, { Fragment as Fragment3, useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2 } from "react";
915
+ import { useAtomCapability, useOperationInvoker as useOperationInvoker6, usePluginManager } from "@dxos/app-framework/ui";
916
+ import { LayoutOperation as LayoutOperation5 } from "@dxos/app-toolkit";
917
+ import { AttentionCapabilities } from "@dxos/plugin-attention";
918
+ import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
919
+ import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from "@dxos/react-ui-stack";
920
+ import { mainPaddingTransitions, mx as mx6 } from "@dxos/ui-theme";
921
+
922
+ // src/components/DeckLayout/ContentEmpty.tsx
923
+ import React11 from "react";
924
+ import { Surface as Surface7 } from "@dxos/app-framework/ui";
925
+ var ContentEmpty = () => {
926
+ const breakpoint = useBreakpoints();
927
+ const { deck } = useDeckState();
928
+ const layoutMode = getMode(deck);
929
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
930
+ return /* @__PURE__ */ React11.createElement("div", {
931
+ role: "none",
932
+ className: "grid place-items-center p-8 relative bg-deckSurface",
933
+ "data-testid": "layoutPlugin.firstRunMessage"
934
+ }, /* @__PURE__ */ React11.createElement(Surface7.Surface, {
935
+ role: "keyshortcuts"
936
+ }), !topbar && /* @__PURE__ */ React11.createElement(ToggleSidebarButton, {
937
+ variant: "default",
938
+ classNames: fixedSidebarToggleStyles
939
+ }));
940
+ };
941
+
942
+ // src/components/DeckLayout/StatusBar.tsx
943
+ import React12 from "react";
944
+ import { Surface as Surface8 } from "@dxos/app-framework/ui";
945
+ import { useLandmarkMover } from "@dxos/react-ui";
946
+ var StatusBar = ({ showHints }) => {
947
+ const mover = useLandmarkMover(void 0, "3");
948
+ return /* @__PURE__ */ React12.createElement("div", {
949
+ role: "contentinfo",
950
+ className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
951
+ ...mover
952
+ }, showHints && /* @__PURE__ */ React12.createElement(Surface8.Surface, {
953
+ role: "hints",
954
+ limit: 1
955
+ }), /* @__PURE__ */ React12.createElement(Surface8.Surface, {
956
+ role: "status-bar",
957
+ limit: 1
958
+ }));
959
+ };
960
+
961
+ // src/components/DeckLayout/Topbar.tsx
962
+ import React13 from "react";
963
+ var Topbar = () => {
964
+ return /* @__PURE__ */ React13.createElement(Banner, {
965
+ variant: "topbar"
966
+ });
967
+ };
968
+
969
+ // src/components/DeckLayout/DeckMain.tsx
970
+ var DeckMain = () => {
971
+ const { invokeSync } = useOperationInvoker6();
972
+ const settings = useAtomCapability(DeckCapabilities.Settings);
973
+ const { state, deck, updateState } = useDeckState();
974
+ const { sidebarState, complementarySidebarState, complementarySidebarPanel } = state;
975
+ const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
976
+ const layoutMode = getMode(deck);
977
+ const breakpoint = useBreakpoints();
978
+ const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
979
+ const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
980
+ const pluginManager = usePluginManager();
981
+ const scrollLeftRef = useRef2(null);
982
+ const deckRef = useRef2(null);
983
+ useEffect4(() => {
984
+ const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
985
+ const attended = attention.getCurrent();
986
+ const firstId = solo ?? active[0];
987
+ if (attended.length === 0 && firstId) {
988
+ document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
989
+ }
990
+ }, []);
991
+ const [isNotMobile] = useMediaQuery("md");
992
+ const shouldRevert = useRef2(false);
993
+ useEffect4(() => {
994
+ if (!isNotMobile && layoutMode === "deck") {
995
+ const attention = pluginManager.capabilities.get(AttentionCapabilities.Attention);
996
+ const attended = attention.getCurrent();
997
+ shouldRevert.current = true;
998
+ invokeSync(LayoutOperation5.SetLayoutMode, {
999
+ subject: attended[0],
1000
+ mode: "solo"
1001
+ });
1002
+ } else if (isNotMobile && layoutMode === "solo" && shouldRevert.current) {
1003
+ invokeSync(LayoutOperation5.SetLayoutMode, {
1004
+ revert: true
1005
+ });
1006
+ }
1007
+ }, [
1008
+ isNotMobile,
1009
+ layoutMode,
1010
+ invokeSync
1011
+ ]);
1012
+ useEffect4(() => {
1013
+ if (!settings?.enableDeck && layoutMode === "deck") {
1014
+ invokeSync(LayoutOperation5.SetLayoutMode, {
1015
+ subject: active[0],
1016
+ mode: "solo"
1017
+ });
1018
+ }
1019
+ }, [
1020
+ settings?.enableDeck,
1021
+ invokeSync,
1022
+ active,
1023
+ layoutMode
1024
+ ]);
1025
+ const handleResize = useCallback6(() => {
1026
+ scrollLeftRef.current = null;
1027
+ }, []);
1028
+ useEffect4(() => {
1029
+ window.addEventListener("resize", handleResize);
1030
+ return () => window.removeEventListener("resize", handleResize);
1031
+ }, [
1032
+ handleResize
1033
+ ]);
1034
+ const restoreScroll = useCallback6(() => {
1035
+ if (deckRef.current && scrollLeftRef.current != null) {
1036
+ deckRef.current.scrollLeft = scrollLeftRef.current;
1037
+ }
1038
+ }, []);
1039
+ useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
1040
+ const handleScroll = useCallback6((event) => {
1041
+ if (!solo && event.currentTarget === event.target) {
1042
+ scrollLeftRef.current = event.target.scrollLeft;
1043
+ }
1044
+ }, [
1045
+ solo
1046
+ ]);
1047
+ const isEmpty = !solo && active.length === 0;
1048
+ const padding = useMemo5(() => {
1049
+ if (!solo && settings?.overscroll === "centering") {
1050
+ return calculateOverscroll(active.length);
1051
+ }
1052
+ return {};
1053
+ }, [
1054
+ solo,
1055
+ settings?.overscroll,
1056
+ deck
1057
+ ]);
1058
+ const mainPosition = useMemo5(() => [
1059
+ "grid !block-start-[env(safe-area-inset-top)]",
1060
+ topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
1061
+ hoistStatusbar && "lg:block-end-[--statusbar-size]"
1062
+ ], [
1063
+ topbar,
1064
+ hoistStatusbar
1065
+ ]);
1066
+ const { order, itemsCount } = useMemo5(() => {
1067
+ return active.reduce((acc, entryId) => {
1068
+ acc.order[entryId] = acc.itemsCount + 1;
1069
+ acc.itemsCount += activeCompanions?.[entryId] ? 3 : 2;
1070
+ return acc;
1071
+ }, {
1072
+ order: {},
1073
+ itemsCount: 0
1074
+ });
1075
+ }, [
1076
+ active,
1077
+ activeCompanions
1078
+ ]);
1079
+ const handleNavigationSidebarStateChange = useCallback6((next) => {
1080
+ updateState((s) => ({
1081
+ ...s,
1082
+ sidebarState: next
1083
+ }));
1084
+ }, [
1085
+ updateState
1086
+ ]);
1087
+ const handleComplementarySidebarStateChange = useCallback6((next) => {
1088
+ updateState((s) => ({
1089
+ ...s,
1090
+ complementarySidebarState: next
1091
+ }));
1092
+ }, [
1093
+ updateState
1094
+ ]);
1095
+ return /* @__PURE__ */ React14.createElement(Main3.Root, {
1096
+ navigationSidebarState: fullscreen ? "closed" : sidebarState,
1097
+ complementarySidebarState: fullscreen ? "closed" : complementarySidebarState,
1098
+ onNavigationSidebarStateChange: handleNavigationSidebarStateChange,
1099
+ onComplementarySidebarStateChange: handleComplementarySidebarStateChange
1100
+ }, /* @__PURE__ */ React14.createElement(Sidebar, null), /* @__PURE__ */ React14.createElement(ComplementarySidebar, {
1101
+ current: complementarySidebarPanel
1102
+ }), /* @__PURE__ */ React14.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
1103
+ bounce: true,
1104
+ handlesFocus: true,
1105
+ classNames: mainPosition
1106
+ }, /* @__PURE__ */ React14.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
1107
+ bounce: true,
1108
+ handlesFocus: true,
1109
+ classNames: mainPosition,
1110
+ style: {
1111
+ "--main-spacing": settings?.encapsulatedPlanks ? "0.75rem" : "0",
1112
+ "--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
1113
+ "--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
1114
+ "--dx-main-contentFirstWidth": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
1115
+ "--dx-main-contentLastWidth": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
1116
+ }
1117
+ }, /* @__PURE__ */ React14.createElement("div", {
1118
+ role: "none",
1119
+ className: !solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
1120
+ ...solo && {
1121
+ inert: true
1122
+ }
1123
+ }, !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
1124
+ classNames: fixedSidebarToggleStyles
1125
+ }), !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
1126
+ classNames: fixedComplementarySidebarToggleStyles
1127
+ }), /* @__PURE__ */ React14.createElement(Stack, {
1128
+ ref: deckRef,
1129
+ orientation: "horizontal",
1130
+ size: "contain",
1131
+ itemsCount: itemsCount - 1,
1132
+ classNames: [
1133
+ "absolute inset-block-[--main-spacing] -inset-inline-px bs-[calc(100%-2*var(--main-spacing))]",
1134
+ mainPaddingTransitions
1135
+ ],
1136
+ style: padding,
1137
+ onScroll: handleScroll
1138
+ }, active.map((entryId) => /* @__PURE__ */ React14.createElement(Fragment3, {
1139
+ key: entryId
1140
+ }, /* @__PURE__ */ React14.createElement(PlankSeparator, {
1141
+ order: order[entryId] - 1,
1142
+ encapsulate: !!settings?.enableDeck
1143
+ }), /* @__PURE__ */ React14.createElement(Plank, {
1144
+ id: entryId,
1145
+ companionId: activeCompanions?.[entryId],
1146
+ part: "deck",
1147
+ order: order[entryId],
1148
+ active,
1149
+ layoutMode,
1150
+ settings
1151
+ }))))), /* @__PURE__ */ React14.createElement("div", {
1152
+ role: "none",
1153
+ className: solo ? "relative overflow-hidden bg-deckSurface" : "sr-only",
1154
+ ...!solo && {
1155
+ inert: true
1156
+ }
1157
+ }, !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleSidebarButton, {
1158
+ classNames: fixedSidebarToggleStyles
1159
+ }), !topbar && !fullscreen && /* @__PURE__ */ React14.createElement(ToggleComplementarySidebarButton, {
1160
+ classNames: fixedComplementarySidebarToggleStyles
1161
+ }), /* @__PURE__ */ React14.createElement(StackContext.Provider, {
1162
+ value: {
1163
+ orientation: "horizontal",
1164
+ size: "contain",
1165
+ rail: true
1166
+ }
1167
+ }, /* @__PURE__ */ React14.createElement(Plank, {
1168
+ id: solo,
1169
+ companionId: solo ? activeCompanions?.[solo] : void 0,
1170
+ part: "solo",
1171
+ layoutMode,
1172
+ settings
1173
+ })))), topbar && /* @__PURE__ */ React14.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React14.createElement(StatusBar, {
1174
+ showHints: settings?.showHints
1175
+ }));
1176
+ };
1177
+ var PlankSeparator = ({ order, encapsulate }) => order > 0 ? /* @__PURE__ */ React14.createElement("span", {
1178
+ role: "separator",
1179
+ className: mx6("row-span-2 bg-deckSurface", encapsulate ? "is-0" : "is-4"),
1180
+ style: {
1181
+ gridColumn: order
1182
+ }
1183
+ }) : null;
1184
+
1185
+ // src/components/DeckLayout/Dialog.tsx
1186
+ import React15, { useCallback as useCallback7 } from "react";
1187
+ import { Surface as Surface9 } from "@dxos/app-framework/ui";
1188
+ import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
1189
+ var Dialog = () => {
1190
+ const { state, updateEphemeral } = useDeckState();
1191
+ const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = state;
1192
+ const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
1193
+ const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
1194
+ const handleOpenChange = useCallback7((nextOpen) => {
1195
+ updateEphemeral((s) => ({
1196
+ ...s,
1197
+ dialogOpen: nextOpen
1198
+ }));
1199
+ }, [
1200
+ updateEphemeral
1201
+ ]);
1202
+ return /* @__PURE__ */ React15.createElement(Root, {
1203
+ modal: dialogBlockAlign !== "end",
1204
+ open: dialogOpen,
1205
+ onOpenChange: handleOpenChange
1206
+ }, dialogBlockAlign === "end" ? (
1207
+ // TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
1208
+ /* @__PURE__ */ React15.createElement(Surface9.Surface, {
1209
+ role: "dialog",
1210
+ data: dialogContent,
1211
+ limit: 1,
1212
+ fallback: PlankContentError,
1213
+ placeholder: /* @__PURE__ */ React15.createElement("div", null)
1214
+ })
1215
+ ) : /* @__PURE__ */ React15.createElement(Overlay, {
1216
+ blockAlign: dialogBlockAlign,
1217
+ classNames: dialogOverlayClasses,
1218
+ style: dialogOverlayStyle
1219
+ }, /* @__PURE__ */ React15.createElement(Surface9.Surface, {
1220
+ role: "dialog",
1221
+ data: dialogContent,
1222
+ limit: 1,
1223
+ fallback: PlankContentError
1224
+ })));
1225
+ };
1226
+
1227
+ // src/components/DeckLayout/Popover.tsx
1228
+ import { createContext } from "@radix-ui/react-context";
1229
+ import React16, { useCallback as useCallback8, useEffect as useEffect5, useRef as useRef3, useState as useState3 } from "react";
1230
+ import { Surface as Surface10, useOperationInvoker as useOperationInvoker7 } from "@dxos/app-framework/ui";
1231
+ import { LayoutOperation as LayoutOperation6 } from "@dxos/app-toolkit";
1232
+ import { Popover as Popover2, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
1233
+ import { Card } from "@dxos/react-ui-mosaic";
1234
+ var DEBOUNCE_DELAY = 40;
1235
+ var [DeckPopoverProvider, useDeckPopoverContext] = createContext("DeckPopover");
1236
+ var PopoverRoot = ({ children }) => {
1237
+ const { state } = useDeckState();
1238
+ const virtualRef = useRef3(null);
1239
+ const [virtualIter, setVirtualIter] = useState3(0);
1240
+ const [open, setOpen] = useState3(false);
1241
+ const debounceRef = useRef3(null);
1242
+ useEffect5(() => {
1243
+ setOpen(false);
1244
+ if (state.popoverOpen) {
1245
+ if (debounceRef.current) {
1246
+ clearTimeout(debounceRef.current);
1247
+ }
1248
+ if (state.popoverAnchor && virtualRef.current !== state.popoverAnchor) {
1249
+ virtualRef.current = state.popoverAnchor ?? null;
1250
+ setVirtualIter((iter) => iter + 1);
1251
+ }
1252
+ debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
1253
+ }
1254
+ }, [
1255
+ state.popoverOpen,
1256
+ state.popoverAnchorId,
1257
+ state.popoverAnchor,
1258
+ state.popoverContent
1259
+ ]);
1260
+ return /* @__PURE__ */ React16.createElement(DeckPopoverProvider, {
1261
+ setOpen
1262
+ }, /* @__PURE__ */ React16.createElement(Popover2.Root, {
1263
+ modal: false,
1264
+ open
1265
+ }, state.popoverAnchor && /* @__PURE__ */ React16.createElement(Popover2.VirtualTrigger, {
1266
+ key: virtualIter,
1267
+ virtualRef
1268
+ }), children));
1269
+ };
1270
+ var PopoverContent = () => {
1271
+ const { t } = useTranslation7(meta.id);
1272
+ const { state, updateEphemeral } = useDeckState();
1273
+ const { setOpen } = useDeckPopoverContext("PopoverContent");
1274
+ const { invokeSync } = useOperationInvoker7();
1275
+ const handleClose = useCallback8(() => {
1276
+ setOpen(false);
1277
+ updateEphemeral((state2) => ({
1278
+ ...state2,
1279
+ popoverOpen: false,
1280
+ popoverAnchor: void 0,
1281
+ popoverAnchorId: void 0,
1282
+ popoverSide: void 0
1283
+ }));
1284
+ }, [
1285
+ updateEphemeral
1286
+ ]);
1287
+ const handleInteractOutside = useCallback8((event) => {
1288
+ if (
1289
+ // TODO(thure): CodeMirror should not focus itself when it updates.
1290
+ event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
1291
+ ) {
1292
+ event.preventDefault();
1293
+ } else {
1294
+ handleClose();
1295
+ }
1296
+ }, [
1297
+ handleClose
1298
+ ]);
1299
+ return /* @__PURE__ */ React16.createElement(Popover2.Portal, null, /* @__PURE__ */ React16.createElement(Popover2.Content, {
1300
+ side: state.popoverSide,
1301
+ sticky: "always",
1302
+ hideWhenDetached: true,
1303
+ onInteractOutside: handleInteractOutside,
1304
+ onEscapeKeyDown: handleInteractOutside
1305
+ }, /* @__PURE__ */ React16.createElement(Popover2.Viewport, null, state.popoverKind === "base" && /* @__PURE__ */ React16.createElement(Surface10.Surface, {
1306
+ role: "popover",
1307
+ data: state.popoverContent,
1308
+ limit: 1
1309
+ }), state.popoverKind === "card" && /* @__PURE__ */ React16.createElement(Card.Root, {
1310
+ border: false,
1311
+ classNames: "popover-card-max-width"
1312
+ }, /* @__PURE__ */ React16.createElement(Card.Toolbar, null, state.popoverContentRef ? /* @__PURE__ */ React16.createElement(Card.ToolbarIconButton, {
1313
+ icon: "ph--arrow-square-out--regular",
1314
+ iconOnly: true,
1315
+ label: t("open item label"),
1316
+ onClick: () => {
1317
+ invokeSync(LayoutOperation6.Open, {
1318
+ subject: [
1319
+ state.popoverContentRef
1320
+ ]
1321
+ });
1322
+ }
1323
+ }) : /* @__PURE__ */ React16.createElement("div", null), state.popoverTitle ? /* @__PURE__ */ React16.createElement(Card.Title, null, toLocalizedString3(state.popoverTitle, t)) : /* @__PURE__ */ React16.createElement("span", null), /* @__PURE__ */ React16.createElement(Card.Close, {
1324
+ onClick: handleClose
1325
+ })), /* @__PURE__ */ React16.createElement(Surface10.Surface, {
1326
+ role: "card--content",
1327
+ data: state.popoverContent,
1328
+ limit: 1
1329
+ }))), /* @__PURE__ */ React16.createElement(Popover2.Arrow, null)));
1330
+ };
1331
+
1332
+ // src/components/DeckLayout/Toast.tsx
1333
+ import React17 from "react";
1334
+ import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString4, useTranslation as useTranslation8 } from "@dxos/react-ui";
1335
+ var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
1336
+ const { t } = useTranslation8(meta.id);
1337
+ return /* @__PURE__ */ React17.createElement(NaturalToast.Root, {
1338
+ "data-testid": id,
1339
+ defaultOpen: true,
1340
+ duration,
1341
+ onOpenChange
1342
+ }, /* @__PURE__ */ React17.createElement(NaturalToast.Body, null, /* @__PURE__ */ React17.createElement(NaturalToast.Title, {
1343
+ classNames: "items-center"
1344
+ }, icon && /* @__PURE__ */ React17.createElement(Icon2, {
1345
+ icon,
1346
+ classNames: "inline mr-1"
1347
+ }), title && /* @__PURE__ */ React17.createElement("span", null, toLocalizedString4(title, t))), description && /* @__PURE__ */ React17.createElement(NaturalToast.Description, null, description && toLocalizedString4(description, t))), /* @__PURE__ */ React17.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React17.createElement(NaturalToast.Action, {
1348
+ altText: toLocalizedString4(actionAlt, t),
1349
+ asChild: true
1350
+ }, /* @__PURE__ */ React17.createElement(Button, {
1351
+ "data-testid": "toast.action",
1352
+ variant: "primary",
1353
+ onClick: () => onAction?.()
1354
+ }, toLocalizedString4(actionLabel, t))), closeLabel && /* @__PURE__ */ React17.createElement(NaturalToast.Close, {
1355
+ asChild: true
1356
+ }, /* @__PURE__ */ React17.createElement(Button, {
1357
+ "data-testid": "toast.close"
1358
+ }, toLocalizedString4(closeLabel, t)))));
1359
+ };
1360
+ var Toaster = ({ toasts, onDismissToast }) => {
1361
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
1362
+ ...toast,
1363
+ key: toast.id,
1364
+ onOpenChange: (open) => {
1365
+ if (!open) {
1366
+ onDismissToast?.(toast.id);
1367
+ }
1368
+ return open;
1369
+ }
1370
+ })));
1371
+ };
1372
+
1373
+ // src/components/DeckLayout/DeckLayout.tsx
1374
+ var DeckLayout = ({ onDismissToast }) => {
1375
+ const { state } = useDeckState();
1376
+ const { toasts } = state;
1377
+ return /* @__PURE__ */ React18.createElement(Mosaic.Root, null, /* @__PURE__ */ React18.createElement(PopoverRoot, null, /* @__PURE__ */ React18.createElement(ActiveNode, null), /* @__PURE__ */ React18.createElement(DeckMain, null), /* @__PURE__ */ React18.createElement(PopoverContent, null), /* @__PURE__ */ React18.createElement(Dialog, null), /* @__PURE__ */ React18.createElement(Toaster, {
1378
+ toasts,
1379
+ onDismissToast
1380
+ })));
1381
+ };
1382
+
1383
+ // src/components/DeckSettings/DeckSettings.tsx
1384
+ import React19 from "react";
1385
+ import { Input, Select, useTranslation as useTranslation9 } from "@dxos/react-ui";
1386
+ import { Settings } from "@dxos/react-ui-form";
1387
+ var isSocket = !!globalThis.__args;
1388
+ var DeckSettings = ({ settings, onSettingsChange }) => {
1389
+ const { t } = useTranslation9(meta.id);
1390
+ return /* @__PURE__ */ React19.createElement(Settings.Root, null, /* @__PURE__ */ React19.createElement(Settings.Section, {
1391
+ title: t("settings title", {
1392
+ ns: meta.id
1393
+ })
1394
+ }, /* @__PURE__ */ React19.createElement(Settings.Group, null, /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1395
+ title: t("settings enable deck label")
1396
+ }, /* @__PURE__ */ React19.createElement(Input.Switch, {
1397
+ checked: settings.enableDeck,
1398
+ onCheckedChange: (checked) => onSettingsChange((s) => ({
1399
+ ...s,
1400
+ enableDeck: checked
1401
+ }))
1402
+ })), /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1403
+ title: t("settings encapsulated planks label")
1404
+ }, /* @__PURE__ */ React19.createElement(Input.Switch, {
1405
+ checked: settings.encapsulatedPlanks ?? false,
1406
+ onCheckedChange: (checked) => onSettingsChange((s) => ({
1407
+ ...s,
1408
+ encapsulatedPlanks: checked
1409
+ }))
1410
+ })), /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1411
+ title: t("select new plank positioning label")
1412
+ }, /* @__PURE__ */ React19.createElement(Select.Root, {
1413
+ disabled: !settings.enableDeck,
1414
+ value: settings.newPlankPositioning ?? "start",
1415
+ onValueChange: (value) => onSettingsChange((s) => ({
1416
+ ...s,
1417
+ newPlankPositioning: value
1418
+ }))
1419
+ }, /* @__PURE__ */ React19.createElement(Select.TriggerButton, {
1420
+ placeholder: t("select new plank positioning placeholder")
1421
+ }), /* @__PURE__ */ React19.createElement(Select.Portal, null, /* @__PURE__ */ React19.createElement(Select.Content, null, /* @__PURE__ */ React19.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React19.createElement(Select.Option, {
1422
+ key: position,
1423
+ value: position
1424
+ }, t(`settings new plank position ${position} label`)))), /* @__PURE__ */ React19.createElement(Select.Arrow, null))))), /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1425
+ title: t("settings overscroll label")
1426
+ }, /* @__PURE__ */ React19.createElement(Select.Root, {
1427
+ disabled: !settings.enableDeck,
1428
+ value: settings.overscroll ?? "none",
1429
+ onValueChange: (value) => onSettingsChange((s) => ({
1430
+ ...s,
1431
+ overscroll: value
1432
+ }))
1433
+ }, /* @__PURE__ */ React19.createElement(Select.TriggerButton, {
1434
+ placeholder: t("select overscroll placeholder")
1435
+ }), /* @__PURE__ */ React19.createElement(Select.Portal, null, /* @__PURE__ */ React19.createElement(Select.Content, null, /* @__PURE__ */ React19.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React19.createElement(Select.Option, {
1436
+ key: option,
1437
+ value: option
1438
+ }, t(`settings overscroll ${option} label`)))), /* @__PURE__ */ React19.createElement(Select.Arrow, null))))), /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1439
+ title: t("settings enable statusbar label")
1440
+ }, /* @__PURE__ */ React19.createElement(Input.Switch, {
1441
+ checked: settings.enableStatusbar,
1442
+ onCheckedChange: (checked) => onSettingsChange((s) => ({
1443
+ ...s,
1444
+ enableStatusbar: checked
1445
+ }))
1446
+ })), /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1447
+ title: t("settings show hints label")
1448
+ }, /* @__PURE__ */ React19.createElement(Input.Switch, {
1449
+ checked: settings.showHints,
1450
+ onCheckedChange: (checked) => onSettingsChange((s) => ({
1451
+ ...s,
1452
+ showHints: checked
1453
+ }))
1454
+ })), !isSocket && /* @__PURE__ */ React19.createElement(Settings.ItemInput, {
1455
+ title: t("settings native redirect label")
1456
+ }, /* @__PURE__ */ React19.createElement(Input.Switch, {
1457
+ checked: settings.enableNativeRedirect,
1458
+ onCheckedChange: (checked) => onSettingsChange((s) => ({
1459
+ ...s,
1460
+ enableNativeRedirect: checked
1461
+ }))
1462
+ })))));
1463
+ };
1464
+
1465
+ export {
1466
+ Banner,
1467
+ DeckLayout,
1468
+ DeckSettings
1469
+ };
1470
+ //# sourceMappingURL=chunk-7NPS347C.mjs.map