@pixerate/editor 0.189.0 → 0.190.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 (31) hide show
  1. package/dist/{chunk-ZEHTUR7Z.js → chunk-7ZWLDVFH.js} +971 -753
  2. package/dist/{chunk-ED4L4UD6.cjs → chunk-T4U4O6DS.cjs} +1005 -787
  3. package/dist/image-editor/controller.d.cts +51 -1
  4. package/dist/image-editor/controller.d.ts +51 -1
  5. package/dist/image-editor/free-transform.d.cts +3 -6
  6. package/dist/image-editor/free-transform.d.ts +3 -6
  7. package/dist/image-editor/index.cjs +1219 -901
  8. package/dist/image-editor/index.d.cts +1 -0
  9. package/dist/image-editor/index.d.ts +1 -0
  10. package/dist/image-editor/index.js +321 -3
  11. package/dist/image-editor/layer-tools.d.cts +1 -1
  12. package/dist/image-editor/layer-tools.d.ts +1 -1
  13. package/dist/image-editor/layers/compositor.d.cts +3 -0
  14. package/dist/image-editor/layers/compositor.d.ts +3 -0
  15. package/dist/image-editor/layers/model.d.cts +23 -0
  16. package/dist/image-editor/layers/model.d.ts +23 -0
  17. package/dist/image-editor/layers/panel.d.cts +11 -1
  18. package/dist/image-editor/layers/panel.d.ts +11 -1
  19. package/dist/image-editor/layers/serialize.d.cts +11 -0
  20. package/dist/image-editor/layers/serialize.d.ts +11 -0
  21. package/dist/image-editor/layers/shape.d.cts +5 -0
  22. package/dist/image-editor/layers/shape.d.ts +5 -0
  23. package/dist/image-editor/layers/vector-mask.d.cts +51 -0
  24. package/dist/image-editor/layers/vector-mask.d.ts +51 -0
  25. package/dist/image-editor/psd/import.d.cts +0 -7
  26. package/dist/image-editor/psd/import.d.ts +0 -7
  27. package/dist/paint-editor/index.cjs +6 -6
  28. package/dist/paint-editor/index.js +1 -1
  29. package/package.json +1 -1
  30. package/skills/pixerate-image-editor/SKILL.md +6 -0
  31. package/skills/pixerate-image-selection-masking/SKILL.md +6 -2
@@ -11,7 +11,7 @@ import { type RefineEdgeParams } from './selection/refine.cjs';
11
11
  import { type LayerMaskProps } from './selection/layer-mask.cjs';
12
12
  import { type AlphaChannel } from './selection/channels.cjs';
13
13
  import type { AdjustmentLayerMask } from './types.cjs';
14
- import { type LayerBlendMode, type ImageLayer, type LayerFilter, type LayerTarget, type PixelLayer, type RasterMask, type SmartContents, type SmartFilter, type SmartPlacement, type LiveShape, type ShapeFillRule, type ShapeOperation, type ShapePaint, type ShapeStroke, type ParagraphStyle, type TextStyle, type TypeLayer, type ImageEffectAnimation } from './layers/model.cjs';
14
+ import { type LayerBlendMode, type ImageLayer, type LayerFilter, type LayerTarget, type PixelLayer, type RasterMask, type SmartContents, type SmartFilter, type SmartPlacement, type LiveShape, type ShapeFillRule, type VectorMask, type ShapeOperation, type ShapePaint, type ShapeStroke, type ParagraphStyle, type TextStyle, type TypeLayer, type ImageEffectAnimation } from './layers/model.cjs';
15
15
  import { type TextLayout, type TextShaper } from './layers/text.cjs';
16
16
  import type { VectorSubpath } from '../vector/types.cjs';
17
17
  import { EffectsSlot } from '../effects/helpers.cjs';
