@pixerate/editor 0.119.0 → 0.120.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 +54 -54
- package/dist/animation-editor/index.d.cts +3 -3
- package/dist/animation-editor/index.d.ts +3 -3
- package/dist/animation-editor/index.js +2 -2
- package/dist/{chunk-KZLQY4CD.js → chunk-BOWUU4LJ.js} +2 -2
- package/dist/{chunk-KGNUFO4T.cjs → chunk-DFLJHLKA.cjs} +36 -36
- package/dist/{chunk-KGNUFO4T.cjs.map → chunk-DFLJHLKA.cjs.map} +1 -1
- package/dist/{chunk-4S2AXNQF.cjs → chunk-HTAFDTNR.cjs} +82 -82
- package/dist/{chunk-4S2AXNQF.cjs.map → chunk-HTAFDTNR.cjs.map} +1 -1
- package/dist/{chunk-LI3KTY7K.cjs → chunk-VYW7JBTM.cjs} +72 -5
- package/dist/chunk-VYW7JBTM.cjs.map +1 -0
- package/dist/{chunk-TDQDMBUR.js → chunk-WAI6ATHC.js} +2 -2
- package/dist/{chunk-CSHEI3YT.js → chunk-WORWH5K5.js} +71 -4
- package/dist/chunk-WORWH5K5.js.map +1 -0
- package/dist/{export-Ds8Ccw0K.d.ts → export-D2D8hb_u.d.ts} +1 -1
- package/dist/{export-B_jO2PrH.d.cts → export-fP2hZYjm.d.cts} +1 -1
- package/dist/image-editor/index.cjs +579 -579
- package/dist/image-editor/index.d.cts +3 -3
- package/dist/image-editor/index.d.ts +3 -3
- package/dist/image-editor/index.js +2 -2
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.d.cts +2 -2
- package/dist/paint-editor/index.d.ts +2 -2
- package/dist/paint-editor/index.js +2 -2
- package/dist/{svg-hK0WQc7-.d.cts → svg-S9zzvqaZ.d.cts} +1 -1
- package/dist/{svg-CTxrB5xO.d.ts → svg-leZpRsJB.d.ts} +1 -1
- package/dist/{types-TrSSh_RB.d.ts → types-BgwxFWvn.d.ts} +23 -9
- package/dist/{types-Dq-8qgoo.d.cts → types-DdRTDnza.d.cts} +23 -9
- package/dist/vector/index.cjs +874 -872
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +12 -5
- package/dist/vector/index.d.ts +12 -5
- package/dist/vector/index.js +7 -5
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/pixerate-vector/SKILL.md +1 -1
- package/skills/pixerate-vector/references/commands.md +1 -0
- package/dist/chunk-CSHEI3YT.js.map +0 -1
- package/dist/chunk-LI3KTY7K.cjs.map +0 -1
- /package/dist/{chunk-KZLQY4CD.js.map → chunk-BOWUU4LJ.js.map} +0 -0
- /package/dist/{chunk-TDQDMBUR.js.map → chunk-WAI6ATHC.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
unionBounds,
|
|
19
19
|
vectorGradientPoints,
|
|
20
20
|
widthProfileAt
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-WORWH5K5.js";
|
|
22
22
|
import {
|
|
23
23
|
segmentLength,
|
|
24
24
|
segmentParamAtLength,
|
|
@@ -750,4 +750,4 @@ export {
|
|
|
750
750
|
interpolateVectorPaths,
|
|
751
751
|
evaluateVectorPathKeyframes
|
|
752
752
|
};
|
|
753
|
-
//# sourceMappingURL=chunk-
|
|
753
|
+
//# sourceMappingURL=chunk-WAI6ATHC.js.map
|
|
@@ -122,7 +122,7 @@ var VECTOR_TOOLS = [
|
|
|
122
122
|
];
|
|
123
123
|
var VECTOR_TRANSFORM_HANDLES = ["nw", "n", "ne", "e", "se", "s", "sw", "w", "rotate"];
|
|
124
124
|
var VECTOR_PATHFINDER_OPERATIONS = ["divide", "trim", "merge", "crop", "outline", "minusBack"];
|
|
125
|
-
var VECTOR_EFFECT_TYPES = ["trim", "roundCorners", "puckerBloat", "twist", "zigzag", "wiggle", "offset", "merge", "repeater", "envelope", "contour"];
|
|
125
|
+
var VECTOR_EFFECT_TYPES = ["trim", "roundCorners", "puckerBloat", "twist", "zigzag", "wiggle", "offset", "merge", "repeater", "envelope", "contour", "blockShadow"];
|
|
126
126
|
var VECTOR_MERGE_MODES = ["merge", "add", "subtract", "intersect", "exclude"];
|
|
127
127
|
var VECTOR_FILTER_TYPES = ["dropShadow", "innerShadow", "outerGlow", "innerGlow", "layerBlur", "feather"];
|
|
128
128
|
|
|
@@ -2829,6 +2829,24 @@ function offsetPaths(paths, amount, join = "miter", miterLimit = 4, copies = 1,
|
|
|
2829
2829
|
return out;
|
|
2830
2830
|
});
|
|
2831
2831
|
}
|
|
2832
|
+
function sweepPath(path, dx, dy, fillRule = "nonzero", tolerance = 0.25) {
|
|
2833
|
+
if (!path.length) return [];
|
|
2834
|
+
if (!Number.isFinite(dx) || !Number.isFinite(dy) || Math.hypot(dx, dy) < 1e-9) return path.slice();
|
|
2835
|
+
const bands = [];
|
|
2836
|
+
for (const contour of pathToContours(path)) {
|
|
2837
|
+
const ring = flattenChain(closeContour(contour, true), Math.max(1e-3, tolerance));
|
|
2838
|
+
for (let i = 0; i < ring.length; i++) {
|
|
2839
|
+
let p = ring[i];
|
|
2840
|
+
let q = ring[(i + 1) % ring.length];
|
|
2841
|
+
const turn2 = (q[0] - p[0]) * dy - (q[1] - p[1]) * dx;
|
|
2842
|
+
if (Math.abs(turn2) < 1e-9) continue;
|
|
2843
|
+
if (turn2 < 0) [p, q] = [q, p];
|
|
2844
|
+
bands.push({ type: "M", x: p[0], y: p[1] }, { type: "L", x: q[0], y: q[1] }, { type: "L", x: q[0] + dx, y: q[1] + dy }, { type: "L", x: p[0] + dx, y: p[1] + dy }, { type: "Z" });
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
const moved = transformBezierPath(path, [1, 0, 0, 1, dx, dy]);
|
|
2848
|
+
return pathBoolean("union", [{ path, fillRule }, { path: moved, fillRule }, ...bands.length ? [{ path: bands, fillRule: "nonzero" }] : []]).path;
|
|
2849
|
+
}
|
|
2832
2850
|
function twistPaths(paths, angle, center) {
|
|
2833
2851
|
let rmax = 0;
|
|
2834
2852
|
for (const p of paths) for (const c of p) if (c.type !== "Z") rmax = Math.max(rmax, Math.hypot(c.x - center.x, c.y - center.y));
|
|
@@ -6248,7 +6266,8 @@ var VECTOR_EFFECT_DEFAULTS = {
|
|
|
6248
6266
|
composite: "below"
|
|
6249
6267
|
},
|
|
6250
6268
|
envelope: { style: "arc", bend: 50, horizontal: 0, vertical: 0, orientation: "horizontal", rows: 2, columns: 2, mesh: null },
|
|
6251
|
-
contour: { direction: "inside", steps: 4, offset: 6, join: "round", miterLimit: 4, fillColor: "#ffffff", strokeColor: null, acceleration: 0 }
|
|
6269
|
+
contour: { direction: "inside", steps: 4, offset: 6, join: "round", miterLimit: 4, fillColor: "#ffffff", strokeColor: null, acceleration: 0 },
|
|
6270
|
+
blockShadow: { angle: 45, distance: 20, color: "#1e293b", opacity: 100, endOpacity: 100 }
|
|
6252
6271
|
};
|
|
6253
6272
|
var VECTOR_EFFECT_LABELS = {
|
|
6254
6273
|
trim: "Trim Paths",
|
|
@@ -6261,7 +6280,8 @@ var VECTOR_EFFECT_LABELS = {
|
|
|
6261
6280
|
merge: "Merge Paths",
|
|
6262
6281
|
repeater: "Repeater",
|
|
6263
6282
|
envelope: "Envelope",
|
|
6264
|
-
contour: "Contour"
|
|
6283
|
+
contour: "Contour",
|
|
6284
|
+
blockShadow: "Block Shadow"
|
|
6265
6285
|
};
|
|
6266
6286
|
var VECTOR_EFFECT_PARAM_SPECS = {
|
|
6267
6287
|
trim: [
|
|
@@ -6356,6 +6376,13 @@ var VECTOR_EFFECT_PARAM_SPECS = {
|
|
|
6356
6376
|
]
|
|
6357
6377
|
}
|
|
6358
6378
|
],
|
|
6379
|
+
blockShadow: [
|
|
6380
|
+
{ key: "angle", label: "Angle \xB0", kind: "number", min: -360, max: 360, step: 1, slider: true },
|
|
6381
|
+
{ key: "distance", label: "Distance", kind: "number", min: 0, max: 2e3, step: 1, slider: true },
|
|
6382
|
+
{ key: "color", label: "Colour", kind: "color" },
|
|
6383
|
+
{ key: "opacity", label: "Opacity %", kind: "number", min: 0, max: 100, step: 1, slider: true },
|
|
6384
|
+
{ key: "endOpacity", label: "End opacity %", kind: "number", min: 0, max: 100, step: 1, slider: true }
|
|
6385
|
+
],
|
|
6359
6386
|
repeater: [
|
|
6360
6387
|
{ key: "copies", label: "Copies", kind: "number", min: 0, max: 50, step: 0.1, slider: true },
|
|
6361
6388
|
{ key: "offset", label: "Offset", kind: "number", min: -10, max: 10, step: 0.1, slider: true },
|
|
@@ -6636,6 +6663,42 @@ function contourShapes(shapes, c) {
|
|
|
6636
6663
|
}
|
|
6637
6664
|
return out;
|
|
6638
6665
|
}
|
|
6666
|
+
function blockShadowShapes(shapes, b) {
|
|
6667
|
+
const rad2 = b.angle * Math.PI / 180;
|
|
6668
|
+
const u = { x: Math.cos(rad2), y: Math.sin(rad2) };
|
|
6669
|
+
const distance = Math.max(0, b.distance);
|
|
6670
|
+
const shadows = [];
|
|
6671
|
+
for (const s of shapes) {
|
|
6672
|
+
const color2 = b.color ?? (typeof s.source.fill === "string" && s.source.fill !== "none" ? s.source.fill : "#000000");
|
|
6673
|
+
const path = sweepPath(s.path, u.x * distance, u.y * distance, s.source.fillRule === "evenodd" ? "evenodd" : "nonzero");
|
|
6674
|
+
const box = bezierPathBounds(s.path);
|
|
6675
|
+
if (!path.length || !box) continue;
|
|
6676
|
+
let fill = color2;
|
|
6677
|
+
const near3 = Math.min(100, Math.max(0, b.opacity));
|
|
6678
|
+
const far = Math.min(100, Math.max(0, b.endOpacity));
|
|
6679
|
+
const top = Math.max(near3, far);
|
|
6680
|
+
if (near3 !== far && distance > 0) {
|
|
6681
|
+
const along2 = [box.minX * u.x + box.minY * u.y, box.maxX * u.x + box.minY * u.y, box.minX * u.x + box.maxY * u.y, box.maxX * u.x + box.maxY * u.y];
|
|
6682
|
+
const t0 = Math.min(...along2);
|
|
6683
|
+
const t1 = Math.max(...along2) + distance;
|
|
6684
|
+
const c = { x: (box.minX + box.maxX) / 2, y: (box.minY + box.maxY) / 2 };
|
|
6685
|
+
const k = c.x * u.x + c.y * u.y;
|
|
6686
|
+
fill = {
|
|
6687
|
+
type: "linear",
|
|
6688
|
+
units: "userSpaceOnUse",
|
|
6689
|
+
start: { x: c.x + u.x * (t0 - k), y: c.y + u.y * (t0 - k) },
|
|
6690
|
+
end: { x: c.x + u.x * (t1 - k), y: c.y + u.y * (t1 - k) },
|
|
6691
|
+
stops: [
|
|
6692
|
+
{ offset: 0, color: color2, opacity: near3 / top },
|
|
6693
|
+
{ offset: 1, color: color2, opacity: far / top }
|
|
6694
|
+
]
|
|
6695
|
+
};
|
|
6696
|
+
}
|
|
6697
|
+
const source = { ...s.source, fill, stroke: null, fills: void 0, strokes: void 0, fillRule: "nonzero" };
|
|
6698
|
+
shadows.push({ source, path, opacity: s.opacity * top / 100, order: [0, ...s.order] });
|
|
6699
|
+
}
|
|
6700
|
+
return [...shadows, ...shapes.map((s) => ({ ...s, order: [1, ...s.order] }))];
|
|
6701
|
+
}
|
|
6639
6702
|
function applyVectorEffects(shapes, effects) {
|
|
6640
6703
|
let list = shapes.slice();
|
|
6641
6704
|
for (const e of effects ?? []) {
|
|
@@ -6679,6 +6742,9 @@ function applyVectorEffects(shapes, effects) {
|
|
|
6679
6742
|
case "contour":
|
|
6680
6743
|
list = contourShapes(list, e.params);
|
|
6681
6744
|
break;
|
|
6745
|
+
case "blockShadow":
|
|
6746
|
+
list = blockShadowShapes(list, e.params);
|
|
6747
|
+
break;
|
|
6682
6748
|
case "repeater": {
|
|
6683
6749
|
const r = e.params;
|
|
6684
6750
|
const copies = repeatPaths(
|
|
@@ -9712,6 +9778,7 @@ export {
|
|
|
9712
9778
|
puckerBloatPaths,
|
|
9713
9779
|
roundCornerPaths,
|
|
9714
9780
|
offsetPaths,
|
|
9781
|
+
sweepPath,
|
|
9715
9782
|
twistPaths,
|
|
9716
9783
|
zigzagPaths,
|
|
9717
9784
|
wigglePaths,
|
|
@@ -9968,4 +10035,4 @@ export {
|
|
|
9968
10035
|
lineSubpath,
|
|
9969
10036
|
roundSubpaths
|
|
9970
10037
|
};
|
|
9971
|
-
//# sourceMappingURL=chunk-
|
|
10038
|
+
//# sourceMappingURL=chunk-WORWH5K5.js.map
|