@dxos/plugin-sheet 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc

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 (355) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs +46 -0
  3. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +7 -0
  4. package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs +33 -0
  5. package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs.map +7 -0
  6. package/dist/lib/neutral/SheetPlugin.mjs +48 -0
  7. package/dist/lib/neutral/SheetPlugin.mjs.map +7 -0
  8. package/dist/lib/neutral/SheetPlugin.node.mjs +27 -0
  9. package/dist/lib/neutral/SheetPlugin.node.mjs.map +7 -0
  10. package/dist/lib/neutral/SheetPlugin.workerd.mjs +21 -0
  11. package/dist/lib/neutral/SheetPlugin.workerd.mjs.map +7 -0
  12. package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs +22 -0
  13. package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs.map +7 -0
  14. package/dist/lib/neutral/capabilities/index.mjs +25 -0
  15. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  16. package/dist/lib/{browser/chunk-7VEWYJJN.mjs → neutral/chunk-4SBAIU6F.mjs} +15 -15
  17. package/dist/lib/neutral/chunk-4SBAIU6F.mjs.map +7 -0
  18. package/dist/lib/neutral/chunk-CGWDLWFZ.mjs +8 -0
  19. package/dist/lib/neutral/chunk-CGWDLWFZ.mjs.map +7 -0
  20. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  21. package/dist/lib/neutral/chunk-KC2SMDNF.mjs +373 -0
  22. package/dist/lib/neutral/chunk-KC2SMDNF.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-YFY6U524.mjs +83 -0
  24. package/dist/lib/neutral/chunk-YFY6U524.mjs.map +7 -0
  25. package/dist/lib/{browser/chunk-FWFAAGXL.mjs → neutral/chunk-ZWOQCLH7.mjs} +2 -9
  26. package/dist/lib/neutral/chunk-ZWOQCLH7.mjs.map +7 -0
  27. package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs +20 -0
  28. package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs.map +7 -0
  29. package/dist/lib/neutral/components/index.mjs +1551 -0
  30. package/dist/lib/neutral/components/index.mjs.map +7 -0
  31. package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs +20 -0
  32. package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs.map +7 -0
  33. package/dist/lib/neutral/containers/index.mjs +11 -0
  34. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  35. package/dist/lib/neutral/create-object-OKQAXJCW.mjs +27 -0
  36. package/dist/lib/neutral/create-object-OKQAXJCW.mjs.map +7 -0
  37. package/dist/lib/neutral/drop-axis-G6UOXG54.mjs +23 -0
  38. package/dist/lib/neutral/drop-axis-G6UOXG54.mjs.map +7 -0
  39. package/dist/lib/{node-esm/types → neutral}/index.mjs +14 -3
  40. package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs +16 -0
  41. package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs.map +7 -0
  42. package/dist/lib/neutral/markdown-I2AKJYPF.mjs +28 -0
  43. package/dist/lib/neutral/markdown-I2AKJYPF.mjs.map +7 -0
  44. package/dist/lib/neutral/meta.json +1 -0
  45. package/dist/lib/neutral/meta.mjs +8 -0
  46. package/dist/lib/neutral/meta.mjs.map +7 -0
  47. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +13 -0
  48. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +7 -0
  49. package/dist/lib/neutral/operations/index.mjs +8 -0
  50. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  51. package/dist/lib/neutral/plugin.mjs +16 -0
  52. package/dist/lib/neutral/plugin.mjs.map +7 -0
  53. package/dist/lib/neutral/react-surface-VSTQNVPT.mjs +44 -0
  54. package/dist/lib/neutral/react-surface-VSTQNVPT.mjs.map +7 -0
  55. package/dist/lib/neutral/restore-axis-44DM6N54.mjs +16 -0
  56. package/dist/lib/neutral/restore-axis-44DM6N54.mjs.map +7 -0
  57. package/dist/lib/neutral/scroll-to-anchor-QPOGMAQG.mjs +33 -0
  58. package/dist/lib/neutral/scroll-to-anchor-QPOGMAQG.mjs.map +7 -0
  59. package/dist/lib/neutral/state-HPA27MX2.mjs +29 -0
  60. package/dist/lib/neutral/state-HPA27MX2.mjs.map +7 -0
  61. package/dist/lib/neutral/testing/index.mjs +103 -0
  62. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  63. package/dist/lib/neutral/translations.mjs +55 -0
  64. package/dist/lib/neutral/translations.mjs.map +7 -0
  65. package/dist/lib/{browser → neutral}/types/index.mjs +6 -2
  66. package/dist/lib/neutral/types/index.mjs.map +7 -0
  67. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs +31 -0
  68. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs.map +7 -0
  69. package/dist/types/src/SheetPlugin.d.ts +3 -1
  70. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  71. package/dist/types/src/SheetPlugin.node.d.ts +4 -0
  72. package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
  73. package/dist/types/src/SheetPlugin.test.d.ts +2 -0
  74. package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
  75. package/dist/types/src/SheetPlugin.workerd.d.ts +4 -0
  76. package/dist/types/src/SheetPlugin.workerd.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/anchor-sort.d.ts +4 -4
  78. package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/comment-config.d.ts +12 -0
  80. package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/compute-graph-registry.d.ts +3 -2
  82. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  84. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  85. package/dist/types/src/capabilities/index.d.ts +23 -9
  86. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  87. package/dist/types/src/capabilities/markdown.d.ts +3 -2
  88. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  90. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  92. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  93. package/dist/types/src/capabilities/state.d.ts +6 -0
  94. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
  96. package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
  97. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  98. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  99. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  100. package/dist/types/src/components/Sheet/Sheet.d.ts +17 -0
  101. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
  102. package/dist/types/src/components/Sheet/index.d.ts +2 -0
  103. package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
  104. package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +1 -1
  105. package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
  106. package/dist/types/src/components/SheetContent/SheetContent.d.ts +6 -0
  107. package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
  108. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +93 -0
  109. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
  110. package/dist/types/src/components/SheetContent/index.d.ts +2 -0
  111. package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
  112. package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +1 -1
  113. package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
  114. package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +8 -6
  115. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
  116. package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
  117. package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
  118. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +6 -0
  119. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
  120. package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
  121. package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
  122. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -5
  123. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  124. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -66
  125. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  126. package/dist/types/src/components/SheetToolbar/align.d.ts +14 -21
  127. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  128. package/dist/types/src/components/SheetToolbar/style.d.ts +14 -20
  129. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  130. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -1
  131. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
  132. package/dist/types/src/components/index.d.ts +1 -4
  133. package/dist/types/src/components/index.d.ts.map +1 -1
  134. package/dist/types/src/containers/RangeList/RangeList.d.ts +7 -0
  135. package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
  136. package/dist/types/src/containers/RangeList/index.d.ts +2 -0
  137. package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
  138. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts +12 -0
  139. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts.map +1 -0
  140. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts +92 -0
  141. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts.map +1 -0
  142. package/dist/types/src/containers/SheetArticle/index.d.ts +2 -0
  143. package/dist/types/src/containers/SheetArticle/index.d.ts.map +1 -0
  144. package/dist/types/src/containers/index.d.ts +4 -0
  145. package/dist/types/src/containers/index.d.ts.map +1 -0
  146. package/dist/types/src/extensions/compute.d.ts +1 -1
  147. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  148. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  149. package/dist/types/src/extensions/editor/sheet-extension.d.ts +1 -1
  150. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
  151. package/dist/types/src/index.d.ts +2 -2
  152. package/dist/types/src/index.d.ts.map +1 -1
  153. package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
  154. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  155. package/dist/types/src/meta.d.ts +2 -2
  156. package/dist/types/src/meta.d.ts.map +1 -1
  157. package/dist/types/src/model/sheet-model.d.ts +4 -4
  158. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  159. package/dist/types/src/model/testing.d.ts +1 -1
  160. package/dist/types/src/model/testing.d.ts.map +1 -1
  161. package/dist/types/src/model/useSheetModel.d.ts +2 -2
  162. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  163. package/dist/types/src/operations/drop-axis.d.ts +5 -0
  164. package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
  165. package/dist/types/src/operations/index.d.ts +3 -0
  166. package/dist/types/src/operations/index.d.ts.map +1 -0
  167. package/dist/types/src/operations/insert-axis.d.ts +5 -0
  168. package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
  169. package/dist/types/src/operations/restore-axis.d.ts +5 -0
  170. package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
  171. package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
  172. package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
  173. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
  174. package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
  175. package/dist/types/src/plugin.d.ts +4 -0
  176. package/dist/types/src/plugin.d.ts.map +1 -0
  177. package/dist/types/src/serializer.d.ts +2 -2
  178. package/dist/types/src/serializer.d.ts.map +1 -1
  179. package/dist/types/src/testing/data.d.ts +1 -1
  180. package/dist/types/src/testing/data.d.ts.map +1 -1
  181. package/dist/types/src/testing/testing.d.ts +17 -17
  182. package/dist/types/src/testing/testing.d.ts.map +1 -1
  183. package/dist/types/src/translations.d.ts +74 -38
  184. package/dist/types/src/translations.d.ts.map +1 -1
  185. package/dist/types/src/types/Sheet.d.ts +41 -35
  186. package/dist/types/src/types/Sheet.d.ts.map +1 -1
  187. package/dist/types/src/types/SheetCapabilities.d.ts +16 -0
  188. package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -0
  189. package/dist/types/src/types/SheetOperation.d.ts +45 -0
  190. package/dist/types/src/types/SheetOperation.d.ts.map +1 -0
  191. package/dist/types/src/types/index.d.ts +3 -1
  192. package/dist/types/src/types/index.d.ts.map +1 -1
  193. package/dist/types/src/types/sheet-range-types.d.ts +1 -1
  194. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
  195. package/dist/types/src/types/types.d.ts +2 -68
  196. package/dist/types/src/types/types.d.ts.map +1 -1
  197. package/dist/types/src/types/util.d.ts +3 -2
  198. package/dist/types/src/types/util.d.ts.map +1 -1
  199. package/dist/types/tsconfig.tsbuildinfo +1 -1
  200. package/package.json +132 -80
  201. package/src/SheetPlugin.node.ts +21 -0
  202. package/src/SheetPlugin.test.ts +30 -0
  203. package/src/SheetPlugin.tsx +37 -68
  204. package/src/SheetPlugin.workerd.ts +18 -0
  205. package/src/capabilities/anchor-sort.ts +20 -15
  206. package/src/capabilities/comment-config.ts +24 -0
  207. package/src/capabilities/compute-graph-registry.ts +19 -13
  208. package/src/capabilities/create-object.ts +30 -0
  209. package/src/capabilities/index.ts +16 -8
  210. package/src/capabilities/markdown.ts +21 -13
  211. package/src/capabilities/operation-handler.ts +16 -0
  212. package/src/capabilities/react-surface.tsx +38 -29
  213. package/src/capabilities/state.ts +29 -0
  214. package/src/capabilities/undo-mappings.ts +30 -0
  215. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
  216. package/src/components/ComputeGraph/compute-graph.stories.tsx +25 -17
  217. package/src/components/Sheet/Sheet.tsx +20 -0
  218. package/src/components/Sheet/index.ts +5 -0
  219. package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +14 -10
  220. package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +21 -20
  221. package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +82 -52
  222. package/src/components/{RangeList → SheetContent}/index.ts +1 -1
  223. package/src/components/{GridSheet → SheetContent}/util.ts +17 -10
  224. package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +55 -42
  225. package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
  226. package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +19 -7
  227. package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
  228. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +5 -5
  229. package/src/components/SheetToolbar/SheetToolbar.tsx +51 -41
  230. package/src/components/SheetToolbar/align.ts +50 -25
  231. package/src/components/SheetToolbar/style.ts +52 -22
  232. package/src/components/SheetToolbar/useToolbarState.ts +22 -5
  233. package/src/components/index.ts +1 -7
  234. package/src/{components → containers}/RangeList/RangeList.tsx +23 -18
  235. package/src/containers/RangeList/index.ts +5 -0
  236. package/src/containers/SheetArticle/SheetArticle.stories.tsx +110 -0
  237. package/src/containers/SheetArticle/SheetArticle.tsx +57 -0
  238. package/src/containers/SheetArticle/index.ts +5 -0
  239. package/src/containers/index.ts +8 -0
  240. package/src/extensions/compute.stories.tsx +29 -19
  241. package/src/extensions/compute.ts +2 -2
  242. package/src/extensions/editor/sheet-extension.test.ts +1 -1
  243. package/src/extensions/editor/sheet-extension.ts +18 -15
  244. package/src/index.ts +2 -2
  245. package/src/integrations/thread-ranges.ts +19 -62
  246. package/src/meta.ts +3 -3
  247. package/src/model/sheet-model.test.ts +5 -5
  248. package/src/model/sheet-model.ts +80 -48
  249. package/src/model/testing.ts +2 -2
  250. package/src/model/useSheetModel.ts +3 -2
  251. package/src/operations/drop-axis.ts +26 -0
  252. package/src/operations/index.ts +12 -0
  253. package/src/operations/insert-axis.ts +19 -0
  254. package/src/operations/restore-axis.ts +19 -0
  255. package/src/operations/scroll-to-anchor.ts +30 -0
  256. package/src/playwright/playwright.config.ts +1 -1
  257. package/src/playwright/sheet.spec.ts +4 -3
  258. package/src/plugin.ts +11 -0
  259. package/src/sanity.test.ts +10 -3
  260. package/src/serializer.ts +3 -3
  261. package/src/testing/data.ts +1 -1
  262. package/src/testing/testing.tsx +4 -4
  263. package/src/translations.ts +41 -35
  264. package/src/types/Sheet.ts +32 -32
  265. package/src/types/SheetCapabilities.ts +26 -0
  266. package/src/types/SheetOperation.ts +75 -0
  267. package/src/types/index.ts +4 -1
  268. package/src/types/sheet-range-types.ts +3 -3
  269. package/src/types/types.ts +4 -40
  270. package/src/types/util.ts +3 -2
  271. package/dist/lib/browser/SheetContainer-GTINUSNB.mjs +0 -349
  272. package/dist/lib/browser/SheetContainer-GTINUSNB.mjs.map +0 -7
  273. package/dist/lib/browser/anchor-sort-R5CB37J7.mjs +0 -24
  274. package/dist/lib/browser/anchor-sort-R5CB37J7.mjs.map +0 -7
  275. package/dist/lib/browser/chunk-73AV3NH6.mjs +0 -15
  276. package/dist/lib/browser/chunk-73AV3NH6.mjs.map +0 -7
  277. package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +0 -7
  278. package/dist/lib/browser/chunk-DVJ3QW3F.mjs +0 -907
  279. package/dist/lib/browser/chunk-DVJ3QW3F.mjs.map +0 -7
  280. package/dist/lib/browser/chunk-FWFAAGXL.mjs.map +0 -7
  281. package/dist/lib/browser/chunk-LS6D4GG7.mjs +0 -850
  282. package/dist/lib/browser/chunk-LS6D4GG7.mjs.map +0 -7
  283. package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs +0 -21
  284. package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs.map +0 -7
  285. package/dist/lib/browser/index.mjs +0 -154
  286. package/dist/lib/browser/index.mjs.map +0 -7
  287. package/dist/lib/browser/intent-resolver-66OAYVQF.mjs +0 -56
  288. package/dist/lib/browser/intent-resolver-66OAYVQF.mjs.map +0 -7
  289. package/dist/lib/browser/markdown-B6VKYY2S.mjs +0 -26
  290. package/dist/lib/browser/markdown-B6VKYY2S.mjs.map +0 -7
  291. package/dist/lib/browser/meta.json +0 -1
  292. package/dist/lib/browser/react-surface-F3VQPGDV.mjs +0 -53
  293. package/dist/lib/browser/react-surface-F3VQPGDV.mjs.map +0 -7
  294. package/dist/lib/node-esm/SheetContainer-PW4KNZME.mjs +0 -350
  295. package/dist/lib/node-esm/SheetContainer-PW4KNZME.mjs.map +0 -7
  296. package/dist/lib/node-esm/anchor-sort-HEND452H.mjs +0 -25
  297. package/dist/lib/node-esm/anchor-sort-HEND452H.mjs.map +0 -7
  298. package/dist/lib/node-esm/chunk-44YTKTMP.mjs +0 -16
  299. package/dist/lib/node-esm/chunk-44YTKTMP.mjs.map +0 -7
  300. package/dist/lib/node-esm/chunk-4H2EHVWE.mjs +0 -908
  301. package/dist/lib/node-esm/chunk-4H2EHVWE.mjs.map +0 -7
  302. package/dist/lib/node-esm/chunk-4QV4AGWK.mjs +0 -236
  303. package/dist/lib/node-esm/chunk-4QV4AGWK.mjs.map +0 -7
  304. package/dist/lib/node-esm/chunk-HILDMVPL.mjs +0 -29
  305. package/dist/lib/node-esm/chunk-HILDMVPL.mjs.map +0 -7
  306. package/dist/lib/node-esm/chunk-LYUIM3QG.mjs +0 -851
  307. package/dist/lib/node-esm/chunk-LYUIM3QG.mjs.map +0 -7
  308. package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs +0 -22
  309. package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs.map +0 -7
  310. package/dist/lib/node-esm/index.mjs +0 -155
  311. package/dist/lib/node-esm/index.mjs.map +0 -7
  312. package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs +0 -57
  313. package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs.map +0 -7
  314. package/dist/lib/node-esm/markdown-VKY7HXU2.mjs +0 -27
  315. package/dist/lib/node-esm/markdown-VKY7HXU2.mjs.map +0 -7
  316. package/dist/lib/node-esm/meta.json +0 -1
  317. package/dist/lib/node-esm/react-surface-GGX76V2Y.mjs +0 -54
  318. package/dist/lib/node-esm/react-surface-GGX76V2Y.mjs.map +0 -7
  319. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  320. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  321. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  322. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  323. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
  324. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
  325. package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
  326. package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
  327. package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
  328. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
  329. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -54
  330. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
  331. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
  332. package/dist/types/src/components/GridSheet/index.d.ts +0 -2
  333. package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
  334. package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
  335. package/dist/types/src/components/RangeList/RangeList.d.ts +0 -7
  336. package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
  337. package/dist/types/src/components/RangeList/index.d.ts +0 -2
  338. package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
  339. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
  340. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
  341. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -55
  342. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
  343. package/dist/types/src/components/SheetContainer/index.d.ts +0 -3
  344. package/dist/types/src/components/SheetContainer/index.d.ts.map +0 -1
  345. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
  346. package/dist/types/src/components/SheetContext/index.d.ts +0 -2
  347. package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
  348. package/src/capabilities/capabilities.ts +0 -14
  349. package/src/capabilities/intent-resolver.ts +0 -38
  350. package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -90
  351. package/src/components/SheetContainer/SheetContainer.tsx +0 -40
  352. package/src/components/SheetContainer/index.ts +0 -7
  353. package/src/components/SheetContext/index.ts +0 -5
  354. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  355. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
