@pixerate/editor 0.275.1 → 0.276.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.
Files changed (65) hide show
  1. package/dist/animation-editor/index.cjs +62 -62
  2. package/dist/animation-editor/index.js +6 -6
  3. package/dist/brushes/index.cjs +81 -70
  4. package/dist/brushes/index.js +17 -6
  5. package/dist/brushes/patch.d.cts +1 -1
  6. package/dist/brushes/patch.d.ts +1 -1
  7. package/dist/brushes/profiles.d.cts +2 -0
  8. package/dist/brushes/profiles.d.ts +2 -0
  9. package/dist/brushes/schema.d.cts +1 -0
  10. package/dist/brushes/schema.d.ts +1 -0
  11. package/dist/brushes/types.d.cts +22 -1
  12. package/dist/brushes/types.d.ts +22 -1
  13. package/dist/{brushstrokeRender-WGY4DZHF.js → brushstrokeRender-FK3ASUUJ.js} +5 -5
  14. package/dist/{brushstrokeRender-2RQL46WB.cjs → brushstrokeRender-I6MYFCOU.cjs} +21 -21
  15. package/dist/canvas/index.cjs +13 -13
  16. package/dist/canvas/index.js +1 -1
  17. package/dist/{chunk-Y2ISSVPH.js → chunk-4EM5NGCL.js} +167 -9
  18. package/dist/{chunk-Y354ETAE.cjs → chunk-5HR5CSLC.cjs} +49 -49
  19. package/dist/{chunk-LMG57L5A.js → chunk-CTHWXW5M.js} +121 -8
  20. package/dist/{chunk-43XJC3PP.js → chunk-CVBTJVRN.js} +1 -1
  21. package/dist/{chunk-RJGW3RQS.js → chunk-GHYJAMMS.js} +1 -1
  22. package/dist/{chunk-NIBFKXMD.cjs → chunk-IFWLZZCW.cjs} +619 -2
  23. package/dist/{chunk-G5TCMKX5.js → chunk-IJ6NSWKM.js} +2 -2
  24. package/dist/{chunk-C6VB7CPY.cjs → chunk-ISCAJBPQ.cjs} +1 -1
  25. package/dist/{chunk-W6JDUXP3.js → chunk-J23JOHPR.js} +1 -1
  26. package/dist/{chunk-IEEY5RJV.js → chunk-JNMNM3SL.js} +1 -1
  27. package/dist/{chunk-HVO6XCI4.js → chunk-JPB65KQ6.js} +1 -1
  28. package/dist/{chunk-ACTHSQOI.js → chunk-LDZOXESA.js} +618 -1
  29. package/dist/{chunk-DHC4E2DU.cjs → chunk-MITQGHN3.cjs} +121 -8
  30. package/dist/{chunk-STLTOISW.cjs → chunk-NPPMKMCU.cjs} +17 -17
  31. package/dist/{chunk-75SYKUOT.js → chunk-OS6OG7DN.js} +1 -1
  32. package/dist/{chunk-OLZXXAER.cjs → chunk-OY24XRYF.cjs} +408 -250
  33. package/dist/{chunk-6QNDGMK7.cjs → chunk-Q33V5PEF.cjs} +123 -42
  34. package/dist/{chunk-JDXWLCXF.cjs → chunk-QNNZA3V5.cjs} +2 -2
  35. package/dist/{chunk-T6KNJVBP.cjs → chunk-U26LUXCJ.cjs} +35 -35
  36. package/dist/{chunk-62MFUHSI.cjs → chunk-UQXULAMQ.cjs} +16 -16
  37. package/dist/{chunk-RAPNRK4R.cjs → chunk-X7XBEX3O.cjs} +88 -88
  38. package/dist/{chunk-MSWLJI4G.js → chunk-XMSH66VU.js} +2 -2
  39. package/dist/{chunk-ZM7IKQ4X.js → chunk-XVPQNX7O.js} +89 -8
  40. package/dist/{chunk-YYZC2EQO.cjs → chunk-ZIE6EJGR.cjs} +23 -23
  41. package/dist/image-editor/index.cjs +880 -852
  42. package/dist/image-editor/index.js +36 -8
  43. package/dist/paint/index.cjs +33 -5
  44. package/dist/paint/index.d.cts +1 -0
  45. package/dist/paint/index.d.ts +1 -0
  46. package/dist/paint/index.js +32 -4
  47. package/dist/paint/live-patterns.d.cts +149 -0
  48. package/dist/paint/live-patterns.d.ts +149 -0
  49. package/dist/paint/wet/world.d.cts +13 -0
  50. package/dist/paint/wet/world.d.ts +13 -0
  51. package/dist/paint-editor/brush-model.d.cts +7 -1
  52. package/dist/paint-editor/brush-model.d.ts +7 -1
  53. package/dist/paint-editor/controller.d.cts +52 -0
  54. package/dist/paint-editor/controller.d.ts +52 -0
  55. package/dist/paint-editor/index.cjs +850 -510
  56. package/dist/paint-editor/index.js +355 -15
  57. package/dist/paint-editor/ui.d.cts +5 -1
  58. package/dist/paint-editor/ui.d.ts +5 -1
  59. package/dist/paint-editor/wet-tools.d.cts +42 -0
  60. package/dist/paint-editor/wet-tools.d.ts +42 -0
  61. package/dist/paint-editor/wet.d.cts +22 -1
  62. package/dist/paint-editor/wet.d.ts +22 -1
  63. package/dist/vector/index.cjs +1002 -1002
  64. package/dist/vector/index.js +7 -7
  65. package/package.json +1 -1
