@pixerate/editor 0.268.2 → 0.269.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 +27 -27
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/index.cjs +61 -61
- package/dist/animation-editor/index.js +5 -5
- package/dist/brushes/import/abr.d.cts +48 -0
- package/dist/brushes/import/abr.d.ts +48 -0
- package/dist/brushes/import/bplist.d.cts +24 -0
- package/dist/brushes/import/bplist.d.ts +24 -0
- package/dist/brushes/import/pack.d.cts +82 -0
- package/dist/brushes/import/pack.d.ts +82 -0
- package/dist/brushes/import/zip.d.cts +31 -0
- package/dist/brushes/import/zip.d.ts +31 -0
- package/dist/brushes/index.cjs +26 -6
- package/dist/brushes/index.d.cts +2 -0
- package/dist/brushes/index.d.ts +2 -0
- package/dist/brushes/index.js +22 -2
- package/dist/{chunk-SIFAIGB3.js → chunk-3AJCEJNH.js} +2 -162
- package/dist/{chunk-YXP6X3SY.cjs → chunk-3KNQ2W6X.cjs} +697 -10
- package/dist/{chunk-QNY7BDFP.js → chunk-4CPOKP27.js} +1 -1
- package/dist/{chunk-J4GXP53R.cjs → chunk-4NMPUJUK.cjs} +86 -86
- package/dist/{chunk-LDOD7VCT.js → chunk-4YSPQGZW.js} +1 -1
- package/dist/{chunk-JBB3GDBB.cjs → chunk-56RHCIJV.cjs} +2 -2
- package/dist/{chunk-4IMD2TLY.cjs → chunk-AI4F33IV.cjs} +3166 -2966
- package/dist/{chunk-YOVXQHA3.cjs → chunk-BENSE3VX.cjs} +23 -23
- package/dist/{chunk-VDGBHYC7.js → chunk-F7OO3DHP.js} +157 -1
- package/dist/{chunk-UVTO3D4E.js → chunk-FUDP5QBB.js} +1 -1
- package/dist/{chunk-3XDSNIGF.js → chunk-ININNHLM.js} +687 -0
- package/dist/{chunk-WIC7TG73.cjs → chunk-M4UQA2T4.cjs} +18 -18
- package/dist/{chunk-ITURMC2M.js → chunk-N3UMQVKX.js} +176 -176
- package/dist/{chunk-UWEQ55MY.cjs → chunk-N4KP3UQR.cjs} +157 -1
- package/dist/{chunk-D5BXSOSU.js → chunk-QGVTOCNB.js} +3118 -2918
- package/dist/{chunk-M6DNZNVY.js → chunk-RWDSSK2I.js} +4 -2
- package/dist/{chunk-CVFAAZXE.cjs → chunk-SPIO2GJU.cjs} +8 -6
- package/dist/{chunk-RHEMMGCN.cjs → chunk-T4JPGBW3.cjs} +173 -173
- package/dist/{chunk-HFY5LG5J.js → chunk-THBJHPUL.js} +1 -1
- package/dist/{chunk-NPWWSCWT.cjs → chunk-VBRHE4AM.cjs} +35 -35
- package/dist/{chunk-AZC2NDAR.js → chunk-WB22XMW3.js} +6 -6
- package/dist/{chunk-NIBFDFYW.cjs → chunk-YBMUHIOM.cjs} +12 -172
- package/dist/extensions/index.cjs +18 -4
- package/dist/extensions/index.d.cts +1 -0
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.js +17 -3
- package/dist/extensions/prompt-editor.d.cts +109 -0
- package/dist/extensions/prompt-editor.d.ts +109 -0
- package/dist/generation/index.cjs +15 -15
- package/dist/generation/index.js +3 -3
- package/dist/grammar/index.cjs +4 -4
- package/dist/grammar/index.js +7 -7
- package/dist/image-editor/index.cjs +785 -785
- package/dist/image-editor/index.js +6 -6
- package/dist/index.cjs +27 -13
- package/dist/index.js +23 -9
- package/dist/paint-editor/index.cjs +91 -91
- package/dist/paint-editor/index.js +6 -6
- package/dist/vector/index.cjs +1001 -1001
- package/dist/vector/index.js +6 -6
- package/package.json +1 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -140,7 +140,7 @@ var _chunkN2FGYZ4Qcjs = require('../chunk-N2FGYZ4Q.cjs');
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
var
|
|
143
|
+
var _chunkT4JPGBW3cjs = require('../chunk-T4JPGBW3.cjs');
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
var _chunkYYBW6DF2cjs = require('../chunk-YYBW6DF2.cjs');
|
|
@@ -698,7 +698,7 @@ function describe(chart, includeSpec) {
|
|
|
698
698
|
function sparklines(doc) {
|
|
699
699
|
const found = [];
|
|
700
700
|
doc.descendants((node, pos) => {
|
|
701
|
-
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label:
|
|
701
|
+
if (node.type.name === "sparkline") found.push({ pos, kind: node.attrs.kind, values: node.attrs.values, label: _chunkT4JPGBW3cjs.sparklineLabel.call(void 0, node) });
|
|
702
702
|
});
|
|
703
703
|
return found;
|
|
704
704
|
}
|
|
@@ -709,7 +709,7 @@ function checkPosition(editor, at) {
|
|
|
709
709
|
function createDocumentChartTools(editor) {
|
|
710
710
|
const chartType = () => editor().schema.nodes.chart;
|
|
711
711
|
const findChart = (args) => {
|
|
712
|
-
const charts =
|
|
712
|
+
const charts = _chunkT4JPGBW3cjs.getDocumentCharts.call(void 0, editor().state.doc);
|
|
713
713
|
const list = charts.map((c) => `"${c.id}" at ${c.pos}`).join(", ") || "none; add one with insert_chart";
|
|
714
714
|
if (args.chartId !== void 0) {
|
|
715
715
|
const chart = charts.find((c) => c.id === args.chartId);
|
|
@@ -736,7 +736,7 @@ function createDocumentChartTools(editor) {
|
|
|
736
736
|
annotations: { title: "List charts in the document", ...READ },
|
|
737
737
|
handler: ({ includeSpec = false }) => {
|
|
738
738
|
const doc = editor().state.doc;
|
|
739
|
-
return { charts:
|
|
739
|
+
return { charts: _chunkT4JPGBW3cjs.getDocumentCharts.call(void 0, doc).map((c) => describe(c, includeSpec)), sparklines: editor().schema.nodes.sparkline ? sparklines(doc) : [] };
|
|
740
740
|
}
|
|
741
741
|
};
|
|
742
742
|
const insertChart = {
|
|
@@ -763,7 +763,7 @@ function createDocumentChartTools(editor) {
|
|
|
763
763
|
const node = { type: "chart", attrs: { id, spec, width, ...height !== void 0 ? { height } : {} } };
|
|
764
764
|
const chain = ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true));
|
|
765
765
|
const ok = (at !== void 0 ? chain.insertContentAt(at, node) : chain.insertContent(node)).run();
|
|
766
|
-
const chart =
|
|
766
|
+
const chart = _chunkT4JPGBW3cjs.getDocumentCharts.call(void 0, ed.state.doc).find((c) => c.id === id);
|
|
767
767
|
if (!ok || !chart) throw new Error(`A chart cannot go at ${_nullishCoalesce(at, () => ( ed.state.selection.from))}; pass a position between blocks or inside a paragraph.`);
|
|
768
768
|
return { id: chart.id, pos: chart.pos, spec: chart.spec, width: chart.node.attrs.width, height: chart.node.attrs.height };
|
|
769
769
|
}
|
|
@@ -810,8 +810,8 @@ function createDocumentChartTools(editor) {
|
|
|
810
810
|
inputSchema: {
|
|
811
811
|
type: "object",
|
|
812
812
|
properties: {
|
|
813
|
-
values: { type: "array", items: _chunkG23BTQA5cjs.VALUE, minItems: 1, maxItems:
|
|
814
|
-
kind: { type: "string", enum: [...
|
|
813
|
+
values: { type: "array", items: _chunkG23BTQA5cjs.VALUE, minItems: 1, maxItems: _chunkT4JPGBW3cjs.MAX_SPARKLINE_VALUES, description: "Values in order (null for a gap)." },
|
|
814
|
+
kind: { type: "string", enum: [..._chunkT4JPGBW3cjs.SPARKLINE_KINDS], description: "line (default), column, or win-loss (sign only)." },
|
|
815
815
|
at: { type: "integer", minimum: 0, description: "Document position inside a paragraph (default: the selection)." },
|
|
816
816
|
width: { type: "number", minimum: 4, maximum: 1e3, description: "Width in pixels (default 80)." },
|
|
817
817
|
height: { type: "number", minimum: 4, maximum: 200, description: "Height in pixels (default 18)." },
|
|
@@ -830,7 +830,7 @@ function createDocumentChartTools(editor) {
|
|
|
830
830
|
if (bad >= 0) throw new Error(`values[${bad}] ("${String(values[bad])}") is not a number; pass numbers, numeric text or null. Nothing was inserted.`);
|
|
831
831
|
const pos = _nullishCoalesce(at, () => ( ed.state.selection.from));
|
|
832
832
|
if (!ed.state.doc.resolve(pos).parent.inlineContent) throw new Error(`Position ${pos} is between blocks; a sparkline goes inside a paragraph (use a position from get_text {blocks: true}).`);
|
|
833
|
-
const stored =
|
|
833
|
+
const stored = _chunkT4JPGBW3cjs.normalizeSparklineValues.call(void 0, parsed);
|
|
834
834
|
ed.chain().command(({ tr }) => (_history.closeHistory.call(void 0, tr), true)).insertContentAt(pos, { type: "sparkline", attrs: { values: stored, kind, width, height, color, label } }).run();
|
|
835
835
|
return { pos, kind, values: stored };
|
|
836
836
|
}
|
|
@@ -1168,8 +1168,8 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1168
1168
|
const config = option === false ? null : option === true || option === void 0 ? {} : option;
|
|
1169
1169
|
const caret = {
|
|
1170
1170
|
id: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _43 => _43.id]), () => ( providerId)),
|
|
1171
|
-
name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _44 => _44.name]), () => (
|
|
1172
|
-
color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _45 => _45.color]), () => (
|
|
1171
|
+
name: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _44 => _44.name]), () => ( _chunkT4JPGBW3cjs.DEFAULT_AGENT_CARET_NAME)),
|
|
1172
|
+
color: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _45 => _45.color]), () => ( _chunkT4JPGBW3cjs.DEFAULT_AGENT_CARET_COLOR))
|
|
1173
1173
|
};
|
|
1174
1174
|
const typing = !_optionalChain([config, 'optionalAccess', _46 => _46.typing]) ? null : config.typing === true ? {} : config.typing;
|
|
1175
1175
|
const idleMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _47 => _47.idleMs]), () => ( 12e3));
|
|
@@ -1182,19 +1182,19 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1182
1182
|
};
|
|
1183
1183
|
const touch = () => {
|
|
1184
1184
|
clearTimeout(idleTimer);
|
|
1185
|
-
if (idleMs > 0) idleTimer = setTimeout(() => live() &&
|
|
1185
|
+
if (idleMs > 0) idleTimer = setTimeout(() => live() && _chunkT4JPGBW3cjs.clearAgentCaret.call(void 0, live(), caret.id), idleMs);
|
|
1186
1186
|
};
|
|
1187
1187
|
const tint = (ed, ranges) => {
|
|
1188
1188
|
clearTimeout(tintTimer);
|
|
1189
|
-
|
|
1190
|
-
if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() &&
|
|
1189
|
+
_chunkT4JPGBW3cjs.markAgentChanges.call(void 0, ed, caret.id, ranges);
|
|
1190
|
+
if (changedMs > 0 && ranges.length) tintTimer = setTimeout(() => live() && _chunkT4JPGBW3cjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
|
|
1191
1191
|
};
|
|
1192
1192
|
return {
|
|
1193
1193
|
/** Puts the caret at `head`, selecting from `anchor`. */
|
|
1194
1194
|
show(anchor, head = anchor) {
|
|
1195
1195
|
const ed = live();
|
|
1196
1196
|
if (!ed) return;
|
|
1197
|
-
|
|
1197
|
+
_chunkT4JPGBW3cjs.setAgentCaret.call(void 0, ed, { ...caret, from: anchor, to: head });
|
|
1198
1198
|
touch();
|
|
1199
1199
|
},
|
|
1200
1200
|
/** Shows the caret after ranges just changed by a tool, tinting them. */
|
|
@@ -1202,7 +1202,7 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1202
1202
|
const ed = live();
|
|
1203
1203
|
if (!ed || !ranges.length) return;
|
|
1204
1204
|
const last = ranges[ranges.length - 1];
|
|
1205
|
-
|
|
1205
|
+
_chunkT4JPGBW3cjs.setAgentCaret.call(void 0, ed, { ...caret, from: last.to });
|
|
1206
1206
|
tint(ed, ranges);
|
|
1207
1207
|
touch();
|
|
1208
1208
|
},
|
|
@@ -1210,12 +1210,12 @@ function createTextPresence(editor, providerId, option) {
|
|
|
1210
1210
|
async write(ed, from, to, text, signal) {
|
|
1211
1211
|
if (live() && typing) {
|
|
1212
1212
|
clearTimeout(tintTimer);
|
|
1213
|
-
const range2 = await
|
|
1214
|
-
if (changedMs > 0) tintTimer = setTimeout(() => live() &&
|
|
1213
|
+
const range2 = await _chunkT4JPGBW3cjs.typeAgentText.call(void 0, ed, { ...typing, from, to, text, caret, signal });
|
|
1214
|
+
if (changedMs > 0) tintTimer = setTimeout(() => live() && _chunkT4JPGBW3cjs.markAgentChanges.call(void 0, live(), caret.id, []), changedMs);
|
|
1215
1215
|
touch();
|
|
1216
1216
|
return range2;
|
|
1217
1217
|
}
|
|
1218
|
-
const tr = _history.closeHistory.call(void 0,
|
|
1218
|
+
const tr = _history.closeHistory.call(void 0, _chunkT4JPGBW3cjs.replaceWithTextTransaction.call(void 0, ed.state, from, to, text));
|
|
1219
1219
|
const end = tr.mapping.map(to, 1);
|
|
1220
1220
|
const range = { from: Math.min(tr.mapping.map(from, -1), end), to: end };
|
|
1221
1221
|
ed.view.dispatch(tr.scrollIntoView());
|
|
@@ -1244,7 +1244,7 @@ function findMatches(editor, query, args, replacement) {
|
|
|
1244
1244
|
wholeWord: !!args.wholeWord,
|
|
1245
1245
|
...args.regex ? { regex: true } : { literal: true }
|
|
1246
1246
|
};
|
|
1247
|
-
const result =
|
|
1247
|
+
const result = _chunkT4JPGBW3cjs.searchDocument.call(void 0, editor.state.doc, query, options, replacement !== void 0 ? { replacement } : {});
|
|
1248
1248
|
if (result.error) throw new Error(`Invalid search pattern: ${result.error.message}`);
|
|
1249
1249
|
return { matches: result.matches, truncated: result.truncated };
|
|
1250
1250
|
}
|
|
@@ -1406,7 +1406,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1406
1406
|
replacement: String(replace).replace(/\r\n?|\n/g, "\r")
|
|
1407
1407
|
}));
|
|
1408
1408
|
const tr = _history.closeHistory.call(void 0, ed.state.tr);
|
|
1409
|
-
const ends =
|
|
1409
|
+
const ends = _chunkT4JPGBW3cjs.applyReplacements.call(void 0, tr, chosen);
|
|
1410
1410
|
ed.view.dispatch(tr.scrollIntoView());
|
|
1411
1411
|
const ranges = chosen.map((m, i) => ({ from: tr.mapping.map(m.from, -1), to: ends[i] }));
|
|
1412
1412
|
presence.changed(ranges.filter((r) => r.from < r.to));
|
|
@@ -1507,7 +1507,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1507
1507
|
inputSchema: {
|
|
1508
1508
|
type: "object",
|
|
1509
1509
|
properties: {
|
|
1510
|
-
operation: { type: "string", enum:
|
|
1510
|
+
operation: { type: "string", enum: _chunkT4JPGBW3cjs.TABLE_ACTIONS.map((a) => a.action), description: "Table operation." },
|
|
1511
1511
|
at: { type: "integer", minimum: 0, description: "Document position to place the cursor first (e.g. inside a cell)." },
|
|
1512
1512
|
rows: { type: "integer", minimum: 1, maximum: 100, description: "insertTable: rows (default 3)." },
|
|
1513
1513
|
cols: { type: "integer", minimum: 1, maximum: 50, description: "insertTable: columns (default 3)." },
|
|
@@ -1537,10 +1537,10 @@ function createRichTextToolProvider(target, options) {
|
|
|
1537
1537
|
ed.view.dispatch(ed.state.tr.setSelection(_state.TextSelection.near(ed.state.doc.resolve(at))));
|
|
1538
1538
|
}
|
|
1539
1539
|
const action = operation;
|
|
1540
|
-
const state =
|
|
1540
|
+
const state = _chunkT4JPGBW3cjs.getTableActionState.call(void 0, ed, action, params);
|
|
1541
1541
|
if (state !== true) throw new Error(state);
|
|
1542
|
-
|
|
1543
|
-
const table =
|
|
1542
|
+
_chunkT4JPGBW3cjs.runTableAction.call(void 0, ed, action, params);
|
|
1543
|
+
const table = _chunkT4JPGBW3cjs.getTableState.call(void 0, ed);
|
|
1544
1544
|
return {
|
|
1545
1545
|
operation,
|
|
1546
1546
|
table: table.inTable ? { rows: table.rows, columns: table.columns, row: table.row, column: table.column } : null,
|
|
@@ -1559,7 +1559,7 @@ function createRichTextToolProvider(target, options) {
|
|
|
1559
1559
|
if (!ed || ed.isDestroyed) return [];
|
|
1560
1560
|
if (!ed.isEditable) return [getText, findText, ...charts.read()];
|
|
1561
1561
|
const tools = [getText, findText, insertText, replaceText, replaceRange, replaceSelection, setSelection, ...formatting.tools(ed)];
|
|
1562
|
-
return [...tools, ...
|
|
1562
|
+
return [...tools, ..._chunkT4JPGBW3cjs.isTableEnabled.call(void 0, ed) ? [editTable] : [], ...charts.read(), ...charts.write().map(withCaret)];
|
|
1563
1563
|
},
|
|
1564
1564
|
subscribe: (notify) => {
|
|
1565
1565
|
const ed = editor();
|
|
@@ -2235,7 +2235,7 @@ function createReviewToolProvider(target, options) {
|
|
|
2235
2235
|
const editor = () => toEditor2(target);
|
|
2236
2236
|
const author = _nullishCoalesce(options.author, () => ( { id: "agent", name: "Agent" }));
|
|
2237
2237
|
const store = () => {
|
|
2238
|
-
const s =
|
|
2238
|
+
const s = _chunkT4JPGBW3cjs.getCommentStore.call(void 0, editor());
|
|
2239
2239
|
if (!s) throw new Error("This editor has no Comments extension.");
|
|
2240
2240
|
return s;
|
|
2241
2241
|
};
|
|
@@ -2430,7 +2430,7 @@ function createReviewToolProvider(target, options) {
|
|
|
2430
2430
|
tools: () => {
|
|
2431
2431
|
const ed = editor();
|
|
2432
2432
|
if (!ed || ed.isDestroyed) return [];
|
|
2433
|
-
const comments = !!
|
|
2433
|
+
const comments = !!_chunkT4JPGBW3cjs.getCommentStore.call(void 0, ed);
|
|
2434
2434
|
const changes = !!_chunk34RQAGWIcjs.getTrackChangesStore.call(void 0, ed);
|
|
2435
2435
|
const tools = [...comments ? [listComments] : [], ...changes ? [listChanges] : []];
|
|
2436
2436
|
if (!ed.isEditable) return tools;
|
package/dist/agent/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await 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;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVBRHE4AMcjs = require('../chunk-VBRHE4AM.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -39,10 +39,10 @@ var _chunk557BDWKOcjs = require('../chunk-557BDWKO.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _chunk56RHCIJVcjs = require('../chunk-56RHCIJV.cjs');
|
|
43
43
|
require('../chunk-EU2ZZA6L.cjs');
|
|
44
44
|
require('../chunk-RDFHWAHL.cjs');
|
|
45
|
-
require('../chunk-
|
|
45
|
+
require('../chunk-SPIO2GJU.cjs');
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
@@ -83,11 +83,11 @@ require('../chunk-2VX55NFM.cjs');
|
|
|
83
83
|
require('../chunk-W5M3J7PV.cjs');
|
|
84
84
|
require('../chunk-474IQG74.cjs');
|
|
85
85
|
require('../chunk-XFM3OCHU.cjs');
|
|
86
|
-
require('../chunk-
|
|
86
|
+
require('../chunk-YBMUHIOM.cjs');
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
var _chunkALNIFK5Gcjs = require('../chunk-ALNIFK5G.cjs');
|
|
90
|
-
require('../chunk-
|
|
90
|
+
require('../chunk-N4KP3UQR.cjs');
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
var _chunkSJ2CPTQCcjs = require('../chunk-SJ2CPTQC.cjs');
|
|
@@ -706,7 +706,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
706
706
|
function motionTextLayout(nodes, id) {
|
|
707
707
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
708
708
|
if (!group || group.type !== "group") return null;
|
|
709
|
-
const letters =
|
|
709
|
+
const letters = _chunk56RHCIJVcjs.collectPathNodes.call(void 0, group).map((p) => ({ id: p.id, b: _optionalChain([nodes, 'access', _8 => _8.get, 'call', _9 => _9(p.id), 'optionalAccess', _10 => _10.bounds]) })).filter((l) => !!l.b && l.b.width + l.b.height > 0);
|
|
710
710
|
if (!letters.length) return null;
|
|
711
711
|
const lines = [];
|
|
712
712
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -791,21 +791,21 @@ function indexMotionNodes(nodes) {
|
|
|
791
791
|
const out = /* @__PURE__ */ new Map();
|
|
792
792
|
const walk = (list, parentWorld, ancestors) => {
|
|
793
793
|
for (const node of list) {
|
|
794
|
-
const local =
|
|
795
|
-
const bounds =
|
|
794
|
+
const local = _chunk56RHCIJVcjs.vectorNodeBounds.call(void 0, node);
|
|
795
|
+
const bounds = _chunk56RHCIJVcjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
796
796
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
797
797
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
798
|
-
if (node.type === "group") walk(node.children,
|
|
798
|
+
if (node.type === "group") walk(node.children, _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
799
799
|
}
|
|
800
800
|
};
|
|
801
|
-
walk(nodes,
|
|
801
|
+
walk(nodes, _chunk56RHCIJVcjs.IDENTITY_MATRIX, []);
|
|
802
802
|
indexCache.set(nodes, out);
|
|
803
803
|
return out;
|
|
804
804
|
}
|
|
805
805
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
806
806
|
function firstPaint(node, key) {
|
|
807
807
|
if (node.type === "path") return solid(node[key]);
|
|
808
|
-
for (const p of
|
|
808
|
+
for (const p of _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node)) {
|
|
809
809
|
const s = solid(p[key]);
|
|
810
810
|
if (s) return s;
|
|
811
811
|
}
|
|
@@ -813,7 +813,7 @@ function firstPaint(node, key) {
|
|
|
813
813
|
}
|
|
814
814
|
function strokeReach(node) {
|
|
815
815
|
let reach = 0;
|
|
816
|
-
for (const p of node.type === "path" ? [node] :
|
|
816
|
+
for (const p of node.type === "path" ? [node] : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node)) {
|
|
817
817
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
818
818
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
819
819
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -883,7 +883,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
883
883
|
case "stroke":
|
|
884
884
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
885
885
|
case "strokeWidth": {
|
|
886
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
886
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
887
887
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
888
888
|
}
|
|
889
889
|
case "shape":
|
|
@@ -994,12 +994,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
994
994
|
const r = camera;
|
|
995
995
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
996
996
|
}
|
|
997
|
-
function motionPathLength(node, parentWorld =
|
|
997
|
+
function motionPathLength(node, parentWorld = _chunk56RHCIJVcjs.IDENTITY_MATRIX) {
|
|
998
998
|
let longest = 0;
|
|
999
|
-
const paths = node.type === "path" ? [node] :
|
|
999
|
+
const paths = node.type === "path" ? [node] : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node);
|
|
1000
1000
|
for (const p of paths) {
|
|
1001
1001
|
try {
|
|
1002
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
1002
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
1003
1003
|
} catch (e2) {
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
@@ -1275,12 +1275,12 @@ function compileMotionScene(scene) {
|
|
|
1275
1275
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1276
1276
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1277
1277
|
if (order2 === "together" && pace === "time") return null;
|
|
1278
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1278
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, entry.node);
|
|
1279
1279
|
let list = paths.map((p) => {
|
|
1280
1280
|
const at = nodes.get(p.id);
|
|
1281
1281
|
let first = { x: 0, y: 0 };
|
|
1282
1282
|
try {
|
|
1283
|
-
const m =
|
|
1283
|
+
const m = _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunk56RHCIJVcjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1284
1284
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1285
1285
|
} catch (e3) {
|
|
1286
1286
|
}
|
|
@@ -1392,17 +1392,17 @@ function compileMotionScene(scene) {
|
|
|
1392
1392
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1393
1393
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1394
1394
|
if (command3.to) {
|
|
1395
|
-
const inv =
|
|
1396
|
-
const target =
|
|
1395
|
+
const inv = _chunk56RHCIJVcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1396
|
+
const target = _chunk56RHCIJVcjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1397
1397
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1398
1398
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1399
1399
|
}
|
|
1400
1400
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1401
|
-
const inv =
|
|
1401
|
+
const inv = _chunk56RHCIJVcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1402
1402
|
const x0 = num2("x");
|
|
1403
1403
|
const y0 = num2("y");
|
|
1404
1404
|
const add = command3.blend === "add";
|
|
1405
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1405
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunk56RHCIJVcjs.applyMatrix.call(void 0, inv, p)).map((p) => ({ x: p.x - entry.center.x - x0, y: p.y - entry.center.y - y0 })), { x: dx, y: dy }];
|
|
1406
1406
|
const times = _optionalChain([command3, 'access', _51 => _51.times, 'optionalAccess', _52 => _52.length]) === command3.via.length ? [start, ...command3.times.map((f) => start + f * (end - start)), end] : smoothMotionTimes(offsets, start, end - start, _nullishCoalesce(command3.pacing, () => ( "even")));
|
|
1407
1407
|
for (const axis of ["x", "y"]) {
|
|
1408
1408
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -2025,13 +2025,13 @@ function morphBetween(a, b) {
|
|
|
2025
2025
|
let inner = morphCache.get(a);
|
|
2026
2026
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2027
2027
|
let morph = inner.get(b);
|
|
2028
|
-
if (!morph) inner.set(b, morph =
|
|
2028
|
+
if (!morph) inner.set(b, morph = _chunkVBRHE4AMcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2029
2029
|
return morph;
|
|
2030
2030
|
}
|
|
2031
2031
|
function shapeIn(entry, shape) {
|
|
2032
2032
|
if (shape === entry) return entry.node;
|
|
2033
|
-
const m =
|
|
2034
|
-
return { ...shape.node, ...
|
|
2033
|
+
const m = _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunk56RHCIJVcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2034
|
+
return { ...shape.node, ..._chunk56RHCIJVcjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2035
2035
|
}
|
|
2036
2036
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2037
2037
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2051,7 +2051,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2051
2051
|
function motionFollowRoute(entry, path) {
|
|
2052
2052
|
if (!path || path.node.type !== "path") return null;
|
|
2053
2053
|
try {
|
|
2054
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2054
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunk56RHCIJVcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2055
2055
|
} catch (e6) {
|
|
2056
2056
|
return null;
|
|
2057
2057
|
}
|
|
@@ -2085,9 +2085,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2085
2085
|
const scaleX = read("scaleX", 1);
|
|
2086
2086
|
const scaleY = read("scaleY", 1);
|
|
2087
2087
|
const c = entry.center;
|
|
2088
|
-
let matrix =
|
|
2088
|
+
let matrix = _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunk56RHCIJVcjs.rotateMatrix.call(void 0, rotation, c)), _chunk56RHCIJVcjs.translateMatrix.call(void 0, dx, dy));
|
|
2089
2089
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2090
|
-
if (along) matrix =
|
|
2090
|
+
if (along) matrix = _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, matrix, _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.translateMatrix.call(void 0, -c.x, -c.y), _chunk56RHCIJVcjs.rotateMatrix.call(void 0, along.angle)), _chunk56RHCIJVcjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2091
2091
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2092
2092
|
}
|
|
2093
2093
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2154,7 +2154,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2154
2154
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2155
2155
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2156
2156
|
if (start > 0 || end < 1) {
|
|
2157
|
-
const trim =
|
|
2157
|
+
const trim = _chunk56RHCIJVcjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2158
2158
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2159
2159
|
}
|
|
2160
2160
|
}
|
|
@@ -2168,8 +2168,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2168
2168
|
if (o >= 1) delete out.opacity;
|
|
2169
2169
|
}
|
|
2170
2170
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2171
|
-
if (offset && !
|
|
2172
|
-
const m =
|
|
2171
|
+
if (offset && !_chunk56RHCIJVcjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2172
|
+
const m = _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _chunk56RHCIJVcjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2173
2173
|
out = { ...out, transform: m };
|
|
2174
2174
|
}
|
|
2175
2175
|
return out;
|
|
@@ -2190,8 +2190,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2190
2190
|
const wrap = { ...options.wrap };
|
|
2191
2191
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2192
2192
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
2193
|
-
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(
|
|
2194
|
-
const art =
|
|
2193
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunk56RHCIJVcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2194
|
+
const art = _chunk56RHCIJVcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2195
2195
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2196
2196
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2197
2197
|
if (transition) {
|
|
@@ -2382,8 +2382,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2382
2382
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2383
2383
|
const circle = clip("clipCircle");
|
|
2384
2384
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
2385
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
2386
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
2385
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2386
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node).length === 0 || _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2387
2387
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2388
2388
|
return typeof v !== "number" || v > 0.01;
|
|
2389
2389
|
}));
|
|
@@ -2470,7 +2470,7 @@ function checkMotionScene(scene) {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
for (const id of targets) {
|
|
2472
2472
|
const node = nodes.get(id).node;
|
|
2473
|
-
const paths = node.type === "path" ? [node] :
|
|
2473
|
+
const paths = node.type === "path" ? [node] : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node);
|
|
2474
2474
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2475
2475
|
issues.push(_chunkDGWOGQJ5cjs.motionIssue.call(void 0, "paint-not-color", `"${id}" has a gradient ${key}; it switches to ${color} at the end instead of blending.`, { ...where, ids: [id] }));
|
|
2476
2476
|
}
|
|
@@ -2483,7 +2483,7 @@ function checkMotionScene(scene) {
|
|
|
2483
2483
|
else
|
|
2484
2484
|
for (const id of targets) {
|
|
2485
2485
|
const node = nodes.get(id).node;
|
|
2486
|
-
const paths = node.type === "path" ? [node] :
|
|
2486
|
+
const paths = node.type === "path" ? [node] : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node);
|
|
2487
2487
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2488
2488
|
issues.push(_chunkDGWOGQJ5cjs.motionIssue.call(void 0, "paint-not-color", `"${id}" has a gradient or no ${key}, so a colour pulse cannot tint it; give it a solid ${key} or pulse the ${key === "fill" ? "stroke" : "fill"}.`, { ...where, ids: [id] }));
|
|
2489
2489
|
}
|
|
@@ -2928,7 +2928,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2928
2928
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2929
2929
|
const timeline = compileMotionScene(scene);
|
|
2930
2930
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2931
|
-
const centre =
|
|
2931
|
+
const centre = _chunk56RHCIJVcjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2932
2932
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2933
2933
|
const fill = paint("fill");
|
|
2934
2934
|
const stroke = paint("stroke");
|
|
@@ -3275,7 +3275,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3275
3275
|
raw: (t) => transformAt(t, true)
|
|
3276
3276
|
});
|
|
3277
3277
|
}
|
|
3278
|
-
const paths = node.type === "path" ? [node] :
|
|
3278
|
+
const paths = node.type === "path" ? [node] : _chunk56RHCIJVcjs.collectPathNodes.call(void 0, node);
|
|
3279
3279
|
for (const path of paths) {
|
|
3280
3280
|
if (pathsSeen.has(path.id)) continue;
|
|
3281
3281
|
pathsSeen.add(path.id);
|
|
@@ -3297,7 +3297,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3297
3297
|
if (shapeSegments.length) {
|
|
3298
3298
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
3299
3299
|
else {
|
|
3300
|
-
const inverse =
|
|
3300
|
+
const inverse = _chunk56RHCIJVcjs.invertMatrix.call(void 0, _chunk56RHCIJVcjs.nodeMatrix.call(void 0, node));
|
|
3301
3301
|
channels.push({
|
|
3302
3302
|
id,
|
|
3303
3303
|
kind: "attr",
|
|
@@ -3306,9 +3306,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3306
3306
|
exact: () => false,
|
|
3307
3307
|
value: (t) => {
|
|
3308
3308
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3309
|
-
const now =
|
|
3309
|
+
const now = _chunk56RHCIJVcjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _151 => _151(frame.document.nodes), 'access', _152 => _152.get, 'call', _153 => _153(id), 'optionalAccess', _154 => _154.node]));
|
|
3310
3310
|
if (!now || now.type !== "path") return "";
|
|
3311
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3311
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, now, _chunk56RHCIJVcjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3312
3312
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3313
3313
|
}
|
|
3314
3314
|
});
|
|
@@ -3448,7 +3448,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3450
3450
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
3451
|
-
let svg =
|
|
3451
|
+
let svg = _chunk56RHCIJVcjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunk56RHCIJVcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3452
3452
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3453
3453
|
let motion = { svg, animate };
|
|
3454
3454
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3546,14 +3546,14 @@ function easingOf(ease, fallback) {
|
|
|
3546
3546
|
return fallback;
|
|
3547
3547
|
}
|
|
3548
3548
|
function poseOf(value, entry) {
|
|
3549
|
-
const t =
|
|
3550
|
-
const o =
|
|
3549
|
+
const t = _chunk56RHCIJVcjs.parseSvgTransform.call(void 0, String(value));
|
|
3550
|
+
const o = _chunk56RHCIJVcjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunk56RHCIJVcjs.invertMatrix.call(void 0, _chunk56RHCIJVcjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3551
3551
|
const sx = Math.hypot(o[0], o[1]);
|
|
3552
3552
|
if (!(sx > 1e-9)) return null;
|
|
3553
3553
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3554
3554
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3555
3555
|
const c = entry.center;
|
|
3556
|
-
const moved =
|
|
3556
|
+
const moved = _chunk56RHCIJVcjs.applyMatrix.call(void 0, o, c);
|
|
3557
3557
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3558
3558
|
}
|
|
3559
3559
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3638,7 +3638,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3638
3638
|
const notes = [];
|
|
3639
3639
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3640
3640
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3641
|
-
const artwork =
|
|
3641
|
+
const artwork = _chunk56RHCIJVcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3642
3642
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3643
3643
|
const byStep = /* @__PURE__ */ new Map();
|
|
3644
3644
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3885,9 +3885,9 @@ function toLottie(scene, options = {}) {
|
|
|
3885
3885
|
const items = [];
|
|
3886
3886
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3887
3887
|
const geometryAt = (t) => {
|
|
3888
|
-
if (!shapeSegments.length) return
|
|
3888
|
+
if (!shapeSegments.length) return _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3889
3889
|
const now = _optionalChain([indexMotionNodes, 'call', _170 => _170(motionFrameAt(scene, t, { draw: false, offsets: false }).document.nodes), 'access', _171 => _171.get, 'call', _172 => _172(path.id), 'optionalAccess', _173 => _173.node]);
|
|
3890
|
-
return now && now.type === "path" ?
|
|
3890
|
+
return now && now.type === "path" ? _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, _chunk56RHCIJVcjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3891
3891
|
};
|
|
3892
3892
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3893
3893
|
rest.forEach((contour, n2) => {
|
|
@@ -3960,13 +3960,13 @@ function toLottie(scene, options = {}) {
|
|
|
3960
3960
|
const innerTr = STATIC_TR();
|
|
3961
3961
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3962
3962
|
else if (node.type === "text" || node.type === "instance") {
|
|
3963
|
-
const drawn =
|
|
3963
|
+
const drawn = _chunk56RHCIJVcjs.expandVectorAppearance.call(void 0, node);
|
|
3964
3964
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3965
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3965
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunk56RHCIJVcjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3966
3966
|
} else {
|
|
3967
3967
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3968
|
-
const m =
|
|
3969
|
-
if (m !==
|
|
3968
|
+
const m = _chunk56RHCIJVcjs.nodeMatrix.call(void 0, node);
|
|
3969
|
+
if (m !== _chunk56RHCIJVcjs.IDENTITY_MATRIX) {
|
|
3970
3970
|
const parts = staticParts(m);
|
|
3971
3971
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3972
3972
|
else {
|
|
@@ -3979,7 +3979,7 @@ function toLottie(scene, options = {}) {
|
|
|
3979
3979
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3980
3980
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3981
3981
|
};
|
|
3982
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3982
|
+
const artwork = { ...scene.artwork, nodes: _chunk56RHCIJVcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3983
3983
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3984
3984
|
if (artwork.background && rgba(artwork.background))
|
|
3985
3985
|
content.push({ ty: "gr", nm: "Background", it: [{ ty: "rc", nm: "Background", p: { a: 0, k: [artwork.width / 2, artwork.height / 2] }, s: { a: 0, k: [artwork.width, artwork.height] }, r: { a: 0, k: 0 } }, { ty: "fl", c: { a: 0, k: rgba(artwork.background).map(round4) }, o: { a: 0, k: 100 }, r: 1 }, STATIC_TR()] });
|
|
@@ -4078,11 +4078,11 @@ function preset(prst, w, h) {
|
|
|
4078
4078
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4079
4079
|
switch (prst) {
|
|
4080
4080
|
case "rect":
|
|
4081
|
-
return [
|
|
4081
|
+
return [_chunk56RHCIJVcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4082
4082
|
case "roundRect":
|
|
4083
|
-
return [
|
|
4083
|
+
return [_chunk56RHCIJVcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4084
4084
|
case "ellipse":
|
|
4085
|
-
return [
|
|
4085
|
+
return [_chunk56RHCIJVcjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4086
4086
|
case "triangle":
|
|
4087
4087
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4088
4088
|
case "rtTriangle":
|
|
@@ -4190,7 +4190,7 @@ function shapes(ctx, tree, map) {
|
|
|
4190
4190
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4191
4191
|
if (!subpaths) {
|
|
4192
4192
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4193
|
-
subpaths = [
|
|
4193
|
+
subpaths = [_chunk56RHCIJVcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4194
4194
|
}
|
|
4195
4195
|
const style = kid(el, "style");
|
|
4196
4196
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4579,7 +4579,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4579
4579
|
walk(scene.artwork.nodes);
|
|
4580
4580
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4581
4581
|
}
|
|
4582
|
-
var motionArtworkSvg = (artwork) =>
|
|
4582
|
+
var motionArtworkSvg = (artwork) => _chunk56RHCIJVcjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4583
4583
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4584
4584
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4585
4585
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -4912,7 +4912,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4912
4912
|
const entry = indexMotionNodes(artwork.nodes).get(path.node);
|
|
4913
4913
|
if (!entry) throw new Error(`There is no node "${path.node}"; find_animation_elements lists the artwork's nodes.`);
|
|
4914
4914
|
if (entry.node.type !== "path") throw new Error(`Node "${path.node}" is a ${entry.node.type}, not a path; pass a path node (find_animation_elements shows each node's type).`);
|
|
4915
|
-
const value2 = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0,
|
|
4915
|
+
const value2 = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, _chunk56RHCIJVcjs.vectorPathWorldBezier.call(void 0, entry.node, entry.parentWorld, { effects: false }));
|
|
4916
4916
|
return { control, value: value2, place: "viewBox" };
|
|
4917
4917
|
}
|
|
4918
4918
|
const provider = this.effects.require();
|
|
@@ -6214,7 +6214,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6214
6214
|
handler: ({ svg }) => {
|
|
6215
6215
|
let artwork;
|
|
6216
6216
|
try {
|
|
6217
|
-
artwork =
|
|
6217
|
+
artwork = _chunk56RHCIJVcjs.parseVectorSvg.call(void 0, svg);
|
|
6218
6218
|
} catch (error) {
|
|
6219
6219
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6220
6220
|
}
|