@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
@@ -26,7 +26,7 @@ export * from './mixing-pad.cjs';
26
26
  export * from './controller.cjs';
27
27
  export * from './presence.cjs';
28
28
  export * from './tools.cjs';
29
- export { createPaintBrushLibraryToolProvider, type PaintBrushLibraryToolProviderOptions } from './brush-library-tools.cjs';
29
+ export { createPaintBrushLibraryToolProvider, paintBrushPreviewRenderer, type PaintBrushLibraryToolProviderOptions } from './brush-library-tools.cjs';
30
30
  export type { PaintAgentTool, PaintOrigin, PaintToolCoordinates } from './hosted.cjs';
31
31
  export * from './ui.cjs';
32
32
  export { BLEND_MODES, PAINTERLY_BLEND_MODES, isBlendMode, isPainterlyBlendMode, standardBlendMode, type BlendMode, type BlendModeInfo } from '../raster/blend.cjs';
@@ -26,7 +26,7 @@ export * from './mixing-pad.js';
26
26
  export * from './controller.js';
27
27
  export * from './presence.js';
28
28
  export * from './tools.js';
29
- export { createPaintBrushLibraryToolProvider, type PaintBrushLibraryToolProviderOptions } from './brush-library-tools.js';
29
+ export { createPaintBrushLibraryToolProvider, paintBrushPreviewRenderer, type PaintBrushLibraryToolProviderOptions } from './brush-library-tools.js';
30
30
  export type { PaintAgentTool, PaintOrigin, PaintToolCoordinates } from './hosted.js';
31
31
  export * from './ui.js';
32
32
  export { BLEND_MODES, PAINTERLY_BLEND_MODES, isBlendMode, isPainterlyBlendMode, standardBlendMode, type BlendMode, type BlendModeInfo } from '../raster/blend.js';
@@ -11,7 +11,7 @@ import {
11
11
  mergeBrushPatch,
12
12
  multiColorSliders,
13
13
  patchBrushValue
14
- } from "../chunk-CNLO6E2K.js";
14
+ } from "../chunk-4OJC4MCD.js";
15
15
  import {
16
16
  createStickerTools,
17
17
  describeStickerRef
@@ -30,7 +30,7 @@ import {
30
30
  resolveExternalAssets,
31
31
  serializeLayers,
32
32
  serializeLayersExternal
33
- } from "../chunk-QW7LKWKE.js";
33
+ } from "../chunk-HAUDEVMC.js";
34
34
  import "../chunk-WJ4WQJCC.js";
