@pixerate/editor 0.215.0 → 0.217.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,5 +1,7 @@
1
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 InspectMaskEdgeOptions, type MaskEdgeReport } from './selection/inspect.cjs';
3
+ import { type CompareSelectionsOptions, type SelectionDiff } from './selection/diff.cjs';
4
+ import { type SelectionUncertainty, type SelectionUncertaintyOptions } from './selection/uncertainty.cjs';
3
5
  import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.cjs';
4
6
  import { type MagneticEdgeOptions } from './selection/magnetic.cjs';
5
7
  import type { ObjectTarget } from './selection/segment/grabcut.cjs';
@@ -283,6 +285,22 @@ export interface CloneSource {
283
285
  /** A vector mask's path: several `components`, or one `shape` / `subpaths` (with `op`). */
284
286
  /** What `inspectMaskEdge` reads: the selection, a layer's painted mask or its vector mask. */
285
287
  export type MaskEdgeTarget = 'selection' | 'layer-mask' | 'vector-mask';
288
+ /** A selection `compareSelections` reads (see `selectionFrom`). */
289
+ export type SelectionSource = {
290
+ kind: 'selection';
291
+ } | {
292
+ kind: 'history';
293
+ steps?: number;
294
+ } | {
295
+ kind: 'channel';
296
+ channelId: string;
297
+ } | {
298
+ kind: 'layer-mask';
299
+ layerId: string;
300
+ } | {
301
+ kind: 'vector-mask';
302
+ layerId: string;
303
+ };
286
304
  /** A layer's edge colour as `getEdgeColor` describes it (percentages). */
287
305
  export interface EdgeColorInfo {
288
306
  layerId: string;
@@ -1876,6 +1894,8 @@ export declare class ImageEditorController {
1876
1894
  decontaminate?: number;
1877
1895
  edits?: RefineEdit[];
1878
1896
  refineMode?: 'color' | 'object';
1897
+ /** Refine only inside these rectangles (e.g. `selectionUncertainty().regions`); the rest stays as it was. */
1898
+ regions?: CropBox[];
1879
1899
  signal?: AbortSignal;
1880
1900
  }): Promise<RefineOutputResult>;
1881
1901
  /**
@@ -2054,6 +2074,31 @@ export declare class ImageEditorController {
2054
2074
  target: MaskEdgeTarget;
2055
2075
  layerId?: string;
2056
2076
  };
2077
+ /** Whole-pixel rectangles inside the canvas, or a useful error; undefined stays undefined. */
2078
+ private checkRegions;
2079
+ /**
2080
+ * Where the selection is unsure of itself: the stretches of its edge with no image edge under
2081
+ * them, widened into a band (a trimap's unknown), as a mask and regions with bounds and
2082
+ * confidence, least confident first. Measured against the composite. Read-only; an empty
2083
+ * selection has none.
2084
+ */
2085
+ selectionUncertainty(options?: SelectionUncertaintyOptions): SelectionUncertainty;
2086
+ /**
2087
+ * A selection to compare (`compareSelections`): the current one, the one `steps` undo steps
2088
+ * ago, a saved channel, or a layer's painted or vector mask. `null` is nothing selected.
2089
+ */
2090
+ selectionFrom(source: SelectionSource): SelectionMask | null;
2091
+ /**
2092
+ * What changed from selection `a` (default: before the last undo step) to `b` (default: the
2093
+ * current selection): added and removed area with their largest pieces, IoU and the coverage
2094
+ * change. With `show` (default true) the canvas tints added area green and removed red until the
2095
+ * selection next changes (view state, no undo step). Read-only otherwise.
2096
+ */
2097
+ compareSelections(a?: SelectionSource, b?: SelectionSource, options?: CompareSelectionsOptions & {
2098
+ show?: boolean;
2099
+ }): SelectionDiff;
2100
+ /** Hides the `compareSelections` overlay. */
2101
+ clearSelectionDiff(): void;
2057
2102
  /** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
2058
2103
  private layerMaskCoverage;
2059
2104
  /**
@@ -1,5 +1,7 @@
1
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 InspectMaskEdgeOptions, type MaskEdgeReport } from './selection/inspect.js';
3
+ import { type CompareSelectionsOptions, type SelectionDiff } from './selection/diff.js';
4
+ import { type SelectionUncertainty, type SelectionUncertaintyOptions } from './selection/uncertainty.js';
3
5
  import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.js';
4
6
  import { type MagneticEdgeOptions } from './selection/magnetic.js';
5
7
  import type { ObjectTarget } from './selection/segment/grabcut.js';
@@ -283,6 +285,22 @@ export interface CloneSource {
283
285
  /** A vector mask's path: several `components`, or one `shape` / `subpaths` (with `op`). */
284
286
  /** What `inspectMaskEdge` reads: the selection, a layer's painted mask or its vector mask. */
285
287
  export type MaskEdgeTarget = 'selection' | 'layer-mask' | 'vector-mask';
288
+ /** A selection `compareSelections` reads (see `selectionFrom`). */
289
+ export type SelectionSource = {
290
+ kind: 'selection';
291
+ } | {
292
+ kind: 'history';
293
+ steps?: number;
294
+ } | {
295
+ kind: 'channel';
296
+ channelId: string;
297
+ } | {
298
+ kind: 'layer-mask';
299
+ layerId: string;
300
+ } | {
301
+ kind: 'vector-mask';
302
+ layerId: string;
303
+ };
286
304
  /** A layer's edge colour as `getEdgeColor` describes it (percentages). */
287
305
  export interface EdgeColorInfo {
288
306
  layerId: string;
@@ -1876,6 +1894,8 @@ export declare class ImageEditorController {
1876
1894
  decontaminate?: number;
1877
1895
  edits?: RefineEdit[];
1878
1896
  refineMode?: 'color' | 'object';
1897
+ /** Refine only inside these rectangles (e.g. `selectionUncertainty().regions`); the rest stays as it was. */
1898
+ regions?: CropBox[];
1879
1899
  signal?: AbortSignal;
1880
1900
  }): Promise<RefineOutputResult>;
1881
1901
  /**
@@ -2054,6 +2074,31 @@ export declare class ImageEditorController {
2054
2074
  target: MaskEdgeTarget;
2055
2075
  layerId?: string;
2056
2076
  };
2077
+ /** Whole-pixel rectangles inside the canvas, or a useful error; undefined stays undefined. */
2078
+ private checkRegions;
2079
+ /**
2080
+ * Where the selection is unsure of itself: the stretches of its edge with no image edge under
2081
+ * them, widened into a band (a trimap's unknown), as a mask and regions with bounds and
2082
+ * confidence, least confident first. Measured against the composite. Read-only; an empty
2083
+ * selection has none.
2084
+ */
2085
+ selectionUncertainty(options?: SelectionUncertaintyOptions): SelectionUncertainty;
2086
+ /**
2087
+ * A selection to compare (`compareSelections`): the current one, the one `steps` undo steps
2088
+ * ago, a saved channel, or a layer's painted or vector mask. `null` is nothing selected.
2089
+ */
2090
+ selectionFrom(source: SelectionSource): SelectionMask | null;
2091
+ /**
2092
+ * What changed from selection `a` (default: before the last undo step) to `b` (default: the
2093
+ * current selection): added and removed area with their largest pieces, IoU and the coverage
2094
+ * change. With `show` (default true) the canvas tints added area green and removed red until the
2095
+ * selection next changes (view state, no undo step). Read-only otherwise.
2096
+ */
2097
+ compareSelections(a?: SelectionSource, b?: SelectionSource, options?: CompareSelectionsOptions & {
2098
+ show?: boolean;
2099
+ }): SelectionDiff;
2100
+ /** Hides the `compareSelections` overlay. */
2101
+ clearSelectionDiff(): void;
2057
2102
  /** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
2058
2103
  private layerMaskCoverage;
2059
2104
  /**