@pixerate/editor 0.231.0 → 0.232.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 +25 -25
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/index.cjs +7 -7
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-OPSK22DL.cjs → chunk-2K5TELHV.cjs} +19 -2
- package/dist/{chunk-CSM5T6SE.js → chunk-6QLTUGMO.js} +1 -1
- package/dist/{chunk-5T3H7CGG.cjs → chunk-A653N65Q.cjs} +7 -7
- package/dist/{chunk-SBPGIZQN.js → chunk-MUSZYMBX.js} +1 -1
- package/dist/{chunk-TCZ2J7PR.js → chunk-PQYDJ2AV.js} +18 -1
- package/dist/{chunk-C73U5UI3.cjs → chunk-RG4O6K2A.cjs} +14 -14
- package/dist/effects/conformance.d.cts +4 -1
- package/dist/effects/conformance.d.ts +4 -1
- package/dist/effects/errors.d.cts +6 -1
- package/dist/effects/errors.d.ts +6 -1
- package/dist/effects/fake-templates.d.cts +17 -0
- package/dist/effects/fake-templates.d.ts +17 -0
- package/dist/effects/fake.d.cts +6 -1
- package/dist/effects/fake.d.ts +6 -1
- package/dist/effects/index.cjs +537 -74
- package/dist/effects/index.d.cts +1 -0
- package/dist/effects/index.d.ts +1 -0
- package/dist/effects/index.js +466 -3
- package/dist/effects/templates.d.cts +56 -0
- package/dist/effects/templates.d.ts +56 -0
- package/dist/effects/types.d.cts +212 -0
- package/dist/effects/types.d.ts +212 -0
- package/dist/image-editor/controller.d.cts +12 -0
- package/dist/image-editor/controller.d.ts +12 -0
- package/dist/image-editor/index.cjs +189 -144
- package/dist/image-editor/index.js +48 -3
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.js +2 -2
- package/dist/vector/index.cjs +6 -6
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +329 -329
- package/dist/video-editor/index.js +3 -3
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +37 -0
|
@@ -744,7 +744,7 @@ require('../chunk-NM3G4VQT.cjs');
|
|
|
744
744
|
|
|
745
745
|
|
|
746
746
|
|
|
747
|
-
var
|
|
747
|
+
var _chunk2K5TELHVcjs = require('../chunk-2K5TELHV.cjs');
|
|
748
748
|
require('../chunk-WOFXZ3XU.cjs');
|
|
749
749
|
|
|
750
750
|
|
|
@@ -4832,7 +4832,7 @@ function checkImageEffectPlace(d, place) {
|
|
|
4832
4832
|
const allowed = IMAGE_EFFECT_PLACES[place];
|
|
4833
4833
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
4834
4834
|
const instead = place === "filter" && d.uses.some((u) => IMAGE_EFFECT_PLACES.layer.includes(u)) ? "; add it as an effect layer with add_effect_layer instead" : place === "layer" && d.uses.includes("filter") ? "; apply it to a layer as a smart filter with apply_effect instead" : "";
|
|
4835
|
-
throw new (0,
|
|
4835
|
+
throw new (0, _chunk2K5TELHVcjs.EffectUnsupportedError)(
|
|
4836
4836
|
`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect, and ${place === "filter" ? "a smart filter takes filter effects" : "an effect layer takes generator, overlay or title effects"}${instead}.`,
|
|
4837
4837
|
d.id
|
|
4838
4838
|
);
|
|
@@ -4856,9 +4856,9 @@ function effectPixelsToSurface(p, depth) {
|
|
|
4856
4856
|
const d = new Uint16Array(f.length);
|
|
4857
4857
|
const code = (v) => v > 0 ? v < 1 ? Math.round(v * 65535) : 65535 : 0;
|
|
4858
4858
|
for (let i = 0; i < f.length; i += 4) {
|
|
4859
|
-
d[i] = code(
|
|
4860
|
-
d[i + 1] = code(
|
|
4861
|
-
d[i + 2] = code(
|
|
4859
|
+
d[i] = code(_chunk2K5TELHVcjs.linearToSrgb.call(void 0, f[i]));
|
|
4860
|
+
d[i + 1] = code(_chunk2K5TELHVcjs.linearToSrgb.call(void 0, f[i + 1]));
|
|
4861
|
+
d[i + 2] = code(_chunk2K5TELHVcjs.linearToSrgb.call(void 0, f[i + 2]));
|
|
4862
4862
|
d[i + 3] = code(f[i + 3]);
|
|
4863
4863
|
}
|
|
4864
4864
|
return _chunkOLNIPTB3cjs.surfaceFromDeepPixels.call(void 0, { width: p.width, height: p.height, data: d }, 4);
|
|
@@ -4875,7 +4875,7 @@ var ImageEffectsEngine = (_class9 = class {
|
|
|
4875
4875
|
__init49() {this.generation = 0}
|
|
4876
4876
|
|
|
4877
4877
|
constructor(options = {}) {;_class9.prototype.__init44.call(this);_class9.prototype.__init45.call(this);_class9.prototype.__init46.call(this);_class9.prototype.__init47.call(this);_class9.prototype.__init48.call(this);_class9.prototype.__init49.call(this);
|
|
4878
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
4878
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunk2K5TELHVcjs.EffectsSlot)()));
|
|
4879
4879
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 24));
|
|
4880
4880
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
4881
4881
|
this.detach = this.slot.subscribe(() => {
|
|
@@ -4935,7 +4935,7 @@ var ImageEffectsEngine = (_class9 = class {
|
|
|
4935
4935
|
const provider = this.slot.require();
|
|
4936
4936
|
const depth = _nullishCoalesce(size.depth, () => ( 8));
|
|
4937
4937
|
const out = await this.render(provider, effect, size.width, size.height, depth, { time: _nullishCoalesce(size.time, () => ( 0)), values });
|
|
4938
|
-
return out.width === size.width && out.height === size.height ? out :
|
|
4938
|
+
return out.width === size.width && out.height === size.height ? out : _chunk2K5TELHVcjs.createEffectPixels.call(void 0, size.width, size.height);
|
|
4939
4939
|
}
|
|
4940
4940
|
/** Why the result for `key` failed, if it did. */
|
|
4941
4941
|
failure(key2) {
|
|
@@ -6197,11 +6197,11 @@ var ImageEditorController = (_class12 = class {
|
|
|
6197
6197
|
__init84() {this.selectionWorker = null}
|
|
6198
6198
|
__init85() {this.documentOpener = null}
|
|
6199
6199
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
6200
|
-
__init86() {this.effects = new (0,
|
|
6200
|
+
__init86() {this.effects = new (0, _chunk2K5TELHVcjs.EffectsSlot)()}
|
|
6201
6201
|
/** Renders provider effects: effect smart filter results and effect layers. */
|
|
6202
6202
|
__init87() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
|
|
6203
6203
|
__init88() {this.effectRefresh = "none"}
|
|
6204
|
-
constructor(options = {}) {;_class12.prototype.__init72.call(this);_class12.prototype.__init73.call(this);_class12.prototype.__init74.call(this);_class12.prototype.__init75.call(this);_class12.prototype.__init76.call(this);_class12.prototype.__init77.call(this);_class12.prototype.__init78.call(this);_class12.prototype.__init79.call(this);_class12.prototype.__init80.call(this);_class12.prototype.__init81.call(this);_class12.prototype.__init82.call(this);_class12.prototype.__init83.call(this);_class12.prototype.__init84.call(this);_class12.prototype.__init85.call(this);_class12.prototype.__init86.call(this);_class12.prototype.__init87.call(this);_class12.prototype.__init88.call(this);_class12.prototype.__init89.call(this);_class12.prototype.__init90.call(this);_class12.prototype.__init91.call(this);_class12.prototype.__init92.call(this);_class12.prototype.__init93.call(this);_class12.prototype.__init94.call(this);_class12.prototype.__init95.call(this);_class12.prototype.__init96.call(this);_class12.prototype.__init97.call(this);_class12.prototype.__init98.call(this);_class12.prototype.__init99.call(this);_class12.prototype.__init100.call(this);_class12.prototype.__init101.call(this);_class12.prototype.__init102.call(this);_class12.prototype.__init103.call(this);_class12.prototype.__init104.call(this);_class12.prototype.__init105.call(this);_class12.prototype.__init106.call(this);
|
|
6204
|
+
constructor(options = {}) {;_class12.prototype.__init72.call(this);_class12.prototype.__init73.call(this);_class12.prototype.__init74.call(this);_class12.prototype.__init75.call(this);_class12.prototype.__init76.call(this);_class12.prototype.__init77.call(this);_class12.prototype.__init78.call(this);_class12.prototype.__init79.call(this);_class12.prototype.__init80.call(this);_class12.prototype.__init81.call(this);_class12.prototype.__init82.call(this);_class12.prototype.__init83.call(this);_class12.prototype.__init84.call(this);_class12.prototype.__init85.call(this);_class12.prototype.__init86.call(this);_class12.prototype.__init87.call(this);_class12.prototype.__init88.call(this);_class12.prototype.__init89.call(this);_class12.prototype.__init90.call(this);_class12.prototype.__init91.call(this);_class12.prototype.__init92.call(this);_class12.prototype.__init93.call(this);_class12.prototype.__init94.call(this);_class12.prototype.__init95.call(this);_class12.prototype.__init96.call(this);_class12.prototype.__init97.call(this);_class12.prototype.__init98.call(this);_class12.prototype.__init99.call(this);_class12.prototype.__init100.call(this);_class12.prototype.__init101.call(this);_class12.prototype.__init102.call(this);_class12.prototype.__init103.call(this);_class12.prototype.__init104.call(this);_class12.prototype.__init105.call(this);_class12.prototype.__init106.call(this);_class12.prototype.__init107.call(this);
|
|
6205
6205
|
this.effects.subscribe(() => this.queueEffectRefresh("all"));
|
|
6206
6206
|
this.effectsEngine.subscribe(() => this.queueEffectRefresh("incomplete"));
|
|
6207
6207
|
if (options.effects) this.effects.set(options.effects);
|
|
@@ -6533,7 +6533,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6533
6533
|
*/
|
|
6534
6534
|
async applyEffectFilter(layerId, effect, options = {}) {
|
|
6535
6535
|
const d = await this.describeEffect(effect, "filter");
|
|
6536
|
-
const values =
|
|
6536
|
+
const values = _chunk2K5TELHVcjs.resolveEffectValues.call(void 0, d, options.values);
|
|
6537
6537
|
const found = _chunkHB4ICNNAcjs.findLayer.call(void 0, this.state.layers, layerId);
|
|
6538
6538
|
if (!found) throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`There is no layer "${layerId}"; call list_layers for the layer ids.`);
|
|
6539
6539
|
let layers = this.state.layers;
|
|
@@ -6575,7 +6575,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6575
6575
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
6576
6576
|
else throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
6577
6577
|
}
|
|
6578
|
-
update.values = { ...base, ...
|
|
6578
|
+
update.values = { ...base, ..._chunk2K5TELHVcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
6579
6579
|
}
|
|
6580
6580
|
for (const k of ["enabled", "blend", "opacity", "preserveTransparency"]) if (changes[k] !== void 0) update[k] = changes[k];
|
|
6581
6581
|
let res = _chunk5VQXSS2Scjs.updateSmartFilter.call(void 0, this.state.layers, layerId, filterId, update, this.canvasSize);
|
|
@@ -6602,7 +6602,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6602
6602
|
const id = options.id && !ids.has(options.id) ? options.id : _chunk5VQXSS2Scjs.newLayerId.call(void 0, );
|
|
6603
6603
|
const placed = _chunk5VQXSS2Scjs.placeLayer.call(void 0, this.state.layers, { type: "pixel", id, name: "", visible: true, opacity: 1, blend: "normal", surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }, this.newLayerPlacement(options));
|
|
6604
6604
|
if (options.clipped) requireClipBase(placed, id);
|
|
6605
|
-
const values =
|
|
6605
|
+
const values = _chunk2K5TELHVcjs.resolveEffectValues.call(void 0, d, withBackgroundOpacity(d, options.values, hasLayersBelow(placed, id)));
|
|
6606
6606
|
const { width, height } = this.naturalSize;
|
|
6607
6607
|
const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time });
|
|
6608
6608
|
const layer = {
|
|
@@ -6647,7 +6647,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
6647
6647
|
else if (k in d.controls.properties) base[k] = d.defaults[k];
|
|
6648
6648
|
else throw new (0, _chunk5VQXSS2Scjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
|
|
6649
6649
|
}
|
|
6650
|
-
const values = { ...base, ...
|
|
6650
|
+
const values = { ...base, ..._chunk2K5TELHVcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
|
|
6651
6651
|
const time = changes.time === void 0 ? _nullishCoalesce(g.time, () => ( 0)) : checkEffectTime(changes.time);
|
|
6652
6652
|
const animate = changes.animate === void 0 ? g.animate : changes.animate === null ? void 0 : checkEffectAnimation(changes.animate);
|
|
6653
6653
|
const { width, height } = this.naturalSize;
|
|
@@ -7141,6 +7141,50 @@ var ImageEditorController = (_class12 = class {
|
|
|
7141
7141
|
const enc = _chunk5VQXSS2Scjs.encodeSurface.call(void 0, surface);
|
|
7142
7142
|
return enc ? enc.url : null;
|
|
7143
7143
|
}
|
|
7144
|
+
__init94() {this.maskedImageCache = /* @__PURE__ */ new WeakMap()}
|
|
7145
|
+
/**
|
|
7146
|
+
* A pixel layer's own pixels with its raster and vector masks applied, cropped to what shows: a
|
|
7147
|
+
* PNG data URL and its document bounds, or `null` for an unknown or non-pixel layer, or when
|
|
7148
|
+
* nothing shows. Opacity, blending, filters and effects are left out, as in `getLayerDataURL`.
|
|
7149
|
+
* Use it for a masked layer, whose stored pixels (a whole copy, for Separate Subject's subject)
|
|
7150
|
+
* are not what it shows.
|
|
7151
|
+
*/
|
|
7152
|
+
getMaskedLayerImage(id) {
|
|
7153
|
+
const layer = this.getLayer(id);
|
|
7154
|
+
if (!layer || layer.type !== "pixel") return null;
|
|
7155
|
+
const surface = this.surfaceOf(layer);
|
|
7156
|
+
const cached = this.maskedImageCache.get(layer);
|
|
7157
|
+
if (cached && cached.surface === surface) return cached.image;
|
|
7158
|
+
const b = this.getLayerBounds(id);
|
|
7159
|
+
let image = null;
|
|
7160
|
+
if (b) {
|
|
7161
|
+
const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
|
|
7162
|
+
delete content.clipped;
|
|
7163
|
+
delete content.fillOpacity;
|
|
7164
|
+
delete content.effects;
|
|
7165
|
+
delete content.filters;
|
|
7166
|
+
const data = this.compositor.composite([content], b, this.compositorSources());
|
|
7167
|
+
let x0 = b.width, y0 = b.height, x1 = -1, y1 = -1;
|
|
7168
|
+
for (let y = 0; y < b.height; y++) {
|
|
7169
|
+
for (let x = 0; x < b.width; x++) {
|
|
7170
|
+
if (!data[(y * b.width + x) * 4 + 3]) continue;
|
|
7171
|
+
if (x < x0) x0 = x;
|
|
7172
|
+
if (x > x1) x1 = x;
|
|
7173
|
+
if (y < y0) y0 = y;
|
|
7174
|
+
if (y > y1) y1 = y;
|
|
7175
|
+
}
|
|
7176
|
+
}
|
|
7177
|
+
if (x1 >= 0) {
|
|
7178
|
+
const w = x1 - x0 + 1;
|
|
7179
|
+
const h = y1 - y0 + 1;
|
|
7180
|
+
const out = new Uint8ClampedArray(w * h * 4);
|
|
7181
|
+
for (let y = 0; y < h; y++) out.set(data.subarray(((y0 + y) * b.width + x0) * 4, ((y0 + y) * b.width + x0 + w) * 4), y * w * 4);
|
|
7182
|
+
image = { url: _chunkOLNIPTB3cjs.pngDataUrl.call(void 0, w, h, out, 4), bounds: { x: b.x + x0, y: b.y + y0, width: w, height: h } };
|
|
7183
|
+
}
|
|
7184
|
+
}
|
|
7185
|
+
this.maskedImageCache.set(layer, { surface, image });
|
|
7186
|
+
return image;
|
|
7187
|
+
}
|
|
7144
7188
|
/**
|
|
7145
7189
|
* Composites the layer stack in document space without a canvas (annotation layers need one
|
|
7146
7190
|
* and are left out): `rect` (default: the canvas) as RGBA, straight alpha. Crop, rotation and
|
|
@@ -7197,8 +7241,8 @@ var ImageEditorController = (_class12 = class {
|
|
|
7197
7241
|
pattern: (id) => _nullishCoalesce(_optionalChain([this, 'access', _221 => _221.state, 'access', _222 => _222.patterns, 'optionalAccess', _223 => _223.find, 'call', _224 => _224((p) => p.id === id)]), () => ( null))
|
|
7198
7242
|
};
|
|
7199
7243
|
}
|
|
7200
|
-
|
|
7201
|
-
|
|
7244
|
+
__init95() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
|
|
7245
|
+
__init96() {this.nextSourceId = 1}
|
|
7202
7246
|
/** Changes whenever the Background's source pixels can have changed. */
|
|
7203
7247
|
sourceVersion() {
|
|
7204
7248
|
const key2 = this.samplePixelsOverride ? this.samplePixels : _nullishCoalesce(this.imageElement, () => ( this.samplePixels));
|
|
@@ -7212,7 +7256,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
7212
7256
|
}
|
|
7213
7257
|
/** The pixels a pixel layer, smart object or shape composites (the decoded source for the Background). */
|
|
7214
7258
|
/** A layer's real pixels for hybrid vector masks' matte guide (the Background's from the source). */
|
|
7215
|
-
|
|
7259
|
+
__init97() {this.guideSurfaceOf = (layer) => layer.type === "pixel" || layer.type === "smart" || layer.type === "shape" || layer.type === "type" ? this.surfaceOf(layer) : void 0}
|
|
7216
7260
|
surfaceOf(layer) {
|
|
7217
7261
|
if (layer.type !== "pixel" || layer.source !== "document") return layer.surface;
|
|
7218
7262
|
return _nullishCoalesce(this.sourceSurface(), () => ( layer.surface));
|
|
@@ -7249,7 +7293,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
7249
7293
|
}
|
|
7250
7294
|
return fits ? fromPixels(px2) : null;
|
|
7251
7295
|
}
|
|
7252
|
-
|
|
7296
|
+
__init98() {this.opaqueCache = /* @__PURE__ */ new WeakMap()}
|
|
7253
7297
|
/** Whether every source pixel is opaque (some legacy renders depend on it). */
|
|
7254
7298
|
sourceIsOpaque() {
|
|
7255
7299
|
const s = this.sourceSurface();
|
|
@@ -8135,7 +8179,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
8135
8179
|
return copy.id;
|
|
8136
8180
|
}
|
|
8137
8181
|
// --- Free Transform ---
|
|
8138
|
-
|
|
8182
|
+
__init99() {this.openTransform = null}
|
|
8139
8183
|
/** The Free Transform in progress (see `beginFreeTransform`), or `null`. */
|
|
8140
8184
|
getFreeTransform() {
|
|
8141
8185
|
if (this.openTransform && !this.openTransform.isOpen) this.openTransform = null;
|
|
@@ -8573,7 +8617,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
8573
8617
|
return left;
|
|
8574
8618
|
}
|
|
8575
8619
|
// --- Smart object contents (Edit Contents) ---
|
|
8576
|
-
|
|
8620
|
+
__init100() {this.contentsStack = []}
|
|
8577
8621
|
/** The smart objects whose contents are open (outermost first); empty when the document itself is shown. */
|
|
8578
8622
|
getEditingContents() {
|
|
8579
8623
|
return this.contentsStack.map((e) => ({ layerId: e.layerId, name: e.name }));
|
|
@@ -8722,7 +8766,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
8722
8766
|
this.commitLayers(_chunk5VQXSS2Scjs.setLayerEffects.call(void 0, this.state.layers, id, effects), void 0, commitToHistory);
|
|
8723
8767
|
return this.getLayerEffects(id);
|
|
8724
8768
|
}
|
|
8725
|
-
|
|
8769
|
+
__init101() {this.patternIds = /* @__PURE__ */ new WeakMap()}
|
|
8726
8770
|
/** Changes whenever the document's pattern list is replaced (the compositor then drops its caches). */
|
|
8727
8771
|
patternsVersion() {
|
|
8728
8772
|
const list = this.state.patterns;
|
|
@@ -8884,7 +8928,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
8884
8928
|
});
|
|
8885
8929
|
return bg.id;
|
|
8886
8930
|
}
|
|
8887
|
-
|
|
8931
|
+
__init102() {this.thumbCache = /* @__PURE__ */ new WeakMap()}
|
|
8888
8932
|
/**
|
|
8889
8933
|
* A small RGBA preview of a pixel layer over the canvas (or of its mask with `mask: true`),
|
|
8890
8934
|
* longest side `maxSide` px, point-sampled; `null` for layers without pixels.
|
|
@@ -9542,7 +9586,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
9542
9586
|
return { layerId: target.id, bounds: { ...b }, output };
|
|
9543
9587
|
}
|
|
9544
9588
|
/** The pixel clipboard (Copy / Cut), or null. */
|
|
9545
|
-
|
|
9589
|
+
__init103() {this.clipboard = null}
|
|
9546
9590
|
/** What Copy or Cut last put on the editor's clipboard, or null. */
|
|
9547
9591
|
getClipboard() {
|
|
9548
9592
|
return this.clipboard;
|
|
@@ -10031,7 +10075,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
10031
10075
|
return true;
|
|
10032
10076
|
}
|
|
10033
10077
|
/** The recipe step of the selection command now running, taken by `setSelection`. */
|
|
10034
|
-
|
|
10078
|
+
__init104() {this.pendingStep = null}
|
|
10035
10079
|
/** Runs a selection command whose change `step` describes, so the selection's recipe records it. */
|
|
10036
10080
|
withRecipeStep(step, fn) {
|
|
10037
10081
|
this.pendingStep = step;
|
|
@@ -10132,7 +10176,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
10132
10176
|
return this.setSelection(null);
|
|
10133
10177
|
}
|
|
10134
10178
|
/** The selection a Deselect cleared, for `reselect` (not saved, not part of history). */
|
|
10135
|
-
|
|
10179
|
+
__init105() {this.lastSelection = null}
|
|
10136
10180
|
/** Whether `reselect` has a selection to bring back. */
|
|
10137
10181
|
canReselect() {
|
|
10138
10182
|
const { width, height } = this.naturalSize;
|
|
@@ -11239,7 +11283,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
11239
11283
|
this.notify();
|
|
11240
11284
|
}
|
|
11241
11285
|
// --- Rendering & Export ---
|
|
11242
|
-
|
|
11286
|
+
__init106() {this.blankSource = null}
|
|
11243
11287
|
/**
|
|
11244
11288
|
* What the renderer draws from: the source image, or, for a document without one (an opened
|
|
11245
11289
|
* PSD, a v3 document loaded on its own), a transparent canvas of the document size, since every
|
|
@@ -12579,7 +12623,7 @@ var ImageEditorController = (_class12 = class {
|
|
|
12579
12623
|
this.notify();
|
|
12580
12624
|
}
|
|
12581
12625
|
/** Problems found by the last `loadJSON` / `initialState` of a v3 document (unreadable layers or assets). */
|
|
12582
|
-
|
|
12626
|
+
__init107() {this.lastLoadProblems = []}
|
|
12583
12627
|
applyStored(raw) {
|
|
12584
12628
|
const s = this.state;
|
|
12585
12629
|
const data = migrateSerializedImageEditorState(raw);
|
|
@@ -16537,29 +16581,29 @@ function snapTo45(from, point2) {
|
|
|
16537
16581
|
return { x: from.x + Math.cos(a) * len, y: from.y + Math.sin(a) * len };
|
|
16538
16582
|
}
|
|
16539
16583
|
var SelectionGesture = (_class13 = class {
|
|
16540
|
-
constructor(controller, getOptions) {;_class13.prototype.
|
|
16584
|
+
constructor(controller, getOptions) {;_class13.prototype.__init108.call(this);_class13.prototype.__init109.call(this);_class13.prototype.__init110.call(this);_class13.prototype.__init111.call(this);_class13.prototype.__init112.call(this);_class13.prototype.__init113.call(this);_class13.prototype.__init114.call(this);_class13.prototype.__init115.call(this);_class13.prototype.__init116.call(this);_class13.prototype.__init117.call(this);_class13.prototype.__init118.call(this);_class13.prototype.__init119.call(this);_class13.prototype.__init120.call(this);
|
|
16541
16585
|
this.controller = controller;
|
|
16542
16586
|
this.getOptions = getOptions;
|
|
16543
16587
|
}
|
|
16544
16588
|
|
|
16545
16589
|
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16590
|
+
__init108() {this.start = null}
|
|
16591
|
+
__init109() {this.points = []}
|
|
16592
|
+
__init110() {this.current = null}
|
|
16593
|
+
__init111() {this.modifiers = {}}
|
|
16550
16594
|
/** Polygonal lasso corners while one is being drawn. */
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16595
|
+
__init112() {this.polygon = null}
|
|
16596
|
+
__init113() {this.pressedAt = null}
|
|
16597
|
+
__init114() {this.freehand = false}
|
|
16598
|
+
__init115() {this.magnetic = null}
|
|
16555
16599
|
/** A click this close to the first corner (natural pixels) closes a polygonal lasso. */
|
|
16556
|
-
|
|
16600
|
+
__init116() {this.closeRadius = 8}
|
|
16557
16601
|
/** The last error (e.g. pixels unavailable for the wand), for the UI to show. */
|
|
16558
|
-
|
|
16559
|
-
|
|
16602
|
+
__init117() {this.error = null}
|
|
16603
|
+
__init118() {this.pending = Promise.resolve()}
|
|
16560
16604
|
/** Quick Selection while dragging: the selection before the stroke, how the stroke combines, the pixels. */
|
|
16561
|
-
|
|
16562
|
-
|
|
16605
|
+
__init119() {this.quick = null}
|
|
16606
|
+
__init120() {this.livePreviews = Promise.resolve()}
|
|
16563
16607
|
get active() {
|
|
16564
16608
|
return this.start !== null || this.polygon !== null || this.magnetic !== null;
|
|
16565
16609
|
}
|
|
@@ -17179,14 +17223,14 @@ function handlePaintShortcut(controller, e) {
|
|
|
17179
17223
|
return false;
|
|
17180
17224
|
}
|
|
17181
17225
|
var PaintGesture = (_class14 = class {
|
|
17182
|
-
constructor(controller) {;_class14.prototype.
|
|
17226
|
+
constructor(controller) {;_class14.prototype.__init121.call(this);_class14.prototype.__init122.call(this);_class14.prototype.__init123.call(this);
|
|
17183
17227
|
this.controller = controller;
|
|
17184
17228
|
}
|
|
17185
17229
|
|
|
17186
|
-
|
|
17187
|
-
|
|
17230
|
+
__init121() {this.stroke = null}
|
|
17231
|
+
__init122() {this.move = null}
|
|
17188
17232
|
/** The last refusal (e.g. "layer is locked"), for the editor to show. */
|
|
17189
|
-
|
|
17233
|
+
__init123() {this.error = null}
|
|
17190
17234
|
get active() {
|
|
17191
17235
|
return Boolean(this.stroke || this.move);
|
|
17192
17236
|
}
|
|
@@ -20044,35 +20088,35 @@ function scaleParams(p, s) {
|
|
|
20044
20088
|
return { ...p, radius: p.radius * s, feather: p.feather * s };
|
|
20045
20089
|
}
|
|
20046
20090
|
var SelectAndMaskSession = (_class15 = class {
|
|
20047
|
-
constructor(controller) {;_class15.prototype.
|
|
20091
|
+
constructor(controller) {;_class15.prototype.__init124.call(this);_class15.prototype.__init125.call(this);_class15.prototype.__init126.call(this);_class15.prototype.__init127.call(this);_class15.prototype.__init128.call(this);_class15.prototype.__init129.call(this);_class15.prototype.__init130.call(this);_class15.prototype.__init131.call(this);_class15.prototype.__init132.call(this);_class15.prototype.__init133.call(this);_class15.prototype.__init134.call(this);_class15.prototype.__init135.call(this);_class15.prototype.__init136.call(this);_class15.prototype.__init137.call(this);_class15.prototype.__init138.call(this);
|
|
20048
20092
|
this.controller = controller;
|
|
20049
20093
|
this.base = controller.getSelection();
|
|
20050
20094
|
this.settingsValue = remembered ? { ...remembered, params: { ...remembered.params }, showOriginal: false } : { ...DEFAULT_SELECT_AND_MASK_SETTINGS, params: { ...DEFAULT_SELECT_AND_MASK_SETTINGS.params } };
|
|
20051
20095
|
}
|
|
20052
20096
|
|
|
20053
20097
|
|
|
20054
|
-
|
|
20098
|
+
__init124() {this.editsList = []}
|
|
20055
20099
|
/** The edit being painted, shown in the preview but not yet in `edits`. */
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20100
|
+
__init125() {this.live = null}
|
|
20101
|
+
__init126() {this.dragStart = null}
|
|
20102
|
+
__init127() {this.pixels = null}
|
|
20103
|
+
__init128() {this.previewPixels = null}
|
|
20060
20104
|
/** The layers below the active one, composited (On Layers shows them where nothing is selected). */
|
|
20061
|
-
|
|
20062
|
-
|
|
20105
|
+
__init129() {this.below = null}
|
|
20106
|
+
__init130() {this.belowPreview = null}
|
|
20063
20107
|
|
|
20064
|
-
|
|
20065
|
-
|
|
20066
|
-
|
|
20108
|
+
__init131() {this.previewMask = null}
|
|
20109
|
+
__init132() {this.baseMask = null}
|
|
20110
|
+
__init133() {this.listeners = /* @__PURE__ */ new Set()}
|
|
20067
20111
|
/** Why the preview could not be made (no pixels), for the UI. */
|
|
20068
|
-
|
|
20112
|
+
__init134() {this.error = null}
|
|
20069
20113
|
/** A note for the UI, such as object aware refinement applying only on OK. */
|
|
20070
|
-
|
|
20114
|
+
__init135() {this.note = null}
|
|
20071
20115
|
/** Bumped each time the preview changes, so a UI can redraw. */
|
|
20072
|
-
|
|
20116
|
+
__init136() {this.revision = 0}
|
|
20073
20117
|
/** True while the worker computes a preview. */
|
|
20074
|
-
|
|
20075
|
-
|
|
20118
|
+
__init137() {this.computing = false}
|
|
20119
|
+
__init138() {this.dirty = false}
|
|
20076
20120
|
get settings() {
|
|
20077
20121
|
return this.settingsValue;
|
|
20078
20122
|
}
|
|
@@ -20820,15 +20864,16 @@ function extractNormalizedLayerItems(controller, fallbackImageUrl = "") {
|
|
|
20820
20864
|
const imgW = _optionalChain([state, 'access', _685 => _685.imageDimensions, 'optionalAccess', _686 => _686.width]) || 1;
|
|
20821
20865
|
const imgH = _optionalChain([state, 'access', _687 => _687.imageDimensions, 'optionalAccess', _688 => _688.height]) || 1;
|
|
20822
20866
|
return ctrlLayers.map((l) => {
|
|
20823
|
-
const
|
|
20867
|
+
const masked = l.type === "pixel" && (l.mask || l.vectorMask) ? controller.getMaskedLayerImage(l.id) : null;
|
|
20868
|
+
const bounds = _optionalChain([masked, 'optionalAccess', _689 => _689.bounds]) || controller.getLayerBounds(l.id) || {
|
|
20824
20869
|
x: 0,
|
|
20825
20870
|
y: 0,
|
|
20826
20871
|
width: imgW,
|
|
20827
20872
|
height: imgH
|
|
20828
20873
|
};
|
|
20829
20874
|
const sLayer = sLayerMap.get(l.id);
|
|
20830
|
-
const assetKey = _optionalChain([sLayer, 'optionalAccess',
|
|
20831
|
-
const layerDataUrl = assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess',
|
|
20875
|
+
const assetKey = _optionalChain([sLayer, 'optionalAccess', _690 => _690.asset]);
|
|
20876
|
+
const layerDataUrl = _optionalChain([masked, 'optionalAccess', _691 => _691.url]) || assetKey && assets[assetKey] || assets[l.id] || (_optionalChain([sLayer, 'optionalAccess', _692 => _692.source]) === "document" ? fallbackImageUrl : "");
|
|
20832
20877
|
return {
|
|
20833
20878
|
id: l.id,
|
|
20834
20879
|
name: l.name || "Untitled Layer",
|
|
@@ -20882,9 +20927,9 @@ async function addLayerOfKind(controller, id, init) {
|
|
|
20882
20927
|
const cx = Math.round(canvas.width / 2);
|
|
20883
20928
|
const cy = Math.round(canvas.height / 2);
|
|
20884
20929
|
return controller.addTextLayer({
|
|
20885
|
-
text: _optionalChain([init, 'optionalAccess',
|
|
20886
|
-
x: typeof _optionalChain([init, 'optionalAccess',
|
|
20887
|
-
y: typeof _optionalChain([init, 'optionalAccess',
|
|
20930
|
+
text: _optionalChain([init, 'optionalAccess', _693 => _693.text]) || "New Text",
|
|
20931
|
+
x: typeof _optionalChain([init, 'optionalAccess', _694 => _694.x]) === "number" ? init.x : cx - 100,
|
|
20932
|
+
y: typeof _optionalChain([init, 'optionalAccess', _695 => _695.y]) === "number" ? init.y : cy,
|
|
20888
20933
|
...init
|
|
20889
20934
|
});
|
|
20890
20935
|
}
|
|
@@ -20897,10 +20942,10 @@ async function addLayerOfKind(controller, id, init) {
|
|
|
20897
20942
|
return controller.addShapeLayer({
|
|
20898
20943
|
shape: {
|
|
20899
20944
|
kind: "rect",
|
|
20900
|
-
x: typeof _optionalChain([init, 'optionalAccess',
|
|
20901
|
-
y: typeof _optionalChain([init, 'optionalAccess',
|
|
20902
|
-
width: typeof _optionalChain([init, 'optionalAccess',
|
|
20903
|
-
height: typeof _optionalChain([init, 'optionalAccess',
|
|
20945
|
+
x: typeof _optionalChain([init, 'optionalAccess', _696 => _696.x]) === "number" ? init.x : cx - Math.round(w / 2),
|
|
20946
|
+
y: typeof _optionalChain([init, 'optionalAccess', _697 => _697.y]) === "number" ? init.y : cy - Math.round(h / 2),
|
|
20947
|
+
width: typeof _optionalChain([init, 'optionalAccess', _698 => _698.width]) === "number" ? init.width : w,
|
|
20948
|
+
height: typeof _optionalChain([init, 'optionalAccess', _699 => _699.height]) === "number" ? init.height : h
|
|
20904
20949
|
},
|
|
20905
20950
|
name: "Rectangle",
|
|
20906
20951
|
...init
|
|
@@ -20915,10 +20960,10 @@ async function addLayerOfKind(controller, id, init) {
|
|
|
20915
20960
|
return controller.addShapeLayer({
|
|
20916
20961
|
shape: {
|
|
20917
20962
|
kind: "ellipse",
|
|
20918
|
-
x: typeof _optionalChain([init, 'optionalAccess',
|
|
20919
|
-
y: typeof _optionalChain([init, 'optionalAccess',
|
|
20920
|
-
width: typeof _optionalChain([init, 'optionalAccess',
|
|
20921
|
-
height: typeof _optionalChain([init, 'optionalAccess',
|
|
20963
|
+
x: typeof _optionalChain([init, 'optionalAccess', _700 => _700.x]) === "number" ? init.x : cx - Math.round(w / 2),
|
|
20964
|
+
y: typeof _optionalChain([init, 'optionalAccess', _701 => _701.y]) === "number" ? init.y : cy - Math.round(h / 2),
|
|
20965
|
+
width: typeof _optionalChain([init, 'optionalAccess', _702 => _702.width]) === "number" ? init.width : w,
|
|
20966
|
+
height: typeof _optionalChain([init, 'optionalAccess', _703 => _703.height]) === "number" ? init.height : h
|
|
20922
20967
|
},
|
|
20923
20968
|
name: "Ellipse",
|
|
20924
20969
|
...init
|
|
@@ -20983,18 +21028,18 @@ function layerEffectsPanel(layer) {
|
|
|
20983
21028
|
if (!layer) return { ...empty, available: false, reason: "Select a layer to add a layer style." };
|
|
20984
21029
|
if (layer.type === "adjustment") return { ...empty, available: false, reason: "Adjustment layers cannot have a layer style." };
|
|
20985
21030
|
const fx = layer.effects;
|
|
20986
|
-
const readOnly = Boolean(_optionalChain([layer, 'access',
|
|
21031
|
+
const readOnly = Boolean(_optionalChain([layer, 'access', _704 => _704.locks, 'optionalAccess', _705 => _705.all]));
|
|
20987
21032
|
return {
|
|
20988
21033
|
available: true,
|
|
20989
21034
|
readOnly,
|
|
20990
21035
|
reason: readOnly ? "The layer is locked; unlock it to change its layer style." : void 0,
|
|
20991
|
-
enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess',
|
|
20992
|
-
scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess',
|
|
20993
|
-
rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess',
|
|
21036
|
+
enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _706 => _706.enabled]), () => ( true)),
|
|
21037
|
+
scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _707 => _707.scale]), () => ( 1)),
|
|
21038
|
+
rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _708 => _708.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkHB4ICNNAcjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
|
|
20994
21039
|
};
|
|
20995
21040
|
}
|
|
20996
21041
|
function layerEffectsBadge(layer) {
|
|
20997
|
-
if (!_optionalChain([layer, 'access',
|
|
21042
|
+
if (!_optionalChain([layer, 'access', _709 => _709.effects, 'optionalAccess', _710 => _710.items, 'access', _711 => _711.length])) return null;
|
|
20998
21043
|
return _chunkHB4ICNNAcjs.hasActiveEffects.call(void 0, layer.effects) ? "on" : "off";
|
|
20999
21044
|
}
|
|
21000
21045
|
var LAYER_EFFECT_MENU = _chunkHB4ICNNAcjs.LAYER_EFFECT_KINDS.map((kind) => ({ kind, label: _chunkHB4ICNNAcjs.layerEffectLabel.call(void 0, kind) }));
|
|
@@ -21039,8 +21084,8 @@ function fillControls(f, allowPattern, patterns) {
|
|
|
21039
21084
|
}
|
|
21040
21085
|
function gradientControls(prefix, g) {
|
|
21041
21086
|
return [
|
|
21042
|
-
{ key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access',
|
|
21043
|
-
{ key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access',
|
|
21087
|
+
{ key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _712 => _712.stops, 'access', _713 => _713[0], 'optionalAccess', _714 => _714.color]), () => ( "#000000")) },
|
|
21088
|
+
{ key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _715 => _715.stops, 'access', _716 => _716[g.stops.length - 1], 'optionalAccess', _717 => _717.color]), () => ( "#ffffff")) },
|
|
21044
21089
|
{ key: `${prefix}.style`, label: "Style", type: "select", value: g.style, options: opt(["linear", "Linear"], ["radial", "Radial"], ["angle", "Angle"], ["reflected", "Reflected"], ["diamond", "Diamond"]) },
|
|
21045
21090
|
{ key: `${prefix}.angle`, label: "Angle", type: "range", min: -180, max: 180, step: 1, value: g.angle, unit: "\xB0" },
|
|
21046
21091
|
{ key: `${prefix}.scale`, label: "Scale", type: "range", min: 0.1, max: 1.5, step: 0.01, value: g.scale, percent: true, unit: "%" },
|
|
@@ -21132,19 +21177,19 @@ function layerEffectControls(e, patterns = []) {
|
|
|
21132
21177
|
}
|
|
21133
21178
|
function fillOfType(current, type, patterns) {
|
|
21134
21179
|
if (type === "gradient") return { type: "gradient", gradient: _chunkHB4ICNNAcjs.defaultEffectGradient.call(void 0, ) };
|
|
21135
|
-
if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access',
|
|
21180
|
+
if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _718 => _718[0], 'optionalAccess', _719 => _719.id]), () => ( "checker")), scale: 1 };
|
|
21136
21181
|
return { type: "color", color: current.type === "color" ? current.color : "#000000" };
|
|
21137
21182
|
}
|
|
21138
21183
|
function effectControlChange(effect, key2, value, patterns = []) {
|
|
21139
21184
|
const [top, ...rest] = key2.split(".");
|
|
21140
21185
|
if (top === "fill" && rest[0] === "type") return { fill: fillOfType(effect.fill, String(value), patterns) };
|
|
21141
21186
|
if (top === "patternId" && !rest.length) {
|
|
21142
|
-
const name = _optionalChain([patternOptions, 'call',
|
|
21187
|
+
const name = _optionalChain([patternOptions, 'call', _720 => _720(patterns), 'access', _721 => _721.find, 'call', _722 => _722((o) => o.value === value), 'optionalAccess', _723 => _723.label]);
|
|
21143
21188
|
return name ? { patternId: value, name } : { patternId: value };
|
|
21144
21189
|
}
|
|
21145
21190
|
if (!rest.length) return { [top]: value };
|
|
21146
21191
|
if (top === "fill" && rest[0] === "patternId") {
|
|
21147
|
-
const name = _optionalChain([patternOptions, 'call',
|
|
21192
|
+
const name = _optionalChain([patternOptions, 'call', _724 => _724(patterns), 'access', _725 => _725.find, 'call', _726 => _726((o) => o.value === value), 'optionalAccess', _727 => _727.label]);
|
|
21148
21193
|
return { fill: { ...effect.fill, patternId: value, ...name ? { name } : {} } };
|
|
21149
21194
|
}
|
|
21150
21195
|
return { [top]: setPath(getPath(effect, top), rest, value) };
|
|
@@ -21171,7 +21216,7 @@ function colorPanelView(controller) {
|
|
|
21171
21216
|
profileName: profile.name,
|
|
21172
21217
|
workingSpace: profile.builtin,
|
|
21173
21218
|
mode: profile.mode,
|
|
21174
|
-
cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access',
|
|
21219
|
+
cmykProfileName: _nullishCoalesce(_optionalChain([profile, 'access', _728 => _728.cmykProfile, 'optionalAccess', _729 => _729.name]), () => ( null)),
|
|
21175
21220
|
proof: proof ? { id: _nullishCoalesce(proof.profile.builtin, () => ( null)), name: proof.profile.name, intent: proof.intent, simulatePaper: proof.simulatePaper, gamutWarning: proof.gamutWarning, bpc: proof.bpc } : null
|
|
21176
21221
|
};
|
|
21177
21222
|
}
|
|
@@ -21354,32 +21399,32 @@ function boxFrameHit(overlay, p, tolerance, band) {
|
|
|
21354
21399
|
return null;
|
|
21355
21400
|
}
|
|
21356
21401
|
var FreeTransformTool = (_class16 = class {
|
|
21357
|
-
constructor(controller, options = {}) {;_class16.prototype.
|
|
21402
|
+
constructor(controller, options = {}) {;_class16.prototype.__init139.call(this);_class16.prototype.__init140.call(this);_class16.prototype.__init141.call(this);_class16.prototype.__init142.call(this);_class16.prototype.__init143.call(this);_class16.prototype.__init144.call(this);_class16.prototype.__init145.call(this);_class16.prototype.__init146.call(this);_class16.prototype.__init147.call(this);_class16.prototype.__init148.call(this);_class16.prototype.__init149.call(this);_class16.prototype.__init150.call(this);_class16.prototype.__init151.call(this);_class16.prototype.__init152.call(this);
|
|
21358
21403
|
this.controller = controller;
|
|
21359
21404
|
this.options = options;
|
|
21360
21405
|
}
|
|
21361
21406
|
|
|
21362
21407
|
|
|
21363
|
-
|
|
21364
|
-
|
|
21408
|
+
__init139() {this.sessionRef = null}
|
|
21409
|
+
__init140() {this.modeValue = "scale"}
|
|
21365
21410
|
/** The reference point in the untransformed frame's space (follows the transform). */
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21411
|
+
__init141() {this.refBox = { x: 0, y: 0 }}
|
|
21412
|
+
__init142() {this.corners = null}
|
|
21413
|
+
__init143() {this.drag = null}
|
|
21369
21414
|
/** The warp mesh in the frame's own space (null: no warp). */
|
|
21370
|
-
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21415
|
+
__init144() {this.mesh = null}
|
|
21416
|
+
__init145() {this.warpSettings = { style: "custom", bend: 50, horizontal: 0, vertical: 0, orientation: "horizontal", columns: 1, rows: 1 }}
|
|
21417
|
+
__init146() {this.pending = false}
|
|
21418
|
+
__init147() {this.viewScale = 1}
|
|
21374
21419
|
|
|
21375
21420
|
/** Values typed into the options bar since the last drag (V skew is not recovered from the shape). */
|
|
21376
|
-
|
|
21421
|
+
__init148() {this.typed = {}}
|
|
21377
21422
|
/** Width and height scale together when typed (the chain icon). */
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21423
|
+
__init149() {this.proportional = true}
|
|
21424
|
+
__init150() {this.error = null}
|
|
21425
|
+
__init151() {this.lastResult = null}
|
|
21381
21426
|
get active() {
|
|
21382
|
-
return Boolean(_optionalChain([this, 'access',
|
|
21427
|
+
return Boolean(_optionalChain([this, 'access', _730 => _730.sessionRef, 'optionalAccess', _731 => _731.isOpen]));
|
|
21383
21428
|
}
|
|
21384
21429
|
get session() {
|
|
21385
21430
|
return this.active ? this.sessionRef : null;
|
|
@@ -21388,7 +21433,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
21388
21433
|
return this.modeValue;
|
|
21389
21434
|
}
|
|
21390
21435
|
get interpolation() {
|
|
21391
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
21436
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _732 => _732.sessionRef, 'optionalAccess', _733 => _733.interpolation]), () => ( "bicubic"));
|
|
21392
21437
|
}
|
|
21393
21438
|
/** Whether the open transform has changed anything yet (a commit would add an undo step). */
|
|
21394
21439
|
get modified() {
|
|
@@ -21398,7 +21443,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
21398
21443
|
const start = s.startGeometry.corners;
|
|
21399
21444
|
return this.corners.some((p, i) => p.x !== start[i].x || p.y !== start[i].y);
|
|
21400
21445
|
}
|
|
21401
|
-
|
|
21446
|
+
__init152() {this.listeners = /* @__PURE__ */ new Set()}
|
|
21402
21447
|
/** Calls `listener` whenever the overlay, readout, mode or error changes. Returns the unsubscribe. */
|
|
21403
21448
|
subscribe(listener) {
|
|
21404
21449
|
this.listeners.add(listener);
|
|
@@ -21407,7 +21452,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
21407
21452
|
};
|
|
21408
21453
|
}
|
|
21409
21454
|
changed() {
|
|
21410
|
-
_optionalChain([this, 'access',
|
|
21455
|
+
_optionalChain([this, 'access', _734 => _734.options, 'access', _735 => _735.onChange, 'optionalCall', _736 => _736()]);
|
|
21411
21456
|
for (const l of this.listeners) l();
|
|
21412
21457
|
}
|
|
21413
21458
|
/** Opens a Free Transform (default: the selected pixels of the active layer, or the whole layer). Returns an error message or `null`. */
|
|
@@ -21800,7 +21845,7 @@ var FreeTransformTool = (_class16 = class {
|
|
|
21800
21845
|
}
|
|
21801
21846
|
/** Abandons the transform and restores everything. */
|
|
21802
21847
|
cancel() {
|
|
21803
|
-
_optionalChain([this, 'access',
|
|
21848
|
+
_optionalChain([this, 'access', _737 => _737.sessionRef, 'optionalAccess', _738 => _738.cancel, 'call', _739 => _739()]);
|
|
21804
21849
|
this.sessionRef = null;
|
|
21805
21850
|
this.corners = null;
|
|
21806
21851
|
this.mesh = null;
|
|
@@ -21857,7 +21902,7 @@ function imageLayerAppliedEffects(layer) {
|
|
|
21857
21902
|
const ref = (r) => ({ effect: r.effect, ...r.name ? { name: r.name } : {}, ...r.provider ? { provider: r.provider } : {} });
|
|
21858
21903
|
if (layer.type === "pixel" && layer.generator) out.push({ id: "generator", ...ref(layer.generator), role: "effect layer", enabled: true, values: layer.generator.values, ...layer.generator.time ? { time: layer.generator.time } : {}, ...layer.generator.animate ? { animate: layer.generator.animate } : {} });
|
|
21859
21904
|
if (layer.type === "smart")
|
|
21860
|
-
(_nullishCoalesce(_optionalChain([layer, 'access',
|
|
21905
|
+
(_nullishCoalesce(_optionalChain([layer, 'access', _740 => _740.smartFilters, 'optionalAccess', _741 => _741.filters]), () => ( []))).forEach((f, index) => {
|
|
21861
21906
|
if (f.kind === "effect") out.push({ id: f.id, ...ref(f), role: "smart filter", enabled: f.enabled && layer.smartFilters.enabled, opacity: f.opacity, blend: f.blend, preserveTransparency: Boolean(f.preserveTransparency), values: f.values, index });
|
|
21862
21907
|
});
|
|
21863
21908
|
return out;
|
|
@@ -21880,7 +21925,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
|
|
|
21880
21925
|
return { target, effect: _nullishCoalesce(effects.find((e) => e.id === instance), () => ( effects[effects.length - 1])), effects, ...extra };
|
|
21881
21926
|
};
|
|
21882
21927
|
const plainValues = (v) => v;
|
|
21883
|
-
return withImagePlayback(
|
|
21928
|
+
return withImagePlayback(_chunk2K5TELHVcjs.createEffectToolProvider.call(void 0, {
|
|
21884
21929
|
id: _nullishCoalesce(options.id, () => ( "image-effects")),
|
|
21885
21930
|
namespace: options.namespace,
|
|
21886
21931
|
title: "Image effects",
|
|
@@ -22034,7 +22079,7 @@ var OTHER_TOOL_LABELS = {
|
|
|
22034
22079
|
eyedropper: "Eyedropper"
|
|
22035
22080
|
};
|
|
22036
22081
|
function imageToolLabel(tool) {
|
|
22037
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([PAINT_TOOLS, 'access',
|
|
22082
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([PAINT_TOOLS, 'access', _742 => _742.find, 'call', _743 => _743((t) => t.id === tool), 'optionalAccess', _744 => _744.label]), () => ( OTHER_TOOL_LABELS[tool])), () => ( tool));
|
|
22038
22083
|
}
|
|
22039
22084
|
var IMAGE_TOOL_SHORTCUTS = {
|
|
22040
22085
|
...Object.fromEntries(PAINT_TOOLS.filter((t) => t.shortcut).map((t) => [t.id, t.shortcut])),
|
|
@@ -22146,19 +22191,19 @@ var pt = (p) => ({ x: p.x, y: p.y });
|
|
|
22146
22191
|
var cloneComponents = (cs) => cs.map((c) => ({ op: c.op, subpaths: c.subpaths.map((sp) => ({ anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed })), ...c.live ? { live: c.live } : {} }));
|
|
22147
22192
|
var sameTarget = (a, b) => !!a && !!b && a.kind === b.kind && (a.kind === "path" ? a.id === b.id : a.layerId === b.layerId);
|
|
22148
22193
|
var PathEditGesture = (_class17 = class {
|
|
22149
|
-
constructor(controller) {;_class17.prototype.
|
|
22194
|
+
constructor(controller) {;_class17.prototype.__init153.call(this);_class17.prototype.__init154.call(this);_class17.prototype.__init155.call(this);_class17.prototype.__init156.call(this);_class17.prototype.__init157.call(this);_class17.prototype.__init158.call(this);_class17.prototype.__init159.call(this);
|
|
22150
22195
|
this.controller = controller;
|
|
22151
22196
|
}
|
|
22152
22197
|
|
|
22153
22198
|
/** Selected anchors, as `component:subpath:anchor` keys. */
|
|
22154
|
-
|
|
22155
|
-
|
|
22156
|
-
|
|
22199
|
+
__init153() {this.selected = /* @__PURE__ */ new Set()}
|
|
22200
|
+
__init154() {this.target = null}
|
|
22201
|
+
__init155() {this.drag = null}
|
|
22157
22202
|
/** The Pen's open subpath being drawn. */
|
|
22158
|
-
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
|
|
22203
|
+
__init156() {this.drawing = null}
|
|
22204
|
+
__init157() {this.pointer = null}
|
|
22205
|
+
__init158() {this.scale = 1}
|
|
22206
|
+
__init159() {this.error = null}
|
|
22162
22207
|
/** Screen pixels per document pixel (the viewport projection's scale). */
|
|
22163
22208
|
setView(scale) {
|
|
22164
22209
|
if (scale > 0 && Number.isFinite(scale)) this.scale = scale;
|
|
@@ -22194,10 +22239,10 @@ var PathEditGesture = (_class17 = class {
|
|
|
22194
22239
|
}
|
|
22195
22240
|
for (const k of [...this.selected]) {
|
|
22196
22241
|
const r = parseKey(k);
|
|
22197
|
-
if (!_optionalChain([cs, 'access',
|
|
22242
|
+
if (!_optionalChain([cs, 'access', _745 => _745[r.component], 'optionalAccess', _746 => _746.subpaths, 'access', _747 => _747[r.subpath], 'optionalAccess', _748 => _748.anchors, 'access', _749 => _749[r.anchor]])) this.selected.delete(k);
|
|
22198
22243
|
}
|
|
22199
22244
|
const d = this.drawing;
|
|
22200
|
-
if (d && (!_optionalChain([cs, 'access',
|
|
22245
|
+
if (d && (!_optionalChain([cs, 'access', _750 => _750[d.component], 'optionalAccess', _751 => _751.subpaths, 'access', _752 => _752[d.subpath]]) || cs[d.component].subpaths[d.subpath].closed)) this.drawing = null;
|
|
22201
22246
|
return cs;
|
|
22202
22247
|
}
|
|
22203
22248
|
anchorAt(cs, p) {
|
|
@@ -22311,7 +22356,7 @@ var PathEditGesture = (_class17 = class {
|
|
|
22311
22356
|
return;
|
|
22312
22357
|
}
|
|
22313
22358
|
const seg = this.segmentAt(cs, p);
|
|
22314
|
-
if (seg && mods.alt && mods.shift && _optionalChain([this, 'access',
|
|
22359
|
+
if (seg && mods.alt && mods.shift && _optionalChain([this, 'access', _753 => _753.target, 'optionalAccess', _754 => _754.kind]) === "vector-mask") return this.cycleEdge(this.target.layerId, seg.ref);
|
|
22315
22360
|
if (seg) {
|
|
22316
22361
|
if (!mods.shift) this.selected.clear();
|
|
22317
22362
|
this.drag = { kind: "segment", ...seg, base: cloneComponents(cs), moved: false };
|
|
@@ -22323,7 +22368,7 @@ var PathEditGesture = (_class17 = class {
|
|
|
22323
22368
|
/** Alt+Shift-click on a vector mask's segment: hard → feather → matte → hard (one undo step). */
|
|
22324
22369
|
cycleEdge(layerId, r) {
|
|
22325
22370
|
const at = { component: r.component, subpath: r.subpath, segment: r.anchor };
|
|
22326
|
-
const now = _nullishCoalesce(_optionalChain([this, 'access',
|
|
22371
|
+
const now = _nullishCoalesce(_optionalChain([this, 'access', _755 => _755.controller, 'access', _756 => _756.getVectorMask, 'call', _757 => _757(layerId), 'optionalAccess', _758 => _758.edges, 'access', _759 => _759.find, 'call', _760 => _760((e) => e.component === at.component && e.subpath === at.subpath && e.segment === at.segment), 'optionalAccess', _761 => _761.mode]), () => ( "hard"));
|
|
22327
22372
|
const next = now === "hard" ? "feather" : now === "feather" ? "matte" : "hard";
|
|
22328
22373
|
try {
|
|
22329
22374
|
this.controller.setVectorMaskEdge(layerId, at, next);
|
|
@@ -22527,8 +22572,8 @@ var PathEditGesture = (_class17 = class {
|
|
|
22527
22572
|
if (!cs) return null;
|
|
22528
22573
|
const curves = [];
|
|
22529
22574
|
const curveModes = [];
|
|
22530
|
-
const edges = _optionalChain([this, 'access',
|
|
22531
|
-
const modeOf = (ci, si, k) => _nullishCoalesce(_optionalChain([edges, 'access',
|
|
22575
|
+
const edges = _optionalChain([this, 'access', _762 => _762.target, 'optionalAccess', _763 => _763.kind]) === "vector-mask" ? _nullishCoalesce(_optionalChain([this, 'access', _764 => _764.controller, 'access', _765 => _765.getVectorMask, 'call', _766 => _766(this.target.layerId), 'optionalAccess', _767 => _767.edges]), () => ( [])) : [];
|
|
22576
|
+
const modeOf = (ci, si, k) => _nullishCoalesce(_optionalChain([edges, 'access', _768 => _768.find, 'call', _769 => _769((e) => e.component === ci && e.subpath === si && e.segment === k), 'optionalAccess', _770 => _770.mode]), () => ( "hard"));
|
|
22532
22577
|
const anchors = [];
|
|
22533
22578
|
const handles = [];
|
|
22534
22579
|
const selectedComponents = new Set(this.selection.map((r) => r.component));
|
|
@@ -22550,11 +22595,11 @@ var PathEditGesture = (_class17 = class {
|
|
|
22550
22595
|
let preview = null;
|
|
22551
22596
|
const d = this.drawing;
|
|
22552
22597
|
if (tool === "path-pen" && d && this.pointer && !this.drag) {
|
|
22553
|
-
const sp = _optionalChain([cs, 'access',
|
|
22554
|
-
const last = _optionalChain([sp, 'optionalAccess',
|
|
22598
|
+
const sp = _optionalChain([cs, 'access', _771 => _771[d.component], 'optionalAccess', _772 => _772.subpaths, 'access', _773 => _773[d.subpath]]);
|
|
22599
|
+
const last = _optionalChain([sp, 'optionalAccess', _774 => _774.anchors, 'access', _775 => _775[sp.anchors.length - 1]]);
|
|
22555
22600
|
if (last) preview = last.out ? [pt(last), pt(last.out), this.pointer, this.pointer] : [pt(last), this.pointer];
|
|
22556
22601
|
}
|
|
22557
|
-
const marquee = _optionalChain([this, 'access',
|
|
22602
|
+
const marquee = _optionalChain([this, 'access', _776 => _776.drag, 'optionalAccess', _777 => _777.kind]) === "marquee" ? rect2(this.drag.start, this.drag.end) : null;
|
|
22558
22603
|
return { curves, ...edges.length ? { curveModes } : {}, anchors, handles, marquee, preview };
|
|
22559
22604
|
}
|
|
22560
22605
|
}, _class17);
|
|
@@ -22589,26 +22634,26 @@ var DEFAULT_CONTENT_AWARE_FILL_SETTINGS = {
|
|
|
22589
22634
|
livePreview: true
|
|
22590
22635
|
};
|
|
22591
22636
|
var ContentAwareFillSession = (_class18 = class _ContentAwareFillSession {
|
|
22592
|
-
constructor(controller) {;_class18.prototype.
|
|
22637
|
+
constructor(controller) {;_class18.prototype.__init160.call(this);_class18.prototype.__init161.call(this);_class18.prototype.__init162.call(this);_class18.prototype.__init163.call(this);_class18.prototype.__init164.call(this);_class18.prototype.__init165.call(this);_class18.prototype.__init166.call(this);_class18.prototype.__init167.call(this);_class18.prototype.__init168.call(this);_class18.prototype.__init169.call(this);_class18.prototype.__init170.call(this);_class18.prototype.__init171.call(this);_class18.prototype.__init172.call(this);_class18.prototype.__init173.call(this);_class18.prototype.__init174.call(this);
|
|
22593
22638
|
this.controller = controller;
|
|
22594
22639
|
}
|
|
22595
22640
|
|
|
22596
|
-
|
|
22597
|
-
|
|
22641
|
+
__init160() {this.settingsValue = { ...DEFAULT_CONTENT_AWARE_FILL_SETTINGS }}
|
|
22642
|
+
__init161() {this.plan = null}
|
|
22598
22643
|
/** The source view's window (document pixels): the selection with room around it to sample. */
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22644
|
+
__init162() {this.win = null}
|
|
22645
|
+
__init163() {this.before = null}
|
|
22646
|
+
__init164() {this.hole = null}
|
|
22602
22647
|
/** 1 where the fill may copy from, per window pixel. */
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22648
|
+
__init165() {this.area = null}
|
|
22649
|
+
__init166() {this.after = null}
|
|
22650
|
+
__init167() {this.lastPoint = null}
|
|
22651
|
+
__init168() {this.listeners = /* @__PURE__ */ new Set()}
|
|
22652
|
+
__init169() {this.dirty = false}
|
|
22608
22653
|
/** Why the workspace can't fill (nothing selected, not a pixel layer), for the UI. */
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22654
|
+
__init170() {this.error = null}
|
|
22655
|
+
__init171() {this.computing = false}
|
|
22656
|
+
__init172() {this.revision = 0}
|
|
22612
22657
|
get settings() {
|
|
22613
22658
|
return this.settingsValue;
|
|
22614
22659
|
}
|
|
@@ -22627,7 +22672,7 @@ var ContentAwareFillSession = (_class18 = class _ContentAwareFillSession {
|
|
|
22627
22672
|
/** Images up to this many pixels show (and can be sampled) whole in the workspace. */
|
|
22628
22673
|
static __initStatic() {this.WHOLE_IMAGE_PIXELS = 4e6}
|
|
22629
22674
|
/** Room around the selection the window holds, in px each way. */
|
|
22630
|
-
|
|
22675
|
+
__init173() {this.margin = 0}
|
|
22631
22676
|
/**
|
|
22632
22677
|
* Reads the layer and makes the first preview. The window is the whole image up to
|
|
22633
22678
|
* {@link WHOLE_IMAGE_PIXELS}; on a larger one it holds the selection and room around it (twice
|
|
@@ -22636,8 +22681,8 @@ var ContentAwareFillSession = (_class18 = class _ContentAwareFillSession {
|
|
|
22636
22681
|
async open() {
|
|
22637
22682
|
try {
|
|
22638
22683
|
const { width, height } = this.controller.getState().imageDimensions;
|
|
22639
|
-
const b = _optionalChain([this, 'access',
|
|
22640
|
-
this.margin = width * height <= _ContentAwareFillSession.WHOLE_IMAGE_PIXELS ? Math.max(width, height) : Math.max(256, 2 * Math.max(_nullishCoalesce(_optionalChain([b, 'optionalAccess',
|
|
22684
|
+
const b = _optionalChain([this, 'access', _778 => _778.controller, 'access', _779 => _779.getSelection, 'call', _780 => _780(), 'optionalAccess', _781 => _781.bounds]);
|
|
22685
|
+
this.margin = width * height <= _ContentAwareFillSession.WHOLE_IMAGE_PIXELS ? Math.max(width, height) : Math.max(256, 2 * Math.max(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _782 => _782.width]), () => ( 0)), _nullishCoalesce(_optionalChain([b, 'optionalAccess', _783 => _783.height]), () => ( 0))));
|
|
22641
22686
|
this.plan = this.controller.prepareContentAwareFill({ sampleRadius: this.margin });
|
|
22642
22687
|
} catch (err) {
|
|
22643
22688
|
this.error = err instanceof Error ? err.message : String(err);
|
|
@@ -22769,7 +22814,7 @@ var ContentAwareFillSession = (_class18 = class _ContentAwareFillSession {
|
|
|
22769
22814
|
this.emit();
|
|
22770
22815
|
return true;
|
|
22771
22816
|
}
|
|
22772
|
-
|
|
22817
|
+
__init174() {this.strokeAdds = true}
|
|
22773
22818
|
move(point2) {
|
|
22774
22819
|
if (!this.lastPoint) return;
|
|
22775
22820
|
this.paint(this.lastPoint, point2, this.strokeAdds);
|
|
@@ -22795,7 +22840,7 @@ var ContentAwareFillSession = (_class18 = class _ContentAwareFillSession {
|
|
|
22795
22840
|
this.dirty = false;
|
|
22796
22841
|
try {
|
|
22797
22842
|
const area = this.samplingMask();
|
|
22798
|
-
if (!_optionalChain([area, 'optionalAccess',
|
|
22843
|
+
if (!_optionalChain([area, 'optionalAccess', _784 => _784.bounds])) throw new Error("The sampling area is empty; paint where the fill may copy from.");
|
|
22799
22844
|
const { plan, after } = await this.controller.previewContentAwareFill({ layerId: this.plan.layerId, samplingArea: area, seed: this.settingsValue.seed });
|
|
22800
22845
|
const win = this.win;
|
|
22801
22846
|
const out = Uint8ClampedArray.from(this.before);
|
|
@@ -22874,7 +22919,7 @@ var ContentAwareFillSession = (_class18 = class _ContentAwareFillSession {
|
|
|
22874
22919
|
/** OK: fills with this sampling area, seed and output as one undo step. */
|
|
22875
22920
|
async commit(options = {}) {
|
|
22876
22921
|
const area = this.samplingMask();
|
|
22877
|
-
if (!this.plan || !_optionalChain([area, 'optionalAccess',
|
|
22922
|
+
if (!this.plan || !_optionalChain([area, 'optionalAccess', _785 => _785.bounds])) throw new Error(_nullishCoalesce(this.error, () => ( "The sampling area is empty; paint where the fill may copy from.")));
|
|
22878
22923
|
return this.controller.contentAwareFillAsync({ layerId: this.plan.layerId, samplingArea: area, seed: this.settingsValue.seed, output: this.settingsValue.output, signal: options.signal });
|
|
22879
22924
|
}
|
|
22880
22925
|
}, _class18.__initStatic(), _class18);
|