@pixerate/editor 0.266.2 → 0.267.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 +172 -105
- package/dist/animation-editor/index.js +91 -24
- package/dist/brushes/index.cjs +59 -59
- package/dist/brushes/index.js +5 -5
- package/dist/brushes/profiles.d.cts +6 -1
- package/dist/brushes/profiles.d.ts +6 -1
- package/dist/{brushstrokeRender-FSUWXUZY.cjs → brushstrokeRender-L7JYRR2R.cjs} +16 -16
- package/dist/{brushstrokeRender-KD453OBX.js → brushstrokeRender-NLFPEBGI.js} +4 -4
- 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-XORJ7UZO.cjs → chunk-3VHH6V67.cjs} +13 -12
- package/dist/{chunk-T2LDTEXK.js → chunk-4IDUYB45.js} +2217 -56
- package/dist/chunk-7UKFXXWL.js +802 -0
- package/dist/chunk-ADMRNWR7.js +340 -0
- package/dist/{chunk-CIJBSUM5.js → chunk-AGNUD5BI.js} +2 -2
- package/dist/{chunk-WLUVZKVD.cjs → chunk-DT4YQUGT.cjs} +32 -32
- package/dist/{chunk-DXYHQ2VN.js → chunk-EF7LZAXQ.js} +1 -1
- package/dist/chunk-EXB2EGBE.cjs +802 -0
- package/dist/{chunk-4ODRXQRW.js → chunk-EYSHTYLG.js} +1 -1
- package/dist/{chunk-R44Y3EFS.js → chunk-FGJHJIMN.js} +8 -336
- package/dist/{chunk-AQZQWXEU.cjs → chunk-G7NHE2VD.cjs} +35 -35
- package/dist/{chunk-XC6DPRYI.js → chunk-GSTSZPSR.js} +154 -949
- package/dist/{chunk-VRK322ZC.cjs → chunk-HIO6E7LC.cjs} +2 -2
- package/dist/{chunk-TOID45I2.cjs → chunk-J2TNIZ55.cjs} +1 -1
- package/dist/{chunk-YHDHFJUC.cjs → chunk-J5VQYK7T.cjs} +217 -1012
- package/dist/{chunk-3C33YTNN.js → chunk-JGWVZPT6.js} +2 -2
- package/dist/{chunk-ACFSFUQH.js → chunk-JL6YH5WD.js} +4 -0
- package/dist/{chunk-3SBLVGOM.cjs → chunk-LA5Y4ETA.cjs} +23 -23
- package/dist/{chunk-MVUQSK5J.cjs → chunk-LHPEG5AU.cjs} +107 -435
- package/dist/{chunk-DOZ6F2K2.js → chunk-NSETJI74.js} +3 -2
- package/dist/{chunk-XRXFVRGY.cjs → chunk-OKHKA43L.cjs} +2364 -203
- package/dist/{chunk-LK4SXL3V.js → chunk-OSEXT7JL.js} +1 -1
- package/dist/{chunk-PE6YJMQT.cjs → chunk-PFHJS4HE.cjs} +20 -19
- package/dist/{chunk-7KNW3WXZ.cjs → chunk-QEVLRLUN.cjs} +63 -0
- package/dist/{chunk-OTN6VB5S.cjs → chunk-RDFHWAHL.cjs} +5 -1
- package/dist/{chunk-6JL2D5SG.js → chunk-VE6UKYQ2.js} +3 -2
- package/dist/{chunk-RFJZGTHA.cjs → chunk-XVOP3CGQ.cjs} +9 -9
- package/dist/{chunk-EZOJBP4D.js → chunk-YIC6MAJ2.js} +1 -1
- 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 +837 -833
- package/dist/image-editor/index.js +105 -101
- package/dist/paint/index.cjs +5 -3
- package/dist/paint/index.js +46 -44
- package/dist/paint-editor/controller.d.cts +5 -3
- package/dist/paint-editor/controller.d.ts +5 -3
- package/dist/paint-editor/index.cjs +832 -2295
- package/dist/paint-editor/index.js +285 -1748
- 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/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 +1846 -1386
- package/dist/vector/index.d.cts +2 -0
- package/dist/vector/index.d.ts +2 -0
- package/dist/vector/index.js +517 -57
- 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 +2 -2
- package/skills/pixerate-brushes-design/SKILL.md +7 -4
- 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 +8 -4
- package/skills/pixerate-paint-editor/references/wet-media.md +9 -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
package/dist/canvas/index.js
CHANGED
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
resolveCanvasBrushSpec,
|
|
47
47
|
validateCanvasBrush,
|
|
48
48
|
validateCanvasBrushPaint
|
|
49
|
-
} from "../chunk-
|
|
49
|
+
} from "../chunk-EF7LZAXQ.js";
|
|
50
50
|
import {
|
|
51
51
|
PATHFINDER_OPERATIONS,
|
|
52
52
|
PlanarMap,
|
|
@@ -8080,6 +8080,8 @@ function createCanvasDrawController(options) {
|
|
|
8080
8080
|
};
|
|
8081
8081
|
let activeStroke = null;
|
|
8082
8082
|
let colorScheme = options.colorScheme === "dark" ? "dark" : "light";
|
|
8083
|
+
let colorLocked = !!options.colorLocked;
|
|
8084
|
+
let brushColour = null;
|
|
8083
8085
|
const erasedInDrag = /* @__PURE__ */ new Map();
|
|
8084
8086
|
let dragStartNodes = null;
|
|
8085
8087
|
function setTool(tool) {
|
|
@@ -8091,11 +8093,16 @@ function createCanvasDrawController(options) {
|
|
|
8091
8093
|
...createDefaultStrokeStyle(tool),
|
|
8092
8094
|
...options.style
|
|
8093
8095
|
};
|
|
8096
|
+
brushColour = null;
|
|
8094
8097
|
options.onStyleChange?.(currentStyle);
|
|
8095
8098
|
}
|
|
8096
8099
|
options.onToolChange?.(tool);
|
|
8097
8100
|
}
|
|
8098
8101
|
function setStyle(style) {
|
|
8102
|
+
if (style.color !== void 0) brushColour = null;
|
|
8103
|
+
applyStyle(style);
|
|
8104
|
+
}
|
|
8105
|
+
function applyStyle(style) {
|
|
8099
8106
|
currentStyle = { ...currentStyle, ...style };
|
|
8100
8107
|
options.onStyleChange?.(currentStyle);
|
|
8101
8108
|
}
|
|
@@ -8312,8 +8319,10 @@ function createCanvasDrawController(options) {
|
|
|
8312
8319
|
/**
|
|
8313
8320
|
* A brush picker's choice: brushes the pen and highlighter with `id` (`null`: a plain vector
|
|
8314
8321
|
* stroke) at the brush's own size, embedding a saved brush, and makes its default colour
|
|
8315
|
-
* (resolved for the colour scheme) the stroke colour unless `keepColour
|
|
8316
|
-
*
|
|
8322
|
+
* (resolved for the colour scheme) the stroke colour unless `keepColour` or the colour is
|
|
8323
|
+
* locked (`setColorLocked`). A light / dark default resolves again when the scheme changes,
|
|
8324
|
+
* until another colour is set. Throws for a brush the canvas can't paint. Resolves with the
|
|
8325
|
+
* brush chosen.
|
|
8317
8326
|
*/
|
|
8318
8327
|
async selectBrush(id, choice = {}) {
|
|
8319
8328
|
if (id === null) {
|
|
@@ -8325,13 +8334,43 @@ function createCanvasDrawController(options) {
|
|
|
8325
8334
|
await validateCanvasBrush(id);
|
|
8326
8335
|
throw new Error(`Brush '${id}' is not one the canvas can paint; listBrushes lists them.`);
|
|
8327
8336
|
}
|
|
8328
|
-
const hex = !choice.keepColour && preset.defaultColor !== void 0 ? brushColourHex(preset.defaultColor, colorScheme) : null;
|
|
8329
|
-
|
|
8337
|
+
const hex = !choice.keepColour && !colorLocked && preset.defaultColor !== void 0 ? brushColourHex(preset.defaultColor, colorScheme) : null;
|
|
8338
|
+
if (hex) brushColour = preset.defaultColor ?? null;
|
|
8339
|
+
applyStyle({ brush: id, brushSize: preset.size, brushSpec: preset.spec, ...hex ? { color: hex } : {} });
|
|
8330
8340
|
return preset;
|
|
8331
8341
|
},
|
|
8332
|
-
|
|
8342
|
+
get colorScheme() {
|
|
8343
|
+
return colorScheme;
|
|
8344
|
+
},
|
|
8345
|
+
/**
|
|
8346
|
+
* The host's colour scheme, for brushes' light / dark default colours: a stroke colour that
|
|
8347
|
+
* came from one (`selectBrush`) resolves to the new side. Strokes already drawn keep theirs.
|
|
8348
|
+
*/
|
|
8333
8349
|
setColorScheme(scheme) {
|
|
8334
|
-
|
|
8350
|
+
const next = scheme === "dark" ? "dark" : "light";
|
|
8351
|
+
if (next === colorScheme) return;
|
|
8352
|
+
colorScheme = next;
|
|
8353
|
+
const hex = brushColour ? brushColourHex(brushColour, next) : null;
|
|
8354
|
+
if (hex && hex !== currentStyle.color) applyStyle({ color: hex });
|
|
8355
|
+
},
|
|
8356
|
+
get colorLocked() {
|
|
8357
|
+
return colorLocked;
|
|
8358
|
+
},
|
|
8359
|
+
/** Locks the stroke colour ("Keep my colour"): choosing a brush with a default colour keeps it. */
|
|
8360
|
+
setColorLocked(locked) {
|
|
8361
|
+
if (colorLocked === !!locked) return;
|
|
8362
|
+
colorLocked = !!locked;
|
|
8363
|
+
options.onColorLockChange?.(colorLocked);
|
|
8364
|
+
},
|
|
8365
|
+
/** What the brush picker is set to: the brush, colour, scheme and lock (a snapshot). */
|
|
8366
|
+
brushSettings() {
|
|
8367
|
+
return {
|
|
8368
|
+
brush: typeof currentStyle.brush === "string" ? currentStyle.brush : null,
|
|
8369
|
+
color: typeof currentStyle.color === "string" ? currentStyle.color : null,
|
|
8370
|
+
colorScheme,
|
|
8371
|
+
colorLocked,
|
|
8372
|
+
colorFollowsScheme: brushColour !== null && typeof brushColour === "object"
|
|
8373
|
+
};
|
|
8335
8374
|
},
|
|
8336
8375
|
/** The saved brush to embed for a brush id (undefined for presets and tip settings); for a brush picker. */
|
|
8337
8376
|
brushSpec: (brush) => resolveCanvasBrushSpec(brush, options.brushLibrary)
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
var _chunkRDFHWAHLcjs = require('./chunk-RDFHWAHL.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
var _chunkU67EN7GGcjs = require('./chunk-U67EN7GG.cjs');
|
|
@@ -33,7 +34,7 @@ var HEX = /^#[0-9a-fA-F]{6}$/;
|
|
|
33
34
|
function stampOutline(kind) {
|
|
34
35
|
const n = GRID;
|
|
35
36
|
const f = new Float32Array((n + 1) * (n + 1));
|
|
36
|
-
for (let j = 0; j <= n; j++) for (let i = 0; i <= n; i++) f[j * (n + 1) + i] =
|
|
37
|
+
for (let j = 0; j <= n; j++) for (let i = 0; i <= n; i++) f[j * (n + 1) + i] = _chunkRDFHWAHLcjs.stampCoverage.call(void 0, kind, i / n * 2 - 1, j / n * 2 - 1, SHAPE_SEED) - 0.5;
|
|
37
38
|
const at = (i, j) => f[j * (n + 1) + i];
|
|
38
39
|
const points = /* @__PURE__ */ new Map();
|
|
39
40
|
const point = (key, i0, j0, i1, j1) => {
|
|
@@ -170,7 +171,7 @@ function stampPixels(kind, size, colour) {
|
|
|
170
171
|
for (let y = 0; y < size; y++) {
|
|
171
172
|
for (let x = 0; x < size; x++) {
|
|
172
173
|
let c = 0;
|
|
173
|
-
for (let sy = 0; sy < ss; sy++) for (let sx = 0; sx < ss; sx++) c +=
|
|
174
|
+
for (let sy = 0; sy < ss; sy++) for (let sx = 0; sx < ss; sx++) c += _chunkRDFHWAHLcjs.stampCoverage.call(void 0, kind, (x + (sx + 0.5) / ss) / size * 2 - 1, (y + (sy + 0.5) / ss) / size * 2 - 1, SHAPE_SEED);
|
|
174
175
|
const a = Math.round(c / (ss * ss) * 255);
|
|
175
176
|
if (!a) continue;
|
|
176
177
|
const i = (y * size + x) * 4;
|
|
@@ -192,25 +193,25 @@ function editorStickers() {
|
|
|
192
193
|
return { id: k, name: m.name, category: m.category, tags: m.tags, description: m.description, width: BOX, height: BOX, thumbnail: thumbs.get(k), formats: ["svg", "png"], licence: { ...LICENCE }, tintable: true };
|
|
193
194
|
};
|
|
194
195
|
const kind = (id) => {
|
|
195
|
-
if (!
|
|
196
|
+
if (!_chunkRDFHWAHLcjs.STAMP_KINDS.includes(id)) throw new (0, _chunkU67EN7GGcjs.StickerError)("unknown_sticker", `The editor has no sticker "${id}"; its stickers are ${_chunkRDFHWAHLcjs.STAMP_KINDS.join(", ")}.`);
|
|
196
197
|
return id;
|
|
197
198
|
};
|
|
198
199
|
return {
|
|
199
|
-
id:
|
|
200
|
+
id: _chunkRDFHWAHLcjs.EDITOR_STICKERS_ID,
|
|
200
201
|
name: "Editor stickers",
|
|
201
202
|
version: "1",
|
|
202
203
|
capabilities: { supportsSearch: true, supportsSvg: true, supportsRaster: true, maxSize: 1024 },
|
|
203
|
-
list: (options) =>
|
|
204
|
-
search: (query, options) =>
|
|
204
|
+
list: (options) => _chunkRDFHWAHLcjs.stickerPage.call(void 0, _chunkRDFHWAHLcjs.STAMP_KINDS.map(summary), options),
|
|
205
|
+
search: (query, options) => _chunkRDFHWAHLcjs.stickerPage.call(void 0, _chunkRDFHWAHLcjs.STAMP_KINDS.map(summary), options, query),
|
|
205
206
|
describe(id) {
|
|
206
|
-
if (!
|
|
207
|
+
if (!_chunkRDFHWAHLcjs.STAMP_KINDS.includes(id)) return void 0;
|
|
207
208
|
const k = id;
|
|
208
209
|
return { ...summary(k), silhouette: outline(k), colours: [META[k].colour] };
|
|
209
210
|
},
|
|
210
|
-
categories: () => [...new Set(
|
|
211
|
+
categories: () => [...new Set(_chunkRDFHWAHLcjs.STAMP_KINDS.map((k) => META[k].category))].map((c) => ({ id: c, name: c[0].toUpperCase() + c.slice(1), count: _chunkRDFHWAHLcjs.STAMP_KINDS.filter((k) => META[k].category === c).length })),
|
|
211
212
|
load(id, options = {}) {
|
|
212
213
|
const k = kind(id);
|
|
213
|
-
|
|
214
|
+
_chunkRDFHWAHLcjs.checkStickerVariant.call(void 0, { id: k }, options.variant);
|
|
214
215
|
const colour = _nullishCoalesce(options.colour, () => ( META[k].colour));
|
|
215
216
|
if (!HEX.test(colour)) throw new (0, _chunkU67EN7GGcjs.StickerError)("invalid_argument", `colour ${JSON.stringify(colour)} must be #rrggbb.`);
|
|
216
217
|
if (options.format === "png") {
|
|
@@ -258,7 +259,7 @@ var StickerBrowser = (_class = 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 _asyncNullishCoalesce(await _optionalChain([p, 'access', _2 => _2.categories, 'optionalCall', _3 => _3()]), async () => ( []));
|
|
261
|
-
const collections = await _asyncNullishCoalesce(await
|
|
262
|
+
const collections = await _asyncNullishCoalesce(await _chunkRDFHWAHLcjs.providerCollections.call(void 0, p), async () => ( []));
|
|
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);
|
|
@@ -298,7 +299,7 @@ var StickerBrowser = (_class = class {
|
|
|
298
299
|
const res = q && p.capabilities.supportsSearch ? await p.search(q, options) : await p.list(options);
|
|
299
300
|
if (run !== this.run) return;
|
|
300
301
|
this.next = res.next;
|
|
301
|
-
const items = res.items.map((s) => ({ ...s, ref:
|
|
302
|
+
const items = res.items.map((s) => ({ ...s, ref: _chunkRDFHWAHLcjs.stickerRefOf.call(void 0, p, s.id) }));
|
|
302
303
|
this.set({ items: first ? items : [...this.s.items, ...items], total: res.total, hasMore: Boolean(res.next), loading: false });
|
|
303
304
|
}
|
|
304
305
|
}, _class);
|