@pixerate/editor 0.258.0 → 0.260.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/agent/index.cjs +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/animation-editor/index.cjs +61 -59
- package/dist/animation-editor/index.js +5 -3
- package/dist/brushes/contract.d.cts +24 -0
- package/dist/brushes/contract.d.ts +24 -0
- package/dist/brushes/index.cjs +146 -31
- package/dist/brushes/index.d.cts +1 -0
- package/dist/brushes/index.d.ts +1 -0
- package/dist/brushes/index.js +121 -6
- package/dist/{brushstrokeRender-JI4W6F2G.js → brushstrokeRender-25Q5BEY6.js} +17 -7
- package/dist/{brushstrokeRender-MQ6PSDM5.cjs → brushstrokeRender-N6UPZSQS.cjs} +31 -21
- package/dist/canvas/brushTypes.d.cts +5 -0
- package/dist/canvas/brushTypes.d.ts +5 -0
- package/dist/canvas/drawController.d.cts +15 -1
- package/dist/canvas/drawController.d.ts +15 -1
- package/dist/canvas/index.cjs +136 -102
- package/dist/canvas/index.js +35 -1
- package/dist/{chunk-3PPJRMIG.js → chunk-3O47TPGX.js} +197 -18
- package/dist/{chunk-5Q5MLXAD.cjs → chunk-3TQW5MPW.cjs} +23 -23
- package/dist/{chunk-JBBJE76O.cjs → chunk-3ZRNK3RO.cjs} +1138 -85
- package/dist/{chunk-YSGW7VV4.cjs → chunk-43NT242D.cjs} +1401 -228
- package/dist/{chunk-SMTUQWGY.js → chunk-5IW65VQ6.js} +1 -1
- package/dist/{chunk-YQ4PQTBB.js → chunk-6NZL24W4.js} +9 -1
- package/dist/{chunk-O3ZVZSNJ.cjs → chunk-7AUQ2UJ3.cjs} +137 -129
- package/dist/{chunk-4M4E3N6X.js → chunk-CQVTGBQI.js} +1 -1
- package/dist/{chunk-SSFMWJDK.js → chunk-D4TE5JNW.js} +1192 -19
- package/dist/{chunk-AORZ5M5C.js → chunk-EHALWBBD.js} +1 -1
- package/dist/{chunk-6WCQ35GI.cjs → chunk-NHA26O5X.cjs} +2 -2
- package/dist/{chunk-DPYAO5U6.cjs → chunk-PVJMTLPJ.cjs} +197 -18
- package/dist/{chunk-MQGQTKVW.cjs → chunk-PYTJBVW5.cjs} +29 -29
- package/dist/{chunk-IXQZHCOF.js → chunk-QAR2N7HZ.js} +1 -1
- package/dist/{chunk-5P4JEOIV.js → chunk-TMDDMJCR.js} +2 -2
- package/dist/{chunk-RSIKDWOP.cjs → chunk-TZOX7KWV.cjs} +15 -15
- package/dist/{chunk-IPUTIUGQ.cjs → chunk-UVZ7RQOE.cjs} +1 -1
- package/dist/{chunk-A7GJ6BXI.js → chunk-WJ4WQJCC.js} +1062 -9
- package/dist/{chunk-ICTPLVSR.js → chunk-X2EXYY4J.js} +1 -1
- package/dist/{chunk-WQCNC4DK.js → chunk-XC6DPRYI.js} +695 -4
- package/dist/{chunk-KBYB7OWB.cjs → chunk-YHDHFJUC.cjs} +776 -85
- package/dist/{chunk-P3PZ63M3.cjs → chunk-YLUIFXSL.cjs} +35 -35
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/image-editor/index.cjs +1385 -2484
- package/dist/image-editor/index.js +139 -1238
- package/dist/image-editor/selection-worker.cjs +3 -4
- package/dist/image-editor/selection-worker.js +1 -2
- package/dist/paint/index.cjs +3 -5
- package/dist/paint/index.js +40 -42
- package/dist/paint-editor/contract.d.cts +29 -0
- package/dist/paint-editor/contract.d.ts +29 -0
- package/dist/paint-editor/dab-stroke.d.cts +5 -0
- package/dist/paint-editor/dab-stroke.d.ts +5 -0
- package/dist/paint-editor/index.cjs +402 -258
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +197 -53
- package/dist/paint-editor/stamp-tip.d.cts +17 -0
- package/dist/paint-editor/stamp-tip.d.ts +17 -0
- package/dist/paint-editor/ui.d.cts +21 -1
- package/dist/paint-editor/ui.d.ts +21 -1
- package/dist/raster/index.cjs +2 -4
- package/dist/raster/index.js +6 -8
- package/dist/vector/brushstroke.d.cts +6 -0
- package/dist/vector/brushstroke.d.ts +6 -0
- package/dist/vector/controller.d.cts +11 -2
- package/dist/vector/controller.d.ts +11 -2
- package/dist/vector/index.cjs +990 -973
- package/dist/vector/index.js +28 -11
- package/package.json +1 -1
- package/skills/pixerate-brushes/SKILL.md +1 -1
- package/skills/pixerate-canvas/SKILL.md +3 -1
- package/skills/pixerate-vector/SKILL.md +2 -2
- package/dist/chunk-2VJAVXLI.js +0 -192
- package/dist/chunk-62Z5WLRA.js +0 -700
- package/dist/chunk-BOHDJJ2O.cjs +0 -192
- package/dist/chunk-NKGB64CW.cjs +0 -700
- package/dist/chunk-SS53NNZO.cjs +0 -1066
- package/dist/chunk-ZNA3IQZF.js +0 -1066
package/dist/chunk-BOHDJJ2O.cjs
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkDPYAO5U6cjs = require('./chunk-DPYAO5U6.cjs');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _chunk2VX55NFMcjs = require('./chunk-2VX55NFM.cjs');
|
|
12
|
-
|
|
13
|
-
// src/raster/effects/ui.ts
|
|
14
|
-
function layerEffectsPanel(layer) {
|
|
15
|
-
const empty = { readOnly: true, enabled: true, scale: 1, rows: [] };
|
|
16
|
-
if (!layer) return { ...empty, available: false, reason: "Select a layer to add a layer style." };
|
|
17
|
-
if (layer.type === "adjustment") return { ...empty, available: false, reason: "Adjustment layers cannot have a layer style." };
|
|
18
|
-
const fx = layer.effects;
|
|
19
|
-
const readOnly = Boolean(_optionalChain([layer, 'access', _ => _.locks, 'optionalAccess', _2 => _2.all]));
|
|
20
|
-
return {
|
|
21
|
-
available: true,
|
|
22
|
-
readOnly,
|
|
23
|
-
reason: readOnly ? "The layer is locked; unlock it to change its layer style." : void 0,
|
|
24
|
-
enabled: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _3 => _3.enabled]), () => ( true)),
|
|
25
|
-
scale: _nullishCoalesce(_optionalChain([fx, 'optionalAccess', _4 => _4.scale]), () => ( 1)),
|
|
26
|
-
rows: (_nullishCoalesce(_optionalChain([fx, 'optionalAccess', _5 => _5.items]), () => ( []))).map((e) => ({ id: e.id, kind: e.kind, label: _chunkDPYAO5U6cjs.layerEffectLabel.call(void 0, e.kind), enabled: e.enabled }))
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function layerEffectsBadge(layer) {
|
|
30
|
-
if (!_optionalChain([layer, 'access', _6 => _6.effects, 'optionalAccess', _7 => _7.items, 'access', _8 => _8.length])) return null;
|
|
31
|
-
return _chunkDPYAO5U6cjs.hasActiveEffects.call(void 0, layer.effects) ? "on" : "off";
|
|
32
|
-
}
|
|
33
|
-
var LAYER_EFFECT_MENU = _chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS.map((kind) => ({ kind, label: _chunkDPYAO5U6cjs.layerEffectLabel.call(void 0, kind) }));
|
|
34
|
-
var BLENDS = _chunk2VX55NFMcjs.BLEND_MODES.filter((m) => m.id !== "pigment").map((m) => ({ value: m.id, label: m.label }));
|
|
35
|
-
var opt = (...pairs) => pairs.map(([value, label]) => ({ value, label }));
|
|
36
|
-
function patternOptions(patterns) {
|
|
37
|
-
return [...patterns.map((p) => ({ value: p.id, label: p.name || p.id })), ..._chunkDPYAO5U6cjs.builtinPatternIds.call(void 0, ).map((id) => ({ value: id, label: _chunkDPYAO5U6cjs.builtinPattern.call(void 0, id).name }))];
|
|
38
|
-
}
|
|
39
|
-
function getPath(o, path) {
|
|
40
|
-
let v = o;
|
|
41
|
-
for (const p of path.split(".")) {
|
|
42
|
-
if (v === null || v === void 0) return void 0;
|
|
43
|
-
if (Array.isArray(v)) v = p === "last" ? v[v.length - 1] : v[Number(p)];
|
|
44
|
-
else v = v[p];
|
|
45
|
-
}
|
|
46
|
-
return v;
|
|
47
|
-
}
|
|
48
|
-
function setPath(o, parts, value) {
|
|
49
|
-
if (!parts.length) return value;
|
|
50
|
-
const [p, ...rest] = parts;
|
|
51
|
-
if (Array.isArray(o)) {
|
|
52
|
-
const i = p === "last" ? o.length - 1 : Number(p);
|
|
53
|
-
const out = [...o];
|
|
54
|
-
out[i] = setPath(o[i], rest, value);
|
|
55
|
-
return out;
|
|
56
|
-
}
|
|
57
|
-
const r = _nullishCoalesce(o, () => ( {}));
|
|
58
|
-
return { ...r, [p]: setPath(r[p], rest, value) };
|
|
59
|
-
}
|
|
60
|
-
function fillControls(f, allowPattern, patterns) {
|
|
61
|
-
const types = allowPattern ? opt(["color", "Color"], ["gradient", "Gradient"], ["pattern", "Pattern"]) : opt(["color", "Color"], ["gradient", "Gradient"]);
|
|
62
|
-
const out = [{ key: "fill.type", label: "Fill", type: "select", value: f.type, options: types }];
|
|
63
|
-
if (f.type === "color") out.push({ key: "fill.color", label: "Color", type: "color", value: f.color });
|
|
64
|
-
else if (f.type === "gradient") out.push(...gradientControls("fill.gradient", f.gradient));
|
|
65
|
-
else {
|
|
66
|
-
out.push(
|
|
67
|
-
{ key: "fill.patternId", label: "Pattern", type: "select", value: f.patternId, options: patternOptions(patterns) },
|
|
68
|
-
{ key: "fill.scale", label: "Scale", type: "range", min: 0.01, max: 10, step: 0.01, value: f.scale, percent: true, unit: "%" }
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return out;
|
|
72
|
-
}
|
|
73
|
-
function gradientControls(prefix, g) {
|
|
74
|
-
return [
|
|
75
|
-
{ key: `${prefix}.stops.0.color`, label: "Start colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _9 => _9.stops, 'access', _10 => _10[0], 'optionalAccess', _11 => _11.color]), () => ( "#000000")) },
|
|
76
|
-
{ key: `${prefix}.stops.last.color`, label: "End colour", type: "color", value: _nullishCoalesce(_optionalChain([g, 'access', _12 => _12.stops, 'access', _13 => _13[g.stops.length - 1], 'optionalAccess', _14 => _14.color]), () => ( "#ffffff")) },
|
|
77
|
-
{ key: `${prefix}.style`, label: "Style", type: "select", value: g.style, options: opt(["linear", "Linear"], ["radial", "Radial"], ["angle", "Angle"], ["reflected", "Reflected"], ["diamond", "Diamond"]) },
|
|
78
|
-
{ key: `${prefix}.angle`, label: "Angle", type: "range", min: -180, max: 180, step: 1, value: g.angle, unit: "\xB0" },
|
|
79
|
-
{ key: `${prefix}.scale`, label: "Scale", type: "range", min: 0.1, max: 1.5, step: 0.01, value: g.scale, percent: true, unit: "%" },
|
|
80
|
-
{ key: `${prefix}.reverse`, label: "Reverse", type: "checkbox", value: g.reverse },
|
|
81
|
-
{ key: `${prefix}.align`, label: "Align with layer", type: "checkbox", value: g.align }
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
var px = (key, label, value, max = 250) => ({ key, label, type: "range", min: 0, max, step: 1, value, unit: "px" });
|
|
85
|
-
var pct = (key, label, value, min = 0, max = 1) => ({ key, label, type: "range", min, max, step: 0.01, value, percent: true, unit: "%" });
|
|
86
|
-
var deg = (key, label, value, min = -180, max = 180) => ({ key, label, type: "range", min, max, step: 1, value, unit: "\xB0" });
|
|
87
|
-
function layerEffectControls(e, patterns = []) {
|
|
88
|
-
const blended = e.kind === "bevel-emboss" ? [] : [
|
|
89
|
-
{ key: "blend", label: "Blend mode", type: "select", value: e.blend, options: BLENDS },
|
|
90
|
-
pct("opacity", "Opacity", e.opacity)
|
|
91
|
-
];
|
|
92
|
-
switch (e.kind) {
|
|
93
|
-
case "drop-shadow":
|
|
94
|
-
case "inner-shadow":
|
|
95
|
-
return [
|
|
96
|
-
...blended,
|
|
97
|
-
{ key: "color", label: "Color", type: "color", value: e.color },
|
|
98
|
-
{ key: "useGlobalLight", label: "Use global light", type: "checkbox", value: e.useGlobalLight },
|
|
99
|
-
deg("angle", "Angle", e.angle),
|
|
100
|
-
px("distance", "Distance", e.distance, 500),
|
|
101
|
-
e.kind === "drop-shadow" ? pct("spread", "Spread", e.spread) : pct("choke", "Choke", e.choke),
|
|
102
|
-
px("size", "Size", e.size),
|
|
103
|
-
pct("noise", "Noise", e.noise),
|
|
104
|
-
...e.kind === "drop-shadow" ? [{ key: "knocksOut", label: "Layer knocks out shadow", type: "checkbox", value: e.knocksOut }] : []
|
|
105
|
-
];
|
|
106
|
-
case "outer-glow":
|
|
107
|
-
case "inner-glow":
|
|
108
|
-
return [
|
|
109
|
-
...blended,
|
|
110
|
-
...fillControls(e.fill, false, patterns),
|
|
111
|
-
{ key: "technique", label: "Technique", type: "select", value: e.technique, options: opt(["softer", "Softer"], ["precise", "Precise"]) },
|
|
112
|
-
...e.kind === "inner-glow" ? [{ key: "source", label: "Source", type: "select", value: e.source, options: opt(["edge", "Edge"], ["center", "Center"]) }] : [],
|
|
113
|
-
e.kind === "outer-glow" ? pct("spread", "Spread", e.spread) : pct("choke", "Choke", e.choke),
|
|
114
|
-
px("size", "Size", e.size),
|
|
115
|
-
pct("range", "Range", e.range, 0.01, 1),
|
|
116
|
-
pct("noise", "Noise", e.noise)
|
|
117
|
-
];
|
|
118
|
-
case "bevel-emboss":
|
|
119
|
-
return [
|
|
120
|
-
{ key: "style", label: "Style", type: "select", value: e.style, options: opt(["inner-bevel", "Inner Bevel"], ["outer-bevel", "Outer Bevel"], ["emboss", "Emboss"], ["pillow-emboss", "Pillow Emboss"], ["stroke-emboss", "Stroke Emboss"]) },
|
|
121
|
-
{ key: "technique", label: "Technique", type: "select", value: e.technique, options: opt(["smooth", "Smooth"], ["chisel-hard", "Chisel Hard"], ["chisel-soft", "Chisel Soft"]) },
|
|
122
|
-
pct("depth", "Depth", e.depth, 0, 10),
|
|
123
|
-
{ key: "direction", label: "Direction", type: "select", value: e.direction, options: opt(["up", "Up"], ["down", "Down"]) },
|
|
124
|
-
px("size", "Size", e.size),
|
|
125
|
-
px("soften", "Soften", e.soften, 16),
|
|
126
|
-
{ key: "useGlobalLight", label: "Use global light", type: "checkbox", value: e.useGlobalLight },
|
|
127
|
-
deg("angle", "Angle", e.angle),
|
|
128
|
-
deg("altitude", "Altitude", e.altitude, 0, 90),
|
|
129
|
-
{ key: "highlightColor", label: "Highlight", type: "color", value: e.highlightColor },
|
|
130
|
-
{ key: "highlightBlend", label: "Highlight mode", type: "select", value: e.highlightBlend, options: BLENDS },
|
|
131
|
-
pct("highlightOpacity", "Highlight opacity", e.highlightOpacity),
|
|
132
|
-
{ key: "shadowColor", label: "Shadow", type: "color", value: e.shadowColor },
|
|
133
|
-
{ key: "shadowBlend", label: "Shadow mode", type: "select", value: e.shadowBlend, options: BLENDS },
|
|
134
|
-
pct("shadowOpacity", "Shadow opacity", e.shadowOpacity)
|
|
135
|
-
];
|
|
136
|
-
case "satin":
|
|
137
|
-
return [
|
|
138
|
-
...blended,
|
|
139
|
-
{ key: "color", label: "Color", type: "color", value: e.color },
|
|
140
|
-
deg("angle", "Angle", e.angle),
|
|
141
|
-
px("distance", "Distance", e.distance),
|
|
142
|
-
px("size", "Size", e.size),
|
|
143
|
-
{ key: "invert", label: "Invert", type: "checkbox", value: e.invert }
|
|
144
|
-
];
|
|
145
|
-
case "color-overlay":
|
|
146
|
-
return [...blended, { key: "color", label: "Color", type: "color", value: e.color }];
|
|
147
|
-
case "gradient-overlay":
|
|
148
|
-
return [...blended, ...gradientControls("gradient", e.gradient)];
|
|
149
|
-
case "pattern-overlay":
|
|
150
|
-
return [
|
|
151
|
-
...blended,
|
|
152
|
-
{ key: "patternId", label: "Pattern", type: "select", value: e.patternId, options: patternOptions(patterns) },
|
|
153
|
-
pct("scale", "Scale", e.scale, 0.01, 10),
|
|
154
|
-
deg("angle", "Angle", _nullishCoalesce(e.angle, () => ( 0))),
|
|
155
|
-
{ key: "link", label: "Link with layer", type: "checkbox", value: _nullishCoalesce(e.link, () => ( true)) }
|
|
156
|
-
];
|
|
157
|
-
case "stroke":
|
|
158
|
-
return [
|
|
159
|
-
...blended,
|
|
160
|
-
px("size", "Size", e.size),
|
|
161
|
-
{ key: "position", label: "Position", type: "select", value: e.position, options: opt(["outside", "Outside"], ["inside", "Inside"], ["center", "Center"]) },
|
|
162
|
-
...fillControls(e.fill, true, patterns)
|
|
163
|
-
];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function fillOfType(current, type, patterns) {
|
|
167
|
-
if (type === "gradient") return { type: "gradient", gradient: _chunkDPYAO5U6cjs.defaultEffectGradient.call(void 0, ) };
|
|
168
|
-
if (type === "pattern") return { type: "pattern", patternId: _nullishCoalesce(_optionalChain([patterns, 'access', _15 => _15[0], 'optionalAccess', _16 => _16.id]), () => ( "checker")), scale: 1 };
|
|
169
|
-
return { type: "color", color: current.type === "color" ? current.color : "#000000" };
|
|
170
|
-
}
|
|
171
|
-
function effectControlChange(effect, key, value, patterns = []) {
|
|
172
|
-
const [top, ...rest] = key.split(".");
|
|
173
|
-
if (top === "fill" && rest[0] === "type") return { fill: fillOfType(effect.fill, String(value), patterns) };
|
|
174
|
-
if (top === "patternId" && !rest.length) {
|
|
175
|
-
const name = _optionalChain([patternOptions, 'call', _17 => _17(patterns), 'access', _18 => _18.find, 'call', _19 => _19((o) => o.value === value), 'optionalAccess', _20 => _20.label]);
|
|
176
|
-
return name ? { patternId: value, name } : { patternId: value };
|
|
177
|
-
}
|
|
178
|
-
if (!rest.length) return { [top]: value };
|
|
179
|
-
if (top === "fill" && rest[0] === "patternId") {
|
|
180
|
-
const name = _optionalChain([patternOptions, 'call', _21 => _21(patterns), 'access', _22 => _22.find, 'call', _23 => _23((o) => o.value === value), 'optionalAccess', _24 => _24.label]);
|
|
181
|
-
return { fill: { ...effect.fill, patternId: value, ...name ? { name } : {} } };
|
|
182
|
-
}
|
|
183
|
-
return { [top]: setPath(getPath(effect, top), rest, value) };
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
exports.layerEffectsPanel = layerEffectsPanel; exports.layerEffectsBadge = layerEffectsBadge; exports.LAYER_EFFECT_MENU = LAYER_EFFECT_MENU; exports.layerEffectControls = layerEffectControls; exports.effectControlChange = effectControlChange;
|