@dxos/plugin-sheet 0.9.0 → 0.9.1-staging.ee54ba693a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/neutral/RangeList-EIJTFS7P.mjs +53 -0
- package/dist/lib/neutral/RangeList-EIJTFS7P.mjs.map +7 -0
- package/dist/lib/neutral/{SheetArticle-5AJRM3V3.mjs → SheetArticle-IUPQYGUU.mjs} +3 -2
- package/dist/lib/neutral/SheetArticle-IUPQYGUU.mjs.map +7 -0
- package/dist/lib/neutral/SheetPlugin.mjs +5 -7
- package/dist/lib/neutral/SheetPlugin.mjs.map +4 -4
- package/dist/lib/neutral/capabilities/index.mjs +6 -8
- package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
- package/dist/lib/neutral/{chunk-KUWATEHB.mjs → chunk-HY4DM35G.mjs} +101 -9
- package/dist/lib/neutral/chunk-HY4DM35G.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TDGEOMRG.mjs +8 -0
- package/dist/lib/neutral/{chunk-BGR7FVNF.mjs.map → chunk-TDGEOMRG.mjs.map} +2 -2
- package/dist/lib/neutral/chunk-WTSCOM64.mjs +45 -0
- package/dist/lib/neutral/chunk-WTSCOM64.mjs.map +7 -0
- package/dist/lib/neutral/{comment-config-WGXXX5FG.mjs → comment-config-4CIQFYM2.mjs} +1 -1
- package/dist/lib/neutral/comment-config-4CIQFYM2.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +14 -14
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +2 -2
- package/dist/lib/neutral/create-I3TKMPQO.mjs +30 -0
- package/dist/lib/neutral/create-I3TKMPQO.mjs.map +7 -0
- package/dist/lib/neutral/{create-object-TDQQ24IB.mjs → create-object-5WEY5XZJ.mjs} +2 -6
- package/dist/lib/neutral/create-object-5WEY5XZJ.mjs.map +7 -0
- package/dist/lib/neutral/{drop-axis-WSWFOLQN.mjs → drop-axis-JPFU5CJO.mjs} +2 -2
- package/dist/lib/neutral/get-values-7YWQTH65.mjs +92 -0
- package/dist/lib/neutral/get-values-7YWQTH65.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +3 -9
- package/dist/lib/neutral/{insert-axis-6UQJTIWC.mjs → insert-axis-WD6ZC3UA.mjs} +2 -2
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{react-surface-4H3PC4WG.mjs → react-surface-TJT6F2E4.mjs} +2 -6
- package/dist/lib/neutral/react-surface-TJT6F2E4.mjs.map +7 -0
- package/dist/lib/neutral/{restore-axis-AMMVTPS3.mjs → restore-axis-RLPX7P3G.mjs} +2 -2
- package/dist/lib/neutral/{scroll-to-anchor-FK2CXCQR.mjs → scroll-to-anchor-6FJJQWZC.mjs} +2 -2
- package/dist/lib/neutral/set-values-5DVOVLJH.mjs +30 -0
- package/dist/lib/neutral/set-values-5DVOVLJH.mjs.map +7 -0
- package/dist/lib/neutral/skill-definition-U3KQCFOI.mjs +12 -0
- package/dist/lib/neutral/skill-definition-U3KQCFOI.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +1 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +1 -1
- package/dist/lib/neutral/{undo-mappings-3FQLSTCZ.mjs → undo-mappings-O75AYIRG.mjs} +2 -2
- package/dist/lib/neutral/{undo-mappings-3FQLSTCZ.mjs.map → undo-mappings-O75AYIRG.mjs.map} +3 -3
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +1 -2
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/comment-config.d.ts +1 -2
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -7
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +9 -16
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown-extension.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +1 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/undo-mappings.d.ts +2 -2
- package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts +1 -1
- package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +32 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +1 -25
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/get-values.d.ts +5 -0
- package/dist/types/src/operations/get-values.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/set-values.d.ts +5 -0
- package/dist/types/src/operations/set-values.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/skills/sheet-skill.d.ts +4 -0
- package/dist/types/src/skills/sheet-skill.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +1 -25
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +7 -28
- package/dist/types/src/types/Sheet.d.ts.map +1 -1
- package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/SheetOperation.d.ts +22 -0
- package/dist/types/src/types/SheetOperation.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +31 -0
- package/package.json +61 -54
- package/src/SheetPlugin.test.ts +1 -1
- package/src/SheetPlugin.tsx +4 -6
- package/src/capabilities/comment-config.ts +1 -6
- package/src/capabilities/create-object.ts +1 -4
- package/src/capabilities/index.ts +2 -9
- package/src/capabilities/react-surface.tsx +4 -5
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/capabilities/undo-mappings.ts +1 -1
- package/src/components/Sheet/Sheet.tsx +1 -1
- package/src/components/SheetContent/SheetCellEditor.stories.tsx +2 -2
- package/src/components/SheetContent/SheetContent.tsx +1 -1
- package/src/components/SheetContent/util.ts +7 -7
- package/src/components/SheetToolbar/align.ts +2 -2
- package/src/components/SheetToolbar/style.ts +1 -1
- package/src/containers/RangeList/RangeList.tsx +36 -20
- package/src/containers/SheetArticle/SheetArticle.tsx +2 -2
- package/src/index.ts +0 -1
- package/src/meta.ts +2 -24
- package/src/operations/create.ts +24 -0
- package/src/operations/get-values.ts +83 -0
- package/src/operations/index.ts +3 -0
- package/src/operations/set-values.ts +29 -0
- package/src/skills/index.ts +5 -0
- package/src/skills/sheet-skill.ts +46 -0
- package/src/translations.ts +1 -1
- package/src/types/Sheet.ts +26 -21
- package/src/types/SheetCapabilities.ts +2 -2
- package/src/types/SheetOperation.ts +62 -1
- package/src/types/util.ts +8 -1
- package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs +0 -46
- package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +0 -7
- package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-2QP6GYB2.mjs +0 -67
- package/dist/lib/neutral/app-graph-builder-2QP6GYB2.mjs.map +0 -7
- package/dist/lib/neutral/chunk-BGR7FVNF.mjs +0 -8
- package/dist/lib/neutral/chunk-FQHTXKMF.mjs +0 -34
- package/dist/lib/neutral/chunk-FQHTXKMF.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KUWATEHB.mjs.map +0 -7
- package/dist/lib/neutral/chunk-S2UNH6VD.mjs +0 -10
- package/dist/lib/neutral/chunk-S2UNH6VD.mjs.map +0 -7
- package/dist/lib/neutral/comment-config-WGXXX5FG.mjs.map +0 -7
- package/dist/lib/neutral/create-object-TDQQ24IB.mjs.map +0 -7
- package/dist/lib/neutral/navigation-resolver-FXEZYO7G.mjs +0 -14
- package/dist/lib/neutral/navigation-resolver-FXEZYO7G.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-4H3PC4WG.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -6
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
- package/dist/types/src/paths.d.ts +0 -3
- package/dist/types/src/paths.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -63
- package/src/capabilities/navigation-resolver.ts +0 -16
- package/src/paths.ts +0 -11
- /package/dist/lib/neutral/{drop-axis-WSWFOLQN.mjs.map → drop-axis-JPFU5CJO.mjs.map} +0 -0
- /package/dist/lib/neutral/{insert-axis-6UQJTIWC.mjs.map → insert-axis-WD6ZC3UA.mjs.map} +0 -0
- /package/dist/lib/neutral/{restore-axis-AMMVTPS3.mjs.map → restore-axis-RLPX7P3G.mjs.map} +0 -0
- /package/dist/lib/neutral/{scroll-to-anchor-FK2CXCQR.mjs.map → scroll-to-anchor-6FJJQWZC.mjs.map} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { addressFromA1Notation, addressToA1Notation, isFormula } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { SheetOperation, addressFromIndex, addressToIndex, mapFormulaIndicesToRefs } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof SheetOperation.GetValues> = SheetOperation.GetValues.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fn(function* ({ sheet: sheetRef, range }) {
|
|
16
|
+
const sheet = yield* Database.load(sheetRef);
|
|
17
|
+
|
|
18
|
+
let fromRow: number;
|
|
19
|
+
let fromCol: number;
|
|
20
|
+
let toRow: number;
|
|
21
|
+
let toCol: number;
|
|
22
|
+
|
|
23
|
+
if (range) {
|
|
24
|
+
const [fromPart, toPart = fromPart] = range.split(':');
|
|
25
|
+
const from = addressFromA1Notation(fromPart);
|
|
26
|
+
const to = addressFromA1Notation(toPart);
|
|
27
|
+
fromRow = from.row;
|
|
28
|
+
fromCol = from.col;
|
|
29
|
+
toRow = to.row;
|
|
30
|
+
toCol = to.col;
|
|
31
|
+
} else {
|
|
32
|
+
let minRow = Infinity;
|
|
33
|
+
let minCol = Infinity;
|
|
34
|
+
let maxRow = -1;
|
|
35
|
+
let maxCol = -1;
|
|
36
|
+
for (const key of Object.keys(sheet.cells)) {
|
|
37
|
+
const cellValue = sheet.cells[key]?.value;
|
|
38
|
+
if (cellValue !== undefined && cellValue !== null) {
|
|
39
|
+
const { row, col } = addressFromIndex(sheet, key);
|
|
40
|
+
if (row < minRow) {
|
|
41
|
+
minRow = row;
|
|
42
|
+
}
|
|
43
|
+
if (row > maxRow) {
|
|
44
|
+
maxRow = row;
|
|
45
|
+
}
|
|
46
|
+
if (col < minCol) {
|
|
47
|
+
minCol = col;
|
|
48
|
+
}
|
|
49
|
+
if (col > maxCol) {
|
|
50
|
+
maxCol = col;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
fromRow = minRow === Infinity ? 0 : minRow;
|
|
55
|
+
fromCol = minCol === Infinity ? 0 : minCol;
|
|
56
|
+
toRow = maxRow;
|
|
57
|
+
toCol = maxCol;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (toRow < 0) {
|
|
61
|
+
return { values: [], range: 'A1:A1' };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const values: (unknown | null)[][] = [];
|
|
65
|
+
for (let row = fromRow; row <= toRow; row++) {
|
|
66
|
+
const rowValues: (unknown | null)[] = [];
|
|
67
|
+
for (let col = fromCol; col <= toCol; col++) {
|
|
68
|
+
const idx = addressToIndex(sheet, { row, col });
|
|
69
|
+
const rawValue = sheet.cells[idx]?.value ?? null;
|
|
70
|
+
const value =
|
|
71
|
+
rawValue !== null && isFormula(String(rawValue)) ? mapFormulaIndicesToRefs(sheet, rawValue) : rawValue;
|
|
72
|
+
rowValues.push(value);
|
|
73
|
+
}
|
|
74
|
+
values.push(rowValues);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const actualRange = `${addressToA1Notation({ row: fromRow, col: fromCol })}:${addressToA1Notation({ row: toRow, col: toCol })}`;
|
|
78
|
+
return { values, range: actualRange };
|
|
79
|
+
}),
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export default handler;
|
package/src/operations/index.ts
CHANGED
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
6
|
|
|
7
7
|
export const SheetOperationHandlerSet = OperationHandlerSet.lazy(
|
|
8
|
+
() => import('./create'),
|
|
8
9
|
() => import('./drop-axis'),
|
|
10
|
+
() => import('./get-values'),
|
|
9
11
|
() => import('./insert-axis'),
|
|
10
12
|
() => import('./restore-axis'),
|
|
11
13
|
() => import('./scroll-to-anchor'),
|
|
14
|
+
() => import('./set-values'),
|
|
12
15
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { Database, Obj } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { SheetOperation, addressToIndex, mapFormulaRefsToIndices } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof SheetOperation.SetValues> = SheetOperation.SetValues.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fn(function* ({ sheet: sheetRef, cells }) {
|
|
16
|
+
const sheet = yield* Database.load(sheetRef);
|
|
17
|
+
Obj.update(sheet, (sheet) => {
|
|
18
|
+
for (const [address, value] of Object.entries(cells)) {
|
|
19
|
+
const cell = addressFromA1Notation(address);
|
|
20
|
+
const idx = addressToIndex(sheet, cell);
|
|
21
|
+
const stored = isFormula(String(value)) ? mapFormulaRefsToIndices(sheet, String(value)) : value;
|
|
22
|
+
sheet.cells[idx] = { value: stored };
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export default handler;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Skill, Template } from '@dxos/compute';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
import { Sheet, SheetOperation } from '#types';
|
|
9
|
+
|
|
10
|
+
const operations = [SheetOperation.Create, SheetOperation.GetValues, SheetOperation.SetValues];
|
|
11
|
+
|
|
12
|
+
const make = () =>
|
|
13
|
+
Skill.make({
|
|
14
|
+
key: Sheet.SKILL_KEY,
|
|
15
|
+
name: 'Sheet',
|
|
16
|
+
tools: Skill.toolDefinitions({ operations }),
|
|
17
|
+
agentCanEnable: true,
|
|
18
|
+
instructions: Template.make({
|
|
19
|
+
source: trim`
|
|
20
|
+
You are an expert at working with spreadsheets.
|
|
21
|
+
The context object represents a Sheet — a collaborative spreadsheet backed by ECHO.
|
|
22
|
+
|
|
23
|
+
## Reading data
|
|
24
|
+
|
|
25
|
+
Use the \`getValues\` tool to read cell values from the sheet.
|
|
26
|
+
It returns a 2D array indexed [row][col] and the A1 range it covers.
|
|
27
|
+
Omit the \`range\` parameter to read the entire occupied area, or pass a range like "A1:C5" to read a subset.
|
|
28
|
+
|
|
29
|
+
## Writing data
|
|
30
|
+
|
|
31
|
+
Use \`setValues\` to write one or more cells at once.
|
|
32
|
+
Pass a map of A1 addresses to values, e.g. \`{ "A1": "Name", "B1": 42, "C1": "=SUM(A1:A5)" }\`.
|
|
33
|
+
Cell values can be plain scalars (string, number, boolean) or formula strings starting with "=".
|
|
34
|
+
Formula examples: "=SUM(A1:A5)", "=A1*B1", "=IF(C2>0,\"yes\",\"no\")".
|
|
35
|
+
Over 400 HyperFormula functions are available: arithmetic, statistical, text, date/time, financial, logical.
|
|
36
|
+
|
|
37
|
+
`,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const skill: Skill.Definition = {
|
|
42
|
+
key: Sheet.SKILL_KEY,
|
|
43
|
+
make,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default skill;
|
package/src/translations.ts
CHANGED
package/src/types/Sheet.ts
CHANGED
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
+
import { AppAnnotation } from '@dxos/app-toolkit';
|
|
9
10
|
import { addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
|
|
10
|
-
import {
|
|
11
|
+
import { Annotation, DXN, Obj, Type } from '@dxos/echo';
|
|
11
12
|
import { FormInputAnnotation } from '@dxos/echo/Annotation';
|
|
13
|
+
import { CollectionItemAnnotation } from '@dxos/schema';
|
|
12
14
|
|
|
13
15
|
import { addressToIndex, initialize, mapFormulaRefsToIndices } from './util';
|
|
14
16
|
|
|
17
|
+
export const SKILL_KEY = 'org.dxos.skill.sheet';
|
|
18
|
+
|
|
15
19
|
export type SheetSize = {
|
|
16
20
|
rows: number;
|
|
17
21
|
columns: number;
|
|
@@ -42,32 +46,33 @@ export const RowColumnMeta = Schema.Struct({
|
|
|
42
46
|
|
|
43
47
|
// TODO(burdon): Reconcile col/column (across packages).
|
|
44
48
|
// TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Sparse map of cells referenced by index.
|
|
49
|
-
cells: Schema.Record({ key: Schema.String, value: CellValue }).pipe(FormInputAnnotation.set(false)),
|
|
49
|
+
export class Sheet extends Type.makeObject<Sheet>(DXN.make('org.dxos.type.sheet', '0.1.0'))(
|
|
50
|
+
Schema.Struct({
|
|
51
|
+
name: Schema.optional(Schema.String),
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
// Sparse map of cells referenced by index.
|
|
54
|
+
cells: Schema.Record({ key: Schema.String, value: CellValue }).pipe(FormInputAnnotation.set(false)),
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// Ordered row indices.
|
|
57
|
+
rows: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
// Ordered column indices.
|
|
60
|
+
columns: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
// Row metadata referenced by index.
|
|
63
|
+
rowMeta: Schema.Record({ key: Schema.String, value: RowColumnMeta }).pipe(FormInputAnnotation.set(false)),
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}).pipe(
|
|
66
|
-
Annotation.IconAnnotation.set({ icon: 'ph--grid-nine--regular', hue: 'indigo' }),
|
|
67
|
-
Type.makeObject(DXN.make('org.dxos.type.sheet', '0.1.0')),
|
|
68
|
-
);
|
|
65
|
+
// Column metadata referenced by index.
|
|
66
|
+
columnMeta: Schema.Record({ key: Schema.String, value: RowColumnMeta }).pipe(FormInputAnnotation.set(false)),
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
// Cell formatting referenced by indexed range.
|
|
69
|
+
ranges: Schema.Array(Range).pipe(FormInputAnnotation.set(false)),
|
|
70
|
+
}).pipe(
|
|
71
|
+
Annotation.IconAnnotation.set({ icon: 'ph--grid-nine--regular', hue: 'indigo' }),
|
|
72
|
+
AppAnnotation.SkillsAnnotation.set([SKILL_KEY]),
|
|
73
|
+
CollectionItemAnnotation.set(true),
|
|
74
|
+
),
|
|
75
|
+
) {}
|
|
71
76
|
|
|
72
77
|
export type SheetProps = {
|
|
73
78
|
name?: string;
|
|
@@ -19,8 +19,8 @@ export type GridRegistry = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const ComputeGraphRegistry = Capability.make<ComputeGraphRegistryType>(
|
|
22
|
-
`${meta.
|
|
22
|
+
`${meta.profile.key}.capability.compute-graph-registry`,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
/** Registry of active grid instances keyed by attendable ID. */
|
|
26
|
-
export const GridInstances = Capability.make<GridRegistry>(`${meta.
|
|
26
|
+
export const GridInstances = Capability.make<GridRegistry>(`${meta.profile.key}.capability.grid-instances`);
|
|
@@ -8,11 +8,14 @@ import * as Schema from 'effect/Schema';
|
|
|
8
8
|
|
|
9
9
|
import { Capability } from '@dxos/app-framework';
|
|
10
10
|
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Database, Ref } from '@dxos/echo';
|
|
11
12
|
import { DXN } from '@dxos/keys';
|
|
12
13
|
|
|
13
14
|
import { meta } from '#meta';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
import * as Sheet from './Sheet';
|
|
17
|
+
|
|
18
|
+
const makeKey = (name: string) => DXN.make(`${meta.profile.key}.operation.${name}`);
|
|
16
19
|
|
|
17
20
|
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
18
21
|
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
@@ -63,6 +66,64 @@ export const ScrollToAnchor = Operation.make({
|
|
|
63
66
|
output: Schema.Void,
|
|
64
67
|
});
|
|
65
68
|
|
|
69
|
+
export const Create = Operation.make({
|
|
70
|
+
meta: {
|
|
71
|
+
key: DXN.make('org.dxos.function.sheet.create'),
|
|
72
|
+
name: 'Create',
|
|
73
|
+
description: 'Creates a new sheet and adds it to the space.',
|
|
74
|
+
icon: 'ph--grid-nine--regular',
|
|
75
|
+
},
|
|
76
|
+
input: Schema.Struct({
|
|
77
|
+
name: Schema.optional(Schema.String).annotations({ description: 'Display name for the sheet.' }),
|
|
78
|
+
rows: Schema.optional(Schema.Number).annotations({ description: 'Initial number of rows (default 50).' }),
|
|
79
|
+
columns: Schema.optional(Schema.Number).annotations({ description: 'Initial number of columns (default 26).' }),
|
|
80
|
+
}),
|
|
81
|
+
output: Schema.Struct({
|
|
82
|
+
id: Schema.String.annotations({ description: 'The DXN of the created sheet.' }),
|
|
83
|
+
}),
|
|
84
|
+
services: [Database.Service],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const GetValues = Operation.make({
|
|
88
|
+
meta: {
|
|
89
|
+
key: makeKey('rangeGet'),
|
|
90
|
+
name: 'Get Range Values',
|
|
91
|
+
description: 'Returns cell values from a sheet as a 2D array. Defaults to the entire occupied area.',
|
|
92
|
+
icon: 'ph--table--regular',
|
|
93
|
+
},
|
|
94
|
+
input: Schema.Struct({
|
|
95
|
+
sheet: Ref.Ref(Sheet.Sheet).annotations({ description: 'The sheet to read from.' }),
|
|
96
|
+
range: Schema.optional(Schema.String).annotations({
|
|
97
|
+
description: 'Range in A1 notation (e.g. "A1:C5"). Omit to return the entire occupied area.',
|
|
98
|
+
}),
|
|
99
|
+
}),
|
|
100
|
+
output: Schema.Struct({
|
|
101
|
+
values: Schema.Array(Schema.Array(Schema.Any)).annotations({
|
|
102
|
+
description:
|
|
103
|
+
'2D array of cell values indexed [row][col]. Empty cells are null. Formulas are shown in A1 notation.',
|
|
104
|
+
}),
|
|
105
|
+
range: Schema.String.annotations({ description: 'The A1 range actually returned (e.g. "A1:E5").' }),
|
|
106
|
+
}),
|
|
107
|
+
services: [Database.Service],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export const SetValues = Operation.make({
|
|
111
|
+
meta: {
|
|
112
|
+
key: makeKey('rangeSet'),
|
|
113
|
+
name: 'Set Range Values',
|
|
114
|
+
description: 'Sets multiple cell values in a sheet at once.',
|
|
115
|
+
icon: 'ph--pencil--regular',
|
|
116
|
+
},
|
|
117
|
+
input: Schema.Struct({
|
|
118
|
+
sheet: Ref.Ref(Sheet.Sheet).annotations({ description: 'The sheet to write to.' }),
|
|
119
|
+
cells: Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
|
|
120
|
+
description: 'Map of A1 address to value (e.g. { "A1": "Name", "B1": 42, "C1": "=A1+B1" }).',
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
output: Schema.Void,
|
|
124
|
+
services: [Database.Service],
|
|
125
|
+
});
|
|
126
|
+
|
|
66
127
|
/**
|
|
67
128
|
* Restore a dropped axis (inverse of DropAxis).
|
|
68
129
|
*/
|
package/src/types/util.ts
CHANGED
|
@@ -124,7 +124,14 @@ export const compareIndexPositions = (sheet: Sheet.Sheet, indexA: string, indexB
|
|
|
124
124
|
export const mapFormulaRefsToIndices = (sheet: Sheet.Sheet, formula: string): string => {
|
|
125
125
|
assertArgument(isFormula(formula), 'formula');
|
|
126
126
|
return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
|
|
127
|
-
|
|
127
|
+
const cell = addressFromA1Notation(match);
|
|
128
|
+
// Skip tokens whose parsed address falls outside the sheet bounds or is negative — they are
|
|
129
|
+
// function names (e.g. LOG10, ATAN2) or malformed refs (e.g. A0 → row -1) rather than valid
|
|
130
|
+
// cell references.
|
|
131
|
+
if (cell.col < 0 || cell.row < 0 || cell.col >= sheet.columns.length || cell.row >= sheet.rows.length) {
|
|
132
|
+
return match;
|
|
133
|
+
}
|
|
134
|
+
return addressToIndex(sheet, cell);
|
|
128
135
|
});
|
|
129
136
|
};
|
|
130
137
|
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/containers/RangeList/RangeList.tsx
|
|
4
|
-
import * as Schema from "effect/Schema";
|
|
5
|
-
import React, { useCallback } from "react";
|
|
6
|
-
import { rangeToA1Notation } from "@dxos/compute-hyperformula";
|
|
7
|
-
import { useObject } from "@dxos/echo-react";
|
|
8
|
-
import { Input, Message, useTranslation } from "@dxos/react-ui";
|
|
9
|
-
import { List } from "@dxos/react-ui-list";
|
|
10
|
-
import { meta } from "#meta";
|
|
11
|
-
import { rangeFromIndex } from "#types";
|
|
12
|
-
import { Sheet } from "#types";
|
|
13
|
-
var RangeList = ({ sheet: sheetProp }) => {
|
|
14
|
-
const { t } = useTranslation(meta.id);
|
|
15
|
-
const [sheet, updateSheet] = useObject(sheetProp);
|
|
16
|
-
const handleSelectRange = (range) => {
|
|
17
|
-
};
|
|
18
|
-
const handleDeleteRange = useCallback((range) => {
|
|
19
|
-
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
20
|
-
updateSheet((sheet2) => {
|
|
21
|
-
sheet2.ranges.splice(index, 1);
|
|
22
|
-
});
|
|
23
|
-
}, [
|
|
24
|
-
sheet,
|
|
25
|
-
updateSheet
|
|
26
|
-
]);
|
|
27
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("range-list.heading"))), sheet.ranges.length < 1 ? /* @__PURE__ */ React.createElement(Message.Root, null, /* @__PURE__ */ React.createElement(Message.Title, null, t("no-ranges.message"))) : /* @__PURE__ */ React.createElement(List.Root, {
|
|
28
|
-
items: sheet.ranges,
|
|
29
|
-
isItem: Schema.is(Sheet.Range)
|
|
30
|
-
}, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ React.createElement(List.Item, {
|
|
31
|
-
key: i,
|
|
32
|
-
item: range
|
|
33
|
-
}, /* @__PURE__ */ React.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React.createElement(List.ItemTitle, {
|
|
34
|
-
onClick: () => handleSelectRange(range)
|
|
35
|
-
}, t("range.title", {
|
|
36
|
-
position: rangeToA1Notation(rangeFromIndex(sheetProp, range.range)),
|
|
37
|
-
key: t(`range-key.${range.key}.label`),
|
|
38
|
-
value: t(`range-value.${range.value}.label`)
|
|
39
|
-
})), /* @__PURE__ */ React.createElement(List.ItemDeleteButton, {
|
|
40
|
-
onClick: () => handleDeleteRange(range)
|
|
41
|
-
})))));
|
|
42
|
-
};
|
|
43
|
-
export {
|
|
44
|
-
RangeList as default
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=RangeList-HYB5S6KQ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/RangeList/RangeList.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback } from 'react';\n\nimport { rangeToA1Notation } from '@dxos/compute-hyperformula';\nimport { useObject } from '@dxos/echo-react';\nimport { Input, Message, useTranslation } from '@dxos/react-ui';\nimport { List } from '@dxos/react-ui-list';\n\nimport { meta } from '#meta';\nimport { rangeFromIndex } from '#types';\nimport { Sheet } from '#types';\n\nexport type RangeListProps = {\n sheet: Sheet.Sheet;\n};\n\nexport const RangeList = ({ sheet: sheetProp }: RangeListProps) => {\n const { t } = useTranslation(meta.id);\n const [sheet, updateSheet] = useObject(sheetProp);\n // TODO(thure): Implement similar to comments, #8121\n const handleSelectRange = (range: Sheet.Range) => {};\n const handleDeleteRange = useCallback(\n (range: Sheet.Range) => {\n const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);\n updateSheet((sheet) => {\n sheet.ranges.splice(index, 1);\n });\n },\n [sheet, updateSheet],\n );\n return (\n <>\n <Input.Root>\n <Input.Label>{t('range-list.heading')}</Input.Label>\n </Input.Root>\n {sheet.ranges.length < 1 ? (\n <Message.Root>\n <Message.Title>{t('no-ranges.message')}</Message.Title>\n </Message.Root>\n ) : (\n <List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>\n {({ items: ranges }) =>\n ranges.map((range, i) => (\n <List.Item key={i} item={range}>\n <List.ItemDragHandle />\n <List.ItemTitle onClick={() => handleSelectRange(range)}>\n {t('range.title', {\n position: rangeToA1Notation(rangeFromIndex(sheetProp, range.range)),\n key: t(`range-key.${range.key}.label`),\n value: t(`range-value.${range.value}.label`),\n })}\n </List.ItemTitle>\n <List.ItemDeleteButton onClick={() => handleDeleteRange(range)} />\n </List.Item>\n ))\n }\n </List.Root>\n )}\n </>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,OAAOC,SAASC,sBAAsB;AAC/C,SAASC,YAAY;AAErB,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AAMf,IAAMC,YAAY,CAAC,EAAEC,OAAOC,UAAS,MAAkB;AAC5D,QAAM,EAAEC,EAAC,IAAKR,eAAeE,KAAKO,EAAE;AACpC,QAAM,CAACH,OAAOI,WAAAA,IAAeb,UAAUU,SAAAA;AAEvC,QAAMI,oBAAoB,CAACC,UAAAA;EAAwB;AACnD,QAAMC,oBAAoBlB,YACxB,CAACiB,UAAAA;AACC,UAAME,QAAQR,MAAMS,OAAOC,UAAU,CAACC,eAAeA,eAAeL,KAAAA;AACpEF,gBAAY,CAACJ,WAAAA;AACXA,MAAAA,OAAMS,OAAOG,OAAOJ,OAAO,CAAA;IAC7B,CAAA;EACF,GACA;IAACR;IAAOI;GAAY;AAEtB,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACZ,MAAMqB,MAAI,MACT,sBAAA,cAACrB,MAAMsB,OAAK,MAAEZ,EAAE,oBAAA,CAAA,CAAA,GAEjBF,MAAMS,OAAOM,SAAS,IACrB,sBAAA,cAACtB,QAAQoB,MAAI,MACX,sBAAA,cAACpB,QAAQuB,OAAK,MAAEd,EAAE,mBAAA,CAAA,CAAA,IAGpB,sBAAA,cAACP,KAAKkB,MAAI;IAAcI,OAAOjB,MAAMS;IAAQS,QAAeC,UAAGrB,MAAMsB,KAAK;KACvE,CAAC,EAAEH,OAAOR,OAAM,MACfA,OAAOY,IAAI,CAACf,OAAOgB,MACjB,sBAAA,cAAC3B,KAAK4B,MAAI;IAACC,KAAKF;IAAGG,MAAMnB;KACvB,sBAAA,cAACX,KAAK+B,gBAAc,IAAA,GACpB,sBAAA,cAAC/B,KAAKgC,WAAS;IAACC,SAAS,MAAMvB,kBAAkBC,KAAAA;KAC9CJ,EAAE,eAAe;IAChB2B,UAAUvC,kBAAkBO,eAAeI,WAAWK,MAAMA,KAAK,CAAA;IACjEkB,KAAKtB,EAAE,aAAaI,MAAMkB,GAAG,QAAQ;IACrCM,OAAO5B,EAAE,eAAeI,MAAMwB,KAAK,QAAQ;EAC7C,CAAA,CAAA,GAEF,sBAAA,cAACnC,KAAKoC,kBAAgB;IAACH,SAAS,MAAMrB,kBAAkBD,KAAAA;;AAQxE;",
|
|
6
|
-
"names": ["Schema", "React", "useCallback", "rangeToA1Notation", "useObject", "Input", "Message", "useTranslation", "List", "meta", "rangeFromIndex", "Sheet", "RangeList", "sheet", "sheetProp", "t", "id", "updateSheet", "handleSelectRange", "range", "handleDeleteRange", "index", "ranges", "findIndex", "sheetRange", "splice", "Root", "Label", "length", "Title", "items", "isItem", "is", "Range", "map", "i", "Item", "key", "item", "ItemDragHandle", "ItemTitle", "onClick", "position", "value", "ItemDeleteButton"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/SheetArticle/SheetArticle.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { type ComputeGraphRegistry } from '@dxos/compute-hyperformula';\nimport { type Space } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { ComputeGraphContextProvider, Sheet, useComputeGraph } from '#components';\nimport { type Sheet as SheetType } from '#types';\n\nexport type SheetArticleProps = AppSurface.ObjectArticleProps<\n SheetType.Sheet,\n {\n space: Space;\n registry: ComputeGraphRegistry;\n ignoreAttention?: boolean;\n }\n>;\n\nexport const SheetArticle = ({ registry, ...props }: SheetArticleProps) => (\n <ComputeGraphContextProvider registry={registry}>\n <SheetArticleInner {...props} />\n </ComputeGraphContextProvider>\n);\n\nconst SheetArticleInner = ({\n role,\n subject: sheet,\n attendableId,\n space,\n ignoreAttention,\n}: Omit<SheetArticleProps, 'registry'>) => {\n const graph = useComputeGraph(space);\n if (!graph) {\n return null;\n }\n\n return (\n <Sheet.Root graph={graph} sheet={sheet} attendableId={attendableId!} ignoreAttention={ignoreAttention}>\n <Panel.Root classNames={role === 'section' && 'aspect-aquare'}>\n <Panel.Toolbar asChild>\n <Sheet.Toolbar />\n </Panel.Toolbar>\n <Panel.Content asChild>\n <Sheet.Content />\n </Panel.Content>\n <Panel.Statusbar asChild>\n <Sheet.Statusbar />\n </Panel.Statusbar>\n </Panel.Root>\n </Sheet.Root>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,OAAOA,WAAW;AAKlB,SAASC,aAAa;AAEtB,SAASC,6BAA6BC,OAAOC,uBAAuB;AAY7D,IAAMC,eAAe,CAAC,EAAEC,UAAU,GAAGC,MAAAA,MAC1C,sBAAA,cAACL,6BAAAA;EAA4BI;GAC3B,sBAAA,cAACE,mBAAsBD,KAAAA,CAAAA;AAI3B,IAAMC,oBAAoB,CAAC,EACzBC,MACAC,SAASC,OACTC,cACAC,OACAC,gBAAe,MACqB;AACpC,QAAMC,QAAQX,gBAAgBS,KAAAA;AAC9B,MAAI,CAACE,OAAO;AACV,WAAO;EACT;AAEA,SACE,sBAAA,cAACZ,MAAMa,MAAI;IAACD;IAAcJ;IAAcC;IAA6BE;KACnE,sBAAA,cAACb,MAAMe,MAAI;IAACC,YAAYR,SAAS,aAAa;KAC5C,sBAAA,cAACR,MAAMiB,SAAO;IAACC,SAAAA;KACb,sBAAA,cAAChB,MAAMe,SAAO,IAAA,CAAA,GAEhB,sBAAA,cAACjB,MAAMmB,SAAO;IAACD,SAAAA;KACb,sBAAA,cAAChB,MAAMiB,SAAO,IAAA,CAAA,GAEhB,sBAAA,cAACnB,MAAMoB,WAAS;IAACF,SAAAA;KACf,sBAAA,cAAChB,MAAMkB,WAAS,IAAA,CAAA,CAAA,CAAA;AAK1B;",
|
|
6
|
-
"names": ["React", "Panel", "ComputeGraphContextProvider", "Sheet", "useComputeGraph", "SheetArticle", "registry", "props", "SheetArticleInner", "role", "subject", "sheet", "attendableId", "space", "ignoreAttention", "graph", "Root", "classNames", "Toolbar", "asChild", "Content", "Statusbar"]
|
|
7
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSheetsPath
|
|
3
|
-
} from "./chunk-S2UNH6VD.mjs";
|
|
4
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/app-graph-builder.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import * as Option from "effect/Option";
|
|
9
|
-
import { Capability } from "@dxos/app-framework";
|
|
10
|
-
import { AppCapabilities, LayoutOperation, createTypeSectionExtension } from "@dxos/app-toolkit";
|
|
11
|
-
import { isSpace } from "@dxos/client/echo";
|
|
12
|
-
import { Operation } from "@dxos/compute";
|
|
13
|
-
import { Type } from "@dxos/echo";
|
|
14
|
-
import { GraphBuilder, Node } from "@dxos/plugin-graph";
|
|
15
|
-
import { SpaceOperation } from "@dxos/plugin-space";
|
|
16
|
-
import { Sheet } from "#types";
|
|
17
|
-
var sheetTypename = Type.getTypename(Sheet.Sheet);
|
|
18
|
-
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
19
|
-
const extensions = yield* Effect.all([
|
|
20
|
-
createTypeSectionExtension(Sheet.Sheet),
|
|
21
|
-
GraphBuilder.createExtension({
|
|
22
|
-
id: "sheetsSectionActions",
|
|
23
|
-
match: (node) => {
|
|
24
|
-
const space = isSpace(node.properties.space) ? node.properties.space : void 0;
|
|
25
|
-
return node.type === sheetTypename && space ? Option.some(space) : Option.none();
|
|
26
|
-
},
|
|
27
|
-
actions: (space) => Effect.succeed([
|
|
28
|
-
Node.makeAction({
|
|
29
|
-
id: "create-sheet",
|
|
30
|
-
data: () => Effect.gen(function* () {
|
|
31
|
-
const sheet = Sheet.make({});
|
|
32
|
-
const { subject } = yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
33
|
-
object: sheet,
|
|
34
|
-
target: space.db,
|
|
35
|
-
hidden: true,
|
|
36
|
-
targetNodeId: getSheetsPath(space.db.spaceId)
|
|
37
|
-
}, {
|
|
38
|
-
spaceId: space.db.spaceId
|
|
39
|
-
});
|
|
40
|
-
yield* Operation.invoke(LayoutOperation.Open, {
|
|
41
|
-
subject: [
|
|
42
|
-
...subject
|
|
43
|
-
]
|
|
44
|
-
}, {
|
|
45
|
-
spaceId: space.db.spaceId
|
|
46
|
-
});
|
|
47
|
-
}),
|
|
48
|
-
properties: {
|
|
49
|
-
label: [
|
|
50
|
-
"add-object.label",
|
|
51
|
-
{
|
|
52
|
-
ns: sheetTypename
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
icon: "ph--plus--regular",
|
|
56
|
-
disposition: "list-item-primary"
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
])
|
|
60
|
-
})
|
|
61
|
-
]);
|
|
62
|
-
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
63
|
-
}));
|
|
64
|
-
export {
|
|
65
|
-
app_graph_builder_default as default
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=app-graph-builder-2QP6GYB2.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, LayoutOperation, createTypeSectionExtension } from '@dxos/app-toolkit';\nimport { isSpace } from '@dxos/client/echo';\nimport { Operation } from '@dxos/compute';\nimport { Type } from '@dxos/echo';\nimport { GraphBuilder, Node } from '@dxos/plugin-graph';\nimport { SpaceOperation } from '@dxos/plugin-space';\n\nimport { Sheet } from '#types';\n\nimport { getSheetsPath } from '../paths';\n\nconst sheetTypename = Type.getTypename(Sheet.Sheet);\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n createTypeSectionExtension(Sheet.Sheet),\n\n GraphBuilder.createExtension({\n id: 'sheetsSectionActions',\n match: (node) => {\n const space = isSpace(node.properties.space) ? node.properties.space : undefined;\n return node.type === sheetTypename && space ? Option.some(space) : Option.none();\n },\n actions: (space) =>\n Effect.succeed([\n Node.makeAction({\n id: 'create-sheet',\n data: () =>\n Effect.gen(function* () {\n const sheet = Sheet.make({});\n const { subject } = yield* Operation.invoke(\n SpaceOperation.AddObject,\n { object: sheet, target: space.db, hidden: true, targetNodeId: getSheetsPath(space.db.spaceId) },\n { spaceId: space.db.spaceId },\n );\n yield* Operation.invoke(\n LayoutOperation.Open,\n { subject: [...subject] },\n { spaceId: space.db.spaceId },\n );\n }),\n properties: {\n label: ['add-object.label', { ns: sheetTypename }],\n icon: 'ph--plus--regular',\n disposition: 'list-item-primary',\n },\n }),\n ]),\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,iBAAiBC,kCAAkC;AAC7E,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,YAAY;AACrB,SAASC,cAAcC,YAAY;AACnC,SAASC,sBAAsB;AAE/B,SAASC,aAAa;AAItB,IAAMC,gBAAgBC,KAAKC,YAAYC,MAAMA,KAAK;AAElD,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCC,2BAA2BN,MAAMA,KAAK;IAEtCO,aAAaC,gBAAgB;MAC3BC,IAAI;MACJC,OAAO,CAACC,SAAAA;AACN,cAAMC,QAAQC,QAAQF,KAAKG,WAAWF,KAAK,IAAID,KAAKG,WAAWF,QAAQG;AACvE,eAAOJ,KAAKK,SAASnB,iBAAiBe,QAAeK,YAAKL,KAAAA,IAAgBM,YAAI;MAChF;MACAC,SAAS,CAACP,UACDQ,eAAQ;QACbC,KAAKC,WAAW;UACdb,IAAI;UACJc,MAAM,MACGC,WAAI,aAAA;AACT,kBAAMC,QAAQzB,MAAM0B,KAAK,CAAC,CAAA;AAC1B,kBAAM,EAAEC,QAAO,IAAK,OAAOC,UAAUC,OACnCC,eAAeC,WACf;cAAEC,QAAQP;cAAOQ,QAAQrB,MAAMsB;cAAIC,QAAQ;cAAMC,cAAcC,cAAczB,MAAMsB,GAAGI,OAAO;YAAE,GAC/F;cAAEA,SAAS1B,MAAMsB,GAAGI;YAAQ,CAAA;AAE9B,mBAAOV,UAAUC,OACfU,gBAAgBC,MAChB;cAAEb,SAAS;mBAAIA;;YAAS,GACxB;cAAEW,SAAS1B,MAAMsB,GAAGI;YAAQ,CAAA;UAEhC,CAAA;UACFxB,YAAY;YACV2B,OAAO;cAAC;cAAoB;gBAAEC,IAAI7C;cAAc;;YAChD8C,MAAM;YACNC,aAAa;UACf;QACF,CAAA;OACD;IACL,CAAA;GACD;AAED,SAAO3C,WAAW4C,YAAYC,gBAAgBC,iBAAiB3C,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Option", "Capability", "AppCapabilities", "LayoutOperation", "createTypeSectionExtension", "isSpace", "Operation", "Type", "GraphBuilder", "Node", "SpaceOperation", "Sheet", "sheetTypename", "Type", "getTypename", "Sheet", "Capability", "makeModule", "fnUntraced", "extensions", "all", "createTypeSectionExtension", "GraphBuilder", "createExtension", "id", "match", "node", "space", "isSpace", "properties", "undefined", "type", "some", "none", "actions", "succeed", "Node", "makeAction", "data", "gen", "sheet", "make", "subject", "Operation", "invoke", "SpaceOperation", "AddObject", "object", "target", "db", "hidden", "targetNodeId", "getSheetsPath", "spaceId", "LayoutOperation", "Open", "label", "ns", "icon", "disposition", "contributes", "AppCapabilities", "AppGraphBuilder"]
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// src/operations/index.ts
|
|
2
|
-
import { OperationHandlerSet } from "@dxos/compute";
|
|
3
|
-
var SheetOperationHandlerSet = OperationHandlerSet.lazy(() => import("./drop-axis-WSWFOLQN.mjs"), () => import("./insert-axis-6UQJTIWC.mjs"), () => import("./restore-axis-AMMVTPS3.mjs"), () => import("./scroll-to-anchor-FK2CXCQR.mjs"));
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
SheetOperationHandlerSet
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=chunk-BGR7FVNF.mjs.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { Plugin } from "@dxos/app-framework";
|
|
3
|
-
import { DXN } from "@dxos/keys";
|
|
4
|
-
import { trim } from "@dxos/util";
|
|
5
|
-
var meta = Plugin.makeMeta({
|
|
6
|
-
key: DXN.make("org.dxos.plugin.sheet"),
|
|
7
|
-
name: "Sheet",
|
|
8
|
-
author: "DXOS",
|
|
9
|
-
description: trim`
|
|
10
|
-
Full-featured spreadsheet for DXOS Composer backed by ECHO for local-first, real-time collaborative editing.
|
|
11
|
-
Cells, row/column metadata, and range-based formatting are all stored as ECHO objects and replicated to peers instantly.
|
|
12
|
-
|
|
13
|
-
Formula evaluation is powered by HyperFormula, providing over 400 built-in functions covering arithmetic, statistics,
|
|
14
|
-
text manipulation, date/time, financial, and logical operations. Formulas are stored with internal cell indices and
|
|
15
|
-
translated to A1-notation on display, keeping references stable across row and column insertions.
|
|
16
|
-
|
|
17
|
-
The plugin integrates with plugin-markdown to expose formula results inside document fenced code blocks, and
|
|
18
|
-
contributes anchor-navigation support so other plugins can scroll and highlight specific cell ranges by DXN reference.
|
|
19
|
-
AI agents can invoke sheet operations — insert/drop axes, scroll to anchor, and read or write cell values — through
|
|
20
|
-
the standard operations framework.
|
|
21
|
-
`,
|
|
22
|
-
icon: "ph--grid-nine--regular",
|
|
23
|
-
iconHue: "indigo",
|
|
24
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet",
|
|
25
|
-
spec: "PLUGIN.mdl",
|
|
26
|
-
screenshots: [
|
|
27
|
-
"https://dxos.network/plugin-details-sheet-dark.png"
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
meta
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=chunk-FQHTXKMF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\nimport { trim } from '@dxos/util';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.sheet'),\n name: 'Sheet',\n author: 'DXOS',\n description: trim`\n Full-featured spreadsheet for DXOS Composer backed by ECHO for local-first, real-time collaborative editing.\n Cells, row/column metadata, and range-based formatting are all stored as ECHO objects and replicated to peers instantly.\n\n Formula evaluation is powered by HyperFormula, providing over 400 built-in functions covering arithmetic, statistics,\n text manipulation, date/time, financial, and logical operations. Formulas are stored with internal cell indices and\n translated to A1-notation on display, keeping references stable across row and column insertions.\n\n The plugin integrates with plugin-markdown to expose formula results inside document fenced code blocks, and\n contributes anchor-navigation support so other plugins can scroll and highlight specific cell ranges by DXN reference.\n AI agents can invoke sheet operations — insert/drop axes, scroll to anchor, and read or write cell values — through\n the standard operations framework.\n `,\n icon: 'ph--grid-nine--regular',\n iconHue: 'indigo',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet',\n spec: 'PLUGIN.mdl',\n screenshots: ['https://dxos.network/plugin-details-sheet-dark.png'],\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,YAAY;AAEd,IAAMC,OAAOH,OAAOI,SAAS;EAClCC,KAAKJ,IAAIK,KAAK,uBAAA;EACdC,MAAM;EACNC,QAAQ;EACRC,aAAaP;;;;;;;;;;;;;EAabQ,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;EACNC,aAAa;IAAC;;AAChB,CAAA;",
|
|
6
|
-
"names": ["Plugin", "DXN", "trim", "meta", "makeMeta", "key", "make", "name", "author", "description", "icon", "iconHue", "source", "spec", "screenshots"]
|
|
7
|
-
}
|