@pixerate/editor 0.40.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +12 -0
- package/dist/animation/index.cjs +4 -2
- package/dist/animation/index.cjs.map +1 -1
- package/dist/animation/index.js +8 -6
- package/dist/canvas/index.cjs +26 -24
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +2 -2
- package/dist/canvas/index.d.ts +2 -2
- package/dist/canvas/index.js +8 -6
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-MR3Z4OQI.cjs +66 -0
- package/dist/chunk-MR3Z4OQI.cjs.map +1 -0
- package/dist/{chunk-XHRZSB77.cjs → chunk-O4ONBPZW.cjs} +5 -64
- package/dist/chunk-O4ONBPZW.cjs.map +1 -0
- package/dist/{chunk-W7BOBWZD.js → chunk-SHOVAHUB.js} +4 -63
- package/dist/chunk-SHOVAHUB.js.map +1 -0
- package/dist/chunk-ZRJMJIQU.js +66 -0
- package/dist/chunk-ZRJMJIQU.js.map +1 -0
- package/dist/{pathfinder-DKRcXiLS.d.cts → pathfinder-BSW2ZTO6.d.cts} +1 -1
- package/dist/{pathfinder-D98S2lV5.d.ts → pathfinder-D7hXenzu.d.ts} +1 -1
- package/dist/vector/index.cjs +3070 -389
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +865 -16
- package/dist/vector/index.d.ts +865 -16
- package/dist/vector/index.js +2837 -156
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-W7BOBWZD.js.map +0 -1
- package/dist/chunk-XHRZSB77.cjs.map +0 -1
package/dist/vector/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as CanvasGradientDef, A as AffineMatrix, B as BezierPathInput, a as BezierPath, S as SvgGradientDef, b as StrokeJoin, c as StrokeCap, d as BezierSegment, P as PlanarMap, e as PathfinderOperation, f as PathfinderShape } from '../pathfinder-
|
|
1
|
+
import { C as CanvasGradientDef, A as AffineMatrix, B as BezierPathInput, a as BezierPath, S as SvgGradientDef, b as StrokeJoin, c as StrokeCap, d as BezierSegment, P as PlanarMap, e as PathfinderOperation, f as PathfinderShape, G as GradientStop } from '../pathfinder-BSW2ZTO6.cjs';
|
|
2
2
|
import { P as Point } from '../types-BFkYA4eF.cjs';
|
|
3
3
|
import { H as HistoryManager } from '../HistoryManager-DeQQMBCj.cjs';
|
|
4
4
|
import { C as CommandSpec } from '../registry-D0GADKc7.cjs';
|
|
5
|
+
import { A as AnimationEasing } from '../easing-DTmX99QG.cjs';
|
|
5
6
|
import '../types-DsiXGmjo.cjs';
|
|
6
7
|
import '../schema-DYDGdYL9.cjs';
|
|
7
8
|
|
|
@@ -132,16 +133,73 @@ interface VectorNodeBase {
|
|
|
132
133
|
* them into the geometry, so stroke widths and the rotated selection box stay exact.
|
|
133
134
|
*/
|
|
134
135
|
transform?: VectorMatrix;
|
|
136
|
+
/**
|
|
137
|
+
* An in-between a blend group generated from its keys. Steps are rebuilt whenever a key or
|
|
138
|
+
* the blend options change, and are locked (clicks select the blend group).
|
|
139
|
+
*/
|
|
140
|
+
blendStep?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Live path effects, applied top to bottom: each acts on every path above it (the node's own
|
|
143
|
+
* outline, or a group's children, then the result of the effects before it), and effects after a
|
|
144
|
+
* repeater act on its copies. The stored anchors and children never change.
|
|
145
|
+
*/
|
|
146
|
+
effects?: VectorEffect[] | null;
|
|
147
|
+
/**
|
|
148
|
+
* As an operand of a live boolean group: how it combines with the result of the operands below
|
|
149
|
+
* it. Absent: the group's `liveBoolean` operation.
|
|
150
|
+
*/
|
|
151
|
+
booleanOperation?: VectorBooleanOperation | null;
|
|
135
152
|
}
|
|
136
153
|
/** A shape made of one or more subpaths (holes and compound shapes included). */
|
|
137
154
|
interface VectorPathNode extends VectorNodeBase, VectorStyle {
|
|
138
155
|
type: 'path';
|
|
139
156
|
subpaths: VectorSubpath[];
|
|
140
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* How a blend spaces its in-betweens: a number of `steps` between each pair of keys, a fixed
|
|
160
|
+
* `distance` between steps along the spine, or `smoothColor` (as many steps as the colours
|
|
161
|
+
* need for a smooth ramp; by distance when the colours match).
|
|
162
|
+
*/
|
|
163
|
+
type VectorBlendSpacing = 'steps' | 'distance' | 'smoothColor';
|
|
164
|
+
declare const VECTOR_BLEND_SPACINGS: readonly VectorBlendSpacing[];
|
|
165
|
+
/** Settings of a blend. */
|
|
166
|
+
interface VectorBlendOptions {
|
|
167
|
+
/** Default `steps`. */
|
|
168
|
+
spacing?: VectorBlendSpacing;
|
|
169
|
+
/** Steps between each pair of keys with `steps` spacing (default 5). */
|
|
170
|
+
steps?: number;
|
|
171
|
+
/** Distance between steps along the spine with `distance` spacing (default 20). */
|
|
172
|
+
distance?: number;
|
|
173
|
+
/** Turn the steps with the spine's direction (default `false`: they keep the keys' orientation). */
|
|
174
|
+
orientToSpine?: boolean;
|
|
175
|
+
/** Move anchors in straight lines instead of the rotation-aware morph (default `false`). */
|
|
176
|
+
linear?: boolean;
|
|
177
|
+
}
|
|
178
|
+
/** A live blend: the group's keys plus how the in-betweens are made and laid out. */
|
|
179
|
+
interface VectorBlend extends VectorBlendOptions {
|
|
180
|
+
/**
|
|
181
|
+
* A replaced spine in the group's space: the steps follow it instead of the straight lines
|
|
182
|
+
* between the keys' centres (the keys sit along it, spread evenly by arc length).
|
|
183
|
+
*/
|
|
184
|
+
spine?: VectorSubpath | null;
|
|
185
|
+
/** The anchor of each key's first subpath its blend starts from, by key id (the Blend tool's clicks). */
|
|
186
|
+
starts?: Record<string, number>;
|
|
187
|
+
}
|
|
141
188
|
/** A group of nodes that select and transform together. */
|
|
142
189
|
interface VectorGroupNode extends VectorNodeBase {
|
|
143
190
|
type: 'group';
|
|
144
191
|
children: VectorNode[];
|
|
192
|
+
/**
|
|
193
|
+
* Makes the group a live blend: its children that are not `blendStep`s are the keys, in
|
|
194
|
+
* stacking order, and the steps between them are regenerated whenever a key changes.
|
|
195
|
+
*/
|
|
196
|
+
blend?: VectorBlend | null;
|
|
197
|
+
/**
|
|
198
|
+
* Makes the group a live boolean: its children stay editable operands, folded bottom to top
|
|
199
|
+
* (each by its own `booleanOperation` or this one), and the group draws as the result in the
|
|
200
|
+
* bottom operand's style.
|
|
201
|
+
*/
|
|
202
|
+
liveBoolean?: VectorBooleanOperation | null;
|
|
145
203
|
}
|
|
146
204
|
type VectorNode = VectorPathNode | VectorGroupNode;
|
|
147
205
|
/** A vector drawing: an artboard and its nodes, bottom to top. */
|
|
@@ -174,9 +232,11 @@ interface VectorHandleRef extends VectorAnchorRef {
|
|
|
174
232
|
* shape; `scissors` cuts a path at a point, `knife` cuts filled shapes along a freehand stroke,
|
|
175
233
|
* `eraser` rubs out the area under one and `width` drags a stroke's width at a point.
|
|
176
234
|
* `shapeBuilder` merges (Alt: deletes) the faces the selected shapes make, and `paintBucket`
|
|
177
|
-
* fills the region the visible outlines enclose around a click with a new shape.
|
|
235
|
+
* fills the region the visible outlines enclose around a click with a new shape. `blend`
|
|
236
|
+
* blends the shape clicked first into the one clicked next (clicking an anchor of a closed path
|
|
237
|
+
* starts the blend there).
|
|
178
238
|
*/
|
|
179
|
-
type VectorTool = 'select' | 'direct' | 'pen' | 'pencil' | 'rect' | 'ellipse' | 'polygon' | 'star' | 'line' | 'scissors' | 'knife' | 'eraser' | 'width' | 'shapeBuilder' | 'paintBucket';
|
|
239
|
+
type VectorTool = 'select' | 'direct' | 'pen' | 'pencil' | 'rect' | 'ellipse' | 'polygon' | 'star' | 'line' | 'scissors' | 'knife' | 'eraser' | 'width' | 'shapeBuilder' | 'paintBucket' | 'blend';
|
|
180
240
|
declare const VECTOR_TOOLS: readonly VectorTool[];
|
|
181
241
|
/** Keyboard modifiers held during a pointer event. */
|
|
182
242
|
interface VectorModifiers {
|
|
@@ -222,6 +282,109 @@ declare const VECTOR_PATHFINDER_OPERATIONS: readonly VectorPathfinderOperation[]
|
|
|
222
282
|
type VectorArrange = 'front' | 'forward' | 'backward' | 'back';
|
|
223
283
|
/** Average: line anchors up on a horizontal line (same y), a vertical one (same x), or both. */
|
|
224
284
|
type VectorAverageAxis = 'horizontal' | 'vertical' | 'both';
|
|
285
|
+
/**
|
|
286
|
+
* Live path effects (After Effects' path operators): `trim` (Trim Paths), `roundCorners`,
|
|
287
|
+
* `puckerBloat`, `twist`, `zigzag`, `wiggle` (Wiggle Paths), `offset` (Offset Paths), `merge`
|
|
288
|
+
* (Merge Paths) and `repeater`.
|
|
289
|
+
*/
|
|
290
|
+
type VectorEffectType = 'trim' | 'roundCorners' | 'puckerBloat' | 'twist' | 'zigzag' | 'wiggle' | 'offset' | 'merge' | 'repeater';
|
|
291
|
+
declare const VECTOR_EFFECT_TYPES: readonly VectorEffectType[];
|
|
292
|
+
/** Merge Paths modes: a compound path (no boolean), union, the first minus the others, intersection or exclusion. */
|
|
293
|
+
type VectorMergeMode = 'merge' | 'add' | 'subtract' | 'intersect' | 'exclude';
|
|
294
|
+
declare const VECTOR_MERGE_MODES: readonly VectorMergeMode[];
|
|
295
|
+
/** Parameters of each effect type. Lengths are in the node's own units, angles in degrees, percentages 0–100. */
|
|
296
|
+
interface VectorEffectParamsMap {
|
|
297
|
+
trim: {
|
|
298
|
+
/** Start and end of the kept part, percent of the length (swapped when start > end). */
|
|
299
|
+
start: number;
|
|
300
|
+
end: number;
|
|
301
|
+
/** Shifts both, in degrees (360° = once round). */
|
|
302
|
+
offset: number;
|
|
303
|
+
/**
|
|
304
|
+
* `simultaneous`: every path trimmed by the same fractions of its own length;
|
|
305
|
+
* `individual`: the paths laid end to end in stacking order and trimmed as one length.
|
|
306
|
+
*/
|
|
307
|
+
mode: 'simultaneous' | 'individual';
|
|
308
|
+
};
|
|
309
|
+
roundCorners: {
|
|
310
|
+
radius: number;
|
|
311
|
+
};
|
|
312
|
+
/** Percent, −100 (pucker: spiky) to 100 (bloat: bulging). */
|
|
313
|
+
puckerBloat: {
|
|
314
|
+
amount: number;
|
|
315
|
+
};
|
|
316
|
+
twist: {
|
|
317
|
+
/** Turn at the farthest point from the centre (none at the centre). */
|
|
318
|
+
angle: number;
|
|
319
|
+
/** The centre as an offset from the middle of the paths' bounds. */
|
|
320
|
+
center: Vec2;
|
|
321
|
+
};
|
|
322
|
+
zigzag: {
|
|
323
|
+
/** How far the points move to either side. */
|
|
324
|
+
size: number;
|
|
325
|
+
/** Ridges per segment. */
|
|
326
|
+
ridges: number;
|
|
327
|
+
/** Rounded waves instead of sharp zig zags. */
|
|
328
|
+
smooth: boolean;
|
|
329
|
+
};
|
|
330
|
+
wiggle: {
|
|
331
|
+
/** Largest displacement. */
|
|
332
|
+
size: number;
|
|
333
|
+
/** Points added per segment. */
|
|
334
|
+
detail: number;
|
|
335
|
+
smooth: boolean;
|
|
336
|
+
/** Wiggles per second. */
|
|
337
|
+
speed: number;
|
|
338
|
+
/** Percent: how much neighbouring points move together. */
|
|
339
|
+
correlation: number;
|
|
340
|
+
/** Degrees (360° = one wiggle). */
|
|
341
|
+
phase: number;
|
|
342
|
+
/** The same seed (and time) always gives the same wiggle. */
|
|
343
|
+
seed: number;
|
|
344
|
+
/** Seconds: where along the wiggle's motion it is drawn. */
|
|
345
|
+
time: number;
|
|
346
|
+
};
|
|
347
|
+
offset: {
|
|
348
|
+
/** Grows (positive) or shrinks (negative) the shapes. */
|
|
349
|
+
amount: number;
|
|
350
|
+
join: VectorLineJoin;
|
|
351
|
+
miterLimit: number;
|
|
352
|
+
/** Copies, copy i offset by `amount · (i + 1 + copyOffset)`. */
|
|
353
|
+
copies: number;
|
|
354
|
+
copyOffset: number;
|
|
355
|
+
};
|
|
356
|
+
merge: {
|
|
357
|
+
mode: VectorMergeMode;
|
|
358
|
+
};
|
|
359
|
+
repeater: {
|
|
360
|
+
/** Copies, the original included; a fraction fades the last copy. */
|
|
361
|
+
copies: number;
|
|
362
|
+
/** Shifts the copies along: copy i is transformed `i + offset` times. */
|
|
363
|
+
offset: number;
|
|
364
|
+
/** Each step: move, about `anchor` turn by `rotation` and scale by `scale` percent. */
|
|
365
|
+
position: Vec2;
|
|
366
|
+
/** Offset from the middle of the paths' bounds. */
|
|
367
|
+
anchor: Vec2;
|
|
368
|
+
rotation: number;
|
|
369
|
+
scale: Vec2;
|
|
370
|
+
/** Percent opacity of the first and last copies (in between interpolated). */
|
|
371
|
+
startOpacity: number;
|
|
372
|
+
endOpacity: number;
|
|
373
|
+
/** `below`: each copy draws under the one before it; `above`: over it. */
|
|
374
|
+
composite: 'below' | 'above';
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/** One entry of an effect stack. */
|
|
378
|
+
type VectorEffect = {
|
|
379
|
+
[K in VectorEffectType]: {
|
|
380
|
+
/** Unique within the node. */
|
|
381
|
+
id: string;
|
|
382
|
+
type: K;
|
|
383
|
+
/** Disabled effects are skipped. Default true. */
|
|
384
|
+
enabled?: boolean;
|
|
385
|
+
params: VectorEffectParamsMap[K];
|
|
386
|
+
};
|
|
387
|
+
}[VectorEffectType];
|
|
225
388
|
/** Identifies one segment of a path node: from anchor `segment` to the next. */
|
|
226
389
|
interface VectorSegmentRef {
|
|
227
390
|
nodeId: string;
|
|
@@ -252,7 +415,7 @@ declare function subpathSegment(sp: VectorSubpath, i: number): Point[];
|
|
|
252
415
|
declare function subpathsToBezier(subpaths: readonly VectorSubpath[], options?: {
|
|
253
416
|
corners?: boolean;
|
|
254
417
|
}): BezierPath;
|
|
255
|
-
/** The node's outline as Bézier commands. Groups have none. */
|
|
418
|
+
/** The node's outline as Bézier commands, as drawn (path effects applied). Groups have none. */
|
|
256
419
|
declare function vectorNodeToBezier(node: VectorNode): BezierPath;
|
|
257
420
|
/** SVG path data (`d`) of a path node or subpaths. */
|
|
258
421
|
declare function vectorPathData(input: VectorPathNode | readonly VectorSubpath[], precision?: number): string;
|
|
@@ -278,8 +441,13 @@ declare function locateVectorNode(nodes: VectorNode[], id: string): {
|
|
|
278
441
|
declare function collectPathNodes(node: VectorNode): VectorPathNode[];
|
|
279
442
|
/** The node's local → parent matrix (identity when it has no `transform`). */
|
|
280
443
|
declare function nodeMatrix(node: VectorNode): AffineMatrix;
|
|
281
|
-
/**
|
|
282
|
-
|
|
444
|
+
/**
|
|
445
|
+
* A path node's outline in the space `parent` maps to (default: its parent's space), as drawn:
|
|
446
|
+
* live corners cut and path effects applied (`{ effects: false }`: the stored path only).
|
|
447
|
+
*/
|
|
448
|
+
declare function vectorPathWorldBezier(node: VectorPathNode, parent?: AffineMatrix, options?: {
|
|
449
|
+
effects?: boolean;
|
|
450
|
+
}): BezierPath;
|
|
283
451
|
/**
|
|
284
452
|
* Geometric bounds of a node (stroke width not included) in the space `parent` maps to —
|
|
285
453
|
* by default the node's parent space, which for top-level nodes is the document. Null when
|
|
@@ -292,19 +460,27 @@ declare function unionBounds(list: readonly (VectorBounds | null | undefined)[])
|
|
|
292
460
|
declare function boundsIntersect(a: VectorBounds, b: VectorBounds): boolean;
|
|
293
461
|
/** A box from two corners in any order. */
|
|
294
462
|
declare function boundsFromPoints(a: Vec2, b: Vec2): VectorBounds;
|
|
463
|
+
/** Options of `hitTestVectorNode`. */
|
|
464
|
+
interface VectorHitTestOptions {
|
|
465
|
+
/**
|
|
466
|
+
* Live groups (live booleans or groups with effects) hit by their children as stored rather
|
|
467
|
+
* than by what they draw: the groups being edited.
|
|
468
|
+
*/
|
|
469
|
+
entered?: ReadonlySet<string>;
|
|
470
|
+
}
|
|
295
471
|
/**
|
|
296
|
-
* Whether `p` hits a node
|
|
297
|
-
*
|
|
298
|
-
* any visible child is.
|
|
472
|
+
* Whether `p` hits a node as drawn (path effects and live booleans applied): inside its fill
|
|
473
|
+
* (when it has one), on its stroke (its alignment and arrowheads respected) or within
|
|
474
|
+
* `tolerance` of either. A group is hit when any visible child is.
|
|
299
475
|
*/
|
|
300
|
-
declare function hitTestVectorNode(node: VectorNode, p: Vec2, tolerance?: number, parent?: AffineMatrix): boolean;
|
|
476
|
+
declare function hitTestVectorNode(node: VectorNode, p: Vec2, tolerance?: number, parent?: AffineMatrix, options?: VectorHitTestOptions): boolean;
|
|
301
477
|
/**
|
|
302
478
|
* The area a path node's stroke paints (alignment, caps, joins, dashes and arrowheads
|
|
303
479
|
* included), as a filled path in the space `parent` maps to. Empty without a stroke.
|
|
304
480
|
*/
|
|
305
481
|
declare function vectorStrokeOutline(node: VectorPathNode, parent?: AffineMatrix): BezierPath;
|
|
306
482
|
/** The topmost node hit by `p` (skipping hidden and locked ones), or null. */
|
|
307
|
-
declare function hitTestVectorNodes(nodes: readonly VectorNode[], p: Vec2, tolerance?: number): VectorNode | null;
|
|
483
|
+
declare function hitTestVectorNodes(nodes: readonly VectorNode[], p: Vec2, tolerance?: number, options?: VectorHitTestOptions): VectorNode | null;
|
|
308
484
|
interface NearestSegment {
|
|
309
485
|
subpath: number;
|
|
310
486
|
segment: number;
|
|
@@ -1089,6 +1265,10 @@ interface VectorEditorState {
|
|
|
1089
1265
|
pointer: Vec2 | null;
|
|
1090
1266
|
/** Shape Builder and paint bucket highlight: faces, line pieces and the gesture's trail. */
|
|
1091
1267
|
builder: VectorBuilderPreview | null;
|
|
1268
|
+
/** The Blend tool's first click: the shape (and anchor of its first subpath) the next click blends from. */
|
|
1269
|
+
blendStart: VectorBlendStart | null;
|
|
1270
|
+
/** Options new blends get. */
|
|
1271
|
+
blendDefaults: VectorBlendOptions;
|
|
1092
1272
|
canUndo: boolean;
|
|
1093
1273
|
canRedo: boolean;
|
|
1094
1274
|
undoLabel: string;
|
|
@@ -1102,6 +1282,22 @@ type VectorActionResult = {
|
|
|
1102
1282
|
ok: false;
|
|
1103
1283
|
message: string;
|
|
1104
1284
|
};
|
|
1285
|
+
/** The shape the Blend tool blends from (its first click). */
|
|
1286
|
+
interface VectorBlendStart {
|
|
1287
|
+
nodeId: string;
|
|
1288
|
+
/** The clicked anchor of its first subpath, or null for the shape as a whole. */
|
|
1289
|
+
anchor: number | null;
|
|
1290
|
+
}
|
|
1291
|
+
/** Blend settings and options of `VectorEditorController.blend`. */
|
|
1292
|
+
interface VectorBlendInput extends VectorBlendOptions {
|
|
1293
|
+
/** Nodes to blend (default: the selection), in stacking order unless `keepOrder`. */
|
|
1294
|
+
ids?: readonly string[];
|
|
1295
|
+
/** Blend in the order given instead of stacking order. */
|
|
1296
|
+
keepOrder?: boolean;
|
|
1297
|
+
/** Start anchor of each key's first subpath, by key id. */
|
|
1298
|
+
starts?: Record<string, number>;
|
|
1299
|
+
name?: string;
|
|
1300
|
+
}
|
|
1105
1301
|
/**
|
|
1106
1302
|
* What the Shape Builder or paint bucket highlights, in document units: the faces (filled paths
|
|
1107
1303
|
* as SVG path data) under the pointer or touched by the drag, the line pieces an erase would
|
|
@@ -1325,6 +1521,9 @@ declare class VectorEditorController {
|
|
|
1325
1521
|
/** Paint bucket map of the visible outlines. */
|
|
1326
1522
|
private fillCache;
|
|
1327
1523
|
private builderPreview;
|
|
1524
|
+
private blendStart;
|
|
1525
|
+
/** Options new blends get (the toolbars edit them along with the selected blend's). */
|
|
1526
|
+
private blendDefaults;
|
|
1328
1527
|
/** What the highlight shows, to skip notifying when the pointer stays over the same face. */
|
|
1329
1528
|
private builderHoverKey;
|
|
1330
1529
|
private readonly createId;
|
|
@@ -1346,6 +1545,8 @@ declare class VectorEditorController {
|
|
|
1346
1545
|
getDocument(): VectorDocument;
|
|
1347
1546
|
getNode(id: string): VectorNode | undefined;
|
|
1348
1547
|
private computeState;
|
|
1548
|
+
/** `doc` with its blends' steps brought up to date (the same object when they already are). */
|
|
1549
|
+
private refreshed;
|
|
1349
1550
|
private notify;
|
|
1350
1551
|
private boundsOf;
|
|
1351
1552
|
private frameOf;
|
|
@@ -1356,10 +1557,15 @@ declare class VectorEditorController {
|
|
|
1356
1557
|
private cursorFor;
|
|
1357
1558
|
private snapshot;
|
|
1358
1559
|
private restore;
|
|
1359
|
-
/**
|
|
1560
|
+
/**
|
|
1561
|
+
* Records the change from `before` to the current state as one undo step. Consecutive
|
|
1562
|
+
* changes with the same `merge` key (a slider drag) fold into one step.
|
|
1563
|
+
*/
|
|
1360
1564
|
private commit;
|
|
1361
|
-
/** Runs `fn` (which updates fields) and records it as one undo step. */
|
|
1565
|
+
/** Runs `fn` (which updates fields) and records it as one undo step (merged by `merge` key). */
|
|
1362
1566
|
private change;
|
|
1567
|
+
/** Ends a merged edit (a slider released): the next change starts a new undo step. */
|
|
1568
|
+
endMergedEdit(): void;
|
|
1363
1569
|
private setDoc;
|
|
1364
1570
|
private replaceNode;
|
|
1365
1571
|
private freshIds;
|
|
@@ -1520,6 +1726,43 @@ declare class VectorEditorController {
|
|
|
1520
1726
|
outlineStroke(options?: {
|
|
1521
1727
|
ids?: readonly string[];
|
|
1522
1728
|
}): string[];
|
|
1729
|
+
/** Selected (or given) nodes that can carry effects: the roots of the selection. */
|
|
1730
|
+
private effectTargets;
|
|
1731
|
+
/**
|
|
1732
|
+
* Adds an effect of `type` to the selected (or given) nodes, at the bottom of each stack (or
|
|
1733
|
+
* at `index`), with default parameters merged with `params`. A repeater's copies start one
|
|
1734
|
+
* shape width apart. One undo step; returns the new effect ids (one per node, in order).
|
|
1735
|
+
*/
|
|
1736
|
+
addEffect(type: VectorEffectType, options?: {
|
|
1737
|
+
ids?: readonly string[];
|
|
1738
|
+
params?: Record<string, unknown>;
|
|
1739
|
+
index?: number;
|
|
1740
|
+
}): string[];
|
|
1741
|
+
private editEffects;
|
|
1742
|
+
/**
|
|
1743
|
+
* Turns an effect on or off and changes its parameters (unknown or invalid values are
|
|
1744
|
+
* ignored). With `merge` (true, or a key of your own), consecutive updates of the same effect
|
|
1745
|
+
* fold into one undo step, as a slider drag should; call `endMergedEdit` when it ends.
|
|
1746
|
+
*/
|
|
1747
|
+
updateEffect(nodeId: string, effectId: string, patch: {
|
|
1748
|
+
enabled?: boolean;
|
|
1749
|
+
params?: Record<string, unknown>;
|
|
1750
|
+
}, options?: {
|
|
1751
|
+
merge?: boolean | string;
|
|
1752
|
+
}): VectorActionResult;
|
|
1753
|
+
/** Removes an effect from a node's stack. */
|
|
1754
|
+
removeEffect(nodeId: string, effectId: string): VectorActionResult;
|
|
1755
|
+
/** Moves an effect to position `index` of its stack (0 is applied first). */
|
|
1756
|
+
moveEffect(nodeId: string, effectId: string, index: number): VectorActionResult;
|
|
1757
|
+
/**
|
|
1758
|
+
* Expand Appearance: bakes the path effects and live booleans of the selected (or given)
|
|
1759
|
+
* nodes, and of everything inside them, into plain paths. A node keeps its id (a group when
|
|
1760
|
+
* it draws as several shapes); the shapes it made get new ids. Returns the ids of the expanded
|
|
1761
|
+
* nodes (empty when none was live).
|
|
1762
|
+
*/
|
|
1763
|
+
expandAppearance(options?: {
|
|
1764
|
+
ids?: readonly string[];
|
|
1765
|
+
}): string[];
|
|
1523
1766
|
rename(id: string, name: string): VectorActionResult;
|
|
1524
1767
|
setVisible(id: string, visible: boolean): VectorActionResult;
|
|
1525
1768
|
setLocked(id: string, locked: boolean): VectorActionResult;
|
|
@@ -1607,11 +1850,20 @@ declare class VectorEditorController {
|
|
|
1607
1850
|
/**
|
|
1608
1851
|
* Combines the selected paths (two or more) into one with a boolean operation. `subtract`
|
|
1609
1852
|
* removes the upper shapes from the lowest one. The result takes the lowest shape's style
|
|
1610
|
-
* and place.
|
|
1853
|
+
* and place. Shapes take part as drawn (path effects and live booleans applied).
|
|
1854
|
+
*
|
|
1855
|
+
* With `live`, the operands stay editable instead: a lone live boolean group gets the
|
|
1856
|
+
* operation (its operands follow it again), operands of live boolean groups get it as their
|
|
1857
|
+
* own, and anything else (two or more nodes with one parent) is wrapped in a new live boolean
|
|
1858
|
+
* group. Returns the result's (or the live group's) id, or null.
|
|
1611
1859
|
*/
|
|
1612
1860
|
booleanOp(op: VectorBooleanOperation, options?: {
|
|
1613
1861
|
ids?: readonly string[];
|
|
1862
|
+
live?: boolean;
|
|
1614
1863
|
}): string | null;
|
|
1864
|
+
/** Whether stored node `rootId` holds `id` as drawn (`id` may be an expanded path inside it). */
|
|
1865
|
+
private holds;
|
|
1866
|
+
private liveBooleanOp;
|
|
1615
1867
|
/** Joins the selected paths into one compound path (subpaths kept, lowest style). */
|
|
1616
1868
|
combine(options?: {
|
|
1617
1869
|
ids?: readonly string[];
|
|
@@ -1634,6 +1886,44 @@ declare class VectorEditorController {
|
|
|
1634
1886
|
ids?: readonly string[];
|
|
1635
1887
|
}): string[];
|
|
1636
1888
|
/** The Shape Builder map of the selected (or given) paths, cached per document and selection. */
|
|
1889
|
+
/** Selected (or given) blend groups; a selected key or step counts as its blend. */
|
|
1890
|
+
private blendTargets;
|
|
1891
|
+
/**
|
|
1892
|
+
* Blends two or more selected (or given) paths or groups: they become the keys of a live
|
|
1893
|
+
* blend group (bottom to top, or in the order given with `keepOrder`) whose in-betweens are
|
|
1894
|
+
* regenerated whenever a key or the options change. The keys must share a parent. Returns
|
|
1895
|
+
* the blend group's id, or null.
|
|
1896
|
+
*/
|
|
1897
|
+
blend(input?: VectorBlendInput): string | null;
|
|
1898
|
+
/** Sets the options new blends get (spacing, steps, distance, orientation, morph). */
|
|
1899
|
+
setBlendDefaults(patch: Partial<VectorBlendOptions>): void;
|
|
1900
|
+
/**
|
|
1901
|
+
* Adds a node as the last key of a blend (it must share the blend's parent); `start` is the
|
|
1902
|
+
* anchor of its first subpath the blend starts from. One undo step.
|
|
1903
|
+
*/
|
|
1904
|
+
addBlendKey(blendId: string, nodeId: string, options?: {
|
|
1905
|
+
start?: number | null;
|
|
1906
|
+
}): VectorActionResult;
|
|
1907
|
+
/** Changes the spacing, steps, distance, orientation or morph of the selected (or given) blends. */
|
|
1908
|
+
setBlendOptions(patch: Partial<VectorBlendOptions>, options?: {
|
|
1909
|
+
ids?: readonly string[];
|
|
1910
|
+
}): VectorActionResult;
|
|
1911
|
+
/** Expand: turns the selected (or given) blends into plain groups of their keys and steps. Returns their ids. */
|
|
1912
|
+
expandBlend(options?: {
|
|
1913
|
+
ids?: readonly string[];
|
|
1914
|
+
}): string[];
|
|
1915
|
+
/** Release: replaces the selected (or given) blends with their keys (and a replaced spine as a path). */
|
|
1916
|
+
releaseBlend(options?: {
|
|
1917
|
+
ids?: readonly string[];
|
|
1918
|
+
}): string[];
|
|
1919
|
+
/**
|
|
1920
|
+
* Replace Spine: the selected blend's steps follow the selected path instead of the straight
|
|
1921
|
+
* lines between its keys. The path's first subpath becomes the spine (the path is removed)
|
|
1922
|
+
* and the keys move onto it, spread evenly by arc length.
|
|
1923
|
+
*/
|
|
1924
|
+
replaceBlendSpine(options?: {
|
|
1925
|
+
ids?: readonly string[];
|
|
1926
|
+
}): VectorActionResult;
|
|
1637
1927
|
private shapeBuilderMap;
|
|
1638
1928
|
/** The faces the Shape Builder offers for the selected (or given) paths (document units). */
|
|
1639
1929
|
getShapeBuilderFaces(options?: {
|
|
@@ -1816,6 +2106,8 @@ declare class VectorEditorController {
|
|
|
1816
2106
|
private hitCornerWidget;
|
|
1817
2107
|
private hitAnchor;
|
|
1818
2108
|
/** Deepest unlocked visible path under `p`. */
|
|
2109
|
+
/** Live groups being edited (selected, or holding the selection or the edited path): their children are hit as stored. */
|
|
2110
|
+
private enteredGroups;
|
|
1819
2111
|
private hitPath;
|
|
1820
2112
|
/** Endpoints of open subpaths of unlocked visible paths (pen tool resumes from them). */
|
|
1821
2113
|
private openEndpoints;
|
|
@@ -1838,6 +2130,10 @@ declare class VectorEditorController {
|
|
|
1838
2130
|
private sameHover;
|
|
1839
2131
|
/** Primary button down on the canvas at `screen` (pixels relative to the canvas). */
|
|
1840
2132
|
pointerDown(screen: Vec2, input?: VectorPointerInput): void;
|
|
2133
|
+
/** The shape under the pointer for the Blend tool, and the anchor of its first subpath under it. */
|
|
2134
|
+
private blendHit;
|
|
2135
|
+
/** Blend tool: the first click picks the shape to blend from, the next one blends it into the shape clicked. */
|
|
2136
|
+
private downBlend;
|
|
1841
2137
|
private downSelect;
|
|
1842
2138
|
private downDirect;
|
|
1843
2139
|
private downPen;
|
|
@@ -1876,6 +2172,153 @@ declare function scaleFor(handle: VectorTransformHandle, b: VectorBounds, p: Vec
|
|
|
1876
2172
|
origin: Vec2;
|
|
1877
2173
|
};
|
|
1878
2174
|
|
|
2175
|
+
/**
|
|
2176
|
+
* Live appearance: path effect stacks and live boolean groups, evaluated on demand while the
|
|
2177
|
+
* stored anchors and children stay editable.
|
|
2178
|
+
*
|
|
2179
|
+
* `expandVectorAppearance` is the one place the effected geometry is made (cached per node
|
|
2180
|
+
* object, so an edit recomputes only the nodes it replaced). Rendering, hit-testing, bounds,
|
|
2181
|
+
* snapping, booleans, the Pathfinder, the Shape Builder and SVG export all read it, the way they
|
|
2182
|
+
* read live corners through `subpathsToBezier`; Expand Appearance stores it.
|
|
2183
|
+
*
|
|
2184
|
+
* Stacking follows After Effects' shape layers (effectcraft `crates/render/src/shapes.rs`): an
|
|
2185
|
+
* effect acts on every path above it — the node's own outline, or for a group every path of its
|
|
2186
|
+
* children (nested groups included, as drawn by their own effects) — in the order of the stack,
|
|
2187
|
+
* and effects placed after a repeater act on its copies. The result paints with the style of the
|
|
2188
|
+
* path each shape came from; Merge Paths and live booleans paint with the bottom one's.
|
|
2189
|
+
*
|
|
2190
|
+
* Live booleans fold their operands bottom to top, each combined with the result below it by its
|
|
2191
|
+
* own operation or the group's, and every prefix of the fold is cached under a rolling hash of the
|
|
2192
|
+
* operands it covers, so editing one operand recombines only the operands from it up; the cache
|
|
2193
|
+
* drops its least recently used half when full. Live groups are hit by their result except while
|
|
2194
|
+
* they are being edited (`vectorEnteredGroups`).
|
|
2195
|
+
*
|
|
2196
|
+
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
2197
|
+
* THIRD_PARTY_NOTICES.md): the stacking rule of effectcraft `crates/render/src/shapes.rs`
|
|
2198
|
+
* (`collect()`); figcraft `crates/render/src/boolean.rs` (`fold_cached`, `PathCache`) and
|
|
2199
|
+
* `crates/engine/src/booleans.rs` (`operand_op`, `result_outline`); and the live-object model of
|
|
2200
|
+
* vectorcraft `crates/doc/src/live.rs` (`expand_live`, `expanded_group`, `subtree_has_live`).
|
|
2201
|
+
*/
|
|
2202
|
+
|
|
2203
|
+
/** One shape of a node's appearance: a path in the node's own space, painted in `source`'s style. */
|
|
2204
|
+
interface VectorAppearanceShape {
|
|
2205
|
+
/** The path whose style paints it. */
|
|
2206
|
+
source: VectorPathNode;
|
|
2207
|
+
path: BezierPath;
|
|
2208
|
+
/** Opacity factor relative to the node (its own opacity not included). */
|
|
2209
|
+
opacity: number;
|
|
2210
|
+
/** Draw-order key (compared element by element). */
|
|
2211
|
+
order: number[];
|
|
2212
|
+
}
|
|
2213
|
+
/** Default parameters of each effect type. */
|
|
2214
|
+
declare const VECTOR_EFFECT_DEFAULTS: {
|
|
2215
|
+
readonly [K in VectorEffectType]: VectorEffectParamsMap[K];
|
|
2216
|
+
};
|
|
2217
|
+
declare const VECTOR_EFFECT_LABELS: Record<VectorEffectType, string>;
|
|
2218
|
+
/** How a panel edits one effect parameter. */
|
|
2219
|
+
type VectorEffectParamSpec = {
|
|
2220
|
+
key: string;
|
|
2221
|
+
label: string;
|
|
2222
|
+
kind: 'number';
|
|
2223
|
+
min?: number;
|
|
2224
|
+
max?: number;
|
|
2225
|
+
step: number;
|
|
2226
|
+
slider?: boolean;
|
|
2227
|
+
} | {
|
|
2228
|
+
key: string;
|
|
2229
|
+
label: string;
|
|
2230
|
+
kind: 'vec2';
|
|
2231
|
+
step: number;
|
|
2232
|
+
} | {
|
|
2233
|
+
key: string;
|
|
2234
|
+
label: string;
|
|
2235
|
+
kind: 'boolean';
|
|
2236
|
+
} | {
|
|
2237
|
+
key: string;
|
|
2238
|
+
label: string;
|
|
2239
|
+
kind: 'select';
|
|
2240
|
+
options: {
|
|
2241
|
+
value: string;
|
|
2242
|
+
label: string;
|
|
2243
|
+
}[];
|
|
2244
|
+
};
|
|
2245
|
+
/** The editable parameters of each effect type, in panel order. */
|
|
2246
|
+
declare const VECTOR_EFFECT_PARAM_SPECS: Record<VectorEffectType, VectorEffectParamSpec[]>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Effect parameters with defaults filled in and invalid values dropped (unknown keys go too).
|
|
2249
|
+
* Returns null for an unknown type.
|
|
2250
|
+
*/
|
|
2251
|
+
declare function normalizeVectorEffectParams<K extends VectorEffectType>(type: K, params: Record<string, unknown> | null | undefined, base?: VectorEffectParamsMap[K]): VectorEffectParamsMap[K] | null;
|
|
2252
|
+
/** A new effect of `type` (defaults merged with `params`), or null for an unknown type. */
|
|
2253
|
+
declare function createVectorEffect<K extends VectorEffectType>(type: K, id: string, params?: Partial<VectorEffectParamsMap[K]> | Record<string, unknown>): Extract<VectorEffect, {
|
|
2254
|
+
type: K;
|
|
2255
|
+
}> | null;
|
|
2256
|
+
/** The node's effects that take part (enabled, of a known type). */
|
|
2257
|
+
declare function activeVectorEffects(node: VectorNode): VectorEffect[];
|
|
2258
|
+
/** Whether the node itself draws differently from its stored geometry (effects or a live boolean). */
|
|
2259
|
+
declare function hasOwnVectorAppearance(node: VectorNode): boolean;
|
|
2260
|
+
/** Whether the node or anything inside it has a live appearance. */
|
|
2261
|
+
declare function hasVectorAppearance(node: VectorNode): boolean;
|
|
2262
|
+
/** A live boolean group (its children are operands). */
|
|
2263
|
+
declare function isVectorLiveBoolean(node: VectorNode | null | undefined): node is VectorGroupNode & {
|
|
2264
|
+
liveBoolean: VectorBooleanOperation;
|
|
2265
|
+
};
|
|
2266
|
+
/** How operand `child` of a live boolean group combines with the operands below it. */
|
|
2267
|
+
declare function vectorOperandOperation(group: VectorGroupNode, child: VectorNode): VectorBooleanOperation;
|
|
2268
|
+
/** How many boolean steps (one operand combined with the result below it) live booleans have computed: what a cache miss costs. */
|
|
2269
|
+
declare function vectorLiveBooleanSteps(): number;
|
|
2270
|
+
/** Empties the live boolean prefix cache. */
|
|
2271
|
+
declare function clearVectorLiveBooleanCache(): void;
|
|
2272
|
+
/** One operand of a live boolean: its outline (group space), fill rule and operation (unused for the bottom one). */
|
|
2273
|
+
interface VectorBooleanOperand {
|
|
2274
|
+
path: BezierPath;
|
|
2275
|
+
fillRule: VectorFillRule;
|
|
2276
|
+
operation: VectorBooleanOperation;
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* The result of folding `operands` bottom to top, reusing the longest cached prefix: only the
|
|
2280
|
+
* operands above it are combined. Invalid geometry gives an empty path.
|
|
2281
|
+
*/
|
|
2282
|
+
declare function foldVectorBooleanOperands(operands: readonly VectorBooleanOperand[]): BezierPath;
|
|
2283
|
+
/** Applies an effect stack to shapes, top to bottom (disabled effects skipped). */
|
|
2284
|
+
declare function applyVectorEffects(shapes: readonly VectorAppearanceShape[], effects: readonly VectorEffect[] | null | undefined): VectorAppearanceShape[];
|
|
2285
|
+
/**
|
|
2286
|
+
* What a node draws as: shapes in its own space (its `transform` and opacity not applied),
|
|
2287
|
+
* bottom to top, with its effects and those of everything inside it applied. Cached per node
|
|
2288
|
+
* object.
|
|
2289
|
+
*/
|
|
2290
|
+
declare function vectorAppearanceShapes(node: VectorNode): VectorAppearanceShape[];
|
|
2291
|
+
/** Everything a node draws as one path in its own space (live corners cut, effects applied). */
|
|
2292
|
+
declare function vectorAppearanceOutline(node: VectorNode): BezierPath;
|
|
2293
|
+
/** What a node draws as, one plain path per shape (ids `<id>~fx<n>`, opacity relative to the node). */
|
|
2294
|
+
declare function vectorAppearanceNodes(node: VectorNode): VectorPathNode[];
|
|
2295
|
+
/**
|
|
2296
|
+
* The node as plain geometry: path effects and live booleans evaluated into paths (the node
|
|
2297
|
+
* itself when nothing inside it is live). A path keeps its id when it draws as one shape;
|
|
2298
|
+
* otherwise, like any live group, it becomes a group with that id holding one path per shape
|
|
2299
|
+
* (ids `<id>~fx<n>`). Groups without effects of their own keep their structure. Cached per node.
|
|
2300
|
+
*/
|
|
2301
|
+
declare function expandVectorAppearance(node: VectorNode): VectorNode;
|
|
2302
|
+
/** Every node of a list expanded (the same array when nothing in it is live). */
|
|
2303
|
+
declare function expandVectorAppearances(nodes: readonly VectorNode[]): VectorNode[];
|
|
2304
|
+
/**
|
|
2305
|
+
* Reads effects from untrusted data (JSON, agent input): unknown types and malformed entries are
|
|
2306
|
+
* dropped, parameters normalized, ids made unique.
|
|
2307
|
+
*/
|
|
2308
|
+
declare function sanitizeVectorEffects(value: unknown): VectorEffect[];
|
|
2309
|
+
/**
|
|
2310
|
+
* Effect parameters carried through a linear map baked into a node's geometry (scaling or
|
|
2311
|
+
* flipping it): offsets and positions move with it, angles turn the other way when it mirrors.
|
|
2312
|
+
* Lengths such as sizes and radii are kept, like stroke widths.
|
|
2313
|
+
*/
|
|
2314
|
+
declare function transformVectorEffects(effects: readonly VectorEffect[], m: AffineMatrix): VectorEffect[];
|
|
2315
|
+
/**
|
|
2316
|
+
* The live groups (live booleans and groups with effects) being edited: those in `ids` and those
|
|
2317
|
+
* holding a node in `ids`. Their children are hit and outlined as stored instead of as drawn, so
|
|
2318
|
+
* each operand can be picked (figcraft `crates/engine/src/booleans.rs`, `result_outline`).
|
|
2319
|
+
*/
|
|
2320
|
+
declare function vectorEnteredGroups(nodes: readonly VectorNode[], ids: readonly string[]): Set<string>;
|
|
2321
|
+
|
|
1879
2322
|
interface VectorRenderPath {
|
|
1880
2323
|
kind: 'path';
|
|
1881
2324
|
id: string;
|
|
@@ -2062,6 +2505,29 @@ interface VectorOverlayRenderData {
|
|
|
2062
2505
|
lines: string[];
|
|
2063
2506
|
trail: string | null;
|
|
2064
2507
|
} | null;
|
|
2508
|
+
/**
|
|
2509
|
+
* Blends (screen space): the spine of each selected blend (`d`, draw it dashed; `keys` are
|
|
2510
|
+
* where its keys sit on it; `replaced` when it is a replaced spine) and, with the Blend tool,
|
|
2511
|
+
* the outline of the shape it blends from (`start`, with the clicked anchor) and the anchors
|
|
2512
|
+
* of the first subpath under the pointer (click one to start the blend there).
|
|
2513
|
+
*/
|
|
2514
|
+
blend: {
|
|
2515
|
+
spines: {
|
|
2516
|
+
id: string;
|
|
2517
|
+
d: string;
|
|
2518
|
+
keys: Vec2[];
|
|
2519
|
+
replaced: boolean;
|
|
2520
|
+
}[];
|
|
2521
|
+
start: {
|
|
2522
|
+
d: string;
|
|
2523
|
+
anchor: Vec2 | null;
|
|
2524
|
+
} | null;
|
|
2525
|
+
anchors: {
|
|
2526
|
+
x: number;
|
|
2527
|
+
y: number;
|
|
2528
|
+
hovered: boolean;
|
|
2529
|
+
}[];
|
|
2530
|
+
};
|
|
2065
2531
|
/** A short status, e.g. "W 120 × H 80" or "45°". */
|
|
2066
2532
|
status: string | null;
|
|
2067
2533
|
}
|
|
@@ -2074,8 +2540,32 @@ declare const VECTOR_BUILDER_HATCH_GAP = 6;
|
|
|
2074
2540
|
declare function getVectorSceneRenderData(state: Pick<VectorEditorState, 'document' | 'viewport'>, options?: {
|
|
2075
2541
|
idPrefix?: string;
|
|
2076
2542
|
}): VectorSceneRenderData;
|
|
2543
|
+
/** Live groups being edited in `state` (see `vectorEnteredGroups`). */
|
|
2544
|
+
declare function getVectorEnteredGroups(state: Pick<VectorEditorState, 'document' | 'selection' | 'editingId'>): Set<string>;
|
|
2077
2545
|
/** The editing overlay in screen pixels. Render it on top of the scene, untransformed. */
|
|
2078
2546
|
declare function getVectorOverlayRenderData(state: VectorEditorState): VectorOverlayRenderData;
|
|
2547
|
+
/** What the Blend controls of a toolbar or style panel show. */
|
|
2548
|
+
interface VectorBlendControls {
|
|
2549
|
+
/** Ids of the selected blends (a selected key counts as its blend). */
|
|
2550
|
+
ids: string[];
|
|
2551
|
+
/** The first selected blend's options, or the options new blends get. */
|
|
2552
|
+
options: Required<VectorBlendOptions>;
|
|
2553
|
+
/** Two or more shapes that share a parent are selected: Blend can run. */
|
|
2554
|
+
canBlend: boolean;
|
|
2555
|
+
/** One blend and one path are selected: Replace Spine can run. */
|
|
2556
|
+
canReplaceSpine: boolean;
|
|
2557
|
+
/** The first selected blend follows a replaced spine. */
|
|
2558
|
+
hasSpine: boolean;
|
|
2559
|
+
}
|
|
2560
|
+
/** State of the Blend controls for the current selection. */
|
|
2561
|
+
declare function getVectorBlendControls(state: Pick<VectorEditorState, 'document' | 'selection' | 'blendDefaults'>): VectorBlendControls;
|
|
2562
|
+
/**
|
|
2563
|
+
* Applies blend options from a toolbar: to the selected blends (one undo step) and to the
|
|
2564
|
+
* options new blends get, so the controls keep showing what was picked.
|
|
2565
|
+
*/
|
|
2566
|
+
declare function applyVectorBlendOptions(controller: VectorEditorController, patch: Partial<VectorBlendOptions>): void;
|
|
2567
|
+
/** Labels of the blend spacing modes, for toolbars. */
|
|
2568
|
+
declare const VECTOR_BLEND_SPACING_LABELS: Readonly<Record<VectorBlendSpacing, string>>;
|
|
2079
2569
|
/** Colours and sizes (screen pixels) the bundled canvases draw the overlay with. */
|
|
2080
2570
|
declare const VECTOR_OVERLAY_THEME: {
|
|
2081
2571
|
readonly accent: "#0ea5e9";
|
|
@@ -2219,6 +2709,33 @@ declare const VECTOR_EDIT_TOGGLES: readonly {
|
|
|
2219
2709
|
label: string;
|
|
2220
2710
|
title: string;
|
|
2221
2711
|
}[];
|
|
2712
|
+
/** One effect of the listed stack, with what a panel needs to edit it. */
|
|
2713
|
+
interface VectorEffectsPanelItem {
|
|
2714
|
+
id: string;
|
|
2715
|
+
type: VectorEffectType;
|
|
2716
|
+
label: string;
|
|
2717
|
+
enabled: boolean;
|
|
2718
|
+
params: Record<string, unknown>;
|
|
2719
|
+
specs: readonly VectorEffectParamSpec[];
|
|
2720
|
+
}
|
|
2721
|
+
/** What an Effects panel shows for the selection. */
|
|
2722
|
+
interface VectorEffectsPanelData {
|
|
2723
|
+
/** The node whose stack is listed (when one node is selected), else null. */
|
|
2724
|
+
nodeId: string | null;
|
|
2725
|
+
/** Selected nodes an added effect goes to. */
|
|
2726
|
+
count: number;
|
|
2727
|
+
/** The listed stack, applied top to bottom. */
|
|
2728
|
+
effects: VectorEffectsPanelItem[];
|
|
2729
|
+
/** Something selected is live (Expand Appearance applies). */
|
|
2730
|
+
expandable: boolean;
|
|
2731
|
+
}
|
|
2732
|
+
/** Effect types in menu order, with their names. */
|
|
2733
|
+
declare const VECTOR_EFFECT_MENU: readonly {
|
|
2734
|
+
type: VectorEffectType;
|
|
2735
|
+
label: string;
|
|
2736
|
+
}[];
|
|
2737
|
+
/** The Effects panel of the selection, or null when nothing that takes effects is selected. */
|
|
2738
|
+
declare function getVectorEffectsPanel(state: Pick<VectorEditorState, 'document' | 'selection'>): VectorEffectsPanelData | null;
|
|
2222
2739
|
|
|
2223
2740
|
interface VectorCommandOptions {
|
|
2224
2741
|
/** Id prefix (default `vector.`); use one per editor when several are registered. */
|
|
@@ -2252,6 +2769,24 @@ interface VectorNodeListing {
|
|
|
2252
2769
|
/** SVG path data (paths only). */
|
|
2253
2770
|
d?: string;
|
|
2254
2771
|
children?: number;
|
|
2772
|
+
/** A blend group's options (its steps are listed as children with `blendStep`). */
|
|
2773
|
+
blend?: {
|
|
2774
|
+
spacing: string;
|
|
2775
|
+
steps: number;
|
|
2776
|
+
distance: number;
|
|
2777
|
+
orientToSpine: boolean;
|
|
2778
|
+
linear: boolean;
|
|
2779
|
+
spine: boolean;
|
|
2780
|
+
keys: string[];
|
|
2781
|
+
};
|
|
2782
|
+
/** An in-between generated by a blend (locked; changes come from its keys). */
|
|
2783
|
+
blendStep?: boolean;
|
|
2784
|
+
/** The node's live path effects, applied in order. */
|
|
2785
|
+
effects?: VectorEffect[];
|
|
2786
|
+
/** A live boolean group's operation (its children are the operands). */
|
|
2787
|
+
liveBoolean?: VectorBooleanOperation;
|
|
2788
|
+
/** An operand's own operation in a live boolean group. */
|
|
2789
|
+
booleanOperation?: VectorBooleanOperation;
|
|
2255
2790
|
}
|
|
2256
2791
|
/**
|
|
2257
2792
|
* Palette and agent commands for a vector editor: list, select, add shapes and paths, style,
|
|
@@ -2589,10 +3124,13 @@ interface VectorPathEntry {
|
|
|
2589
3124
|
}
|
|
2590
3125
|
/**
|
|
2591
3126
|
* The path nodes inside `roots` (or every node when `roots` is null), bottom to top, with their
|
|
2592
|
-
* parent matrices. Hidden nodes are skipped, and locked ones unless `locked` is true.
|
|
3127
|
+
* parent matrices. Hidden nodes are skipped, and locked ones unless `locked` is true. Live nodes
|
|
3128
|
+
* (path effects, live booleans) take part as drawn (`expandVectorAppearance`: their entries are
|
|
3129
|
+
* the expanded paths, whose ids may not be in the document) unless `expand` is false.
|
|
2593
3130
|
*/
|
|
2594
3131
|
declare function vectorPathEntries(doc: VectorDocument, roots: readonly string[] | null, options?: {
|
|
2595
3132
|
locked?: boolean;
|
|
3133
|
+
expand?: boolean;
|
|
2596
3134
|
}): VectorPathEntry[];
|
|
2597
3135
|
/** Whether a subpath, closed, encloses an area (rather than retracing itself). */
|
|
2598
3136
|
declare function subpathEnclosesArea(sp: VectorSubpath): boolean;
|
|
@@ -2712,4 +3250,315 @@ declare function planShapeBuilder(m: VectorShapeBuilderMap, touched: VectorBuild
|
|
|
2712
3250
|
*/
|
|
2713
3251
|
declare function vectorFillMap(doc: VectorDocument, gap?: number): PlanarMap | null;
|
|
2714
3252
|
|
|
2715
|
-
|
|
3253
|
+
/**
|
|
3254
|
+
* Morphing between vector paths: bring two shapes to matching anchors, then compute in-betweens.
|
|
3255
|
+
*
|
|
3256
|
+
* - **Contours** pair up in order. A contour without a partner grows out of (or shrinks into) a
|
|
3257
|
+
* point at the same place relative to the other shape's box. Straight segments become cubics
|
|
3258
|
+
* with handles at a third of the way, so a line bends smoothly into a curve.
|
|
3259
|
+
* - **Anchors** are inserted by arc length with de Casteljau splits, so both contours of a pair
|
|
3260
|
+
* keep their exact outline and get the same number of segments, spread over the segments in
|
|
3261
|
+
* proportion to their length.
|
|
3262
|
+
* - **Correspondence**: the closed side of each pair is turned to the cyclic start that costs
|
|
3263
|
+
* least — the position differences left after the best-fit rotation (both shapes centred and
|
|
3264
|
+
* scaled to unit size), a little for the turn, plus the χ² distance of log-polar
|
|
3265
|
+
* shape-context histograms (Belongie, Malik & Puzicha, PAMI 2002; angles taken from the
|
|
3266
|
+
* contour's direction) — and the winding is chosen once for all contours (the first closed
|
|
3267
|
+
* pair turns the same way), so a nonzero fill keeps its holes.
|
|
3268
|
+
* - **In-betweens** follow the shapes' best-fit rotation and scale (Procrustes), with the
|
|
3269
|
+
* leftover difference blended in linearly, so a turning shape turns instead of collapsing.
|
|
3270
|
+
* - **Paint**: colours mix in OKLab, gradients of one kind resample their stops to a common
|
|
3271
|
+
* set, a missing paint fades from transparent; stroke width, opacity, dashes, arrowhead
|
|
3272
|
+
* scales and width profiles interpolate, and the rest switches halfway.
|
|
3273
|
+
* - **Transforms**: both shapes are blended in their parent's space; the in-between's rigid
|
|
3274
|
+
* `transform` interpolates as a rotation (the short way round) plus a translation.
|
|
3275
|
+
*
|
|
3276
|
+
* Live corners are cut into the geometry first, so rounded corners morph as curves.
|
|
3277
|
+
*/
|
|
3278
|
+
|
|
3279
|
+
interface VectorMorphOptions {
|
|
3280
|
+
/**
|
|
3281
|
+
* Move anchors in straight lines instead of following the shapes' best-fit rotation and
|
|
3282
|
+
* scale. Default `false`.
|
|
3283
|
+
*/
|
|
3284
|
+
linear?: boolean;
|
|
3285
|
+
/** 0–1: how much the rotation-aware path outweighs the straight one (default 1). */
|
|
3286
|
+
rigidity?: number;
|
|
3287
|
+
/** Fewest segments each contour pair gets (default 16). */
|
|
3288
|
+
minSegments?: number;
|
|
3289
|
+
/** At most this far apart (document units) along the longer contour, when set. */
|
|
3290
|
+
spacing?: number | null;
|
|
3291
|
+
/** Most segments a contour pair gets (default 400). */
|
|
3292
|
+
maxSegments?: number;
|
|
3293
|
+
/** Search the start anchor of closed contours (default `true`); off keeps the stored starts. */
|
|
3294
|
+
matchStart?: boolean;
|
|
3295
|
+
/** Compare shape-context histograms when choosing starts (default `true`). */
|
|
3296
|
+
shapeContext?: boolean;
|
|
3297
|
+
/**
|
|
3298
|
+
* The anchor each shape's first subpath starts from (the Blend tool's clicks). A closed
|
|
3299
|
+
* subpath turns round to it; an open one clicked at its last anchor runs backwards.
|
|
3300
|
+
*/
|
|
3301
|
+
starts?: readonly [number | null | undefined, number | null | undefined];
|
|
3302
|
+
/** Id of the in-between (default: the first shape's id). */
|
|
3303
|
+
id?: string;
|
|
3304
|
+
}
|
|
3305
|
+
/** Two shapes prepared once; `at(t)` interpolates (0 = `a`, 1 = `b`). */
|
|
3306
|
+
interface VectorMorph {
|
|
3307
|
+
at(t: number): VectorNode;
|
|
3308
|
+
}
|
|
3309
|
+
/** A subpath as cubics. A closed contour's last point repeats its first. */
|
|
3310
|
+
interface VectorMorphContour {
|
|
3311
|
+
closed: boolean;
|
|
3312
|
+
pts: Point[];
|
|
3313
|
+
}
|
|
3314
|
+
/** A subpath mapped by `m` as cubics (lines with handles at thirds), or null when empty. */
|
|
3315
|
+
declare function subpathToMorphContour(sp: VectorSubpath, m?: AffineMatrix): VectorMorphContour | null;
|
|
3316
|
+
/** A contour back to a subpath (`m` maps it out of the morph's space). Straight cubics become lines. */
|
|
3317
|
+
declare function morphContourToSubpath(c: VectorMorphContour, m?: AffineMatrix, closed?: boolean): VectorSubpath;
|
|
3318
|
+
/**
|
|
3319
|
+
* Exactly the same outline with `segments` cubics (at least as many as it has), the new
|
|
3320
|
+
* anchors spread over its segments in proportion to their arc length (largest remainder)
|
|
3321
|
+
* and each segment split into pieces of equal arc length. Also returns where each original
|
|
3322
|
+
* anchor went.
|
|
3323
|
+
*/
|
|
3324
|
+
declare function refineMorphContour(c: VectorMorphContour, segments: number): {
|
|
3325
|
+
contour: VectorMorphContour;
|
|
3326
|
+
anchors: number[];
|
|
3327
|
+
};
|
|
3328
|
+
/** The same contour run backwards (a closed one keeps its start anchor). */
|
|
3329
|
+
declare function reverseMorphContour(c: VectorMorphContour): VectorMorphContour;
|
|
3330
|
+
/** A closed contour starting at anchor `s` (deckcraft's `turn`). */
|
|
3331
|
+
declare function turnMorphContour(c: VectorMorphContour, s: number): VectorMorphContour;
|
|
3332
|
+
/** Two shapes' contours with matching structure: same count, and per pair the same segments. */
|
|
3333
|
+
interface VectorMorphCorrespondence {
|
|
3334
|
+
a: VectorMorphContour[];
|
|
3335
|
+
b: VectorMorphContour[];
|
|
3336
|
+
/** Whether `b` runs backwards relative to its stored direction. */
|
|
3337
|
+
reversed: boolean;
|
|
3338
|
+
}
|
|
3339
|
+
/**
|
|
3340
|
+
* Gives two lists of contours the same structure with matching anchors (see the module notes).
|
|
3341
|
+
* Contours pair in order; one without a partner meets a point.
|
|
3342
|
+
*/
|
|
3343
|
+
declare function correspondMorphContours(a: readonly VectorMorphContour[], b: readonly VectorMorphContour[], options?: VectorMorphOptions): VectorMorphCorrespondence;
|
|
3344
|
+
/**
|
|
3345
|
+
* How many pairs of straight anchor paths (from `a`'s anchor i to `b`'s anchor i) cross: a
|
|
3346
|
+
* sanity measure of a correspondence — good matches don't make anchors pass through each other.
|
|
3347
|
+
*/
|
|
3348
|
+
declare function morphPathsCross(a: readonly VectorMorphContour[], b: readonly VectorMorphContour[]): number;
|
|
3349
|
+
/** The similarity (rotation θ, scale s, centroids) that best maps `a`'s anchors onto `b`'s. */
|
|
3350
|
+
interface Similarity {
|
|
3351
|
+
ca: Point;
|
|
3352
|
+
cb: Point;
|
|
3353
|
+
theta: number;
|
|
3354
|
+
s: number;
|
|
3355
|
+
}
|
|
3356
|
+
/**
|
|
3357
|
+
* Corresponded contours at `u`: each point carried by the similarity interpolated to `u`
|
|
3358
|
+
* (rotation θu, scale sᵘ, centroid moving straight), plus `u` of what the full similarity
|
|
3359
|
+
* leaves over, blended with the straight path by `rigidity`.
|
|
3360
|
+
*/
|
|
3361
|
+
declare function interpolateMorphContours(a: readonly VectorMorphContour[], b: readonly VectorMorphContour[], u: number, options?: Pick<VectorMorphOptions, 'linear' | 'rigidity'> & {
|
|
3362
|
+
similarity?: Similarity;
|
|
3363
|
+
}): VectorMorphContour[];
|
|
3364
|
+
/**
|
|
3365
|
+
* Interpolates two rigid matrices as a rotation (the shorter way round) plus a translation.
|
|
3366
|
+
* Any scale or skew is interpolated linearly in the rotated frame.
|
|
3367
|
+
*/
|
|
3368
|
+
declare function interpolateRigidMatrix(a: AffineMatrix, b: AffineMatrix, t: number): AffineMatrix;
|
|
3369
|
+
/** Two colours mixed in OKLab (premultiplied alpha); unreadable colours switch halfway. */
|
|
3370
|
+
declare function interpolateVectorColor(a: string, b: string, t: number): string;
|
|
3371
|
+
/** A gradient's stops resampled at `offsets`, each painting what the gradient paints there. */
|
|
3372
|
+
declare function resampleGradientStops(g: CanvasGradientDef, offsets: readonly number[]): GradientStop[];
|
|
3373
|
+
/**
|
|
3374
|
+
* Interpolates paints: colours in OKLab, gradients of one kind with their stops resampled to a
|
|
3375
|
+
* common set, a colour and a gradient through a gradient of that colour, and a missing paint
|
|
3376
|
+
* fading from transparent. Gradients of different kinds switch halfway.
|
|
3377
|
+
*/
|
|
3378
|
+
declare function interpolateVectorPaint(a: VectorPaint | undefined, b: VectorPaint | undefined, t: number): VectorPaint | undefined;
|
|
3379
|
+
/** Width profiles at every position either has a point (no profile is uniform). */
|
|
3380
|
+
declare function interpolateWidthProfiles(a: readonly VectorWidthPoint[] | null | undefined, b: readonly VectorWidthPoint[] | null | undefined, t: number): VectorWidthPoint[] | null;
|
|
3381
|
+
/**
|
|
3382
|
+
* Interpolated style of two paths: paints, stroke width, dashes, arrowhead scales and width
|
|
3383
|
+
* profiles mix; caps, joins, the fill rule, alignment and arrowheads switch halfway.
|
|
3384
|
+
*/
|
|
3385
|
+
declare function interpolateVectorStyle(a: VectorStyle, b: VectorStyle, t: number): VectorStyle;
|
|
3386
|
+
/**
|
|
3387
|
+
* Prepares two shapes for interpolation. Two paths morph directly; with a group on either side
|
|
3388
|
+
* the paths inside pair up in stacking order and those without a partner grow out of a point.
|
|
3389
|
+
* Shapes are blended in their parent's space.
|
|
3390
|
+
*/
|
|
3391
|
+
declare function createVectorMorph(a: VectorNode, b: VectorNode, options?: VectorMorphOptions): VectorMorph;
|
|
3392
|
+
/**
|
|
3393
|
+
* The in-between of two shapes at `t` (0 = `a`, 1 = `b`). Prepare once with
|
|
3394
|
+
* `createVectorMorph` when interpolating the same pair at many `t`.
|
|
3395
|
+
*/
|
|
3396
|
+
declare function interpolateVectorPaths(a: VectorNode, b: VectorNode, t: number, options?: VectorMorphOptions): VectorNode;
|
|
3397
|
+
/** A keyframe of a path track: a shape at a time (ms), with the easing of the segment leaving it. */
|
|
3398
|
+
interface VectorPathKeyframe {
|
|
3399
|
+
time: number;
|
|
3400
|
+
value: VectorNode;
|
|
3401
|
+
easing?: AnimationEasing;
|
|
3402
|
+
}
|
|
3403
|
+
/**
|
|
3404
|
+
* A path track's shape at `time`: before the first keyframe its shape, after the last the
|
|
3405
|
+
* last; in between the two keyframes morph (prepared once per pair and cached) at the eased
|
|
3406
|
+
* fraction. Easings that overshoot are clamped to the keys. `null` without keyframes.
|
|
3407
|
+
*/
|
|
3408
|
+
declare function evaluateVectorPathKeyframes(keyframes: readonly VectorPathKeyframe[], time: number, options?: VectorMorphOptions): VectorNode | null;
|
|
3409
|
+
|
|
3410
|
+
/**
|
|
3411
|
+
* Live blend groups: a group whose `blend` is set keeps its key shapes as children and
|
|
3412
|
+
* regenerates the in-betweens (`blendStep` children, locked) whenever a key or the options
|
|
3413
|
+
* change. Steps follow the straight lines between the keys' centres, or a replaced spine.
|
|
3414
|
+
*
|
|
3415
|
+
* - **Spacing** (`vectorBlendStepCount`): a number of steps per pair of keys, a fixed distance
|
|
3416
|
+
* along the spine, or smooth colour — one step per two levels of the largest colour channel
|
|
3417
|
+
* difference, by distance when the colours match.
|
|
3418
|
+
* - **Spine**: with a replaced spine the keys sit along it, spread evenly by arc length; each
|
|
3419
|
+
* step is moved by how far the spine bends away from the chord between its keys, so a step
|
|
3420
|
+
* lands on the spine and the keys stay where they are. Orient to spine also turns the steps
|
|
3421
|
+
* by how much the spine's direction differs from the keys' (keys keep their orientation);
|
|
3422
|
+
* without a replaced spine the steps run straight and keep their orientation.
|
|
3423
|
+
*/
|
|
3424
|
+
|
|
3425
|
+
declare const DEFAULT_VECTOR_BLEND_STEPS = 5;
|
|
3426
|
+
declare const DEFAULT_VECTOR_BLEND_DISTANCE = 20;
|
|
3427
|
+
/** Most steps between two keys. */
|
|
3428
|
+
declare const VECTOR_BLEND_MAX_STEPS = 1000;
|
|
3429
|
+
/** Most steps smooth colour makes between two keys. */
|
|
3430
|
+
declare const VECTOR_BLEND_MAX_SMOOTH_STEPS = 256;
|
|
3431
|
+
/** Whether a node is a live blend group. */
|
|
3432
|
+
declare function isVectorBlendGroup(node: VectorNode | null | undefined): node is VectorGroupNode & {
|
|
3433
|
+
blend: VectorBlend;
|
|
3434
|
+
};
|
|
3435
|
+
/** The keys of a blend group (its children that are not generated steps), in stacking order. */
|
|
3436
|
+
declare function vectorBlendKeys(group: VectorGroupNode): VectorNode[];
|
|
3437
|
+
/** The full options of a blend, defaults filled in. */
|
|
3438
|
+
declare function resolveVectorBlendOptions(options: VectorBlendOptions | null | undefined): Required<VectorBlendOptions>;
|
|
3439
|
+
/** Largest channel difference (0–1) between the colours of two shapes' fills and strokes. */
|
|
3440
|
+
declare function vectorBlendColorDistance(a: VectorNode, b: VectorNode): number;
|
|
3441
|
+
/** Number of in-betweens between two keys `length` apart along the spine. */
|
|
3442
|
+
declare function vectorBlendStepCount(a: VectorNode, b: VectorNode, options: VectorBlendOptions | null | undefined, length: number): number;
|
|
3443
|
+
/** A subpath flattened to a polyline with cumulative arc lengths and tangent angles. */
|
|
3444
|
+
interface VectorBlendRail {
|
|
3445
|
+
pts: Point[];
|
|
3446
|
+
cum: number[];
|
|
3447
|
+
angles: number[];
|
|
3448
|
+
total: number;
|
|
3449
|
+
closed: boolean;
|
|
3450
|
+
}
|
|
3451
|
+
/** Flattens a spine subpath (32 samples per curve). Null with fewer than two distinct points. */
|
|
3452
|
+
declare function vectorBlendRail(sp: VectorSubpath): VectorBlendRail | null;
|
|
3453
|
+
/** Point and direction (radians) at arc length `s` (clamped; a closed rail wraps). */
|
|
3454
|
+
declare function vectorBlendRailAt(rail: VectorBlendRail, s: number): {
|
|
3455
|
+
point: Point;
|
|
3456
|
+
angle: number;
|
|
3457
|
+
};
|
|
3458
|
+
/**
|
|
3459
|
+
* The spine of a blend in the group's space and where along it each key sits: the replaced
|
|
3460
|
+
* spine (keys spread evenly by arc length) or the straight lines between the keys' centres.
|
|
3461
|
+
*/
|
|
3462
|
+
declare function vectorBlendSpine(group: VectorGroupNode): {
|
|
3463
|
+
spine: VectorSubpath;
|
|
3464
|
+
rail: VectorBlendRail;
|
|
3465
|
+
stops: number[];
|
|
3466
|
+
replaced: boolean;
|
|
3467
|
+
} | null;
|
|
3468
|
+
/** Where key `i` of a blend with spine `spine` should sit: its stop on the spine. */
|
|
3469
|
+
declare function vectorBlendKeyTargets(group: VectorGroupNode): Point[];
|
|
3470
|
+
/**
|
|
3471
|
+
* A blend group's children with fresh steps: each key followed by the in-betweens to the next,
|
|
3472
|
+
* bottom to top. Groups with fewer than two keys keep just their keys.
|
|
3473
|
+
*/
|
|
3474
|
+
declare function generateVectorBlendChildren(group: VectorGroupNode): VectorNode[];
|
|
3475
|
+
/**
|
|
3476
|
+
* Nodes with every blend group's steps brought up to date (nested blends first). Returns the
|
|
3477
|
+
* same array when nothing changed; steps are cached per set of keys, so calling this after
|
|
3478
|
+
* every edit is cheap.
|
|
3479
|
+
*/
|
|
3480
|
+
declare function refreshVectorBlends(nodes: readonly VectorNode[]): VectorNode[];
|
|
3481
|
+
/** Expand: the blend as a plain group of its keys and steps (steps get fresh ids). */
|
|
3482
|
+
declare function expandVectorBlend(group: VectorGroupNode, newId: () => string): VectorGroupNode;
|
|
3483
|
+
/**
|
|
3484
|
+
* Release: the blend's keys in the group's parent space (the group's transform and opacity
|
|
3485
|
+
* applied), followed by the replaced spine as an unpainted path when there is one.
|
|
3486
|
+
*/
|
|
3487
|
+
declare function releaseVectorBlend(group: VectorGroupNode, newId: () => string): VectorNode[];
|
|
3488
|
+
|
|
3489
|
+
/** Total arc length of a path (closing lines included). */
|
|
3490
|
+
declare function effectPathLength(path: BezierPath): number;
|
|
3491
|
+
/** Number of on-curve points of a path (a closed subpath's start counted once). */
|
|
3492
|
+
declare function effectPathVertexCount(path: BezierPath): number;
|
|
3493
|
+
/** The fractions of the length a trim keeps, or null when it keeps everything. */
|
|
3494
|
+
declare function trimIntervals(start: number, end: number, offsetDegrees: number): [number, number][] | null;
|
|
3495
|
+
/**
|
|
3496
|
+
* Trim Paths, simultaneously: every path is trimmed by the same fractions of its own length.
|
|
3497
|
+
* `start` / `end` in percent, `offset` in degrees. Paths trimmed away entirely come back empty.
|
|
3498
|
+
*/
|
|
3499
|
+
declare function trimPaths(paths: readonly BezierPath[], start: number, end: number, offsetDegrees?: number): BezierPath[];
|
|
3500
|
+
/**
|
|
3501
|
+
* Trim Paths, individually: the paths are laid end to end in stacking order and trimmed as one
|
|
3502
|
+
* length, so they draw on one after another.
|
|
3503
|
+
*/
|
|
3504
|
+
declare function trimPathsIndividually(paths: readonly BezierPath[], start: number, end: number, offsetDegrees?: number): BezierPath[];
|
|
3505
|
+
/**
|
|
3506
|
+
* Pucker & Bloat (`amount` in percent, −100 to 100). Positive (bloat) moves the points towards
|
|
3507
|
+
* the mean of a path's points and pushes the handles away from it, so the segments bulge
|
|
3508
|
+
* outwards; negative (pucker) does the opposite, giving spiky shapes.
|
|
3509
|
+
*/
|
|
3510
|
+
declare function puckerBloatPaths(paths: readonly BezierPath[], amount: number): BezierPath[];
|
|
3511
|
+
/**
|
|
3512
|
+
* Round Corners: every corner (where the direction jumps) gets a circular arc of `radius`,
|
|
3513
|
+
* shrunk to fit where the sides are short. Smooth points and the ends of open paths are kept.
|
|
3514
|
+
*/
|
|
3515
|
+
declare function roundCornerPaths(paths: readonly BezierPath[], radius: number): BezierPath[];
|
|
3516
|
+
/**
|
|
3517
|
+
* Offset Paths: grows (positive `amount`) or shrinks (negative) every path with the given join.
|
|
3518
|
+
* `copies` copies are made, copy i offset by `amount · (i + 1 + copyOffset)`, all in one path.
|
|
3519
|
+
*/
|
|
3520
|
+
declare function offsetPaths(paths: readonly BezierPath[], amount: number, join?: VectorLineJoin, miterLimit?: number, copies?: number, copyOffset?: number): BezierPath[];
|
|
3521
|
+
/**
|
|
3522
|
+
* Twist: turns the paths about `center` by an angle growing with the distance from it, from 0
|
|
3523
|
+
* at the centre to `angle` degrees at the farthest point. Segments are subdivided and their
|
|
3524
|
+
* handles mapped through the warp's derivative, which keeps the result smooth.
|
|
3525
|
+
*/
|
|
3526
|
+
declare function twistPaths(paths: readonly BezierPath[], angle: number, center: Vec2): BezierPath[];
|
|
3527
|
+
/**
|
|
3528
|
+
* Zig Zag: every segment gets `ridges` ridges: it is split into `ridges + 1` equal pieces and the
|
|
3529
|
+
* points (original ones included) are pushed alternately `size` to either side of the path.
|
|
3530
|
+
* `smooth` makes rounded waves. A closed path of n segments ends up with `n · (ridges + 1)` points
|
|
3531
|
+
* (an open one, one more).
|
|
3532
|
+
*/
|
|
3533
|
+
declare function zigzagPaths(paths: readonly BezierPath[], size: number, ridges: number, smooth?: boolean): BezierPath[];
|
|
3534
|
+
/**
|
|
3535
|
+
* Wiggle Paths: subdivides the paths (`detail` points per segment) and moves every point by
|
|
3536
|
+
* smooth noise of up to `size` that evolves over `time` seconds at `speed` wiggles per second.
|
|
3537
|
+
* The same parameters always give the same result.
|
|
3538
|
+
*/
|
|
3539
|
+
declare function wigglePaths(paths: readonly BezierPath[], w: VectorEffectParamsMap['wiggle']): BezierPath[];
|
|
3540
|
+
/** Merge Paths: the paths (in stacking order, each filled non-zero) combined into one path. */
|
|
3541
|
+
declare function mergePaths(paths: readonly BezierPath[], mode?: VectorMergeMode): BezierPath;
|
|
3542
|
+
/** One copy a repeater makes: its transform (node space) and opacity factor. */
|
|
3543
|
+
interface VectorRepeaterCopy {
|
|
3544
|
+
/** Copy number (0 is the original). */
|
|
3545
|
+
index: number;
|
|
3546
|
+
matrix: AffineMatrix;
|
|
3547
|
+
opacity: number;
|
|
3548
|
+
}
|
|
3549
|
+
/**
|
|
3550
|
+
* The copies of a repeater around `pivot` (the anchor point in node space), in copy order.
|
|
3551
|
+
* Copy i is moved by `translate(position·k) · rotate(rotation·k) · scale^k` about the pivot with
|
|
3552
|
+
* `k = i + offset`; opacity runs from the start to the end opacity across the copies, and a
|
|
3553
|
+
* fractional copy count fades the last copy by its fraction.
|
|
3554
|
+
*/
|
|
3555
|
+
declare function vectorRepeaterCopies(r: VectorEffectParamsMap['repeater'], pivot: Vec2): VectorRepeaterCopy[];
|
|
3556
|
+
/** Each path repeated by `vectorRepeaterCopies` (copy order, the original first). */
|
|
3557
|
+
declare function repeatPaths(paths: readonly BezierPath[], r: VectorEffectParamsMap['repeater'], pivot: Vec2): {
|
|
3558
|
+
copy: VectorRepeaterCopy;
|
|
3559
|
+
paths: BezierPath[];
|
|
3560
|
+
}[];
|
|
3561
|
+
/** The middle of the paths' bounds (the origin when they are empty). */
|
|
3562
|
+
declare function pathsCenter(paths: readonly BezierPath[]): Vec2;
|
|
3563
|
+
|
|
3564
|
+
export { type AddVectorNodeOptions, AffineMatrix, DEFAULT_VECTOR_BLEND_DISTANCE, DEFAULT_VECTOR_BLEND_STEPS, DEFAULT_VECTOR_PATH_EDIT, DEFAULT_VECTOR_SNAP, IDENTITY_MATRIX, KAPPA, LazyMouse, type NearestSegment, type RecognizeInkOptions, SvgGradientDef, VECTOR_ARROWHEADS, VECTOR_ARROWHEAD_LABELS, VECTOR_BLEND_MAX_SMOOTH_STEPS, VECTOR_BLEND_MAX_STEPS, VECTOR_BLEND_SPACINGS, VECTOR_BLEND_SPACING_LABELS, VECTOR_BUILDER_HATCH_GAP, VECTOR_CLIPBOARD_TYPE, VECTOR_CONSTRUCTION_ANGLES, VECTOR_CORNER_KINDS, VECTOR_CORNER_KIND_LABELS, VECTOR_CORNER_WIDGET_INSET, VECTOR_EDIT_TOGGLES, VECTOR_EFFECT_DEFAULTS, VECTOR_EFFECT_LABELS, VECTOR_EFFECT_MENU, VECTOR_EFFECT_PARAM_SPECS, VECTOR_EFFECT_TYPES, VECTOR_FILL_GAP, VECTOR_INK_MAX_CORNERS, VECTOR_MERGE_MODES, VECTOR_OVERLAY_THEME, VECTOR_PATHFINDER_ACTIONS, VECTOR_PATHFINDER_LABELS, VECTOR_PATHFINDER_OPERATIONS, VECTOR_PATH_ACTIONS, VECTOR_PENCIL_STRING_PX, VECTOR_PRESSURE_NOMINAL, VECTOR_ROTATE_HANDLE_OFFSET, VECTOR_STROKE_ALIGN_LABELS, VECTOR_STYLE_KEYS, VECTOR_TOOLS, VECTOR_TOOL_GLYPHS, VECTOR_TOOL_SHORTCUTS, VECTOR_TRANSFORM_HANDLES, VECTOR_WIDTH_PRESETS, VECTOR_WIDTH_PRESET_IDS, VECTOR_WIDTH_PROFILE_MAX_POINTS, VECTOR_WIDTH_PROFILE_MAX_SCALE, VECTOR_WIDTH_SAME_T, type VariableStrokeOptions, type Vec2, type VectorActionResult, type VectorAlign, type VectorAnchor, type VectorAnchorRef, type VectorAnchorType, type VectorAppearanceShape, type VectorArrange, type VectorArrowAlign, type VectorArrowhead, type VectorArrowheadShape, type VectorAverageAxis, type VectorBlend, type VectorBlendControls, type VectorBlendInput, type VectorBlendOptions, type VectorBlendRail, type VectorBlendSpacing, type VectorBlendStart, type VectorBooleanOperand, type VectorBooleanOperation, type VectorBounds, type VectorBuilderHit, type VectorBuilderLinePiece, type VectorBuilderPreview, type VectorBuilderReplacement, type VectorBuilderTouched, type VectorCommandOptions, type VectorCorner, type VectorCornerInfo, type VectorCornerKind, type VectorCornerWidget, type VectorDefaults, type VectorDistribute, type VectorDocument, VectorEditorController, type VectorEditorOptions, type VectorEditorState, type VectorEffect, type VectorEffectParamSpec, type VectorEffectParamsMap, type VectorEffectType, type VectorEffectsPanelData, type VectorEffectsPanelItem, type VectorFillRule, type VectorGroupNode, type VectorGuideKind, type VectorGuideLabel, type VectorGuideLine, type VectorHandleRef, type VectorHitTestOptions, type VectorHover, type VectorInkShape, type VectorInteraction, type VectorKeyInput, type VectorLineCap, type VectorLineJoin, type VectorMatrix, type VectorMergeMode, type VectorModifiers, type VectorMorph, type VectorMorphContour, type VectorMorphCorrespondence, type VectorMorphOptions, type VectorNode, type VectorNodeListing, type VectorOverlayRenderData, type VectorPaint, type VectorPathAction, type VectorPathEditOptions, type VectorPathEntry, type VectorPathKeyframe, type VectorPathNode, type VectorPathfinderAction, type VectorPathfinderOperation, type VectorPathfinderPaint, type VectorPointSnap, type VectorPointerInput, type VectorRectSnap, type VectorRenderAnchor, type VectorRenderCornerWidget, type VectorRenderGroup, type VectorRenderGuideLabel, type VectorRenderGuideLine, type VectorRenderHandle, type VectorRenderNode, type VectorRenderPath, type VectorRenderStrokeParts, type VectorRenderWidthPoint, type VectorRepeaterCopy, type VectorScaleSnap, type VectorSceneRenderData, type VectorSegmentRef, type VectorSelectionBoxGeometry, type VectorSelectionFrame, type VectorSelectionStyle, type VectorShapeBuilderFace, type VectorShapeBuilderMap, type VectorShapeBuilderPlan, type VectorShapeBuilderResult, type VectorShapeInput, type VectorSnapGuides, type VectorSnapKind, type VectorSnapLeave, type VectorSnapOptions, VectorSnapTargets, type VectorStrokeAlign, type VectorStrokeParts, type VectorStrokeSpot, type VectorStyle, type VectorSubpath, type VectorSvgExportOptions, type VectorSvgImportOptions, type VectorTaperOptions, type VectorTool, type VectorTransformHandle, type VectorViewport, type VectorWaveOptions, type VectorWidthHandle, type VectorWidthPoint, type VectorWidthPointEdit, type VectorWidthPointRef, type VectorWidthPreset, type VectorWidthPresetInfo, activeVectorEffects, addBuilderHit, applyMatrix, applyMatrixLinear, applyVectorBlendOptions, applyVectorCornersAttribute, applyVectorEffects, arrowheadInset, arrowheadPath, arrowheadWeight, bendSegment, bezierToSubpaths, boundsFromPoints, boundsIntersect, clearVectorLiveBooleanCache, cloneAnchor, cloneSubpath, cloneVectorDocument, cloneVectorNode, collectPathNodes, constrainToLeave, convertAnchor, cornerBisectorPoint, cornerRadiusChange, cornerSetback, correspondMorphContours, createVectorCommands, createVectorEffect, createVectorMorph, curvatureMoveAnchor, cutSubpathAt, dashIntervals, decomposeRigid, effectPathLength, effectPathVertexCount, effectiveStrokeAlign, ellipseSubpath, eraseFromFill, eraseFromOutline, eraserRegion, evaluateVectorPathKeyframes, expandVectorAppearance, expandVectorAppearances, expandVectorBlend, expandVectorCorners, expandVectorCornersOf, findVectorNode, fitCornerRadius, foldVectorBooleanOperands, generateVectorBlendChildren, generateWidthProfile, getAnchor, getAnchorWorld, getEditablePathIds, getTransformHandlePositions, getVectorBlendControls, getVectorCornerWidgets, getVectorEffectsPanel, getVectorEnteredGroups, getVectorOverlayRenderData, getVectorSceneRenderData, getVectorSelectionBoxGeometry, getVectorSelectionFrame, getVectorSelectionStyle, getVectorWidthHandles, getVisibleAnchors, getVisibleHandles, hasOwnVectorAppearance, hasPaint, hasStrokeExtras, hasVectorAppearance, hasVectorCorners, hitTestVectorNode, hitTestVectorNodes, hitTestVectorStroke, inferAnchorType, insertAnchor, insertWidthPoint, interpolateMorphContours, interpolateRigidMatrix, interpolateVectorColor, interpolateVectorPaint, interpolateVectorPaths, interpolateVectorStyle, interpolateWidthProfiles, invertMatrix, isClosedBezierShape, isIdentityMatrix, isUniformWidthProfile, isVectorBlendGroup, isVectorLiveBoolean, isVectorTextTarget, joinSubpaths, knifePath, lineSubpath, locateVectorNode, matrixRotation, mergePaths, mirrorWidthProfile, morphContourToSubpath, morphPathsCross, moveAnchorHandle, multiplyMatrices, nearestSegment, nearestStrokePosition, nextVectorCornerKind, nodeMatrix, normalizeVectorEffectParams, offsetPaths, parseSvgTransform, parseVectorSvg, pathsCenter, planShapeBuilder, polygonSubpath, polylineBounds, pressureWidthProfile, puckerBloatPaths, recognizeInkShape, rectSubpath, refineMorphContour, refreshVectorBlends, releaseVectorBlend, removeAnchorKeepingShape, removeAnchors, removeAnchorsKeepingShape, removeRedundantPoints, removeWidthPoints, repeatPaths, resampleGradientStops, resolveVectorBlendOptions, reverseMorphContour, reverseSubpath, reverseWidthProfile, rotateMatrix, roundCornerPaths, roundSubpaths, samplePolyline, sanitizeVectorEffects, sanitizeWidthProfile, scaleFor, scaleMatrix, setAnchorCorner, setSubpathCorners, setWidthPoint, simplifyPolyline, smoothSubpath, splitIntoFaces, splitSubpathAt, starSubpath, strokePositionPoint, strokeWidthProfileOf, subpathEnclosesArea, subpathPointAt, subpathSegment, subpathSegmentCount, subpathToMorphContour, subpathsToBezier, taperWaveFactor, toVectorKeyInput, toVectorModifiers, toVectorPointerInput, transformVectorEffects, transformVectorNode, translateAnchor, translateMatrix, trimIntervals, trimPaths, trimPathsIndividually, turnMorphContour, twistPaths, unionBounds, variableStrokeOutline, variableStrokeRings, vectorAppearanceNodes, vectorAppearanceOutline, vectorAppearanceShapes, vectorBlendColorDistance, vectorBlendKeyTargets, vectorBlendKeys, vectorBlendRail, vectorBlendRailAt, vectorBlendSpine, vectorBlendStepCount, vectorBuilderErasedEdges, vectorCornerAt, vectorCorners, vectorCornersAttribute, vectorDiamondPath, vectorDocumentToSvg, vectorEnteredGroups, vectorFillMap, vectorInkShapeName, vectorLiveBooleanSteps, vectorNodeBounds, vectorNodeRotation, vectorNodeToBezier, vectorOperandOperation, vectorPaintToHex, vectorPaintToSvg, vectorParentMatrix, vectorPathData, vectorPathEntries, vectorPathWorldBezier, vectorPathfinderShape, vectorRepeaterCopies, vectorResizeCursor, vectorResultStyle, vectorShapeBuilderHit, vectorShapeBuilderMap, vectorStrokeLineArea, vectorStrokeOutline, vectorStrokeOutlinePath, vectorStrokeParts, vectorStrokeReach, vectorStrokeSvgParts, vectorStrokeWidthGeometry, vectorToolLabel, vectorWorldMatrix, walkVectorNodes, widthProfileAt, widthProfileFromAttribute, widthProfileMaxScale, widthProfilePreset, widthProfilePresetId, widthProfileToAttribute, wigglePaths, zigzagPaths };
|