@dxos/plugin-deck 0.8.4-main.c1de068 → 0.8.4-main.c351d160a8

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