35
35
  import {
36
36
  LAYER_EFFECT_KINDS,
@@ -88,7 +88,7 @@ import {
88
88
  realPresenceClock,
89
89
  tweenPresenceCursor
90
90
  } from "../chunk-IVSWRVB4.js";
91
- import "../chunk-34HIZXFX.js";
91
+ import "../chunk-WWI6FLH2.js";
92
92
  import {
93
93
  BRUSH_ID,
94
94
  BRUSH_PRESETS,
@@ -143,7 +143,7 @@ import {
143
143
  parseBrushLibrary,
144
144
  resolveBrush,
145
145
  usesPaintExchange
146
- } from "../chunk-P5343XZO.js";
146
+ } from "../chunk-EE7SAYBF.js";
147
147
  import {
148
148
  STAMP_KINDS,
149
149
  StickersSlot,
@@ -12150,15 +12150,18 @@ function strokeSummary(s, withPoints, live) {
12150
12150
  }
12151
12151
 
12152
12152
  // src/paint-editor/brush-library-tools.ts
12153
+ function paintBrushPreviewRenderer(paper = () => DEFAULT_PAPER) {
12154
+ return (brush, { width, height, color }) => {
12155
+ const t = renderBrushThumbnail(resolveBrush(brush), { paper: paper(), width, height, color: color.toLowerCase() });
12156
+ return { data: bytesToBase64(encodePng(t.width, t.height, t.data)), mimeType: "image/png" };
12157
+ };
12158
+ }
12153
12159
  function createPaintBrushLibraryToolProvider(controller, options = {}) {
12154
12160
  return createBrushLibraryToolProvider(controller.brushLibrary, {
12155
12161
  profile: PAINT_PROFILE,
12156
12162
  stickers: () => controller.stickers.provider,
12157
12163
  ...options,
12158
- renderPreview: (brush, { width, height, color }) => {
12159
- const t = renderBrushThumbnail(resolveBrush(brush), { paper: controller.getState().document.paper, width, height, color: color.toLowerCase() });
12160
- return { data: bytesToBase64(encodePng(t.width, t.height, t.data)), mimeType: "image/png" };
12161
- }
12164
+ renderPreview: paintBrushPreviewRenderer(() => controller.getState().document.paper)
12162
12165
  });
12163
12166
  }
12164
12167
 
@@ -13780,6 +13783,7 @@ export {
13780
13783
  overPixels,
13781
13784
  padSampleRadius,
13782
13785
  paintAgentStrokePoints,
13786
+ paintBrushPreviewRenderer,
13783
13787
  paintContracts,
13784
13788
  paintGradientMappingFor,
13785
13789
  paintPlaybackPanel,
@@ -1,4 +1,5 @@
1
1
  import { type BrushLibrary } from '../brushes/library.cjs';
2
+ import type { BrushPreviewRenderer } from '../brushes/tools.cjs';
2
3
  import type { PaintBrush } from '../paint-editor/brushes.cjs';
3
4
  import { type VectorStylizeOptions, type VectorStylizeStyle } from './stylize.cjs';
4
5
  import { type VectorDistortBrushMode } from './distortBrush.cjs';
@@ -104,6 +105,12 @@ export interface VectorEditorOptions {
104
105
  * profile decides which). Share one with the paint editor so a brush saved there paints here.
105
106
  */
106
107
  brushLibrary?: Pick<BrushLibrary, 'list' | 'subscribe'>;
108
+ /**
109
+ * Draws a brush's preview stroke for the brush editor ("Edit brush…"), e.g.
110
+ * `renderCanvasBrushPreview` from `@pixerate/editor/canvas` (the renderer brushstrokes paint
111
+ * with; not bundled here). Without it the brush editor has no preview.
112
+ */
113
+ brushPreview?: BrushPreviewRenderer;
107
114
  /** The app's colour scheme, which picks the side of a brush's light / dark default colour (default light). */
108
115
  colorScheme?: 'light' | 'dark';
109
116
  /** History to record into, e.g. one shared with the rest of the app (default: a new one). */
@@ -802,6 +809,12 @@ export declare class VectorEditorController {
802
809
  */
803
810
  /** The saved brushes of the brush library as last read (empty without one). */
804
811
  private brushes;
812
+ /** The brush library brushstrokes use (`brushLibrary` option), or `null`. A full `BrushLibrary` lets the UI edit brushes (`isBrushLibrary`). */
813
+ readonly brushLibrary: Pick<BrushLibrary, 'list' | 'subscribe'> | null;
814
+ /** The `brushPreview` option: draws the brush editor's preview stroke, or `null`. */
815
+ readonly brushPreview: BrushPreviewRenderer | null;
816
+ /** Reads the brush library again now (it is also read after every change to it); resolves once read. */
817
+ refreshBrushes(): Promise<void>;
805
818
  /** The brushes a brushstroke can use: the presets, then the brush library's saved brushes the vector profile admits. */
806
819
  listBrushstrokeBrushes(): PaintBrush[];
807
820
  /** Resolves once the brush library has been read (its saved brushes can be used from then on). */
@@ -1,4 +1,5 @@
1
1
  import { type BrushLibrary } from '../brushes/library.js';
2
+ import type { BrushPreviewRenderer } from '../brushes/tools.js';
2
3
  import type { PaintBrush } from '../paint-editor/brushes.js';
3
4
  import { type VectorStylizeOptions, type VectorStylizeStyle } from './stylize.js';
4
5
  import { type VectorDistortBrushMode } from './distortBrush.js';
@@ -104,6 +105,12 @@ export interface VectorEditorOptions {
104
105
  * profile decides which). Share one with the paint editor so a brush saved there paints here.
105
106
  */
106
107
  brushLibrary?: Pick<BrushLibrary, 'list' | 'subscribe'>;
108
+ /**
109
+ * Draws a brush's preview stroke for the brush editor ("Edit brush…"), e.g.
110
+ * `renderCanvasBrushPreview` from `@pixerate/editor/canvas` (the renderer brushstrokes paint
111
+ * with; not bundled here). Without it the brush editor has no preview.
112
+ */
113
+ brushPreview?: BrushPreviewRenderer;
107
114
  /** The app's colour scheme, which picks the side of a brush's light / dark default colour (default light). */
108
115
  colorScheme?: 'light' | 'dark';
109
116
  /** History to record into, e.g. one shared with the rest of the app (default: a new one). */
@@ -802,6 +809,12 @@ export declare class VectorEditorController {
802
809
  */
803
810
  /** The saved brushes of the brush library as last read (empty without one). */
804
811
  private brushes;
812
+ /** The brush library brushstrokes use (`brushLibrary` option), or `null`. A full `BrushLibrary` lets the UI edit brushes (`isBrushLibrary`). */
813
+ readonly brushLibrary: Pick<BrushLibrary, 'list' | 'subscribe'> | null;
814
+ /** The `brushPreview` option: draws the brush editor's preview stroke, or `null`. */
815
+ readonly brushPreview: BrushPreviewRenderer | null;
816
+ /** Reads the brush library again now (it is also read after every change to it); resolves once read. */
817
+ refreshBrushes(): Promise<void>;
805
818
  /** The brushes a brushstroke can use: the presets, then the brush library's saved brushes the vector profile admits. */
806
819
  listBrushstrokeBrushes(): PaintBrush[];
807
820
  /** Resolves once the brush library has been read (its saved brushes can be used from then on). */