@dxos/plugin-sheet 0.6.10 → 0.6.11-staging.a542fc9

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 (60) hide show
  1. package/dist/lib/browser/{SheetContainer-ISY6DUVE.mjs → SheetContainer-4XOKHKKZ.mjs} +40 -30
  2. package/dist/lib/browser/SheetContainer-4XOKHKKZ.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-D3PUKBH6.mjs → chunk-FUAGSXA4.mjs} +1 -1
  4. package/dist/lib/browser/{chunk-D3PUKBH6.mjs.map → chunk-FUAGSXA4.mjs.map} +2 -2
  5. package/dist/lib/browser/chunk-FWGRE3EG.mjs +175 -0
  6. package/dist/lib/browser/chunk-FWGRE3EG.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-CBRBNG3R.mjs → chunk-P7SSL3EG.mjs} +115 -194
  8. package/dist/lib/browser/chunk-P7SSL3EG.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-YPU3R7FA.mjs +8 -0
  10. package/dist/lib/browser/chunk-YPU3R7FA.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +23 -68
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/testing.mjs +92 -0
  15. package/dist/lib/browser/testing.mjs.map +7 -0
  16. package/dist/lib/browser/types.mjs +1 -1
  17. package/dist/lib/node/{SheetContainer-ESRTE7A5.cjs → SheetContainer-IQT6TR4Z.cjs} +61 -52
  18. package/dist/lib/node/SheetContainer-IQT6TR4Z.cjs.map +7 -0
  19. package/dist/lib/node/chunk-5EPCDAZC.cjs +40 -0
  20. package/dist/lib/node/chunk-5EPCDAZC.cjs.map +7 -0
  21. package/dist/lib/node/chunk-727C6YNP.cjs +202 -0
  22. package/dist/lib/node/chunk-727C6YNP.cjs.map +7 -0
  23. package/dist/lib/node/{chunk-3R3J7IZR.cjs → chunk-DSYKOI4E.cjs} +4 -4
  24. package/dist/lib/node/{chunk-3R3J7IZR.cjs.map → chunk-DSYKOI4E.cjs.map} +2 -2
  25. package/dist/lib/node/{chunk-4EGEA3KL.cjs → chunk-SVAIIXWQ.cjs} +127 -206
  26. package/dist/lib/node/chunk-SVAIIXWQ.cjs.map +7 -0
  27. package/dist/lib/node/index.cjs +24 -67
  28. package/dist/lib/node/index.cjs.map +4 -4
  29. package/dist/lib/node/meta.json +1 -1
  30. package/dist/lib/node/testing.cjs +111 -0
  31. package/dist/lib/node/testing.cjs.map +7 -0
  32. package/dist/lib/node/types.cjs +9 -9
  33. package/dist/lib/node/types.cjs.map +1 -1
  34. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  35. package/dist/types/src/components/CellEditor/extension.d.ts.map +1 -1
  36. package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +1 -1
  37. package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +1 -1
  38. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
  39. package/dist/types/src/components/SheetContainer.d.ts +1 -1
  40. package/dist/types/src/components/SheetContainer.d.ts.map +1 -1
  41. package/dist/types/src/components/index.d.ts +1 -1
  42. package/dist/types/src/components/index.d.ts.map +1 -1
  43. package/dist/types/src/testing.d.ts +9 -0
  44. package/dist/types/src/testing.d.ts.map +1 -0
  45. package/dist/types/src/types.d.ts.map +1 -1
  46. package/package.json +38 -28
  47. package/src/SheetPlugin.tsx +18 -4
  48. package/src/components/CellEditor/extension.ts +16 -10
  49. package/src/components/ComputeGraph/edge-function.ts +6 -2
  50. package/src/components/ComputeGraph/graph-context.tsx +10 -1
  51. package/src/components/Sheet/Sheet.stories.tsx +3 -39
  52. package/src/components/Sheet/Sheet.tsx +12 -12
  53. package/src/components/Sheet/formatting.ts +1 -1
  54. package/src/components/SheetContainer.tsx +2 -1
  55. package/src/testing.ts +50 -0
  56. package/src/types.ts +2 -0
  57. package/dist/lib/browser/SheetContainer-ISY6DUVE.mjs.map +0 -7
  58. package/dist/lib/browser/chunk-CBRBNG3R.mjs.map +0 -7
  59. package/dist/lib/node/SheetContainer-ESRTE7A5.cjs.map +0 -7
  60. package/dist/lib/node/chunk-4EGEA3KL.cjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-sheet",
