@pixerate/editor 0.277.0 → 0.278.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/paint-editor/controller.d.cts +40 -8
- package/dist/paint-editor/controller.d.ts +40 -8
- package/dist/paint-editor/index.cjs +473 -254
- package/dist/paint-editor/index.js +265 -46
- package/dist/paint-editor/serialize.d.cts +3 -1
- package/dist/paint-editor/serialize.d.ts +3 -1
- package/dist/paint-editor/stroke.d.cts +3 -0
- package/dist/paint-editor/stroke.d.ts +3 -0
- package/dist/paint-editor/strokes.d.cts +11 -1
- package/dist/paint-editor/strokes.d.ts +11 -1
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +2 -2
|
@@ -23,7 +23,7 @@ import { type PaintBrushInput, type PaintBrush } from './brushes.cjs';
|
|
|
23
23
|
import { type BrushLibrary, type BrushLibraryFile } from '../brushes/library.cjs';
|
|
24
24
|
import { type BrushPatch, type UnsettableBrushFacet } from '../brushes/patch.cjs';
|
|
25
25
|
import type { Brush } from '../brushes/types.cjs';
|
|
26
|
-
import type
|
|
26
|
+
import { type ColorScheme, type ColorValue } from '../color/dual.cjs';
|
|
27
27
|
import { type PaintCanvas, type PaintDocumentState, type PaintLayer } from './document.cjs';
|
|
28
28
|
import { type ImageEncoder, type ImageFormat } from './encode.cjs';
|
|
29
29
|
import type { PenPoint } from './engine.cjs';
|
|
@@ -206,8 +206,8 @@ export interface LiveStrokeUpdate {
|
|
|
206
206
|
brushId?: string;
|
|
207
207
|
/** Brush settings to change (as `setBrush` takes), on top of `brushId` or the stroke's brush. */
|
|
208
208
|
brush?: Omit<PaintBrushInput, 'id'>;
|
|
209
|
-
/** A new colour #rrggbb (replaces gradient or effect paint). */
|
|
210
|
-
color?:
|
|
209
|
+
/** A new colour #rrggbb, or a light / dark pair (replaces gradient or effect paint). */
|
|
210
|
+
color?: ColorValue;
|
|
211
211
|
/** Paint: a colour, gradient paint or effect paint; `null` back to the plain colour. */
|
|
212
212
|
paint?: unknown;
|
|
213
213
|
/** Another jitter seed (particles, scatter and texture fall differently). */
|
|
@@ -275,8 +275,12 @@ export interface PaintPreviewPlacement {
|
|
|
275
275
|
export interface PaintStrokeInit {
|
|
276
276
|
/** Default the active layer. */
|
|
277
277
|
layerId?: string;
|
|
278
|
-
/**
|
|
279
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Default the editor colour. A light / dark pair (`DualColor`) is recorded with the stroke
|
|
280
|
+
* (`RecordedStroke.dualColor`): on a stroke layer the document draws its light side and the view
|
|
281
|
+
* the viewer's (`setColorScheme`); on a pixel layer it paints the scheme's side.
|
|
282
|
+
*/
|
|
283
|
+
color?: ColorValue;
|
|
280
284
|
/**
|
|
281
285
|
* What this stroke paints with, instead of the editor's paint: a colour, gradient paint
|
|
282
286
|
* (`@pixerate/editor/paint` `PaintSource`), or effect paint (render it first with
|
|
@@ -1062,9 +1066,29 @@ export declare class PaintEditorController {
|
|
|
1062
1066
|
private brushColour;
|
|
1063
1067
|
/**
|
|
1064
1068
|
* The host's colour scheme: a paint colour that came from a brush's light / dark default
|
|
1065
|
-
* resolves to the new side
|
|
1069
|
+
* resolves to the new side, and stroke layers show their dual-colour strokes in it. Only the
|
|
1070
|
+
* view changes: the document, history and change listeners don't hear of it.
|
|
1066
1071
|
*/
|
|
1067
1072
|
setColorScheme(scheme: ColorScheme): void;
|
|
1073
|
+
/**
|
|
1074
|
+
* Stroke layers in the colour scheme: the document keeps every stroke layer drawn with each
|
|
1075
|
+
* stroke's `color` (a dual-colour stroke's light side), so saved and shared documents never
|
|
1076
|
+
* depend on who is looking. The view (display, image exports, the base a pointer stroke paints
|
|
1077
|
+
* on) draws dual-colour strokes in the scheme's side instead. One cached surface per layer,
|
|
1078
|
+
* brought up to date from the strokes that changed since it was drawn.
|
|
1079
|
+
*/
|
|
1080
|
+
private schemeViews;
|
|
1081
|
+
private schemeCopies;
|
|
1082
|
+
/** Set while a stroke is painted for the document rather than the view (`runStroke` on a stroke layer): dual colours take this side. */
|
|
1083
|
+
private paintScheme;
|
|
1084
|
+
/** A stroke as the scheme shows it: itself, or (a dual-colour stroke) a copy in the scheme's side. */
|
|
1085
|
+
private schemeStroke;
|
|
1086
|
+
/** A stroke layer's surface in the scheme, or `null` when the document's pixels already show it. */
|
|
1087
|
+
private schemeSurface;
|
|
1088
|
+
/** `layers` with each stroke layer that holds dual-colour strokes shown in the scheme. */
|
|
1089
|
+
private schemeLayers;
|
|
1090
|
+
/** The paint colour's light / dark pair for a stroke with `brushId`, when the colour came from one (a brush's own or default colour, or `setColor`). */
|
|
1091
|
+
private dualPaint;
|
|
1068
1092
|
/** Locks the paint colour: choosing a brush with a default colour keeps it. Editor state, not an undo step. */
|
|
1069
1093
|
setColorLocked(locked: boolean): void;
|
|
1070
1094
|
/**
|
|
@@ -1075,8 +1099,12 @@ export declare class PaintEditorController {
|
|
|
1075
1099
|
private takeBrushColour;
|
|
1076
1100
|
/** A brush that always paints its own colour (`colour.own`): that colour, resolved for the scheme now; else `null`. */
|
|
1077
1101
|
private ownColour;
|
|
1078
|
-
/**
|
|
1079
|
-
|
|
1102
|
+
/**
|
|
1103
|
+
* Sets the paint colour (and goes back to one colour from gradient paint). A light / dark pair
|
|
1104
|
+
* paints the colour scheme's side, follows `setColorScheme`, and is recorded with each stroke
|
|
1105
|
+
* painted in it. Returns the colour as #rrggbb.
|
|
1106
|
+
*/
|
|
1107
|
+
setColor(color: ColorValue): string;
|
|
1080
1108
|
/**
|
|
1081
1109
|
* Sets what strokes paint with: one colour (`{ type: 'color', color }` or `#rrggbb`), or gradient
|
|
1082
1110
|
* paint (`{ type: 'gradient', stops, space?, map?, softness? }`, see `@pixerate/editor/paint`),
|
|
@@ -1775,6 +1803,10 @@ export declare class PaintEditorController {
|
|
|
1775
1803
|
liveStrokeArea(id: string): RasterRect | null;
|
|
1776
1804
|
/** Commits a layer's new stroke list with its redrawn pixels, recorded for replays (one undo step). */
|
|
1777
1805
|
private commitLiveStrokes;
|
|
1806
|
+
/**
|
|
1807
|
+
* The document with a layer's strokes set and its pixels redrawn. With `record` false (the same
|
|
1808
|
+
* strokes drawn for the colour scheme) the pixel lock doesn't apply and no event is recorded for replays.
|
|
1809
|
+
*/
|
|
1778
1810
|
private withLiveStrokes;
|
|
1779
1811
|
/** Where a stroke painted (document pixels): as learnt when it was painted or drawn, else an estimate from its points and brush. */
|
|
1780
1812
|
private strokeArea;
|
|
@@ -23,7 +23,7 @@ import { type PaintBrushInput, type PaintBrush } from './brushes.js';
|
|
|
23
23
|
import { type BrushLibrary, type BrushLibraryFile } from '../brushes/library.js';
|
|
24
24
|
import { type BrushPatch, type UnsettableBrushFacet } from '../brushes/patch.js';
|
|
25
25
|
import type { Brush } from '../brushes/types.js';
|
|
26
|
-
import type
|
|
26
|
+
import { type ColorScheme, type ColorValue } from '../color/dual.js';
|
|
27
27
|
import { type PaintCanvas, type PaintDocumentState, type PaintLayer } from './document.js';
|
|
28
28
|
import { type ImageEncoder, type ImageFormat } from './encode.js';
|
|
29
29
|
import type { PenPoint } from './engine.js';
|
|
@@ -206,8 +206,8 @@ export interface LiveStrokeUpdate {
|
|
|
206
206
|
brushId?: string;
|
|
207
207
|
/** Brush settings to change (as `setBrush` takes), on top of `brushId` or the stroke's brush. */
|
|
208
208
|
brush?: Omit<PaintBrushInput, 'id'>;
|
|
209
|
-
/** A new colour #rrggbb (replaces gradient or effect paint). */
|
|
210
|
-
color?:
|
|
209
|
+
/** A new colour #rrggbb, or a light / dark pair (replaces gradient or effect paint). */
|
|
210
|
+
color?: ColorValue;
|
|
211
211
|
/** Paint: a colour, gradient paint or effect paint; `null` back to the plain colour. */
|
|
212
212
|
paint?: unknown;
|
|
213
213
|
/** Another jitter seed (particles, scatter and texture fall differently). */
|
|
@@ -275,8 +275,12 @@ export interface PaintPreviewPlacement {
|
|
|
275
275
|
export interface PaintStrokeInit {
|
|
276
276
|
/** Default the active layer. */
|
|
277
277
|
layerId?: string;
|
|
278
|
-
/**
|
|
279
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Default the editor colour. A light / dark pair (`DualColor`) is recorded with the stroke
|
|
280
|
+
* (`RecordedStroke.dualColor`): on a stroke layer the document draws its light side and the view
|
|
281
|
+
* the viewer's (`setColorScheme`); on a pixel layer it paints the scheme's side.
|
|
282
|
+
*/
|
|
283
|
+
color?: ColorValue;
|
|
280
284
|
/**
|
|
281
285
|
* What this stroke paints with, instead of the editor's paint: a colour, gradient paint
|
|
282
286
|
* (`@pixerate/editor/paint` `PaintSource`), or effect paint (render it first with
|
|
@@ -1062,9 +1066,29 @@ export declare class PaintEditorController {
|
|
|
1062
1066
|
private brushColour;
|
|
1063
1067
|
/**
|
|
1064
1068
|
* The host's colour scheme: a paint colour that came from a brush's light / dark default
|
|
1065
|
-
* resolves to the new side
|
|
1069
|
+
* resolves to the new side, and stroke layers show their dual-colour strokes in it. Only the
|
|
1070
|
+
* view changes: the document, history and change listeners don't hear of it.
|
|
1066
1071
|
*/
|
|
1067
1072
|
setColorScheme(scheme: ColorScheme): void;
|
|
1073
|
+
/**
|
|
1074
|
+
* Stroke layers in the colour scheme: the document keeps every stroke layer drawn with each
|
|
1075
|
+
* stroke's `color` (a dual-colour stroke's light side), so saved and shared documents never
|
|
1076
|
+
* depend on who is looking. The view (display, image exports, the base a pointer stroke paints
|
|
1077
|
+
* on) draws dual-colour strokes in the scheme's side instead. One cached surface per layer,
|
|
1078
|
+
* brought up to date from the strokes that changed since it was drawn.
|
|
1079
|
+
*/
|
|
1080
|
+
private schemeViews;
|
|
1081
|
+
private schemeCopies;
|
|
1082
|
+
/** Set while a stroke is painted for the document rather than the view (`runStroke` on a stroke layer): dual colours take this side. */
|
|
1083
|
+
private paintScheme;
|
|
1084
|
+
/** A stroke as the scheme shows it: itself, or (a dual-colour stroke) a copy in the scheme's side. */
|
|
1085
|
+
private schemeStroke;
|
|
1086
|
+
/** A stroke layer's surface in the scheme, or `null` when the document's pixels already show it. */
|
|
1087
|
+
private schemeSurface;
|
|
1088
|
+
/** `layers` with each stroke layer that holds dual-colour strokes shown in the scheme. */
|
|
1089
|
+
private schemeLayers;
|
|
1090
|
+
/** The paint colour's light / dark pair for a stroke with `brushId`, when the colour came from one (a brush's own or default colour, or `setColor`). */
|
|
1091
|
+
private dualPaint;
|
|
1068
1092
|
/** Locks the paint colour: choosing a brush with a default colour keeps it. Editor state, not an undo step. */
|
|
1069
1093
|
setColorLocked(locked: boolean): void;
|
|
1070
1094
|
/**
|
|
@@ -1075,8 +1099,12 @@ export declare class PaintEditorController {
|
|
|
1075
1099
|
private takeBrushColour;
|
|
1076
1100
|
/** A brush that always paints its own colour (`colour.own`): that colour, resolved for the scheme now; else `null`. */
|
|
1077
1101
|
private ownColour;
|
|
1078
|
-
/**
|
|
1079
|
-
|
|
1102
|
+
/**
|
|
1103
|
+
* Sets the paint colour (and goes back to one colour from gradient paint). A light / dark pair
|
|
1104
|
+
* paints the colour scheme's side, follows `setColorScheme`, and is recorded with each stroke
|
|
1105
|
+
* painted in it. Returns the colour as #rrggbb.
|
|
1106
|
+
*/
|
|
1107
|
+
setColor(color: ColorValue): string;
|
|
1080
1108
|
/**
|
|
1081
1109
|
* Sets what strokes paint with: one colour (`{ type: 'color', color }` or `#rrggbb`), or gradient
|
|
1082
1110
|
* paint (`{ type: 'gradient', stops, space?, map?, softness? }`, see `@pixerate/editor/paint`),
|
|
@@ -1775,6 +1803,10 @@ export declare class PaintEditorController {
|
|
|
1775
1803
|
liveStrokeArea(id: string): RasterRect | null;
|
|
1776
1804
|
/** Commits a layer's new stroke list with its redrawn pixels, recorded for replays (one undo step). */
|
|
1777
1805
|
private commitLiveStrokes;
|
|
1806
|
+
/**
|
|
1807
|
+
* The document with a layer's strokes set and its pixels redrawn. With `record` false (the same
|
|
1808
|
+
* strokes drawn for the colour scheme) the pixel lock doesn't apply and no event is recorded for replays.
|
|
1809
|
+
*/
|
|
1778
1810
|
private withLiveStrokes;
|
|
1779
1811
|
/** Where a stroke painted (document pixels): as learnt when it was painted or drawn, else an estimate from its points and brush. */
|
|
1780
1812
|
private strokeArea;
|