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