@pixerate/editor 0.137.0 → 0.139.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +3 -3
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/index.cjs +57 -57
- package/dist/animation-editor/index.d.cts +6 -5
- package/dist/animation-editor/index.d.ts +6 -5
- package/dist/animation-editor/index.js +4 -4
- package/dist/{arrange-CKXK_hf7.d.cts → arrange-j_mLiFMO.d.cts} +1 -1
- package/dist/{arrange-BUREmgD9.d.ts → arrange-q5HQvnnB.d.ts} +1 -1
- package/dist/{bezier-Dywv3Bw8.d.ts → bezier-B6cK8SR6.d.ts} +2 -2
- package/dist/{bezier-CZ2AhjID.d.cts → bezier-CEJ8Uw4O.d.cts} +2 -2
- package/dist/{brushTypes-C7N3EBK7.d.cts → brushTypes-MX5UVs_m.d.cts} +27 -2
- package/dist/{brushTypes-C7N3EBK7.d.ts → brushTypes-MX5UVs_m.d.ts} +27 -2
- package/dist/{brushes-DJmUbIgz.d.ts → brushes-CQpL7_Lc.d.ts} +2 -107
- package/dist/{brushes-CnvZSYYU.d.cts → brushes-aEnjqoji.d.cts} +2 -107
- package/dist/{brushstrokeRender-IMFY3FF6.cjs → brushstrokeRender-PP6NTF6M.cjs} +52 -24
- package/dist/brushstrokeRender-PP6NTF6M.cjs.map +1 -0
- package/dist/{brushstrokeRender-2FAXA3XC.js → brushstrokeRender-QGEYJ4OZ.js} +40 -12
- package/dist/brushstrokeRender-QGEYJ4OZ.js.map +1 -0
- package/dist/{builtins-Cc-bH-3U.d.cts → builtins-BakDiKWf.d.cts} +3 -2
- package/dist/{builtins-ZU1GJnUA.d.ts → builtins-CE33vyv2.d.ts} +3 -2
- package/dist/canvas/index.cjs +16 -9
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +60 -14
- package/dist/canvas/index.d.ts +60 -14
- package/dist/canvas/index.js +10 -3
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-PRSRYHQD.cjs → chunk-3QHPFSQM.cjs} +36 -36
- package/dist/{chunk-PRSRYHQD.cjs.map → chunk-3QHPFSQM.cjs.map} +1 -1
- package/dist/{chunk-QBWEH3IM.cjs → chunk-3T5O225T.cjs} +391 -76
- package/dist/chunk-3T5O225T.cjs.map +1 -0
- package/dist/{chunk-EQQMGO42.js → chunk-C2J7GOMJ.js} +18 -5
- package/dist/chunk-C2J7GOMJ.js.map +1 -0
- package/dist/{chunk-2XS6LTUP.cjs → chunk-C46AZEBE.cjs} +104 -339
- package/dist/chunk-C46AZEBE.cjs.map +1 -0
- package/dist/{chunk-HUO3TI4C.js → chunk-CPSMARTX.js} +6 -241
- package/dist/chunk-CPSMARTX.js.map +1 -0
- package/dist/{chunk-KEENUAFN.cjs → chunk-DLLUOVQX.cjs} +18 -5
- package/dist/chunk-DLLUOVQX.cjs.map +1 -0
- package/dist/{chunk-LSXXAJG3.js → chunk-J7DSKTKB.js} +5 -4
- package/dist/chunk-J7DSKTKB.js.map +1 -0
- package/dist/{chunk-6S6362D2.js → chunk-NI6RORDS.js} +2 -2
- package/dist/{chunk-XN2NBLV5.cjs → chunk-PMEHFHSP.cjs} +82 -82
- package/dist/{chunk-XN2NBLV5.cjs.map → chunk-PMEHFHSP.cjs.map} +1 -1
- package/dist/{chunk-5FSRTP6E.js → chunk-PQFVLOMR.js} +319 -4
- package/dist/chunk-PQFVLOMR.js.map +1 -0
- package/dist/{chunk-OIBIRXRG.js → chunk-PSPLRQL6.js} +2 -2
- package/dist/{chunk-SYT2TLQF.js → chunk-QEIN6JQO.js} +2 -2
- package/dist/{chunk-3D77LOBM.js → chunk-TJBYBSTN.js} +51 -6
- package/dist/chunk-TJBYBSTN.js.map +1 -0
- package/dist/{chunk-DFSZO2B5.cjs → chunk-UFL5N4DK.cjs} +5 -4
- package/dist/chunk-UFL5N4DK.cjs.map +1 -0
- package/dist/{chunk-TLCTTQFF.cjs → chunk-VEHVXRJU.cjs} +17 -17
- package/dist/{chunk-TLCTTQFF.cjs.map → chunk-VEHVXRJU.cjs.map} +1 -1
- package/dist/{chunk-5OOIUXNJ.cjs → chunk-XFXHA5MU.cjs} +55 -10
- package/dist/chunk-XFXHA5MU.cjs.map +1 -0
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.d.cts +3 -3
- package/dist/commands/index.d.ts +3 -3
- package/dist/commands/index.js +1 -1
- package/dist/effects/index.d.cts +5 -4
- package/dist/effects/index.d.ts +5 -4
- package/dist/{export-DwnZ_hvQ.d.ts → export-0ZaTK__4.d.ts} +4 -4
- package/dist/{export-41rL6Cne.d.ts → export-C45v6MYq.d.ts} +1 -1
- package/dist/{export-CyJdfP_Z.d.cts → export-D-7WCDJ9.d.cts} +4 -4
- package/dist/{export-D9mXp05Q.d.cts → export-DSdCfd6O.d.cts} +1 -1
- package/dist/grain-BWmGZxP4.d.cts +58 -0
- package/dist/grain-BWmGZxP4.d.ts +58 -0
- package/dist/{helpers-v6GMazzg.d.cts → helpers-Cavy1TB7.d.cts} +21 -1
- package/dist/{helpers-C-RgeyvH.d.ts → helpers-LZQ4cpg4.d.ts} +21 -1
- package/dist/image-editor/index.cjs +695 -677
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +12 -11
- package/dist/image-editor/index.d.ts +12 -11
- package/dist/image-editor/index.js +23 -5
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{opentype-KR_jj6b_.d.cts → opentype-BpIJhGpj.d.cts} +1 -1
- package/dist/{opentype-a1KAW-qs.d.ts → opentype-CyxDScVz.d.ts} +1 -1
- package/dist/paint/index.cjs +21 -3
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +72 -5
- package/dist/paint/index.d.ts +72 -5
- package/dist/paint/index.js +20 -2
- package/dist/paint-editor/index.cjs +171 -171
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +77 -29
- package/dist/paint-editor/index.d.ts +77 -29
- package/dist/paint-editor/index.js +12 -12
- package/dist/{pathfinder-BHS4vQNm.d.cts → pathfinder-BMQEcS0k.d.cts} +2 -2
- package/dist/{pathfinder-BVvTIBMo.d.ts → pathfinder-CQIxubuP.d.ts} +2 -2
- package/dist/{pool-CZQOrSXZ.d.ts → pool-Cynuj89K.d.ts} +1 -1
- package/dist/{pool-FjZZmZ80.d.cts → pool-DedjxDKo.d.cts} +1 -1
- package/dist/{rand-8xbUb6ur.d.ts → rand-COS4_E1g.d.ts} +17 -1
- package/dist/{rand-Cw9VLrVC.d.cts → rand-D1JqpR-p.d.cts} +17 -1
- package/dist/{svg-DTb40ICU.d.cts → svg-RcixtBFR.d.cts} +2 -2
- package/dist/{svg-CSz3mzkw.d.ts → svg-nWBJEpnk.d.ts} +2 -2
- package/dist/{tools-Ca0kI1qo.d.cts → tools-CL82d7nw.d.cts} +1 -1
- package/dist/{tools-B0wXP5cF.d.ts → tools-DrxgDnXY.d.ts} +1 -1
- package/dist/vector/index.cjs +995 -955
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +44 -18
- package/dist/vector/index.d.ts +44 -18
- package/dist/vector/index.js +55 -15
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +5 -4
- package/dist/video-editor/index.d.ts +5 -4
- package/dist/{warp-DTOp0lON.d.cts → warp-CHi_P_G6.d.cts} +1 -1
- package/dist/{warp-pd7hrH4T.d.ts → warp-CPaHULUL.d.ts} +1 -1
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +12 -5
- package/skills/pixerate-vector/SKILL.md +4 -2
- package/dist/brushstrokeRender-2FAXA3XC.js.map +0 -1
- package/dist/brushstrokeRender-IMFY3FF6.cjs.map +0 -1
- package/dist/chunk-2XS6LTUP.cjs.map +0 -1
- package/dist/chunk-3D77LOBM.js.map +0 -1
- package/dist/chunk-5FSRTP6E.js.map +0 -1
- package/dist/chunk-5OOIUXNJ.cjs.map +0 -1
- package/dist/chunk-DFSZO2B5.cjs.map +0 -1
- package/dist/chunk-EQQMGO42.js.map +0 -1
- package/dist/chunk-HUO3TI4C.js.map +0 -1
- package/dist/chunk-KEENUAFN.cjs.map +0 -1
- package/dist/chunk-LSXXAJG3.js.map +0 -1
- package/dist/chunk-QBWEH3IM.cjs.map +0 -1
- /package/dist/{chunk-6S6362D2.js.map → chunk-NI6RORDS.js.map} +0 -0
- /package/dist/{chunk-OIBIRXRG.js.map → chunk-PSPLRQL6.js.map} +0 -0
- /package/dist/{chunk-SYT2TLQF.js.map → chunk-QEIN6JQO.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILTIN_BRUSHES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CPSMARTX.js";
|
|
4
4
|
import {
|
|
5
5
|
parseProvenance
|
|
6
6
|
} from "./chunk-A3BVTI3G.js";
|
|
@@ -44,9 +44,10 @@ import {
|
|
|
44
44
|
} from "./chunk-KHNZ6MOU.js";
|
|
45
45
|
import {
|
|
46
46
|
BrushstrokeCache,
|
|
47
|
+
GRAIN_PATTERNS,
|
|
47
48
|
brushstrokeDataUrl,
|
|
48
49
|
isBrushstrokeBrush
|
|
49
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-PQFVLOMR.js";
|
|
50
51
|
import {
|
|
51
52
|
oklabToRgb,
|
|
52
53
|
rgbToOklab
|
|
@@ -2541,8 +2542,46 @@ function sanitizeVectorBrushstroke(value) {
|
|
|
2541
2542
|
const p = r.pressure.filter((v2) => typeof v2 === "number" && Number.isFinite(v2)).map((v2) => Math.min(1, Math.max(0, v2)));
|
|
2542
2543
|
if (p.length) out.pressure = p.slice(0, 64);
|
|
2543
2544
|
}
|
|
2545
|
+
const seed = sanitizeSeed(r.seed);
|
|
2546
|
+
if (seed !== void 0) out.seed = seed;
|
|
2547
|
+
if (r.paper === null) out.paper = null;
|
|
2548
|
+
else {
|
|
2549
|
+
const paper = sanitizeVectorBrushstrokePaper(r.paper);
|
|
2550
|
+
if (paper) out.paper = paper;
|
|
2551
|
+
}
|
|
2544
2552
|
return out;
|
|
2545
2553
|
}
|
|
2554
|
+
var VECTOR_BRUSHSTROKE_MAX_SEED = 2147483647;
|
|
2555
|
+
var finite2 = (v2) => typeof v2 === "number" && Number.isFinite(v2);
|
|
2556
|
+
var sanitizeSeed = (v2) => finite2(v2) ? Math.min(VECTOR_BRUSHSTROKE_MAX_SEED, Math.max(0, Math.round(v2))) : void 0;
|
|
2557
|
+
function sanitizeVectorBrushstrokePaper(value) {
|
|
2558
|
+
if (!value || typeof value !== "object") return null;
|
|
2559
|
+
const r = value;
|
|
2560
|
+
const out = {};
|
|
2561
|
+
if (typeof r.pattern === "string" && GRAIN_PATTERNS.includes(r.pattern)) out.pattern = r.pattern;
|
|
2562
|
+
const seed = sanitizeSeed(r.seed);
|
|
2563
|
+
if (seed !== void 0) out.seed = seed;
|
|
2564
|
+
if (finite2(r.scale) && r.scale > 0) out.scale = Math.min(8, Math.max(0.25, r.scale));
|
|
2565
|
+
if (finite2(r.depth)) out.depth = Math.min(1, Math.max(0, r.depth));
|
|
2566
|
+
return Object.keys(out).length ? out : null;
|
|
2567
|
+
}
|
|
2568
|
+
function vectorBrushstrokeCharacterError(brush) {
|
|
2569
|
+
if (brush.seed !== void 0 && !(Number.isInteger(brush.seed) && brush.seed >= 0 && brush.seed <= VECTOR_BRUSHSTROKE_MAX_SEED)) return `seed must be an integer from 0 to ${VECTOR_BRUSHSTROKE_MAX_SEED}.`;
|
|
2570
|
+
const paper = brush.paper;
|
|
2571
|
+
if (paper === void 0 || paper === null) return null;
|
|
2572
|
+
if (typeof paper !== "object" || Array.isArray(paper)) return "paper must be an object { pattern, seed, scale, depth } or null for no grain.";
|
|
2573
|
+
const r = paper;
|
|
2574
|
+
const extra = Object.keys(r).filter((k) => !["pattern", "seed", "scale", "depth"].includes(k));
|
|
2575
|
+
if (extra.length) return `paper has unknown field ${extra.map((k) => `"${k}"`).join(", ")}: use pattern, seed, scale, depth.`;
|
|
2576
|
+
if (r.pattern !== void 0 && !GRAIN_PATTERNS.includes(r.pattern)) return `Unknown paper pattern "${String(r.pattern)}": use one of ${GRAIN_PATTERNS.join(", ")}.`;
|
|
2577
|
+
if (r.seed !== void 0 && !(Number.isInteger(r.seed) && r.seed >= 0 && r.seed <= VECTOR_BRUSHSTROKE_MAX_SEED)) return `paper.seed must be an integer from 0 to ${VECTOR_BRUSHSTROKE_MAX_SEED}.`;
|
|
2578
|
+
if (r.scale !== void 0 && !(finite2(r.scale) && r.scale >= 0.25 && r.scale <= 8)) return "paper.scale must be from 0.25 to 8 (1 is the pattern's natural size).";
|
|
2579
|
+
if (r.depth !== void 0 && !(finite2(r.depth) && r.depth >= 0 && r.depth <= 1)) return "paper.depth must be from 0 to 1.";
|
|
2580
|
+
return null;
|
|
2581
|
+
}
|
|
2582
|
+
function randomVectorBrushstrokeSeed() {
|
|
2583
|
+
return Math.floor(Math.random() * VECTOR_BRUSHSTROKE_MAX_SEED);
|
|
2584
|
+
}
|
|
2546
2585
|
function isVectorBrushstrokeLayer(layer) {
|
|
2547
2586
|
return layer.kind === "brushstroke" && !!layer.brush && !!vectorBrushstrokeBrush(layer.brush.brushId);
|
|
2548
2587
|
}
|
|
@@ -2563,6 +2602,8 @@ function vectorBrushstrokeImages(node, layer) {
|
|
|
2563
2602
|
const solid = vectorPaintSolid(layer.paint) ?? "#000000";
|
|
2564
2603
|
const c = parseVectorColor(solid) ?? [0, 0, 0, 1];
|
|
2565
2604
|
const color2 = [c[0] * 255, c[1] * 255, c[2] * 255, c[3] * 255].map(Math.round);
|
|
2605
|
+
const { seed, paper } = layer.brush;
|
|
2606
|
+
const character = seed !== void 0 ? { character: { seed, origin: { x: 0, y: 0 }, unit: 1, ...paper !== void 0 ? { paper } : {} } } : {};
|
|
2566
2607
|
const out = [];
|
|
2567
2608
|
for (const sp of node.subpaths) {
|
|
2568
2609
|
if (sp.anchors.length < 2) continue;
|
|
@@ -2570,7 +2611,7 @@ function vectorBrushstrokeImages(node, layer) {
|
|
|
2570
2611
|
const ring = flattenChain(closeContour(contour, contour.closed), 0.25);
|
|
2571
2612
|
if (contour.closed && ring.length > 2) ring.push(ring[0]);
|
|
2572
2613
|
if (ring.length < 2) continue;
|
|
2573
|
-
const stroke = cache.render({ points: ring.map(([x, y]) => ({ x, y })), ...layer.brush.pressure ? { pressure: layer.brush.pressure } : {} }, brush, { scale: VECTOR_BRUSHSTROKE_SCALE, color: color2, maxPixels: 2048 * 2048 });
|
|
2614
|
+
const stroke = cache.render({ points: ring.map(([x, y]) => ({ x, y })), ...layer.brush.pressure ? { pressure: layer.brush.pressure } : {} }, brush, { scale: VECTOR_BRUSHSTROKE_SCALE, color: color2, maxPixels: 2048 * 2048, ...character });
|
|
2574
2615
|
if (!stroke.bounds) continue;
|
|
2575
2616
|
let href = urls.get(stroke);
|
|
2576
2617
|
if (!href) urls.set(stroke, href = brushstrokeDataUrl(stroke));
|
|
@@ -3453,11 +3494,11 @@ function vectorFrameChildMatrix(resizing, box, from, to) {
|
|
|
3453
3494
|
const sy = box.height > 1e-9 ? (y1 - y0) / box.height : 1;
|
|
3454
3495
|
return [sx, 0, 0, sy, x0 - sx * box.x, y0 - sy * box.y];
|
|
3455
3496
|
}
|
|
3456
|
-
var
|
|
3497
|
+
var finite3 = (v2) => typeof v2 === "number" && Number.isFinite(v2);
|
|
3457
3498
|
function sanitizeVectorFrame(value) {
|
|
3458
3499
|
if (!value || typeof value !== "object") return null;
|
|
3459
3500
|
const r = value;
|
|
3460
|
-
if (!
|
|
3501
|
+
if (!finite3(r.x) || !finite3(r.y) || !finite3(r.width) || !finite3(r.height) || r.width < 0 || r.height < 0) return null;
|
|
3461
3502
|
const out = { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
3462
3503
|
if (typeof r.fill === "string" || r.fill && typeof r.fill === "object") out.fill = r.fill;
|
|
3463
3504
|
if (r.clip === false) out.clip = false;
|
|
@@ -10462,6 +10503,10 @@ export {
|
|
|
10462
10503
|
vectorBrushstrokeBrushes,
|
|
10463
10504
|
vectorBrushstrokeBrush,
|
|
10464
10505
|
sanitizeVectorBrushstroke,
|
|
10506
|
+
VECTOR_BRUSHSTROKE_MAX_SEED,
|
|
10507
|
+
sanitizeVectorBrushstrokePaper,
|
|
10508
|
+
vectorBrushstrokeCharacterError,
|
|
10509
|
+
randomVectorBrushstrokeSeed,
|
|
10465
10510
|
isVectorBrushstrokeLayer,
|
|
10466
10511
|
vectorBrushstrokeReach,
|
|
10467
10512
|
vectorBrushstrokeImages,
|
|
@@ -10772,4 +10817,4 @@ export {
|
|
|
10772
10817
|
lineSubpath,
|
|
10773
10818
|
roundSubpaths
|
|
10774
10819
|
};
|
|
10775
|
-
//# sourceMappingURL=chunk-
|
|
10820
|
+
//# sourceMappingURL=chunk-TJBYBSTN.js.map
|