@pixerate/editor 0.145.0 → 0.147.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/README.md +4 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/agent/index.cjs +36 -34
- package/dist/agent/index.js +7 -5
- package/dist/animation/index.cjs +5 -3
- package/dist/animation/index.js +4 -2
- package/dist/animation-editor/index.cjs +62 -60
- package/dist/animation-editor/index.js +6 -4
- package/dist/canvas/index.cjs +36 -34
- package/dist/canvas/index.js +19 -17
- package/dist/chart/index.cjs +88 -86
- package/dist/chart/index.js +7 -5
- package/dist/{chunk-WBJ6BG4R.js → chunk-2AQL4JHM.js} +6 -6
- package/dist/{chunk-HLMF3E53.cjs → chunk-2WDZI6QD.cjs} +15 -15
- package/dist/{chunk-ZNHB5RG6.js → chunk-37RLSNQ3.js} +2 -2
- package/dist/{chunk-5WOY52O6.cjs → chunk-4YQKRHMI.cjs} +8 -8
- package/dist/chunk-6ONMQ6WF.js +113 -0
- package/dist/{chunk-L434J57V.cjs → chunk-6QTON3VW.cjs} +16 -16
- package/dist/chunk-AA34BA7G.js +1913 -0
- package/dist/{chunk-QX25HWFL.js → chunk-AY65VQSU.js} +1 -1
- package/dist/{chunk-ONZJD2OD.cjs → chunk-BROJYMWU.cjs} +57 -153
- package/dist/{chunk-YM75DN54.js → chunk-DSZCDNTM.js} +1 -1
- package/dist/{chunk-PUR6BZFA.cjs → chunk-DVLMW3GB.cjs} +53 -53
- package/dist/{chunk-ALUWD3FG.js → chunk-EIUTJPEL.js} +1 -1
- package/dist/{chunk-X65C4DWV.js → chunk-EQ4SF4X4.js} +1 -1
- package/dist/{chunk-77SG47WT.js → chunk-FLOGD3QB.js} +1 -1
- package/dist/chunk-HRLT5BYO.js +133 -0
- package/dist/{chunk-AJSW5GMP.js → chunk-HVQVHUTV.js} +19 -115
- package/dist/{chunk-UR37VCIR.cjs → chunk-I4AHLP7F.cjs} +16 -35
- package/dist/chunk-IPJ3TEYR.cjs +113 -0
- package/dist/chunk-KC7HB5GF.cjs +133 -0
- package/dist/chunk-KY3FYKP3.js +52 -0
- package/dist/chunk-LEUZ4FRC.cjs +52 -0
- package/dist/{chunk-H6FX45CP.cjs → chunk-LIXLD433.cjs} +37 -37
- package/dist/{chunk-6GAYGQDC.js → chunk-O5ML2I6O.js} +3 -3
- package/dist/{chunk-KI2VBONS.js → chunk-OET45HIR.js} +2 -2
- package/dist/{chunk-XNZWATSB.cjs → chunk-QCEQIRJQ.cjs} +85 -85
- package/dist/{chunk-HRI3ZMDM.cjs → chunk-RHXW4TA5.cjs} +3 -3
- package/dist/{chunk-UUTTJK77.cjs → chunk-SUF6WRXR.cjs} +2 -2
- package/dist/{chunk-RN767PO6.js → chunk-SUVZJ2CP.js} +15 -34
- package/dist/{chunk-FLUTRPLY.cjs → chunk-TLMRGLQQ.cjs} +16 -16
- package/dist/{chunk-DAS7M4RY.js → chunk-UILRJQFD.js} +2 -2
- package/dist/chunk-UKCJ43YL.cjs +1913 -0
- package/dist/{chunk-XQ33O5BC.cjs → chunk-X35BV5YT.cjs} +44 -44
- package/dist/{chunk-6HMEHNWW.cjs → chunk-XTU6QO2W.cjs} +26 -26
- package/dist/{chunk-VM6JYWXQ.js → chunk-ZQUANEK4.js} +2 -2
- package/dist/cms/index.cjs +5 -3
- package/dist/cms/index.js +18 -16
- package/dist/color/contrast.d.cts +14 -0
- package/dist/color/contrast.d.ts +14 -0
- package/dist/color/convert.d.cts +30 -0
- package/dist/color/convert.d.ts +30 -0
- package/dist/color/dual.d.cts +98 -0
- package/dist/color/dual.d.ts +98 -0
- package/dist/color/format.d.cts +12 -0
- package/dist/color/format.d.ts +12 -0
- package/dist/color/gamut.d.cts +12 -0
- package/dist/color/gamut.d.ts +12 -0
- package/dist/color/harmony.d.cts +22 -0
- package/dist/color/harmony.d.ts +22 -0
- package/dist/color/index.cjs +115 -0
- package/dist/color/index.d.cts +18 -0
- package/dist/color/index.d.ts +18 -0
- package/dist/color/index.js +115 -0
- package/dist/color/mix.d.cts +11 -0
- package/dist/color/mix.d.ts +11 -0
- package/dist/color/named.d.cts +5 -0
- package/dist/color/named.d.ts +5 -0
- package/dist/color/parse.d.cts +11 -0
- package/dist/color/parse.d.ts +11 -0
- package/dist/color/picker.d.cts +52 -0
- package/dist/color/picker.d.ts +52 -0
- package/dist/color/recent.d.cts +8 -0
- package/dist/color/recent.d.ts +8 -0
- package/dist/color/tools.d.cts +15 -0
- package/dist/color/tools.d.ts +15 -0
- package/dist/color/types.d.cts +41 -0
- package/dist/color/types.d.ts +41 -0
- package/dist/color/vision.d.cts +36 -0
- package/dist/color/vision.d.ts +36 -0
- package/dist/diagram/editorDocument.d.cts +12 -0
- package/dist/diagram/editorDocument.d.ts +12 -0
- package/dist/diagram/index.cjs +35 -1
- package/dist/diagram/index.d.cts +1 -0
- package/dist/diagram/index.d.ts +1 -0
- package/dist/diagram/index.js +34 -0
- package/dist/export/index.cjs +6 -4
- package/dist/export/index.js +5 -3
- package/dist/extensions/index.cjs +10 -8
- package/dist/extensions/index.js +9 -7
- package/dist/gradient/controller.d.cts +109 -0
- package/dist/gradient/controller.d.ts +109 -0
- package/dist/gradient/editor.d.cts +38 -0
- package/dist/gradient/editor.d.ts +38 -0
- package/dist/gradient/index.cjs +1549 -0
- package/dist/gradient/index.d.cts +5 -0
- package/dist/gradient/index.d.ts +5 -0
- package/dist/gradient/index.js +1549 -0
- package/dist/gradient/model.d.cts +94 -0
- package/dist/gradient/model.d.ts +94 -0
- package/dist/gradient/tools.d.cts +11 -0
- package/dist/gradient/tools.d.ts +11 -0
- package/dist/gradient/types.d.cts +44 -0
- package/dist/gradient/types.d.ts +44 -0
- package/dist/image-editor/index.cjs +649 -647
- package/dist/image-editor/index.js +6 -4
- package/dist/index.cjs +19 -17
- package/dist/index.js +16 -14
- package/dist/paint-editor/color.d.cts +3 -13
- package/dist/paint-editor/color.d.ts +3 -13
- package/dist/paint-editor/index.cjs +23 -68
- package/dist/paint-editor/index.js +15 -60
- package/dist/persistence/documentStore.d.cts +51 -0
- package/dist/persistence/documentStore.d.ts +51 -0
- package/dist/persistence/documentTools.d.cts +35 -0
- package/dist/persistence/documentTools.d.ts +35 -0
- package/dist/persistence/editorAutosave.d.cts +33 -0
- package/dist/persistence/editorAutosave.d.ts +33 -0
- package/dist/persistence/editorDocument.d.cts +118 -0
- package/dist/persistence/editorDocument.d.ts +118 -0
- package/dist/persistence/index.cjs +294 -1
- package/dist/persistence/index.d.cts +4 -0
- package/dist/persistence/index.d.ts +4 -0
- package/dist/persistence/index.js +293 -0
- package/dist/vector/index.cjs +950 -948
- package/dist/vector/index.js +5 -3
- package/dist/video-editor/index.cjs +5 -3
- package/dist/video-editor/index.js +4 -2
- package/package.json +21 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-agent-tools/SKILL.md +21 -0
- package/skills/pixerate-color/SKILL.md +69 -0
- package/skills/pixerate-diagram/SKILL.md +13 -0
- package/dist/chunk-45VRG4RB.js +0 -65
- package/dist/chunk-5FXOR7F2.cjs +0 -65
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; var _class2; var _class3;
|
|
2
2
|
|
|
3
|
-
var _chunkHMGWFXECcjs = require('./chunk-HMGWFXEC.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
|
|
6
|
+
var _chunkYN6JKAUEcjs = require('./chunk-YN6JKAUE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var _chunkYN6JKAUEcjs = require('./chunk-YN6JKAUE.cjs');
|
|
10
9
|
|
|
10
|
+
var _chunk2WDZI6QDcjs = require('./chunk-2WDZI6QD.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkHMGWFXECcjs = require('./chunk-HMGWFXEC.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -34,10 +34,10 @@ var _chunkHLMF3E53cjs = require('./chunk-HLMF3E53.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunk6QTON3VWcjs = require('./chunk-6QTON3VW.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkI4AHLP7Fcjs = require('./chunk-I4AHLP7F.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -2464,13 +2464,13 @@ async function loadCharts(zip, Parser, root, rels, options) {
|
|
|
2464
2464
|
const charts = /* @__PURE__ */ new Map();
|
|
2465
2465
|
if (options.charts === false) return charts;
|
|
2466
2466
|
for (const el of descendants(root, "chart")) {
|
|
2467
|
-
if (el.namespaceURI !==
|
|
2467
|
+
if (el.namespaceURI !== _chunk2WDZI6QDcjs.CHART_OOXML_NS) continue;
|
|
2468
2468
|
const id = attr(el, "id");
|
|
2469
2469
|
const rel = id ? rels.get(id) : void 0;
|
|
2470
2470
|
if (!id || !rel || rel.external || charts.has(id)) continue;
|
|
2471
2471
|
const entry = zip.get(rel.target);
|
|
2472
2472
|
if (!entry) continue;
|
|
2473
|
-
const read =
|
|
2473
|
+
const read = _chunk2WDZI6QDcjs.chartFromOoxml.call(void 0, await zip.readText(entry), { DOMParser: Parser });
|
|
2474
2474
|
charts.set(id, {
|
|
2475
2475
|
id: `chart-${charts.size + 1}`,
|
|
2476
2476
|
path: rel.target,
|
|
@@ -2484,7 +2484,7 @@ async function loadCharts(zip, Parser, root, rels, options) {
|
|
|
2484
2484
|
return charts;
|
|
2485
2485
|
}
|
|
2486
2486
|
function chartBlockHtml(chart) {
|
|
2487
|
-
const [head, ...rows] =
|
|
2487
|
+
const [head, ...rows] = _chunkI4AHLP7Fcjs.chartDataToTable.call(void 0, chart.spec);
|
|
2488
2488
|
const cell = (v, tag) => `<${tag}><p>${_chunkG43MNQ4Ccjs.escapeHtml.call(void 0, v === null || v === void 0 ? "" : String(v))}</p></${tag}>`;
|
|
2489
2489
|
const table = `<table><tbody><tr>${head.map((h) => cell(h, "th")).join("")}</tr>${rows.map((r) => `<tr>${r.map((v, i) => cell(v, i ? "td" : "th")).join("")}</tr>`).join("")}</tbody></table>`;
|
|
2490
2490
|
const caption = `<p>${_chunkG43MNQ4Ccjs.escapeHtml.call(void 0, `[Chart: ${chart.title || "untitled"}]`)}</p>`;
|
|
@@ -3137,7 +3137,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
3137
3137
|
};
|
|
3138
3138
|
if (child.localName === "AlternateContent") {
|
|
3139
3139
|
const branch = childElements(child).find(
|
|
3140
|
-
(b) => descendants(b, "blip").length || descendants(b, "imagedata").length || descendants(b, "chart").some((el) => el.namespaceURI ===
|
|
3140
|
+
(b) => descendants(b, "blip").length || descendants(b, "imagedata").length || descendants(b, "chart").some((el) => el.namespaceURI === _chunk2WDZI6QDcjs.CHART_OOXML_NS)
|
|
3141
3141
|
);
|
|
3142
3142
|
if (branch) this.image(branch, format, push);
|
|
3143
3143
|
return;
|
|
@@ -3204,7 +3204,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
3204
3204
|
/** Charts this paragraph contains, in order. */
|
|
3205
3205
|
__init4() {this.charts = []}
|
|
3206
3206
|
image(container, format, push) {
|
|
3207
|
-
const chartRef = descendants(container, "chart").find((el) => el.namespaceURI ===
|
|
3207
|
+
const chartRef = descendants(container, "chart").find((el) => el.namespaceURI === _chunk2WDZI6QDcjs.CHART_OOXML_NS);
|
|
3208
3208
|
const chart = chartRef ? this.part.charts.get(_nullishCoalesce(attr(chartRef, "id"), () => ( ""))) : void 0;
|
|
3209
3209
|
if (chart) {
|
|
3210
3210
|
if (!this.ctx.charts.includes(chart)) this.ctx.charts.push(chart);
|
|
@@ -3643,9 +3643,9 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3643
3643
|
if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
|
|
3644
3644
|
from = to = _state.Selection.near(state.doc.resolve(from)).from;
|
|
3645
3645
|
}
|
|
3646
|
-
if (htmlSlice &&
|
|
3646
|
+
if (htmlSlice && _chunk6QTON3VWcjs.sliceContainsTable.call(void 0, htmlSlice) && _chunk6QTON3VWcjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
|
|
3647
3647
|
const tr2 = state.tr;
|
|
3648
|
-
const end2 =
|
|
3648
|
+
const end2 = _chunk6QTON3VWcjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
|
|
3649
3649
|
if (end2 !== null) {
|
|
3650
3650
|
if (options.at === void 0) tr2.setSelection(_state.Selection.near(tr2.doc.resolve(end2), -1));
|
|
3651
3651
|
view.dispatch(tr2.scrollIntoView().setMeta("uiEvent", "drop"));
|
|
@@ -3822,7 +3822,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3822
3822
|
const slice = _chunk3AJMR7EGcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
|
|
3823
3823
|
if (!slice) return false;
|
|
3824
3824
|
event.preventDefault();
|
|
3825
|
-
if (
|
|
3825
|
+
if (_chunk6QTON3VWcjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
|
|
3826
3826
|
view.dispatch(
|
|
3827
3827
|
view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste")
|
|
3828
3828
|
);
|
|
@@ -4223,7 +4223,7 @@ function createOutlineStore(editor) {
|
|
|
4223
4223
|
if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
|
|
4224
4224
|
const headings = getOutline(editor);
|
|
4225
4225
|
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _161 => _161(editor, headings), 'optionalAccess', _162 => _162.id]), () => ( null));
|
|
4226
|
-
const sameStructure =
|
|
4226
|
+
const sameStructure = _chunk6QTON3VWcjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
|
|
4227
4227
|
if (sameStructure && snapshot.activeId === activeId) return snapshot;
|
|
4228
4228
|
return {
|
|
4229
4229
|
headings: sameStructure ? snapshot.headings : headings,
|
|
@@ -4271,7 +4271,7 @@ function navigateToHeading(editor, heading, options = {}) {
|
|
|
4271
4271
|
editor.view.dispatch(tr);
|
|
4272
4272
|
editor.view.focus();
|
|
4273
4273
|
}
|
|
4274
|
-
|
|
4274
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, editor.view, current.pos, behavior);
|
|
4275
4275
|
return true;
|
|
4276
4276
|
}
|
|
4277
4277
|
function assignHeadingIds(state, types, generateId) {
|
|
@@ -4296,11 +4296,11 @@ function assignHeadingIds(state, types, generateId) {
|
|
|
4296
4296
|
}
|
|
4297
4297
|
var Outline = _core.Extension.create({
|
|
4298
4298
|
name: "outline",
|
|
4299
|
-
priority:
|
|
4299
|
+
priority: _chunk6QTON3VWcjs.STRUCTURE_PRIORITY,
|
|
4300
4300
|
addOptions() {
|
|
4301
4301
|
return {
|
|
4302
4302
|
types: ["heading"],
|
|
4303
|
-
generateId: () =>
|
|
4303
|
+
generateId: () => _chunk6QTON3VWcjs.generateStructureId.call(void 0, "h"),
|
|
4304
4304
|
onUpdate: void 0
|
|
4305
4305
|
};
|
|
4306
4306
|
},
|
|
@@ -4333,14 +4333,14 @@ var Outline = _core.Extension.create({
|
|
|
4333
4333
|
tr.scrollIntoView();
|
|
4334
4334
|
_optionalChain([view, 'optionalAccess', _169 => _169.focus, 'optionalCall', _170 => _170()]);
|
|
4335
4335
|
}
|
|
4336
|
-
|
|
4336
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4337
4337
|
}
|
|
4338
4338
|
return true;
|
|
4339
4339
|
},
|
|
4340
4340
|
scrollToHeading: (id, options = {}) => ({ state, dispatch, view }) => {
|
|
4341
4341
|
const heading = findHeading(state, id);
|
|
4342
4342
|
if (!heading) return false;
|
|
4343
|
-
if (dispatch)
|
|
4343
|
+
if (dispatch) _chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4344
4344
|
return true;
|
|
4345
4345
|
}
|
|
4346
4346
|
};
|
|
@@ -4361,7 +4361,7 @@ var Outline = _core.Extension.create({
|
|
|
4361
4361
|
apply: (tr, prev, _oldState, newState) => {
|
|
4362
4362
|
if (!tr.docChanged) return prev;
|
|
4363
4363
|
const next = computeOutline(newState.doc, types);
|
|
4364
|
-
if (
|
|
4364
|
+
if (_chunk6QTON3VWcjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
|
|
4365
4365
|
storage.headings = next;
|
|
4366
4366
|
_optionalChain([onUpdate, 'call', _171 => _171(), 'optionalCall', _172 => _172(next)]);
|
|
4367
4367
|
return next;
|
|
@@ -4379,7 +4379,7 @@ var Outline = _core.Extension.create({
|
|
|
4379
4379
|
},
|
|
4380
4380
|
onBeforeCreate() {
|
|
4381
4381
|
const { types, generateId } = this.options;
|
|
4382
|
-
|
|
4382
|
+
_chunk6QTON3VWcjs.syncInitialContent.call(void 0, this.editor, (state) => assignHeadingIds(state, types, generateId));
|
|
4383
4383
|
}
|
|
4384
4384
|
});
|
|
4385
4385
|
|
|
@@ -4549,7 +4549,7 @@ function syncTableOfContents(state, headingTypes) {
|
|
|
4549
4549
|
node.attrs.minLevel,
|
|
4550
4550
|
node.attrs.maxLevel
|
|
4551
4551
|
);
|
|
4552
|
-
if (!
|
|
4552
|
+
if (!_chunk6QTON3VWcjs.arraysEqual.call(void 0, _nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
|
|
4553
4553
|
tr = _nullishCoalesce(tr, () => ( state.tr));
|
|
4554
4554
|
tr.setNodeMarkup(pos, void 0, { ...node.attrs, entries });
|
|
4555
4555
|
}
|
|
@@ -4561,7 +4561,7 @@ function syncTableOfContents(state, headingTypes) {
|
|
|
4561
4561
|
}
|
|
4562
4562
|
var TableOfContents = _core.Node.create({
|
|
4563
4563
|
name: "tableOfContents",
|
|
4564
|
-
priority:
|
|
4564
|
+
priority: _chunk6QTON3VWcjs.STRUCTURE_PRIORITY - 5,
|
|
4565
4565
|
group: "block",
|
|
4566
4566
|
atom: true,
|
|
4567
4567
|
selectable: true,
|
|
@@ -4672,7 +4672,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4672
4672
|
return [
|
|
4673
4673
|
new (0, _state.Plugin)({
|
|
4674
4674
|
key: tableOfContentsPluginKey,
|
|
4675
|
-
state:
|
|
4675
|
+
state: _chunk6QTON3VWcjs.presenceStateSpec.call(void 0, [this.name]),
|
|
4676
4676
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
4677
4677
|
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
4678
4678
|
if (!tableOfContentsPluginKey.getState(newState)) return null;
|
|
@@ -4696,7 +4696,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4696
4696
|
);
|
|
4697
4697
|
view.focus();
|
|
4698
4698
|
}
|
|
4699
|
-
|
|
4699
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, heading.pos);
|
|
4700
4700
|
return true;
|
|
4701
4701
|
}
|
|
4702
4702
|
}
|
|
@@ -4706,7 +4706,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4706
4706
|
},
|
|
4707
4707
|
onBeforeCreate() {
|
|
4708
4708
|
const { headingTypes } = this.options;
|
|
4709
|
-
|
|
4709
|
+
_chunk6QTON3VWcjs.syncInitialContent.call(void 0, this.editor, (state) => syncTableOfContents(state, headingTypes));
|
|
4710
4710
|
}
|
|
4711
4711
|
});
|
|
4712
4712
|
|
|
@@ -4764,7 +4764,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4764
4764
|
const listType = schema.nodes[LIST];
|
|
4765
4765
|
const itemType = schema.nodes[ITEM];
|
|
4766
4766
|
if (!listType || !itemType) return false;
|
|
4767
|
-
const generateId = _nullishCoalesce(options.generateId, () => ( (() =>
|
|
4767
|
+
const generateId = _nullishCoalesce(options.generateId, () => ( (() => _chunk6QTON3VWcjs.generateStructureId.call(void 0, "fn"))));
|
|
4768
4768
|
const refs = [];
|
|
4769
4769
|
const lists = [];
|
|
4770
4770
|
const existing = /* @__PURE__ */ new Map();
|
|
@@ -4848,7 +4848,7 @@ function findReferences(doc, id) {
|
|
|
4848
4848
|
}
|
|
4849
4849
|
var FootnoteReference = _core.Node.create({
|
|
4850
4850
|
name: REFERENCE,
|
|
4851
|
-
priority:
|
|
4851
|
+
priority: _chunk6QTON3VWcjs.STRUCTURE_PRIORITY - 5,
|
|
4852
4852
|
group: "inline",
|
|
4853
4853
|
inline: true,
|
|
4854
4854
|
atom: true,
|
|
@@ -4856,7 +4856,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4856
4856
|
addOptions() {
|
|
4857
4857
|
return {
|
|
4858
4858
|
HTMLAttributes: {},
|
|
4859
|
-
generateId: () =>
|
|
4859
|
+
generateId: () => _chunk6QTON3VWcjs.generateStructureId.call(void 0, "fn")
|
|
4860
4860
|
};
|
|
4861
4861
|
},
|
|
4862
4862
|
addAttributes() {
|
|
@@ -4967,7 +4967,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4967
4967
|
_state.TextSelection.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
|
|
4968
4968
|
);
|
|
4969
4969
|
tr.scrollIntoView();
|
|
4970
|
-
|
|
4970
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, footnote.pos);
|
|
4971
4971
|
}
|
|
4972
4972
|
return true;
|
|
4973
4973
|
},
|
|
@@ -4977,7 +4977,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4977
4977
|
if (dispatch) {
|
|
4978
4978
|
tr.setSelection(_state.NodeSelection.create(tr.doc, ref.pos));
|
|
4979
4979
|
tr.scrollIntoView();
|
|
4980
|
-
|
|
4980
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, ref.pos);
|
|
4981
4981
|
}
|
|
4982
4982
|
return true;
|
|
4983
4983
|
}
|
|
@@ -4989,7 +4989,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4989
4989
|
return [
|
|
4990
4990
|
new (0, _state.Plugin)({
|
|
4991
4991
|
key: footnotesPluginKey,
|
|
4992
|
-
state:
|
|
4992
|
+
state: _chunk6QTON3VWcjs.presenceStateSpec.call(void 0, [REFERENCE, LIST]),
|
|
4993
4993
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
4994
4994
|
if (!transactions.some((tr2) => tr2.docChanged)) return null;
|
|
4995
4995
|
if (!footnotesPluginKey.getState(newState)) return null;
|
|
@@ -5010,7 +5010,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
5010
5010
|
},
|
|
5011
5011
|
onBeforeCreate() {
|
|
5012
5012
|
const { generateId } = this.options;
|
|
5013
|
-
|
|
5013
|
+
_chunk6QTON3VWcjs.syncInitialContent.call(void 0, this.editor, (state) => {
|
|
5014
5014
|
const tr = state.tr;
|
|
5015
5015
|
return syncFootnotes(tr, { generateId }) ? tr : null;
|
|
5016
5016
|
});
|
|
@@ -5150,7 +5150,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5150
5150
|
addOptions() {
|
|
5151
5151
|
return {
|
|
5152
5152
|
HTMLAttributes: {},
|
|
5153
|
-
generateId: () =>
|
|
5153
|
+
generateId: () => _chunk6QTON3VWcjs.generateStructureId.call(void 0, "bm")
|
|
5154
5154
|
};
|
|
5155
5155
|
},
|
|
5156
5156
|
addAttributes() {
|
|
@@ -5235,7 +5235,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5235
5235
|
tr.setSelection(_state.TextSelection.create(tr.doc, bookmark.from, bookmark.to));
|
|
5236
5236
|
tr.scrollIntoView();
|
|
5237
5237
|
const domPos = state.doc.resolve(bookmark.from);
|
|
5238
|
-
|
|
5238
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, domPos.before(domPos.depth));
|
|
5239
5239
|
}
|
|
5240
5240
|
return true;
|
|
5241
5241
|
}
|
|
@@ -5300,7 +5300,7 @@ function syncCrossReferences(state, headingTypes) {
|
|
|
5300
5300
|
}
|
|
5301
5301
|
var CrossReference = _core.Node.create({
|
|
5302
5302
|
name: NAME,
|
|
5303
|
-
priority:
|
|
5303
|
+
priority: _chunk6QTON3VWcjs.STRUCTURE_PRIORITY - 5,
|
|
5304
5304
|
group: "inline",
|
|
5305
5305
|
inline: true,
|
|
5306
5306
|
atom: true,
|
|
@@ -5402,7 +5402,7 @@ var CrossReference = _core.Node.create({
|
|
|
5402
5402
|
if (dispatch) {
|
|
5403
5403
|
tr.setSelection(_state.TextSelection.create(tr.doc, range.from, range.to));
|
|
5404
5404
|
tr.scrollIntoView();
|
|
5405
|
-
|
|
5405
|
+
_chunk6QTON3VWcjs.scrollDomAtPos.call(void 0, view, range.blockPos);
|
|
5406
5406
|
}
|
|
5407
5407
|
return true;
|
|
5408
5408
|
}
|
|
@@ -5414,7 +5414,7 @@ var CrossReference = _core.Node.create({
|
|
|
5414
5414
|
return [
|
|
5415
5415
|
new (0, _state.Plugin)({
|
|
5416
5416
|
key: crossReferencePluginKey,
|
|
5417
|
-
state:
|
|
5417
|
+
state: _chunk6QTON3VWcjs.presenceStateSpec.call(void 0, [NAME]),
|
|
5418
5418
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
5419
5419
|
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
5420
5420
|
if (!crossReferencePluginKey.getState(newState)) return null;
|
|
@@ -5433,7 +5433,7 @@ var CrossReference = _core.Node.create({
|
|
|
5433
5433
|
},
|
|
5434
5434
|
onBeforeCreate() {
|
|
5435
5435
|
const { headingTypes } = this.options;
|
|
5436
|
-
|
|
5436
|
+
_chunk6QTON3VWcjs.syncInitialContent.call(void 0, this.editor, (state) => syncCrossReferences(state, headingTypes));
|
|
5437
5437
|
}
|
|
5438
5438
|
});
|
|
5439
5439
|
|
|
@@ -5688,7 +5688,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5688
5688
|
if (!s || !s.active || s.currentIndex < 0 || !s.matches[s.currentIndex]) return false;
|
|
5689
5689
|
if (dispatch) {
|
|
5690
5690
|
_history.closeHistory.call(void 0, tr);
|
|
5691
|
-
const [end] =
|
|
5691
|
+
const [end] = _chunk6QTON3VWcjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
|
|
5692
5692
|
tr.setSelection(_state.TextSelection.create(tr.doc, end)).scrollIntoView();
|
|
5693
5693
|
meta(tr, { type: "replaced", anchor: end, count: 1 });
|
|
5694
5694
|
}
|
|
@@ -5699,7 +5699,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5699
5699
|
if (!s || !s.active || !s.matches.length) return false;
|
|
5700
5700
|
if (dispatch) {
|
|
5701
5701
|
_history.closeHistory.call(void 0, tr);
|
|
5702
|
-
const ends =
|
|
5702
|
+
const ends = _chunk6QTON3VWcjs.applyReplacements.call(void 0, tr, s.matches);
|
|
5703
5703
|
meta(tr, { type: "replaced", anchor: ends[ends.length - 1], count: s.matches.length });
|
|
5704
5704
|
}
|
|
5705
5705
|
return true;
|
|
@@ -5731,7 +5731,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5731
5731
|
if (!s.active || !s.query) {
|
|
5732
5732
|
return { ...s, matches: [], currentIndex: -1, error: null, truncated: false };
|
|
5733
5733
|
}
|
|
5734
|
-
const result =
|
|
5734
|
+
const result = _chunk6QTON3VWcjs.searchDocument.call(void 0, doc, s.query, s.options, {
|
|
5735
5735
|
replacement: s.replacement,
|
|
5736
5736
|
clipboardText: safeClipboard(options.getClipboardText),
|
|
5737
5737
|
timeLimitMs: options.timeLimitMs,
|
|
@@ -6318,7 +6318,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6318
6318
|
})
|
|
6319
6319
|
];
|
|
6320
6320
|
if (options.table !== false) {
|
|
6321
|
-
extensions2.push(...
|
|
6321
|
+
extensions2.push(..._chunk6QTON3VWcjs.createTableExtensions.call(void 0, optionObject(options.table)));
|
|
6322
6322
|
}
|
|
6323
6323
|
if (characterLimit) {
|
|
6324
6324
|
extensions2.push(
|
|
@@ -6425,8 +6425,8 @@ function createRichTextPreset(options = {}) {
|
|
|
6425
6425
|
}
|
|
6426
6426
|
if (options.chart) {
|
|
6427
6427
|
const { sparkline = true, ...chartOptions } = optionObject(options.chart);
|
|
6428
|
-
extensions2.push(
|
|
6429
|
-
if (sparkline) extensions2.push(
|
|
6428
|
+
extensions2.push(_chunk6QTON3VWcjs.Chart.configure(chartOptions));
|
|
6429
|
+
if (sparkline) extensions2.push(_chunk6QTON3VWcjs.Sparkline.configure(optionObject(sparkline)));
|
|
6430
6430
|
}
|
|
6431
6431
|
if (options.paragraphStyles) {
|
|
6432
6432
|
extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
|
|
@@ -6567,7 +6567,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6567
6567
|
];
|
|
6568
6568
|
}
|
|
6569
6569
|
function validateFindPattern(query, options = {}) {
|
|
6570
|
-
const result =
|
|
6570
|
+
const result = _chunk6QTON3VWcjs.compileFindPattern.call(void 0, query, options);
|
|
6571
6571
|
return result.ok ? null : result.error;
|
|
6572
6572
|
}
|
|
6573
6573
|
|
|
@@ -6576,8 +6576,8 @@ var PARAMS = {
|
|
|
6576
6576
|
insertTable: {
|
|
6577
6577
|
type: "object",
|
|
6578
6578
|
properties: {
|
|
6579
|
-
rows: { type: "integer", minimum: 1, maximum:
|
|
6580
|
-
cols: { type: "integer", minimum: 1, maximum:
|
|
6579
|
+
rows: { type: "integer", minimum: 1, maximum: _chunk6QTON3VWcjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
|
|
6580
|
+
cols: { type: "integer", minimum: 1, maximum: _chunk6QTON3VWcjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
|
|
6581
6581
|
withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
|
|
6582
6582
|
},
|
|
6583
6583
|
additionalProperties: false
|
|
@@ -6608,7 +6608,7 @@ function createTableCommands(editor, options = {}) {
|
|
|
6608
6608
|
const group = _nullishCoalesce(options.group, () => ( "Table"));
|
|
6609
6609
|
const scope = options.scope ? { scope: options.scope } : {};
|
|
6610
6610
|
const focus = _nullishCoalesce(options.focus, () => ( true));
|
|
6611
|
-
return
|
|
6611
|
+
return _chunk6QTON3VWcjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
|
|
6612
6612
|
const params = PARAMS[action];
|
|
6613
6613
|
return {
|
|
6614
6614
|
id: `${prefix}${action}`,
|
|
@@ -6618,13 +6618,13 @@ function createTableCommands(editor, options = {}) {
|
|
|
6618
6618
|
description,
|
|
6619
6619
|
...params ? { params } : {},
|
|
6620
6620
|
...scope,
|
|
6621
|
-
enabled: (_ctx, p) =>
|
|
6621
|
+
enabled: (_ctx, p) => _chunk6QTON3VWcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
|
|
6622
6622
|
run: (_ctx, p) => {
|
|
6623
|
-
if (!
|
|
6624
|
-
const reason =
|
|
6623
|
+
if (!_chunk6QTON3VWcjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
|
|
6624
|
+
const reason = _chunk6QTON3VWcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
|
|
6625
6625
|
throw new Error(reason === true ? `${label} did not change the document.` : reason);
|
|
6626
6626
|
}
|
|
6627
|
-
const state =
|
|
6627
|
+
const state = _chunk6QTON3VWcjs.getTableState.call(void 0, editor);
|
|
6628
6628
|
return {
|
|
6629
6629
|
done: true,
|
|
6630
6630
|
table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
CHART_STACKINGS,
|
|
14
14
|
CHART_TRENDLINE_TYPES,
|
|
15
15
|
CHART_TYPES
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SUVZJ2CP.js";
|
|
17
17
|
|
|
18
18
|
// src/chart/schemas.ts
|
|
19
19
|
var VALUE = { type: ["number", "string", "null"], description: 'A number, numeric text ("1,200", "12%", "$40", "(3)") or null for a gap.' };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLoadReport,
|
|
3
|
+
migrateDocument
|
|
4
|
+
} from "./chunk-WHKNYFM2.js";
|
|
5
|
+
import {
|
|
6
|
+
stripPrototypeKeys
|
|
7
|
+
} from "./chunk-HF5QZS7Z.js";
|
|
8
|
+
|
|
9
|
+
// src/persistence/editorDocument.ts
|
|
10
|
+
var EditorDocumentLoadError = class extends Error {
|
|
11
|
+
/** The `LoadReport` when the input was a file that could not be migrated. */
|
|
12
|
+
report;
|
|
13
|
+
constructor(message, report) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "EditorDocumentLoadError";
|
|
16
|
+
this.report = report;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var EDITOR_DOCUMENT_FORMAT = "pixerate.editor-document";
|
|
20
|
+
var KIND = /^[a-z][a-z0-9_]*$/;
|
|
21
|
+
function isEditorDocumentFile(value) {
|
|
22
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
23
|
+
const v = value;
|
|
24
|
+
return v.format === EDITOR_DOCUMENT_FORMAT && typeof v.kind === "string" && typeof v.formatVersion === "number" && "document" in v;
|
|
25
|
+
}
|
|
26
|
+
function toEditorDocumentFile(doc, name) {
|
|
27
|
+
return {
|
|
28
|
+
format: EDITOR_DOCUMENT_FORMAT,
|
|
29
|
+
kind: doc.kind,
|
|
30
|
+
formatVersion: doc.formatVersion,
|
|
31
|
+
...name ? { name } : {},
|
|
32
|
+
document: doc.getDocument()
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function serializeEditorDocument(doc, options = {}) {
|
|
36
|
+
return JSON.stringify(toEditorDocumentFile(doc, options.name), null, options.space);
|
|
37
|
+
}
|
|
38
|
+
function parseEditorDocument(text, options = {}) {
|
|
39
|
+
let value;
|
|
40
|
+
try {
|
|
41
|
+
value = stripPrototypeKeys(JSON.parse(text));
|
|
42
|
+
} catch (error) {
|
|
43
|
+
throw new EditorDocumentLoadError(`The file is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
44
|
+
}
|
|
45
|
+
if (!isEditorDocumentFile(value)) {
|
|
46
|
+
throw new EditorDocumentLoadError(`The file is not a saved editor document (expected "format": "${EDITOR_DOCUMENT_FORMAT}").`);
|
|
47
|
+
}
|
|
48
|
+
if (options.kind && value.kind !== options.kind) {
|
|
49
|
+
throw new EditorDocumentLoadError(`The file is a ${value.kind} document, not a ${options.kind} document.`);
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
function defineEditorDocument(spec) {
|
|
54
|
+
if (!KIND.test(spec.kind)) throw new Error(`Editor document kind "${spec.kind}" must match ${KIND}.`);
|
|
55
|
+
const formatVersion = spec.formatVersion ?? 1;
|
|
56
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
57
|
+
let revision = 0;
|
|
58
|
+
let unsubscribe = null;
|
|
59
|
+
let connected = false;
|
|
60
|
+
const connect = () => {
|
|
61
|
+
if (unsubscribe) return;
|
|
62
|
+
if (connected) revision++;
|
|
63
|
+
connected = true;
|
|
64
|
+
unsubscribe = spec.subscribe(() => {
|
|
65
|
+
revision++;
|
|
66
|
+
listeners.forEach((listener) => {
|
|
67
|
+
try {
|
|
68
|
+
listener();
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(`[${spec.kind} document] Error in change listener:`, error);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
connect();
|
|
76
|
+
const unwrap = (input) => {
|
|
77
|
+
if (!isEditorDocumentFile(input)) return { document: input, report: createLoadReport({ version: formatVersion }) };
|
|
78
|
+
if (input.kind !== spec.kind) throw new EditorDocumentLoadError(`This is a ${input.kind} document; it cannot be opened in the ${spec.kind} editor.`);
|
|
79
|
+
const steps = Object.fromEntries(
|
|
80
|
+
Object.entries(spec.migrations ?? {}).map(([v, step]) => [v, (w) => ({ ...w, document: step(w.document) })])
|
|
81
|
+
);
|
|
82
|
+
const { doc, report } = migrateDocument(
|
|
83
|
+
{ formatVersion: input.formatVersion, document: input.document },
|
|
84
|
+
{ currentVersion: formatVersion, versionKey: "formatVersion", steps }
|
|
85
|
+
);
|
|
86
|
+
if (report.readOnly) throw new EditorDocumentLoadError(`Cannot open the ${spec.kind} document: ${report.readOnly.message}.`, report);
|
|
87
|
+
return { document: doc.document, report };
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
kind: spec.kind,
|
|
91
|
+
formatVersion,
|
|
92
|
+
recordsLoads: spec.recordsLoads !== false,
|
|
93
|
+
getDocument: () => spec.get(),
|
|
94
|
+
loadDocument(input, options = {}) {
|
|
95
|
+
const { document, report } = unwrap(input);
|
|
96
|
+
if (document === void 0 || document === null) throw new EditorDocumentLoadError(`No ${spec.kind} document was given.`);
|
|
97
|
+
try {
|
|
98
|
+
spec.load(document, { history: options.history ?? "reset" });
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (error instanceof EditorDocumentLoadError) throw error;
|
|
101
|
+
throw new EditorDocumentLoadError(error instanceof Error ? error.message : String(error));
|
|
102
|
+
}
|
|
103
|
+
return report;
|
|
104
|
+
},
|
|
105
|
+
revision: () => {
|
|
106
|
+
connect();
|
|
107
|
+
return revision;
|
|
108
|
+
},
|
|
109
|
+
subscribe(listener) {
|
|
110
|
+
connect();
|
|
111
|
+
listeners.add(listener);
|
|
112
|
+
return () => {
|
|
113
|
+
listeners.delete(listener);
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
history: spec.history,
|
|
117
|
+
readOnly: () => spec.readOnly?.() ?? false,
|
|
118
|
+
destroy() {
|
|
119
|
+
unsubscribe?.();
|
|
120
|
+
unsubscribe = null;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
EditorDocumentLoadError,
|
|
127
|
+
EDITOR_DOCUMENT_FORMAT,
|
|
128
|
+
isEditorDocumentFile,
|
|
129
|
+
toEditorDocumentFile,
|
|
130
|
+
serializeEditorDocument,
|
|
131
|
+
parseEditorDocument,
|
|
132
|
+
defineEditorDocument
|
|
133
|
+
};
|