@@ -209,6 +209,29 @@ export interface CloneSource {
209
209
  * 'star' | 'line', … }`, see `LiveShape`) or subpaths (`[{ anchors: [{ x, y, in?, out? }],
210
210
  * closed }]` or SVG path data), and how it combines with the components below it.
211
211
  */
212
+ /** A vector mask's path: several `components`, or one `shape` / `subpaths` (with `op`). */
213
+ export interface VectorMaskPathInput extends ShapeGeometryInput {
214
+ components?: ShapeGeometryInput[];
215
+ fillRule?: ShapeFillRule;
216
+ }
217
+ /** A vector mask as `getVectorMask` describes it. */
218
+ export interface VectorMaskInfo {
219
+ layerId: string;
220
+ enabled: boolean;
221
+ linked: boolean;
222
+ inverted: boolean;
223
+ fillRule: ShapeFillRule;
224
+ density: number;
225
+ feather: number;
226
+ /** Bounds of the path's anchors and handles (document px), or `null` for an empty path. */
227
+ bounds: CropBox | null;
228
+ components: Array<{
229
+ index: number;
230
+ op: ShapeOperation;
231
+ live: LiveShape | null;
232
+ subpaths: VectorSubpath[];
233
+ }>;
234
+ }
212
235
  export interface ShapeGeometryInput {
213
236
  shape?: LiveShape | Record<string, unknown>;
214
237
  subpaths?: VectorSubpath[] | string;
@@ -888,6 +911,33 @@ export declare class ImageEditorController {
888
911
  addLayerMask(id: string, from?: 'reveal-all' | 'hide-all' | 'selection' | 'hide-selection' | 'transparency', props?: LayerMaskProps): RasterMask;
889
912
  /** Removes a layer's mask (one undo step). */
890
913
  removeLayerMask(id: string): void;
914
+ /** The layer for a vector mask command: not a shape layer (its path is its vector mask), not a depth-masked one. */
915
+ private vectorMaskLayer;
916
+ private requireVectorMask;
917
+ /** Components from a path spec: `components`, or one `shape` / `subpaths`. */
918
+ private vectorMaskComponents;
919
+ /**
920
+ * Layer › Vector Mask: `reveal-all` (an empty path showing everything), `hide-all` (an empty path
921
+ * hiding everything) or `path` (reveals inside the path given). Replaces an existing vector mask;
922
+ * the raster mask is kept and both apply. One undo step. Returns the vector mask.
923
+ */
924
+ addVectorMask(id: string, from?: 'reveal-all' | 'hide-all' | 'path', path?: VectorMaskPathInput): VectorMask;
925
+ /** Replaces a vector mask's path (its properties are kept). One undo step. Returns the vector mask. */
926
+ setVectorMaskPath(id: string, path: VectorMaskPathInput): VectorMask;
927
+ /** Changes a vector mask's enabled, linked, inverted, density or feather (the path is kept). One undo step. */
928
+ setVectorMaskProps(id: string, props: Partial<Pick<VectorMask, 'enabled' | 'linked' | 'inverted' | 'density' | 'feather'>>): VectorMask;
929
+ /** Deletes a layer's vector mask (one undo step). */
930
+ removeVectorMask(id: string): void;
931
+ /**
932
+ * Layer › Rasterize › Vector Mask: multiplies the path (with its density and feather) into the
933
+ * layer's raster mask, adding one when there is none, and removes the vector mask. The raster
934
+ * mask keeps its own properties. One undo step. Returns the raster mask.
935
+ */
936
+ rasterizeVectorMask(id: string): RasterMask;
937
+ /** Load Selection from a vector mask's path (density and feather are not applied), inverted with `invert`. */
938
+ selectionFromVectorMask(id: string, mode?: SelectionMode, invert?: boolean): boolean;
939
+ /** A layer's vector mask with its paths (rounded), or `null` without one. */
940
+ getVectorMask(id: string): VectorMaskInfo | null;
891
941
  /** Changes any layer mask's density, feather, enabled or linked flag (pixels kept). Returns the mask. */
892
942
  setLayerMaskProps(id: string, props: LayerMaskProps, commitToHistory?: boolean): RasterMask;
893
943
  /**
@@ -11,7 +11,7 @@ import { type RefineEdgeParams } from './selection/refine.js';
11
11
  import { type LayerMaskProps } from './selection/layer-mask.js';
12
12
  import { type AlphaChannel } from './selection/channels.js';
13
13
  import type { AdjustmentLayerMask } from './types.js';
14
- import { type LayerBlendMode, type ImageLayer, type LayerFilter, type LayerTarget, type PixelLayer, type RasterMask, type SmartContents, type SmartFilter, type SmartPlacement, type LiveShape, type ShapeFillRule, type ShapeOperation, type ShapePaint, type ShapeStroke, type ParagraphStyle, type TextStyle, type TypeLayer, type ImageEffectAnimation } from './layers/model.js';
14
+ import { type LayerBlendMode, type ImageLayer, type LayerFilter, type LayerTarget, type PixelLayer, type RasterMask, type SmartContents, type SmartFilter, type SmartPlacement, type LiveShape, type ShapeFillRule, type VectorMask, type ShapeOperation, type ShapePaint, type ShapeStroke, type ParagraphStyle, type TextStyle, type TypeLayer, type ImageEffectAnimation } from './layers/model.js';
15
15
  import { type TextLayout, type TextShaper } from './layers/text.js';
16
16
  import type { VectorSubpath } from '../vector/types.js';
17
17
  import { EffectsSlot } from '../effects/helpers.js';
@@ -209,6 +209,29 @@ export interface CloneSource {
209
209
  * 'star' | 'line', … }`, see `LiveShape`) or subpaths (`[{ anchors: [{ x, y, in?, out? }],
210
210
  * closed }]` or SVG path data), and how it combines with the components below it.
