@pixerate/editor 0.252.0 → 0.254.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 +53 -53
- package/dist/animation-editor/index.js +2 -2
- package/dist/brushes/index.cjs +229 -2014
- package/dist/brushes/index.d.cts +5 -1
- package/dist/brushes/index.d.ts +5 -1
- package/dist/brushes/index.js +236 -2021
- package/dist/brushes/patch.d.cts +23 -0
- package/dist/brushes/patch.d.ts +23 -0
- package/dist/brushes/ui.d.cts +105 -0
- package/dist/brushes/ui.d.ts +105 -0
- package/dist/canvas/index.cjs +7 -7
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-QKXO6JPP.cjs → chunk-2OQGPEHH.cjs} +14 -14
- package/dist/chunk-34KLWUH4.cjs +2284 -0
- package/dist/{chunk-Z3BRH4JK.cjs → chunk-557BDWKO.cjs} +6 -6
- package/dist/{chunk-ZBCT5MEA.cjs → chunk-CBVNCWJM.cjs} +7 -7
- package/dist/{chunk-226QDRO3.js → chunk-DHQPRKXF.js} +1 -1
- package/dist/{chunk-ABL7IWFZ.js → chunk-GBEF2D4P.js} +1 -1
- package/dist/{chunk-ISIO63Q5.cjs → chunk-L2JTLW6B.cjs} +150 -25
- package/dist/{chunk-JA57JIT5.js → chunk-MV7CYFMJ.js} +133 -8
- package/dist/{chunk-5E2Q7ZHI.js → chunk-MWUZCEFT.js} +1 -1
- package/dist/chunk-QPHNVZHO.js +2284 -0
- package/dist/effects/conformance.d.cts +1 -0
- package/dist/effects/conformance.d.ts +1 -0
- package/dist/effects/fake.d.cts +7 -1
- package/dist/effects/fake.d.ts +7 -1
- package/dist/effects/helpers.d.cts +36 -4
- package/dist/effects/helpers.d.ts +36 -4
- package/dist/effects/index.cjs +331 -102
- package/dist/effects/index.js +238 -9
- package/dist/effects/types.d.cts +84 -5
- package/dist/effects/types.d.ts +84 -5
- package/dist/image-editor/index.cjs +15 -15
- package/dist/image-editor/index.js +1 -1
- package/dist/paint-editor/brush-controls.d.cts +57 -0
- package/dist/paint-editor/brush-controls.d.ts +57 -0
- package/dist/paint-editor/brush-library-tools.d.cts +15 -0
- package/dist/paint-editor/brush-library-tools.d.ts +15 -0
- package/dist/paint-editor/brush-library.d.cts +29 -0
- package/dist/paint-editor/brush-library.d.ts +29 -0
- package/dist/paint-editor/controller.d.cts +76 -17
- package/dist/paint-editor/controller.d.ts +76 -17
- package/dist/paint-editor/index.cjs +543 -858
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +329 -644
- package/dist/paint-editor/serialize.d.cts +7 -4
- package/dist/paint-editor/serialize.d.ts +7 -4
- package/dist/paint-editor/sticker-tools.d.cts +1 -1
- package/dist/paint-editor/sticker-tools.d.ts +1 -1
- package/dist/paint-editor/strokes.d.cts +10 -1
- package/dist/paint-editor/strokes.d.ts +10 -1
- package/dist/paint-editor/tools.d.cts +1 -1
- package/dist/paint-editor/tools.d.ts +1 -1
- package/dist/paint-editor/ui.d.cts +3 -51
- package/dist/paint-editor/ui.d.ts +3 -51
- package/dist/paint-editor/wet-tools.d.cts +1 -1
- package/dist/paint-editor/wet-tools.d.ts +1 -1
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +344 -344
- package/dist/video-editor/index.js +4 -4
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +5 -3
- package/skills/pixerate-paint-editor/SKILL.md +26 -24
- package/skills/pixerate-paint-editor/references/brush-facets.md +30 -0
- package/skills/pixerate-paint-editor/references/gradient-paint.md +1 -1
- package/skills/pixerate-paint-editor/references/light-paint.md +2 -2
- package/skills/pixerate-paint-editor/references/oils.md +1 -1
- package/skills/pixerate-paint-editor/references/particle-brushes.md +8 -5
- package/skills/pixerate-paint-oil-impasto/SKILL.md +1 -1
- package/skills/pixerate-stickers/SKILL.md +1 -1
- package/skills/pixerate-video-editor/SKILL.md +1 -1
|
@@ -18,7 +18,10 @@ import { type LayerLocks } from '../raster/layers.js';
|
|
|
18
18
|
import { type LayerEffect, type LayerEffectKind, type LayerEffects } from '../raster/effects/model.js';
|
|
19
19
|
import type { EffectPattern } from '../raster/effects/patterns.js';
|
|
20
20
|
import { TiledSurface, type RasterRect, type Tile } from '../raster/surface.js';
|
|
21
|
-
import { type PaintBrushInput, type
|
|
21
|
+
import { type PaintBrushInput, type PaintBrush } from './brushes.js';
|
|
22
|
+
import { type BrushLibrary, type BrushLibraryFile } from '../brushes/library.js';
|
|
23
|
+
import { type BrushPatch, type UnsettableBrushFacet } from '../brushes/patch.js';
|
|
24
|
+
import type { Brush } from '../brushes/types.js';
|
|
22
25
|
import { type PaintCanvas, type PaintDocumentState, type PaintLayer } from './document.js';
|
|
23
26
|
import { type ImageEncoder, type ImageFormat } from './encode.js';
|
|
24
27
|
import type { PenPoint } from './engine.js';
|
|
@@ -57,7 +60,12 @@ export interface PaintEditorOptions extends Partial<PaintCanvas> {
|
|
|
57
60
|
paper?: Partial<PaperSettings> | string;
|
|
58
61
|
/** Active brush id (default `pencil-6b`). */
|
|
59
62
|
brushId?: string;
|
|
60
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* The brush library: built-in presets plus saved brushes, on any storage. Pass one library to
|
|
65
|
+
* every editor so a brush saved in one shows in all of them (default: a library in memory).
|
|
66
|
+
*/
|
|
67
|
+
brushLibrary?: BrushLibrary;
|
|
68
|
+
/** Saved user brushes to start the default library with (or to add to `brushLibrary`). */
|
|
61
69
|
brushes?: readonly PaintBrush[];
|
|
62
70
|
/** Paint colour #rrggbb (default #1f2937). */
|
|
63
71
|
color?: string;
|
|
@@ -296,8 +304,17 @@ export declare class PaintEditorController {
|
|
|
296
304
|
private undoStack;
|
|
297
305
|
private redoStack;
|
|
298
306
|
private readonly historyLimit;
|
|
307
|
+
/** The brush library this editor lists, saves into and paints from (shared with other editors when the host passes one). */
|
|
308
|
+
readonly brushLibrary: BrushLibrary;
|
|
299
309
|
private brush;
|
|
300
|
-
|
|
310
|
+
/** The active brush as facets (what `getBrushSpec` and saving use). */
|
|
311
|
+
private brushSpec;
|
|
312
|
+
/** The library's brushes as last read, each as stored (facets) and as the engine paints it. */
|
|
313
|
+
private brushEntries;
|
|
314
|
+
/** The brush id asked for at construction, while the library had not listed it yet. */
|
|
315
|
+
private pendingBrushId;
|
|
316
|
+
private brushesLoaded;
|
|
317
|
+
private readonly unsubscribeLibrary;
|
|
301
318
|
/** The library list in the state (the same array until the user brushes change, so thumbnails are not redrawn). */
|
|
302
319
|
private library;
|
|
303
320
|
private color;
|
|
@@ -673,39 +690,81 @@ export declare class PaintEditorController {
|
|
|
673
690
|
source: PaintEffectSource;
|
|
674
691
|
amount: number;
|
|
675
692
|
}>;
|
|
693
|
+
private findEntry;
|
|
676
694
|
private findBrush;
|
|
677
|
-
|
|
678
|
-
getBrush(id: string): PaintBrush | undefined;
|
|
695
|
+
private requireEntry;
|
|
679
696
|
private requireBrush;
|
|
697
|
+
/** Reads the library again (after a change anywhere it is shared). */
|
|
698
|
+
private refreshBrushes;
|
|
699
|
+
/** Resolves once the brush library has been read (user brushes kept in storage are listed from then on). */
|
|
700
|
+
whenBrushesLoaded(): Promise<void>;
|
|
701
|
+
/** A library brush by id, as the engine paints it (`undefined` when unknown). */
|
|
702
|
+
getBrush(id: string): PaintBrush | undefined;
|
|
703
|
+
/** A library brush by id as stored (its facets), or without an id the active brush as edited. */
|
|
704
|
+
getBrushSpec(id?: string): Brush | undefined;
|
|
680
705
|
/**
|
|
681
|
-
* Chooses the active brush (`id`: a library brush) and / or changes its settings. Editor
|
|
682
|
-
* not an undo step. Returns the active brush.
|
|
706
|
+
* Chooses the active brush (`id`: a library brush) and / or changes its engine settings. Editor
|
|
707
|
+
* state, not an undo step. Returns the active brush. `setBrushFacets` changes it by facets.
|
|
683
708
|
*/
|
|
684
709
|
setBrush(update?: {
|
|
685
710
|
id?: string;
|
|
686
711
|
} & Omit<PaintBrushInput, 'id'>): PaintBrush;
|
|
687
|
-
/**
|
|
712
|
+
/**
|
|
713
|
+
* Chooses the active brush (`id`: a library brush) and / or lays a facet patch over it (objects
|
|
714
|
+
* merge, lists and values replace, as the library's `update_brush` does). Editor state, not an
|
|
715
|
+
* undo step. `unset` removes whole facets first. Returns the active brush as the engine paints
|
|
716
|
+
* it, its facets, and what was clamped or dropped.
|
|
717
|
+
*/
|
|
718
|
+
setBrushFacets(patch?: BrushPatch, id?: string, unset?: readonly UnsettableBrushFacet[]): {
|
|
719
|
+
brush: PaintBrush;
|
|
720
|
+
spec: Brush;
|
|
721
|
+
problems: string[];
|
|
722
|
+
};
|
|
723
|
+
/**
|
|
724
|
+
* Makes `spec` (a whole facet brush, as the brush editor edits it) the active brush, keeping the
|
|
725
|
+
* active brush's id. Editor state, not an undo step. Returns it as the engine paints it, its
|
|
726
|
+
* facets, and what was clamped or dropped.
|
|
727
|
+
*/
|
|
728
|
+
setBrushSpec(spec: Brush): {
|
|
729
|
+
brush: PaintBrush;
|
|
730
|
+
spec: Brush;
|
|
731
|
+
problems: string[];
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* The engine settings a facet patch changes on a brush (`from`: a library brush id or a brush as
|
|
735
|
+
* painted; default the active brush), as `paintStroke`'s and `updateStroke`'s `brush` take them.
|
|
736
|
+
*/
|
|
737
|
+
brushChanges(patch: BrushPatch, from?: string | PaintBrush): Omit<PaintBrushInput, 'id'>;
|
|
738
|
+
private readBrushPatch;
|
|
739
|
+
private useBrush;
|
|
740
|
+
/**
|
|
741
|
+
* Saves the active brush (or `brush`, engine settings on top of it) into the brush library under
|
|
742
|
+
* `id` / `name`, replacing a user brush with that id. Built-in ids are refused. Resolves with the
|
|
743
|
+
* saved brush.
|
|
744
|
+
*/
|
|
688
745
|
saveBrush(options: {
|
|
689
746
|
id: string;
|
|
690
747
|
name?: string;
|
|
691
748
|
brush?: PaintBrushInput;
|
|
692
|
-
}): PaintBrush
|
|
693
|
-
|
|
694
|
-
|
|
749
|
+
}): Promise<PaintBrush>;
|
|
750
|
+
/** Removes a user brush from the brush library (built-in brushes can't be removed). */
|
|
751
|
+
removeBrush(id: string): Promise<void>;
|
|
752
|
+
/** The user's saved brushes, as the engine paints them. */
|
|
695
753
|
getUserBrushes(): PaintBrush[];
|
|
696
|
-
/** A brush library file of the given brushes (default: the user's brushes). */
|
|
697
|
-
exportBrushes(ids?: readonly string[]): BrushLibraryFile
|
|
754
|
+
/** A brush library file (version 2) of the given brushes (default: the user's brushes). */
|
|
755
|
+
exportBrushes(ids?: readonly string[]): Promise<BrushLibraryFile>;
|
|
698
756
|
/**
|
|
699
|
-
* Adds the brushes of a library file to the
|
|
700
|
-
* unless `replace` (built-in ids are always skipped).
|
|
757
|
+
* Adds the brushes of a library file (version 1 or 2) to the brush library. A brush whose id is
|
|
758
|
+
* taken is skipped unless `replace` (built-in ids are always skipped). Resolves with the ids
|
|
759
|
+
* added or replaced, the ids skipped and the problems.
|
|
701
760
|
*/
|
|
702
761
|
importBrushes(file: unknown, options?: {
|
|
703
762
|
replace?: boolean;
|
|
704
|
-
}): {
|
|
763
|
+
}): Promise<{
|
|
705
764
|
added: string[];
|
|
706
765
|
skipped: string[];
|
|
707
766
|
problems: string[];
|
|
708
|
-
}
|
|
767
|
+
}>;
|
|
709
768
|
/** A thumbnail of a brush: a test stroke on the current paper. */
|
|
710
769
|
brushThumbnail(id: string, options?: {
|
|
711
770
|
width?: number;
|