@dxos/plugin-sheet 0.8.2-main.12df754 → 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-7DK3ZZUT.mjs → SheetContainer-O4WVY7Y4.mjs} +87 -85
- package/dist/lib/browser/SheetContainer-O4WVY7Y4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HRTIOTK7.mjs → chunk-N2FOQHUH.mjs} +49 -48
- package/dist/lib/browser/chunk-N2FOQHUH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IE42HBFC.mjs → chunk-RSBJNX7L.mjs} +7 -8
- package/dist/lib/browser/chunk-RSBJNX7L.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -4
- package/dist/lib/browser/{intent-resolver-OMXW6BDZ.mjs → intent-resolver-DN7JXDAV.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-RTQDRQ4X.mjs → react-surface-JNDDTM6K.mjs} +3 -3
- package/dist/lib/browser/{thread-HV32Z27A.mjs → thread-WU64QL2A.mjs} +2 -2
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{SheetContainer-6RPY4P7E.cjs → SheetContainer-2CFOIYBF.cjs} +105 -101
- package/dist/lib/node/SheetContainer-2CFOIYBF.cjs.map +7 -0
- package/dist/lib/node/{chunk-UXSU6W7E.cjs → chunk-3QKD6C7X.cjs} +19 -20
- package/dist/lib/node/chunk-3QKD6C7X.cjs.map +7 -0
- package/dist/lib/node/{chunk-C3Q4GSES.cjs → chunk-HLSQVT3C.cjs} +65 -64
- package/dist/lib/node/chunk-HLSQVT3C.cjs.map +7 -0
- package/dist/lib/node/index.cjs +10 -10
- package/dist/lib/node/{intent-resolver-KI5DG7LR.cjs → intent-resolver-OPF56TAL.cjs} +9 -9
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-ZDOTWZ4Q.cjs → react-surface-ZTKJM4TA.cjs} +11 -11
- package/dist/lib/node/{thread-NVEWN3H2.cjs → thread-E7YPGR5T.cjs} +7 -7
- package/dist/lib/node/types/index.cjs +29 -29
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{SheetContainer-QQUB22WF.mjs → SheetContainer-W3DQ7UFO.mjs} +87 -85
- package/dist/lib/node-esm/SheetContainer-W3DQ7UFO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JSVXC3QP.mjs → chunk-A5PYXQL6.mjs} +7 -8
- package/dist/lib/node-esm/chunk-A5PYXQL6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SWRUEW6J.mjs → chunk-LYZV4Q4C.mjs} +49 -48
- package/dist/lib/node-esm/chunk-LYZV4Q4C.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +4 -4
- package/dist/lib/node-esm/{intent-resolver-3FVOBB3K.mjs → intent-resolver-7AN5CN4R.mjs} +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-T4OVUZY2.mjs → react-surface-M6VLLWMY.mjs} +3 -3
- package/dist/lib/node-esm/{thread-DTWGGMW4.mjs → thread-ULESW6IX.mjs} +2 -2
- package/dist/lib/node-esm/types/index.mjs +1 -1
- 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 +363 -144
- 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/types.d.ts +36 -36
- package/dist/types/src/types/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 +47 -47
- package/src/components/ComputeGraph/compute-graph.stories.tsx +1 -1
- package/src/components/GridSheet/GridSheet.stories.tsx +1 -1
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +2 -2
- package/src/components/RangeList/RangeList.tsx +2 -2
- 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/src/integrations/thread-ranges.ts +2 -3
- package/src/model/sheet-model.test.ts +1 -1
- package/src/sanity.test.ts +1 -1
- package/src/types/schema.ts +21 -19
- package/src/types/types.ts +25 -25
- package/dist/lib/browser/SheetContainer-7DK3ZZUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-HRTIOTK7.mjs.map +0 -7
- package/dist/lib/browser/chunk-IE42HBFC.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-6RPY4P7E.cjs.map +0 -7
- package/dist/lib/node/chunk-C3Q4GSES.cjs.map +0 -7
- package/dist/lib/node/chunk-UXSU6W7E.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-QQUB22WF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JSVXC3QP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SWRUEW6J.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/{intent-resolver-OMXW6BDZ.mjs.map → intent-resolver-DN7JXDAV.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-RTQDRQ4X.mjs.map → react-surface-JNDDTM6K.mjs.map} +0 -0
- /package/dist/lib/browser/{thread-HV32Z27A.mjs.map → thread-WU64QL2A.mjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-KI5DG7LR.cjs.map → intent-resolver-OPF56TAL.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-ZDOTWZ4Q.cjs.map → react-surface-ZTKJM4TA.cjs.map} +0 -0
- /package/dist/lib/node/{thread-NVEWN3H2.cjs.map → thread-E7YPGR5T.cjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-3FVOBB3K.mjs.map → intent-resolver-7AN5CN4R.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-T4OVUZY2.mjs.map → react-surface-M6VLLWMY.mjs.map} +0 -0
- /package/dist/lib/node-esm/{thread-DTWGGMW4.mjs.map → thread-ULESW6IX.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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,
|
|
1
|
+
{"version":3,"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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import { type CellValue, SheetType } from './schema';
|
|
3
3
|
import { SheetModel } from '../model';
|
|
4
4
|
export type SheetSize = {
|
|
@@ -10,59 +10,59 @@ export type CreateSheetOptions = {
|
|
|
10
10
|
cells?: Record<string, CellValue>;
|
|
11
11
|
} & Partial<SheetSize>;
|
|
12
12
|
export declare namespace SheetAction {
|
|
13
|
-
const Create_base:
|
|
14
|
-
readonly _tag:
|
|
13
|
+
const Create_base: Schema.TaggedClass<Create, "dxos.org/plugin/sheet/action/create", {
|
|
14
|
+
readonly _tag: Schema.tag<"dxos.org/plugin/sheet/action/create">;
|
|
15
15
|
} & {
|
|
16
|
-
input:
|
|
17
|
-
name:
|
|
16
|
+
input: Schema.Struct<{
|
|
17
|
+
name: Schema.optional<typeof Schema.String>;
|
|
18
18
|
}>;
|
|
19
|
-
output:
|
|
19
|
+
output: Schema.Struct<{
|
|
20
20
|
object: typeof SheetType;
|
|
21
21
|
}>;
|
|
22
22
|
}>;
|
|
23
23
|
export class Create extends Create_base {
|
|
24
24
|
}
|
|
25
|
-
const InsertAxis_base:
|
|
26
|
-
readonly _tag:
|
|
25
|
+
const InsertAxis_base: Schema.TaggedClass<InsertAxis, "dxos.org/plugin/sheet/action/axis-insert", {
|
|
26
|
+
readonly _tag: Schema.tag<"dxos.org/plugin/sheet/action/axis-insert">;
|
|
27
27
|
} & {
|
|
28
|
-
input:
|
|
29
|
-
model:
|
|
30
|
-
axis:
|
|
31
|
-
index: typeof
|
|
32
|
-
count:
|
|
28
|
+
input: Schema.Struct<{
|
|
29
|
+
model: Schema.Schema<SheetModel>;
|
|
30
|
+
axis: Schema.Union<[Schema.Literal<["row"]>, Schema.Literal<["col"]>]>;
|
|
31
|
+
index: typeof Schema.Number;
|
|
32
|
+
count: Schema.optional<typeof Schema.Number>;
|
|
33
33
|
}>;
|
|
34
|
-
output: typeof
|
|
34
|
+
output: typeof Schema.Void;
|
|
35
35
|
}>;
|
|
36
36
|
export class InsertAxis extends InsertAxis_base {
|
|
37
37
|
}
|
|
38
|
-
export const RestoreAxis:
|
|
39
|
-
axis:
|
|
40
|
-
axisIndex: typeof
|
|
41
|
-
index: typeof
|
|
42
|
-
axisMeta:
|
|
43
|
-
size:
|
|
38
|
+
export const RestoreAxis: Schema.Struct<{
|
|
39
|
+
axis: Schema.Union<[Schema.Literal<["row"]>, Schema.Literal<["col"]>]>;
|
|
40
|
+
axisIndex: typeof Schema.String;
|
|
41
|
+
index: typeof Schema.Number;
|
|
42
|
+
axisMeta: Schema.Struct<{
|
|
43
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
44
44
|
}>;
|
|
45
|
-
values:
|
|
45
|
+
values: Schema.Array$<typeof Schema.Any>;
|
|
46
46
|
}>;
|
|
47
|
-
export type RestoreAxis =
|
|
48
|
-
const DropAxis_base:
|
|
49
|
-
readonly _tag:
|
|
47
|
+
export type RestoreAxis = Schema.Schema.Type<typeof RestoreAxis>;
|
|
48
|
+
const DropAxis_base: Schema.TaggedClass<DropAxis, "dxos.org/plugin/sheet/action/axis-drop", {
|
|
49
|
+
readonly _tag: Schema.tag<"dxos.org/plugin/sheet/action/axis-drop">;
|
|
50
50
|
} & {
|
|
51
|
-
input:
|
|
52
|
-
model:
|
|
53
|
-
axis:
|
|
54
|
-
axisIndex: typeof
|
|
55
|
-
deletionData:
|
|
56
|
-
axis:
|
|
57
|
-
axisIndex: typeof
|
|
58
|
-
index: typeof
|
|
59
|
-
axisMeta:
|
|
60
|
-
size:
|
|
51
|
+
input: Schema.Struct<{
|
|
52
|
+
model: Schema.Schema<SheetModel>;
|
|
53
|
+
axis: Schema.Union<[Schema.Literal<["row"]>, Schema.Literal<["col"]>]>;
|
|
54
|
+
axisIndex: typeof Schema.String;
|
|
55
|
+
deletionData: Schema.optional<Schema.Struct<{
|
|
56
|
+
axis: Schema.Union<[Schema.Literal<["row"]>, Schema.Literal<["col"]>]>;
|
|
57
|
+
axisIndex: typeof Schema.String;
|
|
58
|
+
index: typeof Schema.Number;
|
|
59
|
+
axisMeta: Schema.Struct<{
|
|
60
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
61
61
|
}>;
|
|
62
|
-
values:
|
|
62
|
+
values: Schema.Array$<typeof Schema.Any>;
|
|
63
63
|
}>>;
|
|
64
64
|
}>;
|
|
65
|
-
output: typeof
|
|
65
|
+
output: typeof Schema.Void;
|
|
66
66
|
}>;
|
|
67
67
|
export class DropAxis extends DropAxis_base {
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,SAAS,EAAiB,SAAS,EAAE,MAAM,UAAU,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,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;AAEvB,yBAAiB,WAAW,CAAC;;;;;;;;;;;IAG3B,MAAM,OAAO,MAAO,SAAQ,WAO1B;KAAG;;;;;mBAQgF,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;;;;;;;IAH9G,MAAM,OAAO,UAAW,SAAQ,eAS9B;KAAG;IAEL,MAAM,CAAC,MAAM,WAAW;;;;;;;;MAMtB,CAAC;IAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;;;;;mBAKoB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;IAH9G,MAAM,OAAO,QAAS,SAAQ,aAS5B;KAAG;;CACN"}
|
|
@@ -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;AAElD,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,CAAC,EAAE,MAAM;CAGtB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,
|
|
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;AAElD,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,CAAC,EAAE,MAAM;CAGtB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,eAAU,KAAG,MAKxC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,MAAM,EAAqD,CAAC;AAE3G,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,MAAM,aAQjF,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,SAAS,EAChB,oBAAiD,OAAO,CAAC,SAAS,CAAM,SAQzE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,2BAA0B,kBAAuB,KAAG,SA0B/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,EAAE,MAAM,WAAW,KAAG,MAEpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,EAAE,KAAK,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",
|
|
@@ -49,43 +49,44 @@
|
|
|
49
49
|
"@radix-ui/react-context": "1.1.1",
|
|
50
50
|
"codemirror-lang-spreadsheet": "^1.3.0",
|
|
51
51
|
"date-fns": "^3.3.1",
|
|
52
|
+
"effect": "^3.13.3",
|
|
52
53
|
"lodash.defaultsdeep": "^4.6.1",
|
|
53
54
|
"re-resizable": "^6.9.17",
|
|
54
55
|
"react-markdown": "^8.0.5",
|
|
55
56
|
"react-resize-detector": "^11.0.1",
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/context": "0.8.2-main.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/functions": "0.8.2-main.
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/plugin-
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/plugin-
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/plugin-
|
|
75
|
-
"@dxos/plugin-
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/plugin-
|
|
78
|
-
"@dxos/react-client": "0.8.2-main.
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/react-ui-
|
|
81
|
-
"@dxos/react-ui-form": "0.8.2-main.
|
|
82
|
-
"@dxos/react-ui-
|
|
83
|
-
"@dxos/react-ui-grid": "0.8.2-main.
|
|
84
|
-
"@dxos/react-ui-
|
|
85
|
-
"@dxos/react-ui-
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/util": "0.8.2-main.
|
|
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"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
92
|
"@lezer/generator": "^1.7.1",
|
|
@@ -94,26 +95,25 @@
|
|
|
94
95
|
"@types/react": "~18.2.0",
|
|
95
96
|
"@types/react-dom": "~18.2.0",
|
|
96
97
|
"@types/react-window": "^1.8.8",
|
|
97
|
-
"effect": "3.13.3",
|
|
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/react-ui
|
|
104
|
-
"@dxos/
|
|
105
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
106
|
-
"@dxos/react-ui-
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/storybook-utils": "0.8.2-main.
|
|
109
|
-
"@dxos/test-utils": "0.8.2-main.
|
|
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
|
-
"effect": "3.13.3",
|
|
112
|
+
"effect": "^3.13.3",
|
|
113
113
|
"react": "~18.2.0",
|
|
114
114
|
"react-dom": "~18.2.0",
|
|
115
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
116
|
-
"@dxos/react-ui-theme": "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"
|
|
@@ -8,7 +8,7 @@ import { type Meta } from '@storybook/react';
|
|
|
8
8
|
import React, { useEffect, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
11
|
-
import { FunctionType } from '@dxos/functions
|
|
11
|
+
import { FunctionType } from '@dxos/functions';
|
|
12
12
|
import { live, useSpace, Filter } from '@dxos/react-client/echo';
|
|
13
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
14
|
import { Toolbar, Button, Input } from '@dxos/react-ui';
|
|
@@ -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 },
|
|
@@ -8,7 +8,7 @@ import { type Meta } from '@storybook/react';
|
|
|
8
8
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { Client } from '@dxos/client';
|
|
11
|
-
import { createDocAccessor, type
|
|
11
|
+
import { createDocAccessor, type AnyLiveObject } from '@dxos/client/echo';
|
|
12
12
|
import { defaultFunctions } from '@dxos/compute';
|
|
13
13
|
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
14
14
|
import { automerge } from '@dxos/react-ui-editor';
|
|
@@ -32,7 +32,7 @@ const Story = ({ value, ...props }: StoryProps) => {
|
|
|
32
32
|
|
|
33
33
|
const AutomergeStory = ({ value, ...props }: StoryProps) => {
|
|
34
34
|
const cell = 'A1';
|
|
35
|
-
const [object, setObject] = useState<
|
|
35
|
+
const [object, setObject] = useState<AnyLiveObject<SheetType>>();
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
setTimeout(async () => {
|
|
38
38
|
const client = new Client({ types: [SheetType] });
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useCallback } from 'react';
|
|
6
7
|
|
|
7
8
|
import { rangeToA1Notation } from '@dxos/compute';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { List } from '@dxos/react-ui-list';
|
|
11
11
|
import { ghostHover } from '@dxos/react-ui-theme';
|
|
@@ -32,7 +32,7 @@ export const RangeList = ({ sheet }: RangeListProps) => {
|
|
|
32
32
|
return (
|
|
33
33
|
<>
|
|
34
34
|
<h2 className='p-2 text-sm font-semibold'>{t('range list heading')}</h2>
|
|
35
|
-
<List.Root<Range> items={sheet.ranges} isItem={
|
|
35
|
+
<List.Root<Range> items={sheet.ranges} isItem={Schema.is(Range)}>
|
|
36
36
|
{({ items: ranges }) =>
|
|
37
37
|
ranges.map((range, i) => (
|
|
38
38
|
<List.Item key={i} item={range} classNames={['p-2', ghostHover]}>
|
|
@@ -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
|
});
|