@@ -63,4 +63,46 @@ export declare const WET_PARAM_SCHEMA: {
63
63
  readonly description: string;
64
64
  };
65
65
  };
66
+ export declare const LIVE_PATTERN_SCHEMA: {
67
+ readonly pattern: {
68
+ readonly type: "string";
69
+ readonly enum: readonly ["spots", "stripes", "coral", "maze", "worms"];
70
+ readonly description: "Pearson Gray-Scott preset: spots, stripes, coral, maze or worms (default spots). Sets feed and kill unless explicit feed/kill are also passed.";
71
+ };
72
+ readonly feed: {
73
+ readonly type: "number";
74
+ readonly minimum: 0.005;
75
+ readonly maximum: 0.1;
76
+ readonly description: "Gray-Scott feed rate F, 0.005..0.1 (default: the pattern preset’s feed rate).";
77
+ };
78
+ readonly kill: {
79
+ readonly type: "number";
80
+ readonly minimum: 0.02;
81
+ readonly maximum: 0.08;
82
+ readonly description: "Gray-Scott kill rate k, 0.02..0.08 (default: the pattern preset’s kill rate).";
83
+ };
84
+ readonly scale: {
85
+ readonly type: "number";
86
+ readonly minimum: 0.25;
87
+ readonly maximum: 4;
88
+ readonly description: "Diffusion scale 0.25..4 (larger values grow broader pattern features; default 1).";
89
+ };
90
+ readonly contrast: {
91
+ readonly type: "number";
92
+ readonly minimum: 0;
93
+ readonly maximum: 2;
94
+ readonly description: "How strongly V modulates the wet pigment or blends toward secondColor, 0..2 (default 0.85).";
95
+ };
96
+ readonly secondColor: {
97
+ readonly type: readonly ["string", "null"];
98
+ readonly pattern: "^#[0-9a-fA-F]{6}$";
99
+ readonly description: "Optional #rrggbb colour that high-V pattern ridges blend toward, or null to modulate pigment contrast (default null).";
100
+ };
101
+ readonly relief: {
102
+ readonly type: "number";
103
+ readonly minimum: 0;
104
+ readonly maximum: 1;
105
+ readonly description: string;
106
+ };
107
+ };
66
108
  export declare function createPaintWetTools(c: PaintEditorController): PaintAgentTool[];
@@ -28,6 +28,7 @@ import { type EffectPaintPixels } from './effect-paint.cjs';
28
28
  import { type WetParams, type WetTilt } from '../paint/wet/model.cjs';
29
29
  import { type WetGpuProvider } from '../paint/wet/gpu.cjs';
30
30
  import { WetWorld, type WetBackendInfo, type WetGhostState, type WetPaperInput, type WetSnapshot, type WetWorldOptions } from '../paint/wet/world.cjs';
31
+ import { LivePatternField, type LivePatternStats, type LivePatternsInput, type LivePatternsSettings } from '../paint/live-patterns.cjs';
31
32
  import { TiledSurface, type RasterRect } from '../raster/surface.cjs';
32
33
  import type { PaintBrush, WetMediumKind } from './brushes.cjs';
33
34
  import { type PenPoint, type StrokeCopy } from './engine.cjs';
@@ -115,6 +116,7 @@ export declare const WET_MEDIUM_PARAMS: Readonly<Record<WetMediumKind, Partial<W
115
116
  export interface WetLayerSettings {
116
117
  params: WetParams;
117
118
  flow: WetFlowSpec;
119
+ livePatterns?: LivePatternsSettings | null;
118
120
  ghost?: WetGhostState | null;
119
121
  }
120
122
  /** One wet layer as tools describe it. */
