@pixerate/editor 0.256.0 → 0.257.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 +40 -38
- package/dist/agent/index.js +9 -7
- package/dist/animation/index.cjs +4 -2
- package/dist/animation/index.js +4 -2
- package/dist/animation-editor/index.cjs +63 -61
- package/dist/animation-editor/index.js +7 -5
- package/dist/brushes/colour.d.cts +11 -0
- package/dist/brushes/colour.d.ts +11 -0
- package/dist/brushes/index.cjs +51 -30
- package/dist/brushes/index.d.cts +1 -0
- package/dist/brushes/index.d.ts +1 -0
- package/dist/brushes/index.js +25 -4
- package/dist/brushes/resolve.d.cts +2 -0
- package/dist/brushes/resolve.d.ts +2 -0
- package/dist/brushes/schema.d.cts +1 -0
- package/dist/brushes/schema.d.ts +1 -0
- package/dist/brushes/tools.d.cts +7 -0
- package/dist/brushes/tools.d.ts +7 -0
- package/dist/brushes/types.d.cts +10 -2
- package/dist/brushes/types.d.ts +10 -2
- package/dist/brushes/ui.d.cts +14 -3
- package/dist/brushes/ui.d.ts +14 -3
- package/dist/{brushstrokeRender-HCOQUSWW.js → brushstrokeRender-JI4W6F2G.js} +2 -2
- package/dist/{brushstrokeRender-ZZOXI5O5.cjs → brushstrokeRender-MQ6PSDM5.cjs} +11 -11
- package/dist/canvas/index.cjs +20 -18
- package/dist/canvas/index.js +7 -5
- package/dist/chart/index.cjs +159 -157
- package/dist/chart/index.js +9 -7
- package/dist/{chunk-7272D3K2.js → chunk-2EUW2XZX.js} +27 -276
- package/dist/{chunk-L6Y7TSQ4.js → chunk-2VJ6OVJV.js} +1 -1
- package/dist/{chunk-6ZZKRH7R.js → chunk-47V3WXDG.js} +2 -2
- package/dist/{chunk-H7ET2ISK.cjs → chunk-4IMD2TLY.cjs} +52 -52
- package/dist/{chunk-VUKUTT2W.js → chunk-4M4E3N6X.js} +1 -1
- package/dist/{chunk-TBAVCLEQ.cjs → chunk-5Q5MLXAD.cjs} +23 -23
- package/dist/{chunk-MONXNVZK.js → chunk-6I23ZCGK.js} +5 -3
- package/dist/{chunk-GOBOCZZI.js → chunk-6NQPKNUZ.js} +1 -1
- package/dist/{chunk-WYGSR3IJ.js → chunk-AORZ5M5C.js} +1 -1
- package/dist/chunk-AVTPZO4Z.cjs +142 -0
- package/dist/{chunk-WKMUBATU.js → chunk-C2WEIEUB.js} +1 -1
- package/dist/{chunk-P3K2JCJA.js → chunk-D5BXSOSU.js} +3 -3
- package/dist/chunk-E2V5DA3W.js +36 -0
- package/dist/{chunk-WZOGDKCQ.js → chunk-F7CPSRLN.js} +0 -133
- package/dist/chunk-FJBQTZS4.js +17 -0
- package/dist/{chunk-SOSBOS5T.cjs → chunk-G23BTQA5.cjs} +22 -22
- package/dist/{chunk-EUIDTZNQ.cjs → chunk-I3Y2Q3PM.cjs} +59 -308
- package/dist/{chunk-YHUMGBZD.js → chunk-ICTPLVSR.js} +22 -4
- package/dist/{chunk-LRNUZKWV.cjs → chunk-IPUTIUGQ.cjs} +1 -1
- package/dist/{chunk-6GRUVGKU.js → chunk-ITURMC2M.js} +3 -3
- package/dist/{chunk-HYWRU5VX.js → chunk-IXQZHCOF.js} +1 -1
- package/dist/chunk-J5UQHWVL.js +142 -0
- package/dist/{chunk-YBAPT7NL.js → chunk-JC2SHA4A.js} +1 -23
- package/dist/chunk-LRTR4ASZ.cjs +17 -0
- package/dist/{chunk-HUAISCUX.cjs → chunk-M2HG5DJ2.cjs} +18 -18
- package/dist/{chunk-N76AMOKE.cjs → chunk-MDLEGVEN.cjs} +42 -42
- package/dist/chunk-MEGSQUQO.cjs +36 -0
- package/dist/chunk-MLLTWAXH.cjs +276 -0
- package/dist/{chunk-RHPSE2YR.js → chunk-MQ6MGIQM.js} +2 -2
- package/dist/{chunk-PGPFWC35.cjs → chunk-MQGQTKVW.cjs} +51 -33
- package/dist/{chunk-5YWWQ36H.cjs → chunk-O3ZVZSNJ.cjs} +9 -9
- package/dist/{chunk-GCTUOTCW.cjs → chunk-P3PZ63M3.cjs} +35 -35
- package/dist/{chunk-WRZ6C4TU.cjs → chunk-P6WYDBTH.cjs} +4 -4
- package/dist/{chunk-CJ6TBL2N.cjs → chunk-RHEMMGCN.cjs} +16 -16
- package/dist/{chunk-HIMGBZAM.cjs → chunk-RSIKDWOP.cjs} +201 -38
- package/dist/{chunk-SABJMH6M.cjs → chunk-RVGP2XLF.cjs} +2 -135
- package/dist/{chunk-JVRLGV3C.js → chunk-SMTUQWGY.js} +184 -21
- package/dist/{chunk-DMTEQ6SH.js → chunk-SSFMWJDK.js} +4 -4
- package/dist/{chunk-TFF2GTGN.cjs → chunk-SXQHWXEL.cjs} +2 -24
- package/dist/{chunk-IWEVV63O.cjs → chunk-UEYLANO3.cjs} +18 -16
- package/dist/chunk-VR6OGHU5.js +276 -0
- package/dist/{chunk-AF23QK5F.js → chunk-YQ4PQTBB.js} +1 -1
- package/dist/{chunk-B7V34GIH.cjs → chunk-YSGW7VV4.cjs} +88 -88
- package/dist/{chunk-3NS5C7FB.cjs → chunk-YYBW6DF2.cjs} +76 -76
- package/dist/{chunk-UFEDHACQ.js → chunk-Z7BX4TWO.js} +2 -2
- package/dist/{chunk-RUONPPMC.cjs → chunk-ZSE25IZA.cjs} +8 -8
- package/dist/color/index.cjs +7 -3
- package/dist/color/index.js +18 -14
- package/dist/export/index.cjs +8 -6
- package/dist/export/index.js +7 -5
- package/dist/extensions/index.cjs +11 -9
- package/dist/extensions/index.js +10 -8
- package/dist/gradient/index.cjs +33 -31
- package/dist/gradient/index.js +5 -3
- package/dist/image-editor/brush-presets.d.cts +4 -1
- package/dist/image-editor/brush-presets.d.ts +4 -1
- package/dist/image-editor/controller.d.cts +10 -5
- package/dist/image-editor/controller.d.ts +10 -5
- package/dist/image-editor/index.cjs +1090 -1073
- package/dist/image-editor/index.js +37 -20
- package/dist/index.cjs +17 -15
- package/dist/index.js +11 -9
- package/dist/paint-editor/brushes.d.cts +18 -1
- package/dist/paint-editor/brushes.d.ts +18 -1
- package/dist/paint-editor/controller.d.cts +29 -0
- package/dist/paint-editor/controller.d.ts +29 -0
- package/dist/paint-editor/engine.d.cts +7 -0
- package/dist/paint-editor/engine.d.ts +7 -0
- package/dist/paint-editor/index.cjs +1443 -1280
- package/dist/paint-editor/index.js +1117 -954
- package/dist/paint-editor/mark-settings.d.cts +1 -1
- package/dist/paint-editor/mark-settings.d.ts +1 -1
- package/dist/paint-editor/procedural.d.cts +4 -2
- package/dist/paint-editor/procedural.d.ts +4 -2
- package/dist/paint-editor/stamp-tip.d.cts +45 -0
- package/dist/paint-editor/stamp-tip.d.ts +45 -0
- package/dist/paint-editor/stroke.d.cts +2 -0
- package/dist/paint-editor/stroke.d.ts +2 -0
- package/dist/stickers/index.cjs +4 -2
- package/dist/stickers/index.js +6 -4
- package/dist/typography/index.cjs +3 -2
- package/dist/typography/index.js +2 -1
- package/dist/vector/index.cjs +971 -969
- package/dist/vector/index.js +8 -6
- package/dist/video-editor/index.cjs +4 -2
- package/dist/video-editor/index.js +4 -2
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +21 -11
- package/skills/pixerate-brushes-design/SKILL.md +6 -2
- package/skills/pixerate-brushes-design/evals/canvas-chalk.json +8 -8
- package/skills/pixerate-canvas/SKILL.md +3 -2
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +4 -1
- package/skills/pixerate-vector/SKILL.md +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkAVTPZO4Zcjs = require('./chunk-AVTPZO4Z.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
@@ -12,12 +13,14 @@
|
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkRSIKDWOPcjs = require('./chunk-RSIKDWOP.cjs');
|
|
16
19
|
|
|
17
20
|
// src/brushes/patch.ts
|
|
18
21
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
19
22
|
var copy = (v) => JSON.parse(JSON.stringify(v));
|
|
20
|
-
var FACETS =
|
|
23
|
+
var FACETS = _chunkRSIKDWOPcjs.BRUSH_JSON_SCHEMA.properties;
|
|
21
24
|
var BRUSH_PATCH_PROPERTIES = (() => {
|
|
22
25
|
const { id: _id, name: _name, ...rest } = FACETS;
|
|
23
26
|
const { required: _r, ...tip } = rest.tip;
|
|
@@ -49,17 +52,17 @@ function changedBrushPaths(a, b, path = "") {
|
|
|
49
52
|
// src/brushes/tools.ts
|
|
50
53
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
51
54
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
52
|
-
var FACETS2 =
|
|
55
|
+
var FACETS2 = _chunkRSIKDWOPcjs.BRUSH_JSON_SCHEMA.properties;
|
|
53
56
|
var ID = { type: "string", pattern: String(FACETS2.id.pattern), description: "Brush id from list_brush_presets (lowercase letters, digits and dashes)." };
|
|
54
57
|
var FACET_PROPS = BRUSH_PATCH_PROPERTIES;
|
|
55
|
-
var HOSTS = Object.keys(
|
|
58
|
+
var HOSTS = Object.keys(_chunkRSIKDWOPcjs.BRUSH_HOST_PROFILES);
|
|
56
59
|
var copy2 = (v) => JSON.parse(JSON.stringify(v));
|
|
57
60
|
var merge = mergeBrushPatch;
|
|
58
61
|
var changedPaths = changedBrushPaths;
|
|
59
62
|
function summary(entry, profile, withCheck) {
|
|
60
63
|
const b = entry.brush;
|
|
61
|
-
const engine =
|
|
62
|
-
const check = withCheck ?
|
|
64
|
+
const engine = _chunkRSIKDWOPcjs.resolveEngine.call(void 0, b);
|
|
65
|
+
const check = withCheck ? _chunkRSIKDWOPcjs.checkBrush.call(void 0, b, profile) : null;
|
|
63
66
|
return {
|
|
64
67
|
id: b.id,
|
|
65
68
|
name: b.name,
|
|
@@ -68,7 +71,7 @@ function summary(entry, profile, withCheck) {
|
|
|
68
71
|
...b.medium ? { medium: b.medium } : {},
|
|
69
72
|
...b.variety ? { variety: b.variety } : {},
|
|
70
73
|
...b.tool ? { tool: b.tool } : {},
|
|
71
|
-
category:
|
|
74
|
+
category: _chunkRSIKDWOPcjs.resolveCategory.call(void 0, b, engine),
|
|
72
75
|
engine,
|
|
73
76
|
tip: b.tip.shape,
|
|
74
77
|
...b.tip.size !== void 0 ? { size: b.tip.size } : {},
|
|
@@ -82,29 +85,44 @@ function summary(entry, profile, withCheck) {
|
|
|
82
85
|
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.)`;
|
|
83
86
|
var warnings = (check) => check.issues.filter((i) => i.severity === "warning");
|
|
84
87
|
function createBrushLibraryTools(library, options = {}) {
|
|
85
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
88
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkRSIKDWOPcjs.PAINT_PROFILE));
|
|
86
89
|
const hostOf = (id) => {
|
|
87
90
|
if (id === void 0) return profile;
|
|
88
|
-
const p =
|
|
89
|
-
if (!p) throw new (0,
|
|
91
|
+
const p = _chunkRSIKDWOPcjs.BRUSH_HOST_PROFILES[id];
|
|
92
|
+
if (!p) throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("invalid", `No host "${id}"; use one of: ${HOSTS.join(", ")}.`);
|
|
90
93
|
return p;
|
|
91
94
|
};
|
|
92
95
|
const entry = async (id) => {
|
|
93
96
|
const found = await library.get(id);
|
|
94
97
|
if (found) return found;
|
|
95
98
|
const ids = (await library.list()).map((e) => e.brush.id);
|
|
96
|
-
throw new (0,
|
|
99
|
+
throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("unknown_brush", `No brush "${id}". ${_chunkRSIKDWOPcjs.closest.call(void 0, id, ids)}list_brush_presets lists them.`);
|
|
100
|
+
};
|
|
101
|
+
const checkFor = async (brush, p) => {
|
|
102
|
+
const check2 = _chunkRSIKDWOPcjs.checkBrush.call(void 0, brush, p);
|
|
103
|
+
const provider = _optionalChain([options, 'access', _9 => _9.stickers, 'optionalCall', _10 => _10()]);
|
|
104
|
+
if (!provider || brush.tip.shape !== "stamp") return check2;
|
|
105
|
+
const issues = [...check2.issues];
|
|
106
|
+
for (const ref of _nullishCoalesce(brush.tip.stamps, () => ( []))) {
|
|
107
|
+
if (ref.startsWith("editor:")) continue;
|
|
108
|
+
try {
|
|
109
|
+
await _chunkAVTPZO4Zcjs.describeStickerRef.call(void 0, provider, ref);
|
|
110
|
+
} catch (e) {
|
|
111
|
+
issues.push({ facet: "tip.stamps", severity: "error", reason: `${p.name} can't load sticker "${ref}": ${e.message}`, fix: "Use a ref from find_stickers, or an editor stamp (editor:star, editor:dot\u2026)." });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { ok: !issues.some((i) => i.severity === "error"), issues };
|
|
97
115
|
};
|
|
98
116
|
const store = async (raw, overwrite) => {
|
|
99
117
|
const problems = [];
|
|
100
118
|
let brush;
|
|
101
119
|
try {
|
|
102
|
-
brush =
|
|
120
|
+
brush = _chunkRSIKDWOPcjs.normalizeBrushSpec.call(void 0, raw, problems);
|
|
103
121
|
} catch (e) {
|
|
104
|
-
throw new (0,
|
|
122
|
+
throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("invalid", e.message);
|
|
105
123
|
}
|
|
106
|
-
const check2 =
|
|
107
|
-
if (!check2.ok) throw new (0,
|
|
124
|
+
const check2 = await checkFor(brush, profile);
|
|
125
|
+
if (!check2.ok) throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("invalid", refusal(check2, profile));
|
|
108
126
|
const saved = await library.save(brush, { overwrite });
|
|
109
127
|
return { ...saved, problems, check: check2 };
|
|
110
128
|
};
|
|
@@ -115,10 +133,10 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
115
133
|
inputSchema: {
|
|
116
134
|
type: "object",
|
|
117
135
|
properties: {
|
|
118
|
-
kind: { type: "string", enum: [...
|
|
119
|
-
medium: { type: "string", enum: [...
|
|
136
|
+
kind: { type: "string", enum: [..._chunkRSIKDWOPcjs.BRUSH_KINDS], description: "mark (lays a material) or tool (works on paint already down)." },
|
|
137
|
+
medium: { type: "string", enum: [..._chunkRSIKDWOPcjs.BRUSH_MEDIA], description: "Marks laying this medium." },
|
|
120
138
|
variety: { type: "string", maxLength: 40, description: "This variety (oil, watercolor, pencil, highlighter\u2026)." },
|
|
121
|
-
tool: { type: "string", enum: [...
|
|
139
|
+
tool: { type: "string", enum: [..._chunkRSIKDWOPcjs.BRUSH_TOOLS], description: "Tools that do this." },
|
|
122
140
|
tag: { type: "string", maxLength: 40, description: "Brushes with this tag." },
|
|
123
141
|
text: { type: "string", maxLength: 200, description: "Words in the id, name, description, variety or tags (each word must match the start of one)." },
|
|
124
142
|
source: { type: "string", enum: ["all", "builtin", "user"], description: "all (default), builtin presets only, or user (saved) brushes only." },
|
|
@@ -145,8 +163,8 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
145
163
|
annotations: { title: "Describe a brush", ...READ },
|
|
146
164
|
handler: async ({ id }) => {
|
|
147
165
|
const e = await entry(id);
|
|
148
|
-
const engine =
|
|
149
|
-
return { brush: e.brush, builtin: e.builtin, engine, category:
|
|
166
|
+
const engine = _chunkRSIKDWOPcjs.resolveEngine.call(void 0, e.brush);
|
|
167
|
+
return { brush: e.brush, builtin: e.builtin, engine, category: _chunkRSIKDWOPcjs.resolveCategory.call(void 0, e.brush, engine), check: await checkFor(e.brush, profile) };
|
|
150
168
|
}
|
|
151
169
|
};
|
|
152
170
|
const check = {
|
|
@@ -164,20 +182,20 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
164
182
|
},
|
|
165
183
|
annotations: { title: "Check a brush for a host", ...READ },
|
|
166
184
|
handler: async ({ id, brush, host }) => {
|
|
167
|
-
if (id === void 0 === (brush === void 0)) throw new (0,
|
|
185
|
+
if (id === void 0 === (brush === void 0)) throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("invalid", "Give either id (a library brush) or brush (a spec), not both or neither.");
|
|
168
186
|
const p = hostOf(host);
|
|
169
187
|
let b;
|
|
170
188
|
const problems = [];
|
|
171
189
|
if (id !== void 0) b = (await entry(id)).brush;
|
|
172
190
|
else {
|
|
173
191
|
try {
|
|
174
|
-
b =
|
|
192
|
+
b = _chunkRSIKDWOPcjs.normalizeBrushSpec.call(void 0, brush, problems);
|
|
175
193
|
} catch (e) {
|
|
176
|
-
throw new (0,
|
|
194
|
+
throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("invalid", e.message);
|
|
177
195
|
}
|
|
178
196
|
}
|
|
179
|
-
const result =
|
|
180
|
-
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded:
|
|
197
|
+
const result = await checkFor(b, p);
|
|
198
|
+
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded: _chunkRSIKDWOPcjs.degrade.call(void 0, b, p) } : {} };
|
|
181
199
|
}
|
|
182
200
|
};
|
|
183
201
|
const exportTool = {
|
|
@@ -209,7 +227,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
209
227
|
annotations: { title: "Preview a brush", ...READ },
|
|
210
228
|
handler: async ({ id, width, height, color }) => {
|
|
211
229
|
const { brush } = await entry(id);
|
|
212
|
-
const own = typeof _optionalChain([brush, 'access',
|
|
230
|
+
const own = typeof _optionalChain([brush, 'access', _11 => _11.colour, 'optionalAccess', _12 => _12.default]) === "string" && /^#[0-9a-f]{6}/i.test(brush.colour.default) ? brush.colour.default.slice(0, 7) : void 0;
|
|
213
231
|
const w = _nullishCoalesce(width, () => ( 256));
|
|
214
232
|
const h = _nullishCoalesce(height, () => ( 96));
|
|
215
233
|
const image = await render(brush, { width: w, height: h, color: _nullishCoalesce(_nullishCoalesce(color, () => ( own)), () => ( "#1f2937")) });
|
|
@@ -236,12 +254,12 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
236
254
|
},
|
|
237
255
|
annotations: { title: "Save a new brush", ...WRITE },
|
|
238
256
|
handler: async ({ basedOn, ...spec }) => {
|
|
239
|
-
if (library.isBuiltin(spec.id)) throw new (0,
|
|
240
|
-
if (await library.get(spec.id)) throw new (0,
|
|
257
|
+
if (library.isBuiltin(spec.id)) throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("builtin", `"${spec.id}" is a built-in brush id; pick another id (or basedOn "${spec.id}" with a new id).`);
|
|
258
|
+
if (await library.get(spec.id)) throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("exists", `A brush "${spec.id}" exists already; pick another id, or change it with update_brush.`);
|
|
241
259
|
const base = basedOn !== void 0 ? (await entry(basedOn)).brush : void 0;
|
|
242
260
|
const raw = base ? merge(base, spec) : spec;
|
|
243
261
|
const saved = await store(raw, false);
|
|
244
|
-
return { id: saved.brush.id, brush: saved.brush, engine:
|
|
262
|
+
return { id: saved.brush.id, brush: saved.brush, engine: _chunkRSIKDWOPcjs.resolveEngine.call(void 0, saved.brush), problems: saved.problems, warnings: warnings(saved.check) };
|
|
245
263
|
}
|
|
246
264
|
},
|
|
247
265
|
{
|
|
@@ -262,7 +280,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
262
280
|
annotations: { title: "Update a brush", ...WRITE, idempotentHint: true },
|
|
263
281
|
handler: async ({ id, unset, ...patch }) => {
|
|
264
282
|
const e = await entry(id);
|
|
265
|
-
if (e.builtin) throw new (0,
|
|
283
|
+
if (e.builtin) throw new (0, _chunkRSIKDWOPcjs.BrushLibraryError)("builtin", `"${id}" is a built-in brush and can't be changed; duplicate_brush makes a copy you can change.`);
|
|
266
284
|
const base = copy2(e.brush);
|
|
267
285
|
for (const k of _nullishCoalesce(unset, () => ( []))) delete base[k];
|
|
268
286
|
const saved = await store(merge(base, { ...patch, id }), true);
|
|
@@ -321,7 +339,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
321
339
|
return tools;
|
|
322
340
|
}
|
|
323
341
|
function createBrushLibraryToolProvider(library, options = {}) {
|
|
324
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
342
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkRSIKDWOPcjs.PAINT_PROFILE));
|
|
325
343
|
const tools = createBrushLibraryTools(library, options);
|
|
326
344
|
return {
|
|
327
345
|
id: _nullishCoalesce(options.id, () => ( "brushes")),
|
|
@@ -356,7 +374,7 @@ var PICKUP_SLIDERS = [
|
|
|
356
374
|
];
|
|
357
375
|
function brushEngineControls(brush) {
|
|
358
376
|
const c = engineControls(brush);
|
|
359
|
-
const wetPaint = brush.engine === "wet" && _optionalChain([brush, 'access',
|
|
377
|
+
const wetPaint = brush.engine === "wet" && _optionalChain([brush, 'access', _13 => _13.wet, 'optionalAccess', _14 => _14.tool]) === "paint";
|
|
360
378
|
if (!c || !(wetPaint || ["dab", "mixer", "particle", "bristle", "impasto"].includes(brush.engine))) return c;
|
|
361
379
|
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 }] : [];
|
|
362
380
|
return { ...c, sliders: [...c.sliders, LIGHT_SLIDER, ...extra], light: true };
|
|
@@ -439,7 +457,7 @@ function engineControls(brush) {
|
|
|
439
457
|
impastoTool: true
|
|
440
458
|
};
|
|
441
459
|
case "wet": {
|
|
442
|
-
const tool = _nullishCoalesce(_optionalChain([brush, 'access',
|
|
460
|
+
const tool = _nullishCoalesce(_optionalChain([brush, 'access', _15 => _15.wet, 'optionalAccess', _16 => _16.tool]), () => ( "paint"));
|
|
443
461
|
const sliders = tool === "paint" ? [
|
|
444
462
|
{ path: "wet.water", label: "Water", min: 0, max: 1, step: 0.01 },
|
|
445
463
|
{ path: "wet.pigment", label: "Pigment", min: 0, max: 1, step: 0.01 },
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkRSIKDWOPcjs = require('./chunk-RSIKDWOP.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkCVFAAZXEcjs = require('./chunk-CVFAAZXE.cjs');
|
|
@@ -2533,11 +2533,11 @@ function vectorExtrudeFaces(path, params) {
|
|
|
2533
2533
|
|
|
2534
2534
|
// src/vector/brushstroke.ts
|
|
2535
2535
|
var VECTOR_BRUSHSTROKE_SCALE = 2;
|
|
2536
|
-
var PRESETS =
|
|
2536
|
+
var PRESETS = _chunkRSIKDWOPcjs.listPresets.call(void 0, _chunkRSIKDWOPcjs.VECTOR_PROFILE).map((spec) => _chunkRSIKDWOPcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
|
|
2537
2537
|
function admitted(spec) {
|
|
2538
2538
|
try {
|
|
2539
|
-
const brush =
|
|
2540
|
-
return
|
|
2539
|
+
const brush = _chunkRSIKDWOPcjs.normalizeBrushSpec.call(void 0, spec);
|
|
2540
|
+
return _chunkRSIKDWOPcjs.checkBrush.call(void 0, brush, _chunkRSIKDWOPcjs.VECTOR_PROFILE).ok && _chunkPXDIAYB6cjs.isBrushstrokeBrush.call(void 0, _chunkRSIKDWOPcjs.resolveBrush.call(void 0, brush)) ? brush : null;
|
|
2541
2541
|
} catch (e4) {
|
|
2542
2542
|
return null;
|
|
2543
2543
|
}
|
|
@@ -2546,7 +2546,7 @@ function vectorBrushstrokeBrushes(user = []) {
|
|
|
2546
2546
|
const out = [...PRESETS];
|
|
2547
2547
|
for (const raw of user) {
|
|
2548
2548
|
const brush = admitted(raw);
|
|
2549
|
-
if (brush && !out.some((b) => b.id === brush.id)) out.push(
|
|
2549
|
+
if (brush && !out.some((b) => b.id === brush.id)) out.push(_chunkRSIKDWOPcjs.resolveBrush.call(void 0, brush));
|
|
2550
2550
|
}
|
|
2551
2551
|
return out;
|
|
2552
2552
|
}
|
|
@@ -2556,7 +2556,7 @@ function vectorBrushstrokeBrush(id) {
|
|
|
2556
2556
|
function vectorBrushstrokeBrushOf(brush) {
|
|
2557
2557
|
if (brush.spec) {
|
|
2558
2558
|
const saved = admitted(brush.spec);
|
|
2559
|
-
return saved && saved.id === brush.brushId ?
|
|
2559
|
+
return saved && saved.id === brush.brushId ? _chunkRSIKDWOPcjs.resolveBrush.call(void 0, saved) : null;
|
|
2560
2560
|
}
|
|
2561
2561
|
return vectorBrushstrokeBrush(brush.brushId);
|
|
2562
2562
|
}
|
|
@@ -2564,11 +2564,11 @@ function vectorBrushstrokeBrushError(id, user = []) {
|
|
|
2564
2564
|
if (vectorBrushstrokeBrush(id)) return null;
|
|
2565
2565
|
const saved = user.find((b) => b.id === id);
|
|
2566
2566
|
const ids = vectorBrushstrokeBrushes(user).map((b) => b.id);
|
|
2567
|
-
const reasons = (b) =>
|
|
2567
|
+
const reasons = (b) => _chunkRSIKDWOPcjs.checkBrush.call(void 0, b, _chunkRSIKDWOPcjs.VECTOR_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ") || "it is not a dry dab brush.";
|
|
2568
2568
|
if (saved) return admitted(saved) ? null : `Brush "${id}" (${saved.name}) can't paint a brushstroke: ${reasons(saved)} Use one of: ${ids.join(", ")}.`;
|
|
2569
|
-
const preset =
|
|
2569
|
+
const preset = _chunkRSIKDWOPcjs.BRUSH_PRESETS.find((b) => b.id === id);
|
|
2570
2570
|
if (preset) return `Brush "${id}" (${preset.name}) can't paint a brushstroke: ${reasons(preset)} Use one of: ${ids.join(", ")}.`;
|
|
2571
|
-
return `Unknown brush "${id}". ${
|
|
2571
|
+
return `Unknown brush "${id}". ${_chunkRSIKDWOPcjs.closest.call(void 0, id, ids)}Use one of: ${ids.join(", ")} (vector.listBrushes lists them).`;
|
|
2572
2572
|
}
|
|
2573
2573
|
function sanitizeVectorBrushstroke(value, user = []) {
|
|
2574
2574
|
if (!value || typeof value !== "object") return null;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkO3ZVZSNJcjs = require('./chunk-O3ZVZSNJ.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 = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.IDENTITY_MATRIX, closed = c.closed) {
|
|
71
|
+
const pts = _chunkO3ZVZSNJcjs.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 = _chunk5YWWQ36Hcjs.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 = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.sortedVectorGradientStops.call(void 0, a);
|
|
471
|
+
let stopsB = _chunkO3ZVZSNJcjs.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 = [..._chunkO3ZVZSNJcjs.expandVectorGradientStops.call(void 0, a), ..._chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.hasExplicitGradientGeometry.call(void 0, a);
|
|
502
|
+
const eb = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.vectorGradientPoints.call(void 0, a);
|
|
516
|
+
const pb = _chunkO3ZVZSNJcjs.vectorGradientPoints.call(void 0, b);
|
|
517
517
|
if (pa.units !== pb.units) {
|
|
518
|
-
const src =
|
|
518
|
+
const src = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.hasPaint.call(void 0, a);
|
|
539
|
+
const pb = _chunkO3ZVZSNJcjs.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 && _chunkO3ZVZSNJcjs.isVectorGradient.call(void 0, a) ? a : null;
|
|
545
|
+
const gb = pb && _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.widthProfileAt.call(void 0, a, pos);
|
|
557
|
+
const y = _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.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 _chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.nodeMatrix.call(void 0, a), mb = _chunkO3ZVZSNJcjs.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 = !_chunkO3ZVZSNJcjs.isIdentityMatrix.call(void 0, ma) || !_chunkO3ZVZSNJcjs.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) : _chunkO3ZVZSNJcjs.IDENTITY_MATRIX;
|
|
638
|
+
const back = rigid ? _chunkO3ZVZSNJcjs.invertMatrix.call(void 0, m) : _chunkO3ZVZSNJcjs.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 = _chunk5YWWQ36Hcjs.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 && !_chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.IDENTITY_MATRIX) {
|
|
651
|
+
const m = _chunkO3ZVZSNJcjs.multiplyMatrices.call(void 0, _chunkO3ZVZSNJcjs.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(_chunkO3ZVZSNJcjs.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 = _chunkO3ZVZSNJcjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
|
|
676
|
+
const bb = _chunkO3ZVZSNJcjs.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, _chunkO3ZVZSNJcjs.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, _chunkO3ZVZSNJcjs.IDENTITY_MATRIX, y.m));
|
|
692
692
|
opacities.push([y.opacity, y.opacity]);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkI3Y2Q3PMcjs = require('./chunk-I3Y2Q3PM.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkSXQHWXELcjs = require('./chunk-SXQHWXEL.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunk5UEFBM2Mcjs = require('./chunk-5UEFBM2M.cjs');
|
|
@@ -87,14 +87,14 @@ function chartRgbToOklab(rgb) {
|
|
|
87
87
|
return [lab.l, lab.a, lab.b];
|
|
88
88
|
}
|
|
89
89
|
function chartColorDistance(a, b) {
|
|
90
|
-
return
|
|
90
|
+
return _chunkSXQHWXELcjs.deltaEOK.call(void 0,
|
|
91
91
|
{ r: a[0], g: a[1], b: a[2], a: 1 },
|
|
92
92
|
{ r: b[0], g: b[1], b: b[2], a: 1 }
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
function simulateChartVision(rgb, vision) {
|
|
96
96
|
if (vision === "normal") return rgb;
|
|
97
|
-
const c =
|
|
97
|
+
const c = _chunkI3Y2Q3PMcjs.simulateColorVision.call(void 0, { r: rgb[0], g: rgb[1], b: rgb[2], a: 1 }, vision);
|
|
98
98
|
return [c.r, c.g, c.b];
|
|
99
99
|
}
|
|
100
100
|
function checkChartColors(colors, options = {}) {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkYYBW6DF2cjs = require('./chunk-YYBW6DF2.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkMDLEGVENcjs = require('./chunk-MDLEGVEN.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkP6WYDBTHcjs = require('./chunk-P6WYDBTH.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
@@ -1457,7 +1457,7 @@ var ChartNodeView = (_class = class {
|
|
|
1457
1457
|
this.dom.contentEditable = "false";
|
|
1458
1458
|
this.syncAttributes();
|
|
1459
1459
|
this.key = specKey(this.node.attrs.spec);
|
|
1460
|
-
this.controller = new (0,
|
|
1460
|
+
this.controller = new (0, _chunkYYBW6DF2cjs.ChartController)({ spec: this.node.attrs.spec });
|
|
1461
1461
|
this.unsubscribe = this.controller.subscribe((state) => {
|
|
1462
1462
|
if (!state.gesture) this.writeBack();
|
|
1463
1463
|
});
|
|
@@ -1690,7 +1690,7 @@ function readSpec(value) {
|
|
|
1690
1690
|
}
|
|
1691
1691
|
}
|
|
1692
1692
|
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
1693
|
-
return
|
|
1693
|
+
return _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, input).spec;
|
|
1694
1694
|
}
|
|
1695
1695
|
var readSize = (value) => {
|
|
1696
1696
|
const n = value === null ? NaN : Number(value);
|
|
@@ -1716,10 +1716,10 @@ function staticChartSvg(node, options) {
|
|
|
1716
1716
|
const spec = node.attrs.spec;
|
|
1717
1717
|
const width = _nullishCoalesce(node.attrs.width, () => ( options.defaultWidth));
|
|
1718
1718
|
const height = _nullishCoalesce(node.attrs.height, () => ( options.defaultHeight));
|
|
1719
|
-
const scene =
|
|
1720
|
-
return
|
|
1719
|
+
const scene = _chunkMDLEGVENcjs.layoutChart.call(void 0, spec, { width, height, theme: options.theme, selection: null });
|
|
1720
|
+
return _chunkYYBW6DF2cjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1721
1721
|
ariaLabel: spec.title || "Chart",
|
|
1722
|
-
description:
|
|
1722
|
+
description: _chunkYYBW6DF2cjs.describeChart.call(void 0, spec),
|
|
1723
1723
|
attrs: { style: "max-width: 100%; height: auto; display: block" }
|
|
1724
1724
|
});
|
|
1725
1725
|
}
|
|
@@ -1735,7 +1735,7 @@ var Chart = _core.Node.create({
|
|
|
1735
1735
|
return {
|
|
1736
1736
|
HTMLAttributes: {},
|
|
1737
1737
|
nodeView: null,
|
|
1738
|
-
theme:
|
|
1738
|
+
theme: _chunkP6WYDBTHcjs.DEFAULT_CHART_THEME,
|
|
1739
1739
|
defaultWidth: 640,
|
|
1740
1740
|
defaultHeight: 320,
|
|
1741
1741
|
generateId: () => generateStructureId("chart")
|
|
@@ -1749,7 +1749,7 @@ var Chart = _core.Node.create({
|
|
|
1749
1749
|
renderHTML: (attributes) => attributes.id ? { "data-chart-id": attributes.id } : {}
|
|
1750
1750
|
},
|
|
1751
1751
|
spec: {
|
|
1752
|
-
default:
|
|
1752
|
+
default: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, {}).spec,
|
|
1753
1753
|
// null (no `data-chart`) keeps what the parse rule found, e.g. a mermaid block's spec.
|
|
1754
1754
|
parseHTML: (element) => readSpec(element.getAttribute("data-chart")),
|
|
1755
1755
|
renderHTML: (attributes) => ({
|
|
@@ -1787,7 +1787,7 @@ var Chart = _core.Node.create({
|
|
|
1787
1787
|
const code = element.querySelector("code");
|
|
1788
1788
|
const language = _nullishCoalesce(_nullishCoalesce(_optionalChain([code, 'optionalAccess', _47 => _47.getAttribute, 'call', _48 => _48("class")]), () => ( element.getAttribute("data-language"))), () => ( ""));
|
|
1789
1789
|
if (!/(?:^|\s)language-mermaid(?:\s|$)/.test(language) && language !== "mermaid") return false;
|
|
1790
|
-
const result =
|
|
1790
|
+
const result = _chunkYYBW6DF2cjs.chartFromMermaid.call(void 0, _nullishCoalesce((_nullishCoalesce(code, () => ( element))).textContent, () => ( "")));
|
|
1791
1791
|
return result.family ? { spec: result.spec } : false;
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
@@ -1811,7 +1811,7 @@ var Chart = _core.Node.create({
|
|
|
1811
1811
|
return {
|
|
1812
1812
|
markdown: {
|
|
1813
1813
|
serialize(state, node) {
|
|
1814
|
-
const text =
|
|
1814
|
+
const text = _chunkYYBW6DF2cjs.chartToMermaid.call(void 0, node.attrs.spec);
|
|
1815
1815
|
const fence = "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
|
|
1816
1816
|
state.write(`${fence}mermaid
|
|
1817
1817
|
`);
|
|
@@ -1833,7 +1833,7 @@ var Chart = _core.Node.create({
|
|
|
1833
1833
|
type: this.name,
|
|
1834
1834
|
attrs: {
|
|
1835
1835
|
id: _nullishCoalesce(options.id, () => ( this.options.generateId())),
|
|
1836
|
-
spec:
|
|
1836
|
+
spec: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, _nullishCoalesce(options.spec, () => ( {}))).spec,
|
|
1837
1837
|
width: _nullishCoalesce(options.width, () => ( null)),
|
|
1838
1838
|
height: _nullishCoalesce(options.height, () => ( this.options.defaultHeight))
|
|
1839
1839
|
}
|
|
@@ -1844,7 +1844,7 @@ var Chart = _core.Node.create({
|
|
|
1844
1844
|
if (dispatch) {
|
|
1845
1845
|
tr.setNodeMarkup(chart.pos, void 0, {
|
|
1846
1846
|
...chart.node.attrs,
|
|
1847
|
-
...changes.spec !== void 0 ? { spec:
|
|
1847
|
+
...changes.spec !== void 0 ? { spec: _chunkP6WYDBTHcjs.normalizeChartSpec.call(void 0, changes.spec).spec } : {},
|
|
1848
1848
|
...changes.width !== void 0 ? { width: changes.width } : {},
|
|
1849
1849
|
...changes.height !== void 0 ? { height: changes.height } : {}
|
|
1850
1850
|
});
|
|
@@ -1951,14 +1951,14 @@ var Sparkline = _core.Node.create({
|
|
|
1951
1951
|
return [{ tag: 'span[data-type="sparkline"]', priority: 60 }];
|
|
1952
1952
|
},
|
|
1953
1953
|
renderHTML({ node, HTMLAttributes }) {
|
|
1954
|
-
const scene =
|
|
1954
|
+
const scene = _chunkYYBW6DF2cjs.layoutSparkline.call(void 0, node.attrs.values, {
|
|
1955
1955
|
kind: node.attrs.kind,
|
|
1956
1956
|
width: node.attrs.width,
|
|
1957
1957
|
height: node.attrs.height,
|
|
1958
1958
|
color: _nullishCoalesce(node.attrs.color, () => ( this.options.color)),
|
|
1959
1959
|
negativeColor: this.options.negativeColor
|
|
1960
1960
|
});
|
|
1961
|
-
const svg =
|
|
1961
|
+
const svg = _chunkYYBW6DF2cjs.chartSceneToDomSpec.call(void 0, scene, {
|
|
1962
1962
|
ariaLabel: sparklineLabel(node),
|
|
1963
1963
|
attrs: { style: "display: inline-block; vertical-align: middle" }
|
|
1964
1964
|
});
|