@pixerate/editor 0.264.1 → 0.266.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +4 -3
- package/dist/agent/index.js +3 -2
- package/dist/animation-editor/index.cjs +60 -61
- package/dist/animation-editor/index.js +4 -5
- package/dist/brushes/index.cjs +73 -60
- package/dist/brushes/index.d.cts +1 -0
- package/dist/brushes/index.d.ts +1 -0
- package/dist/brushes/index.js +17 -4
- package/dist/brushes/preview.d.cts +59 -0
- package/dist/brushes/preview.d.ts +59 -0
- package/dist/brushes/tools.d.cts +12 -5
- package/dist/brushes/tools.d.ts +12 -5
- package/dist/{brushstrokeRender-3MOI7PH4.js → brushstrokeRender-4UB6NRJW.js} +11 -4
- package/dist/{brushstrokeRender-SMMPIJF2.cjs → brushstrokeRender-JQ2XQRUD.cjs} +22 -15
- package/dist/canvas/brushstroke.d.cts +6 -1
- package/dist/canvas/brushstroke.d.ts +6 -1
- package/dist/canvas/index.cjs +18 -18
- package/dist/canvas/index.js +4 -4
- package/dist/{chunk-TMDDMJCR.js → chunk-472INMWH.js} +4 -2
- package/dist/chunk-55ALHYJY.js +289 -0
- package/dist/{chunk-F3KKR6DD.cjs → chunk-5OE4ZZ6V.cjs} +30 -30
- package/dist/{chunk-BY5EBP26.cjs → chunk-677777GH.cjs} +3 -3
- package/dist/{chunk-NHA26O5X.cjs → chunk-7KNW3WXZ.cjs} +14 -12
- package/dist/{chunk-G5ADO47G.cjs → chunk-7NQOGWLM.cjs} +3 -2
- package/dist/{chunk-WWI6FLH2.js → chunk-7PW6VCNW.js} +2 -2
- package/dist/{chunk-CECCP2V7.js → chunk-BLR4KWYQ.js} +1 -1
- package/dist/chunk-DEBIFWY6.cjs +77 -0
- package/dist/{chunk-KXNZNOEF.cjs → chunk-DGXTEPCU.cjs} +94 -94
- package/dist/{chunk-3CI7FRMK.js → chunk-DVPQFMH6.js} +13 -1
- package/dist/chunk-E2Z4UARJ.cjs +289 -0
- package/dist/chunk-HAEB3MZD.js +664 -0
- package/dist/{chunk-EE7SAYBF.js → chunk-J4SGJCPW.js} +3 -3
- package/dist/{chunk-A2IS7EHE.cjs → chunk-JBZRVLXV.cjs} +14 -2
- package/dist/chunk-KIJIONZF.cjs +664 -0
- package/dist/{chunk-V7MJ4HIN.cjs → chunk-NOP4Y5AB.cjs} +23 -23
- package/dist/{chunk-FQC5TDB6.cjs → chunk-O53MOGXG.cjs} +35 -35
- package/dist/{chunk-LPFQHVCO.js → chunk-PXXXRCME.js} +1 -284
- package/dist/{chunk-4OJC4MCD.js → chunk-Q6RVVJW6.js} +1 -1
- package/dist/{chunk-T7QSEKDY.cjs → chunk-QJVOJUTD.cjs} +4 -287
- package/dist/{chunk-HAUDEVMC.js → chunk-WY23AUCA.js} +2 -2
- package/dist/{chunk-JEML4FSA.js → chunk-XDNWQMHY.js} +3 -2
- package/dist/{chunk-ROBSFJ6F.js → chunk-Z2Z2OHRM.js} +1 -1
- package/dist/{chunk-USJX5SW4.cjs → chunk-ZHRVCW3M.cjs} +12 -12
- package/dist/chunk-ZS7LB2MV.js +77 -0
- package/dist/commands/index.cjs +26 -656
- package/dist/commands/index.js +18 -648
- package/dist/image-editor/index.cjs +788 -790
- package/dist/image-editor/index.js +6 -8
- package/dist/paint-editor/index.cjs +88 -84
- package/dist/paint-editor/index.js +12 -8
- package/dist/vector/contract.d.cts +52 -0
- package/dist/vector/contract.d.ts +52 -0
- package/dist/vector/index.cjs +1168 -971
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +204 -7
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +7 -2
- package/dist/chunk-FJBQTZS4.js +0 -17
- package/dist/chunk-LRTR4ASZ.cjs +0 -17
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShortcutMap
|
|
3
|
+
} from "./chunk-PXXXRCME.js";
|
|
4
|
+
|
|
5
|
+
// src/canvas/arrangeShortcuts.ts
|
|
6
|
+
var DEFAULT_ARRANGE_SHORTCUTS = [
|
|
7
|
+
{ action: "alignLeft", code: "KeyA", alt: true, label: "Alt+A" },
|
|
8
|
+
{ action: "alignCenter", code: "KeyH", alt: true, label: "Alt+H" },
|
|
9
|
+
{ action: "alignRight", code: "KeyD", alt: true, label: "Alt+D" },
|
|
10
|
+
{ action: "alignTop", code: "KeyW", alt: true, label: "Alt+W" },
|
|
11
|
+
{ action: "alignMiddle", code: "KeyV", alt: true, label: "Alt+V" },
|
|
12
|
+
{ action: "alignBottom", code: "KeyS", alt: true, label: "Alt+S" },
|
|
13
|
+
{ action: "distributeHorizontal", code: "KeyH", alt: true, shift: true, label: "Alt+Shift+H" },
|
|
14
|
+
{ action: "distributeVertical", code: "KeyV", alt: true, shift: true, label: "Alt+Shift+V" },
|
|
15
|
+
{ action: "lock", code: "KeyL", mod: true, label: "Mod+L" },
|
|
16
|
+
{ action: "unlock", code: "KeyL", mod: true, alt: true, label: "Mod+Alt+L" },
|
|
17
|
+
{ action: "bringForward", code: "BracketRight", mod: true, label: "Mod+]" },
|
|
18
|
+
{ action: "sendBackward", code: "BracketLeft", mod: true, label: "Mod+[" },
|
|
19
|
+
{ action: "bringToFront", code: "BracketRight", mod: true, alt: true, label: "Mod+Alt+]" },
|
|
20
|
+
{ action: "sendToBack", code: "BracketLeft", mod: true, alt: true, label: "Mod+Alt+[" },
|
|
21
|
+
{ action: "nextScene", code: "PageDown", label: "PageDown" },
|
|
22
|
+
{ action: "previousScene", code: "PageUp", label: "PageUp" }
|
|
23
|
+
];
|
|
24
|
+
var maps = /* @__PURE__ */ new WeakMap();
|
|
25
|
+
function arrangeShortcutMap(bindings) {
|
|
26
|
+
let map = maps.get(bindings);
|
|
27
|
+
if (!map) {
|
|
28
|
+
map = new ShortcutMap(
|
|
29
|
+
bindings.map((b) => ({
|
|
30
|
+
command: b.action,
|
|
31
|
+
chord: { key: b.code, mod: b.mod, alt: b.alt, shift: b.shift }
|
|
32
|
+
})),
|
|
33
|
+
{ modifierMode: "either" }
|
|
34
|
+
);
|
|
35
|
+
maps.set(bindings, map);
|
|
36
|
+
}
|
|
37
|
+
return map;
|
|
38
|
+
}
|
|
39
|
+
function matchArrangeShortcut(event, bindings = DEFAULT_ARRANGE_SHORTCUTS) {
|
|
40
|
+
return arrangeShortcutMap(bindings).resolve(event)?.command ?? null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/canvas/gestures.ts
|
|
44
|
+
function gestureRandom(seed) {
|
|
45
|
+
let a = seed >>> 0;
|
|
46
|
+
return () => {
|
|
47
|
+
a = a + 1831565813 >>> 0;
|
|
48
|
+
let t = a;
|
|
49
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
50
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
51
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function gestureSeed(value) {
|
|
55
|
+
const text = JSON.stringify(value) ?? "";
|
|
56
|
+
let h = 2166136261;
|
|
57
|
+
for (let i = 0; i < text.length; i++) {
|
|
58
|
+
h ^= text.charCodeAt(i);
|
|
59
|
+
h = Math.imul(h, 16777619);
|
|
60
|
+
}
|
|
61
|
+
return h >>> 0;
|
|
62
|
+
}
|
|
63
|
+
function gestureUnion(rects) {
|
|
64
|
+
if (!rects.length) throw new Error("Pass at least one rect.");
|
|
65
|
+
const x = Math.min(...rects.map((r) => r.x));
|
|
66
|
+
const y = Math.min(...rects.map((r) => r.y));
|
|
67
|
+
const right = Math.max(...rects.map((r) => r.x + r.width));
|
|
68
|
+
const bottom = Math.max(...rects.map((r) => r.y + r.height));
|
|
69
|
+
return { x, y, width: right - x, height: bottom - y };
|
|
70
|
+
}
|
|
71
|
+
var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
72
|
+
var centre = (r) => [r.x + r.width / 2, r.y + r.height / 2];
|
|
73
|
+
function smoothNoise(rand, octaves = 3) {
|
|
74
|
+
const waves = Array.from({ length: octaves }, (_, i) => ({ f: (i + 1) * (0.6 + rand() * 0.8), phase: rand() * Math.PI * 2, amp: 1 / (i + 1) }));
|
|
75
|
+
const total = waves.reduce((sum, w) => sum + w.amp, 0);
|
|
76
|
+
return (t) => waves.reduce((sum, w) => sum + w.amp * Math.sin(2 * Math.PI * w.f * t + w.phase), 0) / total;
|
|
77
|
+
}
|
|
78
|
+
function handPressure(rand) {
|
|
79
|
+
const r = (lo, hi) => Math.round((lo + rand() * (hi - lo)) * 100) / 100;
|
|
80
|
+
return [r(0.35, 0.55), r(0.8, 0.95), r(0.9, 1), r(0.75, 0.95), r(0.4, 0.65)];
|
|
81
|
+
}
|
|
82
|
+
var round = (p) => [Math.round(p[0] * 100) / 100, Math.round(p[1] * 100) / 100];
|
|
83
|
+
function wobblyLine(a, b, rand, amp, bow = 0) {
|
|
84
|
+
const dx = b[0] - a[0];
|
|
85
|
+
const dy = b[1] - a[1];
|
|
86
|
+
const len = Math.hypot(dx, dy);
|
|
87
|
+
if (len === 0) return [a];
|
|
88
|
+
const nx = -dy / len;
|
|
89
|
+
const ny = dx / len;
|
|
90
|
+
const noise = smoothNoise(rand);
|
|
91
|
+
const n = clamp(Math.ceil(len / 4), 8, 200);
|
|
92
|
+
return Array.from({ length: n + 1 }, (_, i) => {
|
|
93
|
+
const t = i / n;
|
|
94
|
+
const off = bow * 4 * t * (1 - t) + amp * noise(t) * Math.sqrt(Math.sin(Math.PI * t));
|
|
95
|
+
return [a[0] + dx * t + nx * off, a[1] + dy * t + ny * off];
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function circleGesture(rect, seed, options = {}) {
|
|
99
|
+
const rand = gestureRandom(seed);
|
|
100
|
+
const pad = Math.max(0, options.padding ?? 8);
|
|
101
|
+
const [cx, cy] = centre(rect);
|
|
102
|
+
const tilt = (rand() - 0.5) * 0.08;
|
|
103
|
+
const c = Math.abs(Math.cos(tilt));
|
|
104
|
+
const s = Math.abs(Math.sin(tilt));
|
|
105
|
+
const a = (rect.width / 2 * c + rect.height / 2 * s) * Math.SQRT2 + pad;
|
|
106
|
+
const b = (rect.width / 2 * s + rect.height / 2 * c) * Math.SQRT2 + pad;
|
|
107
|
+
const dir = rand() < 0.7 ? -1 : 1;
|
|
108
|
+
const start = -Math.PI * 0.75 + (rand() - 0.5) * 0.6;
|
|
109
|
+
const sweep = Math.PI * 2 + Math.PI * (0.1 + rand() * 0.12);
|
|
110
|
+
const jitter = 0.03 + rand() * 0.03;
|
|
111
|
+
const drift = 0.04 + rand() * 0.05;
|
|
112
|
+
const noise = smoothNoise(rand, 4);
|
|
113
|
+
const perimeter = Math.PI * (3 * (a + b) - Math.sqrt((3 * a + b) * (a + 3 * b)));
|
|
114
|
+
const n = clamp(Math.ceil(perimeter * (sweep / (Math.PI * 2)) / 5), 48, 360);
|
|
115
|
+
const points = Array.from({ length: n + 1 }, (_, i) => {
|
|
116
|
+
const t = i / n;
|
|
117
|
+
const angle = start + dir * sweep * t;
|
|
118
|
+
const grow = 1 + jitter * (0.5 + 0.5 * noise(t)) + drift * t * t;
|
|
119
|
+
const ex = a * grow * Math.cos(angle);
|
|
120
|
+
const ey = b * grow * Math.sin(angle);
|
|
121
|
+
return round([cx + ex * Math.cos(tilt) - ey * Math.sin(tilt), cy + ex * Math.sin(tilt) + ey * Math.cos(tilt)]);
|
|
122
|
+
});
|
|
123
|
+
return { points, pressure: handPressure(rand) };
|
|
124
|
+
}
|
|
125
|
+
function underlineGesture(rect, seed, options = {}) {
|
|
126
|
+
const rand = gestureRandom(seed);
|
|
127
|
+
const offset = Math.max(0, options.offset ?? 4);
|
|
128
|
+
const amp = options.wave ? clamp(rect.width * 0.02, 2, 4) : 0;
|
|
129
|
+
const shake = Math.min(1.5, offset * 0.4);
|
|
130
|
+
const base = rect.y + rect.height + offset + amp + shake;
|
|
131
|
+
const slope = Math.min(6, rect.width * 0.03);
|
|
132
|
+
const x0 = rect.x - rect.width * (0.01 + rand() * 0.04);
|
|
133
|
+
const x1 = rect.x + rect.width * (0.96 + rand() * 0.08);
|
|
134
|
+
const line = wobblyLine([x0, base + rand() * slope], [x1, base + rand() * slope], rand, shake, (rand() - 0.5) * 2 * shake);
|
|
135
|
+
const wavelength = clamp(rect.width / 8, 12, 28);
|
|
136
|
+
const phase = rand() * Math.PI * 2;
|
|
137
|
+
const points = amp ? line.map(([x, y]) => [x, y + amp * Math.sin(2 * Math.PI * (x - x0) / wavelength + phase)]) : line;
|
|
138
|
+
return { points: points.map(round), pressure: handPressure(rand) };
|
|
139
|
+
}
|
|
140
|
+
function gestureEdgePoint(rect, toward, gap = 0) {
|
|
141
|
+
const [cx, cy] = centre(rect);
|
|
142
|
+
const dx = toward[0] - cx;
|
|
143
|
+
const dy = toward[1] - cy;
|
|
144
|
+
const len = Math.hypot(dx, dy);
|
|
145
|
+
if (len === 0) return [cx, cy];
|
|
146
|
+
const t = Math.min(dx ? rect.width / 2 / Math.abs(dx) : Infinity, dy ? rect.height / 2 / Math.abs(dy) : Infinity);
|
|
147
|
+
return [cx + dx * t + dx / len * gap, cy + dy * t + dy / len * gap];
|
|
148
|
+
}
|
|
149
|
+
var isRect = (end) => !Array.isArray(end);
|
|
150
|
+
function arrowGesture(from, to, seed, options = {}) {
|
|
151
|
+
const rand = gestureRandom(seed);
|
|
152
|
+
const gap = Math.max(0, options.gap ?? 6);
|
|
153
|
+
const fromCentre = isRect(from) ? centre(from) : from;
|
|
154
|
+
const toCentre = isRect(to) ? centre(to) : to;
|
|
155
|
+
const start = isRect(from) ? gestureEdgePoint(from, toCentre, gap) : from;
|
|
156
|
+
const tip = isRect(to) ? gestureEdgePoint(to, fromCentre, gap) : to;
|
|
157
|
+
const dx = tip[0] - start[0];
|
|
158
|
+
const dy = tip[1] - start[1];
|
|
159
|
+
const len = Math.hypot(dx, dy);
|
|
160
|
+
if (len < 4) throw new Error("The arrow's ends are too close together (or overlap): pass ends at least a few canvas units apart.");
|
|
161
|
+
const curve = clamp(options.curve ?? (0.08 + rand() * 0.08) * (rand() < 0.5 ? -1 : 1), -1, 1);
|
|
162
|
+
const nx = -dy / len;
|
|
163
|
+
const ny = dx / len;
|
|
164
|
+
const control = [(start[0] + tip[0]) / 2 + nx * curve * len, (start[1] + tip[1]) / 2 + ny * curve * len];
|
|
165
|
+
const noise = smoothNoise(rand);
|
|
166
|
+
const amp = Math.min(2, len * 0.01);
|
|
167
|
+
const n = clamp(Math.ceil(len / 4), 12, 200);
|
|
168
|
+
const shaft = Array.from({ length: n + 1 }, (_, i) => {
|
|
169
|
+
const t = i / n;
|
|
170
|
+
const u = 1 - t;
|
|
171
|
+
const x = u * u * start[0] + 2 * u * t * control[0] + t * t * tip[0];
|
|
172
|
+
const y = u * u * start[1] + 2 * u * t * control[1] + t * t * tip[1];
|
|
173
|
+
const off = amp * noise(t) * Math.sqrt(Math.sin(Math.PI * t));
|
|
174
|
+
return [x + nx * off, y + ny * off];
|
|
175
|
+
});
|
|
176
|
+
const tx = tip[0] - control[0];
|
|
177
|
+
const ty = tip[1] - control[1];
|
|
178
|
+
const tl = Math.hypot(tx, ty) || 1;
|
|
179
|
+
const head = clamp(len * 0.15, 8, 22);
|
|
180
|
+
const barb = (angle2, length) => {
|
|
181
|
+
const c = Math.cos(angle2);
|
|
182
|
+
const s = Math.sin(angle2);
|
|
183
|
+
const bx = -(tx / tl) * c + ty / tl * s;
|
|
184
|
+
const by = -(ty / tl) * c - tx / tl * s;
|
|
185
|
+
return [1 / 3, 2 / 3, 1].map((f) => [tip[0] + bx * length * f, tip[1] + by * length * f]);
|
|
186
|
+
};
|
|
187
|
+
const clear = (pts) => !isRect(to) || pts.every(([x, y]) => x <= to.x || x >= to.x + to.width || y <= to.y || y >= to.y + to.height);
|
|
188
|
+
const fit = (angle2) => {
|
|
189
|
+
const length = head * (0.85 + rand() * 0.3);
|
|
190
|
+
for (let k = 1; k > 0.05; k -= 0.15) {
|
|
191
|
+
const pts = barb(angle2 * k, length);
|
|
192
|
+
if (clear(pts)) return pts;
|
|
193
|
+
}
|
|
194
|
+
return barb(0, length);
|
|
195
|
+
};
|
|
196
|
+
const angle = () => (25 + rand() * 8) * Math.PI / 180;
|
|
197
|
+
const first = fit(angle());
|
|
198
|
+
const second = fit(-angle());
|
|
199
|
+
const points = [...shaft, ...first, ...first.slice(0, -1).reverse(), tip, ...second];
|
|
200
|
+
return { points: points.map(round), pressure: handPressure(rand) };
|
|
201
|
+
}
|
|
202
|
+
function bracketGesture(rect, side, seed, options = {}) {
|
|
203
|
+
const rand = gestureRandom(seed);
|
|
204
|
+
const pad = Math.max(0, options.padding ?? 8);
|
|
205
|
+
const vertical = side === "left" || side === "right";
|
|
206
|
+
const span = vertical ? rect.height : rect.width;
|
|
207
|
+
const depth = Math.max(1, options.depth ?? clamp(span * 0.08, 6, 20));
|
|
208
|
+
const from = vertical ? rect.y : rect.x;
|
|
209
|
+
const edge = side === "left" ? rect.x - pad : side === "right" ? rect.x + rect.width + pad : side === "top" ? rect.y - pad : rect.y + rect.height + pad;
|
|
210
|
+
const out = side === "left" || side === "top" ? -1 : 1;
|
|
211
|
+
const at = (s, d) => vertical ? [edge + out * d, from + s * span] : [from + s * span, edge + out * d];
|
|
212
|
+
const noise = smoothNoise(rand);
|
|
213
|
+
const shake = Math.min(1, depth * 0.06);
|
|
214
|
+
const n = clamp(Math.ceil(span / 4), 24, 240);
|
|
215
|
+
let points;
|
|
216
|
+
if (options.shape === "square") {
|
|
217
|
+
const arm = depth * (0.8 + rand() * 0.2);
|
|
218
|
+
const spine = Array.from({ length: n + 1 }, (_, i) => at(i / n, depth + shake * (1 + noise(i / n))));
|
|
219
|
+
points = [at(0, depth - arm), at(0, depth * 0.5), ...spine, at(1, depth * 0.5), at(1, depth - arm * (0.85 + rand() * 0.15))];
|
|
220
|
+
} else {
|
|
221
|
+
const e = clamp(depth / Math.max(span, 1), 0.04, 0.2);
|
|
222
|
+
const brace = (s) => {
|
|
223
|
+
const u = s <= 0.5 ? s : 1 - s;
|
|
224
|
+
if (u < e) return depth / 2 * Math.sin(Math.PI / 2 * u / e);
|
|
225
|
+
if (u < 0.5 - e) return depth / 2;
|
|
226
|
+
return depth / 2 + depth / 2 * (1 - Math.cos(Math.PI / 2 * (u - (0.5 - e)) / e));
|
|
227
|
+
};
|
|
228
|
+
points = Array.from({ length: n + 1 }, (_, i) => {
|
|
229
|
+
const s = i / n;
|
|
230
|
+
return at(s, brace(s) + shake * (1 + noise(s)) * Math.sin(Math.PI * s));
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return { points: points.map(round), pressure: handPressure(rand) };
|
|
234
|
+
}
|
|
235
|
+
function strikeGesture(rect, seed) {
|
|
236
|
+
const rand = gestureRandom(seed);
|
|
237
|
+
const [, cy] = centre(rect);
|
|
238
|
+
const slope = rect.height * 0.08;
|
|
239
|
+
const x0 = rect.x - rect.width * (0.01 + rand() * 0.03);
|
|
240
|
+
const x1 = rect.x + rect.width * (1.01 + rand() * 0.03);
|
|
241
|
+
const y0 = cy + (rand() - 0.5) * rect.height * 0.1 + slope * (rand() - 0.5);
|
|
242
|
+
const y1 = cy + (rand() - 0.5) * rect.height * 0.1 + slope * (rand() - 0.5);
|
|
243
|
+
const points = wobblyLine([x0, y0], [x1, y1], rand, Math.min(1.5, rect.height * 0.05));
|
|
244
|
+
return { points: points.map(round), pressure: handPressure(rand) };
|
|
245
|
+
}
|
|
246
|
+
function crossGesture(rect, seed) {
|
|
247
|
+
const rand = gestureRandom(seed);
|
|
248
|
+
const over = () => 0.02 + rand() * 0.04;
|
|
249
|
+
const left = () => rect.x - rect.width * over();
|
|
250
|
+
const right = () => rect.x + rect.width * (1 + over());
|
|
251
|
+
const top = () => rect.y - rect.height * over();
|
|
252
|
+
const bottom = () => rect.y + rect.height * (1 + over());
|
|
253
|
+
const amp = Math.min(1.5, Math.min(rect.width, rect.height) * 0.03);
|
|
254
|
+
const first = wobblyLine([left(), top()], [right(), bottom()], rand, amp);
|
|
255
|
+
const second = wobblyLine([right(), top()], [left(), bottom()], rand, amp);
|
|
256
|
+
const mid1 = Math.floor(first.length / 2);
|
|
257
|
+
const mid2 = Math.floor(second.length / 2);
|
|
258
|
+
const points = [...first, ...first.slice(mid1, -1).reverse(), ...second.slice(1, mid2 + 1).reverse(), ...second];
|
|
259
|
+
return { points: points.map(round), pressure: handPressure(rand) };
|
|
260
|
+
}
|
|
261
|
+
function checkGesture(at, seed, options = {}) {
|
|
262
|
+
const rand = gestureRandom(seed);
|
|
263
|
+
const [cx, cy] = isRect(at) ? centre(at) : at;
|
|
264
|
+
const s = Math.max(4, options.size ?? (isRect(at) ? clamp(Math.min(at.width, at.height) * 0.6, 12, 48) : 20));
|
|
265
|
+
const turn = (rand() - 0.5) * 12 * Math.PI / 180;
|
|
266
|
+
const place = ([x, y]) => [cx + s * (x * Math.cos(turn) - y * Math.sin(turn)), cy + s * (x * Math.sin(turn) + y * Math.cos(turn))];
|
|
267
|
+
const p0 = [-0.42 + rand() * 0.08, -0.05 + rand() * 0.08];
|
|
268
|
+
const p1 = [-0.12 + rand() * 0.06, 0.38 + rand() * 0.06];
|
|
269
|
+
const p2 = [0.48 + rand() * 0.06, -0.5 + rand() * 0.06];
|
|
270
|
+
const short = wobblyLine(place(p0), place(p1), rand, 0, -s * 0.03);
|
|
271
|
+
const long = wobblyLine(place(p1), place(p2), rand, Math.min(1, s * 0.02), s * 0.06);
|
|
272
|
+
return { points: [...short, ...long.slice(1)].map(round), pressure: [0.5, 0.95, 0.9, 0.7, 0.35] };
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export {
|
|
276
|
+
DEFAULT_ARRANGE_SHORTCUTS,
|
|
277
|
+
matchArrangeShortcut,
|
|
278
|
+
gestureRandom,
|
|
279
|
+
gestureSeed,
|
|
280
|
+
gestureUnion,
|
|
281
|
+
circleGesture,
|
|
282
|
+
underlineGesture,
|
|
283
|
+
gestureEdgePoint,
|
|
284
|
+
arrowGesture,
|
|
285
|
+
bracketGesture,
|
|
286
|
+
strikeGesture,
|
|
287
|
+
crossGesture,
|
|
288
|
+
checkGesture
|
|
289
|
+
};
|
|
@@ -16,12 +16,12 @@ var _chunkPE6YJMQTcjs = require('./chunk-PE6YJMQT.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk677777GHcjs = require('./chunk-677777GH.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 = _chunk677777GHcjs.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 = _chunk677777GHcjs.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(_chunk677777GHcjs.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 = _chunk677777GHcjs.resolveEngine.call(void 0, b);
|
|
66
|
+
const check = withCheck ? _chunk677777GHcjs.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: _chunk677777GHcjs.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, () => ( _chunk677777GHcjs.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 = _chunk677777GHcjs.BRUSH_HOST_PROFILES[id];
|
|
93
|
+
if (!p) throw new (0, _chunk677777GHcjs.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, _chunk677777GHcjs.BrushLibraryError)("unknown_brush", `No brush "${id}". ${_chunk677777GHcjs.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 = _chunk677777GHcjs.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 = _chunk677777GHcjs.normalizeBrushSpec.call(void 0, raw, problems);
|
|
122
122
|
} catch (e) {
|
|
123
|
-
throw new (0,
|
|
123
|
+
throw new (0, _chunk677777GHcjs.BrushLibraryError)("invalid", e.message);
|
|
124
124
|
}
|
|
125
|
-
const check2 =
|
|
126
|
-
if (!check2.ok) throw new (0,
|
|
125
|
+
const check2 = _chunk677777GHcjs.withKeptIssues.call(void 0, await checkFor(brush, profile), original ? await checkFor(original, profile) : null);
|
|
126
|
+
if (!check2.ok) throw new (0, _chunk677777GHcjs.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: [..._chunk677777GHcjs.BRUSH_KINDS], description: "mark (lays a material) or tool (works on paint already down)." },
|
|
138
|
+
medium: { type: "string", enum: [..._chunk677777GHcjs.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: [..._chunk677777GHcjs.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 = _chunk677777GHcjs.resolveEngine.call(void 0, e.brush);
|
|
168
|
+
return { brush: e.brush, builtin: e.builtin, engine, category: _chunk677777GHcjs.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, _chunk677777GHcjs.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 = _chunk677777GHcjs.normalizeBrushSpec.call(void 0, brush, problems);
|
|
194
194
|
} catch (e) {
|
|
195
|
-
throw new (0,
|
|
195
|
+
throw new (0, _chunk677777GHcjs.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: _chunk677777GHcjs.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, _chunk677777GHcjs.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, _chunk677777GHcjs.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: _chunk677777GHcjs.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, _chunk677777GHcjs.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, () => ( _chunk677777GHcjs.PAINT_PROFILE));
|
|
344
344
|
const tools = createBrushLibraryTools(library, options);
|
|
345
345
|
return {
|
|
346
346
|
id: _nullishCoalesce(options.id, () => ( "brushes")),
|
|
@@ -2443,7 +2443,7 @@ var BRUSH_PRESETS = [
|
|
|
2443
2443
|
tip: { shape: "round", size: 3, hardness: 0.95, spacing: 0.05, opacity: 0.9 },
|
|
2444
2444
|
dynamics: { smoothing: 0.35, pressureSmoothing: 0.3, pressureOpacity: true, minSize: 0.7, opacityJitter: 0.08 },
|
|
2445
2445
|
behaviour: { grain: 0.15 },
|
|
2446
|
-
colour: { default: "#1e3a8a", palette: ["#1e3a8a", "#111827", "#b91c1c", "#166534"] }
|
|
2446
|
+
colour: { default: { light: "#1e3a8a", dark: "#93c5fd" }, palette: [{ light: "#1e3a8a", dark: "#93c5fd" }, { light: "#111827", dark: "#f3f4f6" }, "#b91c1c", "#166534"] }
|
|
2447
2447
|
},
|
|
2448
2448
|
// A gel pen: an even, opaque, saturated line.
|
|
2449
2449
|
{
|
|
@@ -2454,7 +2454,7 @@ var BRUSH_PRESETS = [
|
|
|
2454
2454
|
variety: "gel",
|
|
2455
2455
|
tip: { shape: "round", size: 4, spacing: 0.04 },
|
|
2456
2456
|
dynamics: { smoothing: 0.3, pressureSmoothing: 0.3, minSize: 0.8 },
|
|
2457
|
-
colour: { default: "#111827", palette: ["#111827", "#7c3aed", "#db2777", "#0891b2", "#16a34a", "#f59e0b"] }
|
|
2457
|
+
colour: { default: { light: "#111827", dark: "#f3f4f6" }, palette: [{ light: "#111827", dark: "#f3f4f6" }, "#7c3aed", "#db2777", "#0891b2", "#16a34a", "#f59e0b"] }
|
|
2458
2458
|
},
|
|
2459
2459
|
// A fineliner: one width, whatever the pressure.
|
|
2460
2460
|
{
|
|
@@ -2465,7 +2465,7 @@ var BRUSH_PRESETS = [
|
|
|
2465
2465
|
variety: "fineliner",
|
|
2466
2466
|
tip: { shape: "round", size: 2, spacing: 0.05 },
|
|
2467
2467
|
dynamics: { smoothing: 0.4, pressureSize: false },
|
|
2468
|
-
colour: { default: "#111827" }
|
|
2468
|
+
colour: { default: { light: "#111827", dark: "#f3f4f6" } }
|
|
2469
2469
|
},
|
|
2470
2470
|
// A wax crayon: waxy, catching the paper's peaks, a little uneven.
|
|
2471
2471
|
{
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
var _chunkE2Z4UARJcjs = require('./chunk-E2Z4UARJ.cjs');
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
var _chunkQJVOJUTDcjs = require('./chunk-QJVOJUTD.cjs');
|
|
14
16
|
|
|
15
17
|
// src/commands/builtins.ts
|
|
16
18
|
var DEFAULT_HISTORY_SHORTCUTS = [
|
|
@@ -55,7 +57,7 @@ function createHistoryCommands(history, options = {}) {
|
|
|
55
57
|
}
|
|
56
58
|
var historyShortcutMap = null;
|
|
57
59
|
function matchHistoryShortcut(event, options = {}) {
|
|
58
|
-
historyShortcutMap ??= new (0,
|
|
60
|
+
historyShortcutMap ??= new (0, _chunkQJVOJUTDcjs.ShortcutMap)(DEFAULT_HISTORY_SHORTCUTS);
|
|
59
61
|
return _nullishCoalesce(_optionalChain([historyShortcutMap, 'access', _2 => _2.resolve, 'call', _3 => _3(event, options), 'optionalAccess', _4 => _4.command]), () => ( null));
|
|
60
62
|
}
|
|
61
63
|
var ARRANGE_LABELS = {
|
|
@@ -90,7 +92,7 @@ function createArrangeCommands(controller, options = {}) {
|
|
|
90
92
|
const prefix = _nullishCoalesce(options.prefix, () => ( "canvas."));
|
|
91
93
|
const group = _nullishCoalesce(options.group, () => ( "Arrange"));
|
|
92
94
|
const scope = options.scope === null ? void 0 : _nullishCoalesce(options.scope, () => ( "canvas"));
|
|
93
|
-
const bindings = _nullishCoalesce(options.bindings, () => (
|
|
95
|
+
const bindings = _nullishCoalesce(options.bindings, () => ( _chunkE2Z4UARJcjs.DEFAULT_ARRANGE_SHORTCUTS));
|
|
94
96
|
const count = (params) => _nullishCoalesce(_optionalChain([params, 'optionalAccess', _5 => _5.ids, 'optionalAccess', _6 => _6.length]), () => ( _optionalChain([options, 'access', _7 => _7.getSelectedIds, 'optionalCall', _8 => _8(), 'access', _9 => _9.length])));
|
|
95
97
|
const needs = (min, what) => (_, params) => {
|
|
96
98
|
const n = count(params);
|
|
@@ -441,9 +443,9 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
441
443
|
return value;
|
|
442
444
|
};
|
|
443
445
|
const end = (value, name) => Array.isArray(value) ? [value[0], value[1]] : box(value, name);
|
|
444
|
-
const boxes = (values, name) =>
|
|
446
|
+
const boxes = (values, name) => _chunkE2Z4UARJcjs.gestureUnion.call(void 0, values.map((v, i) => box(v, `${name}[${i}]`)));
|
|
445
447
|
const gesture = (spec) => {
|
|
446
|
-
const seedOf = (params) => _nullishCoalesce(params.seed, () => (
|
|
448
|
+
const seedOf = (params) => _nullishCoalesce(params.seed, () => ( _chunkE2Z4UARJcjs.gestureSeed.call(void 0, { gesture: spec.name, ...params })));
|
|
447
449
|
const generate = (params) => {
|
|
448
450
|
const seed = seedOf(params);
|
|
449
451
|
return { seed, stroke: spec.make(params, seed) };
|
|
@@ -497,7 +499,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
497
499
|
around: gestureBoxes("What to circle."),
|
|
498
500
|
padding: { type: "number", minimum: 0, maximum: 500, description: "Space between them and the loop, canvas units (default 8)." }
|
|
499
501
|
},
|
|
500
|
-
make: (p, seed) =>
|
|
502
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.circleGesture.call(void 0, boxes(p.around, "around"), seed, { ...p.padding !== void 0 ? { padding: p.padding } : {} })
|
|
501
503
|
}),
|
|
502
504
|
gesture({
|
|
503
505
|
name: "underline",
|
|
@@ -510,7 +512,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
510
512
|
offset: { type: "number", minimum: 0, maximum: 200, description: "Gap below the bottom edge, canvas units (default 4)." },
|
|
511
513
|
wave: { type: "boolean", description: "A wavy (squiggly) underline instead of a straight one (default false)." }
|
|
512
514
|
},
|
|
513
|
-
make: (p, seed) =>
|
|
515
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.underlineGesture.call(void 0, box(p.under, "under"), seed, { ...p.offset !== void 0 ? { offset: p.offset } : {}, ...p.wave ? { wave: true } : {} })
|
|
514
516
|
}),
|
|
515
517
|
gesture({
|
|
516
518
|
name: "arrow",
|
|
@@ -524,7 +526,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
524
526
|
curve: { type: "number", minimum: -1, maximum: 1, description: "Bend of the shaft \u22121..1: how far its middle bulges, as a fraction of half its length; positive bends to the left of travel, 0 is straight (default: a gentle seeded bend, about 0.1)." },
|
|
525
527
|
gap: { type: "number", minimum: 0, maximum: 200, description: "Space between a box end and the arrow, canvas units (default 6)." }
|
|
526
528
|
},
|
|
527
|
-
make: (p, seed) =>
|
|
529
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.arrowGesture.call(void 0, end(p.from, "from"), end(p.to, "to"), seed, { ...p.curve !== void 0 ? { curve: p.curve } : {}, ...p.gap !== void 0 ? { gap: p.gap } : {} })
|
|
528
530
|
}),
|
|
529
531
|
gesture({
|
|
530
532
|
name: "bracket",
|
|
@@ -539,7 +541,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
539
541
|
padding: { type: "number", minimum: 0, maximum: 500, description: "Gap between them and the bracket, canvas units (default 8)." },
|
|
540
542
|
depth: { type: "number", exclusiveMinimum: 0, maximum: 500, description: "How far the bracket reaches out, canvas units (default: from the span, 6..20)." }
|
|
541
543
|
},
|
|
542
|
-
make: (p, seed) =>
|
|
544
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.bracketGesture.call(void 0, boxes(p.around, "around"), p.side, seed, {
|
|
543
545
|
...p.shape ? { shape: p.shape } : {},
|
|
544
546
|
...p.padding !== void 0 ? { padding: p.padding } : {},
|
|
545
547
|
...p.depth !== void 0 ? { depth: p.depth } : {}
|
|
@@ -552,7 +554,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
552
554
|
description: "Strikes a line through the middle of a box or node, a little past both ends: for text or a value to drop. It only marks it; nothing is deleted.",
|
|
553
555
|
required: ["over"],
|
|
554
556
|
properties: { over: gestureBox("What to strike through: a box { x, y, width, height } or a node { nodeId }.") },
|
|
555
|
-
make: (p, seed) =>
|
|
557
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.strikeGesture.call(void 0, box(p.over, "over"), seed)
|
|
556
558
|
}),
|
|
557
559
|
gesture({
|
|
558
560
|
name: "cross",
|
|
@@ -561,7 +563,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
561
563
|
description: "Crosses out a box or node with an X from corner to corner: for a rejected option. It only marks it; nothing is deleted. One stroke, so the pen runs back over part of the first diagonal before drawing the second.",
|
|
562
564
|
required: ["over"],
|
|
563
565
|
properties: { over: gestureBox("What to cross out: a box { x, y, width, height } or a node { nodeId }.") },
|
|
564
|
-
make: (p, seed) =>
|
|
566
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.crossGesture.call(void 0, box(p.over, "over"), seed)
|
|
565
567
|
}),
|
|
566
568
|
gesture({
|
|
567
569
|
name: "check",
|
|
@@ -573,7 +575,7 @@ function createGestureCommands(target, base, prefix, options) {
|
|
|
573
575
|
at: gestureEnd("Where the tick goes: a box, a node { nodeId } (its centre) or a point [x, y]."),
|
|
574
576
|
size: { type: "number", exclusiveMinimum: 0, maximum: 2e3, description: "Height of the tick, canvas units (default: 60% of the box's smaller side, 12..48; 20 at a point)." }
|
|
575
577
|
},
|
|
576
|
-
make: (p, seed) =>
|
|
578
|
+
make: (p, seed) => _chunkE2Z4UARJcjs.checkGesture.call(void 0, end(p.at, "at"), seed, { ...p.size !== void 0 ? { size: p.size } : {} })
|
|
577
579
|
})
|
|
578
580
|
];
|
|
579
581
|
}
|
|
@@ -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-JQ2XQRUD.cjs"))).catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -117,7 +117,8 @@ async function renderCanvasBrushSwatch(brush, options = {}, spec) {
|
|
|
117
117
|
return (await loadCanvasBrushstrokeRenderer()).brushSwatchNow(brush, options, spec);
|
|
118
118
|
}
|
|
119
119
|
var renderCanvasBrushPreview = async (brush, { width, height, color }) => {
|
|
120
|
-
const
|
|
120
|
+
const { light: _light, ...plain } = brush;
|
|
121
|
+
const url = await renderCanvasBrushSwatch(brush.id, { width, height, color, scale: 1 }, plain);
|
|
121
122
|
return { data: url.replace(/^data:image\/png;base64,/, ""), mimeType: "image/png" };
|
|
122
123
|
};
|
|
123
124
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
listPresets,
|
|
8
8
|
normalizeBrushSpec,
|
|
9
9
|
resolveBrush
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-J4SGJCPW.js";
|
|
11
11
|
import {
|
|
12
12
|
parseProvenance
|
|
13
13
|
} from "./chunk-M6DNZNVY.js";
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "./chunk-PWBZH3FK.js";
|
|
52
52
|
import {
|
|
53
53
|
brushColourHex
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-DVPQFMH6.js";
|
|
55
55
|
import {
|
|
56
56
|
BrushstrokeCache,
|
|
57
57
|
GRAIN_PATTERNS,
|