@@ -130,6 +132,7 @@ export interface WetLayerInfo {
130
132
  activeTiles: number;
131
133
  params: WetParams;
132
134
  flow: WetFlowSpec;
135
+ livePatterns?: LivePatternsSettings | null;
133
136
  /** Active ghost fade on the layer (`remaining` seconds of simulated time), when one is fading. */
134
137
  ghost?: {
135
138
  remaining: number;
@@ -140,7 +143,7 @@ export interface WetEvent {
140
143
  clock: number;
141
144
  /** How many strokes were recorded before it (where it falls between strokes in a replay). */
142
145
  at?: number;
143
- kind: 'dry' | 'tilt' | 'params' | 'flow' | 'wet-paper' | 'ghost-release' | 'ghost-keep';
146
+ kind: 'dry' | 'tilt' | 'params' | 'flow' | 'wet-paper' | 'live-patterns' | 'seed-live-patterns' | 'ghost-release' | 'ghost-keep';
144
147
  layerId?: string;
145
148
  data?: unknown;
146
149
  }
@@ -158,6 +161,10 @@ export interface PaintWetHost {
158
161
  layerLight(id: string): TiledSurface | null;
159
162
  /** Shows new light paint for wet layers (not an undo step); the next `updateSurfaces` redraws. */
160
163
  updateLights(lights: ReadonlyMap<string, TiledSurface>): void;
164
+ /** The layer's thick height map (one channel), or `null` without any. */
165
+ layerHeight?(id: string): TiledSurface | null;
166
+ /** Shows new thick height maps for wet layers with live pattern relief (not an undo step). */
167
+ updateHeights?(heights: ReadonlyMap<string, TiledSurface>): void;
161
168
  /** The paint dried while time passed (the editor records nothing, it just redraws). */
162
169
  changed(): void;
163
170
  }
@@ -209,6 +216,7 @@ export declare class PaintWetLayers {
209
216
  world: WetWorld | null;
210
217
  tilt: WetTilt;
211
218
  readonly settings: Map<string, WetLayerSettings>;
219
+ readonly patterns: Map<string, LivePatternField>;
212
220
  paused: boolean;
213
221
  /** Wet strokes dry as soon as they end (one undo step with the stroke). */
214
222
  instantDry: boolean;
@@ -260,10 +268,21 @@ export declare class PaintWetLayers {
260
268
  /** Resolves when no batch is running. */
261
269
  idle(): Promise<void>;
262
270
  settingsOf(layerId: string, medium?: WetMediumKind): WetLayerSettings;
271
+ patternFieldOf(layerId: string): LivePatternField;
263
272
  /** Puts a layer in the world (its current pixels become the base under the wet paint). */
264
273
  ensureLane(layerId: string, medium?: WetMediumKind): WetWorld;
265
274
  setParams(layerId: string, update: Partial<WetParams>): WetParams;
266
275
  setFlow(layerId: string, update: Partial<WetFlowSpec>): WetFlowSpec;
276
+ setLivePatterns(layerId: string, update: LivePatternsInput | null): LivePatternsSettings | null;
277
+ seedLivePatterns(layerId: string, points: ReadonlyArray<{
278
+ x: number;
279
+ y: number;
280
+ strength?: number;
281
+ }>, radius: number, seed?: number, settings?: LivePatternsInput): {
282
+ seededCells: number;
283
+ stats: LivePatternStats;
284
+ };
285
+ livePatternStats(layerId: string): LivePatternStats;
267
286
  setTilt(update: Partial<WetTilt>): WetTilt;
268
287
  /** The paper changed. */
269
288
  paperChanged(): void;
@@ -274,6 +293,8 @@ export declare class PaintWetLayers {
274
293
  syncDisplays(maxTiles?: number): RasterRect[];
275
294
  /** Like `syncDisplays`, shading on the GPU when Engine B is active (all stale tiles at once). */
276
295
  syncDisplaysGpu(maxCpuTiles: number, lead?: boolean): Promise<RasterRect[]>;
296
+ /** Updates thick height maps for any layers with live pattern relief (`relief > 0`). */
297
+ private syncHeights;
277
298
  /** Shows each wet layer's live light paint (the light under it with the wet light shaded in). */
278
299
  private syncLights;
279
300
  /** Drops the wet layers whose paint has all dried (they become ordinary pixel layers). */
@@ -28,6 +28,7 @@ import { type EffectPaintPixels } from './effect-paint.js';
28
28
  import { type WetParams, type WetTilt } from '../paint/wet/model.js';
29
29
  import { type WetGpuProvider } from '../paint/wet/gpu.js';
30
30
  import { WetWorld, type WetBackendInfo, type WetGhostState, type WetPaperInput, type WetSnapshot, type WetWorldOptions } from '../paint/wet/world.js';
31
+ import { LivePatternField, type LivePatternStats, type LivePatternsInput, type LivePatternsSettings } from '../paint/live-patterns.js';
31
32
  import { TiledSurface, type RasterRect } from '../raster/surface.js';
32
33
  import type { PaintBrush, WetMediumKind } from './brushes.js';
33
34
  import { type PenPoint, type StrokeCopy } from './engine.js';
@@ -115,6 +116,7 @@ export declare const WET_MEDIUM_PARAMS: Readonly<Record<WetMediumKind, Partial<W
115
116
  export interface WetLayerSettings {
116
117
  params: WetParams;
117
118
  flow: WetFlowSpec;
119
+ livePatterns?: LivePatternsSettings | null;
118
120
  ghost?: WetGhostState | null;
119
121
  }
120
122
  /** One wet layer as tools describe it. */
@@ -130,6 +132,7 @@ export interface WetLayerInfo {
130
132
  activeTiles: number;
131
133
  params: WetParams;
132
134
  flow: WetFlowSpec;
135
+ livePatterns?: LivePatternsSettings | null;
133
136
  /** Active ghost fade on the layer (`remaining` seconds of simulated time), when one is fading. */
134
137
  ghost?: {
135
138
  remaining: number;
@@ -140,7 +143,7 @@ export interface WetEvent {
140
143
  clock: number;
141
144
  /** How many strokes were recorded before it (where it falls between strokes in a replay). */
142
145
  at?: number;
143
- kind: 'dry' | 'tilt' | 'params' | 'flow' | 'wet-paper' | 'ghost-release' | 'ghost-keep';
146
+ kind: 'dry' | 'tilt' | 'params' | 'flow' | 'wet-paper' | 'live-patterns' | 'seed-live-patterns' | 'ghost-release' | 'ghost-keep';
144
147
  layerId?: string;
145
148
  data?: unknown;
146
149
  }
@@ -158,6 +161,10 @@ export interface PaintWetHost {
158
161
  layerLight(id: string): TiledSurface | null;
159
162
  /** Shows new light paint for wet layers (not an undo step); the next `updateSurfaces` redraws. */
160
163
  updateLights(lights: ReadonlyMap<string, TiledSurface>): void;
164
+ /** The layer's thick height map (one channel), or `null` without any. */
165
+ layerHeight?(id: string): TiledSurface | null;
166
+ /** Shows new thick height maps for wet layers with live pattern relief (not an undo step). */
167
+ updateHeights?(heights: ReadonlyMap<string, TiledSurface>): void;
161
168
  /** The paint dried while time passed (the editor records nothing, it just redraws). */
162
169
  changed(): void;
163
170
  }
@@ -209,6 +216,7 @@ export declare class PaintWetLayers {
209
216
  world: WetWorld | null;
210
217
  tilt: WetTilt;
211
218
  readonly settings: Map<string, WetLayerSettings>;
219
+ readonly patterns: Map<string, LivePatternField>;
212
220
  paused: boolean;
213
221
  /** Wet strokes dry as soon as they end (one undo step with the stroke). */
214
222
  instantDry: boolean;
@@ -260,10 +268,21 @@ export declare class PaintWetLayers {
260
268
  /** Resolves when no batch is running. */
261
269
  idle(): Promise<void>;
262
270
  settingsOf(layerId: string, medium?: WetMediumKind): WetLayerSettings;
271
+ patternFieldOf(layerId: string): LivePatternField;
263
272
  /** Puts a layer in the world (its current pixels become the base under the wet paint). */
264
273
  ensureLane(layerId: string, medium?: WetMediumKind): WetWorld;
265
274
  setParams(layerId: string, update: Partial<WetParams>): WetParams;
266
275
  setFlow(layerId: string, update: Partial<WetFlowSpec>): WetFlowSpec;
276
+ setLivePatterns(layerId: string, update: LivePatternsInput | null): LivePatternsSettings | null;
277
+ seedLivePatterns(layerId: string, points: ReadonlyArray<{
278
+ x: number;
279
+ y: number;
280
+ strength?: number;
281
+ }>, radius: number, seed?: number, settings?: LivePatternsInput): {
282
+ seededCells: number;
283
+ stats: LivePatternStats;
284
+ };
285
+ livePatternStats(layerId: string): LivePatternStats;
267
286
  setTilt(update: Partial<WetTilt>): WetTilt;
268
287
  /** The paper changed. */
269
288
  paperChanged(): void;
@@ -274,6 +293,8 @@ export declare class PaintWetLayers {
274
293
  syncDisplays(maxTiles?: number): RasterRect[];
275
294
  /** Like `syncDisplays`, shading on the GPU when Engine B is active (all stale tiles at once). */
276
295
  syncDisplaysGpu(maxCpuTiles: number, lead?: boolean): Promise<RasterRect[]>;
296
+ /** Updates thick height maps for any layers with live pattern relief (`relief > 0`). */
297
+ private syncHeights;
277
298
  /** Shows each wet layer's live light paint (the light under it with the wet light shaded in). */
278
299
  private syncLights;
279
300
  /** Drops the wet layers whose paint has all dried (they become ordinary pixel layers). */