@dxos/plugin-sheet 0.6.12-main.ed7cda7 → 0.6.12-staging.e11e696
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/{SheetContainer-V4GCCZTX.mjs → SheetContainer-LG77O4RM.mjs} +14 -13
- package/dist/lib/browser/SheetContainer-LG77O4RM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-U2JHW3L6.mjs → chunk-CHQAW4F4.mjs} +206 -53
- package/dist/lib/browser/chunk-CHQAW4F4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6ZMQVB4Z.mjs → chunk-GSV5QNLD.mjs} +220 -177
- package/dist/lib/browser/chunk-GSV5QNLD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T3NJFTD4.mjs → chunk-WZMOZKQZ.mjs} +2 -2
- package/dist/lib/browser/{chunk-T3NJFTD4.mjs.map → chunk-WZMOZKQZ.mjs.map} +3 -3
- package/dist/lib/browser/graph-M4IQ76QX.mjs +33 -0
- package/dist/lib/browser/index.mjs +45 -21
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs → SheetContainer-OZ7DHH4L.cjs} +21 -20
- package/dist/lib/node/SheetContainer-OZ7DHH4L.cjs.map +7 -0
- package/dist/lib/node/{chunk-OTTD7FBK.cjs → chunk-5FTFZL5W.cjs} +224 -70
- package/dist/lib/node/chunk-5FTFZL5W.cjs.map +7 -0
- package/dist/lib/node/{chunk-DD6FIXWC.cjs → chunk-5XPK2V4A.cjs} +222 -175
- package/dist/lib/node/chunk-5XPK2V4A.cjs.map +7 -0
- package/dist/lib/node/{chunk-Q3HBHPRL.cjs → chunk-AOP42UAA.cjs} +5 -5
- package/dist/lib/node/{chunk-Q3HBHPRL.cjs.map → chunk-AOP42UAA.cjs.map} +3 -3
- package/dist/lib/node/graph-Q3N2X26H.cjs +55 -0
- package/dist/lib/node/graph-Q3N2X26H.cjs.map +7 -0
- package/dist/lib/node/index.cjs +51 -30
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +8 -8
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs → SheetContainer-4XS2G25Z.mjs} +14 -13
- package/dist/lib/node-esm/SheetContainer-4XS2G25Z.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-D6KU5MI7.mjs → chunk-5WPZCXNS.mjs} +220 -177
- package/dist/lib/node-esm/chunk-5WPZCXNS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7HVSOTGA.mjs → chunk-KK3XL37M.mjs} +206 -53
- package/dist/lib/node-esm/chunk-KK3XL37M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BMNA27EX.mjs → chunk-RR2AO4SM.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-BMNA27EX.mjs.map → chunk-RR2AO4SM.mjs.map} +3 -3
- package/dist/lib/node-esm/graph-SMPUMOV2.mjs +34 -0
- package/dist/lib/node-esm/index.mjs +45 -21
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/CellEditor/extension.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +3 -3
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +3 -3
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer.d.ts +1 -1
- package/dist/types/src/components/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/defs/types.d.ts.map +1 -1
- package/dist/types/src/defs/util.d.ts +1 -1
- package/dist/types/src/defs/util.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +3 -2
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph-registry.d.ts +34 -0
- package/dist/types/src/graph/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/graph/compute-graph.d.ts +17 -34
- package/dist/types/src/graph/compute-graph.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
- package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/graph/compute-node.d.ts +9 -2
- package/dist/types/src/graph/compute-node.d.ts.map +1 -1
- package/dist/types/src/graph/{async-function.d.ts → functions/async-function.d.ts} +13 -4
- package/dist/types/src/graph/functions/async-function.d.ts.map +1 -0
- package/dist/types/src/graph/functions/edge-function.d.ts +21 -0
- package/dist/types/src/graph/functions/edge-function.d.ts.map +1 -0
- package/dist/types/src/graph/functions/function-defs.d.ts.map +1 -0
- package/dist/types/src/graph/functions/index.d.ts +4 -0
- package/dist/types/src/graph/functions/index.d.ts.map +1 -0
- package/dist/types/src/graph/index.d.ts +2 -1
- package/dist/types/src/graph/index.d.ts.map +1 -1
- package/dist/types/src/graph/testing/index.d.ts +3 -0
- package/dist/types/src/graph/testing/index.d.ts.map +1 -0
- package/dist/types/src/graph/testing/test-builder.d.ts +15 -0
- package/dist/types/src/graph/testing/test-builder.d.ts.map +1 -0
- package/dist/types/src/graph/testing/test-plugin.d.ts +36 -0
- package/dist/types/src/graph/testing/test-plugin.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -1
- package/dist/types/src/hooks/useSheetModel.d.ts +2 -2
- package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +3 -3
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.test.d.ts +2 -0
- package/dist/types/src/model/sheet-model.test.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +4 -5
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +40 -39
- package/src/SheetPlugin.tsx +19 -15
- package/src/components/CellEditor/CellEditor.stories.tsx +2 -3
- package/src/components/CellEditor/extension.test.ts +0 -1
- package/src/components/CellEditor/extension.ts +4 -3
- package/src/components/GridSheet/GridSheet.stories.tsx +5 -4
- package/src/components/GridSheet/GridSheet.tsx +4 -4
- package/src/components/Sheet/Sheet.stories.tsx +21 -20
- package/src/components/Sheet/Sheet.tsx +30 -14
- package/src/components/Sheet/sheet-context.tsx +4 -4
- package/src/components/SheetContainer.tsx +13 -15
- package/src/defs/types.ts +1 -0
- package/src/defs/util.ts +19 -3
- package/src/extensions/compute.stories.tsx +20 -20
- package/src/extensions/compute.ts +91 -42
- package/src/graph/compute-graph-registry.ts +90 -0
- package/src/graph/compute-graph.stories.tsx +4 -3
- package/src/graph/compute-graph.test.ts +87 -0
- package/src/graph/compute-graph.ts +73 -121
- package/src/graph/compute-node.ts +17 -5
- package/src/graph/{async-function.ts → functions/async-function.ts} +23 -15
- package/src/graph/{edge-function.ts → functions/edge-function.ts} +14 -13
- package/src/graph/functions/index.ts +7 -0
- package/src/graph/hyperformula.test.ts +1 -2
- package/src/graph/index.ts +2 -1
- package/src/graph/testing/index.ts +6 -0
- package/src/graph/testing/test-builder.ts +54 -0
- package/src/graph/{custom-function.ts → testing/test-plugin.ts} +43 -9
- package/src/hooks/hooks.stories.tsx +3 -3
- package/src/hooks/useComputeGraph.ts +9 -1
- package/src/hooks/useSheetModel.ts +4 -7
- package/src/model/sheet-model.test.ts +59 -0
- package/src/model/sheet-model.ts +47 -30
- package/src/testing/testing.tsx +17 -15
- package/src/types.ts +3 -3
- package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs.map +0 -7
- package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +0 -7
- package/dist/lib/browser/graph-T27BOBOV.mjs +0 -21
- package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs.map +0 -7
- package/dist/lib/node/chunk-DD6FIXWC.cjs.map +0 -7
- package/dist/lib/node/chunk-OTTD7FBK.cjs.map +0 -7
- package/dist/lib/node/graph-SPKGX7W4.cjs +0 -43
- package/dist/lib/node/graph-SPKGX7W4.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +0 -7
- package/dist/lib/node-esm/graph-U67IO4UC.mjs +0 -22
- package/dist/types/src/graph/async-function.d.ts.map +0 -1
- package/dist/types/src/graph/compute-graph.browser.test.d.ts +0 -2
- package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +0 -1
- package/dist/types/src/graph/custom-function.d.ts +0 -21
- package/dist/types/src/graph/custom-function.d.ts.map +0 -1
- package/dist/types/src/graph/edge-function.d.ts +0 -20
- package/dist/types/src/graph/edge-function.d.ts.map +0 -1
- package/dist/types/src/graph/function-defs.d.ts.map +0 -1
- package/src/graph/compute-graph.browser.test.ts +0 -104
- /package/dist/lib/browser/{graph-T27BOBOV.mjs.map → graph-M4IQ76QX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{graph-U67IO4UC.mjs.map → graph-SMPUMOV2.mjs.map} +0 -0
- /package/dist/types/src/graph/{function-defs.d.ts → functions/function-defs.d.ts} +0 -0
- /package/src/graph/{function-defs.ts → functions/function-defs.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMxD,oBAAY,WAAW;IACrB,MAAM,wCAA2B;CAClC;AAKD,KAAK,cAAc,CAAC,CAAC,IAAI;IACvB,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;QAClC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC;KAC9F,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAC/C,sBAAsB,GACtB,oBAAoB,GACpB,yBAAyB,GACzB,uBAAuB,GACvB,oBAAoB,GACpB,cAAc,GACd,iBAAiB,GACjB,aAAa,GACb,cAAc,CAAC,SAAS,CAAC,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/D,eAAO,MAAM,SAAS;;EAMpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAExD;;GAEG;AAEH,oBAAY,aAAa;IACvB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;IAGV,OAAO,KAAK;IACZ,QAAQ,KAAK;IAGb,QAAQ,KAAK;IACb,IAAI,KAAK;IACT,IAAI,KAAK;IAIT,GAAG,KAAK;IACR,GAAG,KAAK;CACT;AAED,eAAO,MAAM,SAAS,+BAAyB,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;EAKrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAG1D,eAAO,MAAM,aAAa;;EAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMxD,oBAAY,WAAW;IACrB,MAAM,wCAA2B;CAClC;AAKD,KAAK,cAAc,CAAC,CAAC,IAAI;IACvB,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;QAClC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC;KAC9F,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAC/C,sBAAsB,GACtB,oBAAoB,GACpB,yBAAyB,GACzB,uBAAuB,GACvB,oBAAoB,GACpB,cAAc,GACd,iBAAiB,GACjB,aAAa,GACb,cAAc,CAAC,SAAS,CAAC,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/D,eAAO,MAAM,SAAS;;EAMpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAExD;;GAEG;AAEH,oBAAY,aAAa;IACvB,IAAI,IAAI;IACR,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;IAGV,OAAO,KAAK;IACZ,QAAQ,KAAK;IAGb,QAAQ,KAAK;IACb,IAAI,KAAK;IACT,IAAI,KAAK;IAIT,GAAG,KAAK;IACR,GAAG,KAAK;CACT;AAED,eAAO,MAAM,SAAS,+BAAyB,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;EAKrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAG1D,eAAO,MAAM,aAAa;;EAExB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBkC,CAAC;;oBACY,CAAC;uBAE3B,CAAA;wBACiB,CAAC;;;;;;;;2BAYC,CAAC;qBAAuC,CAAC;;iBAA8C,CAAC;sBAA4E,CAAC;;;mBAAwE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAhBpP,CAAC;;oBACY,CAAC;uBAE3B,CAAA;wBACiB,CAAC;;;;;;;;2BAYC,CAAC;qBAAuC,CAAC;;iBAA8C,CAAC;sBAA4E,CAAC;;;mBAAwE,CAAC;;;;;;;;AAlCzR,qBAAa,SAAU,SAAQ,cAuB7B;CAAG;AAEL,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-sheet",
|
|
3
|
-
"version": "0.6.12-
|
|
3
|
+
"version": "0.6.12-staging.e11e696",
|
|
4
4
|
"description": "Braneframe sketch plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -57,16 +57,17 @@
|
|
|
57
57
|
"src"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@codemirror/autocomplete": "^6.18.
|
|
61
|
-
"@codemirror/language": "^6.10.
|
|
60
|
+
"@codemirror/autocomplete": "^6.18.1",
|
|
61
|
+
"@codemirror/language": "^6.10.3",
|
|
62
62
|
"@codemirror/state": "^6.4.1",
|
|
63
|
-
"@codemirror/view": "^6.
|
|
63
|
+
"@codemirror/view": "^6.34.1",
|
|
64
64
|
"@dnd-kit/core": "^6.0.5",
|
|
65
65
|
"@dnd-kit/modifiers": "^6.0.0",
|
|
66
66
|
"@dnd-kit/sortable": "^7.0.1",
|
|
67
67
|
"@dnd-kit/utilities": "^3.2.0",
|
|
68
|
-
"@
|
|
69
|
-
"@lezer/
|
|
68
|
+
"@effect/schema": "^0.67.16",
|
|
69
|
+
"@lezer/common": "^1.2.2",
|
|
70
|
+
"@lezer/highlight": "^1.2.1",
|
|
70
71
|
"@lezer/lezer": "^1.1.2",
|
|
71
72
|
"@lezer/lr": "^1.4.2",
|
|
72
73
|
"@preact/signals-core": "^1.6.0",
|
|
@@ -78,29 +79,29 @@
|
|
|
78
79
|
"re-resizable": "^6.9.17",
|
|
79
80
|
"react-markdown": "^8.0.5",
|
|
80
81
|
"react-resize-detector": "^11.0.1",
|
|
81
|
-
"@dxos/app-framework": "0.6.12-
|
|
82
|
-
"@dxos/async": "0.6.12-
|
|
83
|
-
"@dxos/client": "0.6.12-
|
|
84
|
-
"@dxos/context": "0.6.12-
|
|
85
|
-
"@dxos/debug": "0.6.12-
|
|
86
|
-
"@dxos/echo-schema": "0.6.12-
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/plugin-
|
|
92
|
-
"@dxos/plugin-
|
|
93
|
-
"@dxos/plugin-
|
|
94
|
-
"@dxos/plugin-graph": "0.6.12-
|
|
95
|
-
"@dxos/plugin-
|
|
96
|
-
"@dxos/plugin-stack": "0.6.12-
|
|
97
|
-
"@dxos/
|
|
98
|
-
"@dxos/react-
|
|
99
|
-
"@dxos/
|
|
100
|
-
"@dxos/react-ui-
|
|
101
|
-
"@dxos/react-ui-
|
|
102
|
-
"@dxos/
|
|
103
|
-
"@dxos/
|
|
82
|
+
"@dxos/app-framework": "0.6.12-staging.e11e696",
|
|
83
|
+
"@dxos/async": "0.6.12-staging.e11e696",
|
|
84
|
+
"@dxos/client": "0.6.12-staging.e11e696",
|
|
85
|
+
"@dxos/context": "0.6.12-staging.e11e696",
|
|
86
|
+
"@dxos/debug": "0.6.12-staging.e11e696",
|
|
87
|
+
"@dxos/echo-schema": "0.6.12-staging.e11e696",
|
|
88
|
+
"@dxos/invariant": "0.6.12-staging.e11e696",
|
|
89
|
+
"@dxos/crypto": "0.6.12-staging.e11e696",
|
|
90
|
+
"@dxos/keys": "0.6.12-staging.e11e696",
|
|
91
|
+
"@dxos/log": "0.6.12-staging.e11e696",
|
|
92
|
+
"@dxos/plugin-client": "0.6.12-staging.e11e696",
|
|
93
|
+
"@dxos/plugin-attention": "0.6.12-staging.e11e696",
|
|
94
|
+
"@dxos/plugin-markdown": "0.6.12-staging.e11e696",
|
|
95
|
+
"@dxos/plugin-graph": "0.6.12-staging.e11e696",
|
|
96
|
+
"@dxos/plugin-script": "0.6.12-staging.e11e696",
|
|
97
|
+
"@dxos/plugin-stack": "0.6.12-staging.e11e696",
|
|
98
|
+
"@dxos/plugin-space": "0.6.12-staging.e11e696",
|
|
99
|
+
"@dxos/react-client": "0.6.12-staging.e11e696",
|
|
100
|
+
"@dxos/react-hooks": "0.6.12-staging.e11e696",
|
|
101
|
+
"@dxos/react-ui-editor": "0.6.12-staging.e11e696",
|
|
102
|
+
"@dxos/react-ui-grid": "0.6.12-staging.e11e696",
|
|
103
|
+
"@dxos/react-ui-attention": "0.6.12-staging.e11e696",
|
|
104
|
+
"@dxos/util": "0.6.12-staging.e11e696"
|
|
104
105
|
},
|
|
105
106
|
"devDependencies": {
|
|
106
107
|
"@lezer/generator": "^1.7.1",
|
|
@@ -113,20 +114,20 @@
|
|
|
113
114
|
"react": "~18.2.0",
|
|
114
115
|
"react-dom": "~18.2.0",
|
|
115
116
|
"vite": "5.4.7",
|
|
116
|
-
"@dxos/
|
|
117
|
-
"@dxos/
|
|
118
|
-
"@dxos/react-ui
|
|
119
|
-
"@dxos/react-ui-theme": "0.6.12-
|
|
120
|
-
"@dxos/react-ui": "0.6.12-
|
|
121
|
-
"@dxos/
|
|
122
|
-
"@dxos/
|
|
117
|
+
"@dxos/echo-generator": "0.6.12-staging.e11e696",
|
|
118
|
+
"@dxos/random": "0.6.12-staging.e11e696",
|
|
119
|
+
"@dxos/react-ui": "0.6.12-staging.e11e696",
|
|
120
|
+
"@dxos/react-ui-theme": "0.6.12-staging.e11e696",
|
|
121
|
+
"@dxos/react-ui-syntax-highlighter": "0.6.12-staging.e11e696",
|
|
122
|
+
"@dxos/storybook-utils": "0.6.12-staging.e11e696",
|
|
123
|
+
"@dxos/react-ui-types": "0.6.12-staging.e11e696"
|
|
123
124
|
},
|
|
124
|
-
"
|
|
125
|
+
"peerDependencies": {
|
|
125
126
|
"@phosphor-icons/react": "^2.1.5",
|
|
126
127
|
"react": "~18.2.0",
|
|
127
128
|
"react-dom": "~18.2.0",
|
|
128
|
-
"@dxos/react-ui": "0.6.12-
|
|
129
|
-
"@dxos/react-ui-theme": "0.6.12-
|
|
129
|
+
"@dxos/react-ui": "0.6.12-staging.e11e696",
|
|
130
|
+
"@dxos/react-ui-theme": "0.6.12-staging.e11e696"
|
|
130
131
|
},
|
|
131
132
|
"publishConfig": {
|
|
132
133
|
"access": "public"
|
package/src/SheetPlugin.tsx
CHANGED
|
@@ -15,13 +15,15 @@ import { getSpace, isEchoObject } from '@dxos/react-client/echo';
|
|
|
15
15
|
|
|
16
16
|
import { ComputeGraphContextProvider, SheetContainer } from './components';
|
|
17
17
|
import { compareIndexPositions, createSheet } from './defs';
|
|
18
|
+
import { computeGraphFacet } from './extensions';
|
|
18
19
|
import { type ComputeGraphRegistry } from './graph';
|
|
20
|
+
import { useComputeGraph } from './hooks';
|
|
19
21
|
import meta, { SHEET_PLUGIN } from './meta';
|
|
20
22
|
import translations from './translations';
|
|
21
23
|
import { SheetAction, SheetType, type SheetPluginProvides } from './types';
|
|
22
24
|
|
|
23
25
|
export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
24
|
-
let
|
|
26
|
+
let computeGraphRegistry: ComputeGraphRegistry | undefined;
|
|
25
27
|
|
|
26
28
|
return {
|
|
27
29
|
meta,
|
|
@@ -36,18 +38,18 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// Async import removes direct dependency on hyperformula.
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
+
const { ComputeGraphRegistry } = await import('./graph');
|
|
42
|
+
computeGraphRegistry = new ComputeGraphRegistry({ remoteFunctionUrl });
|
|
41
43
|
},
|
|
42
44
|
provides: {
|
|
43
45
|
context: ({ children }) => {
|
|
44
|
-
invariant(
|
|
45
|
-
return <ComputeGraphContextProvider registry={
|
|
46
|
+
invariant(computeGraphRegistry);
|
|
47
|
+
return <ComputeGraphContextProvider registry={computeGraphRegistry}>{children}</ComputeGraphContextProvider>;
|
|
46
48
|
},
|
|
47
49
|
metadata: {
|
|
48
50
|
records: {
|
|
49
51
|
[SheetType.typename]: {
|
|
50
|
-
label: (object: any) => (object instanceof SheetType ? object.
|
|
52
|
+
label: (object: any) => (object instanceof SheetType ? object.name : undefined),
|
|
51
53
|
placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],
|
|
52
54
|
icon: 'ph--grid-nine--regular',
|
|
53
55
|
},
|
|
@@ -108,12 +110,13 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
108
110
|
},
|
|
109
111
|
},
|
|
110
112
|
markdown: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
extensions: ({ document: doc }) => {
|
|
114
|
+
invariant(computeGraphRegistry);
|
|
115
|
+
const space = getSpace(doc);
|
|
116
|
+
if (space) {
|
|
117
|
+
const computeGraph = computeGraphRegistry.getOrCreateGraph(space);
|
|
118
|
+
return computeGraphFacet.of(computeGraph);
|
|
119
|
+
}
|
|
117
120
|
},
|
|
118
121
|
},
|
|
119
122
|
stack: {
|
|
@@ -138,12 +141,13 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
138
141
|
},
|
|
139
142
|
surface: {
|
|
140
143
|
component: ({ data, role }) => {
|
|
141
|
-
const space = isEchoObject(data.object)
|
|
142
|
-
|
|
144
|
+
const space = isEchoObject(data.object) ? getSpace(data.object) : undefined;
|
|
145
|
+
const graph = useComputeGraph(space);
|
|
146
|
+
if (graph && data.object instanceof SheetType) {
|
|
143
147
|
switch (role) {
|
|
144
148
|
case 'article':
|
|
145
149
|
case 'section': {
|
|
146
|
-
return <SheetContainer sheet={data.object}
|
|
150
|
+
return <SheetContainer graph={graph} sheet={data.object} role={role} />;
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
}
|
|
@@ -42,14 +42,13 @@ const AutomergeStory = ({ value, ...props }: StoryProps) => {
|
|
|
42
42
|
const [object, setObject] = useState<EchoReactiveObject<SheetType>>();
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
setTimeout(async () => {
|
|
45
|
-
const client = new Client();
|
|
45
|
+
const client = new Client({ types: [SheetType] });
|
|
46
46
|
await client.initialize();
|
|
47
47
|
await client.halo.createIdentity();
|
|
48
48
|
const space = await client.spaces.create();
|
|
49
|
-
client.addTypes([SheetType]);
|
|
50
49
|
|
|
51
50
|
const sheet = createSheet();
|
|
52
|
-
sheet.
|
|
51
|
+
sheet.name = 'Test';
|
|
53
52
|
sheet.cells[cell] = { value };
|
|
54
53
|
space.db.add(sheet);
|
|
55
54
|
setObject(sheet);
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { CompletionContext, type CompletionSource } from '@codemirror/autocomplete';
|
|
6
6
|
import { EditorState } from '@codemirror/state';
|
|
7
|
-
// @ts-ignore
|
|
8
7
|
import { testTree } from '@lezer/generator/test';
|
|
9
8
|
import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
10
9
|
import { describe, expect, test } from 'vitest';
|
|
@@ -12,12 +12,13 @@ import {
|
|
|
12
12
|
startCompletion,
|
|
13
13
|
} from '@codemirror/autocomplete';
|
|
14
14
|
import { HighlightStyle, type Language, syntaxHighlighting } from '@codemirror/language';
|
|
15
|
-
import { type Extension
|
|
15
|
+
import { type Extension } from '@codemirror/state';
|
|
16
16
|
import { type EditorView, ViewPlugin, type ViewUpdate, keymap } from '@codemirror/view';
|
|
17
17
|
import { type SyntaxNode } from '@lezer/common';
|
|
18
18
|
import { tags } from '@lezer/highlight';
|
|
19
19
|
import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
20
20
|
|
|
21
|
+
import { singleValueFacet } from '@dxos/react-ui-editor/state';
|
|
21
22
|
import { mx } from '@dxos/react-ui-theme';
|
|
22
23
|
|
|
23
24
|
import { type FunctionDefinition } from '../../graph';
|
|
@@ -59,7 +60,7 @@ const highlightStyles = HighlightStyle.define([
|
|
|
59
60
|
},
|
|
60
61
|
]);
|
|
61
62
|
|
|
62
|
-
const languageFacet =
|
|
63
|
+
const languageFacet = singleValueFacet<Language>();
|
|
63
64
|
|
|
64
65
|
export type SheetExtensionOptions = {
|
|
65
66
|
functions?: FunctionDefinition[];
|
|
@@ -229,7 +230,7 @@ export const rangeExtension = (onInit: (notifier: CellRangeNotifier) => void): E
|
|
|
229
230
|
|
|
230
231
|
// Find first Range or cell at cursor.
|
|
231
232
|
activeRange = undefined;
|
|
232
|
-
const
|
|
233
|
+
const language = view.state.facet(languageFacet);
|
|
233
234
|
const { topNode } = language.parser.parse(view.state.doc.toString());
|
|
234
235
|
visitTree(topNode, ({ type, from, to }) => {
|
|
235
236
|
if (from <= anchor && to >= anchor) {
|
|
@@ -10,14 +10,15 @@ import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
|
10
10
|
|
|
11
11
|
import { GridSheet } from './GridSheet';
|
|
12
12
|
import { useComputeGraph } from '../../hooks';
|
|
13
|
-
import { useTestSheet,
|
|
13
|
+
import { useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
14
|
+
import { SheetType } from '../../types';
|
|
14
15
|
|
|
15
16
|
export default {
|
|
16
17
|
title: 'plugin-sheet/GridSheet',
|
|
17
18
|
component: GridSheet,
|
|
18
19
|
decorators: [
|
|
19
|
-
withClientProvider({ createSpace: true }),
|
|
20
|
-
|
|
20
|
+
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
21
|
+
withComputeGraphDecorator(),
|
|
21
22
|
withTheme,
|
|
22
23
|
withLayout({ fullscreen: true, tooltips: true }),
|
|
23
24
|
],
|
|
@@ -31,5 +32,5 @@ export const Basic = () => {
|
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
return <GridSheet
|
|
35
|
+
return <GridSheet graph={graph} sheet={sheet} />;
|
|
35
36
|
};
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Space } from '@dxos/client/echo';
|
|
8
7
|
import {
|
|
9
8
|
type DxGridElement,
|
|
10
9
|
Grid,
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
|
|
16
15
|
import { dxGridCellIndexToSheetCellAddress, useSheetModelDxGridProps } from './util';
|
|
17
16
|
import { rangeToA1Notation, type CellRange } from '../../defs';
|
|
17
|
+
import { type ComputeGraph } from '../../graph';
|
|
18
18
|
import { useFormattingModel, useSheetModel, type UseSheetModelOptions } from '../../hooks';
|
|
19
19
|
import { type SheetModel, type FormattingModel } from '../../model';
|
|
20
20
|
import { type SheetType } from '../../types';
|
|
@@ -136,10 +136,10 @@ const GridSheetImpl = ({
|
|
|
136
136
|
);
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
export type GridSheetProps = {
|
|
139
|
+
export type GridSheetProps = { graph?: ComputeGraph; sheet?: SheetType } & UseSheetModelOptions;
|
|
140
140
|
|
|
141
|
-
export const GridSheet = ({
|
|
142
|
-
const model = useSheetModel(
|
|
141
|
+
export const GridSheet = ({ graph, sheet, ...options }: GridSheetProps) => {
|
|
142
|
+
const model = useSheetModel(graph, sheet, options);
|
|
143
143
|
const formatting = useFormattingModel(model);
|
|
144
144
|
if (!model || !formatting) {
|
|
145
145
|
return null;
|
|
@@ -7,7 +7,7 @@ import '@dxos-theme';
|
|
|
7
7
|
import React, { useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
10
|
+
import { useSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
12
|
import { Button } from '@dxos/react-ui';
|
|
13
13
|
import { mx } from '@dxos/react-ui-theme';
|
|
@@ -17,18 +17,19 @@ import { Sheet } from './Sheet';
|
|
|
17
17
|
import { type SizeMap } from './grid';
|
|
18
18
|
import { useSheetContext } from './sheet-context';
|
|
19
19
|
import { addressToIndex, rangeToIndex } from '../../defs';
|
|
20
|
+
import { type ComputeGraph } from '../../graph';
|
|
21
|
+
import { testFunctionPlugins } from '../../graph/testing';
|
|
20
22
|
import { useComputeGraph } from '../../hooks';
|
|
21
|
-
import { useTestSheet,
|
|
23
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
22
24
|
import { SheetType, ValueTypeEnum } from '../../types';
|
|
23
25
|
import { Toolbar, type ToolbarActionHandler } from '../Toolbar';
|
|
24
26
|
|
|
25
27
|
// TODO(burdon): Allow toolbar to access sheet context; provide state for current cursor/range.
|
|
26
|
-
const SheetWithToolbar = ({
|
|
28
|
+
const SheetWithToolbar = ({ graph, debug }: { graph: ComputeGraph; debug?: boolean }) => {
|
|
27
29
|
const { model, cursor, range } = useSheetContext();
|
|
28
30
|
|
|
29
|
-
const graph = useComputeGraph(space);
|
|
30
31
|
const handleRefresh = () => {
|
|
31
|
-
graph?.refresh();
|
|
32
|
+
// graph?.refresh(); // TODO(burdon): ???
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
// TODO(burdon): Factor out.
|
|
@@ -104,7 +105,7 @@ export default {
|
|
|
104
105
|
component: Sheet,
|
|
105
106
|
decorators: [
|
|
106
107
|
withClientProvider({ types: [SheetType], createIdentity: true }),
|
|
107
|
-
|
|
108
|
+
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
108
109
|
withTheme,
|
|
109
110
|
withLayout({ fullscreen: true, tooltips: true, classNames: 'inset-4' }),
|
|
110
111
|
],
|
|
@@ -114,14 +115,14 @@ export const Default = () => {
|
|
|
114
115
|
const [debug, setDebug] = useState(false);
|
|
115
116
|
const space = useSpace();
|
|
116
117
|
const graph = useComputeGraph(space);
|
|
117
|
-
const sheet = useTestSheet(space, graph);
|
|
118
|
-
if (!
|
|
118
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
119
|
+
if (!graph || !sheet) {
|
|
119
120
|
return null;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
return (
|
|
123
|
-
<Sheet.Root
|
|
124
|
-
<SheetWithToolbar
|
|
124
|
+
<Sheet.Root graph={graph} sheet={sheet} onInfo={() => setDebug((debug) => !debug)}>
|
|
125
|
+
<SheetWithToolbar graph={graph} debug={debug} />
|
|
125
126
|
</Sheet.Root>
|
|
126
127
|
);
|
|
127
128
|
};
|
|
@@ -129,13 +130,13 @@ export const Default = () => {
|
|
|
129
130
|
export const Debug = () => {
|
|
130
131
|
const space = useSpace();
|
|
131
132
|
const graph = useComputeGraph(space);
|
|
132
|
-
const sheet = useTestSheet(space, graph);
|
|
133
|
-
if (!
|
|
133
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
134
|
+
if (!graph || !sheet) {
|
|
134
135
|
return null;
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
return (
|
|
138
|
-
<Sheet.Root
|
|
139
|
+
<Sheet.Root graph={graph} sheet={sheet}>
|
|
139
140
|
<Sheet.Main />
|
|
140
141
|
<Sheet.Debug />
|
|
141
142
|
</Sheet.Root>
|
|
@@ -147,12 +148,12 @@ export const Rows = () => {
|
|
|
147
148
|
const space = useSpace();
|
|
148
149
|
const graph = useComputeGraph(space);
|
|
149
150
|
const sheet = useTestSheet(space, graph);
|
|
150
|
-
if (!
|
|
151
|
+
if (!graph || !sheet) {
|
|
151
152
|
return null;
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
return (
|
|
155
|
-
<Sheet.Root
|
|
156
|
+
<Sheet.Root graph={graph} sheet={sheet}>
|
|
156
157
|
<Sheet.Rows
|
|
157
158
|
rows={sheet.rows}
|
|
158
159
|
sizes={rowSizes}
|
|
@@ -167,12 +168,12 @@ export const Columns = () => {
|
|
|
167
168
|
const space = useSpace();
|
|
168
169
|
const graph = useComputeGraph(space);
|
|
169
170
|
const sheet = useTestSheet(space, graph);
|
|
170
|
-
if (!
|
|
171
|
+
if (!graph || !sheet) {
|
|
171
172
|
return null;
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
return (
|
|
175
|
-
<Sheet.Root
|
|
176
|
+
<Sheet.Root graph={graph} sheet={sheet}>
|
|
176
177
|
<Sheet.Columns
|
|
177
178
|
columns={sheet.columns}
|
|
178
179
|
sizes={columnSizes}
|
|
@@ -185,13 +186,13 @@ export const Columns = () => {
|
|
|
185
186
|
export const Main = () => {
|
|
186
187
|
const space = useSpace();
|
|
187
188
|
const graph = useComputeGraph(space);
|
|
188
|
-
const sheet = useTestSheet(space, graph);
|
|
189
|
-
if (!
|
|
189
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
190
|
+
if (!graph || !sheet) {
|
|
190
191
|
return null;
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
return (
|
|
194
|
-
<Sheet.Root
|
|
195
|
+
<Sheet.Root graph={graph} sheet={sheet}>
|
|
195
196
|
<Sheet.Grid
|
|
196
197
|
size={{
|
|
197
198
|
numRows: 50,
|
|
@@ -25,6 +25,7 @@ import { Resizable, type ResizeCallback, type ResizeStartCallback } from 're-res
|
|
|
25
25
|
import React, {
|
|
26
26
|
type CSSProperties,
|
|
27
27
|
type DOMAttributes,
|
|
28
|
+
type KeyboardEventHandler,
|
|
28
29
|
type PropsWithChildren,
|
|
29
30
|
forwardRef,
|
|
30
31
|
useEffect,
|
|
@@ -40,7 +41,7 @@ import { debounce } from '@dxos/async';
|
|
|
40
41
|
import { fullyQualifiedId, createDocAccessor } from '@dxos/client/echo';
|
|
41
42
|
import { log } from '@dxos/log';
|
|
42
43
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
43
|
-
import {
|
|
44
|
+
import { ATTENABLE_ATTRIBUTE, useAttendableAttributes, useAttention, useAttentionPath } from '@dxos/react-ui-attention';
|
|
44
45
|
import { mx } from '@dxos/react-ui-theme';
|
|
45
46
|
|
|
46
47
|
import {
|
|
@@ -861,10 +862,8 @@ const SheetGrid = forwardRef<HTMLDivElement, SheetGridProps>(
|
|
|
861
862
|
columnSizes,
|
|
862
863
|
});
|
|
863
864
|
|
|
864
|
-
// TODO(burdon): Prevent scroll if not attended.
|
|
865
865
|
const id = fullyQualifiedId(model.sheet);
|
|
866
|
-
const
|
|
867
|
-
const hasAttention = useHasAttention(id);
|
|
866
|
+
const { hasAttention } = useAttention(id);
|
|
868
867
|
|
|
869
868
|
return (
|
|
870
869
|
<div ref={containerRef} role='grid' className='relative flex grow overflow-hidden'>
|
|
@@ -872,6 +871,7 @@ const SheetGrid = forwardRef<HTMLDivElement, SheetGridProps>(
|
|
|
872
871
|
<div className={mx('z-20 absolute inset-0 border border-gridLine pointer-events-none')} />
|
|
873
872
|
|
|
874
873
|
{/* Grid scroll container. */}
|
|
874
|
+
{/* NOTE: Prevents scroll if not attended. */}
|
|
875
875
|
<div ref={scrollerRef} className={mx('grow', hasAttention && 'overflow-auto scrollbar-thin')}>
|
|
876
876
|
{/* Scroll content. */}
|
|
877
877
|
<div
|
|
@@ -952,21 +952,37 @@ const SheetGrid = forwardRef<HTMLDivElement, SheetGridProps>(
|
|
|
952
952
|
</div>
|
|
953
953
|
|
|
954
954
|
{/* Hidden input for key navigation. */}
|
|
955
|
-
{createPortal(
|
|
956
|
-
<input
|
|
957
|
-
ref={inputRef}
|
|
958
|
-
autoFocus
|
|
959
|
-
className='absolute w-[1px] h-[1px] bg-transparent outline-none border-none caret-transparent'
|
|
960
|
-
onKeyDown={handleKeyDown}
|
|
961
|
-
{...attendableAttrs}
|
|
962
|
-
/>,
|
|
963
|
-
document.body,
|
|
964
|
-
)}
|
|
955
|
+
{createPortal(<SheetInput ref={inputRef} id={id} onKeyDown={handleKeyDown} />, document.body)}
|
|
965
956
|
</div>
|
|
966
957
|
);
|
|
967
958
|
},
|
|
968
959
|
);
|
|
969
960
|
|
|
961
|
+
type SheetInputProps = {
|
|
962
|
+
id: string;
|
|
963
|
+
onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
const SheetInput = forwardRef<HTMLInputElement, SheetInputProps>(({ id, onKeyDown }, forwardedRef) => {
|
|
967
|
+
const path = useAttentionPath();
|
|
968
|
+
const attendableAttrs = useAttendableAttributes(id);
|
|
969
|
+
|
|
970
|
+
// TODO(wittjosiah): Consider factoring out as an attention util.
|
|
971
|
+
// Wrap input in attendable divs for each part of the path.
|
|
972
|
+
// This ensures that the sheet stays attended when the input is focused.
|
|
973
|
+
return path.toReversed().reduce(
|
|
974
|
+
(acc, part) => {
|
|
975
|
+
return <div {...{ [ATTENABLE_ATTRIBUTE]: part }}>{acc}</div>;
|
|
976
|
+
},
|
|
977
|
+
<input
|
|
978
|
+
ref={forwardedRef}
|
|
979
|
+
className='absolute w-[1px] h-[1px] bg-transparent outline-none border-none caret-transparent'
|
|
980
|
+
onKeyDown={onKeyDown}
|
|
981
|
+
{...attendableAttrs}
|
|
982
|
+
/>,
|
|
983
|
+
);
|
|
984
|
+
});
|
|
985
|
+
|
|
970
986
|
//
|
|
971
987
|
// Selection
|
|
972
988
|
//
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import React, { type PropsWithChildren, createContext, useContext, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
9
8
|
|
|
10
9
|
import { createDecorations } from './decorations';
|
|
11
10
|
import { type CellAddress, type CellRange } from '../../defs';
|
|
11
|
+
import { type ComputeGraph } from '../../graph';
|
|
12
12
|
import { useSheetModel, useFormattingModel } from '../../hooks';
|
|
13
13
|
import { type FormattingModel, type SheetModel } from '../../model';
|
|
14
14
|
import { type SheetType } from '../../types';
|
|
@@ -45,19 +45,19 @@ export const useSheetContext = (): SheetContextType => {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export type SheetContextProps = {
|
|
48
|
+
graph: ComputeGraph;
|
|
48
49
|
sheet: SheetType;
|
|
49
|
-
space: Space;
|
|
50
50
|
readonly?: boolean;
|
|
51
51
|
} & Pick<SheetContextType, 'onInfo'>;
|
|
52
52
|
|
|
53
53
|
export const SheetContextProvider = ({
|
|
54
54
|
children,
|
|
55
|
+
graph,
|
|
55
56
|
sheet,
|
|
56
|
-
space,
|
|
57
57
|
readonly,
|
|
58
58
|
onInfo,
|
|
59
59
|
}: PropsWithChildren<SheetContextProps>) => {
|
|
60
|
-
const model = useSheetModel(
|
|
60
|
+
const model = useSheetModel(graph, sheet, { readonly });
|
|
61
61
|
const formatting = useFormattingModel(model);
|
|
62
62
|
|
|
63
63
|
// TODO(Zan): Impl. set range and set cursor that scrolls to that cell or range if it is not visible.
|
|
@@ -6,27 +6,22 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { useAttendableAttributes, useAttention } from '@dxos/react-ui-attention';
|
|
10
10
|
import { focusRing, mx } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
12
|
import { Sheet, type SheetRootProps } from './Sheet';
|
|
13
13
|
import { Toolbar, type ToolbarAction } from './Toolbar';
|
|
14
14
|
|
|
15
|
-
// TODO(Zan): Factor out, copied this from MarkdownPlugin.
|
|
16
|
-
const attentionFragment = mx(
|
|
17
|
-
'group-focus-within/editor:attention-surface group-[[aria-current]]/editor:attention-surface',
|
|
18
|
-
'group-focus-within/editor:border-separator',
|
|
19
|
-
);
|
|
20
|
-
|
|
21
15
|
// TODO(Zan): Factor out, copied this from MarkdownPlugin.
|
|
22
16
|
export const sectionToolbarLayout =
|
|
23
17
|
'bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity';
|
|
24
18
|
|
|
25
|
-
const SheetContainer = ({
|
|
19
|
+
const SheetContainer = ({ graph, sheet, role }: SheetRootProps & { role?: string }) => {
|
|
26
20
|
const dispatch = useIntentDispatcher();
|
|
27
21
|
|
|
28
22
|
const id = fullyQualifiedId(sheet);
|
|
29
|
-
const
|
|
23
|
+
const attendableAttrs = useAttendableAttributes(id);
|
|
24
|
+
const { hasAttention } = useAttention(id);
|
|
30
25
|
|
|
31
26
|
// TODO(Zan): Centralise the toolbar action handler. Current implementation in stories.
|
|
32
27
|
const handleAction = useCallback(
|
|
@@ -49,15 +44,19 @@ const SheetContainer = ({ sheet, space, role }: SheetRootProps & { role?: string
|
|
|
49
44
|
);
|
|
50
45
|
|
|
51
46
|
return (
|
|
52
|
-
<div
|
|
53
|
-
|
|
47
|
+
<div
|
|
48
|
+
role='none'
|
|
49
|
+
className={role === 'article' ? 'row-span-2 grid grid-rows-subgrid' : undefined}
|
|
50
|
+
{...(role === 'article' && attendableAttrs)}
|
|
51
|
+
>
|
|
52
|
+
<Sheet.Root graph={graph} sheet={sheet}>
|
|
54
53
|
<div role='none' className={mx('flex flex-0 justify-center overflow-x-auto')}>
|
|
55
54
|
<Toolbar.Root
|
|
56
55
|
onAction={handleAction}
|
|
57
56
|
classNames={mx(
|
|
58
57
|
role === 'section'
|
|
59
|
-
? ['z-[2] group-focus-within/section:visible', !
|
|
60
|
-
: '
|
|
58
|
+
? ['z-[2] group-focus-within/section:visible', !hasAttention && 'invisible', sectionToolbarLayout]
|
|
59
|
+
: 'attention-surface',
|
|
61
60
|
)}
|
|
62
61
|
>
|
|
63
62
|
{/* TODO(Zan): Restore some of this functionality */}
|
|
@@ -73,9 +72,8 @@ const SheetContainer = ({ sheet, space, role }: SheetRootProps & { role?: string
|
|
|
73
72
|
className={mx(
|
|
74
73
|
role === 'section' && 'aspect-square border-is border-bs border-be border-separator',
|
|
75
74
|
role === 'article' &&
|
|
76
|
-
'flex is-full overflow-hidden focus-visible:ring-inset row-span-1 data-[toolbar=disabled]:pbs-2 data-[toolbar=disabled]:row-span-2 border-bs border-separator',
|
|
75
|
+
'flex is-full overflow-hidden focus-visible:ring-inset row-span-1 data-[toolbar=disabled]:pbs-2 data-[toolbar=disabled]:row-span-2 border-bs border-separator attention-surface',
|
|
77
76
|
focusRing,
|
|
78
|
-
attentionFragment,
|
|
79
77
|
)}
|
|
80
78
|
>
|
|
81
79
|
<Sheet.Main />
|
package/src/defs/types.ts
CHANGED
|
@@ -34,6 +34,7 @@ export const addressToA1Notation = ({ col, row }: CellAddress): string => {
|
|
|
34
34
|
return `${columnLetter(col)}${row + 1}`;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
// TODO(burdon): See simpleCellAddressFromString
|
|
37
38
|
export const addressFromA1Notation = (ref: string): CellAddress => {
|
|
38
39
|
const match = ref.match(/([A-Z]+)(\d+)/);
|
|
39
40
|
invariant(match, `Invalid notation: ${ref}`);
|