@pixerate/editor 0.210.0 → 0.212.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 (30) hide show
  1. package/dist/{chunk-QE7D7TZR.cjs → chunk-H65IBXFI.cjs} +74 -25
  2. package/dist/{chunk-KFIOEOCQ.js → chunk-W3TOZTL7.js} +55 -6
  3. package/dist/image-editor/content-aware-fill-session.d.cts +17 -5
  4. package/dist/image-editor/content-aware-fill-session.d.ts +17 -5
  5. package/dist/image-editor/controller.d.cts +60 -4
  6. package/dist/image-editor/controller.d.ts +60 -4
  7. package/dist/image-editor/index.cjs +1522 -1013
  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 +532 -23
  11. package/dist/image-editor/layers/serialize.d.cts +5 -8
  12. package/dist/image-editor/layers/serialize.d.ts +5 -8
  13. package/dist/image-editor/paths.d.cts +41 -0
  14. package/dist/image-editor/paths.d.ts +41 -0
  15. package/dist/image-editor/psd/export.d.cts +8 -1
  16. package/dist/image-editor/psd/export.d.ts +8 -1
  17. package/dist/image-editor/psd/import.d.cts +7 -0
  18. package/dist/image-editor/psd/import.d.ts +7 -0
  19. package/dist/image-editor/psd/paths.d.cts +11 -0
  20. package/dist/image-editor/psd/paths.d.ts +11 -0
  21. package/dist/image-editor/selection/gesture.d.cts +10 -2
  22. package/dist/image-editor/selection/gesture.d.ts +10 -2
  23. package/dist/image-editor/selection/select-and-mask.d.cts +5 -0
  24. package/dist/image-editor/selection/select-and-mask.d.ts +5 -0
  25. package/dist/image-editor/types.d.cts +12 -0
  26. package/dist/image-editor/types.d.ts +12 -0
  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 +1 -1
@@ -2,6 +2,7 @@ import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, Creat
2
2
  import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.cjs';
3
3
  import { type MagneticEdgeOptions } from './selection/magnetic.cjs';
4
4
  import type { ObjectTarget } from './selection/segment/grabcut.cjs';
5
+ import { type DocumentPath } from './paths.cjs';
5
6
  import { type SelectionJob, type SelectionJobResult, type SelectionWorkerFactory } from './selection/worker.cjs';
6
7
  import type { SelectionProgress } from './selection/segment/work.cjs';
7
8
  import type { FocusAreaOptions } from './selection/segment/focus.cjs';
@@ -478,12 +479,17 @@ export interface StrokeSelectionOptions extends Omit<FillOptions, 'useSelection'
478
479
  /** Where the band lies against the selection edge (default `outside`). */
479
480
  location?: 'inside' | 'center' | 'outside';
480
481
  }
482
+ /** Where Content-Aware Fill puts its result. */
483
+ export type ContentAwareFillOutput = 'current' | 'new-layer' | 'duplicate-layer';
481
484
  /** Edit › Content-Aware Fill (see `contentAwareFill`). */
