@pixerate/editor 0.133.0 → 0.135.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 +55 -55
- package/dist/animation-editor/index.d.cts +4 -4
- package/dist/animation-editor/index.d.ts +4 -4
- package/dist/animation-editor/index.js +2 -2
- package/dist/{bezier-DL2wPsFf.d.cts → bezier-J8i4uqSH.d.cts} +1 -1
- package/dist/{bezier-BAGdL89w.d.ts → bezier-lNEOp0Jx.d.ts} +1 -1
- package/dist/canvas/index.d.cts +7 -7
- package/dist/canvas/index.d.ts +7 -7
- package/dist/{chunk-VGZSIXX3.js → chunk-7RJ6P7MI.js} +2 -2
- package/dist/{chunk-AOCFL7L7.js → chunk-ESIWZMMK.js} +2 -2
- package/dist/{chunk-FOBB6AIO.js → chunk-HHTCDFZC.js} +97 -5
- package/dist/chunk-HHTCDFZC.js.map +1 -0
- package/dist/{chunk-6CTZAGZ2.js → chunk-ILYFOJUN.js} +56 -1
- package/dist/chunk-ILYFOJUN.js.map +1 -0
- package/dist/{chunk-2QKUD3E2.cjs → chunk-T6TV6HY6.cjs} +36 -36
- package/dist/{chunk-2QKUD3E2.cjs.map → chunk-T6TV6HY6.cjs.map} +1 -1
- package/dist/{chunk-65GNHOD4.cjs → chunk-YAFS2QFZ.cjs} +82 -82
- package/dist/{chunk-65GNHOD4.cjs.map → chunk-YAFS2QFZ.cjs.map} +1 -1
- package/dist/{chunk-NVTHUPJ6.cjs → chunk-YT3JL7YM.cjs} +71 -16
- package/dist/chunk-YT3JL7YM.cjs.map +1 -0
- package/dist/{chunk-F7GGEAO2.cjs → chunk-Z2H7KECK.cjs} +151 -59
- package/dist/chunk-Z2H7KECK.cjs.map +1 -0
- package/dist/effects/index.d.cts +4 -4
- package/dist/effects/index.d.ts +4 -4
- package/dist/{export-BICOEM9d.d.cts → export-AZSwX087.d.cts} +13 -5
- package/dist/{export-XnuX8FZ2.d.ts → export-BDkyDNM8.d.ts} +13 -5
- package/dist/{export-zB4HITwP.d.ts → export-DMeG6E06.d.ts} +1 -1
- package/dist/{export-CeFplzAW.d.cts → export-KzubBKo7.d.cts} +1 -1
- package/dist/{helpers-cssRNUzH.d.ts → helpers-Coa4e2j_.d.ts} +12 -0
- package/dist/{helpers-BuKdqUlM.d.cts → helpers-DHl28yLO.d.cts} +12 -0
- package/dist/image-editor/index.cjs +739 -647
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +26 -11
- package/dist/image-editor/index.d.ts +26 -11
- package/dist/image-editor/index.js +104 -12
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{opentype-C3iyIFRx.d.cts → opentype-BWR7Qv8W.d.cts} +1 -1
- package/dist/{opentype-DG5Lkwul.d.ts → opentype-Dfcx6wFx.d.ts} +1 -1
- package/dist/paint/index.cjs +10 -2
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +2 -2
- package/dist/paint/index.d.ts +2 -2
- package/dist/paint/index.js +9 -1
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.d.cts +7 -7
- package/dist/paint-editor/index.d.ts +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/{pathfinder-DKLt4UDG.d.ts → pathfinder-Celbi3e6.d.ts} +1 -1
- package/dist/{pathfinder-8vXik95z.d.cts → pathfinder-D8KQ6blQ.d.cts} +1 -1
- package/dist/{pool-C69pkWRz.d.ts → pool-8JZGWHvR.d.ts} +1 -1
- package/dist/{pool-VAWcYUbs.d.cts → pool-BfuxBKTd.d.cts} +1 -1
- package/dist/{rand-BaqEOs1Y.d.ts → rand-BszBST4s.d.ts} +31 -1
- package/dist/{rand-DdpFzCo6.d.cts → rand-DOH_aMvm.d.cts} +31 -1
- package/dist/{svg-CEYpvsgH.d.ts → svg-CxxqG3_W.d.ts} +2 -2
- package/dist/{svg-BThlZmja.d.cts → svg-pwXWq6s2.d.cts} +2 -2
- package/dist/{tools-CRnZJXXr.d.cts → tools-3EBjR91b.d.cts} +1 -1
- package/dist/{tools-CVGqEpO8.d.ts → tools-y1M6O3UT.d.ts} +1 -1
- package/dist/vector/index.cjs +1292 -1035
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +183 -91
- package/dist/vector/index.d.ts +183 -91
- package/dist/vector/index.js +267 -10
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +4 -4
- package/dist/video-editor/index.d.ts +4 -4
- package/dist/{warp-mKylbLiF.d.ts → warp-C1gwu2G_.d.ts} +1 -1
- package/dist/{warp-ChcFDdlT.d.cts → warp-Ceqdz7kj.d.cts} +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +4 -4
- package/skills/pixerate-vector/SKILL.md +18 -54
- package/skills/pixerate-vector/references/pitfalls.md +62 -0
- package/dist/chunk-6CTZAGZ2.js.map +0 -1
- package/dist/chunk-F7GGEAO2.cjs.map +0 -1
- package/dist/chunk-FOBB6AIO.js.map +0 -1
- package/dist/chunk-NVTHUPJ6.cjs.map +0 -1
- /package/dist/{chunk-VGZSIXX3.js.map → chunk-7RJ6P7MI.js.map} +0 -0
- /package/dist/{chunk-AOCFL7L7.js.map → chunk-ESIWZMMK.js.map} +0 -0
|
@@ -3206,10 +3206,11 @@ var drawnCache = /* @__PURE__ */ new WeakMap();
|
|
|
3206
3206
|
function vectorFrameDrawn(node) {
|
|
3207
3207
|
let hit = drawnCache.get(node);
|
|
3208
3208
|
if (hit) return hit;
|
|
3209
|
-
const { frame, ...group } = node;
|
|
3209
|
+
const { frame, masterArt, ...group } = node;
|
|
3210
3210
|
const rect = vectorFrameRectPath(frame);
|
|
3211
|
+
const below = masterArt ?? [];
|
|
3211
3212
|
const fill = frame.fill !== void 0 && frame.fill !== null && frame.fill !== "none" ? [{ id: `${node.id}~frame-fill`, type: "path", fill: frame.fill, stroke: null, subpaths: rect }] : [];
|
|
3212
|
-
hit = frame.clip === false ? { ...group, children: [...fill, ...node.children] } : { ...group, mask: { type: "clip" }, children: [{ id: `${node.id}~frame-clip`, type: "path", fill: "#000000", stroke: null, subpaths: rect }, ...fill, ...node.children] };
|
|
3213
|
+
hit = frame.clip === false ? { ...group, children: [...fill, ...below, ...node.children] } : { ...group, mask: { type: "clip" }, children: [{ id: `${node.id}~frame-clip`, type: "path", fill: "#000000", stroke: null, subpaths: rect }, ...fill, ...below, ...node.children] };
|
|
3213
3214
|
drawnCache.set(node, hit);
|
|
3214
3215
|
return hit;
|
|
3215
3216
|
}
|
|
@@ -3254,6 +3255,8 @@ function sanitizeVectorFrame(value) {
|
|
|
3254
3255
|
const out = { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
3255
3256
|
if (typeof r.fill === "string" || r.fill && typeof r.fill === "object") out.fill = r.fill;
|
|
3256
3257
|
if (r.clip === false) out.clip = false;
|
|
3258
|
+
if (r.master === true) out.master = true;
|
|
3259
|
+
if (typeof r.masterId === "string" && r.masterId) out.masterId = r.masterId;
|
|
3257
3260
|
return out;
|
|
3258
3261
|
}
|
|
3259
3262
|
function sanitizeVectorResizing(value) {
|
|
@@ -7532,6 +7535,84 @@ function vectorEnteredGroups(nodes, ids) {
|
|
|
7532
7535
|
return out;
|
|
7533
7536
|
}
|
|
7534
7537
|
|
|
7538
|
+
// src/vector/pages.ts
|
|
7539
|
+
function isVectorMasterPage(node) {
|
|
7540
|
+
return isVectorFrame(node) && !!node.frame.master;
|
|
7541
|
+
}
|
|
7542
|
+
function vectorPages(doc) {
|
|
7543
|
+
return doc.nodes.filter((n) => isVectorFrame(n) && !n.frame.master);
|
|
7544
|
+
}
|
|
7545
|
+
function vectorMasterPages(doc) {
|
|
7546
|
+
return doc.nodes.filter(isVectorMasterPage);
|
|
7547
|
+
}
|
|
7548
|
+
function fillTokens(node, page, pages) {
|
|
7549
|
+
const map = (s) => s.replace(/\{page\}/g, String(page)).replace(/\{pages\}/g, String(pages));
|
|
7550
|
+
if (!/\{pages?\}/.test(node.text)) return node;
|
|
7551
|
+
if (!node.runs?.length) return { ...node, text: map(node.text) };
|
|
7552
|
+
let at2 = 0;
|
|
7553
|
+
let text = "";
|
|
7554
|
+
const runs = [];
|
|
7555
|
+
for (const r of node.runs) {
|
|
7556
|
+
const part = map(node.text.slice(at2, at2 + r.length));
|
|
7557
|
+
at2 += r.length;
|
|
7558
|
+
text += part;
|
|
7559
|
+
runs.push({ ...r, length: part.length });
|
|
7560
|
+
}
|
|
7561
|
+
return { ...node, text: text + map(node.text.slice(at2)), runs };
|
|
7562
|
+
}
|
|
7563
|
+
function onPage(node, pageId, page, pages) {
|
|
7564
|
+
const id = `${pageId}~master~${node.id}`;
|
|
7565
|
+
if (node.type === "group") return { ...node, id, children: node.children.map((c) => onPage(c, pageId, page, pages)) };
|
|
7566
|
+
if (node.type === "text") return { ...fillTokens(node, page, pages), id, locked: true };
|
|
7567
|
+
return { ...node, id, locked: true };
|
|
7568
|
+
}
|
|
7569
|
+
var artCache = /* @__PURE__ */ new WeakMap();
|
|
7570
|
+
function vectorMasterArt(master, page, number, count) {
|
|
7571
|
+
const f = page.frame;
|
|
7572
|
+
const key = `${page.id}|${f.x}|${f.y}|${f.width}|${f.height}|${number}|${count}`;
|
|
7573
|
+
let byKey = artCache.get(master);
|
|
7574
|
+
const hit = byKey?.get(key);
|
|
7575
|
+
if (hit) return hit;
|
|
7576
|
+
const art = master.children.filter((c) => c.visible !== false).map((c) => {
|
|
7577
|
+
const box = vectorNodeBounds(c);
|
|
7578
|
+
const m = box ? vectorFrameChildMatrix(c.resizing, box, master.frame, page.frame) : null;
|
|
7579
|
+
return onPage(m ? transformVectorNode(c, m) : c, page.id, number, count);
|
|
7580
|
+
});
|
|
7581
|
+
if (!byKey) artCache.set(master, byKey = /* @__PURE__ */ new Map());
|
|
7582
|
+
byKey.set(key, art);
|
|
7583
|
+
return art;
|
|
7584
|
+
}
|
|
7585
|
+
function resolveVectorMasterPages(doc) {
|
|
7586
|
+
const masters = new Map(vectorMasterPages(doc).map((m) => [m.id, m]));
|
|
7587
|
+
const pages = vectorPages(doc);
|
|
7588
|
+
const numbers = new Map(pages.map((p, i) => [p.id, i + 1]));
|
|
7589
|
+
let changed = false;
|
|
7590
|
+
const nodes = doc.nodes.map((n) => {
|
|
7591
|
+
if (!isVectorFrame(n)) return n;
|
|
7592
|
+
const master = !n.frame.master && n.frame.masterId ? masters.get(n.frame.masterId) : void 0;
|
|
7593
|
+
const art = master ? vectorMasterArt(master, n, numbers.get(n.id) ?? 0, pages.length) : void 0;
|
|
7594
|
+
if (art === n.masterArt || !art && !n.masterArt) return n;
|
|
7595
|
+
changed = true;
|
|
7596
|
+
if (!art) {
|
|
7597
|
+
const { masterArt: _m, ...rest } = n;
|
|
7598
|
+
return rest;
|
|
7599
|
+
}
|
|
7600
|
+
return { ...n, masterArt: art };
|
|
7601
|
+
});
|
|
7602
|
+
return changed ? { ...doc, nodes } : doc;
|
|
7603
|
+
}
|
|
7604
|
+
function stripVectorMasterArt(doc) {
|
|
7605
|
+
if (!doc.nodes.some((n) => n.type === "group" && n.masterArt)) return doc;
|
|
7606
|
+
return {
|
|
7607
|
+
...doc,
|
|
7608
|
+
nodes: doc.nodes.map((n) => {
|
|
7609
|
+
if (n.type !== "group" || !n.masterArt) return n;
|
|
7610
|
+
const { masterArt: _m, ...rest } = n;
|
|
7611
|
+
return rest;
|
|
7612
|
+
})
|
|
7613
|
+
};
|
|
7614
|
+
}
|
|
7615
|
+
|
|
7535
7616
|
// src/vector/connectors.ts
|
|
7536
7617
|
var SIDES = ["top", "right", "bottom", "left", "center"];
|
|
7537
7618
|
function isVectorConnector(node) {
|
|
@@ -8145,7 +8226,7 @@ function blendFromAttribute(value, m) {
|
|
|
8145
8226
|
return out;
|
|
8146
8227
|
}
|
|
8147
8228
|
function vectorDocumentToSvg(doc, options = {}) {
|
|
8148
|
-
doc = resolveVectorLenses(resolveVectorSymbols(doc));
|
|
8229
|
+
doc = resolveVectorLenses(resolveVectorMasterPages(resolveVectorSymbols(doc)));
|
|
8149
8230
|
const precision = options.precision ?? 3;
|
|
8150
8231
|
const prefix = options.idPrefix ?? "vg-";
|
|
8151
8232
|
const pretty = options.pretty !== false;
|
|
@@ -8406,6 +8487,11 @@ function vectorDocumentToSvg(doc, options = {}) {
|
|
|
8406
8487
|
ref = ` clip-path="url(#${escapeAttr2(id)})"`;
|
|
8407
8488
|
}
|
|
8408
8489
|
lines.push(`${indent(depth + 1)}<g data-vector-part="frame-contents"${ref}>`);
|
|
8490
|
+
if (node.masterArt?.length) {
|
|
8491
|
+
lines.push(`${indent(depth + 2)}<g data-vector-part="frame-master">`);
|
|
8492
|
+
for (const child of node.masterArt) emit2(child, depth + 3);
|
|
8493
|
+
lines.push(`${indent(depth + 2)}</g>`);
|
|
8494
|
+
}
|
|
8409
8495
|
for (const child of node.children) emit2(child, depth + 2);
|
|
8410
8496
|
lines.push(`${indent(depth + 1)}</g>`);
|
|
8411
8497
|
lines.push(`${indent(depth)}</g>`);
|
|
@@ -9227,7 +9313,7 @@ function parseVectorSvg(svg, options = {}) {
|
|
|
9227
9313
|
const raw = parseJson(g.attrs["data-vector-frame"]);
|
|
9228
9314
|
const frame = sanitizeVectorFrame(raw);
|
|
9229
9315
|
const contentsEl = g.children.find((c) => c.name === "g" && c.attrs["data-vector-part"] === "frame-contents");
|
|
9230
|
-
const children = contentsEl ? visit2(contentsEl, style, m) : [];
|
|
9316
|
+
const children = contentsEl ? visit2({ ...contentsEl, children: contentsEl.children.filter((c) => c.attrs["data-vector-part"] !== "frame-master") }, style, m) : [];
|
|
9231
9317
|
const id = idFor(g);
|
|
9232
9318
|
if (!frame) return children.length ? { id, type: "group", ...meta, children } : null;
|
|
9233
9319
|
const { rigid, residual } = decomposeRigid(m);
|
|
@@ -10508,6 +10594,12 @@ export {
|
|
|
10508
10594
|
sanitizeVectorEffects,
|
|
10509
10595
|
transformVectorEffects,
|
|
10510
10596
|
vectorEnteredGroups,
|
|
10597
|
+
isVectorMasterPage,
|
|
10598
|
+
vectorPages,
|
|
10599
|
+
vectorMasterPages,
|
|
10600
|
+
vectorMasterArt,
|
|
10601
|
+
resolveVectorMasterPages,
|
|
10602
|
+
stripVectorMasterArt,
|
|
10511
10603
|
isVectorConnector,
|
|
10512
10604
|
vectorConnectionSites,
|
|
10513
10605
|
nearestVectorConnectionSite,
|
|
@@ -10582,4 +10674,4 @@ export {
|
|
|
10582
10674
|
lineSubpath,
|
|
10583
10675
|
roundSubpaths
|
|
10584
10676
|
};
|
|
10585
|
-
//# sourceMappingURL=chunk-
|
|
10677
|
+
//# sourceMappingURL=chunk-HHTCDFZC.js.map
|