@pixerate/editor 0.152.0 → 0.154.0
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/animation-editor/index.cjs +4 -4
- package/dist/animation-editor/index.js +4 -4
- package/dist/canvas/editorDocument.d.cts +59 -0
- package/dist/canvas/editorDocument.d.ts +59 -0
- package/dist/canvas/index.cjs +127 -14
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +114 -1
- package/dist/chart/index.cjs +3 -3
- package/dist/chart/index.js +3 -3
- package/dist/{chunk-VGJTUCWM.js → chunk-4J4MC3F5.js} +72 -5
- package/dist/{chunk-LFKLA7RC.js → chunk-BCY22GBH.js} +39 -1
- package/dist/{chunk-2ZO4RSDS.cjs → chunk-HVX35M2I.cjs} +39 -1
- package/dist/{chunk-QSM3MDDJ.cjs → chunk-XFDQEAOS.cjs} +92 -25
- package/dist/image-editor/index.cjs +3 -3
- package/dist/image-editor/index.js +3 -3
- package/dist/index.cjs +41 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -1
- package/dist/richTextDocument.d.cts +10 -0
- package/dist/richTextDocument.d.ts +10 -0
- package/dist/spreadsheet/controller.d.cts +17 -4
- package/dist/spreadsheet/controller.d.ts +17 -4
- package/dist/spreadsheet/editorDocument.d.cts +9 -0
- package/dist/spreadsheet/editorDocument.d.ts +9 -0
- package/dist/spreadsheet/index.cjs +7 -2
- package/dist/spreadsheet/index.d.cts +1 -0
- package/dist/spreadsheet/index.d.ts +1 -0
- package/dist/spreadsheet/index.js +6 -1
- package/dist/tokens/editorDocument.d.cts +10 -0
- package/dist/tokens/editorDocument.d.ts +10 -0
- package/dist/tokens/index.cjs +7 -2
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +6 -1
- package/dist/vector/index.cjs +4 -4
- package/dist/vector/index.js +4 -4
- package/dist/video-editor/index.cjs +4 -4
- package/dist/video-editor/index.js +4 -4
- package/package.json +1 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-canvas/SKILL.md +14 -0
- package/skills/pixerate-rich-text/SKILL.md +14 -0
- package/skills/pixerate-spreadsheet/SKILL.md +14 -0
- package/skills/pixerate-tokens/SKILL.md +56 -0
package/dist/canvas/index.js
CHANGED
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
getTokenVariable,
|
|
61
61
|
isTokenInScope,
|
|
62
62
|
resolveToken
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-BCY22GBH.js";
|
|
64
64
|
import {
|
|
65
65
|
DEFAULT_NODE_HEIGHT,
|
|
66
66
|
DEFAULT_NODE_WIDTH,
|
|
@@ -213,6 +213,11 @@ import "../chunk-V2ZCJRDM.js";
|
|
|
213
213
|
import {
|
|
214
214
|
brushstrokeScaleBucket
|
|
215
215
|
} from "../chunk-ODBT55Q7.js";
|
|
216
|
+
import {
|
|
217
|
+
defineEditorDocument
|
|
218
|
+
} from "../chunk-GNV54DLO.js";
|
|
219
|
+
import "../chunk-WHKNYFM2.js";
|
|
220
|
+
import "../chunk-HF5QZS7Z.js";
|
|
216
221
|
import {
|
|
217
222
|
ANIMATION_TIME_EPSILON,
|
|
218
223
|
AnimationPlayer,
|
|
@@ -11690,6 +11695,112 @@ function createCanvasEffectsToolProvider(controller, options = {}) {
|
|
|
11690
11695
|
]
|
|
11691
11696
|
});
|
|
11692
11697
|
}
|
|
11698
|
+
|
|
11699
|
+
// src/canvas/editorDocument.ts
|
|
11700
|
+
var RUNTIME_NODE_KEYS = ["selected", "dragging", "measured", "resizing"];
|
|
11701
|
+
var stripNode = (node) => {
|
|
11702
|
+
const copy = { ...node };
|
|
11703
|
+
for (const key of RUNTIME_NODE_KEYS) delete copy[key];
|
|
11704
|
+
return copy;
|
|
11705
|
+
};
|
|
11706
|
+
var stripEdge = (edge) => {
|
|
11707
|
+
const { selected: _selected, ...rest } = edge;
|
|
11708
|
+
return rest;
|
|
11709
|
+
};
|
|
11710
|
+
function checkCanvasDocument(document2) {
|
|
11711
|
+
const hint = "A canvas document is { nodes: [{ id, position: { x, y }, data }], edges: [{ id, source, target }], scenes? } as get_canvas_document returns it.";
|
|
11712
|
+
const value = document2;
|
|
11713
|
+
if (!value || typeof value !== "object" || !Array.isArray(value.nodes)) throw new Error(`nodes must be an array. ${hint}`);
|
|
11714
|
+
if (!Array.isArray(value.edges)) throw new Error(`edges must be an array. ${hint}`);
|
|
11715
|
+
const ids = /* @__PURE__ */ new Set();
|
|
11716
|
+
value.nodes.forEach((node, i) => {
|
|
11717
|
+
if (!isValidCanvasNode(node)) throw new Error(`nodes[${i}] needs a string id and a numeric position { x, y }. ${hint}`);
|
|
11718
|
+
if (ids.has(node.id)) throw new Error(`Node id "${node.id}" is used twice.`);
|
|
11719
|
+
ids.add(node.id);
|
|
11720
|
+
});
|
|
11721
|
+
value.nodes.forEach((node) => {
|
|
11722
|
+
if (node.parentId !== void 0 && !ids.has(node.parentId)) throw new Error(`Node "${node.id}" has parentId "${node.parentId}", which is not a node in the document.`);
|
|
11723
|
+
});
|
|
11724
|
+
const edgeIds = /* @__PURE__ */ new Set();
|
|
11725
|
+
value.edges.forEach((edge, i) => {
|
|
11726
|
+
if (!isValidCanvasEdge(edge)) throw new Error(`edges[${i}] needs string id, source and target. ${hint}`);
|
|
11727
|
+
if (edgeIds.has(edge.id)) throw new Error(`Edge id "${edge.id}" is used twice.`);
|
|
11728
|
+
edgeIds.add(edge.id);
|
|
11729
|
+
for (const end of [edge.source, edge.target]) {
|
|
11730
|
+
if (!ids.has(end)) throw new Error(`Edge "${edge.id}" connects to "${end}", which is not a node in the document.`);
|
|
11731
|
+
}
|
|
11732
|
+
});
|
|
11733
|
+
if (value.scenes !== void 0 && !Array.isArray(value.scenes)) throw new Error(`scenes must be an array. ${hint}`);
|
|
11734
|
+
}
|
|
11735
|
+
function createCanvasEditorDocument(options) {
|
|
11736
|
+
const { history, scenes: scenes2 } = options;
|
|
11737
|
+
const snapshot = () => ({
|
|
11738
|
+
nodes: options.getNodes().map(stripNode),
|
|
11739
|
+
edges: options.getEdges().map(stripEdge),
|
|
11740
|
+
...scenes2 ? { scenes: scenes2.toJSON().scenes } : {}
|
|
11741
|
+
});
|
|
11742
|
+
const apply = (doc) => {
|
|
11743
|
+
options.setNodes(doc.nodes.map((n3) => ({ ...n3 })));
|
|
11744
|
+
options.setEdges(doc.edges.map((e) => ({ ...e })));
|
|
11745
|
+
if (scenes2) scenes2.load(doc.scenes ?? []);
|
|
11746
|
+
};
|
|
11747
|
+
return defineEditorDocument({
|
|
11748
|
+
kind: "canvas",
|
|
11749
|
+
get: snapshot,
|
|
11750
|
+
load: (document2, { history: mode }) => {
|
|
11751
|
+
checkCanvasDocument(document2);
|
|
11752
|
+
const next = document2;
|
|
11753
|
+
if (mode === "record") {
|
|
11754
|
+
const before = snapshot();
|
|
11755
|
+
history.execute({ name: "Load canvas", execute: () => apply(next), undo: () => apply(before) });
|
|
11756
|
+
return;
|
|
11757
|
+
}
|
|
11758
|
+
apply(next);
|
|
11759
|
+
history.clear();
|
|
11760
|
+
},
|
|
11761
|
+
subscribe: (listener) => {
|
|
11762
|
+
const offs = [history.subscribe(() => listener())];
|
|
11763
|
+
if (scenes2) offs.push(scenes2.subscribe(() => listener()));
|
|
11764
|
+
if (options.subscribe) offs.push(options.subscribe(listener));
|
|
11765
|
+
return () => offs.forEach((off) => off());
|
|
11766
|
+
},
|
|
11767
|
+
history: {
|
|
11768
|
+
undo: () => history.undo(),
|
|
11769
|
+
redo: () => history.redo(),
|
|
11770
|
+
getState: () => history.getState()
|
|
11771
|
+
},
|
|
11772
|
+
readOnly: options.readOnly
|
|
11773
|
+
});
|
|
11774
|
+
}
|
|
11775
|
+
function createCanvasGestureRecorder(options) {
|
|
11776
|
+
let before = null;
|
|
11777
|
+
const take = () => ({ nodes: options.getNodes(), edges: options.getEdges?.() });
|
|
11778
|
+
const key = (s) => JSON.stringify([s.nodes.map(stripNode), s.edges?.map(stripEdge)]);
|
|
11779
|
+
const restore = (s) => {
|
|
11780
|
+
options.setNodes(s.nodes);
|
|
11781
|
+
if (s.edges && options.setEdges) options.setEdges(s.edges);
|
|
11782
|
+
};
|
|
11783
|
+
return {
|
|
11784
|
+
/** Remembers the canvas as it is before the gesture. */
|
|
11785
|
+
begin() {
|
|
11786
|
+
before = take();
|
|
11787
|
+
},
|
|
11788
|
+
/** Records the gesture as one undo step named `name`, if it changed anything. Returns whether it did. */
|
|
11789
|
+
end(name = "Move") {
|
|
11790
|
+
const start = before;
|
|
11791
|
+
before = null;
|
|
11792
|
+
if (!start) return false;
|
|
11793
|
+
const after = take();
|
|
11794
|
+
if (key(start) === key(after)) return false;
|
|
11795
|
+
options.history.execute({ name, execute: () => restore(after), undo: () => restore(start) });
|
|
11796
|
+
return true;
|
|
11797
|
+
},
|
|
11798
|
+
/** Forgets a gesture without recording it. */
|
|
11799
|
+
cancel() {
|
|
11800
|
+
before = null;
|
|
11801
|
+
}
|
|
11802
|
+
};
|
|
11803
|
+
}
|
|
11693
11804
|
export {
|
|
11694
11805
|
ANIMATABLE_PROPERTIES,
|
|
11695
11806
|
ANIMATION_DATA_KEY,
|
|
@@ -11822,8 +11933,10 @@ export {
|
|
|
11822
11933
|
createCanvasComponent,
|
|
11823
11934
|
createCanvasComponentsController,
|
|
11824
11935
|
createCanvasDrawController,
|
|
11936
|
+
createCanvasEditorDocument,
|
|
11825
11937
|
createCanvasEffectsController,
|
|
11826
11938
|
createCanvasEffectsToolProvider,
|
|
11939
|
+
createCanvasGestureRecorder,
|
|
11827
11940
|
createCanvasInstance,
|
|
11828
11941
|
createCanvasPlaybackLocator,
|
|
11829
11942
|
createCanvasScenesStore,
|
package/dist/chart/index.cjs
CHANGED
|
@@ -152,11 +152,11 @@ var _chunkN3KJFGXTcjs = require('../chunk-N3KJFGXT.cjs');
|
|
|
152
152
|
var _chunkSWTUM32Hcjs = require('../chunk-SWTUM32H.cjs');
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
var
|
|
156
|
-
require('../chunk-L5OWG2NA.cjs');
|
|
155
|
+
var _chunkALNIFK5Gcjs = require('../chunk-ALNIFK5G.cjs');
|
|
157
156
|
|
|
158
157
|
|
|
159
|
-
var
|
|
158
|
+
var _chunk5H2C3QSFcjs = require('../chunk-5H2C3QSF.cjs');
|
|
159
|
+
require('../chunk-L5OWG2NA.cjs');
|
|
160
160
|
require('../chunk-2BSBFBOA.cjs');
|
|
161
161
|
require('../chunk-FJ2MSI43.cjs');
|
|
162
162
|
require('../chunk-UKCJ43YL.cjs');
|
package/dist/chart/index.js
CHANGED
|
@@ -150,13 +150,13 @@ import {
|
|
|
150
150
|
realPresenceClock,
|
|
151
151
|
tweenPresenceCursor
|
|
152
152
|
} from "../chunk-O2ANJFUF.js";
|
|
153
|
+
import {
|
|
154
|
+
readZip
|
|
155
|
+
} from "../chunk-CIQIM2IP.js";
|
|
153
156
|
import {
|
|
154
157
|
defineEditorDocument
|
|
155
158
|
} from "../chunk-GNV54DLO.js";
|
|
156
159
|
import "../chunk-WHKNYFM2.js";
|
|
157
|
-
import {
|
|
158
|
-
readZip
|
|
159
|
-
} from "../chunk-CIQIM2IP.js";
|
|
160
160
|
import "../chunk-HF5QZS7Z.js";
|
|
161
161
|
import "../chunk-RNSANXPT.js";
|
|
162
162
|
import "../chunk-AA34BA7G.js";
|
|
@@ -42,6 +42,9 @@ import {
|
|
|
42
42
|
serializeCsv,
|
|
43
43
|
serializeTsv
|
|
44
44
|
} from "./chunk-WJSD3MAZ.js";
|
|
45
|
+
import {
|
|
46
|
+
defineEditorDocument
|
|
47
|
+
} from "./chunk-GNV54DLO.js";
|
|
45
48
|
|
|
46
49
|
// src/spreadsheet/formula/dependency-graph.ts
|
|
47
50
|
function extractNameDependencies(node) {
|
|
@@ -2829,6 +2832,7 @@ var SpreadsheetController = class {
|
|
|
2829
2832
|
boundSheetId = null;
|
|
2830
2833
|
names = [];
|
|
2831
2834
|
onSelectionChange;
|
|
2835
|
+
changeListeners = /* @__PURE__ */ new Set();
|
|
2832
2836
|
onCellCommit;
|
|
2833
2837
|
// History stack for undo/redo
|
|
2834
2838
|
undoStack = [];
|
|
@@ -3069,15 +3073,21 @@ var SpreadsheetController = class {
|
|
|
3069
3073
|
const snapshot = this.workbookSnapshot();
|
|
3070
3074
|
return JSON.parse(JSON.stringify({ ...snapshot, sheets: snapshot.sheets.map(withoutNames) }));
|
|
3071
3075
|
}
|
|
3072
|
-
/**
|
|
3073
|
-
|
|
3076
|
+
/**
|
|
3077
|
+
* Replaces the whole workbook (sheets, names, active sheet). Clears undo
|
|
3078
|
+
* history, or with `undoable: true` records the replacement as one undo step.
|
|
3079
|
+
*/
|
|
3080
|
+
loadWorkbook(workbook, options = {}) {
|
|
3074
3081
|
if (!workbook.sheets.length) return;
|
|
3082
|
+
if (options.undoable) this.recordWorkbookSnapshot();
|
|
3075
3083
|
this.setWorkbookState(JSON.parse(JSON.stringify(workbook)), true);
|
|
3076
3084
|
this.boundSheetId = this.runtimes[0].doc.id;
|
|
3077
3085
|
this.editingCell = null;
|
|
3078
3086
|
this.draftValue = "";
|
|
3079
|
-
|
|
3080
|
-
|
|
3087
|
+
if (!options.undoable) {
|
|
3088
|
+
this.undoStack = [];
|
|
3089
|
+
this.redoStack = [];
|
|
3090
|
+
}
|
|
3081
3091
|
this.syncWithDataSource();
|
|
3082
3092
|
for (const rt of this.runtimes) this.withSheet(rt, () => this.rederiveTypedValues());
|
|
3083
3093
|
this.recalculateAll();
|
|
@@ -5322,11 +5332,17 @@ var SpreadsheetController = class {
|
|
|
5322
5332
|
getHistoryDepth() {
|
|
5323
5333
|
return { undo: this.undoStack.length, redo: this.redoStack.length };
|
|
5324
5334
|
}
|
|
5335
|
+
/** Returns `false` when there was nothing to undo. */
|
|
5325
5336
|
undo() {
|
|
5337
|
+
if (!this.undoStack.length) return false;
|
|
5326
5338
|
this.applyHistory(this.undoStack, this.redoStack);
|
|
5339
|
+
return true;
|
|
5327
5340
|
}
|
|
5341
|
+
/** Returns `false` when there was nothing to redo. */
|
|
5328
5342
|
redo() {
|
|
5343
|
+
if (!this.redoStack.length) return false;
|
|
5329
5344
|
this.applyHistory(this.redoStack, this.undoStack);
|
|
5345
|
+
return true;
|
|
5330
5346
|
}
|
|
5331
5347
|
/** Restores the newest entry of `from`, saving the current state of the same scope on `to`. */
|
|
5332
5348
|
applyHistory(from, to) {
|
|
@@ -5412,6 +5428,23 @@ var SpreadsheetController = class {
|
|
|
5412
5428
|
const snapshot = this.workbookSnapshot();
|
|
5413
5429
|
this.onWorkbookChange({ sheets: snapshot.sheets, activeSheetId: snapshot.activeSheetId, names: snapshot.names });
|
|
5414
5430
|
}
|
|
5431
|
+
for (const listener of [...this.changeListeners]) {
|
|
5432
|
+
try {
|
|
5433
|
+
listener();
|
|
5434
|
+
} catch (error) {
|
|
5435
|
+
console.error("[SpreadsheetController] Error in change listener:", error);
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
/**
|
|
5440
|
+
* Calls `listener` after every change to the workbook's data (the moments
|
|
5441
|
+
* `onDocumentChange` fires; not selection). Returns an unsubscribe function.
|
|
5442
|
+
*/
|
|
5443
|
+
subscribe(listener) {
|
|
5444
|
+
this.changeListeners.add(listener);
|
|
5445
|
+
return () => {
|
|
5446
|
+
this.changeListeners.delete(listener);
|
|
5447
|
+
};
|
|
5415
5448
|
}
|
|
5416
5449
|
// --- Conditional formatting and data validation ---
|
|
5417
5450
|
/** The sheet as rule evaluation sees it. */
|
|
@@ -6393,6 +6426,39 @@ function sameSpreadsheetViewWindow(a, b) {
|
|
|
6393
6426
|
return a.virtual === b.virtual && a.rowStart === b.rowStart && a.rowEnd === b.rowEnd && a.colStart === b.colStart && a.colEnd === b.colEnd && a.topSpace === b.topSpace && a.bottomSpace === b.bottomSpace && a.leftSpace === b.leftSpace && a.rightSpace === b.rightSpace;
|
|
6394
6427
|
}
|
|
6395
6428
|
|
|
6429
|
+
// src/spreadsheet/editorDocument.ts
|
|
6430
|
+
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
6431
|
+
function checkWorkbook(document) {
|
|
6432
|
+
const hint = "A spreadsheet document is a workbook { sheets: [{ columns, rows, cells }], activeSheetId?, names? } as get_spreadsheet_document returns it.";
|
|
6433
|
+
if (!isRecord(document) || !Array.isArray(document.sheets) || document.sheets.length === 0) throw new Error(`sheets must be a non-empty array. ${hint}`);
|
|
6434
|
+
document.sheets.forEach((sheet, i) => {
|
|
6435
|
+
if (!isRecord(sheet)) throw new Error(`sheets[${i}] must be an object. ${hint}`);
|
|
6436
|
+
if (!Array.isArray(sheet.columns)) throw new Error(`sheets[${i}].columns must be an array. ${hint}`);
|
|
6437
|
+
if (!Array.isArray(sheet.rows)) throw new Error(`sheets[${i}].rows must be an array. ${hint}`);
|
|
6438
|
+
if (!isRecord(sheet.cells)) throw new Error(`sheets[${i}].cells must be an object of rows. ${hint}`);
|
|
6439
|
+
});
|
|
6440
|
+
if (document.names !== void 0 && !Array.isArray(document.names)) throw new Error(`names must be an array. ${hint}`);
|
|
6441
|
+
}
|
|
6442
|
+
function createSpreadsheetEditorDocument(controller) {
|
|
6443
|
+
return defineEditorDocument({
|
|
6444
|
+
kind: "spreadsheet",
|
|
6445
|
+
get: () => controller.getWorkbook(),
|
|
6446
|
+
load: (document, { history }) => {
|
|
6447
|
+
checkWorkbook(document);
|
|
6448
|
+
controller.loadWorkbook(document, { undoable: history === "record" });
|
|
6449
|
+
},
|
|
6450
|
+
subscribe: (listener) => controller.subscribe(listener),
|
|
6451
|
+
history: {
|
|
6452
|
+
undo: () => controller.undo(),
|
|
6453
|
+
redo: () => controller.redo(),
|
|
6454
|
+
getState: () => {
|
|
6455
|
+
const depth = controller.getHistoryDepth();
|
|
6456
|
+
return { canUndo: depth.undo > 0, canRedo: depth.redo > 0 };
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
});
|
|
6460
|
+
}
|
|
6461
|
+
|
|
6396
6462
|
export {
|
|
6397
6463
|
extractNameDependencies,
|
|
6398
6464
|
columnDependencyKey,
|
|
@@ -6519,5 +6585,6 @@ export {
|
|
|
6519
6585
|
fullSpreadsheetViewWindow,
|
|
6520
6586
|
getSpreadsheetViewWindow,
|
|
6521
6587
|
getSpreadsheetScrollToCell,
|
|
6522
|
-
sameSpreadsheetViewWindow
|
|
6588
|
+
sameSpreadsheetViewWindow,
|
|
6589
|
+
createSpreadsheetEditorDocument
|
|
6523
6590
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineEditorDocument
|
|
3
|
+
} from "./chunk-GNV54DLO.js";
|
|
1
4
|
import {
|
|
2
5
|
hexToRgba,
|
|
3
6
|
normalizeTokenColor
|
|
@@ -1270,6 +1273,40 @@ function importW3CTokens(state, input, options = {}) {
|
|
|
1270
1273
|
return { state: next, report };
|
|
1271
1274
|
}
|
|
1272
1275
|
|
|
1276
|
+
// src/tokens/editorDocument.ts
|
|
1277
|
+
function createTokensEditorDocument(store) {
|
|
1278
|
+
return defineEditorDocument({
|
|
1279
|
+
kind: "tokens",
|
|
1280
|
+
get: () => store.toJSON(),
|
|
1281
|
+
load: (document, { history }) => {
|
|
1282
|
+
const { state, issues } = parseTokenState(document);
|
|
1283
|
+
if (history === "record") {
|
|
1284
|
+
for (const variable of state.variables) {
|
|
1285
|
+
for (const value of Object.values(variable.valuesByMode)) {
|
|
1286
|
+
if (typeof value !== "object" || value === null) continue;
|
|
1287
|
+
const error = checkTokenAlias(state, variable, value.alias);
|
|
1288
|
+
if (error) issues.push({ message: error.message, variableId: variable.id });
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (issues.length) {
|
|
1292
|
+
const found = issues.map((i) => `${i.message}${i.variableId ? ` (${i.variableId})` : i.collectionId ? ` (${i.collectionId})` : ""}.`).join(" ");
|
|
1293
|
+
throw new Error(`${found} A tokens document is { collections: [{ id, name, modes }], variables: [{ id, collectionId, name, type, valuesByMode }] } as get_tokens_document returns it.`);
|
|
1294
|
+
}
|
|
1295
|
+
store.replaceState(state, { record: true, reason: "Load tokens" });
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
store.replaceState(state, { reason: "load" });
|
|
1299
|
+
return { problems: issues.map((i) => ({ section: i.variableId ?? i.collectionId ?? "tokens", message: i.message })) };
|
|
1300
|
+
},
|
|
1301
|
+
subscribe: (listener) => store.subscribe(() => listener()),
|
|
1302
|
+
history: {
|
|
1303
|
+
undo: () => store.undo(),
|
|
1304
|
+
redo: () => store.redo(),
|
|
1305
|
+
getState: () => ({ canUndo: store.canUndo(), canRedo: store.canRedo() })
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1273
1310
|
export {
|
|
1274
1311
|
TOKEN_TYPES,
|
|
1275
1312
|
TokenError,
|
|
@@ -1322,5 +1359,6 @@ export {
|
|
|
1322
1359
|
W3C_TOKENS_EXTENSION,
|
|
1323
1360
|
exportW3CTokens,
|
|
1324
1361
|
exportW3CTokensJson,
|
|
1325
|
-
importW3CTokens
|
|
1362
|
+
importW3CTokens,
|
|
1363
|
+
createTokensEditorDocument
|
|
1326
1364
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
|
|
2
2
|
|
|
3
|
+
var _chunk5H2C3QSFcjs = require('./chunk-5H2C3QSF.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
var _chunkA6QWKBJPcjs = require('./chunk-A6QWKBJP.cjs');
|
|
5
8
|
|
|
@@ -1270,6 +1273,41 @@ function importW3CTokens(state, input, options = {}) {
|
|
|
1270
1273
|
return { state: next, report };
|
|
1271
1274
|
}
|
|
1272
1275
|
|
|
1276
|
+
// src/tokens/editorDocument.ts
|
|
1277
|
+
function createTokensEditorDocument(store) {
|
|
1278
|
+
return _chunk5H2C3QSFcjs.defineEditorDocument.call(void 0, {
|
|
1279
|
+
kind: "tokens",
|
|
1280
|
+
get: () => store.toJSON(),
|
|
1281
|
+
load: (document, { history }) => {
|
|
1282
|
+
const { state, issues } = parseTokenState(document);
|
|
1283
|
+
if (history === "record") {
|
|
1284
|
+
for (const variable of state.variables) {
|
|
1285
|
+
for (const value of Object.values(variable.valuesByMode)) {
|
|
1286
|
+
if (typeof value !== "object" || value === null) continue;
|
|
1287
|
+
const error = checkTokenAlias(state, variable, value.alias);
|
|
1288
|
+
if (error) issues.push({ message: error.message, variableId: variable.id });
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (issues.length) {
|
|
1292
|
+
const found = issues.map((i) => `${i.message}${i.variableId ? ` (${i.variableId})` : i.collectionId ? ` (${i.collectionId})` : ""}.`).join(" ");
|
|
1293
|
+
throw new Error(`${found} A tokens document is { collections: [{ id, name, modes }], variables: [{ id, collectionId, name, type, valuesByMode }] } as get_tokens_document returns it.`);
|
|
1294
|
+
}
|
|
1295
|
+
store.replaceState(state, { record: true, reason: "Load tokens" });
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
store.replaceState(state, { reason: "load" });
|
|
1299
|
+
return { problems: issues.map((i) => ({ section: _nullishCoalesce(_nullishCoalesce(i.variableId, () => ( i.collectionId)), () => ( "tokens")), message: i.message })) };
|
|
1300
|
+
},
|
|
1301
|
+
subscribe: (listener) => store.subscribe(() => listener()),
|
|
1302
|
+
history: {
|
|
1303
|
+
undo: () => store.undo(),
|
|
1304
|
+
redo: () => store.redo(),
|
|
1305
|
+
getState: () => ({ canUndo: store.canUndo(), canRedo: store.canRedo() })
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
|
|
1273
1311
|
|
|
1274
1312
|
|
|
1275
1313
|
|
|
@@ -1323,4 +1361,4 @@ function importW3CTokens(state, input, options = {}) {
|
|
|
1323
1361
|
|
|
1324
1362
|
|
|
1325
1363
|
|
|
1326
|
-
exports.TOKEN_TYPES = TOKEN_TYPES; exports.TokenError = TokenError; exports.isTokenAlias = isTokenAlias; exports.EMPTY_TOKEN_STATE = EMPTY_TOKEN_STATE; exports.getTokenCollection = getTokenCollection; exports.getTokenVariable = getTokenVariable; exports.findTokenCollection = findTokenCollection; exports.findTokenVariable = findTokenVariable; exports.getCollectionVariables = getCollectionVariables; exports.getDefaultMode = getDefaultMode; exports.findTokenMode = findTokenMode; exports.getCurrentMode = getCurrentMode; exports.defaultTokenValue = defaultTokenValue; exports.coerceTokenLiteral = coerceTokenLiteral; exports.literalTokenType = literalTokenType; exports.formatTokenValue = formatTokenValue; exports.resolveToken = resolveToken; exports.resolveTokenValue = resolveTokenValue; exports.resolveTokenInMode = resolveTokenInMode; exports.checkTokenAlias = checkTokenAlias; exports.TOKEN_SCOPES_BY_TYPE = TOKEN_SCOPES_BY_TYPE; exports.isTokenScopeKnown = isTokenScopeKnown; exports.normalizeTokenScopes = normalizeTokenScopes; exports.isTokenInScope = isTokenInScope; exports.normalizeTokenName = normalizeTokenName; exports.defaultTokenId = defaultTokenId; exports.createTokenCollection = createTokenCollection; exports.renameTokenCollection = renameTokenCollection; exports.deleteTokenVariables = deleteTokenVariables; exports.deleteTokenCollection = deleteTokenCollection; exports.addTokenMode = addTokenMode; exports.renameTokenMode = renameTokenMode; exports.removeTokenMode = removeTokenMode; exports.moveTokenMode = moveTokenMode; exports.prepareTokenValue = prepareTokenValue; exports.createTokenVariable = createTokenVariable; exports.setTokenValue = setTokenValue; exports.renameTokenVariable = renameTokenVariable; exports.updateTokenVariable = updateTokenVariable; exports.parseTokenState = parseTokenState; exports.TokenStore = TokenStore; exports.createTokenStore = createTokenStore; exports.tokenSlug = tokenSlug; exports.getTokenCssName = getTokenCssName; exports.cssString = cssString; exports.formatTokenCssValue = formatTokenCssValue; exports.exportTokensCss = exportTokensCss; exports.getTokenCssVariables = getTokenCssVariables; exports.W3C_TOKENS_EXTENSION = W3C_TOKENS_EXTENSION; exports.exportW3CTokens = exportW3CTokens; exports.exportW3CTokensJson = exportW3CTokensJson; exports.importW3CTokens = importW3CTokens;
|
|
1364
|
+
exports.TOKEN_TYPES = TOKEN_TYPES; exports.TokenError = TokenError; exports.isTokenAlias = isTokenAlias; exports.EMPTY_TOKEN_STATE = EMPTY_TOKEN_STATE; exports.getTokenCollection = getTokenCollection; exports.getTokenVariable = getTokenVariable; exports.findTokenCollection = findTokenCollection; exports.findTokenVariable = findTokenVariable; exports.getCollectionVariables = getCollectionVariables; exports.getDefaultMode = getDefaultMode; exports.findTokenMode = findTokenMode; exports.getCurrentMode = getCurrentMode; exports.defaultTokenValue = defaultTokenValue; exports.coerceTokenLiteral = coerceTokenLiteral; exports.literalTokenType = literalTokenType; exports.formatTokenValue = formatTokenValue; exports.resolveToken = resolveToken; exports.resolveTokenValue = resolveTokenValue; exports.resolveTokenInMode = resolveTokenInMode; exports.checkTokenAlias = checkTokenAlias; exports.TOKEN_SCOPES_BY_TYPE = TOKEN_SCOPES_BY_TYPE; exports.isTokenScopeKnown = isTokenScopeKnown; exports.normalizeTokenScopes = normalizeTokenScopes; exports.isTokenInScope = isTokenInScope; exports.normalizeTokenName = normalizeTokenName; exports.defaultTokenId = defaultTokenId; exports.createTokenCollection = createTokenCollection; exports.renameTokenCollection = renameTokenCollection; exports.deleteTokenVariables = deleteTokenVariables; exports.deleteTokenCollection = deleteTokenCollection; exports.addTokenMode = addTokenMode; exports.renameTokenMode = renameTokenMode; exports.removeTokenMode = removeTokenMode; exports.moveTokenMode = moveTokenMode; exports.prepareTokenValue = prepareTokenValue; exports.createTokenVariable = createTokenVariable; exports.setTokenValue = setTokenValue; exports.renameTokenVariable = renameTokenVariable; exports.updateTokenVariable = updateTokenVariable; exports.parseTokenState = parseTokenState; exports.TokenStore = TokenStore; exports.createTokenStore = createTokenStore; exports.tokenSlug = tokenSlug; exports.getTokenCssName = getTokenCssName; exports.cssString = cssString; exports.formatTokenCssValue = formatTokenCssValue; exports.exportTokensCss = exportTokensCss; exports.getTokenCssVariables = getTokenCssVariables; exports.W3C_TOKENS_EXTENSION = W3C_TOKENS_EXTENSION; exports.exportW3CTokens = exportW3CTokens; exports.exportW3CTokensJson = exportW3CTokensJson; exports.importW3CTokens = importW3CTokens; exports.createTokensEditorDocument = createTokensEditorDocument;
|
|
@@ -43,6 +43,9 @@ var _chunk55AKPTLMcjs = require('./chunk-55AKPTLM.cjs');
|
|
|
43
43
|
|
|
44
44
|
var _chunkN3KJFGXTcjs = require('./chunk-N3KJFGXT.cjs');
|
|
45
45
|
|
|
46
|
+
|
|
47
|
+
var _chunk5H2C3QSFcjs = require('./chunk-5H2C3QSF.cjs');
|
|
48
|
+
|
|
46
49
|
// src/spreadsheet/formula/dependency-graph.ts
|
|
47
50
|
function extractNameDependencies(node) {
|
|
48
51
|
const names = [];
|
|
@@ -2829,27 +2832,28 @@ var SpreadsheetController = (_class6 = class {
|
|
|
2829
2832
|
__init31() {this.boundSheetId = null}
|
|
2830
2833
|
__init32() {this.names = []}
|
|
2831
2834
|
|
|
2835
|
+
__init33() {this.changeListeners = /* @__PURE__ */ new Set()}
|
|
2832
2836
|
|
|
2833
2837
|
// History stack for undo/redo
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2838
|
+
__init34() {this.undoStack = []}
|
|
2839
|
+
__init35() {this.redoStack = []}
|
|
2840
|
+
__init36() {this.isApplyingHistory = false}
|
|
2837
2841
|
|
|
2838
2842
|
// Set while importing TSV: history and recalculation are done once at the end.
|
|
2839
|
-
|
|
2840
|
-
|
|
2843
|
+
__init37() {this.batching = false}
|
|
2844
|
+
__init38() {this.pendingCommits = []}
|
|
2841
2845
|
// Row being evaluated, so [property] references resolve per row.
|
|
2842
|
-
|
|
2846
|
+
__init39() {this.evaluatingRowIndex = null}
|
|
2843
2847
|
// Cell being evaluated, for implicit intersection (`=@A:A`).
|
|
2844
|
-
|
|
2848
|
+
__init40() {this.evaluatingCell = null}
|
|
2845
2849
|
// Dynamic arrays. Spilled values are derived state: they live in the sheet
|
|
2846
2850
|
// runtimes, not in the documents, and every recalculation rebuilds them.
|
|
2847
2851
|
// Cells (sheet-qualified keys) whose spill ownership changed during the current pass.
|
|
2848
|
-
|
|
2849
|
-
|
|
2852
|
+
__init41() {this.spillChanges = null}
|
|
2853
|
+
__init42() {this.recalcStats = { evaluated: 0, planned: 0, passes: 0 }}
|
|
2850
2854
|
// Values of large ranges read while running an evaluation plan (see runEvaluationPlan).
|
|
2851
|
-
|
|
2852
|
-
|
|
2855
|
+
__init43() {this.astCache = /* @__PURE__ */ new Map()}
|
|
2856
|
+
__init44() {this.rangeCache = null}
|
|
2853
2857
|
/** The active sheet's document (the sheet the editor shows). */
|
|
2854
2858
|
get document() {
|
|
2855
2859
|
return this.ctx.doc;
|
|
@@ -2868,18 +2872,18 @@ var SpreadsheetController = (_class6 = class {
|
|
|
2868
2872
|
}
|
|
2869
2873
|
// Conditional formatting is evaluated lazily (getConditionalFormatOverlay).
|
|
2870
2874
|
// Cell keys whose values changed since, or 'all' to evaluate from scratch.
|
|
2871
|
-
|
|
2872
|
-
|
|
2875
|
+
__init45() {this.cfEngine = null}
|
|
2876
|
+
__init46() {this.cfDirty = "all"}
|
|
2873
2877
|
// Set while a single cell edit notifies, so the change stays incremental.
|
|
2874
|
-
|
|
2878
|
+
__init47() {this.cfIncremental = false}
|
|
2875
2879
|
// Value being entered, seen by validation formulas instead of the cell's value.
|
|
2876
|
-
|
|
2880
|
+
__init48() {this.valueOverride = null}
|
|
2877
2881
|
// "Circle invalid data": on/off and the cached cells.
|
|
2878
|
-
|
|
2879
|
-
|
|
2882
|
+
__init49() {this.circlesShown = false}
|
|
2883
|
+
__init50() {this.invalidCircles = null}
|
|
2880
2884
|
/** Invalid input waiting for the user's answer (see `resolveValidationPrompt`). */
|
|
2881
|
-
|
|
2882
|
-
constructor(options = {}) {;_class6.prototype.__init24.call(this);_class6.prototype.__init25.call(this);_class6.prototype.__init26.call(this);_class6.prototype.__init27.call(this);_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);_class6.prototype.__init32.call(this);_class6.prototype.__init33.call(this);_class6.prototype.__init34.call(this);_class6.prototype.__init35.call(this);_class6.prototype.__init36.call(this);_class6.prototype.__init37.call(this);_class6.prototype.__init38.call(this);_class6.prototype.__init39.call(this);_class6.prototype.__init40.call(this);_class6.prototype.__init41.call(this);_class6.prototype.__init42.call(this);_class6.prototype.__init43.call(this);_class6.prototype.__init44.call(this);_class6.prototype.__init45.call(this);_class6.prototype.__init46.call(this);_class6.prototype.__init47.call(this);_class6.prototype.__init48.call(this);_class6.prototype.__init49.call(this);_class6.prototype.__init50.call(this);_class6.prototype.__init51.call(this);
|
|
2885
|
+
__init51() {this.validationPrompt = null}
|
|
2886
|
+
constructor(options = {}) {;_class6.prototype.__init24.call(this);_class6.prototype.__init25.call(this);_class6.prototype.__init26.call(this);_class6.prototype.__init27.call(this);_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);_class6.prototype.__init32.call(this);_class6.prototype.__init33.call(this);_class6.prototype.__init34.call(this);_class6.prototype.__init35.call(this);_class6.prototype.__init36.call(this);_class6.prototype.__init37.call(this);_class6.prototype.__init38.call(this);_class6.prototype.__init39.call(this);_class6.prototype.__init40.call(this);_class6.prototype.__init41.call(this);_class6.prototype.__init42.call(this);_class6.prototype.__init43.call(this);_class6.prototype.__init44.call(this);_class6.prototype.__init45.call(this);_class6.prototype.__init46.call(this);_class6.prototype.__init47.call(this);_class6.prototype.__init48.call(this);_class6.prototype.__init49.call(this);_class6.prototype.__init50.call(this);_class6.prototype.__init51.call(this);_class6.prototype.__init52.call(this);
|
|
2883
2887
|
const defaultCols = [
|
|
2884
2888
|
{ id: "col_a", key: "A", title: "A", width: 120, type: "freeform" },
|
|
2885
2889
|
{ id: "col_b", key: "B", title: "B", width: 120, type: "freeform" },
|
|
@@ -3069,15 +3073,21 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3069
3073
|
const snapshot = this.workbookSnapshot();
|
|
3070
3074
|
return JSON.parse(JSON.stringify({ ...snapshot, sheets: snapshot.sheets.map(withoutNames) }));
|
|
3071
3075
|
}
|
|
3072
|
-
/**
|
|
3073
|
-
|
|
3076
|
+
/**
|
|
3077
|
+
* Replaces the whole workbook (sheets, names, active sheet). Clears undo
|
|
3078
|
+
* history, or with `undoable: true` records the replacement as one undo step.
|
|
3079
|
+
*/
|
|
3080
|
+
loadWorkbook(workbook, options = {}) {
|
|
3074
3081
|
if (!workbook.sheets.length) return;
|
|
3082
|
+
if (options.undoable) this.recordWorkbookSnapshot();
|
|
3075
3083
|
this.setWorkbookState(JSON.parse(JSON.stringify(workbook)), true);
|
|
3076
3084
|
this.boundSheetId = this.runtimes[0].doc.id;
|
|
3077
3085
|
this.editingCell = null;
|
|
3078
3086
|
this.draftValue = "";
|
|
3079
|
-
|
|
3080
|
-
|
|
3087
|
+
if (!options.undoable) {
|
|
3088
|
+
this.undoStack = [];
|
|
3089
|
+
this.redoStack = [];
|
|
3090
|
+
}
|
|
3081
3091
|
this.syncWithDataSource();
|
|
3082
3092
|
for (const rt of this.runtimes) this.withSheet(rt, () => this.rederiveTypedValues());
|
|
3083
3093
|
this.recalculateAll();
|
|
@@ -4375,7 +4385,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4375
4385
|
const { headerRows, footerRows } = getTableSections(this.document);
|
|
4376
4386
|
return { start: headerRows, end: this.document.rows.length - footerRows - 1 };
|
|
4377
4387
|
}
|
|
4378
|
-
|
|
4388
|
+
__init52() {this.getCellValueAt = (rowIndex, colIndex) => {
|
|
4379
4389
|
const row = this.document.rows[rowIndex];
|
|
4380
4390
|
const col = this.document.columns[colIndex];
|
|
4381
4391
|
if (!row || !col) return "";
|
|
@@ -5322,11 +5332,17 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5322
5332
|
getHistoryDepth() {
|
|
5323
5333
|
return { undo: this.undoStack.length, redo: this.redoStack.length };
|
|
5324
5334
|
}
|
|
5335
|
+
/** Returns `false` when there was nothing to undo. */
|
|
5325
5336
|
undo() {
|
|
5337
|
+
if (!this.undoStack.length) return false;
|
|
5326
5338
|
this.applyHistory(this.undoStack, this.redoStack);
|
|
5339
|
+
return true;
|
|
5327
5340
|
}
|
|
5341
|
+
/** Returns `false` when there was nothing to redo. */
|
|
5328
5342
|
redo() {
|
|
5343
|
+
if (!this.redoStack.length) return false;
|
|
5329
5344
|
this.applyHistory(this.redoStack, this.undoStack);
|
|
5345
|
+
return true;
|
|
5330
5346
|
}
|
|
5331
5347
|
/** Restores the newest entry of `from`, saving the current state of the same scope on `to`. */
|
|
5332
5348
|
applyHistory(from, to) {
|
|
@@ -5412,6 +5428,23 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5412
5428
|
const snapshot = this.workbookSnapshot();
|
|
5413
5429
|
this.onWorkbookChange({ sheets: snapshot.sheets, activeSheetId: snapshot.activeSheetId, names: snapshot.names });
|
|
5414
5430
|
}
|
|
5431
|
+
for (const listener of [...this.changeListeners]) {
|
|
5432
|
+
try {
|
|
5433
|
+
listener();
|
|
5434
|
+
} catch (error) {
|
|
5435
|
+
console.error("[SpreadsheetController] Error in change listener:", error);
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
/**
|
|
5440
|
+
* Calls `listener` after every change to the workbook's data (the moments
|
|
5441
|
+
* `onDocumentChange` fires; not selection). Returns an unsubscribe function.
|
|
5442
|
+
*/
|
|
5443
|
+
subscribe(listener) {
|
|
5444
|
+
this.changeListeners.add(listener);
|
|
5445
|
+
return () => {
|
|
5446
|
+
this.changeListeners.delete(listener);
|
|
5447
|
+
};
|
|
5415
5448
|
}
|
|
5416
5449
|
// --- Conditional formatting and data validation ---
|
|
5417
5450
|
/** The sheet as rule evaluation sees it. */
|
|
@@ -6393,6 +6426,40 @@ function sameSpreadsheetViewWindow(a, b) {
|
|
|
6393
6426
|
return a.virtual === b.virtual && a.rowStart === b.rowStart && a.rowEnd === b.rowEnd && a.colStart === b.colStart && a.colEnd === b.colEnd && a.topSpace === b.topSpace && a.bottomSpace === b.bottomSpace && a.leftSpace === b.leftSpace && a.rightSpace === b.rightSpace;
|
|
6394
6427
|
}
|
|
6395
6428
|
|
|
6429
|
+
// src/spreadsheet/editorDocument.ts
|
|
6430
|
+
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
6431
|
+
function checkWorkbook(document) {
|
|
6432
|
+
const hint = "A spreadsheet document is a workbook { sheets: [{ columns, rows, cells }], activeSheetId?, names? } as get_spreadsheet_document returns it.";
|
|
6433
|
+
if (!isRecord(document) || !Array.isArray(document.sheets) || document.sheets.length === 0) throw new Error(`sheets must be a non-empty array. ${hint}`);
|
|
6434
|
+
document.sheets.forEach((sheet, i) => {
|
|
6435
|
+
if (!isRecord(sheet)) throw new Error(`sheets[${i}] must be an object. ${hint}`);
|
|
6436
|
+
if (!Array.isArray(sheet.columns)) throw new Error(`sheets[${i}].columns must be an array. ${hint}`);
|
|
6437
|
+
if (!Array.isArray(sheet.rows)) throw new Error(`sheets[${i}].rows must be an array. ${hint}`);
|
|
6438
|
+
if (!isRecord(sheet.cells)) throw new Error(`sheets[${i}].cells must be an object of rows. ${hint}`);
|
|
6439
|
+
});
|
|
6440
|
+
if (document.names !== void 0 && !Array.isArray(document.names)) throw new Error(`names must be an array. ${hint}`);
|
|
6441
|
+
}
|
|
6442
|
+
function createSpreadsheetEditorDocument(controller) {
|
|
6443
|
+
return _chunk5H2C3QSFcjs.defineEditorDocument.call(void 0, {
|
|
6444
|
+
kind: "spreadsheet",
|
|
6445
|
+
get: () => controller.getWorkbook(),
|
|
6446
|
+
load: (document, { history }) => {
|
|
6447
|
+
checkWorkbook(document);
|
|
6448
|
+
controller.loadWorkbook(document, { undoable: history === "record" });
|
|
6449
|
+
},
|
|
6450
|
+
subscribe: (listener) => controller.subscribe(listener),
|
|
6451
|
+
history: {
|
|
6452
|
+
undo: () => controller.undo(),
|
|
6453
|
+
redo: () => controller.redo(),
|
|
6454
|
+
getState: () => {
|
|
6455
|
+
const depth = controller.getHistoryDepth();
|
|
6456
|
+
return { canUndo: depth.undo > 0, canRedo: depth.redo > 0 };
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
});
|
|
6460
|
+
}
|
|
6461
|
+
|
|
6462
|
+
|
|
6396
6463
|
|
|
6397
6464
|
|
|
6398
6465
|
|
|
@@ -6520,4 +6587,4 @@ function sameSpreadsheetViewWindow(a, b) {
|
|
|
6520
6587
|
|
|
6521
6588
|
|
|
6522
6589
|
|
|
6523
|
-
exports.extractNameDependencies = extractNameDependencies; exports.columnDependencyKey = columnDependencyKey; exports.extractCellDependencies = extractCellDependencies; exports.extractReferenceDependencies = extractReferenceDependencies; exports.rangeDependencyKey = rangeDependencyKey; exports.IntervalIndex = IntervalIndex; exports.DependencyGraph = DependencyGraph; exports.shiftFormulaReferences = shiftFormulaReferences; exports.mapFormulaReferences = mapFormulaReferences; exports.offsetFormulaReferences = offsetFormulaReferences; exports.remapFormulaReferences = remapFormulaReferences; exports.transposeFormulaReferences = transposeFormulaReferences; exports.sheetNameNeedsQuotes = sheetNameNeedsQuotes; exports.quoteSheetName = quoteSheetName; exports.formatSheetPrefix = formatSheetPrefix; exports.renameSheetInFormula = renameSheetInFormula; exports.deleteSheetInFormula = deleteSheetInFormula; exports.renameNameInFormula = renameNameInFormula; exports.formulaIdentifiers = formulaIdentifiers; exports.getFormulaCaretContext = getFormulaCaretContext; exports.getFormulaHints = getFormulaHints; exports.applyFormulaSuggestion = applyFormulaSuggestion; exports.NUMBER_FORMAT_PRESETS = NUMBER_FORMAT_PRESETS; exports.numberFormatForCellFormat = numberFormatForCellFormat; exports.cellFormatForNumberFormat = cellFormatForNumberFormat; exports.isGeneralNumberFormat = isGeneralNumberFormat; exports.formatCellForDisplay = formatCellForDisplay; exports.formatCellDisplay = formatCellDisplay; exports.formatValueWithCode = formatValueWithCode; exports.DataSourceBinder = DataSourceBinder; exports.MAX_SHEET_NAME_LENGTH = MAX_SHEET_NAME_LENGTH; exports.MAX_DEFINED_NAME_LENGTH = MAX_DEFINED_NAME_LENGTH; exports.validateSheetName = validateSheetName; exports.nextSheetName = nextSheetName; exports.copySheetName = copySheetName; exports.validateDefinedName = validateDefinedName; exports.isLambdaDefinition = isLambdaDefinition; exports.SPREADSHEET_CLIPBOARD_MIME = SPREADSHEET_CLIPBOARD_MIME; exports.serializeHtmlTable = serializeHtmlTable; exports.parseHtmlTable = parseHtmlTable; exports.createSpreadsheetClipboardData = createSpreadsheetClipboardData; exports.readSpreadsheetClipboard = readSpreadsheetClipboard; exports.rebaseClipboardRows = rebaseClipboardRows; exports.adjustRangeForStructuralChange = adjustRangeForStructuralChange; exports.adjustRangesForStructuralChange = adjustRangesForStructuralChange; exports.subtractRange = subtractRange; exports.subtractRangeFromRanges = subtractRangeFromRanges; exports.rangesContain = rangesContain; exports.ruleAnchor = ruleAnchor; exports.ruleFormulaAt = ruleFormulaAt; exports.shiftRuleFormula = shiftRuleFormula; exports.forEachRangeCell = forEachRangeCell; exports.formatRuleRanges = formatRuleRanges; exports.parseRuleRanges = parseRuleRanges; exports.mergeRuleRanges = mergeRuleRanges; exports.sortRuleRanges = sortRuleRanges; exports.transposeRuleRanges = transposeRuleRanges; exports.reanchorRuleFormula = reanchorRuleFormula; exports.transposeRuleFormula = transposeRuleFormula; exports.mapConditionalFormatFormulas = mapConditionalFormatFormulas; exports.mapDataValidationFormulas = mapDataValidationFormulas; exports.sortRules = sortRules; exports.transposeRules = transposeRules; exports.CONDITIONAL_FORMAT_ICON_SETS = CONDITIONAL_FORMAT_ICON_SETS; exports.conditionalFormatIconCount = conditionalFormatIconCount; exports.getConditionalFormatIcon = getConditionalFormatIcon; exports.conditionalFormatNumber = conditionalFormatNumber; exports.blendConditionalFormatColors = blendConditionalFormatColors; exports.defaultIconThresholds = defaultIconThresholds; exports.EMPTY_CONDITIONAL_FORMAT_OVERLAY = EMPTY_CONDITIONAL_FORMAT_OVERLAY; exports.ConditionalFormatEngine = ConditionalFormatEngine; exports.matchesTimePeriod = matchesTimePeriod; exports.evaluateConditionalFormats = evaluateConditionalFormats; exports.describeConditionalFormat = describeConditionalFormat; exports.describeDataValidation = describeDataValidation; exports.CONDITIONAL_FORMAT_STYLE_PRESETS = CONDITIONAL_FORMAT_STYLE_PRESETS; exports.DEFAULT_CONDITIONAL_FORMAT_STYLE = DEFAULT_CONDITIONAL_FORMAT_STYLE; exports.CONDITIONAL_FORMAT_PRESETS = CONDITIONAL_FORMAT_PRESETS; exports.CONDITIONAL_FORMAT_TIME_PERIODS = CONDITIONAL_FORMAT_TIME_PERIODS; exports.createConditionalFormatRule = createConditionalFormatRule; exports.DATA_VALIDATION_TYPE_OPTIONS = DATA_VALIDATION_TYPE_OPTIONS; exports.DATA_VALIDATION_OPERATOR_OPTIONS = DATA_VALIDATION_OPERATOR_OPTIONS; exports.DATA_VALIDATION_ERROR_STYLE_OPTIONS = DATA_VALIDATION_ERROR_STYLE_OPTIONS; exports.conditionalFormatContrastColor = conditionalFormatContrastColor; exports.getConditionalFormatCss = getConditionalFormatCss; exports.getDataBarCss = getDataBarCss; exports.conditionalFormatStyleString = conditionalFormatStyleString; exports.DEFAULT_DATA_VALIDATION_MESSAGE = DEFAULT_DATA_VALIDATION_MESSAGE; exports.DEFAULT_DATA_VALIDATION_TITLE = DEFAULT_DATA_VALIDATION_TITLE; exports.findDataValidation = findDataValidation; exports.getValidationListValues = getValidationListValues; exports.validateCellInput = validateCellInput; exports.findInvalidCells = findInvalidCells; exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT; exports.DEFAULT_COLUMN_WIDTH = DEFAULT_COLUMN_WIDTH; exports.getTableSections = getTableSections; exports.getRowSection = getRowSection; exports.rowPassesFilters = rowPassesFilters; exports.computeRowGroups = computeRowGroups; exports.buildSpreadsheetView = buildSpreadsheetView; exports.SpreadsheetController = SpreadsheetController; exports.runSpreadsheetMenuItem = runSpreadsheetMenuItem; exports.clampMenuPosition = clampMenuPosition; exports.getSpreadsheetMenuItems = getSpreadsheetMenuItems; exports.SPREADSHEET_TABLE_ACTIONS = SPREADSHEET_TABLE_ACTIONS; exports.bindSpreadsheetTableActions = bindSpreadsheetTableActions; exports.csvImportAdapter = csvImportAdapter; exports.tsvImportAdapter = tsvImportAdapter; exports.SPREADSHEET_IMPORT_ADAPTERS = SPREADSHEET_IMPORT_ADAPTERS; exports.registerSpreadsheetImportAdapters = registerSpreadsheetImportAdapters; exports.importFileIntoSpreadsheet = importFileIntoSpreadsheet; exports.getSheetTabMenuItems = getSheetTabMenuItems; exports.sheetDropIndex = sheetDropIndex; exports.getNameManagerRows = getNameManagerRows; exports.SPREADSHEET_COLUMN_HEADER_HEIGHT = SPREADSHEET_COLUMN_HEADER_HEIGHT; exports.SPREADSHEET_ROW_HEADER_WIDTH = SPREADSHEET_ROW_HEADER_WIDTH; exports.SPREADSHEET_GROUP_ROW_HEIGHT = SPREADSHEET_GROUP_ROW_HEIGHT; exports.SPREADSHEET_VIRTUAL_ROW_THRESHOLD = SPREADSHEET_VIRTUAL_ROW_THRESHOLD; exports.SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD = SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD; exports.SPREADSHEET_DEFAULT_VIEWPORT = SPREADSHEET_DEFAULT_VIEWPORT; exports.measureSpreadsheetView = measureSpreadsheetView; exports.shouldVirtualizeSpreadsheet = shouldVirtualizeSpreadsheet; exports.fullSpreadsheetViewWindow = fullSpreadsheetViewWindow; exports.getSpreadsheetViewWindow = getSpreadsheetViewWindow; exports.getSpreadsheetScrollToCell = getSpreadsheetScrollToCell; exports.sameSpreadsheetViewWindow = sameSpreadsheetViewWindow;
|
|
6590
|
+
exports.extractNameDependencies = extractNameDependencies; exports.columnDependencyKey = columnDependencyKey; exports.extractCellDependencies = extractCellDependencies; exports.extractReferenceDependencies = extractReferenceDependencies; exports.rangeDependencyKey = rangeDependencyKey; exports.IntervalIndex = IntervalIndex; exports.DependencyGraph = DependencyGraph; exports.shiftFormulaReferences = shiftFormulaReferences; exports.mapFormulaReferences = mapFormulaReferences; exports.offsetFormulaReferences = offsetFormulaReferences; exports.remapFormulaReferences = remapFormulaReferences; exports.transposeFormulaReferences = transposeFormulaReferences; exports.sheetNameNeedsQuotes = sheetNameNeedsQuotes; exports.quoteSheetName = quoteSheetName; exports.formatSheetPrefix = formatSheetPrefix; exports.renameSheetInFormula = renameSheetInFormula; exports.deleteSheetInFormula = deleteSheetInFormula; exports.renameNameInFormula = renameNameInFormula; exports.formulaIdentifiers = formulaIdentifiers; exports.getFormulaCaretContext = getFormulaCaretContext; exports.getFormulaHints = getFormulaHints; exports.applyFormulaSuggestion = applyFormulaSuggestion; exports.NUMBER_FORMAT_PRESETS = NUMBER_FORMAT_PRESETS; exports.numberFormatForCellFormat = numberFormatForCellFormat; exports.cellFormatForNumberFormat = cellFormatForNumberFormat; exports.isGeneralNumberFormat = isGeneralNumberFormat; exports.formatCellForDisplay = formatCellForDisplay; exports.formatCellDisplay = formatCellDisplay; exports.formatValueWithCode = formatValueWithCode; exports.DataSourceBinder = DataSourceBinder; exports.MAX_SHEET_NAME_LENGTH = MAX_SHEET_NAME_LENGTH; exports.MAX_DEFINED_NAME_LENGTH = MAX_DEFINED_NAME_LENGTH; exports.validateSheetName = validateSheetName; exports.nextSheetName = nextSheetName; exports.copySheetName = copySheetName; exports.validateDefinedName = validateDefinedName; exports.isLambdaDefinition = isLambdaDefinition; exports.SPREADSHEET_CLIPBOARD_MIME = SPREADSHEET_CLIPBOARD_MIME; exports.serializeHtmlTable = serializeHtmlTable; exports.parseHtmlTable = parseHtmlTable; exports.createSpreadsheetClipboardData = createSpreadsheetClipboardData; exports.readSpreadsheetClipboard = readSpreadsheetClipboard; exports.rebaseClipboardRows = rebaseClipboardRows; exports.adjustRangeForStructuralChange = adjustRangeForStructuralChange; exports.adjustRangesForStructuralChange = adjustRangesForStructuralChange; exports.subtractRange = subtractRange; exports.subtractRangeFromRanges = subtractRangeFromRanges; exports.rangesContain = rangesContain; exports.ruleAnchor = ruleAnchor; exports.ruleFormulaAt = ruleFormulaAt; exports.shiftRuleFormula = shiftRuleFormula; exports.forEachRangeCell = forEachRangeCell; exports.formatRuleRanges = formatRuleRanges; exports.parseRuleRanges = parseRuleRanges; exports.mergeRuleRanges = mergeRuleRanges; exports.sortRuleRanges = sortRuleRanges; exports.transposeRuleRanges = transposeRuleRanges; exports.reanchorRuleFormula = reanchorRuleFormula; exports.transposeRuleFormula = transposeRuleFormula; exports.mapConditionalFormatFormulas = mapConditionalFormatFormulas; exports.mapDataValidationFormulas = mapDataValidationFormulas; exports.sortRules = sortRules; exports.transposeRules = transposeRules; exports.CONDITIONAL_FORMAT_ICON_SETS = CONDITIONAL_FORMAT_ICON_SETS; exports.conditionalFormatIconCount = conditionalFormatIconCount; exports.getConditionalFormatIcon = getConditionalFormatIcon; exports.conditionalFormatNumber = conditionalFormatNumber; exports.blendConditionalFormatColors = blendConditionalFormatColors; exports.defaultIconThresholds = defaultIconThresholds; exports.EMPTY_CONDITIONAL_FORMAT_OVERLAY = EMPTY_CONDITIONAL_FORMAT_OVERLAY; exports.ConditionalFormatEngine = ConditionalFormatEngine; exports.matchesTimePeriod = matchesTimePeriod; exports.evaluateConditionalFormats = evaluateConditionalFormats; exports.describeConditionalFormat = describeConditionalFormat; exports.describeDataValidation = describeDataValidation; exports.CONDITIONAL_FORMAT_STYLE_PRESETS = CONDITIONAL_FORMAT_STYLE_PRESETS; exports.DEFAULT_CONDITIONAL_FORMAT_STYLE = DEFAULT_CONDITIONAL_FORMAT_STYLE; exports.CONDITIONAL_FORMAT_PRESETS = CONDITIONAL_FORMAT_PRESETS; exports.CONDITIONAL_FORMAT_TIME_PERIODS = CONDITIONAL_FORMAT_TIME_PERIODS; exports.createConditionalFormatRule = createConditionalFormatRule; exports.DATA_VALIDATION_TYPE_OPTIONS = DATA_VALIDATION_TYPE_OPTIONS; exports.DATA_VALIDATION_OPERATOR_OPTIONS = DATA_VALIDATION_OPERATOR_OPTIONS; exports.DATA_VALIDATION_ERROR_STYLE_OPTIONS = DATA_VALIDATION_ERROR_STYLE_OPTIONS; exports.conditionalFormatContrastColor = conditionalFormatContrastColor; exports.getConditionalFormatCss = getConditionalFormatCss; exports.getDataBarCss = getDataBarCss; exports.conditionalFormatStyleString = conditionalFormatStyleString; exports.DEFAULT_DATA_VALIDATION_MESSAGE = DEFAULT_DATA_VALIDATION_MESSAGE; exports.DEFAULT_DATA_VALIDATION_TITLE = DEFAULT_DATA_VALIDATION_TITLE; exports.findDataValidation = findDataValidation; exports.getValidationListValues = getValidationListValues; exports.validateCellInput = validateCellInput; exports.findInvalidCells = findInvalidCells; exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT; exports.DEFAULT_COLUMN_WIDTH = DEFAULT_COLUMN_WIDTH; exports.getTableSections = getTableSections; exports.getRowSection = getRowSection; exports.rowPassesFilters = rowPassesFilters; exports.computeRowGroups = computeRowGroups; exports.buildSpreadsheetView = buildSpreadsheetView; exports.SpreadsheetController = SpreadsheetController; exports.runSpreadsheetMenuItem = runSpreadsheetMenuItem; exports.clampMenuPosition = clampMenuPosition; exports.getSpreadsheetMenuItems = getSpreadsheetMenuItems; exports.SPREADSHEET_TABLE_ACTIONS = SPREADSHEET_TABLE_ACTIONS; exports.bindSpreadsheetTableActions = bindSpreadsheetTableActions; exports.csvImportAdapter = csvImportAdapter; exports.tsvImportAdapter = tsvImportAdapter; exports.SPREADSHEET_IMPORT_ADAPTERS = SPREADSHEET_IMPORT_ADAPTERS; exports.registerSpreadsheetImportAdapters = registerSpreadsheetImportAdapters; exports.importFileIntoSpreadsheet = importFileIntoSpreadsheet; exports.getSheetTabMenuItems = getSheetTabMenuItems; exports.sheetDropIndex = sheetDropIndex; exports.getNameManagerRows = getNameManagerRows; exports.SPREADSHEET_COLUMN_HEADER_HEIGHT = SPREADSHEET_COLUMN_HEADER_HEIGHT; exports.SPREADSHEET_ROW_HEADER_WIDTH = SPREADSHEET_ROW_HEADER_WIDTH; exports.SPREADSHEET_GROUP_ROW_HEIGHT = SPREADSHEET_GROUP_ROW_HEIGHT; exports.SPREADSHEET_VIRTUAL_ROW_THRESHOLD = SPREADSHEET_VIRTUAL_ROW_THRESHOLD; exports.SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD = SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD; exports.SPREADSHEET_DEFAULT_VIEWPORT = SPREADSHEET_DEFAULT_VIEWPORT; exports.measureSpreadsheetView = measureSpreadsheetView; exports.shouldVirtualizeSpreadsheet = shouldVirtualizeSpreadsheet; exports.fullSpreadsheetViewWindow = fullSpreadsheetViewWindow; exports.getSpreadsheetViewWindow = getSpreadsheetViewWindow; exports.getSpreadsheetScrollToCell = getSpreadsheetScrollToCell; exports.sameSpreadsheetViewWindow = sameSpreadsheetViewWindow; exports.createSpreadsheetEditorDocument = createSpreadsheetEditorDocument;
|