@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
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
ComputeGraphContextProvider,
|
|
6
6
|
RangeList,
|
|
7
7
|
SheetContainer
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RSBJNX7L.mjs";
|
|
9
9
|
import "./chunk-AT5ZK6JD.mjs";
|
|
10
10
|
import {
|
|
11
11
|
SheetType
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-N2FOQHUH.mjs";
|
|
13
13
|
import {
|
|
14
14
|
SHEET_PLUGIN
|
|
15
15
|
} from "./chunk-D3G4UGEK.mjs";
|
|
@@ -50,4 +50,4 @@ var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
|
50
50
|
export {
|
|
51
51
|
react_surface_default as default
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=react-surface-
|
|
53
|
+
//# sourceMappingURL=react-surface-JNDDTM6K.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SheetType,
|
|
3
3
|
compareIndexPositions
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-N2FOQHUH.mjs";
|
|
5
5
|
import "./chunk-D3G4UGEK.mjs";
|
|
6
6
|
|
|
7
7
|
// packages/plugins/plugin-sheet/src/capabilities/thread.ts
|
|
@@ -14,4 +14,4 @@ var thread_default = () => contributes(ThreadCapabilities.Thread, {
|
|
|
14
14
|
export {
|
|
15
15
|
thread_default as default
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=thread-
|
|
17
|
+
//# sourceMappingURL=thread-WU64QL2A.mjs.map
|
|
@@ -26,14 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var SheetContainer_2CFOIYBF_exports = {};
|
|
30
|
+
__export(SheetContainer_2CFOIYBF_exports, {
|
|
31
31
|
default: () => SheetContainer_default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var
|
|
33
|
+
module.exports = __toCommonJS(SheetContainer_2CFOIYBF_exports);
|
|
34
|
+
var import_chunk_3QKD6C7X = require("./chunk-3QKD6C7X.cjs");
|
|
35
35
|
var import_chunk_LEV7OSTK = require("./chunk-LEV7OSTK.cjs");
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_HLSQVT3C = require("./chunk-HLSQVT3C.cjs");
|
|
37
37
|
var import_chunk_JSIDCZHB = require("./chunk-JSIDCZHB.cjs");
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_echo = require("@dxos/react-client/echo");
|
|
@@ -42,6 +42,8 @@ var import_react2 = __toESM(require("react"));
|
|
|
42
42
|
var import_compute = require("@dxos/compute");
|
|
43
43
|
var import_react_ui = require("@dxos/react-ui");
|
|
44
44
|
var import_react3 = __toESM(require("react"));
|
|
45
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
46
|
+
var import_types = require("@dxos/plugin-thread/types");
|
|
45
47
|
var import_react_ui_menu = require("@dxos/react-ui-menu");
|
|
46
48
|
var import_react4 = require("react");
|
|
47
49
|
var import_compute2 = require("@dxos/compute");
|
|
@@ -53,19 +55,15 @@ var import_react6 = require("react");
|
|
|
53
55
|
var import_compute3 = require("@dxos/compute");
|
|
54
56
|
var import_react_ui_menu4 = require("@dxos/react-ui-menu");
|
|
55
57
|
var import_react7 = require("react");
|
|
56
|
-
var import_app_framework = require("@dxos/app-framework");
|
|
57
|
-
var import_compute4 = require("@dxos/compute");
|
|
58
|
-
var import_types = require("@dxos/plugin-thread/types");
|
|
59
|
-
var import_react8 = require("react");
|
|
60
58
|
var import_live_object2 = require("@dxos/live-object");
|
|
61
59
|
var FunctionEditor = () => {
|
|
62
|
-
const { model, cursor, range } = (0,
|
|
60
|
+
const { model, cursor, range } = (0, import_chunk_3QKD6C7X.useSheetContext)();
|
|
63
61
|
let value;
|
|
64
62
|
let formula = false;
|
|
65
63
|
if (cursor) {
|
|
66
64
|
value = model.getCellValue(cursor);
|
|
67
65
|
if ((0, import_compute.isFormula)(value)) {
|
|
68
|
-
value = model.graph.mapFunctionBindingFromId((0,
|
|
66
|
+
value = model.graph.mapFunctionBindingFromId((0, import_chunk_HLSQVT3C.mapFormulaIndicesToRefs)(model.sheet, value));
|
|
69
67
|
formula = true;
|
|
70
68
|
} else if (value != null) {
|
|
71
69
|
value = String(value);
|
|
@@ -95,9 +93,9 @@ var aligns = {
|
|
|
95
93
|
end: "ph--text-align-right--regular"
|
|
96
94
|
};
|
|
97
95
|
var useAlignState = (state) => {
|
|
98
|
-
const { cursor, model } = (0,
|
|
96
|
+
const { cursor, model } = (0, import_chunk_3QKD6C7X.useSheetContext)();
|
|
99
97
|
(0, import_react4.useEffect)(() => {
|
|
100
|
-
state[
|
|
98
|
+
state[import_chunk_HLSQVT3C.alignKey] = cursor ? model.sheet.ranges?.findLast(({ range, key }) => key === import_chunk_HLSQVT3C.alignKey && (0, import_compute2.inRange)((0, import_chunk_HLSQVT3C.rangeFromIndex)(model.sheet, range), cursor))?.value : void 0;
|
|
101
99
|
}, [
|
|
102
100
|
cursor,
|
|
103
101
|
model.sheet
|
|
@@ -112,13 +110,33 @@ var createAlignGroupAction = (value) => (0, import_react_ui_menu2.createMenuItem
|
|
|
112
110
|
],
|
|
113
111
|
variant: "toggleGroup",
|
|
114
112
|
selectCardinality: "single",
|
|
115
|
-
value: `${
|
|
113
|
+
value: `${import_chunk_HLSQVT3C.alignKey}--${value}`
|
|
116
114
|
});
|
|
117
|
-
var createAlignActions = (
|
|
118
|
-
return (0, import_react_ui_menu2.createMenuAction)(`${
|
|
119
|
-
|
|
115
|
+
var createAlignActions = (model, state, cursorFallbackRange) => Object.entries(aligns).map(([alignValue, icon]) => {
|
|
116
|
+
return (0, import_react_ui_menu2.createMenuAction)(`${import_chunk_HLSQVT3C.alignKey}--${alignValue}`, () => {
|
|
117
|
+
if (!cursorFallbackRange) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const index = model.sheet.ranges?.findIndex((range) => range.key === import_chunk_HLSQVT3C.alignKey && (0, import_compute2.inRange)((0, import_chunk_HLSQVT3C.rangeFromIndex)(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
|
|
121
|
+
const nextRangeEntity = {
|
|
122
|
+
range: (0, import_chunk_HLSQVT3C.rangeToIndex)(model.sheet, cursorFallbackRange),
|
|
123
|
+
key: import_chunk_HLSQVT3C.alignKey,
|
|
124
|
+
value: alignValue
|
|
125
|
+
};
|
|
126
|
+
if (index < 0) {
|
|
127
|
+
model.sheet.ranges?.push(nextRangeEntity);
|
|
128
|
+
state[import_chunk_HLSQVT3C.alignKey] = nextRangeEntity.value;
|
|
129
|
+
} else if (model.sheet.ranges[index].value === nextRangeEntity.value) {
|
|
130
|
+
model.sheet.ranges?.splice(index, 1);
|
|
131
|
+
state[import_chunk_HLSQVT3C.alignKey] = void 0;
|
|
132
|
+
} else {
|
|
133
|
+
model.sheet.ranges?.splice(index, 1, nextRangeEntity);
|
|
134
|
+
state[import_chunk_HLSQVT3C.alignKey] = nextRangeEntity.value;
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: import_chunk_HLSQVT3C.alignKey,
|
|
120
138
|
value: alignValue,
|
|
121
|
-
checked:
|
|
139
|
+
checked: state[import_chunk_HLSQVT3C.alignKey] === alignValue,
|
|
122
140
|
label: [
|
|
123
141
|
`range value ${alignValue} label`,
|
|
124
142
|
{
|
|
@@ -126,12 +144,12 @@ var createAlignActions = (value) => Object.entries(aligns).map(([alignValue, ico
|
|
|
126
144
|
}
|
|
127
145
|
],
|
|
128
146
|
icon,
|
|
129
|
-
testId: `grid.toolbar.${
|
|
147
|
+
testId: `grid.toolbar.${import_chunk_HLSQVT3C.alignKey}.${alignValue}`
|
|
130
148
|
});
|
|
131
149
|
});
|
|
132
|
-
var createAlign = (
|
|
133
|
-
const alignGroup = createAlignGroupAction(
|
|
134
|
-
const alignActions = createAlignActions(
|
|
150
|
+
var createAlign = (model, state, cursorFallbackRange) => {
|
|
151
|
+
const alignGroup = createAlignGroupAction(state[import_chunk_HLSQVT3C.alignKey]);
|
|
152
|
+
const alignActions = createAlignActions(model, state, cursorFallbackRange);
|
|
135
153
|
return {
|
|
136
154
|
nodes: [
|
|
137
155
|
alignGroup,
|
|
@@ -150,12 +168,12 @@ var createAlign = ({ [import_chunk_C3Q4GSES.alignKey]: alignValue }) => {
|
|
|
150
168
|
};
|
|
151
169
|
};
|
|
152
170
|
var useCommentState = (state) => {
|
|
153
|
-
const { cursorFallbackRange, model } = (0,
|
|
171
|
+
const { cursorFallbackRange, model } = (0, import_chunk_3QKD6C7X.useSheetContext)();
|
|
154
172
|
const overlapsCommentAnchor = (0, import_react5.useMemo)(() => import_live_object.RefArray.targets(model.sheet.threads ?? []).filter((thread) => thread.status !== "resolved").some((thread) => {
|
|
155
173
|
if (!cursorFallbackRange) {
|
|
156
174
|
return false;
|
|
157
175
|
}
|
|
158
|
-
return (0,
|
|
176
|
+
return (0, import_chunk_HLSQVT3C.rangeToIndex)(model.sheet, cursorFallbackRange) === thread.anchor;
|
|
159
177
|
}), [
|
|
160
178
|
cursorFallbackRange,
|
|
161
179
|
model.sheet
|
|
@@ -167,8 +185,17 @@ var useCommentState = (state) => {
|
|
|
167
185
|
cursorFallbackRange
|
|
168
186
|
]);
|
|
169
187
|
};
|
|
170
|
-
var createCommentAction = (state) => (0, import_react_ui_menu3.createMenuAction)("comment", {
|
|
171
|
-
|
|
188
|
+
var createCommentAction = (model, state, onComment, cursorFallbackRange) => (0, import_react_ui_menu3.createMenuAction)("comment", () => {
|
|
189
|
+
if (!cursorFallbackRange) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const cellContent = model.getCellText(cursorFallbackRange.from);
|
|
193
|
+
if (!cellContent) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
onComment(cellContent, (0, import_chunk_3QKD6C7X.completeCellRangeToThreadCursor)(cursorFallbackRange));
|
|
197
|
+
}, {
|
|
198
|
+
key: import_chunk_HLSQVT3C.commentKey,
|
|
172
199
|
testId: "editor.toolbar.comment",
|
|
173
200
|
icon: "ph--chat-text--regular",
|
|
174
201
|
label: [
|
|
@@ -179,9 +206,9 @@ var createCommentAction = (state) => (0, import_react_ui_menu3.createMenuAction)
|
|
|
179
206
|
],
|
|
180
207
|
disabled: state.commentEnabled !== "comment"
|
|
181
208
|
});
|
|
182
|
-
var createComment = (state) => ({
|
|
209
|
+
var createComment = (model, state, onComment, cursorFallbackRange) => ({
|
|
183
210
|
nodes: [
|
|
184
|
-
createCommentAction(state)
|
|
211
|
+
createCommentAction(model, state, onComment, cursorFallbackRange)
|
|
185
212
|
],
|
|
186
213
|
edges: [
|
|
187
214
|
{
|
|
@@ -195,12 +222,12 @@ var styles = {
|
|
|
195
222
|
softwrap: "ph--paragraph--regular"
|
|
196
223
|
};
|
|
197
224
|
var useStyleState = (state) => {
|
|
198
|
-
const { cursorFallbackRange, model } = (0,
|
|
225
|
+
const { cursorFallbackRange, model } = (0, import_chunk_3QKD6C7X.useSheetContext)();
|
|
199
226
|
(0, import_react6.useEffect)(() => {
|
|
200
227
|
state.highlight = false;
|
|
201
228
|
state.softwrap = false;
|
|
202
229
|
if (cursorFallbackRange && model.sheet.ranges) {
|
|
203
|
-
model.sheet.ranges.filter(({ range, key }) => key === "style" && (0, import_compute3.inRange)((0,
|
|
230
|
+
model.sheet.ranges.filter(({ range, key }) => key === "style" && (0, import_compute3.inRange)((0, import_chunk_HLSQVT3C.rangeFromIndex)(model.sheet, range), cursorFallbackRange.from)).forEach(({ value }) => {
|
|
204
231
|
state[value] = true;
|
|
205
232
|
});
|
|
206
233
|
}
|
|
@@ -216,8 +243,27 @@ var createStyleGroup = (state) => {
|
|
|
216
243
|
value: Object.keys(styles).filter((key) => !!state[key]).map((styleValue) => `style--${styleValue}`)
|
|
217
244
|
});
|
|
218
245
|
};
|
|
219
|
-
var createStyleActions = (state) => Object.entries(styles).map(([styleValue, icon]) => {
|
|
220
|
-
return (0, import_react_ui_menu4.createMenuAction)(`style--${styleValue}`, {
|
|
246
|
+
var createStyleActions = (model, state, cursorFallbackRange) => Object.entries(styles).map(([styleValue, icon]) => {
|
|
247
|
+
return (0, import_react_ui_menu4.createMenuAction)(`style--${styleValue}`, () => {
|
|
248
|
+
if (!cursorFallbackRange) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const index = model.sheet.ranges?.findIndex((range) => range.key === "style" && (0, import_compute3.inRange)((0, import_chunk_HLSQVT3C.rangeFromIndex)(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
|
|
252
|
+
const nextRangeEntity = {
|
|
253
|
+
range: (0, import_chunk_HLSQVT3C.rangeToIndex)(model.sheet, cursorFallbackRange),
|
|
254
|
+
key: "style",
|
|
255
|
+
value: styleValue
|
|
256
|
+
};
|
|
257
|
+
if (model.sheet.ranges.filter(({ range, key: rangeKey }) => rangeKey === "style" && (0, import_compute3.inRange)((0, import_chunk_HLSQVT3C.rangeFromIndex)(model.sheet, range), cursorFallbackRange.from)).some(({ value: rangeValue }) => rangeValue === styleValue)) {
|
|
258
|
+
if (index >= 0) {
|
|
259
|
+
model.sheet.ranges?.splice(index, 1);
|
|
260
|
+
}
|
|
261
|
+
state[nextRangeEntity.value] = false;
|
|
262
|
+
} else {
|
|
263
|
+
model.sheet.ranges?.push(nextRangeEntity);
|
|
264
|
+
state[nextRangeEntity.value] = true;
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
221
267
|
key: "style",
|
|
222
268
|
value: styleValue,
|
|
223
269
|
icon,
|
|
@@ -230,9 +276,9 @@ var createStyleActions = (state) => Object.entries(styles).map(([styleValue, ico
|
|
|
230
276
|
checked: !!state[styleValue]
|
|
231
277
|
});
|
|
232
278
|
});
|
|
233
|
-
var createStyle = (state) => {
|
|
279
|
+
var createStyle = (model, state, cursorFallbackRange) => {
|
|
234
280
|
const styleGroupAction = createStyleGroup(state);
|
|
235
|
-
const styleActions = createStyleActions(state);
|
|
281
|
+
const styleActions = createStyleActions(model, state, cursorFallbackRange);
|
|
236
282
|
return {
|
|
237
283
|
nodes: [
|
|
238
284
|
styleGroupAction,
|
|
@@ -250,67 +296,14 @@ var createStyle = (state) => {
|
|
|
250
296
|
]
|
|
251
297
|
};
|
|
252
298
|
};
|
|
253
|
-
var useToolbarAction = (state) => {
|
|
254
|
-
const { model, cursorFallbackRange, cursor } = (0, import_chunk_UXSU6W7E.useSheetContext)();
|
|
255
|
-
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
256
|
-
return (0, import_react7.useCallback)((action) => {
|
|
257
|
-
const { key, value } = action.properties;
|
|
258
|
-
if (cursorFallbackRange) {
|
|
259
|
-
const index = model.sheet.ranges?.findIndex((range) => range.key === key && (0, import_compute4.inRange)((0, import_chunk_C3Q4GSES.rangeFromIndex)(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
|
|
260
|
-
const nextRangeEntity = {
|
|
261
|
-
range: (0, import_chunk_C3Q4GSES.rangeToIndex)(model.sheet, cursorFallbackRange),
|
|
262
|
-
key,
|
|
263
|
-
value
|
|
264
|
-
};
|
|
265
|
-
switch (key) {
|
|
266
|
-
case "alignment":
|
|
267
|
-
if (index < 0) {
|
|
268
|
-
model.sheet.ranges?.push(nextRangeEntity);
|
|
269
|
-
state[import_chunk_C3Q4GSES.alignKey] = value;
|
|
270
|
-
} else if (model.sheet.ranges[index].value === value) {
|
|
271
|
-
model.sheet.ranges?.splice(index, 1);
|
|
272
|
-
state[import_chunk_C3Q4GSES.alignKey] = void 0;
|
|
273
|
-
} else {
|
|
274
|
-
model.sheet.ranges?.splice(index, 1, nextRangeEntity);
|
|
275
|
-
state[import_chunk_C3Q4GSES.alignKey] = value;
|
|
276
|
-
}
|
|
277
|
-
break;
|
|
278
|
-
case "style":
|
|
279
|
-
if (model.sheet.ranges.filter(({ range, key: rangeKey }) => rangeKey === "style" && (0, import_compute4.inRange)((0, import_chunk_C3Q4GSES.rangeFromIndex)(model.sheet, range), cursorFallbackRange.from)).some(({ value: rangeValue }) => rangeValue === value)) {
|
|
280
|
-
if (index >= 0) {
|
|
281
|
-
model.sheet.ranges?.splice(index, 1);
|
|
282
|
-
}
|
|
283
|
-
state[value] = false;
|
|
284
|
-
} else {
|
|
285
|
-
model.sheet.ranges?.push(nextRangeEntity);
|
|
286
|
-
state[value] = true;
|
|
287
|
-
}
|
|
288
|
-
break;
|
|
289
|
-
case "comment": {
|
|
290
|
-
const cellContent = model.getCellText(cursorFallbackRange.from);
|
|
291
|
-
void dispatch((0, import_app_framework.createIntent)(import_types.ThreadAction.Create, {
|
|
292
|
-
cursor: (0, import_chunk_UXSU6W7E.completeCellRangeToThreadCursor)(cursorFallbackRange),
|
|
293
|
-
name: cellContent,
|
|
294
|
-
subject: model.sheet
|
|
295
|
-
}));
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}, [
|
|
300
|
-
model.sheet,
|
|
301
|
-
cursorFallbackRange,
|
|
302
|
-
cursor,
|
|
303
|
-
dispatch
|
|
304
|
-
]);
|
|
305
|
-
};
|
|
306
299
|
var useToolbarState = (initialState = {}) => {
|
|
307
|
-
return (0,
|
|
300
|
+
return (0, import_react7.useMemo)(() => (0, import_live_object2.live)(initialState), []);
|
|
308
301
|
};
|
|
309
|
-
var createToolbarActions = (state) => {
|
|
310
|
-
const align = createAlign(state);
|
|
311
|
-
const style = createStyle(state);
|
|
302
|
+
var createToolbarActions = (model, state, onComment, cursorFallbackRange) => {
|
|
303
|
+
const align = createAlign(model, state, cursorFallbackRange);
|
|
304
|
+
const style = createStyle(model, state, cursorFallbackRange);
|
|
312
305
|
const gap = (0, import_react_ui_menu.createGapSeparator)();
|
|
313
|
-
const comment = createComment(state);
|
|
306
|
+
const comment = createComment(model, state, onComment, cursorFallbackRange);
|
|
314
307
|
return {
|
|
315
308
|
nodes: [
|
|
316
309
|
...align.nodes,
|
|
@@ -327,26 +320,37 @@ var createToolbarActions = (state) => {
|
|
|
327
320
|
};
|
|
328
321
|
};
|
|
329
322
|
var SheetToolbar = ({ attendableId, classNames }) => {
|
|
323
|
+
const { dispatchPromise: dispatch } = (0, import_app_framework.useIntentDispatcher)();
|
|
324
|
+
const { model, cursorFallbackRange } = (0, import_chunk_3QKD6C7X.useSheetContext)();
|
|
330
325
|
const state = useToolbarState({});
|
|
331
326
|
useAlignState(state);
|
|
332
327
|
useStyleState(state);
|
|
333
328
|
useCommentState(state);
|
|
334
|
-
const
|
|
335
|
-
|
|
329
|
+
const handleComment = (0, import_react3.useCallback)((name, cursor) => dispatch((0, import_app_framework.createIntent)(import_types.ThreadAction.Create, {
|
|
330
|
+
cursor,
|
|
331
|
+
name,
|
|
332
|
+
subject: model.sheet
|
|
333
|
+
})), [
|
|
334
|
+
model.sheet,
|
|
335
|
+
dispatch
|
|
336
|
+
]);
|
|
337
|
+
const actionsCreator = (0, import_react3.useCallback)(() => createToolbarActions(model, state, handleComment, cursorFallbackRange), [
|
|
338
|
+
model,
|
|
339
|
+
state,
|
|
340
|
+
handleComment,
|
|
341
|
+
cursorFallbackRange
|
|
336
342
|
]);
|
|
337
343
|
const menu = (0, import_react_ui_menu.useMenuActions)(actionsCreator);
|
|
338
|
-
const handleAction = useToolbarAction(state);
|
|
339
344
|
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui_menu.MenuProvider, {
|
|
340
345
|
...menu,
|
|
341
|
-
attendableId
|
|
342
|
-
onAction: handleAction
|
|
346
|
+
attendableId
|
|
343
347
|
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui_menu.ToolbarMenu, {
|
|
344
348
|
classNames
|
|
345
349
|
}));
|
|
346
350
|
};
|
|
347
351
|
var SheetContainer = ({ space, sheet, role, ignoreAttention }) => {
|
|
348
|
-
const graph = (0,
|
|
349
|
-
return graph ? /* @__PURE__ */ import_react.default.createElement(
|
|
352
|
+
const graph = (0, import_chunk_3QKD6C7X.useComputeGraph)(space);
|
|
353
|
+
return graph ? /* @__PURE__ */ import_react.default.createElement(import_chunk_3QKD6C7X.SheetProvider, {
|
|
350
354
|
sheet,
|
|
351
355
|
graph,
|
|
352
356
|
ignoreAttention
|
|
@@ -358,7 +362,7 @@ var SheetContainer = ({ space, sheet, role, ignoreAttention }) => {
|
|
|
358
362
|
}
|
|
359
363
|
}, /* @__PURE__ */ import_react.default.createElement(SheetToolbar, {
|
|
360
364
|
attendableId: (0, import_echo.fullyQualifiedId)(sheet)
|
|
361
|
-
}), /* @__PURE__ */ import_react.default.createElement(
|
|
365
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_chunk_3QKD6C7X.GridSheet, null), /* @__PURE__ */ import_react.default.createElement(FunctionEditor, null))) : null;
|
|
362
366
|
};
|
|
363
367
|
var SheetContainer_default = SheetContainer;
|
|
364
|
-
//# sourceMappingURL=SheetContainer-
|
|
368
|
+
//# sourceMappingURL=SheetContainer-2CFOIYBF.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/SheetContainer/SheetContainer.tsx", "../../../src/components/FunctionEditor/FunctionEditor.tsx", "../../../src/components/SheetToolbar/SheetToolbar.tsx", "../../../src/components/SheetToolbar/align.ts", "../../../src/components/SheetToolbar/comment.ts", "../../../src/components/SheetToolbar/style.ts", "../../../src/components/SheetToolbar/useToolbarState.ts", "../../../src/components/SheetContainer/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { fullyQualifiedId, type Space } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { type SheetType } from '../../types';\nimport { useComputeGraph } from '../ComputeGraph';\nimport { FunctionEditor } from '../FunctionEditor';\nimport { GridSheet } from '../GridSheet';\nimport { SheetProvider } from '../SheetContext';\nimport { SheetToolbar } from '../SheetToolbar';\n\nexport const SheetContainer = ({\n space,\n sheet,\n role,\n ignoreAttention,\n}: {\n space: Space;\n sheet: SheetType;\n role?: string;\n ignoreAttention?: boolean;\n}) => {\n const graph = useComputeGraph(space);\n\n return graph ? (\n <SheetProvider sheet={sheet} graph={graph} ignoreAttention={ignoreAttention}>\n <StackItem.Content toolbar statusbar {...(role === 'section' && { classNames: 'aspect-video' })}>\n <SheetToolbar attendableId={fullyQualifiedId(sheet)} />\n <GridSheet />\n <FunctionEditor />\n </StackItem.Content>\n </SheetProvider>\n ) : null;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { addressToA1Notation, isFormula, rangeToA1Notation } from '@dxos/compute';\nimport { Icon } from '@dxos/react-ui';\n\nimport { mapFormulaIndicesToRefs } from '../../types';\nimport { useSheetContext } from '../SheetContext';\n\nexport const FunctionEditor = () => {\n const { model, cursor, range } = useSheetContext();\n\n let value;\n let formula = false;\n if (cursor) {\n value = model.getCellValue(cursor);\n if (isFormula(value)) {\n value = model.graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(model.sheet, value));\n formula = true;\n } else if (value != null) {\n value = String(value);\n }\n }\n\n return (\n <div className='flex shrink-0 justify-between items-center px-4 py-1 text-sm attention-surface border-bs !border-separator'>\n <div className='flex gap-4 items-center'>\n <div className='flex w-16 items-center font-mono'>\n {(range && rangeToA1Notation(range)) || (cursor && addressToA1Notation(cursor))}\n </div>\n <div className='flex gap-2 items-center'>\n <Icon icon='ph--function--regular' classNames={['text-greenText', formula ? 'visible' : 'invisible']} />\n <span className='font-mono'>{value}</span>\n </div>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type PropsWithChildren, useCallback } from 'react';\n\nimport { createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { type CompleteCellRange } from '@dxos/compute';\nimport { ThreadAction } from '@dxos/plugin-thread/types';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { createGapSeparator, MenuProvider, ToolbarMenu, useMenuActions } from '@dxos/react-ui-menu';\n\nimport { createAlign, useAlignState } from './align';\nimport { createComment, useCommentState } from './comment';\nimport { createStyle, useStyleState } from './style';\nimport { type ToolbarState, useToolbarState } from './useToolbarState';\nimport { type SheetModel } from '../../model';\nimport { useSheetContext } from '../SheetContext';\n\n//\n// Root\n//\n\nexport type SheetToolbarProps = ThemedClassName<PropsWithChildren<{ attendableId?: string }>>;\n\nconst createToolbarActions = (\n model: SheetModel,\n state: ToolbarState,\n onComment: (cellContent: string, cursor: string) => void,\n cursorFallbackRange?: CompleteCellRange,\n) => {\n const align = createAlign(model, state, cursorFallbackRange);\n const style = createStyle(model, state, cursorFallbackRange);\n const gap = createGapSeparator();\n const comment = createComment(model, state, onComment, cursorFallbackRange);\n return {\n nodes: [...align.nodes, ...style.nodes, ...gap.nodes, ...comment.nodes],\n edges: [...align.edges, ...style.edges, ...gap.edges, ...comment.edges],\n };\n};\n\nexport const SheetToolbar = ({ attendableId, classNames }: SheetToolbarProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const { model, cursorFallbackRange } = useSheetContext();\n const state = useToolbarState({});\n useAlignState(state);\n useStyleState(state);\n useCommentState(state);\n\n const handleComment = useCallback(\n (name: string, cursor: string) =>\n dispatch(\n createIntent(ThreadAction.Create, {\n cursor,\n name,\n subject: model.sheet,\n }),\n ),\n [model.sheet, dispatch],\n );\n\n const actionsCreator = useCallback(\n () => createToolbarActions(model, state, handleComment, cursorFallbackRange),\n [model, state, handleComment, cursorFallbackRange],\n );\n const menu = useMenuActions(actionsCreator);\n\n return (\n <MenuProvider {...menu} attendableId={attendableId}>\n <ToolbarMenu classNames={classNames} />\n </MenuProvider>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect } from 'react';\n\nimport { type CompleteCellRange, inRange } from '@dxos/compute';\nimport { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';\n\nimport { type ToolbarState } from './useToolbarState';\nimport { SHEET_PLUGIN } from '../../meta';\nimport { type SheetModel } from '../../model';\nimport { type AlignKey, alignKey, type AlignValue, rangeFromIndex, rangeToIndex } from '../../types';\nimport { useSheetContext } from '../SheetContext';\n\nexport type AlignAction = { key: AlignKey; value: AlignValue };\n\nexport type AlignState = { [alignKey]: AlignValue | undefined };\n\nconst aligns: Record<AlignValue, string> = {\n start: 'ph--text-align-left--regular',\n center: 'ph--text-align-center--regular',\n end: 'ph--text-align-right--regular',\n};\n\nexport const useAlignState = (state: Partial<AlignState>) => {\n const { cursor, model } = useSheetContext();\n useEffect(() => {\n // TODO(thure): Can this O(n) call be memoized?\n state[alignKey] = (\n cursor\n ? model.sheet.ranges?.findLast(\n ({ range, key }) => key === alignKey && inRange(rangeFromIndex(model.sheet, range), cursor),\n )?.value\n : undefined\n ) as AlignValue | undefined;\n }, [cursor, model.sheet]);\n};\n\nconst createAlignGroupAction = (value?: AlignValue) =>\n createMenuItemGroup('align', {\n label: ['align label', { ns: SHEET_PLUGIN }],\n variant: 'toggleGroup',\n selectCardinality: 'single',\n value: `${alignKey}--${value}`,\n } as ToolbarMenuActionGroupProperties);\n\nconst createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallbackRange?: CompleteCellRange) =>\n Object.entries(aligns).map(([alignValue, icon]) => {\n return createMenuAction<AlignAction>(\n `${alignKey}--${alignValue}`,\n () => {\n if (!cursorFallbackRange) {\n return;\n }\n const index =\n model.sheet.ranges?.findIndex(\n (range) =>\n range.key === alignKey && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),\n ) ?? -1;\n const nextRangeEntity = {\n range: rangeToIndex(model.sheet, cursorFallbackRange),\n key: alignKey,\n value: alignValue as AlignValue,\n };\n if (index < 0) {\n model.sheet.ranges?.push(nextRangeEntity);\n state[alignKey] = nextRangeEntity.value;\n } else if (model.sheet.ranges![index].value === nextRangeEntity.value) {\n model.sheet.ranges?.splice(index, 1);\n state[alignKey] = undefined;\n } else {\n model.sheet.ranges?.splice(index, 1, nextRangeEntity);\n state[alignKey] = nextRangeEntity.value;\n }\n },\n {\n key: alignKey,\n value: alignValue as AlignValue,\n checked: state[alignKey] === alignValue,\n label: [`range value ${alignValue} label`, { ns: SHEET_PLUGIN }],\n icon,\n testId: `grid.toolbar.${alignKey}.${alignValue}`,\n },\n );\n });\n\nexport const createAlign = (model: SheetModel, state: ToolbarState, cursorFallbackRange?: CompleteCellRange) => {\n const alignGroup = createAlignGroupAction(state[alignKey]);\n const alignActions = createAlignActions(model, state, cursorFallbackRange);\n return {\n nodes: [alignGroup, ...alignActions],\n edges: [\n { source: 'root', target: 'align' },\n ...alignActions.map(({ id }) => ({ source: alignGroup.id, target: id })),\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport { type CompleteCellRange } from '@dxos/compute';\nimport { RefArray } from '@dxos/live-object';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { completeCellRangeToThreadCursor } from '../../integrations/thread-ranges';\nimport { SHEET_PLUGIN } from '../../meta';\nimport { type SheetModel } from '../../model';\nimport { commentKey, type CommentKey, type CommentValue, rangeToIndex } from '../../types';\nimport { useSheetContext } from '../SheetContext';\n\nexport type CommentAction = { key: CommentKey; value: CommentValue; cellContent?: string };\n\nexport type CommentState = { commentEnabled: 'comment' | 'no cursor' | 'selection overlaps existing comment' };\n\nexport const useCommentState = (state: Partial<CommentState>) => {\n const { cursorFallbackRange, model } = useSheetContext();\n\n // TODO(thure): Can this O(n) call be memoized?\n const overlapsCommentAnchor = useMemo(\n () =>\n RefArray.targets(model.sheet.threads ?? [])\n .filter((thread) => thread.status !== 'resolved')\n .some((thread) => {\n if (!cursorFallbackRange) {\n return false;\n }\n return rangeToIndex(model.sheet, cursorFallbackRange) === thread.anchor;\n }),\n [cursorFallbackRange, model.sheet],\n );\n\n useEffect(() => {\n state.commentEnabled = !cursorFallbackRange\n ? 'no cursor'\n : overlapsCommentAnchor\n ? 'selection overlaps existing comment'\n : 'comment';\n }, [overlapsCommentAnchor, cursorFallbackRange]);\n};\n\nconst createCommentAction = (\n model: SheetModel,\n state: Partial<CommentState>,\n onComment: (cellContent: string, cursor: string) => void,\n cursorFallbackRange?: CompleteCellRange,\n) =>\n createMenuAction<Pick<CommentAction, 'key'>>(\n 'comment',\n () => {\n if (!cursorFallbackRange) {\n return;\n }\n\n const cellContent = model.getCellText(cursorFallbackRange.from);\n if (!cellContent) {\n return;\n }\n\n onComment(cellContent, completeCellRangeToThreadCursor(cursorFallbackRange));\n },\n {\n key: commentKey,\n testId: 'editor.toolbar.comment',\n icon: 'ph--chat-text--regular',\n label: [`${state.commentEnabled} label`, { ns: SHEET_PLUGIN }],\n disabled: state.commentEnabled !== 'comment',\n },\n );\n\nexport const createComment = (\n model: SheetModel,\n state: Partial<CommentState>,\n onComment: (cellContent: string, cursor: string) => void,\n cursorFallbackRange?: CompleteCellRange,\n) => ({\n nodes: [createCommentAction(model, state, onComment, cursorFallbackRange)],\n edges: [{ source: 'root', target: 'comment' }],\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect } from 'react';\n\nimport { type CompleteCellRange, inRange } from '@dxos/compute';\nimport { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';\n\nimport { SHEET_PLUGIN } from '../../meta';\nimport { type SheetModel } from '../../model';\nimport { rangeFromIndex, rangeToIndex, type StyleKey, type StyleValue } from '../../types';\nimport { useSheetContext } from '../SheetContext';\n\nexport type StyleState = Partial<Record<StyleValue, boolean>>;\n\nexport type StyleAction = { key: StyleKey; value: StyleValue };\n\nconst styles: Record<StyleValue, string> = {\n highlight: 'ph--highlighter--regular',\n softwrap: 'ph--paragraph--regular',\n};\n\nexport const useStyleState = (state: StyleState) => {\n const { cursorFallbackRange, model } = useSheetContext();\n\n useEffect(() => {\n state.highlight = false;\n state.softwrap = false;\n if (cursorFallbackRange && model.sheet.ranges) {\n model.sheet.ranges\n .filter(\n ({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),\n )\n .forEach(({ value }) => {\n state[value as StyleValue] = true;\n });\n }\n }, [cursorFallbackRange, model.sheet]);\n};\n\nconst createStyleGroup = (state: StyleState) => {\n return createMenuItemGroup('style', {\n variant: 'toggleGroup',\n selectCardinality: 'multiple',\n value: Object.keys(styles)\n .filter((key) => !!state[key as StyleValue])\n .map((styleValue) => `style--${styleValue}`),\n } as ToolbarMenuActionGroupProperties);\n};\n\nconst createStyleActions = (model: SheetModel, state: StyleState, cursorFallbackRange?: CompleteCellRange) =>\n Object.entries(styles).map(([styleValue, icon]) => {\n return createMenuAction<StyleAction>(\n `style--${styleValue}`,\n () => {\n if (!cursorFallbackRange) {\n return;\n }\n const index =\n model.sheet.ranges?.findIndex(\n (range) =>\n range.key === 'style' && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),\n ) ?? -1;\n const nextRangeEntity = {\n range: rangeToIndex(model.sheet, cursorFallbackRange),\n key: 'style',\n value: styleValue as StyleValue,\n };\n if (\n model.sheet.ranges\n .filter(\n ({ range, key: rangeKey }) =>\n rangeKey === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),\n )\n .some(({ value: rangeValue }) => rangeValue === styleValue)\n ) {\n // this value should be unset\n if (index >= 0) {\n model.sheet.ranges?.splice(index, 1);\n }\n state[nextRangeEntity.value] = false;\n } else {\n model.sheet.ranges?.push(nextRangeEntity);\n state[nextRangeEntity.value] = true;\n }\n },\n {\n key: 'style',\n value: styleValue as StyleValue,\n icon,\n label: [`range value ${styleValue} label`, { ns: SHEET_PLUGIN }],\n checked: !!state[styleValue as StyleValue],\n },\n );\n });\n\nexport const createStyle = (model: SheetModel, state: StyleState, cursorFallbackRange?: CompleteCellRange) => {\n const styleGroupAction = createStyleGroup(state);\n const styleActions = createStyleActions(model, state, cursorFallbackRange);\n return {\n nodes: [styleGroupAction, ...styleActions],\n edges: [\n { source: 'root', target: 'style' },\n ...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id })),\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { live } from '@dxos/live-object';\n\nimport { type AlignState } from './align';\nimport { type CommentState } from './comment';\nimport { type StyleState } from './style';\n\nexport type ToolbarState = Partial<StyleState & AlignState & CommentState>;\n\nexport const useToolbarState = (initialState: ToolbarState = {}) => {\n return useMemo(() => live<ToolbarState>(initialState), []);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { SheetContainer } from './SheetContainer';\n\nexport default SheetContainer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,kBAA6C;AAC7C,4BAA0B;ACH1B,IAAAA,gBAAkB;AAElB,qBAAkE;AAClE,sBAAqB;ACHrB,IAAAA,gBAA2D;AAE3D,2BAAkD;AAElD,mBAA6B;AAE7B,2BAA8E;ACN9E,IAAAA,gBAA0B;AAE1B,IAAAC,kBAAgD;AAChD,IAAAC,wBAA6F;ACH7F,IAAAF,gBAAmC;AAGnC,yBAAyB;AACzB,IAAAE,wBAAiC;ACJjC,IAAAF,gBAA0B;AAE1B,IAAAC,kBAAgD;AAChD,IAAAC,wBAA6F;ACH7F,IAAAF,gBAAwB;AAExB,IAAAG,sBAAqB;ALMd,IAAMC,iBAAiB,MAAA;AAC5B,QAAM,EAAEC,OAAOC,QAAQC,MAAK,QAAKC,uCAAAA;AAEjC,MAAIC;AACJ,MAAIC,UAAU;AACd,MAAIJ,QAAQ;AACVG,YAAQJ,MAAMM,aAAaL,MAAAA;AAC3B,YAAIM,0BAAUH,KAAAA,GAAQ;AACpBA,cAAQJ,MAAMQ,MAAMC,6BAAyBC,+CAAwBV,MAAMW,OAAOP,KAAAA,CAAAA;AAClFC,gBAAU;IACZ,WAAW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ACtBlG,8BAAAA,QAAA,cAACiH,kCAAAA;IAAY1G;;AAGnB;AFxDO,IAAM2G,iBAAiB,CAAC,EAC7BC,OACArH,OACAsH,MACAC,gBAAe,MAMhB;AACC,QAAM1H,YAAQ2H,uCAAgBH,KAAAA;AAE9B,SAAOxH,QACLK,6BAAAA,QAAA,cAACuH,qCAAAA;IAAczH;IAAcH;IAAc0H;KACzCrH,6BAAAA,QAAA,cAACwH,gCAAUC,SAAO;IAACC,SAAAA;IAAQC,WAAAA;IAAW,GAAIP,SAAS,aAAa;MAAE7G,YAAY;IAAe;KAC3FP,6BAAAA,QAAA,cAACiG,cAAAA;IAAaC,kBAAc0B,8BAAiB9H,KAAAA;MAC7CE,6BAAAA,QAAA,cAAC6H,iCAAAA,IAAAA,GACD7H,6BAAAA,QAAA,cAACd,gBAAAA,IAAAA,CAAAA,CAAAA,IAGH;AACN;AOhCA,IAAA,yBAAegI;",
|
|
6
|
+
"names": ["import_react", "import_compute", "import_react_ui_menu", "import_live_object", "FunctionEditor", "model", "cursor", "range", "useSheetContext", "value", "formula", "getCellValue", "isFormula", "graph", "mapFunctionBindingFromId", "mapFormulaIndicesToRefs", "sheet", "String", "React", "div", "className", "rangeToA1Notation", "addressToA1Notation", "Icon", "icon", "classNames", "span", "aligns", "start", "center", "end", "useAlignState", "state", "useEffect", "alignKey", "ranges", "findLast", "key", "inRange", "rangeFromIndex", "undefined", "createAlignGroupAction", "createMenuItemGroup", "label", "ns", "SHEET_PLUGIN", "variant", "selectCardinality", "createAlignActions", "cursorFallbackRange", "Object", "entries", "map", "alignValue", "createMenuAction", "index", "findIndex", "from", "nextRangeEntity", "rangeToIndex", "push", "splice", "checked", "testId", "createAlign", "alignGroup", "alignActions", "nodes", "edges", "source", "target", "id", "useCommentState", "overlapsCommentAnchor", "useMemo", "RefArray", "targets", "threads", "filter", "thread", "status", "some", "anchor", "commentEnabled", "createCommentAction", "onComment", "cellContent", "getCellText", "completeCellRangeToThreadCursor", "commentKey", "disabled", "createComment", "styles", "highlight", "softwrap", "useStyleState", "forEach", "createStyleGroup", "keys", "styleValue", "createStyleActions", "rangeKey", "rangeValue", "createStyle", "styleGroupAction", "styleActions", "useToolbarState", "initialState", "live", "createToolbarActions", "align", "style", "gap", "createGapSeparator", "comment", "SheetToolbar", "attendableId", "dispatchPromise", "dispatch", "useIntentDispatcher", "handleComment", "useCallback", "name", "createIntent", "ThreadAction", "Create", "subject", "actionsCreator", "menu", "useMenuActions", "MenuProvider", "ToolbarMenu", "SheetContainer", "space", "role", "ignoreAttention", "useComputeGraph", "SheetProvider", "StackItem", "Content", "toolbar", "statusbar", "fullyQualifiedId", "GridSheet"]
|
|
7
|
+
}
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_3QKD6C7X_exports = {};
|
|
30
|
+
__export(chunk_3QKD6C7X_exports, {
|
|
31
31
|
ComputeGraphContextProvider: () => ComputeGraphContextProvider,
|
|
32
32
|
GridSheet: () => GridSheet,
|
|
33
33
|
RangeList: () => RangeList,
|
|
@@ -37,16 +37,16 @@ __export(chunk_UXSU6W7E_exports, {
|
|
|
37
37
|
useComputeGraph: () => useComputeGraph,
|
|
38
38
|
useSheetContext: () => useSheetContext
|
|
39
39
|
});
|
|
40
|
-
module.exports = __toCommonJS(
|
|
40
|
+
module.exports = __toCommonJS(chunk_3QKD6C7X_exports);
|
|
41
41
|
var import_chunk_LEV7OSTK = require("./chunk-LEV7OSTK.cjs");
|
|
42
|
-
var
|
|
42
|
+
var import_chunk_HLSQVT3C = require("./chunk-HLSQVT3C.cjs");
|
|
43
43
|
var import_chunk_JSIDCZHB = require("./chunk-JSIDCZHB.cjs");
|
|
44
44
|
var import_react = __toESM(require("react"));
|
|
45
45
|
var import_debug = require("@dxos/debug");
|
|
46
46
|
var import_react_hooks = require("@dxos/react-hooks");
|
|
47
|
+
var import_effect = require("effect");
|
|
47
48
|
var import_react2 = __toESM(require("react"));
|
|
48
49
|
var import_compute = require("@dxos/compute");
|
|
49
|
-
var import_echo_schema = require("@dxos/echo-schema");
|
|
50
50
|
var import_react_ui = require("@dxos/react-ui");
|
|
51
51
|
var import_react_ui_list = require("@dxos/react-ui-list");
|
|
52
52
|
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
@@ -63,12 +63,11 @@ var import_echo = require("@dxos/react-client/echo");
|
|
|
63
63
|
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
64
64
|
var import_react_ui_grid2 = require("@dxos/react-ui-grid");
|
|
65
65
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
66
|
-
var
|
|
66
|
+
var import_effect2 = require("effect");
|
|
67
67
|
var import_react6 = require("react");
|
|
68
68
|
var import_app_framework2 = require("@dxos/app-framework");
|
|
69
69
|
var import_async = require("@dxos/async");
|
|
70
70
|
var import_compute4 = require("@dxos/compute");
|
|
71
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
72
71
|
var import_types = require("@dxos/plugin-deck/types");
|
|
73
72
|
var import_types2 = require("@dxos/plugin-thread/types");
|
|
74
73
|
var import_echo2 = require("@dxos/react-client/echo");
|
|
@@ -112,7 +111,7 @@ var RangeList = ({ sheet }) => {
|
|
|
112
111
|
className: "p-2 text-sm font-semibold"
|
|
113
112
|
}, t("range list heading")), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_list.List.Root, {
|
|
114
113
|
items: sheet.ranges,
|
|
115
|
-
isItem:
|
|
114
|
+
isItem: import_effect.Schema.is(import_chunk_HLSQVT3C.Range)
|
|
116
115
|
}, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ import_react2.default.createElement(import_react_ui_list.List.Item, {
|
|
117
116
|
key: i,
|
|
118
117
|
item: range,
|
|
@@ -123,7 +122,7 @@ var RangeList = ({ sheet }) => {
|
|
|
123
122
|
}, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_list.List.ItemDragHandle, null), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_list.List.ItemTitle, {
|
|
124
123
|
onClick: () => handleSelectRange(range)
|
|
125
124
|
}, t("range title", {
|
|
126
|
-
position: (0, import_compute.rangeToA1Notation)((0,
|
|
125
|
+
position: (0, import_compute.rangeToA1Notation)((0, import_chunk_HLSQVT3C.rangeFromIndex)(sheet, range.range)),
|
|
127
126
|
key: t(`range key ${range.key} label`),
|
|
128
127
|
value: t(`range value ${range.value} label`)
|
|
129
128
|
})), /* @__PURE__ */ import_react2.default.createElement(import_react_ui_list.List.ItemDeleteButton, {
|
|
@@ -157,7 +156,7 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
|
|
|
157
156
|
intent: import_app_framework2.LayoutAction.ScrollIntoView,
|
|
158
157
|
position: "hoist",
|
|
159
158
|
filter: (data) => {
|
|
160
|
-
if (!
|
|
159
|
+
if (!import_effect2.Schema.is(import_app_framework2.LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
161
160
|
return false;
|
|
162
161
|
}
|
|
163
162
|
return data.subject === (0, import_echo2.fullyQualifiedId)(model.sheet) && !!data.options?.cursor;
|
|
@@ -197,7 +196,7 @@ var useSelectThreadOnCellFocus = () => {
|
|
|
197
196
|
});
|
|
198
197
|
if (closestThread) {
|
|
199
198
|
const primary = (0, import_echo2.fullyQualifiedId)(model.sheet);
|
|
200
|
-
const intent = (0,
|
|
199
|
+
const intent = (0, import_effect2.pipe)((0, import_app_framework2.createIntent)(import_types2.ThreadAction.Select, {
|
|
201
200
|
current: (0, import_echo2.fullyQualifiedId)(closestThread)
|
|
202
201
|
}), (0, import_app_framework2.chain)(import_types.DeckAction.ChangeCompanion, {
|
|
203
202
|
primary,
|
|
@@ -256,7 +255,7 @@ var projectCellProps = (model, col, row) => {
|
|
|
256
255
|
row
|
|
257
256
|
};
|
|
258
257
|
const rawValue = model.getValue(address);
|
|
259
|
-
const ranges = model.sheet.ranges?.filter(({ range }) => (0, import_compute3.inRange)((0,
|
|
258
|
+
const ranges = model.sheet.ranges?.filter(({ range }) => (0, import_compute3.inRange)((0, import_chunk_HLSQVT3C.rangeFromIndex)(model.sheet, range), address));
|
|
260
259
|
const threadRefs = model.sheet.threads?.filter((thread) => {
|
|
261
260
|
const range = thread.target?.anchor && parseThreadAnchorAsCellRange(thread.target.anchor);
|
|
262
261
|
return thread && range ? (0, import_compute3.inRange)(range, address) : false;
|
|
@@ -264,7 +263,7 @@ var projectCellProps = (model, col, row) => {
|
|
|
264
263
|
const description = model.getValueDescription(address);
|
|
265
264
|
const type = description?.type;
|
|
266
265
|
const format = description?.format;
|
|
267
|
-
const classNames = ranges?.map(
|
|
266
|
+
const classNames = ranges?.map(import_chunk_HLSQVT3C.cellClassNameForRange).reverse();
|
|
268
267
|
return {
|
|
269
268
|
value: (0, import_react_ui_form.parseValue)({
|
|
270
269
|
type,
|
|
@@ -442,7 +441,7 @@ var SheetProviderImpl = ({ model, onInfo, ignoreAttention, children, __gridScope
|
|
|
442
441
|
}, children);
|
|
443
442
|
};
|
|
444
443
|
var SheetProvider = ({ children, graph, sheet, readonly, ignoreAttention, onInfo }) => {
|
|
445
|
-
const model = (0,
|
|
444
|
+
const model = (0, import_chunk_HLSQVT3C.useSheetModel)(graph, sheet, {
|
|
446
445
|
readonly
|
|
447
446
|
});
|
|
448
447
|
return !model ? null : /* @__PURE__ */ import_react7.default.createElement(import_react_ui_grid3.Grid.Root, {
|
|
@@ -701,13 +700,13 @@ var GridSheet = () => {
|
|
|
701
700
|
switch (operation) {
|
|
702
701
|
case "insert-before":
|
|
703
702
|
case "insert-after":
|
|
704
|
-
return dispatch((0, import_app_framework.createIntent)(
|
|
703
|
+
return dispatch((0, import_app_framework.createIntent)(import_chunk_HLSQVT3C.SheetAction.InsertAxis, {
|
|
705
704
|
model,
|
|
706
705
|
axis: contextMenuAxis,
|
|
707
706
|
index: contextMenuOpen[contextMenuAxis] + (operation === "insert-before" ? 0 : 1)
|
|
708
707
|
}));
|
|
709
708
|
case "drop":
|
|
710
|
-
return dispatch((0, import_app_framework.createIntent)(
|
|
709
|
+
return dispatch((0, import_app_framework.createIntent)(import_chunk_HLSQVT3C.SheetAction.DropAxis, {
|
|
711
710
|
model,
|
|
712
711
|
axis: contextMenuAxis,
|
|
713
712
|
axisIndex: model.sheet[contextMenuAxis === "row" ? "rows" : "columns"][contextMenuOpen[contextMenuAxis]]
|
|
@@ -759,8 +758,8 @@ var GridSheet = () => {
|
|
|
759
758
|
onBlur: handleBlur
|
|
760
759
|
}), /* @__PURE__ */ import_react4.default.createElement(import_react_ui_grid.Grid.Content, {
|
|
761
760
|
initialCells,
|
|
762
|
-
limitColumns:
|
|
763
|
-
limitRows:
|
|
761
|
+
limitColumns: import_chunk_HLSQVT3C.DEFAULT_COLS,
|
|
762
|
+
limitRows: import_chunk_HLSQVT3C.DEFAULT_ROWS,
|
|
764
763
|
columns,
|
|
765
764
|
rows,
|
|
766
765
|
onAxisResize: handleAxisResize,
|
|
@@ -807,7 +806,7 @@ var GridSheet = () => {
|
|
|
807
806
|
icon: "ph--backspace--regular"
|
|
808
807
|
}), /* @__PURE__ */ import_react4.default.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.DropdownMenu.Arrow, null))));
|
|
809
808
|
};
|
|
810
|
-
var SheetContainer = (0, import_react3.lazy)(() => import("./SheetContainer-
|
|
809
|
+
var SheetContainer = (0, import_react3.lazy)(() => import("./SheetContainer-2CFOIYBF.cjs"));
|
|
811
810
|
// Annotate the CommonJS export names for ESM import in node:
|
|
812
811
|
0 && (module.exports = {
|
|
813
812
|
ComputeGraphContextProvider,
|
|
@@ -819,4 +818,4 @@ var SheetContainer = (0, import_react3.lazy)(() => import("./SheetContainer-6RPY
|
|
|
819
818
|
useComputeGraph,
|
|
820
819
|
useSheetContext
|
|
821
820
|
});
|
|
822
|
-
//# sourceMappingURL=chunk-
|
|
821
|
+
//# sourceMappingURL=chunk-3QKD6C7X.cjs.map
|