@dxos/plugin-sheet 0.8.2-main.5ca3450 → 0.8.2-main.600d381

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.
Files changed (46) hide show
  1. package/dist/lib/browser/{SheetContainer-N74FX62K.mjs → SheetContainer-O4WVY7Y4.mjs} +86 -84
  2. package/dist/lib/browser/SheetContainer-O4WVY7Y4.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-SY25UNYZ.mjs → chunk-RSBJNX7L.mjs} +2 -2
  4. package/dist/lib/browser/index.mjs +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/{react-surface-XUJZGNUH.mjs → react-surface-JNDDTM6K.mjs} +2 -2
  7. package/dist/lib/node/{SheetContainer-MERCQUPB.cjs → SheetContainer-2CFOIYBF.cjs} +96 -92
  8. package/dist/lib/node/SheetContainer-2CFOIYBF.cjs.map +7 -0
  9. package/dist/lib/node/{chunk-62JKBCGO.cjs → chunk-3QKD6C7X.cjs} +5 -5
  10. package/dist/lib/node/index.cjs +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/{react-surface-GSS7VQ2D.cjs → react-surface-ZTKJM4TA.cjs} +8 -8
  13. package/dist/lib/node-esm/{SheetContainer-XFQTSA3I.mjs → SheetContainer-W3DQ7UFO.mjs} +86 -84
  14. package/dist/lib/node-esm/SheetContainer-W3DQ7UFO.mjs.map +7 -0
  15. package/dist/lib/node-esm/{chunk-RRIPYVEN.mjs → chunk-A5PYXQL6.mjs} +2 -2
  16. package/dist/lib/node-esm/index.mjs +1 -1
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/{react-surface-XUFWQE5B.mjs → react-surface-M6VLLWMY.mjs} +2 -2
  19. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  21. package/dist/types/src/components/SheetToolbar/align.d.ts +4 -1
  22. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  23. package/dist/types/src/components/SheetToolbar/comment.d.ts +3 -1
  24. package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -1
  25. package/dist/types/src/components/SheetToolbar/style.d.ts +3 -1
  26. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  27. package/package.json +45 -45
  28. package/src/components/GridSheet/GridSheet.stories.tsx +1 -1
  29. package/src/components/SheetContainer/SheetContainer.stories.tsx +1 -5
  30. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +1 -1
  31. package/src/components/SheetToolbar/SheetToolbar.tsx +33 -8
  32. package/src/components/SheetToolbar/align.ts +44 -14
  33. package/src/components/SheetToolbar/comment.ts +39 -11
  34. package/src/components/SheetToolbar/style.ts +48 -12
  35. package/dist/lib/browser/SheetContainer-N74FX62K.mjs.map +0 -7
  36. package/dist/lib/node/SheetContainer-MERCQUPB.cjs.map +0 -7
  37. package/dist/lib/node-esm/SheetContainer-XFQTSA3I.mjs.map +0 -7
  38. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +0 -8
  39. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +0 -1
  40. package/src/components/SheetToolbar/useToolbarAction.ts +0 -87
  41. /package/dist/lib/browser/{chunk-SY25UNYZ.mjs.map → chunk-RSBJNX7L.mjs.map} +0 -0
  42. /package/dist/lib/browser/{react-surface-XUJZGNUH.mjs.map → react-surface-JNDDTM6K.mjs.map} +0 -0
  43. /package/dist/lib/node/{chunk-62JKBCGO.cjs.map → chunk-3QKD6C7X.cjs.map} +0 -0
  44. /package/dist/lib/node/{react-surface-GSS7VQ2D.cjs.map → react-surface-ZTKJM4TA.cjs.map} +0 -0
  45. /package/dist/lib/node-esm/{chunk-RRIPYVEN.mjs.map → chunk-A5PYXQL6.mjs.map} +0 -0
  46. /package/dist/lib/node-esm/{react-surface-XUFWQE5B.mjs.map → react-surface-M6VLLWMY.mjs.map} +0 -0
