@pixerate/editor 0.271.0 → 0.272.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.
Files changed (96) hide show
  1. package/dist/agent/index.cjs +34 -32
  2. package/dist/agent/index.js +10 -8
  3. package/dist/animation-editor/index.cjs +60 -60
  4. package/dist/animation-editor/index.js +4 -4
  5. package/dist/brushes/index.cjs +69 -66
  6. package/dist/brushes/index.js +6 -3
  7. package/dist/brushes/patch.d.cts +1 -1
  8. package/dist/brushes/patch.d.ts +1 -1
  9. package/dist/brushes/schema.d.cts +1 -0
  10. package/dist/brushes/schema.d.ts +1 -0
  11. package/dist/brushes/types.d.cts +8 -0
  12. package/dist/brushes/types.d.ts +8 -0
  13. package/dist/{brushstrokeRender-WR2N5HHY.cjs → brushstrokeRender-5YBCLFDQ.cjs} +15 -15
  14. package/dist/{brushstrokeRender-A727TTNQ.js → brushstrokeRender-DZGFU3J4.js} +3 -3
  15. package/dist/canvas/index.cjs +13 -13
  16. package/dist/canvas/index.js +1 -1
  17. package/dist/chart/contract.d.cts +95 -0
  18. package/dist/chart/contract.d.ts +95 -0
  19. package/dist/chart/controller.d.cts +4 -0
  20. package/dist/chart/controller.d.ts +4 -0
  21. package/dist/chart/index.cjs +492 -26
  22. package/dist/chart/index.d.cts +1 -0
  23. package/dist/chart/index.d.ts +1 -0
  24. package/dist/chart/index.js +476 -10
  25. package/dist/chart/tools.d.cts +3 -0
  26. package/dist/chart/tools.d.ts +3 -0
  27. package/dist/chart-maps/index.cjs +4 -64
  28. package/dist/chart-maps/index.js +3 -63
  29. package/dist/{chunk-YNFSH72F.js → chunk-2F3YDXCN.js} +1 -1
  30. package/dist/{chunk-QYXUE37Q.js → chunk-2XDNF73E.js} +1 -1
  31. package/dist/{chunk-3KNQ2W6X.cjs → chunk-3JKCREEU.cjs} +59 -53
  32. package/dist/{chunk-NMZQMPFZ.js → chunk-4LZQO5Y7.js} +2 -0
  33. package/dist/{chunk-B5W677L7.js → chunk-5HP2VSAS.js} +1 -1
  34. package/dist/chunk-5UGRMVNE.js +328 -0
  35. package/dist/{chunk-X4FTNFIA.js → chunk-7MGPW2OV.js} +1 -1
  36. package/dist/{chunk-BPJSI4NT.cjs → chunk-7W2EQQBP.cjs} +2 -2
  37. package/dist/{chunk-DGITFN73.cjs → chunk-BWJBZAUE.cjs} +8 -8
  38. package/dist/chunk-CHZYVNXZ.js +336 -0
  39. package/dist/{chunk-LETF75CA.js → chunk-CLB2I2FU.js} +1 -1
  40. package/dist/chunk-DRMZ5R3S.cjs +67 -0
  41. package/dist/{chunk-BAZMCFVL.js → chunk-DZVRH63Y.js} +1 -1
  42. package/dist/chunk-EI5GFTKG.js +67 -0
  43. package/dist/{chunk-U2ASNGO6.cjs → chunk-FXVCB6YG.cjs} +35 -35
  44. package/dist/{chunk-EU2ZZA6L.cjs → chunk-GHGBIAWQ.cjs} +126 -39
  45. package/dist/chunk-JV7DKLMX.js +1073 -0
  46. package/dist/{chunk-2WOGXEDX.cjs → chunk-M3RZOF3G.cjs} +1 -1
  47. package/dist/chunk-MFBUQC67.cjs +328 -0
  48. package/dist/{chunk-GSTSZPSR.js → chunk-N3SKPQEH.js} +225 -18
  49. package/dist/{chunk-J5VQYK7T.cjs → chunk-N5IMDAHM.cjs} +251 -44
  50. package/dist/{chunk-ININNHLM.js → chunk-NAHJV3O6.js} +11 -5
  51. package/dist/{chunk-IBXEQOGI.js → chunk-PYHB2EHE.js} +2 -324
  52. package/dist/chunk-QEUI6OGE.cjs +336 -0
  53. package/dist/{chunk-6ZSFRRJI.js → chunk-RSF6BT34.js} +1 -1
  54. package/dist/{chunk-JJ2H25JG.cjs → chunk-SNAFFCAX.cjs} +200 -174
  55. package/dist/chunk-T2HUQBRC.cjs +1073 -0
  56. package/dist/{chunk-M2ZVPU7L.cjs → chunk-TNLKFW7D.cjs} +23 -23
  57. package/dist/{chunk-KZI3YWKW.js → chunk-UXYCY3HP.js} +93 -6
  58. package/dist/{chunk-GSLOH2IN.cjs → chunk-VF6ODSYX.cjs} +2 -0
  59. package/dist/{chunk-NQUKTRKN.cjs → chunk-WZLNNGG3.cjs} +45 -45
  60. package/dist/{chunk-NRBGAEFI.cjs → chunk-Y3RUYOOW.cjs} +8 -330
  61. package/dist/{chunk-DDL3ZBHK.cjs → chunk-YJANF2BL.cjs} +86 -86
  62. package/dist/{chunk-TNHDCP4R.js → chunk-ZEI7ZEA4.js} +31 -5
  63. package/dist/commands/index.cjs +7 -323
  64. package/dist/commands/index.js +5 -321
  65. package/dist/extensions/index.cjs +4 -4
  66. package/dist/extensions/index.js +3 -3
  67. package/dist/image-editor/index.cjs +789 -789
  68. package/dist/image-editor/index.js +5 -5
  69. package/dist/index.cjs +9 -9
  70. package/dist/index.js +3 -3
  71. package/dist/paint/index.cjs +2 -2
  72. package/dist/paint/index.js +1 -1
  73. package/dist/paint/wet/world.d.cts +37 -1
  74. package/dist/paint/wet/world.d.ts +37 -1
  75. package/dist/paint-editor/brush-controls.d.cts +2 -0
  76. package/dist/paint-editor/brush-controls.d.ts +2 -0
  77. package/dist/paint-editor/brush-model.d.cts +14 -1
  78. package/dist/paint-editor/brush-model.d.ts +14 -1
  79. package/dist/paint-editor/index.cjs +343 -306
  80. package/dist/paint-editor/index.js +48 -11
  81. package/dist/paint-editor/ui.d.cts +1 -1
  82. package/dist/paint-editor/ui.d.ts +1 -1
  83. package/dist/paint-editor/wet.d.cts +8 -1
  84. package/dist/paint-editor/wet.d.ts +8 -1
  85. package/dist/persistence/index.cjs +24 -1042
  86. package/dist/persistence/index.js +22 -1040
  87. package/dist/tools/index.cjs +5 -3
  88. package/dist/tools/index.js +8 -6
  89. package/dist/vector/index.cjs +999 -999
  90. package/dist/vector/index.js +5 -5
  91. package/package.json +1 -1
  92. package/skills/pixerate-brushes/SKILL.md +1 -0
  93. package/skills/pixerate-paint-editor/SKILL.md +4 -11
  94. package/skills/pixerate-paint-editor/references/brush-facets.md +1 -0
  95. package/skills/pixerate-paint-editor/references/ghost.md +47 -0
  96. package/skills/pixerate-paint-watercolour/SKILL.md +1 -0
