@pixerate/editor 0.150.1 → 0.152.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/agent/index.cjs +34 -34
- package/dist/agent/index.js +8 -8
- package/dist/animation-editor/editorDocument.d.cts +9 -0
- package/dist/animation-editor/editorDocument.d.ts +9 -0
- package/dist/animation-editor/index.cjs +33 -1
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +32 -0
- package/dist/bridge/cli.cjs +4 -4
- package/dist/bridge/cli.js +3 -3
- package/dist/bridge/index.cjs +4 -4
- package/dist/bridge/index.js +3 -3
- package/dist/chart/controller.d.cts +5 -0
- package/dist/chart/controller.d.ts +5 -0
- package/dist/chart/editorDocument.d.cts +10 -0
- package/dist/chart/editorDocument.d.ts +10 -0
- package/dist/chart/index.cjs +54 -18
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +37 -1
- package/dist/{chunk-ENIZYNEF.cjs → chunk-24M7VD6M.cjs} +7 -7
- package/dist/{chunk-OET45HIR.js → chunk-4RF2H3N3.js} +10 -0
- package/dist/{chunk-KC7HB5GF.cjs → chunk-5H2C3QSF.cjs} +4 -3
- package/dist/{chunk-HRLT5BYO.js → chunk-GNV54DLO.js} +2 -1
- package/dist/{chunk-EAQ4BGNS.js → chunk-MKTDELCD.js} +1 -1
- package/dist/{chunk-X35BV5YT.cjs → chunk-ML2II3Y3.cjs} +10 -0
- package/dist/{chunk-DVLMW3GB.cjs → chunk-R3PECGTQ.cjs} +44 -44
- package/dist/{chunk-2AQL4JHM.js → chunk-R6HNWN7B.js} +1 -1
- package/dist/{chunk-6QTON3VW.cjs → chunk-RZJCYJWO.cjs} +8 -8
- package/dist/{chunk-O5ML2I6O.js → chunk-SVINJIGK.js} +1 -1
- package/dist/diagram/index.cjs +6 -6
- package/dist/diagram/index.js +5 -5
- package/dist/export/index.cjs +1 -1
- package/dist/export/index.js +1 -1
- package/dist/extensions/index.cjs +5 -5
- package/dist/extensions/index.js +4 -4
- package/dist/image-editor/index.cjs +4 -4
- package/dist/image-editor/index.js +4 -4
- package/dist/index.cjs +14 -14
- package/dist/index.js +8 -8
- 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/parameters/controller.d.cts +6 -0
- package/dist/parameters/controller.d.ts +6 -0
- package/dist/parameters/editorDocument.d.cts +9 -0
- package/dist/parameters/editorDocument.d.ts +9 -0
- package/dist/parameters/index.cjs +71 -1
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +70 -0
- package/dist/persistence/editorDocument.d.cts +6 -3
- package/dist/persistence/editorDocument.d.ts +6 -3
- package/dist/persistence/index.cjs +7 -7
- package/dist/persistence/index.js +1 -1
- package/dist/tools/index.cjs +5 -5
- package/dist/tools/index.js +6 -6
- package/dist/vector/editorDocument.d.cts +9 -0
- package/dist/vector/editorDocument.d.ts +9 -0
- package/dist/vector/index.cjs +45 -1
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +44 -0
- package/dist/video-editor/editorDocument.d.cts +9 -0
- package/dist/video-editor/editorDocument.d.ts +9 -0
- package/dist/video-editor/index.cjs +33 -1
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +32 -0
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +12 -0
- package/skills/pixerate-chart/SKILL.md +12 -0
- package/skills/pixerate-parameters/SKILL.md +12 -0
- package/skills/pixerate-vector/SKILL.md +14 -0
- package/skills/pixerate-video-editor/SKILL.md +12 -0
- package/dist/{chunk-Y4BWZB6J.cjs → chunk-462WGGXX.cjs} +2 -2
- package/dist/{chunk-RFBFTLVN.js → chunk-EVXQNQND.js} +3 -3
|
@@ -1,5 +1,10 @@
|
|
|
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
|
+
require('../chunk-L5OWG2NA.cjs');
|
|
5
|
+
require('../chunk-2BSBFBOA.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
3
8
|
var _chunkFJ2MSI43cjs = require('../chunk-FJ2MSI43.cjs');
|
|
4
9
|
|
|
5
10
|
|
|
@@ -948,6 +953,35 @@ var ParametersController = (_class = class {
|
|
|
948
953
|
}
|
|
949
954
|
this.notify(changed);
|
|
950
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* Replaces every value (missing ones take their defaults) and, when given, the user presets,
|
|
958
|
+
* as one undo step. All-or-nothing: if any id is unknown or any value invalid, nothing
|
|
959
|
+
* changes and every error is returned.
|
|
960
|
+
*/
|
|
961
|
+
replace(snapshot, options = {}) {
|
|
962
|
+
const errors = [];
|
|
963
|
+
const coerced = {};
|
|
964
|
+
for (const [id, raw] of Object.entries(_nullishCoalesce(snapshot.values, () => ( {})))) {
|
|
965
|
+
if (raw === void 0) continue;
|
|
966
|
+
const field = this.fieldMap.get(id);
|
|
967
|
+
if (!field) {
|
|
968
|
+
errors.push({ id, path: `/${id}`, message: unknownMessage(id, this.fields) });
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
const result = coerceParameterValue(field, raw);
|
|
972
|
+
if (result.ok) coerced[id] = result.value;
|
|
973
|
+
else errors.push(result.error);
|
|
974
|
+
}
|
|
975
|
+
if (errors.length) {
|
|
976
|
+
this.reject(errors.filter((e) => this.fieldMap.has(e.id)));
|
|
977
|
+
return { ok: false, errors, message: errors.map((e) => e.message).join(" ") };
|
|
978
|
+
}
|
|
979
|
+
const after = this.diff({ ...this.defaults, ...coerced });
|
|
980
|
+
const presets = snapshot.presets ? { before: this.userPresets, after: snapshot.presets.map((p) => ({ ...p, values: { ...p.values }, builtIn: false })) } : void 0;
|
|
981
|
+
const changed = Object.keys(after);
|
|
982
|
+
if (changed.length || presets) this.record(_nullishCoalesce(options.label, () => ( "Replace parameters")), after, presets ? { presets } : {});
|
|
983
|
+
return { ok: true, values: { ...this.values }, changed };
|
|
984
|
+
}
|
|
951
985
|
undo() {
|
|
952
986
|
this.endGesture();
|
|
953
987
|
return this.history.undo();
|
|
@@ -1291,6 +1325,42 @@ function mapRange(value, from, to, options) {
|
|
|
1291
1325
|
return createRangeMapper({ from, to, ...options })(value);
|
|
1292
1326
|
}
|
|
1293
1327
|
|
|
1328
|
+
// src/parameters/editorDocument.ts
|
|
1329
|
+
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
1330
|
+
function createParametersEditorDocument(controller) {
|
|
1331
|
+
return _chunk5H2C3QSFcjs.defineEditorDocument.call(void 0, {
|
|
1332
|
+
kind: "parameters",
|
|
1333
|
+
get: () => controller.toJSON(),
|
|
1334
|
+
load: (document, { history }) => {
|
|
1335
|
+
if (!isRecord(document) || !isRecord(document.values)) throw new Error("A parameters document is { values: { <field id>: value }, presets?: [...] }.");
|
|
1336
|
+
if (document.presets !== void 0 && !Array.isArray(document.presets)) throw new Error("presets must be an array of presets.");
|
|
1337
|
+
const snapshot = document;
|
|
1338
|
+
if (history === "record") {
|
|
1339
|
+
const result = controller.replace(snapshot);
|
|
1340
|
+
if (!result.ok) throw new Error(result.message);
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
controller.load(snapshot, { clearHistory: true });
|
|
1344
|
+
return { problems: Object.entries(controller.getState().errors).map(([section, message]) => ({ section, message })) };
|
|
1345
|
+
},
|
|
1346
|
+
subscribe: (listener) => {
|
|
1347
|
+
let saved = JSON.stringify(controller.toJSON());
|
|
1348
|
+
return controller.subscribe(() => {
|
|
1349
|
+
const next = JSON.stringify(controller.toJSON());
|
|
1350
|
+
if (next === saved) return;
|
|
1351
|
+
saved = next;
|
|
1352
|
+
listener();
|
|
1353
|
+
});
|
|
1354
|
+
},
|
|
1355
|
+
history: {
|
|
1356
|
+
undo: () => controller.undo(),
|
|
1357
|
+
redo: () => controller.redo(),
|
|
1358
|
+
getState: () => controller.history.getState()
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
|
|
1294
1364
|
|
|
1295
1365
|
|
|
1296
1366
|
|
|
@@ -1340,4 +1410,4 @@ function mapRange(value, from, to, options) {
|
|
|
1340
1410
|
|
|
1341
1411
|
|
|
1342
1412
|
|
|
1343
|
-
exports.PARAMETER_KEY_TOLERANCE = PARAMETER_KEY_TOLERANCE; exports.ParameterSchemaError = ParameterSchemaError; exports.ParametersController = ParametersController; exports.checkParameterSchema = checkParameterSchema; exports.choiceOptionLabel = choiceOptionLabel; exports.clampParameterNumber = clampParameterNumber; exports.cloneValue = cloneValue; exports.coerceParameterValue = coerceParameterValue; exports.createParameterCommands = createParameterCommands; exports.createParameterKeyframeStore = createParameterKeyframeStore; exports.createParametersController = createParametersController; exports.createRangeMapper = createRangeMapper; exports.evaluateParameterCondition = evaluateParameterCondition; exports.findParameterKeyframe = findParameterKeyframe; exports.formatParameterNumber = formatParameterNumber; exports.formatParameterValue = formatParameterValue; exports.getChoiceOptions = getChoiceOptions; exports.getParameterDefaults = getParameterDefaults; exports.getParameterFields = getParameterFields; exports.getParameterGroups = getParameterGroups; exports.getParameterKeyState = getParameterKeyState; exports.getParameterVisibility = getParameterVisibility; exports.hexToRgba01 = hexToRgba01; exports.humanizeParameterId = humanizeParameterId; exports.isParameterGroup = isParameterGroup; exports.isSliderField = isSliderField; exports.mapRange = mapRange; exports.normalizeHexColor = normalizeHexColor; exports.parameterDecimals = parameterDecimals; exports.parameterFieldFromShaderControl = parameterFieldFromShaderControl; exports.parameterFieldToJsonSchema = parameterFieldToJsonSchema; exports.parameterLabel = parameterLabel; exports.parameterSchemaFromShaderControls = parameterSchemaFromShaderControls; exports.parameterSchemaToJsonSchema = parameterSchemaToJsonSchema; exports.parameterStep = parameterStep; exports.parameterValueFromShaderControl = parameterValueFromShaderControl; exports.parameterValuesEqual = parameterValuesEqual; exports.parseParameterNumberInput = parseParameterNumberInput; exports.planParameterSetPlayback = planParameterSetPlayback; exports.rgba01ToHex = rgba01ToHex; exports.seededRandom = seededRandom; exports.shaderControlValue = shaderControlValue; exports.validateParameterValue = validateParameterValue; exports.validateParameterValues = validateParameterValues; exports.vectorComponentField = vectorComponentField; exports.vectorSize = vectorSize; exports.withParameterKeyframe = withParameterKeyframe; exports.withParameterPlayback = withParameterPlayback; exports.withoutParameterKeyframe = withoutParameterKeyframe;
|
|
1413
|
+
exports.PARAMETER_KEY_TOLERANCE = PARAMETER_KEY_TOLERANCE; exports.ParameterSchemaError = ParameterSchemaError; exports.ParametersController = ParametersController; exports.checkParameterSchema = checkParameterSchema; exports.choiceOptionLabel = choiceOptionLabel; exports.clampParameterNumber = clampParameterNumber; exports.cloneValue = cloneValue; exports.coerceParameterValue = coerceParameterValue; exports.createParameterCommands = createParameterCommands; exports.createParameterKeyframeStore = createParameterKeyframeStore; exports.createParametersController = createParametersController; exports.createParametersEditorDocument = createParametersEditorDocument; exports.createRangeMapper = createRangeMapper; exports.evaluateParameterCondition = evaluateParameterCondition; exports.findParameterKeyframe = findParameterKeyframe; exports.formatParameterNumber = formatParameterNumber; exports.formatParameterValue = formatParameterValue; exports.getChoiceOptions = getChoiceOptions; exports.getParameterDefaults = getParameterDefaults; exports.getParameterFields = getParameterFields; exports.getParameterGroups = getParameterGroups; exports.getParameterKeyState = getParameterKeyState; exports.getParameterVisibility = getParameterVisibility; exports.hexToRgba01 = hexToRgba01; exports.humanizeParameterId = humanizeParameterId; exports.isParameterGroup = isParameterGroup; exports.isSliderField = isSliderField; exports.mapRange = mapRange; exports.normalizeHexColor = normalizeHexColor; exports.parameterDecimals = parameterDecimals; exports.parameterFieldFromShaderControl = parameterFieldFromShaderControl; exports.parameterFieldToJsonSchema = parameterFieldToJsonSchema; exports.parameterLabel = parameterLabel; exports.parameterSchemaFromShaderControls = parameterSchemaFromShaderControls; exports.parameterSchemaToJsonSchema = parameterSchemaToJsonSchema; exports.parameterStep = parameterStep; exports.parameterValueFromShaderControl = parameterValueFromShaderControl; exports.parameterValuesEqual = parameterValuesEqual; exports.parseParameterNumberInput = parseParameterNumberInput; exports.planParameterSetPlayback = planParameterSetPlayback; exports.rgba01ToHex = rgba01ToHex; exports.seededRandom = seededRandom; exports.shaderControlValue = shaderControlValue; exports.validateParameterValue = validateParameterValue; exports.validateParameterValues = validateParameterValues; exports.vectorComponentField = vectorComponentField; exports.vectorSize = vectorSize; exports.withParameterKeyframe = withParameterKeyframe; exports.withParameterPlayback = withParameterPlayback; exports.withoutParameterKeyframe = withoutParameterKeyframe;
|
package/dist/parameters/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineEditorDocument
|
|
3
|
+
} from "../chunk-GNV54DLO.js";
|
|
4
|
+
import "../chunk-WHKNYFM2.js";
|
|
5
|
+
import "../chunk-HF5QZS7Z.js";
|
|
1
6
|
import {
|
|
2
7
|
HistoryManager
|
|
3
8
|
} from "../chunk-RNSANXPT.js";
|
|
@@ -948,6 +953,35 @@ var ParametersController = class {
|
|
|
948
953
|
}
|
|
949
954
|
this.notify(changed);
|
|
950
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* Replaces every value (missing ones take their defaults) and, when given, the user presets,
|
|
958
|
+
* as one undo step. All-or-nothing: if any id is unknown or any value invalid, nothing
|
|
959
|
+
* changes and every error is returned.
|
|
960
|
+
*/
|
|
961
|
+
replace(snapshot, options = {}) {
|
|
962
|
+
const errors = [];
|
|
963
|
+
const coerced = {};
|
|
964
|
+
for (const [id, raw] of Object.entries(snapshot.values ?? {})) {
|
|
965
|
+
if (raw === void 0) continue;
|
|
966
|
+
const field = this.fieldMap.get(id);
|
|
967
|
+
if (!field) {
|
|
968
|
+
errors.push({ id, path: `/${id}`, message: unknownMessage(id, this.fields) });
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
const result = coerceParameterValue(field, raw);
|
|
972
|
+
if (result.ok) coerced[id] = result.value;
|
|
973
|
+
else errors.push(result.error);
|
|
974
|
+
}
|
|
975
|
+
if (errors.length) {
|
|
976
|
+
this.reject(errors.filter((e) => this.fieldMap.has(e.id)));
|
|
977
|
+
return { ok: false, errors, message: errors.map((e) => e.message).join(" ") };
|
|
978
|
+
}
|
|
979
|
+
const after = this.diff({ ...this.defaults, ...coerced });
|
|
980
|
+
const presets = snapshot.presets ? { before: this.userPresets, after: snapshot.presets.map((p) => ({ ...p, values: { ...p.values }, builtIn: false })) } : void 0;
|
|
981
|
+
const changed = Object.keys(after);
|
|
982
|
+
if (changed.length || presets) this.record(options.label ?? "Replace parameters", after, presets ? { presets } : {});
|
|
983
|
+
return { ok: true, values: { ...this.values }, changed };
|
|
984
|
+
}
|
|
951
985
|
undo() {
|
|
952
986
|
this.endGesture();
|
|
953
987
|
return this.history.undo();
|
|
@@ -1290,6 +1324,41 @@ function createRangeMapper(options = {}) {
|
|
|
1290
1324
|
function mapRange(value, from, to, options) {
|
|
1291
1325
|
return createRangeMapper({ from, to, ...options })(value);
|
|
1292
1326
|
}
|
|
1327
|
+
|
|
1328
|
+
// src/parameters/editorDocument.ts
|
|
1329
|
+
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
1330
|
+
function createParametersEditorDocument(controller) {
|
|
1331
|
+
return defineEditorDocument({
|
|
1332
|
+
kind: "parameters",
|
|
1333
|
+
get: () => controller.toJSON(),
|
|
1334
|
+
load: (document, { history }) => {
|
|
1335
|
+
if (!isRecord(document) || !isRecord(document.values)) throw new Error("A parameters document is { values: { <field id>: value }, presets?: [...] }.");
|
|
1336
|
+
if (document.presets !== void 0 && !Array.isArray(document.presets)) throw new Error("presets must be an array of presets.");
|
|
1337
|
+
const snapshot = document;
|
|
1338
|
+
if (history === "record") {
|
|
1339
|
+
const result = controller.replace(snapshot);
|
|
1340
|
+
if (!result.ok) throw new Error(result.message);
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
controller.load(snapshot, { clearHistory: true });
|
|
1344
|
+
return { problems: Object.entries(controller.getState().errors).map(([section, message]) => ({ section, message })) };
|
|
1345
|
+
},
|
|
1346
|
+
subscribe: (listener) => {
|
|
1347
|
+
let saved = JSON.stringify(controller.toJSON());
|
|
1348
|
+
return controller.subscribe(() => {
|
|
1349
|
+
const next = JSON.stringify(controller.toJSON());
|
|
1350
|
+
if (next === saved) return;
|
|
1351
|
+
saved = next;
|
|
1352
|
+
listener();
|
|
1353
|
+
});
|
|
1354
|
+
},
|
|
1355
|
+
history: {
|
|
1356
|
+
undo: () => controller.undo(),
|
|
1357
|
+
redo: () => controller.redo(),
|
|
1358
|
+
getState: () => controller.history.getState()
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1293
1362
|
export {
|
|
1294
1363
|
PARAMETER_KEY_TOLERANCE,
|
|
1295
1364
|
ParameterSchemaError,
|
|
@@ -1302,6 +1371,7 @@ export {
|
|
|
1302
1371
|
createParameterCommands,
|
|
1303
1372
|
createParameterKeyframeStore,
|
|
1304
1373
|
createParametersController,
|
|
1374
|
+
createParametersEditorDocument,
|
|
1305
1375
|
createRangeMapper,
|
|
1306
1376
|
evaluateParameterCondition,
|
|
1307
1377
|
findParameterKeyframe,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LoadReport } from "./migrate.cjs";
|
|
1
|
+
import { type LoadReport, type SectionProblem } from "./migrate.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* Undo / redo of an editor. Satisfies `HistoryCommandTarget`, so
|
|
4
4
|
* `createHistoryCommands(doc.history)` works for every editor.
|
|
@@ -97,11 +97,14 @@ export interface EditorDocumentSpec<T> {
|
|
|
97
97
|
get(): T;
|
|
98
98
|
/**
|
|
99
99
|
* Replaces the document. Throw (with a message saying what is wrong) before
|
|
100
|
-
* changing anything when `document` does not fit.
|
|
100
|
+
* changing anything when `document` does not fit. Return `problems` for parts
|
|
101
|
+
* that were repaired with defaults (they land in the `LoadReport`).
|
|
101
102
|
*/
|
|
102
103
|
load(document: unknown, options: {
|
|
103
104
|
history: "reset" | "record";
|
|
104
|
-
}): void
|
|
105
|
+
}): void | {
|
|
106
|
+
problems?: SectionProblem[];
|
|
107
|
+
};
|
|
105
108
|
/** Calls `listener` after each document change (not selection or view changes). */
|
|
106
109
|
subscribe(listener: () => void): () => void;
|
|
107
110
|
history: EditorDocumentHistory;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LoadReport } from "./migrate.js";
|
|
1
|
+
import { type LoadReport, type SectionProblem } from "./migrate.js";
|
|
2
2
|
/**
|
|
3
3
|
* Undo / redo of an editor. Satisfies `HistoryCommandTarget`, so
|
|
4
4
|
* `createHistoryCommands(doc.history)` works for every editor.
|
|
@@ -97,11 +97,14 @@ export interface EditorDocumentSpec<T> {
|
|
|
97
97
|
get(): T;
|
|
98
98
|
/**
|
|
99
99
|
* Replaces the document. Throw (with a message saying what is wrong) before
|
|
100
|
-
* changing anything when `document` does not fit.
|
|
100
|
+
* changing anything when `document` does not fit. Return `problems` for parts
|
|
101
|
+
* that were repaired with defaults (they land in the `LoadReport`).
|
|
101
102
|
*/
|
|
102
103
|
load(document: unknown, options: {
|
|
103
104
|
history: "reset" | "record";
|
|
104
|
-
}): void
|
|
105
|
+
}): void | {
|
|
106
|
+
problems?: SectionProblem[];
|
|
107
|
+
};
|
|
105
108
|
/** Calls `listener` after each document change (not selection or view changes). */
|
|
106
109
|
subscribe(listener: () => void): () => void;
|
|
107
110
|
history: EditorDocumentHistory;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk5H2C3QSFcjs = require('../chunk-5H2C3QSF.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -668,8 +668,8 @@ function createEditorAutosave(doc, options) {
|
|
|
668
668
|
const controller = createAutosaveController({
|
|
669
669
|
...rest,
|
|
670
670
|
key: _nullishCoalesce(key, () => ( doc.kind)),
|
|
671
|
-
getSnapshot: () =>
|
|
672
|
-
deserialize: (text) =>
|
|
671
|
+
getSnapshot: () => _chunk5H2C3QSFcjs.toEditorDocumentFile.call(void 0, doc),
|
|
672
|
+
deserialize: (text) => _chunk5H2C3QSFcjs.parseEditorDocument.call(void 0, text, { kind: doc.kind }),
|
|
673
673
|
revision: revisions.revision,
|
|
674
674
|
savedRevision: revisions.savedRevision
|
|
675
675
|
});
|
|
@@ -742,7 +742,7 @@ function createEditorDocumentStore(options) {
|
|
|
742
742
|
const newestFirst = (a, b) => a.savedAt < b.savedAt ? 1 : a.savedAt > b.savedAt ? -1 : 0;
|
|
743
743
|
const readFile = async (key) => {
|
|
744
744
|
const raw = await storage.get(fileKey(key));
|
|
745
|
-
return raw === null ? null :
|
|
745
|
+
return raw === null ? null : _chunk5H2C3QSFcjs.parseEditorDocument.call(void 0, raw);
|
|
746
746
|
};
|
|
747
747
|
return {
|
|
748
748
|
save: (doc, name) => run(async () => {
|
|
@@ -754,7 +754,7 @@ function createEditorDocumentStore(options) {
|
|
|
754
754
|
formatVersion: doc.formatVersion,
|
|
755
755
|
savedAt: new Date(now()).toISOString()
|
|
756
756
|
};
|
|
757
|
-
await storage.set(fileKey(entry.key), JSON.stringify(
|
|
757
|
+
await storage.set(fileKey(entry.key), JSON.stringify(_chunk5H2C3QSFcjs.toEditorDocumentFile.call(void 0, doc, trimmed)));
|
|
758
758
|
await saveIndex([...(await loadIndex()).filter((item) => item.key !== entry.key), entry]);
|
|
759
759
|
return entry;
|
|
760
760
|
}),
|
|
@@ -765,7 +765,7 @@ function createEditorDocumentStore(options) {
|
|
|
765
765
|
const file = entry ? await readFile(key) : null;
|
|
766
766
|
if (!entry || !file) {
|
|
767
767
|
const keys = (await loadIndex()).filter((item) => item.kind === doc.kind).sort(newestFirst).map((item) => item.key);
|
|
768
|
-
throw new (0,
|
|
768
|
+
throw new (0, _chunk5H2C3QSFcjs.EditorDocumentLoadError)(
|
|
769
769
|
`There is no saved document "${key}". ${keys.length ? `Saved ${doc.kind} documents: ${keys.join(", ")}.` : `No ${doc.kind} documents are saved yet.`}`
|
|
770
770
|
);
|
|
771
771
|
}
|
|
@@ -966,4 +966,4 @@ function createDocumentToolProvider(doc, options = {}) {
|
|
|
966
966
|
|
|
967
967
|
|
|
968
968
|
|
|
969
|
-
exports.EDITOR_DOCUMENT_FORMAT =
|
|
969
|
+
exports.EDITOR_DOCUMENT_FORMAT = _chunk5H2C3QSFcjs.EDITOR_DOCUMENT_FORMAT; exports.EditorDocumentLoadError = _chunk5H2C3QSFcjs.EditorDocumentLoadError; exports.InjectedStorageError = InjectedStorageError; exports.StorageUnavailableError = StorageUnavailableError; exports.createAutosaveController = createAutosaveController; exports.createDocumentToolProvider = createDocumentToolProvider; exports.createEditorAutosave = createEditorAutosave; exports.createEditorDocumentStore = createEditorDocumentStore; exports.createIndexedDbAdapter = createIndexedDbAdapter; exports.createLoadReport = _chunkL5OWG2NAcjs.createLoadReport; exports.createLocalStorageAdapter = createLocalStorageAdapter; exports.createMemoryStorage = createMemoryStorage; exports.createOpfsAdapter = createOpfsAdapter; exports.createRecoveryPolicy = createRecoveryPolicy; exports.createRevisionTracker = createRevisionTracker; exports.defineEditorDocument = _chunk5H2C3QSFcjs.defineEditorDocument; exports.exponentialBackoff = exponentialBackoff; exports.formatRecoveryMessage = formatRecoveryMessage; exports.hasLoadProblems = _chunkL5OWG2NAcjs.hasLoadProblems; exports.isEditorDocumentFile = _chunk5H2C3QSFcjs.isEditorDocumentFile; exports.isIndexedDbAvailable = isIndexedDbAvailable; exports.isLocalStorageAvailable = isLocalStorageAvailable; exports.isOpfsAvailable = isOpfsAvailable; exports.loadDocument = _chunkL5OWG2NAcjs.loadDocument; exports.loadSections = _chunkL5OWG2NAcjs.loadSections; exports.migrateDocument = _chunkL5OWG2NAcjs.migrateDocument; exports.parseEditorDocument = _chunk5H2C3QSFcjs.parseEditorDocument; exports.recoveryMetaKey = recoveryMetaKey; exports.serializeEditorDocument = _chunk5H2C3QSFcjs.serializeEditorDocument; exports.slugifyDocumentName = slugifyDocumentName; exports.toEditorDocumentFile = _chunk5H2C3QSFcjs.toEditorDocumentFile; exports.withStorageFailures = withStorageFailures;
|
package/dist/tools/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var _chunkERAGQL2Ncjs = require('../chunk-ERAGQL2N.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunk462WGGXXcjs = require('../chunk-462WGGXX.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -82,19 +82,19 @@ var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
var _chunk2BSBFBOAcjs = require('../chunk-2BSBFBOA.cjs');
|
|
86
85
|
|
|
87
86
|
|
|
88
87
|
|
|
89
88
|
|
|
89
|
+
var _chunkSWTUM32Hcjs = require('../chunk-SWTUM32H.cjs');
|
|
90
90
|
|
|
91
91
|
|
|
92
|
+
var _chunkWOFXZ3XUcjs = require('../chunk-WOFXZ3XU.cjs');
|
|
92
93
|
|
|
93
94
|
|
|
94
|
-
var _chunkSWTUM32Hcjs = require('../chunk-SWTUM32H.cjs');
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
var
|
|
97
|
+
var _chunk2BSBFBOAcjs = require('../chunk-2BSBFBOA.cjs');
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
|
|
@@ -177,4 +177,4 @@ var _chunkWOFXZ3XUcjs = require('../chunk-WOFXZ3XU.cjs');
|
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
exports.AgentPlayback = _chunkGMWNBSBScjs.AgentPlayback; exports.CAPTURE_EXCLUDE_SELECTOR = _chunkSVFEVKLFcjs.CAPTURE_EXCLUDE_SELECTOR; exports.CAPTURE_OVERLAY_SELECTORS = _chunkSVFEVKLFcjs.CAPTURE_OVERLAY_SELECTORS; exports.EDITOR_CANVAS_TOOLS = _chunkSVFEVKLFcjs.EDITOR_CANVAS_TOOLS; exports.EDITOR_MCP_TOOLS = _chunkSVFEVKLFcjs.EDITOR_MCP_TOOLS; exports.EDITOR_PROMPT_TOOLS = _chunkSVFEVKLFcjs.EDITOR_PROMPT_TOOLS; exports.EDIT_OPERATION_REQUIRED_ARGUMENTS = _chunkSVFEVKLFcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS; exports.EXPORT_EXCLUDED_SELECTORS = _chunkSVFEVKLFcjs.EXPORT_EXCLUDED_SELECTORS; exports.JSON_RPC_ERRORS =
|
|
180
|
+
exports.AgentPlayback = _chunkGMWNBSBScjs.AgentPlayback; exports.CAPTURE_EXCLUDE_SELECTOR = _chunkSVFEVKLFcjs.CAPTURE_EXCLUDE_SELECTOR; exports.CAPTURE_OVERLAY_SELECTORS = _chunkSVFEVKLFcjs.CAPTURE_OVERLAY_SELECTORS; exports.EDITOR_CANVAS_TOOLS = _chunkSVFEVKLFcjs.EDITOR_CANVAS_TOOLS; exports.EDITOR_MCP_TOOLS = _chunkSVFEVKLFcjs.EDITOR_MCP_TOOLS; exports.EDITOR_PROMPT_TOOLS = _chunkSVFEVKLFcjs.EDITOR_PROMPT_TOOLS; exports.EDIT_OPERATION_REQUIRED_ARGUMENTS = _chunkSVFEVKLFcjs.EDIT_OPERATION_REQUIRED_ARGUMENTS; exports.EXPORT_EXCLUDED_SELECTORS = _chunkSVFEVKLFcjs.EXPORT_EXCLUDED_SELECTORS; exports.JSON_RPC_ERRORS = _chunk462WGGXXcjs.JSON_RPC_ERRORS; exports.MCP_PROTOCOL_VERSIONS = _chunk462WGGXXcjs.MCP_PROTOCOL_VERSIONS; exports.MCP_TOOL_CANVAS_ADD_NODE = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_ADD_NODE; exports.MCP_TOOL_CANVAS_CONNECT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_CONNECT; exports.MCP_TOOL_CANVAS_HIGHLIGHT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_HIGHLIGHT; exports.MCP_TOOL_CANVAS_LAYOUT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_LAYOUT; exports.MCP_TOOL_CANVAS_REMOVE_NODES = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_REMOVE_NODES; exports.MCP_TOOL_CANVAS_SELECT = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_SELECT; exports.MCP_TOOL_CANVAS_UPDATE_NODE = _chunkSVFEVKLFcjs.MCP_TOOL_CANVAS_UPDATE_NODE; exports.MCP_TOOL_EDIT_CANVAS = _chunkSVFEVKLFcjs.MCP_TOOL_EDIT_CANVAS; exports.MCP_TOOL_EDIT_PROMPT = _chunkSVFEVKLFcjs.MCP_TOOL_EDIT_PROMPT; exports.MCP_TOOL_GET_EDITOR_STATE = _chunkSVFEVKLFcjs.MCP_TOOL_GET_EDITOR_STATE; exports.MCP_TOOL_PROMPT_INSERT_TEXT = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_INSERT_TEXT; exports.MCP_TOOL_PROMPT_REPLACE_RANGE = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_REPLACE_RANGE; exports.MCP_TOOL_PROMPT_SELECT = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_SELECT; exports.MCP_TOOL_PROMPT_SET_VARIABLE = _chunkSVFEVKLFcjs.MCP_TOOL_PROMPT_SET_VARIABLE; exports.MCP_TOOL_VIEW_EDITOR = _chunkSVFEVKLFcjs.MCP_TOOL_VIEW_EDITOR; exports.PRESENCE_COLORS = _chunkSWTUM32Hcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkSWTUM32Hcjs.PerformanceQueue; exports.PresenceStore = _chunkSWTUM32Hcjs.PresenceStore; exports.TOOL_BRIDGE_DEFAULT_PORT = _chunk462WGGXXcjs.TOOL_BRIDGE_DEFAULT_PORT; exports.TOOL_BRIDGE_PROTOCOL = _chunk462WGGXXcjs.TOOL_BRIDGE_PROTOCOL; exports.TOOL_DISCOVERY_TOOLS = _chunk462WGGXXcjs.TOOL_DISCOVERY_TOOLS; exports.TOOL_NAMESPACE_SEPARATOR = _chunk462WGGXXcjs.TOOL_NAMESPACE_SEPARATOR; exports.ToolRegistry = _chunk462WGGXXcjs.ToolRegistry; exports.ToolRegistryError = _chunk462WGGXXcjs.ToolRegistryError; exports.ToolRegistryView = _chunk462WGGXXcjs.ToolRegistryView; exports.UNSAFE_JSON_KEYS = _chunk2BSBFBOAcjs.UNSAFE_JSON_KEYS; exports.baseToolName = _chunk462WGGXXcjs.baseToolName; exports.captureInputSchema = _chunkN2FGYZ4Qcjs.captureInputSchema; exports.captureOutputSize = _chunkN2FGYZ4Qcjs.captureOutputSize; exports.cloneElementWithStyles = _chunkSVFEVKLFcjs.cloneElementWithStyles; exports.connectToolBridge = _chunk462WGGXXcjs.connectToolBridge; exports.createAgentPlayback = _chunkGMWNBSBScjs.createAgentPlayback; exports.createCaptureTool = _chunkN2FGYZ4Qcjs.createCaptureTool; exports.createCaptureToolProvider = _chunkN2FGYZ4Qcjs.createCaptureToolProvider; exports.createElementCaptureSurface = _chunkSVFEVKLFcjs.createElementCaptureSurface; exports.createInstantPresenceClock = _chunkSWTUM32Hcjs.createInstantPresenceClock; exports.createMcpServer = _chunk462WGGXXcjs.createMcpServer; exports.createPlaybackToolProvider = _chunkGMWNBSBScjs.createPlaybackToolProvider; exports.createToolRegistry = _chunk462WGGXXcjs.createToolRegistry; exports.derivePlaybackSteps = _chunkGMWNBSBScjs.derivePlaybackSteps; exports.elementToSvg = _chunkSVFEVKLFcjs.elementToSvg; exports.errorResult = _chunk462WGGXXcjs.errorResult; exports.isUnsafeJsonKey = _chunk2BSBFBOAcjs.isUnsafeJsonKey; exports.listSkills = _chunk462WGGXXcjs.listSkills; exports.locatePlaybackChrome = _chunkGMWNBSBScjs.locatePlaybackChrome; exports.parseSkillFrontmatter = _chunk462WGGXXcjs.parseSkillFrontmatter; exports.playbackRectFromClient = _chunkGMWNBSBScjs.playbackRectFromClient; exports.playbackRefsFromArgs = _chunkGMWNBSBScjs.playbackRefsFromArgs; exports.playbackRefsFromResult = _chunkGMWNBSBScjs.playbackRefsFromResult; exports.rasterizeElement = _chunkSVFEVKLFcjs.rasterizeElement; exports.readSkillFile = _chunk462WGGXXcjs.readSkillFile; exports.readingTime = _chunkGMWNBSBScjs.readingTime; exports.realPresenceClock = _chunkSWTUM32Hcjs.realPresenceClock; exports.resolveCaptureRequest = _chunkN2FGYZ4Qcjs.resolveCaptureRequest; exports.runToolScript = _chunkERAGQL2Ncjs.runToolScript; exports.searchTokens = _chunk462WGGXXcjs.searchTokens; exports.searchTools = _chunk462WGGXXcjs.searchTools; exports.stripPrototypeKeys = _chunk2BSBFBOAcjs.stripPrototypeKeys; exports.summarize = _chunk462WGGXXcjs.summarize; exports.toCapturedImageData = _chunkN2FGYZ4Qcjs.toCapturedImageData; exports.toToolResult = _chunk462WGGXXcjs.toToolResult; exports.toolResultError = _chunkERAGQL2Ncjs.toolResultError; exports.toolResultValue = _chunkERAGQL2Ncjs.toolResultValue; exports.toolsetInstructions = _chunk462WGGXXcjs.toolsetInstructions; exports.toolsetName = _chunk462WGGXXcjs.toolsetName; exports.trackPresenceDrag = _chunkSWTUM32Hcjs.trackPresenceDrag; exports.tweenPresenceCursor = _chunkSWTUM32Hcjs.tweenPresenceCursor; exports.unionCaptureRects = _chunkN2FGYZ4Qcjs.unionCaptureRects; exports.unionRects = _chunkGMWNBSBScjs.unionRects; exports.unknownToolMessage = _chunk462WGGXXcjs.unknownToolMessage; exports.validateJsonSchema = _chunkWOFXZ3XUcjs.validateJsonSchema;
|
package/dist/tools/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
toolsetInstructions,
|
|
29
29
|
toolsetName,
|
|
30
30
|
unknownToolMessage
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-EVXQNQND.js";
|
|
32
32
|
import {
|
|
33
33
|
AgentPlayback,
|
|
34
34
|
createAgentPlayback,
|
|
@@ -78,11 +78,6 @@ import {
|
|
|
78
78
|
toCapturedImageData,
|
|
79
79
|
unionCaptureRects
|
|
80
80
|
} from "../chunk-5ED73EC6.js";
|
|
81
|
-
import {
|
|
82
|
-
UNSAFE_JSON_KEYS,
|
|
83
|
-
isUnsafeJsonKey,
|
|
84
|
-
stripPrototypeKeys
|
|
85
|
-
} from "../chunk-HF5QZS7Z.js";
|
|
86
81
|
import {
|
|
87
82
|
PRESENCE_COLORS,
|
|
88
83
|
PerformanceQueue,
|
|
@@ -95,6 +90,11 @@ import {
|
|
|
95
90
|
import {
|
|
96
91
|
validateJsonSchema
|
|
97
92
|
} from "../chunk-V2ZCJRDM.js";
|
|
93
|
+
import {
|
|
94
|
+
UNSAFE_JSON_KEYS,
|
|
95
|
+
isUnsafeJsonKey,
|
|
96
|
+
stripPrototypeKeys
|
|
97
|
+
} from "../chunk-HF5QZS7Z.js";
|
|
98
98
|
export {
|
|
99
99
|
AgentPlayback,
|
|
100
100
|
CAPTURE_EXCLUDE_SELECTOR,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EditorDocument } from '../persistence/editorDocument.cjs';
|
|
2
|
+
import type { VectorEditorController } from './controller.cjs';
|
|
3
|
+
import type { VectorDocument } from './types.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* The save / load / undo contract for a `VectorEditorController` (kind `vector`, document: the
|
|
6
|
+
* `VectorDocument` from `toJSON`). Recorded loads are one undo step. The tool, selection and
|
|
7
|
+
* view are not part of the document.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createVectorEditorDocument(controller: VectorEditorController): EditorDocument<VectorDocument>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EditorDocument } from '../persistence/editorDocument.js';
|
|
2
|
+
import type { VectorEditorController } from './controller.js';
|
|
3
|
+
import type { VectorDocument } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The save / load / undo contract for a `VectorEditorController` (kind `vector`, document: the
|
|
6
|
+
* `VectorDocument` from `toJSON`). Recorded loads are one undo step. The tool, selection and
|
|
7
|
+
* view are not part of the document.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createVectorEditorDocument(controller: VectorEditorController): EditorDocument<VectorDocument>;
|