@pixerate/editor 0.132.0 → 0.134.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/animation-editor/index.cjs +55 -55
- package/dist/animation-editor/index.d.cts +4 -4
- package/dist/animation-editor/index.d.ts +4 -4
- package/dist/animation-editor/index.js +2 -2
- package/dist/{bezier-oCBfrGDG.d.cts → bezier-J8i4uqSH.d.cts} +1 -1
- package/dist/{bezier-0IHDCvv_.d.ts → bezier-lNEOp0Jx.d.ts} +1 -1
- package/dist/canvas/index.d.cts +7 -7
- package/dist/canvas/index.d.ts +7 -7
- package/dist/{chunk-MZXQTKUM.cjs → chunk-24ATT2PE.cjs} +10 -6
- package/dist/chunk-24ATT2PE.cjs.map +1 -0
- package/dist/{chunk-AHUYMDYW.js → chunk-2HC4DRF4.js} +10 -6
- package/dist/chunk-2HC4DRF4.js.map +1 -0
- package/dist/{chunk-YRZ6NVE3.js → chunk-6CTZAGZ2.js} +235 -4
- package/dist/chunk-6CTZAGZ2.js.map +1 -0
- package/dist/{chunk-ECVI5QRE.js → chunk-7RJ6P7MI.js} +2 -2
- package/dist/{chunk-G5FX56KX.js → chunk-ESIWZMMK.js} +51 -11
- package/dist/chunk-ESIWZMMK.js.map +1 -0
- package/dist/{chunk-IEYXYMRQ.js → chunk-HHTCDFZC.js} +99 -5
- package/dist/chunk-HHTCDFZC.js.map +1 -0
- package/dist/{chunk-W6M7C7R3.cjs → chunk-NVTHUPJ6.cjs} +236 -5
- package/dist/chunk-NVTHUPJ6.cjs.map +1 -0
- package/dist/{chunk-OYPJGGF3.cjs → chunk-T6TV6HY6.cjs} +36 -36
- package/dist/{chunk-OYPJGGF3.cjs.map → chunk-T6TV6HY6.cjs.map} +1 -1
- package/dist/{chunk-55UEZIU4.cjs → chunk-YAFS2QFZ.cjs} +231 -191
- package/dist/chunk-YAFS2QFZ.cjs.map +1 -0
- package/dist/{chunk-YYJKIESX.cjs → chunk-Z2H7KECK.cjs} +153 -59
- package/dist/chunk-Z2H7KECK.cjs.map +1 -0
- package/dist/effects/index.d.cts +4 -4
- package/dist/effects/index.d.ts +4 -4
- package/dist/{export-D-gkjBkB.d.cts → export-BGdT02aL.d.cts} +10 -10
- package/dist/{export-CfAogLEr.d.cts → export-DMeG6E06.d.ts} +1 -1
- package/dist/{export-ByJvAvR7.d.ts → export-Dng22YB8.d.ts} +10 -10
- package/dist/{export-Crl82sbE.d.ts → export-KzubBKo7.d.cts} +1 -1
- package/dist/{helpers-BCd2-PAR.d.ts → helpers-Coa4e2j_.d.ts} +35 -1
- package/dist/{helpers-CoIeXQnW.d.cts → helpers-DHl28yLO.d.cts} +35 -1
- package/dist/image-editor/index.cjs +983 -874
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +32 -13
- package/dist/image-editor/index.d.ts +32 -13
- package/dist/image-editor/index.js +124 -15
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{opentype-BDahNRTe.d.cts → opentype-BWR7Qv8W.d.cts} +1 -1
- package/dist/{opentype-BQFEvy-t.d.ts → opentype-Dfcx6wFx.d.ts} +1 -1
- package/dist/paint/index.cjs +8 -2
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +14 -3
- package/dist/paint/index.d.ts +14 -3
- package/dist/paint/index.js +7 -1
- package/dist/paint-editor/index.cjs +78 -78
- package/dist/paint-editor/index.d.cts +7 -7
- package/dist/paint-editor/index.d.ts +7 -7
- package/dist/paint-editor/index.js +3 -3
- package/dist/{pathfinder-DaVdT8jq.d.ts → pathfinder-Celbi3e6.d.ts} +1 -1
- package/dist/{pathfinder-01ZgAwqV.d.cts → pathfinder-D8KQ6blQ.d.cts} +1 -1
- package/dist/{pool-D2A3WTt9.d.ts → pool-8JZGWHvR.d.ts} +1 -1
- package/dist/{pool-D6a45MoE.d.cts → pool-BfuxBKTd.d.cts} +1 -1
- package/dist/{rand-pQQ2sJTk.d.ts → rand-BaqEOs1Y.d.ts} +17 -4
- package/dist/{rand-DTXAssW1.d.cts → rand-DdpFzCo6.d.cts} +17 -4
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.d.cts +4 -4
- package/dist/raster/index.d.ts +4 -4
- package/dist/raster/index.js +1 -1
- package/dist/{svg-DELNVerw.d.ts → svg-CxxqG3_W.d.ts} +2 -2
- package/dist/{svg-CcDz7Zq2.d.cts → svg-pwXWq6s2.d.cts} +2 -2
- package/dist/{tools-BFvkFnRj.d.cts → tools-3EBjR91b.d.cts} +1 -1
- package/dist/{tools-D7ws-OKL.d.ts → tools-y1M6O3UT.d.ts} +1 -1
- package/dist/vector/index.cjs +1642 -1046
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +275 -93
- package/dist/vector/index.d.ts +275 -93
- package/dist/vector/index.js +607 -11
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +4 -4
- package/dist/video-editor/index.d.ts +4 -4
- package/dist/{warp-2N9wkOkL.d.ts → warp-C1gwu2G_.d.ts} +1 -1
- package/dist/{warp-DErXW5rz.d.cts → warp-Ceqdz7kj.d.cts} +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-image-editor/references/retouching.md +3 -2
- package/skills/pixerate-vector/SKILL.md +12 -53
- package/skills/pixerate-vector/references/pitfalls.md +62 -0
- package/dist/chunk-55UEZIU4.cjs.map +0 -1
- package/dist/chunk-AHUYMDYW.js.map +0 -1
- package/dist/chunk-G5FX56KX.js.map +0 -1
- package/dist/chunk-IEYXYMRQ.js.map +0 -1
- package/dist/chunk-MZXQTKUM.cjs.map +0 -1
- package/dist/chunk-W6M7C7R3.cjs.map +0 -1
- package/dist/chunk-YRZ6NVE3.js.map +0 -1
- package/dist/chunk-YYJKIESX.cjs.map +0 -1
- /package/dist/{chunk-ECVI5QRE.js.map → chunk-7RJ6P7MI.js.map} +0 -0
|
@@ -80,7 +80,7 @@ var _chunkSFCPGMCTcjs = require('../chunk-SFCPGMCT.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
var
|
|
83
|
+
var _chunkYAFS2QFZcjs = require('../chunk-YAFS2QFZ.cjs');
|
|
84
84
|
require('../chunk-2YQONY6G.cjs');
|
|
85
85
|
|
|
86
86
|
|
|
@@ -92,7 +92,7 @@ var _chunkW6QTLHZ3cjs = require('../chunk-W6QTLHZ3.cjs');
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
var
|
|
95
|
+
var _chunk24ATT2PEcjs = require('../chunk-24ATT2PE.cjs');
|
|
96
96
|
require('../chunk-MUUXNRU4.cjs');
|
|
97
97
|
|
|
98
98
|
|
|
@@ -211,7 +211,7 @@ var _chunkCOAMRKVIcjs = require('../chunk-COAMRKVI.cjs');
|
|
|
211
211
|
|
|
212
212
|
|
|
213
213
|
var _chunkEGFUVXKKcjs = require('../chunk-EGFUVXKK.cjs');
|
|
214
|
-
require('../chunk-
|
|
214
|
+
require('../chunk-Z2H7KECK.cjs');
|
|
215
215
|
require('../chunk-BJTCSLF6.cjs');
|
|
216
216
|
require('../chunk-IZ4WRXZA.cjs');
|
|
217
217
|
|
|
@@ -1550,7 +1550,7 @@ var PROFILE = {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
};
|
|
1552
1552
|
function createPaintCompositor() {
|
|
1553
|
-
return new (0,
|
|
1553
|
+
return new (0, _chunk24ATT2PEcjs.RasterCompositor)(PROFILE);
|
|
1554
1554
|
}
|
|
1555
1555
|
function downsampleRgba(data, width, height, tw, th) {
|
|
1556
1556
|
tw = Math.max(1, Math.round(tw));
|
|
@@ -1625,11 +1625,11 @@ function header(state, options) {
|
|
|
1625
1625
|
return out;
|
|
1626
1626
|
}
|
|
1627
1627
|
function serializePaintDocument(state, options = {}) {
|
|
1628
|
-
const { layers, assets } =
|
|
1628
|
+
const { layers, assets } = _chunkYAFS2QFZcjs.serializeLayers.call(void 0, state.layers);
|
|
1629
1629
|
return { ...header(state, options), layers, assets };
|
|
1630
1630
|
}
|
|
1631
1631
|
async function serializePaintDocumentExternal(state, store, options = {}) {
|
|
1632
|
-
const { layers, assets } = await
|
|
1632
|
+
const { layers, assets } = await _chunkYAFS2QFZcjs.serializeLayersExternal.call(void 0, state.layers, store);
|
|
1633
1633
|
return { ...header(state, options), layers, assets };
|
|
1634
1634
|
}
|
|
1635
1635
|
function paintLayersOnly(layers, problems) {
|
|
@@ -1666,9 +1666,9 @@ function deserializePaintDocument(raw) {
|
|
|
1666
1666
|
const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
|
|
1667
1667
|
const paper = _chunkW4LNKTHTcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
|
|
1668
1668
|
const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
|
|
1669
|
-
const layers = paintLayersOnly(
|
|
1669
|
+
const layers = paintLayersOnly(_chunkYAFS2QFZcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
|
|
1670
1670
|
const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
|
|
1671
|
-
const activeLayerId = wanted &&
|
|
1671
|
+
const activeLayerId = wanted && _chunk24ATT2PEcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunk24ATT2PEcjs.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));
|
|
1672
1672
|
const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
|
|
1673
1673
|
const state = { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) };
|
|
1674
1674
|
if (wetEvents.length) state.wetEvents = wetEvents;
|
|
@@ -1680,7 +1680,7 @@ async function deserializePaintDocumentAsync(raw, store) {
|
|
|
1680
1680
|
if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
|
|
1681
1681
|
const r = raw;
|
|
1682
1682
|
const problems = [];
|
|
1683
|
-
const assets = await
|
|
1683
|
+
const assets = await _chunkYAFS2QFZcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
|
|
1684
1684
|
const loaded = deserializePaintDocument({ ...r, assets });
|
|
1685
1685
|
return { ...loaded, problems: [...problems, ...loaded.problems] };
|
|
1686
1686
|
}
|
|
@@ -3052,7 +3052,7 @@ function replayItems(doc) {
|
|
|
3052
3052
|
}
|
|
3053
3053
|
function emptiedLayers(layers) {
|
|
3054
3054
|
let out = [...layers];
|
|
3055
|
-
for (const l of
|
|
3055
|
+
for (const l of _chunk24ATT2PEcjs.flattenLayers.call(void 0, layers)) if (l.type === "pixel") out = _chunk24ATT2PEcjs.mapLayer.call(void 0, out, l.id, () => ({ ...l, surface: _chunkJ5BA3BQ6cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }));
|
|
3056
3056
|
return out;
|
|
3057
3057
|
}
|
|
3058
3058
|
async function replayPainting(source, target, options = {}) {
|
|
@@ -3443,12 +3443,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3443
3443
|
canvas: () => this.doc.canvas,
|
|
3444
3444
|
paper: () => this.doc.paper,
|
|
3445
3445
|
layerSurface: (id) => {
|
|
3446
|
-
const l = _optionalChain([
|
|
3446
|
+
const l = _optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _159 => _159.layer]);
|
|
3447
3447
|
return isPixelLayer(l) ? l.surface : null;
|
|
3448
3448
|
},
|
|
3449
3449
|
updateSurfaces: (surfaces, rects) => {
|
|
3450
3450
|
let layers = this.doc.layers;
|
|
3451
|
-
for (const [id, surface] of surfaces) if (
|
|
3451
|
+
for (const [id, surface] of surfaces) if (_chunk24ATT2PEcjs.findLayer.call(void 0, layers, id)) layers = _chunk24ATT2PEcjs.mapLayer.call(void 0, layers, id, (l) => ({ ...l, surface }));
|
|
3452
3452
|
this.doc = { ...this.doc, layers };
|
|
3453
3453
|
this.emit(rects.length ? rects : "all");
|
|
3454
3454
|
},
|
|
@@ -3707,7 +3707,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3707
3707
|
}
|
|
3708
3708
|
// --- Layers --------------------------------------------------------------------
|
|
3709
3709
|
getLayer(id) {
|
|
3710
|
-
return _optionalChain([
|
|
3710
|
+
return _optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _174 => _174.layer]);
|
|
3711
3711
|
}
|
|
3712
3712
|
/** The active pixel layer (or `undefined`). */
|
|
3713
3713
|
getActiveLayer() {
|
|
@@ -3726,12 +3726,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3726
3726
|
walk(this.doc.layers, null, 0);
|
|
3727
3727
|
return out;
|
|
3728
3728
|
}
|
|
3729
|
-
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([
|
|
3729
|
+
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _175 => _175.parent, 'optionalAccess', _176 => _176.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _177 => _177.path, 'access', _178 => _178.length]), () => ( 0))) {
|
|
3730
3730
|
let bounds = null;
|
|
3731
3731
|
if (l.type === "pixel") {
|
|
3732
3732
|
const b = _chunkJ5BA3BQ6cjs.contentBounds.call(void 0, l.surface);
|
|
3733
3733
|
bounds = b ? { ...b, x: b.x + l.offset.x, y: b.y + l.offset.y } : null;
|
|
3734
|
-
} else for (const c of
|
|
3734
|
+
} else for (const c of _chunk24ATT2PEcjs.flattenLayers.call(void 0, l.children)) if (c.type === "pixel") bounds = unionRect(bounds, this.describeLayer(c, l.id, depth + 1).bounds);
|
|
3735
3735
|
return {
|
|
3736
3736
|
id: l.id,
|
|
3737
3737
|
name: l.name,
|
|
@@ -3758,7 +3758,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3758
3758
|
if (!id) throw new PaintEditorError(`There is no active layer to ${what}; add one with add_layer.`);
|
|
3759
3759
|
const l = this.requireLayer(id);
|
|
3760
3760
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; ${what} a pixel layer inside it.`);
|
|
3761
|
-
if (
|
|
3761
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) before you ${what} it.`);
|
|
3762
3762
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) before you ${what} it.`);
|
|
3763
3763
|
return l;
|
|
3764
3764
|
}
|
|
@@ -3771,7 +3771,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3771
3771
|
/** Adds an empty pixel layer or group above `aboveId` (default: the active layer) and makes it active. */
|
|
3772
3772
|
addLayer(options = {}) {
|
|
3773
3773
|
this.requireIdle("adding a layer");
|
|
3774
|
-
const count =
|
|
3774
|
+
const count = _chunk24ATT2PEcjs.flattenLayers.call(void 0, this.doc.layers).length;
|
|
3775
3775
|
const type = _nullishCoalesce(options.type, () => ( "pixel"));
|
|
3776
3776
|
const name = _optionalChain([options, 'access', _179 => _179.name, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]) || (type === "group" ? `Group ${count + 1}` : `Layer ${count + 1}`);
|
|
3777
3777
|
const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
|
|
@@ -3783,19 +3783,19 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3783
3783
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
3784
3784
|
parentId = g.id;
|
|
3785
3785
|
} else if (above) {
|
|
3786
|
-
const loc =
|
|
3786
|
+
const loc = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, above);
|
|
3787
3787
|
if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
|
|
3788
3788
|
parentId = _nullishCoalesce(_optionalChain([loc, 'access', _182 => _182.parent, 'optionalAccess', _183 => _183.id]), () => ( null));
|
|
3789
3789
|
index = loc.index + 1;
|
|
3790
3790
|
}
|
|
3791
|
-
const layers =
|
|
3791
|
+
const layers = _chunk24ATT2PEcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
|
|
3792
3792
|
this.commit(type === "group" ? "Add group" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id });
|
|
3793
3793
|
return this.describeLayer(layer);
|
|
3794
3794
|
}
|
|
3795
3795
|
updateLayer(id, update) {
|
|
3796
3796
|
this.requireIdle("changing a layer");
|
|
3797
3797
|
const l = this.requireLayer(id);
|
|
3798
|
-
if (
|
|
3798
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, l, "all") && Object.keys(update).some((k) => k !== "locks")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it first (locks {all: false}).`);
|
|
3799
3799
|
if (update.opacity !== void 0 && !(update.opacity >= 0 && update.opacity <= 1)) throw new PaintEditorError(`opacity ${update.opacity} is out of range; use 0..1.`);
|
|
3800
3800
|
if (update.blend !== void 0 && !_chunkJ5BA3BQ6cjs.isBlendMode.call(void 0, update.blend) && !(l.type === "group" && update.blend === "pass-through")) {
|
|
3801
3801
|
throw new PaintEditorError(`Unknown blend mode "${update.blend}". Call get_canvas_info for the blend modes.`);
|
|
@@ -3811,31 +3811,31 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3811
3811
|
const locks = { ..._nullishCoalesce(l.locks, () => ( {})), ...update.locks };
|
|
3812
3812
|
next.locks = Object.values(locks).some(Boolean) ? locks : void 0;
|
|
3813
3813
|
}
|
|
3814
|
-
this.commit("Layer properties", { ...this.doc, layers:
|
|
3814
|
+
this.commit("Layer properties", { ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, id, () => next) });
|
|
3815
3815
|
return this.describeLayer(next);
|
|
3816
3816
|
}
|
|
3817
3817
|
removeLayer(id) {
|
|
3818
3818
|
this.requireIdle("removing a layer");
|
|
3819
3819
|
const l = this.requireLayer(id);
|
|
3820
|
-
if (
|
|
3821
|
-
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" &&
|
|
3820
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it before removing it.`);
|
|
3821
|
+
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" && _chunk24ATT2PEcjs.findLayer.call(void 0, l.children, x));
|
|
3822
3822
|
if (wetIds.length) {
|
|
3823
3823
|
this.beginWetOp();
|
|
3824
3824
|
for (const x of wetIds) this.wet.world.removeLane(x);
|
|
3825
3825
|
}
|
|
3826
|
-
const layers =
|
|
3826
|
+
const layers = _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
3827
3827
|
let active = this.doc.activeLayerId;
|
|
3828
|
-
if (active && !
|
|
3829
|
-
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(
|
|
3828
|
+
if (active && !_chunk24ATT2PEcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunk24ATT2PEcjs.flattenLayers.call(void 0, layers), 'access', _184 => _184.filter, 'call', _185 => _185((x) => x.type === "pixel"), 'access', _186 => _186.pop, 'call', _187 => _187(), 'optionalAccess', _188 => _188.id]), () => ( null));
|
|
3829
|
+
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunk24ATT2PEcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunk24ATT2PEcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
|
|
3830
3830
|
return { removed: id, activeLayerId: active };
|
|
3831
3831
|
}
|
|
3832
3832
|
duplicateLayer(id) {
|
|
3833
3833
|
this.requireIdle("duplicating a layer");
|
|
3834
|
-
if (
|
|
3834
|
+
if (_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id)) {
|
|
3835
3835
|
const inside = (l) => l.type === "group" ? l.children.flatMap(inside) : [l.id];
|
|
3836
|
-
this.dryLayersFirst(inside(
|
|
3836
|
+
this.dryLayersFirst(inside(_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id).layer));
|
|
3837
3837
|
}
|
|
3838
|
-
const loc =
|
|
3838
|
+
const loc = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3839
3839
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3840
3840
|
const thick = { ..._nullishCoalesce(this.doc.thick, () => ( {})) };
|
|
3841
3841
|
const stickers = { ..._nullishCoalesce(this.doc.stickers, () => ( {})) };
|
|
@@ -3846,43 +3846,43 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3846
3846
|
return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
|
|
3847
3847
|
};
|
|
3848
3848
|
const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
|
|
3849
|
-
const layers =
|
|
3849
|
+
const layers = _chunk24ATT2PEcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _189 => _189.parent, 'optionalAccess', _190 => _190.id]), () => ( null)), loc.index + 1);
|
|
3850
3850
|
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {} }));
|
|
3851
3851
|
return this.describeLayer(dup);
|
|
3852
3852
|
}
|
|
3853
3853
|
/** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
|
|
3854
3854
|
moveLayer(id, index, parentId) {
|
|
3855
3855
|
this.requireIdle("moving a layer");
|
|
3856
|
-
const loc =
|
|
3856
|
+
const loc = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3857
3857
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3858
3858
|
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _191 => _191.parent, 'optionalAccess', _192 => _192.id]), () => ( null)) : parentId;
|
|
3859
3859
|
if (target) {
|
|
3860
3860
|
const g = this.requireLayer(target);
|
|
3861
3861
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
3862
|
-
if (target === id || loc.layer.type === "group" &&
|
|
3862
|
+
if (target === id || loc.layer.type === "group" && _chunk24ATT2PEcjs.findLayer.call(void 0, loc.layer.children, target)) throw new PaintEditorError("A group cannot move into itself.");
|
|
3863
3863
|
}
|
|
3864
|
-
const without =
|
|
3865
|
-
const siblings = target ?
|
|
3864
|
+
const without = _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
3865
|
+
const siblings = target ? _chunk24ATT2PEcjs.findLayer.call(void 0, without, target).layer.children : without;
|
|
3866
3866
|
if (!Number.isInteger(index) || index < 0 || index > siblings.length) throw new PaintEditorError(`index ${index} is out of range; use 0..${siblings.length} (0 is the bottom).`);
|
|
3867
|
-
const layers =
|
|
3867
|
+
const layers = _chunk24ATT2PEcjs.insertLayer.call(void 0, without, loc.layer, target, index);
|
|
3868
3868
|
this.commit("Move layer", { ...this.doc, layers });
|
|
3869
3869
|
return this.describeLayer(loc.layer);
|
|
3870
3870
|
}
|
|
3871
3871
|
/** Merges a pixel layer into the pixel layer below it (keeping the lower one's settings). */
|
|
3872
3872
|
mergeDown(id) {
|
|
3873
3873
|
this.requireIdle("merging");
|
|
3874
|
-
const pre =
|
|
3874
|
+
const pre = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3875
3875
|
if (pre) {
|
|
3876
3876
|
const sib = pre.parent ? pre.parent.children : this.doc.layers;
|
|
3877
3877
|
this.dryLayersFirst([id, _optionalChain([sib, 'access', _193 => _193[pre.index - 1], 'optionalAccess', _194 => _194.id])].filter((x) => Boolean(x)));
|
|
3878
3878
|
}
|
|
3879
|
-
const loc =
|
|
3879
|
+
const loc = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3880
3880
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3881
3881
|
const siblings = loc.parent ? loc.parent.children : this.doc.layers;
|
|
3882
3882
|
const below = siblings[loc.index - 1];
|
|
3883
3883
|
const upper = loc.layer;
|
|
3884
3884
|
if (!isPixelLayer(upper) || !isPixelLayer(below)) throw new PaintEditorError("Merge down needs a pixel layer directly above another pixel layer in the same group.");
|
|
3885
|
-
if (
|
|
3885
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, below, "pixels")) throw new PaintEditorError(`Layer "${below.name}" has its pixels locked; unlock it to merge into it.`);
|
|
3886
3886
|
const rect = unionRect(this.describeLayer(below).bounds, this.describeLayer(upper).bounds);
|
|
3887
3887
|
let surface = _chunkJ5BA3BQ6cjs.emptySurface.call(void 0, 4);
|
|
3888
3888
|
if (rect) {
|
|
@@ -3892,7 +3892,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3892
3892
|
surface = _chunkJ5BA3BQ6cjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
|
|
3893
3893
|
}
|
|
3894
3894
|
const merged = { ...below, surface, offset: { x: 0, y: 0 } };
|
|
3895
|
-
const layers =
|
|
3895
|
+
const layers = _chunk24ATT2PEcjs.mapLayer.call(void 0, _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
|
|
3896
3896
|
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]) }));
|
|
3897
3897
|
return this.describeLayer(merged);
|
|
3898
3898
|
}
|
|
@@ -3905,7 +3905,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3905
3905
|
this.wet.world.removeLane(l.id);
|
|
3906
3906
|
}
|
|
3907
3907
|
const bounds = this.describeLayer(l).bounds;
|
|
3908
|
-
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers:
|
|
3908
|
+
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunkJ5BA3BQ6cjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]) }, { kind: "clear", layerId: l.id }));
|
|
3909
3909
|
return { layerId: l.id, bounds };
|
|
3910
3910
|
}
|
|
3911
3911
|
/**
|
|
@@ -3943,12 +3943,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3943
3943
|
background: rgbaOf(this.doc.paper.color),
|
|
3944
3944
|
opacity,
|
|
3945
3945
|
blend,
|
|
3946
|
-
lockTransparency:
|
|
3946
|
+
lockTransparency: _chunk24ATT2PEcjs.isLayerLocked.call(void 0, l, "transparency"),
|
|
3947
3947
|
selection: null,
|
|
3948
3948
|
offset: l.offset
|
|
3949
3949
|
};
|
|
3950
3950
|
const surface = this.applyCoverage(l, coverage, rect, apply);
|
|
3951
|
-
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers:
|
|
3951
|
+
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })) }), { kind: "fill", layerId: l.id, data: { color, opacity, grain: grainAmount, pressure, blend } }));
|
|
3952
3952
|
return { layerId: l.id, bounds: rect };
|
|
3953
3953
|
}
|
|
3954
3954
|
applyCoverage(l, coverage, rect, apply) {
|
|
@@ -3989,7 +3989,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3989
3989
|
}
|
|
3990
3990
|
/** The effect a layer is drawn from, or `undefined` for other layers. */
|
|
3991
3991
|
getEffectLayer(layerId) {
|
|
3992
|
-
return
|
|
3992
|
+
return _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access', _203 => _203.doc, 'access', _204 => _204.effectLayers, 'optionalAccess', _205 => _205[layerId]]) : void 0;
|
|
3993
3993
|
}
|
|
3994
3994
|
/** The effect paper (without its pixels), or `null`. */
|
|
3995
3995
|
getPaperEffect() {
|
|
@@ -4117,10 +4117,10 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4117
4117
|
const pixels = await this.renderEffectCanvas(d, values, options.time);
|
|
4118
4118
|
this.requireIdle("adding a layer");
|
|
4119
4119
|
const above = _nullishCoalesce(options.aboveId, () => ( this.doc.activeLayerId));
|
|
4120
|
-
const loc = above ?
|
|
4120
|
+
const loc = above ? _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, above) : null;
|
|
4121
4121
|
if (options.aboveId !== void 0 && !loc) throw new PaintEditorError(`Layer "${options.aboveId}" was removed while the effect rendered.`);
|
|
4122
4122
|
const layer = { ...createPaintLayer(_optionalChain([options, 'access', _212 => _212.name, 'optionalAccess', _213 => _213.trim, 'call', _214 => _214()]) || d.name), surface: _chunkJ5BA3BQ6cjs.surfaceFromPixels.call(void 0, pixels, 4), opacity: _nullishCoalesce(options.opacity, () => ( 1)), blend: _nullishCoalesce(options.blend, () => ( "normal")) };
|
|
4123
|
-
const layers =
|
|
4123
|
+
const layers = _chunk24ATT2PEcjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _215 => _215.parent, 'optionalAccess', _216 => _216.id]), () => ( null)), loc ? loc.index + 1 : void 0);
|
|
4124
4124
|
const source = this.sourceOf(d, values, options.time);
|
|
4125
4125
|
this.commit("Add effect layer", { ...this.doc, layers, activeLayerId: layer.id, effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [layer.id]: source } });
|
|
4126
4126
|
return { layer: this.describeLayer(layer), source };
|
|
@@ -4144,7 +4144,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4144
4144
|
this.requireIdle("changing an effect layer");
|
|
4145
4145
|
if (!isPixelLayer(now)) throw new PaintEditorError(`Layer "${l.name}" was removed while the effect rendered.`);
|
|
4146
4146
|
const source = this.sourceOf(d, values, time);
|
|
4147
|
-
this.commitOrAmend("Effect layer", { ...this.doc, layers:
|
|
4147
|
+
this.commitOrAmend("Effect layer", { ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...now, surface: _chunkJ5BA3BQ6cjs.surfaceFromPixels.call(void 0, pixels, 4), offset: { x: 0, y: 0 } })), effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [l.id]: source } }, commitToHistory);
|
|
4148
4148
|
return source;
|
|
4149
4149
|
}
|
|
4150
4150
|
/** Turns an effect layer into a plain pixel layer, keeping its pixels (one undo step). */
|
|
@@ -4172,9 +4172,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4172
4172
|
const rect = this.canvasRectOf(now);
|
|
4173
4173
|
const before = _chunkJ5BA3BQ6cjs.readRegion.call(void 0, now.surface, rect);
|
|
4174
4174
|
let after = overPixels(before, pixels.data, _nullishCoalesce(options.opacity, () => ( 1)));
|
|
4175
|
-
if (options.lockTransparency ||
|
|
4175
|
+
if (options.lockTransparency || _chunk24ATT2PEcjs.isLayerLocked.call(void 0, now, "transparency")) after = mixPixels(before, after, 1);
|
|
4176
4176
|
const surface = _chunkJ5BA3BQ6cjs.writeRegion.call(void 0, now.surface, rect, after);
|
|
4177
|
-
this.commit("Effect fill", { ...this.doc, layers:
|
|
4177
|
+
this.commit("Effect fill", { ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, now.id, () => ({ ...now, surface })) });
|
|
4178
4178
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time) };
|
|
4179
4179
|
}
|
|
4180
4180
|
/**
|
|
@@ -4211,7 +4211,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4211
4211
|
const out = await this.effectsRenderer.render(this.effects.require(), d.id, { width: rect.width, height: rect.height }, { time: _nullishCoalesce(options.time, () => ( 0)), values, inputs });
|
|
4212
4212
|
const now = this.sameLayerAfterRender(l);
|
|
4213
4213
|
const surface = _chunkJ5BA3BQ6cjs.writeRegion.call(void 0, now.surface, rect, mixPixels(before, out.data, amount));
|
|
4214
|
-
this.commit("Light effect", { ...this.doc, layers:
|
|
4214
|
+
this.commit("Light effect", { ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, now.id, () => ({ ...now, surface })) });
|
|
4215
4215
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time), amount };
|
|
4216
4216
|
}
|
|
4217
4217
|
// --- Brushes -------------------------------------------------------------------
|
|
@@ -4447,11 +4447,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4447
4447
|
let layer = (() => {
|
|
4448
4448
|
const id = _nullishCoalesce(init.layerId, () => ( doc.activeLayerId));
|
|
4449
4449
|
if (!id) throw new PaintEditorError("There is no active layer to paint on; add one with add_layer.");
|
|
4450
|
-
const loc =
|
|
4450
|
+
const loc = _chunk24ATT2PEcjs.findLayer.call(void 0, doc.layers, id);
|
|
4451
4451
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4452
4452
|
const l = loc.layer;
|
|
4453
4453
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; paint on a pixel layer inside it.`);
|
|
4454
|
-
if (
|
|
4454
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) to paint on it.`);
|
|
4455
4455
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) to paint on it.`);
|
|
4456
4456
|
return l;
|
|
4457
4457
|
})();
|
|
@@ -4467,8 +4467,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4467
4467
|
this.requireWetIdle("painting");
|
|
4468
4468
|
if (layer.offset.x || layer.offset.y) {
|
|
4469
4469
|
const moved = { ...layer, surface: _chunkJ5BA3BQ6cjs.translateSurface.call(void 0, layer.surface, layer.offset.x, layer.offset.y), offset: { x: 0, y: 0 } };
|
|
4470
|
-
this.doc = { ...this.doc, layers:
|
|
4471
|
-
if (doc !== this.doc) doc = { ...doc, layers:
|
|
4470
|
+
this.doc = { ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => moved) };
|
|
4471
|
+
if (doc !== this.doc) doc = { ...doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, doc.layers, layer.id, () => moved) };
|
|
4472
4472
|
layer = moved;
|
|
4473
4473
|
}
|
|
4474
4474
|
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >= _chunkFHPVDTI2cjs.MAX_WET_LANES) {
|
|
@@ -4501,7 +4501,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4501
4501
|
wet = { driver, surface: () => world.display(id).surface };
|
|
4502
4502
|
} else if (this.wet.wetLayerIds().includes(layer.id)) {
|
|
4503
4503
|
this.dryLayersFirst([layer.id]);
|
|
4504
|
-
const dried =
|
|
4504
|
+
const dried = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, layer.id).layer;
|
|
4505
4505
|
layer = dried;
|
|
4506
4506
|
}
|
|
4507
4507
|
let color = init.color === void 0 ? this.color : parseColor(init.color);
|
|
@@ -4520,7 +4520,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4520
4520
|
layerId: layer.id,
|
|
4521
4521
|
surface: layer.surface,
|
|
4522
4522
|
offset: layer.offset,
|
|
4523
|
-
lockTransparency:
|
|
4523
|
+
lockTransparency: _chunk24ATT2PEcjs.isLayerLocked.call(void 0, layer, "transparency"),
|
|
4524
4524
|
brush,
|
|
4525
4525
|
color: rgba,
|
|
4526
4526
|
background: rgbaOf(doc.paper.color),
|
|
@@ -4615,7 +4615,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4615
4615
|
const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
|
|
4616
4616
|
const sprayed = s.stickers();
|
|
4617
4617
|
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _239 => _239.doc, 'access', _240 => _240.stickers, 'optionalAccess', _241 => _241[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
|
|
4618
|
-
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers:
|
|
4618
|
+
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {} }), wetStroke ? before : this.doc);
|
|
4619
4619
|
}
|
|
4620
4620
|
};
|
|
4621
4621
|
let session;
|
|
@@ -4643,13 +4643,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4643
4643
|
if (cancelled || !surface) return;
|
|
4644
4644
|
const stroke = this.record(s);
|
|
4645
4645
|
s.result.strokeId = stroke.id;
|
|
4646
|
-
const l =
|
|
4646
|
+
const l = _chunk24ATT2PEcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
|
|
4647
4647
|
const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
|
|
4648
4648
|
const ch = s.thickChannels();
|
|
4649
4649
|
const sprayed = s.stickers();
|
|
4650
4650
|
out = {
|
|
4651
4651
|
...out,
|
|
4652
|
-
layers:
|
|
4652
|
+
layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
|
|
4653
4653
|
strokes: [...out.strokes, stroke],
|
|
4654
4654
|
...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
|
|
4655
4655
|
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _242 => _242.stickers, 'optionalAccess', _243 => _243[l.id]]), () => ( [])), ...sprayed] } } : {}
|
|
@@ -4664,8 +4664,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4664
4664
|
if (this.wet.instantDry && result.strokeId) {
|
|
4665
4665
|
this.wet.dry(session.layerId);
|
|
4666
4666
|
this.logWet({ kind: "dry", layerId: session.layerId, at: out.strokes.length });
|
|
4667
|
-
const dried =
|
|
4668
|
-
out = { ...out, layers:
|
|
4667
|
+
const dried = _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, session.layerId).layer.surface;
|
|
4668
|
+
out = { ...out, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, out.layers, session.layerId, (l) => ({ ...l, surface: dried })) };
|
|
4669
4669
|
}
|
|
4670
4670
|
result.wet = this.wet.isWet(session.layerId);
|
|
4671
4671
|
}
|
|
@@ -4743,7 +4743,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4743
4743
|
brush = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
|
|
4744
4744
|
}
|
|
4745
4745
|
const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
|
|
4746
|
-
if (!
|
|
4746
|
+
if (!_chunk24ATT2PEcjs.findLayer.call(void 0, doc.layers, layerId)) throw new PaintEditorError(`Stroke "${s.id}" was painted on layer "${layerId}", which no longer exists; pass layerId to replay it elsewhere.`);
|
|
4747
4747
|
let load = s.load;
|
|
4748
4748
|
if (load && options.color !== void 0 && load.reservoir) {
|
|
4749
4749
|
const [r, g, b] = _chunkW4LNKTHTcjs.hexToRgb8.call(void 0, options.color);
|
|
@@ -4960,7 +4960,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4960
4960
|
wetPaper(options = {}) {
|
|
4961
4961
|
this.requireIdle("wetting the paper");
|
|
4962
4962
|
const l = this.wetLayer(options.layerId, "wet the paper of");
|
|
4963
|
-
if (
|
|
4963
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it first.`);
|
|
4964
4964
|
const amount = _nullishCoalesce(options.amount, () => ( 1));
|
|
4965
4965
|
if (!(amount > 0 && amount <= 1)) throw new PaintEditorError(`amount ${amount} is out of range; use above 0 up to 1.`);
|
|
4966
4966
|
const rect = _nullishCoalesce(this.checkRect(options.rect), () => ( { x: 0, y: 0, width: this.doc.canvas.width, height: this.doc.canvas.height }));
|
|
@@ -5044,7 +5044,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5044
5044
|
const live = this.live;
|
|
5045
5045
|
if (!live) return this.doc.layers;
|
|
5046
5046
|
if (_optionalChain([this, 'access', _253 => _253.liveLayers, 'optionalAccess', _254 => _254.key]) === live.surface) return this.liveLayers.layers;
|
|
5047
|
-
const layers =
|
|
5047
|
+
const layers = _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
|
|
5048
5048
|
this.liveLayers = { key: live.surface, layers };
|
|
5049
5049
|
return layers;
|
|
5050
5050
|
}
|
|
@@ -5081,7 +5081,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5081
5081
|
let out = layers;
|
|
5082
5082
|
for (const id of ids) {
|
|
5083
5083
|
const baked = this.wet.bakedSurface(id);
|
|
5084
|
-
if (baked &&
|
|
5084
|
+
if (baked && _chunk24ATT2PEcjs.findLayer.call(void 0, out, id)) out = _chunk24ATT2PEcjs.mapLayer.call(void 0, out, id, (l) => ({ ...l, surface: baked }));
|
|
5085
5085
|
}
|
|
5086
5086
|
return out;
|
|
5087
5087
|
}
|
|
@@ -5094,12 +5094,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5094
5094
|
const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
|
|
5095
5095
|
for (const id of ids) {
|
|
5096
5096
|
const ch = _optionalChain([live, 'optionalAccess', _257 => _257.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _258 => _258[id]]);
|
|
5097
|
-
const l = ch && _optionalChain([
|
|
5097
|
+
const l = ch && _optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, out, id), 'optionalAccess', _259 => _259.layer]);
|
|
5098
5098
|
if (!ch || !isPixelLayer(l)) continue;
|
|
5099
5099
|
let cache = this.litCaches.get(id);
|
|
5100
5100
|
if (!cache) this.litCaches.set(id, cache = new LitCache());
|
|
5101
5101
|
const lit = cache.lit(l.surface, ch, this.lighting);
|
|
5102
|
-
if (lit !== l.surface) out =
|
|
5102
|
+
if (lit !== l.surface) out = _chunk24ATT2PEcjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: lit }));
|
|
5103
5103
|
}
|
|
5104
5104
|
return out;
|
|
5105
5105
|
}
|
|
@@ -5107,7 +5107,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5107
5107
|
let layers = this.litLayers((_nullishCoalesce(options.wet, () => ( "display"))) === "dried" ? this.driedLayers() : this.currentLayers());
|
|
5108
5108
|
if (options.layerIds) {
|
|
5109
5109
|
const picked = [];
|
|
5110
|
-
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([
|
|
5110
|
+
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _260 => _260.layer]), () => ( this.requireLayer(id))));
|
|
5111
5111
|
layers = picked.map((l) => ({ ...l, visible: true }));
|
|
5112
5112
|
}
|
|
5113
5113
|
const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
|
|
@@ -5150,7 +5150,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5150
5150
|
/** Wet settings saved with the document (`null` when they are all defaults). */
|
|
5151
5151
|
wetJSON() {
|
|
5152
5152
|
const layers = {};
|
|
5153
|
-
for (const [id, set] of this.wet.settings) if (
|
|
5153
|
+
for (const [id, set] of this.wet.settings) if (_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id)) layers[id] = { params: { ...set.params }, flow: { ...set.flow } };
|
|
5154
5154
|
const flat = this.wet.tilt.angle === 0;
|
|
5155
5155
|
if (!Object.keys(layers).length && flat) return void 0;
|
|
5156
5156
|
return { tilt: { ...this.wet.tilt }, layers };
|
|
@@ -5176,17 +5176,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5176
5176
|
const ext = { ...this.extensions };
|
|
5177
5177
|
const channels = {};
|
|
5178
5178
|
for (const [id, ch] of Object.entries(_nullishCoalesce(this.doc.thick, () => ( {})))) {
|
|
5179
|
-
if (!
|
|
5179
|
+
if (!_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id)) continue;
|
|
5180
5180
|
const saved = thickToJSON(ch);
|
|
5181
5181
|
if (saved) channels[id] = saved;
|
|
5182
5182
|
}
|
|
5183
5183
|
if (Object.keys(channels).length) ext.layerChannels = channels;
|
|
5184
5184
|
else delete ext.layerChannels;
|
|
5185
5185
|
const stickers = {};
|
|
5186
|
-
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length &&
|
|
5186
|
+
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length && _chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id)) stickers[id] = list.map((x) => ({ ...x }));
|
|
5187
5187
|
if (Object.keys(stickers).length) ext.stickers = stickers;
|
|
5188
5188
|
else delete ext.stickers;
|
|
5189
|
-
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([
|
|
5189
|
+
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _263 => _263.layer])));
|
|
5190
5190
|
if (effectLayers) ext.effectLayers = effectLayers;
|
|
5191
5191
|
else delete ext.effectLayers;
|
|
5192
5192
|
if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
|
|
@@ -5202,7 +5202,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5202
5202
|
if (ext.stickers && typeof ext.stickers === "object") {
|
|
5203
5203
|
const stickers = {};
|
|
5204
5204
|
for (const [id, list] of Object.entries(ext.stickers)) {
|
|
5205
|
-
if (!
|
|
5205
|
+
if (!_chunk24ATT2PEcjs.findLayer.call(void 0, state.layers, id) || !Array.isArray(list)) continue;
|
|
5206
5206
|
const ok = list.filter((x) => x && typeof x.id === "string" && _chunkW4LNKTHTcjs.STAMP_KINDS.includes(x.stamp) && Number.isFinite(x.x) && Number.isFinite(x.y) && x.size > 0);
|
|
5207
5207
|
if (ok.length !== list.length) problems.push(`Some stickers of layer "${id}" could not be read; they were dropped.`);
|
|
5208
5208
|
stickers[id] = ok.map((x) => ({ ...x }));
|
|
@@ -5212,7 +5212,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5212
5212
|
if (ext.effectLayers && typeof ext.effectLayers === "object") {
|
|
5213
5213
|
const effectLayers = {};
|
|
5214
5214
|
for (const [id, v] of Object.entries(ext.effectLayers)) {
|
|
5215
|
-
if (!isPixelLayer(_optionalChain([
|
|
5215
|
+
if (!isPixelLayer(_optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _264 => _264.layer]))) continue;
|
|
5216
5216
|
const source = readPaintEffectSource(v);
|
|
5217
5217
|
if (source) effectLayers[id] = source;
|
|
5218
5218
|
else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
|
|
@@ -5230,7 +5230,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5230
5230
|
if (!raw || typeof raw !== "object") return state;
|
|
5231
5231
|
const thick = {};
|
|
5232
5232
|
for (const [id, v] of Object.entries(raw)) {
|
|
5233
|
-
if (!
|
|
5233
|
+
if (!_chunk24ATT2PEcjs.findLayer.call(void 0, state.layers, id)) continue;
|
|
5234
5234
|
try {
|
|
5235
5235
|
thick[id] = thickFromJSON(v);
|
|
5236
5236
|
} catch (e) {
|
|
@@ -5344,7 +5344,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5344
5344
|
return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
|
|
5345
5345
|
});
|
|
5346
5346
|
const layers = toStandard(dried);
|
|
5347
|
-
const result =
|
|
5347
|
+
const result = _chunkYAFS2QFZcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
5348
5348
|
for (const [mode, names] of changed) {
|
|
5349
5349
|
const label = _nullishCoalesce(_optionalChain([_chunkJ5BA3BQ6cjs.BLEND_MODES, 'access', _268 => _268.find, 'call', _269 => _269((m) => m.id === mode), 'optionalAccess', _270 => _270.label]), () => ( mode));
|
|
5350
5350
|
const std = _nullishCoalesce(_optionalChain([_chunkJ5BA3BQ6cjs.BLEND_MODES, 'access', _271 => _271.find, 'call', _272 => _272((m) => m.id === _chunkJ5BA3BQ6cjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _273 => _273.label]), () => ( _chunkJ5BA3BQ6cjs.standardBlendMode.call(void 0, mode)));
|
|
@@ -5594,9 +5594,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5594
5594
|
}
|
|
5595
5595
|
/** Replaces a layer's stickers and redraws its pixels from them (one undo step). */
|
|
5596
5596
|
commitStickers(label, layer, stickers) {
|
|
5597
|
-
if (
|
|
5597
|
+
if (_chunk24ATT2PEcjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it first.`);
|
|
5598
5598
|
const surface = _chunkW4LNKTHTcjs.stickerSurface.call(void 0, stickers);
|
|
5599
|
-
const doc = { ...this.doc, layers:
|
|
5599
|
+
const doc = { ...this.doc, layers: _chunk24ATT2PEcjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => ({ ...layer, surface, offset: { x: 0, y: 0 } })), stickers: { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [layer.id]: stickers } };
|
|
5600
5600
|
this.commit(label, this.withPaintEvent(doc, { kind: "stickers", layerId: layer.id, data: { stickers: stickers.map((s) => ({ ...s })) } }));
|
|
5601
5601
|
}
|
|
5602
5602
|
/** Moves, turns, resizes, recolours or restamps one sticker (one undo step). Returns it. */
|
|
@@ -5849,7 +5849,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5849
5849
|
}
|
|
5850
5850
|
/** A layer's tile surface (live while stroking), for thumbnails. */
|
|
5851
5851
|
layerSurface(id) {
|
|
5852
|
-
const l = _optionalChain([
|
|
5852
|
+
const l = _optionalChain([_chunk24ATT2PEcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _296 => _296.layer]);
|
|
5853
5853
|
return isPixelLayer(l) ? l.surface : null;
|
|
5854
5854
|
}
|
|
5855
5855
|
}, _class10);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a1 as RasterLayer, a0 as RasterGroupLayer, a5 as RasterPixelLayer, C as CompositorLayer, a as RasterCompositor, R as RasterSources, U as LayerLocks } from '../deep-CcwHkQdb.cjs';
|
|
2
|
-
import { D as Dab, C as CoverageMap, B as BrushSettings, e as StrokePoint, g as PaintTileTarget, i as PaintGradientSource, T as TileMedium, M as MixerSettings, j as MixingModel, k as BlenderSettings, l as SmudgeSettings, P as PaintSource, a as MixerLoad, W as WetWorld, m as WetTilt, n as WetParams, o as WetFlowSpec, p as RgbTriple, q as WetWorldOptions, r as WetGpuProvider, s as WetBackendInfo, t as WetSnapshot, u as WetPaperInput } from '../rand-
|
|
3
|
-
export { v as DEFAULT_FLOW, w as DEFAULT_PAINT_GRADIENT, x as DEFAULT_PAINT_GRADIENT_MAPPING, y as DEFAULT_WET_PARAMS, z as MAX_BRUSH_SIZE, A as PAINT_COLOR_JSON_SCHEMA, E as PAINT_GRADIENT_FULL_SPEED, F as PAINT_GRADIENT_JSON_SCHEMA, G as PAINT_GRADIENT_KIT, H as PAINT_GRADIENT_MAPPINGS, I as PAINT_GRADIENT_MAPPING_LABELS, J as PAINT_GRADIENT_PRESETS, K as PAINT_GRADIENT_REPEATS, L as PAINT_GRADIENT_REPEAT_LABELS, N as PAINT_GRADIENT_SPACES, O as PAINT_GRADIENT_SPACE_LABELS, Q as PAINT_SOURCE_JSON_SCHEMA, U as PaintColorSource, V as PaintDabParams, X as PaintGradientKit, Y as PaintGradientMapping, Z as PaintGradientMappingKind, _ as PaintGradientRepeat, $ as PaintGradientSample, a0 as PaintGradientSampler, a1 as PaintGradientSpace, a2 as PaintGradientStop, a3 as PaintRgb, a4 as PaintSourceError, a5 as WET_FLOW_KINDS, a6 as WET_PARAM_KEYS, a7 as WetFlowKind, a8 as WetSupport, a9 as addPaintGradientStop, aa as hash2, ab as hexToPaintRgb, ac as isGradientPaint, ad as mix32, ae as normalizeFlow, af as normalizeHexColor, ag as normalizeWetParams, ah as paintGradientMappingFor, ai as paintSourceColor, aj as paintSourceCss, ak as parsePaintSource, al as rand01, am as readPaintSource, an as removePaintGradientStop, ao as resolvePaintGradient, ap as reversePaintGradient, aq as scalePaintGradient, ar as solidPaint, as as updatePaintGradientStop, at as wetSupport } from '../rand-
|
|
2
|
+
import { D as Dab, C as CoverageMap, B as BrushSettings, e as StrokePoint, g as PaintTileTarget, i as PaintGradientSource, T as TileMedium, M as MixerSettings, j as MixingModel, k as BlenderSettings, l as SmudgeSettings, P as PaintSource, a as MixerLoad, W as WetWorld, m as WetTilt, n as WetParams, o as WetFlowSpec, p as RgbTriple, q as WetWorldOptions, r as WetGpuProvider, s as WetBackendInfo, t as WetSnapshot, u as WetPaperInput } from '../rand-DdpFzCo6.cjs';
|
|
3
|
+
export { v as DEFAULT_FLOW, w as DEFAULT_PAINT_GRADIENT, x as DEFAULT_PAINT_GRADIENT_MAPPING, y as DEFAULT_WET_PARAMS, z as MAX_BRUSH_SIZE, A as PAINT_COLOR_JSON_SCHEMA, E as PAINT_GRADIENT_FULL_SPEED, F as PAINT_GRADIENT_JSON_SCHEMA, G as PAINT_GRADIENT_KIT, H as PAINT_GRADIENT_MAPPINGS, I as PAINT_GRADIENT_MAPPING_LABELS, J as PAINT_GRADIENT_PRESETS, K as PAINT_GRADIENT_REPEATS, L as PAINT_GRADIENT_REPEAT_LABELS, N as PAINT_GRADIENT_SPACES, O as PAINT_GRADIENT_SPACE_LABELS, Q as PAINT_SOURCE_JSON_SCHEMA, U as PaintColorSource, V as PaintDabParams, X as PaintGradientKit, Y as PaintGradientMapping, Z as PaintGradientMappingKind, _ as PaintGradientRepeat, $ as PaintGradientSample, a0 as PaintGradientSampler, a1 as PaintGradientSpace, a2 as PaintGradientStop, a3 as PaintRgb, a4 as PaintSourceError, a5 as WET_FLOW_KINDS, a6 as WET_PARAM_KEYS, a7 as WetFlowKind, a8 as WetSupport, a9 as addPaintGradientStop, aa as hash2, ab as hexToPaintRgb, ac as isGradientPaint, ad as mix32, ae as normalizeFlow, af as normalizeHexColor, ag as normalizeWetParams, ah as paintGradientMappingFor, ai as paintSourceColor, aj as paintSourceCss, ak as parsePaintSource, al as rand01, am as readPaintSource, an as removePaintGradientStop, ao as resolvePaintGradient, ap as reversePaintGradient, aq as scalePaintGradient, ar as solidPaint, as as updatePaintGradientStop, at as wetSupport } from '../rand-DdpFzCo6.cjs';
|
|
4
4
|
import { R as RasterRect, T as TiledSurface, a as BlendMode, b as BlendModeInfo } from '../surface-1MRncXpF.cjs';
|
|
5
5
|
export { B as BLEND_MODES, P as PAINTERLY_BLEND_MODES, i as Tile, v as isBlendMode, w as isPainterlyBlendMode, I as standardBlendMode } from '../surface-1MRncXpF.cjs';
|
|
6
|
-
import { e as EffectValue, E as EffectProvider, f as EffectDescription, a as EffectRenderRequest, b as EffectPixels, v as EffectsSlot } from '../helpers-
|
|
7
|
-
import { I as ImageEditorAssetStore, S as SerializedLayer, P as PsdExportResult } from '../export-
|
|
8
|
-
import { V as VideoProject, D as VideoFfmpegExport } from '../export-
|
|
6
|
+
import { e as EffectValue, E as EffectProvider, f as EffectDescription, a as EffectRenderRequest, b as EffectPixels, v as EffectsSlot } from '../helpers-DHl28yLO.cjs';
|
|
7
|
+
import { I as ImageEditorAssetStore, S as SerializedLayer, P as PsdExportResult } from '../export-BGdT02aL.cjs';
|
|
8
|
+
import { V as VideoProject, D as VideoFfmpegExport } from '../export-KzubBKo7.cjs';
|
|
9
9
|
import { g as PresenceStore, e as PresenceClock, d as PresenceActorInfo, c as PresenceActor, f as PresenceState } from '../presence-Cb6WhcrQ.cjs';
|
|
10
10
|
import { a as AgentToolProvider, A as AgentTool } from '../registry-BqA1AZt0.cjs';
|
|
11
11
|
import '../types-CwMPoRMU.cjs';
|
|
@@ -13,9 +13,9 @@ import '../schema-Di0CS6Pe.cjs';
|
|
|
13
13
|
import '../evaluate-BsxYieLN.cjs';
|
|
14
14
|
import '../easing-lM0Xo9Ni.cjs';
|
|
15
15
|
import '../builtin-CY97ppKM.cjs';
|
|
16
|
-
import '../bezier-
|
|
16
|
+
import '../bezier-J8i4uqSH.cjs';
|
|
17
17
|
import '../brushTypes-C7N3EBK7.cjs';
|
|
18
|
-
import '../warp-
|
|
18
|
+
import '../warp-Ceqdz7kj.cjs';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Seeded, deterministic noise for paper grain and brush jitter (photocraft's counter-based
|