@pixerate/editor 0.263.0 → 0.264.1
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 +155 -68
- package/dist/brushes/index.d.cts +3 -3
- package/dist/brushes/index.d.ts +3 -3
- package/dist/brushes/index.js +111 -24
- package/dist/brushes/library.d.cts +2 -0
- package/dist/brushes/library.d.ts +2 -0
- package/dist/brushes/profiles.d.cts +21 -2
- package/dist/brushes/profiles.d.ts +21 -2
- package/dist/brushes/ui.d.cts +57 -4
- package/dist/brushes/ui.d.ts +57 -4
- package/dist/{brushstrokeRender-S5DABANG.js → brushstrokeRender-3MOI7PH4.js} +2 -2
- package/dist/{brushstrokeRender-2GBME4XD.cjs → brushstrokeRender-SMMPIJF2.cjs} +12 -12
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-CNLO6E2K.js → chunk-4OJC4MCD.js} +8 -7
- package/dist/{chunk-ZBACQHW3.cjs → chunk-BY5EBP26.cjs} +27 -6
- package/dist/{chunk-JGI4PZWO.js → chunk-CECCP2V7.js} +1 -1
- package/dist/{chunk-P5343XZO.js → chunk-EE7SAYBF.js} +23 -2
- package/dist/{chunk-TILEUVRO.cjs → chunk-F3KKR6DD.cjs} +35 -34
- package/dist/{chunk-TIHW7CUY.cjs → chunk-FQC5TDB6.cjs} +35 -35
- package/dist/{chunk-4E6BGHWN.cjs → chunk-G5ADO47G.cjs} +1 -1
- package/dist/{chunk-QW7LKWKE.js → chunk-HAUDEVMC.js} +1 -1
- package/dist/{chunk-LG6MEEV7.js → chunk-JEML4FSA.js} +1 -1
- package/dist/{chunk-XQW6R7VW.cjs → chunk-KXNZNOEF.cjs} +86 -86
- package/dist/{chunk-6XX7E7O2.js → chunk-ROBSFJ6F.js} +1 -1
- package/dist/{chunk-LWHUU6A6.cjs → chunk-USJX5SW4.cjs} +10 -10
- package/dist/{chunk-73QFSPDG.cjs → chunk-V7MJ4HIN.cjs} +23 -23
- package/dist/{chunk-34HIZXFX.js → chunk-WWI6FLH2.js} +1 -1
- package/dist/image-editor/controller.d.cts +3 -0
- package/dist/image-editor/controller.d.ts +3 -0
- package/dist/image-editor/index.cjs +789 -786
- package/dist/image-editor/index.js +7 -4
- package/dist/image-editor/types.d.cts +7 -0
- package/dist/image-editor/types.d.ts +7 -0
- package/dist/paint-editor/brush-library-tools.d.cts +8 -1
- package/dist/paint-editor/brush-library-tools.d.ts +8 -1
- package/dist/paint-editor/controller.d.cts +1 -1
- package/dist/paint-editor/controller.d.ts +1 -1
- package/dist/paint-editor/index.cjs +88 -83
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +16 -11
- package/dist/vector/controller.d.cts +13 -0
- package/dist/vector/controller.d.ts +13 -0
- package/dist/vector/index.cjs +1215 -1205
- package/dist/vector/index.js +16 -6
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +11 -3
- package/skills/pixerate-brushes-design/SKILL.md +1 -0
- package/skills/pixerate-vector/SKILL.md +1 -1
|
@@ -15,12 +15,13 @@ var _chunkPE6YJMQTcjs = require('./chunk-PE6YJMQT.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
var _chunkBY5EBP26cjs = require('./chunk-BY5EBP26.cjs');
|
|
19
20
|
|
|
20
21
|
// src/brushes/patch.ts
|
|
21
22
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
22
23
|
var copy = (v) => JSON.parse(JSON.stringify(v));
|
|
23
|
-
var FACETS =
|
|
24
|
+
var FACETS = _chunkBY5EBP26cjs.BRUSH_JSON_SCHEMA.properties;
|
|
24
25
|
var BRUSH_PATCH_PROPERTIES = (() => {
|
|
25
26
|
const { id: _id, name: _name, ...rest } = FACETS;
|
|
26
27
|
const { required: _r, ...tip } = rest.tip;
|
|
@@ -52,17 +53,17 @@ function changedBrushPaths(a, b, path = "") {
|
|
|
52
53
|
// src/brushes/tools.ts
|
|
53
54
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
54
55
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
55
|
-
var FACETS2 =
|
|
56
|
+
var FACETS2 = _chunkBY5EBP26cjs.BRUSH_JSON_SCHEMA.properties;
|
|
56
57
|
var ID = { type: "string", pattern: String(FACETS2.id.pattern), description: "Brush id from list_brush_presets (lowercase letters, digits and dashes)." };
|
|
57
58
|
var FACET_PROPS = BRUSH_PATCH_PROPERTIES;
|
|
58
|
-
var HOSTS = Object.keys(
|
|
59
|
+
var HOSTS = Object.keys(_chunkBY5EBP26cjs.BRUSH_HOST_PROFILES);
|
|
59
60
|
var copy2 = (v) => JSON.parse(JSON.stringify(v));
|
|
60
61
|
var merge = mergeBrushPatch;
|
|
61
62
|
var changedPaths = changedBrushPaths;
|
|
62
63
|
function summary(entry, profile, withCheck) {
|
|
63
64
|
const b = entry.brush;
|
|
64
|
-
const engine =
|
|
65
|
-
const check = withCheck ?
|
|
65
|
+
const engine = _chunkBY5EBP26cjs.resolveEngine.call(void 0, b);
|
|
66
|
+
const check = withCheck ? _chunkBY5EBP26cjs.checkBrush.call(void 0, b, profile) : null;
|
|
66
67
|
return {
|
|
67
68
|
id: b.id,
|
|
68
69
|
name: b.name,
|
|
@@ -71,7 +72,7 @@ function summary(entry, profile, withCheck) {
|
|
|
71
72
|
...b.medium ? { medium: b.medium } : {},
|
|
72
73
|
...b.variety ? { variety: b.variety } : {},
|
|
73
74
|
...b.tool ? { tool: b.tool } : {},
|
|
74
|
-
category:
|
|
75
|
+
category: _chunkBY5EBP26cjs.resolveCategory.call(void 0, b, engine),
|
|
75
76
|
engine,
|
|
76
77
|
tip: b.tip.shape,
|
|
77
78
|
...b.tip.size !== void 0 ? { size: b.tip.size } : {},
|
|
@@ -85,21 +86,21 @@ function summary(entry, profile, withCheck) {
|
|
|
85
86
|
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.)`;
|
|
86
87
|
var warnings = (check) => check.issues.filter((i) => i.severity === "warning");
|
|
87
88
|
function createBrushLibraryTools(library, options = {}) {
|
|
88
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
89
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkBY5EBP26cjs.PAINT_PROFILE));
|
|
89
90
|
const hostOf = (id) => {
|
|
90
91
|
if (id === void 0) return profile;
|
|
91
|
-
const p =
|
|
92
|
-
if (!p) throw new (0,
|
|
92
|
+
const p = _chunkBY5EBP26cjs.BRUSH_HOST_PROFILES[id];
|
|
93
|
+
if (!p) throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("invalid", `No host "${id}"; use one of: ${HOSTS.join(", ")}.`);
|
|
93
94
|
return p;
|
|
94
95
|
};
|
|
95
96
|
const entry = async (id) => {
|
|
96
97
|
const found = await library.get(id);
|
|
97
98
|
if (found) return found;
|
|
98
99
|
const ids = (await library.list()).map((e) => e.brush.id);
|
|
99
|
-
throw new (0,
|
|
100
|
+
throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("unknown_brush", `No brush "${id}". ${_chunkBY5EBP26cjs.closest.call(void 0, id, ids)}list_brush_presets lists them.`);
|
|
100
101
|
};
|
|
101
102
|
const checkFor = async (brush, p) => {
|
|
102
|
-
const check2 =
|
|
103
|
+
const check2 = _chunkBY5EBP26cjs.checkBrush.call(void 0, brush, p);
|
|
103
104
|
const provider = _optionalChain([options, 'access', _9 => _9.stickers, 'optionalCall', _10 => _10()]);
|
|
104
105
|
if (!provider || brush.tip.shape !== "stamp") return check2;
|
|
105
106
|
const issues = [...check2.issues];
|
|
@@ -113,16 +114,16 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
113
114
|
}
|
|
114
115
|
return { ok: !issues.some((i) => i.severity === "error"), issues };
|
|
115
116
|
};
|
|
116
|
-
const store = async (raw, overwrite) => {
|
|
117
|
+
const store = async (raw, overwrite, original) => {
|
|
117
118
|
const problems = [];
|
|
118
119
|
let brush;
|
|
119
120
|
try {
|
|
120
|
-
brush =
|
|
121
|
+
brush = _chunkBY5EBP26cjs.normalizeBrushSpec.call(void 0, raw, problems);
|
|
121
122
|
} catch (e) {
|
|
122
|
-
throw new (0,
|
|
123
|
+
throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("invalid", e.message);
|
|
123
124
|
}
|
|
124
|
-
const check2 = await checkFor(brush, profile);
|
|
125
|
-
if (!check2.ok) throw new (0,
|
|
125
|
+
const check2 = _chunkBY5EBP26cjs.withKeptIssues.call(void 0, await checkFor(brush, profile), original ? await checkFor(original, profile) : null);
|
|
126
|
+
if (!check2.ok) throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("invalid", refusal(check2, profile));
|
|
126
127
|
const saved = await library.save(brush, { overwrite });
|
|
127
128
|
return { ...saved, problems, check: check2 };
|
|
128
129
|
};
|
|
@@ -133,10 +134,10 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
133
134
|
inputSchema: {
|
|
134
135
|
type: "object",
|
|
135
136
|
properties: {
|
|
136
|
-
kind: { type: "string", enum: [...
|
|
137
|
-
medium: { type: "string", enum: [...
|
|
137
|
+
kind: { type: "string", enum: [..._chunkBY5EBP26cjs.BRUSH_KINDS], description: "mark (lays a material) or tool (works on paint already down)." },
|
|
138
|
+
medium: { type: "string", enum: [..._chunkBY5EBP26cjs.BRUSH_MEDIA], description: "Marks laying this medium." },
|
|
138
139
|
variety: { type: "string", maxLength: 40, description: "This variety (oil, watercolor, pencil, highlighter\u2026)." },
|
|
139
|
-
tool: { type: "string", enum: [...
|
|
140
|
+
tool: { type: "string", enum: [..._chunkBY5EBP26cjs.BRUSH_TOOLS], description: "Tools that do this." },
|
|
140
141
|
tag: { type: "string", maxLength: 40, description: "Brushes with this tag." },
|
|
141
142
|
text: { type: "string", maxLength: 200, description: "Words in the id, name, description, variety or tags (each word must match the start of one)." },
|
|
142
143
|
source: { type: "string", enum: ["all", "builtin", "user"], description: "all (default), builtin presets only, or user (saved) brushes only." },
|
|
@@ -163,8 +164,8 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
163
164
|
annotations: { title: "Describe a brush", ...READ },
|
|
164
165
|
handler: async ({ id }) => {
|
|
165
166
|
const e = await entry(id);
|
|
166
|
-
const engine =
|
|
167
|
-
return { brush: e.brush, builtin: e.builtin, engine, category:
|
|
167
|
+
const engine = _chunkBY5EBP26cjs.resolveEngine.call(void 0, e.brush);
|
|
168
|
+
return { brush: e.brush, builtin: e.builtin, engine, category: _chunkBY5EBP26cjs.resolveCategory.call(void 0, e.brush, engine), check: await checkFor(e.brush, profile) };
|
|
168
169
|
}
|
|
169
170
|
};
|
|
170
171
|
const check = {
|
|
@@ -182,20 +183,20 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
182
183
|
},
|
|
183
184
|
annotations: { title: "Check a brush for a host", ...READ },
|
|
184
185
|
handler: async ({ id, brush, host }) => {
|
|
185
|
-
if (id === void 0 === (brush === void 0)) throw new (0,
|
|
186
|
+
if (id === void 0 === (brush === void 0)) throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("invalid", "Give either id (a library brush) or brush (a spec), not both or neither.");
|
|
186
187
|
const p = hostOf(host);
|
|
187
188
|
let b;
|
|
188
189
|
const problems = [];
|
|
189
190
|
if (id !== void 0) b = (await entry(id)).brush;
|
|
190
191
|
else {
|
|
191
192
|
try {
|
|
192
|
-
b =
|
|
193
|
+
b = _chunkBY5EBP26cjs.normalizeBrushSpec.call(void 0, brush, problems);
|
|
193
194
|
} catch (e) {
|
|
194
|
-
throw new (0,
|
|
195
|
+
throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("invalid", e.message);
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
const result = await checkFor(b, p);
|
|
198
|
-
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded:
|
|
199
|
+
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded: _chunkBY5EBP26cjs.degrade.call(void 0, b, p) } : {} };
|
|
199
200
|
}
|
|
200
201
|
};
|
|
201
202
|
const exportTool = {
|
|
@@ -254,18 +255,18 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
254
255
|
},
|
|
255
256
|
annotations: { title: "Save a new brush", ...WRITE },
|
|
256
257
|
handler: async ({ basedOn, ...spec }) => {
|
|
257
|
-
if (library.isBuiltin(spec.id)) throw new (0,
|
|
258
|
-
if (await library.get(spec.id)) throw new (0,
|
|
258
|
+
if (library.isBuiltin(spec.id)) throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("builtin", `"${spec.id}" is a built-in brush id; pick another id (or basedOn "${spec.id}" with a new id).`);
|
|
259
|
+
if (await library.get(spec.id)) throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("exists", `A brush "${spec.id}" exists already; pick another id, or change it with update_brush.`);
|
|
259
260
|
const base = basedOn !== void 0 ? (await entry(basedOn)).brush : void 0;
|
|
260
261
|
const raw = base ? merge(base, spec) : spec;
|
|
261
262
|
const saved = await store(raw, false);
|
|
262
|
-
return { id: saved.brush.id, brush: saved.brush, engine:
|
|
263
|
+
return { id: saved.brush.id, brush: saved.brush, engine: _chunkBY5EBP26cjs.resolveEngine.call(void 0, saved.brush), problems: saved.problems, warnings: warnings(saved.check) };
|
|
263
264
|
}
|
|
264
265
|
},
|
|
265
266
|
{
|
|
266
267
|
name: "update_brush",
|
|
267
268
|
title: "Update a brush",
|
|
268
|
-
description: `Changes a saved brush: the facets given are laid over its own (objects merge, lists and values replace; marks of another kind replace the marks), and unset removes whole facets back to their defaults. Built-in presets are refused (duplicate_brush first). Checked against this host like create_brush
|
|
269
|
+
description: `Changes a saved brush: the facets given are laid over its own (objects merge, lists and values replace; marks of another kind replace the marks), and unset removes whole facets back to their defaults. Built-in presets are refused (duplicate_brush first). Checked against this host like create_brush: a change that adds what this host can't render is refused and saves nothing, while facets the brush already had for other hosts (a paint brush's light, in canvas) are kept as they are. One change. Returns the brush, the leaf paths changed, problems, warnings and, when there are any, kept: the facets this host can't use that the brush keeps.`,
|
|
269
270
|
inputSchema: {
|
|
270
271
|
type: "object",
|
|
271
272
|
properties: {
|
|
@@ -280,11 +281,11 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
280
281
|
annotations: { title: "Update a brush", ...WRITE, idempotentHint: true },
|
|
281
282
|
handler: async ({ id, unset, ...patch }) => {
|
|
282
283
|
const e = await entry(id);
|
|
283
|
-
if (e.builtin) throw new (0,
|
|
284
|
+
if (e.builtin) throw new (0, _chunkBY5EBP26cjs.BrushLibraryError)("builtin", `"${id}" is a built-in brush and can't be changed; duplicate_brush makes a copy you can change.`);
|
|
284
285
|
const base = copy2(e.brush);
|
|
285
286
|
for (const k of _nullishCoalesce(unset, () => ( []))) delete base[k];
|
|
286
|
-
const saved = await store(merge(base, { ...patch, id }), true);
|
|
287
|
-
return { id, brush: saved.brush, changed: changedPaths(e.brush, saved.brush), problems: saved.problems, warnings: warnings(saved.check) };
|
|
287
|
+
const saved = await store(merge(base, { ...patch, id }), true, e.brush);
|
|
288
|
+
return { id, brush: saved.brush, changed: changedPaths(e.brush, saved.brush), problems: saved.problems, warnings: warnings(saved.check), ...saved.check.kept.length ? { kept: saved.check.kept } : {} };
|
|
288
289
|
}
|
|
289
290
|
},
|
|
290
291
|
{
|
|
@@ -339,7 +340,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
339
340
|
return tools;
|
|
340
341
|
}
|
|
341
342
|
function createBrushLibraryToolProvider(library, options = {}) {
|
|
342
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
343
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkBY5EBP26cjs.PAINT_PROFILE));
|
|
343
344
|
const tools = createBrushLibraryTools(library, options);
|
|
344
345
|
return {
|
|
345
346
|
id: _nullishCoalesce(options.id, () => ( "brushes")),
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkUSJX5SW4cjs = require('./chunk-USJX5SW4.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 = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.IDENTITY_MATRIX, closed = c.closed) {
|
|
71
|
+
const pts = _chunkUSJX5SW4cjs.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 = _chunkLWHUU6A6cjs.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 = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.sortedVectorGradientStops.call(void 0, a);
|
|
471
|
+
let stopsB = _chunkUSJX5SW4cjs.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 = [..._chunkUSJX5SW4cjs.expandVectorGradientStops.call(void 0, a), ..._chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.hasExplicitGradientGeometry.call(void 0, a);
|
|
502
|
+
const eb = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.vectorGradientPoints.call(void 0, a);
|
|
516
|
+
const pb = _chunkUSJX5SW4cjs.vectorGradientPoints.call(void 0, b);
|
|
517
517
|
if (pa.units !== pb.units) {
|
|
518
|
-
const src =
|
|
518
|
+
const src = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.hasPaint.call(void 0, a);
|
|
539
|
+
const pb = _chunkUSJX5SW4cjs.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 && _chunkUSJX5SW4cjs.isVectorGradient.call(void 0, a) ? a : null;
|
|
545
|
+
const gb = pb && _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.widthProfileAt.call(void 0, a, pos);
|
|
557
|
+
const y = _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.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 _chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.nodeMatrix.call(void 0, a), mb = _chunkUSJX5SW4cjs.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 = !_chunkUSJX5SW4cjs.isIdentityMatrix.call(void 0, ma) || !_chunkUSJX5SW4cjs.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) : _chunkUSJX5SW4cjs.IDENTITY_MATRIX;
|
|
638
|
+
const back = rigid ? _chunkUSJX5SW4cjs.invertMatrix.call(void 0, m) : _chunkUSJX5SW4cjs.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 = _chunkLWHUU6A6cjs.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 && !_chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.IDENTITY_MATRIX) {
|
|
651
|
+
const m = _chunkUSJX5SW4cjs.multiplyMatrices.call(void 0, _chunkUSJX5SW4cjs.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(_chunkUSJX5SW4cjs.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 = _chunkUSJX5SW4cjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
|
|
676
|
+
const bb = _chunkUSJX5SW4cjs.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, _chunkUSJX5SW4cjs.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, _chunkUSJX5SW4cjs.IDENTITY_MATRIX, y.m));
|
|
692
692
|
opacities.push([y.opacity, y.opacity]);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -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-SMMPIJF2.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-3MOI7PH4.js").catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|