@@ -26,12 +26,12 @@ 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 SheetContainer_MERCQUPB_exports = {};
30
- __export(SheetContainer_MERCQUPB_exports, {
29
+ var SheetContainer_2CFOIYBF_exports = {};
30
+ __export(SheetContainer_2CFOIYBF_exports, {
31
31
  default: () => SheetContainer_default
32
32
  });
33
- module.exports = __toCommonJS(SheetContainer_MERCQUPB_exports);
34
- var import_chunk_62JKBCGO = require("./chunk-62JKBCGO.cjs");
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
36
  var import_chunk_HLSQVT3C = require("./chunk-HLSQVT3C.cjs");
37
37
  var import_chunk_JSIDCZHB = require("./chunk-JSIDCZHB.cjs");
@@ -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,13 +55,9 @@ 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, import_chunk_62JKBCGO.useSheetContext)();
60
+ const { model, cursor, range } = (0, import_chunk_3QKD6C7X.useSheetContext)();
63
61
  let value;
64
62
  let formula = false;
65
63
  if (cursor) {
@@ -95,7 +93,7 @@ var aligns = {
95
93
  end: "ph--text-align-right--regular"
96
94
  };
97
95
  var useAlignState = (state) => {
98
- const { cursor, model } = (0, import_chunk_62JKBCGO.useSheetContext)();
96
+ const { cursor, model } = (0, import_chunk_3QKD6C7X.useSheetContext)();
99
97
  (0, import_react4.useEffect)(() => {
100
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
  }, [
@@ -114,11 +112,31 @@ var createAlignGroupAction = (value) => (0, import_react_ui_menu2.createMenuItem
114
112
  selectCardinality: "single",
115
113
  value: `${import_chunk_HLSQVT3C.alignKey}--${value}`
116
114
  });
117
- var createAlignActions = (value) => Object.entries(aligns).map(([alignValue, icon]) => {
118
- return (0, import_react_ui_menu2.createMenuAction)(`${import_chunk_HLSQVT3C.alignKey}--${alignValue}`, {
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
+ }, {
119
137
  key: import_chunk_HLSQVT3C.alignKey,
120
138
  value: alignValue,
121
- checked: value === alignValue,
139
+ checked: state[import_chunk_HLSQVT3C.alignKey] === alignValue,
122
140
  label: [
123
141
  `range value ${alignValue} label`,
124
142
  {
@@ -129,9 +147,9 @@ var createAlignActions = (value) => Object.entries(aligns).map(([alignValue, ico
129
147
  testId: `grid.toolbar.${import_chunk_HLSQVT3C.alignKey}.${alignValue}`
130
148
  });
131
149
  });
132
- var createAlign = ({ [import_chunk_HLSQVT3C.alignKey]: alignValue }) => {
133
- const alignGroup = createAlignGroupAction(alignValue);
134
- const alignActions = createAlignActions(alignValue);
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,7 +168,7 @@ var createAlign = ({ [import_chunk_HLSQVT3C.alignKey]: alignValue }) => {
150
168
  };
151
169
  };
152
170
  var useCommentState = (state) => {
153
- const { cursorFallbackRange, model } = (0, import_chunk_62JKBCGO.useSheetContext)();
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;
@@ -167,7 +185,16 @@ var useCommentState = (state) => {
167
185
  cursorFallbackRange
168
186
  ]);
169
187
  };
170
- var createCommentAction = (state) => (0, import_react_ui_menu3.createMenuAction)("comment", {
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
+ }, {
171
198
  key: import_chunk_HLSQVT3C.commentKey,
172
199
  testId: "editor.toolbar.comment",
173
200
  icon: "ph--chat-text--regular",
@@ -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,7 +222,7 @@ var styles = {
195
222
  softwrap: "ph--paragraph--regular"
196
223
  };
197
224
  var useStyleState = (state) => {
198
- const { cursorFallbackRange, model } = (0, import_chunk_62JKBCGO.useSheetContext)();
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;
@@ -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_62JKBCGO.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_HLSQVT3C.rangeFromIndex)(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
260
- const nextRangeEntity = {
261
- range: (0, import_chunk_HLSQVT3C.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_HLSQVT3C.alignKey] = value;
270
- } else if (model.sheet.ranges[index].value === value) {
271
- model.sheet.ranges?.splice(index, 1);
272
- state[import_chunk_HLSQVT3C.alignKey] = void 0;
273
- } else {
274
- model.sheet.ranges?.splice(index, 1, nextRangeEntity);
275
- state[import_chunk_HLSQVT3C.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_HLSQVT3C.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_62JKBCGO.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, import_react8.useMemo)(() => (0, import_live_object2.live)(initialState), []);
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 actionsCreator = (0, import_react3.useCallback)(() => createToolbarActions(state), [
335
- state
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, import_chunk_62JKBCGO.useComputeGraph)(space);
349
- return graph ? /* @__PURE__ */ import_react.default.createElement(import_chunk_62JKBCGO.SheetProvider, {
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(import_chunk_62JKBCGO.GridSheet, null), /* @__PURE__ */ import_react.default.createElement(FunctionEditor, null))) : null;
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-MERCQUPB.cjs.map
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,WAAWD,SAAS,MAAM;AACxBA,cAAQQ,OAAOR,KAAAA;IACjB;EACF;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FxDO,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 chunk_62JKBCGO_exports = {};
30
- __export(chunk_62JKBCGO_exports, {
29
+ var chunk_3QKD6C7X_exports = {};
30
+ __export(chunk_3QKD6C7X_exports, {
31
31
  ComputeGraphContextProvider: () => ComputeGraphContextProvider,
32
32
  GridSheet: () => GridSheet,
33
33
  RangeList: () => RangeList,
@@ -37,7 +37,7 @@ __export(chunk_62JKBCGO_exports, {
37
37
  useComputeGraph: () => useComputeGraph,
38
38
  useSheetContext: () => useSheetContext
39
39
  });
40
- module.exports = __toCommonJS(chunk_62JKBCGO_exports);
40
+ module.exports = __toCommonJS(chunk_3QKD6C7X_exports);
41
41
  var import_chunk_LEV7OSTK = require("./chunk-LEV7OSTK.cjs");
42
42
  var import_chunk_HLSQVT3C = require("./chunk-HLSQVT3C.cjs");
43
43
  var import_chunk_JSIDCZHB = require("./chunk-JSIDCZHB.cjs");
@@ -806,7 +806,7 @@ var GridSheet = () => {
806
806
  icon: "ph--backspace--regular"
807
807
  }), /* @__PURE__ */ import_react4.default.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.DropdownMenu.Arrow, null))));
808
808
  };
809
- var SheetContainer = (0, import_react3.lazy)(() => import("./SheetContainer-MERCQUPB.cjs"));
809
+ var SheetContainer = (0, import_react3.lazy)(() => import("./SheetContainer-2CFOIYBF.cjs"));
810
810
  // Annotate the CommonJS export names for ESM import in node:
811
811
  0 && (module.exports = {
812
812
  ComputeGraphContextProvider,
@@ -818,4 +818,4 @@ var SheetContainer = (0, import_react3.lazy)(() => import("./SheetContainer-MERC
818
818
  useComputeGraph,
819
819
  useSheetContext
820
820
  });
821
- //# sourceMappingURL=chunk-62JKBCGO.cjs.map
821
+ //# sourceMappingURL=chunk-3QKD6C7X.cjs.map
@@ -47,7 +47,7 @@ var import_echo = require("@dxos/react-client/echo");
47
47
  var ComputeGraphRegistry = (0, import_app_framework.lazy)(() => import("./compute-graph-registry-VVSRJUGS.cjs"));
48
48
  var IntentResolver = (0, import_app_framework.lazy)(() => import("./intent-resolver-OPF56TAL.cjs"));
49
49
  var Markdown = (0, import_app_framework.lazy)(() => import("./markdown-E7OUIMZO.cjs"));
50
- var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-GSS7VQ2D.cjs"));
50
+ var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-ZTKJM4TA.cjs"));
51
51
  var Thread = (0, import_app_framework.lazy)(() => import("./thread-E7YPGR5T.cjs"));
52
52
  var serializer = {
53
53
  serialize: async ({ object }) => {