@@ -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-WR2N5HHY.cjs"))).catch((error) => {
77
+ loading ??= Promise.resolve().then(() => _interopRequireWildcard(require("./brushstrokeRender-5YBCLFDQ.cjs"))).catch((error) => {
78
78
  loading = null;
79
79
  throw error;
80
80
  });
@@ -0,0 +1,328 @@
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
+
3
+ var _chunk7TD63DZPcjs = require('./chunk-7TD63DZP.cjs');
4
+
5
+
6
+ var _chunkWOFXZ3XUcjs = require('./chunk-WOFXZ3XU.cjs');
7
+
8
+
9
+
10
+ var _chunk2BSBFBOAcjs = require('./chunk-2BSBFBOA.cjs');
11
+
12
+ // src/tools/style.ts
13
+ var STYLE_SKILL_NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
14
+ var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
15
+ function parseStyleDomains(markdown) {
16
+ const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(markdown);
17
+ const line = _optionalChain([match, 'optionalAccess', _ => _[1], 'access', _2 => _2.split, 'call', _3 => _3(/\r?\n/), 'access', _4 => _4.find, 'call', _5 => _5((l) => /^domains:/.test(l))]);
18
+ if (!line) return void 0;
19
+ const raw = line.slice("domains:".length).trim().replace(/^\[|\]$/g, "");
20
+ return raw.split(",").map((d) => d.trim().replace(/^(['"])(.*)\1$/, "$2")).filter(Boolean);
21
+ }
22
+ function memoryStyleStore(initial = {}, state = {}) {
23
+ const files = /* @__PURE__ */ new Map();
24
+ const states = new Map(Object.entries(state));
25
+ const listeners = /* @__PURE__ */ new Set();
26
+ const notify = () => listeners.forEach((l) => l());
27
+ for (const [path, text] of Object.entries(initial)) {
28
+ const [dir, ...rest] = path.replace(/\\/g, "/").replace(/^\.?\//, "").split("/");
29
+ if (!dir || !rest.length) continue;
30
+ if (!files.has(dir)) files.set(dir, /* @__PURE__ */ new Map());
31
+ files.get(dir).set(rest.join("/"), text);
32
+ }
33
+ return {
34
+ list: () => [.../* @__PURE__ */ new Set([...files.keys(), ...states.keys()])].sort().map((name) => ({ name, ...states.get(name) })),
35
+ read: (name, file) => _optionalChain([files, 'access', _6 => _6.get, 'call', _7 => _7(name), 'optionalAccess', _8 => _8.get, 'call', _9 => _9(file)]),
36
+ files: (name) => [..._nullishCoalesce(_optionalChain([files, 'access', _10 => _10.get, 'call', _11 => _11(name), 'optionalAccess', _12 => _12.keys, 'call', _13 => _13()]), () => ( []))].sort(),
37
+ subscribe(listener) {
38
+ listeners.add(listener);
39
+ return () => listeners.delete(listener);
40
+ },
41
+ set(name, skillFiles) {
42
+ files.set(name, new Map(Object.entries(skillFiles)));
43
+ notify();
44
+ },
45
+ remove(name) {
46
+ files.delete(name);
47
+ states.delete(name);
48
+ notify();
49
+ },
50
+ setState(name, next) {
51
+ if (next) states.set(name, next);
52
+ else states.delete(name);
53
+ notify();
54
+ }
55
+ };
56
+ }
57
+ function resolveTokens(value, tokens, path, errors) {
58
+ if (Array.isArray(value)) return value.map((v, i) => resolveTokens(v, tokens, `${path}[${i}]`, errors));
59
+ if (!isPlainObject(value)) return value;
60
+ if ("$token" in value) {
61
+ const token = value.$token;
62
+ const mode = value.mode;
63
+ if (typeof token !== "string" || !token || mode !== void 0 && typeof mode !== "string" || Object.keys(value).some((k) => k !== "$token" && k !== "mode")) {
64
+ errors.push(`${path || "profile"}: a token reference is { "$token": "<variable name or id>", "mode"?: "<mode>" }.`);
65
+ return void 0;
66
+ }
67
+ if (!tokens) {
68
+ errors.push(`${path}: "${token}" is a token reference, but this host has no design tokens to resolve it.`);
69
+ return void 0;
70
+ }
71
+ const resolved = tokens.resolve({ token, ...mode ? { mode } : {} });
72
+ if (!resolved.ok) errors.push(`${path}: ${resolved.message}`);
73
+ return resolved.ok ? resolved.value : void 0;
74
+ }
75
+ const out = {};
76
+ for (const [k, v] of Object.entries(value)) out[k] = resolveTokens(v, tokens, path ? `${path}.${k}` : k, errors);
77
+ return out;
78
+ }
79
+ function checkListErrors(list, domain) {
80
+ if (list === void 0) return [];
81
+ if (!Array.isArray(list)) return ['checks: expected a list of check ids or { "id": ..., options } objects.'];
82
+ const errors = [];
83
+ list.forEach((entry, i) => {
84
+ const id = typeof entry === "string" ? entry : isPlainObject(entry) ? entry.id : void 0;
85
+ if (typeof id !== "string" || !id) {
86
+ errors.push(`checks[${i}]: expected a check id or { "id": ..., options }.`);
87
+ return;
88
+ }
89
+ const check = domain.checks.find((c) => c.id === id);
90
+ if (!check || typeof entry === "string") return;
91
+ const { id: _id, ...options } = entry;
92
+ const schema = _nullishCoalesce(check.optionsSchema, () => ( { type: "object", properties: {}, additionalProperties: false }));
93
+ for (const e of _chunkWOFXZ3XUcjs.validateJsonSchema.call(void 0, options, schema)) errors.push(`checks[${i}] (${id})${e.path}: ${e.message}`);
94
+ });
95
+ return errors;
96
+ }
97
+ function mergeProfile(target, value, layer, skill, sources, locked, issues, prefix = "") {
98
+ for (const [key, next] of Object.entries(value)) {
99
+ if (_chunk2BSBFBOAcjs.isUnsafeJsonKey.call(void 0, key) || next === void 0) continue;
100
+ const path = prefix ? `${prefix}.${key}` : key;
101
+ const lockedBy = [...locked.entries()].find(([p]) => p === path || path.startsWith(`${p}.`) || p.startsWith(`${path}.`));
102
+ if (isPlainObject(next)) {
103
+ if (!isPlainObject(target[key])) {
104
+ if (lockedBy && lockedBy[1] !== layer.id && target[key] !== void 0) {
105
+ issues.push({ skill, layer: layer.id, message: `"${path}" is locked by the ${lockedBy[1]} layer, so this skill's value is ignored.` });
106
+ continue;
107
+ }
108
+ target[key] = {};
109
+ delete sources[path];
110
+ }
111
+ mergeProfile(target[key], next, layer, skill, sources, locked, issues, path);
112
+ continue;
113
+ }
114
+ if (lockedBy && lockedBy[1] !== layer.id) {
115
+ issues.push({ skill, layer: layer.id, message: `"${path}" is locked by the ${lockedBy[1]} layer, so this skill's value is ignored.` });
116
+ continue;
117
+ }
118
+ target[key] = Array.isArray(next) ? structuredClone(next) : next;
119
+ for (const p of Object.keys(sources)) if (p.startsWith(`${path}.`)) delete sources[p];
120
+ sources[path] = layer.id;
121
+ if (layer.locked) locked.set(path, layer.id);
122
+ }
123
+ }
124
+ function createStyleResolver(options) {
125
+ const layers = [...options.layers];
126
+ const domains = [...options.domains];
127
+ const ids = /* @__PURE__ */ new Set();
128
+ for (const layer of layers) {
129
+ if (ids.has(layer.id)) throw new Error(`Two style layers are called "${layer.id}"; give each layer its own id.`);
130
+ ids.add(layer.id);
131
+ }
132
+ const domainIds = domains.map((d) => d.id);
133
+ const requireDomain = (id) => {
134
+ const domain = domains.find((d) => d.id === id);
135
+ if (!domain) throw new Error(`There is no house-style domain "${id}"; expected one of ${domainIds.map((d) => `"${d}"`).join(", ") || "(none registered)"}.`);
136
+ return domain;
137
+ };
138
+ async function load() {
139
+ const issues = [];
140
+ const entries = await Promise.all(layers.map(async (layer) => [...await layer.store.list()]));
141
+ const names = [...new Set(entries.flat().map((e) => e.name))];
142
+ const skills = [];
143
+ for (const name of names) {
144
+ if (!STYLE_SKILL_NAME.test(name)) {
145
+ issues.push({ skill: name, message: `"${name}" is not a valid skill name (lowercase letters, digits and hyphens, at most 64).` });
146
+ continue;
147
+ }
148
+ const copies = [];
149
+ for (let i = 0; i < layers.length; i++) {
150
+ const text = await layers[i].store.read(name, "SKILL.md");
151
+ if (text !== void 0) copies.push({ index: i, text });
152
+ }
153
+ if (!copies.length) continue;
154
+ const lockedCopy = copies.find((c) => layers[c.index].locked);
155
+ const winner = _nullishCoalesce(lockedCopy, () => ( copies[copies.length - 1]));
156
+ const layer = layers[winner.index];
157
+ const skillIssues = [];
158
+ for (const c of copies) {
159
+ if (c.index > winner.index) skillIssues.push(`The ${layers[c.index].id} layer's copy is ignored: the ${layer.id} layer is locked.`);
160
+ }
161
+ let enabled = true;
162
+ let order = 0;
163
+ for (let i = 0; i < layers.length; i++) {
164
+ const entry = entries[i].find((e) => e.name === name);
165
+ if (!entry) continue;
166
+ if (i === winner.index && entry.order !== void 0) order = entry.order;
167
+ if (entry.enabled === void 0) continue;
168
+ if (layer.required && i !== winner.index) {
169
+ if (entry.enabled === false) skillIssues.push(`The ${layers[i].id} layer cannot switch it off: the ${layer.id} layer requires it.`);
170
+ continue;
171
+ }
172
+ enabled = entry.enabled;
173
+ }
174
+ const { description = "", body } = _chunk7TD63DZPcjs.parseSkillFrontmatter.call(void 0, winner.text);
175
+ const named = parseStyleDomains(winner.text);
176
+ const applies = /* @__PURE__ */ new Set();
177
+ for (const d of _nullishCoalesce(named, () => ( domainIds))) {
178
+ if (domainIds.includes(d)) applies.add(d);
179
+ else skillIssues.push(`It names an unknown domain "${d}"; the domains here are ${domainIds.join(", ")}.`);
180
+ }
181
+ const profiles = /* @__PURE__ */ new Map();
182
+ for (const domain of domains) {
183
+ const raw = await layer.store.read(name, `${domain.id}.json`);
184
+ if (raw === void 0) continue;
185
+ const file = `${domain.id}.json`;
186
+ if (!applies.has(domain.id)) {
187
+ skillIssues.push(`${file} is left out: the skill's domains do not include ${domain.id}.`);
188
+ continue;
189
+ }
190
+ let parsed;
191
+ try {
192
+ parsed = _chunk2BSBFBOAcjs.stripPrototypeKeys.call(void 0, JSON.parse(raw));
193
+ } catch (error) {
194
+ skillIssues.push(`${file} is not valid JSON: ${error.message}`);
195
+ continue;
196
+ }
197
+ if (!isPlainObject(parsed)) {
198
+ skillIssues.push(`${file} must hold a JSON object.`);
199
+ continue;
200
+ }
201
+ const errors = [];
202
+ const resolved = resolveTokens(parsed, options.tokens, "", errors);
203
+ const { checks, ...rest } = resolved;
204
+ errors.push(..._chunkWOFXZ3XUcjs.validateJsonSchema.call(void 0, rest, domain.profileSchema).map((e) => `${e.path || "(profile)"}: ${e.message}`));
205
+ errors.push(...checkListErrors(checks, domain));
206
+ if (errors.length) {
207
+ skillIssues.push(`${file} is left out: ${errors.join(" ")}`);
208
+ continue;
209
+ }
210
+ profiles.set(domain.id, resolved);
211
+ }
212
+ skills.push({
213
+ info: {
214
+ name,
215
+ description,
216
+ layer: layer.id,
217
+ domains: [...applies],
218
+ profiles: [...profiles.keys()],
219
+ enabled,
220
+ order,
221
+ issues: skillIssues
222
+ },
223
+ layerIndex: winner.index,
224
+ body: body.trim(),
225
+ profiles,
226
+ applies
227
+ });
228
+ }
229
+ skills.sort((a, b) => a.layerIndex - b.layerIndex || a.info.order - b.info.order || a.info.name.localeCompare(b.info.name));
230
+ return { skills, issues };
231
+ }
232
+ async function resolve(domainId) {
233
+ requireDomain(domainId);
234
+ const { skills, issues: loadIssues } = await load();
235
+ const issues = [...loadIssues];
236
+ const profile = {};
237
+ const sources = {};
238
+ const locked = /* @__PURE__ */ new Map();
239
+ const applied = [];
240
+ for (const skill of skills) {
241
+ if (!skill.applies.has(domainId)) continue;
242
+ for (const message of skill.info.issues) issues.push({ skill: skill.info.name, layer: skill.info.layer, message });
243
+ if (!skill.info.enabled) continue;
244
+ applied.push({ name: skill.info.name, description: skill.info.description, layer: skill.info.layer, body: skill.body });
245
+ const own = skill.profiles.get(domainId);
246
+ if (own) mergeProfile(profile, own, layers[skill.layerIndex], skill.info.name, sources, locked, issues);
247
+ }
248
+ return { domain: domainId, skills: applied, profile, sources, issues };
249
+ }
250
+ async function winnerLayer(name) {
251
+ const copies = [];
252
+ for (let i = 0; i < layers.length; i++) if (await layers[i].store.read(name, "SKILL.md") !== void 0) copies.push(i);
253
+ if (!copies.length) return void 0;
254
+ return layers[_nullishCoalesce(copies.find((i) => layers[i].locked), () => ( copies[copies.length - 1]))];
255
+ }
256
+ return {
257
+ layers,
258
+ domains,
259
+ async list(opts = {}) {
260
+ if (opts.domain !== void 0) requireDomain(opts.domain);
261
+ const { skills } = await load();
262
+ return skills.filter((s) => opts.domain === void 0 || s.applies.has(opts.domain)).map((s) => s.info);
263
+ },
264
+ resolve,
265
+ async readFile(name, file) {
266
+ const layer = await winnerLayer(name);
267
+ return layer ? layer.store.read(name, file) : void 0;
268
+ },
269
+ async files(name) {
270
+ const layer = await winnerLayer(name);
271
+ return layer ? [...await layer.store.files(name)] : void 0;
272
+ },
273
+ async check(domainId, state) {
274
+ const domain = requireDomain(domainId);
275
+ const style = await resolve(domainId);
276
+ return { ...runStyleChecks(domain, state, style), style };
277
+ },
278
+ subscribe(listener) {
279
+ const offs = [...layers.map((l) => _optionalChain([l, 'access', _14 => _14.store, 'access', _15 => _15.subscribe, 'optionalCall', _16 => _16(listener)])), _optionalChain([options, 'access', _17 => _17.tokens, 'optionalAccess', _18 => _18.subscribe, 'optionalCall', _19 => _19(listener)])];
280
+ return () => offs.forEach((off) => _optionalChain([off, 'optionalCall', _20 => _20()]));
281
+ }
282
+ };
283
+ }
284
+ function runStyleChecks(domain, state, style) {
285
+ const report = { findings: [], ran: [], skipped: [] };
286
+ const list = Array.isArray(style.profile.checks) ? style.profile.checks : [];
287
+ const layer = style.sources.checks;
288
+ for (const entry of list) {
289
+ const id = typeof entry === "string" ? entry : isPlainObject(entry) && typeof entry.id === "string" ? entry.id : void 0;
290
+ if (!id) continue;
291
+ const check = domain.checks.find((c) => c.id === id);
292
+ if (!check) {
293
+ report.skipped.push({ check: id, reason: `There is no "${id}" check for ${domain.id}; it has ${domain.checks.map((c) => `"${c.id}"`).join(", ")}.` });
294
+ continue;
295
+ }
296
+ const { id: _id, ...options } = isPlainObject(entry) ? entry : { id };
297
+ try {
298
+ for (const f of check.run(state, style.profile, options)) report.findings.push({ ...f, check: id, ...layer ? { layer } : {} });
299
+ report.ran.push(id);
300
+ } catch (error) {
301
+ report.skipped.push({ check: id, reason: `The check could not run: ${error.message}` });
302
+ }
303
+ }
304
+ return report;
305
+ }
306
+ var escapeAttribute = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
307
+ function renderStyle(style) {
308
+ if (!style.skills.length) return `No house style applies to ${style.domain}.`;
309
+ const blocks = style.skills.map((s) => {
310
+ const body = s.body.replace(/<(\/?)style_skill/gi, "&lt;$1style_skill");
311
+ return `<style_skill name="${escapeAttribute(s.name)}" layer="${escapeAttribute(s.layer)}">
312
+ ${body}
313
+ </style_skill>`;
314
+ });
315
+ const profile = Object.keys(style.profile).length ? `
316
+
317
+ Merged ${style.domain} profile:
318
+ ${JSON.stringify(style.profile, null, 2)}` : "";
319
+ return `${blocks.join("\n\n")}${profile}`;
320
+ }
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ exports.parseStyleDomains = parseStyleDomains; exports.memoryStyleStore = memoryStyleStore; exports.createStyleResolver = createStyleResolver; exports.runStyleChecks = runStyleChecks; exports.renderStyle = renderStyle;