@pixerate/editor 0.151.0 → 0.153.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/index.cjs +16 -13
- package/dist/canvas/index.js +4 -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/paint-editor/controller.d.cts +8 -2
- package/dist/paint-editor/controller.d.ts +8 -2
- package/dist/paint-editor/index.cjs +8 -4
- package/dist/paint-editor/index.js +8 -4
- 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-rich-text/SKILL.md +14 -0
- package/skills/pixerate-spreadsheet/SKILL.md +14 -0
- package/skills/pixerate-tokens/SKILL.md +56 -0
|
@@ -11,9 +11,6 @@ var _chunkLIXLD433cjs = require('../chunk-LIXLD433.cjs');
|
|
|
11
11
|
var _chunkEBDZWIOPcjs = require('../chunk-EBDZWIOP.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var _chunk5H2C3QSFcjs = require('../chunk-5H2C3QSF.cjs');
|
|
15
|
-
|
|
16
|
-
|
|
17
14
|
|
|
18
15
|
|
|
19
16
|
|
|
@@ -37,7 +34,6 @@ var _chunk5H2C3QSFcjs = require('../chunk-5H2C3QSF.cjs');
|
|
|
37
34
|
var _chunkRHXW4TA5cjs = require('../chunk-RHXW4TA5.cjs');
|
|
38
35
|
require('../chunk-BXMIBMVG.cjs');
|
|
39
36
|
require('../chunk-CVFAAZXE.cjs');
|
|
40
|
-
require('../chunk-L5OWG2NA.cjs');
|
|
41
37
|
|
|
42
38
|
|
|
43
39
|
|
|
@@ -63,6 +59,10 @@ require('../chunk-NIBFDFYW.cjs');
|
|
|
63
59
|
|
|
64
60
|
var _chunkALNIFK5Gcjs = require('../chunk-ALNIFK5G.cjs');
|
|
65
61
|
require('../chunk-UWEQ55MY.cjs');
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
var _chunk5H2C3QSFcjs = require('../chunk-5H2C3QSF.cjs');
|
|
65
|
+
require('../chunk-L5OWG2NA.cjs');
|
|
66
66
|
require('../chunk-2BSBFBOA.cjs');
|
|
67
67
|
|
|
68
68
|
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
namedWithSuggestion,
|
|
10
10
|
suggestName
|
|
11
11
|
} from "../chunk-W4KFNAWC.js";
|
|
12
|
-
import {
|
|
13
|
-
defineEditorDocument
|
|
14
|
-
} from "../chunk-GNV54DLO.js";
|
|
15
12
|
import {
|
|
16
13
|
IDENTITY_MATRIX,
|
|
17
14
|
applyMatrix,
|
|
@@ -37,7 +34,6 @@ import {
|
|
|
37
34
|
} from "../chunk-FLOGD3QB.js";
|
|
38
35
|
import "../chunk-ORDXMBD4.js";
|
|
39
36
|
import "../chunk-M6DNZNVY.js";
|
|
40
|
-
import "../chunk-WHKNYFM2.js";
|
|
41
37
|
import {
|
|
42
38
|
bezierPathLength,
|
|
43
39
|
bezierPathPointAtLength,
|
|
@@ -63,6 +59,10 @@ import {
|
|
|
63
59
|
readZip
|
|
64
60
|
} from "../chunk-CIQIM2IP.js";
|
|
65
61
|
import "../chunk-VDGBHYC7.js";
|
|
62
|
+
import {
|
|
63
|
+
defineEditorDocument
|
|
64
|
+
} from "../chunk-GNV54DLO.js";
|
|
65
|
+
import "../chunk-WHKNYFM2.js";
|
|
66
66
|
import "../chunk-HF5QZS7Z.js";
|
|
67
67
|
import {
|
|
68
68
|
HistoryManager
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ var _chunkZVNAMTFOcjs = require('../chunk-ZVNAMTFO.cjs');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkHVX35M2Icjs = require('../chunk-HVX35M2I.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -213,6 +213,9 @@ require('../chunk-WOFXZ3XU.cjs');
|
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
var _chunkYQGCPL5Xcjs = require('../chunk-YQGCPL5X.cjs');
|
|
216
|
+
require('../chunk-5H2C3QSF.cjs');
|
|
217
|
+
require('../chunk-L5OWG2NA.cjs');
|
|
218
|
+
require('../chunk-2BSBFBOA.cjs');
|
|
216
219
|
|
|
217
220
|
|
|
218
221
|
|
|
@@ -4045,7 +4048,7 @@ function getTokenPropertyScope(property, node) {
|
|
|
4045
4048
|
}
|
|
4046
4049
|
function getTokensForProperty(state, property, node) {
|
|
4047
4050
|
const scope = getTokenPropertyScope(property, node);
|
|
4048
|
-
return state.variables.filter((v) => v.type === property.type &&
|
|
4051
|
+
return state.variables.filter((v) => v.type === property.type && _chunkHVX35M2Icjs.isTokenInScope.call(void 0, v, scope));
|
|
4049
4052
|
}
|
|
4050
4053
|
function lookupOf(nodes) {
|
|
4051
4054
|
return new Map(nodes.map((n3) => [n3.id, n3]));
|
|
@@ -4053,7 +4056,7 @@ function lookupOf(nodes) {
|
|
|
4053
4056
|
function validModes(state, modes, into) {
|
|
4054
4057
|
for (const [collectionId, modeId] of Object.entries(modes)) {
|
|
4055
4058
|
if (state) {
|
|
4056
|
-
const collection =
|
|
4059
|
+
const collection = _chunkHVX35M2Icjs.getTokenCollection.call(void 0, state, collectionId);
|
|
4057
4060
|
if (!collection || !collection.modes.some((m) => m.id === modeId)) continue;
|
|
4058
4061
|
}
|
|
4059
4062
|
into[collectionId] = modeId;
|
|
@@ -4108,7 +4111,7 @@ function applyBindings(node, state, modes, options, only) {
|
|
|
4108
4111
|
if (only && !only.has(variableId)) continue;
|
|
4109
4112
|
const property = getCanvasTokenProperty(key, options);
|
|
4110
4113
|
if (!property || !property.appliesTo(next)) continue;
|
|
4111
|
-
const resolved =
|
|
4114
|
+
const resolved = _chunkHVX35M2Icjs.resolveToken.call(void 0, state, variableId, modes);
|
|
4112
4115
|
if (!resolved.ok || resolved.type !== property.type) continue;
|
|
4113
4116
|
next = property.write(next, resolved.value);
|
|
4114
4117
|
}
|
|
@@ -4131,7 +4134,7 @@ function inspectNodeTokens(node, nodes, state, options = {}) {
|
|
|
4131
4134
|
for (const [key, variableId] of Object.entries(getNodeTokenBindings(node))) {
|
|
4132
4135
|
const property = getCanvasTokenProperty(key, options);
|
|
4133
4136
|
if (!property) continue;
|
|
4134
|
-
out.push({ property, variableId, variable:
|
|
4137
|
+
out.push({ property, variableId, variable: _chunkHVX35M2Icjs.getTokenVariable.call(void 0, state, variableId), resolution: _chunkHVX35M2Icjs.resolveToken.call(void 0, state, variableId, modes) });
|
|
4135
4138
|
}
|
|
4136
4139
|
return out;
|
|
4137
4140
|
}
|
|
@@ -4143,12 +4146,12 @@ function setDataRecord(node, key, record) {
|
|
|
4143
4146
|
}
|
|
4144
4147
|
function bindCanvasToken(nodes, ids, propertyKey, variableId, state, options = {}) {
|
|
4145
4148
|
const property = getCanvasTokenProperty(propertyKey, options);
|
|
4146
|
-
if (!property) throw new (0,
|
|
4149
|
+
if (!property) throw new (0, _chunkHVX35M2Icjs.TokenError)("not-found", `No bindable property \`${propertyKey}\``);
|
|
4147
4150
|
if (variableId !== null) {
|
|
4148
|
-
const variable =
|
|
4149
|
-
if (!variable) throw new (0,
|
|
4151
|
+
const variable = _chunkHVX35M2Icjs.getTokenVariable.call(void 0, state, variableId);
|
|
4152
|
+
if (!variable) throw new (0, _chunkHVX35M2Icjs.TokenError)("not-found", `No variable \`${variableId}\``);
|
|
4150
4153
|
if (variable.type !== property.type) {
|
|
4151
|
-
throw new (0,
|
|
4154
|
+
throw new (0, _chunkHVX35M2Icjs.TokenError)("type-mismatch", `${property.label} takes a ${property.type} variable; \`${variable.name}\` is a ${variable.type}`);
|
|
4152
4155
|
}
|
|
4153
4156
|
}
|
|
4154
4157
|
const targets = new Set(ids);
|
|
@@ -4170,9 +4173,9 @@ function bindCanvasToken(nodes, ids, propertyKey, variableId, state, options = {
|
|
|
4170
4173
|
}
|
|
4171
4174
|
function setCanvasTokenMode(nodes, ids, collectionId, modeId, state, options = {}) {
|
|
4172
4175
|
if (modeId !== null) {
|
|
4173
|
-
const collection =
|
|
4174
|
-
if (!collection) throw new (0,
|
|
4175
|
-
if (!collection.modes.some((m) => m.id === modeId)) throw new (0,
|
|
4176
|
+
const collection = _chunkHVX35M2Icjs.getTokenCollection.call(void 0, state, collectionId);
|
|
4177
|
+
if (!collection) throw new (0, _chunkHVX35M2Icjs.TokenError)("not-found", `No collection \`${collectionId}\``);
|
|
4178
|
+
if (!collection.modes.some((m) => m.id === modeId)) throw new (0, _chunkHVX35M2Icjs.TokenError)("not-found", `No mode \`${modeId}\` in \`${collection.name}\``);
|
|
4176
4179
|
}
|
|
4177
4180
|
const targets = new Set(ids);
|
|
4178
4181
|
let changed = false;
|
|
@@ -4193,7 +4196,7 @@ function setCanvasTokenMode(nodes, ids, collectionId, modeId, state, options = {
|
|
|
4193
4196
|
}
|
|
4194
4197
|
function detachTokenBindings(nodes, state, variableIds, options = {}) {
|
|
4195
4198
|
const only = variableIds ? new Set(variableIds) : null;
|
|
4196
|
-
const isDetached = (id) => only ? only.has(id) : !
|
|
4199
|
+
const isDetached = (id) => only ? only.has(id) : !_chunkHVX35M2Icjs.getTokenVariable.call(void 0, state, id);
|
|
4197
4200
|
const { modesOf } = modesResolver(nodes, state, options);
|
|
4198
4201
|
let changed = false;
|
|
4199
4202
|
const out = nodes.map((node) => {
|
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,9 @@ import "../chunk-V2ZCJRDM.js";
|
|
|
213
213
|
import {
|
|
214
214
|
brushstrokeScaleBucket
|
|
215
215
|
} from "../chunk-ODBT55Q7.js";
|
|
216
|
+
import "../chunk-GNV54DLO.js";
|
|
217
|
+
import "../chunk-WHKNYFM2.js";
|
|
218
|
+
import "../chunk-HF5QZS7Z.js";
|
|
216
219
|
import {
|
|
217
220
|
ANIMATION_TIME_EPSILON,
|
|
218
221
|
AnimationPlayer,
|
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;
|