@pixerate/editor 0.188.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.
- package/dist/{chunk-IGMNJM2H.js → chunk-7ZWLDVFH.js} +979 -753
- package/dist/{chunk-JYV4R62M.cjs → chunk-T4U4O6DS.cjs} +1013 -787
- package/dist/image-editor/controller.d.cts +68 -1
- package/dist/image-editor/controller.d.ts +68 -1
- package/dist/image-editor/free-transform.d.cts +3 -6
- package/dist/image-editor/free-transform.d.ts +3 -6
- package/dist/image-editor/index.cjs +1867 -1413
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +869 -415
- package/dist/image-editor/layer-tools.d.cts +1 -1
- package/dist/image-editor/layer-tools.d.ts +1 -1
- package/dist/image-editor/layers/compositor.d.cts +3 -0
- package/dist/image-editor/layers/compositor.d.ts +3 -0
- package/dist/image-editor/layers/model.d.cts +23 -0
- package/dist/image-editor/layers/model.d.ts +23 -0
- package/dist/image-editor/layers/paint-ui.d.cts +2 -1
- package/dist/image-editor/layers/paint-ui.d.ts +2 -1
- package/dist/image-editor/layers/panel.d.cts +14 -3
- package/dist/image-editor/layers/panel.d.ts +14 -3
- package/dist/image-editor/layers/serialize.d.cts +11 -0
- package/dist/image-editor/layers/serialize.d.ts +11 -0
- package/dist/image-editor/layers/shape.d.cts +5 -0
- package/dist/image-editor/layers/shape.d.ts +5 -0
- package/dist/image-editor/layers/vector-mask.d.cts +51 -0
- package/dist/image-editor/layers/vector-mask.d.ts +51 -0
- package/dist/image-editor/psd/import.d.cts +0 -7
- package/dist/image-editor/psd/import.d.ts +0 -7
- package/dist/image-editor/renderer.d.cts +6 -0
- package/dist/image-editor/renderer.d.ts +6 -0
- package/dist/image-editor/selection/gesture.d.cts +10 -0
- package/dist/image-editor/selection/gesture.d.ts +10 -0
- package/dist/image-editor/selection/layer-mask.d.cts +6 -0
- package/dist/image-editor/selection/layer-mask.d.ts +6 -0
- package/dist/image-editor/types.d.cts +8 -0
- package/dist/image-editor/types.d.ts +8 -0
- package/dist/paint-editor/index.cjs +6 -6
- package/dist/paint-editor/index.js +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +7 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +10 -3
|
@@ -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';
|
|
@@ -113,6 +113,8 @@ export interface SelectionCommandOptions {
|
|
|
113
113
|
}
|
|
114
114
|
/** How the canvas shows the selection: marching ants, a Quick Mask tint, or not at all. */
|
|
115
115
|
export type SelectionDisplay = 'ants' | 'quickMask' | 'none';
|
|
116
|
+
/** How a layer mask is shown on the canvas: alone in grey, or as a red tint over the image. */
|
|
117
|
+
export type MaskViewMode = 'gray' | 'overlay';
|
|
116
118
|
/** What `exportMaskImage` writes: the selection, an alpha channel or a layer's painted mask. */
|
|
117
119
|
export type MaskImageSource = 'selection' | {
|
|
118
120
|
channelId: string;
|
|
@@ -207,6 +209,29 @@ export interface CloneSource {
|
|
|
207
209
|
* 'star' | 'line', … }`, see `LiveShape`) or subpaths (`[{ anchors: [{ x, y, in?, out? }],
|
|
208
210
|
* closed }]` or SVG path data), and how it combines with the components below it.
|
|
209
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
|
+
}
|
|
210
235
|
export interface ShapeGeometryInput {
|
|
211
236
|
shape?: LiveShape | Record<string, unknown>;
|
|
212
237
|
subpaths?: VectorSubpath[] | string;
|
|
@@ -886,6 +911,33 @@ export declare class ImageEditorController {
|
|
|
886
911
|
addLayerMask(id: string, from?: 'reveal-all' | 'hide-all' | 'selection' | 'hide-selection' | 'transparency', props?: LayerMaskProps): RasterMask;
|
|
887
912
|
/** Removes a layer's mask (one undo step). */
|
|
888
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;
|
|
889
941
|
/** Changes any layer mask's density, feather, enabled or linked flag (pixels kept). Returns the mask. */
|
|
890
942
|
setLayerMaskProps(id: string, props: LayerMaskProps, commitToHistory?: boolean): RasterMask;
|
|
891
943
|
/**
|
|
@@ -1506,6 +1558,21 @@ export declare class ImageEditorController {
|
|
|
1506
1558
|
* it (the selection still applies). View state: no undo step, not saved.
|
|
1507
1559
|
*/
|
|
1508
1560
|
setSelectionDisplay(display: SelectionDisplay): void;
|
|
1561
|
+
/** The layer mask shown on the canvas, or `null` (see `setMaskView`). */
|
|
1562
|
+
getMaskView(): {
|
|
1563
|
+
layerId: string;
|
|
1564
|
+
mode: MaskViewMode;
|
|
1565
|
+
} | null;
|
|
1566
|
+
/**
|
|
1567
|
+
* Shows a layer's mask on the canvas: `gray` alone in grey (Alt-click the mask thumbnail),
|
|
1568
|
+
* `overlay` as a red tint over what it hides (the \ key), `off` back to the image. The layer
|
|
1569
|
+
* defaults to the active one. View state: no undo step, not saved. Throws when the layer has
|
|
1570
|
+
* no painted mask.
|
|
1571
|
+
*/
|
|
1572
|
+
setMaskView(mode: MaskViewMode | 'off', layerId?: string): {
|
|
1573
|
+
layerId: string;
|
|
1574
|
+
mode: MaskViewMode;
|
|
1575
|
+
} | null;
|
|
1509
1576
|
/** The alpha channels (saved selections), in panel order. */
|
|
1510
1577
|
getChannels(): readonly AlphaChannel[];
|
|
1511
1578
|
getChannel(id: string): AlphaChannel | null;
|
|
@@ -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';
|
|
@@ -113,6 +113,8 @@ export interface SelectionCommandOptions {
|
|
|
113
113
|
}
|
|
114
114
|
/** How the canvas shows the selection: marching ants, a Quick Mask tint, or not at all. */
|
|
115
115
|
export type SelectionDisplay = 'ants' | 'quickMask' | 'none';
|
|
116
|
+
/** How a layer mask is shown on the canvas: alone in grey, or as a red tint over the image. */
|
|
117
|
+
export type MaskViewMode = 'gray' | 'overlay';
|
|
116
118
|
/** What `exportMaskImage` writes: the selection, an alpha channel or a layer's painted mask. */
|
|
117
119
|
export type MaskImageSource = 'selection' | {
|
|
118
120
|
channelId: string;
|
|
@@ -207,6 +209,29 @@ export interface CloneSource {
|
|
|
207
209
|
* 'star' | 'line', … }`, see `LiveShape`) or subpaths (`[{ anchors: [{ x, y, in?, out? }],
|
|
208
210
|
* closed }]` or SVG path data), and how it combines with the components below it.
|
|
209
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
|
+
}
|
|
210
235
|
export interface ShapeGeometryInput {
|
|
211
236
|
shape?: LiveShape | Record<string, unknown>;
|
|
212
237
|
subpaths?: VectorSubpath[] | string;
|
|
@@ -886,6 +911,33 @@ export declare class ImageEditorController {
|
|
|
886
911
|
addLayerMask(id: string, from?: 'reveal-all' | 'hide-all' | 'selection' | 'hide-selection' | 'transparency', props?: LayerMaskProps): RasterMask;
|
|
887
912
|
/** Removes a layer's mask (one undo step). */
|
|
888
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;
|
|
889
941
|
/** Changes any layer mask's density, feather, enabled or linked flag (pixels kept). Returns the mask. */
|
|
890
942
|
setLayerMaskProps(id: string, props: LayerMaskProps, commitToHistory?: boolean): RasterMask;
|
|
891
943
|
/**
|
|
@@ -1506,6 +1558,21 @@ export declare class ImageEditorController {
|
|
|
1506
1558
|
* it (the selection still applies). View state: no undo step, not saved.
|
|
1507
1559
|
*/
|
|
1508
1560
|
setSelectionDisplay(display: SelectionDisplay): void;
|
|
1561
|
+
/** The layer mask shown on the canvas, or `null` (see `setMaskView`). */
|
|
1562
|
+
getMaskView(): {
|
|
1563
|
+
layerId: string;
|
|
1564
|
+
mode: MaskViewMode;
|
|
1565
|
+
} | null;
|
|
1566
|
+
/**
|
|
1567
|
+
* Shows a layer's mask on the canvas: `gray` alone in grey (Alt-click the mask thumbnail),
|
|
1568
|
+
* `overlay` as a red tint over what it hides (the \ key), `off` back to the image. The layer
|
|
1569
|
+
* defaults to the active one. View state: no undo step, not saved. Throws when the layer has
|
|
1570
|
+
* no painted mask.
|
|
1571
|
+
*/
|
|
1572
|
+
setMaskView(mode: MaskViewMode | 'off', layerId?: string): {
|
|
1573
|
+
layerId: string;
|
|
1574
|
+
mode: MaskViewMode;
|
|
1575
|
+
} | null;
|
|
1509
1576
|
/** The alpha channels (saved selections), in panel order. */
|
|
1510
1577
|
getChannels(): readonly AlphaChannel[];
|
|
1511
1578
|
getChannel(id: string): AlphaChannel | null;
|
|
@@ -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
|