3
- "version": "0.6.10",
3
+ "version": "0.6.11-staging.a542fc9",
4
4
  "description": "Braneframe sketch plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -21,6 +21,13 @@
21
21
  },
22
22
  "types": "./dist/types/src/meta.d.ts"
23
23
  },
24
+ "./testing": {
25
+ "browser": "./dist/lib/browser/testing.mjs",
26
+ "node": {
27
+ "default": "./dist/lib/node/testing.cjs"
28
+ },
29
+ "types": "./dist/types/src/testing.d.ts"
30
+ },
24
31
  "./types": {
25
32
  "browser": "./dist/lib/browser/types.mjs",
26
33
  "node": {
@@ -35,6 +42,9 @@
35
42
  "meta": [
36
43
  "dist/types/src/meta.d.ts"
37
44
  ],
45
+ "testing": [
46
+ "dist/types/src/testing.d.ts"
47
+ ],
38
48
  "types": [
39
49
  "dist/types/src/types.d.ts"
40
50
  ]
@@ -66,25 +76,25 @@
66
76
  "re-resizable": "^6.9.17",
67
77
  "react-markdown": "^8.0.5",
68
78
  "react-resize-detector": "^11.0.1",
69
- "@dxos/app-framework": "0.6.10",
70
- "@dxos/client": "0.6.10",
71
- "@dxos/async": "0.6.10",
72
- "@dxos/context": "0.6.10",
73
- "@dxos/crypto": "0.6.10",
74
- "@dxos/echo-schema": "0.6.10",
75
- "@dxos/keys": "0.6.10",
76
- "@dxos/debug": "0.6.10",
77
- "@dxos/invariant": "0.6.10",
78
- "@dxos/log": "0.6.10",
79
- "@dxos/plugin-client": "0.6.10",
80
- "@dxos/plugin-script": "0.6.10",
81
- "@dxos/plugin-space": "0.6.10",
82
- "@dxos/plugin-graph": "0.6.10",
83
- "@dxos/plugin-stack": "0.6.10",
84
- "@dxos/react-client": "0.6.10",
85
- "@dxos/react-ui-attention": "0.6.10",
86
- "@dxos/react-ui-editor": "0.6.10",
87
- "@dxos/util": "0.6.10"
79
+ "@dxos/app-framework": "0.6.11-staging.a542fc9",
80
+ "@dxos/async": "0.6.11-staging.a542fc9",
81
+ "@dxos/client": "0.6.11-staging.a542fc9",
82
+ "@dxos/context": "0.6.11-staging.a542fc9",
83
+ "@dxos/crypto": "0.6.11-staging.a542fc9",
84
+ "@dxos/debug": "0.6.11-staging.a542fc9",
85
+ "@dxos/echo-schema": "0.6.11-staging.a542fc9",
86
+ "@dxos/invariant": "0.6.11-staging.a542fc9",
87
+ "@dxos/keys": "0.6.11-staging.a542fc9",
88
+ "@dxos/log": "0.6.11-staging.a542fc9",
89
+ "@dxos/plugin-client": "0.6.11-staging.a542fc9",
90
+ "@dxos/plugin-graph": "0.6.11-staging.a542fc9",
91
+ "@dxos/plugin-script": "0.6.11-staging.a542fc9",
92
+ "@dxos/plugin-space": "0.6.11-staging.a542fc9",
93
+ "@dxos/plugin-stack": "0.6.11-staging.a542fc9",
94
+ "@dxos/react-client": "0.6.11-staging.a542fc9",
95
+ "@dxos/react-ui-attention": "0.6.11-staging.a542fc9",
96
+ "@dxos/util": "0.6.11-staging.a542fc9",
97
+ "@dxos/react-ui-editor": "0.6.11-staging.a542fc9"
88
98
  },
89
99
  "devDependencies": {
90
100
  "@lezer/generator": "^1.7.1",
@@ -97,19 +107,19 @@
97
107
  "react": "~18.2.0",
98
108
  "react-dom": "~18.2.0",
99
109
  "vite": "^5.3.4",
100
- "@dxos/echo-generator": "0.6.10",
101
- "@dxos/random": "0.6.10",
102
- "@dxos/react-ui-theme": "0.6.10",
103
- "@dxos/react-ui-types": "0.6.10",
104
- "@dxos/react-ui": "0.6.10",
105
- "@dxos/storybook-utils": "0.6.10"
110
+ "@dxos/echo-generator": "0.6.11-staging.a542fc9",
111
+ "@dxos/random": "0.6.11-staging.a542fc9",
112
+ "@dxos/react-ui": "0.6.11-staging.a542fc9",
113
+ "@dxos/react-ui-theme": "0.6.11-staging.a542fc9",
114
+ "@dxos/react-ui-types": "0.6.11-staging.a542fc9",
115
+ "@dxos/storybook-utils": "0.6.11-staging.a542fc9"
106
116
  },
107
117
  "optionalDependencies": {
108
118
  "@phosphor-icons/react": "^2.1.5",
109
119
  "react": "^18.0.0",
110
120
  "react-dom": "^18.0.0",
111
- "@dxos/react-ui": "0.6.10",
112
- "@dxos/react-ui-theme": "0.6.10"
121
+ "@dxos/react-ui": "0.6.11-staging.a542fc9",
122
+ "@dxos/react-ui-theme": "0.6.11-staging.a542fc9"
113
123
  },
114
124
  "publishConfig": {
115
125
  "access": "public"
@@ -19,7 +19,13 @@ import { FunctionType } from '@dxos/plugin-script/types';
19
19
  import { SpaceAction } from '@dxos/plugin-space';
20
20
  import { getSpace, isEchoObject } from '@dxos/react-client/echo';
21
21
 
22
- import { createComputeGraph, SheetContainer, type ComputeGraph } from './components';
22
+ import {
23
+ createComputeGraph,
24
+ CustomPlugin,
25
+ CustomPluginTranslations,
26
+ SheetContainer,
27
+ type ComputeGraph,
28
+ } from './components';
23
29
  // TODO(wittjosiah): Refactor. These are not exported from ./components due to depending on ECHO.
24
30
  import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations } from './components/ComputeGraph/edge-function';
25
31
  import { ComputeGraphContextProvider } from './components/ComputeGraph/graph-context';
@@ -61,6 +67,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
61
67
  metadata: {
62
68
  records: {
63
69
  [SheetType.typename]: {
70
+ label: (object: any) => (object instanceof SheetType ? object.title : undefined),
64
71
  placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],
65
72
  icon: (props: IconProps) => <GridNine {...props} />,
66
73
  iconSymbol: 'ph--grid-nine--regular',
@@ -120,11 +127,14 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
120
127
  creators: [
121
128
  {
122
129
  id: 'create-stack-section-sheet',
123
- testId: 'sheetPlugin.createSectionSpaceSheet',
130
+ testId: 'sheetPlugin.createSection',
124
131
  type: ['plugin name', { ns: SHEET_PLUGIN }],
125
132
  label: ['create sheet section label', { ns: SHEET_PLUGIN }],
126
133
  icon: (props: any) => <GridNine {...props} />,
127
- intent: { plugin: SHEET_PLUGIN, action: SheetAction.CREATE },
134
+ intent: {
135
+ plugin: SHEET_PLUGIN,
136
+ action: SheetAction.CREATE,
137
+ },
128
138
  },
129
139
  ],
130
140
  },
@@ -155,7 +165,11 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
155
165
  const graph =
156
166
  graphs[space.id] ??
157
167
  createComputeGraph(
158
- [{ plugin: EdgeFunctionPlugin, translations: EdgeFunctionPluginTranslations }],
168
+ [
169
+ { plugin: EdgeFunctionPlugin, translations: EdgeFunctionPluginTranslations },
170
+ // TODO(wittjosiah): Remove. Needed for current test sheet generated data.
171
+ { plugin: CustomPlugin, translations: CustomPluginTranslations },
172
+ ],
159
173
  space,
160
174
  { remoteFunctionUrl },
161
175
  );
@@ -32,30 +32,30 @@ const highlightStyles = HighlightStyle.define([
32
32
  // Function.
33
33
  {
34
34
  tag: tags.name,
35
- class: 'text-primary-500',
35
+ class: 'text-accentText',
36
36
  },
37
37
  // Range.
38
38
  {
39
39
  tag: tags.tagName,
40
- class: 'text-pink-500',
40
+ class: 'text-pinkText',
41
41
  },
42
42
  // Values.
43
43
  {
44
44
  tag: tags.number,
45
- class: 'text-teal-500',
45
+ class: 'text-tealText',
46
46
  },
47
47
  {
48
48
  tag: tags.bool,
49
- class: 'text-teal-500',
49
+ class: 'text-tealText',
50
50
  },
51
51
  {
52
52
  tag: tags.string,
53
- class: 'text-teal-500',
53
+ class: 'text-tealText',
54
54
  },
55
55
  // Error.
56
56
  {
57
57
  tag: tags.invalid,
58
- class: 'text-neutral-500',
58
+ class: 'text-unAccent',
59
59
  },
60
60
  ]);
61
61
 
@@ -92,7 +92,7 @@ export const sheetExtension = ({ functions = [] }: SheetExtensionOptions): Exten
92
92
 
93
93
  const title = document.createElement('h2');
94
94
  title.innerText = name;
95
- title.className = 'text-lg font-mono text-primary-500';
95
+ title.className = 'text-lg font-mono text-accentText';
96
96
  root.appendChild(title);
97
97
 
98
98
  if (description) {
@@ -105,7 +105,7 @@ export const sheetExtension = ({ functions = [] }: SheetExtensionOptions): Exten
105
105
  if (syntax) {
106
106
  const detail = document.createElement('pre');
107
107
  detail.innerText = syntax;
108
- detail.className = 'whitespace-pre-wrap text-green-500';
108
+ detail.className = 'whitespace-pre-wrap text-greenText';
109
109
  root.appendChild(detail);
110
110
  }
111
111
 
@@ -168,8 +168,8 @@ export const sheetExtension = ({ functions = [] }: SheetExtensionOptions): Exten
168
168
  // TODO(burdon): Factor out fragments.
169
169
  // TODO(burdon): Size to make width same as column.
170
170
  '!-left-[1px] !top-[33px] !-m-0 border !border-t-0 [&>ul]:!min-w-[198px]',
171
- '[&>ul>li[aria-selected]]:!bg-primary-700',
172
- 'border-neutral-200 dark:border-neutral-700',
171
+ '[&>ul>li[aria-selected]]:!bg-accentSurface',
172
+ 'border-separator',
173
173
  ),
174
174
  }),
