@pixerate/editor 0.154.0 → 0.156.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 +60 -61
- package/dist/animation-editor/index.js +5 -6
- package/dist/{brushstrokeRender-YAZVQUXY.cjs → brushstrokeRender-5WANQIG4.cjs} +10 -10
- package/dist/{brushstrokeRender-EUDQTDYS.js → brushstrokeRender-Q4LI22QV.js} +3 -3
- package/dist/canvas/index.cjs +23 -24
- package/dist/canvas/index.js +3 -4
- package/dist/chart/index.cjs +2 -3
- package/dist/chart/index.js +1 -2
- package/dist/{chunk-AGZ47XY2.js → chunk-2N2QPO3H.js} +6 -2
- package/dist/{chunk-NMXPOKF3.js → chunk-45XXVHVG.js} +1 -1
- package/dist/{chunk-FLOGD3QB.js → chunk-6UPGM3JB.js} +2 -2
- package/dist/{chunk-6FUAHCVI.cjs → chunk-7NW46N7I.cjs} +16 -16
- package/dist/{chunk-ORDXMBD4.js → chunk-A5UCR2TO.js} +10 -3
- package/dist/{chunk-PI45JMP7.cjs → chunk-CD7PLU77.cjs} +81 -81
- package/dist/{chunk-LRRCMRSL.cjs → chunk-EBDCRTZI.cjs} +20 -16
- package/dist/{chunk-OLCYQLFE.js → chunk-EL5PAHNP.js} +1 -1
- package/dist/{chunk-PUC43JPT.cjs → chunk-EYVVIZJ3.cjs} +1 -1
- package/dist/{chunk-BXMIBMVG.cjs → chunk-JGKCC5OF.cjs} +65 -58
- package/dist/chunk-M4MIZPQI.cjs +393 -0
- package/dist/{chunk-LIXLD433.cjs → chunk-MHEXLG3M.cjs} +35 -35
- package/dist/chunk-NHLYK3AX.js +393 -0
- package/dist/{chunk-RHXW4TA5.cjs → chunk-QMI5HZWA.cjs} +7 -7
- package/dist/{chunk-XFDQEAOS.cjs → chunk-RQCMSEM5.cjs} +2 -2
- package/dist/{chunk-BCY22GBH.js → chunk-SDHZG5TF.js} +1 -1
- package/dist/{chunk-HVX35M2I.cjs → chunk-WI7QJA7A.cjs} +2 -2
- package/dist/{chunk-UILRJQFD.js → chunk-WNAAWLZ5.js} +1 -1
- package/dist/{chunk-4J4MC3F5.js → chunk-YXOW456B.js} +1 -1
- package/dist/{chunk-Y64YPIFT.js → chunk-ZQWLWDZI.js} +1 -1
- package/dist/diagram/index.cjs +2 -3
- package/dist/diagram/index.js +1 -2
- package/dist/image-editor/controller.d.cts +8 -0
- package/dist/image-editor/controller.d.ts +8 -0
- package/dist/image-editor/editorDocument.d.cts +16 -0
- package/dist/image-editor/editorDocument.d.ts +16 -0
- package/dist/image-editor/index.cjs +787 -737
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +56 -6
- package/dist/index.cjs +4 -5
- package/dist/index.js +2 -3
- package/dist/paint/grain.d.cts +7 -0
- package/dist/paint/grain.d.ts +7 -0
- package/dist/paint/index.cjs +3 -3
- package/dist/paint/index.js +2 -2
- package/dist/paint-editor/controller.d.cts +38 -0
- package/dist/paint-editor/controller.d.ts +38 -0
- package/dist/paint-editor/document.d.cts +8 -0
- package/dist/paint-editor/document.d.ts +8 -0
- package/dist/paint-editor/editorDocument.d.cts +17 -0
- package/dist/paint-editor/editorDocument.d.ts +17 -0
- package/dist/paint-editor/index.cjs +476 -273
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +216 -13
- package/dist/paint-editor/paper.d.cts +8 -0
- package/dist/paint-editor/paper.d.ts +8 -0
- package/dist/paint-editor/stencils.d.cts +2 -0
- package/dist/paint-editor/stencils.d.ts +2 -0
- package/dist/paint-editor/wet.d.cts +1 -0
- package/dist/paint-editor/wet.d.ts +1 -0
- package/dist/parameters/index.cjs +2 -3
- package/dist/parameters/index.js +1 -2
- package/dist/persistence/assets.d.cts +51 -0
- package/dist/persistence/assets.d.ts +51 -0
- package/dist/persistence/editorDocument.d.cts +12 -0
- package/dist/persistence/editorDocument.d.ts +12 -0
- package/dist/persistence/index.cjs +32 -8
- package/dist/persistence/index.d.cts +1 -0
- package/dist/persistence/index.d.ts +1 -0
- package/dist/persistence/index.js +34 -10
- package/dist/spreadsheet/index.cjs +3 -4
- package/dist/spreadsheet/index.js +2 -3
- package/dist/tokens/index.cjs +3 -4
- package/dist/tokens/index.js +2 -3
- package/dist/vector/index.cjs +952 -953
- package/dist/vector/index.js +5 -6
- package/dist/video-editor/index.cjs +2 -3
- package/dist/video-editor/index.js +1 -2
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +16 -24
- package/skills/pixerate-image-editor/references/smart-objects.md +28 -0
- package/skills/pixerate-paint-editor/SKILL.md +26 -6
- package/dist/chunk-5H2C3QSF.cjs +0 -134
- package/dist/chunk-GNV54DLO.js +0 -134
- package/dist/chunk-L5OWG2NA.cjs +0 -135
- package/dist/chunk-WHKNYFM2.js +0 -135
|
@@ -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;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMHEXLG3Mcjs = require('../chunk-MHEXLG3M.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -31,8 +31,8 @@ var _chunkEBDZWIOPcjs = require('../chunk-EBDZWIOP.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
35
|
-
require('../chunk-
|
|
34
|
+
var _chunkQMI5HZWAcjs = require('../chunk-QMI5HZWA.cjs');
|
|
35
|
+
require('../chunk-JGKCC5OF.cjs');
|
|
36
36
|
require('../chunk-CVFAAZXE.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
@@ -50,7 +50,7 @@ require('../chunk-NM3G4VQT.cjs');
|
|
|
50
50
|
|
|
51
51
|
var _chunkRUZQMYXHcjs = require('../chunk-RUZQMYXH.cjs');
|
|
52
52
|
require('../chunk-WOFXZ3XU.cjs');
|
|
53
|
-
require('../chunk-
|
|
53
|
+
require('../chunk-EBDCRTZI.cjs');
|
|
54
54
|
require('../chunk-YQGCPL5X.cjs');
|
|
55
55
|
require('../chunk-CWM3CUUX.cjs');
|
|
56
56
|
require('../chunk-XFM3OCHU.cjs');
|
|
@@ -61,8 +61,7 @@ var _chunkALNIFK5Gcjs = require('../chunk-ALNIFK5G.cjs');
|
|
|
61
61
|
require('../chunk-UWEQ55MY.cjs');
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
65
|
-
require('../chunk-L5OWG2NA.cjs');
|
|
64
|
+
var _chunkM4MIZPQIcjs = require('../chunk-M4MIZPQI.cjs');
|
|
66
65
|
require('../chunk-2BSBFBOA.cjs');
|
|
67
66
|
|
|
68
67
|
|
|
@@ -596,7 +595,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
596
595
|
function motionTextLayout(nodes, id) {
|
|
597
596
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
598
597
|
if (!group || group.type !== "group") return null;
|
|
599
|
-
const letters =
|
|
598
|
+
const letters = _chunkQMI5HZWAcjs.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);
|
|
600
599
|
if (!letters.length) return null;
|
|
601
600
|
const lines = [];
|
|
602
601
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -681,21 +680,21 @@ function indexMotionNodes(nodes) {
|
|
|
681
680
|
const out = /* @__PURE__ */ new Map();
|
|
682
681
|
const walk = (list, parentWorld, ancestors) => {
|
|
683
682
|
for (const node of list) {
|
|
684
|
-
const local =
|
|
685
|
-
const bounds =
|
|
683
|
+
const local = _chunkQMI5HZWAcjs.vectorNodeBounds.call(void 0, node);
|
|
684
|
+
const bounds = _chunkQMI5HZWAcjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
686
685
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
687
686
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
688
|
-
if (node.type === "group") walk(node.children,
|
|
687
|
+
if (node.type === "group") walk(node.children, _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
689
688
|
}
|
|
690
689
|
};
|
|
691
|
-
walk(nodes,
|
|
690
|
+
walk(nodes, _chunkQMI5HZWAcjs.IDENTITY_MATRIX, []);
|
|
692
691
|
indexCache.set(nodes, out);
|
|
693
692
|
return out;
|
|
694
693
|
}
|
|
695
694
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
696
695
|
function firstPaint(node, key) {
|
|
697
696
|
if (node.type === "path") return solid(node[key]);
|
|
698
|
-
for (const p of
|
|
697
|
+
for (const p of _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node)) {
|
|
699
698
|
const s = solid(p[key]);
|
|
700
699
|
if (s) return s;
|
|
701
700
|
}
|
|
@@ -703,7 +702,7 @@ function firstPaint(node, key) {
|
|
|
703
702
|
}
|
|
704
703
|
function strokeReach(node) {
|
|
705
704
|
let reach = 0;
|
|
706
|
-
for (const p of node.type === "path" ? [node] :
|
|
705
|
+
for (const p of node.type === "path" ? [node] : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node)) {
|
|
707
706
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
708
707
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
709
708
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -773,7 +772,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
773
772
|
case "stroke":
|
|
774
773
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
775
774
|
case "strokeWidth": {
|
|
776
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
775
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
777
776
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
778
777
|
}
|
|
779
778
|
case "shape":
|
|
@@ -884,12 +883,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
884
883
|
const r = camera;
|
|
885
884
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
886
885
|
}
|
|
887
|
-
function motionPathLength(node, parentWorld =
|
|
886
|
+
function motionPathLength(node, parentWorld = _chunkQMI5HZWAcjs.IDENTITY_MATRIX) {
|
|
888
887
|
let longest = 0;
|
|
889
|
-
const paths = node.type === "path" ? [node] :
|
|
888
|
+
const paths = node.type === "path" ? [node] : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node);
|
|
890
889
|
for (const p of paths) {
|
|
891
890
|
try {
|
|
892
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
891
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
893
892
|
} catch (e2) {
|
|
894
893
|
}
|
|
895
894
|
}
|
|
@@ -1142,12 +1141,12 @@ function compileMotionScene(scene) {
|
|
|
1142
1141
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1143
1142
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1144
1143
|
if (order2 === "together" && pace === "time") return null;
|
|
1145
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1144
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, entry.node);
|
|
1146
1145
|
let list = paths.map((p) => {
|
|
1147
1146
|
const at = nodes.get(p.id);
|
|
1148
1147
|
let first = { x: 0, y: 0 };
|
|
1149
1148
|
try {
|
|
1150
|
-
const m =
|
|
1149
|
+
const m = _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _41 => _41.parentWorld]), () => ( _chunkQMI5HZWAcjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1151
1150
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1152
1151
|
} catch (e3) {
|
|
1153
1152
|
}
|
|
@@ -1259,17 +1258,17 @@ function compileMotionScene(scene) {
|
|
|
1259
1258
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _44 => _44.by, 'optionalAccess', _45 => _45.x]), () => ( 0));
|
|
1260
1259
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _46 => _46.by, 'optionalAccess', _47 => _47.y]), () => ( 0));
|
|
1261
1260
|
if (command3.to) {
|
|
1262
|
-
const inv =
|
|
1263
|
-
const target =
|
|
1261
|
+
const inv = _chunkQMI5HZWAcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1262
|
+
const target = _chunkQMI5HZWAcjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1264
1263
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1265
1264
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1266
1265
|
}
|
|
1267
1266
|
if (_optionalChain([command3, 'access', _48 => _48.via, 'optionalAccess', _49 => _49.length])) {
|
|
1268
|
-
const inv =
|
|
1267
|
+
const inv = _chunkQMI5HZWAcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1269
1268
|
const x0 = num2("x");
|
|
1270
1269
|
const y0 = num2("y");
|
|
1271
1270
|
const add = command3.blend === "add";
|
|
1272
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1271
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunkQMI5HZWAcjs.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 }];
|
|
1273
1272
|
const times = _optionalChain([command3, 'access', _50 => _50.times, 'optionalAccess', _51 => _51.length]) === command3.via.length ? [start, ...command3.times.map((f) => start + f * (end - start)), end] : smoothMotionTimes(offsets, start, end - start, _nullishCoalesce(command3.pacing, () => ( "even")));
|
|
1274
1273
|
for (const axis of ["x", "y"]) {
|
|
1275
1274
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -1412,13 +1411,13 @@ function morphBetween(a, b) {
|
|
|
1412
1411
|
let inner = morphCache.get(a);
|
|
1413
1412
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
1414
1413
|
let morph = inner.get(b);
|
|
1415
|
-
if (!morph) inner.set(b, morph =
|
|
1414
|
+
if (!morph) inner.set(b, morph = _chunkMHEXLG3Mcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
1416
1415
|
return morph;
|
|
1417
1416
|
}
|
|
1418
1417
|
function shapeIn(entry, shape) {
|
|
1419
1418
|
if (shape === entry) return entry.node;
|
|
1420
|
-
const m =
|
|
1421
|
-
return { ...shape.node, ...
|
|
1419
|
+
const m = _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunkQMI5HZWAcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
1420
|
+
return { ...shape.node, ..._chunkQMI5HZWAcjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
1422
1421
|
}
|
|
1423
1422
|
function shapeAt(entry, timeline, nodes, time) {
|
|
1424
1423
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -1438,7 +1437,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
1438
1437
|
function motionFollowRoute(entry, path) {
|
|
1439
1438
|
if (!path || path.node.type !== "path") return null;
|
|
1440
1439
|
try {
|
|
1441
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
1440
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunkQMI5HZWAcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
1442
1441
|
} catch (e4) {
|
|
1443
1442
|
return null;
|
|
1444
1443
|
}
|
|
@@ -1472,9 +1471,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
1472
1471
|
const scaleX = read("scaleX", 1);
|
|
1473
1472
|
const scaleY = read("scaleY", 1);
|
|
1474
1473
|
const c = entry.center;
|
|
1475
|
-
let matrix =
|
|
1474
|
+
let matrix = _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunkQMI5HZWAcjs.rotateMatrix.call(void 0, rotation, c)), _chunkQMI5HZWAcjs.translateMatrix.call(void 0, dx, dy));
|
|
1476
1475
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
1477
|
-
if (along) matrix =
|
|
1476
|
+
if (along) matrix = _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, matrix, _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.translateMatrix.call(void 0, -c.x, -c.y), _chunkQMI5HZWAcjs.rotateMatrix.call(void 0, along.angle)), _chunkQMI5HZWAcjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
1478
1477
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
1479
1478
|
}
|
|
1480
1479
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -1541,7 +1540,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
1541
1540
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
1542
1541
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
1543
1542
|
if (start > 0 || end < 1) {
|
|
1544
|
-
const trim =
|
|
1543
|
+
const trim = _chunkQMI5HZWAcjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
1545
1544
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
1546
1545
|
}
|
|
1547
1546
|
}
|
|
@@ -1555,8 +1554,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
1555
1554
|
if (o >= 1) delete out.opacity;
|
|
1556
1555
|
}
|
|
1557
1556
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
1558
|
-
if (offset && !
|
|
1559
|
-
const m =
|
|
1557
|
+
if (offset && !_chunkQMI5HZWAcjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
1558
|
+
const m = _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
1560
1559
|
out = { ...out, transform: m };
|
|
1561
1560
|
}
|
|
1562
1561
|
return out;
|
|
@@ -1576,7 +1575,7 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
1576
1575
|
const wrap = { ...options.wrap };
|
|
1577
1576
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
1578
1577
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
1579
|
-
return withViewBox(
|
|
1578
|
+
return withViewBox(_chunkQMI5HZWAcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera);
|
|
1580
1579
|
}
|
|
1581
1580
|
function withViewBox(svg, box) {
|
|
1582
1581
|
const f = (n) => String(Math.round(n * 1e3) / 1e3);
|
|
@@ -1759,8 +1758,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
1759
1758
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
1760
1759
|
const circle = clip("clipCircle");
|
|
1761
1760
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
1762
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
1763
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
1761
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
1762
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node).length === 0 || _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
1764
1763
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
1765
1764
|
return typeof v !== "number" || v > 0.01;
|
|
1766
1765
|
}));
|
|
@@ -1846,7 +1845,7 @@ function checkMotionScene(scene) {
|
|
|
1846
1845
|
}
|
|
1847
1846
|
for (const id of targets) {
|
|
1848
1847
|
const node = nodes.get(id).node;
|
|
1849
|
-
const paths = node.type === "path" ? [node] :
|
|
1848
|
+
const paths = node.type === "path" ? [node] : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node);
|
|
1850
1849
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
1851
1850
|
issues.push(_chunkEBDZWIOPcjs.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] }));
|
|
1852
1851
|
}
|
|
@@ -1859,7 +1858,7 @@ function checkMotionScene(scene) {
|
|
|
1859
1858
|
else
|
|
1860
1859
|
for (const id of targets) {
|
|
1861
1860
|
const node = nodes.get(id).node;
|
|
1862
|
-
const paths = node.type === "path" ? [node] :
|
|
1861
|
+
const paths = node.type === "path" ? [node] : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node);
|
|
1863
1862
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
1864
1863
|
issues.push(_chunkEBDZWIOPcjs.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] }));
|
|
1865
1864
|
}
|
|
@@ -2304,7 +2303,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2304
2303
|
if (!entry) throw new Error(`There is no element ${_chunkEBDZWIOPcjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2305
2304
|
const timeline = compileMotionScene(scene);
|
|
2306
2305
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2307
|
-
const centre =
|
|
2306
|
+
const centre = _chunkQMI5HZWAcjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2308
2307
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2309
2308
|
const fill = paint("fill");
|
|
2310
2309
|
const stroke = paint("stroke");
|
|
@@ -2651,7 +2650,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2651
2650
|
raw: (t) => transformAt(t, true)
|
|
2652
2651
|
});
|
|
2653
2652
|
}
|
|
2654
|
-
const paths = node.type === "path" ? [node] :
|
|
2653
|
+
const paths = node.type === "path" ? [node] : _chunkQMI5HZWAcjs.collectPathNodes.call(void 0, node);
|
|
2655
2654
|
for (const path of paths) {
|
|
2656
2655
|
if (pathsSeen.has(path.id)) continue;
|
|
2657
2656
|
pathsSeen.add(path.id);
|
|
@@ -2673,7 +2672,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2673
2672
|
if (shapeSegments.length) {
|
|
2674
2673
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
2675
2674
|
else {
|
|
2676
|
-
const inverse =
|
|
2675
|
+
const inverse = _chunkQMI5HZWAcjs.invertMatrix.call(void 0, _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, node));
|
|
2677
2676
|
channels.push({
|
|
2678
2677
|
id,
|
|
2679
2678
|
kind: "attr",
|
|
@@ -2682,9 +2681,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2682
2681
|
exact: () => false,
|
|
2683
2682
|
value: (t) => {
|
|
2684
2683
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
2685
|
-
const now =
|
|
2684
|
+
const now = _chunkQMI5HZWAcjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _114 => _114(frame.document.nodes), 'access', _115 => _115.get, 'call', _116 => _116(id), 'optionalAccess', _117 => _117.node]));
|
|
2686
2685
|
if (!now || now.type !== "path") return "";
|
|
2687
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2686
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, now, _chunkQMI5HZWAcjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
2688
2687
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
2689
2688
|
}
|
|
2690
2689
|
});
|
|
@@ -2791,7 +2790,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2791
2790
|
}
|
|
2792
2791
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
2793
2792
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
2794
|
-
let svg =
|
|
2793
|
+
let svg = _chunkQMI5HZWAcjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunkQMI5HZWAcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
2795
2794
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
2796
2795
|
let motion = { svg, animate };
|
|
2797
2796
|
if (_optionalChain([scene, 'access', _120 => _120.controls, 'optionalAccess', _121 => _121.length])) {
|
|
@@ -2875,14 +2874,14 @@ function easingOf(ease, fallback) {
|
|
|
2875
2874
|
return fallback;
|
|
2876
2875
|
}
|
|
2877
2876
|
function poseOf(value, entry) {
|
|
2878
|
-
const t =
|
|
2879
|
-
const o =
|
|
2877
|
+
const t = _chunkQMI5HZWAcjs.parseSvgTransform.call(void 0, String(value));
|
|
2878
|
+
const o = _chunkQMI5HZWAcjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunkQMI5HZWAcjs.invertMatrix.call(void 0, _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
2880
2879
|
const sx = Math.hypot(o[0], o[1]);
|
|
2881
2880
|
if (!(sx > 1e-9)) return null;
|
|
2882
2881
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
2883
2882
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
2884
2883
|
const c = entry.center;
|
|
2885
|
-
const moved =
|
|
2884
|
+
const moved = _chunkQMI5HZWAcjs.applyMatrix.call(void 0, o, c);
|
|
2886
2885
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
2887
2886
|
}
|
|
2888
2887
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -2967,7 +2966,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
2967
2966
|
const notes = [];
|
|
2968
2967
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
2969
2968
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
2970
|
-
const artwork =
|
|
2969
|
+
const artwork = _chunkQMI5HZWAcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
2971
2970
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
2972
2971
|
const byStep = /* @__PURE__ */ new Map();
|
|
2973
2972
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3214,9 +3213,9 @@ function toLottie(scene, options = {}) {
|
|
|
3214
3213
|
const items = [];
|
|
3215
3214
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3216
3215
|
const geometryAt = (t) => {
|
|
3217
|
-
if (!shapeSegments.length) return
|
|
3216
|
+
if (!shapeSegments.length) return _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3218
3217
|
const now = _optionalChain([indexMotionNodes, 'call', _130 => _130(motionFrameAt(scene, t, { draw: false, offsets: false }).document.nodes), 'access', _131 => _131.get, 'call', _132 => _132(path.id), 'optionalAccess', _133 => _133.node]);
|
|
3219
|
-
return now && now.type === "path" ?
|
|
3218
|
+
return now && now.type === "path" ? _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, _chunkQMI5HZWAcjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunkQMI5HZWAcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3220
3219
|
};
|
|
3221
3220
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round3);
|
|
3222
3221
|
rest.forEach((contour, n) => {
|
|
@@ -3289,13 +3288,13 @@ function toLottie(scene, options = {}) {
|
|
|
3289
3288
|
const innerTr = STATIC_TR();
|
|
3290
3289
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3291
3290
|
else if (node.type === "text" || node.type === "instance") {
|
|
3292
|
-
const drawn =
|
|
3291
|
+
const drawn = _chunkQMI5HZWAcjs.expandVectorAppearance.call(void 0, node);
|
|
3293
3292
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3294
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3293
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunkQMI5HZWAcjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3295
3294
|
} else {
|
|
3296
3295
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3297
|
-
const m =
|
|
3298
|
-
if (m !==
|
|
3296
|
+
const m = _chunkQMI5HZWAcjs.nodeMatrix.call(void 0, node);
|
|
3297
|
+
if (m !== _chunkQMI5HZWAcjs.IDENTITY_MATRIX) {
|
|
3299
3298
|
const parts = staticParts(m);
|
|
3300
3299
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3301
3300
|
else {
|
|
@@ -3308,7 +3307,7 @@ function toLottie(scene, options = {}) {
|
|
|
3308
3307
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3309
3308
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3310
3309
|
};
|
|
3311
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3310
|
+
const artwork = { ...scene.artwork, nodes: _chunkQMI5HZWAcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3312
3311
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3313
3312
|
if (artwork.background && rgba(artwork.background))
|
|
3314
3313
|
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(round3) }, o: { a: 0, k: 100 }, r: 1 }, STATIC_TR()] });
|
|
@@ -3407,11 +3406,11 @@ function preset(prst, w, h) {
|
|
|
3407
3406
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
3408
3407
|
switch (prst) {
|
|
3409
3408
|
case "rect":
|
|
3410
|
-
return [
|
|
3409
|
+
return [_chunkQMI5HZWAcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
3411
3410
|
case "roundRect":
|
|
3412
|
-
return [
|
|
3411
|
+
return [_chunkQMI5HZWAcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
3413
3412
|
case "ellipse":
|
|
3414
|
-
return [
|
|
3413
|
+
return [_chunkQMI5HZWAcjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
3415
3414
|
case "triangle":
|
|
3416
3415
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
3417
3416
|
case "rtTriangle":
|
|
@@ -3519,7 +3518,7 @@ function shapes(ctx, tree, map) {
|
|
|
3519
3518
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
3520
3519
|
if (!subpaths) {
|
|
3521
3520
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
3522
|
-
subpaths = [
|
|
3521
|
+
subpaths = [_chunkQMI5HZWAcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
3523
3522
|
}
|
|
3524
3523
|
const style = kid(el, "style");
|
|
3525
3524
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -3757,7 +3756,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
3757
3756
|
walk(scene.artwork.nodes);
|
|
3758
3757
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
3759
3758
|
}
|
|
3760
|
-
var motionArtworkSvg = (artwork) =>
|
|
3759
|
+
var motionArtworkSvg = (artwork) => _chunkQMI5HZWAcjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
3761
3760
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
3762
3761
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
3763
3762
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -5084,7 +5083,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
5084
5083
|
handler: ({ svg }) => {
|
|
5085
5084
|
let artwork;
|
|
5086
5085
|
try {
|
|
5087
|
-
artwork =
|
|
5086
|
+
artwork = _chunkQMI5HZWAcjs.parseVectorSvg.call(void 0, svg);
|
|
5088
5087
|
} catch (error) {
|
|
5089
5088
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
5090
5089
|
}
|
|
@@ -5938,7 +5937,7 @@ function createAnimationEffectsToolProvider(controller, options = {}) {
|
|
|
5938
5937
|
|
|
5939
5938
|
// src/animation-editor/editorDocument.ts
|
|
5940
5939
|
function createAnimationEditorDocument(controller) {
|
|
5941
|
-
return
|
|
5940
|
+
return _chunkM4MIZPQIcjs.defineEditorDocument.call(void 0, {
|
|
5942
5941
|
kind: "animation",
|
|
5943
5942
|
get: () => controller.getScene(),
|
|
5944
5943
|
load: (document, { history }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WNAAWLZ5.js";
|
|
4
4
|
import {
|
|
5
5
|
MOTION_ISSUE_CODES,
|
|
6
6
|
motionIssue,
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
vectorNodeBounds,
|
|
32
32
|
vectorPathWorldBezier,
|
|
33
33
|
vectorTextHasOutlines
|
|
34
|
-
} from "../chunk-
|
|
35
|
-
import "../chunk-
|
|
34
|
+
} from "../chunk-6UPGM3JB.js";
|
|
35
|
+
import "../chunk-A5UCR2TO.js";
|
|
36
36
|
import "../chunk-M6DNZNVY.js";
|
|
37
37
|
import {
|
|
38
38
|
bezierPathLength,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
resolveEffectValues
|
|
51
51
|
} from "../chunk-7KWJEYIK.js";
|
|
52
52
|
import "../chunk-V2ZCJRDM.js";
|
|
53
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-2N2QPO3H.js";
|
|
54
54
|
import "../chunk-ODBT55Q7.js";
|
|
55
55
|
import "../chunk-H367YTXI.js";
|
|
56
56
|
import "../chunk-QGHEDC7B.js";
|
|
@@ -61,8 +61,7 @@ import {
|
|
|
61
61
|
import "../chunk-VDGBHYC7.js";
|
|
62
62
|
import {
|
|
63
63
|
defineEditorDocument
|
|
64
|
-
} from "../chunk-
|
|
65
|
-
import "../chunk-WHKNYFM2.js";
|
|
64
|
+
} from "../chunk-NHLYK3AX.js";
|
|
66
65
|
import "../chunk-HF5QZS7Z.js";
|
|
67
66
|
import {
|
|
68
67
|
HistoryManager
|
|
@@ -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 _chunkEYVVIZJ3cjs = require('./chunk-EYVVIZJ3.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkJGKCC5OFcjs = require('./chunk-JGKCC5OF.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -17,23 +17,23 @@ var _chunkNM3G4VQTcjs = require('./chunk-NM3G4VQT.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkEBDCRTZIcjs = require('./chunk-EBDCRTZI.cjs');
|
|
21
21
|
require('./chunk-YQGCPL5X.cjs');
|
|
22
22
|
require('./chunk-CWM3CUUX.cjs');
|
|
23
23
|
require('./chunk-XFM3OCHU.cjs');
|
|
24
24
|
|
|
25
25
|
// src/canvas/brushstrokeRender.ts
|
|
26
|
-
var DRY =
|
|
26
|
+
var DRY = _chunkJGKCC5OFcjs.BUILTIN_BRUSHES.filter((b) => _chunkEBDCRTZIcjs.isBrushstrokeBrush.call(void 0, b));
|
|
27
27
|
function listCanvasBrushes() {
|
|
28
28
|
return DRY.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size }));
|
|
29
29
|
}
|
|
30
30
|
function resolveCanvasBrush(brush, width) {
|
|
31
31
|
const given = width !== void 0 && Number.isFinite(width) ? Math.max(1, width) : void 0;
|
|
32
32
|
if (typeof brush === "string") {
|
|
33
|
-
const preset =
|
|
33
|
+
const preset = _chunkJGKCC5OFcjs.BUILTIN_BRUSHES.find((b) => b.id === brush);
|
|
34
34
|
const ids = DRY.map((b) => b.id).join(", ");
|
|
35
35
|
if (!preset) throw new Error(`Unknown brush '${brush}'. Use one of the dry paint presets (${ids}) or tip settings ({ hardness, spacing, flow, \u2026 }).`);
|
|
36
|
-
if (!
|
|
36
|
+
if (!_chunkEBDCRTZIcjs.isBrushstrokeBrush.call(void 0, preset)) {
|
|
37
37
|
throw new Error(`Brush '${brush}' (${preset.name}) is not a dry brush: brushed canvas strokes use dry media only (wet paint needs an area to flow in; mixer, blender, smudge and eraser brushes need paint under them). Use one of: ${ids}.`);
|
|
38
38
|
}
|
|
39
39
|
return given === void 0 ? preset : { ...preset, tip: { ...preset.tip, size: given } };
|
|
@@ -44,7 +44,7 @@ function resolveCanvasBrush(brush, width) {
|
|
|
44
44
|
return { size: _nullishCoalesce(given, () => ( 3)), ...brush };
|
|
45
45
|
}
|
|
46
46
|
function resolveCanvasPaint(paint) {
|
|
47
|
-
const source =
|
|
47
|
+
const source = _chunkEBDCRTZIcjs.parsePaintSource.call(void 0, paint, "paint");
|
|
48
48
|
if (source.type === "gradient" && (source.map.by === "velocity" || source.map.by === "time")) {
|
|
49
49
|
throw new Error(`paint.map.by "${source.map.by}" needs timed samples, which canvas strokes do not record; use distance, pressure, tilt, direction, across-tip or random.`);
|
|
50
50
|
}
|
|
@@ -65,14 +65,14 @@ function strokeColor(shape) {
|
|
|
65
65
|
const n = parseInt(parsed.hex.slice(1), 16);
|
|
66
66
|
return [n >> 16 & 255, n >> 8 & 255, n & 255, Math.round(parsed.alpha * 255)];
|
|
67
67
|
}
|
|
68
|
-
var cache = new (0,
|
|
68
|
+
var cache = new (0, _chunkEBDCRTZIcjs.BrushstrokeCache)(128);
|
|
69
69
|
var urls = /* @__PURE__ */ new WeakMap();
|
|
70
70
|
function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
71
71
|
const seed = shape.brush.seed;
|
|
72
72
|
const textured = typeof seed === "number" && Number.isFinite(seed);
|
|
73
73
|
const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
|
|
74
74
|
const brush = resolveCanvasBrush(shape.brush.brush, size);
|
|
75
|
-
const points =
|
|
75
|
+
const points = _chunkEYVVIZJ3cjs.pathDataToPolyline.call(void 0, shape.d);
|
|
76
76
|
if (!points.length) return null;
|
|
77
77
|
const { pressure, tiltX, tiltY } = shape.brush;
|
|
78
78
|
const input = {
|
|
@@ -95,7 +95,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
|
95
95
|
if (!stroke.bounds) return null;
|
|
96
96
|
let href = urls.get(stroke);
|
|
97
97
|
if (href === void 0) {
|
|
98
|
-
href =
|
|
98
|
+
href = _chunkEBDCRTZIcjs.brushstrokeDataUrl.call(void 0, stroke);
|
|
99
99
|
urls.set(stroke, href);
|
|
100
100
|
}
|
|
101
101
|
return { href, ...stroke.bounds, scale: stroke.scale };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pathDataToPolyline
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-45XXVHVG.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-A5UCR2TO.js";
|
|
10
10
|
import {
|
|
11
11
|
formatNumber,
|
|
12
12
|
getShapeSvg,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
brushstrokeDataUrl,
|
|
18
18
|
isBrushstrokeBrush,
|
|
19
19
|
parsePaintSource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2N2QPO3H.js";
|
|
21
21
|
import "./chunk-ODBT55Q7.js";
|
|
22
22
|
import "./chunk-H367YTXI.js";
|
|
23
23
|
import "./chunk-QGHEDC7B.js";
|