@dxos/plugin-sheet 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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.
- package/dist/lib/browser/RangeList-S3SHV7T6.mjs +53 -0
- package/dist/lib/browser/RangeList-S3SHV7T6.mjs.map +7 -0
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs +1805 -0
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs +24 -0
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SSN4HYJL.mjs → chunk-NNWF7EKC.mjs} +17 -17
- package/dist/lib/browser/chunk-NNWF7EKC.mjs.map +7 -0
- package/dist/lib/browser/chunk-S445OQGW.mjs +397 -0
- package/dist/lib/browser/chunk-S445OQGW.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs +21 -0
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +71 -80
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/markdown-S6GVLHB4.mjs +29 -0
- package/dist/lib/browser/markdown-S6GVLHB4.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs +79 -0
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs +51 -0
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -12
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs +54 -0
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs.map +7 -0
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs +1806 -0
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs +25 -0
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IK4O7FUJ.mjs → chunk-M52YLLWU.mjs} +17 -17
- package/dist/lib/node-esm/chunk-M52YLLWU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs +398 -0
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs +22 -0
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +71 -80
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs +30 -0
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs +52 -0
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -12
- package/dist/types/src/SheetPlugin.d.ts +2 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +5 -0
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
- package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts +11 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/index.d.ts +2 -0
- package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +1 -1
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +5 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet/GridSheet.stories.d.ts → SheetContent/SheetContent.stories.d.ts} +5 -4
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/index.d.ts +2 -0
- package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +6 -6
- package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
- package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
- package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +5 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +6 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +2 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +12 -19
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +12 -18
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +2 -2
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
- package/dist/types/src/containers/RangeList/index.d.ts +3 -0
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/SheetContainer.stories.d.ts +4 -3
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -6
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +2 -2
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +2 -2
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/serializer.d.ts +2 -2
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +2 -2
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +26 -2
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +76 -0
- package/dist/types/src/types/Sheet.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +6 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts +2 -2
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +91 -74
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +10 -10
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +74 -67
- package/src/SheetPlugin.tsx +41 -61
- package/src/capabilities/anchor-sort/anchor-sort.ts +27 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/compute-graph-registry/compute-graph-registry.ts +27 -0
- package/src/capabilities/compute-graph-registry/index.ts +7 -0
- package/src/capabilities/index.ts +5 -9
- package/src/capabilities/markdown/index.ts +7 -0
- package/src/capabilities/markdown/markdown.ts +30 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +77 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +46 -0
- package/src/components/ComputeGraph/compute-graph.stories.tsx +10 -10
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +13 -10
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +16 -15
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +52 -39
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +14 -8
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +42 -40
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +10 -5
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +4 -4
- package/src/components/SheetToolbar/SheetToolbar.tsx +45 -35
- package/src/components/SheetToolbar/align.ts +44 -19
- package/src/components/SheetToolbar/style.ts +48 -18
- package/src/components/SheetToolbar/useToolbarState.ts +22 -5
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +17 -12
- package/src/containers/RangeList/index.ts +7 -0
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +94 -0
- package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
- package/src/{components → containers}/SheetContainer/index.ts +1 -1
- package/src/containers/index.ts +8 -0
- package/src/extensions/compute.stories.tsx +24 -14
- package/src/extensions/compute.ts +1 -1
- package/src/extensions/editor/sheet-extension.ts +16 -13
- package/src/index.ts +1 -1
- package/src/integrations/thread-ranges.ts +38 -49
- package/src/meta.ts +8 -4
- package/src/model/sheet-model.test.ts +4 -4
- package/src/model/sheet-model.ts +80 -48
- package/src/model/testing.ts +4 -4
- package/src/model/useSheetModel.ts +2 -2
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +2 -1
- package/src/sanity.test.ts +3 -4
- package/src/serializer.ts +4 -4
- package/src/testing/data.ts +2 -2
- package/src/testing/testing.tsx +3 -3
- package/src/translations.ts +3 -2
- package/src/types/Sheet.ts +97 -0
- package/src/{capabilities → types}/capabilities.ts +2 -2
- package/src/types/index.ts +2 -1
- package/src/types/sheet-range-types.ts +5 -5
- package/src/types/types.ts +82 -48
- package/src/types/util.ts +11 -38
- package/dist/lib/browser/SheetContainer-VL34UND4.mjs +0 -351
- package/dist/lib/browser/SheetContainer-VL34UND4.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-3N44DS5F.mjs +0 -24
- package/dist/lib/browser/anchor-sort-3N44DS5F.mjs.map +0 -7
- package/dist/lib/browser/chunk-ADK2HW4A.mjs +0 -906
- package/dist/lib/browser/chunk-ADK2HW4A.mjs.map +0 -7
- package/dist/lib/browser/chunk-CSBSADPQ.mjs +0 -16
- package/dist/lib/browser/chunk-CSBSADPQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-SSN4HYJL.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZJWJMX4E.mjs +0 -852
- package/dist/lib/browser/chunk-ZJWJMX4E.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZMPNHFIP.mjs +0 -15
- package/dist/lib/browser/chunk-ZMPNHFIP.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs +0 -21
- package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BQLV6IAA.mjs +0 -56
- package/dist/lib/browser/intent-resolver-BQLV6IAA.mjs.map +0 -7
- package/dist/lib/browser/markdown-RMTMI237.mjs +0 -26
- package/dist/lib/browser/markdown-RMTMI237.mjs.map +0 -7
- package/dist/lib/browser/react-surface-7ZDMQDCT.mjs +0 -53
- package/dist/lib/browser/react-surface-7ZDMQDCT.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-NWJ7L6FC.mjs +0 -352
- package/dist/lib/node-esm/SheetContainer-NWJ7L6FC.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-YL2OZHYM.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-YL2OZHYM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BZAPYBSH.mjs +0 -907
- package/dist/lib/node-esm/chunk-BZAPYBSH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H3GSD33H.mjs +0 -18
- package/dist/lib/node-esm/chunk-H3GSD33H.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IK4O7FUJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LN6ZSAII.mjs +0 -16
- package/dist/lib/node-esm/chunk-LN6ZSAII.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YL7BVJPC.mjs +0 -853
- package/dist/lib/node-esm/chunk-YL7BVJPC.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-MV5ZFXAQ.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-MV5ZFXAQ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-EDIWHA3P.mjs +0 -27
- package/dist/lib/node-esm/markdown-EDIWHA3P.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TUME5MM2.mjs +0 -54
- package/dist/lib/node-esm/react-surface-TUME5MM2.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +0 -4
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown.d.ts +0 -4
- package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/index.d.ts +0 -2
- package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/index.d.ts +0 -2
- package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/index.d.ts +0 -2
- package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -37
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -22
- package/src/capabilities/compute-graph-registry.ts +0 -23
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/capabilities/markdown.ts +0 -23
- package/src/capabilities/react-surface.tsx +0 -40
- package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -90
- package/src/components/SheetContainer/SheetContainer.tsx +0 -40
- package/src/components/SheetContext/index.ts +0 -5
- package/src/types/schema.ts +0 -61
- /package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SheetContent } from '../SheetContent';
|
|
6
|
+
import { SheetRoot } from '../SheetRoot';
|
|
7
|
+
import { SheetStatusbar } from '../SheetStatusbar';
|
|
8
|
+
import { SheetToolbar } from '../SheetToolbar';
|
|
9
|
+
|
|
10
|
+
export { useSheetContext, type SheetContextValue, type SheetRootProps } from '../SheetRoot';
|
|
11
|
+
export { type SheetContentProps } from '../SheetContent';
|
|
12
|
+
export { type SheetToolbarProps } from '../SheetToolbar';
|
|
13
|
+
export { type SheetStatusbarProps } from '../SheetStatusbar';
|
|
14
|
+
|
|
15
|
+
export const Sheet = {
|
|
16
|
+
Root: SheetRoot,
|
|
17
|
+
Toolbar: SheetToolbar,
|
|
18
|
+
Content: SheetContent,
|
|
19
|
+
Statusbar: SheetStatusbar,
|
|
20
|
+
};
|
|
@@ -6,16 +6,17 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
|
-
import { createDocAccessor } from '@dxos/client/echo';
|
|
10
9
|
import { defaultFunctions } from '@dxos/compute';
|
|
11
10
|
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
12
13
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
13
14
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
-
import { automerge } from '@dxos/react-ui-editor';
|
|
15
15
|
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
16
|
+
import { automerge } from '@dxos/ui-editor';
|
|
16
17
|
|
|
17
18
|
import { sheetExtension } from '../../extensions';
|
|
18
|
-
import {
|
|
19
|
+
import { Sheet } from '../../types';
|
|
19
20
|
|
|
20
21
|
const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
21
22
|
const extensions = useMemo(() => {
|
|
@@ -29,16 +30,18 @@ const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
29
30
|
|
|
30
31
|
const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
31
32
|
const cell = 'A1';
|
|
32
|
-
const [object, setObject] = useState<
|
|
33
|
+
const [object, setObject] = useState<Sheet.Sheet>();
|
|
33
34
|
useAsyncEffect(async () => {
|
|
34
|
-
const client = new Client({ types: [
|
|
35
|
+
const client = new Client({ types: [Sheet.Sheet] });
|
|
35
36
|
await client.initialize();
|
|
36
37
|
await client.halo.createIdentity();
|
|
37
38
|
const space = await client.spaces.create();
|
|
38
39
|
|
|
39
|
-
const sheet =
|
|
40
|
-
sheet
|
|
41
|
-
|
|
40
|
+
const sheet = Sheet.make();
|
|
41
|
+
Obj.change(sheet, (obj) => {
|
|
42
|
+
obj.name = 'Test';
|
|
43
|
+
obj.cells[cell] = { value };
|
|
44
|
+
});
|
|
42
45
|
space.db.add(sheet);
|
|
43
46
|
setObject(sheet);
|
|
44
47
|
}, [value]);
|
|
@@ -58,9 +61,9 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
const meta = {
|
|
61
|
-
title: 'plugins/plugin-sheet/CellEditor',
|
|
64
|
+
title: 'plugins/plugin-sheet/components/CellEditor',
|
|
62
65
|
|
|
63
|
-
decorators: [withTheme],
|
|
66
|
+
decorators: [withTheme()],
|
|
64
67
|
component: CellEditor,
|
|
65
68
|
render: DefaultStory,
|
|
66
69
|
} satisfies Meta<typeof DefaultStory>;
|
package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx}
RENAMED
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
9
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/plugin-testing';
|
|
11
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
|
|
15
15
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
16
16
|
import { translations } from '../../translations';
|
|
17
|
-
import {
|
|
17
|
+
import { Sheet } from '../../types';
|
|
18
18
|
import { useComputeGraph } from '../ComputeGraph';
|
|
19
|
-
import {
|
|
19
|
+
import { SheetRoot } from '../SheetRoot';
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { SheetContent } from './SheetContent';
|
|
22
22
|
|
|
23
23
|
export const Basic = () => {
|
|
24
24
|
const space = useSpace();
|
|
@@ -29,30 +29,31 @@ export const Basic = () => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
<div role='none' className='grid
|
|
34
|
-
<
|
|
32
|
+
<SheetRoot graph={graph} sheet={sheet} ignoreAttention>
|
|
33
|
+
<div role='none' className='grid h-full w-full'>
|
|
34
|
+
<SheetContent />
|
|
35
35
|
</div>
|
|
36
|
-
</
|
|
36
|
+
</SheetRoot>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const meta = {
|
|
41
|
-
title: 'plugins/plugin-sheet/
|
|
42
|
-
component:
|
|
41
|
+
title: 'plugins/plugin-sheet/components/SheetContent',
|
|
42
|
+
component: SheetContent,
|
|
43
43
|
decorators: [
|
|
44
|
-
withTheme,
|
|
45
|
-
|
|
44
|
+
withTheme(),
|
|
45
|
+
withLayout({ layout: 'fullscreen' }),
|
|
46
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
46
47
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
47
48
|
withPluginManager({
|
|
48
|
-
plugins: [
|
|
49
|
+
plugins: [OperationPlugin(), RuntimePlugin()],
|
|
49
50
|
}),
|
|
50
51
|
],
|
|
51
52
|
parameters: {
|
|
52
53
|
layout: 'fullscreen',
|
|
53
54
|
translations,
|
|
54
55
|
},
|
|
55
|
-
} satisfies Meta<typeof
|
|
56
|
+
} satisfies Meta<typeof SheetContent>;
|
|
56
57
|
|
|
57
58
|
export default meta;
|
|
58
59
|
|
|
@@ -13,10 +13,11 @@ import React, {
|
|
|
13
13
|
useState,
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
17
17
|
import { type CellRange, rangeToA1Notation } from '@dxos/compute';
|
|
18
|
+
import { Obj } from '@dxos/echo';
|
|
18
19
|
import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
|
|
19
|
-
import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
|
+
import { type ComposableProps, DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
21
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
21
22
|
import {
|
|
22
23
|
type DxGridCellIndex,
|
|
@@ -31,12 +32,13 @@ import {
|
|
|
31
32
|
editorKeys,
|
|
32
33
|
parseCellIndex,
|
|
33
34
|
} from '@dxos/react-ui-grid';
|
|
35
|
+
import { mx, useComposableProps } from '@dxos/ui-theme';
|
|
34
36
|
|
|
35
37
|
import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
|
|
36
38
|
import { useSelectThreadOnCellFocus, useUpdateFocusedCellOnThreadSelection } from '../../integrations';
|
|
37
39
|
import { meta } from '../../meta';
|
|
38
|
-
import { DEFAULT_COLS, DEFAULT_ROWS,
|
|
39
|
-
import { useSheetContext } from '../
|
|
40
|
+
import { DEFAULT_COLS, DEFAULT_ROWS, SheetOperation } from '../../types';
|
|
41
|
+
import { useSheetContext } from '../SheetRoot';
|
|
40
42
|
|
|
41
43
|
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
42
44
|
|
|
@@ -68,17 +70,21 @@ const sheetRowDefault = {
|
|
|
68
70
|
grid: { size: defaultRowSize, resizeable: true },
|
|
69
71
|
};
|
|
70
72
|
|
|
71
|
-
export
|
|
73
|
+
export type SheetContentProps = ComposableProps<React.HTMLAttributes<HTMLDivElement>>;
|
|
74
|
+
|
|
75
|
+
export const SheetContent = (props: SheetContentProps) => {
|
|
72
76
|
const { t } = useTranslation(meta.id);
|
|
73
77
|
const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } =
|
|
74
78
|
useSheetContext();
|
|
79
|
+
|
|
75
80
|
// NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
|
|
76
81
|
// a reliable dependency for `useEffect` whereas `useLayoutEffect` does not guarantee the element will be defined.
|
|
77
82
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
78
83
|
const [extraplanarFocus, setExtraplanarFocus] = useState<DxGridPosition | null>(null);
|
|
79
|
-
const {
|
|
84
|
+
const { invokePromise } = useOperationInvoker();
|
|
80
85
|
const rangeController = useRef<RangeController>(null);
|
|
81
86
|
const { hasAttention } = useAttention(id);
|
|
87
|
+
const { className, ...rest } = useComposableProps(props);
|
|
82
88
|
|
|
83
89
|
const handleFocus = useCallback(
|
|
84
90
|
(event: FocusEvent) => {
|
|
@@ -127,15 +133,17 @@ export const GridSheet = () => {
|
|
|
127
133
|
|
|
128
134
|
const handleAxisResize = useCallback<NonNullable<GridContentProps['onAxisResize']>>(
|
|
129
135
|
({ axis, size, index: numericIndex }) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
Obj.change(model.sheet, (sheet) => {
|
|
137
|
+
if (axis === 'row') {
|
|
138
|
+
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
139
|
+
sheet.rowMeta[rowId] ??= {};
|
|
140
|
+
sheet.rowMeta[rowId].size = size;
|
|
141
|
+
} else {
|
|
142
|
+
const columnId = sheet.columns[parseInt(numericIndex)];
|
|
143
|
+
sheet.columnMeta[columnId] ??= {};
|
|
144
|
+
sheet.columnMeta[columnId].size = size;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
139
147
|
},
|
|
140
148
|
[model],
|
|
141
149
|
);
|
|
@@ -172,12 +180,20 @@ export const GridSheet = () => {
|
|
|
172
180
|
case 'frozenRowsStart':
|
|
173
181
|
return dxGrid?.setSelection({
|
|
174
182
|
start: { col: pos.col, row: 0, plane: 'grid' },
|
|
175
|
-
end: {
|
|
183
|
+
end: {
|
|
184
|
+
col: pos.col,
|
|
185
|
+
row: model.sheet.rows.length - 1,
|
|
186
|
+
plane: 'grid',
|
|
187
|
+
},
|
|
176
188
|
});
|
|
177
189
|
case 'frozenColsStart':
|
|
178
190
|
return dxGrid?.setSelection({
|
|
179
191
|
start: { row: pos.row, col: 0, plane: 'grid' },
|
|
180
|
-
end: {
|
|
192
|
+
end: {
|
|
193
|
+
row: pos.row,
|
|
194
|
+
col: model.sheet.columns.length - 1,
|
|
195
|
+
plane: 'grid',
|
|
196
|
+
},
|
|
181
197
|
});
|
|
182
198
|
}
|
|
183
199
|
},
|
|
@@ -257,31 +273,30 @@ export const GridSheet = () => {
|
|
|
257
273
|
switch (operation) {
|
|
258
274
|
case 'insert-before':
|
|
259
275
|
case 'insert-after':
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}),
|
|
266
|
-
);
|
|
276
|
+
return invokePromise(SheetOperation.InsertAxis, {
|
|
277
|
+
model,
|
|
278
|
+
axis: contextMenuAxis,
|
|
279
|
+
index: contextMenuOpen![contextMenuAxis] + (operation === 'insert-before' ? 0 : 1),
|
|
280
|
+
});
|
|
267
281
|
case 'drop':
|
|
268
|
-
return
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}),
|
|
274
|
-
);
|
|
282
|
+
return invokePromise(SheetOperation.DropAxis, {
|
|
283
|
+
model,
|
|
284
|
+
axis: contextMenuAxis,
|
|
285
|
+
axisIndex: model.sheet[contextMenuAxis === 'row' ? 'rows' : 'columns'][contextMenuOpen![contextMenuAxis]],
|
|
286
|
+
});
|
|
275
287
|
}
|
|
276
288
|
},
|
|
277
|
-
[contextMenuAxis, contextMenuOpen, model,
|
|
289
|
+
[contextMenuAxis, contextMenuOpen, model, invokePromise],
|
|
278
290
|
);
|
|
279
291
|
|
|
280
292
|
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
281
293
|
|
|
282
294
|
const extensions = useMemo(
|
|
283
295
|
() => [
|
|
284
|
-
editorKeys({
|
|
296
|
+
editorKeys({
|
|
297
|
+
onClose: handleClose,
|
|
298
|
+
...(editing?.initialContent && { onNav: handleClose }),
|
|
299
|
+
}),
|
|
285
300
|
sheetExtension({ functions: model.graph.getFunctions() }),
|
|
286
301
|
rangeExtension({
|
|
287
302
|
onInit: (fn) => (rangeController.current = fn),
|
|
@@ -307,19 +322,20 @@ export const GridSheet = () => {
|
|
|
307
322
|
useSelectThreadOnCellFocus();
|
|
308
323
|
|
|
309
324
|
return (
|
|
310
|
-
|
|
311
|
-
<div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent'>
|
|
325
|
+
<div {...rest} role='none' className={mx('relative min-h-0', className)}>
|
|
312
326
|
<GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
|
|
313
327
|
<Grid.Content
|
|
328
|
+
className='[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
314
329
|
initialCells={initialCells}
|
|
315
330
|
limitColumns={DEFAULT_COLS}
|
|
316
331
|
limitRows={DEFAULT_ROWS}
|
|
317
332
|
columns={columns}
|
|
318
333
|
rows={rows}
|
|
319
|
-
// TODO(burdon): `col` vs. `column`?
|
|
320
334
|
columnDefault={sheetColDefault}
|
|
321
335
|
rowDefault={sheetRowDefault}
|
|
336
|
+
activeRefs={activeRefs}
|
|
322
337
|
frozen={frozen}
|
|
338
|
+
overscroll='trap'
|
|
323
339
|
onAxisResize={handleAxisResize}
|
|
324
340
|
onSelect={handleSelect}
|
|
325
341
|
onFocus={handleFocus}
|
|
@@ -327,9 +343,6 @@ export const GridSheet = () => {
|
|
|
327
343
|
onKeyDown={handleKeyDown}
|
|
328
344
|
onContextMenu={handleContextMenu}
|
|
329
345
|
onClick={handleClick}
|
|
330
|
-
overscroll='trap'
|
|
331
|
-
className='[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
332
|
-
activeRefs={activeRefs}
|
|
333
346
|
ref={setDxGrid}
|
|
334
347
|
/>
|
|
335
348
|
<DropdownMenu.Root
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { inRange } from '@dxos/compute';
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
9
|
import { cellClassesForFieldType, parseValue } from '@dxos/react-ui-form';
|
|
10
10
|
import {
|
|
11
11
|
type DxGridAxisMeta,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
commentedClassName,
|
|
20
20
|
rowToA1Notation,
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
|
-
import { mx } from '@dxos/
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
23
|
|
|
24
24
|
import { type SheetModel } from '../../model';
|
|
25
25
|
import { cellClassNameForRange, rangeFromIndex } from '../../types';
|
|
@@ -28,7 +28,10 @@ const createDxGridColumns = (model: SheetModel): DxGridAxisMeta => {
|
|
|
28
28
|
return model.sheet.columns.reduce(
|
|
29
29
|
(acc: DxGridAxisMeta, columnId, numericIndex) => {
|
|
30
30
|
if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
|
|
31
|
-
acc.grid[numericIndex] = {
|
|
31
|
+
acc.grid[numericIndex] = {
|
|
32
|
+
size: model.sheet.columnMeta[columnId].size,
|
|
33
|
+
resizeable: true,
|
|
34
|
+
};
|
|
32
35
|
}
|
|
33
36
|
return acc;
|
|
34
37
|
},
|
|
@@ -40,7 +43,10 @@ const createDxGridRows = (model: SheetModel): DxGridAxisMeta => {
|
|
|
40
43
|
return model.sheet.rows.reduce(
|
|
41
44
|
(acc: DxGridAxisMeta, rowId, numericIndex) => {
|
|
42
45
|
if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
|
|
43
|
-
acc.grid[numericIndex] = {
|
|
46
|
+
acc.grid[numericIndex] = {
|
|
47
|
+
size: model.sheet.rowMeta[rowId].size,
|
|
48
|
+
resizeable: true,
|
|
49
|
+
};
|
|
44
50
|
}
|
|
45
51
|
return acc;
|
|
46
52
|
},
|
|
@@ -59,7 +65,7 @@ const projectCellProps = (model: SheetModel, col: number, row: number): DxGridCe
|
|
|
59
65
|
// const range = thread.target?.anchor && parseThreadAnchorAsCellRange(thread.target!.anchor);
|
|
60
66
|
// return thread && range ? inRange(range, address) : false;
|
|
61
67
|
// })
|
|
62
|
-
// .map((thread) =>
|
|
68
|
+
// .map((thread) => Obj.getDXN(thread!).toString())
|
|
63
69
|
// .join(' ');
|
|
64
70
|
|
|
65
71
|
const description = model.getValueDescription(address);
|
|
@@ -90,13 +96,13 @@ const gridCellGetter = (model: SheetModel) => {
|
|
|
90
96
|
|
|
91
97
|
export const rowLabelCell = (row: number) => ({
|
|
92
98
|
value: rowToA1Notation(row),
|
|
93
|
-
className: '!bg-
|
|
99
|
+
className: '!bg-toolbar-surface text-subdued text-end pe-1',
|
|
94
100
|
resizeHandle: 'row',
|
|
95
101
|
});
|
|
96
102
|
|
|
97
103
|
export const colLabelCell = (col: number) => ({
|
|
98
104
|
value: colToA1Notation(col),
|
|
99
|
-
className: '!bg-
|
|
105
|
+
className: '!bg-toolbar-surface text-subdued',
|
|
100
106
|
resizeHandle: 'col',
|
|
101
107
|
});
|
|
102
108
|
|
|
@@ -108,7 +114,7 @@ const cellGetter = (model: SheetModel) => {
|
|
|
108
114
|
return getGridCells(nextBounds);
|
|
109
115
|
case 'fixedStartStart': {
|
|
110
116
|
return {
|
|
111
|
-
'0,0': { className: '!bg-
|
|
117
|
+
'0,0': { className: '!bg-toolbar-surface' },
|
|
112
118
|
};
|
|
113
119
|
}
|
|
114
120
|
case 'frozenColsStart':
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type CellAddress, type CellRange, type CompleteCellRange, type ComputeGraph } from '@dxos/compute';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { raise } from '@dxos/debug';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
10
|
import {
|
|
11
11
|
Grid,
|
|
12
12
|
type GridContentProps,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@dxos/react-ui-grid';
|
|
17
17
|
|
|
18
18
|
import { type SheetModel, useSheetModel } from '../../model';
|
|
19
|
-
import { type
|
|
19
|
+
import { type Sheet } from '../../types';
|
|
20
20
|
|
|
21
21
|
export type SheetContextValue = {
|
|
22
22
|
id: string;
|
|
@@ -39,29 +39,57 @@ export type SheetContextValue = {
|
|
|
39
39
|
activeRefs: GridContentProps['activeRefs'];
|
|
40
40
|
setActiveRefs: (activeRefs: GridContentProps['activeRefs']) => void;
|
|
41
41
|
|
|
42
|
+
// Flags
|
|
43
|
+
ignoreAttention?: boolean;
|
|
44
|
+
|
|
42
45
|
// Events.
|
|
43
46
|
// TODO(burdon): Generalize.
|
|
44
47
|
onInfo?: () => void;
|
|
45
|
-
|
|
46
|
-
// Flags
|
|
47
|
-
ignoreAttention?: boolean;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
// TODO(burdon): Use radix context.
|
|
50
51
|
const SheetContext = createContext<SheetContextValue | undefined>(undefined);
|
|
51
52
|
|
|
52
53
|
export const useSheetContext = (): SheetContextValue => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
return useContext(SheetContext) ?? raise(new Error('Missing SheetContext'));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type SheetRootProps = {
|
|
58
|
+
graph: ComputeGraph;
|
|
59
|
+
sheet: Sheet.Sheet;
|
|
60
|
+
readonly?: boolean;
|
|
61
|
+
ignoreAttention?: boolean;
|
|
62
|
+
} & Pick<SheetContextValue, 'onInfo'>;
|
|
63
|
+
|
|
64
|
+
export const SheetRoot = ({
|
|
65
|
+
children,
|
|
66
|
+
graph,
|
|
67
|
+
sheet,
|
|
68
|
+
readonly,
|
|
69
|
+
ignoreAttention,
|
|
70
|
+
onInfo,
|
|
71
|
+
}: PropsWithChildren<SheetRootProps>) => {
|
|
72
|
+
const model = useSheetModel(graph, sheet, { readonly });
|
|
73
|
+
if (!model) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<Grid.Root id={Obj.getDXN(sheet).toString()}>
|
|
79
|
+
<SheetProviderImpl model={model} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
80
|
+
{children}
|
|
81
|
+
</SheetProviderImpl>
|
|
82
|
+
</Grid.Root>
|
|
83
|
+
);
|
|
56
84
|
};
|
|
57
85
|
|
|
58
86
|
const SheetProviderImpl = ({
|
|
87
|
+
__gridScope,
|
|
88
|
+
children,
|
|
89
|
+
ignoreAttention,
|
|
59
90
|
model,
|
|
60
91
|
onInfo,
|
|
61
|
-
|
|
62
|
-
children,
|
|
63
|
-
__gridScope,
|
|
64
|
-
}: GridScopedProps<PropsWithChildren<Pick<SheetContextValue, 'onInfo' | 'model' | 'ignoreAttention'>>>) => {
|
|
92
|
+
}: GridScopedProps<PropsWithChildren<Pick<SheetContextValue, 'ignoreAttention' | 'model' | 'onInfo'>>>) => {
|
|
65
93
|
const { id, editing, setEditing } = useGridContext('SheetProvider', __gridScope);
|
|
66
94
|
|
|
67
95
|
const [cursor, setCursorInternal] = useState<CellAddress>();
|
|
@@ -102,38 +130,12 @@ const SheetProviderImpl = ({
|
|
|
102
130
|
cursorFallbackRange,
|
|
103
131
|
activeRefs,
|
|
104
132
|
setActiveRefs,
|
|
133
|
+
ignoreAttention,
|
|
105
134
|
// TODO(burdon): Change to event.
|
|
106
135
|
onInfo,
|
|
107
|
-
ignoreAttention,
|
|
108
136
|
}}
|
|
109
137
|
>
|
|
110
138
|
{children}
|
|
111
139
|
</SheetContext.Provider>
|
|
112
140
|
);
|
|
113
141
|
};
|
|
114
|
-
|
|
115
|
-
export type SheetProviderProps = {
|
|
116
|
-
graph: ComputeGraph;
|
|
117
|
-
sheet: SheetType;
|
|
118
|
-
readonly?: boolean;
|
|
119
|
-
ignoreAttention?: boolean;
|
|
120
|
-
} & Pick<SheetContextValue, 'onInfo'>;
|
|
121
|
-
|
|
122
|
-
export const SheetProvider = ({
|
|
123
|
-
children,
|
|
124
|
-
graph,
|
|
125
|
-
sheet,
|
|
126
|
-
readonly,
|
|
127
|
-
ignoreAttention,
|
|
128
|
-
onInfo,
|
|
129
|
-
}: PropsWithChildren<SheetProviderProps>) => {
|
|
130
|
-
const model = useSheetModel(graph, sheet, { readonly });
|
|
131
|
-
|
|
132
|
-
return !model ? null : (
|
|
133
|
-
<Grid.Root id={fullyQualifiedId(sheet)}>
|
|
134
|
-
<SheetProviderImpl model={model} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
135
|
-
{children}
|
|
136
|
-
</SheetProviderImpl>
|
|
137
|
-
</Grid.Root>
|
|
138
|
-
);
|
|
139
|
-
};
|
package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx}
RENAMED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { addressToA1Notation, isFormula, rangeToA1Notation } from '@dxos/compute';
|
|
8
|
-
import { Icon } from '@dxos/react-ui';
|
|
8
|
+
import { type ComposableProps, Icon } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { mapFormulaIndicesToRefs } from '../../types';
|
|
11
|
-
import { useSheetContext } from '../
|
|
11
|
+
import { useSheetContext } from '../SheetRoot';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type SheetStatusbarProps = ComposableProps;
|
|
14
|
+
|
|
15
|
+
export const SheetStatusbar = (props: SheetStatusbarProps) => {
|
|
14
16
|
const { model, cursor, range } = useSheetContext();
|
|
15
17
|
|
|
16
18
|
let value;
|
|
@@ -26,13 +28,16 @@ export const FunctionEditor = () => {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
return (
|
|
29
|
-
<div
|
|
31
|
+
<div
|
|
32
|
+
{...props}
|
|
33
|
+
className='flex shrink-0 justify-between items-center px-4 py-1 text-sm bg-toolbar-surface border-y !border-subdued-separator'
|
|
34
|
+
>
|
|
30
35
|
<div className='flex gap-4 items-center'>
|
|
31
36
|
<div className='flex w-16 items-center font-mono'>
|
|
32
37
|
{(range && rangeToA1Notation(range)) || (cursor && addressToA1Notation(cursor))}
|
|
33
38
|
</div>
|
|
34
39
|
<div className='flex gap-2 items-center'>
|
|
35
|
-
<Icon icon='ph--function--regular' classNames={['text-
|
|
40
|
+
<Icon icon='ph--function--regular' classNames={['text-green-text', formula ? 'visible' : 'invisible']} />
|
|
36
41
|
<span className='font-mono'>{value}</span>
|
|
37
42
|
</div>
|
|
38
43
|
</div>
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
9
|
|
|
10
10
|
import { translations } from '../../translations';
|
|
11
11
|
|
|
12
12
|
import { SheetToolbar } from './SheetToolbar';
|
|
13
13
|
|
|
14
14
|
const DefaultStory = () => {
|
|
15
|
-
// TODO(wittjosiah): Depends on
|
|
15
|
+
// TODO(wittjosiah): Depends on SheetRoot.
|
|
16
16
|
// return <SheetToolbar id='test' />;
|
|
17
17
|
return <>TODO</>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const meta = {
|
|
21
|
-
title: 'plugins/plugin-sheet/Toolbar',
|
|
21
|
+
title: 'plugins/plugin-sheet/components/Toolbar',
|
|
22
22
|
component: SheetToolbar as any,
|
|
23
23
|
render: DefaultStory,
|
|
24
|
-
decorators: [withTheme],
|
|
24
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
25
25
|
parameters: {
|
|
26
26
|
layout: 'fullscreen',
|
|
27
27
|
translations,
|