@pixerate/editor 0.208.0 → 0.209.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.
@@ -1,4 +1,4 @@
1
- import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState } from './types.cjs';
1
+ import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState, DocumentOpener } from './types.cjs';
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';
@@ -168,7 +168,7 @@ export interface FocusAreaCommandOptions extends FocusAreaOptions {
168
168
  sampleAllLayers?: boolean;
169
169
  }
170
170
  /** Where Select and Mask puts its result (Photoshop's Output To). */
171
- export type RefineOutput = 'selection' | 'layer-mask' | 'new-layer' | 'new-layer-with-mask';
171
+ export type RefineOutput = 'selection' | 'layer-mask' | 'new-layer' | 'new-layer-with-mask' | 'new-document' | 'new-document-with-mask';
172
172
  /** What {@link ImageEditorController.refineSelectionTo} made. */
173
173
  export interface RefineOutputResult {
174
174
  output: RefineOutput;
@@ -176,6 +176,8 @@ export interface RefineOutputResult {
176
176
  layerId?: string;
177
177
  /** The layer it made (`new-layer`, `new-layer-with-mask`). */
178
178
  newLayerId?: string;
179
+ /** The id the host's document opener returned (`new-document`, `new-document-with-mask`). */
180
+ documentId?: string;
179
181
  /** How the edge was refined: by colour, or with the segmentation model (object aware). */
180
182
  refineMode: 'color' | 'object';
181
183
  }
@@ -691,6 +693,7 @@ export declare class ImageEditorController {
691
693
  /** The segmentation provider behind `selectSubject` (see `setSegmentationProvider`). */
692
694
  private segmentation;
693
695
  private selectionWorker;
696
+ private documentOpener;
694
697
  /** The effects provider slot (see `setEffectsProvider`). */
695
698
  readonly effects: EffectsSlot;
696
699
  /** Renders provider effects: effect smart filter results and effect layers. */
@@ -726,6 +729,24 @@ export declare class ImageEditorController {
726
729
  * A worker that is cancelled or fails is replaced by a fresh one on the next job.
727
730
  */
728
731
  setSelectionWorker(factory: SelectionWorkerFactory | null): void;
732
+ /** Sets (or with `null` removes) how new documents are opened (see `DocumentOpener`). Not an edit. */
733
+ setDocumentOpener(opener: DocumentOpener | null): void;
734
+ /** Whether the host can open new documents (the New Document outputs are available). */
735
+ get canOpenDocuments(): boolean;
736
+ /**
737
+ * A new one-layer document from the selection (or `options.selection`) on a pixel layer
738
+ * (`layerId`, default the active one), the size of this image: the selected pixels on
739
+ * transparency, or with `withMask` the whole layer masked by the selection. This document is
740
+ * not changed. `decontaminate` (0..100) cleans the soft edge's colours as the new-layer
741
+ * outputs do.
742
+ */
743
+ documentFromSelection(options?: {
744
+ layerId?: string;
745
+ withMask?: boolean;
746
+ selection?: SelectionMask | null;
747
+ decontaminate?: number;
748
+ radius?: number;
749
+ }): SerializedLayeredImageEditorState;
729
750
  /** Whether the long selections run in a worker. */
730
751
  get hasSelectionWorker(): boolean;
731
752
  /**
@@ -1696,6 +1717,8 @@ export declare class ImageEditorController {
1696
1717
  * its alpha.
1697
1718
  */
1698
1719
  private decontaminateLayer;
1720
+ /** `layer`'s surface with Decontaminate Colors applied along `coverage`'s soft edge, colours read from `source`. */
1721
+ private decontaminatedSurface;
1699
1722
  /**
1700
1723
  * Loads a selection from a mask image (an AI segmentation, a saved mask): a data URL / URL or
1701
1724
  * RGBA pixels, by luminance (white = selected) or a channel. Any size; it is resampled.
@@ -1,4 +1,4 @@
1
- import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState } from './types.js';
1
+ import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, CreateAnnotationPayload, AspectRatio, CropBox, DepthMaskOptions, ExportOptions, ImageAdjustments, ImageDimensions, ImageEditorFit, ImageEditorOptions, ImageEditorState, ImageEditorTool, ImageTransform, ImagePoint, SerializedImageEditorState, DocumentOpener } from './types.js';
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';
@@ -168,7 +168,7 @@ export interface FocusAreaCommandOptions extends FocusAreaOptions {
168
168
  sampleAllLayers?: boolean;
169
169
  }
170
170
  /** Where Select and Mask puts its result (Photoshop's Output To). */
171
- export type RefineOutput = 'selection' | 'layer-mask' | 'new-layer' | 'new-layer-with-mask';
171
+ export type RefineOutput = 'selection' | 'layer-mask' | 'new-layer' | 'new-layer-with-mask' | 'new-document' | 'new-document-with-mask';
172
172
  /** What {@link ImageEditorController.refineSelectionTo} made. */
173
173
  export interface RefineOutputResult {
174
174
  output: RefineOutput;
@@ -176,6 +176,8 @@ export interface RefineOutputResult {
176
176
  layerId?: string;
177
177
  /** The layer it made (`new-layer`, `new-layer-with-mask`). */
178
178
  newLayerId?: string;
179
+ /** The id the host's document opener returned (`new-document`, `new-document-with-mask`). */
180
+ documentId?: string;
179
181
  /** How the edge was refined: by colour, or with the segmentation model (object aware). */
180
182
  refineMode: 'color' | 'object';
181
183
  }
@@ -691,6 +693,7 @@ export declare class ImageEditorController {
691
693
  /** The segmentation provider behind `selectSubject` (see `setSegmentationProvider`). */
692
694
  private segmentation;
693
695
  private selectionWorker;
696
+ private documentOpener;
694
697
  /** The effects provider slot (see `setEffectsProvider`). */
695
698
  readonly effects: EffectsSlot;
696
699
  /** Renders provider effects: effect smart filter results and effect layers. */
@@ -726,6 +729,24 @@ export declare class ImageEditorController {
726
729
  * A worker that is cancelled or fails is replaced by a fresh one on the next job.
727
730
  */
728
731
  setSelectionWorker(factory: SelectionWorkerFactory | null): void;
732
+ /** Sets (or with `null` removes) how new documents are opened (see `DocumentOpener`). Not an edit. */
733
+ setDocumentOpener(opener: DocumentOpener | null): void;
734
+ /** Whether the host can open new documents (the New Document outputs are available). */
735
+ get canOpenDocuments(): boolean;
736
+ /**
737
+ * A new one-layer document from the selection (or `options.selection`) on a pixel layer
738
+ * (`layerId`, default the active one), the size of this image: the selected pixels on
739
+ * transparency, or with `withMask` the whole layer masked by the selection. This document is
740
+ * not changed. `decontaminate` (0..100) cleans the soft edge's colours as the new-layer
741
+ * outputs do.
742
+ */
743
+ documentFromSelection(options?: {
744
+ layerId?: string;
745
+ withMask?: boolean;
746
+ selection?: SelectionMask | null;
747
+ decontaminate?: number;
748
+ radius?: number;
749
+ }): SerializedLayeredImageEditorState;
729
750
  /** Whether the long selections run in a worker. */
730
751
  get hasSelectionWorker(): boolean;
731
752
  /**
@@ -1696,6 +1717,8 @@ export declare class ImageEditorController {
1696
1717
  * its alpha.
1697
1718
  */
1698
1719
  private decontaminateLayer;
1720
+ /** `layer`'s surface with Decontaminate Colors applied along `coverage`'s soft edge, colours read from `source`. */
1721
+ private decontaminatedSurface;
1699
1722
  /**
1700
1723
  * Loads a selection from a mask image (an AI segmentation, a saved mask): a data URL / URL or
1701
1724
  * RGBA pixels, by luminance (white = selected) or a channel. Any size; it is resampled.