@dxos/plugin-sheet 0.8.2-main.f081794 → 0.8.2-main.fbd8ed0

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 (139) hide show
  1. package/dist/lib/browser/{SheetContainer-7DK3ZZUT.mjs → SheetContainer-UV7RMPXS.mjs} +88 -86
  2. package/dist/lib/browser/SheetContainer-UV7RMPXS.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-HRTIOTK7.mjs → chunk-N2FOQHUH.mjs} +49 -48
  4. package/dist/lib/browser/chunk-N2FOQHUH.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-IE42HBFC.mjs → chunk-TN7LTDHU.mjs} +86 -75
  6. package/dist/lib/browser/chunk-TN7LTDHU.mjs.map +7 -0
  7. package/dist/lib/browser/{compute-graph-registry-WEJLJJ6T.mjs → compute-graph-registry-MBJKPAHX.mjs} +2 -2
  8. package/dist/lib/browser/compute-graph-registry-MBJKPAHX.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +6 -6
  10. package/dist/lib/browser/{intent-resolver-OMXW6BDZ.mjs → intent-resolver-DN7JXDAV.mjs} +2 -2
  11. package/dist/lib/browser/{markdown-DR4RDEEY.mjs → markdown-57MKY5WB.mjs} +2 -2
  12. package/dist/lib/browser/markdown-57MKY5WB.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{react-surface-RTQDRQ4X.mjs → react-surface-NQU63B63.mjs} +3 -3
  15. package/dist/lib/browser/{thread-HV32Z27A.mjs → thread-WU64QL2A.mjs} +2 -2
  16. package/dist/lib/browser/types/index.mjs +1 -1
  17. package/dist/lib/node/{SheetContainer-6RPY4P7E.cjs → SheetContainer-GR2KDOAE.cjs} +106 -102
  18. package/dist/lib/node/SheetContainer-GR2KDOAE.cjs.map +7 -0
  19. package/dist/lib/node/{chunk-UXSU6W7E.cjs → chunk-CN7OBGYV.cjs} +95 -84
  20. package/dist/lib/node/chunk-CN7OBGYV.cjs.map +7 -0
  21. package/dist/lib/node/{chunk-C3Q4GSES.cjs → chunk-HLSQVT3C.cjs} +65 -64
  22. package/dist/lib/node/chunk-HLSQVT3C.cjs.map +7 -0
  23. package/dist/lib/node/{compute-graph-registry-VVSRJUGS.cjs → compute-graph-registry-EBBDN6ZX.cjs} +5 -5
  24. package/dist/lib/node/compute-graph-registry-EBBDN6ZX.cjs.map +7 -0
  25. package/dist/lib/node/index.cjs +12 -12
  26. package/dist/lib/node/{intent-resolver-KI5DG7LR.cjs → intent-resolver-OPF56TAL.cjs} +9 -9
  27. package/dist/lib/node/{markdown-E7OUIMZO.cjs → markdown-Q3RXYPHQ.cjs} +5 -5
  28. package/dist/lib/node/markdown-Q3RXYPHQ.cjs.map +7 -0
  29. package/dist/lib/node/meta.json +1 -1
  30. package/dist/lib/node/{react-surface-ZDOTWZ4Q.cjs → react-surface-7SAA5DX3.cjs} +11 -11
  31. package/dist/lib/node/{thread-NVEWN3H2.cjs → thread-E7YPGR5T.cjs} +7 -7
  32. package/dist/lib/node/types/index.cjs +29 -29
  33. package/dist/lib/node/types/index.cjs.map +1 -1
  34. package/dist/lib/node-esm/{SheetContainer-QQUB22WF.mjs → SheetContainer-XW7B2AJI.mjs} +88 -86
  35. package/dist/lib/node-esm/SheetContainer-XW7B2AJI.mjs.map +7 -0
  36. package/dist/lib/node-esm/{chunk-JSVXC3QP.mjs → chunk-3JJ7ETTJ.mjs} +86 -75
  37. package/dist/lib/node-esm/chunk-3JJ7ETTJ.mjs.map +7 -0
  38. package/dist/lib/node-esm/{chunk-SWRUEW6J.mjs → chunk-LYZV4Q4C.mjs} +49 -48
  39. package/dist/lib/node-esm/chunk-LYZV4Q4C.mjs.map +7 -0
  40. package/dist/lib/node-esm/{compute-graph-registry-PBQ52KH6.mjs → compute-graph-registry-TVG6RN2J.mjs} +2 -2
  41. package/dist/lib/node-esm/compute-graph-registry-TVG6RN2J.mjs.map +7 -0
  42. package/dist/lib/node-esm/index.mjs +6 -6
  43. package/dist/lib/node-esm/{intent-resolver-3FVOBB3K.mjs → intent-resolver-7AN5CN4R.mjs} +2 -2
  44. package/dist/lib/node-esm/{markdown-BPKS2TNG.mjs → markdown-ACHAWUOE.mjs} +2 -2
  45. package/dist/lib/node-esm/markdown-ACHAWUOE.mjs.map +7 -0
  46. package/dist/lib/node-esm/meta.json +1 -1
  47. package/dist/lib/node-esm/{react-surface-T4OVUZY2.mjs → react-surface-BPNN7RSE.mjs} +3 -3
  48. package/dist/lib/node-esm/{thread-DTWGGMW4.mjs → thread-ULESW6IX.mjs} +2 -2
  49. package/dist/lib/node-esm/types/index.mjs +1 -1
  50. package/dist/types/src/capabilities/compute-graph-registry.d.ts +2 -2
  51. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  52. package/dist/types/src/capabilities/index.d.ts +2 -2
  53. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  54. package/dist/types/src/capabilities/markdown.d.ts +2 -2
  55. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  56. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  57. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  58. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  59. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  60. package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
  61. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +3 -2
  62. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
  63. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  64. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
  65. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  66. package/dist/types/src/components/SheetToolbar/align.d.ts +4 -1
  67. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  68. package/dist/types/src/components/SheetToolbar/comment.d.ts +3 -1
  69. package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -1
  70. package/dist/types/src/components/SheetToolbar/style.d.ts +3 -1
  71. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  72. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
  73. package/dist/types/src/components/index.d.ts +1 -6
  74. package/dist/types/src/components/index.d.ts.map +1 -1
  75. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  76. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
  77. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  78. package/dist/types/src/model/testing.d.ts.map +1 -1
  79. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  80. package/dist/types/src/testing/data.d.ts.map +1 -1
  81. package/dist/types/src/testing/testing.d.ts.map +1 -1
  82. package/dist/types/src/translations.d.ts +2 -54
  83. package/dist/types/src/translations.d.ts.map +1 -1
  84. package/dist/types/src/types/schema.d.ts +239 -144
  85. package/dist/types/src/types/schema.d.ts.map +1 -1
  86. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
  87. package/dist/types/src/types/types.d.ts +36 -36
  88. package/dist/types/src/types/types.d.ts.map +1 -1
  89. package/dist/types/src/types/util.d.ts.map +1 -1
  90. package/dist/types/tsconfig.tsbuildinfo +1 -1
  91. package/package.json +53 -47
  92. package/src/capabilities/compute-graph-registry.ts +3 -3
  93. package/src/capabilities/markdown.ts +3 -3
  94. package/src/components/ComputeGraph/compute-graph.stories.tsx +2 -2
  95. package/src/components/FunctionEditor/FunctionEditor.tsx +1 -1
  96. package/src/components/GridSheet/GridSheet.stories.tsx +5 -2
  97. package/src/components/GridSheet/GridSheet.tsx +18 -12
  98. package/src/components/GridSheet/SheetCellEditor.stories.tsx +2 -2
  99. package/src/components/GridSheet/util.ts +7 -2
  100. package/src/components/RangeList/RangeList.tsx +2 -2
  101. package/src/components/SheetContainer/SheetContainer.stories.tsx +1 -5
  102. package/src/components/SheetContainer/SheetContainer.tsx +4 -7
  103. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +1 -1
  104. package/src/components/SheetToolbar/SheetToolbar.tsx +33 -8
  105. package/src/components/SheetToolbar/align.ts +44 -14
  106. package/src/components/SheetToolbar/comment.ts +39 -11
  107. package/src/components/SheetToolbar/style.ts +48 -12
  108. package/src/integrations/thread-ranges.ts +2 -3
  109. package/src/model/sheet-model.test.ts +1 -1
  110. package/src/sanity.test.ts +1 -1
  111. package/src/types/schema.ts +21 -19
  112. package/src/types/types.ts +25 -25
  113. package/dist/lib/browser/SheetContainer-7DK3ZZUT.mjs.map +0 -7
  114. package/dist/lib/browser/chunk-HRTIOTK7.mjs.map +0 -7
  115. package/dist/lib/browser/chunk-IE42HBFC.mjs.map +0 -7
  116. package/dist/lib/browser/compute-graph-registry-WEJLJJ6T.mjs.map +0 -7
  117. package/dist/lib/browser/markdown-DR4RDEEY.mjs.map +0 -7
  118. package/dist/lib/node/SheetContainer-6RPY4P7E.cjs.map +0 -7
  119. package/dist/lib/node/chunk-C3Q4GSES.cjs.map +0 -7
  120. package/dist/lib/node/chunk-UXSU6W7E.cjs.map +0 -7
  121. package/dist/lib/node/compute-graph-registry-VVSRJUGS.cjs.map +0 -7
  122. package/dist/lib/node/markdown-E7OUIMZO.cjs.map +0 -7
  123. package/dist/lib/node-esm/SheetContainer-QQUB22WF.mjs.map +0 -7
  124. package/dist/lib/node-esm/chunk-JSVXC3QP.mjs.map +0 -7
  125. package/dist/lib/node-esm/chunk-SWRUEW6J.mjs.map +0 -7
  126. package/dist/lib/node-esm/compute-graph-registry-PBQ52KH6.mjs.map +0 -7
  127. package/dist/lib/node-esm/markdown-BPKS2TNG.mjs.map +0 -7
  128. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +0 -8
  129. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +0 -1
  130. package/src/components/SheetToolbar/useToolbarAction.ts +0 -87
  131. /package/dist/lib/browser/{intent-resolver-OMXW6BDZ.mjs.map → intent-resolver-DN7JXDAV.mjs.map} +0 -0
  132. /package/dist/lib/browser/{react-surface-RTQDRQ4X.mjs.map → react-surface-NQU63B63.mjs.map} +0 -0
  133. /package/dist/lib/browser/{thread-HV32Z27A.mjs.map → thread-WU64QL2A.mjs.map} +0 -0
  134. /package/dist/lib/node/{intent-resolver-KI5DG7LR.cjs.map → intent-resolver-OPF56TAL.cjs.map} +0 -0
  135. /package/dist/lib/node/{react-surface-ZDOTWZ4Q.cjs.map → react-surface-7SAA5DX3.cjs.map} +0 -0
  136. /package/dist/lib/node/{thread-NVEWN3H2.cjs.map → thread-E7YPGR5T.cjs.map} +0 -0
  137. /package/dist/lib/node-esm/{intent-resolver-3FVOBB3K.mjs.map → intent-resolver-7AN5CN4R.mjs.map} +0 -0
  138. /package/dist/lib/node-esm/{react-surface-T4OVUZY2.mjs.map → react-surface-BPNN7RSE.mjs.map} +0 -0
  139. /package/dist/lib/node-esm/{thread-DTWGGMW4.mjs.map → thread-ULESW6IX.mjs.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  completeCellRangeToThreadCursor,
6
6
  useComputeGraph,
7
7
  useSheetContext
8
- } from "./chunk-JSVXC3QP.mjs";
8
+ } from "./chunk-3JJ7ETTJ.mjs";
9
9
  import "./chunk-HXBUY5ET.mjs";
