@pixerate/editor 0.259.0 → 0.260.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 +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/index.cjs +61 -59
- package/dist/animation-editor/index.js +5 -3
- package/dist/brushes/index.cjs +52 -52
- package/dist/brushes/index.js +6 -6
- package/dist/{brushstrokeRender-JI4W6F2G.js → brushstrokeRender-25Q5BEY6.js} +17 -7
- package/dist/{brushstrokeRender-MQ6PSDM5.cjs → brushstrokeRender-N6UPZSQS.cjs} +31 -21
- package/dist/canvas/brushTypes.d.cts +5 -0
- package/dist/canvas/brushTypes.d.ts +5 -0
- package/dist/canvas/drawController.d.cts +15 -1
- package/dist/canvas/drawController.d.ts +15 -1
- package/dist/canvas/index.cjs +136 -102
- package/dist/canvas/index.js +35 -1
- package/dist/{chunk-3PPJRMIG.js → chunk-3O47TPGX.js} +197 -18
- package/dist/{chunk-5Q5MLXAD.cjs → chunk-3TQW5MPW.cjs} +23 -23
- package/dist/{chunk-JBBJE76O.cjs → chunk-3ZRNK3RO.cjs} +1138 -85
- package/dist/{chunk-YSGW7VV4.cjs → chunk-43NT242D.cjs} +1401 -228
- package/dist/{chunk-SMTUQWGY.js → chunk-5IW65VQ6.js} +1 -1
- package/dist/{chunk-YQ4PQTBB.js → chunk-6NZL24W4.js} +9 -1
- package/dist/{chunk-O3ZVZSNJ.cjs → chunk-7AUQ2UJ3.cjs} +137 -129
- package/dist/{chunk-4M4E3N6X.js → chunk-CQVTGBQI.js} +1 -1
- package/dist/{chunk-SSFMWJDK.js → chunk-D4TE5JNW.js} +1192 -19
- package/dist/{chunk-AORZ5M5C.js → chunk-EHALWBBD.js} +1 -1
- package/dist/{chunk-6WCQ35GI.cjs → chunk-NHA26O5X.cjs} +2 -2
- package/dist/{chunk-DPYAO5U6.cjs → chunk-PVJMTLPJ.cjs} +197 -18
- package/dist/{chunk-MQGQTKVW.cjs → chunk-PYTJBVW5.cjs} +29 -29
- package/dist/{chunk-IXQZHCOF.js → chunk-QAR2N7HZ.js} +1 -1
- package/dist/{chunk-5P4JEOIV.js → chunk-TMDDMJCR.js} +2 -2
- package/dist/{chunk-RSIKDWOP.cjs → chunk-TZOX7KWV.cjs} +15 -15
- package/dist/{chunk-IPUTIUGQ.cjs → chunk-UVZ7RQOE.cjs} +1 -1
- package/dist/{chunk-A7GJ6BXI.js → chunk-WJ4WQJCC.js} +1062 -9
- package/dist/{chunk-ICTPLVSR.js → chunk-X2EXYY4J.js} +1 -1
- package/dist/{chunk-WQCNC4DK.js → chunk-XC6DPRYI.js} +695 -4
- package/dist/{chunk-KBYB7OWB.cjs → chunk-YHDHFJUC.cjs} +776 -85
- package/dist/{chunk-P3PZ63M3.cjs → chunk-YLUIFXSL.cjs} +35 -35
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/image-editor/index.cjs +1385 -2484
- package/dist/image-editor/index.js +139 -1238
- package/dist/image-editor/selection-worker.cjs +3 -4
- package/dist/image-editor/selection-worker.js +1 -2
- package/dist/paint/index.cjs +3 -5
- package/dist/paint/index.js +40 -42
- package/dist/paint-editor/contract.d.cts +29 -0
- package/dist/paint-editor/contract.d.ts +29 -0
- package/dist/paint-editor/dab-stroke.d.cts +5 -0
- package/dist/paint-editor/dab-stroke.d.ts +5 -0
- package/dist/paint-editor/index.cjs +402 -258
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +197 -53
- package/dist/paint-editor/stamp-tip.d.cts +17 -0
- package/dist/paint-editor/stamp-tip.d.ts +17 -0
- package/dist/paint-editor/ui.d.cts +21 -1
- package/dist/paint-editor/ui.d.ts +21 -1
- package/dist/raster/index.cjs +2 -4
- package/dist/raster/index.js +6 -8
- package/dist/vector/brushstroke.d.cts +6 -0
- package/dist/vector/brushstroke.d.ts +6 -0
- package/dist/vector/controller.d.cts +11 -2
- package/dist/vector/controller.d.ts +11 -2
- package/dist/vector/index.cjs +990 -973
- package/dist/vector/index.js +28 -11
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +1 -1
- package/skills/pixerate-canvas/SKILL.md +3 -1
- package/skills/pixerate-vector/SKILL.md +2 -2
- package/dist/chunk-2VJAVXLI.js +0 -192
- package/dist/chunk-62Z5WLRA.js +0 -700
- package/dist/chunk-BOHDJJ2O.cjs +0 -192
- package/dist/chunk-NKGB64CW.cjs +0 -700
- package/dist/chunk-SS53NNZO.cjs +0 -1066
- package/dist/chunk-ZNA3IQZF.js +0 -1066
package/dist/agent/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
var _chunkG23BTQA5cjs = require('../chunk-G23BTQA5.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkNHA26O5Xcjs = require('../chunk-NHA26O5X.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -2120,7 +2120,7 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
|
|
|
2120
2120
|
({ id }) => check(controller.restoreMainComponent(id))
|
|
2121
2121
|
)
|
|
2122
2122
|
];
|
|
2123
|
-
if (
|
|
2123
|
+
if (_chunkNHA26O5Xcjs.hasVariantCommands.call(void 0, controller)) {
|
|
2124
2124
|
const SET = { type: "string", description: "Component set, or one of its variants (default: the selection\u2019s set)." };
|
|
2125
2125
|
const VARIANT = { type: "string", description: "Variant id (default: the first selected variant)." };
|
|
2126
2126
|
const VALUES = { type: "object", additionalProperties: { type: "string" }, description: 'Variant property \u2192 value, e.g. { "Size": "Medium" }.' };
|
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(); } } 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 _chunkYLUIFXSLcjs = require('../chunk-YLUIFXSL.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -39,8 +39,8 @@ var _chunk557BDWKOcjs = require('../chunk-557BDWKO.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('../chunk-
|
|
42
|
+
var _chunk7AUQ2UJ3cjs = require('../chunk-7AUQ2UJ3.cjs');
|
|
43
|
+
require('../chunk-TZOX7KWV.cjs');
|
|
44
44
|
require('../chunk-JSDND7DF.cjs');
|
|
45
45
|
require('../chunk-CVFAAZXE.cjs');
|
|
46
46
|
|
|
@@ -51,6 +51,8 @@ require('../chunk-CVFAAZXE.cjs');
|
|
|
51
51
|
|
|
52
52
|
var _chunkGF2RBSDMcjs = require('../chunk-GF2RBSDM.cjs');
|
|
53
53
|
require('../chunk-NM3G4VQT.cjs');
|
|
54
|
+
require('../chunk-LRTR4ASZ.cjs');
|
|
55
|
+
require('../chunk-A2IS7EHE.cjs');
|
|
54
56
|
require('../chunk-U67EN7GG.cjs');
|
|
55
57
|
|
|
56
58
|
|
|
@@ -704,7 +706,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
704
706
|
function motionTextLayout(nodes, id) {
|
|
705
707
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
706
708
|
if (!group || group.type !== "group") return null;
|
|
707
|
-
const letters =
|
|
709
|
+
const letters = _chunk7AUQ2UJ3cjs.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);
|
|
708
710
|
if (!letters.length) return null;
|
|
709
711
|
const lines = [];
|
|
710
712
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -789,21 +791,21 @@ function indexMotionNodes(nodes) {
|
|
|
789
791
|
const out = /* @__PURE__ */ new Map();
|
|
790
792
|
const walk = (list, parentWorld, ancestors) => {
|
|
791
793
|
for (const node of list) {
|
|
792
|
-
const local =
|
|
793
|
-
const bounds =
|
|
794
|
+
const local = _chunk7AUQ2UJ3cjs.vectorNodeBounds.call(void 0, node);
|
|
795
|
+
const bounds = _chunk7AUQ2UJ3cjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
794
796
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
795
797
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
796
|
-
if (node.type === "group") walk(node.children,
|
|
798
|
+
if (node.type === "group") walk(node.children, _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
797
799
|
}
|
|
798
800
|
};
|
|
799
|
-
walk(nodes,
|
|
801
|
+
walk(nodes, _chunk7AUQ2UJ3cjs.IDENTITY_MATRIX, []);
|
|
800
802
|
indexCache.set(nodes, out);
|
|
801
803
|
return out;
|
|
802
804
|
}
|
|
803
805
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
804
806
|
function firstPaint(node, key) {
|
|
805
807
|
if (node.type === "path") return solid(node[key]);
|
|
806
|
-
for (const p of
|
|
808
|
+
for (const p of _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node)) {
|
|
807
809
|
const s = solid(p[key]);
|
|
808
810
|
if (s) return s;
|
|
809
811
|
}
|
|
@@ -811,7 +813,7 @@ function firstPaint(node, key) {
|
|
|
811
813
|
}
|
|
812
814
|
function strokeReach(node) {
|
|
813
815
|
let reach = 0;
|
|
814
|
-
for (const p of node.type === "path" ? [node] :
|
|
816
|
+
for (const p of node.type === "path" ? [node] : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node)) {
|
|
815
817
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
816
818
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
817
819
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -881,7 +883,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
881
883
|
case "stroke":
|
|
882
884
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
883
885
|
case "strokeWidth": {
|
|
884
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
886
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
885
887
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
886
888
|
}
|
|
887
889
|
case "shape":
|
|
@@ -992,12 +994,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
992
994
|
const r = camera;
|
|
993
995
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
994
996
|
}
|
|
995
|
-
function motionPathLength(node, parentWorld =
|
|
997
|
+
function motionPathLength(node, parentWorld = _chunk7AUQ2UJ3cjs.IDENTITY_MATRIX) {
|
|
996
998
|
let longest = 0;
|
|
997
|
-
const paths = node.type === "path" ? [node] :
|
|
999
|
+
const paths = node.type === "path" ? [node] : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node);
|
|
998
1000
|
for (const p of paths) {
|
|
999
1001
|
try {
|
|
1000
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
1002
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
1001
1003
|
} catch (e2) {
|
|
1002
1004
|
}
|
|
1003
1005
|
}
|
|
@@ -1273,12 +1275,12 @@ function compileMotionScene(scene) {
|
|
|
1273
1275
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1274
1276
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1275
1277
|
if (order2 === "together" && pace === "time") return null;
|
|
1276
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1278
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, entry.node);
|
|
1277
1279
|
let list = paths.map((p) => {
|
|
1278
1280
|
const at = nodes.get(p.id);
|
|
1279
1281
|
let first = { x: 0, y: 0 };
|
|
1280
1282
|
try {
|
|
1281
|
-
const m =
|
|
1283
|
+
const m = _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunk7AUQ2UJ3cjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1282
1284
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1283
1285
|
} catch (e3) {
|
|
1284
1286
|
}
|
|
@@ -1390,17 +1392,17 @@ function compileMotionScene(scene) {
|
|
|
1390
1392
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1391
1393
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1392
1394
|
if (command3.to) {
|
|
1393
|
-
const inv =
|
|
1394
|
-
const target =
|
|
1395
|
+
const inv = _chunk7AUQ2UJ3cjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1396
|
+
const target = _chunk7AUQ2UJ3cjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1395
1397
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1396
1398
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1397
1399
|
}
|
|
1398
1400
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1399
|
-
const inv =
|
|
1401
|
+
const inv = _chunk7AUQ2UJ3cjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1400
1402
|
const x0 = num2("x");
|
|
1401
1403
|
const y0 = num2("y");
|
|
1402
1404
|
const add = command3.blend === "add";
|
|
1403
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1405
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunk7AUQ2UJ3cjs.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 }];
|
|
1404
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")));
|
|
1405
1407
|
for (const axis of ["x", "y"]) {
|
|
1406
1408
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -2023,13 +2025,13 @@ function morphBetween(a, b) {
|
|
|
2023
2025
|
let inner = morphCache.get(a);
|
|
2024
2026
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2025
2027
|
let morph = inner.get(b);
|
|
2026
|
-
if (!morph) inner.set(b, morph =
|
|
2028
|
+
if (!morph) inner.set(b, morph = _chunkYLUIFXSLcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2027
2029
|
return morph;
|
|
2028
2030
|
}
|
|
2029
2031
|
function shapeIn(entry, shape) {
|
|
2030
2032
|
if (shape === entry) return entry.node;
|
|
2031
|
-
const m =
|
|
2032
|
-
return { ...shape.node, ...
|
|
2033
|
+
const m = _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunk7AUQ2UJ3cjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2034
|
+
return { ...shape.node, ..._chunk7AUQ2UJ3cjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2033
2035
|
}
|
|
2034
2036
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2035
2037
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2049,7 +2051,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2049
2051
|
function motionFollowRoute(entry, path) {
|
|
2050
2052
|
if (!path || path.node.type !== "path") return null;
|
|
2051
2053
|
try {
|
|
2052
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2054
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunk7AUQ2UJ3cjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2053
2055
|
} catch (e6) {
|
|
2054
2056
|
return null;
|
|
2055
2057
|
}
|
|
@@ -2083,9 +2085,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2083
2085
|
const scaleX = read("scaleX", 1);
|
|
2084
2086
|
const scaleY = read("scaleY", 1);
|
|
2085
2087
|
const c = entry.center;
|
|
2086
|
-
let matrix =
|
|
2088
|
+
let matrix = _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunk7AUQ2UJ3cjs.rotateMatrix.call(void 0, rotation, c)), _chunk7AUQ2UJ3cjs.translateMatrix.call(void 0, dx, dy));
|
|
2087
2089
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2088
|
-
if (along) matrix =
|
|
2090
|
+
if (along) matrix = _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, matrix, _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.translateMatrix.call(void 0, -c.x, -c.y), _chunk7AUQ2UJ3cjs.rotateMatrix.call(void 0, along.angle)), _chunk7AUQ2UJ3cjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2089
2091
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2090
2092
|
}
|
|
2091
2093
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2152,7 +2154,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2152
2154
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2153
2155
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2154
2156
|
if (start > 0 || end < 1) {
|
|
2155
|
-
const trim =
|
|
2157
|
+
const trim = _chunk7AUQ2UJ3cjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2156
2158
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2157
2159
|
}
|
|
2158
2160
|
}
|
|
@@ -2166,8 +2168,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2166
2168
|
if (o >= 1) delete out.opacity;
|
|
2167
2169
|
}
|
|
2168
2170
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2169
|
-
if (offset && !
|
|
2170
|
-
const m =
|
|
2171
|
+
if (offset && !_chunk7AUQ2UJ3cjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2172
|
+
const m = _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _chunk7AUQ2UJ3cjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2171
2173
|
out = { ...out, transform: m };
|
|
2172
2174
|
}
|
|
2173
2175
|
return out;
|
|
@@ -2188,8 +2190,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2188
2190
|
const wrap = { ...options.wrap };
|
|
2189
2191
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2190
2192
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
2191
|
-
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(
|
|
2192
|
-
const art =
|
|
2193
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunk7AUQ2UJ3cjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2194
|
+
const art = _chunk7AUQ2UJ3cjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2193
2195
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2194
2196
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2195
2197
|
if (transition) {
|
|
@@ -2380,8 +2382,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2380
2382
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2381
2383
|
const circle = clip("clipCircle");
|
|
2382
2384
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
2383
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
2384
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
2385
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2386
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node).length === 0 || _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2385
2387
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2386
2388
|
return typeof v !== "number" || v > 0.01;
|
|
2387
2389
|
}));
|
|
@@ -2468,7 +2470,7 @@ function checkMotionScene(scene) {
|
|
|
2468
2470
|
}
|
|
2469
2471
|
for (const id of targets) {
|
|
2470
2472
|
const node = nodes.get(id).node;
|
|
2471
|
-
const paths = node.type === "path" ? [node] :
|
|
2473
|
+
const paths = node.type === "path" ? [node] : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node);
|
|
2472
2474
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2473
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] }));
|
|
2474
2476
|
}
|
|
@@ -2481,7 +2483,7 @@ function checkMotionScene(scene) {
|
|
|
2481
2483
|
else
|
|
2482
2484
|
for (const id of targets) {
|
|
2483
2485
|
const node = nodes.get(id).node;
|
|
2484
|
-
const paths = node.type === "path" ? [node] :
|
|
2486
|
+
const paths = node.type === "path" ? [node] : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node);
|
|
2485
2487
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2486
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] }));
|
|
2487
2489
|
}
|
|
@@ -2926,7 +2928,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2926
2928
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2927
2929
|
const timeline = compileMotionScene(scene);
|
|
2928
2930
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2929
|
-
const centre =
|
|
2931
|
+
const centre = _chunk7AUQ2UJ3cjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2930
2932
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2931
2933
|
const fill = paint("fill");
|
|
2932
2934
|
const stroke = paint("stroke");
|
|
@@ -3273,7 +3275,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3273
3275
|
raw: (t) => transformAt(t, true)
|
|
3274
3276
|
});
|
|
3275
3277
|
}
|
|
3276
|
-
const paths = node.type === "path" ? [node] :
|
|
3278
|
+
const paths = node.type === "path" ? [node] : _chunk7AUQ2UJ3cjs.collectPathNodes.call(void 0, node);
|
|
3277
3279
|
for (const path of paths) {
|
|
3278
3280
|
if (pathsSeen.has(path.id)) continue;
|
|
3279
3281
|
pathsSeen.add(path.id);
|
|
@@ -3295,7 +3297,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3295
3297
|
if (shapeSegments.length) {
|
|
3296
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").`);
|
|
3297
3299
|
else {
|
|
3298
|
-
const inverse =
|
|
3300
|
+
const inverse = _chunk7AUQ2UJ3cjs.invertMatrix.call(void 0, _chunk7AUQ2UJ3cjs.nodeMatrix.call(void 0, node));
|
|
3299
3301
|
channels.push({
|
|
3300
3302
|
id,
|
|
3301
3303
|
kind: "attr",
|
|
@@ -3304,9 +3306,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3304
3306
|
exact: () => false,
|
|
3305
3307
|
value: (t) => {
|
|
3306
3308
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3307
|
-
const now =
|
|
3309
|
+
const now = _chunk7AUQ2UJ3cjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _151 => _151(frame.document.nodes), 'access', _152 => _152.get, 'call', _153 => _153(id), 'optionalAccess', _154 => _154.node]));
|
|
3308
3310
|
if (!now || now.type !== "path") return "";
|
|
3309
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3311
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, now, _chunk7AUQ2UJ3cjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3310
3312
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3311
3313
|
}
|
|
3312
3314
|
});
|
|
@@ -3446,7 +3448,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3446
3448
|
}
|
|
3447
3449
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3448
3450
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
3449
|
-
let svg =
|
|
3451
|
+
let svg = _chunk7AUQ2UJ3cjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunk7AUQ2UJ3cjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3450
3452
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3451
3453
|
let motion = { svg, animate };
|
|
3452
3454
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3544,14 +3546,14 @@ function easingOf(ease, fallback) {
|
|
|
3544
3546
|
return fallback;
|
|
3545
3547
|
}
|
|
3546
3548
|
function poseOf(value, entry) {
|
|
3547
|
-
const t =
|
|
3548
|
-
const o =
|
|
3549
|
+
const t = _chunk7AUQ2UJ3cjs.parseSvgTransform.call(void 0, String(value));
|
|
3550
|
+
const o = _chunk7AUQ2UJ3cjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunk7AUQ2UJ3cjs.invertMatrix.call(void 0, _chunk7AUQ2UJ3cjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3549
3551
|
const sx = Math.hypot(o[0], o[1]);
|
|
3550
3552
|
if (!(sx > 1e-9)) return null;
|
|
3551
3553
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3552
3554
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3553
3555
|
const c = entry.center;
|
|
3554
|
-
const moved =
|
|
3556
|
+
const moved = _chunk7AUQ2UJ3cjs.applyMatrix.call(void 0, o, c);
|
|
3555
3557
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3556
3558
|
}
|
|
3557
3559
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3636,7 +3638,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3636
3638
|
const notes = [];
|
|
3637
3639
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3638
3640
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3639
|
-
const artwork =
|
|
3641
|
+
const artwork = _chunk7AUQ2UJ3cjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3640
3642
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3641
3643
|
const byStep = /* @__PURE__ */ new Map();
|
|
3642
3644
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3883,9 +3885,9 @@ function toLottie(scene, options = {}) {
|
|
|
3883
3885
|
const items = [];
|
|
3884
3886
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3885
3887
|
const geometryAt = (t) => {
|
|
3886
|
-
if (!shapeSegments.length) return
|
|
3888
|
+
if (!shapeSegments.length) return _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, path);
|
|
3887
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]);
|
|
3888
|
-
return now && now.type === "path" ?
|
|
3890
|
+
return now && now.type === "path" ? _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, _chunk7AUQ2UJ3cjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, path);
|
|
3889
3891
|
};
|
|
3890
3892
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3891
3893
|
rest.forEach((contour, n2) => {
|
|
@@ -3958,13 +3960,13 @@ function toLottie(scene, options = {}) {
|
|
|
3958
3960
|
const innerTr = STATIC_TR();
|
|
3959
3961
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3960
3962
|
else if (node.type === "text" || node.type === "instance") {
|
|
3961
|
-
const drawn =
|
|
3963
|
+
const drawn = _chunk7AUQ2UJ3cjs.expandVectorAppearance.call(void 0, node);
|
|
3962
3964
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3963
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3965
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunk7AUQ2UJ3cjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3964
3966
|
} else {
|
|
3965
3967
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3966
|
-
const m =
|
|
3967
|
-
if (m !==
|
|
3968
|
+
const m = _chunk7AUQ2UJ3cjs.nodeMatrix.call(void 0, node);
|
|
3969
|
+
if (m !== _chunk7AUQ2UJ3cjs.IDENTITY_MATRIX) {
|
|
3968
3970
|
const parts = staticParts(m);
|
|
3969
3971
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3970
3972
|
else {
|
|
@@ -3977,7 +3979,7 @@ function toLottie(scene, options = {}) {
|
|
|
3977
3979
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3978
3980
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3979
3981
|
};
|
|
3980
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3982
|
+
const artwork = { ...scene.artwork, nodes: _chunk7AUQ2UJ3cjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3981
3983
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3982
3984
|
if (artwork.background && rgba(artwork.background))
|
|
3983
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()] });
|
|
@@ -4076,11 +4078,11 @@ function preset(prst, w, h) {
|
|
|
4076
4078
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4077
4079
|
switch (prst) {
|
|
4078
4080
|
case "rect":
|
|
4079
|
-
return [
|
|
4081
|
+
return [_chunk7AUQ2UJ3cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4080
4082
|
case "roundRect":
|
|
4081
|
-
return [
|
|
4083
|
+
return [_chunk7AUQ2UJ3cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4082
4084
|
case "ellipse":
|
|
4083
|
-
return [
|
|
4085
|
+
return [_chunk7AUQ2UJ3cjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4084
4086
|
case "triangle":
|
|
4085
4087
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4086
4088
|
case "rtTriangle":
|
|
@@ -4188,7 +4190,7 @@ function shapes(ctx, tree, map) {
|
|
|
4188
4190
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4189
4191
|
if (!subpaths) {
|
|
4190
4192
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4191
|
-
subpaths = [
|
|
4193
|
+
subpaths = [_chunk7AUQ2UJ3cjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4192
4194
|
}
|
|
4193
4195
|
const style = kid(el, "style");
|
|
4194
4196
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4577,7 +4579,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4577
4579
|
walk(scene.artwork.nodes);
|
|
4578
4580
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4579
4581
|
}
|
|
4580
|
-
var motionArtworkSvg = (artwork) =>
|
|
4582
|
+
var motionArtworkSvg = (artwork) => _chunk7AUQ2UJ3cjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4581
4583
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4582
4584
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4583
4585
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -4921,7 +4923,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4921
4923
|
const entry = indexMotionNodes(this.scene.artwork.nodes).get(options.path.node);
|
|
4922
4924
|
if (!entry) throw new Error(`There is no node "${options.path.node}"; find_animation_elements lists the artwork's nodes.`);
|
|
4923
4925
|
if (entry.node.type !== "path") throw new Error(`Node "${options.path.node}" is a ${entry.node.type}, not a path; pass a path node (find_animation_elements shows each node's type).`);
|
|
4924
|
-
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0,
|
|
4926
|
+
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, _chunk7AUQ2UJ3cjs.vectorPathWorldBezier.call(void 0, entry.node, entry.parentWorld, { effects: false }));
|
|
4925
4927
|
place ??= "viewBox";
|
|
4926
4928
|
} else {
|
|
4927
4929
|
const provider = this.effects.require();
|
|
@@ -6182,7 +6184,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6182
6184
|
handler: ({ svg }) => {
|
|
6183
6185
|
let artwork;
|
|
6184
6186
|
try {
|
|
6185
|
-
artwork =
|
|
6187
|
+
artwork = _chunk7AUQ2UJ3cjs.parseVectorSvg.call(void 0, svg);
|
|
6186
6188
|
} catch (error) {
|
|
6187
6189
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6188
6190
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-QAR2N7HZ.js";
|
|
4
4
|
import {
|
|
5
5
|
MOTION_ISSUE_CODES,
|
|
6
6
|
motionIssue,
|
|
@@ -39,8 +39,8 @@ import {
|
|
|
39
39
|
vectorNodeBounds,
|
|
40
40
|
vectorPathWorldBezier,
|
|
41
41
|
vectorTextHasOutlines
|
|
42
|
-
} from "../chunk-
|
|
43
|
-
import "../chunk-
|
|
42
|
+
} from "../chunk-6NZL24W4.js";
|
|
43
|
+
import "../chunk-5IW65VQ6.js";
|
|
44
44
|
import "../chunk-APX63ILU.js";
|
|
45
45
|
import "../chunk-M6DNZNVY.js";
|
|
46
46
|
import {
|
|
@@ -51,6 +51,8 @@ import {
|
|
|
51
51
|
transformBezierPath
|
|
52
52
|
} from "../chunk-WEIK3UYB.js";
|
|
53
53
|
import "../chunk-PWBZH3FK.js";
|
|
54
|
+
import "../chunk-FJBQTZS4.js";
|
|
55
|
+
import "../chunk-3CI7FRMK.js";
|
|
54
56
|
import "../chunk-SZTI6EER.js";
|
|
55
57
|
import {
|
|
56
58
|
EffectRendererPool
|