@pixerate/editor 0.121.0 → 0.122.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/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/{chunk-GLOOH65Y.cjs → chunk-4PUPGALM.cjs} +196 -103
- package/dist/chunk-4PUPGALM.cjs.map +1 -0
- package/dist/{chunk-4I54JSJ6.js → chunk-CLTTLLWA.js} +1089 -981
- package/dist/chunk-CLTTLLWA.js.map +1 -0
- package/dist/{chunk-LL3RAN55.cjs → chunk-DFFBJV3U.cjs} +1839 -1731
- package/dist/chunk-DFFBJV3U.cjs.map +1 -0
- package/dist/{chunk-E6N5KLMA.js → chunk-IX3YKUVK.js} +96 -3
- package/dist/chunk-IX3YKUVK.js.map +1 -0
- package/dist/{render-B05K68_h.d.ts → deep-DLwKZDFr.d.ts} +143 -134
- package/dist/{render-DnAbIKcs.d.cts → deep-QS3ppbMX.d.cts} +143 -134
- package/dist/{export-D2D8hb_u.d.ts → export-VmTofKIk.d.ts} +11 -4
- package/dist/{export-fP2hZYjm.d.cts → export-jKKj8Fg8.d.cts} +11 -4
- package/dist/image-editor/index.cjs +678 -672
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +17 -5
- package/dist/image-editor/index.d.ts +17 -5
- package/dist/image-editor/index.js +8 -2
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint-editor/index.cjs +68 -68
- package/dist/paint-editor/index.d.cts +2 -2
- package/dist/paint-editor/index.d.ts +2 -2
- package/dist/paint-editor/index.js +2 -2
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.d.cts +29 -7
- package/dist/raster/index.d.ts +29 -7
- package/dist/raster/index.js +1 -1
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +23 -1
- package/skills/pixerate-image-editor/SKILL.md +7 -1
- package/skills/pixerate-image-editor/references/photoshop-files.md +4 -3
- package/skills/pixerate-paint-editor/SKILL.md +32 -7
- package/dist/chunk-4I54JSJ6.js.map +0 -1
- package/dist/chunk-E6N5KLMA.js.map +0 -1
- package/dist/chunk-GLOOH65Y.cjs.map +0 -1
- package/dist/chunk-LL3RAN55.cjs.map +0 -1
|
@@ -7,7 +7,7 @@ var _chunkSMJGE7HMcjs = require('../chunk-SMJGE7HM.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk4PUPGALMcjs = require('../chunk-4PUPGALM.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ var _chunkGLOOH65Ycjs = require('../chunk-GLOOH65Y.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkDFFBJV3Ucjs = require('../chunk-DFFBJV3U.cjs');
|
|
19
19
|
require('../chunk-MUUXNRU4.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
@@ -3224,7 +3224,7 @@ var PROFILE = {
|
|
|
3224
3224
|
}
|
|
3225
3225
|
};
|
|
3226
3226
|
function createPaintCompositor() {
|
|
3227
|
-
return new (0,
|
|
3227
|
+
return new (0, _chunkDFFBJV3Ucjs.RasterCompositor)(PROFILE);
|
|
3228
3228
|
}
|
|
3229
3229
|
function downsampleRgba(data, width, height, tw, th) {
|
|
3230
3230
|
tw = Math.max(1, Math.round(tw));
|
|
@@ -3299,11 +3299,11 @@ function header(state, options) {
|
|
|
3299
3299
|
return out;
|
|
3300
3300
|
}
|
|
3301
3301
|
function serializePaintDocument(state, options = {}) {
|
|
3302
|
-
const { layers, assets } =
|
|
3302
|
+
const { layers, assets } = _chunk4PUPGALMcjs.serializeLayers.call(void 0, state.layers);
|
|
3303
3303
|
return { ...header(state, options), layers, assets };
|
|
3304
3304
|
}
|
|
3305
3305
|
async function serializePaintDocumentExternal(state, store, options = {}) {
|
|
3306
|
-
const { layers, assets } = await
|
|
3306
|
+
const { layers, assets } = await _chunk4PUPGALMcjs.serializeLayersExternal.call(void 0, state.layers, store);
|
|
3307
3307
|
return { ...header(state, options), layers, assets };
|
|
3308
3308
|
}
|
|
3309
3309
|
function paintLayersOnly(layers, problems) {
|
|
@@ -3340,9 +3340,9 @@ function deserializePaintDocument(raw) {
|
|
|
3340
3340
|
const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
|
|
3341
3341
|
const paper = normalizePaper(_nullishCoalesce(r.paper, () => ( {})));
|
|
3342
3342
|
const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
|
|
3343
|
-
const layers = paintLayersOnly(
|
|
3343
|
+
const layers = paintLayersOnly(_chunk4PUPGALMcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
|
|
3344
3344
|
const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
|
|
3345
|
-
const activeLayerId = wanted &&
|
|
3345
|
+
const activeLayerId = wanted && _chunkDFFBJV3Ucjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers), 'access', _73 => _73.filter, 'call', _74 => _74((l) => l.type === "pixel"), 'access', _75 => _75.pop, 'call', _76 => _76(), 'optionalAccess', _77 => _77.id]), () => ( null));
|
|
3346
3346
|
const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
|
|
3347
3347
|
const state = { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) };
|
|
3348
3348
|
if (wetEvents.length) state.wetEvents = wetEvents;
|
|
@@ -3354,7 +3354,7 @@ async function deserializePaintDocumentAsync(raw, store) {
|
|
|
3354
3354
|
if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
|
|
3355
3355
|
const r = raw;
|
|
3356
3356
|
const problems = [];
|
|
3357
|
-
const assets = await
|
|
3357
|
+
const assets = await _chunk4PUPGALMcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
|
|
3358
3358
|
const loaded = deserializePaintDocument({ ...r, assets });
|
|
3359
3359
|
return { ...loaded, problems: [...problems, ...loaded.problems] };
|
|
3360
3360
|
}
|
|
@@ -4592,7 +4592,7 @@ function replayItems(doc) {
|
|
|
4592
4592
|
}
|
|
4593
4593
|
function emptiedLayers(layers) {
|
|
4594
4594
|
let out = [...layers];
|
|
4595
|
-
for (const l of
|
|
4595
|
+
for (const l of _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers)) if (l.type === "pixel") out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out, l.id, () => ({ ...l, surface: _chunk7ISPWEJAcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }));
|
|
4596
4596
|
return out;
|
|
4597
4597
|
}
|
|
4598
4598
|
async function replayPainting(source, target, options = {}) {
|
|
@@ -4853,12 +4853,12 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
4853
4853
|
canvas: () => this.doc.canvas,
|
|
4854
4854
|
paper: () => this.doc.paper,
|
|
4855
4855
|
layerSurface: (id) => {
|
|
4856
|
-
const l = _optionalChain([
|
|
4856
|
+
const l = _optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _143 => _143.layer]);
|
|
4857
4857
|
return isPixelLayer(l) ? l.surface : null;
|
|
4858
4858
|
},
|
|
4859
4859
|
updateSurfaces: (surfaces, rects) => {
|
|
4860
4860
|
let layers = this.doc.layers;
|
|
4861
|
-
for (const [id, surface] of surfaces) if (
|
|
4861
|
+
for (const [id, surface] of surfaces) if (_chunkDFFBJV3Ucjs.findLayer.call(void 0, layers, id)) layers = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, layers, id, (l) => ({ ...l, surface }));
|
|
4862
4862
|
this.doc = { ...this.doc, layers };
|
|
4863
4863
|
this.emit(rects.length ? rects : "all");
|
|
4864
4864
|
},
|
|
@@ -5099,7 +5099,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5099
5099
|
}
|
|
5100
5100
|
// --- Layers --------------------------------------------------------------------
|
|
5101
5101
|
getLayer(id) {
|
|
5102
|
-
return _optionalChain([
|
|
5102
|
+
return _optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _155 => _155.layer]);
|
|
5103
5103
|
}
|
|
5104
5104
|
/** The active pixel layer (or `undefined`). */
|
|
5105
5105
|
getActiveLayer() {
|
|
@@ -5118,12 +5118,12 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5118
5118
|
walk(this.doc.layers, null, 0);
|
|
5119
5119
|
return out;
|
|
5120
5120
|
}
|
|
5121
|
-
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([
|
|
5121
|
+
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _156 => _156.parent, 'optionalAccess', _157 => _157.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _158 => _158.path, 'access', _159 => _159.length]), () => ( 0))) {
|
|
5122
5122
|
let bounds = null;
|
|
5123
5123
|
if (l.type === "pixel") {
|
|
5124
5124
|
const b = _chunk7ISPWEJAcjs.contentBounds.call(void 0, l.surface);
|
|
5125
5125
|
bounds = b ? { ...b, x: b.x + l.offset.x, y: b.y + l.offset.y } : null;
|
|
5126
|
-
} else for (const c of
|
|
5126
|
+
} else for (const c of _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, l.children)) if (c.type === "pixel") bounds = unionRect(bounds, this.describeLayer(c, l.id, depth + 1).bounds);
|
|
5127
5127
|
return {
|
|
5128
5128
|
id: l.id,
|
|
5129
5129
|
name: l.name,
|
|
@@ -5150,7 +5150,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5150
5150
|
if (!id) throw new PaintEditorError(`There is no active layer to ${what}; add one with add_layer.`);
|
|
5151
5151
|
const l = this.requireLayer(id);
|
|
5152
5152
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; ${what} a pixel layer inside it.`);
|
|
5153
|
-
if (
|
|
5153
|
+
if (_chunkDFFBJV3Ucjs.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.`);
|
|
5154
5154
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) before you ${what} it.`);
|
|
5155
5155
|
return l;
|
|
5156
5156
|
}
|
|
@@ -5163,7 +5163,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5163
5163
|
/** Adds an empty pixel layer or group above `aboveId` (default: the active layer) and makes it active. */
|
|
5164
5164
|
addLayer(options = {}) {
|
|
5165
5165
|
this.requireIdle("adding a layer");
|
|
5166
|
-
const count =
|
|
5166
|
+
const count = _chunkDFFBJV3Ucjs.flattenLayers.call(void 0, this.doc.layers).length;
|
|
5167
5167
|
const type = _nullishCoalesce(options.type, () => ( "pixel"));
|
|
5168
5168
|
const name = _optionalChain([options, 'access', _160 => _160.name, 'optionalAccess', _161 => _161.trim, 'call', _162 => _162()]) || (type === "group" ? `Group ${count + 1}` : `Layer ${count + 1}`);
|
|
5169
5169
|
const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
|
|
@@ -5175,19 +5175,19 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5175
5175
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
5176
5176
|
parentId = g.id;
|
|
5177
5177
|
} else if (above) {
|
|
5178
|
-
const loc =
|
|
5178
|
+
const loc = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, above);
|
|
5179
5179
|
if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
|
|
5180
5180
|
parentId = _nullishCoalesce(_optionalChain([loc, 'access', _163 => _163.parent, 'optionalAccess', _164 => _164.id]), () => ( null));
|
|
5181
5181
|
index = loc.index + 1;
|
|
5182
5182
|
}
|
|
5183
|
-
const layers =
|
|
5183
|
+
const layers = _chunkDFFBJV3Ucjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
|
|
5184
5184
|
this.commit(type === "group" ? "Add group" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id });
|
|
5185
5185
|
return this.describeLayer(layer);
|
|
5186
5186
|
}
|
|
5187
5187
|
updateLayer(id, update) {
|
|
5188
5188
|
this.requireIdle("changing a layer");
|
|
5189
5189
|
const l = this.requireLayer(id);
|
|
5190
|
-
if (
|
|
5190
|
+
if (_chunkDFFBJV3Ucjs.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}).`);
|
|
5191
5191
|
if (update.opacity !== void 0 && !(update.opacity >= 0 && update.opacity <= 1)) throw new PaintEditorError(`opacity ${update.opacity} is out of range; use 0..1.`);
|
|
5192
5192
|
if (update.blend !== void 0 && !_chunk7ISPWEJAcjs.isBlendMode.call(void 0, update.blend) && !(l.type === "group" && update.blend === "pass-through")) {
|
|
5193
5193
|
throw new PaintEditorError(`Unknown blend mode "${update.blend}". Call get_canvas_info for the blend modes.`);
|
|
@@ -5203,31 +5203,31 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5203
5203
|
const locks = { ..._nullishCoalesce(l.locks, () => ( {})), ...update.locks };
|
|
5204
5204
|
next.locks = Object.values(locks).some(Boolean) ? locks : void 0;
|
|
5205
5205
|
}
|
|
5206
|
-
this.commit("Layer properties", { ...this.doc, layers:
|
|
5206
|
+
this.commit("Layer properties", { ...this.doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, id, () => next) });
|
|
5207
5207
|
return this.describeLayer(next);
|
|
5208
5208
|
}
|
|
5209
5209
|
removeLayer(id) {
|
|
5210
5210
|
this.requireIdle("removing a layer");
|
|
5211
5211
|
const l = this.requireLayer(id);
|
|
5212
|
-
if (
|
|
5213
|
-
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" &&
|
|
5212
|
+
if (_chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it before removing it.`);
|
|
5213
|
+
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" && _chunkDFFBJV3Ucjs.findLayer.call(void 0, l.children, x));
|
|
5214
5214
|
if (wetIds.length) {
|
|
5215
5215
|
this.beginWetOp();
|
|
5216
5216
|
for (const x of wetIds) this.wet.world.removeLane(x);
|
|
5217
5217
|
}
|
|
5218
|
-
const layers =
|
|
5218
|
+
const layers = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
5219
5219
|
let active = this.doc.activeLayerId;
|
|
5220
|
-
if (active && !
|
|
5221
|
-
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(
|
|
5220
|
+
if (active && !_chunkDFFBJV3Ucjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkDFFBJV3Ucjs.flattenLayers.call(void 0, layers), 'access', _165 => _165.filter, 'call', _166 => _166((x) => x.type === "pixel"), 'access', _167 => _167.pop, 'call', _168 => _168(), 'optionalAccess', _169 => _169.id]), () => ( null));
|
|
5221
|
+
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunkDFFBJV3Ucjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunkDFFBJV3Ucjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
|
|
5222
5222
|
return { removed: id, activeLayerId: active };
|
|
5223
5223
|
}
|
|
5224
5224
|
duplicateLayer(id) {
|
|
5225
5225
|
this.requireIdle("duplicating a layer");
|
|
5226
|
-
if (
|
|
5226
|
+
if (_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id)) {
|
|
5227
5227
|
const inside = (l) => l.type === "group" ? l.children.flatMap(inside) : [l.id];
|
|
5228
|
-
this.dryLayersFirst(inside(
|
|
5228
|
+
this.dryLayersFirst(inside(_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id).layer));
|
|
5229
5229
|
}
|
|
5230
|
-
const loc =
|
|
5230
|
+
const loc = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id);
|
|
5231
5231
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
5232
5232
|
const thick = { ..._nullishCoalesce(this.doc.thick, () => ( {})) };
|
|
5233
5233
|
const stickers = { ..._nullishCoalesce(this.doc.stickers, () => ( {})) };
|
|
@@ -5238,43 +5238,43 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5238
5238
|
return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
|
|
5239
5239
|
};
|
|
5240
5240
|
const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
|
|
5241
|
-
const layers =
|
|
5241
|
+
const layers = _chunkDFFBJV3Ucjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _170 => _170.parent, 'optionalAccess', _171 => _171.id]), () => ( null)), loc.index + 1);
|
|
5242
5242
|
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {} }));
|
|
5243
5243
|
return this.describeLayer(dup);
|
|
5244
5244
|
}
|
|
5245
5245
|
/** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
|
|
5246
5246
|
moveLayer(id, index, parentId) {
|
|
5247
5247
|
this.requireIdle("moving a layer");
|
|
5248
|
-
const loc =
|
|
5248
|
+
const loc = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id);
|
|
5249
5249
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
5250
5250
|
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _172 => _172.parent, 'optionalAccess', _173 => _173.id]), () => ( null)) : parentId;
|
|
5251
5251
|
if (target) {
|
|
5252
5252
|
const g = this.requireLayer(target);
|
|
5253
5253
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
5254
|
-
if (target === id || loc.layer.type === "group" &&
|
|
5254
|
+
if (target === id || loc.layer.type === "group" && _chunkDFFBJV3Ucjs.findLayer.call(void 0, loc.layer.children, target)) throw new PaintEditorError("A group cannot move into itself.");
|
|
5255
5255
|
}
|
|
5256
|
-
const without =
|
|
5257
|
-
const siblings = target ?
|
|
5256
|
+
const without = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
5257
|
+
const siblings = target ? _chunkDFFBJV3Ucjs.findLayer.call(void 0, without, target).layer.children : without;
|
|
5258
5258
|
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).`);
|
|
5259
|
-
const layers =
|
|
5259
|
+
const layers = _chunkDFFBJV3Ucjs.insertLayer.call(void 0, without, loc.layer, target, index);
|
|
5260
5260
|
this.commit("Move layer", { ...this.doc, layers });
|
|
5261
5261
|
return this.describeLayer(loc.layer);
|
|
5262
5262
|
}
|
|
5263
5263
|
/** Merges a pixel layer into the pixel layer below it (keeping the lower one's settings). */
|
|
5264
5264
|
mergeDown(id) {
|
|
5265
5265
|
this.requireIdle("merging");
|
|
5266
|
-
const pre =
|
|
5266
|
+
const pre = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id);
|
|
5267
5267
|
if (pre) {
|
|
5268
5268
|
const sib = pre.parent ? pre.parent.children : this.doc.layers;
|
|
5269
5269
|
this.dryLayersFirst([id, _optionalChain([sib, 'access', _174 => _174[pre.index - 1], 'optionalAccess', _175 => _175.id])].filter((x) => Boolean(x)));
|
|
5270
5270
|
}
|
|
5271
|
-
const loc =
|
|
5271
|
+
const loc = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id);
|
|
5272
5272
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
5273
5273
|
const siblings = loc.parent ? loc.parent.children : this.doc.layers;
|
|
5274
5274
|
const below = siblings[loc.index - 1];
|
|
5275
5275
|
const upper = loc.layer;
|
|
5276
5276
|
if (!isPixelLayer(upper) || !isPixelLayer(below)) throw new PaintEditorError("Merge down needs a pixel layer directly above another pixel layer in the same group.");
|
|
5277
|
-
if (
|
|
5277
|
+
if (_chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, below, "pixels")) throw new PaintEditorError(`Layer "${below.name}" has its pixels locked; unlock it to merge into it.`);
|
|
5278
5278
|
const rect = unionRect(this.describeLayer(below).bounds, this.describeLayer(upper).bounds);
|
|
5279
5279
|
let surface = _chunk7ISPWEJAcjs.emptySurface.call(void 0, 4);
|
|
5280
5280
|
if (rect) {
|
|
@@ -5284,7 +5284,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5284
5284
|
surface = _chunk7ISPWEJAcjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
|
|
5285
5285
|
}
|
|
5286
5286
|
const merged = { ...below, surface, offset: { x: 0, y: 0 } };
|
|
5287
|
-
const layers =
|
|
5287
|
+
const layers = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
|
|
5288
5288
|
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]) }));
|
|
5289
5289
|
return this.describeLayer(merged);
|
|
5290
5290
|
}
|
|
@@ -5297,7 +5297,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5297
5297
|
this.wet.world.removeLane(l.id);
|
|
5298
5298
|
}
|
|
5299
5299
|
const bounds = this.describeLayer(l).bounds;
|
|
5300
|
-
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers:
|
|
5300
|
+
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunk7ISPWEJAcjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]) }, { kind: "clear", layerId: l.id }));
|
|
5301
5301
|
return { layerId: l.id, bounds };
|
|
5302
5302
|
}
|
|
5303
5303
|
/**
|
|
@@ -5335,12 +5335,12 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5335
5335
|
background: rgbaOf(this.doc.paper.color),
|
|
5336
5336
|
opacity,
|
|
5337
5337
|
blend,
|
|
5338
|
-
lockTransparency:
|
|
5338
|
+
lockTransparency: _chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, l, "transparency"),
|
|
5339
5339
|
selection: null,
|
|
5340
5340
|
offset: l.offset
|
|
5341
5341
|
};
|
|
5342
5342
|
const surface = this.applyCoverage(l, coverage, rect, apply);
|
|
5343
|
-
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers:
|
|
5343
|
+
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })) }), { kind: "fill", layerId: l.id, data: { color, opacity, grain: grainAmount, pressure, blend } }));
|
|
5344
5344
|
return { layerId: l.id, bounds: rect };
|
|
5345
5345
|
}
|
|
5346
5346
|
applyCoverage(l, coverage, rect, apply) {
|
|
@@ -5536,11 +5536,11 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5536
5536
|
let layer = (() => {
|
|
5537
5537
|
const id = _nullishCoalesce(init.layerId, () => ( doc.activeLayerId));
|
|
5538
5538
|
if (!id) throw new PaintEditorError("There is no active layer to paint on; add one with add_layer.");
|
|
5539
|
-
const loc =
|
|
5539
|
+
const loc = _chunkDFFBJV3Ucjs.findLayer.call(void 0, doc.layers, id);
|
|
5540
5540
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
5541
5541
|
const l = loc.layer;
|
|
5542
5542
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; paint on a pixel layer inside it.`);
|
|
5543
|
-
if (
|
|
5543
|
+
if (_chunkDFFBJV3Ucjs.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.`);
|
|
5544
5544
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) to paint on it.`);
|
|
5545
5545
|
return l;
|
|
5546
5546
|
})();
|
|
@@ -5556,8 +5556,8 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5556
5556
|
this.requireWetIdle("painting");
|
|
5557
5557
|
if (layer.offset.x || layer.offset.y) {
|
|
5558
5558
|
const moved = { ...layer, surface: _chunk7ISPWEJAcjs.translateSurface.call(void 0, layer.surface, layer.offset.x, layer.offset.y), offset: { x: 0, y: 0 } };
|
|
5559
|
-
this.doc = { ...this.doc, layers:
|
|
5560
|
-
if (doc !== this.doc) doc = { ...doc, layers:
|
|
5559
|
+
this.doc = { ...this.doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => moved) };
|
|
5560
|
+
if (doc !== this.doc) doc = { ...doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, doc.layers, layer.id, () => moved) };
|
|
5561
5561
|
layer = moved;
|
|
5562
5562
|
}
|
|
5563
5563
|
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >= _chunkL3PXFMOFcjs.MAX_WET_LANES) {
|
|
@@ -5587,7 +5587,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5587
5587
|
wet = { driver, surface: () => world.display(id).surface };
|
|
5588
5588
|
} else if (this.wet.wetLayerIds().includes(layer.id)) {
|
|
5589
5589
|
this.dryLayersFirst([layer.id]);
|
|
5590
|
-
const dried =
|
|
5590
|
+
const dried = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, layer.id).layer;
|
|
5591
5591
|
layer = dried;
|
|
5592
5592
|
}
|
|
5593
5593
|
let color = init.color === void 0 ? this.color : parseColor(init.color);
|
|
@@ -5606,7 +5606,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5606
5606
|
layerId: layer.id,
|
|
5607
5607
|
surface: layer.surface,
|
|
5608
5608
|
offset: layer.offset,
|
|
5609
|
-
lockTransparency:
|
|
5609
|
+
lockTransparency: _chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, layer, "transparency"),
|
|
5610
5610
|
brush,
|
|
5611
5611
|
color: rgba,
|
|
5612
5612
|
background: rgbaOf(doc.paper.color),
|
|
@@ -5699,7 +5699,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5699
5699
|
const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
|
|
5700
5700
|
const sprayed = s.stickers();
|
|
5701
5701
|
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _198 => _198.doc, 'access', _199 => _199.stickers, 'optionalAccess', _200 => _200[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
|
|
5702
|
-
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers:
|
|
5702
|
+
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {} }), wetStroke ? before : this.doc);
|
|
5703
5703
|
}
|
|
5704
5704
|
};
|
|
5705
5705
|
let session;
|
|
@@ -5727,13 +5727,13 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5727
5727
|
if (cancelled || !surface) return;
|
|
5728
5728
|
const stroke = this.record(s);
|
|
5729
5729
|
s.result.strokeId = stroke.id;
|
|
5730
|
-
const l =
|
|
5730
|
+
const l = _chunkDFFBJV3Ucjs.findLayer.call(void 0, out.layers, s.layerId).layer;
|
|
5731
5731
|
const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
|
|
5732
5732
|
const ch = s.thickChannels();
|
|
5733
5733
|
const sprayed = s.stickers();
|
|
5734
5734
|
out = {
|
|
5735
5735
|
...out,
|
|
5736
|
-
layers:
|
|
5736
|
+
layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
|
|
5737
5737
|
strokes: [...out.strokes, stroke],
|
|
5738
5738
|
...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
|
|
5739
5739
|
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _201 => _201.stickers, 'optionalAccess', _202 => _202[l.id]]), () => ( [])), ...sprayed] } } : {}
|
|
@@ -5748,8 +5748,8 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5748
5748
|
if (this.wet.instantDry && result.strokeId) {
|
|
5749
5749
|
this.wet.dry(session.layerId);
|
|
5750
5750
|
this.logWet({ kind: "dry", layerId: session.layerId, at: out.strokes.length });
|
|
5751
|
-
const dried =
|
|
5752
|
-
out = { ...out, layers:
|
|
5751
|
+
const dried = _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, session.layerId).layer.surface;
|
|
5752
|
+
out = { ...out, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out.layers, session.layerId, (l) => ({ ...l, surface: dried })) };
|
|
5753
5753
|
}
|
|
5754
5754
|
result.wet = this.wet.isWet(session.layerId);
|
|
5755
5755
|
}
|
|
@@ -5827,7 +5827,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
5827
5827
|
brush = normalizePaintBrush({ tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
|
|
5828
5828
|
}
|
|
5829
5829
|
const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
|
|
5830
|
-
if (!
|
|
5830
|
+
if (!_chunkDFFBJV3Ucjs.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.`);
|
|
5831
5831
|
let load = s.load;
|
|
5832
5832
|
if (load && options.color !== void 0 && load.reservoir) {
|
|
5833
5833
|
const [r, g, b] = hexToRgb8(options.color);
|
|
@@ -6018,7 +6018,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6018
6018
|
wetPaper(options = {}) {
|
|
6019
6019
|
this.requireIdle("wetting the paper");
|
|
6020
6020
|
const l = this.wetLayer(options.layerId, "wet the paper of");
|
|
6021
|
-
if (
|
|
6021
|
+
if (_chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it first.`);
|
|
6022
6022
|
const amount = _nullishCoalesce(options.amount, () => ( 1));
|
|
6023
6023
|
if (!(amount > 0 && amount <= 1)) throw new PaintEditorError(`amount ${amount} is out of range; use above 0 up to 1.`);
|
|
6024
6024
|
const rect = _nullishCoalesce(this.checkRect(options.rect), () => ( { x: 0, y: 0, width: this.doc.canvas.width, height: this.doc.canvas.height }));
|
|
@@ -6102,7 +6102,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6102
6102
|
const live = this.live;
|
|
6103
6103
|
if (!live) return this.doc.layers;
|
|
6104
6104
|
if (_optionalChain([this, 'access', _212 => _212.liveLayers, 'optionalAccess', _213 => _213.key]) === live.surface) return this.liveLayers.layers;
|
|
6105
|
-
const layers =
|
|
6105
|
+
const layers = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
|
|
6106
6106
|
this.liveLayers = { key: live.surface, layers };
|
|
6107
6107
|
return layers;
|
|
6108
6108
|
}
|
|
@@ -6131,7 +6131,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6131
6131
|
let out = layers;
|
|
6132
6132
|
for (const id of ids) {
|
|
6133
6133
|
const baked = this.wet.bakedSurface(id);
|
|
6134
|
-
if (baked &&
|
|
6134
|
+
if (baked && _chunkDFFBJV3Ucjs.findLayer.call(void 0, out, id)) out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out, id, (l) => ({ ...l, surface: baked }));
|
|
6135
6135
|
}
|
|
6136
6136
|
return out;
|
|
6137
6137
|
}
|
|
@@ -6144,12 +6144,12 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6144
6144
|
const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
|
|
6145
6145
|
for (const id of ids) {
|
|
6146
6146
|
const ch = _optionalChain([live, 'optionalAccess', _216 => _216.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _217 => _217[id]]);
|
|
6147
|
-
const l = ch && _optionalChain([
|
|
6147
|
+
const l = ch && _optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, out, id), 'optionalAccess', _218 => _218.layer]);
|
|
6148
6148
|
if (!ch || !isPixelLayer(l)) continue;
|
|
6149
6149
|
let cache = this.litCaches.get(id);
|
|
6150
6150
|
if (!cache) this.litCaches.set(id, cache = new LitCache());
|
|
6151
6151
|
const lit = cache.lit(l.surface, ch, this.lighting);
|
|
6152
|
-
if (lit !== l.surface) out =
|
|
6152
|
+
if (lit !== l.surface) out = _chunkDFFBJV3Ucjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: lit }));
|
|
6153
6153
|
}
|
|
6154
6154
|
return out;
|
|
6155
6155
|
}
|
|
@@ -6157,7 +6157,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6157
6157
|
let layers = this.litLayers((_nullishCoalesce(options.wet, () => ( "display"))) === "dried" ? this.driedLayers() : this.currentLayers());
|
|
6158
6158
|
if (options.layerIds) {
|
|
6159
6159
|
const picked = [];
|
|
6160
|
-
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([
|
|
6160
|
+
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, layers, id), 'optionalAccess', _219 => _219.layer]), () => ( this.requireLayer(id))));
|
|
6161
6161
|
layers = picked.map((l) => ({ ...l, visible: true }));
|
|
6162
6162
|
}
|
|
6163
6163
|
const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
|
|
@@ -6199,7 +6199,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6199
6199
|
/** Wet settings saved with the document (`null` when they are all defaults). */
|
|
6200
6200
|
wetJSON() {
|
|
6201
6201
|
const layers = {};
|
|
6202
|
-
for (const [id, set] of this.wet.settings) if (
|
|
6202
|
+
for (const [id, set] of this.wet.settings) if (_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id)) layers[id] = { params: { ...set.params }, flow: { ...set.flow } };
|
|
6203
6203
|
const flat = this.wet.tilt.angle === 0;
|
|
6204
6204
|
if (!Object.keys(layers).length && flat) return void 0;
|
|
6205
6205
|
return { tilt: { ...this.wet.tilt }, layers };
|
|
@@ -6225,14 +6225,14 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6225
6225
|
const ext = { ...this.extensions };
|
|
6226
6226
|
const channels = {};
|
|
6227
6227
|
for (const [id, ch] of Object.entries(_nullishCoalesce(this.doc.thick, () => ( {})))) {
|
|
6228
|
-
if (!
|
|
6228
|
+
if (!_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id)) continue;
|
|
6229
6229
|
const saved = thickToJSON(ch);
|
|
6230
6230
|
if (saved) channels[id] = saved;
|
|
6231
6231
|
}
|
|
6232
6232
|
if (Object.keys(channels).length) ext.layerChannels = channels;
|
|
6233
6233
|
else delete ext.layerChannels;
|
|
6234
6234
|
const stickers = {};
|
|
6235
|
-
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length &&
|
|
6235
|
+
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length && _chunkDFFBJV3Ucjs.findLayer.call(void 0, this.doc.layers, id)) stickers[id] = list.map((x) => ({ ...x }));
|
|
6236
6236
|
if (Object.keys(stickers).length) ext.stickers = stickers;
|
|
6237
6237
|
else delete ext.stickers;
|
|
6238
6238
|
if (this.lighting.azimuth !== DEFAULT_LIGHTING.azimuth || this.lighting.elevation !== DEFAULT_LIGHTING.elevation || this.lighting.relief !== DEFAULT_LIGHTING.relief) ext.lighting = { ...this.lighting };
|
|
@@ -6246,7 +6246,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6246
6246
|
if (ext.stickers && typeof ext.stickers === "object") {
|
|
6247
6247
|
const stickers = {};
|
|
6248
6248
|
for (const [id, list] of Object.entries(ext.stickers)) {
|
|
6249
|
-
if (!
|
|
6249
|
+
if (!_chunkDFFBJV3Ucjs.findLayer.call(void 0, state.layers, id) || !Array.isArray(list)) continue;
|
|
6250
6250
|
const ok = list.filter((x) => x && typeof x.id === "string" && STAMP_KINDS.includes(x.stamp) && Number.isFinite(x.x) && Number.isFinite(x.y) && x.size > 0);
|
|
6251
6251
|
if (ok.length !== list.length) problems.push(`Some stickers of layer "${id}" could not be read; they were dropped.`);
|
|
6252
6252
|
stickers[id] = ok.map((x) => ({ ...x }));
|
|
@@ -6257,7 +6257,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6257
6257
|
if (!raw || typeof raw !== "object") return state;
|
|
6258
6258
|
const thick = {};
|
|
6259
6259
|
for (const [id, v] of Object.entries(raw)) {
|
|
6260
|
-
if (!
|
|
6260
|
+
if (!_chunkDFFBJV3Ucjs.findLayer.call(void 0, state.layers, id)) continue;
|
|
6261
6261
|
try {
|
|
6262
6262
|
thick[id] = thickFromJSON(v);
|
|
6263
6263
|
} catch (e) {
|
|
@@ -6371,7 +6371,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6371
6371
|
return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
|
|
6372
6372
|
});
|
|
6373
6373
|
const layers = toStandard(dried);
|
|
6374
|
-
const result =
|
|
6374
|
+
const result = _chunk4PUPGALMcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
6375
6375
|
for (const [mode, names] of changed) {
|
|
6376
6376
|
const label = _nullishCoalesce(_optionalChain([_chunk7ISPWEJAcjs.BLEND_MODES, 'access', _225 => _225.find, 'call', _226 => _226((m) => m.id === mode), 'optionalAccess', _227 => _227.label]), () => ( mode));
|
|
6377
6377
|
const std = _nullishCoalesce(_optionalChain([_chunk7ISPWEJAcjs.BLEND_MODES, 'access', _228 => _228.find, 'call', _229 => _229((m) => m.id === _chunk7ISPWEJAcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _230 => _230.label]), () => ( _chunk7ISPWEJAcjs.standardBlendMode.call(void 0, mode)));
|
|
@@ -6621,9 +6621,9 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6621
6621
|
}
|
|
6622
6622
|
/** Replaces a layer's stickers and redraws its pixels from them (one undo step). */
|
|
6623
6623
|
commitStickers(label, layer, stickers) {
|
|
6624
|
-
if (
|
|
6624
|
+
if (_chunkDFFBJV3Ucjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it first.`);
|
|
6625
6625
|
const surface = stickerSurface(stickers);
|
|
6626
|
-
const doc = { ...this.doc, layers:
|
|
6626
|
+
const doc = { ...this.doc, layers: _chunkDFFBJV3Ucjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => ({ ...layer, surface, offset: { x: 0, y: 0 } })), stickers: { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [layer.id]: stickers } };
|
|
6627
6627
|
this.commit(label, this.withPaintEvent(doc, { kind: "stickers", layerId: layer.id, data: { stickers: stickers.map((s) => ({ ...s })) } }));
|
|
6628
6628
|
}
|
|
6629
6629
|
/** Moves, turns, resizes, recolours or restamps one sticker (one undo step). Returns it. */
|
|
@@ -6869,7 +6869,7 @@ var PaintEditorController = (_class17 = class _PaintEditorController {
|
|
|
6869
6869
|
}
|
|
6870
6870
|
/** A layer's tile surface (live while stroking), for thumbnails. */
|
|
6871
6871
|
layerSurface(id) {
|
|
6872
|
-
const l = _optionalChain([
|
|
6872
|
+
const l = _optionalChain([_chunkDFFBJV3Ucjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _253 => _253.layer]);
|
|
6873
6873
|
return isPixelLayer(l) ? l.surface : null;
|
|
6874
6874
|
}
|
|
6875
6875
|
}, _class17);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a1 as RasterLayer, a0 as RasterGroupLayer, a5 as RasterPixelLayer, C as CompositorLayer, a as RasterCompositor, R as RasterSources, U as LayerLocks } from '../
|
|
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-QS3ppbMX.cjs';
|
|
2
2
|
import { D as Dab, C as CoverageMap, B as BrushSettings, e as StrokePoint, P as PaintTileTarget, T as TileMedium, M as MixerSettings, h as MixingModel, i as BlenderSettings, j as SmudgeSettings, a as MixerLoad, W as WetWorld, k as WetTilt, l as WetParams, m as WetFlowSpec, n as RgbTriple, o as WetWorldOptions, p as WetBackendInfo, q as WetSnapshot, r as WetPaperInput } from '../flow-A2Dj-69w.cjs';
|
|
3
3
|
export { s as DEFAULT_FLOW, t as DEFAULT_WET_PARAMS, u as MAX_BRUSH_SIZE, v as WET_FLOW_KINDS, w as WET_PARAM_KEYS, x as WetFlowKind, y as WetSupport, z as normalizeFlow, A as normalizeWetParams, E as wetSupport } from '../flow-A2Dj-69w.cjs';
|
|
4
4
|
import { R as RasterRect, j as TiledSurface, a as BlendMode, b as BlendModeInfo } from '../surface-Cn30xIV6.cjs';
|
|
5
5
|
export { B as BLEND_MODES, P as PAINTERLY_BLEND_MODES, h as Tile, v as isBlendMode, w as isPainterlyBlendMode, I as standardBlendMode } from '../surface-Cn30xIV6.cjs';
|
|
6
|
-
import { I as ImageEditorAssetStore, S as SerializedLayer, P as PsdExportResult } from '../export-
|
|
6
|
+
import { I as ImageEditorAssetStore, S as SerializedLayer, P as PsdExportResult } from '../export-jKKj8Fg8.cjs';
|
|
7
7
|
import { V as VideoProject, A as VideoFfmpegExport } from '../export-Dv0-ZVrV.cjs';
|
|
8
8
|
import { g as PresenceStore, e as PresenceClock, d as PresenceActorInfo, c as PresenceActor, f as PresenceState } from '../presence-Cb6WhcrQ.cjs';
|
|
9
9
|
import { a as AgentToolProvider, A as AgentTool } from '../registry-BqA1AZt0.cjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a1 as RasterLayer, a0 as RasterGroupLayer, a5 as RasterPixelLayer, C as CompositorLayer, a as RasterCompositor, R as RasterSources, U as LayerLocks } from '../
|
|
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-DLwKZDFr.js';
|
|
2
2
|
import { D as Dab, C as CoverageMap, B as BrushSettings, e as StrokePoint, P as PaintTileTarget, T as TileMedium, M as MixerSettings, h as MixingModel, i as BlenderSettings, j as SmudgeSettings, a as MixerLoad, W as WetWorld, k as WetTilt, l as WetParams, m as WetFlowSpec, n as RgbTriple, o as WetWorldOptions, p as WetBackendInfo, q as WetSnapshot, r as WetPaperInput } from '../flow-C95atNoQ.js';
|
|
3
3
|
export { s as DEFAULT_FLOW, t as DEFAULT_WET_PARAMS, u as MAX_BRUSH_SIZE, v as WET_FLOW_KINDS, w as WET_PARAM_KEYS, x as WetFlowKind, y as WetSupport, z as normalizeFlow, A as normalizeWetParams, E as wetSupport } from '../flow-C95atNoQ.js';
|
|
4
4
|
import { R as RasterRect, j as TiledSurface, a as BlendMode, b as BlendModeInfo } from '../surface-Cn30xIV6.js';
|
|
5
5
|
export { B as BLEND_MODES, P as PAINTERLY_BLEND_MODES, h as Tile, v as isBlendMode, w as isPainterlyBlendMode, I as standardBlendMode } from '../surface-Cn30xIV6.js';
|
|
6
|
-
import { I as ImageEditorAssetStore, S as SerializedLayer, P as PsdExportResult } from '../export-
|
|
6
|
+
import { I as ImageEditorAssetStore, S as SerializedLayer, P as PsdExportResult } from '../export-VmTofKIk.js';
|
|
7
7
|
import { V as VideoProject, A as VideoFfmpegExport } from '../export-Dv0-ZVrV.js';
|
|
8
8
|
import { g as PresenceStore, e as PresenceClock, d as PresenceActorInfo, c as PresenceActor, f as PresenceState } from '../presence-Cb6WhcrQ.js';
|
|
9
9
|
import { a as AgentToolProvider, A as AgentTool } from '../registry-D-4fit9C.js';
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
resolveExternalAssets,
|
|
8
8
|
serializeLayers,
|
|
9
9
|
serializeLayersExternal
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-IX3YKUVK.js";
|
|
11
11
|
import {
|
|
12
12
|
RasterCompositor,
|
|
13
13
|
findLayer,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
insertLayer,
|
|
16
16
|
isLayerLocked,
|
|
17
17
|
mapLayer
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-CLTTLLWA.js";
|
|
19
19
|
import "../chunk-GX332W2C.js";
|
|
20
20
|
import {
|
|
21
21
|
CoverageMap,
|
package/dist/raster/index.cjs
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkDFFBJV3Ucjs = require('../chunk-DFFBJV3U.cjs');
|
|
65
65
|
require('../chunk-MUUXNRU4.cjs');
|
|
66
66
|
|
|
67
67
|
|
|
@@ -286,5 +286,5 @@ var _chunk643B2HKCcjs = require('../chunk-643B2HKC.cjs');
|
|
|
286
286
|
|
|
287
287
|
|
|
288
288
|
|
|
289
|
-
exports.BIT_DEPTHS = _chunk7ISPWEJAcjs.BIT_DEPTHS; exports.BLEND_MODES = _chunk7ISPWEJAcjs.BLEND_MODES; exports.CURVE_LUT_SIZE =
|
|
289
|
+
exports.BIT_DEPTHS = _chunk7ISPWEJAcjs.BIT_DEPTHS; exports.BLEND_MODES = _chunk7ISPWEJAcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkDFFBJV3Ucjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkDFFBJV3Ucjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkDFFBJV3Ucjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DeepCompositor = _chunkDFFBJV3Ucjs.DeepCompositor; exports.INTERPOLATIONS = _chunkDFFBJV3Ucjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkDFFBJV3Ucjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkDFFBJV3Ucjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkDFFBJV3Ucjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkDFFBJV3Ucjs.MAX_TRANSFORM_PIXELS; exports.PAINTERLY_BLEND_MODES = _chunk7ISPWEJAcjs.PAINTERLY_BLEND_MODES; exports.PatternPlacement = _chunkDFFBJV3Ucjs.PatternPlacement; exports.PatternTile = _chunkDFFBJV3Ucjs.PatternTile; exports.RasterCompositor = _chunkDFFBJV3Ucjs.RasterCompositor; exports.SHADOW_AMBIENT = _chunk7ISPWEJAcjs.SHADOW_AMBIENT; exports.STROKE_CHAMFER_MAX = _chunkDFFBJV3Ucjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunk7ISPWEJAcjs.SurfaceDraft; exports.TILE = _chunk7ISPWEJAcjs.TILE; exports.TILE_SHIFT = _chunk7ISPWEJAcjs.TILE_SHIFT; exports.TiledSurface = _chunk7ISPWEJAcjs.TiledSurface; exports.TransformTooLargeError = _chunkDFFBJV3Ucjs.TransformTooLargeError; exports.ZlibError = _chunk643B2HKCcjs.ZlibError; exports.activeEffectItems = _chunkDFFBJV3Ucjs.activeEffectItems; exports.adler32 = _chunk643B2HKCcjs.adler32; exports.base64ToBytes = _chunkDCLJNVZScjs.base64ToBytes; exports.blendChannel = _chunk7ISPWEJAcjs.blendChannel; exports.blendImageData = _chunk7ISPWEJAcjs.blendImageData; exports.blendLum = _chunk7ISPWEJAcjs.blendLum; exports.blendPixel = _chunk7ISPWEJAcjs.blendPixel; exports.blendRgb = _chunk7ISPWEJAcjs.blendRgb; exports.blendTile = _chunkDFFBJV3Ucjs.blendTile; exports.buildEffectMaps = _chunkDFFBJV3Ucjs.buildEffectMaps; exports.builtinPattern = _chunkDFFBJV3Ucjs.builtinPattern; exports.builtinPatternIds = _chunkDFFBJV3Ucjs.builtinPatternIds; exports.bytesToBase64 = _chunkDCLJNVZScjs.bytesToBase64; exports.canvasCompositeOperation = _chunk7ISPWEJAcjs.canvasCompositeOperation; exports.changedTiles = _chunkDFFBJV3Ucjs.changedTiles; exports.collectTiles = _chunk7ISPWEJAcjs.collectTiles; exports.compositeLayerEffects = _chunkDFFBJV3Ucjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkDFFBJV3Ucjs.compositeSurfaceOver; exports.contentBounds = _chunk7ISPWEJAcjs.contentBounds; exports.contourLut = _chunkDFFBJV3Ucjs.contourLut; exports.convertSurfaceDepth = _chunk7ISPWEJAcjs.convertSurfaceDepth; exports.curveLut = _chunkDFFBJV3Ucjs.curveLut; exports.decodePng = _chunkDCLJNVZScjs.decodePng; exports.deepBytes = _chunk7ISPWEJAcjs.deepBytes; exports.deepTile = _chunk7ISPWEJAcjs.deepTile; exports.defaultEffectGradient = _chunkDFFBJV3Ucjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkDFFBJV3Ucjs.defaultLayerEffect; exports.deflate = _chunk643B2HKCcjs.deflate; exports.deflateRaw = _chunk643B2HKCcjs.deflateRaw; exports.depthOf = _chunk7ISPWEJAcjs.depthOf; exports.effectColorHex = _chunkDFFBJV3Ucjs.effectColorHex; exports.effectFillColors = _chunkDFFBJV3Ucjs.effectFillColors; exports.effectReach = _chunkDFFBJV3Ucjs.effectReach; exports.effectsAreLocal = _chunkDFFBJV3Ucjs.effectsAreLocal; exports.effectsFingerprint = _chunkDFFBJV3Ucjs.effectsFingerprint; exports.effectsMargin = _chunkDFFBJV3Ucjs.effectsMargin; exports.effectsScale = _chunkDFFBJV3Ucjs.effectsScale; exports.emptySurface = _chunk7ISPWEJAcjs.emptySurface; exports.encodePng = _chunkDCLJNVZScjs.encodePng; exports.fillRect = _chunk7ISPWEJAcjs.fillRect; exports.findLayer = _chunkDFFBJV3Ucjs.findLayer; exports.finishTile = _chunk7ISPWEJAcjs.finishTile; exports.flattenLayers = _chunkDFFBJV3Ucjs.flattenLayers; exports.gaussianBlur = _chunkDFFBJV3Ucjs.gaussianBlur; exports.gradientT = _chunkDFFBJV3Ucjs.gradientT; exports.hasActiveEffects = _chunkDFFBJV3Ucjs.hasActiveEffects; exports.hashNoise = _chunkDFFBJV3Ucjs.hashNoise; exports.inflate = _chunk643B2HKCcjs.inflate; exports.inflateRaw = _chunk643B2HKCcjs.inflateRaw; exports.insertLayer = _chunkDFFBJV3Ucjs.insertLayer; exports.isBitDepth = _chunk7ISPWEJAcjs.isBitDepth; exports.isBlendMode = _chunk7ISPWEJAcjs.isBlendMode; exports.isInterpolation = _chunkDFFBJV3Ucjs.isInterpolation; exports.isLayerEffectKind = _chunkDFFBJV3Ucjs.isLayerEffectKind; exports.isLayerLocked = _chunkDFFBJV3Ucjs.isLayerLocked; exports.isPainterlyBlendMode = _chunk7ISPWEJAcjs.isPainterlyBlendMode; exports.isPng = _chunkDCLJNVZScjs.isPng; exports.isSeparableBlendMode = _chunk7ISPWEJAcjs.isSeparableBlendMode; exports.keepDeepSamples = _chunk7ISPWEJAcjs.keepDeepSamples; exports.keysWeight = _chunkDFFBJV3Ucjs.keysWeight; exports.layerEffectFields = _chunkDFFBJV3Ucjs.layerEffectFields; exports.layerEffectLabel = _chunkDFFBJV3Ucjs.layerEffectLabel; exports.mapLayer = _chunkDFFBJV3Ucjs.mapLayer; exports.mergeLayerEffect = _chunkDFFBJV3Ucjs.mergeLayerEffect; exports.mixPigment8 = _chunk7ISPWEJAcjs.mixPigment8; exports.mixPigmentRgb = _chunk7ISPWEJAcjs.mixPigmentRgb; exports.newEffectId = _chunkDFFBJV3Ucjs.newEffectId; exports.normalizeBlendMode = _chunk7ISPWEJAcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkDFFBJV3Ucjs.normalizeLayerEffects; exports.packRgba = _chunk7ISPWEJAcjs.packRgba; exports.parseDataUrl = _chunkDCLJNVZScjs.parseDataUrl; exports.parseEffectColor = _chunkDFFBJV3Ucjs.parseEffectColor; exports.patchEffectMaps = _chunkDFFBJV3Ucjs.patchEffectMaps; exports.pigment8 = _chunk7ISPWEJAcjs.pigment8; exports.pngDataUrl = _chunkDCLJNVZScjs.pngDataUrl; exports.proxyOf = _chunk7ISPWEJAcjs.proxyOf; exports.readDeepRegion = _chunk7ISPWEJAcjs.readDeepRegion; exports.readPixel = _chunk7ISPWEJAcjs.readPixel; exports.readRegion = _chunk7ISPWEJAcjs.readRegion; exports.reduceSurface = _chunkDFFBJV3Ucjs.reduceSurface; exports.renderLayerEffects = _chunkDFFBJV3Ucjs.renderLayerEffects; exports.scaleLayerEffect = _chunkDFFBJV3Ucjs.scaleLayerEffect; exports.setLum = _chunk7ISPWEJAcjs.setLum; exports.solidSurface = _chunk7ISPWEJAcjs.solidSurface; exports.srgbDecode = _chunk7ISPWEJAcjs.srgbDecode; exports.srgbEncode = _chunk7ISPWEJAcjs.srgbEncode; exports.standardBlendMode = _chunk7ISPWEJAcjs.standardBlendMode; exports.surfaceBytes = _chunk7ISPWEJAcjs.surfaceBytes; exports.surfaceDepth = _chunk7ISPWEJAcjs.surfaceDepth; exports.surfaceFromDeepPixels = _chunk7ISPWEJAcjs.surfaceFromDeepPixels; exports.surfaceFromPixels = _chunk7ISPWEJAcjs.surfaceFromPixels; exports.surfacesEqual = _chunk7ISPWEJAcjs.surfacesEqual; exports.tileCoord = _chunk7ISPWEJAcjs.tileCoord; exports.tileKey = _chunk7ISPWEJAcjs.tileKey; exports.tileRect = _chunk7ISPWEJAcjs.tileRect; exports.tileSamples = _chunk7ISPWEJAcjs.tileSamples; exports.tileSamples16 = _chunk7ISPWEJAcjs.tileSamples16; exports.tileSamples32 = _chunk7ISPWEJAcjs.tileSamples32; exports.tilesInRect = _chunk7ISPWEJAcjs.tilesInRect; exports.to16From32 = _chunk7ISPWEJAcjs.to16From32; exports.to16From8 = _chunk7ISPWEJAcjs.to16From8; exports.to32From16 = _chunk7ISPWEJAcjs.to32From16; exports.to32From8 = _chunk7ISPWEJAcjs.to32From8; exports.to8From16 = _chunk7ISPWEJAcjs.to8From16; exports.to8From32 = _chunk7ISPWEJAcjs.to8From32; exports.transformSurface = _chunkDFFBJV3Ucjs.transformSurface; exports.transformedBounds = _chunkDFFBJV3Ucjs.transformedBounds; exports.translateSurface = _chunk7ISPWEJAcjs.translateSurface; exports.uniformTile = _chunk7ISPWEJAcjs.uniformTile; exports.validateEffectGradient = _chunkDFFBJV3Ucjs.validateEffectGradient; exports.validateLayerEffect = _chunkDFFBJV3Ucjs.validateLayerEffect; exports.validateLayerEffects = _chunkDFFBJV3Ucjs.validateLayerEffects; exports.warpSurface = _chunkDFFBJV3Ucjs.warpSurface; exports.workingToSamples = _chunkDFFBJV3Ucjs.workingToSamples; exports.writeDeepRegion = _chunk7ISPWEJAcjs.writeDeepRegion; exports.writeRegion = _chunk7ISPWEJAcjs.writeRegion;
|
|
290
290
|
//# sourceMappingURL=index.cjs.map
|