482
485
  export interface ContentAwareFillOptions {
483
486
  /** The pixel layer to sample and fill (default the active layer). */
484
487
  layerId?: string;
485
- /** `current` (default) paints into the layer; `new-layer` puts the fill on a new layer above it. */
486
- output?: 'current' | 'new-layer';
488
+ /**
489
+ * `current` (default) paints into the layer; `new-layer` puts the fill on a new layer above it;
490
+ * `duplicate-layer` paints it into a copy of the layer, above it.
491
+ */
492
+ output?: ContentAwareFillOutput;
487
493
  /** How far around the selection to sample, in pixels (default its larger side, at least 32). */
488
494
  sampleRadius?: number;
489
495
  /** Random seed: the same seed gives the same fill (default 0). */
@@ -1087,6 +1093,50 @@ export declare class ImageEditorController {
1087
1093
  pathToSelection(path: VectorMaskPathInput, options?: PathToSelectionOptions & {
1088
1094
  mode?: SelectionMode;
1089
1095
  }): boolean;
1096
+ /** The document's paths: saved paths and the Work Path, in panel order. */
1097
+ getPaths(): readonly DocumentPath[];
1098
+ getPath(id: string): DocumentPath | null;
1099
+ private requirePath;
1100
+ /** Selects a path in the Paths panel (or none). View state: no undo step. */
1101
+ setActivePath(id: string | null): void;
1102
+ private commitPaths;
1103
+ /**
1104
+ * Paths › Make Work Path: the selection's outline, traced, becomes the Work Path (replacing the
1105
+ * last one, unless it was saved). One undo step. Returns the path.
1106
+ */
1107
+ makeWorkPath(options?: SelectionToPathOptions): DocumentPath;
1108
+ /** A new saved path from geometry (`shape`, `subpaths` or `components`). One undo step. */
1109
+ addPath(input: VectorMaskPathInput & {
1110
+ name?: string;
1111
+ }): DocumentPath;
1112
+ /** Replaces a path's geometry (its name is kept). One undo step. */
1113
+ setPathGeometry(id: string, input: VectorMaskPathInput): DocumentPath;
1114
+ /** Renames a path; renaming the Work Path saves it (Photoshop's Save Path). One undo step. */
1115
+ renamePath(id: string, name: string): DocumentPath;
1116
+ /** Duplicates a path as a saved path. One undo step. */
1117
+ duplicatePath(id: string, name?: string): DocumentPath;
1118
+ /** Deletes a path. One undo step. */
1119
+ deletePath(id: string): void;
1120
+ /** The area a path fills over the image, as a selection mask. */
1121
+ private pathArea;
1122
+ /** Paths › Make Selection: loads a path as the selection, combined by `mode`. One undo step. */
1123
+ loadPathAsSelection(id: string, options?: PathToSelectionOptions & {
1124
+ mode?: SelectionMode;
1125
+ }): boolean;
1126
+ /**
1127
+ * Paths › Fill Path: fills the path's area on a pixel layer (default the active one) with a
1128
+ * colour (default the foreground). The selection is not changed. One undo step.
1129
+ */
1130
+ fillPath(id: string, options?: Omit<FillOptions, 'useSelection'>): PaintStrokeResult;
1131
+ /**
1132
+ * Paths › Stroke Path: strokes along the path's outline on a pixel layer (default the active
1133
+ * one), `width` px wide and centred on it. The selection is not changed. One undo step.
1134
+ */
1135
+ strokePath(id: string, options: Omit<StrokeSelectionOptions, 'location'>): PaintStrokeResult;
1136
+ /** Paths › Add Vector Mask: masks a layer (default the active one) with a document path. One undo step. */
1137
+ addVectorMaskFromPath(pathId: string, layerId?: string): VectorMask;
1138
+ /** Runs `fn` with `mask` as the selection, then puts the selection back, all as one undo step. */
1139
+ private withSelection;
1090
1140
  /** Replaces a vector mask's path (its properties are kept). One undo step. Returns the vector mask. */
1091
1141
  setVectorMaskPath(id: string, path: VectorMaskPathInput): VectorMask;
1092
1142
  /** Changes a vector mask's enabled, linked, inverted, density or feather (the path is kept). One undo step. */
@@ -1483,7 +1533,7 @@ export declare class ImageEditorController {
1483
1533
  contentAwareFill(options?: ContentAwareFillOptions): {
1484
1534
  layerId: string;
1485
1535
  bounds: CropBox;
1486
- output: 'current' | 'new-layer';
1536
+ output: ContentAwareFillOutput;
1487
1537
  };
1488
1538
  /**
1489
1539
  * `contentAwareFill` with the synthesis in the selection worker when there is one, with
@@ -1495,7 +1545,7 @@ export declare class ImageEditorController {
1495
1545
  }): Promise<{
1496
1546
  layerId: string;
1497
1547
  bounds: CropBox;
1498
- output: 'current' | 'new-layer';
1548
+ output: ContentAwareFillOutput;
1499
1549
  }>;
1500
1550
  /**
1501
1551
  * The fill without changing anything: the window, its pixels before and after (RGBA, the fill
@@ -1627,6 +1677,12 @@ export declare class ImageEditorController {
1627
1677
  * Returns false when nothing changed.
1628
1678
  */
1629
1679
  setSelection(mask: SelectionMask | null, mode?: SelectionMode): boolean;
1680
+ /**
1681
+ * Shows `mask` in place of the selection while a gesture runs (Quick Selection as the brush
1682
+ * moves; `null` shows nothing selected), or with `undefined` stops. View state only: no undo
1683
+ * step, not saved.
1684
+ */
1685
+ setSelectionPreview(mask: SelectionMask | null | undefined): void;
1630
1686
  /** Select › All. */
1631
1687
  selectAll(): boolean;
1632
1688
  /** Select › Deselect. */
@@ -2,6 +2,7 @@ import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, Creat
2
2
  import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.js';
3
3
  import { type MagneticEdgeOptions } from './selection/magnetic.js';
4
4
  import type { ObjectTarget } from './selection/segment/grabcut.js';
5
+ import { type DocumentPath } from './paths.js';
5
6
  import { type SelectionJob, type SelectionJobResult, type SelectionWorkerFactory } from './selection/worker.js';
6
7
  import type { SelectionProgress } from './selection/segment/work.js';
7
8
  import type { FocusAreaOptions } from './selection/segment/focus.js';
@@ -478,12 +479,17 @@ export interface StrokeSelectionOptions extends Omit<FillOptions, 'useSelection'
478
479
  /** Where the band lies against the selection edge (default `outside`). */
479
480
  location?: 'inside' | 'center' | 'outside';
480
481
  }
482
+ /** Where Content-Aware Fill puts its result. */
483
+ export type ContentAwareFillOutput = 'current' | 'new-layer' | 'duplicate-layer';
481
484
  /** Edit › Content-Aware Fill (see `contentAwareFill`). */
482
485
  export interface ContentAwareFillOptions {
483
486
  /** The pixel layer to sample and fill (default the active layer). */
484
487
  layerId?: string;
485
- /** `current` (default) paints into the layer; `new-layer` puts the fill on a new layer above it. */
486
- output?: 'current' | 'new-layer';
488
+ /**
489
+ * `current` (default) paints into the layer; `new-layer` puts the fill on a new layer above it;
490
+ * `duplicate-layer` paints it into a copy of the layer, above it.
491
+ */
492
+ output?: ContentAwareFillOutput;
487
493
  /** How far around the selection to sample, in pixels (default its larger side, at least 32). */
488
494
  sampleRadius?: number;
489
495
  /** Random seed: the same seed gives the same fill (default 0). */
@@ -1087,6 +1093,50 @@ export declare class ImageEditorController {
1087
1093
  pathToSelection(path: VectorMaskPathInput, options?: PathToSelectionOptions & {
1088
1094
  mode?: SelectionMode;
1089
1095
  }): boolean;
1096
+ /** The document's paths: saved paths and the Work Path, in panel order. */
1097
+ getPaths(): readonly DocumentPath[];
1098
+ getPath(id: string): DocumentPath | null;
1099
+ private requirePath;
1100
+ /** Selects a path in the Paths panel (or none). View state: no undo step. */
1101
+ setActivePath(id: string | null): void;
1102
+ private commitPaths;
1103
+ /**
1104
+ * Paths › Make Work Path: the selection's outline, traced, becomes the Work Path (replacing the
1105
+ * last one, unless it was saved). One undo step. Returns the path.
1106
+ */
1107
+ makeWorkPath(options?: SelectionToPathOptions): DocumentPath;
1108
+ /** A new saved path from geometry (`shape`, `subpaths` or `components`). One undo step. */
1109
+ addPath(input: VectorMaskPathInput & {
1110
+ name?: string;
1111
+ }): DocumentPath;
1112
+ /** Replaces a path's geometry (its name is kept). One undo step. */
1113
+ setPathGeometry(id: string, input: VectorMaskPathInput): DocumentPath;
1114
+ /** Renames a path; renaming the Work Path saves it (Photoshop's Save Path). One undo step. */
1115
+ renamePath(id: string, name: string): DocumentPath;
1116
+ /** Duplicates a path as a saved path. One undo step. */
1117
+ duplicatePath(id: string, name?: string): DocumentPath;
1118
+ /** Deletes a path. One undo step. */
1119
+ deletePath(id: string): void;
1120
+ /** The area a path fills over the image, as a selection mask. */
1121
+ private pathArea;
1122
+ /** Paths › Make Selection: loads a path as the selection, combined by `mode`. One undo step. */
1123
+ loadPathAsSelection(id: string, options?: PathToSelectionOptions & {
1124
+ mode?: SelectionMode;
1125
+ }): boolean;
1126
+ /**
1127
+ * Paths › Fill Path: fills the path's area on a pixel layer (default the active one) with a
1128
+ * colour (default the foreground). The selection is not changed. One undo step.
1129
+ */
1130
+ fillPath(id: string, options?: Omit<FillOptions, 'useSelection'>): PaintStrokeResult;
1131
+ /**
1132
+ * Paths › Stroke Path: strokes along the path's outline on a pixel layer (default the active
1133
+ * one), `width` px wide and centred on it. The selection is not changed. One undo step.
1134
+ */
1135
+ strokePath(id: string, options: Omit<StrokeSelectionOptions, 'location'>): PaintStrokeResult;
1136
+ /** Paths › Add Vector Mask: masks a layer (default the active one) with a document path. One undo step. */
1137
+ addVectorMaskFromPath(pathId: string, layerId?: string): VectorMask;
1138
+ /** Runs `fn` with `mask` as the selection, then puts the selection back, all as one undo step. */
1139
+ private withSelection;
1090
1140
  /** Replaces a vector mask's path (its properties are kept). One undo step. Returns the vector mask. */
1091
1141
  setVectorMaskPath(id: string, path: VectorMaskPathInput): VectorMask;
1092
1142
  /** Changes a vector mask's enabled, linked, inverted, density or feather (the path is kept). One undo step. */
@@ -1483,7 +1533,7 @@ export declare class ImageEditorController {
1483
1533
  contentAwareFill(options?: ContentAwareFillOptions): {
1484
1534
  layerId: string;
1485
1535
  bounds: CropBox;
1486
- output: 'current' | 'new-layer';
1536
+ output: ContentAwareFillOutput;
1487
1537
  };
1488
1538
  /**
1489
1539
  * `contentAwareFill` with the synthesis in the selection worker when there is one, with
@@ -1495,7 +1545,7 @@ export declare class ImageEditorController {
1495
1545
  }): Promise<{
1496
1546
  layerId: string;
1497
1547
  bounds: CropBox;
1498
- output: 'current' | 'new-layer';
1548
+ output: ContentAwareFillOutput;
1499
1549
  }>;
1500
1550
  /**
1501
1551
  * The fill without changing anything: the window, its pixels before and after (RGBA, the fill
@@ -1627,6 +1677,12 @@ export declare class ImageEditorController {
1627
1677
  * Returns false when nothing changed.
1628
1678
  */
1629
1679
  setSelection(mask: SelectionMask | null, mode?: SelectionMode): boolean;
1680
+ /**
1681
+ * Shows `mask` in place of the selection while a gesture runs (Quick Selection as the brush
1682
+ * moves; `null` shows nothing selected), or with `undefined` stops. View state only: no undo
1683
+ * step, not saved.
1684
+ */
1685
+ setSelectionPreview(mask: SelectionMask | null | undefined): void;
1630
1686
  /** Select › All. */
1631
1687
  selectAll(): boolean;
1632
1688
  /** Select › Deselect. */