@pixerate/editor 0.242.0 → 0.243.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/{brushstrokeRender-MOYGEXOC.js → brushstrokeRender-274HGNZR.js} +3 -3
- package/dist/{brushstrokeRender-UKADOV5D.cjs → brushstrokeRender-C7RJZPMC.cjs} +5 -5
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-KCMV2534.cjs → chunk-3WOZEBXZ.cjs} +2 -2
- package/dist/{chunk-ZDPLZDTT.js → chunk-4ZHXLFXS.js} +1 -1
- package/dist/{chunk-5BR7LC24.cjs → chunk-5FZS7J7C.cjs} +50 -4
- package/dist/{chunk-ILM6GYAX.js → chunk-6L3WWIDW.js} +1 -1
- package/dist/{chunk-UDBDYZET.js → chunk-H4Z72Z4Z.js} +1 -1
- package/dist/{chunk-XBZK47LV.js → chunk-HQZHOPNE.js} +49 -3
- package/dist/{chunk-QP2B3MID.js → chunk-IXI5KATU.js} +1 -1
- package/dist/{chunk-HGGJ36HR.cjs → chunk-KK2FWMA2.cjs} +1 -1
- package/dist/{chunk-AFLMXITL.cjs → chunk-OONFIFEU.cjs} +23 -23
- package/dist/{chunk-HW72ABGR.cjs → chunk-R2FVAKFH.cjs} +86 -86
- package/dist/{chunk-NE6OOKWJ.js → chunk-SRXWDOUI.js} +1 -1
- package/dist/{chunk-7F4G74UQ.cjs → chunk-UV7OOZJQ.cjs} +35 -35
- package/dist/image-editor/index.cjs +775 -775
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/brushes.d.cts +18 -2
- package/dist/paint-editor/brushes.d.ts +18 -2
- package/dist/paint-editor/controller.d.cts +28 -0
- package/dist/paint-editor/controller.d.ts +28 -0
- package/dist/paint-editor/document.d.cts +3 -0
- package/dist/paint-editor/document.d.ts +3 -0
- package/dist/paint-editor/index.cjs +1011 -493
- package/dist/paint-editor/index.js +560 -42
- package/dist/paint-editor/light.d.cts +74 -0
- package/dist/paint-editor/light.d.ts +74 -0
- package/dist/paint-editor/stroke.d.cts +14 -0
- package/dist/paint-editor/stroke.d.ts +14 -0
- package/dist/paint-editor/thick-tools.d.cts +2 -2
- package/dist/paint-editor/thick-tools.d.ts +2 -2
- package/dist/paint-editor/thick.d.cts +5 -1
- package/dist/paint-editor/thick.d.ts +5 -1
- package/dist/paint-editor/ui.d.cts +2 -0
- package/dist/paint-editor/ui.d.ts +2 -0
- package/dist/vector/index.cjs +962 -962
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +9 -9
- package/skills/pixerate-paint-editor/references/canvas-hosted.md +8 -0
- package/skills/pixerate-paint-editor/references/light-paint.md +31 -0
- package/skills/pixerate-paint-oil-impasto/SKILL.md +1 -0
|
@@ -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 _chunkUV7OOZJQcjs = require('../chunk-UV7OOZJQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -39,8 +39,8 @@ var _chunkK5DS2JTAcjs = require('../chunk-K5DS2JTA.cjs');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
require('../chunk-
|
|
42
|
+
var _chunk3WOZEBXZcjs = require('../chunk-3WOZEBXZ.cjs');
|
|
43
|
+
require('../chunk-5FZS7J7C.cjs');
|
|
44
44
|
require('../chunk-CVFAAZXE.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
@@ -698,7 +698,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
698
698
|
function motionTextLayout(nodes, id) {
|
|
699
699
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
700
700
|
if (!group || group.type !== "group") return null;
|
|
701
|
-
const letters =
|
|
701
|
+
const letters = _chunk3WOZEBXZcjs.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);
|
|
702
702
|
if (!letters.length) return null;
|
|
703
703
|
const lines = [];
|
|
704
704
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -783,21 +783,21 @@ function indexMotionNodes(nodes) {
|
|
|
783
783
|
const out = /* @__PURE__ */ new Map();
|
|
784
784
|
const walk = (list, parentWorld, ancestors) => {
|
|
785
785
|
for (const node of list) {
|
|
786
|
-
const local =
|
|
787
|
-
const bounds =
|
|
786
|
+
const local = _chunk3WOZEBXZcjs.vectorNodeBounds.call(void 0, node);
|
|
787
|
+
const bounds = _chunk3WOZEBXZcjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
788
788
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
789
789
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
790
|
-
if (node.type === "group") walk(node.children,
|
|
790
|
+
if (node.type === "group") walk(node.children, _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
791
791
|
}
|
|
792
792
|
};
|
|
793
|
-
walk(nodes,
|
|
793
|
+
walk(nodes, _chunk3WOZEBXZcjs.IDENTITY_MATRIX, []);
|
|
794
794
|
indexCache.set(nodes, out);
|
|
795
795
|
return out;
|
|
796
796
|
}
|
|
797
797
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
798
798
|
function firstPaint(node, key) {
|
|
799
799
|
if (node.type === "path") return solid(node[key]);
|
|
800
|
-
for (const p of
|
|
800
|
+
for (const p of _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node)) {
|
|
801
801
|
const s = solid(p[key]);
|
|
802
802
|
if (s) return s;
|
|
803
803
|
}
|
|
@@ -805,7 +805,7 @@ function firstPaint(node, key) {
|
|
|
805
805
|
}
|
|
806
806
|
function strokeReach(node) {
|
|
807
807
|
let reach = 0;
|
|
808
|
-
for (const p of node.type === "path" ? [node] :
|
|
808
|
+
for (const p of node.type === "path" ? [node] : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node)) {
|
|
809
809
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
810
810
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
811
811
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -875,7 +875,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
875
875
|
case "stroke":
|
|
876
876
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
877
877
|
case "strokeWidth": {
|
|
878
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
878
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
879
879
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
880
880
|
}
|
|
881
881
|
case "shape":
|
|
@@ -986,12 +986,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
986
986
|
const r = camera;
|
|
987
987
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
988
988
|
}
|
|
989
|
-
function motionPathLength(node, parentWorld =
|
|
989
|
+
function motionPathLength(node, parentWorld = _chunk3WOZEBXZcjs.IDENTITY_MATRIX) {
|
|
990
990
|
let longest = 0;
|
|
991
|
-
const paths = node.type === "path" ? [node] :
|
|
991
|
+
const paths = node.type === "path" ? [node] : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node);
|
|
992
992
|
for (const p of paths) {
|
|
993
993
|
try {
|
|
994
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
994
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
995
995
|
} catch (e2) {
|
|
996
996
|
}
|
|
997
997
|
}
|
|
@@ -1267,12 +1267,12 @@ function compileMotionScene(scene) {
|
|
|
1267
1267
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1268
1268
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1269
1269
|
if (order2 === "together" && pace === "time") return null;
|
|
1270
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1270
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, entry.node);
|
|
1271
1271
|
let list = paths.map((p) => {
|
|
1272
1272
|
const at = nodes.get(p.id);
|
|
1273
1273
|
let first = { x: 0, y: 0 };
|
|
1274
1274
|
try {
|
|
1275
|
-
const m =
|
|
1275
|
+
const m = _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _42 => _42.parentWorld]), () => ( _chunk3WOZEBXZcjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1276
1276
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1277
1277
|
} catch (e3) {
|
|
1278
1278
|
}
|
|
@@ -1384,17 +1384,17 @@ function compileMotionScene(scene) {
|
|
|
1384
1384
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _45 => _45.by, 'optionalAccess', _46 => _46.x]), () => ( 0));
|
|
1385
1385
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _47 => _47.by, 'optionalAccess', _48 => _48.y]), () => ( 0));
|
|
1386
1386
|
if (command3.to) {
|
|
1387
|
-
const inv =
|
|
1388
|
-
const target =
|
|
1387
|
+
const inv = _chunk3WOZEBXZcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1388
|
+
const target = _chunk3WOZEBXZcjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1389
1389
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1390
1390
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1391
1391
|
}
|
|
1392
1392
|
if (_optionalChain([command3, 'access', _49 => _49.via, 'optionalAccess', _50 => _50.length])) {
|
|
1393
|
-
const inv =
|
|
1393
|
+
const inv = _chunk3WOZEBXZcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1394
1394
|
const x0 = num2("x");
|
|
1395
1395
|
const y0 = num2("y");
|
|
1396
1396
|
const add = command3.blend === "add";
|
|
1397
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1397
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunk3WOZEBXZcjs.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 }];
|
|
1398
1398
|
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")));
|
|
1399
1399
|
for (const axis of ["x", "y"]) {
|
|
1400
1400
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -2017,13 +2017,13 @@ function morphBetween(a, b) {
|
|
|
2017
2017
|
let inner = morphCache.get(a);
|
|
2018
2018
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
2019
2019
|
let morph = inner.get(b);
|
|
2020
|
-
if (!morph) inner.set(b, morph =
|
|
2020
|
+
if (!morph) inner.set(b, morph = _chunkUV7OOZJQcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
2021
2021
|
return morph;
|
|
2022
2022
|
}
|
|
2023
2023
|
function shapeIn(entry, shape) {
|
|
2024
2024
|
if (shape === entry) return entry.node;
|
|
2025
|
-
const m =
|
|
2026
|
-
return { ...shape.node, ...
|
|
2025
|
+
const m = _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunk3WOZEBXZcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2026
|
+
return { ...shape.node, ..._chunk3WOZEBXZcjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
2027
2027
|
}
|
|
2028
2028
|
function shapeAt(entry, timeline, nodes, time) {
|
|
2029
2029
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -2043,7 +2043,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
2043
2043
|
function motionFollowRoute(entry, path) {
|
|
2044
2044
|
if (!path || path.node.type !== "path") return null;
|
|
2045
2045
|
try {
|
|
2046
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2046
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunk3WOZEBXZcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
2047
2047
|
} catch (e6) {
|
|
2048
2048
|
return null;
|
|
2049
2049
|
}
|
|
@@ -2077,9 +2077,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
2077
2077
|
const scaleX = read("scaleX", 1);
|
|
2078
2078
|
const scaleY = read("scaleY", 1);
|
|
2079
2079
|
const c = entry.center;
|
|
2080
|
-
let matrix =
|
|
2080
|
+
let matrix = _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunk3WOZEBXZcjs.rotateMatrix.call(void 0, rotation, c)), _chunk3WOZEBXZcjs.translateMatrix.call(void 0, dx, dy));
|
|
2081
2081
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
2082
|
-
if (along) matrix =
|
|
2082
|
+
if (along) matrix = _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, matrix, _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.translateMatrix.call(void 0, -c.x, -c.y), _chunk3WOZEBXZcjs.rotateMatrix.call(void 0, along.angle)), _chunk3WOZEBXZcjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
2083
2083
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
2084
2084
|
}
|
|
2085
2085
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -2146,7 +2146,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2146
2146
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
2147
2147
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
2148
2148
|
if (start > 0 || end < 1) {
|
|
2149
|
-
const trim =
|
|
2149
|
+
const trim = _chunk3WOZEBXZcjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
2150
2150
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
@@ -2160,8 +2160,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
2160
2160
|
if (o >= 1) delete out.opacity;
|
|
2161
2161
|
}
|
|
2162
2162
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
2163
|
-
if (offset && !
|
|
2164
|
-
const m =
|
|
2163
|
+
if (offset && !_chunk3WOZEBXZcjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
2164
|
+
const m = _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _chunk3WOZEBXZcjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
2165
2165
|
out = { ...out, transform: m };
|
|
2166
2166
|
}
|
|
2167
2167
|
return out;
|
|
@@ -2182,8 +2182,8 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
2182
2182
|
const wrap = { ...options.wrap };
|
|
2183
2183
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
2184
2184
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
2185
|
-
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(
|
|
2186
|
-
const art =
|
|
2185
|
+
if (!motionSceneHasLayers(scene)) return withCameraViewEffects(withViewBox(_chunk3WOZEBXZcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera), frame.view, frame.camera, prefix);
|
|
2186
|
+
const art = _chunk3WOZEBXZcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap, background: false });
|
|
2187
2187
|
let svg = withViewBox(withMotionShotLayers(art, scene, time, frame.camera, options.layers, options.background !== false), frame.camera);
|
|
2188
2188
|
const transition = options.transitions === false ? null : motionTransitionAt(scene, time);
|
|
2189
2189
|
if (transition) {
|
|
@@ -2374,8 +2374,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
2374
2374
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
2375
2375
|
const circle = clip("clipCircle");
|
|
2376
2376
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
2377
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
2378
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
2377
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
2378
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node).length === 0 || _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
2379
2379
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
2380
2380
|
return typeof v !== "number" || v > 0.01;
|
|
2381
2381
|
}));
|
|
@@ -2462,7 +2462,7 @@ function checkMotionScene(scene) {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
for (const id of targets) {
|
|
2464
2464
|
const node = nodes.get(id).node;
|
|
2465
|
-
const paths = node.type === "path" ? [node] :
|
|
2465
|
+
const paths = node.type === "path" ? [node] : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node);
|
|
2466
2466
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
2467
2467
|
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] }));
|
|
2468
2468
|
}
|
|
@@ -2475,7 +2475,7 @@ function checkMotionScene(scene) {
|
|
|
2475
2475
|
else
|
|
2476
2476
|
for (const id of targets) {
|
|
2477
2477
|
const node = nodes.get(id).node;
|
|
2478
|
-
const paths = node.type === "path" ? [node] :
|
|
2478
|
+
const paths = node.type === "path" ? [node] : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node);
|
|
2479
2479
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
2480
2480
|
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] }));
|
|
2481
2481
|
}
|
|
@@ -2920,7 +2920,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2920
2920
|
if (!entry) throw new Error(`There is no element ${_chunkDGWOGQJ5cjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2921
2921
|
const timeline = compileMotionScene(scene);
|
|
2922
2922
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2923
|
-
const centre =
|
|
2923
|
+
const centre = _chunk3WOZEBXZcjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2924
2924
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2925
2925
|
const fill = paint("fill");
|
|
2926
2926
|
const stroke = paint("stroke");
|
|
@@ -3267,7 +3267,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3267
3267
|
raw: (t) => transformAt(t, true)
|
|
3268
3268
|
});
|
|
3269
3269
|
}
|
|
3270
|
-
const paths = node.type === "path" ? [node] :
|
|
3270
|
+
const paths = node.type === "path" ? [node] : _chunk3WOZEBXZcjs.collectPathNodes.call(void 0, node);
|
|
3271
3271
|
for (const path of paths) {
|
|
3272
3272
|
if (pathsSeen.has(path.id)) continue;
|
|
3273
3273
|
pathsSeen.add(path.id);
|
|
@@ -3289,7 +3289,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3289
3289
|
if (shapeSegments.length) {
|
|
3290
3290
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
3291
3291
|
else {
|
|
3292
|
-
const inverse =
|
|
3292
|
+
const inverse = _chunk3WOZEBXZcjs.invertMatrix.call(void 0, _chunk3WOZEBXZcjs.nodeMatrix.call(void 0, node));
|
|
3293
3293
|
channels.push({
|
|
3294
3294
|
id,
|
|
3295
3295
|
kind: "attr",
|
|
@@ -3298,9 +3298,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3298
3298
|
exact: () => false,
|
|
3299
3299
|
value: (t) => {
|
|
3300
3300
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
3301
|
-
const now =
|
|
3301
|
+
const now = _chunk3WOZEBXZcjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _151 => _151(frame.document.nodes), 'access', _152 => _152.get, 'call', _153 => _153(id), 'optionalAccess', _154 => _154.node]));
|
|
3302
3302
|
if (!now || now.type !== "path") return "";
|
|
3303
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
3303
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, now, _chunk3WOZEBXZcjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
3304
3304
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
3305
3305
|
}
|
|
3306
3306
|
});
|
|
@@ -3440,7 +3440,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
3440
3440
|
}
|
|
3441
3441
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
3442
3442
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
3443
|
-
let svg =
|
|
3443
|
+
let svg = _chunk3WOZEBXZcjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunk3WOZEBXZcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
3444
3444
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
3445
3445
|
let motion = { svg, animate };
|
|
3446
3446
|
if (_optionalChain([scene, 'access', _160 => _160.controls, 'optionalAccess', _161 => _161.length])) {
|
|
@@ -3538,14 +3538,14 @@ function easingOf(ease, fallback) {
|
|
|
3538
3538
|
return fallback;
|
|
3539
3539
|
}
|
|
3540
3540
|
function poseOf(value, entry) {
|
|
3541
|
-
const t =
|
|
3542
|
-
const o =
|
|
3541
|
+
const t = _chunk3WOZEBXZcjs.parseSvgTransform.call(void 0, String(value));
|
|
3542
|
+
const o = _chunk3WOZEBXZcjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunk3WOZEBXZcjs.invertMatrix.call(void 0, _chunk3WOZEBXZcjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
3543
3543
|
const sx = Math.hypot(o[0], o[1]);
|
|
3544
3544
|
if (!(sx > 1e-9)) return null;
|
|
3545
3545
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
3546
3546
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
3547
3547
|
const c = entry.center;
|
|
3548
|
-
const moved =
|
|
3548
|
+
const moved = _chunk3WOZEBXZcjs.applyMatrix.call(void 0, o, c);
|
|
3549
3549
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
3550
3550
|
}
|
|
3551
3551
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -3630,7 +3630,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
3630
3630
|
const notes = [];
|
|
3631
3631
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
3632
3632
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
3633
|
-
const artwork =
|
|
3633
|
+
const artwork = _chunk3WOZEBXZcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
3634
3634
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
3635
3635
|
const byStep = /* @__PURE__ */ new Map();
|
|
3636
3636
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3877,9 +3877,9 @@ function toLottie(scene, options = {}) {
|
|
|
3877
3877
|
const items = [];
|
|
3878
3878
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3879
3879
|
const geometryAt = (t) => {
|
|
3880
|
-
if (!shapeSegments.length) return
|
|
3880
|
+
if (!shapeSegments.length) return _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3881
3881
|
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]);
|
|
3882
|
-
return now && now.type === "path" ?
|
|
3882
|
+
return now && now.type === "path" ? _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, _chunk3WOZEBXZcjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3883
3883
|
};
|
|
3884
3884
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round4);
|
|
3885
3885
|
rest.forEach((contour, n2) => {
|
|
@@ -3952,13 +3952,13 @@ function toLottie(scene, options = {}) {
|
|
|
3952
3952
|
const innerTr = STATIC_TR();
|
|
3953
3953
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3954
3954
|
else if (node.type === "text" || node.type === "instance") {
|
|
3955
|
-
const drawn =
|
|
3955
|
+
const drawn = _chunk3WOZEBXZcjs.expandVectorAppearance.call(void 0, node);
|
|
3956
3956
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3957
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3957
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunk3WOZEBXZcjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3958
3958
|
} else {
|
|
3959
3959
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3960
|
-
const m =
|
|
3961
|
-
if (m !==
|
|
3960
|
+
const m = _chunk3WOZEBXZcjs.nodeMatrix.call(void 0, node);
|
|
3961
|
+
if (m !== _chunk3WOZEBXZcjs.IDENTITY_MATRIX) {
|
|
3962
3962
|
const parts = staticParts(m);
|
|
3963
3963
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3964
3964
|
else {
|
|
@@ -3971,7 +3971,7 @@ function toLottie(scene, options = {}) {
|
|
|
3971
3971
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3972
3972
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3973
3973
|
};
|
|
3974
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3974
|
+
const artwork = { ...scene.artwork, nodes: _chunk3WOZEBXZcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3975
3975
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3976
3976
|
if (artwork.background && rgba(artwork.background))
|
|
3977
3977
|
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()] });
|
|
@@ -4070,11 +4070,11 @@ function preset(prst, w, h) {
|
|
|
4070
4070
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
4071
4071
|
switch (prst) {
|
|
4072
4072
|
case "rect":
|
|
4073
|
-
return [
|
|
4073
|
+
return [_chunk3WOZEBXZcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4074
4074
|
case "roundRect":
|
|
4075
|
-
return [
|
|
4075
|
+
return [_chunk3WOZEBXZcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
4076
4076
|
case "ellipse":
|
|
4077
|
-
return [
|
|
4077
|
+
return [_chunk3WOZEBXZcjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4078
4078
|
case "triangle":
|
|
4079
4079
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
4080
4080
|
case "rtTriangle":
|
|
@@ -4182,7 +4182,7 @@ function shapes(ctx, tree, map) {
|
|
|
4182
4182
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
4183
4183
|
if (!subpaths) {
|
|
4184
4184
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
4185
|
-
subpaths = [
|
|
4185
|
+
subpaths = [_chunk3WOZEBXZcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
4186
4186
|
}
|
|
4187
4187
|
const style = kid(el, "style");
|
|
4188
4188
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -4571,7 +4571,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
4571
4571
|
walk(scene.artwork.nodes);
|
|
4572
4572
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
4573
4573
|
}
|
|
4574
|
-
var motionArtworkSvg = (artwork) =>
|
|
4574
|
+
var motionArtworkSvg = (artwork) => _chunk3WOZEBXZcjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
4575
4575
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
4576
4576
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
4577
4577
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -4915,7 +4915,7 @@ var AnimationEditorController = (_class2 = class {
|
|
|
4915
4915
|
const entry = indexMotionNodes(this.scene.artwork.nodes).get(options.path.node);
|
|
4916
4916
|
if (!entry) throw new Error(`There is no node "${options.path.node}"; find_animation_elements lists the artwork's nodes.`);
|
|
4917
4917
|
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).`);
|
|
4918
|
-
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0,
|
|
4918
|
+
value = _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, _chunk3WOZEBXZcjs.vectorPathWorldBezier.call(void 0, entry.node, entry.parentWorld, { effects: false }));
|
|
4919
4919
|
place ??= "viewBox";
|
|
4920
4920
|
} else {
|
|
4921
4921
|
const provider = this.effects.require();
|
|
@@ -6176,7 +6176,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
6176
6176
|
handler: ({ svg }) => {
|
|
6177
6177
|
let artwork;
|
|
6178
6178
|
try {
|
|
6179
|
-
artwork =
|
|
6179
|
+
artwork = _chunk3WOZEBXZcjs.parseVectorSvg.call(void 0, svg);
|
|
6180
6180
|
} catch (error) {
|
|
6181
6181
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
6182
6182
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-4ZHXLFXS.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-6L3WWIDW.js";
|
|
43
|
+
import "../chunk-HQZHOPNE.js";
|
|
44
44
|
import "../chunk-M6DNZNVY.js";
|
|
45
45
|
import {
|
|
46
46
|
bezierPathLength,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pathDataToPolyline
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IXI5KATU.js";
|
|
4
4
|
import {
|
|
5
5
|
parseCssColor
|
|
6
6
|
} from "./chunk-3CI7FRMK.js";
|
|
7
7
|
import {
|
|
8
8
|
BUILTIN_BRUSHES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HQZHOPNE.js";
|
|
10
10
|
import {
|
|
11
11
|
formatNumber,
|
|
12
12
|
getShapeSvg,
|
|
@@ -26,7 +26,7 @@ import "./chunk-F67XMVDI.js";
|
|
|
26
26
|
import "./chunk-6ONMQ6WF.js";
|
|
27
27
|
|
|
28
28
|
// src/canvas/brushstrokeRender.ts
|
|
29
|
-
var DRY = BUILTIN_BRUSHES.filter((b) => isBrushstrokeBrush(b));
|
|
29
|
+
var DRY = BUILTIN_BRUSHES.filter((b) => isBrushstrokeBrush(b) && b.light.amount === 0);
|
|
30
30
|
function listCanvasBrushes() {
|
|
31
31
|
return DRY.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size }));
|
|
32
32
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKK2FWMA2cjs = require('./chunk-KK2FWMA2.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk5FZS7J7Ccjs = require('./chunk-5FZS7J7C.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -26,14 +26,14 @@ require('./chunk-7AHBW2CQ.cjs');
|
|
|
26
26
|
require('./chunk-IPJ3TEYR.cjs');
|
|
27
27
|
|
|
28
28
|
// src/canvas/brushstrokeRender.ts
|
|
29
|
-
var DRY =
|
|
29
|
+
var DRY = _chunk5FZS7J7Ccjs.BUILTIN_BRUSHES.filter((b) => _chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, b) && b.light.amount === 0);
|
|
30
30
|
function listCanvasBrushes() {
|
|
31
31
|
return DRY.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size }));
|
|
32
32
|
}
|
|
33
33
|
function resolveCanvasBrush(brush, width) {
|
|
34
34
|
const given = width !== void 0 && Number.isFinite(width) ? Math.max(1, width) : void 0;
|
|
35
35
|
if (typeof brush === "string") {
|
|
36
|
-
const preset =
|
|
36
|
+
const preset = _chunk5FZS7J7Ccjs.BUILTIN_BRUSHES.find((b) => b.id === brush);
|
|
37
37
|
const ids = DRY.map((b) => b.id).join(", ");
|
|
38
38
|
if (!preset) throw new Error(`Unknown brush '${brush}'. Use one of the dry paint presets (${ids}) or tip settings ({ hardness, spacing, flow, \u2026 }).`);
|
|
39
39
|
if (!_chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, preset)) {
|
|
@@ -75,7 +75,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
|
75
75
|
const textured = typeof seed === "number" && Number.isFinite(seed);
|
|
76
76
|
const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
|
|
77
77
|
const brush = resolveCanvasBrush(shape.brush.brush, size);
|
|
78
|
-
const points =
|
|
78
|
+
const points = _chunkKK2FWMA2cjs.pathDataToPolyline.call(void 0, shape.d);
|
|
79
79
|
if (!points.length) return null;
|
|
80
80
|
const { pressure, tiltX, tiltY } = shape.brush;
|
|
81
81
|
const input = {
|