211
211
  */
212
+ /** A vector mask's path: several `components`, or one `shape` / `subpaths` (with `op`). */
213
+ export interface VectorMaskPathInput extends ShapeGeometryInput {
214
+ components?: ShapeGeometryInput[];
215
+ fillRule?: ShapeFillRule;
216
+ }
217
+ /** A vector mask as `getVectorMask` describes it. */
218
+ export interface VectorMaskInfo {
219
+ layerId: string;
220
+ enabled: boolean;
221
+ linked: boolean;
222
+ inverted: boolean;
223
+ fillRule: ShapeFillRule;
224
+ density: number;
225
+ feather: number;
226
+ /** Bounds of the path's anchors and handles (document px), or `null` for an empty path. */
227
+ bounds: CropBox | null;
228
+ components: Array<{
229
+ index: number;
230
+ op: ShapeOperation;
231
+ live: LiveShape | null;
232
+ subpaths: VectorSubpath[];
233
+ }>;
234
+ }
212
235
  export interface ShapeGeometryInput {
213
236
  shape?: LiveShape | Record<string, unknown>;
214
237
  subpaths?: VectorSubpath[] | string;
@@ -888,6 +911,33 @@ export declare class ImageEditorController {
888
911
  addLayerMask(id: string, from?: 'reveal-all' | 'hide-all' | 'selection' | 'hide-selection' | 'transparency', props?: LayerMaskProps): RasterMask;
889
912
  /** Removes a layer's mask (one undo step). */
890
913
  removeLayerMask(id: string): void;
914
+ /** The layer for a vector mask command: not a shape layer (its path is its vector mask), not a depth-masked one. */
915
+ private vectorMaskLayer;
916
+ private requireVectorMask;
917
+ /** Components from a path spec: `components`, or one `shape` / `subpaths`. */
918
+ private vectorMaskComponents;
919
+ /**
920
+ * Layer › Vector Mask: `reveal-all` (an empty path showing everything), `hide-all` (an empty path
921
+ * hiding everything) or `path` (reveals inside the path given). Replaces an existing vector mask;
922
+ * the raster mask is kept and both apply. One undo step. Returns the vector mask.
923
+ */
924
+ addVectorMask(id: string, from?: 'reveal-all' | 'hide-all' | 'path', path?: VectorMaskPathInput): VectorMask;
925
+ /** Replaces a vector mask's path (its properties are kept). One undo step. Returns the vector mask. */
926
+ setVectorMaskPath(id: string, path: VectorMaskPathInput): VectorMask;
927
+ /** Changes a vector mask's enabled, linked, inverted, density or feather (the path is kept). One undo step. */
928
+ setVectorMaskProps(id: string, props: Partial<Pick<VectorMask, 'enabled' | 'linked' | 'inverted' | 'density' | 'feather'>>): VectorMask;
929
+ /** Deletes a layer's vector mask (one undo step). */
930
+ removeVectorMask(id: string): void;
931
+ /**
932
+ * Layer › Rasterize › Vector Mask: multiplies the path (with its density and feather) into the
933
+ * layer's raster mask, adding one when there is none, and removes the vector mask. The raster
934
+ * mask keeps its own properties. One undo step. Returns the raster mask.
935
+ */
936
+ rasterizeVectorMask(id: string): RasterMask;
937
+ /** Load Selection from a vector mask's path (density and feather are not applied), inverted with `invert`. */
938
+ selectionFromVectorMask(id: string, mode?: SelectionMode, invert?: boolean): boolean;
939
+ /** A layer's vector mask with its paths (rounded), or `null` without one. */
940
+ getVectorMask(id: string): VectorMaskInfo | null;
891
941
  /** Changes any layer mask's density, feather, enabled or linked flag (pixels kept). Returns the mask. */
892
942
  setLayerMaskProps(id: string, props: LayerMaskProps, commitToHistory?: boolean): RasterMask;
893
943
  /**
@@ -1,9 +1,3 @@
1
- /**
2
- * Free Transform sessions: what a transform moves (a layer's pixels with its linked mask, a lone
3
- * unlinked mask, the selected pixels as a floating piece, a copy of them on a new layer, or just
4
- * the selection outline), a live preview while the geometry changes, and one undo step when it is
5
- * committed with full-quality resampling.
6
- */
7
1
  import { TiledSurface } from '../raster/surface.cjs';
8
2
  import { type Interpolation } from '../raster/transform.cjs';
9
3
  import { type ImageLayer, type LayerTarget, type PixelLayer, type SmartObjectLayer } from './layers/model.cjs';
@@ -147,6 +141,9 @@ export declare class FreeTransformSession {
147
141
  }, preview?: FreeTransformPreview | false): FreeTransformGeometry;
148
142
  /** Resamples every part for the current geometry and shows it (or returns it, for commit). */
149
143
  private resample;
144
+ /** A linked vector mask follows the layer's content through the same document-space map. */
145
+ private moveVectorMask;
146
+ private resampleContent;
150
147
  /**
151
148
  * A shape with its paths mapped through the current geometry and rendered again (live shapes
152
149
  * stay live under an affine map; perspective and warps turn them into plain paths). Previews
@@ -1,9 +1,3 @@
1
- /**
2
- * Free Transform sessions: what a transform moves (a layer's pixels with its linked mask, a lone
3
- * unlinked mask, the selected pixels as a floating piece, a copy of them on a new layer, or just
4
- * the selection outline), a live preview while the geometry changes, and one undo step when it is
5
- * committed with full-quality resampling.
6
- */
7
1
  import { TiledSurface } from '../raster/surface.js';
8
2
  import { type Interpolation } from '../raster/transform.js';
9
3
  import { type ImageLayer, type LayerTarget, type PixelLayer, type SmartObjectLayer } from './layers/model.js';
@@ -147,6 +141,9 @@ export declare class FreeTransformSession {
147
141
  }, preview?: FreeTransformPreview | false): FreeTransformGeometry;
148
142
  /** Resamples every part for the current geometry and shows it (or returns it, for commit). */
149
143
  private resample;
144
+ /** A linked vector mask follows the layer's content through the same document-space map. */
145
+ private moveVectorMask;
146
+ private resampleContent;
150
147
  /**
151
148
  * A shape with its paths mapped through the current geometry and rendered again (live shapes
152
149
  * stay live under an affine map; perspective and warps turn them into plain paths). Previews