175
175
  keymap.of([
@@ -242,6 +242,12 @@ export const rangeExtension = (onInit: (notifier: CellRangeNotifier) => void): E
242
242
  break;
243
243
  }
244
244
 
245
+ case 'CloseParen': {
246
+ // Mark but keep looking.
247
+ activeRange = { from, to: from };
248
+ break;
249
+ }
250
+
245
251
  case 'RangeToken':
246
252
  case 'CellToken':
247
253
  activeRange = { from, to };
@@ -8,6 +8,7 @@ import { type InterpreterState } from 'hyperformula/typings/interpreter/Interpre
8
8
  import { type ProcedureAst } from 'hyperformula/typings/parser';
9
9
 
10
10
  import { Filter, getMeta } from '@dxos/client/echo';
11
+ import { log } from '@dxos/log';
11
12
  import { getUserFunctionUrlInMetadata } from '@dxos/plugin-script/edge';
12
13
  import { FunctionType } from '@dxos/plugin-script/types';
13
14
  import { nonNullable } from '@dxos/util';
@@ -35,15 +36,18 @@ export class EdgeFunctionPlugin extends FunctionPluginAsync {
35
36
  objects: [fn],
36
37
  } = await space.db.query(Filter.schema(FunctionType, { binding })).run();
37
38
  if (!fn) {
39
+ log.info('Function not found', { binding });
38
40
  return new CellError(ErrorType.REF, 'Function not found');
39
41
  }
40
42
 
41
43
  if (subscribe) {
42
44
  const unsubscribe = effect(() => {
45
+ log.info('function changed', { fn });
43
46
  const _ = fn?.version;
44
47
 
45
- // If the function changes, force a recalculation.
46
- this.runAsyncFunction(ast, state, handler(false), { ttl: 0 });
48
+ // TODO(wittjosiah): `ttl` should be 0 to force a recalculation when a new version is deployed.
49
+ // This needs a ttl to prevent a binding change from causing the function not to be found.
50
+ this.runAsyncFunction(ast, state, handler(false), { ttl: EDGE_FUNCTION_TTL });
47
51
  });
48
52
 
49
53
  this.context.createSubscription(ast.procedureName, unsubscribe);
@@ -7,6 +7,7 @@ import React, { createContext, type PropsWithChildren, useContext, useEffect } f
7
7
  import { type Space } from '@dxos/react-client/echo';
8
8
 
9
9
  import { type FunctionContextOptions } from './async-function';
10
+ import { CustomPlugin, CustomPluginTranslations } from './custom';
10
11
  import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations } from './edge-function';
11
12
  import { createComputeGraph, type ComputeGraph } from './graph';
12
13
 
@@ -29,7 +30,15 @@ export const useComputeGraph = (space: Space, options?: Partial<FunctionContextO
29
30
  const { graphs, setGraph } = useContext(ComputeGraphContext);
30
31
  const graph =
31
32
  graphs[space.id] ??
32
- createComputeGraph([{ plugin: EdgeFunctionPlugin, translations: EdgeFunctionPluginTranslations }], space, options);
33
+ createComputeGraph(
34
+ [
35
+ { plugin: EdgeFunctionPlugin, translations: EdgeFunctionPluginTranslations },
36
+ // TODO(wittjosiah): Remove. Needed for current test sheet generated data.
37
+ { plugin: CustomPlugin, translations: CustomPluginTranslations },
38
+ ],
39
+ space,
40
+ options,
41
+ );
33
42
 
34
43
  useEffect(() => {
35
44
  if (!graphs[space.id]) {
@@ -18,8 +18,8 @@ import { withTheme, withFullscreen } from '@dxos/storybook-utils';
18
18
  import { Sheet } from './Sheet';
19
19
  import { type SizeMap } from './grid';
20
20
  import { useSheetContext } from './sheet-context';
21
- import { SheetModel } from '../../model';
22
- import { ValueTypeEnum, type CellValue, createSheet, SheetType } from '../../types';
21
+ import { createTestSheet, testSheetName } from '../../testing';
22
+ import { ValueTypeEnum, SheetType } from '../../types';
23
23
  import { type ComputeGraph, createComputeGraph } from '../ComputeGraph';
24
24
  // TODO(wittjosiah): Refactor. This is not exported from ./components due to depending on ECHO.
25
25
  import { ComputeGraphContext, ComputeGraphContextProvider, useComputeGraph } from '../ComputeGraph/graph-context';
@@ -99,8 +99,6 @@ const SheetWithToolbar = ({ debug, space }: { debug?: boolean; space: Space }) =
99
99
  );
100
100
  };
101
101
 
102
- const testSheetName = 'test';
103
-
104
102
  const withGraphDecorator: Decorator = (Story) => {
105
103
  const [graphs, setGraphs] = useState<Record<string, ComputeGraph>>({});
106
104
 
@@ -263,34 +261,6 @@ const Cell = ({ className, label }: { className?: string; label: string }) => (
263
261
  <div className={mx('flex items-center justify-center border', className)}>{label}</div>
264
262
  );
265
263
 
266
- const createCells = (): Record<string, CellValue> => ({
267
- B1: { value: 'Qty' },
268
- B3: { value: 1 },
269
- B4: { value: 2 },
270
- B5: { value: 3 },
271
- B7: { value: 'Total' },
272
-
273
- C1: { value: 'Price' },
274
- C3: { value: 2_000 },
275
- C4: { value: 2_500 },
276
- C5: { value: 3_000 },
277
- C7: { value: '=SUMPRODUCT(B2:B6, C2:C6)' },
278
- // C8: { value: '=C7*CRYPTO(D7)' },
279
- C8: { value: '=C7*TEST()' },
280
-
281
- D7: { value: 'USD' },
282
- D8: { value: 'BTC' },
283
-
284
- E3: { value: '=TODAY()' },
285
- E4: { value: '=NOW()' },
286
-
287
- F1: { value: `=${testSheetName}!A1` }, // Ref test sheet.
288
- F3: { value: true },
289
- F4: { value: false },
290
- F5: { value: '8%' },
291
- F6: { value: '$10000' },
292
- });
293
-
294
264
  const useTestSheet = () => {
295
265
  const { graphs, setGraph } = useContext(ComputeGraphContext);
296
266
  const [sheet, setSheet] = useState<EchoReactiveObject<SheetType>>();
@@ -307,13 +277,7 @@ const useTestSheet = () => {
307
277
  setGraph(space.id, graph);
308
278
  }
309
279
 
310
- const sheet = createSheet();
311
- const model = new SheetModel(graph, sheet);
312
- await model.initialize();
313
- model.setValues(createCells());
314
- model.sheet.columnMeta[model.sheet.columns[0]] = { size: 100 };
315
- await model.destroy();
316
-
280
+ const sheet = await createTestSheet({ graph });
317
281
  space.db.add(sheet);
318
282
  setSheet(sheet);
319
283
  });
@@ -114,11 +114,11 @@ import {
114
114
 
115
115
  // TODO(burdon): Factor out fragments.
116
116
  const fragments = {
117
- axis: 'bg-neutral-50 text-neutral-800 dark:bg-neutral-800 dark:text-neutral-200 text-xs select-none',
118
- axisSelected: 'bg-neutral-100 dark:bg-neutral-900 text-black dark:text-white',
119
- cell: 'dark:bg-neutral-850',
120
- cellSelected: 'bg-neutral-50 dark:bg-neutral-900 text-black dark:text-white border !border-primary-500',
121
- border: 'border-neutral-200 dark:border-neutral-700',
117
+ axis: 'bg-axisSurface text-axisText text-xs select-none',
118
+ axisSelected: 'bg-attention text-baseText',
119
+ cell: 'bg-gridCell',
120
+ cellSelected: 'bg-gridCellSelected text-baseText border !border-accentSurface',
121
+ border: 'border-gridLine',
122
122
  };
123
123
 
124
124
  //
@@ -345,7 +345,7 @@ const GridCorner = (props: { className?: string } & Pick<DOMAttributes<HTMLDivEl
345
345
 
346
346
  const MovingOverlay = ({ label }: { label: string }) => {
347
347
  return (
348
- <div className='flex w-full h-full justify-center items-center text-sm p-1 bg-primary-500/50 cursor-pointer'>
348
+ <div className='flex w-full h-full justify-center items-center text-sm p-1 bg-gridOverlay cursor-pointer'>
349
349
  {label}
350
350
  </div>
351
351
  );
@@ -532,11 +532,11 @@ const GridRowCell = ({ idx, index, label, size, resize, selected, onSelect, onRe
532
532
 
533
533
  {/* Drop indicator. */}
534
534
  {over?.id === idx && !isDragging && (
535
- <div className='z-20 absolute top-0 w-full min-h-[4px] border-b-4 border-primary-500' />
535
+ <div className='z-20 absolute top-0 w-full min-h-[4px] border-b-4 border-accentSurface' />
536
536
  )}
537
537
 
538
538
  {/* Resize indicator. */}
539
- {resizing && <div className='z-20 absolute bottom-0 w-full min-h-[4px] border-b-4 border-primary-500' />}
539
+ {resizing && <div className='z-20 absolute bottom-0 w-full min-h-[4px] border-b-4 border-accentSurface' />}
540
540
  </div>
541
541
  </Resizable>
542
542
  );
@@ -696,11 +696,11 @@ const GridColumnCell = ({ idx, index, label, size, resize, selected, onSelect, o
696
696
 
697
697
  {/* Drop indicator. */}
698
698
  {over?.id === idx && !isDragging && (
699
- <div className='z-20 absolute left-0 h-full min-w-[4px] border-l-4 border-primary-500' />
699
+ <div className='z-20 absolute left-0 h-full min-w-[4px] border-l-4 border-accentSurface' />
700
700
  )}
701
701
 
702
702
  {/* Resize indicator. */}
703
- {resizing && <div className='z-20 absolute right-0 h-full min-h-[4px] border-l-4 border-primary-500' />}
703
+ {resizing && <div className='z-20 absolute right-0 h-full min-h-[4px] border-l-4 border-accentSurface' />}
704
704
  </div>
705
705
  </Resizable>
706
706
  );
@@ -991,7 +991,7 @@ const SelectionOverlay = ({ root }: { root: HTMLDivElement }) => {
991
991
  <div
992
992
  role='none'
993
993
  style={bounds}
994
- className='z-10 absolute pointer-events-none bg-primary-500/20 border border-primary-500/50'
994
+ className='z-10 absolute pointer-events-none bg-gridSelectionOverlay border border-gridOverlay'
995
995
  />
996
996
  );
997
997
  };
@@ -1099,7 +1099,7 @@ const SheetStatusBar = () => {
1099
1099
  {(range && rangeToA1Notation(range)) || (cursor && addressToA1Notation(cursor))}
1100
1100
  </div>
1101
1101
  <div className='flex gap-2 items-center'>
1102
- <FunctionIcon className={mx('text-green-500', isFormula ? 'visible' : 'invisible')} />
1102
+ <FunctionIcon className={mx('text-greenText', isFormula ? 'visible' : 'invisible')} />
1103
1103
  <span className='font-mono'>{value}</span>
1104
1104
  </div>
1105
1105
  </div>
@@ -51,7 +51,7 @@ export class FormattingModel {
51
51
  case ValueTypeEnum.Boolean: {
52
52
  return {
53
53
  value: (value as boolean).toLocaleString().toUpperCase(),
54
- classNames: [...classNames, value ? '!text-green-500' : '!text-orange-500'],
54
+ classNames: [...classNames, value ? '!text-greenText' : '!text-orangeText'],
55
55
  };
56
56
  }
57
57
 
@@ -14,6 +14,7 @@ const SheetContainer = ({
14
14
  space,
15
15
  role,
16
16
  coordinate = { part: 'main', entryId: '' },
17
+ remoteFunctionUrl,
17
18
  }: SheetRootProps & { role?: string; coordinate?: LayoutCoordinate }) => {
18
19
  return (
19
20
  <div
@@ -25,7 +26,7 @@ const SheetContainer = ({
25
26
  coordinate.part !== 'solo' && 'border-is border-separator',
26
27
  )}
27
28
  >
28
- <Sheet.Root sheet={sheet} space={space}>
29
+ <Sheet.Root sheet={sheet} space={space} remoteFunctionUrl={remoteFunctionUrl}>
29
30
  <Sheet.Main />
30
31
  </Sheet.Root>
31
32
  </div>
package/src/testing.ts ADDED
@@ -0,0 +1,50 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type ComputeGraph, createComputeGraph } from './components';
6
+ import { SheetModel } from './model';
7
+ import { createSheet, type CellValue } from './types';
8
+
9
+ export const testSheetName = 'test';
10
+
11
+ export const createCells = (): Record<string, CellValue> => ({
12
+ B1: { value: 'Qty' },
13
+ B3: { value: 1 },
14
+ B4: { value: 2 },
15
+ B5: { value: 3 },
16
+ B7: { value: 'Total' },
17
+
18
+ C1: { value: 'Price' },
19
+ C3: { value: 2_000 },
20
+ C4: { value: 2_500 },
21
+ C5: { value: 3_000 },
22
+ C7: { value: '=SUMPRODUCT(B2:B6, C2:C6)' },
23
+ // C8: { value: '=C7*CRYPTO(D7)' },
24
+ C8: { value: '=C7*TEST()' },
25
+
26
+ D7: { value: 'USD' },
27
+ D8: { value: 'BTC' },
28
+
29
+ E3: { value: '=TODAY()' },
30
+ E4: { value: '=NOW()' },
31
+
32
+ F1: { value: `=${testSheetName}!A1` }, // Ref test sheet.
33
+ F3: { value: true },
34
+ F4: { value: false },
35
+ F5: { value: '8%' },
36
+ F6: { value: '$10000' },
37
+ });
38
+
39
+ export const createTestSheet = async ({
40
+ name,
41
+ graph = createComputeGraph(),
42
+ }: { name?: string; graph?: ComputeGraph } = {}) => {
43
+ const sheet = createSheet(name);
44
+ const model = new SheetModel(graph, sheet);
45
+ await model.initialize();
46
+ model.setValues(createCells());
47
+ model.sheet.columnMeta[model.sheet.columns[0]] = { size: 100 };
48
+ await model.destroy();
49
+ return sheet;
50
+ };
package/src/types.ts CHANGED
@@ -83,6 +83,8 @@ export const RowColumnMeta = S.Struct({
83
83
  });
84
84
 
85
85
  // TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
86
+ // TODO(wittjosiah): Migrate typename to remove `Type` suffix.
87
+ // TODO(wittjosiah): Rename title to name to align with other schemas.
86
88
  export class SheetType extends TypedObject({ typename: 'dxos.org/type/SheetType', version: '0.1.0' })({
87
89
  title: S.optional(S.String),
88
90