@pixerate/editor 0.278.0 → 0.279.1
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 +59 -59
- package/dist/animation-editor/index.js +3 -3
- package/dist/canvas/editorDocument.d.cts +53 -0
- package/dist/canvas/editorDocument.d.ts +53 -0
- package/dist/canvas/index.cjs +169 -22
- package/dist/canvas/index.js +148 -1
- package/dist/chart/index.cjs +1 -1
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-MITQGHN3.cjs → chunk-4BMRQSPB.cjs} +15 -1
- package/dist/{chunk-T2HUQBRC.cjs → chunk-DK33HLA2.cjs} +331 -10
- package/dist/{chunk-DWPFGWW5.js → chunk-FKO3CY2C.js} +1 -1
- package/dist/{chunk-N4MCWQZ7.js → chunk-HN57I7KT.js} +1 -1
- package/dist/{chunk-4NZTK7LM.cjs → chunk-K4ANWBF7.cjs} +35 -35
- package/dist/{chunk-JV7DKLMX.js → chunk-KBH6CM3U.js} +326 -5
- package/dist/{chunk-VNF7A2JA.cjs → chunk-MNHP3AQT.cjs} +23 -23
- package/dist/{chunk-FNIWHSLI.js → chunk-NJDEKU5D.js} +1 -1
- package/dist/{chunk-CTHWXW5M.js → chunk-V6LQND7D.js} +14 -0
- package/dist/{chunk-QBZEC2JJ.cjs → chunk-WCC4NXWY.cjs} +86 -86
- package/dist/{chunk-PEQWARCP.cjs → chunk-WZYRYYXN.cjs} +29 -25
- package/dist/{chunk-HHX7ST6Z.js → chunk-YOM76H2V.js} +7 -3
- package/dist/image-editor/index.cjs +783 -783
- package/dist/image-editor/index.js +4 -4
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.js +1 -1
- package/dist/paint/wet/gpu.d.cts +2 -0
- package/dist/paint/wet/gpu.d.ts +2 -0
- package/dist/paint-editor/index.cjs +128 -128
- package/dist/paint-editor/index.js +3 -3
- package/dist/persistence/autosave.d.cts +15 -1
- package/dist/persistence/autosave.d.ts +15 -1
- package/dist/persistence/editorAutosave.d.cts +12 -1
- package/dist/persistence/editorAutosave.d.ts +12 -1
- package/dist/persistence/index.cjs +6 -2
- package/dist/persistence/index.d.cts +1 -0
- package/dist/persistence/index.d.ts +1 -0
- package/dist/persistence/index.js +5 -1
- package/dist/persistence/remoteSync.d.cts +152 -0
- package/dist/persistence/remoteSync.d.ts +152 -0
- package/dist/vector/index.cjs +997 -997
- package/dist/vector/index.js +4 -4
- package/package.json +1 -1
|
@@ -74,7 +74,7 @@ var _chunkJBZRVLXVcjs = require('./chunk-JBZRVLXV.cjs');
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
var
|
|
77
|
+
var _chunk4BMRQSPBcjs = require('./chunk-4BMRQSPB.cjs');
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
@@ -3706,7 +3706,7 @@ var PaintDabStroke = (_class4 = class {
|
|
|
3706
3706
|
|
|
3707
3707
|
// src/paint-editor/wet.ts
|
|
3708
3708
|
var STROKE_WATER = 0.9;
|
|
3709
|
-
var STROKE_MASS =
|
|
3709
|
+
var STROKE_MASS = _chunk4BMRQSPBcjs.PIGMENT_UNIT * 2.5;
|
|
3710
3710
|
var STROKE_LIGHT = 1.5;
|
|
3711
3711
|
var COVERAGE_STEPS = 4096;
|
|
3712
3712
|
function union(a, b) {
|
|
@@ -3737,14 +3737,14 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
3737
3737
|
const perDab = Math.min(1, spacing * 1.2);
|
|
3738
3738
|
const thin = wet.thinner;
|
|
3739
3739
|
const body = wet.body * (1 - thin);
|
|
3740
|
-
this.medium = new (0,
|
|
3740
|
+
this.medium = new (0, _chunk4BMRQSPBcjs.WetMedium)(init.world, init.laneId, {
|
|
3741
3741
|
water: STROKE_WATER * Math.min(1, wet.water * (1 + thin)) * perDab,
|
|
3742
3742
|
mass: STROKE_MASS * wet.pigment * (1 - 0.6 * thin) * perDab,
|
|
3743
3743
|
body,
|
|
3744
3744
|
light: 0
|
|
3745
3745
|
});
|
|
3746
3746
|
if (wet.tool === "paint" && brush.ghost && wet.pigment > 0) {
|
|
3747
|
-
const one =
|
|
3747
|
+
const one = _chunk4BMRQSPBcjs.pigmentOf.call(void 0, init.color, body);
|
|
3748
3748
|
init.world.startGhost(init.laneId, [one[0], one[1], one[2], one[3]], brush.ghost.linger, _nullishCoalesce(init.speed, () => ( 120)), _nullishCoalesce(brush.ghost.trigger, () => ( "immediate")));
|
|
3749
3749
|
}
|
|
3750
3750
|
this.lightBase = wet.tool === "paint" ? STROKE_LIGHT * brush.light.amount * (1 - 0.6 * thin) * perDab : 0;
|
|
@@ -3978,7 +3978,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
3978
3978
|
|
|
3979
3979
|
|
|
3980
3980
|
__init41() {this.world = null}
|
|
3981
|
-
__init42() {this.tilt = { ...
|
|
3981
|
+
__init42() {this.tilt = { ..._chunk4BMRQSPBcjs.FLAT }}
|
|
3982
3982
|
__init43() {this.settings = /* @__PURE__ */ new Map()}
|
|
3983
3983
|
__init44() {this.patterns = /* @__PURE__ */ new Map()}
|
|
3984
3984
|
__init45() {this.paused = false}
|
|
@@ -4003,8 +4003,8 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4003
4003
|
/** Starts the GPU engine for the world (once; it may turn out unavailable). */
|
|
4004
4004
|
startGpu() {
|
|
4005
4005
|
if (this.gpuMode === "off" || this.gpu || this.gpuStarting || this.gpuSupport) return;
|
|
4006
|
-
const provider = this.options.gpuProvider === void 0 ?
|
|
4007
|
-
this.gpuStarting =
|
|
4006
|
+
const provider = this.options.gpuProvider === void 0 ? _chunk4BMRQSPBcjs.findWebGpu.call(void 0, ) : this.options.gpuProvider;
|
|
4007
|
+
this.gpuStarting = _chunk4BMRQSPBcjs.createWetGpuEngine.call(void 0, provider).then(({ engine, support }) => {
|
|
4008
4008
|
this.gpuSupport = support;
|
|
4009
4009
|
if (!engine) return;
|
|
4010
4010
|
if (this.gpuMode === "off" || !this.world) {
|
|
@@ -4063,7 +4063,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4063
4063
|
return this.world;
|
|
4064
4064
|
}
|
|
4065
4065
|
makeWorld(width, height, paper) {
|
|
4066
|
-
const world = new (0,
|
|
4066
|
+
const world = new (0, _chunk4BMRQSPBcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: this.options.kernel, threads: this.options.threads });
|
|
4067
4067
|
world.setTilt(this.tilt);
|
|
4068
4068
|
world.gpuMinTiles = this.gpuMinTiles;
|
|
4069
4069
|
if (this.gpu) world.attachGpu(this.gpu);
|
|
@@ -4075,7 +4075,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4075
4075
|
* sides: the shift has to be whole wet tiles (256 px), and no wet stroke may be live.
|
|
4076
4076
|
*/
|
|
4077
4077
|
canExtend(left2, top) {
|
|
4078
|
-
return left2 %
|
|
4078
|
+
return left2 % _chunk4BMRQSPBcjs.WET_TILE === 0 && top % _chunk4BMRQSPBcjs.WET_TILE === 0 && !this.driver;
|
|
4079
4079
|
}
|
|
4080
4080
|
/**
|
|
4081
4081
|
* Keeps the wet paint while the canvas grows to `width`×`height` by `left` / `top` on those
|
|
@@ -4087,8 +4087,8 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4087
4087
|
extend(width, height, left2, top, paper) {
|
|
4088
4088
|
if (!this.canExtend(left2, top)) throw new Error("Wet paint only moves by whole 256 px tiles, between strokes.");
|
|
4089
4089
|
for (const [id, s] of this.settings) if (s.flow.center) this.settings.set(id, { ...s, flow: { ...s.flow, center: { x: s.flow.center.x + left2, y: s.flow.center.y + top } } });
|
|
4090
|
-
const tx0 = left2 /
|
|
4091
|
-
const ty0 = top /
|
|
4090
|
+
const tx0 = left2 / _chunk4BMRQSPBcjs.WET_TILE;
|
|
4091
|
+
const ty0 = top / _chunk4BMRQSPBcjs.WET_TILE;
|
|
4092
4092
|
for (const [id, f] of this.patterns) {
|
|
4093
4093
|
const moved2 = _chunkIFWLZZCWcjs.moveLivePatternSnapshot.call(void 0, f.snapshot(), { width, height }, tx0, ty0);
|
|
4094
4094
|
const next = new (0, _chunkIFWLZZCWcjs.LivePatternField)(width, height);
|
|
@@ -4101,12 +4101,12 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4101
4101
|
this.lastTick = null;
|
|
4102
4102
|
this.stepsOwed = 0;
|
|
4103
4103
|
if (!old || !snap) return;
|
|
4104
|
-
const moved =
|
|
4104
|
+
const moved = _chunk4BMRQSPBcjs.moveWetSnapshot.call(void 0, snap, old, { width, height }, left2, top, (l) => {
|
|
4105
4105
|
const flow = _optionalChain([this, 'access', _104 => _104.settings, 'access', _105 => _105.get, 'call', _106 => _106(l.id), 'optionalAccess', _107 => _107.flow]);
|
|
4106
4106
|
return {
|
|
4107
4107
|
base: _chunk474IQG74cjs.translateSurface.call(void 0, l.base, left2, top),
|
|
4108
4108
|
...l.light ? { light: _chunk474IQG74cjs.translateSurface.call(void 0, l.light, left2, top) } : {},
|
|
4109
|
-
flow: l.flow && flow && flow.kind !== "none" ?
|
|
4109
|
+
flow: l.flow && flow && flow.kind !== "none" ? _chunk4BMRQSPBcjs.flowField.call(void 0, flow, width, height) : l.flow
|
|
4110
4110
|
};
|
|
4111
4111
|
});
|
|
4112
4112
|
this.world = this.makeWorld(width, height, paper);
|
|
@@ -4130,12 +4130,15 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4130
4130
|
}
|
|
4131
4131
|
/** Resolves when no batch is running. */
|
|
4132
4132
|
async idle() {
|
|
4133
|
-
while (this.ticking
|
|
4133
|
+
while (this.ticking || this.displaying) {
|
|
4134
|
+
if (this.ticking) await this.ticking;
|
|
4135
|
+
else await this.displaying.catch(() => void 0);
|
|
4136
|
+
}
|
|
4134
4137
|
}
|
|
4135
4138
|
settingsOf(layerId, medium = "watercolor") {
|
|
4136
4139
|
let s = this.settings.get(layerId);
|
|
4137
4140
|
if (!s) {
|
|
4138
|
-
s = { params:
|
|
4141
|
+
s = { params: _chunk4BMRQSPBcjs.normalizeWetParams.call(void 0, WET_MEDIUM_PARAMS[medium], _chunk4BMRQSPBcjs.DEFAULT_WET_PARAMS), flow: { ..._chunk4BMRQSPBcjs.DEFAULT_FLOW }, livePatterns: null };
|
|
4139
4142
|
this.settings.set(layerId, s);
|
|
4140
4143
|
}
|
|
4141
4144
|
return s;
|
|
@@ -4162,22 +4165,22 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4162
4165
|
const s = this.settingsOf(layerId, medium);
|
|
4163
4166
|
w.ensureLane(layerId, { params: s.params, base, light: this.host.layerLight(layerId), ghost: s.ghost, livePatterns: lp });
|
|
4164
4167
|
const { width, height } = this.host.canvas();
|
|
4165
|
-
if (s.flow.kind !== "none") w.setFlow(layerId,
|
|
4168
|
+
if (s.flow.kind !== "none") w.setFlow(layerId, _chunk4BMRQSPBcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
4166
4169
|
}
|
|
4167
4170
|
return w;
|
|
4168
4171
|
}
|
|
4169
4172
|
setParams(layerId, update) {
|
|
4170
4173
|
const s = this.settingsOf(layerId);
|
|
4171
|
-
s.params =
|
|
4174
|
+
s.params = _chunk4BMRQSPBcjs.normalizeWetParams.call(void 0, update, s.params);
|
|
4172
4175
|
if (_optionalChain([this, 'access', _117 => _117.world, 'optionalAccess', _118 => _118.hasLane, 'call', _119 => _119(layerId)])) this.world.setParams(layerId, s.params);
|
|
4173
4176
|
return { ...s.params };
|
|
4174
4177
|
}
|
|
4175
4178
|
setFlow(layerId, update) {
|
|
4176
4179
|
const s = this.settingsOf(layerId);
|
|
4177
|
-
s.flow =
|
|
4180
|
+
s.flow = _chunk4BMRQSPBcjs.normalizeFlow.call(void 0, update, s.flow);
|
|
4178
4181
|
if (_optionalChain([this, 'access', _120 => _120.world, 'optionalAccess', _121 => _121.hasLane, 'call', _122 => _122(layerId)])) {
|
|
4179
4182
|
const { width, height } = this.host.canvas();
|
|
4180
|
-
this.world.setFlow(layerId,
|
|
4183
|
+
this.world.setFlow(layerId, _chunk4BMRQSPBcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
4181
4184
|
}
|
|
4182
4185
|
return { ...s.flow };
|
|
4183
4186
|
}
|
|
@@ -4241,7 +4244,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4241
4244
|
};
|
|
4242
4245
|
}
|
|
4243
4246
|
setTilt(update) {
|
|
4244
|
-
this.tilt =
|
|
4247
|
+
this.tilt = _chunk4BMRQSPBcjs.normalizeTilt.call(void 0, update, this.tilt);
|
|
4245
4248
|
_optionalChain([this, 'access', _146 => _146.world, 'optionalAccess', _147 => _147.setTilt, 'call', _148 => _148(this.tilt)]);
|
|
4246
4249
|
return { ...this.tilt };
|
|
4247
4250
|
}
|
|
@@ -4265,7 +4268,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4265
4268
|
params: { ...s.params },
|
|
4266
4269
|
flow: { ...s.flow },
|
|
4267
4270
|
livePatterns: s.livePatterns ? { ...s.livePatterns } : null,
|
|
4268
|
-
...g ? { ghost: { remaining: Math.round(g.remaining *
|
|
4271
|
+
...g ? { ghost: { remaining: Math.round(g.remaining * _chunk4BMRQSPBcjs.FREE_INTERVAL / this.speed * 100) / 100 } } : {}
|
|
4269
4272
|
};
|
|
4270
4273
|
}
|
|
4271
4274
|
backend() {
|
|
@@ -4387,13 +4390,14 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4387
4390
|
this.ticking = null;
|
|
4388
4391
|
}
|
|
4389
4392
|
this.flushDriver();
|
|
4393
|
+
if (this.displaying) await this.displaying.catch(() => void 0);
|
|
4390
4394
|
if (w.gpuActive) {
|
|
4391
4395
|
const shading = this.syncDisplaysGpu(DISPLAY_TILES_PER_TICK).then(() => void 0);
|
|
4392
4396
|
this.displaying = shading;
|
|
4393
4397
|
try {
|
|
4394
4398
|
await shading;
|
|
4395
4399
|
} finally {
|
|
4396
|
-
this.displaying = null;
|
|
4400
|
+
if (this.displaying === shading) this.displaying = null;
|
|
4397
4401
|
}
|
|
4398
4402
|
} else this.syncDisplays(DISPLAY_TILES_PER_TICK);
|
|
4399
4403
|
this.retireDry();
|
|
@@ -4468,7 +4472,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4468
4472
|
const s = this.settings.get(layerId);
|
|
4469
4473
|
if (_optionalChain([s, 'optionalAccess', _175 => _175.ghost, 'optionalAccess', _176 => _176.trigger]) === "agent") {
|
|
4470
4474
|
const sec = linger !== void 0 ? Math.max(0.5, Math.min(60, linger)) : s.ghost.linger;
|
|
4471
|
-
const total = Math.max(1, Math.round(sec * this.speed /
|
|
4475
|
+
const total = Math.max(1, Math.round(sec * this.speed / _chunk4BMRQSPBcjs.FREE_INTERVAL));
|
|
4472
4476
|
s.ghost = { ...s.ghost, linger: sec, total, remaining: total, trigger: void 0 };
|
|
4473
4477
|
}
|
|
4474
4478
|
}
|
|
@@ -4593,7 +4597,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
4593
4597
|
}, _class6);
|
|
4594
4598
|
function wetPigmentOf(hex, body) {
|
|
4595
4599
|
const [r, g, b] = hexToRgb8(hex);
|
|
4596
|
-
return Array.from(
|
|
4600
|
+
return Array.from(_chunk4BMRQSPBcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], body));
|
|
4597
4601
|
}
|
|
4598
4602
|
|
|
4599
4603
|
// src/vector/brushstrokeMedia.ts
|
|
@@ -4681,7 +4685,7 @@ var WetBrushstrokeJob = (_class7 = class {
|
|
|
4681
4685
|
return;
|
|
4682
4686
|
}
|
|
4683
4687
|
const { rect, points } = this.placed;
|
|
4684
|
-
this.world = new (0,
|
|
4688
|
+
this.world = new (0, _chunk4BMRQSPBcjs.WetWorld)(rect.width, rect.height, wetPaperInput(DEFAULT_PAPER), { kernel: "typescript", threads: 0 });
|
|
4685
4689
|
const medium = _nullishCoalesce(this.placed.brush.wet.medium, () => ( "watercolor"));
|
|
4686
4690
|
this.world.ensureLane("s", { params: _nullishCoalesce(WET_MEDIUM_PARAMS[medium], () => ( {})) });
|
|
4687
4691
|
const color2 = this.placed.color;
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
normalizeTilt,
|
|
75
75
|
normalizeWetParams,
|
|
76
76
|
pigmentOf
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-V6LQND7D.js";
|
|
78
78
|
import {
|
|
79
79
|
BrushstrokeCache,
|
|
80
80
|
brushstrokeDataUrl,
|
|
@@ -4130,7 +4130,10 @@ var PaintWetLayers = class {
|
|
|
4130
4130
|
}
|
|
4131
4131
|
/** Resolves when no batch is running. */
|
|
4132
4132
|
async idle() {
|
|
4133
|
-
while (this.ticking
|
|
4133
|
+
while (this.ticking || this.displaying) {
|
|
4134
|
+
if (this.ticking) await this.ticking;
|
|
4135
|
+
else await this.displaying.catch(() => void 0);
|
|
4136
|
+
}
|
|
4134
4137
|
}
|
|
4135
4138
|
settingsOf(layerId, medium = "watercolor") {
|
|
4136
4139
|
let s = this.settings.get(layerId);
|
|
@@ -4387,13 +4390,14 @@ var PaintWetLayers = class {
|
|
|
4387
4390
|
this.ticking = null;
|
|
4388
4391
|
}
|
|
4389
4392
|
this.flushDriver();
|
|
4393
|
+
if (this.displaying) await this.displaying.catch(() => void 0);
|
|
4390
4394
|
if (w.gpuActive) {
|
|
4391
4395
|
const shading = this.syncDisplaysGpu(DISPLAY_TILES_PER_TICK).then(() => void 0);
|
|
4392
4396
|
this.displaying = shading;
|
|
4393
4397
|
try {
|
|
4394
4398
|
await shading;
|
|
4395
4399
|
} finally {
|
|
4396
|
-
this.displaying = null;
|
|
4400
|
+
if (this.displaying === shading) this.displaying = null;
|
|
4397
4401
|
}
|
|
4398
4402
|
} else this.syncDisplays(DISPLAY_TILES_PER_TICK);
|
|
4399
4403
|
this.retireDry();
|