@pixerate/editor 0.265.0 → 0.266.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/agent/index.cjs +4 -3
- package/dist/agent/index.js +3 -2
- package/dist/animation-editor/index.cjs +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/brushes/index.cjs +56 -56
- package/dist/brushes/index.js +3 -3
- package/dist/brushes/presets.d.cts +3 -3
- package/dist/brushes/presets.d.ts +3 -3
- package/dist/brushes/resolve.d.cts +1 -1
- package/dist/brushes/resolve.d.ts +1 -1
- package/dist/{brushstrokeRender-JQ2XQRUD.cjs → brushstrokeRender-FSUWXUZY.cjs} +15 -15
- package/dist/{brushstrokeRender-4UB6NRJW.js → brushstrokeRender-KD453OBX.js} +3 -3
- package/dist/canvas/index.cjs +15 -14
- package/dist/canvas/index.js +3 -2
- package/dist/{chunk-Q6RVVJW6.js → chunk-3C33YTNN.js} +1 -1
- package/dist/{chunk-NOP4Y5AB.cjs → chunk-3SBLVGOM.cjs} +23 -23
- package/dist/{chunk-TMDDMJCR.js → chunk-472INMWH.js} +4 -2
- package/dist/{chunk-ZS7LB2MV.js → chunk-4ODRXQRW.js} +1 -1
- package/dist/chunk-55ALHYJY.js +289 -0
- package/dist/{chunk-NHA26O5X.cjs → chunk-7KNW3WXZ.cjs} +14 -12
- package/dist/{chunk-O53MOGXG.cjs → chunk-AQZQWXEU.cjs} +35 -35
- package/dist/{chunk-J4SGJCPW.js → chunk-CIJBSUM5.js} +1133 -1806
- package/dist/{chunk-XDNWQMHY.js → chunk-DXYHQ2VN.js} +1 -1
- package/dist/chunk-E2Z4UARJ.cjs +289 -0
- package/dist/{chunk-BLR4KWYQ.js → chunk-EZOJBP4D.js} +1 -1
- package/dist/chunk-HAEB3MZD.js +664 -0
- package/dist/chunk-KIJIONZF.cjs +664 -0
- package/dist/{chunk-Z2Z2OHRM.js → chunk-LK4SXL3V.js} +1 -1
- package/dist/{chunk-DGXTEPCU.cjs → chunk-MVUQSK5J.cjs} +86 -86
- package/dist/{chunk-LPFQHVCO.js → chunk-PXXXRCME.js} +1 -284
- package/dist/{chunk-T7QSEKDY.cjs → chunk-QJVOJUTD.cjs} +4 -287
- package/dist/{chunk-WY23AUCA.js → chunk-R44Y3EFS.js} +1 -1
- package/dist/{chunk-677777GH.cjs → chunk-RFJZGTHA.cjs} +1137 -1810
- package/dist/{chunk-7PW6VCNW.js → chunk-T2LDTEXK.js} +1 -1
- package/dist/{chunk-7NQOGWLM.cjs → chunk-TOID45I2.cjs} +1 -1
- package/dist/{chunk-DEBIFWY6.cjs → chunk-VRK322ZC.cjs} +2 -2
- package/dist/{chunk-5OE4ZZ6V.cjs → chunk-WLUVZKVD.cjs} +30 -30
- package/dist/{chunk-ZHRVCW3M.cjs → chunk-XRXFVRGY.cjs} +10 -10
- package/dist/commands/index.cjs +26 -656
- package/dist/commands/index.js +18 -648
- package/dist/image-editor/index.cjs +786 -786
- package/dist/image-editor/index.js +4 -4
- package/dist/paint-editor/brush-model.d.cts +273 -0
- package/dist/paint-editor/brush-model.d.ts +273 -0
- package/dist/paint-editor/brushes.d.cts +6 -270
- package/dist/paint-editor/brushes.d.ts +6 -270
- package/dist/paint-editor/index.cjs +79 -79
- package/dist/paint-editor/index.js +5 -5
- package/dist/paint-editor/ui.d.cts +1 -1
- package/dist/paint-editor/ui.d.ts +1 -1
- package/dist/vector/contract.d.cts +52 -0
- package/dist/vector/contract.d.ts +52 -0
- package/dist/vector/index.cjs +1167 -969
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +203 -5
- package/package.json +1 -1
package/dist/brushes/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkWLUVZKVDcjs = require('../chunk-WLUVZKVD.cjs');
|
|
12
12
|
require('../chunk-PE6YJMQT.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ require('../chunk-PE6YJMQT.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkVRK322ZCcjs = require('../chunk-VRK322ZC.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -69,7 +69,7 @@ var _chunkDEBIFWY6cjs = require('../chunk-DEBIFWY6.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _chunkRFJZGTHAcjs = require('../chunk-RFJZGTHA.cjs');
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
var _chunkOTN6VB5Scjs = require('../chunk-OTN6VB5S.cjs');
|
|
@@ -122,20 +122,20 @@ var ARIA = {
|
|
|
122
122
|
"light.pressure": "Light follows pressure"
|
|
123
123
|
};
|
|
124
124
|
var aria = (path, label) => _nullishCoalesce(ARIA[path], () => ( `Brush ${label.toLowerCase()}`));
|
|
125
|
-
function brushEditorSections(brush, profile =
|
|
126
|
-
const resolved =
|
|
127
|
-
const engine =
|
|
128
|
-
const fieldOf = (facet) =>
|
|
129
|
-
const facetOf = (enginePath) => _optionalChain([(_nullishCoalesce(
|
|
125
|
+
function brushEditorSections(brush, profile = _chunkRFJZGTHAcjs.PAINT_PROFILE) {
|
|
126
|
+
const resolved = _chunkRFJZGTHAcjs.resolveBrush.call(void 0, brush);
|
|
127
|
+
const engine = _chunkRFJZGTHAcjs.resolveEngine.call(void 0, brush);
|
|
128
|
+
const fieldOf = (facet) => _chunkRFJZGTHAcjs.BRUSH_FIELDS.find((f) => f.facet === facet && f.engines.includes(engine));
|
|
129
|
+
const facetOf = (enginePath) => _optionalChain([(_nullishCoalesce(_chunkRFJZGTHAcjs.BRUSH_FIELDS.find((f) => f.engine === enginePath && f.engines.includes(engine)), () => ( _chunkRFJZGTHAcjs.BRUSH_FIELDS.find((f) => f.engine === enginePath)))), 'optionalAccess', _ => _.facet]);
|
|
130
130
|
const value = (path) => {
|
|
131
|
-
const own =
|
|
131
|
+
const own = _chunkRFJZGTHAcjs.getPath.call(void 0, brush, path);
|
|
132
132
|
if (own !== void 0) return own;
|
|
133
133
|
const field = fieldOf(path);
|
|
134
134
|
if (!field) return void 0;
|
|
135
|
-
const v =
|
|
135
|
+
const v = _chunkRFJZGTHAcjs.getPath.call(void 0, resolved, field.engine);
|
|
136
136
|
return field.map ? field.map.toFacet(v) : v;
|
|
137
137
|
};
|
|
138
|
-
const issues =
|
|
138
|
+
const issues = _chunkRFJZGTHAcjs.checkBrush.call(void 0, brush, profile).issues;
|
|
139
139
|
const warned = new Map(issues.filter((i) => i.severity === "warning").map((i) => [i.facet, i.reason]));
|
|
140
140
|
const refused = new Set(issues.filter((i) => i.severity === "error").map((i) => i.facet));
|
|
141
141
|
const full = (s) => s === "full";
|
|
@@ -164,18 +164,18 @@ function brushEditorSections(brush, profile = _chunk677777GHcjs.PAINT_PROFILE) {
|
|
|
164
164
|
const exchangeFull = full(_optionalChain([brush, 'access', _9 => _9.behaviour, 'optionalAccess', _10 => _10.exchange, 'optionalAccess', _11 => _11.reservoir]) ? profile.reservoir : profile.exchange);
|
|
165
165
|
add("medium", "Medium", [
|
|
166
166
|
profile.kinds.length > 1 && profile.kinds.includes(brush.kind) && choice("kind", "Kind", options(profile.kinds, { mark: "Lays a material", tool: "Works on paint" })),
|
|
167
|
-
!isTool && choice("medium", "Medium", [{ value: "", label: "Any" }, ...options(
|
|
167
|
+
!isTool && choice("medium", "Medium", [{ value: "", label: "Any" }, ...options(_chunkRFJZGTHAcjs.BRUSH_MEDIA, MEDIUM_LABELS)], ""),
|
|
168
168
|
!isTool && withNote({ kind: "text", path: "variety", label: "Variety", ariaLabel: "Brush variety", value: _nullishCoalesce(brush.variety, () => ( "")), placeholder: "pencil, oil, highlighter\u2026" }),
|
|
169
169
|
isTool && !!brush.tool && profile.tools.includes(brush.tool) && choice("tool", "Tool", options(profile.tools, TOOL_LABELS))
|
|
170
170
|
]);
|
|
171
|
-
const engineControls =
|
|
172
|
-
const tipSliders =
|
|
171
|
+
const engineControls = _chunkWLUVZKVDcjs.brushEngineControls.call(void 0, resolved);
|
|
172
|
+
const tipSliders = _chunkWLUVZKVDcjs.BRUSH_SLIDERS.filter((c) => c.path.startsWith("tip.") && c.path !== "tip.smoothing");
|
|
173
173
|
add("shape", "Shape", [
|
|
174
174
|
!refused.has("tip.shape") && choice("tip.shape", "Tip", options(profile.tipShapes.filter((s) => !isTool || s !== "stamp"), SHAPE_LABELS)),
|
|
175
175
|
...tipSliders.map((c) => slider(c)),
|
|
176
176
|
engine === "dab" && choice("tip.blend", "Blend", _chunk2VX55NFMcjs.BLEND_MODES.map((m) => ({ value: m.id, label: m.label })), "normal"),
|
|
177
177
|
...shape === "bristle" && engineOk && engineControls ? engineControls.sliders.filter((c) => c.path.startsWith("bristle.")).map((c) => slider(c)) : [],
|
|
178
|
-
shape === "stamp" && engineOk && withNote({ kind: "stamps", path: "tip.stamps", label: "Stamps", ariaLabel: "Brush stamps", value: [..._nullishCoalesce(value("tip.stamps"), () => ( []))], max: marks === "particles" ?
|
|
178
|
+
shape === "stamp" && engineOk && withNote({ kind: "stamps", path: "tip.stamps", label: "Stamps", ariaLabel: "Brush stamps", value: [..._nullishCoalesce(value("tip.stamps"), () => ( []))], max: marks === "particles" ? _chunkRFJZGTHAcjs.MAX_DOT_TEXTURES : _chunkRFJZGTHAcjs.MAX_STICKER_STAMPS, options: STAMP_OPTIONS })
|
|
179
179
|
]);
|
|
180
180
|
if (!isTool && profile.marks.length > 1 && engineOk) {
|
|
181
181
|
const particles = marks === "particles" && engineControls ? engineControls.sliders.filter((c) => c.path.startsWith("particle.") && c.path !== "particle.waveSpeed") : [];
|
|
@@ -183,21 +183,21 @@ function brushEditorSections(brush, profile = _chunk677777GHcjs.PAINT_PROFILE) {
|
|
|
183
183
|
const render = value("marks.render");
|
|
184
184
|
add("marks", "Marks", [
|
|
185
185
|
choice("marks.kind", "Laid as", options(profile.marks, MARKS_LABELS), "continuous"),
|
|
186
|
-
marks === "particles" && choice("marks.physics", "Particles", options(
|
|
187
|
-
marks === "particles" && choice("marks.render", "Drawn as", options(
|
|
188
|
-
marks === "particles" && render === "ribbon" && choice("marks.ribbonPairs", "Ribbon joins", options(
|
|
189
|
-
marks === "particles" && shape === "stamp" && choice("marks.stampOrder", "Texture order", options(
|
|
190
|
-
marks === "particles" && shape === "stamp" && choice("marks.stampRotation", "Texture turn", options(
|
|
186
|
+
marks === "particles" && choice("marks.physics", "Particles", options(_chunkRFJZGTHAcjs.PARTICLE_KINDS, PHYSICS_LABELS)),
|
|
187
|
+
marks === "particles" && choice("marks.render", "Drawn as", options(_chunkRFJZGTHAcjs.PARTICLE_RENDERS, RENDER_LABELS)),
|
|
188
|
+
marks === "particles" && render === "ribbon" && choice("marks.ribbonPairs", "Ribbon joins", options(_chunkRFJZGTHAcjs.RIBBON_PAIRS, { adjacent: "Neighbours", "first-last": "Outermost" })),
|
|
189
|
+
marks === "particles" && shape === "stamp" && choice("marks.stampOrder", "Texture order", options(_chunkRFJZGTHAcjs.DOT_TEXTURE_ORDERS, { sequence: "In turn", random: "Random" })),
|
|
190
|
+
marks === "particles" && shape === "stamp" && choice("marks.stampRotation", "Texture turn", options(_chunkRFJZGTHAcjs.DOT_ROTATIONS, { follow: "Follow motion", random: "Random", fixed: "Tip angle" })),
|
|
191
191
|
...particles.map((c) => slider(c)),
|
|
192
192
|
...objects.map((c) => slider(c))
|
|
193
193
|
]);
|
|
194
194
|
}
|
|
195
|
-
const feel =
|
|
195
|
+
const feel = _chunkWLUVZKVDcjs.BRUSH_SLIDERS.filter((c) => ["tip.smoothing", "pressureSmoothing", "dynamics.minSize", "dynamics.tiltSize", "dynamics.velocitySize"].includes(c.path)).filter((c) => !(c.path === "dynamics.tiltSize" && !full(profile.tilt)) && !(c.path === "dynamics.velocitySize" && !full(profile.velocity)));
|
|
196
196
|
add("feel", "Feel", [
|
|
197
197
|
...feel.map((c) => slider(c)),
|
|
198
198
|
toggle("dynamics.pressureSize", "Pressure \u2192 size"),
|
|
199
199
|
toggle("dynamics.pressureOpacity", "Pressure \u2192 opacity"),
|
|
200
|
-
choice("dynamics.rotation", "Rotation", options(
|
|
200
|
+
choice("dynamics.rotation", "Rotation", options(_chunkRFJZGTHAcjs.BRUSH_ROTATIONS, ROTATION_LABELS))
|
|
201
201
|
]);
|
|
202
202
|
const surfaces = profile.surfaces;
|
|
203
203
|
const engineSliders = (engineOk ? _nullishCoalesce(_optionalChain([engineControls, 'optionalAccess', _12 => _12.sliders]), () => ( [])) : []).filter((c) => !/^(bristle|particle|sticker)\./.test(c.path) && c.path !== "light.amount" && c.path !== "impasto.rim" && c.path !== "impasto.clarity");
|
|
@@ -205,8 +205,8 @@ function brushEditorSections(brush, profile = _chunk677777GHcjs.PAINT_PROFILE) {
|
|
|
205
205
|
add("behaviour", _nullishCoalesce(_optionalChain([engineControls, 'optionalAccess', _15 => _15.title]), () => ( "Behaviour")), [
|
|
206
206
|
!isTool && surfaces.length > 1 && !refused.has("behaviour.surface") && choice("behaviour.surface", "Surface", options(surfaces, SURFACE_LABELS), "dry"),
|
|
207
207
|
full(profile.grain) && slider({ path: "grain", label: "Grain", min: 0, max: 1, step: 0.01 }, "behaviour.grain"),
|
|
208
|
-
engine === "wet" && engineOk && !isTool && choice("behaviour.wet.medium", "Medium", options(
|
|
209
|
-
engine === "impasto" && engineOk && choice("behaviour.thick.applicator", "Tool", options(
|
|
208
|
+
engine === "wet" && engineOk && !isTool && choice("behaviour.wet.medium", "Medium", options(_chunkRFJZGTHAcjs.WET_MEDIA, WET_MEDIUM_LABELS), "watercolor"),
|
|
209
|
+
engine === "impasto" && engineOk && choice("behaviour.thick.applicator", "Tool", options(_chunkRFJZGTHAcjs.IMPASTO_TOOLS, APPLICATOR_LABELS), "brush"),
|
|
210
210
|
...engineSliders.map((c) => exchangeOk(facetOf(c.path)) ? slider(c) : null),
|
|
211
211
|
engineOk && _optionalChain([engineControls, 'optionalAccess', _16 => _16.mixingPath]) && (engine === "wet" || exchangeFull) && fieldOf("behaviour.mixing") && choice("behaviour.mixing", "Mixing", options(["pigment", "rgb"], { pigment: "Pigment", rgb: "RGB" })),
|
|
212
212
|
engineOk && _optionalChain([engineControls, 'optionalAccess', _17 => _17.dirty]) && exchangeFull && fieldOf("behaviour.exchange.dirty") && toggle("behaviour.exchange.dirty", "Dirty brush"),
|
|
@@ -234,7 +234,7 @@ function brushEditorSections(brush, profile = _chunk677777GHcjs.PAINT_PROFILE) {
|
|
|
234
234
|
label: "Palette",
|
|
235
235
|
ariaLabel: "Brush palette",
|
|
236
236
|
value: (_nullishCoalesce(_optionalChain([brush, 'access', _24 => _24.colour, 'optionalAccess', _25 => _25.palette]), () => ( []))).flatMap((c) => _chunkMLLTWAXHcjs.isDualColor.call(void 0, c) ? [{ light: _chunkJBZRVLXVcjs.brushColourHex.call(void 0, c, "light"), dark: _chunkJBZRVLXVcjs.brushColourHex.call(void 0, c, "dark") }] : hex(c) ? [hex(c)] : []),
|
|
237
|
-
max:
|
|
237
|
+
max: _chunkRFJZGTHAcjs.MAX_BRUSH_PALETTE
|
|
238
238
|
}),
|
|
239
239
|
toggle("colour.own", "Always its own colour")
|
|
240
240
|
]);
|
|
@@ -268,15 +268,15 @@ function hiddenLabel(issue, b) {
|
|
|
268
268
|
case "dynamics.tilt":
|
|
269
269
|
return "tilt dynamics";
|
|
270
270
|
case "colour.default":
|
|
271
|
-
return `a ${
|
|
271
|
+
return `a ${_chunkRFJZGTHAcjs.brushColourKind.call(void 0, b.colour.default)} default colour`;
|
|
272
272
|
default:
|
|
273
273
|
return null;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
var sentence = (words) => words.length < 2 ? _nullishCoalesce(words[0], () => ( "")) : `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`;
|
|
277
|
-
function brushEditorScope(brush, profile =
|
|
277
|
+
function brushEditorScope(brush, profile = _chunkRFJZGTHAcjs.PAINT_PROFILE) {
|
|
278
278
|
const hidden = [];
|
|
279
|
-
for (const issue of
|
|
279
|
+
for (const issue of _chunkRFJZGTHAcjs.checkBrush.call(void 0, brush, profile).issues) {
|
|
280
280
|
const label = hiddenLabel(issue, brush);
|
|
281
281
|
if (label && !hidden.some((h) => h.label === label)) hidden.push({ facet: issue.facet, label });
|
|
282
282
|
}
|
|
@@ -289,17 +289,17 @@ function newBrushFor(profile, from, name = "New brush") {
|
|
|
289
289
|
const id = brushIdFromName(name);
|
|
290
290
|
const base = { id, name, kind: profile.kinds.includes("mark") ? "mark" : profile.kinds[0], ...profile.kinds.includes("mark") ? {} : { tool: profile.tools[0] }, tip: { shape: profile.tipShapes.includes("round") ? "round" : profile.tipShapes[0] } };
|
|
291
291
|
if (from) {
|
|
292
|
-
const stripped =
|
|
292
|
+
const stripped = _chunkRFJZGTHAcjs.degrade.call(void 0, from, profile, { ignored: true });
|
|
293
293
|
if (!stripped.issues.length) return { ...stripped.brush, id, name };
|
|
294
294
|
}
|
|
295
295
|
return base;
|
|
296
296
|
}
|
|
297
297
|
async function saveBrushEdit(library, options2) {
|
|
298
298
|
const { original, profile } = options2;
|
|
299
|
-
const check =
|
|
299
|
+
const check = _chunkRFJZGTHAcjs.checkBrushEdit.call(void 0, original, options2.brush, profile);
|
|
300
300
|
if (!check.ok) {
|
|
301
301
|
const errors = check.issues.filter((i) => i.severity === "error").map((i) => `${i.facet}: ${i.reason} ${i.fix}`);
|
|
302
|
-
throw new (0,
|
|
302
|
+
throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("invalid", `${profile.name} can't use this brush: ${errors.join(" ")} Nothing was saved.`);
|
|
303
303
|
}
|
|
304
304
|
const inPlace = !!original && options2.name === void 0 && !library.isBuiltin(original.id) && original.id === options2.brush.id && !!await library.get(original.id);
|
|
305
305
|
let brush = options2.brush;
|
|
@@ -335,13 +335,13 @@ function setBrushEditorValue(brush, path, value) {
|
|
|
335
335
|
if (value !== "bristle") delete next.tip.bristle;
|
|
336
336
|
} else if (value === void 0 || value === "") {
|
|
337
337
|
const keys = path.split(".");
|
|
338
|
-
const parent =
|
|
338
|
+
const parent = _chunkRFJZGTHAcjs.getPath.call(void 0, next, keys.slice(0, -1).join("."));
|
|
339
339
|
if (keys.length === 1) delete next[keys[0]];
|
|
340
340
|
else if (parent) delete parent[keys[keys.length - 1]];
|
|
341
|
-
} else
|
|
341
|
+
} else _chunkRFJZGTHAcjs.setPath.call(void 0, next, path, value);
|
|
342
342
|
const problems = [];
|
|
343
343
|
try {
|
|
344
|
-
return { brush:
|
|
344
|
+
return { brush: _chunkRFJZGTHAcjs.normalizeBrushSpec.call(void 0, JSON.parse(JSON.stringify(next)), problems), problems };
|
|
345
345
|
} catch (e) {
|
|
346
346
|
return { brush, problems: [e.message] };
|
|
347
347
|
}
|
|
@@ -357,7 +357,7 @@ function brushLibraryGroups(entries, filter = {}) {
|
|
|
357
357
|
const text = words([b.id, b.name, _nullishCoalesce(b.variety, () => ( "")), _nullishCoalesce(b.medium, () => ( "")), _nullishCoalesce(b.tool, () => ( "")), ..._nullishCoalesce(b.tags, () => ( []))].join(" "));
|
|
358
358
|
if (!wanted.every((w) => text.some((t) => t.startsWith(w)))) continue;
|
|
359
359
|
}
|
|
360
|
-
if (filter.profile && !
|
|
360
|
+
if (filter.profile && !_chunkRFJZGTHAcjs.checkBrush.call(void 0, b, filter.profile).ok) continue;
|
|
361
361
|
const id = b.kind === "tool" ? "tools" : _nullishCoalesce(b.medium, () => ( "other"));
|
|
362
362
|
let g = groups.get(id);
|
|
363
363
|
if (!g) groups.set(id, g = { id, title: id === "tools" ? "Tools" : id === "other" ? "Other" : MEDIUM_LABELS[id], varieties: [] });
|
|
@@ -379,11 +379,11 @@ var BRUSH_PROFILE_JSON_SCHEMA = {
|
|
|
379
379
|
properties: {
|
|
380
380
|
id: { type: "string", description: "paint, image, canvas, vector\u2026" },
|
|
381
381
|
name: { type: "string", description: "Display name, used in messages." },
|
|
382
|
-
kinds: { type: "array", items: { type: "string", enum: [...
|
|
383
|
-
tools: { type: "array", items: { type: "string", enum: [...
|
|
384
|
-
tipShapes: { type: "array", items: { type: "string", enum: [...
|
|
385
|
-
marks: { type: "array", items: { type: "string", enum: [...
|
|
386
|
-
surfaces: { type: "array", items: { type: "string", enum: [...
|
|
382
|
+
kinds: { type: "array", items: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_KINDS] }, description: "Brush kinds it has." },
|
|
383
|
+
tools: { type: "array", items: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_TOOLS] }, description: "Tools it has (kind tool)." },
|
|
384
|
+
tipShapes: { type: "array", items: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_TIP_SHAPES] }, description: "Tip shapes it renders." },
|
|
385
|
+
marks: { type: "array", items: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_MARKS_KINDS] }, description: "Marks kinds it renders." },
|
|
386
|
+
surfaces: { type: "array", items: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_SURFACES] }, description: "Surfaces it renders." },
|
|
387
387
|
exchange: { ...SUPPORT, description: "Picking paint up and mixing it in." },
|
|
388
388
|
reservoir: { ...SUPPORT, description: "The Mixer Brush reservoir." },
|
|
389
389
|
grain: { ...SUPPORT, description: "Paper grain response." },
|
|
@@ -408,7 +408,7 @@ var BRUSH_LIBRARY_FILE_JSON_SCHEMA = {
|
|
|
408
408
|
additionalProperties: false
|
|
409
409
|
};
|
|
410
410
|
function migrationInputs() {
|
|
411
|
-
const pick = (id) =>
|
|
411
|
+
const pick = (id) => _chunkRFJZGTHAcjs.brushToJSON.call(void 0, _chunkRFJZGTHAcjs.BUILTIN_BRUSHES.find((b) => b.id === id));
|
|
412
412
|
return [
|
|
413
413
|
{ id: "plain", name: "Plain" },
|
|
414
414
|
pick("pencil-6b"),
|
|
@@ -430,34 +430,34 @@ function migrationInputs() {
|
|
|
430
430
|
function editorSectionFixtures() {
|
|
431
431
|
const ids = ["highlighter", "chalk", "watercolor-wash", "hair-strands", "mixer-brush", "blender", "spray-can"];
|
|
432
432
|
return ids.flatMap(
|
|
433
|
-
(id) => Object.keys(
|
|
434
|
-
const brush =
|
|
435
|
-
return { brush: id, host, sections: brushEditorSections(brush,
|
|
433
|
+
(id) => Object.keys(_chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES).map((host) => {
|
|
434
|
+
const brush = _chunkRFJZGTHAcjs.BRUSH_PRESETS.find((b) => b.id === id);
|
|
435
|
+
return { brush: id, host, sections: brushEditorSections(brush, _chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES[host]) };
|
|
436
436
|
})
|
|
437
437
|
);
|
|
438
438
|
}
|
|
439
439
|
function toolDefinitions() {
|
|
440
|
-
const library =
|
|
441
|
-
const toolsFor = (host) =>
|
|
440
|
+
const library = _chunkRFJZGTHAcjs.createBrushLibrary.call(void 0, );
|
|
441
|
+
const toolsFor = (host) => _chunkWLUVZKVDcjs.createBrushLibraryTools.call(void 0, library, { profile: _chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES[host], renderPreview: () => ({ data: "", mimeType: "image/png" }) });
|
|
442
442
|
return {
|
|
443
443
|
tools: toolsFor("paint").map((t) => ({ name: t.name, title: t.title, description: t.description, inputSchema: t.inputSchema, annotations: t.annotations })),
|
|
444
|
-
hosts: Object.fromEntries(Object.keys(
|
|
444
|
+
hosts: Object.fromEntries(Object.keys(_chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES).map((host) => [host, toolsFor(host).map((t) => t.name)]))
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
447
|
function brushContracts() {
|
|
448
|
-
const presets =
|
|
449
|
-
const resolved =
|
|
450
|
-
const profiles = Object.values(
|
|
451
|
-
const checks =
|
|
448
|
+
const presets = _chunkRFJZGTHAcjs.BRUSH_PRESETS.map((b) => JSON.parse(JSON.stringify(b)));
|
|
449
|
+
const resolved = _chunkRFJZGTHAcjs.BRUSH_PRESETS.map((b) => ({ id: b.id, engine: _chunkRFJZGTHAcjs.resolveEngine.call(void 0, b), category: _chunkRFJZGTHAcjs.resolveCategory.call(void 0, b), brush: _chunkRFJZGTHAcjs.brushToJSON.call(void 0, _chunkRFJZGTHAcjs.resolveBrush.call(void 0, b)) }));
|
|
450
|
+
const profiles = Object.values(_chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES);
|
|
451
|
+
const checks = _chunkRFJZGTHAcjs.BRUSH_PRESETS.map((b) => ({
|
|
452
452
|
id: b.id,
|
|
453
453
|
hosts: Object.fromEntries(profiles.map((p) => {
|
|
454
|
-
const c =
|
|
454
|
+
const c = _chunkRFJZGTHAcjs.checkBrush.call(void 0, b, p);
|
|
455
455
|
return [p.id, { ok: c.ok, issues: c.issues.map(({ facet, severity }) => ({ facet, severity })) }];
|
|
456
456
|
}))
|
|
457
457
|
}));
|
|
458
|
-
const migrations = migrationInputs().map((input) => ({ input, output:
|
|
458
|
+
const migrations = migrationInputs().map((input) => ({ input, output: _chunkRFJZGTHAcjs.migrateBrushV1.call(void 0, input), resolved: _chunkRFJZGTHAcjs.brushToJSON.call(void 0, _chunkRFJZGTHAcjs.resolveBrush.call(void 0, _chunkRFJZGTHAcjs.migrateBrushV1.call(void 0, input))), engine: _chunkRFJZGTHAcjs.normalizePaintBrush.call(void 0, input).engine }));
|
|
459
459
|
const files = {
|
|
460
|
-
"brush.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "brush.schema.json", ...
|
|
460
|
+
"brush.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "brush.schema.json", ..._chunkRFJZGTHAcjs.BRUSH_JSON_SCHEMA },
|
|
461
461
|
"profile.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "profile.schema.json", ...BRUSH_PROFILE_JSON_SCHEMA },
|
|
462
462
|
"library-file.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "library-file.schema.json", ...BRUSH_LIBRARY_FILE_JSON_SCHEMA },
|
|
463
463
|
"presets.json": presets,
|
|
@@ -471,7 +471,7 @@ function brushContracts() {
|
|
|
471
471
|
files["manifest.json"] = {
|
|
472
472
|
domain: "brushes",
|
|
473
473
|
formatVersion: BRUSH_CONTRACT_FORMAT_VERSION,
|
|
474
|
-
limits: { maxPalette:
|
|
474
|
+
limits: { maxPalette: _chunkRFJZGTHAcjs.MAX_BRUSH_PALETTE },
|
|
475
475
|
counts: { presets: presets.length, profiles: profiles.length, migrations: migrations.length, editorSections: files["editor-sections.json"].length },
|
|
476
476
|
files: Object.keys(files).sort()
|
|
477
477
|
};
|
|
@@ -537,4 +537,4 @@ function brushContracts() {
|
|
|
537
537
|
|
|
538
538
|
|
|
539
539
|
|
|
540
|
-
exports.BRUSH_CONTRACT_FORMAT_VERSION = BRUSH_CONTRACT_FORMAT_VERSION; exports.BRUSH_FACET_SCHEMAS =
|
|
540
|
+
exports.BRUSH_CONTRACT_FORMAT_VERSION = BRUSH_CONTRACT_FORMAT_VERSION; exports.BRUSH_FACET_SCHEMAS = _chunkRFJZGTHAcjs.BRUSH_FACET_SCHEMAS; exports.BRUSH_HOST_PROFILES = _chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES; exports.BRUSH_JSON_SCHEMA = _chunkRFJZGTHAcjs.BRUSH_JSON_SCHEMA; exports.BRUSH_KINDS = _chunkRFJZGTHAcjs.BRUSH_KINDS; exports.BRUSH_LIBRARY_FILE_JSON_SCHEMA = BRUSH_LIBRARY_FILE_JSON_SCHEMA; exports.BRUSH_MARKS_KINDS = _chunkRFJZGTHAcjs.BRUSH_MARKS_KINDS; exports.BRUSH_MEDIA = _chunkRFJZGTHAcjs.BRUSH_MEDIA; exports.BRUSH_PATCH_PROPERTIES = _chunkWLUVZKVDcjs.BRUSH_PATCH_PROPERTIES; exports.BRUSH_PRESETS = _chunkRFJZGTHAcjs.BRUSH_PRESETS; exports.BRUSH_PREVIEW_DARK_PAPER = _chunkVRK322ZCcjs.BRUSH_PREVIEW_DARK_PAPER; exports.BRUSH_PREVIEW_FALLBACKS = _chunkVRK322ZCcjs.BRUSH_PREVIEW_FALLBACKS; exports.BRUSH_PREVIEW_MIN_CONTRAST = _chunkVRK322ZCcjs.BRUSH_PREVIEW_MIN_CONTRAST; exports.BRUSH_PROFILE_JSON_SCHEMA = BRUSH_PROFILE_JSON_SCHEMA; exports.BRUSH_SURFACES = _chunkRFJZGTHAcjs.BRUSH_SURFACES; exports.BRUSH_TIP_SHAPES = _chunkRFJZGTHAcjs.BRUSH_TIP_SHAPES; exports.BRUSH_TOOLS = _chunkRFJZGTHAcjs.BRUSH_TOOLS; exports.BRUSH_UNSET_PROPERTY = _chunkWLUVZKVDcjs.BRUSH_UNSET_PROPERTY; exports.BRUSH_WORD = _chunkRFJZGTHAcjs.BRUSH_WORD; exports.BrushLibraryError = _chunkRFJZGTHAcjs.BrushLibraryError; exports.CANVAS_PROFILE = _chunkRFJZGTHAcjs.CANVAS_PROFILE; exports.IMAGE_PROFILE = _chunkRFJZGTHAcjs.IMAGE_PROFILE; exports.MAX_BRUSH_PALETTE = _chunkRFJZGTHAcjs.MAX_BRUSH_PALETTE; exports.PAINT_PROFILE = _chunkRFJZGTHAcjs.PAINT_PROFILE; exports.UNSETTABLE_BRUSH_FACETS = _chunkWLUVZKVDcjs.UNSETTABLE_BRUSH_FACETS; exports.VECTOR_PROFILE = _chunkRFJZGTHAcjs.VECTOR_PROFILE; exports.WET_BRUSH_TOOLS = _chunkRFJZGTHAcjs.WET_BRUSH_TOOLS; exports.brushColourHex = _chunkJBZRVLXVcjs.brushColourHex; exports.brushColourKind = _chunkRFJZGTHAcjs.brushColourKind; exports.brushContracts = brushContracts; exports.brushEditorScope = brushEditorScope; exports.brushEditorSections = brushEditorSections; exports.brushIdFromName = brushIdFromName; exports.brushLibraryGroups = brushLibraryGroups; exports.brushPreviewColours = _chunkVRK322ZCcjs.brushPreviewColours; exports.brushPreviewStrength = _chunkVRK322ZCcjs.brushPreviewStrength; exports.brushPreviewsOnDark = _chunkVRK322ZCcjs.brushPreviewsOnDark; exports.changedBrushPaths = _chunkWLUVZKVDcjs.changedBrushPaths; exports.checkBrush = _chunkRFJZGTHAcjs.checkBrush; exports.checkBrushEdit = _chunkRFJZGTHAcjs.checkBrushEdit; exports.createBrushLibrary = _chunkRFJZGTHAcjs.createBrushLibrary; exports.createBrushLibraryToolProvider = _chunkWLUVZKVDcjs.createBrushLibraryToolProvider; exports.createBrushLibraryTools = _chunkWLUVZKVDcjs.createBrushLibraryTools; exports.degrade = _chunkRFJZGTHAcjs.degrade; exports.isBrushLibrary = _chunkRFJZGTHAcjs.isBrushLibrary; exports.listPresets = _chunkRFJZGTHAcjs.listPresets; exports.mergeBrushPatch = _chunkWLUVZKVDcjs.mergeBrushPatch; exports.migrateBrushV1 = _chunkRFJZGTHAcjs.migrateBrushV1; exports.newBrushFor = newBrushFor; exports.normalizeBrushSpec = _chunkRFJZGTHAcjs.normalizeBrushSpec; exports.parseBrushLibrary = _chunkRFJZGTHAcjs.parseBrushLibrary2; exports.resolveBrush = _chunkRFJZGTHAcjs.resolveBrush; exports.resolveCategory = _chunkRFJZGTHAcjs.resolveCategory; exports.resolveEngine = _chunkRFJZGTHAcjs.resolveEngine; exports.resolveWetMedium = _chunkRFJZGTHAcjs.resolveWetMedium; exports.saveBrushEdit = saveBrushEdit; exports.setBrushEditorValue = setBrushEditorValue; exports.snapshotBrushLibrary = _chunkRFJZGTHAcjs.snapshotBrushLibrary; exports.withKeptIssues = _chunkRFJZGTHAcjs.withKeptIssues;
|
package/dist/brushes/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
createBrushLibraryToolProvider,
|
|
9
9
|
createBrushLibraryTools,
|
|
10
10
|
mergeBrushPatch
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-3C33YTNN.js";
|
|
12
12
|
import "../chunk-6JL2D5SG.js";
|
|
13
13
|
import {
|
|
14
14
|
BRUSH_PREVIEW_DARK_PAPER,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
brushPreviewColours,
|
|
18
18
|
brushPreviewStrength,
|
|
19
19
|
brushPreviewsOnDark
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-4ODRXQRW.js";
|
|
21
21
|
import {
|
|
22
22
|
BRUSH_FACET_SCHEMAS,
|
|
23
23
|
BRUSH_FIELDS,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
setPath,
|
|
70
70
|
snapshotBrushLibrary,
|
|
71
71
|
withKeptIssues
|
|
72
|
-
} from "../chunk-
|
|
72
|
+
} from "../chunk-CIJBSUM5.js";
|
|
73
73
|
import {
|
|
74
74
|
STAMP_KINDS
|
|
75
75
|
} from "../chunk-ACFSFUQH.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The built-in brushes as facet specs.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The built-in brushes as facet specs. The paint editor's built-in library (`BUILTIN_BRUSHES`)
|
|
3
|
+
* is these, resolved (`resolveBrush`), so a preset is written only here; the committed brush
|
|
4
|
+
* contracts (`resolved.json`) catch a change in what one paints. Medium and variety file
|
|
5
5
|
* each brush under what it is for browsing and filtering. Only what differs from the engine's
|
|
6
6
|
* defaults is written down.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The built-in brushes as facet specs.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The built-in brushes as facet specs. The paint editor's built-in library (`BUILTIN_BRUSHES`)
|
|
3
|
+
* is these, resolved (`resolveBrush`), so a preset is written only here; the committed brush
|
|
4
|
+
* contracts (`resolved.json`) catch a change in what one paints. Medium and variety file
|
|
5
5
|
* each brush under what it is for browsing and filtering. Only what differs from the engine's
|
|
6
6
|
* defaults is written down.
|
|
7
7
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `BRUSH_FIELDS` maps each facet field to the engine field it sets, for the engines that read it.
|
|
7
7
|
* `migrateBrushV1` reads the same map the other way, so the two directions cannot drift apart.
|
|
8
8
|
*/
|
|
9
|
-
import { type PaintBrushCategory, type PaintBrushEngine, type WetMediumKind, type WetTool } from '../paint-editor/
|
|
9
|
+
import { type PaintBrushCategory, type PaintBrushEngine, type WetMediumKind, type WetTool } from '../paint-editor/brush-model.cjs';
|
|
10
10
|
import type { Brush, BrushTool, ResolvedBrush } from './types.cjs';
|
|
11
11
|
/** One facet field and the engine field it sets. */
|
|
12
12
|
export interface BrushField {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `BRUSH_FIELDS` maps each facet field to the engine field it sets, for the engines that read it.
|
|
7
7
|
* `migrateBrushV1` reads the same map the other way, so the two directions cannot drift apart.
|
|
8
8
|
*/
|
|
9
|
-
import { type PaintBrushCategory, type PaintBrushEngine, type WetMediumKind, type WetTool } from '../paint-editor/
|
|
9
|
+
import { type PaintBrushCategory, type PaintBrushEngine, type WetMediumKind, type WetTool } from '../paint-editor/brush-model.js';
|
|
10
10
|
import type { Brush, BrushTool, ResolvedBrush } from './types.js';
|
|
11
11
|
/** One facet field and the engine field it sets. */
|
|
12
12
|
export interface BrushField {
|
|
@@ -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 _chunkVRK322ZCcjs = require('./chunk-VRK322ZC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTOID45I2cjs = require('./chunk-TOID45I2.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ var _chunk7NQOGWLMcjs = require('./chunk-7NQOGWLM.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkRFJZGTHAcjs = require('./chunk-RFJZGTHA.cjs');
|
|
18
18
|
require('./chunk-OTN6VB5S.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
@@ -48,17 +48,17 @@ require('./chunk-5UEFBM2M.cjs');
|
|
|
48
48
|
require('./chunk-IPJ3TEYR.cjs');
|
|
49
49
|
|
|
50
50
|
// src/canvas/brushstrokeRender.ts
|
|
51
|
-
var PRESETS =
|
|
51
|
+
var PRESETS = _chunkRFJZGTHAcjs.listPresets.call(void 0, _chunkRFJZGTHAcjs.CANVAS_PROFILE).map((spec) => _chunkRFJZGTHAcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
|
|
52
52
|
var presetIds = () => PRESETS.map((b) => b.id).join(", ");
|
|
53
|
-
var refusal = (brush) =>
|
|
53
|
+
var refusal = (brush) => _chunkRFJZGTHAcjs.checkBrush.call(void 0, brush, _chunkRFJZGTHAcjs.CANVAS_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ");
|
|
54
54
|
function readCanvasBrushSpec(spec) {
|
|
55
55
|
let brush;
|
|
56
56
|
try {
|
|
57
|
-
brush =
|
|
57
|
+
brush = _chunkRFJZGTHAcjs.normalizeBrushSpec.call(void 0, spec);
|
|
58
58
|
} catch (e) {
|
|
59
59
|
throw new Error(`Not a brush: ${e.message}`);
|
|
60
60
|
}
|
|
61
|
-
if (!
|
|
61
|
+
if (!_chunkRFJZGTHAcjs.checkBrush.call(void 0, brush, _chunkRFJZGTHAcjs.CANVAS_PROFILE).ok) throw new Error(`Brush '${brush.id}' (${brush.name}) can't brush a canvas stroke: ${refusal(brush)}`);
|
|
62
62
|
return brush;
|
|
63
63
|
}
|
|
64
64
|
function listCanvasBrushes(user = []) {
|
|
@@ -66,12 +66,12 @@ function listCanvasBrushes(user = []) {
|
|
|
66
66
|
const d = _optionalChain([spec, 'access', _2 => _2.colour, 'optionalAccess', _3 => _3.default]);
|
|
67
67
|
return typeof d === "string" || _chunkMLLTWAXHcjs.isDualColor.call(void 0, d) ? { defaultColor: d } : {};
|
|
68
68
|
};
|
|
69
|
-
const out = PRESETS.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size, builtin: true, ...colourOf(
|
|
69
|
+
const out = PRESETS.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size, builtin: true, ...colourOf(_chunkRFJZGTHAcjs.BRUSH_PRESETS.find((p) => p.id === b.id)) }));
|
|
70
70
|
for (const raw of user) {
|
|
71
71
|
try {
|
|
72
72
|
const brush = readCanvasBrushSpec(raw);
|
|
73
73
|
if (out.some((b) => b.id === brush.id)) continue;
|
|
74
|
-
out.push({ id: brush.id, name: brush.name, category:
|
|
74
|
+
out.push({ id: brush.id, name: brush.name, category: _chunkRFJZGTHAcjs.resolveCategory.call(void 0, brush), size: _chunkRFJZGTHAcjs.resolveBrush.call(void 0, brush).tip.size, builtin: false, spec: brush, ...colourOf(brush) });
|
|
75
75
|
} catch (e2) {
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -82,15 +82,15 @@ function resolveCanvasBrush(brush, width, spec) {
|
|
|
82
82
|
const sized = (b) => given === void 0 ? b : { ...b, tip: { ...b.tip, size: given } };
|
|
83
83
|
if (typeof brush === "string") {
|
|
84
84
|
if (spec !== void 0 && spec !== null) {
|
|
85
|
-
const saved =
|
|
85
|
+
const saved = _chunkRFJZGTHAcjs.resolveBrush.call(void 0, readCanvasBrushSpec(spec));
|
|
86
86
|
if (!_chunkPXDIAYB6cjs.isBrushstrokeBrush.call(void 0, saved)) throw new Error(`Brush '${saved.id}' (${saved.name}) can't brush a canvas stroke: it is not a dry dab brush.`);
|
|
87
87
|
return sized(saved);
|
|
88
88
|
}
|
|
89
89
|
const preset = PRESETS.find((b) => b.id === brush);
|
|
90
90
|
if (preset) return sized(preset);
|
|
91
|
-
const other =
|
|
91
|
+
const other = _chunkRFJZGTHAcjs.BRUSH_PRESETS.find((b) => b.id === brush);
|
|
92
92
|
if (other) throw new Error(`Brush '${brush}' (${other.name}) can't brush a canvas stroke: ${refusal(other)} Use one of: ${presetIds()}, or a saved brush the canvas can paint.`);
|
|
93
|
-
throw new Error(`Unknown brush '${brush}'. ${
|
|
93
|
+
throw new Error(`Unknown brush '${brush}'. ${_chunkRFJZGTHAcjs.closest.call(void 0, brush, PRESETS.map((b) => b.id))}Use one of the dry presets (${presetIds()}), a saved brush from the brush library, or tip settings ({ hardness, spacing, flow, \u2026 }).`);
|
|
94
94
|
}
|
|
95
95
|
if (!brush || typeof brush !== "object" || Array.isArray(brush)) {
|
|
96
96
|
throw new Error("A brush is a preset or saved brush id (see listCanvasBrushes / canvas.listBrushes) or an object of tip settings.");
|
|
@@ -126,7 +126,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
|
126
126
|
const textured = typeof seed === "number" && Number.isFinite(seed);
|
|
127
127
|
const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
|
|
128
128
|
const brush = resolveCanvasBrush(shape.brush.brush, size, shape.brush.spec);
|
|
129
|
-
const points =
|
|
129
|
+
const points = _chunkTOID45I2cjs.pathDataToPolyline.call(void 0, shape.d);
|
|
130
130
|
if (!points.length) return null;
|
|
131
131
|
const { pressure, tiltX, tiltY } = shape.brush;
|
|
132
132
|
const input = {
|
|
@@ -164,8 +164,8 @@ function brushedShapeSvgNow(shape, size, scale, place = {}) {
|
|
|
164
164
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${f(size.width)}" height="${f(size.height)}" viewBox="0 0 ${f(size.width)} ${f(size.height)}">${content}</svg>`;
|
|
165
165
|
}
|
|
166
166
|
function swatchColour(brush, background, spec) {
|
|
167
|
-
const facets = typeof brush !== "string" ? null : spec ? readCanvasBrushSpec(spec) :
|
|
168
|
-
return background && facets ?
|
|
167
|
+
const facets = typeof brush !== "string" ? null : spec ? readCanvasBrushSpec(spec) : _chunkRFJZGTHAcjs.BRUSH_PRESETS.find((b) => b.id === brush);
|
|
168
|
+
return background && facets ? _chunkVRK322ZCcjs.brushPreviewColours.call(void 0, facets, { paper: background, profile: _chunkRFJZGTHAcjs.CANVAS_PROFILE, keepPaper: true }).color : "#1f2937";
|
|
169
169
|
}
|
|
170
170
|
function brushSwatchNow(brush, options, spec) {
|
|
171
171
|
const w = options.width && options.width > 8 ? options.width : 96;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
brushPreviewColours
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4ODRXQRW.js";
|
|
4
4
|
import {
|
|
5
5
|
pathDataToPolyline
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DXYHQ2VN.js";
|
|
7
7
|
import {
|
|
8
8
|
BRUSH_PRESETS,
|
|
9
9
|
BUILTIN_BRUSHES,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
normalizeBrushSpec,
|
|
15
15
|
resolveBrush,
|
|
16
16
|
resolveCategory
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CIJBSUM5.js";
|
|
18
18
|
import "./chunk-ACFSFUQH.js";
|
|
19
19
|
import {
|
|
20
20
|
formatNumber,
|