@pixerate/editor 0.206.0 → 0.208.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 -59
- package/dist/animation-editor/index.js +6 -5
- package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
- package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
- package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
- package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
- package/dist/chunk-474IQG74.cjs +384 -0
- package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
- package/dist/chunk-DWYQPL2A.js +2010 -0
- package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
- package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
- package/dist/chunk-HVVR5PZW.js +384 -0
- package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
- package/dist/chunk-K6PXS6DO.cjs +102 -0
- package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
- package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
- package/dist/chunk-L3G23N5Y.js +763 -0
- package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
- package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
- package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
- package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
- package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
- package/dist/chunk-QYLWG22N.cjs +763 -0
- package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
- package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
- package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
- package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
- package/dist/chunk-X4LUGTQX.cjs +2010 -0
- package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
- package/dist/chunk-ZIF4UJJ6.js +102 -0
- package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
- package/dist/image-editor/controller.d.cts +28 -3
- package/dist/image-editor/controller.d.ts +28 -3
- package/dist/image-editor/index.cjs +2150 -3380
- package/dist/image-editor/index.js +675 -1905
- package/dist/image-editor/selection/index.d.cts +2 -0
- package/dist/image-editor/selection/index.d.ts +2 -0
- package/dist/image-editor/selection/refine-edits.d.cts +13 -4
- package/dist/image-editor/selection/refine-edits.d.ts +13 -4
- package/dist/image-editor/selection/segment/focus.d.cts +2 -0
- package/dist/image-editor/selection/segment/focus.d.ts +2 -0
- package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
- package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
- package/dist/image-editor/selection/segment/sky.d.cts +2 -0
- package/dist/image-editor/selection/segment/sky.d.ts +2 -0
- package/dist/image-editor/selection/segment/subject.d.cts +2 -1
- package/dist/image-editor/selection/segment/subject.d.ts +2 -1
- package/dist/image-editor/selection/segment/work.d.cts +5 -0
- package/dist/image-editor/selection/segment/work.d.ts +5 -0
- package/dist/image-editor/selection/select-and-mask.d.cts +136 -0
- package/dist/image-editor/selection/select-and-mask.d.ts +136 -0
- package/dist/image-editor/selection/worker.d.cts +126 -0
- package/dist/image-editor/selection/worker.d.ts +126 -0
- package/dist/image-editor/selection-worker.cjs +14 -0
- package/dist/image-editor/selection-worker.d.cts +12 -0
- package/dist/image-editor/selection-worker.d.ts +12 -0
- package/dist/image-editor/selection-worker.js +14 -0
- package/dist/image-editor/types.d.cts +8 -0
- package/dist/image-editor/types.d.ts +8 -0
- package/dist/paint/index.cjs +6 -5
- package/dist/paint/index.js +5 -4
- package/dist/paint-editor/index.cjs +394 -390
- package/dist/paint-editor/index.js +18 -14
- package/dist/raster/index.cjs +22 -18
- package/dist/raster/index.js +29 -25
- package/dist/vector/index.cjs +986 -985
- package/dist/vector/index.js +6 -5
- package/package.json +11 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-image-selection-masking/SKILL.md +4 -2
|
@@ -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 _chunkI7G3RSUJcjs = require('../chunk-I7G3RSUJ.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 _chunkQAUIZPYIcjs = require('../chunk-QAUIZPYI.cjs');
|
|
35
|
+
require('../chunk-ROVK6AXX.cjs');
|
|
36
36
|
require('../chunk-CVFAAZXE.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
@@ -50,9 +50,10 @@ require('../chunk-NM3G4VQT.cjs');
|
|
|
50
50
|
|
|
51
51
|
var _chunkA3A5TI6Rcjs = require('../chunk-A3A5TI6R.cjs');
|
|
52
52
|
require('../chunk-WOFXZ3XU.cjs');
|
|
53
|
-
require('../chunk-
|
|
53
|
+
require('../chunk-PQ3H2AAN.cjs');
|
|
54
54
|
require('../chunk-YQGCPL5X.cjs');
|
|
55
|
-
require('../chunk-
|
|
55
|
+
require('../chunk-OLNIPTB3.cjs');
|
|
56
|
+
require('../chunk-474IQG74.cjs');
|
|
56
57
|
require('../chunk-XFM3OCHU.cjs');
|
|
57
58
|
require('../chunk-NIBFDFYW.cjs');
|
|
58
59
|
|
|
@@ -597,7 +598,7 @@ function smoothMotionTimes(points, start, duration, pacing = "even") {
|
|
|
597
598
|
function motionTextLayout(nodes, id) {
|
|
598
599
|
const group = _optionalChain([nodes, 'access', _5 => _5.get, 'call', _6 => _6(id), 'optionalAccess', _7 => _7.node]);
|
|
599
600
|
if (!group || group.type !== "group") return null;
|
|
600
|
-
const letters =
|
|
601
|
+
const letters = _chunkQAUIZPYIcjs.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);
|
|
601
602
|
if (!letters.length) return null;
|
|
602
603
|
const lines = [];
|
|
603
604
|
for (const l of [...letters].sort((a, c) => a.b.y + a.b.height / 2 - (c.b.y + c.b.height / 2))) {
|
|
@@ -682,21 +683,21 @@ function indexMotionNodes(nodes) {
|
|
|
682
683
|
const out = /* @__PURE__ */ new Map();
|
|
683
684
|
const walk = (list, parentWorld, ancestors) => {
|
|
684
685
|
for (const node of list) {
|
|
685
|
-
const local =
|
|
686
|
-
const bounds =
|
|
686
|
+
const local = _chunkQAUIZPYIcjs.vectorNodeBounds.call(void 0, node);
|
|
687
|
+
const bounds = _chunkQAUIZPYIcjs.vectorNodeBounds.call(void 0, node, parentWorld);
|
|
687
688
|
const center = local ? { x: local.x + local.width / 2, y: local.y + local.height / 2 } : { x: 0, y: 0 };
|
|
688
689
|
if (!out.has(node.id)) out.set(node.id, { node, ancestors, parentWorld, center, bounds, box: local });
|
|
689
|
-
if (node.type === "group") walk(node.children,
|
|
690
|
+
if (node.type === "group") walk(node.children, _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.nodeMatrix.call(void 0, node), parentWorld), [...ancestors, node.id]);
|
|
690
691
|
}
|
|
691
692
|
};
|
|
692
|
-
walk(nodes,
|
|
693
|
+
walk(nodes, _chunkQAUIZPYIcjs.IDENTITY_MATRIX, []);
|
|
693
694
|
indexCache.set(nodes, out);
|
|
694
695
|
return out;
|
|
695
696
|
}
|
|
696
697
|
var solid = (paint) => typeof paint === "string" && paint !== "none" ? paint : void 0;
|
|
697
698
|
function firstPaint(node, key) {
|
|
698
699
|
if (node.type === "path") return solid(node[key]);
|
|
699
|
-
for (const p of
|
|
700
|
+
for (const p of _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node)) {
|
|
700
701
|
const s = solid(p[key]);
|
|
701
702
|
if (s) return s;
|
|
702
703
|
}
|
|
@@ -704,7 +705,7 @@ function firstPaint(node, key) {
|
|
|
704
705
|
}
|
|
705
706
|
function strokeReach(node) {
|
|
706
707
|
let reach = 0;
|
|
707
|
-
for (const p of node.type === "path" ? [node] :
|
|
708
|
+
for (const p of node.type === "path" ? [node] : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node)) {
|
|
708
709
|
if (p.stroke == null || p.stroke === "none") continue;
|
|
709
710
|
const width = _nullishCoalesce(p.strokeWidth, () => ( 1));
|
|
710
711
|
reach = Math.max(reach, p.strokeAlign === "outside" ? width : p.strokeAlign === "inside" ? 0 : width / 2);
|
|
@@ -774,7 +775,7 @@ function motionRestValue(entry, property, artwork) {
|
|
|
774
775
|
case "stroke":
|
|
775
776
|
return _nullishCoalesce((node && firstPaint(node, property)), () => ( "transparent"));
|
|
776
777
|
case "strokeWidth": {
|
|
777
|
-
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ?
|
|
778
|
+
const path = _optionalChain([node, 'optionalAccess', _13 => _13.type]) === "path" ? node : node ? _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node)[0] : void 0;
|
|
778
779
|
return _nullishCoalesce(_optionalChain([path, 'optionalAccess', _14 => _14.strokeWidth]), () => ( 1));
|
|
779
780
|
}
|
|
780
781
|
case "shape":
|
|
@@ -885,12 +886,12 @@ function resolveMotionCamera(camera, scene) {
|
|
|
885
886
|
const r = camera;
|
|
886
887
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
887
888
|
}
|
|
888
|
-
function motionPathLength(node, parentWorld =
|
|
889
|
+
function motionPathLength(node, parentWorld = _chunkQAUIZPYIcjs.IDENTITY_MATRIX) {
|
|
889
890
|
let longest = 0;
|
|
890
|
-
const paths = node.type === "path" ? [node] :
|
|
891
|
+
const paths = node.type === "path" ? [node] : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node);
|
|
891
892
|
for (const p of paths) {
|
|
892
893
|
try {
|
|
893
|
-
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0,
|
|
894
|
+
longest = Math.max(longest, _chunkGF2RBSDMcjs.bezierPathLength.call(void 0, _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, p, parentWorld, { effects: false })));
|
|
894
895
|
} catch (e2) {
|
|
895
896
|
}
|
|
896
897
|
}
|
|
@@ -1143,12 +1144,12 @@ function compileMotionScene(scene) {
|
|
|
1143
1144
|
const order2 = _nullishCoalesce(o.order, () => ( "together"));
|
|
1144
1145
|
const pace = _nullishCoalesce(o.pace, () => ( "time"));
|
|
1145
1146
|
if (order2 === "together" && pace === "time") return null;
|
|
1146
|
-
const paths = entry.node.type === "path" ? [entry.node] :
|
|
1147
|
+
const paths = entry.node.type === "path" ? [entry.node] : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, entry.node);
|
|
1147
1148
|
let list = paths.map((p) => {
|
|
1148
1149
|
const at = nodes.get(p.id);
|
|
1149
1150
|
let first = { x: 0, y: 0 };
|
|
1150
1151
|
try {
|
|
1151
|
-
const m =
|
|
1152
|
+
const m = _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, p, _nullishCoalesce(_optionalChain([at, 'optionalAccess', _41 => _41.parentWorld]), () => ( _chunkQAUIZPYIcjs.IDENTITY_MATRIX)), { effects: false })[0];
|
|
1152
1153
|
if (m && m.type === "M") first = { x: m.x, y: m.y };
|
|
1153
1154
|
} catch (e3) {
|
|
1154
1155
|
}
|
|
@@ -1260,17 +1261,17 @@ function compileMotionScene(scene) {
|
|
|
1260
1261
|
let dx = _nullishCoalesce(_optionalChain([command3, 'access', _44 => _44.by, 'optionalAccess', _45 => _45.x]), () => ( 0));
|
|
1261
1262
|
let dy = _nullishCoalesce(_optionalChain([command3, 'access', _46 => _46.by, 'optionalAccess', _47 => _47.y]), () => ( 0));
|
|
1262
1263
|
if (command3.to) {
|
|
1263
|
-
const inv =
|
|
1264
|
-
const target =
|
|
1264
|
+
const inv = _chunkQAUIZPYIcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1265
|
+
const target = _chunkQAUIZPYIcjs.applyMatrix.call(void 0, inv, command3.to);
|
|
1265
1266
|
dx = target.x - (entry.center.x + num2("x"));
|
|
1266
1267
|
dy = target.y - (entry.center.y + num2("y"));
|
|
1267
1268
|
}
|
|
1268
1269
|
if (_optionalChain([command3, 'access', _48 => _48.via, 'optionalAccess', _49 => _49.length])) {
|
|
1269
|
-
const inv =
|
|
1270
|
+
const inv = _chunkQAUIZPYIcjs.invertMatrix.call(void 0, entry.parentWorld);
|
|
1270
1271
|
const x0 = num2("x");
|
|
1271
1272
|
const y0 = num2("y");
|
|
1272
1273
|
const add = command3.blend === "add";
|
|
1273
|
-
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) =>
|
|
1274
|
+
const offsets = [{ x: 0, y: 0 }, ...command3.via.map((p) => _chunkQAUIZPYIcjs.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 }];
|
|
1274
1275
|
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")));
|
|
1275
1276
|
for (const axis of ["x", "y"]) {
|
|
1276
1277
|
const base = add ? 0 : axis === "x" ? x0 : y0;
|
|
@@ -1413,13 +1414,13 @@ function morphBetween(a, b) {
|
|
|
1413
1414
|
let inner = morphCache.get(a);
|
|
1414
1415
|
if (!inner) morphCache.set(a, inner = /* @__PURE__ */ new WeakMap());
|
|
1415
1416
|
let morph = inner.get(b);
|
|
1416
|
-
if (!morph) inner.set(b, morph =
|
|
1417
|
+
if (!morph) inner.set(b, morph = _chunkI7G3RSUJcjs.createVectorMorph.call(void 0, a, b, { id: a.id }));
|
|
1417
1418
|
return morph;
|
|
1418
1419
|
}
|
|
1419
1420
|
function shapeIn(entry, shape) {
|
|
1420
1421
|
if (shape === entry) return entry.node;
|
|
1421
|
-
const m =
|
|
1422
|
-
return { ...shape.node, ...
|
|
1422
|
+
const m = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.nodeMatrix.call(void 0, shape.node), shape.parentWorld), _chunkQAUIZPYIcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
1423
|
+
return { ...shape.node, ..._chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, m) ? { transform: void 0 } : { transform: m } };
|
|
1423
1424
|
}
|
|
1424
1425
|
function shapeAt(entry, timeline, nodes, time) {
|
|
1425
1426
|
const track = timeline.tracks.get(motionTrackKey(entry.node.id, "shape"));
|
|
@@ -1439,7 +1440,7 @@ function shapeAt(entry, timeline, nodes, time) {
|
|
|
1439
1440
|
function motionFollowRoute(entry, path) {
|
|
1440
1441
|
if (!path || path.node.type !== "path") return null;
|
|
1441
1442
|
try {
|
|
1442
|
-
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
1443
|
+
return _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, path.node, path.parentWorld, { effects: false }), _chunkQAUIZPYIcjs.invertMatrix.call(void 0, entry.parentWorld));
|
|
1443
1444
|
} catch (e4) {
|
|
1444
1445
|
return null;
|
|
1445
1446
|
}
|
|
@@ -1473,9 +1474,9 @@ function motionNodeOffset(entry, timeline, time, nodes = indexMotionNodes([entry
|
|
|
1473
1474
|
const scaleX = read("scaleX", 1);
|
|
1474
1475
|
const scaleY = read("scaleY", 1);
|
|
1475
1476
|
const c = entry.center;
|
|
1476
|
-
let matrix =
|
|
1477
|
+
let matrix = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.scaleMatrix.call(void 0, scaleX, scaleY, c), _chunkQAUIZPYIcjs.rotateMatrix.call(void 0, rotation, c)), _chunkQAUIZPYIcjs.translateMatrix.call(void 0, dx, dy));
|
|
1477
1478
|
const along = follow ? followAt(entry, timeline, nodes, time) : null;
|
|
1478
|
-
if (along) matrix =
|
|
1479
|
+
if (along) matrix = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, matrix, _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.translateMatrix.call(void 0, -c.x, -c.y), _chunkQAUIZPYIcjs.rotateMatrix.call(void 0, along.angle)), _chunkQAUIZPYIcjs.translateMatrix.call(void 0, along.x, along.y)));
|
|
1479
1480
|
return { matrix, dx, dy, rotation, scaleX, scaleY, follow: along };
|
|
1480
1481
|
}
|
|
1481
1482
|
function motionNodeClips(id, timeline, time) {
|
|
@@ -1542,7 +1543,7 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
1542
1543
|
const start = Math.min(1, Math.max(0, typeof drawStart === "number" ? drawStart : 0));
|
|
1543
1544
|
const end = Math.min(1, Math.max(0, typeof drawEnd === "number" ? drawEnd : 1));
|
|
1544
1545
|
if (start > 0 || end < 1) {
|
|
1545
|
-
const trim =
|
|
1546
|
+
const trim = _chunkQAUIZPYIcjs.createVectorEffect.call(void 0, "trim", MOTION_DRAW_EFFECT_ID, { start: tidy(start * 100), end: tidy(end * 100) });
|
|
1546
1547
|
p = { ...p, effects: [trim, ...(_nullishCoalesce(p.effects, () => ( []))).filter((e) => e.id !== MOTION_DRAW_EFFECT_ID)] };
|
|
1547
1548
|
}
|
|
1548
1549
|
}
|
|
@@ -1556,8 +1557,8 @@ function motionFrameAt(scene, time, options = {}) {
|
|
|
1556
1557
|
if (o >= 1) delete out.opacity;
|
|
1557
1558
|
}
|
|
1558
1559
|
const offset = options.offsets === false ? null : motionNodeOffset(entry, timeline, time, nodes);
|
|
1559
|
-
if (offset && !
|
|
1560
|
-
const m =
|
|
1560
|
+
if (offset && !_chunkQAUIZPYIcjs.isIdentityMatrix.call(void 0, offset.matrix)) {
|
|
1561
|
+
const m = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _chunkQAUIZPYIcjs.nodeMatrix.call(void 0, out), offset.matrix).map(tidy);
|
|
1561
1562
|
out = { ...out, transform: m };
|
|
1562
1563
|
}
|
|
1563
1564
|
return out;
|
|
@@ -1577,7 +1578,7 @@ function motionFrameToSvg(scene, time, options = {}) {
|
|
|
1577
1578
|
const wrap = { ...options.wrap };
|
|
1578
1579
|
for (const [id, clips] of Object.entries(frame.clips))
|
|
1579
1580
|
wrap[id] = [..._nullishCoalesce(wrap[id], () => ( [])), ...clips.map((clip, i) => ({ clip: { id: `${prefix}reveal-${id}-${i}`, shape: clip.shape, attrs: motionClipAttrs(clip) } }))];
|
|
1580
|
-
return withViewBox(
|
|
1581
|
+
return withViewBox(_chunkQAUIZPYIcjs.vectorDocumentToSvg.call(void 0, frame.document, { ...options, wrap }), frame.camera);
|
|
1581
1582
|
}
|
|
1582
1583
|
function withViewBox(svg, box) {
|
|
1583
1584
|
const f = (n) => String(Math.round(n * 1e3) / 1e3);
|
|
@@ -1760,8 +1761,8 @@ function visibleAt(timeline, id, time, node) {
|
|
|
1760
1761
|
if (Array.isArray(rect) && (rect[2] <= 1e-4 || rect[3] <= 1e-4)) return false;
|
|
1761
1762
|
const circle = clip("clipCircle");
|
|
1762
1763
|
if (Array.isArray(circle) && circle[2] <= 1e-4) return false;
|
|
1763
|
-
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" :
|
|
1764
|
-
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" ||
|
|
1764
|
+
const hasFill = node.type === "path" ? !!node.fill && node.fill !== "none" : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node).some((p) => p.fill && p.fill !== "none");
|
|
1765
|
+
const drawn = num2("drawEnd", 1) > 0.01 && (node.type === "path" || _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node).length === 0 || _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node).some((p) => {
|
|
1765
1766
|
const v = trackValue(timeline.tracks.get(motionTrackKey(p.id, "drawEnd")), time);
|
|
1766
1767
|
return typeof v !== "number" || v > 0.01;
|
|
1767
1768
|
}));
|
|
@@ -1847,7 +1848,7 @@ function checkMotionScene(scene) {
|
|
|
1847
1848
|
}
|
|
1848
1849
|
for (const id of targets) {
|
|
1849
1850
|
const node = nodes.get(id).node;
|
|
1850
|
-
const paths = node.type === "path" ? [node] :
|
|
1851
|
+
const paths = node.type === "path" ? [node] : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node);
|
|
1851
1852
|
if (paths.some((p) => p[key] !== void 0 && p[key] !== null && typeof p[key] !== "string"))
|
|
1852
1853
|
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] }));
|
|
1853
1854
|
}
|
|
@@ -1860,7 +1861,7 @@ function checkMotionScene(scene) {
|
|
|
1860
1861
|
else
|
|
1861
1862
|
for (const id of targets) {
|
|
1862
1863
|
const node = nodes.get(id).node;
|
|
1863
|
-
const paths = node.type === "path" ? [node] :
|
|
1864
|
+
const paths = node.type === "path" ? [node] : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node);
|
|
1864
1865
|
if (paths.some((p) => typeof p[key] !== "string"))
|
|
1865
1866
|
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] }));
|
|
1866
1867
|
}
|
|
@@ -2305,7 +2306,7 @@ function motionNodePose(scene, id, time) {
|
|
|
2305
2306
|
if (!entry) throw new Error(`There is no element ${_chunkEBDZWIOPcjs.namedWithSuggestion.call(void 0, id, [...indexMotionNodes(scene.artwork.nodes).keys()])} in the artwork.`);
|
|
2306
2307
|
const timeline = compileMotionScene(scene);
|
|
2307
2308
|
const drawn = indexMotionNodes(motionFrameAt(scene, time).document.nodes).get(id);
|
|
2308
|
-
const centre =
|
|
2309
|
+
const centre = _chunkQAUIZPYIcjs.applyMatrix.call(void 0, entry.parentWorld, { x: entry.center.x + motionPropertyValue(timeline, id, "x", time), y: entry.center.y + motionPropertyValue(timeline, id, "y", time) });
|
|
2309
2310
|
const paint = (property) => _nullishCoalesce(trackValue(timeline.tracks.get(motionTrackKey(id, property)), time), () => ( motionRestValue(entry, property, scene.artwork)));
|
|
2310
2311
|
const fill = paint("fill");
|
|
2311
2312
|
const stroke = paint("stroke");
|
|
@@ -2652,7 +2653,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2652
2653
|
raw: (t) => transformAt(t, true)
|
|
2653
2654
|
});
|
|
2654
2655
|
}
|
|
2655
|
-
const paths = node.type === "path" ? [node] :
|
|
2656
|
+
const paths = node.type === "path" ? [node] : _chunkQAUIZPYIcjs.collectPathNodes.call(void 0, node);
|
|
2656
2657
|
for (const path of paths) {
|
|
2657
2658
|
if (pathsSeen.has(path.id)) continue;
|
|
2658
2659
|
pathsSeen.add(path.id);
|
|
@@ -2674,7 +2675,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2674
2675
|
if (shapeSegments.length) {
|
|
2675
2676
|
if (node.type !== "path") notes.push(`"${id}" is a group: its morph or effect animation is not exported (Flair tweens one path's "d").`);
|
|
2676
2677
|
else {
|
|
2677
|
-
const inverse =
|
|
2678
|
+
const inverse = _chunkQAUIZPYIcjs.invertMatrix.call(void 0, _chunkQAUIZPYIcjs.nodeMatrix.call(void 0, node));
|
|
2678
2679
|
channels.push({
|
|
2679
2680
|
id,
|
|
2680
2681
|
kind: "attr",
|
|
@@ -2683,9 +2684,9 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2683
2684
|
exact: () => false,
|
|
2684
2685
|
value: (t) => {
|
|
2685
2686
|
const frame = motionFrameAt(scene, t, { draw: false, offsets: false });
|
|
2686
|
-
const now =
|
|
2687
|
+
const now = _chunkQAUIZPYIcjs.expandVectorAppearance.call(void 0, _optionalChain([indexMotionNodes, 'call', _114 => _114(frame.document.nodes), 'access', _115 => _115.get, 'call', _116 => _116(id), 'optionalAccess', _117 => _117.node]));
|
|
2687
2688
|
if (!now || now.type !== "path") return "";
|
|
2688
|
-
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0,
|
|
2689
|
+
const bezier = _chunkGF2RBSDMcjs.transformBezierPath.call(void 0, _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, now, _chunkQAUIZPYIcjs.IDENTITY_MATRIX, { effects: false }), inverse);
|
|
2689
2690
|
return _chunkGF2RBSDMcjs.bezierPathToSvg.call(void 0, bezier, { precision: Math.min(precision, 2) });
|
|
2690
2691
|
}
|
|
2691
2692
|
});
|
|
@@ -2792,7 +2793,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
2792
2793
|
}
|
|
2793
2794
|
if (scene.motionBlur) notes.push("Motion blur is drawn on the stage only; Flair plays the scene sharp.");
|
|
2794
2795
|
if (trigger && (_nullishCoalesce(scene.loop, () => ( "none"))) !== "none") notes.push(`The scene plays on ${trigger}, so its loop does not apply in Flair.`);
|
|
2795
|
-
let svg =
|
|
2796
|
+
let svg = _chunkQAUIZPYIcjs.vectorDocumentToSvg.call(void 0, { ...scene.artwork, nodes: _chunkQAUIZPYIcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) }, { pretty: false, precision, wrap });
|
|
2796
2797
|
if (routes.length) svg = svg.replace(/^(<svg[^>]*>)/, `$1<defs>${routes.join("")}</defs>`);
|
|
2797
2798
|
let motion = { svg, animate };
|
|
2798
2799
|
if (_optionalChain([scene, 'access', _120 => _120.controls, 'optionalAccess', _121 => _121.length])) {
|
|
@@ -2876,14 +2877,14 @@ function easingOf(ease, fallback) {
|
|
|
2876
2877
|
return fallback;
|
|
2877
2878
|
}
|
|
2878
2879
|
function poseOf(value, entry) {
|
|
2879
|
-
const t =
|
|
2880
|
-
const o =
|
|
2880
|
+
const t = _chunkQAUIZPYIcjs.parseSvgTransform.call(void 0, String(value));
|
|
2881
|
+
const o = _chunkQAUIZPYIcjs.multiplyMatrices.call(void 0, _nullishCoalesce(_chunkQAUIZPYIcjs.invertMatrix.call(void 0, _chunkQAUIZPYIcjs.nodeMatrix.call(void 0, entry.node)), () => ( [1, 0, 0, 1, 0, 0])), t);
|
|
2881
2882
|
const sx = Math.hypot(o[0], o[1]);
|
|
2882
2883
|
if (!(sx > 1e-9)) return null;
|
|
2883
2884
|
const sy = (o[0] * o[3] - o[1] * o[2]) / sx;
|
|
2884
2885
|
if (Math.abs(o[2] + o[1] / sx * sy) > 1e-6 || Math.abs(o[3] - o[0] / sx * sy) > 1e-6) return null;
|
|
2885
2886
|
const c = entry.center;
|
|
2886
|
-
const moved =
|
|
2887
|
+
const moved = _chunkQAUIZPYIcjs.applyMatrix.call(void 0, o, c);
|
|
2887
2888
|
return { dx: moved.x - c.x, dy: moved.y - c.y, rotation: Math.atan2(o[1], o[0]) * 180 / Math.PI, sx, sy };
|
|
2888
2889
|
}
|
|
2889
2890
|
var near = (a, b, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
@@ -2968,7 +2969,7 @@ function fromFlairSvgMotion(input, options = {}) {
|
|
|
2968
2969
|
const notes = [];
|
|
2969
2970
|
if (!input || typeof input.svg !== "string") throw new Error('Give a Flair SvgMotion: { svg: "<svg \u2026>", animate: [ \u2026 ] }.');
|
|
2970
2971
|
const { motion, controls } = resolvePlaceholders(input, notes);
|
|
2971
|
-
const artwork =
|
|
2972
|
+
const artwork = _chunkQAUIZPYIcjs.parseVectorSvg.call(void 0, motion.svg);
|
|
2972
2973
|
const nodes = indexMotionNodes(artwork.nodes);
|
|
2973
2974
|
const byStep = /* @__PURE__ */ new Map();
|
|
2974
2975
|
for (const anim of _nullishCoalesce(motion.animate, () => ( []))) {
|
|
@@ -3215,9 +3216,9 @@ function toLottie(scene, options = {}) {
|
|
|
3215
3216
|
const items = [];
|
|
3216
3217
|
const shapeSegments = [...timeline.tracks.entries()].filter(([k]) => k.startsWith(`${path.id}\0`) && (k.endsWith("\0shape") || k.includes("\0effect:"))).flatMap(([, v]) => v);
|
|
3217
3218
|
const geometryAt = (t) => {
|
|
3218
|
-
if (!shapeSegments.length) return
|
|
3219
|
+
if (!shapeSegments.length) return _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3219
3220
|
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]);
|
|
3220
|
-
return now && now.type === "path" ?
|
|
3221
|
+
return now && now.type === "path" ? _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, _chunkQAUIZPYIcjs.expandVectorAppearances.call(void 0, [now])[0]) : _chunkQAUIZPYIcjs.vectorPathWorldBezier.call(void 0, path);
|
|
3221
3222
|
};
|
|
3222
3223
|
const rest = lottieContours(_chunkGF2RBSDMcjs.toBezierPath.call(void 0, geometryAt(0)), round3);
|
|
3223
3224
|
rest.forEach((contour, n) => {
|
|
@@ -3290,13 +3291,13 @@ function toLottie(scene, options = {}) {
|
|
|
3290
3291
|
const innerTr = STATIC_TR();
|
|
3291
3292
|
if (node.type === "path") inner = [...pathShapes(node)];
|
|
3292
3293
|
else if (node.type === "text" || node.type === "instance") {
|
|
3293
|
-
const drawn =
|
|
3294
|
+
const drawn = _chunkQAUIZPYIcjs.expandVectorAppearance.call(void 0, node);
|
|
3294
3295
|
inner = drawn.type === "path" ? [...pathShapes(drawn)] : drawn.children.filter((c) => c.type === "path").reverse().flatMap((c) => [...pathShapes(c)]);
|
|
3295
|
-
notes.push(`"${node.id}": text is exported as its outlines${
|
|
3296
|
+
notes.push(`"${node.id}": text is exported as its outlines${_chunkQAUIZPYIcjs.vectorTextHasOutlines.call(void 0, ) ? "" : " (glyph boxes: set an outline text shaper for real glyphs)"}.`);
|
|
3296
3297
|
} else {
|
|
3297
3298
|
inner = shown(node.children).reverse().map(nodeGroup);
|
|
3298
|
-
const m =
|
|
3299
|
-
if (m !==
|
|
3299
|
+
const m = _chunkQAUIZPYIcjs.nodeMatrix.call(void 0, node);
|
|
3300
|
+
if (m !== _chunkQAUIZPYIcjs.IDENTITY_MATRIX) {
|
|
3300
3301
|
const parts = staticParts(m);
|
|
3301
3302
|
if (!parts) notes.push(`"${node.id}": its transform skews, which is not exported; it is drawn without the skew.`);
|
|
3302
3303
|
else {
|
|
@@ -3309,7 +3310,7 @@ function toLottie(scene, options = {}) {
|
|
|
3309
3310
|
const body = { ty: "gr", nm: `${node.id} (own)`, it: [...inner, innerTr] };
|
|
3310
3311
|
return { ty: "gr", nm: _nullishCoalesce(node.name, () => ( node.id)), it: [body, poseTransform(entry)] };
|
|
3311
3312
|
};
|
|
3312
|
-
const artwork = { ...scene.artwork, nodes:
|
|
3313
|
+
const artwork = { ...scene.artwork, nodes: _chunkQAUIZPYIcjs.expandVectorAppearances.call(void 0, scene.artwork.nodes) };
|
|
3313
3314
|
const content = shown(artwork.nodes).reverse().map(nodeGroup);
|
|
3314
3315
|
if (artwork.background && rgba(artwork.background))
|
|
3315
3316
|
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()] });
|
|
@@ -3408,11 +3409,11 @@ function preset(prst, w, h) {
|
|
|
3408
3409
|
const poly = (pts) => [{ closed: true, anchors: pts.map(([x, y]) => ({ x, y })) }];
|
|
3409
3410
|
switch (prst) {
|
|
3410
3411
|
case "rect":
|
|
3411
|
-
return [
|
|
3412
|
+
return [_chunkQAUIZPYIcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
3412
3413
|
case "roundRect":
|
|
3413
|
-
return [
|
|
3414
|
+
return [_chunkQAUIZPYIcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h }, Math.min(w, h) * 0.16667)];
|
|
3414
3415
|
case "ellipse":
|
|
3415
|
-
return [
|
|
3416
|
+
return [_chunkQAUIZPYIcjs.ellipseSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
3416
3417
|
case "triangle":
|
|
3417
3418
|
return poly([[w / 2, 0], [w, h], [0, h]]);
|
|
3418
3419
|
case "rtTriangle":
|
|
@@ -3520,7 +3521,7 @@ function shapes(ctx, tree, map) {
|
|
|
3520
3521
|
let subpaths = cust ? custom(cust, w, h) : prst ? preset(prst, w, h) : null;
|
|
3521
3522
|
if (!subpaths) {
|
|
3522
3523
|
if (prst) ctx.notes.push(`"${name}" is a ${prst}, drawn as its bounding rectangle.`);
|
|
3523
|
-
subpaths = [
|
|
3524
|
+
subpaths = [_chunkQAUIZPYIcjs.rectSubpath.call(void 0, { x: 0, y: 0, width: w, height: h })];
|
|
3524
3525
|
}
|
|
3525
3526
|
const style = kid(el, "style");
|
|
3526
3527
|
const fill = kid(spPr, "noFill") ? null : _nullishCoalesce(colour(ctx, kid(spPr, "solidFill")), () => ( (el.localName === "cxnSp" ? null : colour(ctx, kid(style, "fillRef")))));
|
|
@@ -3758,7 +3759,7 @@ function nextMotionEffectInstance(scene) {
|
|
|
3758
3759
|
walk(scene.artwork.nodes);
|
|
3759
3760
|
for (let i = 1; ; i++) if (!used.has(`fx${i}`)) return `fx${i}`;
|
|
3760
3761
|
}
|
|
3761
|
-
var motionArtworkSvg = (artwork) =>
|
|
3762
|
+
var motionArtworkSvg = (artwork) => _chunkQAUIZPYIcjs.vectorDocumentToSvg.call(void 0, artwork);
|
|
3762
3763
|
var tag = (commands, source) => commands.map((c) => c.type === "wait" ? c : { ...c, source });
|
|
3763
3764
|
function motionCommandsFromEffect(artwork, motion, source) {
|
|
3764
3765
|
const imported = fromFlairSvgMotion({ svg: motionArtworkSvg(artwork), animate: [..._nullishCoalesce(motion.animate, () => ( []))] });
|
|
@@ -5085,7 +5086,7 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
5085
5086
|
handler: ({ svg }) => {
|
|
5086
5087
|
let artwork;
|
|
5087
5088
|
try {
|
|
5088
|
-
artwork =
|
|
5089
|
+
artwork = _chunkQAUIZPYIcjs.parseVectorSvg.call(void 0, svg);
|
|
5089
5090
|
} catch (error) {
|
|
5090
5091
|
throw new Error(`The SVG could not be read: ${error.message}. Nothing was changed.`);
|
|
5091
5092
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVectorMorph
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-BGOCAUXH.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-NDMXB4PR.js";
|
|
35
|
+
import "../chunk-F7YA3MMC.js";
|
|
36
36
|
import "../chunk-M6DNZNVY.js";
|
|
37
37
|
import {
|
|
38
38
|
bezierPathLength,
|
|
@@ -50,9 +50,10 @@ import {
|
|
|
50
50
|
resolveEffectValues
|
|
51
51
|
} from "../chunk-6G2NLMVK.js";
|
|
52
52
|
import "../chunk-V2ZCJRDM.js";
|
|
53
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-2PBZBRP5.js";
|
|
54
54
|
import "../chunk-ODBT55Q7.js";
|
|
55
|
-
import "../chunk-
|
|
55
|
+
import "../chunk-42TWUPNJ.js";
|
|
56
|
+
import "../chunk-HVVR5PZW.js";
|
|
56
57
|
import "../chunk-QGHEDC7B.js";
|
|
57
58
|
import "../chunk-SIFAIGB3.js";
|
|
58
59
|
import {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pathDataToPolyline
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G4E6RUPC.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-F7YA3MMC.js";
|
|
10
10
|
import {
|
|
11
11
|
formatNumber,
|
|
12
12
|
getShapeSvg,
|
|
@@ -17,9 +17,10 @@ import {
|
|
|
17
17
|
brushstrokeDataUrl,
|
|
18
18
|
isBrushstrokeBrush,
|
|
19
19
|
parsePaintSource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2PBZBRP5.js";
|
|
21
21
|
import "./chunk-ODBT55Q7.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-42TWUPNJ.js";
|
|
23
|
+
import "./chunk-HVVR5PZW.js";
|
|
23
24
|
import "./chunk-QGHEDC7B.js";
|
|
24
25
|
|
|
25
26
|
// src/canvas/brushstrokeRender.ts
|
|
@@ -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 _chunkZMHPQ6HPcjs = require('./chunk-ZMHPQ6HP.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkA2IS7EHEcjs = require('./chunk-A2IS7EHE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkROVK6AXXcjs = require('./chunk-ROVK6AXX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -17,23 +17,24 @@ var _chunkNM3G4VQTcjs = require('./chunk-NM3G4VQT.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkPQ3H2AANcjs = require('./chunk-PQ3H2AAN.cjs');
|
|
21
21
|
require('./chunk-YQGCPL5X.cjs');
|
|
22
|
-
require('./chunk-
|
|
22
|
+
require('./chunk-OLNIPTB3.cjs');
|
|
23
|
+
require('./chunk-474IQG74.cjs');
|
|
23
24
|
require('./chunk-XFM3OCHU.cjs');
|
|
24
25
|
|
|
25
26
|
// src/canvas/brushstrokeRender.ts
|
|
26
|
-
var DRY =
|
|
27
|
+
var DRY = _chunkROVK6AXXcjs.BUILTIN_BRUSHES.filter((b) => _chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, b));
|
|
27
28
|
function listCanvasBrushes() {
|
|
28
29
|
return DRY.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size }));
|
|
29
30
|
}
|
|
30
31
|
function resolveCanvasBrush(brush, width) {
|
|
31
32
|
const given = width !== void 0 && Number.isFinite(width) ? Math.max(1, width) : void 0;
|
|
32
33
|
if (typeof brush === "string") {
|
|
33
|
-
const preset =
|
|
34
|
+
const preset = _chunkROVK6AXXcjs.BUILTIN_BRUSHES.find((b) => b.id === brush);
|
|
34
35
|
const ids = DRY.map((b) => b.id).join(", ");
|
|
35
36
|
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 (!
|
|
37
|
+
if (!_chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, preset)) {
|
|
37
38
|
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
39
|
}
|
|
39
40
|
return given === void 0 ? preset : { ...preset, tip: { ...preset.tip, size: given } };
|
|
@@ -44,7 +45,7 @@ function resolveCanvasBrush(brush, width) {
|
|
|
44
45
|
return { size: _nullishCoalesce(given, () => ( 3)), ...brush };
|
|
45
46
|
}
|
|
46
47
|
function resolveCanvasPaint(paint) {
|
|
47
|
-
const source =
|
|
48
|
+
const source = _chunkPQ3H2AANcjs.parsePaintSource.call(void 0, paint, "paint");
|
|
48
49
|
if (source.type === "gradient" && (source.map.by === "velocity" || source.map.by === "time")) {
|
|
49
50
|
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
51
|
}
|
|
@@ -65,14 +66,14 @@ function strokeColor(shape) {
|
|
|
65
66
|
const n = parseInt(parsed.hex.slice(1), 16);
|
|
66
67
|
return [n >> 16 & 255, n >> 8 & 255, n & 255, Math.round(parsed.alpha * 255)];
|
|
67
68
|
}
|
|
68
|
-
var cache = new (0,
|
|
69
|
+
var cache = new (0, _chunkPQ3H2AANcjs.BrushstrokeCache)(128);
|
|
69
70
|
var urls = /* @__PURE__ */ new WeakMap();
|
|
70
71
|
function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
71
72
|
const seed = shape.brush.seed;
|
|
72
73
|
const textured = typeof seed === "number" && Number.isFinite(seed);
|
|
73
74
|
const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
|
|
74
75
|
const brush = resolveCanvasBrush(shape.brush.brush, size);
|
|
75
|
-
const points =
|
|
76
|
+
const points = _chunkZMHPQ6HPcjs.pathDataToPolyline.call(void 0, shape.d);
|
|
76
77
|
if (!points.length) return null;
|
|
77
78
|
const { pressure, tiltX, tiltY } = shape.brush;
|
|
78
79
|
const input = {
|
|
@@ -95,7 +96,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
|
95
96
|
if (!stroke.bounds) return null;
|
|
96
97
|
let href = urls.get(stroke);
|
|
97
98
|
if (href === void 0) {
|
|
98
|
-
href =
|
|
99
|
+
href = _chunkPQ3H2AANcjs.brushstrokeDataUrl.call(void 0, stroke);
|
|
99
100
|
urls.set(stroke, href);
|
|
100
101
|
}
|
|
101
102
|
return { href, ...stroke.bounds, scale: stroke.scale };
|