@pixerate/editor 0.262.0 → 0.263.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +60 -60
- package/dist/animation-editor/index.js +4 -4
- package/dist/brushes/index.cjs +52 -52
- package/dist/brushes/index.js +4 -4
- package/dist/{brushstrokeRender-N6UPZSQS.cjs → brushstrokeRender-2GBME4XD.cjs} +13 -13
- package/dist/{brushstrokeRender-25Q5BEY6.js → brushstrokeRender-S5DABANG.js} +3 -3
- package/dist/canvas/index.cjs +15 -14
- package/dist/canvas/index.js +3 -2
- package/dist/canvas/stickers.d.cts +5 -1
- package/dist/canvas/stickers.d.ts +5 -1
- package/dist/{chunk-6NZL24W4.js → chunk-34HIZXFX.js} +1 -1
- package/dist/{chunk-UVZ7RQOE.cjs → chunk-4E6BGHWN.cjs} +1 -1
- package/dist/{chunk-J5UQHWVL.js → chunk-6JL2D5SG.js} +27 -15
- package/dist/{chunk-QAR2N7HZ.js → chunk-6XX7E7O2.js} +1 -1
- package/dist/{chunk-3TQW5MPW.cjs → chunk-73QFSPDG.cjs} +23 -23
- package/dist/{chunk-APX63ILU.js → chunk-ACFSFUQH.js} +31 -0
- package/dist/{chunk-X2EXYY4J.js → chunk-CNLO6E2K.js} +2 -2
- package/dist/{chunk-F7CPSRLN.js → chunk-DOZ6F2K2.js} +12 -4
- package/dist/{chunk-CQVTGBQI.js → chunk-JGI4PZWO.js} +1 -1
- package/dist/{chunk-EHALWBBD.js → chunk-LG6MEEV7.js} +1 -1
- package/dist/{chunk-7AUQ2UJ3.cjs → chunk-LWHUU6A6.cjs} +10 -10
- package/dist/{chunk-JSDND7DF.cjs → chunk-OTN6VB5S.cjs} +32 -1
- package/dist/{chunk-5IW65VQ6.js → chunk-P5343XZO.js} +1 -1
- package/dist/{chunk-AVTPZO4Z.cjs → chunk-PE6YJMQT.cjs} +37 -25
- package/dist/{chunk-D4TE5JNW.js → chunk-QW7LKWKE.js} +1 -1
- package/dist/{chunk-YLUIFXSL.cjs → chunk-TIHW7CUY.cjs} +35 -35
- package/dist/{chunk-PYTJBVW5.cjs → chunk-TILEUVRO.cjs} +31 -31
- package/dist/{chunk-RVGP2XLF.cjs → chunk-XORJ7UZO.cjs} +21 -13
- package/dist/{chunk-43NT242D.cjs → chunk-XQW6R7VW.cjs} +86 -86
- package/dist/{chunk-TZOX7KWV.cjs → chunk-ZBACQHW3.cjs} +8 -8
- package/dist/image-editor/index.cjs +789 -788
- package/dist/image-editor/index.js +7 -6
- package/dist/image-editor/stickers.d.cts +7 -2
- package/dist/image-editor/stickers.d.ts +7 -2
- package/dist/paint-editor/controller.d.cts +7 -2
- package/dist/paint-editor/controller.d.ts +7 -2
- package/dist/paint-editor/index.cjs +576 -523
- package/dist/paint-editor/index.js +99 -46
- package/dist/paint-editor/sticker-art.d.cts +20 -10
- package/dist/paint-editor/sticker-art.d.ts +20 -10
- package/dist/paint-editor/stickers.d.cts +8 -1
- package/dist/paint-editor/stickers.d.ts +8 -1
- package/dist/paint-editor/stroke.d.cts +2 -0
- package/dist/paint-editor/stroke.d.ts +2 -0
- package/dist/stickers/browser.d.cts +10 -3
- package/dist/stickers/browser.d.ts +10 -3
- package/dist/stickers/combine.d.cts +2 -0
- package/dist/stickers/combine.d.ts +2 -0
- package/dist/stickers/conformance.d.cts +1 -1
- package/dist/stickers/conformance.d.ts +1 -1
- package/dist/stickers/errors.d.cts +1 -1
- package/dist/stickers/errors.d.ts +1 -1
- package/dist/stickers/fake.d.cts +4 -2
- package/dist/stickers/fake.d.ts +4 -2
- package/dist/stickers/helpers.d.cts +16 -2
- package/dist/stickers/helpers.d.ts +16 -2
- package/dist/stickers/index.cjs +116 -29
- package/dist/stickers/index.js +106 -19
- package/dist/stickers/tools.d.cts +9 -2
- package/dist/stickers/tools.d.ts +9 -2
- package/dist/stickers/types.d.cts +32 -5
- package/dist/stickers/types.d.ts +32 -5
- package/dist/vector/index.cjs +972 -971
- package/dist/vector/index.js +7 -6
- package/dist/vector/stickers.d.cts +7 -2
- package/dist/vector/stickers.d.ts +7 -2
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +1 -1
- package/skills/pixerate-stickers/SKILL.md +20 -9
package/dist/brushes/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../chunk-
|
|
11
|
+
var _chunkTILEUVROcjs = require('../chunk-TILEUVRO.cjs');
|
|
12
|
+
require('../chunk-PE6YJMQT.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -58,10 +58,10 @@ require('../chunk-AVTPZO4Z.cjs');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var _chunkZBACQHW3cjs = require('../chunk-ZBACQHW3.cjs');
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkOTN6VB5Scjs = require('../chunk-OTN6VB5S.cjs');
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
var _chunkLRTR4ASZcjs = require('../chunk-LRTR4ASZ.cjs');
|
|
@@ -96,7 +96,7 @@ var PHYSICS_LABELS = { string: "Strings", spring: "Springs", orbit: "Orbits", fl
|
|
|
96
96
|
var RENDER_LABELS = { dot: "Dots", line: "Lines", sequence: "Beads", ribbon: "Ribbon" };
|
|
97
97
|
var APPLICATOR_LABELS = { brush: "Brush", tube: "Paint tube", knife: "Palette knife", roller: "Roller", gloop: "Gloop pen" };
|
|
98
98
|
var WET_MEDIUM_LABELS = { watercolor: "Watercolour", gouache: "Gouache", oil: "Oil" };
|
|
99
|
-
var STAMP_OPTIONS =
|
|
99
|
+
var STAMP_OPTIONS = _chunkOTN6VB5Scjs.STAMP_KINDS.map((k) => ({ value: `editor:${k}`, label: title(k) }));
|
|
100
100
|
var ARIA = {
|
|
101
101
|
"dynamics.rotation": "Brush rotation",
|
|
102
102
|
"tip.blend": "Brush blend",
|
|
@@ -112,20 +112,20 @@ var ARIA = {
|
|
|
112
112
|
"light.pressure": "Light follows pressure"
|
|
113
113
|
};
|
|
114
114
|
var aria = (path, label) => _nullishCoalesce(ARIA[path], () => ( `Brush ${label.toLowerCase()}`));
|
|
115
|
-
function brushEditorSections(brush, profile =
|
|
116
|
-
const resolved =
|
|
117
|
-
const engine =
|
|
118
|
-
const fieldOf = (facet) =>
|
|
119
|
-
const facetOf = (enginePath) => _optionalChain([(_nullishCoalesce(
|
|
115
|
+
function brushEditorSections(brush, profile = _chunkZBACQHW3cjs.PAINT_PROFILE) {
|
|
116
|
+
const resolved = _chunkZBACQHW3cjs.resolveBrush.call(void 0, brush);
|
|
117
|
+
const engine = _chunkZBACQHW3cjs.resolveEngine.call(void 0, brush);
|
|
118
|
+
const fieldOf = (facet) => _chunkZBACQHW3cjs.BRUSH_FIELDS.find((f) => f.facet === facet && f.engines.includes(engine));
|
|
119
|
+
const facetOf = (enginePath) => _optionalChain([(_nullishCoalesce(_chunkZBACQHW3cjs.BRUSH_FIELDS.find((f) => f.engine === enginePath && f.engines.includes(engine)), () => ( _chunkZBACQHW3cjs.BRUSH_FIELDS.find((f) => f.engine === enginePath)))), 'optionalAccess', _ => _.facet]);
|
|
120
120
|
const value = (path) => {
|
|
121
|
-
const own =
|
|
121
|
+
const own = _chunkZBACQHW3cjs.getPath.call(void 0, brush, path);
|
|
122
122
|
if (own !== void 0) return own;
|
|
123
123
|
const field = fieldOf(path);
|
|
124
124
|
if (!field) return void 0;
|
|
125
|
-
const v =
|
|
125
|
+
const v = _chunkZBACQHW3cjs.getPath.call(void 0, resolved, field.engine);
|
|
126
126
|
return field.map ? field.map.toFacet(v) : v;
|
|
127
127
|
};
|
|
128
|
-
const warned = new Map(
|
|
128
|
+
const warned = new Map(_chunkZBACQHW3cjs.checkBrush.call(void 0, brush, profile).issues.filter((i) => i.severity === "warning").map((i) => [i.facet, i.reason]));
|
|
129
129
|
const noteFor = (path) => _optionalChain([[...warned], 'access', _2 => _2.find, 'call', _3 => _3(([facet]) => path === facet || path.startsWith(`${facet}.`)), 'optionalAccess', _4 => _4[1]]);
|
|
130
130
|
const withNote = (c) => {
|
|
131
131
|
const note = noteFor(c.path);
|
|
@@ -149,18 +149,18 @@ function brushEditorSections(brush, profile = _chunkTZOX7KWVcjs.PAINT_PROFILE) {
|
|
|
149
149
|
const marks = _nullishCoalesce(_optionalChain([brush, 'access', _7 => _7.marks, 'optionalAccess', _8 => _8.kind]), () => ( "continuous"));
|
|
150
150
|
add("medium", "Medium", [
|
|
151
151
|
profile.kinds.length > 1 && choice("kind", "Kind", options(profile.kinds, { mark: "Lays a material", tool: "Works on paint" })),
|
|
152
|
-
!isTool && choice("medium", "Medium", [{ value: "", label: "Any" }, ...options(
|
|
152
|
+
!isTool && choice("medium", "Medium", [{ value: "", label: "Any" }, ...options(_chunkZBACQHW3cjs.BRUSH_MEDIA, MEDIUM_LABELS)], ""),
|
|
153
153
|
!isTool && withNote({ kind: "text", path: "variety", label: "Variety", ariaLabel: "Brush variety", value: _nullishCoalesce(brush.variety, () => ( "")), placeholder: "pencil, oil, highlighter\u2026" }),
|
|
154
154
|
isTool && profile.tools.length > 0 && choice("tool", "Tool", options(profile.tools, TOOL_LABELS))
|
|
155
155
|
]);
|
|
156
|
-
const engineControls =
|
|
157
|
-
const tipSliders =
|
|
156
|
+
const engineControls = _chunkTILEUVROcjs.brushEngineControls.call(void 0, resolved);
|
|
157
|
+
const tipSliders = _chunkTILEUVROcjs.BRUSH_SLIDERS.filter((c) => c.path.startsWith("tip.") && c.path !== "tip.smoothing");
|
|
158
158
|
add("shape", "Shape", [
|
|
159
159
|
choice("tip.shape", "Tip", options(profile.tipShapes.filter((s) => !isTool || s !== "stamp"), SHAPE_LABELS)),
|
|
160
160
|
...tipSliders.map((c) => slider(c)),
|
|
161
161
|
engine === "dab" && choice("tip.blend", "Blend", _chunk2VX55NFMcjs.BLEND_MODES.map((m) => ({ value: m.id, label: m.label })), "normal"),
|
|
162
162
|
...shape === "bristle" && engineControls ? engineControls.sliders.filter((c) => c.path.startsWith("bristle.")).map((c) => slider(c)) : [],
|
|
163
|
-
shape === "stamp" && withNote({ kind: "stamps", path: "tip.stamps", label: "Stamps", ariaLabel: "Brush stamps", value: [..._nullishCoalesce(value("tip.stamps"), () => ( []))], max: marks === "particles" ?
|
|
163
|
+
shape === "stamp" && withNote({ kind: "stamps", path: "tip.stamps", label: "Stamps", ariaLabel: "Brush stamps", value: [..._nullishCoalesce(value("tip.stamps"), () => ( []))], max: marks === "particles" ? _chunkZBACQHW3cjs.MAX_DOT_TEXTURES : _chunkZBACQHW3cjs.MAX_STICKER_STAMPS, options: STAMP_OPTIONS })
|
|
164
164
|
]);
|
|
165
165
|
if (!isTool && profile.marks.length > 1) {
|
|
166
166
|
const particles = marks === "particles" && engineControls ? engineControls.sliders.filter((c) => c.path.startsWith("particle.") && c.path !== "particle.waveSpeed") : [];
|
|
@@ -168,21 +168,21 @@ function brushEditorSections(brush, profile = _chunkTZOX7KWVcjs.PAINT_PROFILE) {
|
|
|
168
168
|
const render = value("marks.render");
|
|
169
169
|
add("marks", "Marks", [
|
|
170
170
|
choice("marks.kind", "Laid as", options(profile.marks, MARKS_LABELS), "continuous"),
|
|
171
|
-
marks === "particles" && choice("marks.physics", "Particles", options(
|
|
172
|
-
marks === "particles" && choice("marks.render", "Drawn as", options(
|
|
173
|
-
marks === "particles" && render === "ribbon" && choice("marks.ribbonPairs", "Ribbon joins", options(
|
|
174
|
-
marks === "particles" && shape === "stamp" && choice("marks.stampOrder", "Texture order", options(
|
|
175
|
-
marks === "particles" && shape === "stamp" && choice("marks.stampRotation", "Texture turn", options(
|
|
171
|
+
marks === "particles" && choice("marks.physics", "Particles", options(_chunkZBACQHW3cjs.PARTICLE_KINDS, PHYSICS_LABELS)),
|
|
172
|
+
marks === "particles" && choice("marks.render", "Drawn as", options(_chunkZBACQHW3cjs.PARTICLE_RENDERS, RENDER_LABELS)),
|
|
173
|
+
marks === "particles" && render === "ribbon" && choice("marks.ribbonPairs", "Ribbon joins", options(_chunkZBACQHW3cjs.RIBBON_PAIRS, { adjacent: "Neighbours", "first-last": "Outermost" })),
|
|
174
|
+
marks === "particles" && shape === "stamp" && choice("marks.stampOrder", "Texture order", options(_chunkZBACQHW3cjs.DOT_TEXTURE_ORDERS, { sequence: "In turn", random: "Random" })),
|
|
175
|
+
marks === "particles" && shape === "stamp" && choice("marks.stampRotation", "Texture turn", options(_chunkZBACQHW3cjs.DOT_ROTATIONS, { follow: "Follow motion", random: "Random", fixed: "Tip angle" })),
|
|
176
176
|
...particles.map((c) => slider(c)),
|
|
177
177
|
...objects.map((c) => slider(c))
|
|
178
178
|
]);
|
|
179
179
|
}
|
|
180
|
-
const feel =
|
|
180
|
+
const feel = _chunkTILEUVROcjs.BRUSH_SLIDERS.filter((c) => ["tip.smoothing", "pressureSmoothing", "dynamics.minSize", "dynamics.tiltSize", "dynamics.velocitySize"].includes(c.path)).filter((c) => !(c.path === "dynamics.tiltSize" && profile.tilt === "none") && !(c.path === "dynamics.velocitySize" && profile.velocity === "none"));
|
|
181
181
|
add("feel", "Feel", [
|
|
182
182
|
...feel.map((c) => slider(c)),
|
|
183
183
|
toggle("dynamics.pressureSize", "Pressure \u2192 size"),
|
|
184
184
|
toggle("dynamics.pressureOpacity", "Pressure \u2192 opacity"),
|
|
185
|
-
choice("dynamics.rotation", "Rotation", options(
|
|
185
|
+
choice("dynamics.rotation", "Rotation", options(_chunkZBACQHW3cjs.BRUSH_ROTATIONS, ROTATION_LABELS))
|
|
186
186
|
]);
|
|
187
187
|
const surfaces = profile.surfaces;
|
|
188
188
|
const engineSliders = (_nullishCoalesce(_optionalChain([engineControls, 'optionalAccess', _9 => _9.sliders]), () => ( []))).filter((c) => !/^(bristle|particle|sticker)\./.test(c.path) && c.path !== "light.amount" && c.path !== "impasto.rim" && c.path !== "impasto.clarity");
|
|
@@ -190,8 +190,8 @@ function brushEditorSections(brush, profile = _chunkTZOX7KWVcjs.PAINT_PROFILE) {
|
|
|
190
190
|
add("behaviour", _nullishCoalesce(_optionalChain([engineControls, 'optionalAccess', _12 => _12.title]), () => ( "Behaviour")), [
|
|
191
191
|
!isTool && surfaces.length > 1 && choice("behaviour.surface", "Surface", options(surfaces, SURFACE_LABELS), "dry"),
|
|
192
192
|
profile.grain !== "none" && slider({ path: "grain", label: "Grain", min: 0, max: 1, step: 0.01 }, "behaviour.grain"),
|
|
193
|
-
engine === "wet" && !isTool && choice("behaviour.wet.medium", "Medium", options(
|
|
194
|
-
engine === "impasto" && choice("behaviour.thick.applicator", "Tool", options(
|
|
193
|
+
engine === "wet" && !isTool && choice("behaviour.wet.medium", "Medium", options(_chunkZBACQHW3cjs.WET_MEDIA, WET_MEDIUM_LABELS), "watercolor"),
|
|
194
|
+
engine === "impasto" && choice("behaviour.thick.applicator", "Tool", options(_chunkZBACQHW3cjs.IMPASTO_TOOLS, APPLICATOR_LABELS), "brush"),
|
|
195
195
|
...engineSliders.map((c) => exchangeOk(facetOf(c.path)) ? slider(c) : null),
|
|
196
196
|
_optionalChain([engineControls, 'optionalAccess', _13 => _13.mixingPath]) && fieldOf("behaviour.mixing") && choice("behaviour.mixing", "Mixing", options(["pigment", "rgb"], { pigment: "Pigment", rgb: "RGB" })),
|
|
197
197
|
_optionalChain([engineControls, 'optionalAccess', _14 => _14.dirty]) && profile.exchange !== "none" && fieldOf("behaviour.exchange.dirty") && toggle("behaviour.exchange.dirty", "Dirty brush"),
|
|
@@ -219,7 +219,7 @@ function brushEditorSections(brush, profile = _chunkTZOX7KWVcjs.PAINT_PROFILE) {
|
|
|
219
219
|
label: "Palette",
|
|
220
220
|
ariaLabel: "Brush palette",
|
|
221
221
|
value: (_nullishCoalesce(_optionalChain([brush, 'access', _21 => _21.colour, 'optionalAccess', _22 => _22.palette]), () => ( []))).flatMap((c) => _chunkMLLTWAXHcjs.isDualColor.call(void 0, c) ? [{ light: _chunkLRTR4ASZcjs.brushColourHex.call(void 0, c, "light"), dark: _chunkLRTR4ASZcjs.brushColourHex.call(void 0, c, "dark") }] : hex(c) ? [hex(c)] : []),
|
|
222
|
-
max:
|
|
222
|
+
max: _chunkZBACQHW3cjs.MAX_BRUSH_PALETTE
|
|
223
223
|
}),
|
|
224
224
|
toggle("colour.own", "Always its own colour")
|
|
225
225
|
]);
|
|
@@ -248,13 +248,13 @@ function setBrushEditorValue(brush, path, value) {
|
|
|
248
248
|
if (value !== "bristle") delete next.tip.bristle;
|
|
249
249
|
} else if (value === void 0 || value === "") {
|
|
250
250
|
const keys = path.split(".");
|
|
251
|
-
const parent =
|
|
251
|
+
const parent = _chunkZBACQHW3cjs.getPath.call(void 0, next, keys.slice(0, -1).join("."));
|
|
252
252
|
if (keys.length === 1) delete next[keys[0]];
|
|
253
253
|
else if (parent) delete parent[keys[keys.length - 1]];
|
|
254
|
-
} else
|
|
254
|
+
} else _chunkZBACQHW3cjs.setPath.call(void 0, next, path, value);
|
|
255
255
|
const problems = [];
|
|
256
256
|
try {
|
|
257
|
-
return { brush:
|
|
257
|
+
return { brush: _chunkZBACQHW3cjs.normalizeBrushSpec.call(void 0, JSON.parse(JSON.stringify(next)), problems), problems };
|
|
258
258
|
} catch (e) {
|
|
259
259
|
return { brush, problems: [e.message] };
|
|
260
260
|
}
|
|
@@ -270,7 +270,7 @@ function brushLibraryGroups(entries, filter = {}) {
|
|
|
270
270
|
const text = words([b.id, b.name, _nullishCoalesce(b.variety, () => ( "")), _nullishCoalesce(b.medium, () => ( "")), _nullishCoalesce(b.tool, () => ( "")), ..._nullishCoalesce(b.tags, () => ( []))].join(" "));
|
|
271
271
|
if (!wanted.every((w) => text.some((t) => t.startsWith(w)))) continue;
|
|
272
272
|
}
|
|
273
|
-
if (filter.profile && !
|
|
273
|
+
if (filter.profile && !_chunkZBACQHW3cjs.checkBrush.call(void 0, b, filter.profile).ok) continue;
|
|
274
274
|
const id = b.kind === "tool" ? "tools" : _nullishCoalesce(b.medium, () => ( "other"));
|
|
275
275
|
let g = groups.get(id);
|
|
276
276
|
if (!g) groups.set(id, g = { id, title: id === "tools" ? "Tools" : id === "other" ? "Other" : MEDIUM_LABELS[id], varieties: [] });
|
|
@@ -292,11 +292,11 @@ var BRUSH_PROFILE_JSON_SCHEMA = {
|
|
|
292
292
|
properties: {
|
|
293
293
|
id: { type: "string", description: "paint, image, canvas, vector\u2026" },
|
|
294
294
|
name: { type: "string", description: "Display name, used in messages." },
|
|
295
|
-
kinds: { type: "array", items: { type: "string", enum: [...
|
|
296
|
-
tools: { type: "array", items: { type: "string", enum: [...
|
|
297
|
-
tipShapes: { type: "array", items: { type: "string", enum: [...
|
|
298
|
-
marks: { type: "array", items: { type: "string", enum: [...
|
|
299
|
-
surfaces: { type: "array", items: { type: "string", enum: [...
|
|
295
|
+
kinds: { type: "array", items: { type: "string", enum: [..._chunkZBACQHW3cjs.BRUSH_KINDS] }, description: "Brush kinds it has." },
|
|
296
|
+
tools: { type: "array", items: { type: "string", enum: [..._chunkZBACQHW3cjs.BRUSH_TOOLS] }, description: "Tools it has (kind tool)." },
|
|
297
|
+
tipShapes: { type: "array", items: { type: "string", enum: [..._chunkZBACQHW3cjs.BRUSH_TIP_SHAPES] }, description: "Tip shapes it renders." },
|
|
298
|
+
marks: { type: "array", items: { type: "string", enum: [..._chunkZBACQHW3cjs.BRUSH_MARKS_KINDS] }, description: "Marks kinds it renders." },
|
|
299
|
+
surfaces: { type: "array", items: { type: "string", enum: [..._chunkZBACQHW3cjs.BRUSH_SURFACES] }, description: "Surfaces it renders." },
|
|
300
300
|
exchange: { ...SUPPORT, description: "Picking paint up and mixing it in." },
|
|
301
301
|
reservoir: { ...SUPPORT, description: "The Mixer Brush reservoir." },
|
|
302
302
|
grain: { ...SUPPORT, description: "Paper grain response." },
|
|
@@ -321,7 +321,7 @@ var BRUSH_LIBRARY_FILE_JSON_SCHEMA = {
|
|
|
321
321
|
additionalProperties: false
|
|
322
322
|
};
|
|
323
323
|
function migrationInputs() {
|
|
324
|
-
const pick = (id) =>
|
|
324
|
+
const pick = (id) => _chunkZBACQHW3cjs.brushToJSON.call(void 0, _chunkZBACQHW3cjs.BUILTIN_BRUSHES.find((b) => b.id === id));
|
|
325
325
|
return [
|
|
326
326
|
{ id: "plain", name: "Plain" },
|
|
327
327
|
pick("pencil-6b"),
|
|
@@ -343,34 +343,34 @@ function migrationInputs() {
|
|
|
343
343
|
function editorSectionFixtures() {
|
|
344
344
|
const ids = ["highlighter", "chalk", "watercolor-wash", "hair-strands", "mixer-brush", "blender", "spray-can"];
|
|
345
345
|
return ids.flatMap(
|
|
346
|
-
(id) => Object.keys(
|
|
347
|
-
const brush =
|
|
348
|
-
return { brush: id, host, sections: brushEditorSections(brush,
|
|
346
|
+
(id) => Object.keys(_chunkZBACQHW3cjs.BRUSH_HOST_PROFILES).map((host) => {
|
|
347
|
+
const brush = _chunkZBACQHW3cjs.BRUSH_PRESETS.find((b) => b.id === id);
|
|
348
|
+
return { brush: id, host, sections: brushEditorSections(brush, _chunkZBACQHW3cjs.BRUSH_HOST_PROFILES[host]) };
|
|
349
349
|
})
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
352
|
function toolDefinitions() {
|
|
353
|
-
const library =
|
|
354
|
-
const toolsFor = (host) =>
|
|
353
|
+
const library = _chunkZBACQHW3cjs.createBrushLibrary.call(void 0, );
|
|
354
|
+
const toolsFor = (host) => _chunkTILEUVROcjs.createBrushLibraryTools.call(void 0, library, { profile: _chunkZBACQHW3cjs.BRUSH_HOST_PROFILES[host], renderPreview: () => ({ data: "", mimeType: "image/png" }) });
|
|
355
355
|
return {
|
|
356
356
|
tools: toolsFor("paint").map((t) => ({ name: t.name, title: t.title, description: t.description, inputSchema: t.inputSchema, annotations: t.annotations })),
|
|
357
|
-
hosts: Object.fromEntries(Object.keys(
|
|
357
|
+
hosts: Object.fromEntries(Object.keys(_chunkZBACQHW3cjs.BRUSH_HOST_PROFILES).map((host) => [host, toolsFor(host).map((t) => t.name)]))
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
function brushContracts() {
|
|
361
|
-
const presets =
|
|
362
|
-
const resolved =
|
|
363
|
-
const profiles = Object.values(
|
|
364
|
-
const checks =
|
|
361
|
+
const presets = _chunkZBACQHW3cjs.BRUSH_PRESETS.map((b) => JSON.parse(JSON.stringify(b)));
|
|
362
|
+
const resolved = _chunkZBACQHW3cjs.BRUSH_PRESETS.map((b) => ({ id: b.id, engine: _chunkZBACQHW3cjs.resolveEngine.call(void 0, b), category: _chunkZBACQHW3cjs.resolveCategory.call(void 0, b), brush: _chunkZBACQHW3cjs.brushToJSON.call(void 0, _chunkZBACQHW3cjs.resolveBrush.call(void 0, b)) }));
|
|
363
|
+
const profiles = Object.values(_chunkZBACQHW3cjs.BRUSH_HOST_PROFILES);
|
|
364
|
+
const checks = _chunkZBACQHW3cjs.BRUSH_PRESETS.map((b) => ({
|
|
365
365
|
id: b.id,
|
|
366
366
|
hosts: Object.fromEntries(profiles.map((p) => {
|
|
367
|
-
const c =
|
|
367
|
+
const c = _chunkZBACQHW3cjs.checkBrush.call(void 0, b, p);
|
|
368
368
|
return [p.id, { ok: c.ok, issues: c.issues.map(({ facet, severity }) => ({ facet, severity })) }];
|
|
369
369
|
}))
|
|
370
370
|
}));
|
|
371
|
-
const migrations = migrationInputs().map((input) => ({ input, output:
|
|
371
|
+
const migrations = migrationInputs().map((input) => ({ input, output: _chunkZBACQHW3cjs.migrateBrushV1.call(void 0, input), resolved: _chunkZBACQHW3cjs.brushToJSON.call(void 0, _chunkZBACQHW3cjs.resolveBrush.call(void 0, _chunkZBACQHW3cjs.migrateBrushV1.call(void 0, input))), engine: _chunkZBACQHW3cjs.normalizePaintBrush.call(void 0, input).engine }));
|
|
372
372
|
const files = {
|
|
373
|
-
"brush.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "brush.schema.json", ...
|
|
373
|
+
"brush.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "brush.schema.json", ..._chunkZBACQHW3cjs.BRUSH_JSON_SCHEMA },
|
|
374
374
|
"profile.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "profile.schema.json", ...BRUSH_PROFILE_JSON_SCHEMA },
|
|
375
375
|
"library-file.schema.json": { $schema: "https://json-schema.org/draft/2020-12/schema", $id: "library-file.schema.json", ...BRUSH_LIBRARY_FILE_JSON_SCHEMA },
|
|
376
376
|
"presets.json": presets,
|
|
@@ -384,7 +384,7 @@ function brushContracts() {
|
|
|
384
384
|
files["manifest.json"] = {
|
|
385
385
|
domain: "brushes",
|
|
386
386
|
formatVersion: BRUSH_CONTRACT_FORMAT_VERSION,
|
|
387
|
-
limits: { maxPalette:
|
|
387
|
+
limits: { maxPalette: _chunkZBACQHW3cjs.MAX_BRUSH_PALETTE },
|
|
388
388
|
counts: { presets: presets.length, profiles: profiles.length, migrations: migrations.length, editorSections: files["editor-sections.json"].length },
|
|
389
389
|
files: Object.keys(files).sort()
|
|
390
390
|
};
|
|
@@ -437,4 +437,4 @@ function brushContracts() {
|
|
|
437
437
|
|
|
438
438
|
|
|
439
439
|
|
|
440
|
-
exports.BRUSH_CONTRACT_FORMAT_VERSION = BRUSH_CONTRACT_FORMAT_VERSION; exports.BRUSH_FACET_SCHEMAS =
|
|
440
|
+
exports.BRUSH_CONTRACT_FORMAT_VERSION = BRUSH_CONTRACT_FORMAT_VERSION; exports.BRUSH_FACET_SCHEMAS = _chunkZBACQHW3cjs.BRUSH_FACET_SCHEMAS; exports.BRUSH_HOST_PROFILES = _chunkZBACQHW3cjs.BRUSH_HOST_PROFILES; exports.BRUSH_JSON_SCHEMA = _chunkZBACQHW3cjs.BRUSH_JSON_SCHEMA; exports.BRUSH_KINDS = _chunkZBACQHW3cjs.BRUSH_KINDS; exports.BRUSH_LIBRARY_FILE_JSON_SCHEMA = BRUSH_LIBRARY_FILE_JSON_SCHEMA; exports.BRUSH_MARKS_KINDS = _chunkZBACQHW3cjs.BRUSH_MARKS_KINDS; exports.BRUSH_MEDIA = _chunkZBACQHW3cjs.BRUSH_MEDIA; exports.BRUSH_PATCH_PROPERTIES = _chunkTILEUVROcjs.BRUSH_PATCH_PROPERTIES; exports.BRUSH_PRESETS = _chunkZBACQHW3cjs.BRUSH_PRESETS; exports.BRUSH_PROFILE_JSON_SCHEMA = BRUSH_PROFILE_JSON_SCHEMA; exports.BRUSH_SURFACES = _chunkZBACQHW3cjs.BRUSH_SURFACES; exports.BRUSH_TIP_SHAPES = _chunkZBACQHW3cjs.BRUSH_TIP_SHAPES; exports.BRUSH_TOOLS = _chunkZBACQHW3cjs.BRUSH_TOOLS; exports.BRUSH_UNSET_PROPERTY = _chunkTILEUVROcjs.BRUSH_UNSET_PROPERTY; exports.BRUSH_WORD = _chunkZBACQHW3cjs.BRUSH_WORD; exports.BrushLibraryError = _chunkZBACQHW3cjs.BrushLibraryError; exports.CANVAS_PROFILE = _chunkZBACQHW3cjs.CANVAS_PROFILE; exports.IMAGE_PROFILE = _chunkZBACQHW3cjs.IMAGE_PROFILE; exports.MAX_BRUSH_PALETTE = _chunkZBACQHW3cjs.MAX_BRUSH_PALETTE; exports.PAINT_PROFILE = _chunkZBACQHW3cjs.PAINT_PROFILE; exports.UNSETTABLE_BRUSH_FACETS = _chunkTILEUVROcjs.UNSETTABLE_BRUSH_FACETS; exports.VECTOR_PROFILE = _chunkZBACQHW3cjs.VECTOR_PROFILE; exports.WET_BRUSH_TOOLS = _chunkZBACQHW3cjs.WET_BRUSH_TOOLS; exports.brushColourHex = _chunkLRTR4ASZcjs.brushColourHex; exports.brushColourKind = _chunkZBACQHW3cjs.brushColourKind; exports.brushContracts = brushContracts; exports.brushEditorSections = brushEditorSections; exports.brushLibraryGroups = brushLibraryGroups; exports.changedBrushPaths = _chunkTILEUVROcjs.changedBrushPaths; exports.checkBrush = _chunkZBACQHW3cjs.checkBrush; exports.createBrushLibrary = _chunkZBACQHW3cjs.createBrushLibrary; exports.createBrushLibraryToolProvider = _chunkTILEUVROcjs.createBrushLibraryToolProvider; exports.createBrushLibraryTools = _chunkTILEUVROcjs.createBrushLibraryTools; exports.degrade = _chunkZBACQHW3cjs.degrade; exports.listPresets = _chunkZBACQHW3cjs.listPresets; exports.mergeBrushPatch = _chunkTILEUVROcjs.mergeBrushPatch; exports.migrateBrushV1 = _chunkZBACQHW3cjs.migrateBrushV1; exports.normalizeBrushSpec = _chunkZBACQHW3cjs.normalizeBrushSpec; exports.parseBrushLibrary = _chunkZBACQHW3cjs.parseBrushLibrary2; exports.resolveBrush = _chunkZBACQHW3cjs.resolveBrush; exports.resolveCategory = _chunkZBACQHW3cjs.resolveCategory; exports.resolveEngine = _chunkZBACQHW3cjs.resolveEngine; exports.resolveWetMedium = _chunkZBACQHW3cjs.resolveWetMedium; exports.setBrushEditorValue = setBrushEditorValue; exports.snapshotBrushLibrary = _chunkZBACQHW3cjs.snapshotBrushLibrary;
|
package/dist/brushes/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
createBrushLibraryToolProvider,
|
|
9
9
|
createBrushLibraryTools,
|
|
10
10
|
mergeBrushPatch
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-CNLO6E2K.js";
|
|
12
|
+
import "../chunk-6JL2D5SG.js";
|
|
13
13
|
import {
|
|
14
14
|
BRUSH_FACET_SCHEMAS,
|
|
15
15
|
BRUSH_FIELDS,
|
|
@@ -58,10 +58,10 @@ import {
|
|
|
58
58
|
resolveWetMedium,
|
|
59
59
|
setPath,
|
|
60
60
|
snapshotBrushLibrary
|
|
61
|
-
} from "../chunk-
|
|
61
|
+
} from "../chunk-P5343XZO.js";
|
|
62
62
|
import {
|
|
63
63
|
STAMP_KINDS
|
|
64
|
-
} from "../chunk-
|
|
64
|
+
} from "../chunk-ACFSFUQH.js";
|
|
65
65
|
import {
|
|
66
66
|
brushColourHex
|
|
67
67
|
} from "../chunk-FJBQTZS4.js";
|
|
@@ -1,6 +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
|
|
3
|
+
var _chunk4E6BGHWNcjs = require('./chunk-4E6BGHWN.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@ var _chunkUVZ7RQOEcjs = require('./chunk-UVZ7RQOE.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
require('./chunk-
|
|
14
|
+
var _chunkZBACQHW3cjs = require('./chunk-ZBACQHW3.cjs');
|
|
15
|
+
require('./chunk-OTN6VB5S.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -45,17 +45,17 @@ require('./chunk-5UEFBM2M.cjs');
|
|
|
45
45
|
require('./chunk-IPJ3TEYR.cjs');
|
|
46
46
|
|
|
47
47
|
// src/canvas/brushstrokeRender.ts
|
|
48
|
-
var PRESETS =
|
|
48
|
+
var PRESETS = _chunkZBACQHW3cjs.listPresets.call(void 0, _chunkZBACQHW3cjs.CANVAS_PROFILE).map((spec) => _chunkZBACQHW3cjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
|
|
49
49
|
var presetIds = () => PRESETS.map((b) => b.id).join(", ");
|
|
50
|
-
var refusal = (brush) =>
|
|
50
|
+
var refusal = (brush) => _chunkZBACQHW3cjs.checkBrush.call(void 0, brush, _chunkZBACQHW3cjs.CANVAS_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ");
|
|
51
51
|
function readCanvasBrushSpec(spec) {
|
|
52
52
|
let brush;
|
|
53
53
|
try {
|
|
54
|
-
brush =
|
|
54
|
+
brush = _chunkZBACQHW3cjs.normalizeBrushSpec.call(void 0, spec);
|
|
55
55
|
} catch (e) {
|
|
56
56
|
throw new Error(`Not a brush: ${e.message}`);
|
|
57
57
|
}
|
|
58
|
-
if (!
|
|
58
|
+
if (!_chunkZBACQHW3cjs.checkBrush.call(void 0, brush, _chunkZBACQHW3cjs.CANVAS_PROFILE).ok) throw new Error(`Brush '${brush.id}' (${brush.name}) can't brush a canvas stroke: ${refusal(brush)}`);
|
|
59
59
|
return brush;
|
|
60
60
|
}
|
|
61
61
|
function listCanvasBrushes(user = []) {
|
|
@@ -63,12 +63,12 @@ function listCanvasBrushes(user = []) {
|
|
|
63
63
|
const d = _optionalChain([spec, 'access', _2 => _2.colour, 'optionalAccess', _3 => _3.default]);
|
|
64
64
|
return typeof d === "string" || _chunkMLLTWAXHcjs.isDualColor.call(void 0, d) ? { defaultColor: d } : {};
|
|
65
65
|
};
|
|
66
|
-
const out = PRESETS.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size, builtin: true, ...colourOf(
|
|
66
|
+
const out = PRESETS.map((b) => ({ id: b.id, name: b.name, category: b.category, size: b.tip.size, builtin: true, ...colourOf(_chunkZBACQHW3cjs.BRUSH_PRESETS.find((p) => p.id === b.id)) }));
|
|
67
67
|
for (const raw of user) {
|
|
68
68
|
try {
|
|
69
69
|
const brush = readCanvasBrushSpec(raw);
|
|
70
70
|
if (out.some((b) => b.id === brush.id)) continue;
|
|
71
|
-
out.push({ id: brush.id, name: brush.name, category:
|
|
71
|
+
out.push({ id: brush.id, name: brush.name, category: _chunkZBACQHW3cjs.resolveCategory.call(void 0, brush), size: _chunkZBACQHW3cjs.resolveBrush.call(void 0, brush).tip.size, builtin: false, spec: brush, ...colourOf(brush) });
|
|
72
72
|
} catch (e2) {
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -79,15 +79,15 @@ function resolveCanvasBrush(brush, width, spec) {
|
|
|
79
79
|
const sized = (b) => given === void 0 ? b : { ...b, tip: { ...b.tip, size: given } };
|
|
80
80
|
if (typeof brush === "string") {
|
|
81
81
|
if (spec !== void 0 && spec !== null) {
|
|
82
|
-
const saved =
|
|
82
|
+
const saved = _chunkZBACQHW3cjs.resolveBrush.call(void 0, readCanvasBrushSpec(spec));
|
|
83
83
|
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.`);
|
|
84
84
|
return sized(saved);
|
|
85
85
|
}
|
|
86
86
|
const preset = PRESETS.find((b) => b.id === brush);
|
|
87
87
|
if (preset) return sized(preset);
|
|
88
|
-
const other =
|
|
88
|
+
const other = _chunkZBACQHW3cjs.BRUSH_PRESETS.find((b) => b.id === brush);
|
|
89
89
|
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.`);
|
|
90
|
-
throw new Error(`Unknown brush '${brush}'. ${
|
|
90
|
+
throw new Error(`Unknown brush '${brush}'. ${_chunkZBACQHW3cjs.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 }).`);
|
|
91
91
|
}
|
|
92
92
|
if (!brush || typeof brush !== "object" || Array.isArray(brush)) {
|
|
93
93
|
throw new Error("A brush is a preset or saved brush id (see listCanvasBrushes / canvas.listBrushes) or an object of tip settings.");
|
|
@@ -123,7 +123,7 @@ function renderShapeBrushstrokeNow(shape, scale, place = {}) {
|
|
|
123
123
|
const textured = typeof seed === "number" && Number.isFinite(seed);
|
|
124
124
|
const size = _nullishCoalesce(shape.brush.size, () => ( (textured ? void 0 : _nullishCoalesce(shape.strokeWidth, () => ( 3)))));
|
|
125
125
|
const brush = resolveCanvasBrush(shape.brush.brush, size, shape.brush.spec);
|
|
126
|
-
const points =
|
|
126
|
+
const points = _chunk4E6BGHWNcjs.pathDataToPolyline.call(void 0, shape.d);
|
|
127
127
|
if (!points.length) return null;
|
|
128
128
|
const { pressure, tiltX, tiltY } = shape.brush;
|
|
129
129
|
const input = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pathDataToPolyline
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LG6MEEV7.js";
|
|
4
4
|
import {
|
|
5
5
|
BRUSH_PRESETS,
|
|
6
6
|
BUILTIN_BRUSHES,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
normalizeBrushSpec,
|
|
12
12
|
resolveBrush,
|
|
13
13
|
resolveCategory
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-P5343XZO.js";
|
|
15
|
+
import "./chunk-ACFSFUQH.js";
|
|
16
16
|
import {
|
|
17
17
|
formatNumber,
|
|
18
18
|
getShapeSvg,
|