@pixerate/editor 0.262.1 → 0.264.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/animation-editor/index.cjs +60 -60
- package/dist/animation-editor/index.js +4 -4
- package/dist/brushes/index.cjs +158 -71
- package/dist/brushes/index.d.cts +3 -3
- package/dist/brushes/index.d.ts +3 -3
- package/dist/brushes/index.js +113 -26
- package/dist/brushes/library.d.cts +2 -0
- package/dist/brushes/library.d.ts +2 -0
- package/dist/brushes/profiles.d.cts +21 -2
- package/dist/brushes/profiles.d.ts +21 -2
- package/dist/brushes/ui.d.cts +57 -4
- package/dist/brushes/ui.d.ts +57 -4
- package/dist/{brushstrokeRender-25Q5BEY6.js → brushstrokeRender-3MOI7PH4.js} +3 -3
- package/dist/{brushstrokeRender-N6UPZSQS.cjs → brushstrokeRender-SMMPIJF2.cjs} +13 -13
- package/dist/canvas/index.cjs +15 -14
- package/dist/canvas/index.js +3 -2
- package/dist/canvas/stickers.d.cts +5 -1
- package/dist/canvas/stickers.d.ts +5 -1
- package/dist/{chunk-X2EXYY4J.js → chunk-4OJC4MCD.js} +9 -8
- package/dist/{chunk-J5UQHWVL.js → chunk-6JL2D5SG.js} +27 -15
- package/dist/{chunk-APX63ILU.js → chunk-ACFSFUQH.js} +31 -0
- package/dist/{chunk-TZOX7KWV.cjs → chunk-BY5EBP26.cjs} +35 -14
- package/dist/{chunk-CQVTGBQI.js → chunk-CECCP2V7.js} +1 -1
- package/dist/{chunk-F7CPSRLN.js → chunk-DOZ6F2K2.js} +12 -4
- package/dist/{chunk-5IW65VQ6.js → chunk-EE7SAYBF.js} +24 -3
- package/dist/{chunk-PYTJBVW5.cjs → chunk-F3KKR6DD.cjs} +37 -36
- package/dist/{chunk-YLUIFXSL.cjs → chunk-FQC5TDB6.cjs} +35 -35
- package/dist/{chunk-UVZ7RQOE.cjs → chunk-G5ADO47G.cjs} +1 -1
- package/dist/{chunk-D4TE5JNW.js → chunk-HAUDEVMC.js} +1 -1
- package/dist/{chunk-EHALWBBD.js → chunk-JEML4FSA.js} +1 -1
- package/dist/{chunk-43NT242D.cjs → chunk-KXNZNOEF.cjs} +86 -86
- package/dist/{chunk-JSDND7DF.cjs → chunk-OTN6VB5S.cjs} +32 -1
- package/dist/{chunk-AVTPZO4Z.cjs → chunk-PE6YJMQT.cjs} +37 -25
- package/dist/{chunk-QAR2N7HZ.js → chunk-ROBSFJ6F.js} +1 -1
- package/dist/{chunk-7AUQ2UJ3.cjs → chunk-USJX5SW4.cjs} +10 -10
- package/dist/{chunk-3TQW5MPW.cjs → chunk-V7MJ4HIN.cjs} +23 -23
- package/dist/{chunk-6NZL24W4.js → chunk-WWI6FLH2.js} +1 -1
- package/dist/{chunk-RVGP2XLF.cjs → chunk-XORJ7UZO.cjs} +21 -13
- package/dist/image-editor/controller.d.cts +3 -0
- package/dist/image-editor/controller.d.ts +3 -0
- package/dist/image-editor/index.cjs +792 -788
- package/dist/image-editor/index.js +10 -6
- package/dist/image-editor/stickers.d.cts +7 -2
- package/dist/image-editor/stickers.d.ts +7 -2
- package/dist/image-editor/types.d.cts +7 -0
- package/dist/image-editor/types.d.ts +7 -0
- package/dist/paint-editor/brush-library-tools.d.cts +8 -1
- package/dist/paint-editor/brush-library-tools.d.ts +8 -1
- package/dist/paint-editor/controller.d.cts +7 -2
- package/dist/paint-editor/controller.d.ts +7 -2
- package/dist/paint-editor/index.cjs +581 -524
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +105 -48
- package/dist/paint-editor/sticker-art.d.cts +20 -10
- package/dist/paint-editor/sticker-art.d.ts +20 -10
- package/dist/paint-editor/stickers.d.cts +8 -1
- package/dist/paint-editor/stickers.d.ts +8 -1
- package/dist/paint-editor/stroke.d.cts +2 -0
- package/dist/paint-editor/stroke.d.ts +2 -0
- package/dist/stickers/browser.d.cts +10 -3
- package/dist/stickers/browser.d.ts +10 -3
- package/dist/stickers/combine.d.cts +2 -0
- package/dist/stickers/combine.d.ts +2 -0
- package/dist/stickers/conformance.d.cts +1 -1
- package/dist/stickers/conformance.d.ts +1 -1
- package/dist/stickers/errors.d.cts +1 -1
- package/dist/stickers/errors.d.ts +1 -1
- package/dist/stickers/fake.d.cts +4 -2
- package/dist/stickers/fake.d.ts +4 -2
- package/dist/stickers/helpers.d.cts +16 -2
- package/dist/stickers/helpers.d.ts +16 -2
- package/dist/stickers/index.cjs +116 -29
- package/dist/stickers/index.js +106 -19
- package/dist/stickers/tools.d.cts +9 -2
- package/dist/stickers/tools.d.ts +9 -2
- package/dist/stickers/types.d.cts +32 -5
- package/dist/stickers/types.d.ts +32 -5
- package/dist/vector/controller.d.cts +13 -0
- package/dist/vector/controller.d.ts +13 -0
- package/dist/vector/index.cjs +1218 -1207
- package/dist/vector/index.js +19 -8
- package/dist/vector/stickers.d.cts +7 -2
- package/dist/vector/stickers.d.ts +7 -2
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +11 -3
- package/skills/pixerate-brushes-design/SKILL.md +1 -0
- package/skills/pixerate-stickers/SKILL.md +20 -9
- package/skills/pixerate-vector/SKILL.md +1 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
parseOpenTypeFont,
|
|
9
9
|
removeAnchorsKeepingShape,
|
|
10
10
|
traceField
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-CECCP2V7.js";
|
|
12
12
|
import {
|
|
13
13
|
ADJUSTMENT_KEYS,
|
|
14
14
|
ADJUSTMENT_KINDS,
|
|
@@ -410,7 +410,7 @@ import {
|
|
|
410
410
|
writePsd,
|
|
411
411
|
xyToTempTint,
|
|
412
412
|
xyToUv
|
|
413
|
-
} from "../chunk-
|
|
413
|
+
} from "../chunk-HAUDEVMC.js";
|
|
414
414
|
import {
|
|
415
415
|
ColorGmm,
|
|
416
416
|
DEFAULT_REFINE_EDGE_PARAMS,
|
|
@@ -770,15 +770,15 @@ import {
|
|
|
770
770
|
warpMeshParamAt,
|
|
771
771
|
warpMeshRows,
|
|
772
772
|
warpPresetMesh
|
|
773
|
-
} from "../chunk-
|
|
773
|
+
} from "../chunk-WWI6FLH2.js";
|
|
774
774
|
import {
|
|
775
775
|
IMAGE_PROFILE,
|
|
776
776
|
checkBrush,
|
|
777
777
|
closest,
|
|
778
778
|
createBrushLibrary,
|
|
779
779
|
resolveBrush
|
|
780
|
-
} from "../chunk-
|
|
781
|
-
import "../chunk-
|
|
780
|
+
} from "../chunk-EE7SAYBF.js";
|
|
781
|
+
import "../chunk-ACFSFUQH.js";
|
|
782
782
|
import "../chunk-M6DNZNVY.js";
|
|
783
783
|
import {
|
|
784
784
|
bezierPathToSvg,
|
|
@@ -5993,6 +5993,7 @@ var ImageEditorController = class {
|
|
|
5993
5993
|
effectRefresh = "none";
|
|
5994
5994
|
constructor(options = {}) {
|
|
5995
5995
|
this.brushLibrary = options.brushLibrary ?? createBrushLibrary();
|
|
5996
|
+
this.brushPreview = options.brushPreview ?? null;
|
|
5996
5997
|
this.effects.subscribe(() => this.queueEffectRefresh("all"));
|
|
5997
5998
|
this.effectsEngine.subscribe(() => this.queueEffectRefresh("incomplete"));
|
|
5998
5999
|
if (options.effects) this.effects.set(options.effects);
|
|
@@ -8773,6 +8774,8 @@ var ImageEditorController = class {
|
|
|
8773
8774
|
// --- Painting ---
|
|
8774
8775
|
/** The brush library the brush presets come from (shared with other editors when the host passes one). */
|
|
8775
8776
|
brushLibrary;
|
|
8777
|
+
/** The `brushPreview` option: draws the brush editor's preview stroke, or `null`. */
|
|
8778
|
+
brushPreview;
|
|
8776
8779
|
/** The brushes this editor can paint with (`IMAGE_PROFILE`): built-in presets, then saved brushes. */
|
|
8777
8780
|
async listBrushPresets() {
|
|
8778
8781
|
return this.brushLibrary.list({ profile: IMAGE_PROFILE });
|
|
@@ -21482,10 +21485,11 @@ var ContentAwareFillSession = class _ContentAwareFillSession {
|
|
|
21482
21485
|
};
|
|
21483
21486
|
|
|
21484
21487
|
// src/image-editor/stickers.ts
|
|
21485
|
-
function createImageStickerHost(controller) {
|
|
21488
|
+
function createImageStickerHost(controller, options = {}) {
|
|
21486
21489
|
return {
|
|
21487
21490
|
noun: "pixel layer",
|
|
21488
21491
|
format: "png",
|
|
21492
|
+
...options.dark ? { dark: options.dark } : {},
|
|
21489
21493
|
defaultCentre: () => {
|
|
21490
21494
|
const { width, height } = controller.getCanvasSize();
|
|
21491
21495
|
return { x: width / 2, y: height / 2 };
|
|
@@ -5,5 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { StickerInsertHost } from '../stickers/tools.cjs';
|
|
7
7
|
import type { ImageEditorController } from './controller.cjs';
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* `insert_sticker` for an image editor: a new pixel layer named after the sticker, one undo step.
|
|
10
|
+
* With `dark` (the host's dark theme or picture), stickers that have a dark variant use it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createImageStickerHost(controller: ImageEditorController, options?: {
|
|
13
|
+
dark?: () => boolean;
|
|
14
|
+
}): StickerInsertHost;
|
|
@@ -5,5 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { StickerInsertHost } from '../stickers/tools.js';
|
|
7
7
|
import type { ImageEditorController } from './controller.js';
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* `insert_sticker` for an image editor: a new pixel layer named after the sticker, one undo step.
|
|
10
|
+
* With `dark` (the host's dark theme or picture), stickers that have a dark variant use it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createImageStickerHost(controller: ImageEditorController, options?: {
|
|
13
|
+
dark?: () => boolean;
|
|
14
|
+
}): StickerInsertHost;
|
|
@@ -10,6 +10,7 @@ import type { SerializedLayeredImageEditorState } from './layers/serialize.cjs';
|
|
|
10
10
|
import type { PaintOptions } from './controller.cjs';
|
|
11
11
|
import type { TextShaper } from './layers/text.cjs';
|
|
12
12
|
import type { BrushLibrary } from '../brushes/library.cjs';
|
|
13
|
+
import type { BrushPreviewRenderer } from '../brushes/tools.cjs';
|
|
13
14
|
export interface ImageDimensions {
|
|
14
15
|
width: number;
|
|
15
16
|
height: number;
|
|
@@ -459,6 +460,12 @@ export interface ImageEditorOptions {
|
|
|
459
460
|
* paints here (default: a library in memory).
|
|
460
461
|
*/
|
|
461
462
|
brushLibrary?: BrushLibrary;
|
|
463
|
+
/**
|
|
464
|
+
* Draws a brush's preview stroke for the brush editor ("Edit brush…"), e.g. the paint engine's
|
|
465
|
+
* `paintBrushPreviewRenderer()` from `@pixerate/editor/paint-editor` (not bundled here, so the
|
|
466
|
+
* image editor stays free of the paint editor). Without it the brush editor has no preview.
|
|
467
|
+
*/
|
|
468
|
+
brushPreview?: BrushPreviewRenderer;
|
|
462
469
|
/**
|
|
463
470
|
* What lays out and draws type layers. Default: the browser's fonts through Canvas 2D
|
|
464
471
|
* (`createCanvasTextShaper`) where there is a 2D canvas; `null` (or no canvas) keeps type layers'
|
|
@@ -10,6 +10,7 @@ import type { SerializedLayeredImageEditorState } from './layers/serialize.js';
|
|
|
10
10
|
import type { PaintOptions } from './controller.js';
|
|
11
11
|
import type { TextShaper } from './layers/text.js';
|
|
12
12
|
import type { BrushLibrary } from '../brushes/library.js';
|
|
13
|
+
import type { BrushPreviewRenderer } from '../brushes/tools.js';
|
|
13
14
|
export interface ImageDimensions {
|
|
14
15
|
width: number;
|
|
15
16
|
height: number;
|
|
@@ -459,6 +460,12 @@ export interface ImageEditorOptions {
|
|
|
459
460
|
* paints here (default: a library in memory).
|
|
460
461
|
*/
|
|
461
462
|
brushLibrary?: BrushLibrary;
|
|
463
|
+
/**
|
|
464
|
+
* Draws a brush's preview stroke for the brush editor ("Edit brush…"), e.g. the paint engine's
|
|
465
|
+
* `paintBrushPreviewRenderer()` from `@pixerate/editor/paint-editor` (not bundled here, so the
|
|
466
|
+
* image editor stays free of the paint editor). Without it the brush editor has no preview.
|
|
467
|
+
*/
|
|
468
|
+
brushPreview?: BrushPreviewRenderer;
|
|
462
469
|
/**
|
|
463
470
|
* What lays out and draws type layers. Default: the browser's fonts through Canvas 2D
|
|
464
471
|
* (`createCanvasTextShaper`) where there is a 2D canvas; `null` (or no canvas) keeps type layers'
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
* The shared brush library's agent tools for a paint editor (`createPaintBrushLibraryToolProvider`),
|
|
3
3
|
* with `preview_brush` painted by this editor.
|
|
4
4
|
*/
|
|
5
|
-
import { type BrushLibraryToolProviderOptions } from '../brushes/tools.cjs';
|
|
5
|
+
import { type BrushLibraryToolProviderOptions, type BrushPreviewRenderer } from '../brushes/tools.cjs';
|
|
6
6
|
import type { AgentToolProvider } from '../tools/registry.cjs';
|
|
7
7
|
import type { PaintEditorController } from './controller.cjs';
|
|
8
|
+
import { type PaperSettings } from './paper.cjs';
|
|
8
9
|
export type PaintBrushLibraryToolProviderOptions = Omit<BrushLibraryToolProviderOptions, 'renderPreview'>;
|
|
10
|
+
/**
|
|
11
|
+
* A brush preview renderer (`BrushPreviewRenderer`, as `preview_brush` and `BrushLibraryEditor`
|
|
12
|
+
* take) that paints the test stroke with the paint engine on `paper` (read on every call; default
|
|
13
|
+
* the default paper). Any brush the paint editor renders, so also the image editor's.
|
|
14
|
+
*/
|
|
15
|
+
export declare function paintBrushPreviewRenderer(paper?: () => PaperSettings): BrushPreviewRenderer;
|
|
9
16
|
/**
|
|
10
17
|
* The brush library tools for a paint editor (`@pixerate/editor/brushes`' provider on the
|
|
11
18
|
* editor's `brushLibrary`, `PAINT_PROFILE`), with `preview_brush` painting the test stroke on the
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
* The shared brush library's agent tools for a paint editor (`createPaintBrushLibraryToolProvider`),
|
|
3
3
|
* with `preview_brush` painted by this editor.
|
|
4
4
|
*/
|
|
5
|
-
import { type BrushLibraryToolProviderOptions } from '../brushes/tools.js';
|
|
5
|
+
import { type BrushLibraryToolProviderOptions, type BrushPreviewRenderer } from '../brushes/tools.js';
|
|
6
6
|
import type { AgentToolProvider } from '../tools/registry.js';
|
|
7
7
|
import type { PaintEditorController } from './controller.js';
|
|
8
|
+
import { type PaperSettings } from './paper.js';
|
|
8
9
|
export type PaintBrushLibraryToolProviderOptions = Omit<BrushLibraryToolProviderOptions, 'renderPreview'>;
|
|
10
|
+
/**
|
|
11
|
+
* A brush preview renderer (`BrushPreviewRenderer`, as `preview_brush` and `BrushLibraryEditor`
|
|
12
|
+
* take) that paints the test stroke with the paint engine on `paper` (read on every call; default
|
|
13
|
+
* the default paper). Any brush the paint editor renders, so also the image editor's.
|
|
14
|
+
*/
|
|
15
|
+
export declare function paintBrushPreviewRenderer(paper?: () => PaperSettings): BrushPreviewRenderer;
|
|
9
16
|
/**
|
|
10
17
|
* The brush library tools for a paint editor (`@pixerate/editor/brushes`' provider on the
|
|
11
18
|
* editor's `brushLibrary`, `PAINT_PROFILE`), with `preview_brush` painting the test stroke on the
|
|
@@ -1289,15 +1289,20 @@ export declare class PaintEditorController {
|
|
|
1289
1289
|
setStickersProvider(provider: StickerProvider | null): void;
|
|
1290
1290
|
/**
|
|
1291
1291
|
* Loads the art of `refs` (provider stickers; editor stamps need none) so sprays and placements
|
|
1292
|
-
* can draw them. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
|
|
1292
|
+
* can draw them: their dark variants when the colour scheme is dark and they have one. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
|
|
1293
1293
|
* ones, or a sticker whose art failed. Emits when art arrives, so views redraw.
|
|
1294
1294
|
*/
|
|
1295
1295
|
prepareStickers(refs: readonly StickerRef[]): Promise<void>;
|
|
1296
|
-
/** Whether a sticker's art is ready to draw: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
|
|
1296
|
+
/** Whether a sticker's art is ready to draw in the variant the colour scheme picks: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
|
|
1297
1297
|
stickerArtStatus(ref: StickerRef): {
|
|
1298
1298
|
status: 'ready' | 'loading' | 'failed' | 'none';
|
|
1299
1299
|
error?: string;
|
|
1300
1300
|
};
|
|
1301
|
+
/**
|
|
1302
|
+
* A sticker whose ref is new (placed or restamped) in the variant the colour scheme picks: `dark`
|
|
1303
|
+
* on a dark scheme when its sticker has one (known once its art was asked for).
|
|
1304
|
+
*/
|
|
1305
|
+
private withStickerVariant;
|
|
1301
1306
|
private readStickerRef;
|
|
1302
1307
|
/** Refuses to redraw stickers whose art has not loaded (they would vanish), naming them and what to call. */
|
|
1303
1308
|
private requireStickerArt;
|
|
@@ -1289,15 +1289,20 @@ export declare class PaintEditorController {
|
|
|
1289
1289
|
setStickersProvider(provider: StickerProvider | null): void;
|
|
1290
1290
|
/**
|
|
1291
1291
|
* Loads the art of `refs` (provider stickers; editor stamps need none) so sprays and placements
|
|
1292
|
-
* can draw them. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
|
|
1292
|
+
* can draw them: their dark variants when the colour scheme is dark and they have one. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
|
|
1293
1293
|
* ones, or a sticker whose art failed. Emits when art arrives, so views redraw.
|
|
1294
1294
|
*/
|
|
1295
1295
|
prepareStickers(refs: readonly StickerRef[]): Promise<void>;
|
|
1296
|
-
/** Whether a sticker's art is ready to draw: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
|
|
1296
|
+
/** Whether a sticker's art is ready to draw in the variant the colour scheme picks: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
|
|
1297
1297
|
stickerArtStatus(ref: StickerRef): {
|
|
1298
1298
|
status: 'ready' | 'loading' | 'failed' | 'none';
|
|
1299
1299
|
error?: string;
|
|
1300
1300
|
};
|
|
1301
|
+
/**
|
|
1302
|
+
* A sticker whose ref is new (placed or restamped) in the variant the colour scheme picks: `dark`
|
|
1303
|
+
* on a dark scheme when its sticker has one (known once its art was asked for).
|
|
1304
|
+
*/
|
|
1305
|
+
private withStickerVariant;
|
|
1301
1306
|
private readStickerRef;
|
|
1302
1307
|
/** Refuses to redraw stickers whose art has not loaded (they would vanish), naming them and what to call. */
|
|
1303
1308
|
private requireStickerArt;
|