@pixerate/editor 0.263.0 → 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.
Files changed (50) hide show
  1. package/dist/animation-editor/index.cjs +59 -59
  2. package/dist/animation-editor/index.js +3 -3
  3. package/dist/brushes/index.cjs +155 -68
  4. package/dist/brushes/index.d.cts +3 -3
  5. package/dist/brushes/index.d.ts +3 -3
  6. package/dist/brushes/index.js +111 -24
  7. package/dist/brushes/library.d.cts +2 -0
  8. package/dist/brushes/library.d.ts +2 -0
  9. package/dist/brushes/profiles.d.cts +21 -2
  10. package/dist/brushes/profiles.d.ts +21 -2
  11. package/dist/brushes/ui.d.cts +57 -4
  12. package/dist/brushes/ui.d.ts +57 -4
  13. package/dist/{brushstrokeRender-S5DABANG.js → brushstrokeRender-3MOI7PH4.js} +2 -2
  14. package/dist/{brushstrokeRender-2GBME4XD.cjs → brushstrokeRender-SMMPIJF2.cjs} +12 -12
  15. package/dist/canvas/index.cjs +13 -13
  16. package/dist/canvas/index.js +1 -1
  17. package/dist/{chunk-CNLO6E2K.js → chunk-4OJC4MCD.js} +8 -7
  18. package/dist/{chunk-ZBACQHW3.cjs → chunk-BY5EBP26.cjs} +27 -6
  19. package/dist/{chunk-JGI4PZWO.js → chunk-CECCP2V7.js} +1 -1
  20. package/dist/{chunk-P5343XZO.js → chunk-EE7SAYBF.js} +23 -2
  21. package/dist/{chunk-TILEUVRO.cjs → chunk-F3KKR6DD.cjs} +35 -34
  22. package/dist/{chunk-TIHW7CUY.cjs → chunk-FQC5TDB6.cjs} +35 -35
  23. package/dist/{chunk-4E6BGHWN.cjs → chunk-G5ADO47G.cjs} +1 -1
  24. package/dist/{chunk-QW7LKWKE.js → chunk-HAUDEVMC.js} +1 -1
  25. package/dist/{chunk-LG6MEEV7.js → chunk-JEML4FSA.js} +1 -1
  26. package/dist/{chunk-XQW6R7VW.cjs → chunk-KXNZNOEF.cjs} +86 -86
  27. package/dist/{chunk-6XX7E7O2.js → chunk-ROBSFJ6F.js} +1 -1
  28. package/dist/{chunk-LWHUU6A6.cjs → chunk-USJX5SW4.cjs} +10 -10
  29. package/dist/{chunk-73QFSPDG.cjs → chunk-V7MJ4HIN.cjs} +23 -23
  30. package/dist/{chunk-34HIZXFX.js → chunk-WWI6FLH2.js} +1 -1
  31. package/dist/image-editor/controller.d.cts +3 -0
  32. package/dist/image-editor/controller.d.ts +3 -0
  33. package/dist/image-editor/index.cjs +789 -786
  34. package/dist/image-editor/index.js +7 -4
  35. package/dist/image-editor/types.d.cts +7 -0
  36. package/dist/image-editor/types.d.ts +7 -0
  37. package/dist/paint-editor/brush-library-tools.d.cts +8 -1
  38. package/dist/paint-editor/brush-library-tools.d.ts +8 -1
  39. package/dist/paint-editor/index.cjs +84 -80
  40. package/dist/paint-editor/index.d.cts +1 -1
  41. package/dist/paint-editor/index.d.ts +1 -1
  42. package/dist/paint-editor/index.js +12 -8
  43. package/dist/vector/controller.d.cts +13 -0
  44. package/dist/vector/controller.d.ts +13 -0
  45. package/dist/vector/index.cjs +1215 -1205
  46. package/dist/vector/index.js +16 -6
  47. package/package.json +1 -1
  48. package/skills/pixerate-brushes/SKILL.md +11 -3
  49. package/skills/pixerate-brushes-design/SKILL.md +1 -0
  50. 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-JGI4PZWO.js";
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-QW7LKWKE.js";
413
+ } from "../chunk-HAUDEVMC.js";
414
414
  import {
415
415
  ColorGmm,
416
416
  DEFAULT_REFINE_EDGE_PARAMS,
@@ -770,14 +770,14 @@ import {
770
770
  warpMeshParamAt,
771
771
  warpMeshRows,
772
772
  warpPresetMesh
773
- } from "../chunk-34HIZXFX.js";
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-P5343XZO.js";
780
+ } from "../chunk-EE7SAYBF.js";
781
781
  import "../chunk-ACFSFUQH.js";
782
782
  import "../chunk-M6DNZNVY.js";
783
783
  import {
@@ -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 });
@@ -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