@dxos/plugin-deck 0.8.4-main.c4373fc → 0.8.4-main.d05673bc65

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