@pixerate/editor 0.281.0 → 0.282.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 +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/brushes/index.cjs +76 -71
- package/dist/brushes/index.js +13 -8
- package/dist/brushes/schema.d.cts +1 -0
- package/dist/brushes/schema.d.ts +1 -0
- package/dist/brushes/types.d.cts +29 -3
- package/dist/brushes/types.d.ts +29 -3
- package/dist/{brushstrokeRender-EIK3625T.js → brushstrokeRender-4MA5CBW3.js} +3 -3
- package/dist/{brushstrokeRender-7HOMKZNO.cjs → brushstrokeRender-JVKVKWDA.cjs} +15 -15
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-NJDEKU5D.js → chunk-2YGYYVSG.js} +1 -1
- package/dist/{chunk-JVFGK3DK.cjs → chunk-3JUKN3RM.cjs} +76 -53
- package/dist/{chunk-HN57I7KT.js → chunk-CG3FBNXE.js} +1 -1
- package/dist/{chunk-WFSYZO5Z.cjs → chunk-DFZ4I7EZ.cjs} +1 -1
- package/dist/{chunk-LZE2QZCT.js → chunk-IHMMHZGP.js} +1 -1
- package/dist/{chunk-K4ANWBF7.cjs → chunk-IJQ2YH2M.cjs} +35 -35
- package/dist/{chunk-HRUK5TFW.cjs → chunk-IUKPQCYQ.cjs} +164 -71
- package/dist/{chunk-WCC4NXWY.cjs → chunk-JD63B33V.cjs} +86 -86
- package/dist/{chunk-NJLPW4MM.js → chunk-KV7QHPKL.js} +27 -4
- package/dist/{chunk-H3EME3S5.cjs → chunk-MRIAR5DY.cjs} +2 -2
- package/dist/{chunk-ROURHJYT.js → chunk-NEDS6DSC.js} +1 -1
- package/dist/{chunk-FKO3CY2C.js → chunk-ULPXJ3NB.js} +1 -1
- package/dist/{chunk-WZYRYYXN.cjs → chunk-UOM5S4W5.cjs} +12 -12
- package/dist/{chunk-YOM76H2V.js → chunk-VEX6YVNG.js} +1 -1
- package/dist/{chunk-MNHP3AQT.cjs → chunk-WEXWDBUF.cjs} +23 -23
- package/dist/{chunk-PPDUCZZV.js → chunk-YRGTQLDN.js} +122 -29
- package/dist/image-editor/index.cjs +788 -788
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/antimatter.d.cts +154 -0
- package/dist/paint-editor/antimatter.d.ts +154 -0
- package/dist/paint-editor/brush-controls.d.cts +1 -0
- package/dist/paint-editor/brush-controls.d.ts +1 -0
- package/dist/paint-editor/brush-model.d.cts +9 -5
- package/dist/paint-editor/brush-model.d.ts +9 -5
- package/dist/paint-editor/controller.d.cts +23 -0
- package/dist/paint-editor/controller.d.ts +23 -0
- package/dist/paint-editor/index.cjs +1931 -891
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +1098 -58
- package/dist/paint-editor/mark-settings.d.cts +30 -0
- package/dist/paint-editor/mark-settings.d.ts +30 -0
- package/dist/paint-editor/stroke.d.cts +16 -0
- package/dist/paint-editor/stroke.d.ts +16 -0
- package/dist/paint-editor/strokes.d.cts +2 -0
- package/dist/paint-editor/strokes.d.ts +2 -0
- package/dist/paint-editor/ui.d.cts +4 -2
- package/dist/paint-editor/ui.d.ts +4 -2
- package/dist/vector/index.cjs +999 -999
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +8 -2
- package/skills/pixerate-paint-editor/references/antimatter.md +49 -0
- package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
|
@@ -28,7 +28,7 @@ var _chunkPFHJS4HEcjs = require('./chunk-PFHJS4HE.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkIUKPQCYQcjs = require('./chunk-IUKPQCYQ.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
@@ -39,7 +39,7 @@ var _chunkXFM3OCHUcjs = require('./chunk-XFM3OCHU.cjs');
|
|
|
39
39
|
// src/brushes/patch.ts
|
|
40
40
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
41
41
|
var copy = (v) => JSON.parse(JSON.stringify(v));
|
|
42
|
-
var FACETS =
|
|
42
|
+
var FACETS = _chunkIUKPQCYQcjs.BRUSH_JSON_SCHEMA.properties;
|
|
43
43
|
var BRUSH_PATCH_PROPERTIES = (() => {
|
|
44
44
|
const { id: _id, name: _name, ...rest } = FACETS;
|
|
45
45
|
const { required: _r, ...tip } = rest.tip;
|
|
@@ -47,7 +47,7 @@ var BRUSH_PATCH_PROPERTIES = (() => {
|
|
|
47
47
|
description: "Liquid ferrofluid paint: 0..1 (amount), or { amount, wavelength, threshold }. Rises into glossy Rosensweig spikes near magnets until cured.",
|
|
48
48
|
anyOf: [
|
|
49
49
|
{ type: "number", minimum: 0, maximum: 1, description: "How much liquid ferrofluid the brush lays per dab (0..1)." },
|
|
50
|
-
|
|
50
|
+
_chunkIUKPQCYQcjs.BRUSH_FACET_SCHEMAS.ferro
|
|
51
51
|
]
|
|
52
52
|
};
|
|
53
53
|
return { ...rest, tip: { ...tip, description: `${tip.description} In a patch, shape may be left out to keep it.` }, ferro };
|
|
@@ -567,7 +567,7 @@ function idMaker(prefix) {
|
|
|
567
567
|
return (name) => {
|
|
568
568
|
const base = `${prefix}-${slug(name, 20) || "brush"}`.slice(0, 58).replace(/-+$/, "");
|
|
569
569
|
let id = base;
|
|
570
|
-
for (let n = 2; used.has(id) || !
|
|
570
|
+
for (let n = 2; used.has(id) || !_chunkIUKPQCYQcjs.BRUSH_ID.test(id); n++) id = `${base}-${n}`;
|
|
571
571
|
used.add(id);
|
|
572
572
|
return id;
|
|
573
573
|
};
|
|
@@ -592,9 +592,9 @@ function readAbrPack(bytes, name, prefix, licence, pack) {
|
|
|
592
592
|
return;
|
|
593
593
|
}
|
|
594
594
|
try {
|
|
595
|
-
const source =
|
|
595
|
+
const source = _chunkIUKPQCYQcjs.brushSourceFromMask.call(void 0, { id: `${brushId}-shape`, name: label, licence, origin: `${name}.abr` }, tip.width, tip.height, tip.mask);
|
|
596
596
|
pack.sources.push(source);
|
|
597
|
-
pack.brushes.push({ ...base, tip: { shape: "stamp", size: clamp2(Math.max(tip.width, tip.height), 1, 2500), spacing: _nullishCoalesce(tip.spacing, () => ( 0.25)), stamps: [
|
|
597
|
+
pack.brushes.push({ ...base, tip: { shape: "stamp", size: clamp2(Math.max(tip.width, tip.height), 1, 2500), spacing: _nullishCoalesce(tip.spacing, () => ( 0.25)), stamps: [_chunkIUKPQCYQcjs.brushSourceRef.call(void 0, source.id)] } });
|
|
598
598
|
} catch (e) {
|
|
599
599
|
pack.unsupported.push(`"${label}": ${e.message}`);
|
|
600
600
|
}
|
|
@@ -636,7 +636,7 @@ function readProcreatePack(bytes, name, prefix, licence, pack) {
|
|
|
636
636
|
const e = byName.get(`${dir}${file}`);
|
|
637
637
|
if (!e) return null;
|
|
638
638
|
try {
|
|
639
|
-
const s =
|
|
639
|
+
const s = _chunkIUKPQCYQcjs.makeBrushSource.call(void 0, { id: `${brushId}-${kind}`, name: `${label} ${kind}`, image: e.read(), channel: "lightness", licence: [licence, terms].filter(Boolean).join("\n\n") || void 0, origin: `${where}/${file}` });
|
|
640
640
|
pack.sources.push(s);
|
|
641
641
|
return s;
|
|
642
642
|
} catch (err) {
|
|
@@ -657,8 +657,8 @@ function readProcreatePack(bytes, name, prefix, licence, pack) {
|
|
|
657
657
|
shape: shape ? "stamp" : "round",
|
|
658
658
|
size: 40,
|
|
659
659
|
...plot !== void 0 ? { spacing: plot } : {},
|
|
660
|
-
...shape ? { stamps: [
|
|
661
|
-
...grain ? { grain: { source:
|
|
660
|
+
...shape ? { stamps: [_chunkIUKPQCYQcjs.brushSourceRef.call(void 0, shape.id)] } : {},
|
|
661
|
+
...grain ? { grain: { source: _chunkIUKPQCYQcjs.brushSourceRef.call(void 0, grain.id), mode: "moving" } } : {}
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
if (!settings) pack.unsupported.push(`"${label}": its Brush.archive could not be read; the brush takes its name from the file and default settings.`);
|
|
@@ -712,17 +712,17 @@ async function importBrushFile(library, file, options = {}) {
|
|
|
712
712
|
// src/brushes/tools.ts
|
|
713
713
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
714
714
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
715
|
-
var FACETS2 =
|
|
715
|
+
var FACETS2 = _chunkIUKPQCYQcjs.BRUSH_JSON_SCHEMA.properties;
|
|
716
716
|
var ID = { type: "string", pattern: String(FACETS2.id.pattern), description: "Brush id from list_brush_presets (lowercase letters, digits and dashes)." };
|
|
717
717
|
var FACET_PROPS = BRUSH_PATCH_PROPERTIES;
|
|
718
|
-
var HOSTS = Object.keys(
|
|
718
|
+
var HOSTS = Object.keys(_chunkIUKPQCYQcjs.BRUSH_HOST_PROFILES);
|
|
719
719
|
var copy2 = (v) => JSON.parse(JSON.stringify(v));
|
|
720
720
|
var merge = mergeBrushPatch;
|
|
721
721
|
var changedPaths = changedBrushPaths;
|
|
722
722
|
function summary(entry, profile, withCheck) {
|
|
723
723
|
const b = entry.brush;
|
|
724
|
-
const engine =
|
|
725
|
-
const check = withCheck ?
|
|
724
|
+
const engine = _chunkIUKPQCYQcjs.resolveEngine.call(void 0, b);
|
|
725
|
+
const check = withCheck ? _chunkIUKPQCYQcjs.checkBrush.call(void 0, b, profile) : null;
|
|
726
726
|
return {
|
|
727
727
|
id: b.id,
|
|
728
728
|
name: b.name,
|
|
@@ -731,7 +731,7 @@ function summary(entry, profile, withCheck) {
|
|
|
731
731
|
...b.medium ? { medium: b.medium } : {},
|
|
732
732
|
...b.variety ? { variety: b.variety } : {},
|
|
733
733
|
...b.tool ? { tool: b.tool } : {},
|
|
734
|
-
category:
|
|
734
|
+
category: _chunkIUKPQCYQcjs.resolveCategory.call(void 0, b, engine),
|
|
735
735
|
engine,
|
|
736
736
|
tip: b.tip.shape,
|
|
737
737
|
...b.tip.size !== void 0 ? { size: b.tip.size } : {},
|
|
@@ -746,33 +746,33 @@ function summary(entry, profile, withCheck) {
|
|
|
746
746
|
var refusal = (check, host) => `${host.name} can't use this brush: ${check.issues.filter((i) => i.severity === "error").map((i) => `${i.facet}: ${i.reason} ${i.fix}`).join(" ")} (check_brush lists every issue; nothing was saved.)`;
|
|
747
747
|
var warnings = (check) => check.issues.filter((i) => i.severity === "warning");
|
|
748
748
|
function createBrushLibraryTools(library, options = {}) {
|
|
749
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
749
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkIUKPQCYQcjs.PAINT_PROFILE));
|
|
750
750
|
const hostOf = (id) => {
|
|
751
751
|
if (id === void 0) return profile;
|
|
752
|
-
const p =
|
|
753
|
-
if (!p) throw new (0,
|
|
752
|
+
const p = _chunkIUKPQCYQcjs.BRUSH_HOST_PROFILES[id];
|
|
753
|
+
if (!p) throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", `No host "${id}"; use one of: ${HOSTS.join(", ")}.`);
|
|
754
754
|
return p;
|
|
755
755
|
};
|
|
756
756
|
const entry = async (id) => {
|
|
757
757
|
const found = await library.get(id);
|
|
758
758
|
if (found) return found;
|
|
759
759
|
const ids = (await library.list()).map((e) => e.brush.id);
|
|
760
|
-
throw new (0,
|
|
760
|
+
throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("unknown_brush", `No brush "${id}". ${_chunkIUKPQCYQcjs.closest.call(void 0, id, ids)}list_brush_presets lists them.`);
|
|
761
761
|
};
|
|
762
762
|
const checkFor = async (brush, p) => {
|
|
763
|
-
const check2 =
|
|
763
|
+
const check2 = _chunkIUKPQCYQcjs.checkBrush.call(void 0, brush, p);
|
|
764
764
|
const issues = [...check2.issues];
|
|
765
765
|
const refs = [...(_nullishCoalesce(brush.tip.stamps, () => ( []))).map((r) => ["tip.stamps", r]), ...brush.tip.grain ? [["tip.grain.source", brush.tip.grain.source]] : []];
|
|
766
766
|
for (const [facet, ref] of refs) {
|
|
767
|
-
const id =
|
|
767
|
+
const id = _chunkIUKPQCYQcjs.brushSourceIdOf.call(void 0, ref);
|
|
768
768
|
if (id === null || await library.getSource(id)) continue;
|
|
769
769
|
const ids = (await library.listSources()).map((x) => x.id);
|
|
770
|
-
issues.push({ facet, severity: "error", reason: `There is no image source "${id}" in the brush library. ${
|
|
770
|
+
issues.push({ facet, severity: "error", reason: `There is no image source "${id}" in the brush library. ${_chunkIUKPQCYQcjs.closest.call(void 0, id, ids)}`.trim(), fix: "Add it with add_brush_source, or use a ref list_brush_sources lists." });
|
|
771
771
|
}
|
|
772
772
|
const provider = _optionalChain([options, 'access', _26 => _26.stickers, 'optionalCall', _27 => _27()]);
|
|
773
773
|
if (!provider || brush.tip.shape !== "stamp") return { ok: !issues.some((i) => i.severity === "error"), issues };
|
|
774
774
|
for (const ref of _nullishCoalesce(brush.tip.stamps, () => ( []))) {
|
|
775
|
-
if (ref.startsWith("editor:") ||
|
|
775
|
+
if (ref.startsWith("editor:") || _chunkIUKPQCYQcjs.isBrushSourceRef.call(void 0, ref)) continue;
|
|
776
776
|
try {
|
|
777
777
|
await _chunkPFHJS4HEcjs.describeStickerRef.call(void 0, provider, ref);
|
|
778
778
|
} catch (e) {
|
|
@@ -785,12 +785,12 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
785
785
|
const problems = [];
|
|
786
786
|
let brush;
|
|
787
787
|
try {
|
|
788
|
-
brush =
|
|
788
|
+
brush = _chunkIUKPQCYQcjs.normalizeBrushSpec.call(void 0, raw, problems);
|
|
789
789
|
} catch (e) {
|
|
790
|
-
throw new (0,
|
|
790
|
+
throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", e.message);
|
|
791
791
|
}
|
|
792
|
-
const check2 =
|
|
793
|
-
if (!check2.ok) throw new (0,
|
|
792
|
+
const check2 = _chunkIUKPQCYQcjs.withKeptIssues.call(void 0, await checkFor(brush, profile), original ? await checkFor(original, profile) : null);
|
|
793
|
+
if (!check2.ok) throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", refusal(check2, profile));
|
|
794
794
|
const saved = await library.save(brush, { overwrite });
|
|
795
795
|
return { ...saved, problems, check: check2 };
|
|
796
796
|
};
|
|
@@ -801,10 +801,10 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
801
801
|
inputSchema: {
|
|
802
802
|
type: "object",
|
|
803
803
|
properties: {
|
|
804
|
-
kind: { type: "string", enum: [...
|
|
805
|
-
medium: { type: "string", enum: [...
|
|
804
|
+
kind: { type: "string", enum: [..._chunkIUKPQCYQcjs.BRUSH_KINDS], description: "mark (lays a material) or tool (works on paint already down)." },
|
|
805
|
+
medium: { type: "string", enum: [..._chunkIUKPQCYQcjs.BRUSH_MEDIA], description: "Marks laying this medium." },
|
|
806
806
|
variety: { type: "string", maxLength: 40, description: "This variety (oil, watercolor, pencil, highlighter\u2026)." },
|
|
807
|
-
tool: { type: "string", enum: [...
|
|
807
|
+
tool: { type: "string", enum: [..._chunkIUKPQCYQcjs.BRUSH_TOOLS], description: "Tools that do this." },
|
|
808
808
|
tag: { type: "string", maxLength: 40, description: "Brushes with this tag." },
|
|
809
809
|
text: { type: "string", maxLength: 200, description: "Words in the id, name, description, variety or tags (each word must match the start of one)." },
|
|
810
810
|
source: { type: "string", enum: ["all", "builtin", "user"], description: "all (default), builtin presets only, or user (saved) brushes only." },
|
|
@@ -831,8 +831,8 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
831
831
|
annotations: { title: "Describe a brush", ...READ },
|
|
832
832
|
handler: async ({ id }) => {
|
|
833
833
|
const e = await entry(id);
|
|
834
|
-
const engine =
|
|
835
|
-
return { brush: e.brush, builtin: e.builtin, engine, category:
|
|
834
|
+
const engine = _chunkIUKPQCYQcjs.resolveEngine.call(void 0, e.brush);
|
|
835
|
+
return { brush: e.brush, builtin: e.builtin, engine, category: _chunkIUKPQCYQcjs.resolveCategory.call(void 0, e.brush, engine), check: await checkFor(e.brush, profile) };
|
|
836
836
|
}
|
|
837
837
|
};
|
|
838
838
|
const check = {
|
|
@@ -850,20 +850,20 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
850
850
|
},
|
|
851
851
|
annotations: { title: "Check a brush for a host", ...READ },
|
|
852
852
|
handler: async ({ id, brush, host }) => {
|
|
853
|
-
if (id === void 0 === (brush === void 0)) throw new (0,
|
|
853
|
+
if (id === void 0 === (brush === void 0)) throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", "Give either id (a library brush) or brush (a spec), not both or neither.");
|
|
854
854
|
const p = hostOf(host);
|
|
855
855
|
let b;
|
|
856
856
|
const problems = [];
|
|
857
857
|
if (id !== void 0) b = (await entry(id)).brush;
|
|
858
858
|
else {
|
|
859
859
|
try {
|
|
860
|
-
b =
|
|
860
|
+
b = _chunkIUKPQCYQcjs.normalizeBrushSpec.call(void 0, brush, problems);
|
|
861
861
|
} catch (e) {
|
|
862
|
-
throw new (0,
|
|
862
|
+
throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", e.message);
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
const result = await checkFor(b, p);
|
|
866
|
-
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded:
|
|
866
|
+
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded: _chunkIUKPQCYQcjs.degrade.call(void 0, b, p) } : {} };
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
869
|
const exportTool = {
|
|
@@ -898,7 +898,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
898
898
|
});
|
|
899
899
|
const start = _nullishCoalesce(offset, () => ( 0));
|
|
900
900
|
const page = found.slice(start, start + (_nullishCoalesce(limit, () => ( 100))));
|
|
901
|
-
return { total: found.length, sources: page.map((x) => ({ ...
|
|
901
|
+
return { total: found.length, sources: page.map((x) => ({ ..._chunkIUKPQCYQcjs.summarizeBrushSource.call(void 0, x), usedBy: brushes.filter((b) => _chunkIUKPQCYQcjs.brushSourceIds.call(void 0, b).includes(x.id)).map((b) => b.id) })) };
|
|
902
902
|
}
|
|
903
903
|
};
|
|
904
904
|
const tools = [list, describe, check, exportTool, listSources];
|
|
@@ -949,12 +949,12 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
949
949
|
},
|
|
950
950
|
annotations: { title: "Save a new brush", ...WRITE },
|
|
951
951
|
handler: async ({ basedOn, ...spec }) => {
|
|
952
|
-
if (library.isBuiltin(spec.id)) throw new (0,
|
|
953
|
-
if (await library.get(spec.id)) throw new (0,
|
|
952
|
+
if (library.isBuiltin(spec.id)) throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("builtin", `"${spec.id}" is a built-in brush id; pick another id (or basedOn "${spec.id}" with a new id).`);
|
|
953
|
+
if (await library.get(spec.id)) throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("exists", `A brush "${spec.id}" exists already; pick another id, or change it with update_brush.`);
|
|
954
954
|
const base = basedOn !== void 0 ? (await entry(basedOn)).brush : void 0;
|
|
955
955
|
const raw = base ? merge(base, spec) : spec;
|
|
956
956
|
const saved = await store(raw, false);
|
|
957
|
-
return { id: saved.brush.id, brush: saved.brush, engine:
|
|
957
|
+
return { id: saved.brush.id, brush: saved.brush, engine: _chunkIUKPQCYQcjs.resolveEngine.call(void 0, saved.brush), problems: saved.problems, warnings: warnings(saved.check) };
|
|
958
958
|
}
|
|
959
959
|
},
|
|
960
960
|
{
|
|
@@ -975,7 +975,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
975
975
|
annotations: { title: "Update a brush", ...WRITE, idempotentHint: true },
|
|
976
976
|
handler: async ({ id, unset, ...patch }) => {
|
|
977
977
|
const e = await entry(id);
|
|
978
|
-
if (e.builtin) throw new (0,
|
|
978
|
+
if (e.builtin) throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("builtin", `"${id}" is a built-in brush and can't be changed; duplicate_brush makes a copy you can change.`);
|
|
979
979
|
const base = copy2(e.brush);
|
|
980
980
|
for (const k of _nullishCoalesce(unset, () => ( []))) delete base[k];
|
|
981
981
|
const saved = await store(merge(base, { ...patch, id }), true, e.brush);
|
|
@@ -985,14 +985,14 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
985
985
|
{
|
|
986
986
|
name: "add_brush_source",
|
|
987
987
|
title: "Add a brush image source",
|
|
988
|
-
description: `Adds an image to the brush library as a source for image tips and image grain (as Procreate's shape and grain sources). The image is a PNG data: URL; the marks are read from its transparency, its dark parts (a scan of marks on paper) or its light parts (white on black), as channel says, and kept as a grey mask at most ${
|
|
988
|
+
description: `Adds an image to the brush library as a source for image tips and image grain (as Procreate's shape and grain sources). The image is a PNG data: URL; the marks are read from its transparency, its dark parts (a scan of marks on paper) or its light parts (white on black), as channel says, and kept as a grey mask at most ${_chunkIUKPQCYQcjs.MAX_BRUSH_SOURCE_SIZE} px on a side. Returns id, ref (source:<id>), the stored source's width and height, problems (the channel auto picked, scaling) and replaced. Then make the brush: create_brush or update_brush with tip { shape: "stamp", stamps: [ref] } for an image tip, or tip.grain { source: ref } for grain. A taken id is refused unless overwrite.`,
|
|
989
989
|
inputSchema: {
|
|
990
990
|
type: "object",
|
|
991
991
|
properties: {
|
|
992
992
|
name: { type: "string", minLength: 1, maxLength: 80, description: 'Display name, e.g. "Charcoal scan".' },
|
|
993
|
-
image: { type: "string", pattern: "^data:image/png;base64,", maxLength: 4e7, description: `The image: a PNG data: URL, at most ${
|
|
993
|
+
image: { type: "string", pattern: "^data:image/png;base64,", maxLength: 4e7, description: `The image: a PNG data: URL, at most ${_chunkIUKPQCYQcjs.MAX_BRUSH_SOURCE_INPUT_PIXELS} pixels; larger than ${_chunkIUKPQCYQcjs.MAX_BRUSH_SOURCE_SIZE} px it is scaled down.` },
|
|
994
994
|
id: { type: "string", pattern: String(FACETS2.id.pattern), description: "The source id (default: from the name, made unique): lowercase letters, digits and dashes." },
|
|
995
|
-
channel: { type: "string", enum: [...
|
|
995
|
+
channel: { type: "string", enum: [..._chunkIUKPQCYQcjs.BRUSH_SOURCE_CHANNELS], description: "Where the marks are: auto (default: the transparency when the image has any, else the dark parts), alpha, darkness (dark marks on light paper) or lightness (light marks on black)." },
|
|
996
996
|
invert: { type: "boolean", description: "Swap painted and empty parts (default false)." },
|
|
997
997
|
licence: { type: "string", maxLength: 2e3, description: "The licence or terms the image came with, kept with the source." },
|
|
998
998
|
origin: { type: "string", maxLength: 200, description: "Where it came from: a file name, a pack or a URL." },
|
|
@@ -1004,7 +1004,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
1004
1004
|
annotations: { title: "Add a brush image source", ...WRITE },
|
|
1005
1005
|
handler: async ({ overwrite, ...input }) => {
|
|
1006
1006
|
const r = await library.addSource(input, { overwrite: !!overwrite });
|
|
1007
|
-
return { id: r.source.id, ref:
|
|
1007
|
+
return { id: r.source.id, ref: _chunkIUKPQCYQcjs.brushSourceRef.call(void 0, r.source.id), width: r.source.width, height: r.source.height, problems: r.problems, replaced: r.replaced };
|
|
1008
1008
|
}
|
|
1009
1009
|
},
|
|
1010
1010
|
{
|
|
@@ -1078,24 +1078,24 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
1078
1078
|
try {
|
|
1079
1079
|
bytes = _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, file.replace(/^data:[^,]*,/, ""));
|
|
1080
1080
|
} catch (e6) {
|
|
1081
|
-
throw new (0,
|
|
1081
|
+
throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", "file is not base64: pass the pack's bytes as base64 (a data: URL works too).");
|
|
1082
1082
|
}
|
|
1083
1083
|
let r;
|
|
1084
1084
|
try {
|
|
1085
1085
|
r = await importBrushPack(library, bytes, { fileName, ...format ? { format } : {}, ...prefix ? { prefix } : {}, ...licence ? { licence } : {}, overwrite: !!overwrite });
|
|
1086
1086
|
} catch (e) {
|
|
1087
|
-
if (e instanceof
|
|
1088
|
-
throw new (0,
|
|
1087
|
+
if (e instanceof _chunkIUKPQCYQcjs.BrushLibraryError) throw e;
|
|
1088
|
+
throw new (0, _chunkIUKPQCYQcjs.BrushLibraryError)("invalid", `${e.message} Nothing was imported.`);
|
|
1089
1089
|
}
|
|
1090
1090
|
const entries = await Promise.all(r.brushes.map((b) => library.get(b.id)));
|
|
1091
|
-
return { ...r, brushes: r.brushes.map((b, i) => ({ ...b, renderable: entries[i] ?
|
|
1091
|
+
return { ...r, brushes: r.brushes.map((b, i) => ({ ...b, renderable: entries[i] ? _chunkIUKPQCYQcjs.checkBrush.call(void 0, entries[i].brush, profile).ok : false })) };
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
);
|
|
1095
1095
|
return tools;
|
|
1096
1096
|
}
|
|
1097
1097
|
function createBrushLibraryToolProvider(library, options = {}) {
|
|
1098
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
1098
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkIUKPQCYQcjs.PAINT_PROFILE));
|
|
1099
1099
|
const tools = createBrushLibraryTools(library, options);
|
|
1100
1100
|
return {
|
|
1101
1101
|
id: _nullishCoalesce(options.id, () => ( "brushes")),
|
|
@@ -1142,17 +1142,30 @@ var MUTATION_SLIDERS = [
|
|
|
1142
1142
|
{ path: "mutation.patience", label: "Patience", min: 5, max: 300, step: 5 },
|
|
1143
1143
|
{ path: "mutation.fade", label: "Fade", min: 0.5, max: 10, step: 0.5 }
|
|
1144
1144
|
];
|
|
1145
|
+
var ANTIMATTER_SLIDERS = [
|
|
1146
|
+
{ path: "antimatter.blastRadius", label: "Blast size", min: 1, max: 6, step: 0.1 },
|
|
1147
|
+
{ path: "antimatter.blastSpacing", label: "Blast spacing", min: 0.5, max: 8, step: 0.1 },
|
|
1148
|
+
{ path: "antimatter.threshold", label: "Fuel threshold", min: 0, max: 1, step: 0.01 },
|
|
1149
|
+
{ path: "antimatter.invert", label: "Inversion", min: 0, max: 1, step: 0.01 },
|
|
1150
|
+
{ path: "antimatter.scorch", label: "Scorch", min: 0, max: 1, step: 0.01 },
|
|
1151
|
+
{ path: "antimatter.annihilate", label: "Annihilate", min: 0, max: 1, step: 0.01 },
|
|
1152
|
+
{ path: "antimatter.sparks", label: "Sparks", min: 0, max: 1, step: 0.01 },
|
|
1153
|
+
{ path: "antimatter.sparkReach", label: "Spark reach", min: 0.5, max: 8, step: 0.1 },
|
|
1154
|
+
{ path: "antimatter.crater", label: "Crater depth", min: 0, max: 1, step: 0.01 },
|
|
1155
|
+
{ path: "antimatter.duration", label: "Blast duration", min: 0, max: 2, step: 0.05 }
|
|
1156
|
+
];
|
|
1145
1157
|
function brushEngineControls(brush) {
|
|
1146
1158
|
const c = engineControls(brush);
|
|
1147
1159
|
if (!c) return null;
|
|
1148
1160
|
const mut = brush.mutation ? MUTATION_SLIDERS : [];
|
|
1149
1161
|
const wetPaint = brush.engine === "wet" && _optionalChain([brush, 'access', _30 => _30.wet, 'optionalAccess', _31 => _31.tool]) === "paint" && !brush.ghost && !brush.mutation;
|
|
1150
|
-
if (!(wetPaint || ["dab", "mixer", "particle", "bristle", "impasto"].includes(brush.engine))) {
|
|
1162
|
+
if (!(wetPaint || ["dab", "mixer", "particle", "bristle", "impasto", "antimatter"].includes(brush.engine))) {
|
|
1151
1163
|
return mut.length ? { ...c, sliders: [...c.sliders, ...mut] } : c;
|
|
1152
1164
|
}
|
|
1153
1165
|
const extra = brush.engine === "impasto" ? [{ path: "impasto.rim", label: "Rim", min: 0, max: 1, step: 0.01 }, { path: "impasto.clarity", label: "Clarity", min: 0, max: 1, step: 0.01 }] : [];
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1166
|
+
const canFilm = brush.engine !== "antimatter";
|
|
1167
|
+
const film = canFilm && brush.iridescence ? IRIDESCENCE_SLIDERS : [];
|
|
1168
|
+
return { ...c, sliders: [...c.sliders, ...mut, LIGHT_SLIDER, ...extra, ...film], light: true, iridescence: canFilm };
|
|
1156
1169
|
}
|
|
1157
1170
|
function engineControls(brush) {
|
|
1158
1171
|
switch (brush.engine) {
|
|
@@ -1213,6 +1226,15 @@ function engineControls(brush) {
|
|
|
1213
1226
|
load: false,
|
|
1214
1227
|
stickerStamps: true
|
|
1215
1228
|
};
|
|
1229
|
+
case "antimatter":
|
|
1230
|
+
return {
|
|
1231
|
+
title: "Antimatter",
|
|
1232
|
+
sliders: ANTIMATTER_SLIDERS,
|
|
1233
|
+
mixingPath: null,
|
|
1234
|
+
dirty: false,
|
|
1235
|
+
multicolor: false,
|
|
1236
|
+
load: false
|
|
1237
|
+
};
|
|
1216
1238
|
case "impasto":
|
|
1217
1239
|
return {
|
|
1218
1240
|
title: "Thick paint",
|
|
@@ -1321,4 +1343,5 @@ function patchBrushValue(brush, path, value) {
|
|
|
1321
1343
|
|
|
1322
1344
|
|
|
1323
1345
|
|
|
1324
|
-
|
|
1346
|
+
|
|
1347
|
+
exports.BRUSH_PATCH_PROPERTIES = BRUSH_PATCH_PROPERTIES; exports.UNSETTABLE_BRUSH_FACETS = UNSETTABLE_BRUSH_FACETS; exports.BRUSH_UNSET_PROPERTY = BRUSH_UNSET_PROPERTY; exports.mergeBrushPatch = mergeBrushPatch; exports.changedBrushPaths = changedBrushPaths; exports.AbrError = AbrError; exports.readAbr = readAbr; exports.BRUSH_PACK_FORMATS = BRUSH_PACK_FORMATS; exports.MAX_BRUSH_PACK_BYTES = MAX_BRUSH_PACK_BYTES; exports.MAX_PACK_BRUSHES = MAX_PACK_BRUSHES; exports.BrushPackError = BrushPackError; exports.brushPackFormat = brushPackFormat; exports.readBrushPack = readBrushPack; exports.importBrushPack = importBrushPack; exports.importBrushFile = importBrushFile; exports.createBrushLibraryTools = createBrushLibraryTools; exports.createBrushLibraryToolProvider = createBrushLibraryToolProvider; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.IRIDESCENCE_SLIDERS = IRIDESCENCE_SLIDERS; exports.GHOST_SLIDERS = GHOST_SLIDERS; exports.MUTATION_SLIDERS = MUTATION_SLIDERS; exports.ANTIMATTER_SLIDERS = ANTIMATTER_SLIDERS; exports.brushEngineControls = brushEngineControls; exports.multiColorSliders = multiColorSliders; exports.patchBrushValue = patchBrushValue;
|
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-
|
|
77
|
+
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-JVKVKWDA.cjs"))).catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= import("./brushstrokeRender-
|
|
77
|
+
loading ??= import("./brushstrokeRender-4MA5CBW3.js").catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkUOM5S4W5cjs = require('./chunk-UOM5S4W5.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -37,7 +37,7 @@ var lerpP = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
|
37
37
|
var toP = (v) => [v.x, v.y];
|
|
38
38
|
var mapP = (m, p) => [m[0] * p[0] + m[2] * p[1] + m[4], m[1] * p[0] + m[3] * p[1] + m[5]];
|
|
39
39
|
var curvesOf = (c) => Math.max(0, (c.pts.length - 1) / 3) | 0;
|
|
40
|
-
function subpathToMorphContour(sp, m =
|
|
40
|
+
function subpathToMorphContour(sp, m = _chunkUOM5S4W5cjs.IDENTITY_MATRIX) {
|
|
41
41
|
const n = sp.anchors.length;
|
|
42
42
|
if (!n) return null;
|
|
43
43
|
const first = mapP(m, toP(sp.anchors[0]));
|
|
@@ -67,8 +67,8 @@ function isStraight(p0, p1, p2, p3) {
|
|
|
67
67
|
const u2 = along(p2);
|
|
68
68
|
return off(p1) < tol && off(p2) < tol && u1 >= -1e-9 && u1 <= 1 + 1e-9 && u2 >= -1e-9 && u2 <= 1 + 1e-9;
|
|
69
69
|
}
|
|
70
|
-
function morphContourToSubpath(c, m =
|
|
71
|
-
const pts =
|
|
70
|
+
function morphContourToSubpath(c, m = _chunkUOM5S4W5cjs.IDENTITY_MATRIX, closed = c.closed) {
|
|
71
|
+
const pts = _chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, m) ? c.pts : c.pts.map((p) => mapP(m, p));
|
|
72
72
|
const curves = curvesOf(c);
|
|
73
73
|
const dropLast = closed && c.closed && curves > 0;
|
|
74
74
|
const count = dropLast ? curves : curves + 1;
|
|
@@ -84,7 +84,7 @@ function morphContourToSubpath(c, m = _chunkWZYRYYXNcjs.IDENTITY_MATRIX, closed
|
|
|
84
84
|
anchors[(k + 1) % count].in = { x: p2[0], y: p2[1] };
|
|
85
85
|
}
|
|
86
86
|
for (const a of anchors) {
|
|
87
|
-
const type =
|
|
87
|
+
const type = _chunkUOM5S4W5cjs.inferAnchorType.call(void 0, a);
|
|
88
88
|
if (type !== "corner") a.type = type;
|
|
89
89
|
}
|
|
90
90
|
const isClosed = closed && curves > 0;
|
|
@@ -267,7 +267,7 @@ function bestStart(fixed, free, useShapeContext) {
|
|
|
267
267
|
return best;
|
|
268
268
|
}
|
|
269
269
|
function placeIn(c, from, to) {
|
|
270
|
-
const b =
|
|
270
|
+
const b = _chunkUOM5S4W5cjs.unionBounds.call(void 0, [boundsOfPoints(c.pts)]);
|
|
271
271
|
const p = b ? [b.x + b.width / 2, b.y + b.height / 2] : c.pts[0];
|
|
272
272
|
if (!from || !to) return p;
|
|
273
273
|
const fx = from.width > 0 ? (p[0] - from.x) / from.width : 0.5;
|
|
@@ -456,7 +456,7 @@ function interpolateVectorColor(a, b, t) {
|
|
|
456
456
|
}
|
|
457
457
|
function resampleGradientStops(g, offsets) {
|
|
458
458
|
return offsets.map((offset) => {
|
|
459
|
-
const s =
|
|
459
|
+
const s = _chunkUOM5S4W5cjs.sampleVectorGradient.call(void 0, g, offset);
|
|
460
460
|
return s.opacity < 1 ? { offset, color: s.color, opacity: Math.round(s.opacity * 1e4) / 1e4 } : { offset, color: s.color };
|
|
461
461
|
});
|
|
462
462
|
}
|
|
@@ -467,11 +467,11 @@ function lerpAngle(a, b, t) {
|
|
|
467
467
|
var lerpPoint = (a, b, t) => ({ x: lerpN(a.x, b.x, t), y: lerpN(a.y, b.y, t) });
|
|
468
468
|
var sameColourModel = (a, b) => (_nullishCoalesce(a.interpolation, () => ( "srgb"))) === (_nullishCoalesce(b.interpolation, () => ( "srgb"))) && (_nullishCoalesce(a.smoothness, () => ( 0))) === (_nullishCoalesce(b.smoothness, () => ( 0)));
|
|
469
469
|
function lerpStops(a, b, t) {
|
|
470
|
-
let stopsA =
|
|
471
|
-
let stopsB =
|
|
470
|
+
let stopsA = _chunkUOM5S4W5cjs.sortedVectorGradientStops.call(void 0, a);
|
|
471
|
+
let stopsB = _chunkUOM5S4W5cjs.sortedVectorGradientStops.call(void 0, b);
|
|
472
472
|
const resampled = stopsA.length !== stopsB.length || !sameColourModel(a, b);
|
|
473
473
|
if (resampled) {
|
|
474
|
-
const offs = [...
|
|
474
|
+
const offs = [..._chunkUOM5S4W5cjs.expandVectorGradientStops.call(void 0, a), ..._chunkUOM5S4W5cjs.expandVectorGradientStops.call(void 0, b), ...stopsA, ...stopsB].map((s) => s.offset).filter(Number.isFinite).sort((x, y) => x - y);
|
|
475
475
|
const common = offs.filter((o, i) => i === 0 || o - offs[i - 1] > 1e-4);
|
|
476
476
|
stopsA = resampleGradientStops(a, common);
|
|
477
477
|
stopsB = resampleGradientStops(b, common);
|
|
@@ -498,8 +498,8 @@ function lerpGradient(a, b, t) {
|
|
|
498
498
|
}
|
|
499
499
|
if (near.spread && near.spread !== "pad") out.spread = near.spread;
|
|
500
500
|
if (near.strokeMode && near.strokeMode !== "within") out.strokeMode = near.strokeMode;
|
|
501
|
-
const ea =
|
|
502
|
-
const eb =
|
|
501
|
+
const ea = _chunkUOM5S4W5cjs.hasExplicitGradientGeometry.call(void 0, a);
|
|
502
|
+
const eb = _chunkUOM5S4W5cjs.hasExplicitGradientGeometry.call(void 0, b);
|
|
503
503
|
if (!ea && !eb) {
|
|
504
504
|
if (a.angle !== void 0 || b.angle !== void 0 || a.type === "linear" || a.type === "reflected") {
|
|
505
505
|
const fallback = a.type === "linear" || a.type === "reflected" ? 180 : 90;
|
|
@@ -512,10 +512,10 @@ function lerpGradient(a, b, t) {
|
|
|
512
512
|
}
|
|
513
513
|
return out;
|
|
514
514
|
}
|
|
515
|
-
const pa =
|
|
516
|
-
const pb =
|
|
515
|
+
const pa = _chunkUOM5S4W5cjs.vectorGradientPoints.call(void 0, a);
|
|
516
|
+
const pb = _chunkUOM5S4W5cjs.vectorGradientPoints.call(void 0, b);
|
|
517
517
|
if (pa.units !== pb.units) {
|
|
518
|
-
const src =
|
|
518
|
+
const src = _chunkUOM5S4W5cjs.explicitVectorGradient.call(void 0, near);
|
|
519
519
|
return { ...src, stops: out.stops, ...out.interpolation ? { interpolation: out.interpolation } : {}, ...out.smoothness ? { smoothness: out.smoothness } : {} };
|
|
520
520
|
}
|
|
521
521
|
out.start = lerpPoint(pa.start, pb.start, t);
|
|
@@ -535,14 +535,14 @@ function solidLike(color, like) {
|
|
|
535
535
|
function interpolateVectorPaint(a, b, t) {
|
|
536
536
|
if (t <= 0) return a;
|
|
537
537
|
if (t >= 1) return b;
|
|
538
|
-
const pa =
|
|
539
|
-
const pb =
|
|
538
|
+
const pa = _chunkUOM5S4W5cjs.hasPaint.call(void 0, a);
|
|
539
|
+
const pb = _chunkUOM5S4W5cjs.hasPaint.call(void 0, b);
|
|
540
540
|
if (!pa && !pb) return t < 0.5 ? a : b;
|
|
541
541
|
if (typeof a === "string" && pa && typeof b === "string" && pb) return interpolateVectorColor(a, b, t);
|
|
542
542
|
if (!pa && typeof b === "string") return interpolateVectorColor("transparent", b, t);
|
|
543
543
|
if (!pb && typeof a === "string") return interpolateVectorColor(a, "transparent", t);
|
|
544
|
-
const ga = pa &&
|
|
545
|
-
const gb = pb &&
|
|
544
|
+
const ga = pa && _chunkUOM5S4W5cjs.isVectorGradient.call(void 0, a) ? a : null;
|
|
545
|
+
const gb = pb && _chunkUOM5S4W5cjs.isVectorGradient.call(void 0, b) ? b : null;
|
|
546
546
|
if (ga && gb) return _nullishCoalesce(lerpGradient(ga, gb, t), () => ( (t < 0.5 ? a : b)));
|
|
547
547
|
if (gb) return _nullishCoalesce(lerpGradient(solidLike(pa ? a : null, gb), gb, t), () => ( b));
|
|
548
548
|
if (ga) return _nullishCoalesce(lerpGradient(ga, solidLike(pb ? b : null, ga), t), () => ( a));
|
|
@@ -553,8 +553,8 @@ function interpolateWidthProfiles(a, b, t) {
|
|
|
553
553
|
const at = [..._nullishCoalesce(a, () => ( [])), ..._nullishCoalesce(b, () => ( [])), { t: 0 }, { t: 1 }].map((p) => p.t).sort((x, y) => x - y);
|
|
554
554
|
const ts = at.filter((v, i) => i === 0 || v - at[i - 1] > 1e-6);
|
|
555
555
|
return ts.map((pos) => {
|
|
556
|
-
const x =
|
|
557
|
-
const y =
|
|
556
|
+
const x = _chunkUOM5S4W5cjs.widthProfileAt.call(void 0, a, pos);
|
|
557
|
+
const y = _chunkUOM5S4W5cjs.widthProfileAt.call(void 0, b, pos);
|
|
558
558
|
return { t: pos, left: lerpN(x.left, y.left, t), right: lerpN(x.right, y.right, t) };
|
|
559
559
|
});
|
|
560
560
|
}
|
|
@@ -597,7 +597,7 @@ function reversedStyle(s) {
|
|
|
597
597
|
out.endArrow = s.startArrow;
|
|
598
598
|
out.startArrowScale = s.endArrowScale;
|
|
599
599
|
out.endArrowScale = s.startArrowScale;
|
|
600
|
-
if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile =
|
|
600
|
+
if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile = _chunkUOM5S4W5cjs.reverseWidthProfile.call(void 0, s.strokeWidthProfile);
|
|
601
601
|
for (const k of ["startArrow", "endArrow", "startArrowScale", "endArrowScale"]) if (out[k] === void 0) delete out[k];
|
|
602
602
|
return out;
|
|
603
603
|
}
|
|
@@ -623,19 +623,19 @@ function styleOf(n) {
|
|
|
623
623
|
return out;
|
|
624
624
|
}
|
|
625
625
|
function contoursOf(node, m) {
|
|
626
|
-
return
|
|
626
|
+
return _chunkUOM5S4W5cjs.expandVectorCorners.call(void 0, node.subpaths).map((sp) => subpathToMorphContour(sp, m)).filter((c) => !!c);
|
|
627
627
|
}
|
|
628
|
-
function preparePathMorph(a, b, options, ma =
|
|
628
|
+
function preparePathMorph(a, b, options, ma = _chunkUOM5S4W5cjs.nodeMatrix.call(void 0, a), mb = _chunkUOM5S4W5cjs.nodeMatrix.call(void 0, b)) {
|
|
629
629
|
const corr = correspondMorphContours(contoursOf(a, ma), contoursOf(b, mb), options);
|
|
630
630
|
const sim = procrustes(corr.a, corr.b);
|
|
631
631
|
const styleA = styleOf(a);
|
|
632
632
|
const styleB = corr.reversed ? reversedStyle(styleOf(b)) : styleOf(b);
|
|
633
|
-
const rigid = !
|
|
633
|
+
const rigid = !_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, ma) || !_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, mb);
|
|
634
634
|
const id = _nullishCoalesce(options.id, () => ( a.id));
|
|
635
635
|
return (t) => {
|
|
636
636
|
const contours = interpolateMorphContours(corr.a, corr.b, t, { linear: options.linear, rigidity: options.rigidity, similarity: sim });
|
|
637
|
-
const m = rigid ? interpolateRigidMatrix(ma, mb, t) :
|
|
638
|
-
const back = rigid ?
|
|
637
|
+
const m = rigid ? interpolateRigidMatrix(ma, mb, t) : _chunkUOM5S4W5cjs.IDENTITY_MATRIX;
|
|
638
|
+
const back = rigid ? _chunkUOM5S4W5cjs.invertMatrix.call(void 0, m) : _chunkUOM5S4W5cjs.IDENTITY_MATRIX;
|
|
639
639
|
const subpaths = contours.map((c, k) => {
|
|
640
640
|
const closed = t <= 0 ? corr.a[k].closed : t >= 1 ? corr.b[k].closed : corr.a[k].closed && corr.b[k].closed;
|
|
641
641
|
return morphContourToSubpath({ closed: corr.a[k].closed && corr.b[k].closed, pts: c.pts }, back, closed);
|
|
@@ -643,14 +643,14 @@ function preparePathMorph(a, b, options, ma = _chunkWZYRYYXNcjs.nodeMatrix.call(
|
|
|
643
643
|
const node = { id, type: "path", subpaths, ...interpolateVectorStyle(styleA, styleB, t) };
|
|
644
644
|
const opacity = lerpN(_nullishCoalesce(a.opacity, () => ( 1)), _nullishCoalesce(b.opacity, () => ( 1)), t);
|
|
645
645
|
if (opacity < 1) node.opacity = opacity;
|
|
646
|
-
if (rigid && !
|
|
646
|
+
if (rigid && !_chunkUOM5S4W5cjs.isIdentityMatrix.call(void 0, m)) node.transform = m;
|
|
647
647
|
return node;
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function flattenPaths(node, parent =
|
|
651
|
-
const m =
|
|
650
|
+
function flattenPaths(node, parent = _chunkUOM5S4W5cjs.IDENTITY_MATRIX) {
|
|
651
|
+
const m = _chunkUOM5S4W5cjs.multiplyMatrices.call(void 0, _chunkUOM5S4W5cjs.nodeMatrix.call(void 0, node), parent);
|
|
652
652
|
if (node.type === "path") return [{ path: node, m, opacity: 1 }];
|
|
653
|
-
if (node.type === "text" || node.type === "instance") return flattenPaths(
|
|
653
|
+
if (node.type === "text" || node.type === "instance") return flattenPaths(_chunkUOM5S4W5cjs.expandVectorAppearance.call(void 0, node), parent);
|
|
654
654
|
const o = _nullishCoalesce(node.opacity, () => ( 1));
|
|
655
655
|
return node.children.filter((c) => c.visible !== false).flatMap((c) => flattenPaths(c, m)).map((e) => ({ ...e, opacity: e.opacity * o }));
|
|
656
656
|
}
|
|
@@ -672,8 +672,8 @@ function createVectorMorph(a, b, options = {}) {
|
|
|
672
672
|
}
|
|
673
673
|
const pa = flattenPaths(a);
|
|
674
674
|
const pb = flattenPaths(b);
|
|
675
|
-
const ba =
|
|
676
|
-
const bb =
|
|
675
|
+
const ba = _chunkUOM5S4W5cjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
|
|
676
|
+
const bb = _chunkUOM5S4W5cjs.unionBounds.call(void 0, pb.map((e) => placedBounds(e.path, e.m)));
|
|
677
677
|
const id = _nullishCoalesce(options.id, () => ( a.id));
|
|
678
678
|
const parts = [];
|
|
679
679
|
const opacities = [];
|
|
@@ -685,10 +685,10 @@ function createVectorMorph(a, b, options = {}) {
|
|
|
685
685
|
parts.push(preparePathMorph(x.path, y.path, sub, x.m, y.m));
|
|
686
686
|
opacities.push([x.opacity, y.opacity]);
|
|
687
687
|
} else if (x) {
|
|
688
|
-
parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m,
|
|
688
|
+
parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m, _chunkUOM5S4W5cjs.IDENTITY_MATRIX));
|
|
689
689
|
opacities.push([x.opacity, x.opacity]);
|
|
690
690
|
} else if (y) {
|
|
691
|
-
parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub,
|
|
691
|
+
parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub, _chunkUOM5S4W5cjs.IDENTITY_MATRIX, y.m));
|
|
692
692
|
opacities.push([y.opacity, y.opacity]);
|
|
693
693
|
}
|
|
694
694
|
}
|