@pixerate/editor 0.129.0 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +55 -55
- package/dist/animation-editor/index.d.cts +5 -5
- package/dist/animation-editor/index.d.ts +5 -5
- package/dist/animation-editor/index.js +2 -2
- package/dist/{bezier-DP4NnJp3.d.ts → bezier-0IHDCvv_.d.ts} +1 -1
- package/dist/{bezier-CvgQiYRg.d.cts → bezier-oCBfrGDG.d.cts} +1 -1
- package/dist/canvas/index.d.cts +7 -7
- package/dist/canvas/index.d.ts +7 -7
- package/dist/{chunk-A6KHMKI4.js → chunk-ECVI5QRE.js} +2 -2
- package/dist/{chunk-ROZFX4QI.js → chunk-IEYXYMRQ.js} +556 -13
- package/dist/chunk-IEYXYMRQ.js.map +1 -0
- package/dist/{chunk-BEGEWQHD.cjs → chunk-OYPJGGF3.cjs} +36 -36
- package/dist/{chunk-BEGEWQHD.cjs.map → chunk-OYPJGGF3.cjs.map} +1 -1
- package/dist/{chunk-XLUYXUBD.cjs → chunk-SUJ4U6V2.cjs} +82 -82
- package/dist/{chunk-XLUYXUBD.cjs.map → chunk-SUJ4U6V2.cjs.map} +1 -1
- package/dist/{chunk-F7Q2NE2Y.js → chunk-YQJWLB3G.js} +2 -2
- package/dist/{chunk-ORE334I6.cjs → chunk-YYJKIESX.cjs} +619 -76
- package/dist/chunk-YYJKIESX.cjs.map +1 -0
- package/dist/effects/index.d.cts +4 -4
- package/dist/effects/index.d.ts +4 -4
- package/dist/{export-DRzNhrdx.d.cts → export-BRixPkeT.d.cts} +3 -3
- package/dist/{export-Cbr9IqpJ.d.cts → export-CfAogLEr.d.cts} +1 -1
- package/dist/{export-DotEEyXj.d.ts → export-CkDz9XuC.d.ts} +3 -3
- package/dist/{export-ClPKUB-v.d.ts → export-Crl82sbE.d.ts} +1 -1
- package/dist/{helpers-CPWcK504.d.ts → helpers-BCd2-PAR.d.ts} +67 -3
- package/dist/{helpers-C5aAd44p.d.cts → helpers-CoIeXQnW.d.cts} +67 -3
- package/dist/image-editor/index.cjs +606 -606
- package/dist/image-editor/index.d.cts +8 -8
- package/dist/image-editor/index.d.ts +8 -8
- package/dist/image-editor/index.js +2 -2
- package/dist/{opentype-BOewaGQx.d.cts → opentype-BDahNRTe.d.cts} +2 -2
- package/dist/{opentype-sQrF3Ry1.d.ts → opentype-BQFEvy-t.d.ts} +2 -2
- package/dist/paint-editor/index.cjs +7 -7
- package/dist/paint-editor/index.d.cts +5 -5
- package/dist/paint-editor/index.d.ts +5 -5
- package/dist/paint-editor/index.js +2 -2
- package/dist/{pathfinder-CnkW7zLI.d.cts → pathfinder-01ZgAwqV.d.cts} +1 -1
- package/dist/{pathfinder-BwJx0_zM.d.ts → pathfinder-DaVdT8jq.d.ts} +1 -1
- package/dist/{pool-CTrtciaN.d.ts → pool-D2A3WTt9.d.ts} +1 -1
- package/dist/{pool-C7GtrL34.d.cts → pool-D6a45MoE.d.cts} +1 -1
- package/dist/{svg-C4LlFnEw.d.cts → svg-CcDz7Zq2.d.cts} +2 -2
- package/dist/{svg-CUzZa0EO.d.ts → svg-DELNVerw.d.ts} +2 -2
- package/dist/{tools-BpCmUNxb.d.cts → tools-BFvkFnRj.d.cts} +1 -1
- package/dist/{tools-AugT22z3.d.ts → tools-D7ws-OKL.d.ts} +1 -1
- package/dist/vector/index.cjs +1149 -1017
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +106 -10
- package/dist/vector/index.d.ts +106 -10
- package/dist/vector/index.js +142 -10
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +4 -4
- package/dist/video-editor/index.d.ts +4 -4
- package/dist/{warp-CIsO617e.d.ts → warp-2N9wkOkL.d.ts} +2 -2
- package/dist/{warp-D62N_5VK.d.cts → warp-DErXW5rz.d.cts} +2 -2
- package/package.json +2 -2
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-vector/SKILL.md +8 -1
- package/skills/pixerate-vector/references/commands.md +20 -0
- package/dist/chunk-ORE334I6.cjs.map +0 -1
- package/dist/chunk-ROZFX4QI.js.map +0 -1
- /package/dist/{chunk-A6KHMKI4.js.map → chunk-ECVI5QRE.js.map} +0 -0
- /package/dist/{chunk-F7Q2NE2Y.js.map → chunk-YQJWLB3G.js.map} +0 -0
package/dist/vector/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
reverseMorphContour,
|
|
43
43
|
subpathToMorphContour,
|
|
44
44
|
turnMorphContour
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-ECVI5QRE.js";
|
|
46
46
|
import {
|
|
47
47
|
DEFAULT_VECTOR_FONT,
|
|
48
48
|
IDENTITY_MATRIX,
|
|
@@ -74,6 +74,9 @@ import {
|
|
|
74
74
|
VECTOR_GRADIENT_TYPES,
|
|
75
75
|
VECTOR_HORIZONTAL_RESIZING,
|
|
76
76
|
VECTOR_HORIZONTAL_RESIZING_LABELS,
|
|
77
|
+
VECTOR_LENS_LABELS,
|
|
78
|
+
VECTOR_LENS_SPECS,
|
|
79
|
+
VECTOR_LENS_TYPES,
|
|
77
80
|
VECTOR_MASK_TYPES,
|
|
78
81
|
VECTOR_MERGE_MODES,
|
|
79
82
|
VECTOR_MESH_MAX,
|
|
@@ -198,6 +201,7 @@ import {
|
|
|
198
201
|
isVectorFrame,
|
|
199
202
|
isVectorFreeformGradient,
|
|
200
203
|
isVectorGradient,
|
|
204
|
+
isVectorLens,
|
|
201
205
|
isVectorLiveBoolean,
|
|
202
206
|
isVectorMaskActive,
|
|
203
207
|
isVectorMaskGroup,
|
|
@@ -212,6 +216,7 @@ import {
|
|
|
212
216
|
mapBezierPath,
|
|
213
217
|
mapVectorGradient,
|
|
214
218
|
mapVectorPaint,
|
|
219
|
+
mapVectorPaintColors,
|
|
215
220
|
mapVectorPoints,
|
|
216
221
|
mapVectorShadedPaint,
|
|
217
222
|
mapVectorSubpaths,
|
|
@@ -265,6 +270,7 @@ import {
|
|
|
265
270
|
replaceVectorText,
|
|
266
271
|
rerouteVectorConnectors,
|
|
267
272
|
resizeWarpMesh,
|
|
273
|
+
resolveVectorLenses,
|
|
268
274
|
resolveVectorSymbols,
|
|
269
275
|
reverseSubpath,
|
|
270
276
|
reverseVectorGradient,
|
|
@@ -284,6 +290,7 @@ import {
|
|
|
284
290
|
sanitizeVectorFilters,
|
|
285
291
|
sanitizeVectorFrame,
|
|
286
292
|
sanitizeVectorGradient,
|
|
293
|
+
sanitizeVectorLens,
|
|
287
294
|
sanitizeVectorMask,
|
|
288
295
|
sanitizeVectorResizing,
|
|
289
296
|
sanitizeVectorShadedPaint,
|
|
@@ -300,6 +307,7 @@ import {
|
|
|
300
307
|
setVectorGradientVector,
|
|
301
308
|
setVectorTextShaper,
|
|
302
309
|
setWidthPoint,
|
|
310
|
+
shadeVectorColor,
|
|
303
311
|
simplifyPolyline,
|
|
304
312
|
skewMatrix,
|
|
305
313
|
sortedVectorGradientStops,
|
|
@@ -308,6 +316,7 @@ import {
|
|
|
308
316
|
splitWarpMeshU,
|
|
309
317
|
splitWarpMeshV,
|
|
310
318
|
starSubpath,
|
|
319
|
+
stripVectorLensViews,
|
|
311
320
|
stripVectorSymbolArt,
|
|
312
321
|
strokePositionPoint,
|
|
313
322
|
strokeWidthProfileOf,
|
|
@@ -337,6 +346,7 @@ import {
|
|
|
337
346
|
vectorAppearanceOutline,
|
|
338
347
|
vectorAppearanceShapes,
|
|
339
348
|
vectorArtboards,
|
|
349
|
+
vectorBevelFaces,
|
|
340
350
|
vectorBlendModeCss,
|
|
341
351
|
vectorBlendModeFromCss,
|
|
342
352
|
vectorBoundsInside,
|
|
@@ -355,6 +365,7 @@ import {
|
|
|
355
365
|
vectorEnvelopeFrame,
|
|
356
366
|
vectorEnvelopeMap,
|
|
357
367
|
vectorEnvelopeMesh,
|
|
368
|
+
vectorExtrudeFaces,
|
|
358
369
|
vectorFills,
|
|
359
370
|
vectorFilterMarkup,
|
|
360
371
|
vectorFilterParamKeys,
|
|
@@ -384,6 +395,8 @@ import {
|
|
|
384
395
|
vectorGradientUnitsMatrix,
|
|
385
396
|
vectorInstanceDrawn,
|
|
386
397
|
vectorInstanceGroup,
|
|
398
|
+
vectorLensColorMap,
|
|
399
|
+
vectorLensDrawn,
|
|
387
400
|
vectorLiveBooleanSteps,
|
|
388
401
|
vectorMaskContains,
|
|
389
402
|
vectorMaskContentBounds,
|
|
@@ -413,11 +426,13 @@ import {
|
|
|
413
426
|
vectorNodesNear,
|
|
414
427
|
vectorOperandOperation,
|
|
415
428
|
vectorPaintLayerNodes,
|
|
429
|
+
vectorPaintSolid,
|
|
416
430
|
vectorPaintToSvg,
|
|
417
431
|
vectorParentMatrix,
|
|
418
432
|
vectorPathAt,
|
|
419
433
|
vectorPathData,
|
|
420
434
|
vectorPathLocalBounds,
|
|
435
|
+
vectorPathRings,
|
|
421
436
|
vectorPathTextPositions,
|
|
422
437
|
vectorPathWorldBezier,
|
|
423
438
|
vectorRepeaterCopies,
|
|
@@ -478,7 +493,7 @@ import {
|
|
|
478
493
|
withVectorStrokes,
|
|
479
494
|
withVectorTargetPaint,
|
|
480
495
|
zigzagPaths
|
|
481
|
-
} from "../chunk-
|
|
496
|
+
} from "../chunk-IEYXYMRQ.js";
|
|
482
497
|
import {
|
|
483
498
|
bezierPathBounds,
|
|
484
499
|
bezierPathToSvg,
|
|
@@ -2291,12 +2306,20 @@ function collapsedNode(node, box, prefix) {
|
|
|
2291
2306
|
byPrefix.set(prefix, out);
|
|
2292
2307
|
return out;
|
|
2293
2308
|
}
|
|
2309
|
+
var lensResolved = /* @__PURE__ */ new WeakMap();
|
|
2310
|
+
function resolvedLensNodes(doc) {
|
|
2311
|
+
const hit = lensResolved.get(doc.nodes);
|
|
2312
|
+
if (hit) return hit;
|
|
2313
|
+
const nodes = resolveVectorLenses(doc).nodes;
|
|
2314
|
+
lensResolved.set(doc.nodes, nodes);
|
|
2315
|
+
return nodes;
|
|
2316
|
+
}
|
|
2294
2317
|
function getVectorSceneRenderData(state, options = {}) {
|
|
2295
2318
|
const defs = [];
|
|
2296
2319
|
const filters = [];
|
|
2297
2320
|
const prefix = options.idPrefix ?? "ve-";
|
|
2298
2321
|
const v = state.viewport;
|
|
2299
|
-
const all = state.document
|
|
2322
|
+
const all = resolvedLensNodes(state.document);
|
|
2300
2323
|
const stats = { nodes: all.length, culled: 0, collapsed: 0 };
|
|
2301
2324
|
let nodes;
|
|
2302
2325
|
const size = options.viewportSize;
|
|
@@ -3512,6 +3535,7 @@ ${offset}
|
|
|
3512
3535
|
var pdfString = (s) => `(${s.replace(/[\\()]/g, (c) => `\\${c}`).replace(/[^\x20-\x7e]/g, "?")})`;
|
|
3513
3536
|
function vectorDocumentToPdf(doc, options = {}) {
|
|
3514
3537
|
const notes = /* @__PURE__ */ new Set();
|
|
3538
|
+
doc = resolveVectorLenses(doc);
|
|
3515
3539
|
const scale = options.scale ?? 1;
|
|
3516
3540
|
const compress = options.compress !== false;
|
|
3517
3541
|
const frames = options.pages === "artboards" ? vectorArtboards(doc) : [];
|
|
@@ -3724,9 +3748,10 @@ function nodeGroup(node, notes) {
|
|
|
3724
3748
|
if (node.filters?.length) notes.push(`${label(node)}: filters (shadows, glows, blurs) are not part of Lottie (left out).`);
|
|
3725
3749
|
const m = nodeMatrix(node);
|
|
3726
3750
|
let items = [];
|
|
3727
|
-
const live = (node.effects ?? []).some((e) => e.enabled !== false && (e.type === "wiggle" || e.type === "envelope" || e.type === "contour" || e.type === "blockShadow"));
|
|
3728
|
-
if (node.type === "text" || node.type === "instance" || live || isVectorMaskGroup(node) || isVectorFrame(node) || isVectorSymmetryGroup(node)) {
|
|
3729
|
-
if (live) notes.push(`${label(node)}: wiggle, envelope, contour
|
|
3751
|
+
const live = (node.effects ?? []).some((e) => e.enabled !== false && (e.type === "wiggle" || e.type === "envelope" || e.type === "contour" || e.type === "blockShadow" || e.type === "extrude" || e.type === "bevel"));
|
|
3752
|
+
if (node.type === "text" || node.type === "instance" || live || isVectorMaskGroup(node) || isVectorFrame(node) || isVectorSymmetryGroup(node) || isVectorLens(node)) {
|
|
3753
|
+
if (live) notes.push(`${label(node)}: wiggle, envelope, contour, block shadow, extrude and bevel effects have no Lottie equivalent (exported as drawn).`);
|
|
3754
|
+
if (isVectorLens(node)) notes.push(`${label(node)}: a lens exports as drawn (what it shows now, clipped by its outline).`);
|
|
3730
3755
|
if (isVectorMaskGroup(node) && node.mask?.type !== "clip") notes.push(`${label(node)}: opacity masks are not exported (the contents are drawn whole).`);
|
|
3731
3756
|
const drawn = isVectorFrame(node) ? vectorFrameDrawn(node) : node;
|
|
3732
3757
|
const shapes = isVectorMaskGroup(drawn) && drawn.mask?.type === "clip" ? vectorAppearanceShapes({ ...drawn, transform: void 0 }) : null;
|
|
@@ -3780,6 +3805,7 @@ function vectorDocumentToLottie(doc, options = {}) {
|
|
|
3780
3805
|
const fps = options.fps ?? 30;
|
|
3781
3806
|
const op = Math.max(1, Math.round(options.frames ?? 1));
|
|
3782
3807
|
const shapes = [];
|
|
3808
|
+
if (!options.nodes) doc = resolveVectorLenses(doc);
|
|
3783
3809
|
for (const n2 of [...options.nodes ?? doc.nodes].reverse()) {
|
|
3784
3810
|
const g = nodeGroup(n2, notes);
|
|
3785
3811
|
if (g) shapes.push(g);
|
|
@@ -6977,7 +7003,7 @@ var VectorEditorController = class _VectorEditorController {
|
|
|
6977
7003
|
out = { ...out, symbols: out.symbols.map((s) => s.id === edit.symbolId ? { ...s, nodes: out.nodes } : s) };
|
|
6978
7004
|
}
|
|
6979
7005
|
out = resolveVectorSymbols(out);
|
|
6980
|
-
return rerouteVectorConnectors(this.solved(out));
|
|
7006
|
+
return resolveVectorLenses(rerouteVectorConnectors(this.solved(out)));
|
|
6981
7007
|
}
|
|
6982
7008
|
/**
|
|
6983
7009
|
* `doc` with its constraints solved (geometry edited since the last solve moving least) and
|
|
@@ -7471,7 +7497,7 @@ var VectorEditorController = class _VectorEditorController {
|
|
|
7471
7497
|
return vectorDocumentToSvg(this.storedDocument(), options);
|
|
7472
7498
|
}
|
|
7473
7499
|
toJSON() {
|
|
7474
|
-
return cloneVectorDocument(stripVectorSymbolArt(this.storedDocument()));
|
|
7500
|
+
return cloneVectorDocument(stripVectorLensViews(stripVectorSymbolArt(this.storedDocument())));
|
|
7475
7501
|
}
|
|
7476
7502
|
/** Adds a node (ids are kept unless taken). Returns its id. */
|
|
7477
7503
|
addNode(node, options = {}) {
|
|
@@ -10129,6 +10155,51 @@ var VectorEditorController = class _VectorEditorController {
|
|
|
10129
10155
|
* (`{ nodeId, side? }`) or unglue it (`null`, the end staying where it is), and `route`,
|
|
10130
10156
|
* `radius`, `gap` set how they run. Plain open paths given by id become connectors. One undo step.
|
|
10131
10157
|
*/
|
|
10158
|
+
/**
|
|
10159
|
+
* Makes closed paths lenses (CorelDRAW's Lens) or changes their lens: `lens` is merged over the
|
|
10160
|
+
* current settings (a different `type` starts from that type's defaults), and `null` makes
|
|
10161
|
+
* them plain paths again. One undo step. Returns each path's id and resulting lens.
|
|
10162
|
+
*/
|
|
10163
|
+
setLens(lens, options = {}) {
|
|
10164
|
+
const ids = options.ids ?? this.selection;
|
|
10165
|
+
if (!ids.length) return { ok: false, message: "Select a closed path to make a lens first." };
|
|
10166
|
+
if (lens && lens.type !== void 0 && !VECTOR_LENS_TYPES.includes(lens.type)) return { ok: false, message: `Unknown lens "${lens.type}": use ${VECTOR_LENS_TYPES.join(", ")}.` };
|
|
10167
|
+
if (lens?.color !== void 0 && lens.color !== null && !parseVectorColor(lens.color)) return { ok: false, message: `"${lens.color}" is not a colour: use a CSS colour such as #ff0000.` };
|
|
10168
|
+
const next = /* @__PURE__ */ new Map();
|
|
10169
|
+
for (const id of ids) {
|
|
10170
|
+
const n2 = this.getNode(id);
|
|
10171
|
+
if (!n2) return { ok: false, message: `There is no node "${id}".` };
|
|
10172
|
+
if (n2.locked) return { ok: false, message: `"${id}" is locked; unlock it first.` };
|
|
10173
|
+
if (lens === null) {
|
|
10174
|
+
if (n2.type === "path" && n2.lens) next.set(id, null);
|
|
10175
|
+
continue;
|
|
10176
|
+
}
|
|
10177
|
+
if (n2.type !== "path" || !n2.subpaths.some((sp) => sp.closed) || isVectorConnector(n2)) return { ok: false, message: `"${id}" is not a closed path: only closed paths can be lenses.` };
|
|
10178
|
+
const type = lens.type ?? n2.lens?.type;
|
|
10179
|
+
if (!type) return { ok: false, message: `"${id}" is not a lens yet: pass a type (${VECTOR_LENS_TYPES.join(", ")}).` };
|
|
10180
|
+
const spec = VECTOR_LENS_SPECS[type];
|
|
10181
|
+
if (lens.amount !== void 0 && !(Number.isFinite(lens.amount) && lens.amount >= spec.min && lens.amount <= spec.max)) return { ok: false, message: `amount for a ${type} lens must be from ${spec.min} to ${spec.max} (${spec.unit}).` };
|
|
10182
|
+
const base = n2.lens && n2.lens.type === type ? n2.lens : { type };
|
|
10183
|
+
next.set(id, sanitizeVectorLens({ ...base, ...lens, type }));
|
|
10184
|
+
}
|
|
10185
|
+
if (!next.size) return { ok: true, lenses: [] };
|
|
10186
|
+
this.change(
|
|
10187
|
+
lens === null ? "Remove Lens" : "Lens",
|
|
10188
|
+
() => {
|
|
10189
|
+
this.setDoc(
|
|
10190
|
+
mapTree(this.doc.nodes, (n2) => {
|
|
10191
|
+
if (!next.has(n2.id) || n2.type !== "path") return n2;
|
|
10192
|
+
const l = next.get(n2.id);
|
|
10193
|
+
if (l) return { ...n2, lens: l };
|
|
10194
|
+
const { lens: _l, lensView: _v, ...rest } = n2;
|
|
10195
|
+
return rest;
|
|
10196
|
+
})
|
|
10197
|
+
);
|
|
10198
|
+
},
|
|
10199
|
+
options.merge
|
|
10200
|
+
);
|
|
10201
|
+
return { ok: true, lenses: [...next].map(([id, l]) => ({ id, lens: l })) };
|
|
10202
|
+
}
|
|
10132
10203
|
setConnector(patch, options = {}) {
|
|
10133
10204
|
const ids = options.ids ?? this.selection;
|
|
10134
10205
|
if (!ids.length) return { ok: false, message: "Select a connector first." };
|
|
@@ -13889,7 +13960,7 @@ function pencilPressureProfile(points, pressures) {
|
|
|
13889
13960
|
}
|
|
13890
13961
|
|
|
13891
13962
|
// src/vector/commands.ts
|
|
13892
|
-
var EFFECT_PARAMS_DESCRIPTION = "Effect parameters (missing ones keep their value or default). trim: start, end (percent), offset (degrees), mode simultaneous|individual. roundCorners: radius. puckerBloat: amount (\u2212100\u2026100). twist: angle, center {x, y} (offset from the middle). zigzag: size, ridges, smooth. wiggle: size, detail, smooth, speed, correlation, phase, seed, time (seconds). offset: amount, join miter|round|bevel, miterLimit, copies, copyOffset. merge: mode merge|add|subtract|intersect|exclude. repeater: copies (fractions fade the last), offset, position {x, y}, anchor {x, y} (offset from the middle), rotation, scale {x, y} (percent), startOpacity, endOpacity (percent), composite below|above. contour: direction inside|outside|center, steps, offset, fillColor / strokeColor (end colours, null keeps the colour), acceleration (\u2212100\u2026100), join. blockShadow: angle (degrees, 0 right, 90 down), distance, color (null: the shape fill colour), opacity, endOpacity (percent; lower than opacity fades it into a long shadow). envelope: style (a warp preset: arc|arcLower|arcUpper|arch|bulge|shellLower|shellUpper|flag|wave|fish|rise|fisheye|inflate|squeeze|twist, or mesh), bend, horizontal, vertical (percent, \u2212100\u2026100), orientation horizontal|vertical, rows, columns, mesh { us, vs, points } (node space; prefer vector.envelope).";
|
|
13963
|
+
var EFFECT_PARAMS_DESCRIPTION = "Effect parameters (missing ones keep their value or default). trim: start, end (percent), offset (degrees), mode simultaneous|individual. roundCorners: radius. puckerBloat: amount (\u2212100\u2026100). twist: angle, center {x, y} (offset from the middle). zigzag: size, ridges, smooth. wiggle: size, detail, smooth, speed, correlation, phase, seed, time (seconds). offset: amount, join miter|round|bevel, miterLimit, copies, copyOffset. merge: mode merge|add|subtract|intersect|exclude. repeater: copies (fractions fade the last), offset, position {x, y}, anchor {x, y} (offset from the middle), rotation, scale {x, y} (percent), startOpacity, endOpacity (percent), composite below|above. contour: direction inside|outside|center, steps, offset, fillColor / strokeColor (end colours, null keeps the colour), acceleration (\u2212100\u2026100), join. blockShadow: angle (degrees, 0 right, 90 down), distance, color (null: the shape fill colour), opacity, endOpacity (percent; lower than opacity fades it into a long shadow). extrude: mode parallel|perspective, angle (degrees) and depth (units) for parallel, vanishingPoint {x, y} (offset from the middle) and toward (percent of the way there) for perspective, color (null: the shape fill colour), lightAngle (degrees the light comes from, 0 right, -90 above), shading (percent). bevel: width (units), lightAngle (degrees), shading (percent), color (null: the shape fill colour). envelope: style (a warp preset: arc|arcLower|arcUpper|arch|bulge|shellLower|shellUpper|flag|wave|fish|rise|fisheye|inflate|squeeze|twist, or mesh), bend, horizontal, vertical (percent, \u2212100\u2026100), orientation horizontal|vertical, rows, columns, mesh { us, vs, points } (node space; prefer vector.envelope).";
|
|
13893
13964
|
var fail = (message) => {
|
|
13894
13965
|
throw new Error(message);
|
|
13895
13966
|
};
|
|
@@ -14086,7 +14157,8 @@ function createVectorCommands(controller, options = {}) {
|
|
|
14086
14157
|
...isVectorFrame(n2) ? { frameRect: n2.frame } : {},
|
|
14087
14158
|
...n2.resizing ? { resizing: n2.resizing } : {},
|
|
14088
14159
|
...n2.type === "path" && n2.connector ? { connector: n2.connector } : {},
|
|
14089
|
-
...n2.type === "group" && n2.symmetry ? { symmetry: n2.symmetry } : {}
|
|
14160
|
+
...n2.type === "group" && n2.symmetry ? { symmetry: n2.symmetry } : {},
|
|
14161
|
+
...n2.type === "path" && n2.lens ? { lens: n2.lens } : {}
|
|
14090
14162
|
});
|
|
14091
14163
|
if (n2.type === "group") visit(n2.children, depth + 1);
|
|
14092
14164
|
}
|
|
@@ -15050,6 +15122,50 @@ function createVectorCommands(controller, options = {}) {
|
|
|
15050
15122
|
}
|
|
15051
15123
|
}
|
|
15052
15124
|
];
|
|
15125
|
+
const LENS_AMOUNTS = VECTOR_LENS_TYPES.map((t) => `${t} ${VECTOR_LENS_SPECS[t].min}\u2026${VECTOR_LENS_SPECS[t].max} ${VECTOR_LENS_SPECS[t].unit} (default ${VECTOR_LENS_SPECS[t].amount})`).join("; ");
|
|
15126
|
+
const lensCommands = () => [
|
|
15127
|
+
{
|
|
15128
|
+
...base,
|
|
15129
|
+
id: `${prefix}setLens`,
|
|
15130
|
+
label: "Lens\u2026",
|
|
15131
|
+
keywords: ["lens", "magnify", "fisheye", "fish eye", "invert", "brighten", "grayscale", "heat map", "wireframe", "transparency", "tint", "loupe"],
|
|
15132
|
+
description: "Makes closed paths (`ids`, default the selection) lenses, or changes their lens: inside its outline, what is drawn below shows changed (magnify, fisheye, brighten, invert, tintedGrayscale, colorAdd, colorLimit, heatMap, wireframe, or the lens's own fill see-through for transparency). The lens follows every edit below it; its bounds stay its own shape. Pass type to make or switch a lens (missing values take that type's defaults); omit it to change amount or color of existing lenses. One undo step. Returns { lenses: [{ id, lens }] }.",
|
|
15133
|
+
params: {
|
|
15134
|
+
type: "object",
|
|
15135
|
+
properties: {
|
|
15136
|
+
ids: { ...IDS, description: "Closed paths to make or change (default: the selection)." },
|
|
15137
|
+
type: { type: "string", enum: [...VECTOR_LENS_TYPES], description: "What the lens does. Required for a path that is not a lens yet." },
|
|
15138
|
+
amount: { type: "number", description: `Strength, by type: ${LENS_AMOUNTS}.` },
|
|
15139
|
+
color: { type: ["string", "null"], description: "CSS colour for tintedGrayscale, colorAdd, colorLimit and wireframe (default per type; ignored by the others)." }
|
|
15140
|
+
},
|
|
15141
|
+
additionalProperties: false
|
|
15142
|
+
},
|
|
15143
|
+
undoable: true,
|
|
15144
|
+
enabled: enabledFor,
|
|
15145
|
+
run: (_ctx, params) => {
|
|
15146
|
+
const { ids: list2, ...patch } = params ?? {};
|
|
15147
|
+
if (!Object.keys(patch).length) fail("Pass at least one of type, amount, color.");
|
|
15148
|
+
const r = controller.setLens(patch, list2 ? { ids: list2 } : {});
|
|
15149
|
+
check(r);
|
|
15150
|
+
return { lenses: r.lenses ?? [] };
|
|
15151
|
+
}
|
|
15152
|
+
},
|
|
15153
|
+
{
|
|
15154
|
+
...base,
|
|
15155
|
+
id: `${prefix}removeLens`,
|
|
15156
|
+
label: "Remove Lens",
|
|
15157
|
+
keywords: ["lens", "remove", "plain"],
|
|
15158
|
+
description: "Makes lenses (`ids`, default the selection) plain paths again; ids that are not lenses are skipped. One undo step. Returns { ids } of the paths that stopped being lenses.",
|
|
15159
|
+
params: { type: "object", properties: { ids: { ...IDS, description: "Lens ids (default: the selection)." } }, additionalProperties: false },
|
|
15160
|
+
undoable: true,
|
|
15161
|
+
enabled: enabledFor,
|
|
15162
|
+
run: (_ctx, params) => {
|
|
15163
|
+
const r = controller.setLens(null, params?.ids ? { ids: params.ids } : {});
|
|
15164
|
+
check(r);
|
|
15165
|
+
return { ids: (r.lenses ?? []).map((l) => l.id) };
|
|
15166
|
+
}
|
|
15167
|
+
}
|
|
15168
|
+
];
|
|
15053
15169
|
const pdfCommands = () => [
|
|
15054
15170
|
{
|
|
15055
15171
|
...base,
|
|
@@ -15886,6 +16002,7 @@ function createVectorCommands(controller, options = {}) {
|
|
|
15886
16002
|
...lottieCommands(),
|
|
15887
16003
|
...pdfCommands(),
|
|
15888
16004
|
...symmetryCommands(),
|
|
16005
|
+
...lensCommands(),
|
|
15889
16006
|
{
|
|
15890
16007
|
...base,
|
|
15891
16008
|
id: `${prefix}setCorners`,
|
|
@@ -16917,6 +17034,9 @@ export {
|
|
|
16917
17034
|
VECTOR_HORIZONTAL_RESIZING,
|
|
16918
17035
|
VECTOR_HORIZONTAL_RESIZING_LABELS,
|
|
16919
17036
|
VECTOR_INK_MAX_CORNERS,
|
|
17037
|
+
VECTOR_LENS_LABELS,
|
|
17038
|
+
VECTOR_LENS_SPECS,
|
|
17039
|
+
VECTOR_LENS_TYPES,
|
|
16920
17040
|
VECTOR_MASK_TYPES,
|
|
16921
17041
|
VECTOR_MASK_TYPE_LABELS,
|
|
16922
17042
|
VECTOR_MASK_TYPE_OPTIONS,
|
|
@@ -17123,6 +17243,7 @@ export {
|
|
|
17123
17243
|
isVectorFrame,
|
|
17124
17244
|
isVectorFreeformGradient,
|
|
17125
17245
|
isVectorGradient,
|
|
17246
|
+
isVectorLens,
|
|
17126
17247
|
isVectorLiveBoolean,
|
|
17127
17248
|
isVectorMaskActive,
|
|
17128
17249
|
isVectorMaskGroup,
|
|
@@ -17142,6 +17263,7 @@ export {
|
|
|
17142
17263
|
mapVectorGradient,
|
|
17143
17264
|
mapWarpMeshPoints as mapVectorMeshPoints,
|
|
17144
17265
|
mapVectorPaint,
|
|
17266
|
+
mapVectorPaintColors,
|
|
17145
17267
|
mapVectorPoints,
|
|
17146
17268
|
mapVectorShadedPaint,
|
|
17147
17269
|
mapVectorSubpaths,
|
|
@@ -17212,6 +17334,7 @@ export {
|
|
|
17212
17334
|
resampleGradientStops,
|
|
17213
17335
|
resizeWarpMesh as resizeVectorMesh,
|
|
17214
17336
|
resolveVectorBlendOptions,
|
|
17337
|
+
resolveVectorLenses,
|
|
17215
17338
|
resolveVectorSymbols,
|
|
17216
17339
|
reverseMorphContour,
|
|
17217
17340
|
reverseSubpath,
|
|
@@ -17233,6 +17356,7 @@ export {
|
|
|
17233
17356
|
sanitizeVectorFilters,
|
|
17234
17357
|
sanitizeVectorFrame,
|
|
17235
17358
|
sanitizeVectorGradient,
|
|
17359
|
+
sanitizeVectorLens,
|
|
17236
17360
|
sanitizeVectorMask,
|
|
17237
17361
|
sanitizeVectorResizing,
|
|
17238
17362
|
sanitizeVectorShadedPaint,
|
|
@@ -17250,6 +17374,7 @@ export {
|
|
|
17250
17374
|
setVectorGradientVector,
|
|
17251
17375
|
setVectorTextShaper,
|
|
17252
17376
|
setWidthPoint,
|
|
17377
|
+
shadeVectorColor,
|
|
17253
17378
|
simplifyPolyline,
|
|
17254
17379
|
smoothSubpath,
|
|
17255
17380
|
solve8,
|
|
@@ -17261,6 +17386,7 @@ export {
|
|
|
17261
17386
|
splitWarpMeshU as splitVectorMeshU,
|
|
17262
17387
|
splitWarpMeshV as splitVectorMeshV,
|
|
17263
17388
|
starSubpath,
|
|
17389
|
+
stripVectorLensViews,
|
|
17264
17390
|
stripVectorSymbolArt,
|
|
17265
17391
|
strokePositionPoint,
|
|
17266
17392
|
strokeWidthProfileOf,
|
|
@@ -17300,6 +17426,7 @@ export {
|
|
|
17300
17426
|
vectorAppearanceOutline,
|
|
17301
17427
|
vectorAppearanceShapes,
|
|
17302
17428
|
vectorArtboards,
|
|
17429
|
+
vectorBevelFaces,
|
|
17303
17430
|
vectorBlendColorDistance,
|
|
17304
17431
|
vectorBlendKeyTargets,
|
|
17305
17432
|
vectorBlendKeys,
|
|
@@ -17339,6 +17466,7 @@ export {
|
|
|
17339
17466
|
vectorEnvelopeMap,
|
|
17340
17467
|
vectorEnvelopeMesh,
|
|
17341
17468
|
vectorExpressionNames,
|
|
17469
|
+
vectorExtrudeFaces,
|
|
17342
17470
|
vectorFillMap,
|
|
17343
17471
|
vectorFills,
|
|
17344
17472
|
vectorFilterMarkup,
|
|
@@ -17375,6 +17503,8 @@ export {
|
|
|
17375
17503
|
vectorInkShapeName,
|
|
17376
17504
|
vectorInstanceDrawn,
|
|
17377
17505
|
vectorInstanceGroup,
|
|
17506
|
+
vectorLensColorMap,
|
|
17507
|
+
vectorLensDrawn,
|
|
17378
17508
|
vectorLiveBooleanSteps,
|
|
17379
17509
|
vectorMaskContains,
|
|
17380
17510
|
vectorMaskContentBounds,
|
|
@@ -17410,6 +17540,7 @@ export {
|
|
|
17410
17540
|
vectorNodesNear,
|
|
17411
17541
|
vectorOperandOperation,
|
|
17412
17542
|
vectorPaintLayerNodes,
|
|
17543
|
+
vectorPaintSolid,
|
|
17413
17544
|
vectorPaintSwatch,
|
|
17414
17545
|
vectorPaintToHex,
|
|
17415
17546
|
vectorPaintToSvg,
|
|
@@ -17419,6 +17550,7 @@ export {
|
|
|
17419
17550
|
vectorPathData,
|
|
17420
17551
|
vectorPathEntries,
|
|
17421
17552
|
vectorPathLocalBounds,
|
|
17553
|
+
vectorPathRings,
|
|
17422
17554
|
vectorPathTextPositions,
|
|
17423
17555
|
vectorPathWorldBezier,
|
|
17424
17556
|
vectorPathfinderShape,
|