@@ -2,11 +2,13 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ // @import-as-namespace
6
+
5
7
  import * as Schema from 'effect/Schema';
6
8
 
7
- import { addressFromA1Notation, isFormula } from '@dxos/compute';
8
- import { Obj, Type } from '@dxos/echo';
9
- import { FormAnnotation } from '@dxos/echo/internal';
9
+ import { addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
10
+ import { Annotation, Obj, Type } from '@dxos/echo';
11
+ import { FormInputAnnotation } from '@dxos/echo/internal';
10
12
 
11
13
  import { addressToIndex, initialize, mapFormulaRefsToIndices } from './util';
12
14
 
@@ -44,36 +46,31 @@ export const Sheet = Schema.Struct({
44
46
  name: Schema.optional(Schema.String),
45
47
 
46
48
  // Sparse map of cells referenced by index.
47
- cells: Schema.Record({ key: Schema.String, value: Schema.mutable(CellValue) }).pipe(
48
- Schema.mutable,
49
- FormAnnotation.set(false),
50
- ),
49
+ cells: Schema.Record({ key: Schema.String, value: CellValue }).pipe(FormInputAnnotation.set(false)),
51
50
 
52
51
  // Ordered row indices.
53
- rows: Schema.Array(Schema.String).pipe(Schema.mutable, FormAnnotation.set(false)),
52
+ rows: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
54
53
 
55
54
  // Ordered column indices.
56
- columns: Schema.Array(Schema.String).pipe(Schema.mutable, FormAnnotation.set(false)),
55
+ columns: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
57
56
 
58
57
  // Row metadata referenced by index.
59
- rowMeta: Schema.Record({ key: Schema.String, value: Schema.mutable(RowColumnMeta) }).pipe(
60
- Schema.mutable,
61
- FormAnnotation.set(false),
62
- ),
58
+ rowMeta: Schema.Record({ key: Schema.String, value: RowColumnMeta }).pipe(FormInputAnnotation.set(false)),
63
59
 
64
60
  // Column metadata referenced by index.
65
- columnMeta: Schema.Record({ key: Schema.String, value: Schema.mutable(RowColumnMeta) }).pipe(
66
- Schema.mutable,
67
- FormAnnotation.set(false),
68
- ),
61
+ columnMeta: Schema.Record({ key: Schema.String, value: RowColumnMeta }).pipe(FormInputAnnotation.set(false)),
69
62
 
70
63
  // Cell formatting referenced by indexed range.
71
- ranges: Schema.Array(Range).pipe(Schema.mutable, FormAnnotation.set(false)),
64
+ ranges: Schema.Array(Range).pipe(FormInputAnnotation.set(false)),
72
65
  }).pipe(
73
- Type.Obj({
74
- typename: 'dxos.org/type/Sheet',
66
+ Type.object({
67
+ typename: 'org.dxos.type.sheet',
75
68
  version: '0.1.0',
76
69
  }),
70
+ Annotation.IconAnnotation.set({
71
+ icon: 'ph--grid-nine--regular',
72
+ hue: 'indigo',
73
+ }),
77
74
  );
78
75
 
79
76
  export interface Sheet extends Schema.Schema.Type<typeof Sheet> {}
@@ -86,18 +83,21 @@ export type SheetProps = {
86
83
  export const make = ({ name, cells = {}, ...size }: SheetProps = {}) => {
87
84
  const sheet = Obj.make(Sheet, { name, cells: {}, rows: [], columns: [], rowMeta: {}, columnMeta: {}, ranges: [] });
88
85
 
89
- initialize(sheet, size);
90
-
91
- if (cells) {
92
- Object.entries(cells).forEach(([key, { value }]) => {
93
- const idx = addressToIndex(sheet, addressFromA1Notation(key));
94
- if (isFormula(value)) {
95
- value = mapFormulaRefsToIndices(sheet, value);
96
- }
97
-
98
- sheet.cells[idx] = { value };
99
- });
100
- }
86
+ // Initialize and set cells within Obj.update to satisfy change context requirements.
87
+ Obj.update(sheet, (sheet) => {
88
+ initialize(sheet, size);
89
+
90
+ if (cells) {
91
+ Object.entries(cells).forEach(([key, { value }]) => {
92
+ const idx = addressToIndex(sheet, addressFromA1Notation(key));
93
+ if (isFormula(value)) {
94
+ value = mapFormulaRefsToIndices(sheet, value);
95
+ }
96
+
97
+ sheet.cells[idx] = { value };
98
+ });
99
+ }
100
+ });
101
101
 
102
102
  return sheet;
103
103
  };
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { type ComputeGraphRegistry as ComputeGraphRegistryType } from '@dxos/compute-hyperformula';
9
+ import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
10
+
11
+ import { meta } from '#meta';
12
+
13
+ export type GridEntry = { grid: DxGridElement; setActiveRefs: (refs: GridContentProps['activeRefs']) => void };
14
+
15
+ export type GridRegistry = {
16
+ register: (attendableId: string, grid: DxGridElement, setActiveRefs: GridEntry['setActiveRefs']) => void;
17
+ unregister: (attendableId: string) => void;
18
+ get: (attendableId: string) => GridEntry | undefined;
19
+ };
20
+
21
+ export const ComputeGraphRegistry = Capability.make<ComputeGraphRegistryType>(
22
+ `${meta.id}.capability.compute-graph-registry`,
23
+ );
24
+
25
+ /** Registry of active grid instances keyed by attendable ID. */
26
+ export const GridInstances = Capability.make<GridRegistry>(`${meta.id}.capability.grid-instances`);
@@ -0,0 +1,75 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ import { Capability } from '@dxos/app-framework';
10
+ import { Operation } from '@dxos/compute';
11
+
12
+ import { meta } from '#meta';
13
+
14
+ const SHEET_OPERATION = `${meta.id}.operation`;
15
+
16
+ // TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
17
+ const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
18
+
19
+ export const InsertAxis = Operation.make({
20
+ meta: { key: `${SHEET_OPERATION}.axis-insert`, name: 'Insert Axis' },
21
+ input: Schema.Struct({
22
+ model: Schema.Any,
23
+ axis: Axis,
24
+ index: Schema.Number,
25
+ count: Schema.optional(Schema.Number),
26
+ }),
27
+ output: Schema.Void,
28
+ });
29
+
30
+ export const DropAxisOutput = Schema.Struct({
31
+ axis: Axis.annotations({ description: 'The axis type (row or col).' }),
32
+ axisIndex: Schema.String.annotations({ description: 'The dropped axis index.' }),
33
+ index: Schema.Number.annotations({ description: 'The position the axis was at.' }),
34
+ axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
35
+ values: Schema.Array(Schema.Any).annotations({ description: 'The cell values that were dropped.' }),
36
+ });
37
+
38
+ export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
39
+
40
+ export const DropAxis = Operation.make({
41
+ meta: { key: `${SHEET_OPERATION}.axis-drop`, name: 'Drop Axis' },
42
+ input: Schema.Struct({
43
+ model: Schema.Any,
44
+ axis: Axis,
45
+ axisIndex: Schema.String,
46
+ }),
47
+ output: DropAxisOutput,
48
+ });
49
+
50
+ export const ScrollToAnchor = Operation.make({
51
+ meta: { key: `${SHEET_OPERATION}.scroll-to-anchor`, name: 'Scroll To Anchor' },
52
+ services: [Capability.Service],
53
+ input: Schema.Struct({
54
+ subject: Schema.String.annotations({ description: 'Attendable ID of the sheet.' }),
55
+ cursor: Schema.String.annotations({ description: 'Cell range coordinates.' }),
56
+ ref: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
57
+ }),
58
+ output: Schema.Void,
59
+ });
60
+
61
+ /**
62
+ * Restore a dropped axis (inverse of DropAxis).
63
+ */
64
+ export const RestoreAxis = Operation.make({
65
+ meta: { key: `${SHEET_OPERATION}.restore-axis`, name: 'Restore Axis' },
66
+ input: Schema.Struct({
67
+ model: Schema.Any.annotations({ description: 'The sheet model.' }),
68
+ axis: Axis.annotations({ description: 'The axis type (row or col).' }),
69
+ axisIndex: Schema.String.annotations({ description: 'The axis index to restore.' }),
70
+ index: Schema.Number.annotations({ description: 'The position to restore at.' }),
71
+ axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
72
+ values: Schema.Array(Schema.Any).annotations({ description: 'The cell values to restore.' }),
73
+ }),
74
+ output: Schema.Void,
75
+ });
@@ -2,7 +2,10 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * as Sheet from './Sheet';
6
5
  export * from './sheet-range-types';
7
6
  export * from './types';
8
7
  export * from './util';
8
+
9
+ export * as Sheet from './Sheet';
10
+ export * as SheetCapabilities from './SheetCapabilities';
11
+ export * as SheetOperation from './SheetOperation';
@@ -34,14 +34,14 @@ export const cellClassNameForRange = ({ key, value }: Sheet.Sheet['ranges'][numb
34
34
  }
35
35
 
36
36
  case commentKey:
37
- return 'bg-gridComment';
37
+ return 'bg-grid-comment';
38
38
 
39
39
  case styleKey:
40
40
  switch (value) {
41
41
  case 'highlight':
42
- return '!bg-gridHighlight';
42
+ return 'bg-grid-highlight!';
43
43
  case 'softwrap':
44
- return '!whitespace-normal';
44
+ return 'whitespace-normal!';
45
45
  default:
46
46
  return undefined;
47
47
  }
@@ -4,39 +4,14 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { meta } from '../meta';
8
- import { SheetModel } from '../model';
9
-
10
7
  import * as Sheet from './Sheet';
11
8
 
12
- export namespace SheetAction {
13
- const SHEET_ACTION = `${meta.id}/action`;
14
-
15
- export class Create extends Schema.TaggedClass<Create>()(`${SHEET_ACTION}/create`, {
16
- input: Schema.Struct({
17
- name: Schema.optional(Schema.String),
18
- }),
19
- output: Schema.Struct({
20
- object: Sheet.Sheet,
21
- }),
22
- }) {}
23
-
24
- // TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
25
- const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
26
-
27
- export class InsertAxis extends Schema.TaggedClass<InsertAxis>()(`${SHEET_ACTION}/axis-insert`, {
28
- input: Schema.Struct({
29
- // TODO(wittjosiah): Schema.instanceOf(SheetModel) throws when running tests.
30
- model: Schema.Any.pipe(Schema.filter((model) => model instanceof SheetModel)) as Schema.Schema<SheetModel>,
31
- axis: Axis,
32
- index: Schema.Number,
33
- count: Schema.optional(Schema.Number),
34
- }),
35
- output: Schema.Void,
36
- }) {}
9
+ // TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
10
+ const ActionAxis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
37
11
 
12
+ export namespace SheetAction {
38
13
  export const RestoreAxis = Schema.Struct({
39
- axis: Axis,
14
+ axis: ActionAxis,
40
15
  axisIndex: Schema.String,
41
16
  index: Schema.Number,
42
17
  axisMeta: Sheet.RowColumnMeta,
@@ -44,15 +19,4 @@ export namespace SheetAction {
44
19
  });
45
20
 
46
21
  export type RestoreAxis = Schema.Schema.Type<typeof RestoreAxis>;
47
-
48
- export class DropAxis extends Schema.TaggedClass<DropAxis>()(`${SHEET_ACTION}/axis-drop`, {
49
- input: Schema.Struct({
50
- // TODO(wittjosiah): Schema.instanceOf(SheetModel) throws when running tests.
51
- model: Schema.Any.pipe(Schema.filter((model) => model instanceof SheetModel)) as Schema.Schema<SheetModel>,
52
- axis: Axis,
53
- axisIndex: Schema.String,
54
- deletionData: Schema.optional(RestoreAxis),
55
- }),
56
- output: Schema.Void,
57
- }) {}
58
22
  }
package/src/types/util.ts CHANGED
@@ -9,8 +9,9 @@ import {
9
9
  addressFromA1Notation,
10
10
  addressToA1Notation,
11
11
  isFormula,
12
- } from '@dxos/compute';
12
+ } from '@dxos/compute-hyperformula';
13
13
  import { randomBytes } from '@dxos/crypto';
14
+ import { type Obj } from '@dxos/echo';
14
15
  import { invariant } from '@dxos/invariant';
15
16
 
16
17
  import { type Sheet } from '../types';
@@ -55,7 +56,7 @@ export const insertIndices = (indices: string[], i: number, n: number, max: numb
55
56
  };
56
57
 
57
58
  export const initialize = (
58
- sheet: Sheet.Sheet,
59
+ sheet: Obj.Mutable<Sheet.Sheet>,
59
60
  { rows = DEFAULT_ROWS, columns = DEFAULT_COLS }: Partial<Sheet.SheetSize> = {},
60
61
  ) => {
61
62
  if (!sheet.rows.length) {
@@ -1,349 +0,0 @@
1
- import {
2
- GridSheet,
3
- SheetProvider,
4
- useComputeGraph,
5
- useSheetContext
6
- } from "./chunk-LS6D4GG7.mjs";
7
- import {
8
- alignKey,
9
- mapFormulaIndicesToRefs,
10
- rangeFromIndex,
11
- rangeToIndex
12
- } from "./chunk-DVJ3QW3F.mjs";
13
- import "./chunk-7VEWYJJN.mjs";
14
- import {
15
- meta
16
- } from "./chunk-FWFAAGXL.mjs";
17
-
18
- // src/components/SheetContainer/SheetContainer.tsx
19
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
20
- import React3 from "react";
21
- import { fullyQualifiedId } from "@dxos/react-client/echo";
22
- import { StackItem } from "@dxos/react-ui-stack";
23
-
24
- // src/components/FunctionEditor/FunctionEditor.tsx
25
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
26
- import React from "react";
27
- import { addressToA1Notation, isFormula, rangeToA1Notation } from "@dxos/compute";
28
- import { Icon } from "@dxos/react-ui";
29
- var FunctionEditor = () => {
30
- var _effect = _useSignals();
31
- try {
32
- const { model, cursor, range } = useSheetContext();
33
- let value;
34
- let formula = false;
35
- if (cursor) {
36
- value = model.getCellValue(cursor);
37
- if (isFormula(value)) {
38
- value = model.graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(model.sheet, value));
39
- formula = true;
40
- } else if (value != null) {
41
- value = String(value);
42
- }
43
- }
44
- return /* @__PURE__ */ React.createElement("div", {
45
- className: "flex shrink-0 justify-between items-center px-4 py-1 text-sm bg-toolbarSurface border-bs !border-subduedSeparator"
46
- }, /* @__PURE__ */ React.createElement("div", {
47
- className: "flex gap-4 items-center"
48
- }, /* @__PURE__ */ React.createElement("div", {
49
- className: "flex w-16 items-center font-mono"
50
- }, range && rangeToA1Notation(range) || cursor && addressToA1Notation(cursor)), /* @__PURE__ */ React.createElement("div", {
51
- className: "flex gap-2 items-center"
52
- }, /* @__PURE__ */ React.createElement(Icon, {
53
- icon: "ph--function--regular",
54
- classNames: [
55
- "text-greenText",
56
- formula ? "visible" : "invisible"
57
- ]
58
- }), /* @__PURE__ */ React.createElement("span", {
59
- className: "font-mono"
60
- }, value))));
61
- } finally {
62
- _effect.f();
63
- }
64
- };
65
-
66
- // src/components/SheetToolbar/SheetToolbar.tsx
67
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
68
- import { Rx } from "@effect-rx/rx-react";
69
- import React2, { useMemo as useMemo2 } from "react";
70
- import { useAppGraph } from "@dxos/app-framework";
71
- import { MenuProvider, ToolbarMenu, createGapSeparator, rxFromSignal, useMenuActions } from "@dxos/react-ui-menu";
72
-
73
- // src/components/SheetToolbar/align.ts
74
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
75
- import { useEffect } from "react";
76
- import { inRange } from "@dxos/compute";
77
- import { createMenuAction, createMenuItemGroup } from "@dxos/react-ui-menu";
78
- var aligns = {
79
- start: "ph--text-align-left--regular",
80
- center: "ph--text-align-center--regular",
81
- end: "ph--text-align-right--regular"
82
- };
83
- var useAlignState = (state) => {
84
- var _effect = _useSignals2();
85
- try {
86
- const { cursor, model } = useSheetContext();
87
- useEffect(() => {
88
- state[alignKey] = cursor ? model.sheet.ranges?.findLast(({ range, key }) => key === alignKey && inRange(rangeFromIndex(model.sheet, range), cursor))?.value : void 0;
89
- }, [
90
- cursor,
91
- model.sheet
92
- ]);
93
- } finally {
94
- _effect.f();
95
- }
96
- };
97
- var createAlignGroupAction = (value) => createMenuItemGroup("align", {
98
- label: [
99
- "align label",
100
- {
101
- ns: meta.id
102
- }
103
- ],
104
- variant: "toggleGroup",
105
- selectCardinality: "single",
106
- value: `${alignKey}--${value}`
107
- });
108
- var createAlignActions = (model, state, cursorFallbackRange) => Object.entries(aligns).map(([alignValue, icon]) => {
109
- return createMenuAction(`${alignKey}--${alignValue}`, () => {
110
- if (!cursorFallbackRange) {
111
- return;
112
- }
113
- const index = model.sheet.ranges?.findIndex((range) => range.key === alignKey && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
114
- const nextRangeEntity = {
115
- range: rangeToIndex(model.sheet, cursorFallbackRange),
116
- key: alignKey,
117
- value: alignValue
118
- };
119
- if (index < 0) {
120
- model.sheet.ranges?.push(nextRangeEntity);
121
- state[alignKey] = nextRangeEntity.value;
122
- } else if (model.sheet.ranges[index].value === nextRangeEntity.value) {
123
- model.sheet.ranges?.splice(index, 1);
124
- state[alignKey] = void 0;
125
- } else {
126
- model.sheet.ranges?.splice(index, 1, nextRangeEntity);
127
- state[alignKey] = nextRangeEntity.value;
128
- }
129
- }, {
130
- key: alignKey,
131
- value: alignValue,
132
- checked: state[alignKey] === alignValue,
133
- label: [
134
- `range value ${alignValue} label`,
135
- {
136
- ns: meta.id
137
- }
138
- ],
139
- icon,
140
- testId: `grid.toolbar.${alignKey}.${alignValue}`
141
- });
142
- });
143
- var createAlign = (model, state, cursorFallbackRange) => {
144
- const alignGroup = createAlignGroupAction(state[alignKey]);
145
- const alignActions = createAlignActions(model, state, cursorFallbackRange);
146
- return {
147
- nodes: [
148
- alignGroup,
149
- ...alignActions
150
- ],
151
- edges: [
152
- {
153
- source: "root",
154
- target: "align"
155
- },
156
- ...alignActions.map(({ id }) => ({
157
- source: alignGroup.id,
158
- target: id
159
- }))
160
- ]
161
- };
162
- };
163
-
164
- // src/components/SheetToolbar/style.ts
165
- import { useEffect as useEffect2 } from "react";
166
- import { inRange as inRange2 } from "@dxos/compute";
167
- import { createMenuAction as createMenuAction2, createMenuItemGroup as createMenuItemGroup2 } from "@dxos/react-ui-menu";
168
- var styles = {
169
- highlight: "ph--highlighter--regular",
170
- softwrap: "ph--paragraph--regular"
171
- };
172
- var useStyleState = (state) => {
173
- const { cursorFallbackRange, model } = useSheetContext();
174
- useEffect2(() => {
175
- state.highlight = false;
176
- state.softwrap = false;
177
- if (cursorFallbackRange && model.sheet.ranges) {
178
- model.sheet.ranges.filter(({ range, key }) => key === "style" && inRange2(rangeFromIndex(model.sheet, range), cursorFallbackRange.from)).forEach(({ value }) => {
179
- state[value] = true;
180
- });
181
- }
182
- }, [
183
- cursorFallbackRange,
184
- model.sheet
185
- ]);
186
- };
187
- var createStyleGroup = (state) => {
188
- return createMenuItemGroup2("style", {
189
- variant: "toggleGroup",
190
- selectCardinality: "multiple",
191
- value: Object.keys(styles).filter((key) => !!state[key]).map((styleValue) => `style--${styleValue}`)
192
- });
193
- };
194
- var createStyleActions = (model, state, cursorFallbackRange) => Object.entries(styles).map(([styleValue, icon]) => {
195
- return createMenuAction2(`style--${styleValue}`, () => {
196
- if (!cursorFallbackRange) {
197
- return;
198
- }
199
- const index = model.sheet.ranges?.findIndex((range) => range.key === "style" && inRange2(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
200
- const nextRangeEntity = {
201
- range: rangeToIndex(model.sheet, cursorFallbackRange),
202
- key: "style",
203
- value: styleValue
204
- };
205
- if (model.sheet.ranges.filter(({ range, key: rangeKey }) => rangeKey === "style" && inRange2(rangeFromIndex(model.sheet, range), cursorFallbackRange.from)).some(({ value: rangeValue }) => rangeValue === styleValue)) {
206
- if (index >= 0) {
207
- model.sheet.ranges?.splice(index, 1);
208
- }
209
- state[nextRangeEntity.value] = false;
210
- } else {
211
- model.sheet.ranges?.push(nextRangeEntity);
212
- state[nextRangeEntity.value] = true;
213
- }
214
- }, {
215
- key: "style",
216
- value: styleValue,
217
- icon,
218
- label: [
219
- `range value ${styleValue} label`,
220
- {
221
- ns: meta.id
222
- }
223
- ],
224
- checked: !!state[styleValue]
225
- });
226
- });
227
- var createStyle = (model, state, cursorFallbackRange) => {
228
- const styleGroupAction = createStyleGroup(state);
229
- const styleActions = createStyleActions(model, state, cursorFallbackRange);
230
- return {
231
- nodes: [
232
- styleGroupAction,
233
- ...styleActions
234
- ],
235
- edges: [
236
- {
237
- source: "root",
238
- target: "style"
239
- },
240
- ...styleActions.map(({ id }) => ({
241
- source: styleGroupAction.id,
242
- target: id
243
- }))
244
- ]
245
- };
246
- };
247
-
248
- // src/components/SheetToolbar/useToolbarState.ts
249
- import { useMemo } from "react";
250
- import { live } from "@dxos/live-object";
251
- var useToolbarState = (initialState = {}) => {
252
- return useMemo(() => live(initialState), []);
253
- };
254
-
255
- // src/components/SheetToolbar/SheetToolbar.tsx
256
- var createToolbarActions = (model, state, cursorFallbackRange, customActions) => {
257
- return Rx.make((get) => {
258
- const align = get(rxFromSignal(() => createAlign(model, state, cursorFallbackRange)));
259
- const style = get(rxFromSignal(() => createStyle(model, state, cursorFallbackRange)));
260
- const gap = createGapSeparator();
261
- const graph = {
262
- nodes: [
263
- ...align.nodes,
264
- ...style.nodes,
265
- ...gap.nodes
266
- ],
267
- edges: [
268
- ...align.edges,
269
- ...style.edges,
270
- ...gap.edges
271
- ]
272
- };
273
- if (customActions) {
274
- const custom = get(customActions);
275
- graph.nodes.push(...custom.nodes);
276
- graph.edges.push(...custom.edges);
277
- }
278
- return graph;
279
- });
280
- };
281
- var SheetToolbar = ({ id }) => {
282
- var _effect = _useSignals3();
283
- try {
284
- const { model, cursorFallbackRange } = useSheetContext();
285
- const state = useToolbarState({});
286
- useAlignState(state);
287
- useStyleState(state);
288
- const { graph } = useAppGraph();
289
- const customActions = useMemo2(() => {
290
- return Rx.make((get) => {
291
- const actions = get(graph.actions(id));
292
- const nodes = actions.filter((action) => action.properties.disposition === "toolbar");
293
- return {
294
- nodes,
295
- edges: nodes.map((node) => ({
296
- source: "root",
297
- target: node.id
298
- }))
299
- };
300
- });
301
- }, [
302
- graph
303
- ]);
304
- const actionsCreator = useMemo2(() => createToolbarActions(model, state, cursorFallbackRange, customActions), [
305
- model,
306
- state,
307
- cursorFallbackRange,
308
- customActions
309
- ]);
310
- const menu = useMenuActions(actionsCreator);
311
- return /* @__PURE__ */ React2.createElement(MenuProvider, {
312
- ...menu,
313
- attendableId: id
314
- }, /* @__PURE__ */ React2.createElement(ToolbarMenu, null));
315
- } finally {
316
- _effect.f();
317
- }
318
- };
319
-
320
- // src/components/SheetContainer/SheetContainer.tsx
321
- var SheetContainer = ({ space, sheet, role, ignoreAttention }) => {
322
- var _effect = _useSignals4();
323
- try {
324
- const graph = useComputeGraph(space);
325
- return graph ? /* @__PURE__ */ React3.createElement(SheetProvider, {
326
- sheet,
327
- graph,
328
- ignoreAttention
329
- }, /* @__PURE__ */ React3.createElement(StackItem.Content, {
330
- toolbar: true,
331
- statusbar: true,
332
- classNames: [
333
- role === "section" && "aspect-video",
334
- role === "story" && "bs-full"
335
- ]
336
- }, /* @__PURE__ */ React3.createElement(SheetToolbar, {
337
- id: fullyQualifiedId(sheet)
338
- }), /* @__PURE__ */ React3.createElement(GridSheet, null), /* @__PURE__ */ React3.createElement(FunctionEditor, null))) : null;
339
- } finally {
340
- _effect.f();
341
- }
342
- };
343
-
344
- // src/components/SheetContainer/index.ts
345
- var SheetContainer_default = SheetContainer;
346
- export {
347
- SheetContainer_default as default
348
- };
349
- //# sourceMappingURL=SheetContainer-GTINUSNB.mjs.map