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