10
10
  import {
11
11
  alignKey,
@@ -13,7 +13,7 @@ import {
13
13
  mapFormulaIndicesToRefs,
14
14
  rangeFromIndex,
15
15
  rangeToIndex
16
- } from "./chunk-SWRUEW6J.mjs";
16
+ } from "./chunk-LYZV4Q4C.mjs";
17
17
  import {
18
18
  SHEET_PLUGIN
19
19
  } from "./chunk-Y6ND5HWX.mjs";
@@ -41,7 +41,7 @@ var FunctionEditor = () => {
41
41
  }
42
42
  }
43
43
  return /* @__PURE__ */ React.createElement("div", {
44
- className: "flex shrink-0 justify-between items-center px-4 py-1 text-sm attention-surface border-bs !border-separator"
44
+ className: "flex shrink-0 justify-between items-center px-4 py-1 text-sm bg-toolbarSurface border-bs !border-separator"
45
45
  }, /* @__PURE__ */ React.createElement("div", {
46
46
  className: "flex gap-4 items-center"
47
47
  }, /* @__PURE__ */ React.createElement("div", {
@@ -60,7 +60,9 @@ var FunctionEditor = () => {
60
60
  };
61
61
 
62
62
  // packages/plugins/plugin-sheet/src/components/SheetToolbar/SheetToolbar.tsx
63
- import React2, { useCallback as useCallback2 } from "react";
63
+ import React2, { useCallback } from "react";
64
+ import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
65
+ import { ThreadAction } from "@dxos/plugin-thread/types";
64
66
  import { createGapSeparator, MenuProvider, ToolbarMenu, useMenuActions } from "@dxos/react-ui-menu";
65
67
 
66
68
  // packages/plugins/plugin-sheet/src/components/SheetToolbar/align.ts
@@ -92,11 +94,31 @@ var createAlignGroupAction = (value) => createMenuItemGroup("align", {
92
94
  selectCardinality: "single",
93
95
  value: `${alignKey}--${value}`
94
96
  });
95
- var createAlignActions = (value) => Object.entries(aligns).map(([alignValue, icon]) => {
96
- return createMenuAction(`${alignKey}--${alignValue}`, {
97
+ var createAlignActions = (model, state, cursorFallbackRange) => Object.entries(aligns).map(([alignValue, icon]) => {
98
+ return createMenuAction(`${alignKey}--${alignValue}`, () => {
99
+ if (!cursorFallbackRange) {
100
+ return;
101
+ }
102
+ const index = model.sheet.ranges?.findIndex((range) => range.key === alignKey && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
103
+ const nextRangeEntity = {
104
+ range: rangeToIndex(model.sheet, cursorFallbackRange),
105
+ key: alignKey,
106
+ value: alignValue
107
+ };
108
+ if (index < 0) {
109
+ model.sheet.ranges?.push(nextRangeEntity);
110
+ state[alignKey] = nextRangeEntity.value;
111
+ } else if (model.sheet.ranges[index].value === nextRangeEntity.value) {
112
+ model.sheet.ranges?.splice(index, 1);
113
+ state[alignKey] = void 0;
114
+ } else {
115
+ model.sheet.ranges?.splice(index, 1, nextRangeEntity);
116
+ state[alignKey] = nextRangeEntity.value;
117
+ }
118
+ }, {
97
119
  key: alignKey,
98
120
  value: alignValue,
99
- checked: value === alignValue,
121
+ checked: state[alignKey] === alignValue,
100
122
  label: [
101
123
  `range value ${alignValue} label`,
102
124
  {
@@ -107,9 +129,9 @@ var createAlignActions = (value) => Object.entries(aligns).map(([alignValue, ico
107
129
  testId: `grid.toolbar.${alignKey}.${alignValue}`
108
130
  });
109
131
  });
110
- var createAlign = ({ [alignKey]: alignValue }) => {
111
- const alignGroup = createAlignGroupAction(alignValue);
112
- const alignActions = createAlignActions(alignValue);
132
+ var createAlign = (model, state, cursorFallbackRange) => {
133
+ const alignGroup = createAlignGroupAction(state[alignKey]);
134
+ const alignActions = createAlignActions(model, state, cursorFallbackRange);
113
135
  return {
114
136
  nodes: [
115
137
  alignGroup,
@@ -150,7 +172,16 @@ var useCommentState = (state) => {
150
172
  cursorFallbackRange
151
173
  ]);
152
174
  };
153
- var createCommentAction = (state) => createMenuAction2("comment", {
175
+ var createCommentAction = (model, state, onComment, cursorFallbackRange) => createMenuAction2("comment", () => {
176
+ if (!cursorFallbackRange) {
177
+ return;
178
+ }
179
+ const cellContent = model.getCellText(cursorFallbackRange.from);
180
+ if (!cellContent) {
181
+ return;
182
+ }
183
+ onComment(cellContent, completeCellRangeToThreadCursor(cursorFallbackRange));
184
+ }, {
154
185
  key: commentKey,
155
186
  testId: "editor.toolbar.comment",
156
187
  icon: "ph--chat-text--regular",
@@ -162,9 +193,9 @@ var createCommentAction = (state) => createMenuAction2("comment", {
162
193
  ],
163
194
  disabled: state.commentEnabled !== "comment"
164
195
  });
165
- var createComment = (state) => ({
196
+ var createComment = (model, state, onComment, cursorFallbackRange) => ({
166
197
  nodes: [
167
- createCommentAction(state)
198
+ createCommentAction(model, state, onComment, cursorFallbackRange)
168
199
  ],
169
200
  edges: [
170
201
  {
@@ -204,8 +235,27 @@ var createStyleGroup = (state) => {
204
235
  value: Object.keys(styles).filter((key) => !!state[key]).map((styleValue) => `style--${styleValue}`)
205
236
  });
206
237
  };
207
- var createStyleActions = (state) => Object.entries(styles).map(([styleValue, icon]) => {
208
- return createMenuAction3(`style--${styleValue}`, {
238
+ var createStyleActions = (model, state, cursorFallbackRange) => Object.entries(styles).map(([styleValue, icon]) => {
239
+ return createMenuAction3(`style--${styleValue}`, () => {
240
+ if (!cursorFallbackRange) {
241
+ return;
242
+ }
243
+ const index = model.sheet.ranges?.findIndex((range) => range.key === "style" && inRange2(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
244
+ const nextRangeEntity = {
245
+ range: rangeToIndex(model.sheet, cursorFallbackRange),
246
+ key: "style",
247
+ value: styleValue
248
+ };
249
+ if (model.sheet.ranges.filter(({ range, key: rangeKey }) => rangeKey === "style" && inRange2(rangeFromIndex(model.sheet, range), cursorFallbackRange.from)).some(({ value: rangeValue }) => rangeValue === styleValue)) {
250
+ if (index >= 0) {
251
+ model.sheet.ranges?.splice(index, 1);
252
+ }
253
+ state[nextRangeEntity.value] = false;
254
+ } else {
255
+ model.sheet.ranges?.push(nextRangeEntity);
256
+ state[nextRangeEntity.value] = true;
257
+ }
258
+ }, {
209
259
  key: "style",
210
260
  value: styleValue,
211
261
  icon,
@@ -218,9 +268,9 @@ var createStyleActions = (state) => Object.entries(styles).map(([styleValue, ico
218
268
  checked: !!state[styleValue]
219
269
  });
220
270
  });
221
- var createStyle = (state) => {
271
+ var createStyle = (model, state, cursorFallbackRange) => {
222
272
  const styleGroupAction = createStyleGroup(state);
223
- const styleActions = createStyleActions(state);
273
+ const styleActions = createStyleActions(model, state, cursorFallbackRange);
224
274
  return {
225
275
  nodes: [
226
276
  styleGroupAction,
@@ -239,65 +289,6 @@ var createStyle = (state) => {
239
289
  };
240
290
  };
241
291
 
242
- // packages/plugins/plugin-sheet/src/components/SheetToolbar/useToolbarAction.ts
243
- import { useCallback } from "react";
244
- import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
245
- import { inRange as inRange3 } from "@dxos/compute";
246
- import { ThreadAction } from "@dxos/plugin-thread/types";
247
- var useToolbarAction = (state) => {
248
- const { model, cursorFallbackRange, cursor } = useSheetContext();
249
- const { dispatchPromise: dispatch } = useIntentDispatcher();
250
- return useCallback((action) => {
251
- const { key, value } = action.properties;
252
- if (cursorFallbackRange) {
253
- const index = model.sheet.ranges?.findIndex((range) => range.key === key && inRange3(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from)) ?? -1;
254
- const nextRangeEntity = {
255
- range: rangeToIndex(model.sheet, cursorFallbackRange),
256
- key,
257
- value
258
- };
259
- switch (key) {
260
- case "alignment":
261
- if (index < 0) {
262
- model.sheet.ranges?.push(nextRangeEntity);
263
- state[alignKey] = value;
264
- } else if (model.sheet.ranges[index].value === value) {
265
- model.sheet.ranges?.splice(index, 1);
266
- state[alignKey] = void 0;
267
- } else {
268
- model.sheet.ranges?.splice(index, 1, nextRangeEntity);
269
- state[alignKey] = value;
270
- }
271
- break;
272
- case "style":
273
- if (model.sheet.ranges.filter(({ range, key: rangeKey }) => rangeKey === "style" && inRange3(rangeFromIndex(model.sheet, range), cursorFallbackRange.from)).some(({ value: rangeValue }) => rangeValue === value)) {
274
- if (index >= 0) {
275
- model.sheet.ranges?.splice(index, 1);
276
- }
277
- state[value] = false;
278
- } else {
279
- model.sheet.ranges?.push(nextRangeEntity);
280
- state[value] = true;
281
- }
282
- break;
283
- case "comment": {
284
- const cellContent = model.getCellText(cursorFallbackRange.from);
285
- void dispatch(createIntent(ThreadAction.Create, {
286
- cursor: completeCellRangeToThreadCursor(cursorFallbackRange),
287
- name: cellContent,
288
- subject: model.sheet
289
- }));
290
- }
291
- }
292
- }
293
- }, [
294
- model.sheet,
295
- cursorFallbackRange,
296
- cursor,
297
- dispatch
298
- ]);
299
- };
300
-
301
292
  // packages/plugins/plugin-sheet/src/components/SheetToolbar/useToolbarState.ts
302
293
  import { useMemo as useMemo2 } from "react";
303
294
  import { live } from "@dxos/live-object";
@@ -306,11 +297,11 @@ var useToolbarState = (initialState = {}) => {
306
297
  };
307
298
 
308
299
  // packages/plugins/plugin-sheet/src/components/SheetToolbar/SheetToolbar.tsx
309
- var createToolbarActions = (state) => {
310
- const align = createAlign(state);
311
- const style = createStyle(state);
300
+ var createToolbarActions = (model, state, onComment, cursorFallbackRange) => {
301
+ const align = createAlign(model, state, cursorFallbackRange);
302
+ const style = createStyle(model, state, cursorFallbackRange);
312
303
  const gap = createGapSeparator();
313
- const comment = createComment(state);
304
+ const comment = createComment(model, state, onComment, cursorFallbackRange);
314
305
  return {
315
306
  nodes: [
316
307
  ...align.nodes,
@@ -327,19 +318,30 @@ var createToolbarActions = (state) => {
327
318
  };
328
319
  };
329
320
  var SheetToolbar = ({ attendableId, classNames }) => {
321
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
322
+ const { model, cursorFallbackRange } = useSheetContext();
330
323
  const state = useToolbarState({});
331
324
  useAlignState(state);
332
325
  useStyleState(state);
333
326
  useCommentState(state);
334
- const actionsCreator = useCallback2(() => createToolbarActions(state), [
335
- state
327
+ const handleComment = useCallback((name, cursor) => dispatch(createIntent(ThreadAction.Create, {
328
+ cursor,
329
+ name,
330
+ subject: model.sheet
331
+ })), [
332
+ model.sheet,
333
+ dispatch
334
+ ]);
335
+ const actionsCreator = useCallback(() => createToolbarActions(model, state, handleComment, cursorFallbackRange), [
336
+ model,
337
+ state,
338
+ handleComment,
339
+ cursorFallbackRange
336
340
  ]);
337
341
  const menu = useMenuActions(actionsCreator);
338
- const handleAction = useToolbarAction(state);
339
342
  return /* @__PURE__ */ React2.createElement(MenuProvider, {
340
343
  ...menu,
341
- attendableId,
342
- onAction: handleAction
344
+ attendableId
343
345
  }, /* @__PURE__ */ React2.createElement(ToolbarMenu, {
344
346
  classNames
345
347
  }));
@@ -368,4 +370,4 @@ var SheetContainer_default = SheetContainer;
368
370
  export {
369
371
  SheetContainer_default as default
370
372
  };
371
- //# sourceMappingURL=SheetContainer-QQUB22WF.mjs.map
373
+ //# sourceMappingURL=SheetContainer-XW7B2AJI.mjs.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 type SheetContainerProps = {\n space: Space;\n sheet: SheetType;\n role?: string;\n ignoreAttention?: boolean;\n};\n\nexport const SheetContainer = ({ space, sheet, role, ignoreAttention }: SheetContainerProps) => {\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 bg-toolbarSurface 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,OAAOA,YAAW;AAElB,SAASC,wBAAoC;AAC7C,SAASC,iBAAiB;;;ACH1B,OAAOC,WAAW;AAElB,SAASC,qBAAqBC,WAAWC,yBAAyB;AAClE,SAASC,YAAY;AAKd,IAAMC,iBAAiB,MAAA;AAC5B,QAAM,EAAEC,OAAOC,QAAQC,MAAK,IAAKC,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C,MAAcC,WACbV,SACEW,aAAaC,aAAaC,QAAQ;IAChCH;IACAD;IACAK,SAAShC,MAAMiC;EACjB,CAAA,CAAA,GAEJ;IAACjC,MAAMiC;IAAOf;GAAS;AAGzB,QAAMgB,iBAAiBR,YACrB,MAAM3B,qBAAqBC,OAAOC,OAAOwB,eAAetB,mBAAAA,GACxD;IAACH;IAAOC;IAAOwB;IAAetB;GAAoB;AAEpD,QAAMgC,OAAOC,eAAeF,cAAAA;AAE5B,SACE,gBAAAG,OAAA,cAACC,cAAAA;IAAc,GAAGH;IAAMpB;KACtB,gBAAAsB,OAAA,cAACE,aAAAA;IAAYvB;;AAGnB;;;AFjDO,IAAMwB,iBAAiB,CAAC,EAAEC,OAAOC,OAAOC,MAAMC,gBAAe,MAAuB;AACzF,QAAMC,QAAQC,gBAAgBL,KAAAA;AAE9B,SAAOI,QACL,gBAAAE,OAAA,cAACC,eAAAA;IAAcN;IAAcG;IAAcD;KACzC,gBAAAG,OAAA,cAACE,UAAUC,SAAO;IAACC,SAAAA;IAAQC,WAAAA;IAAW,GAAIT,SAAS,aAAa;MAAEU,YAAY;IAAe;KAC3F,gBAAAN,OAAA,cAACO,cAAAA;IAAaC,cAAcC,iBAAiBd,KAAAA;MAC7C,gBAAAK,OAAA,cAACU,WAAAA,IAAAA,GACD,gBAAAV,OAAA,cAACW,gBAAAA,IAAAA,CAAAA,CAAAA,IAGH;AACN;;;AO7BA,IAAA,yBAAeC;",
6
+ "names": ["React", "fullyQualifiedId", "StackItem", "React", "addressToA1Notation", "isFormula", "rangeToA1Notation", "Icon", "FunctionEditor", "model", "cursor", "range", "useSheetContext", "value", "formula", "getCellValue", "isFormula", "graph", "mapFunctionBindingFromId", "mapFormulaIndicesToRefs", "sheet", "String", "div", "className", "rangeToA1Notation", "addressToA1Notation", "Icon", "icon", "classNames", "span", "React", "useCallback", "createIntent", "useIntentDispatcher", "ThreadAction", "createGapSeparator", "MenuProvider", "ToolbarMenu", "useMenuActions", "useEffect", "inRange", "createMenuAction", "createMenuItemGroup", "aligns", "start", "center", "end", "useAlignState", "state", "cursor", "model", "useSheetContext", "useEffect", "alignKey", "sheet", "ranges", "findLast", "range", "key", "inRange", "rangeFromIndex", "value", "undefined", "createAlignGroupAction", "createMenuItemGroup", "label", "ns", "SHEET_PLUGIN", "variant", "selectCardinality", "createAlignActions", "cursorFallbackRange", "Object", "entries", "map", "alignValue", "icon", "createMenuAction", "index", "findIndex", "from", "nextRangeEntity", "rangeToIndex", "push", "splice", "checked", "testId", "createAlign", "alignGroup", "alignActions", "nodes", "edges", "source", "target", "id", "useEffect", "useMemo", "RefArray", "createMenuAction", "useCommentState", "state", "cursorFallbackRange", "model", "useSheetContext", "overlapsCommentAnchor", "useMemo", "RefArray", "targets", "sheet", "threads", "filter", "thread", "status", "some", "rangeToIndex", "anchor", "useEffect", "commentEnabled", "createCommentAction", "onComment", "createMenuAction", "cellContent", "getCellText", "from", "completeCellRangeToThreadCursor", "key", "commentKey", "testId", "icon", "label", "ns", "SHEET_PLUGIN", "disabled", "createComment", "nodes", "edges", "source", "target", "useEffect", "inRange", "createMenuAction", "createMenuItemGroup", "styles", "highlight", "softwrap", "useStyleState", "state", "cursorFallbackRange", "model", "useSheetContext", "useEffect", "sheet", "ranges", "filter", "range", "key", "inRange", "rangeFromIndex", "from", "forEach", "value", "createStyleGroup", "createMenuItemGroup", "variant", "selectCardinality", "Object", "keys", "map", "styleValue", "createStyleActions", "entries", "icon", "createMenuAction", "index", "findIndex", "nextRangeEntity", "rangeToIndex", "rangeKey", "some", "rangeValue", "splice", "push", "label", "ns", "SHEET_PLUGIN", "checked", "createStyle", "styleGroupAction", "styleActions", "nodes", "edges", "source", "target", "id", "useMemo", "live", "useToolbarState", "initialState", "useMemo", "live", "createToolbarActions", "model", "state", "onComment", "cursorFallbackRange", "align", "createAlign", "style", "createStyle", "gap", "createGapSeparator", "comment", "createComment", "nodes", "edges", "SheetToolbar", "attendableId", "classNames", "dispatchPromise", "dispatch", "useIntentDispatcher", "useSheetContext", "useToolbarState", "useAlignState", "useStyleState", "useCommentState", "handleComment", "useCallback", "name", "cursor", "createIntent", "ThreadAction", "Create", "subject", "sheet", "actionsCreator", "menu", "useMenuActions", "React", "MenuProvider", "ToolbarMenu", "SheetContainer", "space", "sheet", "role", "ignoreAttention", "graph", "useComputeGraph", "React", "SheetProvider", "StackItem", "Content", "toolbar", "statusbar", "classNames", "SheetToolbar", "attendableId", "fullyQualifiedId", "GridSheet", "FunctionEditor", "SheetContainer"]
7
+ }
@@ -11,7 +11,7 @@ import {
11
11
  cellClassNameForRange,
12
12
  rangeFromIndex,
13
13
  useSheetModel
14
- } from "./chunk-SWRUEW6J.mjs";
14
+ } from "./chunk-LYZV4Q4C.mjs";
15
15
  import {
16
16
  SHEET_PLUGIN
17
17
  } from "./chunk-Y6ND5HWX.mjs";
@@ -44,9 +44,9 @@ var useComputeGraph = (space) => {
44
44
  };
45
45
 
46
46
  // packages/plugins/plugin-sheet/src/components/RangeList/RangeList.tsx
47
+ import { Schema } from "effect";
47
48
  import React2, { useCallback } from "react";
48
49
  import { rangeToA1Notation } from "@dxos/compute";
49
- import { S } from "@dxos/echo-schema";
50
50
  import { useTranslation } from "@dxos/react-ui";
51
51
  import { List } from "@dxos/react-ui-list";
52
52
  import { ghostHover } from "@dxos/react-ui-theme";
@@ -64,7 +64,7 @@ var RangeList = ({ sheet }) => {
64
64
  className: "p-2 text-sm font-semibold"
65
65
  }, t("range list heading")), /* @__PURE__ */ React2.createElement(List.Root, {
66
66
  items: sheet.ranges,
67
- isItem: S.is(Range)
67
+ isItem: Schema.is(Range)
68
68
  }, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ React2.createElement(List.Item, {
69
69
  key: i,
70
70
  item: range,
@@ -90,9 +90,10 @@ import { lazy } from "react";
90
90
  import React4, { useCallback as useCallback4, useMemo as useMemo2, useRef, useState as useState3 } from "react";
91
91
  import { createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
92
92
  import { rangeToA1Notation as rangeToA1Notation2 } from "@dxos/compute";
93
+ import { defaultColSize, defaultRowSize } from "@dxos/lit-grid";
93
94
  import { DropdownMenu, Icon, useTranslation as useTranslation2 } from "@dxos/react-ui";
94
95
  import { useAttention } from "@dxos/react-ui-attention";
95
- import { closestCell, defaultSizeRow, editorKeys, Grid as Grid2, GridCellEditor, parseCellIndex } from "@dxos/react-ui-grid";
96
+ import { closestCell, editorKeys, parseCellIndex, Grid as Grid2, GridCellEditor } from "@dxos/react-ui-grid";
96
97
 
97
98
  // packages/plugins/plugin-sheet/src/components/GridSheet/util.ts
98
99
  import { useEffect as useEffect2, useState } from "react";
@@ -103,12 +104,11 @@ import { colToA1Notation, rowToA1Notation, commentedClassName } from "@dxos/reac
103
104
  import { mx } from "@dxos/react-ui-theme";
104
105
 
105
106
  // packages/plugins/plugin-sheet/src/integrations/thread-ranges.ts
106
- import { pipe } from "effect";
107
+ import { Schema as Schema2, pipe } from "effect";
107
108
  import { useCallback as useCallback2, useEffect, useMemo } from "react";
108
109
  import { createIntent, createResolver, LayoutAction, useIntentResolver, useIntentDispatcher, chain } from "@dxos/app-framework";
109
110
  import { debounce } from "@dxos/async";
110
111
  import { inRange } from "@dxos/compute";
111
- import { S as S2 } from "@dxos/echo-schema";
112
112
  import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from "@dxos/plugin-deck/types";
113
113
  import { ThreadAction } from "@dxos/plugin-thread/types";
114
114
  import { fullyQualifiedId } from "@dxos/react-client/echo";
@@ -139,7 +139,7 @@ var useUpdateFocusedCellOnThreadSelection = (grid) => {
139
139
  intent: LayoutAction.ScrollIntoView,
140
140
  position: "hoist",
141
141
  filter: (data) => {
142
- if (!S2.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
142
+ if (!Schema2.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
143
143
  return false;
144
144
  }
145
145
  return data.subject === fullyQualifiedId(model.sheet) && !!data.options?.cursor;
@@ -281,12 +281,12 @@ var gridCellGetter = (model) => {
281
281
  };
282
282
  var rowLabelCell = (row) => ({
283
283
  value: rowToA1Notation(row),
284
- className: "text-end pie-1 text-subdued",
284
+ className: "!bg-toolbarSurface text-subdued text-end pie-1",
285
285
  resizeHandle: "row"
286
286
  });
287
287
  var colLabelCell = (col) => ({
288
288
  value: colToA1Notation(col),
289
- className: "text-subdued",
289
+ className: "!bg-toolbarSurface text-subdued",
290
290
  resizeHandle: "col"
291
291
  });
292
292
  var cellGetter = (model) => {
@@ -295,6 +295,13 @@ var cellGetter = (model) => {
295
295
  switch (plane) {
296
296
  case "grid":
297
297
  return getGridCells(nextBounds);
298
+ case "fixedStartStart": {
299
+ return {
300
+ "0,0": {
301
+ className: "!bg-toolbarSurface"
302
+ }
303
+ };
304
+ }
298
305
  case "frozenColsStart":
299
306
  return [
300
307
  ...Array(nextBounds.end.row - nextBounds.start.row)
@@ -469,23 +476,23 @@ var frozen = {
469
476
  frozenColsStart: 1,
470
477
  frozenRowsStart: 1
471
478
  };
472
- var sheetRowDefault = {
473
- frozenRowsStart: {
474
- size: defaultSizeRow,
479
+ var sheetColDefault = {
480
+ frozenColsStart: {
481
+ size: 48,
475
482
  readonly: true
476
483
  },
477
484
  grid: {
478
- size: defaultSizeRow,
485
+ size: defaultColSize,
479
486
  resizeable: true
480
487
  }
481
488
  };
482
- var sheetColDefault = {
483
- frozenColsStart: {
484
- size: 48,
489
+ var sheetRowDefault = {
490
+ frozenRowsStart: {
491
+ size: defaultRowSize,
485
492
  readonly: true
486
493
  },
487
494
  grid: {
488
- size: 180,
495
+ size: defaultRowSize,
489
496
  resizeable: true
490
497
  }
491
498
  };
@@ -742,66 +749,70 @@ var GridSheet = () => {
742
749
  ]);
743
750
  useUpdateFocusedCellOnThreadSelection(dxGrid);
744
751
  useSelectThreadOnCellFocus();
745
- return /* @__PURE__ */ React4.createElement("div", {
746
- role: "none",
747
- className: "relative min-bs-0"
748
- }, /* @__PURE__ */ React4.createElement(GridCellEditor, {
749
- getCellContent,
750
- extension,
751
- onBlur: handleBlur
752
- }), /* @__PURE__ */ React4.createElement(Grid2.Content, {
753
- initialCells,
754
- limitColumns: DEFAULT_COLS,
755
- limitRows: DEFAULT_ROWS,
756
- columns,
757
- rows,
758
- onAxisResize: handleAxisResize,
759
- onSelect: handleSelect,
760
- rowDefault: sheetRowDefault,
761
- columnDefault: sheetColDefault,
762
- frozen,
763
- onFocus: handleFocus,
764
- onWheelCapture: handleWheel,
765
- onKeyDown: handleKeyDown,
766
- onContextMenu: handleContextMenu,
767
- onClick: handleClick,
768
- overscroll: "trap",
769
- className: "[--dx-grid-base:var(--surface-bg)] [&_.dx-grid]:border-bs [&_.dx-grid]:absolute [&_.dx-grid]:inset-0 [&_.dx-grid]:border-separator",
770
- activeRefs,
771
- ref: setDxGrid
772
- }), /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
773
- modal: false,
774
- open: !!contextMenuOpen,
775
- onOpenChange: (nextOpen) => setContextMenuOpen(nextOpen ? inertPosition : null)
776
- }, /* @__PURE__ */ React4.createElement(DropdownMenu.VirtualTrigger, {
777
- virtualRef: contextMenuAnchorRef
778
- }), /* @__PURE__ */ React4.createElement(DropdownMenu.Content, {
779
- side: contextMenuAxis === "col" ? "bottom" : "right",
780
- sideOffset: 4,
781
- collisionPadding: 8
782
- }, /* @__PURE__ */ React4.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
783
- onClick: () => handleAxisMenuAction("insert-before"),
784
- "data-testid": `grid.${contextMenuAxis}.insert-before`
785
- }, /* @__PURE__ */ React4.createElement(Icon, {
786
- size: 5,
787
- icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
788
- }), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
789
- onClick: () => handleAxisMenuAction("insert-after"),
790
- "data-testid": `grid.${contextMenuAxis}.insert-after`
791
- }, /* @__PURE__ */ React4.createElement(Icon, {
792
- size: 5,
793
- icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
794
- }), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
795
- onClick: () => handleAxisMenuAction("drop"),
796
- "data-testid": `grid.${contextMenuAxis}.drop`
797
- }, /* @__PURE__ */ React4.createElement(Icon, {
798
- size: 5,
799
- icon: "ph--backspace--regular"
800
- }), /* @__PURE__ */ React4.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ React4.createElement(DropdownMenu.Arrow, null))));
752
+ return (
753
+ // TODO(thure): Why are Table’s and Sheet’s editor boxes off by 1px?
754
+ /* @__PURE__ */ React4.createElement("div", {
755
+ role: "none",
756
+ className: "relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent "
757
+ }, /* @__PURE__ */ React4.createElement(GridCellEditor, {
758
+ getCellContent,
759
+ extension,
760
+ onBlur: handleBlur
761
+ }), /* @__PURE__ */ React4.createElement(Grid2.Content, {
762
+ initialCells,
763
+ limitColumns: DEFAULT_COLS,
764
+ limitRows: DEFAULT_ROWS,
765
+ columns,
766
+ rows,
767
+ // TODO(burdon): `col` vs. `column`?
768
+ columnDefault: sheetColDefault,
769
+ rowDefault: sheetRowDefault,
770
+ frozen,
771
+ onAxisResize: handleAxisResize,
772
+ onSelect: handleSelect,
773
+ onFocus: handleFocus,
774
+ onWheelCapture: handleWheel,
775
+ onKeyDown: handleKeyDown,
776
+ onContextMenu: handleContextMenu,
777
+ onClick: handleClick,
778
+ overscroll: "trap",
779
+ className: "[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:border-bs [&_.dx-grid]:border-be [&_.dx-grid]:absolute [&_.dx-grid]:inset-0 [&_.dx-grid]:border-separator",
780
+ activeRefs,
781
+ ref: setDxGrid
782
+ }), /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
783
+ modal: false,
784
+ open: !!contextMenuOpen,
785
+ onOpenChange: (nextOpen) => setContextMenuOpen(nextOpen ? inertPosition : null)
786
+ }, /* @__PURE__ */ React4.createElement(DropdownMenu.VirtualTrigger, {
787
+ virtualRef: contextMenuAnchorRef
788
+ }), /* @__PURE__ */ React4.createElement(DropdownMenu.Content, {
789
+ side: contextMenuAxis === "col" ? "bottom" : "right",
790
+ sideOffset: 4,
791
+ collisionPadding: 8
792
+ }, /* @__PURE__ */ React4.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
793
+ onClick: () => handleAxisMenuAction("insert-before"),
794
+ "data-testid": `grid.${contextMenuAxis}.insert-before`
795
+ }, /* @__PURE__ */ React4.createElement(Icon, {
796
+ size: 5,
797
+ icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
798
+ }), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
799
+ onClick: () => handleAxisMenuAction("insert-after"),
800
+ "data-testid": `grid.${contextMenuAxis}.insert-after`
801
+ }, /* @__PURE__ */ React4.createElement(Icon, {
802
+ size: 5,
803
+ icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
804
+ }), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
805
+ onClick: () => handleAxisMenuAction("drop"),
806
+ "data-testid": `grid.${contextMenuAxis}.drop`
807
+ }, /* @__PURE__ */ React4.createElement(Icon, {
808
+ size: 5,
809
+ icon: "ph--backspace--regular"
810
+ }), /* @__PURE__ */ React4.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ React4.createElement(DropdownMenu.Arrow, null))))
811
+ );
801
812
  };
802
813
 
803
814
  // packages/plugins/plugin-sheet/src/components/index.ts
804
- var SheetContainer = lazy(() => import("./SheetContainer-QQUB22WF.mjs"));
815
+ var SheetContainer = lazy(() => import("./SheetContainer-XW7B2AJI.mjs"));
805
816
 
806
817
  export {
807
818
  ComputeGraphContextProvider,
@@ -813,4 +824,4 @@ export {
813
824
  RangeList,
814
825
  SheetContainer
815
826
  };
816
- //# sourceMappingURL=chunk-JSVXC3QP.mjs.map
827
+ //# sourceMappingURL=chunk-3JJ7ETTJ.mjs.map