@dxos/plugin-sheet 0.8.2-main.2f9c567 → 0.8.2-main.30e4dbb
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-N74FX62K.mjs → SheetContainer-O4WVY7Y4.mjs} +86 -84
- package/dist/lib/browser/SheetContainer-O4WVY7Y4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SY25UNYZ.mjs → chunk-RSBJNX7L.mjs} +2 -2
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-XUJZGNUH.mjs → react-surface-JNDDTM6K.mjs} +2 -2
- package/dist/lib/node/{SheetContainer-MERCQUPB.cjs → SheetContainer-2CFOIYBF.cjs} +96 -92
- package/dist/lib/node/SheetContainer-2CFOIYBF.cjs.map +7 -0
- package/dist/lib/node/{chunk-62JKBCGO.cjs → chunk-3QKD6C7X.cjs} +5 -5
- package/dist/lib/node/index.cjs +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-GSS7VQ2D.cjs → react-surface-ZTKJM4TA.cjs} +8 -8
- package/dist/lib/node-esm/{SheetContainer-XFQTSA3I.mjs → SheetContainer-W3DQ7UFO.mjs} +86 -84
- package/dist/lib/node-esm/SheetContainer-W3DQ7UFO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RRIPYVEN.mjs → chunk-A5PYXQL6.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-XUFWQE5B.mjs → react-surface-M6VLLWMY.mjs} +2 -2
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +4 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/comment.d.ts +3 -1
- package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +3 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -54
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -45
- package/src/components/GridSheet/GridSheet.stories.tsx +1 -1
- package/src/components/SheetContainer/SheetContainer.stories.tsx +1 -5
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +1 -1
- package/src/components/SheetToolbar/SheetToolbar.tsx +33 -8
- package/src/components/SheetToolbar/align.ts +44 -14
- package/src/components/SheetToolbar/comment.ts +39 -11
- package/src/components/SheetToolbar/style.ts +48 -12
- package/dist/lib/browser/SheetContainer-N74FX62K.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-MERCQUPB.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-XFQTSA3I.mjs.map +0 -7
- package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +0 -8
- package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +0 -1
- package/src/components/SheetToolbar/useToolbarAction.ts +0 -87
- /package/dist/lib/browser/{chunk-SY25UNYZ.mjs.map → chunk-RSBJNX7L.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-XUJZGNUH.mjs.map → react-surface-JNDDTM6K.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-62JKBCGO.cjs.map → chunk-3QKD6C7X.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-GSS7VQ2D.cjs.map → react-surface-ZTKJM4TA.cjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-RRIPYVEN.mjs.map → chunk-A5PYXQL6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-XUFWQE5B.mjs.map → react-surface-M6VLLWMY.mjs.map} +0 -0
|
@@ -1,61 +1,9 @@
|
|
|
1
|
+
import { SheetType } from './types';
|
|
1
2
|
declare const _default: readonly [{
|
|
2
3
|
readonly 'en-US': {
|
|
3
|
-
readonly [
|
|
4
|
+
readonly [SheetType.typename]: {
|
|
4
5
|
readonly 'typename label': "Sheet";
|
|
5
6
|
readonly 'object name placeholder': "New sheet";
|
|
6
|
-
readonly 'plugin name'?: undefined;
|
|
7
|
-
readonly 'cell placeholder'?: undefined;
|
|
8
|
-
readonly 'range key alignment label'?: undefined;
|
|
9
|
-
readonly 'range key style label'?: undefined;
|
|
10
|
-
readonly 'range value start label'?: undefined;
|
|
11
|
-
readonly 'range value center label'?: undefined;
|
|
12
|
-
readonly 'range value end label'?: undefined;
|
|
13
|
-
readonly 'range value softwrap label'?: undefined;
|
|
14
|
-
readonly 'range value highlight label'?: undefined;
|
|
15
|
-
readonly 'toolbar action label'?: undefined;
|
|
16
|
-
readonly 'selection overlaps existing comment label'?: undefined;
|
|
17
|
-
readonly 'comment label'?: undefined;
|
|
18
|
-
readonly 'comment ranges not supported label'?: undefined;
|
|
19
|
-
readonly 'no cursor label'?: undefined;
|
|
20
|
-
readonly 'open comment for sheet cell'?: undefined;
|
|
21
|
-
readonly 'add col before label'?: undefined;
|
|
22
|
-
readonly 'add col after label'?: undefined;
|
|
23
|
-
readonly 'delete col label'?: undefined;
|
|
24
|
-
readonly 'add row before label'?: undefined;
|
|
25
|
-
readonly 'add row after label'?: undefined;
|
|
26
|
-
readonly 'delete row label'?: undefined;
|
|
27
|
-
readonly 'range list heading'?: undefined;
|
|
28
|
-
readonly 'range title'?: undefined;
|
|
29
|
-
readonly 'col dropped label'?: undefined;
|
|
30
|
-
readonly 'row dropped label'?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
readonly 'plugin name': "Sheets";
|
|
33
|
-
readonly 'cell placeholder': "Cell value...";
|
|
34
|
-
readonly 'range key alignment label': "Align";
|
|
35
|
-
readonly 'range key style label': "Style";
|
|
36
|
-
readonly 'range value start label': "Align left";
|
|
37
|
-
readonly 'range value center label': "Align center";
|
|
38
|
-
readonly 'range value end label': "Align right";
|
|
39
|
-
readonly 'range value softwrap label': "Wrap text";
|
|
40
|
-
readonly 'range value highlight label': "Highlight";
|
|
41
|
-
readonly 'toolbar action label': "{{value}}";
|
|
42
|
-
readonly 'selection overlaps existing comment label': "Selected cell already has a comment";
|
|
43
|
-
readonly 'comment label': "Add comment";
|
|
44
|
-
readonly 'comment ranges not supported label': "Commenting on ranges is not yet supported";
|
|
45
|
-
readonly 'no cursor label': "Select a cell to comment";
|
|
46
|
-
readonly 'open comment for sheet cell': "View comments for cell";
|
|
47
|
-
readonly 'add col before label': "Add column before";
|
|
48
|
-
readonly 'add col after label': "Add column after";
|
|
49
|
-
readonly 'delete col label': "Delete column";
|
|
50
|
-
readonly 'add row before label': "Add row before";
|
|
51
|
-
readonly 'add row after label': "Add row after";
|
|
52
|
-
readonly 'delete row label': "Delete row";
|
|
53
|
-
readonly 'range list heading': "Ranges";
|
|
54
|
-
readonly 'range title': "{{position}} — {{value}}";
|
|
55
|
-
readonly 'col dropped label': "Deleted a column";
|
|
56
|
-
readonly 'row dropped label': "Deleted a row";
|
|
57
|
-
readonly 'typename label'?: undefined;
|
|
58
|
-
readonly 'object name placeholder'?: undefined;
|
|
59
7
|
};
|
|
60
8
|
readonly "dxos.org/plugin/sheet": {
|
|
61
9
|
readonly 'plugin name': "Sheets";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;;;QAK9B,SAAA,CAAC,SAAS,CAAC,QAAQ,CAAC;;;UAGnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANP,wBAoCW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,GAAG,EAAe,MAAM,mBAAmB,CAAC;AAGrD,eAAO,MAAM,SAAS;;EAKpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAG7D,eAAO,MAAM,KAAK;;;;EAIhB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAGrD,eAAO,MAAM,aAAa;;EAExB,CAAC
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names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file":"sheet-range-types.d.ts","sourceRoot":"","sources":["../../../../src/types/sheet-range-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,QAAQ,cAAc,CAAC;AACpC,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC;AACvC,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpD,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,eAAO,MAAM,QAAQ,UAAU,CAAC;AAChC,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC;AACvC,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAGlD,eAAO,MAAM,qBAAqB,GAAI,gBAAgB,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAG,cA8BnF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/types/util.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE9E,eAAO,MAAM,QAAQ,MAAM,CAAC;AAC5B,eAAO,MAAM,QAAQ,MAAM,CAAC;AAE5B,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,YAAY,KAAK,CAAC;AAG/B,qBAAa,QAAS,SAAQ,KAAK;CAAG;AAEtC,qBAAa,iBAAkB,SAAQ,QAAQ;CAAG;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AK,MAAM,KAAG,WAMhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,EAAE,OAAO,SAAS,KAAG,MAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,EAAE,KAAK,MAAM,KAAG,iBAG9D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,SAAS,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAAM,KAAG,MAUxF,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,SAAS,EAAE,SAAS,MAAM,KAAG,MAK3E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,SAAS,EAAE,SAAS,MAAM,KAAG,MAK3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-sheet",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.30e4dbb",
|
|
4
4
|
"description": "Braneframe sketch plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -54,39 +54,39 @@
|
|
|
54
54
|
"re-resizable": "^6.9.17",
|
|
55
55
|
"react-markdown": "^8.0.5",
|
|
56
56
|
"react-resize-detector": "^11.0.1",
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/context": "0.8.2-main.
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/crypto": "0.8.2-main.
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/functions": "0.8.2-main.
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/plugin-
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/plugin-
|
|
75
|
-
"@dxos/plugin-
|
|
76
|
-
"@dxos/plugin-
|
|
77
|
-
"@dxos/plugin-stack": "0.8.2-main.
|
|
78
|
-
"@dxos/plugin-thread": "0.8.2-main.
|
|
79
|
-
"@dxos/react-
|
|
80
|
-
"@dxos/react-
|
|
81
|
-
"@dxos/react-
|
|
82
|
-
"@dxos/react-ui-
|
|
83
|
-
"@dxos/react-ui-
|
|
84
|
-
"@dxos/react-ui-grid": "0.8.2-main.
|
|
85
|
-
"@dxos/react-ui-
|
|
86
|
-
"@dxos/react-ui-
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/schema": "0.8.2-main.
|
|
89
|
-
"@dxos/
|
|
57
|
+
"@dxos/app-framework": "0.8.2-main.30e4dbb",
|
|
58
|
+
"@dxos/async": "0.8.2-main.30e4dbb",
|
|
59
|
+
"@dxos/compute": "0.8.2-main.30e4dbb",
|
|
60
|
+
"@dxos/context": "0.8.2-main.30e4dbb",
|
|
61
|
+
"@dxos/client": "0.8.2-main.30e4dbb",
|
|
62
|
+
"@dxos/crypto": "0.8.2-main.30e4dbb",
|
|
63
|
+
"@dxos/echo-schema": "0.8.2-main.30e4dbb",
|
|
64
|
+
"@dxos/debug": "0.8.2-main.30e4dbb",
|
|
65
|
+
"@dxos/functions": "0.8.2-main.30e4dbb",
|
|
66
|
+
"@dxos/invariant": "0.8.2-main.30e4dbb",
|
|
67
|
+
"@dxos/keys": "0.8.2-main.30e4dbb",
|
|
68
|
+
"@dxos/live-object": "0.8.2-main.30e4dbb",
|
|
69
|
+
"@dxos/plugin-attention": "0.8.2-main.30e4dbb",
|
|
70
|
+
"@dxos/log": "0.8.2-main.30e4dbb",
|
|
71
|
+
"@dxos/plugin-client": "0.8.2-main.30e4dbb",
|
|
72
|
+
"@dxos/plugin-graph": "0.8.2-main.30e4dbb",
|
|
73
|
+
"@dxos/plugin-deck": "0.8.2-main.30e4dbb",
|
|
74
|
+
"@dxos/plugin-markdown": "0.8.2-main.30e4dbb",
|
|
75
|
+
"@dxos/plugin-script": "0.8.2-main.30e4dbb",
|
|
76
|
+
"@dxos/plugin-space": "0.8.2-main.30e4dbb",
|
|
77
|
+
"@dxos/plugin-stack": "0.8.2-main.30e4dbb",
|
|
78
|
+
"@dxos/plugin-thread": "0.8.2-main.30e4dbb",
|
|
79
|
+
"@dxos/react-client": "0.8.2-main.30e4dbb",
|
|
80
|
+
"@dxos/react-hooks": "0.8.2-main.30e4dbb",
|
|
81
|
+
"@dxos/react-ui-editor": "0.8.2-main.30e4dbb",
|
|
82
|
+
"@dxos/react-ui-form": "0.8.2-main.30e4dbb",
|
|
83
|
+
"@dxos/react-ui-attention": "0.8.2-main.30e4dbb",
|
|
84
|
+
"@dxos/react-ui-grid": "0.8.2-main.30e4dbb",
|
|
85
|
+
"@dxos/react-ui-list": "0.8.2-main.30e4dbb",
|
|
86
|
+
"@dxos/react-ui-menu": "0.8.2-main.30e4dbb",
|
|
87
|
+
"@dxos/react-ui-stack": "0.8.2-main.30e4dbb",
|
|
88
|
+
"@dxos/schema": "0.8.2-main.30e4dbb",
|
|
89
|
+
"@dxos/util": "0.8.2-main.30e4dbb"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@lezer/generator": "^1.7.1",
|
|
@@ -98,22 +98,22 @@
|
|
|
98
98
|
"react": "~18.2.0",
|
|
99
99
|
"react-dom": "~18.2.0",
|
|
100
100
|
"vite": "5.4.7",
|
|
101
|
-
"@dxos/echo-generator": "0.8.2-main.
|
|
102
|
-
"@dxos/lit-grid": "0.8.2-main.
|
|
103
|
-
"@dxos/
|
|
104
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
105
|
-
"@dxos/react-ui-
|
|
106
|
-
"@dxos/react-ui-
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/
|
|
109
|
-
"@dxos/
|
|
101
|
+
"@dxos/echo-generator": "0.8.2-main.30e4dbb",
|
|
102
|
+
"@dxos/lit-grid": "0.8.2-main.30e4dbb",
|
|
103
|
+
"@dxos/react-ui": "0.8.2-main.30e4dbb",
|
|
104
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2-main.30e4dbb",
|
|
105
|
+
"@dxos/react-ui-theme": "0.8.2-main.30e4dbb",
|
|
106
|
+
"@dxos/react-ui-types": "0.8.2-main.30e4dbb",
|
|
107
|
+
"@dxos/random": "0.8.2-main.30e4dbb",
|
|
108
|
+
"@dxos/storybook-utils": "0.8.2-main.30e4dbb",
|
|
109
|
+
"@dxos/test-utils": "0.8.2-main.30e4dbb"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"effect": "^3.13.3",
|
|
113
113
|
"react": "~18.2.0",
|
|
114
114
|
"react-dom": "~18.2.0",
|
|
115
|
-
"@dxos/react-ui
|
|
116
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
115
|
+
"@dxos/react-ui": "0.8.2-main.30e4dbb",
|
|
116
|
+
"@dxos/react-ui-theme": "0.8.2-main.30e4dbb"
|
|
117
117
|
},
|
|
118
118
|
"publishConfig": {
|
|
119
119
|
"access": "public"
|
|
@@ -41,7 +41,7 @@ const meta: Meta = {
|
|
|
41
41
|
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
42
42
|
withComputeGraphDecorator(),
|
|
43
43
|
withTheme,
|
|
44
|
-
withLayout({ fullscreen: true,
|
|
44
|
+
withLayout({ fullscreen: true, classNames: 'grid' }),
|
|
45
45
|
withPluginManager(),
|
|
46
46
|
],
|
|
47
47
|
parameters: { translations },
|
|
@@ -64,11 +64,7 @@ const meta: Meta = {
|
|
|
64
64
|
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
65
65
|
withComputeGraphDecorator(),
|
|
66
66
|
withTheme,
|
|
67
|
-
withLayout({
|
|
68
|
-
fullscreen: true,
|
|
69
|
-
tooltips: true,
|
|
70
|
-
classNames: 'grid',
|
|
71
|
-
}),
|
|
67
|
+
withLayout({ fullscreen: true, classNames: 'grid' }),
|
|
72
68
|
withAttention,
|
|
73
69
|
// TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
|
|
74
70
|
withPluginManager({
|
|
@@ -23,7 +23,7 @@ const meta: Meta = {
|
|
|
23
23
|
title: 'plugins/plugin-sheet/Toolbar',
|
|
24
24
|
component: SheetToolbar,
|
|
25
25
|
render: DefaultStory,
|
|
26
|
-
decorators: [withTheme, withLayout(
|
|
26
|
+
decorators: [withTheme, withLayout()],
|
|
27
27
|
parameters: { translations, layout: 'fullscreen' },
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -4,14 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type PropsWithChildren, useCallback } from 'react';
|
|
6
6
|
|
|
7
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
+
import { type CompleteCellRange } from '@dxos/compute';
|
|
9
|
+
import { ThreadAction } from '@dxos/plugin-thread/types';
|
|
7
10
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
11
|
import { createGapSeparator, MenuProvider, ToolbarMenu, useMenuActions } from '@dxos/react-ui-menu';
|
|
9
12
|
|
|
10
13
|
import { createAlign, useAlignState } from './align';
|
|
11
14
|
import { createComment, useCommentState } from './comment';
|
|
12
15
|
import { createStyle, useStyleState } from './style';
|
|
13
|
-
import { useToolbarAction } from './useToolbarAction';
|
|
14
16
|
import { type ToolbarState, useToolbarState } from './useToolbarState';
|
|
17
|
+
import { type SheetModel } from '../../model';
|
|
18
|
+
import { useSheetContext } from '../SheetContext';
|
|
15
19
|
|
|
16
20
|
//
|
|
17
21
|
// Root
|
|
@@ -19,11 +23,16 @@ import { type ToolbarState, useToolbarState } from './useToolbarState';
|
|
|
19
23
|
|
|
20
24
|
export type SheetToolbarProps = ThemedClassName<PropsWithChildren<{ attendableId?: string }>>;
|
|
21
25
|
|
|
22
|
-
const createToolbarActions = (
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
const createToolbarActions = (
|
|
27
|
+
model: SheetModel,
|
|
28
|
+
state: ToolbarState,
|
|
29
|
+
onComment: (cellContent: string, cursor: string) => void,
|
|
30
|
+
cursorFallbackRange?: CompleteCellRange,
|
|
31
|
+
) => {
|
|
32
|
+
const align = createAlign(model, state, cursorFallbackRange);
|
|
33
|
+
const style = createStyle(model, state, cursorFallbackRange);
|
|
25
34
|
const gap = createGapSeparator();
|
|
26
|
-
const comment = createComment(state);
|
|
35
|
+
const comment = createComment(model, state, onComment, cursorFallbackRange);
|
|
27
36
|
return {
|
|
28
37
|
nodes: [...align.nodes, ...style.nodes, ...gap.nodes, ...comment.nodes],
|
|
29
38
|
edges: [...align.edges, ...style.edges, ...gap.edges, ...comment.edges],
|
|
@@ -31,17 +40,33 @@ const createToolbarActions = (state: ToolbarState) => {
|
|
|
31
40
|
};
|
|
32
41
|
|
|
33
42
|
export const SheetToolbar = ({ attendableId, classNames }: SheetToolbarProps) => {
|
|
43
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
44
|
+
const { model, cursorFallbackRange } = useSheetContext();
|
|
34
45
|
const state = useToolbarState({});
|
|
35
46
|
useAlignState(state);
|
|
36
47
|
useStyleState(state);
|
|
37
48
|
useCommentState(state);
|
|
38
49
|
|
|
39
|
-
const
|
|
50
|
+
const handleComment = useCallback(
|
|
51
|
+
(name: string, cursor: string) =>
|
|
52
|
+
dispatch(
|
|
53
|
+
createIntent(ThreadAction.Create, {
|
|
54
|
+
cursor,
|
|
55
|
+
name,
|
|
56
|
+
subject: model.sheet,
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
[model.sheet, dispatch],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const actionsCreator = useCallback(
|
|
63
|
+
() => createToolbarActions(model, state, handleComment, cursorFallbackRange),
|
|
64
|
+
[model, state, handleComment, cursorFallbackRange],
|
|
65
|
+
);
|
|
40
66
|
const menu = useMenuActions(actionsCreator);
|
|
41
|
-
const handleAction = useToolbarAction(state);
|
|
42
67
|
|
|
43
68
|
return (
|
|
44
|
-
<MenuProvider {...menu} attendableId={attendableId}
|
|
69
|
+
<MenuProvider {...menu} attendableId={attendableId}>
|
|
45
70
|
<ToolbarMenu classNames={classNames} />
|
|
46
71
|
</MenuProvider>
|
|
47
72
|
);
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import { inRange } from '@dxos/compute';
|
|
7
|
+
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
8
|
import { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
|
|
9
9
|
|
|
10
|
+
import { type ToolbarState } from './useToolbarState';
|
|
10
11
|
import { SHEET_PLUGIN } from '../../meta';
|
|
11
|
-
import { type
|
|
12
|
+
import { type SheetModel } from '../../model';
|
|
13
|
+
import { type AlignKey, alignKey, type AlignValue, rangeFromIndex, rangeToIndex } from '../../types';
|
|
12
14
|
import { useSheetContext } from '../SheetContext';
|
|
13
15
|
|
|
14
16
|
export type AlignAction = { key: AlignKey; value: AlignValue };
|
|
@@ -43,21 +45,49 @@ const createAlignGroupAction = (value?: AlignValue) =>
|
|
|
43
45
|
value: `${alignKey}--${value}`,
|
|
44
46
|
} as ToolbarMenuActionGroupProperties);
|
|
45
47
|
|
|
46
|
-
const createAlignActions = (
|
|
48
|
+
const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallbackRange?: CompleteCellRange) =>
|
|
47
49
|
Object.entries(aligns).map(([alignValue, icon]) => {
|
|
48
|
-
return createMenuAction<AlignAction>(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
return createMenuAction<AlignAction>(
|
|
51
|
+
`${alignKey}--${alignValue}`,
|
|
52
|
+
() => {
|
|
53
|
+
if (!cursorFallbackRange) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const index =
|
|
57
|
+
model.sheet.ranges?.findIndex(
|
|
58
|
+
(range) =>
|
|
59
|
+
range.key === alignKey && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),
|
|
60
|
+
) ?? -1;
|
|
61
|
+
const nextRangeEntity = {
|
|
62
|
+
range: rangeToIndex(model.sheet, cursorFallbackRange),
|
|
63
|
+
key: alignKey,
|
|
64
|
+
value: alignValue as AlignValue,
|
|
65
|
+
};
|
|
66
|
+
if (index < 0) {
|
|
67
|
+
model.sheet.ranges?.push(nextRangeEntity);
|
|
68
|
+
state[alignKey] = nextRangeEntity.value;
|
|
69
|
+
} else if (model.sheet.ranges![index].value === nextRangeEntity.value) {
|
|
70
|
+
model.sheet.ranges?.splice(index, 1);
|
|
71
|
+
state[alignKey] = undefined;
|
|
72
|
+
} else {
|
|
73
|
+
model.sheet.ranges?.splice(index, 1, nextRangeEntity);
|
|
74
|
+
state[alignKey] = nextRangeEntity.value;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: alignKey,
|
|
79
|
+
value: alignValue as AlignValue,
|
|
80
|
+
checked: state[alignKey] === alignValue,
|
|
81
|
+
label: [`range value ${alignValue} label`, { ns: SHEET_PLUGIN }],
|
|
82
|
+
icon,
|
|
83
|
+
testId: `grid.toolbar.${alignKey}.${alignValue}`,
|
|
84
|
+
},
|
|
85
|
+
);
|
|
56
86
|
});
|
|
57
87
|
|
|
58
|
-
export const createAlign = (
|
|
59
|
-
const alignGroup = createAlignGroupAction(
|
|
60
|
-
const alignActions = createAlignActions(
|
|
88
|
+
export const createAlign = (model: SheetModel, state: ToolbarState, cursorFallbackRange?: CompleteCellRange) => {
|
|
89
|
+
const alignGroup = createAlignGroupAction(state[alignKey]);
|
|
90
|
+
const alignActions = createAlignActions(model, state, cursorFallbackRange);
|
|
61
91
|
return {
|
|
62
92
|
nodes: [alignGroup, ...alignActions],
|
|
63
93
|
edges: [
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type CompleteCellRange } from '@dxos/compute';
|
|
7
8
|
import { RefArray } from '@dxos/live-object';
|
|
8
9
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
9
10
|
|
|
11
|
+
import { completeCellRangeToThreadCursor } from '../../integrations/thread-ranges';
|
|
10
12
|
import { SHEET_PLUGIN } from '../../meta';
|
|
13
|
+
import { type SheetModel } from '../../model';
|
|
11
14
|
import { commentKey, type CommentKey, type CommentValue, rangeToIndex } from '../../types';
|
|
12
15
|
import { useSheetContext } from '../SheetContext';
|
|
13
16
|
|
|
@@ -41,16 +44,41 @@ export const useCommentState = (state: Partial<CommentState>) => {
|
|
|
41
44
|
}, [overlapsCommentAnchor, cursorFallbackRange]);
|
|
42
45
|
};
|
|
43
46
|
|
|
44
|
-
const createCommentAction = (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const createCommentAction = (
|
|
48
|
+
model: SheetModel,
|
|
49
|
+
state: Partial<CommentState>,
|
|
50
|
+
onComment: (cellContent: string, cursor: string) => void,
|
|
51
|
+
cursorFallbackRange?: CompleteCellRange,
|
|
52
|
+
) =>
|
|
53
|
+
createMenuAction<Pick<CommentAction, 'key'>>(
|
|
54
|
+
'comment',
|
|
55
|
+
() => {
|
|
56
|
+
if (!cursorFallbackRange) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const cellContent = model.getCellText(cursorFallbackRange.from);
|
|
61
|
+
if (!cellContent) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onComment(cellContent, completeCellRangeToThreadCursor(cursorFallbackRange));
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: commentKey,
|
|
69
|
+
testId: 'editor.toolbar.comment',
|
|
70
|
+
icon: 'ph--chat-text--regular',
|
|
71
|
+
label: [`${state.commentEnabled} label`, { ns: SHEET_PLUGIN }],
|
|
72
|
+
disabled: state.commentEnabled !== 'comment',
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export const createComment = (
|
|
77
|
+
model: SheetModel,
|
|
78
|
+
state: Partial<CommentState>,
|
|
79
|
+
onComment: (cellContent: string, cursor: string) => void,
|
|
80
|
+
cursorFallbackRange?: CompleteCellRange,
|
|
81
|
+
) => ({
|
|
82
|
+
nodes: [createCommentAction(model, state, onComment, cursorFallbackRange)],
|
|
55
83
|
edges: [{ source: 'root', target: 'comment' }],
|
|
56
84
|
});
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import { inRange } from '@dxos/compute';
|
|
7
|
+
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
8
|
import { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
|
|
9
9
|
|
|
10
10
|
import { SHEET_PLUGIN } from '../../meta';
|
|
11
|
-
import {
|
|
11
|
+
import { type SheetModel } from '../../model';
|
|
12
|
+
import { rangeFromIndex, rangeToIndex, type StyleKey, type StyleValue } from '../../types';
|
|
12
13
|
import { useSheetContext } from '../SheetContext';
|
|
13
14
|
|
|
14
15
|
export type StyleState = Partial<Record<StyleValue, boolean>>;
|
|
@@ -48,20 +49,55 @@ const createStyleGroup = (state: StyleState) => {
|
|
|
48
49
|
} as ToolbarMenuActionGroupProperties);
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
const createStyleActions = (state: StyleState) =>
|
|
52
|
+
const createStyleActions = (model: SheetModel, state: StyleState, cursorFallbackRange?: CompleteCellRange) =>
|
|
52
53
|
Object.entries(styles).map(([styleValue, icon]) => {
|
|
53
|
-
return createMenuAction<StyleAction>(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
return createMenuAction<StyleAction>(
|
|
55
|
+
`style--${styleValue}`,
|
|
56
|
+
() => {
|
|
57
|
+
if (!cursorFallbackRange) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const index =
|
|
61
|
+
model.sheet.ranges?.findIndex(
|
|
62
|
+
(range) =>
|
|
63
|
+
range.key === 'style' && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),
|
|
64
|
+
) ?? -1;
|
|
65
|
+
const nextRangeEntity = {
|
|
66
|
+
range: rangeToIndex(model.sheet, cursorFallbackRange),
|
|
67
|
+
key: 'style',
|
|
68
|
+
value: styleValue as StyleValue,
|
|
69
|
+
};
|
|
70
|
+
if (
|
|
71
|
+
model.sheet.ranges
|
|
72
|
+
.filter(
|
|
73
|
+
({ range, key: rangeKey }) =>
|
|
74
|
+
rangeKey === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
|
|
75
|
+
)
|
|
76
|
+
.some(({ value: rangeValue }) => rangeValue === styleValue)
|
|
77
|
+
) {
|
|
78
|
+
// this value should be unset
|
|
79
|
+
if (index >= 0) {
|
|
80
|
+
model.sheet.ranges?.splice(index, 1);
|
|
81
|
+
}
|
|
82
|
+
state[nextRangeEntity.value] = false;
|
|
83
|
+
} else {
|
|
84
|
+
model.sheet.ranges?.push(nextRangeEntity);
|
|
85
|
+
state[nextRangeEntity.value] = true;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'style',
|
|
90
|
+
value: styleValue as StyleValue,
|
|
91
|
+
icon,
|
|
92
|
+
label: [`range value ${styleValue} label`, { ns: SHEET_PLUGIN }],
|
|
93
|
+
checked: !!state[styleValue as StyleValue],
|
|
94
|
+
},
|
|
95
|
+
);
|
|
60
96
|
});
|
|
61
97
|
|
|
62
|
-
export const createStyle = (state: StyleState) => {
|
|
98
|
+
export const createStyle = (model: SheetModel, state: StyleState, cursorFallbackRange?: CompleteCellRange) => {
|
|
63
99
|
const styleGroupAction = createStyleGroup(state);
|
|
64
|
-
const styleActions = createStyleActions(state);
|
|
100
|
+
const styleActions = createStyleActions(model, state, cursorFallbackRange);
|
|
65
101
|
return {
|
|
66
102
|
nodes: [styleGroupAction, ...styleActions],
|
|
67
103
|
edges: [
|