@pixerate/editor 0.209.0 → 0.211.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-QE7D7TZR.cjs → chunk-H65IBXFI.cjs} +74 -25
- package/dist/{chunk-X4LUGTQX.cjs → chunk-L52VMQZS.cjs} +21 -10
- package/dist/{chunk-DWYQPL2A.js → chunk-LQ5SALHK.js} +13 -2
- package/dist/chunk-MQDIP4CF.cjs +462 -0
- package/dist/{chunk-KFIOEOCQ.js → chunk-W3TOZTL7.js} +55 -6
- package/dist/chunk-XI2NV5U7.js +462 -0
- package/dist/{chunk-3EHPLDFQ.cjs → chunk-YF3YZZ6G.cjs} +16 -453
- package/dist/{chunk-USQCKRZG.js → chunk-ZGJGSCUW.js} +8 -445
- package/dist/image-editor/content-aware-fill-session.d.cts +109 -0
- package/dist/image-editor/content-aware-fill-session.d.ts +109 -0
- package/dist/image-editor/controller.d.cts +111 -1
- package/dist/image-editor/controller.d.ts +111 -1
- package/dist/image-editor/index.cjs +1879 -1052
- package/dist/image-editor/index.d.cts +2 -0
- package/dist/image-editor/index.d.ts +2 -0
- package/dist/image-editor/index.js +869 -42
- package/dist/image-editor/layers/serialize.d.cts +5 -8
- package/dist/image-editor/layers/serialize.d.ts +5 -8
- package/dist/image-editor/paths.d.cts +41 -0
- package/dist/image-editor/paths.d.ts +41 -0
- package/dist/image-editor/psd/export.d.cts +8 -1
- package/dist/image-editor/psd/export.d.ts +8 -1
- package/dist/image-editor/psd/import.d.cts +7 -0
- package/dist/image-editor/psd/import.d.ts +7 -0
- package/dist/image-editor/psd/paths.d.cts +11 -0
- package/dist/image-editor/psd/paths.d.ts +11 -0
- package/dist/image-editor/selection/gesture.d.cts +10 -2
- package/dist/image-editor/selection/gesture.d.ts +10 -2
- package/dist/image-editor/selection/select-and-mask.d.cts +5 -0
- package/dist/image-editor/selection/select-and-mask.d.ts +5 -0
- package/dist/image-editor/selection/worker.d.cts +10 -0
- package/dist/image-editor/selection/worker.d.ts +10 -0
- package/dist/image-editor/selection-worker.cjs +4 -3
- package/dist/image-editor/selection-worker.js +2 -1
- package/dist/image-editor/types.d.cts +12 -0
- package/dist/image-editor/types.d.ts +12 -0
- package/dist/paint/heal.d.cts +3 -1
- package/dist/paint/heal.d.ts +3 -1
- package/dist/paint/index.cjs +4 -2
- package/dist/paint/index.js +10 -8
- 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 +20 -22
- package/skills/pixerate-image-editor/references/layer-effects.md +24 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +2 -1
package/dist/paint/index.js
CHANGED
|
@@ -10,33 +10,35 @@ import {
|
|
|
10
10
|
TransformedPixelSource,
|
|
11
11
|
applyRetouchToTile,
|
|
12
12
|
applyToneToDeepTile,
|
|
13
|
-
bestOffset,
|
|
14
13
|
boxBlurPixels,
|
|
15
14
|
cloneSamplePoint,
|
|
16
|
-
contentAwareFill,
|
|
17
|
-
dilateMask,
|
|
18
15
|
dodgeBurn,
|
|
19
16
|
dodgeBurnCurve,
|
|
20
17
|
healPixels,
|
|
21
18
|
isIdentityCloneTransform,
|
|
22
19
|
luma,
|
|
23
|
-
maskBounds,
|
|
24
|
-
membraneFill,
|
|
25
20
|
normalizeRetouch,
|
|
26
21
|
perDabStrength,
|
|
27
22
|
readSourceRegion,
|
|
28
23
|
retouchFilter,
|
|
29
24
|
rgbaViewOfGrey,
|
|
30
25
|
saturationOf,
|
|
31
|
-
seamlessClone,
|
|
32
26
|
smudgeEffect,
|
|
33
|
-
solveMembrane,
|
|
34
27
|
sponge,
|
|
35
28
|
spongeEffect,
|
|
36
29
|
spotHealPixels,
|
|
37
30
|
spotHealWindow,
|
|
38
31
|
toneOf
|
|
39
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-ZGJGSCUW.js";
|
|
33
|
+
import {
|
|
34
|
+
bestOffset,
|
|
35
|
+
contentAwareFill,
|
|
36
|
+
dilateMask,
|
|
37
|
+
maskBounds,
|
|
38
|
+
membraneFill,
|
|
39
|
+
seamlessClone,
|
|
40
|
+
solveMembrane
|
|
41
|
+
} from "../chunk-XI2NV5U7.js";
|
|
40
42
|
import {
|
|
41
43
|
BODY_SCATTER,
|
|
42
44
|
DEFAULT_FLOW,
|
|
@@ -7,7 +7,7 @@ var _chunkZ64NRDEHcjs = require('../chunk-Z64NRDEH.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkH65IBXFIcjs = require('../chunk-H65IBXFI.cjs');
|
|
11
11
|
require('../chunk-A2IS7EHE.cjs');
|
|
12
12
|
require('../chunk-QYLWG22N.cjs');
|
|
13
13
|
|
|
@@ -1657,11 +1657,11 @@ function header(state, options) {
|
|
|
1657
1657
|
return out;
|
|
1658
1658
|
}
|
|
1659
1659
|
function serializePaintDocument(state, options = {}) {
|
|
1660
|
-
const { layers, assets } =
|
|
1660
|
+
const { layers, assets } = _chunkH65IBXFIcjs.serializeLayers.call(void 0, state.layers);
|
|
1661
1661
|
return { ...header(state, options), layers, assets };
|
|
1662
1662
|
}
|
|
1663
1663
|
async function serializePaintDocumentExternal(state, store, options = {}) {
|
|
1664
|
-
const { layers, assets } = await
|
|
1664
|
+
const { layers, assets } = await _chunkH65IBXFIcjs.serializeLayersExternal.call(void 0, state.layers, store);
|
|
1665
1665
|
return { ...header(state, options), layers, assets };
|
|
1666
1666
|
}
|
|
1667
1667
|
function paintLayersOnly(layers, problems) {
|
|
@@ -1698,7 +1698,7 @@ function deserializePaintDocument(raw) {
|
|
|
1698
1698
|
const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
|
|
1699
1699
|
const paper = _chunkROVK6AXXcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
|
|
1700
1700
|
const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
|
|
1701
|
-
const layers = paintLayersOnly(
|
|
1701
|
+
const layers = paintLayersOnly(_chunkH65IBXFIcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
|
|
1702
1702
|
const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
|
|
1703
1703
|
const activeLayerId = wanted && _chunkUOGKSVRQcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkUOGKSVRQcjs.flattenLayers.call(void 0, layers), 'access', _70 => _70.filter, 'call', _71 => _71((l) => l.type === "pixel"), 'access', _72 => _72.pop, 'call', _73 => _73(), 'optionalAccess', _74 => _74.id]), () => ( null));
|
|
1704
1704
|
const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
|
|
@@ -1714,7 +1714,7 @@ async function deserializePaintDocumentAsync(raw, store) {
|
|
|
1714
1714
|
if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
|
|
1715
1715
|
const r = raw;
|
|
1716
1716
|
const problems = [];
|
|
1717
|
-
const assets = await
|
|
1717
|
+
const assets = await _chunkH65IBXFIcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
|
|
1718
1718
|
const loaded = deserializePaintDocument({ ...r, assets });
|
|
1719
1719
|
return { ...loaded, problems: [...problems, ...loaded.problems] };
|
|
1720
1720
|
}
|
|
@@ -5413,7 +5413,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5413
5413
|
return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
|
|
5414
5414
|
});
|
|
5415
5415
|
const layers = toStandard(dried);
|
|
5416
|
-
const result =
|
|
5416
|
+
const result = _chunkH65IBXFIcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
5417
5417
|
for (const [mode, names] of changed) {
|
|
5418
5418
|
const label = _nullishCoalesce(_optionalChain([_chunkOLNIPTB3cjs.BLEND_MODES, 'access', _271 => _271.find, 'call', _272 => _272((m) => m.id === mode), 'optionalAccess', _273 => _273.label]), () => ( mode));
|
|
5419
5419
|
const std = _nullishCoalesce(_optionalChain([_chunkOLNIPTB3cjs.BLEND_MODES, 'access', _274 => _274.find, 'call', _275 => _275((m) => m.id === _chunkOLNIPTB3cjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _276 => _276.label]), () => ( _chunkOLNIPTB3cjs.standardBlendMode.call(void 0, mode)));
|
package/package.json
CHANGED
|
@@ -96,25 +96,13 @@ drawing or editing either.
|
|
|
96
96
|
|
|
97
97
|
### Layer effects
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
for provider effects (effect layers and filters), so say "layer style" when you tell the user
|
|
107
|
-
where a drop shadow or stroke lives.
|
|
108
|
-
2. **Keep the ids**: `add_layer_effect` returns `effectId`; `update_layer_effect` and
|
|
109
|
-
`remove_layer_effect` need it. `list_layers` shows which layers have effects (ids and kinds
|
|
110
|
-
only).
|
|
111
|
-
3. **Light consistently**: shadows and bevels follow the document's global light while
|
|
112
|
-
`useGlobalLight` is true (the default). Change the light for all of them with
|
|
113
|
-
`set_global_light`; give one effect its own `angle` only when it must differ.
|
|
114
|
-
4. **Compare and size as a whole**: `set_layer_effects_enabled` with `enabled: false` hides
|
|
115
|
-
every effect of a layer (each keeps its own `enabled`); `scale` resizes them all (Scale
|
|
116
|
-
Effects), e.g. after resizing a layer's content.
|
|
117
|
-
5. **Look after each change**: `render_preview` (with `layerId` for one layer alone).
|
|
99
|
+
Live per-layer effects (shadows, glows, bevel, overlays, strokes): see `references/layer-effects.md`.
|
|
100
|
+
|
|
101
|
+
### Paths
|
|
102
|
+
|
|
103
|
+
1. **Keep outlines as paths**: `make_work_path` turns the selection into the Work Path (the next
|
|
104
|
+
one replaces it; `rename_path` saves it), `add_path` adds one from geometry.
|
|
105
|
+
2. **Use them**: `path_to_selection` / `add_vector_mask` with `pathId`, `fill_path`, `stroke_path`.
|
|
118
106
|
|
|
119
107
|
### Painting
|
|
120
108
|
|
|
@@ -320,13 +308,23 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
320
308
|
| `remove_shape_component` | Delete one component (not the last: delete the layer instead). Returns the shape. |
|
|
321
309
|
| `merge_shape_components` | Merge Shape Components: the combined area becomes one plain component (live shapes become paths); the look does not change. Returns the shape. |
|
|
322
310
|
| `get_vector_mask` | Read-only. A layer's vector mask: enabled, linked, inverted, fill rule, density, feather, bounds and components (subpaths in document px), or null. Read it before editing the path. |
|
|
323
|
-
| `add_vector_mask` | Layer › Vector Mask on any layer but a shape: `from` `path` (a `shape`, `subpaths` or `components`, like `add_shape_layer`), `selection` (traced, `tolerance` px), `reveal-all` or `hide-all` (empty path). Reveals inside the path, sharp at any size; it combines with the raster mask. Returns the vector mask. |
|
|
311
|
+
| `add_vector_mask` | Layer › Vector Mask on any layer but a shape: `from` `path` (a `shape`, `subpaths` or `components`, like `add_shape_layer`, or a document path's `pathId`), `selection` (traced, `tolerance` px), `reveal-all` or `hide-all` (empty path). Reveals inside the path, sharp at any size; it combines with the raster mask. Returns the vector mask. |
|
|
324
312
|
| `set_vector_mask_path` | Replace the vector mask's path (properties kept). Returns the vector mask. |
|
|
325
313
|
| `set_vector_mask_properties` | `enabled`, `linked` (false: stays put when the layer moves), `inverted`, `density`, `feather` px; the path is kept. Returns the vector mask. |
|
|
326
314
|
| `rasterize_vector_mask` | Multiply the path into the raster mask (adding one) and drop the vector mask, so it can be painted. Returns the mask summary. |
|
|
327
315
|
| `remove_vector_mask` | Delete the vector mask (the raster mask stays). |
|
|
328
316
|
| `selection_to_path` | Read-only. Make Work Path: the selection's outline as closed Bézier subpaths (`tolerance` px, `cornerRoundness`, `minArea`); returns `svg` and `fillRule: "evenodd"` to pass to `add_vector_mask`, `set_vector_mask_path` or `add_shape_layer`. |
|
|
329
|
-
| `path_to_selection` | Make Selection: fill a path (`shape`, `subpaths`, `components`) into the selection by `mode`, with `feather` and `antiAlias`. Returns the selection. |
|
|
317
|
+
| `path_to_selection` | Make Selection: fill a path (`shape`, `subpaths`, `components`, or a document path's `pathId`) into the selection by `mode`, with `feather` and `antiAlias`. Returns the selection. |
|
|
318
|
+
| `list_paths` | Paths panel: saved paths and the Work Path (`work: true`) with ids, names, anchor counts and bounds. Read before the other path tools. |
|
|
319
|
+
| `get_path` | One document path: summary, `svg` and `components` (anchors with handles) to edit and pass to `set_path_geometry`. |
|
|
320
|
+
| `make_work_path` | Paths › Make Work Path: trace the selection into the Work Path (replacing the last one); `tolerance` px. Returns the path. |
|
|
321
|
+
| `add_path` | A saved path from `shape`, `subpaths` (or SVG data) or `components`, with `name`. Returns the path. |
|
|
322
|
+
| `set_path_geometry` | Replace a path's geometry (name kept). Returns the path. |
|
|
323
|
+
| `rename_path` | Rename a path; renaming the Work Path saves it. Returns the path. |
|
|
324
|
+
| `duplicate_path` | Copy a path as a saved path. Returns the copy. |
|
|
325
|
+
| `delete_path` | Delete a path (undo brings it back). Returns the remaining paths. |
|
|
326
|
+
| `fill_path` | Paths › Fill Path: fill a path's area on a pixel layer (`layerId`, `color`, `opacity`); the selection is untouched. |
|
|
327
|
+
| `stroke_path` | Paths › Stroke Path: stroke along a path, `width` px centred, on a pixel layer; the selection is untouched. |
|
|
330
328
|
| `convert_to_smart_object` | Convert sibling `layerIds` (default the active layer) to one smart object at the top one's position, optional `name`. One pixel layer keeps its id, look and properties (filters become smart filters); several layers, groups or adjustments nest as a layer document. Returns the `layer` and the `smartObject` summary. |
|
|
331
329
|
| `rasterize_smart_object` | Turn a smart object into a pixel layer holding what it shows now (smart filters baked; same id, mask, effects, opacity, blend). Destructive: the contents and filters are gone. Returns the layer. |
|
|
332
330
|
| `set_smart_object_transform` | Set a smart object's transform absolutely: `corners`, `matrix` (contents → document), or `scaleX` / `scaleY` (percent of the contents), `rotate`, `skewX`, `skewY`, `x`, `y` (where the contents' centre goes; unset numbers keep their values); `warp` preset or mesh in contents px, `null` removes it; `interpolation`. Re-renders from the contents. Returns `placement`, `masksMoved` and `bounds`. |
|
|
@@ -386,7 +384,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
|
|
|
386
384
|
| `apply_selection_as_mask` | Mask a layer with the current selection: pass `layerId` to mask an existing layer, or `kind` (plus optional `params`) to create a new masked layer in one step. `density` 0..1 and `feather` px soften the mask non-destructively. Returns `layerId`, kind, mask info and the selection summary. |
|
|
387
385
|
| `stroke_selection` | Edit › Stroke: a band `width` px (≤ 250) `outside` (default), `inside` or `center` on the selection edge, with `color`, `opacity`, `blend`, on a layer's pixels or mask (`channel`). One undo step. Returns the changed `bounds`. |
|
|
388
386
|
| `crop_to_selection` | Set the crop box to the selection's bounds (non-destructive; `reset_crop` undoes it). Returns the `crop`. |
|
|
389
|
-
| `content_aware_fill` | Remove what is selected by synthesising texture from around it on a pixel layer; `output` `new-layer` (keeps the fill separate, recommended) or `current`; `sampleRadius`, `seed` (another seed, another fill). Select with a 2–4 px margin. 8-bit only. Returns `layerId` and `bounds`. |
|
|
387
|
+
| `content_aware_fill` | Remove what is selected by synthesising texture from around it on a pixel layer; `output` `new-layer` (keeps the fill separate, recommended) or `current`; `sampleRadius`, `seed` (another seed, another fill); the sampling area with `sampleRects`, `samplingChannelId` and `excludeRects` (never copy from these). Select with a 2–4 px margin. 8-bit only. Returns `layerId` and `bounds`. |
|
|
390
388
|
| `copy_pixels` | Copy the selected pixels of a layer (or with `merged` the visible image) to the editor clipboard, cropped to the selection with its soft edge. No undo step. Returns `width`, `height`, `x`, `y`. |
|
|
391
389
|
| `cut_pixels` | Copy, then clear the selected pixels (one undo step). Returns the size and position. |
|
|
392
390
|
| `paste_pixels` | Paste the clipboard as a new layer: `mode` `new-layer` (centred on the selection or canvas), `in-place`, `into` (masked by the selection) or `outside` (masked by its inverse). One undo step. Returns `layerId`, `bounds`, `masked`. |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Layer effects: drop shadows, glows, bevels, overlays and strokes
|
|
2
|
+
|
|
3
|
+
Read this before `add_layer_effect`, `update_layer_effect`, `set_global_light` or
|
|
4
|
+
`set_layer_effects_enabled`.
|
|
5
|
+
|
|
6
|
+
1. **Effects are live and per layer**: drop and inner shadows, outer and inner glows,
|
|
7
|
+
bevel & emboss, satin, colour / gradient / pattern overlays and strokes go on pixel,
|
|
8
|
+
annotation and group layers (not adjustment layers) and follow the layer's pixels as they
|
|
9
|
+
change. Add them with `add_layer_effect` (`kind` plus only the `settings` that differ from
|
|
10
|
+
Photoshop's defaults), tune them with `update_layer_effect` and read them back with
|
|
11
|
+
`list_layer_effects`. Each call is one undo step and returns the layer's effects. In the UI
|
|
12
|
+
they are the **Layer Style** section of **Layer Properties**; the separate **Effects** panel is
|
|
13
|
+
for provider effects (effect layers and filters), so say "layer style" when you tell the user
|
|
14
|
+
where a drop shadow or stroke lives.
|
|
15
|
+
2. **Keep the ids**: `add_layer_effect` returns `effectId`; `update_layer_effect` and
|
|
16
|
+
`remove_layer_effect` need it. `list_layers` shows which layers have effects (ids and kinds
|
|
17
|
+
only).
|
|
18
|
+
3. **Light consistently**: shadows and bevels follow the document's global light while
|
|
19
|
+
`useGlobalLight` is true (the default). Change the light for all of them with
|
|
20
|
+
`set_global_light`; give one effect its own `angle` only when it must differ.
|
|
21
|
+
4. **Compare and size as a whole**: `set_layer_effects_enabled` with `enabled: false` hides
|
|
22
|
+
every effect of a layer (each keeps its own `enabled`); `scale` resizes them all (Scale
|
|
23
|
+
Effects), e.g. after resizing a layer's content.
|
|
24
|
+
5. **Look after each change**: `render_preview` (with `layerId` for one layer alone).
|
|
@@ -151,7 +151,8 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
|
|
|
151
151
|
`set_layer_properties`; no selection is needed.
|
|
152
152
|
- **Remove an object:** select it with a 2–4 px margin (`modify_selection` `expand`), then
|
|
153
153
|
`content_aware_fill` `output: "new-layer"`; try another `seed` if the fill repeats texture,
|
|
154
|
-
and mask out what is wrong.
|
|
154
|
+
and mask out what is wrong. If it copies in something it shouldn't (a person, a sign), pass
|
|
155
|
+
`excludeRects` over that, or `sampleRects` over the background it should continue.
|
|
155
156
|
- **Outline a cutout:** `select_layer_transparency` on it, then `stroke_selection`
|
|
156
157
|
`location: "outside"` on a new layer below it.
|
|
157
158
|
- **Crop to a subject:** select it, then `crop_to_selection` (non-destructive).
|