@pixerate/editor 0.266.2 → 0.268.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 +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/controller.d.cts +8 -0
- package/dist/animation-editor/controller.d.ts +8 -0
- package/dist/animation-editor/effect-tools.d.cts +1 -1
- package/dist/animation-editor/effect-tools.d.ts +1 -1
- package/dist/animation-editor/index.cjs +175 -108
- package/dist/animation-editor/index.js +94 -27
- package/dist/brushes/index.cjs +201 -75
- package/dist/brushes/index.d.cts +4 -3
- package/dist/brushes/index.d.ts +4 -3
- package/dist/brushes/index.js +138 -12
- package/dist/brushes/library.d.cts +27 -1
- package/dist/brushes/library.d.ts +27 -1
- package/dist/brushes/profiles.d.cts +10 -1
- package/dist/brushes/profiles.d.ts +10 -1
- package/dist/brushes/schema.d.cts +4 -0
- package/dist/brushes/schema.d.ts +4 -0
- package/dist/brushes/sources.d.cts +114 -0
- package/dist/brushes/sources.d.ts +114 -0
- package/dist/brushes/types.d.cts +37 -5
- package/dist/brushes/types.d.ts +37 -5
- package/dist/brushes/ui.d.cts +40 -4
- package/dist/brushes/ui.d.ts +40 -4
- package/dist/{brushstrokeRender-KD453OBX.js → brushstrokeRender-A727TTNQ.js} +7 -7
- package/dist/{brushstrokeRender-FSUWXUZY.cjs → brushstrokeRender-WR2N5HHY.cjs} +23 -23
- package/dist/canvas/brushTypes.d.cts +12 -0
- package/dist/canvas/brushTypes.d.ts +12 -0
- package/dist/canvas/brushstroke.d.cts +1 -1
- package/dist/canvas/brushstroke.d.ts +1 -1
- package/dist/canvas/drawController.d.cts +19 -4
- package/dist/canvas/drawController.d.ts +19 -4
- package/dist/canvas/index.cjs +144 -105
- package/dist/canvas/index.js +46 -7
- package/dist/{chunk-TOID45I2.cjs → chunk-2WOGXEDX.cjs} +1 -1
- package/dist/{chunk-XORJ7UZO.cjs → chunk-3VHH6V67.cjs} +13 -12
- package/dist/{chunk-3C33YTNN.js → chunk-3XDSNIGF.js} +73 -6
- package/dist/chunk-62MFUHSI.cjs +802 -0
- package/dist/{chunk-R44Y3EFS.js → chunk-74ODPZLX.js} +17 -345
- package/dist/{chunk-GCVFEPJG.js → chunk-ACTHSQOI.js} +182 -0
- package/dist/chunk-ADMRNWR7.js +340 -0
- package/dist/{chunk-MVUQSK5J.cjs → chunk-B3G7BKUV.cjs} +111 -439
- package/dist/{chunk-DXYHQ2VN.js → chunk-BAZMCFVL.js} +1 -1
- package/dist/{chunk-VRK322ZC.cjs → chunk-BPJSI4NT.cjs} +2 -2
- package/dist/{chunk-RFJZGTHA.cjs → chunk-EU2ZZA6L.cjs} +400 -69
- package/dist/{chunk-XC6DPRYI.js → chunk-GSTSZPSR.js} +154 -949
- package/dist/{chunk-EZOJBP4D.js → chunk-HFY5LG5J.js} +1 -1
- package/dist/chunk-HVO6XCI4.js +802 -0
- package/dist/{chunk-YHDHFJUC.cjs → chunk-J5VQYK7T.cjs} +217 -1012
- package/dist/{chunk-XRXFVRGY.cjs → chunk-JBB3GDBB.cjs} +2483 -208
- package/dist/{chunk-ACFSFUQH.js → chunk-JL6YH5WD.js} +4 -0
- package/dist/{chunk-CIJBSUM5.js → chunk-KZI3YWKW.js} +353 -22
- package/dist/{chunk-4ODRXQRW.js → chunk-LETF75CA.js} +1 -1
- package/dist/{chunk-FQPUF2W2.cjs → chunk-NIBFKXMD.cjs} +217 -35
- package/dist/{chunk-AQZQWXEU.cjs → chunk-NPWWSCWT.cjs} +35 -35
- package/dist/{chunk-DOZ6F2K2.js → chunk-NSETJI74.js} +3 -2
- package/dist/{chunk-PE6YJMQT.cjs → chunk-PFHJS4HE.cjs} +20 -19
- package/dist/{chunk-7KNW3WXZ.cjs → chunk-QEVLRLUN.cjs} +63 -0
- package/dist/{chunk-LK4SXL3V.js → chunk-QNY7BDFP.js} +1 -1
- package/dist/{chunk-OTN6VB5S.cjs → chunk-RDFHWAHL.cjs} +5 -1
- package/dist/{chunk-PXDIAYB6.cjs → chunk-STLTOISW.cjs} +34 -214
- package/dist/{chunk-T2LDTEXK.js → chunk-UVTO3D4E.js} +2333 -58
- package/dist/{chunk-6JL2D5SG.js → chunk-VE6UKYQ2.js} +3 -2
- package/dist/{chunk-TXFWZ5ZJ.js → chunk-W6JDUXP3.js} +4 -184
- package/dist/{chunk-3SBLVGOM.cjs → chunk-YOVXQHA3.cjs} +23 -23
- package/dist/{chunk-WLUVZKVD.cjs → chunk-YXP6X3SY.cjs} +103 -36
- package/dist/chunk-YZWM6ZIP.cjs +340 -0
- package/dist/{chunk-472INMWH.js → chunk-ZA7L5YJB.js} +63 -0
- package/dist/commands/builtins.d.cts +12 -1
- package/dist/commands/builtins.d.ts +12 -1
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/image-editor/controller.d.cts +1 -1
- package/dist/image-editor/controller.d.ts +1 -1
- package/dist/image-editor/index.cjs +868 -864
- package/dist/image-editor/index.js +123 -119
- package/dist/paint/index.cjs +8 -6
- package/dist/paint/index.js +56 -54
- package/dist/paint-editor/brush-library-tools.d.cts +12 -2
- package/dist/paint-editor/brush-library-tools.d.ts +12 -2
- package/dist/paint-editor/brush-model.d.cts +29 -1
- package/dist/paint-editor/brush-model.d.ts +29 -1
- package/dist/paint-editor/brush-source-art.d.cts +32 -0
- package/dist/paint-editor/brush-source-art.d.ts +32 -0
- package/dist/paint-editor/controller.d.cts +11 -4
- package/dist/paint-editor/controller.d.ts +11 -4
- package/dist/paint-editor/dab-stroke.d.cts +2 -0
- package/dist/paint-editor/dab-stroke.d.ts +2 -0
- package/dist/paint-editor/engine.d.cts +11 -2
- package/dist/paint-editor/engine.d.ts +11 -2
- package/dist/paint-editor/index.cjs +967 -2335
- package/dist/paint-editor/index.d.cts +3 -1
- package/dist/paint-editor/index.d.ts +3 -1
- package/dist/paint-editor/index.js +394 -1762
- package/dist/paint-editor/path-samples.d.cts +2 -0
- package/dist/paint-editor/path-samples.d.ts +2 -0
- package/dist/paint-editor/presence.d.cts +20 -1
- package/dist/paint-editor/presence.d.ts +20 -1
- package/dist/paint-editor/stamp-tip.d.cts +8 -5
- package/dist/paint-editor/stamp-tip.d.ts +8 -5
- package/dist/paint-editor/thumbnails.d.cts +6 -0
- package/dist/paint-editor/thumbnails.d.ts +6 -0
- package/dist/paint-editor/tip-grain.d.cts +34 -0
- package/dist/paint-editor/tip-grain.d.ts +34 -0
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.js +9 -9
- package/dist/stickers/helpers.d.cts +2 -0
- package/dist/stickers/helpers.d.ts +2 -0
- package/dist/stickers/index.cjs +41 -35
- package/dist/stickers/index.js +22 -16
- package/dist/stickers/types.d.cts +4 -2
- package/dist/stickers/types.d.ts +4 -2
- package/dist/vector/backdrop.d.cts +13 -0
- package/dist/vector/backdrop.d.ts +13 -0
- package/dist/vector/brushstroke.d.cts +54 -7
- package/dist/vector/brushstroke.d.ts +54 -7
- package/dist/vector/brushstrokeMedia.d.cts +96 -0
- package/dist/vector/brushstrokeMedia.d.ts +96 -0
- package/dist/vector/controller.d.cts +17 -3
- package/dist/vector/controller.d.ts +17 -3
- package/dist/vector/index.cjs +1850 -1390
- package/dist/vector/index.d.cts +2 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.js +520 -60
- package/dist/vector/render.d.cts +6 -0
- package/dist/vector/render.d.ts +6 -0
- package/dist/vector/types.d.cts +14 -0
- package/dist/vector/types.d.ts +14 -0
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -0
- package/skills/pixerate-brushes/SKILL.md +37 -10
- package/skills/pixerate-brushes-design/SKILL.md +15 -5
- package/skills/pixerate-brushes-design/evals/port-to-vector.json +8 -8
- package/skills/pixerate-canvas/SKILL.md +11 -1
- package/skills/pixerate-image-editor/SKILL.md +19 -64
- package/skills/pixerate-image-editor/references/color-management.md +2 -1
- package/skills/pixerate-image-editor/references/free-transform.md +12 -0
- package/skills/pixerate-image-editor/references/layer-effects.md +10 -0
- package/skills/pixerate-image-editor/references/painting.md +17 -0
- package/skills/pixerate-image-editor/references/photoshop-files.md +1 -1
- package/skills/pixerate-image-editor/references/shapes-and-type.md +14 -0
- package/skills/pixerate-image-editor/references/smart-objects.md +10 -0
- package/skills/pixerate-paint-editor/SKILL.md +14 -4
- package/skills/pixerate-paint-editor/references/brush-facets.md +3 -1
- package/skills/pixerate-paint-editor/references/wet-media.md +9 -0
- package/skills/pixerate-paint-sketch-to-finish/SKILL.md +1 -0
- package/skills/pixerate-vector/SKILL.md +16 -6
- package/skills/pixerate-vector/references/best-practices.md +1 -0
- package/skills/pixerate-vector/references/commands.md +19 -0
|
@@ -1,4 +1,6 @@
|
|
|
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; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7;
|
|
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; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8;
|
|
2
|
+
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
var _chunk3K6HWEXZcjs = require('./chunk-3K6HWEXZ.cjs');
|
|
4
6
|
|
|
@@ -1078,6 +1080,180 @@ function coverageTileCoord(key) {
|
|
|
1078
1080
|
return _chunk474IQG74cjs.tileCoord.call(void 0, key);
|
|
1079
1081
|
}
|
|
1080
1082
|
|
|
1083
|
+
// src/paint/grain.ts
|
|
1084
|
+
var GRAIN_PATTERNS = ["smooth", "cold-pressed", "hot-pressed", "rough", "vellum", "laid", "ingres", "sanded", "canvas", "linen", "gesso"];
|
|
1085
|
+
var GRAIN_TILE = 256;
|
|
1086
|
+
var clamp01 = (v) => v < 0 ? 0 : v > 1 ? 1 : v;
|
|
1087
|
+
function patternHeights(pattern, n, seed) {
|
|
1088
|
+
const out = new Float32Array(n * n);
|
|
1089
|
+
const salt = Math.imul(seed | 0, 2654435761) + 17;
|
|
1090
|
+
if (pattern === "smooth") return out.fill(1);
|
|
1091
|
+
const noise = (cx, cy, oct, s = 0) => new (0, _chunk3K6HWEXZcjs.TileableNoise)(n, cx, cy, oct, salt + s);
|
|
1092
|
+
const k = n / GRAIN_TILE;
|
|
1093
|
+
switch (pattern) {
|
|
1094
|
+
case "cold-pressed": {
|
|
1095
|
+
const base = noise(20 * k, 20 * k, 4);
|
|
1096
|
+
const fine = noise(64 * k, 64 * k, 2, 3);
|
|
1097
|
+
for (let y = 0; y < n; y++)
|
|
1098
|
+
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.8 + 0.5 + (fine.at(x, y) - 0.5) * 0.5 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.12);
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
case "hot-pressed": {
|
|
1102
|
+
const base = noise(40 * k, 40 * k, 3);
|
|
1103
|
+
for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.1 + 0.6 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.08);
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
case "rough": {
|
|
1107
|
+
const base = noise(10 * k, 10 * k, 5);
|
|
1108
|
+
const blot = noise(28 * k, 28 * k, 2, 5);
|
|
1109
|
+
for (let y = 0; y < n; y++)
|
|
1110
|
+
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 2.4 + 0.5 + (blot.at(x, y) - 0.5) * 0.7 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.15);
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
case "vellum": {
|
|
1114
|
+
const base = noise(40 * k, 40 * k, 3);
|
|
1115
|
+
for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.6 + 0.55 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.2);
|
|
1116
|
+
break;
|
|
1117
|
+
}
|
|
1118
|
+
case "laid": {
|
|
1119
|
+
const pulp = noise(32 * k, 32 * k, 3);
|
|
1120
|
+
const chain = n / 8;
|
|
1121
|
+
for (let y = 0; y < n; y++) {
|
|
1122
|
+
const laid = 0.5 + 0.5 * Math.cos(2 * Math.PI * y / 4);
|
|
1123
|
+
for (let x = 0; x < n; x++) {
|
|
1124
|
+
const c = Math.abs((x + 0.5) % chain - chain / 2) / (chain / 2);
|
|
1125
|
+
const chainLine = c > 0.94 ? -0.35 : 0;
|
|
1126
|
+
out[y * n + x] = clamp01(0.3 + 0.5 * laid + chainLine + (pulp.at(x, y) - 0.5) * 0.6);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
case "ingres": {
|
|
1132
|
+
const fibres = noise(64 * k, 12 * k, 3);
|
|
1133
|
+
const base = noise(16 * k, 16 * k, 3, 7);
|
|
1134
|
+
for (let y = 0; y < n; y++)
|
|
1135
|
+
for (let x = 0; x < n; x++) {
|
|
1136
|
+
const g = _chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt ^ 85);
|
|
1137
|
+
out[y * n + x] = clamp01((fibres.at(x, y) - 0.5) * 1.5 + (base.at(x, y) - 0.5) * 0.7 + 0.55 + (g < 0.1 ? -0.3 : 0));
|
|
1138
|
+
}
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
case "sanded": {
|
|
1142
|
+
const grit = noise(96 * k, 96 * k, 2);
|
|
1143
|
+
for (let y = 0; y < n; y++)
|
|
1144
|
+
for (let x = 0; x < n; x++) {
|
|
1145
|
+
const h = _chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt);
|
|
1146
|
+
out[y * n + x] = clamp01((grit.at(x, y) - 0.5) * 2.4 + 0.5 + (h - 0.5) * 0.7);
|
|
1147
|
+
}
|
|
1148
|
+
break;
|
|
1149
|
+
}
|
|
1150
|
+
case "canvas":
|
|
1151
|
+
case "linen": {
|
|
1152
|
+
const period = (pattern === "canvas" ? 8 : 5) * k;
|
|
1153
|
+
const threads = Math.max(2, 2 * Math.round(n / period / 2));
|
|
1154
|
+
const p = n / threads;
|
|
1155
|
+
const slub = noise(threads, threads, 2, 11);
|
|
1156
|
+
for (let y = 0; y < n; y++)
|
|
1157
|
+
for (let x = 0; x < n; x++) {
|
|
1158
|
+
const fx = (x + 0.5) / p;
|
|
1159
|
+
const fy = (y + 0.5) / p;
|
|
1160
|
+
const cx = Math.floor(fx);
|
|
1161
|
+
const cy = Math.floor(fy);
|
|
1162
|
+
const warp = Math.sin(Math.PI * (fx - cx));
|
|
1163
|
+
const weft = Math.sin(Math.PI * (fy - cy));
|
|
1164
|
+
const top = (cx + cy) % 2 === 0 ? warp : weft;
|
|
1165
|
+
const irregular = pattern === "linen" ? (slub.at(x, y) - 0.5) * 0.5 : 0;
|
|
1166
|
+
out[y * n + x] = clamp01(0.2 + 0.7 * top + irregular + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.15);
|
|
1167
|
+
}
|
|
1168
|
+
break;
|
|
1169
|
+
}
|
|
1170
|
+
case "gesso": {
|
|
1171
|
+
const streaks = noise(2 * k, 28 * k, 3);
|
|
1172
|
+
const tooth = noise(64 * k, 64 * k, 2, 13);
|
|
1173
|
+
for (let y = 0; y < n; y++)
|
|
1174
|
+
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((streaks.at(x, y) - 0.5) * 1.8 + (tooth.at(x, y) - 0.5) * 0.9 + 0.55);
|
|
1175
|
+
break;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
return out;
|
|
1179
|
+
}
|
|
1180
|
+
var rawCache = /* @__PURE__ */ new Map();
|
|
1181
|
+
function grainHeights(pattern, seed, size = GRAIN_TILE) {
|
|
1182
|
+
const key = `${pattern}:${seed}:${size}`;
|
|
1183
|
+
let h = rawCache.get(key);
|
|
1184
|
+
if (!h) {
|
|
1185
|
+
h = patternHeights(pattern, size, seed);
|
|
1186
|
+
if (rawCache.size > 32) rawCache.delete(rawCache.keys().next().value);
|
|
1187
|
+
rawCache.set(key, h);
|
|
1188
|
+
}
|
|
1189
|
+
return h;
|
|
1190
|
+
}
|
|
1191
|
+
var PaperGrain = (_class4 = class {
|
|
1192
|
+
__init21() {this.size = GRAIN_TILE}
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
constructor(paper, media = "dry") {;_class4.prototype.__init21.call(this);
|
|
1200
|
+
const raw = grainHeights(paper.pattern, paper.seed);
|
|
1201
|
+
const t = paper[media];
|
|
1202
|
+
this.flat = paper.pattern === "smooth";
|
|
1203
|
+
if (t.contrast === 1 && !t.invert) this.heights = raw;
|
|
1204
|
+
else {
|
|
1205
|
+
const out = new Float32Array(raw.length);
|
|
1206
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1207
|
+
const v = clamp01((raw[i] - 0.5) * t.contrast + 0.5);
|
|
1208
|
+
out[i] = t.invert ? 1 - v : v;
|
|
1209
|
+
}
|
|
1210
|
+
this.heights = out;
|
|
1211
|
+
}
|
|
1212
|
+
this.scale = paper.scale;
|
|
1213
|
+
this.mirror = paper.tiling === "mirror";
|
|
1214
|
+
this.ox = _nullishCoalesce(_optionalChain([paper, 'access', _5 => _5.offset, 'optionalAccess', _6 => _6.x]), () => ( 0));
|
|
1215
|
+
this.oy = _nullishCoalesce(_optionalChain([paper, 'access', _7 => _7.offset, 'optionalAccess', _8 => _8.y]), () => ( 0));
|
|
1216
|
+
}
|
|
1217
|
+
/** Tile cell index for a coordinate in grain pixels (mirrored on odd tiles when mirroring). */
|
|
1218
|
+
wrap(v) {
|
|
1219
|
+
const n = this.size;
|
|
1220
|
+
if (!this.mirror) return (v % n + n) % n;
|
|
1221
|
+
const p = (v % (2 * n) + 2 * n) % (2 * n);
|
|
1222
|
+
return p < n ? p : 2 * n - 1 - p;
|
|
1223
|
+
}
|
|
1224
|
+
/** Height 0..1 at document position (x, y). */
|
|
1225
|
+
at(x, y) {
|
|
1226
|
+
const u = (x - this.ox) / this.scale - 0.5;
|
|
1227
|
+
const v = (y - this.oy) / this.scale - 0.5;
|
|
1228
|
+
const x0 = Math.floor(u);
|
|
1229
|
+
const y0 = Math.floor(v);
|
|
1230
|
+
const fx = u - x0;
|
|
1231
|
+
const fy = v - y0;
|
|
1232
|
+
const n = this.size;
|
|
1233
|
+
const h = this.heights;
|
|
1234
|
+
const a = this.wrap(x0);
|
|
1235
|
+
const b = this.wrap(x0 + 1);
|
|
1236
|
+
const c = this.wrap(y0) * n;
|
|
1237
|
+
const d = this.wrap(y0 + 1) * n;
|
|
1238
|
+
const top = h[c + a] + (h[c + b] - h[c + a]) * fx;
|
|
1239
|
+
const bot = h[d + a] + (h[d + b] - h[d + a]) * fx;
|
|
1240
|
+
return top + (bot - top) * fy;
|
|
1241
|
+
}
|
|
1242
|
+
}, _class4);
|
|
1243
|
+
function grainCatch(h, depth, pressure) {
|
|
1244
|
+
if (depth <= 0) return 1;
|
|
1245
|
+
const t = depth * (0.75 - 0.65 * Math.min(1, Math.max(0, pressure)));
|
|
1246
|
+
const u = clamp01((h - t + 0.18) / 0.36);
|
|
1247
|
+
return 1 - depth + depth * u * u * (3 - 2 * u);
|
|
1248
|
+
}
|
|
1249
|
+
function strokeGrainCatch(h, depth, pressure) {
|
|
1250
|
+
if (depth <= 0) return 1;
|
|
1251
|
+
const p = Math.min(1, Math.max(0, pressure));
|
|
1252
|
+
const amount = Math.min(1, depth * (1.4 - 0.6 * p));
|
|
1253
|
+
const u = clamp01((h - 0.2 - 0.25 * (1 - p)) / 0.5);
|
|
1254
|
+
return 1 - amount + amount * u * u * (3 - 2 * u);
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1081
1257
|
// src/paint/exchange.ts
|
|
1082
1258
|
var MIXING_MODELS = ["rgb", "pigment"];
|
|
1083
1259
|
var EMPTY_MIXER_LOAD = { reservoir: null, amount: 0, pickup: null };
|
|
@@ -1086,8 +1262,8 @@ var MIXER_DRAIN = 0.08;
|
|
|
1086
1262
|
function exchangeRates(pickup, mix, load, mixing) {
|
|
1087
1263
|
return { pickup: MIXER_PICKUP_RATE * pickup, mix: mix * pickup, drain: MIXER_DRAIN * (1 - load), mixing };
|
|
1088
1264
|
}
|
|
1089
|
-
var PaintExchange = (
|
|
1090
|
-
constructor(rates, load) {;
|
|
1265
|
+
var PaintExchange = (_class5 = class {
|
|
1266
|
+
constructor(rates, load) {;_class5.prototype.__init22.call(this);
|
|
1091
1267
|
this.rates = rates;
|
|
1092
1268
|
this.reservoir = load.reservoir ? [load.reservoir[0], load.reservoir[1], load.reservoir[2]] : null;
|
|
1093
1269
|
this.amount = this.reservoir ? Math.min(1, Math.max(0, load.amount)) : 0;
|
|
@@ -1099,7 +1275,7 @@ var PaintExchange = (_class4 = class {
|
|
|
1099
1275
|
|
|
1100
1276
|
|
|
1101
1277
|
|
|
1102
|
-
|
|
1278
|
+
__init22() {this.out = [0, 0, 0]}
|
|
1103
1279
|
/** What the brush carries now. */
|
|
1104
1280
|
get load() {
|
|
1105
1281
|
return { reservoir: this.reservoir ? [...this.reservoir] : null, amount: this.amount, pickup: this.well ? [...this.well] : null };
|
|
@@ -1110,7 +1286,7 @@ var PaintExchange = (_class4 = class {
|
|
|
1110
1286
|
}
|
|
1111
1287
|
/** The prepared pigment of the last `paint` colour (pigment mixing only), for `deposit`. */
|
|
1112
1288
|
get paintPigment() {
|
|
1113
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
1289
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _9 => _9.pig, 'optionalAccess', _10 => _10.paint]), () => ( null));
|
|
1114
1290
|
}
|
|
1115
1291
|
/** Recolours the reservoir without refilling it (a multi-coloured brush, per dab). */
|
|
1116
1292
|
setReservoirColor(r, g, b) {
|
|
@@ -1147,7 +1323,7 @@ var PaintExchange = (_class4 = class {
|
|
|
1147
1323
|
if (!this.well) this.well = [sample.rgb[0], sample.rgb[1], sample.rgb[2]];
|
|
1148
1324
|
else {
|
|
1149
1325
|
if (pig) _chunk2VX55NFMcjs.setPigmentColor.call(void 0, pig.canvas, sample.rgb[0], sample.rgb[1], sample.rgb[2]);
|
|
1150
|
-
const o = this.mix(this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess',
|
|
1326
|
+
const o = this.mix(this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _11 => _11.well]), () => ( null)), sample.rgb, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _12 => _12.canvas]), () => ( null)), this.rates.pickup * sample.contact);
|
|
1151
1327
|
this.well = [o[0], o[1], o[2]];
|
|
1152
1328
|
}
|
|
1153
1329
|
if (pig) _chunk2VX55NFMcjs.setPigmentColor.call(void 0, pig.well, this.well[0], this.well[1], this.well[2]);
|
|
@@ -1165,7 +1341,7 @@ var PaintExchange = (_class4 = class {
|
|
|
1165
1341
|
if (!(total > 1e-6)) return 0;
|
|
1166
1342
|
const pig = this.pig;
|
|
1167
1343
|
if (res && this.well) {
|
|
1168
|
-
const m = this.mix(res, _nullishCoalesce(_optionalChain([pig, 'optionalAccess',
|
|
1344
|
+
const m = this.mix(res, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _13 => _13.res]), () => ( null)), this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _14 => _14.well]), () => ( null)), wp / total);
|
|
1169
1345
|
out[0] = m[0];
|
|
1170
1346
|
out[1] = m[1];
|
|
1171
1347
|
out[2] = m[2];
|
|
@@ -1182,29 +1358,29 @@ var PaintExchange = (_class4 = class {
|
|
|
1182
1358
|
drain() {
|
|
1183
1359
|
this.amount *= 1 - this.rates.drain;
|
|
1184
1360
|
}
|
|
1185
|
-
},
|
|
1361
|
+
}, _class5);
|
|
1186
1362
|
function put255(px, i, v) {
|
|
1187
1363
|
if (px instanceof Float32Array) px[i] = v > 0 ? v * 255 : 0;
|
|
1188
1364
|
else px[i] = Math.round(v * 255);
|
|
1189
1365
|
}
|
|
1190
|
-
var TileMedium = (
|
|
1191
|
-
constructor(target, options = {}) {;
|
|
1366
|
+
var TileMedium = (_class6 = class {
|
|
1367
|
+
constructor(target, options = {}) {;_class6.prototype.__init23.call(this);_class6.prototype.__init24.call(this);_class6.prototype.__init25.call(this);_class6.prototype.__init26.call(this);_class6.prototype.__init27.call(this);_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);_class6.prototype.__init32.call(this);
|
|
1192
1368
|
this.target = target;
|
|
1193
1369
|
this.options = options;
|
|
1194
1370
|
}
|
|
1195
1371
|
|
|
1196
1372
|
|
|
1197
1373
|
// The tile last looked up by `locate` (and whether it came from `writeTile`).
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1374
|
+
__init23() {this.tx = NaN}
|
|
1375
|
+
__init24() {this.ty = NaN}
|
|
1376
|
+
__init25() {this.tile = null}
|
|
1377
|
+
__init26() {this.writable = false}
|
|
1378
|
+
__init27() {this.canvasPig = _chunk2VX55NFMcjs.createPigment.call(void 0, [0, 0, 0])}
|
|
1379
|
+
__init28() {this.paintPig = _chunk2VX55NFMcjs.createPigment.call(void 0, [0, 0, 0])}
|
|
1380
|
+
__init29() {this.paintKey = -1}
|
|
1381
|
+
__init30() {this.cb = [0, 0, 0, 0]}
|
|
1382
|
+
__init31() {this.src = [0, 0, 0, 1]}
|
|
1383
|
+
__init32() {this.o = [0, 0, 0]}
|
|
1208
1384
|
/** Forgets the cached tile (call when another writer may have replaced tiles). */
|
|
1209
1385
|
reset() {
|
|
1210
1386
|
this.tx = NaN;
|
|
@@ -1349,7 +1525,7 @@ var TileMedium = (_class5 = class {
|
|
|
1349
1525
|
}
|
|
1350
1526
|
}
|
|
1351
1527
|
}
|
|
1352
|
-
},
|
|
1528
|
+
}, _class6);
|
|
1353
1529
|
|
|
1354
1530
|
// src/paint/blending.ts
|
|
1355
1531
|
var DEFAULT_BLENDER = { strength: 0.5, distance: 0.35, mixing: "pigment" };
|
|
@@ -1465,8 +1641,8 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
1465
1641
|
}
|
|
1466
1642
|
}
|
|
1467
1643
|
}
|
|
1468
|
-
var SmudgeTip = (
|
|
1469
|
-
constructor(settings, diameter) {;
|
|
1644
|
+
var SmudgeTip = (_class7 = class {
|
|
1645
|
+
constructor(settings, diameter) {;_class7.prototype.__init33.call(this);_class7.prototype.__init34.call(this);
|
|
1470
1646
|
this.settings = settings;
|
|
1471
1647
|
this.size = Math.max(2, Math.min(512, Math.ceil(diameter)));
|
|
1472
1648
|
this.patch = new Float32Array(this.size * this.size * 4);
|
|
@@ -1474,8 +1650,8 @@ var SmudgeTip = (_class6 = class {
|
|
|
1474
1650
|
|
|
1475
1651
|
|
|
1476
1652
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1653
|
+
__init33() {this.loaded = false}
|
|
1654
|
+
__init34() {this.out = [0, 0, 0]}
|
|
1479
1655
|
cell(d, px, py) {
|
|
1480
1656
|
const s = this.size;
|
|
1481
1657
|
const r = Math.max(0.5, d.radius);
|
|
@@ -1586,7 +1762,7 @@ var SmudgeTip = (_class6 = class {
|
|
|
1586
1762
|
}
|
|
1587
1763
|
}
|
|
1588
1764
|
}
|
|
1589
|
-
},
|
|
1765
|
+
}, _class7);
|
|
1590
1766
|
|
|
1591
1767
|
// src/paint/mixer.ts
|
|
1592
1768
|
var DEFAULT_MIXER = {
|
|
@@ -1619,22 +1795,22 @@ function loadMixer(load, color) {
|
|
|
1619
1795
|
function cleanMixer(load) {
|
|
1620
1796
|
return { reservoir: load.reservoir, amount: load.amount, pickup: null };
|
|
1621
1797
|
}
|
|
1622
|
-
var MixerStroke = (
|
|
1623
|
-
constructor(brush, settings, load, target) {;
|
|
1798
|
+
var MixerStroke = (_class8 = class {
|
|
1799
|
+
constructor(brush, settings, load, target) {;_class8.prototype.__init35.call(this);_class8.prototype.__init36.call(this);_class8.prototype.__init37.call(this);_class8.prototype.__init38.call(this);_class8.prototype.__init39.call(this);
|
|
1624
1800
|
this.brush = brush;
|
|
1625
1801
|
this.walker = new DabWalker(brush);
|
|
1626
1802
|
this.exchange = new PaintExchange(mixerRates(normalizeMixer(settings)), load);
|
|
1627
1803
|
this.medium = new TileMedium(target);
|
|
1628
1804
|
}
|
|
1629
1805
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1806
|
+
__init35() {this.dabCount = 0}
|
|
1807
|
+
__init36() {this.bounds = null}
|
|
1632
1808
|
|
|
1633
|
-
|
|
1634
|
-
|
|
1809
|
+
__init37() {this.smoothPos = null}
|
|
1810
|
+
__init38() {this.buf = new Float32Array(0)}
|
|
1635
1811
|
|
|
1636
1812
|
|
|
1637
|
-
|
|
1813
|
+
__init39() {this.paintColor = [0, 0, 0]}
|
|
1638
1814
|
/** The brush load after the dabs so far. */
|
|
1639
1815
|
get load() {
|
|
1640
1816
|
return this.exchange.load;
|
|
@@ -1682,7 +1858,7 @@ var MixerStroke = (_class7 = class {
|
|
|
1682
1858
|
}
|
|
1683
1859
|
ex.drain();
|
|
1684
1860
|
}
|
|
1685
|
-
},
|
|
1861
|
+
}, _class8);
|
|
1686
1862
|
function union(a, b) {
|
|
1687
1863
|
if (!a) return { ...b };
|
|
1688
1864
|
const x = Math.min(a.x, b.x);
|
|
@@ -1763,4 +1939,10 @@ function union(a, b) {
|
|
|
1763
1939
|
|
|
1764
1940
|
|
|
1765
1941
|
|
|
1766
|
-
|
|
1942
|
+
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
|
|
1948
|
+
exports.PAINT_GRADIENT_SPACES = PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_REPEATS = PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_MAPPINGS = PAINT_GRADIENT_MAPPINGS; exports.DEFAULT_PAINT_GRADIENT_MAPPING = DEFAULT_PAINT_GRADIENT_MAPPING; exports.PAINT_GRADIENT_FULL_SPEED = PAINT_GRADIENT_FULL_SPEED; exports.PaintSourceError = PaintSourceError; exports.normalizeHexColor = normalizeHexColor; exports.hexToPaintRgb = hexToPaintRgb; exports.parsePaintSource = parsePaintSource; exports.readPaintSource = readPaintSource; exports.resolvePaintGradient = resolvePaintGradient; exports.scalePaintGradient = scalePaintGradient; exports.solidPaint = solidPaint; exports.isGradientPaint = isGradientPaint; exports.paintSourceColor = paintSourceColor; exports.paintSourceCss = paintSourceCss; exports.PaintGradientSampler = PaintGradientSampler; exports.PAINT_GRADIENT_JSON_SCHEMA = PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_COLOR_JSON_SCHEMA = PAINT_COLOR_JSON_SCHEMA; exports.PAINT_SOURCE_JSON_SCHEMA = PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_GRADIENT_MAPPING_LABELS = PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_SPACE_LABELS = PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_GRADIENT_REPEAT_LABELS = PAINT_GRADIENT_REPEAT_LABELS; exports.DEFAULT_PAINT_GRADIENT = DEFAULT_PAINT_GRADIENT; exports.PAINT_GRADIENT_PRESETS = PAINT_GRADIENT_PRESETS; exports.addPaintGradientStop = addPaintGradientStop; exports.removePaintGradientStop = removePaintGradientStop; exports.updatePaintGradientStop = updatePaintGradientStop; exports.reversePaintGradient = reversePaintGradient; exports.paintGradientMappingFor = paintGradientMappingFor; exports.PAINT_GRADIENT_KIT = PAINT_GRADIENT_KIT; exports.DEFAULT_BRUSH = DEFAULT_BRUSH; exports.MAX_BRUSH_SIZE = MAX_BRUSH_SIZE; exports.normalizeBrush = normalizeBrush; exports.tipShape = tipShape; exports.tipFalloff = tipFalloff; exports.tipReach = tipReach; exports.dabCoverage = dabCoverage; exports.smoothPoints = smoothPoints; exports.DabWalker = DabWalker; exports.walkDabs = walkDabs; exports.dabRect = dabRect; exports.rasterizeDab = rasterizeDab; exports.CoverageMap = CoverageMap; exports.StrokeCoverage = StrokeCoverage; exports.TIP_GRADIENT_STEPS = TIP_GRADIENT_STEPS; exports.gradientDabColor = gradientDabColor; exports.applyStrokeToTile = applyStrokeToTile; exports.applyStrokeToDeepTile = applyStrokeToDeepTile; exports.coverageTileCoord = coverageTileCoord; exports.GRAIN_PATTERNS = GRAIN_PATTERNS; exports.GRAIN_TILE = GRAIN_TILE; exports.grainHeights = grainHeights; exports.PaperGrain = PaperGrain; exports.grainCatch = grainCatch; exports.strokeGrainCatch = strokeGrainCatch; exports.MIXING_MODELS = MIXING_MODELS; exports.EMPTY_MIXER_LOAD = EMPTY_MIXER_LOAD; exports.MIXER_PICKUP_RATE = MIXER_PICKUP_RATE; exports.MIXER_DRAIN = MIXER_DRAIN; exports.exchangeRates = exchangeRates; exports.PaintExchange = PaintExchange; exports.put255 = put255; exports.TileMedium = TileMedium; exports.DEFAULT_BLENDER = DEFAULT_BLENDER; exports.DEFAULT_SMUDGE = DEFAULT_SMUDGE; exports.normalizeBlender = normalizeBlender; exports.normalizeSmudge = normalizeSmudge; exports.blendRadius = blendRadius; exports.createBlenderScratch = createBlenderScratch; exports.blenderDab = blenderDab; exports.SmudgeTip = SmudgeTip; exports.DEFAULT_MIXER = DEFAULT_MIXER; exports.normalizeMixer = normalizeMixer; exports.mixerRates = mixerRates; exports.loadMixer = loadMixer; exports.cleanMixer = cleanMixer; exports.MixerStroke = MixerStroke;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkJBB3GDBBcjs = require('./chunk-JBB3GDBB.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -37,7 +37,7 @@ var lerpP = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
|
|
|
37
37
|
var toP = (v) => [v.x, v.y];
|
|
38
38
|
var mapP = (m, p) => [m[0] * p[0] + m[2] * p[1] + m[4], m[1] * p[0] + m[3] * p[1] + m[5]];
|
|
39
39
|
var curvesOf = (c) => Math.max(0, (c.pts.length - 1) / 3) | 0;
|
|
40
|
-
function subpathToMorphContour(sp, m =
|
|
40
|
+
function subpathToMorphContour(sp, m = _chunkJBB3GDBBcjs.IDENTITY_MATRIX) {
|
|
41
41
|
const n = sp.anchors.length;
|
|
42
42
|
if (!n) return null;
|
|
43
43
|
const first = mapP(m, toP(sp.anchors[0]));
|
|
@@ -67,8 +67,8 @@ function isStraight(p0, p1, p2, p3) {
|
|
|
67
67
|
const u2 = along(p2);
|
|
68
68
|
return off(p1) < tol && off(p2) < tol && u1 >= -1e-9 && u1 <= 1 + 1e-9 && u2 >= -1e-9 && u2 <= 1 + 1e-9;
|
|
69
69
|
}
|
|
70
|
-
function morphContourToSubpath(c, m =
|
|
71
|
-
const pts =
|
|
70
|
+
function morphContourToSubpath(c, m = _chunkJBB3GDBBcjs.IDENTITY_MATRIX, closed = c.closed) {
|
|
71
|
+
const pts = _chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, m) ? c.pts : c.pts.map((p) => mapP(m, p));
|
|
72
72
|
const curves = curvesOf(c);
|
|
73
73
|
const dropLast = closed && c.closed && curves > 0;
|
|
74
74
|
const count = dropLast ? curves : curves + 1;
|
|
@@ -84,7 +84,7 @@ function morphContourToSubpath(c, m = _chunkXRXFVRGYcjs.IDENTITY_MATRIX, closed
|
|
|
84
84
|
anchors[(k + 1) % count].in = { x: p2[0], y: p2[1] };
|
|
85
85
|
}
|
|
86
86
|
for (const a of anchors) {
|
|
87
|
-
const type =
|
|
87
|
+
const type = _chunkJBB3GDBBcjs.inferAnchorType.call(void 0, a);
|
|
88
88
|
if (type !== "corner") a.type = type;
|
|
89
89
|
}
|
|
90
90
|
const isClosed = closed && curves > 0;
|
|
@@ -267,7 +267,7 @@ function bestStart(fixed, free, useShapeContext) {
|
|
|
267
267
|
return best;
|
|
268
268
|
}
|
|
269
269
|
function placeIn(c, from, to) {
|
|
270
|
-
const b =
|
|
270
|
+
const b = _chunkJBB3GDBBcjs.unionBounds.call(void 0, [boundsOfPoints(c.pts)]);
|
|
271
271
|
const p = b ? [b.x + b.width / 2, b.y + b.height / 2] : c.pts[0];
|
|
272
272
|
if (!from || !to) return p;
|
|
273
273
|
const fx = from.width > 0 ? (p[0] - from.x) / from.width : 0.5;
|
|
@@ -456,7 +456,7 @@ function interpolateVectorColor(a, b, t) {
|
|
|
456
456
|
}
|
|
457
457
|
function resampleGradientStops(g, offsets) {
|
|
458
458
|
return offsets.map((offset) => {
|
|
459
|
-
const s =
|
|
459
|
+
const s = _chunkJBB3GDBBcjs.sampleVectorGradient.call(void 0, g, offset);
|
|
460
460
|
return s.opacity < 1 ? { offset, color: s.color, opacity: Math.round(s.opacity * 1e4) / 1e4 } : { offset, color: s.color };
|
|
461
461
|
});
|
|
462
462
|
}
|
|
@@ -467,11 +467,11 @@ function lerpAngle(a, b, t) {
|
|
|
467
467
|
var lerpPoint = (a, b, t) => ({ x: lerpN(a.x, b.x, t), y: lerpN(a.y, b.y, t) });
|
|
468
468
|
var sameColourModel = (a, b) => (_nullishCoalesce(a.interpolation, () => ( "srgb"))) === (_nullishCoalesce(b.interpolation, () => ( "srgb"))) && (_nullishCoalesce(a.smoothness, () => ( 0))) === (_nullishCoalesce(b.smoothness, () => ( 0)));
|
|
469
469
|
function lerpStops(a, b, t) {
|
|
470
|
-
let stopsA =
|
|
471
|
-
let stopsB =
|
|
470
|
+
let stopsA = _chunkJBB3GDBBcjs.sortedVectorGradientStops.call(void 0, a);
|
|
471
|
+
let stopsB = _chunkJBB3GDBBcjs.sortedVectorGradientStops.call(void 0, b);
|
|
472
472
|
const resampled = stopsA.length !== stopsB.length || !sameColourModel(a, b);
|
|
473
473
|
if (resampled) {
|
|
474
|
-
const offs = [...
|
|
474
|
+
const offs = [..._chunkJBB3GDBBcjs.expandVectorGradientStops.call(void 0, a), ..._chunkJBB3GDBBcjs.expandVectorGradientStops.call(void 0, b), ...stopsA, ...stopsB].map((s) => s.offset).filter(Number.isFinite).sort((x, y) => x - y);
|
|
475
475
|
const common = offs.filter((o, i) => i === 0 || o - offs[i - 1] > 1e-4);
|
|
476
476
|
stopsA = resampleGradientStops(a, common);
|
|
477
477
|
stopsB = resampleGradientStops(b, common);
|
|
@@ -498,8 +498,8 @@ function lerpGradient(a, b, t) {
|
|
|
498
498
|
}
|
|
499
499
|
if (near.spread && near.spread !== "pad") out.spread = near.spread;
|
|
500
500
|
if (near.strokeMode && near.strokeMode !== "within") out.strokeMode = near.strokeMode;
|
|
501
|
-
const ea =
|
|
502
|
-
const eb =
|
|
501
|
+
const ea = _chunkJBB3GDBBcjs.hasExplicitGradientGeometry.call(void 0, a);
|
|
502
|
+
const eb = _chunkJBB3GDBBcjs.hasExplicitGradientGeometry.call(void 0, b);
|
|
503
503
|
if (!ea && !eb) {
|
|
504
504
|
if (a.angle !== void 0 || b.angle !== void 0 || a.type === "linear" || a.type === "reflected") {
|
|
505
505
|
const fallback = a.type === "linear" || a.type === "reflected" ? 180 : 90;
|
|
@@ -512,10 +512,10 @@ function lerpGradient(a, b, t) {
|
|
|
512
512
|
}
|
|
513
513
|
return out;
|
|
514
514
|
}
|
|
515
|
-
const pa =
|
|
516
|
-
const pb =
|
|
515
|
+
const pa = _chunkJBB3GDBBcjs.vectorGradientPoints.call(void 0, a);
|
|
516
|
+
const pb = _chunkJBB3GDBBcjs.vectorGradientPoints.call(void 0, b);
|
|
517
517
|
if (pa.units !== pb.units) {
|
|
518
|
-
const src =
|
|
518
|
+
const src = _chunkJBB3GDBBcjs.explicitVectorGradient.call(void 0, near);
|
|
519
519
|
return { ...src, stops: out.stops, ...out.interpolation ? { interpolation: out.interpolation } : {}, ...out.smoothness ? { smoothness: out.smoothness } : {} };
|
|
520
520
|
}
|
|
521
521
|
out.start = lerpPoint(pa.start, pb.start, t);
|
|
@@ -535,14 +535,14 @@ function solidLike(color, like) {
|
|
|
535
535
|
function interpolateVectorPaint(a, b, t) {
|
|
536
536
|
if (t <= 0) return a;
|
|
537
537
|
if (t >= 1) return b;
|
|
538
|
-
const pa =
|
|
539
|
-
const pb =
|
|
538
|
+
const pa = _chunkJBB3GDBBcjs.hasPaint.call(void 0, a);
|
|
539
|
+
const pb = _chunkJBB3GDBBcjs.hasPaint.call(void 0, b);
|
|
540
540
|
if (!pa && !pb) return t < 0.5 ? a : b;
|
|
541
541
|
if (typeof a === "string" && pa && typeof b === "string" && pb) return interpolateVectorColor(a, b, t);
|
|
542
542
|
if (!pa && typeof b === "string") return interpolateVectorColor("transparent", b, t);
|
|
543
543
|
if (!pb && typeof a === "string") return interpolateVectorColor(a, "transparent", t);
|
|
544
|
-
const ga = pa &&
|
|
545
|
-
const gb = pb &&
|
|
544
|
+
const ga = pa && _chunkJBB3GDBBcjs.isVectorGradient.call(void 0, a) ? a : null;
|
|
545
|
+
const gb = pb && _chunkJBB3GDBBcjs.isVectorGradient.call(void 0, b) ? b : null;
|
|
546
546
|
if (ga && gb) return _nullishCoalesce(lerpGradient(ga, gb, t), () => ( (t < 0.5 ? a : b)));
|
|
547
547
|
if (gb) return _nullishCoalesce(lerpGradient(solidLike(pa ? a : null, gb), gb, t), () => ( b));
|
|
548
548
|
if (ga) return _nullishCoalesce(lerpGradient(ga, solidLike(pb ? b : null, ga), t), () => ( a));
|
|
@@ -553,8 +553,8 @@ function interpolateWidthProfiles(a, b, t) {
|
|
|
553
553
|
const at = [..._nullishCoalesce(a, () => ( [])), ..._nullishCoalesce(b, () => ( [])), { t: 0 }, { t: 1 }].map((p) => p.t).sort((x, y) => x - y);
|
|
554
554
|
const ts = at.filter((v, i) => i === 0 || v - at[i - 1] > 1e-6);
|
|
555
555
|
return ts.map((pos) => {
|
|
556
|
-
const x =
|
|
557
|
-
const y =
|
|
556
|
+
const x = _chunkJBB3GDBBcjs.widthProfileAt.call(void 0, a, pos);
|
|
557
|
+
const y = _chunkJBB3GDBBcjs.widthProfileAt.call(void 0, b, pos);
|
|
558
558
|
return { t: pos, left: lerpN(x.left, y.left, t), right: lerpN(x.right, y.right, t) };
|
|
559
559
|
});
|
|
560
560
|
}
|
|
@@ -597,7 +597,7 @@ function reversedStyle(s) {
|
|
|
597
597
|
out.endArrow = s.startArrow;
|
|
598
598
|
out.startArrowScale = s.endArrowScale;
|
|
599
599
|
out.endArrowScale = s.startArrowScale;
|
|
600
|
-
if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile =
|
|
600
|
+
if (_optionalChain([s, 'access', _6 => _6.strokeWidthProfile, 'optionalAccess', _7 => _7.length])) out.strokeWidthProfile = _chunkJBB3GDBBcjs.reverseWidthProfile.call(void 0, s.strokeWidthProfile);
|
|
601
601
|
for (const k of ["startArrow", "endArrow", "startArrowScale", "endArrowScale"]) if (out[k] === void 0) delete out[k];
|
|
602
602
|
return out;
|
|
603
603
|
}
|
|
@@ -623,19 +623,19 @@ function styleOf(n) {
|
|
|
623
623
|
return out;
|
|
624
624
|
}
|
|
625
625
|
function contoursOf(node, m) {
|
|
626
|
-
return
|
|
626
|
+
return _chunkJBB3GDBBcjs.expandVectorCorners.call(void 0, node.subpaths).map((sp) => subpathToMorphContour(sp, m)).filter((c) => !!c);
|
|
627
627
|
}
|
|
628
|
-
function preparePathMorph(a, b, options, ma =
|
|
628
|
+
function preparePathMorph(a, b, options, ma = _chunkJBB3GDBBcjs.nodeMatrix.call(void 0, a), mb = _chunkJBB3GDBBcjs.nodeMatrix.call(void 0, b)) {
|
|
629
629
|
const corr = correspondMorphContours(contoursOf(a, ma), contoursOf(b, mb), options);
|
|
630
630
|
const sim = procrustes(corr.a, corr.b);
|
|
631
631
|
const styleA = styleOf(a);
|
|
632
632
|
const styleB = corr.reversed ? reversedStyle(styleOf(b)) : styleOf(b);
|
|
633
|
-
const rigid = !
|
|
633
|
+
const rigid = !_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, ma) || !_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, mb);
|
|
634
634
|
const id = _nullishCoalesce(options.id, () => ( a.id));
|
|
635
635
|
return (t) => {
|
|
636
636
|
const contours = interpolateMorphContours(corr.a, corr.b, t, { linear: options.linear, rigidity: options.rigidity, similarity: sim });
|
|
637
|
-
const m = rigid ? interpolateRigidMatrix(ma, mb, t) :
|
|
638
|
-
const back = rigid ?
|
|
637
|
+
const m = rigid ? interpolateRigidMatrix(ma, mb, t) : _chunkJBB3GDBBcjs.IDENTITY_MATRIX;
|
|
638
|
+
const back = rigid ? _chunkJBB3GDBBcjs.invertMatrix.call(void 0, m) : _chunkJBB3GDBBcjs.IDENTITY_MATRIX;
|
|
639
639
|
const subpaths = contours.map((c, k) => {
|
|
640
640
|
const closed = t <= 0 ? corr.a[k].closed : t >= 1 ? corr.b[k].closed : corr.a[k].closed && corr.b[k].closed;
|
|
641
641
|
return morphContourToSubpath({ closed: corr.a[k].closed && corr.b[k].closed, pts: c.pts }, back, closed);
|
|
@@ -643,14 +643,14 @@ function preparePathMorph(a, b, options, ma = _chunkXRXFVRGYcjs.nodeMatrix.call(
|
|
|
643
643
|
const node = { id, type: "path", subpaths, ...interpolateVectorStyle(styleA, styleB, t) };
|
|
644
644
|
const opacity = lerpN(_nullishCoalesce(a.opacity, () => ( 1)), _nullishCoalesce(b.opacity, () => ( 1)), t);
|
|
645
645
|
if (opacity < 1) node.opacity = opacity;
|
|
646
|
-
if (rigid && !
|
|
646
|
+
if (rigid && !_chunkJBB3GDBBcjs.isIdentityMatrix.call(void 0, m)) node.transform = m;
|
|
647
647
|
return node;
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function flattenPaths(node, parent =
|
|
651
|
-
const m =
|
|
650
|
+
function flattenPaths(node, parent = _chunkJBB3GDBBcjs.IDENTITY_MATRIX) {
|
|
651
|
+
const m = _chunkJBB3GDBBcjs.multiplyMatrices.call(void 0, _chunkJBB3GDBBcjs.nodeMatrix.call(void 0, node), parent);
|
|
652
652
|
if (node.type === "path") return [{ path: node, m, opacity: 1 }];
|
|
653
|
-
if (node.type === "text" || node.type === "instance") return flattenPaths(
|
|
653
|
+
if (node.type === "text" || node.type === "instance") return flattenPaths(_chunkJBB3GDBBcjs.expandVectorAppearance.call(void 0, node), parent);
|
|
654
654
|
const o = _nullishCoalesce(node.opacity, () => ( 1));
|
|
655
655
|
return node.children.filter((c) => c.visible !== false).flatMap((c) => flattenPaths(c, m)).map((e) => ({ ...e, opacity: e.opacity * o }));
|
|
656
656
|
}
|
|
@@ -672,8 +672,8 @@ function createVectorMorph(a, b, options = {}) {
|
|
|
672
672
|
}
|
|
673
673
|
const pa = flattenPaths(a);
|
|
674
674
|
const pb = flattenPaths(b);
|
|
675
|
-
const ba =
|
|
676
|
-
const bb =
|
|
675
|
+
const ba = _chunkJBB3GDBBcjs.unionBounds.call(void 0, pa.map((e) => placedBounds(e.path, e.m)));
|
|
676
|
+
const bb = _chunkJBB3GDBBcjs.unionBounds.call(void 0, pb.map((e) => placedBounds(e.path, e.m)));
|
|
677
677
|
const id = _nullishCoalesce(options.id, () => ( a.id));
|
|
678
678
|
const parts = [];
|
|
679
679
|
const opacities = [];
|
|
@@ -685,10 +685,10 @@ function createVectorMorph(a, b, options = {}) {
|
|
|
685
685
|
parts.push(preparePathMorph(x.path, y.path, sub, x.m, y.m));
|
|
686
686
|
opacities.push([x.opacity, y.opacity]);
|
|
687
687
|
} else if (x) {
|
|
688
|
-
parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m,
|
|
688
|
+
parts.push(preparePathMorph(x.path, collapsedPath(x.path, x.m, ba, bb), sub, x.m, _chunkJBB3GDBBcjs.IDENTITY_MATRIX));
|
|
689
689
|
opacities.push([x.opacity, x.opacity]);
|
|
690
690
|
} else if (y) {
|
|
691
|
-
parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub,
|
|
691
|
+
parts.push(preparePathMorph(collapsedPath(y.path, y.m, bb, ba), y.path, sub, _chunkJBB3GDBBcjs.IDENTITY_MATRIX, y.m));
|
|
692
692
|
opacities.push([y.opacity, y.opacity]);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
@@ -2,10 +2,11 @@ import {
|
|
|
2
2
|
EDITOR_STICKERS_ID,
|
|
3
3
|
STAMP_KINDS,
|
|
4
4
|
checkStickerVariant,
|
|
5
|
+
providerCollections,
|
|
5
6
|
stampCoverage,
|
|
6
7
|
stickerPage,
|
|
7
8
|
stickerRefOf
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JL6YH5WD.js";
|
|
9
10
|
import {
|
|
10
11
|
StickerError
|
|
11
12
|
} from "./chunk-SZTI6EER.js";
|
|
@@ -258,7 +259,7 @@ var StickerBrowser = class {
|
|
|
258
259
|
this.set({ loading: true, error: null, items: [], total: 0, hasMore: false, provider: p.name });
|
|
259
260
|
try {
|
|
260
261
|
const categories = await p.categories?.() ?? [];
|
|
261
|
-
const collections = await p
|
|
262
|
+
const collections = await providerCollections(p) ?? [];
|
|
262
263
|
if (run !== this.run) return;
|
|
263
264
|
this.set({ categories, collections, ...this.s.collection && !collections.some((c) => c.id === this.s.collection) ? { collection: "" } : {} });
|
|
264
265
|
await this.page(run, p, true);
|