@pixerate/editor 0.266.0 → 0.266.2
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 +6 -2
- package/dist/agent/index.js +5 -1
- 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 +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-Q6RVVJW6.js → chunk-3C33YTNN.js} +1 -1
- package/dist/{chunk-NOP4Y5AB.cjs → chunk-3SBLVGOM.cjs} +23 -23
- package/dist/{chunk-ZS7LB2MV.js → chunk-4ODRXQRW.js} +1 -1
- 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-BLR4KWYQ.js → chunk-EZOJBP4D.js} +1 -1
- package/dist/{chunk-Z2Z2OHRM.js → chunk-LK4SXL3V.js} +1 -1
- package/dist/{chunk-DGXTEPCU.cjs → chunk-MVUQSK5J.cjs} +86 -86
- package/dist/{chunk-ZQI3WUPP.js → chunk-QCLY5SFS.js} +12 -0
- 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/{chunk-YBC3RKT2.cjs → chunk-ZGXJ7BTR.cjs} +13 -1
- 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/tools/conformance.d.cts +8 -0
- package/dist/tools/conformance.d.ts +8 -0
- package/dist/tools/index.cjs +6 -2
- package/dist/tools/index.js +5 -1
- package/dist/vector/index.cjs +988 -988
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-
|
|
77
|
+
loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-FSUWXUZY.cjs"))).catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -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 _chunkRFJZGTHAcjs = require('./chunk-RFJZGTHA.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkJBZRVLXVcjs = require('./chunk-JBZRVLXV.cjs');
|
|
@@ -44,7 +44,7 @@ function brushPreviewStrength(brush) {
|
|
|
44
44
|
}
|
|
45
45
|
var over = (fg, bg, alpha) => ({ r: fg.r * alpha + bg.r * (1 - alpha), g: fg.g * alpha + bg.g * (1 - alpha), b: fg.b * alpha + bg.b * (1 - alpha), a: 1 });
|
|
46
46
|
function brushPreviewColours(brush, options = {}) {
|
|
47
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
47
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkRFJZGTHAcjs.PAINT_PROFILE));
|
|
48
48
|
let background = profile.light === "full" && brushPreviewsOnDark(brush) ? BRUSH_PREVIEW_DARK_PAPER : hexOf(_nullishCoalesce(options.paper, () => ( "#ffffff")));
|
|
49
49
|
if (!options.keepPaper && brush.tip.blend === "multiply" && _chunk5UEFBM2Mcjs.relativeLuminance.call(void 0, _chunk5UEFBM2Mcjs.parseColor.call(void 0, background)) < 0.18) background = "#ffffff";
|
|
50
50
|
const bg = _chunk5UEFBM2Mcjs.parseColor.call(void 0, background);
|
|
@@ -16,12 +16,12 @@ var _chunkPE6YJMQTcjs = require('./chunk-PE6YJMQT.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkRFJZGTHAcjs = require('./chunk-RFJZGTHA.cjs');
|
|
20
20
|
|
|
21
21
|
// src/brushes/patch.ts
|
|
22
22
|
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
23
23
|
var copy = (v) => JSON.parse(JSON.stringify(v));
|
|
24
|
-
var FACETS =
|
|
24
|
+
var FACETS = _chunkRFJZGTHAcjs.BRUSH_JSON_SCHEMA.properties;
|
|
25
25
|
var BRUSH_PATCH_PROPERTIES = (() => {
|
|
26
26
|
const { id: _id, name: _name, ...rest } = FACETS;
|
|
27
27
|
const { required: _r, ...tip } = rest.tip;
|
|
@@ -53,17 +53,17 @@ function changedBrushPaths(a, b, path = "") {
|
|
|
53
53
|
// src/brushes/tools.ts
|
|
54
54
|
var READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
55
55
|
var WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
56
|
-
var FACETS2 =
|
|
56
|
+
var FACETS2 = _chunkRFJZGTHAcjs.BRUSH_JSON_SCHEMA.properties;
|
|
57
57
|
var ID = { type: "string", pattern: String(FACETS2.id.pattern), description: "Brush id from list_brush_presets (lowercase letters, digits and dashes)." };
|
|
58
58
|
var FACET_PROPS = BRUSH_PATCH_PROPERTIES;
|
|
59
|
-
var HOSTS = Object.keys(
|
|
59
|
+
var HOSTS = Object.keys(_chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES);
|
|
60
60
|
var copy2 = (v) => JSON.parse(JSON.stringify(v));
|
|
61
61
|
var merge = mergeBrushPatch;
|
|
62
62
|
var changedPaths = changedBrushPaths;
|
|
63
63
|
function summary(entry, profile, withCheck) {
|
|
64
64
|
const b = entry.brush;
|
|
65
|
-
const engine =
|
|
66
|
-
const check = withCheck ?
|
|
65
|
+
const engine = _chunkRFJZGTHAcjs.resolveEngine.call(void 0, b);
|
|
66
|
+
const check = withCheck ? _chunkRFJZGTHAcjs.checkBrush.call(void 0, b, profile) : null;
|
|
67
67
|
return {
|
|
68
68
|
id: b.id,
|
|
69
69
|
name: b.name,
|
|
@@ -72,7 +72,7 @@ function summary(entry, profile, withCheck) {
|
|
|
72
72
|
...b.medium ? { medium: b.medium } : {},
|
|
73
73
|
...b.variety ? { variety: b.variety } : {},
|
|
74
74
|
...b.tool ? { tool: b.tool } : {},
|
|
75
|
-
category:
|
|
75
|
+
category: _chunkRFJZGTHAcjs.resolveCategory.call(void 0, b, engine),
|
|
76
76
|
engine,
|
|
77
77
|
tip: b.tip.shape,
|
|
78
78
|
...b.tip.size !== void 0 ? { size: b.tip.size } : {},
|
|
@@ -86,21 +86,21 @@ function summary(entry, profile, withCheck) {
|
|
|
86
86
|
var refusal = (check, host) => `${host.name} can't use this brush: ${check.issues.filter((i) => i.severity === "error").map((i) => `${i.facet}: ${i.reason} ${i.fix}`).join(" ")} (check_brush lists every issue; nothing was saved.)`;
|
|
87
87
|
var warnings = (check) => check.issues.filter((i) => i.severity === "warning");
|
|
88
88
|
function createBrushLibraryTools(library, options = {}) {
|
|
89
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
89
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkRFJZGTHAcjs.PAINT_PROFILE));
|
|
90
90
|
const hostOf = (id) => {
|
|
91
91
|
if (id === void 0) return profile;
|
|
92
|
-
const p =
|
|
93
|
-
if (!p) throw new (0,
|
|
92
|
+
const p = _chunkRFJZGTHAcjs.BRUSH_HOST_PROFILES[id];
|
|
93
|
+
if (!p) throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("invalid", `No host "${id}"; use one of: ${HOSTS.join(", ")}.`);
|
|
94
94
|
return p;
|
|
95
95
|
};
|
|
96
96
|
const entry = async (id) => {
|
|
97
97
|
const found = await library.get(id);
|
|
98
98
|
if (found) return found;
|
|
99
99
|
const ids = (await library.list()).map((e) => e.brush.id);
|
|
100
|
-
throw new (0,
|
|
100
|
+
throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("unknown_brush", `No brush "${id}". ${_chunkRFJZGTHAcjs.closest.call(void 0, id, ids)}list_brush_presets lists them.`);
|
|
101
101
|
};
|
|
102
102
|
const checkFor = async (brush, p) => {
|
|
103
|
-
const check2 =
|
|
103
|
+
const check2 = _chunkRFJZGTHAcjs.checkBrush.call(void 0, brush, p);
|
|
104
104
|
const provider = _optionalChain([options, 'access', _9 => _9.stickers, 'optionalCall', _10 => _10()]);
|
|
105
105
|
if (!provider || brush.tip.shape !== "stamp") return check2;
|
|
106
106
|
const issues = [...check2.issues];
|
|
@@ -118,12 +118,12 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
118
118
|
const problems = [];
|
|
119
119
|
let brush;
|
|
120
120
|
try {
|
|
121
|
-
brush =
|
|
121
|
+
brush = _chunkRFJZGTHAcjs.normalizeBrushSpec.call(void 0, raw, problems);
|
|
122
122
|
} catch (e) {
|
|
123
|
-
throw new (0,
|
|
123
|
+
throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("invalid", e.message);
|
|
124
124
|
}
|
|
125
|
-
const check2 =
|
|
126
|
-
if (!check2.ok) throw new (0,
|
|
125
|
+
const check2 = _chunkRFJZGTHAcjs.withKeptIssues.call(void 0, await checkFor(brush, profile), original ? await checkFor(original, profile) : null);
|
|
126
|
+
if (!check2.ok) throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("invalid", refusal(check2, profile));
|
|
127
127
|
const saved = await library.save(brush, { overwrite });
|
|
128
128
|
return { ...saved, problems, check: check2 };
|
|
129
129
|
};
|
|
@@ -134,10 +134,10 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
134
134
|
inputSchema: {
|
|
135
135
|
type: "object",
|
|
136
136
|
properties: {
|
|
137
|
-
kind: { type: "string", enum: [...
|
|
138
|
-
medium: { type: "string", enum: [...
|
|
137
|
+
kind: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_KINDS], description: "mark (lays a material) or tool (works on paint already down)." },
|
|
138
|
+
medium: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_MEDIA], description: "Marks laying this medium." },
|
|
139
139
|
variety: { type: "string", maxLength: 40, description: "This variety (oil, watercolor, pencil, highlighter\u2026)." },
|
|
140
|
-
tool: { type: "string", enum: [...
|
|
140
|
+
tool: { type: "string", enum: [..._chunkRFJZGTHAcjs.BRUSH_TOOLS], description: "Tools that do this." },
|
|
141
141
|
tag: { type: "string", maxLength: 40, description: "Brushes with this tag." },
|
|
142
142
|
text: { type: "string", maxLength: 200, description: "Words in the id, name, description, variety or tags (each word must match the start of one)." },
|
|
143
143
|
source: { type: "string", enum: ["all", "builtin", "user"], description: "all (default), builtin presets only, or user (saved) brushes only." },
|
|
@@ -164,8 +164,8 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
164
164
|
annotations: { title: "Describe a brush", ...READ },
|
|
165
165
|
handler: async ({ id }) => {
|
|
166
166
|
const e = await entry(id);
|
|
167
|
-
const engine =
|
|
168
|
-
return { brush: e.brush, builtin: e.builtin, engine, category:
|
|
167
|
+
const engine = _chunkRFJZGTHAcjs.resolveEngine.call(void 0, e.brush);
|
|
168
|
+
return { brush: e.brush, builtin: e.builtin, engine, category: _chunkRFJZGTHAcjs.resolveCategory.call(void 0, e.brush, engine), check: await checkFor(e.brush, profile) };
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
const check = {
|
|
@@ -183,20 +183,20 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
183
183
|
},
|
|
184
184
|
annotations: { title: "Check a brush for a host", ...READ },
|
|
185
185
|
handler: async ({ id, brush, host }) => {
|
|
186
|
-
if (id === void 0 === (brush === void 0)) throw new (0,
|
|
186
|
+
if (id === void 0 === (brush === void 0)) throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("invalid", "Give either id (a library brush) or brush (a spec), not both or neither.");
|
|
187
187
|
const p = hostOf(host);
|
|
188
188
|
let b;
|
|
189
189
|
const problems = [];
|
|
190
190
|
if (id !== void 0) b = (await entry(id)).brush;
|
|
191
191
|
else {
|
|
192
192
|
try {
|
|
193
|
-
b =
|
|
193
|
+
b = _chunkRFJZGTHAcjs.normalizeBrushSpec.call(void 0, brush, problems);
|
|
194
194
|
} catch (e) {
|
|
195
|
-
throw new (0,
|
|
195
|
+
throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("invalid", e.message);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
const result = await checkFor(b, p);
|
|
199
|
-
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded:
|
|
199
|
+
return { host: p.id, ...result, ...problems.length ? { problems } : {}, ...!result.ok ? { degraded: _chunkRFJZGTHAcjs.degrade.call(void 0, b, p) } : {} };
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
const exportTool = {
|
|
@@ -255,12 +255,12 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
255
255
|
},
|
|
256
256
|
annotations: { title: "Save a new brush", ...WRITE },
|
|
257
257
|
handler: async ({ basedOn, ...spec }) => {
|
|
258
|
-
if (library.isBuiltin(spec.id)) throw new (0,
|
|
259
|
-
if (await library.get(spec.id)) throw new (0,
|
|
258
|
+
if (library.isBuiltin(spec.id)) throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("builtin", `"${spec.id}" is a built-in brush id; pick another id (or basedOn "${spec.id}" with a new id).`);
|
|
259
|
+
if (await library.get(spec.id)) throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("exists", `A brush "${spec.id}" exists already; pick another id, or change it with update_brush.`);
|
|
260
260
|
const base = basedOn !== void 0 ? (await entry(basedOn)).brush : void 0;
|
|
261
261
|
const raw = base ? merge(base, spec) : spec;
|
|
262
262
|
const saved = await store(raw, false);
|
|
263
|
-
return { id: saved.brush.id, brush: saved.brush, engine:
|
|
263
|
+
return { id: saved.brush.id, brush: saved.brush, engine: _chunkRFJZGTHAcjs.resolveEngine.call(void 0, saved.brush), problems: saved.problems, warnings: warnings(saved.check) };
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
266
|
{
|
|
@@ -281,7 +281,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
281
281
|
annotations: { title: "Update a brush", ...WRITE, idempotentHint: true },
|
|
282
282
|
handler: async ({ id, unset, ...patch }) => {
|
|
283
283
|
const e = await entry(id);
|
|
284
|
-
if (e.builtin) throw new (0,
|
|
284
|
+
if (e.builtin) throw new (0, _chunkRFJZGTHAcjs.BrushLibraryError)("builtin", `"${id}" is a built-in brush and can't be changed; duplicate_brush makes a copy you can change.`);
|
|
285
285
|
const base = copy2(e.brush);
|
|
286
286
|
for (const k of _nullishCoalesce(unset, () => ( []))) delete base[k];
|
|
287
287
|
const saved = await store(merge(base, { ...patch, id }), true, e.brush);
|
|
@@ -340,7 +340,7 @@ function createBrushLibraryTools(library, options = {}) {
|
|
|
340
340
|
return tools;
|
|
341
341
|
}
|
|
342
342
|
function createBrushLibraryToolProvider(library, options = {}) {
|
|
343
|
-
const profile = _nullishCoalesce(options.profile, () => (
|
|
343
|
+
const profile = _nullishCoalesce(options.profile, () => ( _chunkRFJZGTHAcjs.PAINT_PROFILE));
|
|
344
344
|
const tools = createBrushLibraryTools(library, options);
|
|
345
345
|
return {
|
|
346
346
|
id: _nullishCoalesce(options.id, () => ( "brushes")),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkRFJZGTHAcjs = require('./chunk-RFJZGTHA.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkCVFAAZXEcjs = require('./chunk-CVFAAZXE.cjs');
|
|
@@ -2536,11 +2536,11 @@ function vectorExtrudeFaces(path, params) {
|
|
|
2536
2536
|
|
|
2537
2537
|
// src/vector/brushstroke.ts
|
|
2538
2538
|
var VECTOR_BRUSHSTROKE_SCALE = 2;
|
|
2539
|
-
var PRESETS =
|
|
2539
|
+
var PRESETS = _chunkRFJZGTHAcjs.listPresets.call(void 0, _chunkRFJZGTHAcjs.VECTOR_PROFILE).map((spec) => _chunkRFJZGTHAcjs.BUILTIN_BRUSHES.find((b) => b.id === spec.id));
|
|
2540
2540
|
function admitted(spec) {
|
|
2541
2541
|
try {
|
|
2542
|
-
const brush =
|
|
2543
|
-
return
|
|
2542
|
+
const brush = _chunkRFJZGTHAcjs.normalizeBrushSpec.call(void 0, spec);
|
|
2543
|
+
return _chunkRFJZGTHAcjs.checkBrush.call(void 0, brush, _chunkRFJZGTHAcjs.VECTOR_PROFILE).ok && _chunkPXDIAYB6cjs.isBrushstrokeBrush.call(void 0, _chunkRFJZGTHAcjs.resolveBrush.call(void 0, brush)) ? brush : null;
|
|
2544
2544
|
} catch (e4) {
|
|
2545
2545
|
return null;
|
|
2546
2546
|
}
|
|
@@ -2549,7 +2549,7 @@ function vectorBrushstrokeBrushes(user = []) {
|
|
|
2549
2549
|
const out = [...PRESETS];
|
|
2550
2550
|
for (const raw of user) {
|
|
2551
2551
|
const brush = admitted(raw);
|
|
2552
|
-
if (brush && !out.some((b) => b.id === brush.id)) out.push(
|
|
2552
|
+
if (brush && !out.some((b) => b.id === brush.id)) out.push(_chunkRFJZGTHAcjs.resolveBrush.call(void 0, brush));
|
|
2553
2553
|
}
|
|
2554
2554
|
return out;
|
|
2555
2555
|
}
|
|
@@ -2559,7 +2559,7 @@ function vectorBrushstrokeBrush(id) {
|
|
|
2559
2559
|
function vectorBrushstrokeBrushOf(brush) {
|
|
2560
2560
|
if (brush.spec) {
|
|
2561
2561
|
const saved = admitted(brush.spec);
|
|
2562
|
-
return saved && saved.id === brush.brushId ?
|
|
2562
|
+
return saved && saved.id === brush.brushId ? _chunkRFJZGTHAcjs.resolveBrush.call(void 0, saved) : null;
|
|
2563
2563
|
}
|
|
2564
2564
|
return vectorBrushstrokeBrush(brush.brushId);
|
|
2565
2565
|
}
|
|
@@ -2567,14 +2567,14 @@ function vectorBrushstrokeBrushError(id, user = []) {
|
|
|
2567
2567
|
if (vectorBrushstrokeBrush(id)) return null;
|
|
2568
2568
|
const saved = user.find((b) => b.id === id);
|
|
2569
2569
|
const ids = vectorBrushstrokeBrushes(user).map((b) => b.id);
|
|
2570
|
-
const reasons = (b) =>
|
|
2570
|
+
const reasons = (b) => _chunkRFJZGTHAcjs.checkBrush.call(void 0, b, _chunkRFJZGTHAcjs.VECTOR_PROFILE).issues.filter((i) => i.severity === "error").map((i) => `${i.reason} ${i.fix}`).join(" ") || "it is not a dry dab brush.";
|
|
2571
2571
|
if (saved) return admitted(saved) ? null : `Brush "${id}" (${saved.name}) can't paint a brushstroke: ${reasons(saved)} Use one of: ${ids.join(", ")}.`;
|
|
2572
|
-
const preset =
|
|
2572
|
+
const preset = _chunkRFJZGTHAcjs.BRUSH_PRESETS.find((b) => b.id === id);
|
|
2573
2573
|
if (preset) return `Brush "${id}" (${preset.name}) can't paint a brushstroke: ${reasons(preset)} Use one of: ${ids.join(", ")}.`;
|
|
2574
|
-
return `Unknown brush "${id}". ${
|
|
2574
|
+
return `Unknown brush "${id}". ${_chunkRFJZGTHAcjs.closest.call(void 0, id, ids)}Use one of: ${ids.join(", ")} (vector.listBrushes lists them).`;
|
|
2575
2575
|
}
|
|
2576
2576
|
function vectorBrushstrokeDefaultColour(id, user = [], scheme = "light") {
|
|
2577
|
-
const brush = _nullishCoalesce(
|
|
2577
|
+
const brush = _nullishCoalesce(_chunkRFJZGTHAcjs.BRUSH_PRESETS.find((b) => b.id === id), () => ( user.find((b) => b.id === id)));
|
|
2578
2578
|
return brush ? _chunkJBZRVLXVcjs.brushColourHex.call(void 0, _optionalChain([brush, 'access', _55 => _55.colour, 'optionalAccess', _56 => _56.default]), scheme) : null;
|
|
2579
2579
|
}
|
|
2580
2580
|
function sanitizeVectorBrushstroke(value, user = []) {
|
|
@@ -727,6 +727,16 @@ function resultText(result) {
|
|
|
727
727
|
}
|
|
728
728
|
return void 0;
|
|
729
729
|
}
|
|
730
|
+
var CONFORMANCE_NUMBER_TOLERANCE = 1e-9;
|
|
731
|
+
function conformanceValuesMatch(a, b) {
|
|
732
|
+
if (typeof a === "number" && typeof b === "number") return a === b || Math.abs(a - b) <= CONFORMANCE_NUMBER_TOLERANCE * Math.max(1, Math.abs(a), Math.abs(b));
|
|
733
|
+
if (Array.isArray(a) || Array.isArray(b)) return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((x, i) => conformanceValuesMatch(x, b[i]));
|
|
734
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
735
|
+
const ka = Object.keys(a), kb = Object.keys(b);
|
|
736
|
+
return ka.length === kb.length && ka.every((k) => k in b && conformanceValuesMatch(a[k], b[k]));
|
|
737
|
+
}
|
|
738
|
+
return a === b;
|
|
739
|
+
}
|
|
730
740
|
async function runConformanceScenario(scenario, host) {
|
|
731
741
|
const ids = new ConformanceIds();
|
|
732
742
|
const isId = _optionalChain([host, 'access', _41 => _41.isGeneratedId, 'optionalAccess', _42 => _42.bind, 'call', _43 => _43(host)]);
|
|
@@ -773,4 +783,6 @@ async function runConformanceScenario(scenario, host) {
|
|
|
773
783
|
|
|
774
784
|
|
|
775
785
|
|
|
776
|
-
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
exports.listSkillEvals = listSkillEvals; exports.imageEvalFixturePixels = imageEvalFixturePixels; exports.callEvalTool = callEvalTool; exports.matchesEvalExpectation = matchesEvalExpectation; exports.failedEvalChecks = failedEvalChecks; exports.toolResultValue = toolResultValue; exports.toolResultError = toolResultError; exports.runToolScript = runToolScript; exports.parseStyleDomains = parseStyleDomains; exports.memoryStyleStore = memoryStyleStore; exports.createStyleResolver = createStyleResolver; exports.runStyleChecks = runStyleChecks; exports.renderStyle = renderStyle; exports.createStyleToolProvider = createStyleToolProvider; exports.createOriginMiddleware = createOriginMiddleware; exports.ConformanceIds = ConformanceIds; exports.CONFORMANCE_BINARY_MIN_LENGTH = CONFORMANCE_BINARY_MIN_LENGTH; exports.normalizeConformanceValue = normalizeConformanceValue; exports.omitConformancePaths = omitConformancePaths; exports.resolveConformanceArguments = resolveConformanceArguments; exports.conformanceResult = conformanceResult; exports.CONFORMANCE_NUMBER_TOLERANCE = CONFORMANCE_NUMBER_TOLERANCE; exports.conformanceValuesMatch = conformanceValuesMatch; exports.runConformanceScenario = runConformanceScenario;
|