@pixerate/editor 0.43.0 → 0.44.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 +4 -0
- package/dist/vector/index.cjs +1982 -301
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +622 -152
- package/dist/vector/index.d.ts +622 -152
- package/dist/vector/index.js +1755 -74
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vector/index.d.ts
CHANGED
|
@@ -319,9 +319,10 @@ interface VectorHandleRef extends VectorAnchorRef {
|
|
|
319
319
|
* `shapeBuilder` merges (Alt: deletes) the faces the selected shapes make, and `paintBucket`
|
|
320
320
|
* fills the region the visible outlines enclose around a click with a new shape. `blend`
|
|
321
321
|
* blends the shape clicked first into the one clicked next (clicking an anchor of a closed path
|
|
322
|
-
* starts the blend there).
|
|
322
|
+
* starts the blend there). `envelope` edits the mesh of the selection's envelope: drag its
|
|
323
|
+
* anchors and handles, or inside a patch to pull the surface.
|
|
323
324
|
*/
|
|
324
|
-
type VectorTool = 'select' | 'direct' | 'pen' | 'pencil' | 'rect' | 'ellipse' | 'polygon' | 'star' | 'line' | 'scissors' | 'knife' | 'eraser' | 'width' | 'shapeBuilder' | 'paintBucket' | 'blend' | 'gradient';
|
|
325
|
+
type VectorTool = 'select' | 'direct' | 'pen' | 'pencil' | 'rect' | 'ellipse' | 'polygon' | 'star' | 'line' | 'scissors' | 'knife' | 'eraser' | 'width' | 'shapeBuilder' | 'paintBucket' | 'blend' | 'gradient' | 'envelope';
|
|
325
326
|
declare const VECTOR_TOOLS: readonly VectorTool[];
|
|
326
327
|
/** Keyboard modifiers held during a pointer event. */
|
|
327
328
|
interface VectorModifiers {
|
|
@@ -370,10 +371,24 @@ type VectorAverageAxis = 'horizontal' | 'vertical' | 'both';
|
|
|
370
371
|
/**
|
|
371
372
|
* Live path effects (After Effects' path operators): `trim` (Trim Paths), `roundCorners`,
|
|
372
373
|
* `puckerBloat`, `twist`, `zigzag`, `wiggle` (Wiggle Paths), `offset` (Offset Paths), `merge`
|
|
373
|
-
* (Merge Paths) and `
|
|
374
|
+
* (Merge Paths), `repeater` and `envelope` (an envelope distortion: a warp preset or a mesh).
|
|
374
375
|
*/
|
|
375
|
-
type VectorEffectType = 'trim' | 'roundCorners' | 'puckerBloat' | 'twist' | 'zigzag' | 'wiggle' | 'offset' | 'merge' | 'repeater';
|
|
376
|
+
type VectorEffectType = 'trim' | 'roundCorners' | 'puckerBloat' | 'twist' | 'zigzag' | 'wiggle' | 'offset' | 'merge' | 'repeater' | 'envelope';
|
|
376
377
|
declare const VECTOR_EFFECT_TYPES: readonly VectorEffectType[];
|
|
378
|
+
/** Warp presets (Photoshop's fifteen, in menu order). */
|
|
379
|
+
type VectorWarpStyle = 'arc' | 'arcLower' | 'arcUpper' | 'arch' | 'bulge' | 'shellLower' | 'shellUpper' | 'flag' | 'wave' | 'fish' | 'rise' | 'fisheye' | 'inflate' | 'squeeze' | 'twist';
|
|
380
|
+
/**
|
|
381
|
+
* A grid of bicubic Bézier patches mapping a source box onto the plane. `us` / `vs` are the patch
|
|
382
|
+
* boundaries as fractions of the box (increasing, first 0, last 1); `points` is the
|
|
383
|
+
* `(3·(us.length − 1) + 1) × (3·(vs.length − 1) + 1)` control grid, row by row, in the node's own
|
|
384
|
+
* space. Neighbouring patches share their edge row: anchors sit where both indices are multiples
|
|
385
|
+
* of 3, handles where one is.
|
|
386
|
+
*/
|
|
387
|
+
interface VectorWarpMesh {
|
|
388
|
+
us: number[];
|
|
389
|
+
vs: number[];
|
|
390
|
+
points: Vec2[];
|
|
391
|
+
}
|
|
377
392
|
/** Merge Paths modes: a compound path (no boolean), union, the first minus the others, intersection or exclusion. */
|
|
378
393
|
type VectorMergeMode = 'merge' | 'add' | 'subtract' | 'intersect' | 'exclude';
|
|
379
394
|
declare const VECTOR_MERGE_MODES: readonly VectorMergeMode[];
|
|
@@ -458,6 +473,23 @@ interface VectorEffectParamsMap {
|
|
|
458
473
|
/** `below`: each copy draws under the one before it; `above`: over it. */
|
|
459
474
|
composite: 'below' | 'above';
|
|
460
475
|
};
|
|
476
|
+
/**
|
|
477
|
+
* Envelope distortion: the paths above it are mapped from their combined bounds through a warp
|
|
478
|
+
* preset (bend and horizontal / vertical distortion in percent) or, with style `mesh`, through
|
|
479
|
+
* `mesh` (null: the flat mesh of `columns × rows` patches over the bounds). The bounds are
|
|
480
|
+
* taken afresh each time, so editing the contents keeps the envelope.
|
|
481
|
+
*/
|
|
482
|
+
envelope: {
|
|
483
|
+
style: VectorWarpStyle | 'mesh';
|
|
484
|
+
bend: number;
|
|
485
|
+
horizontal: number;
|
|
486
|
+
vertical: number;
|
|
487
|
+
orientation: 'horizontal' | 'vertical';
|
|
488
|
+
/** Patches of the mesh (a preset turns into a mesh of this size when it is edited). */
|
|
489
|
+
rows: number;
|
|
490
|
+
columns: number;
|
|
491
|
+
mesh: VectorWarpMesh | null;
|
|
492
|
+
};
|
|
461
493
|
}
|
|
462
494
|
/** One entry of an effect stack. */
|
|
463
495
|
type VectorEffect = {
|
|
@@ -784,6 +816,15 @@ declare function pinVectorGradient(g: VectorGradient, bounds: VectorBounds | nul
|
|
|
784
816
|
* three points span); a box gradient follows the box and is unchanged.
|
|
785
817
|
*/
|
|
786
818
|
declare function transformVectorGradient(g: VectorGradient, m: VectorMatrix): VectorGradient;
|
|
819
|
+
/**
|
|
820
|
+
* A gradient after its node's geometry goes through a non-affine map `f` (Free Distort, an
|
|
821
|
+
* envelope): handles in the node's own space (`userSpaceOnUse`) are mapped point by point, which
|
|
822
|
+
* keeps the gradient's frame where the shape went; bounding-box gradients are left alone, as they
|
|
823
|
+
* already follow the shape's new bounds.
|
|
824
|
+
*/
|
|
825
|
+
declare function mapVectorGradient(g: VectorGradient, f: (p: Vec2) => Vec2): VectorGradient;
|
|
826
|
+
/** A paint after its node's geometry goes through a non-affine map `f` (see `mapVectorGradient`). */
|
|
827
|
+
declare function mapVectorPaint<T extends VectorPaint | undefined>(paint: T, f: (p: Vec2) => Vec2): T;
|
|
787
828
|
/** A paint after its node's geometry is mapped by `m` (colours unchanged). */
|
|
788
829
|
declare function transformVectorPaint<T extends VectorPaint | undefined>(paint: T, m: VectorMatrix): T;
|
|
789
830
|
/**
|
|
@@ -1256,6 +1297,246 @@ declare function vectorGradientBarPosition(a: Pick<VectorGradientAnnotator, 'sta
|
|
|
1256
1297
|
/** The annotator part under screen point `p`: stops, then midpoints, the handles and the bar. */
|
|
1257
1298
|
declare function hitVectorGradientAnnotator(a: VectorGradientAnnotator, p: Vec2): VectorGradientPart | null;
|
|
1258
1299
|
|
|
1300
|
+
/**
|
|
1301
|
+
* Live appearance: path effect stacks and live boolean groups, evaluated on demand while the
|
|
1302
|
+
* stored anchors and children stay editable.
|
|
1303
|
+
*
|
|
1304
|
+
* `expandVectorAppearance` is the one place the effected geometry is made (cached per node
|
|
1305
|
+
* object, so an edit recomputes only the nodes it replaced). Rendering, hit-testing, bounds,
|
|
1306
|
+
* snapping, booleans, the Pathfinder, the Shape Builder and SVG export all read it, the way they
|
|
1307
|
+
* read live corners through `subpathsToBezier`; Expand Appearance stores it.
|
|
1308
|
+
*
|
|
1309
|
+
* Stacking follows After Effects' shape layers (effectcraft `crates/render/src/shapes.rs`): an
|
|
1310
|
+
* effect acts on every path above it — the node's own outline, or for a group every path of its
|
|
1311
|
+
* children (nested groups included, as drawn by their own effects) — in the order of the stack,
|
|
1312
|
+
* and effects placed after a repeater act on its copies. The result paints with the style of the
|
|
1313
|
+
* path each shape came from; Merge Paths and live booleans paint with the bottom one's.
|
|
1314
|
+
*
|
|
1315
|
+
* Live booleans fold their operands bottom to top, each combined with the result below it by its
|
|
1316
|
+
* own operation or the group's, and every prefix of the fold is cached under a rolling hash of the
|
|
1317
|
+
* operands it covers, so editing one operand recombines only the operands from it up; the cache
|
|
1318
|
+
* drops its least recently used half when full. Live groups are hit by their result except while
|
|
1319
|
+
* they are being edited (`vectorEnteredGroups`).
|
|
1320
|
+
*
|
|
1321
|
+
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
1322
|
+
* THIRD_PARTY_NOTICES.md): the stacking rule of effectcraft `crates/render/src/shapes.rs`
|
|
1323
|
+
* (`collect()`); figcraft `crates/render/src/boolean.rs` (`fold_cached`, `PathCache`) and
|
|
1324
|
+
* `crates/engine/src/booleans.rs` (`operand_op`, `result_outline`); and the live-object model of
|
|
1325
|
+
* vectorcraft `crates/doc/src/live.rs` (`expand_live`, `expanded_group`, `subtree_has_live`).
|
|
1326
|
+
*/
|
|
1327
|
+
|
|
1328
|
+
/** One shape of a node's appearance: a path in the node's own space, painted in `source`'s style. */
|
|
1329
|
+
interface VectorAppearanceShape {
|
|
1330
|
+
/** The path whose style paints it. */
|
|
1331
|
+
source: VectorPathNode;
|
|
1332
|
+
path: BezierPath;
|
|
1333
|
+
/** Opacity factor relative to the node (its own opacity not included). */
|
|
1334
|
+
opacity: number;
|
|
1335
|
+
/** Draw-order key (compared element by element). */
|
|
1336
|
+
order: number[];
|
|
1337
|
+
}
|
|
1338
|
+
/** Default parameters of each effect type. */
|
|
1339
|
+
declare const VECTOR_EFFECT_DEFAULTS: {
|
|
1340
|
+
readonly [K in VectorEffectType]: VectorEffectParamsMap[K];
|
|
1341
|
+
};
|
|
1342
|
+
declare const VECTOR_EFFECT_LABELS: Record<VectorEffectType, string>;
|
|
1343
|
+
/** How a panel edits one effect parameter. */
|
|
1344
|
+
type VectorEffectParamSpec = {
|
|
1345
|
+
key: string;
|
|
1346
|
+
label: string;
|
|
1347
|
+
kind: 'number';
|
|
1348
|
+
min?: number;
|
|
1349
|
+
max?: number;
|
|
1350
|
+
step: number;
|
|
1351
|
+
slider?: boolean;
|
|
1352
|
+
} | {
|
|
1353
|
+
key: string;
|
|
1354
|
+
label: string;
|
|
1355
|
+
kind: 'vec2';
|
|
1356
|
+
step: number;
|
|
1357
|
+
} | {
|
|
1358
|
+
key: string;
|
|
1359
|
+
label: string;
|
|
1360
|
+
kind: 'boolean';
|
|
1361
|
+
} | {
|
|
1362
|
+
key: string;
|
|
1363
|
+
label: string;
|
|
1364
|
+
kind: 'select';
|
|
1365
|
+
options: {
|
|
1366
|
+
value: string;
|
|
1367
|
+
label: string;
|
|
1368
|
+
}[];
|
|
1369
|
+
};
|
|
1370
|
+
/** The editable parameters of each effect type, in panel order. */
|
|
1371
|
+
declare const VECTOR_EFFECT_PARAM_SPECS: Record<VectorEffectType, VectorEffectParamSpec[]>;
|
|
1372
|
+
/** Envelope parameters. */
|
|
1373
|
+
type VectorEnvelopeParams = VectorEffectParamsMap['envelope'];
|
|
1374
|
+
/**
|
|
1375
|
+
* The envelope's mesh over `bounds` (the paths' combined bounds), in the node's space: its own
|
|
1376
|
+
* mesh, the flat mesh of `columns × rows` patches, or a preset split exactly into that many patches.
|
|
1377
|
+
*/
|
|
1378
|
+
declare function vectorEnvelopeMesh(params: VectorEnvelopeParams, bounds: VectorBounds): VectorWarpMesh;
|
|
1379
|
+
/** The envelope as a map of the node's space over `bounds`, or null when it changes nothing (or the box is empty). */
|
|
1380
|
+
declare function vectorEnvelopeMap(params: VectorEnvelopeParams, bounds: VectorBounds | null): ((p: {
|
|
1381
|
+
x: number;
|
|
1382
|
+
y: number;
|
|
1383
|
+
}) => {
|
|
1384
|
+
x: number;
|
|
1385
|
+
y: number;
|
|
1386
|
+
}) | null;
|
|
1387
|
+
/**
|
|
1388
|
+
* Effect parameters with defaults filled in and invalid values dropped (unknown keys go too).
|
|
1389
|
+
* Returns null for an unknown type.
|
|
1390
|
+
*/
|
|
1391
|
+
declare function normalizeVectorEffectParams<K extends VectorEffectType>(type: K, params: Record<string, unknown> | null | undefined, base?: VectorEffectParamsMap[K]): VectorEffectParamsMap[K] | null;
|
|
1392
|
+
/** A new effect of `type` (defaults merged with `params`), or null for an unknown type. */
|
|
1393
|
+
declare function createVectorEffect<K extends VectorEffectType>(type: K, id: string, params?: Partial<VectorEffectParamsMap[K]> | Record<string, unknown>): Extract<VectorEffect, {
|
|
1394
|
+
type: K;
|
|
1395
|
+
}> | null;
|
|
1396
|
+
/** The node's effects that take part (enabled, of a known type). */
|
|
1397
|
+
declare function activeVectorEffects(node: VectorNode): VectorEffect[];
|
|
1398
|
+
/** Whether the node itself draws differently from its stored geometry (effects or a live boolean). */
|
|
1399
|
+
declare function hasOwnVectorAppearance(node: VectorNode): boolean;
|
|
1400
|
+
/** Whether the node or anything inside it has a live appearance. */
|
|
1401
|
+
declare function hasVectorAppearance(node: VectorNode): boolean;
|
|
1402
|
+
/** A live boolean group (its children are operands). */
|
|
1403
|
+
declare function isVectorLiveBoolean(node: VectorNode | null | undefined): node is VectorGroupNode & {
|
|
1404
|
+
liveBoolean: VectorBooleanOperation;
|
|
1405
|
+
};
|
|
1406
|
+
/** How operand `child` of a live boolean group combines with the operands below it. */
|
|
1407
|
+
declare function vectorOperandOperation(group: VectorGroupNode, child: VectorNode): VectorBooleanOperation;
|
|
1408
|
+
/** How many boolean steps (one operand combined with the result below it) live booleans have computed: what a cache miss costs. */
|
|
1409
|
+
declare function vectorLiveBooleanSteps(): number;
|
|
1410
|
+
/** Empties the live boolean prefix cache. */
|
|
1411
|
+
declare function clearVectorLiveBooleanCache(): void;
|
|
1412
|
+
/** One operand of a live boolean: its outline (group space), fill rule and operation (unused for the bottom one). */
|
|
1413
|
+
interface VectorBooleanOperand {
|
|
1414
|
+
path: BezierPath;
|
|
1415
|
+
fillRule: VectorFillRule;
|
|
1416
|
+
operation: VectorBooleanOperation;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* The result of folding `operands` bottom to top, reusing the longest cached prefix: only the
|
|
1420
|
+
* operands above it are combined. Invalid geometry gives an empty path.
|
|
1421
|
+
*/
|
|
1422
|
+
declare function foldVectorBooleanOperands(operands: readonly VectorBooleanOperand[]): BezierPath;
|
|
1423
|
+
/** Applies an effect stack to shapes, top to bottom (disabled effects skipped). */
|
|
1424
|
+
declare function applyVectorEffects(shapes: readonly VectorAppearanceShape[], effects: readonly VectorEffect[] | null | undefined): VectorAppearanceShape[];
|
|
1425
|
+
/** The paths entering effect `effectId` of the node's stack (those above it applied), in the node's own space. */
|
|
1426
|
+
declare function vectorEffectInputPaths(node: VectorNode, effectId: string): BezierPath[] | null;
|
|
1427
|
+
/** The box effect `effectId` (an envelope) bends: the combined bounds of the paths entering it, in the node's own space. */
|
|
1428
|
+
declare function vectorEffectInputBounds(node: VectorNode, effectId: string): VectorBounds | null;
|
|
1429
|
+
/** The node's first enabled envelope effect, or null. */
|
|
1430
|
+
declare function vectorNodeEnvelope(node: VectorNode | null | undefined): Extract<VectorEffect, {
|
|
1431
|
+
type: 'envelope';
|
|
1432
|
+
}> | null;
|
|
1433
|
+
/**
|
|
1434
|
+
* The editable mesh of a node's envelope (its own mesh, or the preset or flat mesh it stands for)
|
|
1435
|
+
* with the box it bends, in the node's own space; null without an envelope or contents.
|
|
1436
|
+
*/
|
|
1437
|
+
declare function vectorEnvelopeFrame(node: VectorNode, effectId?: string): {
|
|
1438
|
+
effectId: string;
|
|
1439
|
+
bounds: VectorBounds;
|
|
1440
|
+
mesh: VectorWarpMesh;
|
|
1441
|
+
} | null;
|
|
1442
|
+
/**
|
|
1443
|
+
* What a node draws as: shapes in its own space (its `transform` and opacity not applied),
|
|
1444
|
+
* bottom to top, with its effects and those of everything inside it applied. Cached per node
|
|
1445
|
+
* object.
|
|
1446
|
+
*/
|
|
1447
|
+
declare function vectorAppearanceShapes(node: VectorNode): VectorAppearanceShape[];
|
|
1448
|
+
/** Everything a node draws as one path in its own space (live corners cut, effects applied). */
|
|
1449
|
+
declare function vectorAppearanceOutline(node: VectorNode): BezierPath;
|
|
1450
|
+
/** What a node draws as, one plain path per shape (ids `<id>~fx<n>`, opacity relative to the node). */
|
|
1451
|
+
declare function vectorAppearanceNodes(node: VectorNode): VectorPathNode[];
|
|
1452
|
+
/**
|
|
1453
|
+
* The node as plain geometry: path effects and live booleans evaluated into paths (the node
|
|
1454
|
+
* itself when nothing inside it is live). A path keeps its id when it draws as one shape;
|
|
1455
|
+
* otherwise, like any live group, it becomes a group with that id holding one path per shape
|
|
1456
|
+
* (ids `<id>~fx<n>`). Groups without effects of their own keep their structure. Cached per node.
|
|
1457
|
+
*/
|
|
1458
|
+
declare function expandVectorAppearance(node: VectorNode): VectorNode;
|
|
1459
|
+
/** Every node of a list expanded (the same array when nothing in it is live). */
|
|
1460
|
+
declare function expandVectorAppearances(nodes: readonly VectorNode[]): VectorNode[];
|
|
1461
|
+
/**
|
|
1462
|
+
* Reads effects from untrusted data (JSON, agent input): unknown types and malformed entries are
|
|
1463
|
+
* dropped, parameters normalized, ids made unique.
|
|
1464
|
+
*/
|
|
1465
|
+
declare function sanitizeVectorEffects(value: unknown): VectorEffect[];
|
|
1466
|
+
/**
|
|
1467
|
+
* Effect parameters carried through a linear map baked into a node's geometry (scaling or
|
|
1468
|
+
* flipping it): offsets and positions move with it, angles turn the other way when it mirrors.
|
|
1469
|
+
* Lengths such as sizes and radii are kept, like stroke widths.
|
|
1470
|
+
*/
|
|
1471
|
+
declare function transformVectorEffects(effects: readonly VectorEffect[], m: AffineMatrix, node?: VectorNode): VectorEffect[];
|
|
1472
|
+
/**
|
|
1473
|
+
* The live groups (live booleans and groups with effects) being edited: those in `ids` and those
|
|
1474
|
+
* holding a node in `ids`. Their children are hit and outlined as stored instead of as drawn, so
|
|
1475
|
+
* each operand can be picked (figcraft `crates/engine/src/booleans.rs`, `result_outline`).
|
|
1476
|
+
*/
|
|
1477
|
+
declare function vectorEnteredGroups(nodes: readonly VectorNode[], ids: readonly string[]): Set<string>;
|
|
1478
|
+
|
|
1479
|
+
/** A map of the plane (document or node space). */
|
|
1480
|
+
type VectorPointMap = (p: Vec2) => Vec2;
|
|
1481
|
+
/** Every anchor and handle of `subpaths` through `f` (no subdivision). */
|
|
1482
|
+
declare function mapVectorPoints(subpaths: readonly VectorSubpath[], f: VectorPointMap): VectorSubpath[];
|
|
1483
|
+
interface MapVectorSubpathsOptions {
|
|
1484
|
+
/** Refit runs of split pieces with fewer cubics where they stay within the tolerance (default true). */
|
|
1485
|
+
refit?: boolean;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* `subpaths` through a smooth, possibly non-linear map `f`: each segment is split in halves until
|
|
1489
|
+
* its mapped control points follow the mapped curve within `tolerance` (at most 64 pieces a
|
|
1490
|
+
* segment, fewer for huge paths), then refitted with fewer cubics where possible. A straight
|
|
1491
|
+
* segment whose image is straight stays a straight segment; anchors keep their types and live
|
|
1492
|
+
* corners, and the anchors added are smooth.
|
|
1493
|
+
*/
|
|
1494
|
+
declare function mapVectorSubpaths(subpaths: readonly VectorSubpath[], f: VectorPointMap, tolerance?: number, options?: MapVectorSubpathsOptions): VectorSubpath[];
|
|
1495
|
+
/** `mapVectorSubpaths` for Bézier commands (live corners are not involved). */
|
|
1496
|
+
declare function mapBezierPath(path: BezierPathInput, f: VectorPointMap, tolerance?: number, options?: MapVectorSubpathsOptions): BezierPath;
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* Free Distort, perspective and skew: the selection box's corners or sides dragged, and nodes sent
|
|
1500
|
+
* through a map of document space while each keeps its own (rigid) transform.
|
|
1501
|
+
*
|
|
1502
|
+
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
1503
|
+
* THIRD_PARTY_NOTICES.md): vectorcraft `crates/tools/src/xform/free.rs` (`distort_quad`: a corner
|
|
1504
|
+
* moved freely, or with its partner mirrored along the dominant axis for perspective, and a side's
|
|
1505
|
+
* two corners moved together; `shear_for_side`: a side handle shears about the opposite side, or
|
|
1506
|
+
* the centre with Alt).
|
|
1507
|
+
*/
|
|
1508
|
+
|
|
1509
|
+
/** Default tolerance (document units) of Free Distort's adaptive path mapping. */
|
|
1510
|
+
declare const VECTOR_DISTORT_TOLERANCE = 0.05;
|
|
1511
|
+
/** How dragging a selection box handle distorts it: each corner freely, or in symmetric perspective. */
|
|
1512
|
+
type VectorDistortMode = 'distort' | 'perspective';
|
|
1513
|
+
/** A box's corners clockwise from the top left. */
|
|
1514
|
+
declare const vectorBoxCorners: (b: VectorBounds) => Vec2[];
|
|
1515
|
+
/**
|
|
1516
|
+
* The quad (clockwise from the top left) box `b` becomes when handle `handle` is dragged by `d`: a
|
|
1517
|
+
* corner moves by `d` (`distort`), or along the drag's dominant axis with the corner beside it on
|
|
1518
|
+
* that side moving the opposite way (`perspective`); a side moves both its corners.
|
|
1519
|
+
*/
|
|
1520
|
+
declare function vectorDistortQuad(b: VectorBounds, handle: VectorTransformHandle, d: Vec2, mode?: VectorDistortMode): Vec2[];
|
|
1521
|
+
/**
|
|
1522
|
+
* The skew for dragging side `handle` of box `b` by `d`: along that side, about the opposite side
|
|
1523
|
+
* (or the centre, `fromCenter`). Corners give the identity.
|
|
1524
|
+
*/
|
|
1525
|
+
declare function vectorShearForSide(b: VectorBounds, handle: VectorTransformHandle, d: Vec2, fromCenter?: boolean): AffineMatrix;
|
|
1526
|
+
/**
|
|
1527
|
+
* A skew by `ax` degrees horizontally (vertical lines lean right for positive angles: x' = x + tan(ax)·y)
|
|
1528
|
+
* and `ay` degrees vertically (y' = y + tan(ay)·x), about `origin`.
|
|
1529
|
+
*/
|
|
1530
|
+
declare function vectorSkewMatrix(ax: number, ay: number, origin?: Vec2): AffineMatrix;
|
|
1531
|
+
/**
|
|
1532
|
+
* A node sent through `f`, a map of the space `parentToDoc` maps its parent to (the document):
|
|
1533
|
+
* every anchor and handle is mapped in the node's own space, adaptively so curves stay within
|
|
1534
|
+
* `tolerance`, and the node keeps its rigid `transform`. Gradients in the node's space have their
|
|
1535
|
+
* handles mapped (bounding-box ones follow the new bounds), envelope meshes and a blend's spine
|
|
1536
|
+
* are mapped too; stroke widths, live corner radii and effect parameters are kept.
|
|
1537
|
+
*/
|
|
1538
|
+
declare function distortVectorNode<T extends VectorNode>(node: T, parentToDoc: AffineMatrix, f: VectorPointMap, tolerance?: number): T;
|
|
1539
|
+
|
|
1259
1540
|
/**
|
|
1260
1541
|
* What a guide line shows: `align` lines run from a target through the snapped point or box,
|
|
1261
1542
|
* `construction` lines from where a drawn point leaves, `spacing` marks equal gaps and `size`
|
|
@@ -1524,6 +1805,8 @@ interface VectorEditorOptions {
|
|
|
1524
1805
|
createId?: () => string;
|
|
1525
1806
|
/** Called after the document changes (edits, undo, redo, load). */
|
|
1526
1807
|
onChange?: (document: VectorDocument) => void;
|
|
1808
|
+
/** Start in Free Distort mode (see `setFreeDistort`). */
|
|
1809
|
+
freeDistort?: boolean;
|
|
1527
1810
|
}
|
|
1528
1811
|
/** A pointer event as the controller needs it. Positions are in screen pixels relative to the canvas. */
|
|
1529
1812
|
interface VectorPointerInput extends VectorModifiers {
|
|
@@ -1595,6 +1878,11 @@ interface VectorHover {
|
|
|
1595
1878
|
strokeSpot?: VectorStrokeSpot;
|
|
1596
1879
|
/** A part of the gradient annotator (gradient tool). */
|
|
1597
1880
|
gradient?: VectorGradientPart;
|
|
1881
|
+
/** A control point of the selected envelope's mesh (`index`), or a spot inside it (`index` null): Envelope tool. */
|
|
1882
|
+
envelope?: {
|
|
1883
|
+
nodeId: string;
|
|
1884
|
+
index: number | null;
|
|
1885
|
+
};
|
|
1598
1886
|
}
|
|
1599
1887
|
/** The drag in progress, for overlays and status text. */
|
|
1600
1888
|
type VectorInteraction = {
|
|
@@ -1656,6 +1944,18 @@ type VectorInteraction = {
|
|
|
1656
1944
|
part: 'create' | VectorGradientPart['kind'];
|
|
1657
1945
|
handle?: VectorGradientHandle;
|
|
1658
1946
|
removing?: boolean;
|
|
1947
|
+
}
|
|
1948
|
+
/** Free Distort: the selection box's corners as dragged so far (document space, clockwise from the top left). */
|
|
1949
|
+
| {
|
|
1950
|
+
type: 'distort';
|
|
1951
|
+
mode: VectorDistortMode | 'skew';
|
|
1952
|
+
corners: Vec2[];
|
|
1953
|
+
}
|
|
1954
|
+
/** Envelope tool: a mesh point (`index`) or the surface (`index` null) being dragged. */
|
|
1955
|
+
| {
|
|
1956
|
+
type: 'envelope';
|
|
1957
|
+
nodeId: string;
|
|
1958
|
+
index: number | null;
|
|
1659
1959
|
} | {
|
|
1660
1960
|
type: 'pan';
|
|
1661
1961
|
};
|
|
@@ -1706,6 +2006,12 @@ interface VectorEditorState {
|
|
|
1706
2006
|
target: VectorGradientTarget;
|
|
1707
2007
|
stop: number | null;
|
|
1708
2008
|
};
|
|
2009
|
+
/**
|
|
2010
|
+
* Free Distort mode of the selection box: dragging a corner distorts in perspective (each corner
|
|
2011
|
+
* on its own; Shift+Alt+Mod: symmetric perspective), a side moves its two corners, and Mod-dragging
|
|
2012
|
+
* a side skews along it (Alt: about the centre).
|
|
2013
|
+
*/
|
|
2014
|
+
freeDistort: boolean;
|
|
1709
2015
|
canUndo: boolean;
|
|
1710
2016
|
canRedo: boolean;
|
|
1711
2017
|
undoLabel: string;
|
|
@@ -1911,6 +2217,19 @@ interface VectorSelectionBoxGeometry {
|
|
|
1911
2217
|
corners: Vec2[];
|
|
1912
2218
|
}
|
|
1913
2219
|
declare function getVectorSelectionBoxGeometry(frame: VectorSelectionFrame, viewport: VectorViewport): VectorSelectionBoxGeometry;
|
|
2220
|
+
/**
|
|
2221
|
+
* The node the Envelope tool edits: the one selected node with an enabled envelope, with the
|
|
2222
|
+
* envelope's mesh and box (node space) and the node → document matrix. Null otherwise.
|
|
2223
|
+
*/
|
|
2224
|
+
declare function getVectorEnvelopeTarget(doc: VectorDocument, selection: readonly string[]): {
|
|
2225
|
+
node: VectorNode;
|
|
2226
|
+
frame: {
|
|
2227
|
+
effectId: string;
|
|
2228
|
+
bounds: VectorBounds;
|
|
2229
|
+
mesh: VectorWarpMesh;
|
|
2230
|
+
};
|
|
2231
|
+
world: AffineMatrix;
|
|
2232
|
+
} | null;
|
|
1914
2233
|
/** The resize cursor for a handle of a box rotated by `angle` degrees. */
|
|
1915
2234
|
declare function vectorResizeCursor(handle: VectorTransformHandle, angle?: number): string;
|
|
1916
2235
|
declare function vectorToolLabel(tool: VectorTool): string;
|
|
@@ -1962,6 +2281,7 @@ declare class VectorEditorController {
|
|
|
1962
2281
|
/** Options new blends get (the toolbars edit them along with the selected blend's). */
|
|
1963
2282
|
private blendDefaults;
|
|
1964
2283
|
private gradientEdit;
|
|
2284
|
+
private freeDistort;
|
|
1965
2285
|
/** What the highlight shows, to skip notifying when the pointer stays over the same face. */
|
|
1966
2286
|
private builderHoverKey;
|
|
1967
2287
|
private readonly createId;
|
|
@@ -2268,6 +2588,83 @@ declare class VectorEditorController {
|
|
|
2268
2588
|
private selectedRoots;
|
|
2269
2589
|
/** `m`, given in a frame rotated by `angle`, as a document-space matrix. */
|
|
2270
2590
|
private inFrame;
|
|
2591
|
+
/** The selection frame's corners in document space, clockwise from the top left. */
|
|
2592
|
+
private frameCorners;
|
|
2593
|
+
/** `doc` with nodes `ids` sent through `f` (a map of document space), each in its own space (see `distortVectorNode`). */
|
|
2594
|
+
private distorted;
|
|
2595
|
+
/**
|
|
2596
|
+
* Free Distort mode of the selection box (`state.freeDistort`): dragging a corner distorts the
|
|
2597
|
+
* selection in perspective, each corner on its own (Shift+Alt+Mod: symmetric perspective, the
|
|
2598
|
+
* corner beside it moving the other way); dragging a side moves its two corners; Mod-dragging a
|
|
2599
|
+
* side skews along it (Alt: about the centre). Each drag is one undo step.
|
|
2600
|
+
*/
|
|
2601
|
+
setFreeDistort(on: boolean): void;
|
|
2602
|
+
/**
|
|
2603
|
+
* Distorts the selected (or given) nodes so the corners of their selection box (clockwise from
|
|
2604
|
+
* the top left, in the box's own rotation) land on `corners` (document space): a projective map,
|
|
2605
|
+
* so straight lines stay straight. Curves are followed within `tolerance` (document units).
|
|
2606
|
+
* One undo step.
|
|
2607
|
+
*/
|
|
2608
|
+
distort(corners: readonly Vec2[], options?: {
|
|
2609
|
+
ids?: readonly string[];
|
|
2610
|
+
tolerance?: number;
|
|
2611
|
+
}): VectorActionResult;
|
|
2612
|
+
/**
|
|
2613
|
+
* Skews the selected (or given) nodes along the selection box's own axes by `ax` degrees
|
|
2614
|
+
* horizontally (x' = x + tan(ax)·y: vertical lines lean right for positive angles) and `ay`
|
|
2615
|
+
* vertically, about `origin` (default: the box centre, document space). One undo step.
|
|
2616
|
+
*/
|
|
2617
|
+
skew(ax: number, ay?: number, options?: {
|
|
2618
|
+
ids?: readonly string[];
|
|
2619
|
+
origin?: Vec2;
|
|
2620
|
+
}): VectorActionResult;
|
|
2621
|
+
/** A selection box handle dragged in Free Distort mode. */
|
|
2622
|
+
private moveDistort;
|
|
2623
|
+
/** Selected (or given) roots that can carry an envelope. */
|
|
2624
|
+
private envelopeTargets;
|
|
2625
|
+
/** Envelope parameters for `node` after `patch`: a preset switched to a mesh becomes the mesh it stood for. */
|
|
2626
|
+
private envelopeParams;
|
|
2627
|
+
/**
|
|
2628
|
+
* Gives the selected (or given) nodes an envelope distortion, or changes the one they have: a
|
|
2629
|
+
* warp preset (`style` with `bend`, `horizontal` and `vertical` in percent and `orientation`) or
|
|
2630
|
+
* a mesh (`style: 'mesh'` with `rows` and `columns`, and optionally its `mesh` points). The
|
|
2631
|
+
* envelope stays live (an `envelope` effect: edit it with the Envelope tool, Expand Appearance
|
|
2632
|
+
* bakes it). One undo step (with `merge`, consecutive changes fold into one, as a slider drag
|
|
2633
|
+
* should). Returns the envelope of each node.
|
|
2634
|
+
*/
|
|
2635
|
+
envelope(params?: Partial<VectorEnvelopeParams>, options?: {
|
|
2636
|
+
ids?: readonly string[];
|
|
2637
|
+
merge?: boolean;
|
|
2638
|
+
}): {
|
|
2639
|
+
nodeId: string;
|
|
2640
|
+
effectId: string;
|
|
2641
|
+
}[];
|
|
2642
|
+
/**
|
|
2643
|
+
* Make with Top Object: the topmost selected object's outline (a closed path) becomes the envelope
|
|
2644
|
+
* of the other selected objects (grouped when there are several; they must share a parent), as a
|
|
2645
|
+
* mesh of `columns × rows` patches whose border follows the outline. The top object is used up.
|
|
2646
|
+
* One undo step; returns the id of the enveloped node.
|
|
2647
|
+
*/
|
|
2648
|
+
makeEnvelopeWithTopObject(options?: {
|
|
2649
|
+
ids?: readonly string[];
|
|
2650
|
+
rows?: number;
|
|
2651
|
+
columns?: number;
|
|
2652
|
+
}): VectorActionResult & {
|
|
2653
|
+
nodeId?: string;
|
|
2654
|
+
};
|
|
2655
|
+
/**
|
|
2656
|
+
* Release: the selected (or given) nodes lose their envelope, and its shape (the mesh's border)
|
|
2657
|
+
* comes back as a path above each of them. One undo step; returns the new paths' ids.
|
|
2658
|
+
*/
|
|
2659
|
+
releaseEnvelope(options?: {
|
|
2660
|
+
ids?: readonly string[];
|
|
2661
|
+
}): string[];
|
|
2662
|
+
/** The selected node the Envelope tool edits, with its mesh (node space) and node → document matrix. */
|
|
2663
|
+
private envelopeTarget;
|
|
2664
|
+
/** The envelope mesh point under `screen` (handles first), or a spot inside the mesh. */
|
|
2665
|
+
private hitEnvelope;
|
|
2666
|
+
private downEnvelope;
|
|
2667
|
+
private moveEnvelope;
|
|
2271
2668
|
/** Applies a matrix to the selected (or given) nodes as one undo step. */
|
|
2272
2669
|
transform(matrix: AffineMatrix, options?: {
|
|
2273
2670
|
ids?: readonly string[];
|
|
@@ -2657,153 +3054,6 @@ declare function scaleFor(handle: VectorTransformHandle, b: VectorBounds, p: Vec
|
|
|
2657
3054
|
origin: Vec2;
|
|
2658
3055
|
};
|
|
2659
3056
|
|
|
2660
|
-
/**
|
|
2661
|
-
* Live appearance: path effect stacks and live boolean groups, evaluated on demand while the
|
|
2662
|
-
* stored anchors and children stay editable.
|
|
2663
|
-
*
|
|
2664
|
-
* `expandVectorAppearance` is the one place the effected geometry is made (cached per node
|
|
2665
|
-
* object, so an edit recomputes only the nodes it replaced). Rendering, hit-testing, bounds,
|
|
2666
|
-
* snapping, booleans, the Pathfinder, the Shape Builder and SVG export all read it, the way they
|
|
2667
|
-
* read live corners through `subpathsToBezier`; Expand Appearance stores it.
|
|
2668
|
-
*
|
|
2669
|
-
* Stacking follows After Effects' shape layers (effectcraft `crates/render/src/shapes.rs`): an
|
|
2670
|
-
* effect acts on every path above it — the node's own outline, or for a group every path of its
|
|
2671
|
-
* children (nested groups included, as drawn by their own effects) — in the order of the stack,
|
|
2672
|
-
* and effects placed after a repeater act on its copies. The result paints with the style of the
|
|
2673
|
-
* path each shape came from; Merge Paths and live booleans paint with the bottom one's.
|
|
2674
|
-
*
|
|
2675
|
-
* Live booleans fold their operands bottom to top, each combined with the result below it by its
|
|
2676
|
-
* own operation or the group's, and every prefix of the fold is cached under a rolling hash of the
|
|
2677
|
-
* operands it covers, so editing one operand recombines only the operands from it up; the cache
|
|
2678
|
-
* drops its least recently used half when full. Live groups are hit by their result except while
|
|
2679
|
-
* they are being edited (`vectorEnteredGroups`).
|
|
2680
|
-
*
|
|
2681
|
-
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
2682
|
-
* THIRD_PARTY_NOTICES.md): the stacking rule of effectcraft `crates/render/src/shapes.rs`
|
|
2683
|
-
* (`collect()`); figcraft `crates/render/src/boolean.rs` (`fold_cached`, `PathCache`) and
|
|
2684
|
-
* `crates/engine/src/booleans.rs` (`operand_op`, `result_outline`); and the live-object model of
|
|
2685
|
-
* vectorcraft `crates/doc/src/live.rs` (`expand_live`, `expanded_group`, `subtree_has_live`).
|
|
2686
|
-
*/
|
|
2687
|
-
|
|
2688
|
-
/** One shape of a node's appearance: a path in the node's own space, painted in `source`'s style. */
|
|
2689
|
-
interface VectorAppearanceShape {
|
|
2690
|
-
/** The path whose style paints it. */
|
|
2691
|
-
source: VectorPathNode;
|
|
2692
|
-
path: BezierPath;
|
|
2693
|
-
/** Opacity factor relative to the node (its own opacity not included). */
|
|
2694
|
-
opacity: number;
|
|
2695
|
-
/** Draw-order key (compared element by element). */
|
|
2696
|
-
order: number[];
|
|
2697
|
-
}
|
|
2698
|
-
/** Default parameters of each effect type. */
|
|
2699
|
-
declare const VECTOR_EFFECT_DEFAULTS: {
|
|
2700
|
-
readonly [K in VectorEffectType]: VectorEffectParamsMap[K];
|
|
2701
|
-
};
|
|
2702
|
-
declare const VECTOR_EFFECT_LABELS: Record<VectorEffectType, string>;
|
|
2703
|
-
/** How a panel edits one effect parameter. */
|
|
2704
|
-
type VectorEffectParamSpec = {
|
|
2705
|
-
key: string;
|
|
2706
|
-
label: string;
|
|
2707
|
-
kind: 'number';
|
|
2708
|
-
min?: number;
|
|
2709
|
-
max?: number;
|
|
2710
|
-
step: number;
|
|
2711
|
-
slider?: boolean;
|
|
2712
|
-
} | {
|
|
2713
|
-
key: string;
|
|
2714
|
-
label: string;
|
|
2715
|
-
kind: 'vec2';
|
|
2716
|
-
step: number;
|
|
2717
|
-
} | {
|
|
2718
|
-
key: string;
|
|
2719
|
-
label: string;
|
|
2720
|
-
kind: 'boolean';
|
|
2721
|
-
} | {
|
|
2722
|
-
key: string;
|
|
2723
|
-
label: string;
|
|
2724
|
-
kind: 'select';
|
|
2725
|
-
options: {
|
|
2726
|
-
value: string;
|
|
2727
|
-
label: string;
|
|
2728
|
-
}[];
|
|
2729
|
-
};
|
|
2730
|
-
/** The editable parameters of each effect type, in panel order. */
|
|
2731
|
-
declare const VECTOR_EFFECT_PARAM_SPECS: Record<VectorEffectType, VectorEffectParamSpec[]>;
|
|
2732
|
-
/**
|
|
2733
|
-
* Effect parameters with defaults filled in and invalid values dropped (unknown keys go too).
|
|
2734
|
-
* Returns null for an unknown type.
|
|
2735
|
-
*/
|
|
2736
|
-
declare function normalizeVectorEffectParams<K extends VectorEffectType>(type: K, params: Record<string, unknown> | null | undefined, base?: VectorEffectParamsMap[K]): VectorEffectParamsMap[K] | null;
|
|
2737
|
-
/** A new effect of `type` (defaults merged with `params`), or null for an unknown type. */
|
|
2738
|
-
declare function createVectorEffect<K extends VectorEffectType>(type: K, id: string, params?: Partial<VectorEffectParamsMap[K]> | Record<string, unknown>): Extract<VectorEffect, {
|
|
2739
|
-
type: K;
|
|
2740
|
-
}> | null;
|
|
2741
|
-
/** The node's effects that take part (enabled, of a known type). */
|
|
2742
|
-
declare function activeVectorEffects(node: VectorNode): VectorEffect[];
|
|
2743
|
-
/** Whether the node itself draws differently from its stored geometry (effects or a live boolean). */
|
|
2744
|
-
declare function hasOwnVectorAppearance(node: VectorNode): boolean;
|
|
2745
|
-
/** Whether the node or anything inside it has a live appearance. */
|
|
2746
|
-
declare function hasVectorAppearance(node: VectorNode): boolean;
|
|
2747
|
-
/** A live boolean group (its children are operands). */
|
|
2748
|
-
declare function isVectorLiveBoolean(node: VectorNode | null | undefined): node is VectorGroupNode & {
|
|
2749
|
-
liveBoolean: VectorBooleanOperation;
|
|
2750
|
-
};
|
|
2751
|
-
/** How operand `child` of a live boolean group combines with the operands below it. */
|
|
2752
|
-
declare function vectorOperandOperation(group: VectorGroupNode, child: VectorNode): VectorBooleanOperation;
|
|
2753
|
-
/** How many boolean steps (one operand combined with the result below it) live booleans have computed: what a cache miss costs. */
|
|
2754
|
-
declare function vectorLiveBooleanSteps(): number;
|
|
2755
|
-
/** Empties the live boolean prefix cache. */
|
|
2756
|
-
declare function clearVectorLiveBooleanCache(): void;
|
|
2757
|
-
/** One operand of a live boolean: its outline (group space), fill rule and operation (unused for the bottom one). */
|
|
2758
|
-
interface VectorBooleanOperand {
|
|
2759
|
-
path: BezierPath;
|
|
2760
|
-
fillRule: VectorFillRule;
|
|
2761
|
-
operation: VectorBooleanOperation;
|
|
2762
|
-
}
|
|
2763
|
-
/**
|
|
2764
|
-
* The result of folding `operands` bottom to top, reusing the longest cached prefix: only the
|
|
2765
|
-
* operands above it are combined. Invalid geometry gives an empty path.
|
|
2766
|
-
*/
|
|
2767
|
-
declare function foldVectorBooleanOperands(operands: readonly VectorBooleanOperand[]): BezierPath;
|
|
2768
|
-
/** Applies an effect stack to shapes, top to bottom (disabled effects skipped). */
|
|
2769
|
-
declare function applyVectorEffects(shapes: readonly VectorAppearanceShape[], effects: readonly VectorEffect[] | null | undefined): VectorAppearanceShape[];
|
|
2770
|
-
/**
|
|
2771
|
-
* What a node draws as: shapes in its own space (its `transform` and opacity not applied),
|
|
2772
|
-
* bottom to top, with its effects and those of everything inside it applied. Cached per node
|
|
2773
|
-
* object.
|
|
2774
|
-
*/
|
|
2775
|
-
declare function vectorAppearanceShapes(node: VectorNode): VectorAppearanceShape[];
|
|
2776
|
-
/** Everything a node draws as one path in its own space (live corners cut, effects applied). */
|
|
2777
|
-
declare function vectorAppearanceOutline(node: VectorNode): BezierPath;
|
|
2778
|
-
/** What a node draws as, one plain path per shape (ids `<id>~fx<n>`, opacity relative to the node). */
|
|
2779
|
-
declare function vectorAppearanceNodes(node: VectorNode): VectorPathNode[];
|
|
2780
|
-
/**
|
|
2781
|
-
* The node as plain geometry: path effects and live booleans evaluated into paths (the node
|
|
2782
|
-
* itself when nothing inside it is live). A path keeps its id when it draws as one shape;
|
|
2783
|
-
* otherwise, like any live group, it becomes a group with that id holding one path per shape
|
|
2784
|
-
* (ids `<id>~fx<n>`). Groups without effects of their own keep their structure. Cached per node.
|
|
2785
|
-
*/
|
|
2786
|
-
declare function expandVectorAppearance(node: VectorNode): VectorNode;
|
|
2787
|
-
/** Every node of a list expanded (the same array when nothing in it is live). */
|
|
2788
|
-
declare function expandVectorAppearances(nodes: readonly VectorNode[]): VectorNode[];
|
|
2789
|
-
/**
|
|
2790
|
-
* Reads effects from untrusted data (JSON, agent input): unknown types and malformed entries are
|
|
2791
|
-
* dropped, parameters normalized, ids made unique.
|
|
2792
|
-
*/
|
|
2793
|
-
declare function sanitizeVectorEffects(value: unknown): VectorEffect[];
|
|
2794
|
-
/**
|
|
2795
|
-
* Effect parameters carried through a linear map baked into a node's geometry (scaling or
|
|
2796
|
-
* flipping it): offsets and positions move with it, angles turn the other way when it mirrors.
|
|
2797
|
-
* Lengths such as sizes and radii are kept, like stroke widths.
|
|
2798
|
-
*/
|
|
2799
|
-
declare function transformVectorEffects(effects: readonly VectorEffect[], m: AffineMatrix): VectorEffect[];
|
|
2800
|
-
/**
|
|
2801
|
-
* The live groups (live booleans and groups with effects) being edited: those in `ids` and those
|
|
2802
|
-
* holding a node in `ids`. Their children are hit and outlined as stored instead of as drawn, so
|
|
2803
|
-
* each operand can be picked (figcraft `crates/engine/src/booleans.rs`, `result_outline`).
|
|
2804
|
-
*/
|
|
2805
|
-
declare function vectorEnteredGroups(nodes: readonly VectorNode[], ids: readonly string[]): Set<string>;
|
|
2806
|
-
|
|
2807
3057
|
interface VectorRenderPath {
|
|
2808
3058
|
kind: 'path';
|
|
2809
3059
|
id: string;
|
|
@@ -2930,7 +3180,43 @@ interface VectorOverlayRenderData {
|
|
|
2930
3180
|
transform: string;
|
|
2931
3181
|
corners: Vec2[];
|
|
2932
3182
|
handles: VectorSelectionBoxGeometry['handles'];
|
|
3183
|
+
freeDistort: boolean;
|
|
2933
3184
|
}) | null;
|
|
3185
|
+
/**
|
|
3186
|
+
* A Free Distort drag (screen space): the quad the selection box's corners make so far (`d`,
|
|
3187
|
+
* closed path data) and its corners clockwise from the top left. The box is hidden meanwhile.
|
|
3188
|
+
*/
|
|
3189
|
+
distort: {
|
|
3190
|
+
mode: 'distort' | 'perspective' | 'skew';
|
|
3191
|
+
d: string;
|
|
3192
|
+
corners: Vec2[];
|
|
3193
|
+
} | null;
|
|
3194
|
+
/**
|
|
3195
|
+
* The Envelope tool's mesh of the selected envelope (screen space): `grid` is the grid lines as
|
|
3196
|
+
* path data, `anchors` the points where they cross and `handles` the handles along them, each
|
|
3197
|
+
* with the anchor it belongs to (`index` is the point's index in the mesh). Draw anchors as
|
|
3198
|
+
* squares and handles as dots joined to their anchors.
|
|
3199
|
+
*/
|
|
3200
|
+
envelope: {
|
|
3201
|
+
nodeId: string;
|
|
3202
|
+
grid: string;
|
|
3203
|
+
anchors: {
|
|
3204
|
+
index: number;
|
|
3205
|
+
x: number;
|
|
3206
|
+
y: number;
|
|
3207
|
+
hovered: boolean;
|
|
3208
|
+
active: boolean;
|
|
3209
|
+
}[];
|
|
3210
|
+
handles: {
|
|
3211
|
+
index: number;
|
|
3212
|
+
x: number;
|
|
3213
|
+
y: number;
|
|
3214
|
+
anchorX: number;
|
|
3215
|
+
anchorY: number;
|
|
3216
|
+
hovered: boolean;
|
|
3217
|
+
active: boolean;
|
|
3218
|
+
}[];
|
|
3219
|
+
} | null;
|
|
2934
3220
|
anchors: VectorRenderAnchor[];
|
|
2935
3221
|
handles: VectorRenderHandle[];
|
|
2936
3222
|
/** Marquee rectangle, screen space. */
|
|
@@ -3086,6 +3372,31 @@ declare function getVectorSceneRenderData(state: Pick<VectorEditorState, 'docume
|
|
|
3086
3372
|
declare function getVectorEnteredGroups(state: Pick<VectorEditorState, 'document' | 'selection' | 'editingId'>): Set<string>;
|
|
3087
3373
|
/** The editing overlay in screen pixels. Render it on top of the scene, untransformed. */
|
|
3088
3374
|
declare function getVectorOverlayRenderData(state: VectorEditorState): VectorOverlayRenderData;
|
|
3375
|
+
/** Warp choices of an envelope: the fifteen presets, then Mesh. */
|
|
3376
|
+
declare const VECTOR_ENVELOPE_STYLE_OPTIONS: readonly {
|
|
3377
|
+
value: VectorEnvelopeParams['style'];
|
|
3378
|
+
label: string;
|
|
3379
|
+
}[];
|
|
3380
|
+
/** What a Distort / Envelope panel shows for the selection. */
|
|
3381
|
+
interface VectorEnvelopePanelData {
|
|
3382
|
+
/** The one selected node, or null when several are selected. */
|
|
3383
|
+
nodeId: string | null;
|
|
3384
|
+
count: number;
|
|
3385
|
+
/** The selected node's envelope (the first one in its stack), if any. */
|
|
3386
|
+
envelope: {
|
|
3387
|
+
effectId: string;
|
|
3388
|
+
enabled: boolean;
|
|
3389
|
+
params: VectorEnvelopeParams;
|
|
3390
|
+
} | null;
|
|
3391
|
+
/** Some selected node can take an envelope (Make with Warp / Mesh). */
|
|
3392
|
+
canMake: boolean;
|
|
3393
|
+
/** Make with Top Object: several objects selected and the topmost is a closed path. */
|
|
3394
|
+
canMakeWithTopObject: boolean;
|
|
3395
|
+
/** Some selected node has an envelope (Release, Expand). */
|
|
3396
|
+
canRelease: boolean;
|
|
3397
|
+
}
|
|
3398
|
+
/** The Distort / Envelope panel of the selection, or null when nothing is selected. */
|
|
3399
|
+
declare function getVectorEnvelopePanel(state: Pick<VectorEditorState, 'document' | 'selection'>): VectorEnvelopePanelData | null;
|
|
3089
3400
|
/** What the Blend controls of a toolbar or style panel show. */
|
|
3090
3401
|
interface VectorBlendControls {
|
|
3091
3402
|
/** Ids of the selected blends (a selected key counts as its blend). */
|
|
@@ -3290,6 +3601,7 @@ interface VectorEffectsPanelItem {
|
|
|
3290
3601
|
label: string;
|
|
3291
3602
|
enabled: boolean;
|
|
3292
3603
|
params: Record<string, unknown>;
|
|
3604
|
+
/** The parameters to edit (none for an envelope: `getVectorEnvelopePanel` and the Envelope panels edit it). */
|
|
3293
3605
|
specs: readonly VectorEffectParamSpec[];
|
|
3294
3606
|
}
|
|
3295
3607
|
/** What an Effects panel shows for the selection. */
|
|
@@ -4149,4 +4461,162 @@ declare function vectorStrokeGradientDefs(g: VectorGradient, id: string, node: V
|
|
|
4149
4461
|
precision?: number;
|
|
4150
4462
|
}): VectorPaintDef[];
|
|
4151
4463
|
|
|
4152
|
-
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_GRADIENT_INTERPOLATIONS, VECTOR_GRADIENT_INTERPOLATION_LABELS, VECTOR_GRADIENT_MAX_PERIODS, VECTOR_GRADIENT_MIDPOINT_GAP, VECTOR_GRADIENT_MIN_STOPS, VECTOR_GRADIENT_OFF_BAR, VECTOR_GRADIENT_SPREADS, VECTOR_GRADIENT_SPREAD_LABELS, VECTOR_GRADIENT_STOP_GAP, VECTOR_GRADIENT_TYPES, VECTOR_GRADIENT_TYPE_LABELS, 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_STROKE_GRADIENT_MODES, VECTOR_STROKE_GRADIENT_MODE_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 VectorGradient, type VectorGradientAnnotator, type VectorGradientEditorData, type VectorGradientHandle, type VectorGradientInterpolation, type VectorGradientPart, type VectorGradientPatch, type VectorGradientPoints, type VectorGradientRamp, type VectorGradientSpread, type VectorGradientStop, type VectorGradientSvgOptions, type VectorGradientTarget, type VectorGradientType, type VectorGradientUnits, 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 VectorPaintDef, type VectorPaintSvgOptions, 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 VectorRenderGradientAnnotator, type VectorRenderGroup, type VectorRenderGuideLabel, type VectorRenderGuideLine, type VectorRenderHandle, type VectorRenderNode, type VectorRenderPath, type VectorRenderStrokeParts, type VectorRenderWidthPoint, type VectorRepeaterCopy, type VectorRgba, 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 VectorStrokeGradientMode, type VectorStrokeParts, type VectorStrokeSpot, type VectorStyle, type VectorSubpath, type VectorSvgExportOptions, type VectorSvgImportOptions, type VectorSvgPatternDef, 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, applyVectorGradientPatch, applyVectorGradientSpread, arrowheadInset, arrowheadPath, arrowheadWeight, bendSegment, bezierToSubpaths, boundsFromPoints, boundsIntersect, clearVectorLiveBooleanCache, cloneAnchor, cloneSubpath, cloneVectorDocument, cloneVectorNode, collectPathNodes, constrainToLeave, convertAnchor, convertVectorGradient, cornerBisectorPoint, cornerRadiusChange, cornerSetback, correspondMorphContours, createVectorCommands, createVectorEffect, createVectorMorph, curvatureMoveAnchor, cutSubpathAt, dashIntervals, decomposeRigid, defaultVectorGradient, effectPathLength, effectPathVertexCount, effectiveStrokeAlign, ellipseSubpath, eraseFromFill, eraseFromOutline, eraserRegion, evaluateVectorPathKeyframes, expandVectorAppearance, expandVectorAppearances, expandVectorBlend, expandVectorCorners, expandVectorCornersOf, expandVectorGradientSpread, expandVectorGradientStops, explicitVectorGradient, findVectorNode, fitCornerRadius, foldVectorBooleanOperands, generateVectorBlendChildren, generateWidthProfile, getAnchor, getAnchorWorld, getEditablePathIds, getTransformHandlePositions, getVectorBlendControls, getVectorCornerWidgets, getVectorEffectsPanel, getVectorEnteredGroups, getVectorGradientAnnotator, getVectorGradientEditor, getVectorOverlayRenderData, getVectorSceneRenderData, getVectorSelectionBoxGeometry, getVectorSelectionFrame, getVectorSelectionStyle, getVectorWidthHandles, getVisibleAnchors, getVisibleHandles, gradientMidpointRemap, hasExplicitGradientGeometry, hasOwnVectorAppearance, hasPaint, hasStrokeExtras, hasVectorAppearance, hasVectorCorners, hitTestVectorNode, hitTestVectorNodes, hitTestVectorStroke, hitVectorGradientAnnotator, inferAnchorType, insertAnchor, insertVectorGradientStop, insertWidthPoint, interpolateMorphContours, interpolateRigidMatrix, interpolateVectorColor, interpolateVectorPaint, interpolateVectorPaths, interpolateVectorStyle, interpolateWidthProfiles, invertMatrix, isCentredVectorGradient, isClosedBezierShape, isIdentityMatrix, isUniformWidthProfile, isVectorBlendGroup, isVectorGradient, isVectorLiveBoolean, isVectorTextTarget, joinSubpaths, knifePath, lineSubpath, locateVectorNode, matrixRotation, mergePaths, mirrorWidthProfile, morphContourToSubpath, morphPathsCross, moveAnchorHandle, moveVectorGradientHandle, moveVectorGradientStop, multiplyMatrices, nearestSegment, nearestStrokePosition, nextVectorCornerKind, nodeMatrix, normalizeVectorEffectParams, offsetPaths, parseSvgTransform, parseVectorColor, parseVectorSvg, pathsCenter, patternAttrs, periodicVectorGradientStops, pinVectorGradient, planShapeBuilder, polygonSubpath, polylineBounds, pressureWidthProfile, puckerBloatPaths, recognizeInkShape, rectSubpath, refineMorphContour, refreshVectorBlends, releaseVectorBlend, removeAnchorKeepingShape, removeAnchors, removeAnchorsKeepingShape, removeRedundantPoints, removeVectorGradientStop, removeWidthPoints, repeatPaths, resampleGradientStops, resolveVectorBlendOptions, reverseMorphContour, reverseSubpath, reverseVectorGradient, reverseWidthProfile, rotateMatrix, roundCornerPaths, roundSubpaths, samplePlainStops, samplePolyline, sampleVectorGradient, sampleVectorGradientAt, sampleVectorPaintDefAt, sanitizeVectorEffects, sanitizeVectorGradient, sanitizeWidthProfile, scaleFor, scaleMatrix, setAnchorCorner, setSubpathCorners, setVectorGradientVector, setWidthPoint, simplifyPolyline, smoothSubpath, sortedVectorGradientStops, spanVectorGradientStops, splitIntoFaces, splitSubpathAt, starSubpath, strokePositionPoint, strokeWidthProfileOf, subpathEnclosesArea, subpathPointAt, subpathSegment, subpathSegmentCount, subpathToMorphContour, subpathsToBezier, taperWaveFactor, toVectorKeyInput, toVectorModifiers, toVectorPointerInput, transformVectorEffects, transformVectorGradient, transformVectorNode, transformVectorPaint, translateAnchor, translateMatrix, trimIntervals, trimPaths, trimPathsIndividually, turnMorphContour, twistPaths, unionBounds, variableStrokeOutline, variableStrokeRings, vectorAppearanceNodes, vectorAppearanceOutline, vectorAppearanceShapes, vectorBlendColorDistance, vectorBlendKeyTargets, vectorBlendKeys, vectorBlendRail, vectorBlendRailAt, vectorBlendSpine, vectorBlendStepCount, vectorBoxMatrix, vectorBuilderErasedEdges, vectorCornerAt, vectorCorners, vectorCornersAttribute, vectorDiamondPath, vectorDocumentToSvg, vectorEnteredGroups, vectorFillMap, vectorGradientArea, vectorGradientAspect, vectorGradientBarPosition, vectorGradientFocalParam, vectorGradientHandles, vectorGradientMatrix, vectorGradientMidpointFromPosition, vectorGradientMidpointPosition, vectorGradientNeedsExpansion, vectorGradientParam, vectorGradientPoints, vectorGradientRamp, vectorGradientSvgDefs, vectorGradientTAt, vectorGradientTargetPath, vectorGradientUnitsMatrix, vectorInkShapeName, vectorLiveBooleanSteps, vectorNodeBounds, vectorNodeRotation, vectorNodeToBezier, vectorOperandOperation, vectorPaintToHex, vectorPaintToSvg, vectorParentMatrix, vectorPathData, vectorPathEntries, vectorPathLocalBounds, vectorPathWorldBezier, vectorPathfinderShape, vectorRepeaterCopies, vectorResizeCursor, vectorResultStyle, vectorShapeBuilderHit, vectorShapeBuilderMap, vectorStrokeGradientDefs, vectorStrokeLineArea, vectorStrokeOutline, vectorStrokeOutlinePath, vectorStrokeParts, vectorStrokeReach, vectorStrokeSvgParts, vectorStrokeWidthGeometry, vectorToolLabel, vectorWorldMatrix, walkVectorNodes, widthProfileAt, widthProfileFromAttribute, widthProfileMaxScale, widthProfilePreset, widthProfilePresetId, widthProfileToAttribute, wigglePaths, zigzagPaths };
|
|
4464
|
+
/**
|
|
4465
|
+
* Perspective (projective) maps between quadrilaterals: what Free Distort needs. Pure maths;
|
|
4466
|
+
* degenerate or non-finite quads give `null` instead of NaNs.
|
|
4467
|
+
*
|
|
4468
|
+
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
4469
|
+
* THIRD_PARTY_NOTICES.md): pdfcraft `crates/geom/src/perspective.rs` (`Homography::from_points`,
|
|
4470
|
+
* `Homography::apply`, `solve8`, `order_quad`).
|
|
4471
|
+
*/
|
|
4472
|
+
|
|
4473
|
+
/** A 3×3 projective map, row-major, normalised so that the last entry is 1. */
|
|
4474
|
+
type VectorHomography = readonly [number, number, number, number, number, number, number, number, number];
|
|
4475
|
+
/**
|
|
4476
|
+
* Gaussian elimination with partial pivoting on an 8×8 system (the 9th column of each row is the
|
|
4477
|
+
* right-hand side). Null when the system is singular.
|
|
4478
|
+
*/
|
|
4479
|
+
declare function solve8(rows: readonly (readonly number[])[]): number[] | null;
|
|
4480
|
+
/** The image of `p`, or null where the map sends it to infinity. */
|
|
4481
|
+
declare function applyVectorHomography(h: VectorHomography, p: Vec2): Vec2 | null;
|
|
4482
|
+
/**
|
|
4483
|
+
* The projective map that takes each of `from` to the point at the same index of `to`. Null when
|
|
4484
|
+
* three of either set are collinear or a coordinate is not finite.
|
|
4485
|
+
*/
|
|
4486
|
+
declare function vectorHomography(from: readonly Vec2[], to: readonly Vec2[]): VectorHomography | null;
|
|
4487
|
+
/**
|
|
4488
|
+
* Whether `h` maps the whole convex quad `quad` without sending any of it through infinity (the
|
|
4489
|
+
* denominator keeps one sign over it): what a usable distortion needs.
|
|
4490
|
+
*/
|
|
4491
|
+
declare function vectorHomographyKeepsQuad(h: VectorHomography, quad: readonly Vec2[]): boolean;
|
|
4492
|
+
/**
|
|
4493
|
+
* The four corners in reading order for a y-down space: top-left, top-right, bottom-right,
|
|
4494
|
+
* bottom-left, whatever order they come in. Null unless they form a convex quadrilateral with a
|
|
4495
|
+
* non-negligible area.
|
|
4496
|
+
*/
|
|
4497
|
+
declare function orderVectorQuad(points: readonly Vec2[]): Vec2[] | null;
|
|
4498
|
+
|
|
4499
|
+
/**
|
|
4500
|
+
* Warp geometry for envelope distortion: preset warp styles and editable Bézier meshes, both
|
|
4501
|
+
* forward maps from a source box (the bounds of the paths an envelope bends) to the node's space.
|
|
4502
|
+
*
|
|
4503
|
+
* - **Presets** (`VectorWarpStyle`, Photoshop's fifteen with bend and horizontal / vertical
|
|
4504
|
+
* distortion in percent): each is one bicubic Bézier patch whose 4 × 4 control grid follows the
|
|
4505
|
+
* bend (`vectorWarpPresetGrid`). Every preset is the identity at bend 0 and continuous in it.
|
|
4506
|
+
* - **Meshes** (`VectorWarpMesh`): a grid of bicubic patches. Splitting a mesh (`splitVectorMeshU`
|
|
4507
|
+
* / `V`) is an exact de Casteljau subdivision, so it never changes the shape, and a preset turns
|
|
4508
|
+
* into an editable mesh of any size exactly.
|
|
4509
|
+
*
|
|
4510
|
+
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
4511
|
+
* THIRD_PARTY_NOTICES.md): photocraft `crates/geom/src/warp.rs` (`WarpStyle`, `StyleWarp`,
|
|
4512
|
+
* `rest_grid`, `edge_arc`, `arc_grid`, `blend_rows`, `preset_grid`, `bernstein`, `split_cubic`,
|
|
4513
|
+
* `BERN_INV`, and `BezierMesh`: `identity`, `fit`, `eval`, `split_u`, `split_v`, `remove_split_u`,
|
|
4514
|
+
* `transpose`, `map_points`, `param_at`, `pull`, `smooth_lines`, `drag_point`, `control_bounds`;
|
|
4515
|
+
* `Warp::map` and `Warp::to_mesh`). The Coons patch of `vectorMeshFromOutline` is our own.
|
|
4516
|
+
*/
|
|
4517
|
+
|
|
4518
|
+
/** The fifteen presets in Photoshop's menu order. */
|
|
4519
|
+
declare const VECTOR_WARP_STYLES: readonly VectorWarpStyle[];
|
|
4520
|
+
declare const VECTOR_WARP_STYLE_LABELS: Readonly<Record<VectorWarpStyle, string>>;
|
|
4521
|
+
/**
|
|
4522
|
+
* A preset as a Bézier control grid (rows of `[x, y]` in box units, y down). `b`, `hd`, `vd` are
|
|
4523
|
+
* the bend and the horizontal / vertical distortion as fractions (−1…1); `aspect` is the box's
|
|
4524
|
+
* height over its width. The arc family stays circular in pixels, the other offsets scale with the
|
|
4525
|
+
* box, and a vertical warp is the horizontal one with the axes (and distortions) swapped.
|
|
4526
|
+
*/
|
|
4527
|
+
declare function vectorWarpPresetGrid(style: VectorWarpStyle, b: number, hd: number, vd: number, vertical: boolean, aspect: number): [number, number][][];
|
|
4528
|
+
/** A preset warp's settings (bend and distortions in percent, −100…100). */
|
|
4529
|
+
interface VectorWarpPreset {
|
|
4530
|
+
style: VectorWarpStyle;
|
|
4531
|
+
bend: number;
|
|
4532
|
+
horizontal?: number;
|
|
4533
|
+
vertical?: number;
|
|
4534
|
+
/** Bend along the vertical axis. */
|
|
4535
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4536
|
+
}
|
|
4537
|
+
/**
|
|
4538
|
+
* A preset as one Bézier patch over `bounds` (points in the bounds' space), or null when it
|
|
4539
|
+
* changes nothing (an unknown style, all-zero amounts, or an empty box).
|
|
4540
|
+
*/
|
|
4541
|
+
declare function vectorWarpPresetMesh(preset: VectorWarpPreset, bounds: VectorBounds): VectorWarpMesh | null;
|
|
4542
|
+
/** Control points per row. */
|
|
4543
|
+
declare const vectorMeshColumns: (m: VectorWarpMesh) => number;
|
|
4544
|
+
/** Control point rows. */
|
|
4545
|
+
declare const vectorMeshRows: (m: VectorWarpMesh) => number;
|
|
4546
|
+
/** Whether a mesh is well formed: knots from 0 to 1 increasing, the right number of finite points. */
|
|
4547
|
+
declare function isValidVectorMesh(m: unknown): m is VectorWarpMesh;
|
|
4548
|
+
/** Fits a mesh with patch boundaries `us` / `vs` to the map `f` (box fractions → output) by interpolating it at each patch's thirds. Exact for bicubic maps (affine maps included). */
|
|
4549
|
+
declare function fitVectorMesh(f: (s: number, t: number) => Vec2, us: readonly number[], vs: readonly number[]): VectorWarpMesh;
|
|
4550
|
+
/** The identity mesh over `bounds` with `columns × rows` patches. */
|
|
4551
|
+
declare function vectorIdentityMesh(bounds: VectorBounds, columns?: number, rows?: number): VectorWarpMesh;
|
|
4552
|
+
/** The surface at box fractions `(s, t)`. */
|
|
4553
|
+
declare function evalVectorMesh(m: VectorWarpMesh, s: number, t: number): Vec2;
|
|
4554
|
+
/** The mesh with the patch column holding `s` split at `s` (exact). Null when `s` is on or too close to a boundary. */
|
|
4555
|
+
declare function splitVectorMeshU(m: VectorWarpMesh, s: number): VectorWarpMesh | null;
|
|
4556
|
+
/** The mesh with the patch row holding `t` split at `t` (exact). */
|
|
4557
|
+
declare function splitVectorMeshV(m: VectorWarpMesh, t: number): VectorWarpMesh | null;
|
|
4558
|
+
/**
|
|
4559
|
+
* The mesh without interior vertical boundary `k` (1 … us.length − 2), its two patch columns
|
|
4560
|
+
* merged: exact when they came from an unedited split; otherwise the outer control points stay and
|
|
4561
|
+
* the inner handles are extrapolated.
|
|
4562
|
+
*/
|
|
4563
|
+
declare function removeVectorMeshSplitU(m: VectorWarpMesh, k: number): VectorWarpMesh | null;
|
|
4564
|
+
/** Removes interior horizontal boundary `k`. */
|
|
4565
|
+
declare function removeVectorMeshSplitV(m: VectorWarpMesh, k: number): VectorWarpMesh | null;
|
|
4566
|
+
/** Every control point through `f` (exact for affine maps). */
|
|
4567
|
+
declare function mapVectorMeshPoints(m: VectorWarpMesh, f: (p: Vec2) => Vec2): VectorWarpMesh;
|
|
4568
|
+
/**
|
|
4569
|
+
* The mesh with `columns × rows` patches over the same surface: split exactly when its knots are
|
|
4570
|
+
* a subset of the new even ones (a one-patch mesh always is), otherwise refitted.
|
|
4571
|
+
*/
|
|
4572
|
+
declare function resizeVectorMesh(m: VectorWarpMesh, columns: number, rows: number): VectorWarpMesh;
|
|
4573
|
+
/** Bounding box of the control points (the surface lies inside it). */
|
|
4574
|
+
declare function vectorMeshControlBounds(m: VectorWarpMesh): VectorBounds;
|
|
4575
|
+
/** Box fractions `(s, t)` whose surface point is nearest `p` (a coarse search, then Newton steps). */
|
|
4576
|
+
declare function vectorMeshParamAt(m: VectorWarpMesh, p: Vec2): {
|
|
4577
|
+
s: number;
|
|
4578
|
+
t: number;
|
|
4579
|
+
distance: number;
|
|
4580
|
+
};
|
|
4581
|
+
/**
|
|
4582
|
+
* `base` with control point `index` dragged by `d`, keeping the surface smooth across the grid
|
|
4583
|
+
* lines: an anchor moves with the eight points around it as one block; a handle moves with the two
|
|
4584
|
+
* points beside it across its line, and the handle opposite it on the same anchor turns the other
|
|
4585
|
+
* way (with its two neighbours), so the line keeps passing straight through the anchor. An inner
|
|
4586
|
+
* point of a patch moves alone.
|
|
4587
|
+
*/
|
|
4588
|
+
declare function dragVectorMeshPoint(base: VectorWarpMesh, index: number, d: Vec2): VectorWarpMesh;
|
|
4589
|
+
/**
|
|
4590
|
+
* `base` with its surface point at box fractions `(s, t)` pulled by `d`, the way dragging inside a
|
|
4591
|
+
* patch works: interior anchors within about two cells follow by a share of `d` that fades with
|
|
4592
|
+
* distance (each with its block of handles, so grid lines stay smooth); the outer border stays
|
|
4593
|
+
* pinned unless the grab is near it, and then it bows; the four corners never move. The grabbed
|
|
4594
|
+
* patch's inner points (and, near the border, the border's handles) make up the rest, so the
|
|
4595
|
+
* grabbed point lands exactly at its start + `d`.
|
|
4596
|
+
*/
|
|
4597
|
+
declare function pullVectorMesh(base: VectorWarpMesh, s: number, t: number, d: Vec2): VectorWarpMesh;
|
|
4598
|
+
/**
|
|
4599
|
+
* A mesh whose border follows a closed outline (Illustrator's Make with Top Object): the outline is
|
|
4600
|
+
* cut into four sides at the points nearest its bounding box's corners, and the interior is the
|
|
4601
|
+
* Coons patch of those sides, fitted with `columns × rows` patches. Null for an open or degenerate
|
|
4602
|
+
* outline.
|
|
4603
|
+
*/
|
|
4604
|
+
declare function vectorMeshFromOutline(sp: VectorSubpath, columns?: number, rows?: number): VectorWarpMesh | null;
|
|
4605
|
+
/** The mesh's border as one closed subpath (clockwise from the top-left corner): what Release gives back as the envelope's shape. */
|
|
4606
|
+
declare function vectorMeshOutline(m: VectorWarpMesh): VectorSubpath;
|
|
4607
|
+
/**
|
|
4608
|
+
* The control points an editor shows: the anchors (where grid lines cross) and the handles along
|
|
4609
|
+
* the grid lines, each with the anchor it belongs to. Points inside a patch are left out (drag
|
|
4610
|
+
* inside a patch to pull the surface instead).
|
|
4611
|
+
*/
|
|
4612
|
+
declare function vectorMeshEditPoints(m: VectorWarpMesh): {
|
|
4613
|
+
anchors: number[];
|
|
4614
|
+
handles: {
|
|
4615
|
+
index: number;
|
|
4616
|
+
anchor: number;
|
|
4617
|
+
}[];
|
|
4618
|
+
};
|
|
4619
|
+
/** The mesh's grid lines (patch borders) as cubics `[p0, p1, p2, p3]`. */
|
|
4620
|
+
declare function vectorMeshGridCurves(m: VectorWarpMesh): Vec2[][];
|
|
4621
|
+
|
|
4622
|
+
export { type AddVectorNodeOptions, AffineMatrix, DEFAULT_VECTOR_BLEND_DISTANCE, DEFAULT_VECTOR_BLEND_STEPS, DEFAULT_VECTOR_PATH_EDIT, DEFAULT_VECTOR_SNAP, IDENTITY_MATRIX, KAPPA, LazyMouse, type MapVectorSubpathsOptions, 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_DISTORT_TOLERANCE, VECTOR_EDIT_TOGGLES, VECTOR_EFFECT_DEFAULTS, VECTOR_EFFECT_LABELS, VECTOR_EFFECT_MENU, VECTOR_EFFECT_PARAM_SPECS, VECTOR_EFFECT_TYPES, VECTOR_ENVELOPE_STYLE_OPTIONS, VECTOR_FILL_GAP, VECTOR_GRADIENT_INTERPOLATIONS, VECTOR_GRADIENT_INTERPOLATION_LABELS, VECTOR_GRADIENT_MAX_PERIODS, VECTOR_GRADIENT_MIDPOINT_GAP, VECTOR_GRADIENT_MIN_STOPS, VECTOR_GRADIENT_OFF_BAR, VECTOR_GRADIENT_SPREADS, VECTOR_GRADIENT_SPREAD_LABELS, VECTOR_GRADIENT_STOP_GAP, VECTOR_GRADIENT_TYPES, VECTOR_GRADIENT_TYPE_LABELS, 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_STROKE_GRADIENT_MODES, VECTOR_STROKE_GRADIENT_MODE_LABELS, VECTOR_STYLE_KEYS, VECTOR_TOOLS, VECTOR_TOOL_GLYPHS, VECTOR_TOOL_SHORTCUTS, VECTOR_TRANSFORM_HANDLES, VECTOR_WARP_STYLES, VECTOR_WARP_STYLE_LABELS, 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 VectorDistortMode, type VectorDistribute, type VectorDocument, VectorEditorController, type VectorEditorOptions, type VectorEditorState, type VectorEffect, type VectorEffectParamSpec, type VectorEffectParamsMap, type VectorEffectType, type VectorEffectsPanelData, type VectorEffectsPanelItem, type VectorEnvelopePanelData, type VectorEnvelopeParams, type VectorFillRule, type VectorGradient, type VectorGradientAnnotator, type VectorGradientEditorData, type VectorGradientHandle, type VectorGradientInterpolation, type VectorGradientPart, type VectorGradientPatch, type VectorGradientPoints, type VectorGradientRamp, type VectorGradientSpread, type VectorGradientStop, type VectorGradientSvgOptions, type VectorGradientTarget, type VectorGradientType, type VectorGradientUnits, type VectorGroupNode, type VectorGuideKind, type VectorGuideLabel, type VectorGuideLine, type VectorHandleRef, type VectorHitTestOptions, type VectorHomography, 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 VectorPaintDef, type VectorPaintSvgOptions, type VectorPathAction, type VectorPathEditOptions, type VectorPathEntry, type VectorPathKeyframe, type VectorPathNode, type VectorPathfinderAction, type VectorPathfinderOperation, type VectorPathfinderPaint, type VectorPointMap, type VectorPointSnap, type VectorPointerInput, type VectorRectSnap, type VectorRenderAnchor, type VectorRenderCornerWidget, type VectorRenderGradientAnnotator, type VectorRenderGroup, type VectorRenderGuideLabel, type VectorRenderGuideLine, type VectorRenderHandle, type VectorRenderNode, type VectorRenderPath, type VectorRenderStrokeParts, type VectorRenderWidthPoint, type VectorRepeaterCopy, type VectorRgba, 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 VectorStrokeGradientMode, type VectorStrokeParts, type VectorStrokeSpot, type VectorStyle, type VectorSubpath, type VectorSvgExportOptions, type VectorSvgImportOptions, type VectorSvgPatternDef, type VectorTaperOptions, type VectorTool, type VectorTransformHandle, type VectorViewport, type VectorWarpMesh, type VectorWarpPreset, type VectorWarpStyle, type VectorWaveOptions, type VectorWidthHandle, type VectorWidthPoint, type VectorWidthPointEdit, type VectorWidthPointRef, type VectorWidthPreset, type VectorWidthPresetInfo, activeVectorEffects, addBuilderHit, applyMatrix, applyMatrixLinear, applyVectorBlendOptions, applyVectorCornersAttribute, applyVectorEffects, applyVectorGradientPatch, applyVectorGradientSpread, applyVectorHomography, arrowheadInset, arrowheadPath, arrowheadWeight, bendSegment, bezierToSubpaths, boundsFromPoints, boundsIntersect, clearVectorLiveBooleanCache, cloneAnchor, cloneSubpath, cloneVectorDocument, cloneVectorNode, collectPathNodes, constrainToLeave, convertAnchor, convertVectorGradient, cornerBisectorPoint, cornerRadiusChange, cornerSetback, correspondMorphContours, createVectorCommands, createVectorEffect, createVectorMorph, curvatureMoveAnchor, cutSubpathAt, dashIntervals, decomposeRigid, defaultVectorGradient, distortVectorNode, dragVectorMeshPoint, effectPathLength, effectPathVertexCount, effectiveStrokeAlign, ellipseSubpath, eraseFromFill, eraseFromOutline, eraserRegion, evalVectorMesh, evaluateVectorPathKeyframes, expandVectorAppearance, expandVectorAppearances, expandVectorBlend, expandVectorCorners, expandVectorCornersOf, expandVectorGradientSpread, expandVectorGradientStops, explicitVectorGradient, findVectorNode, fitCornerRadius, fitVectorMesh, foldVectorBooleanOperands, generateVectorBlendChildren, generateWidthProfile, getAnchor, getAnchorWorld, getEditablePathIds, getTransformHandlePositions, getVectorBlendControls, getVectorCornerWidgets, getVectorEffectsPanel, getVectorEnteredGroups, getVectorEnvelopePanel, getVectorEnvelopeTarget, getVectorGradientAnnotator, getVectorGradientEditor, getVectorOverlayRenderData, getVectorSceneRenderData, getVectorSelectionBoxGeometry, getVectorSelectionFrame, getVectorSelectionStyle, getVectorWidthHandles, getVisibleAnchors, getVisibleHandles, gradientMidpointRemap, hasExplicitGradientGeometry, hasOwnVectorAppearance, hasPaint, hasStrokeExtras, hasVectorAppearance, hasVectorCorners, hitTestVectorNode, hitTestVectorNodes, hitTestVectorStroke, hitVectorGradientAnnotator, inferAnchorType, insertAnchor, insertVectorGradientStop, insertWidthPoint, interpolateMorphContours, interpolateRigidMatrix, interpolateVectorColor, interpolateVectorPaint, interpolateVectorPaths, interpolateVectorStyle, interpolateWidthProfiles, invertMatrix, isCentredVectorGradient, isClosedBezierShape, isIdentityMatrix, isUniformWidthProfile, isValidVectorMesh, isVectorBlendGroup, isVectorGradient, isVectorLiveBoolean, isVectorTextTarget, joinSubpaths, knifePath, lineSubpath, locateVectorNode, mapBezierPath, mapVectorGradient, mapVectorMeshPoints, mapVectorPaint, mapVectorPoints, mapVectorSubpaths, matrixRotation, mergePaths, mirrorWidthProfile, morphContourToSubpath, morphPathsCross, moveAnchorHandle, moveVectorGradientHandle, moveVectorGradientStop, multiplyMatrices, nearestSegment, nearestStrokePosition, nextVectorCornerKind, nodeMatrix, normalizeVectorEffectParams, offsetPaths, orderVectorQuad, parseSvgTransform, parseVectorColor, parseVectorSvg, pathsCenter, patternAttrs, periodicVectorGradientStops, pinVectorGradient, planShapeBuilder, polygonSubpath, polylineBounds, pressureWidthProfile, puckerBloatPaths, pullVectorMesh, recognizeInkShape, rectSubpath, refineMorphContour, refreshVectorBlends, releaseVectorBlend, removeAnchorKeepingShape, removeAnchors, removeAnchorsKeepingShape, removeRedundantPoints, removeVectorGradientStop, removeVectorMeshSplitU, removeVectorMeshSplitV, removeWidthPoints, repeatPaths, resampleGradientStops, resizeVectorMesh, resolveVectorBlendOptions, reverseMorphContour, reverseSubpath, reverseVectorGradient, reverseWidthProfile, rotateMatrix, roundCornerPaths, roundSubpaths, samplePlainStops, samplePolyline, sampleVectorGradient, sampleVectorGradientAt, sampleVectorPaintDefAt, sanitizeVectorEffects, sanitizeVectorGradient, sanitizeWidthProfile, scaleFor, scaleMatrix, setAnchorCorner, setSubpathCorners, setVectorGradientVector, setWidthPoint, simplifyPolyline, smoothSubpath, solve8, sortedVectorGradientStops, spanVectorGradientStops, splitIntoFaces, splitSubpathAt, splitVectorMeshU, splitVectorMeshV, starSubpath, strokePositionPoint, strokeWidthProfileOf, subpathEnclosesArea, subpathPointAt, subpathSegment, subpathSegmentCount, subpathToMorphContour, subpathsToBezier, taperWaveFactor, toVectorKeyInput, toVectorModifiers, toVectorPointerInput, transformVectorEffects, transformVectorGradient, transformVectorNode, transformVectorPaint, translateAnchor, translateMatrix, trimIntervals, trimPaths, trimPathsIndividually, turnMorphContour, twistPaths, unionBounds, variableStrokeOutline, variableStrokeRings, vectorAppearanceNodes, vectorAppearanceOutline, vectorAppearanceShapes, vectorBlendColorDistance, vectorBlendKeyTargets, vectorBlendKeys, vectorBlendRail, vectorBlendRailAt, vectorBlendSpine, vectorBlendStepCount, vectorBoxCorners, vectorBoxMatrix, vectorBuilderErasedEdges, vectorCornerAt, vectorCorners, vectorCornersAttribute, vectorDiamondPath, vectorDistortQuad, vectorDocumentToSvg, vectorEffectInputBounds, vectorEffectInputPaths, vectorEnteredGroups, vectorEnvelopeFrame, vectorEnvelopeMap, vectorEnvelopeMesh, vectorFillMap, vectorGradientArea, vectorGradientAspect, vectorGradientBarPosition, vectorGradientFocalParam, vectorGradientHandles, vectorGradientMatrix, vectorGradientMidpointFromPosition, vectorGradientMidpointPosition, vectorGradientNeedsExpansion, vectorGradientParam, vectorGradientPoints, vectorGradientRamp, vectorGradientSvgDefs, vectorGradientTAt, vectorGradientTargetPath, vectorGradientUnitsMatrix, vectorHomography, vectorHomographyKeepsQuad, vectorIdentityMesh, vectorInkShapeName, vectorLiveBooleanSteps, vectorMeshColumns, vectorMeshControlBounds, vectorMeshEditPoints, vectorMeshFromOutline, vectorMeshGridCurves, vectorMeshOutline, vectorMeshParamAt, vectorMeshRows, vectorNodeBounds, vectorNodeEnvelope, vectorNodeRotation, vectorNodeToBezier, vectorOperandOperation, vectorPaintToHex, vectorPaintToSvg, vectorParentMatrix, vectorPathData, vectorPathEntries, vectorPathLocalBounds, vectorPathWorldBezier, vectorPathfinderShape, vectorRepeaterCopies, vectorResizeCursor, vectorResultStyle, vectorShapeBuilderHit, vectorShapeBuilderMap, vectorShearForSide, vectorSkewMatrix, vectorStrokeGradientDefs, vectorStrokeLineArea, vectorStrokeOutline, vectorStrokeOutlinePath, vectorStrokeParts, vectorStrokeReach, vectorStrokeSvgParts, vectorStrokeWidthGeometry, vectorToolLabel, vectorWarpPresetGrid, vectorWarpPresetMesh, vectorWorldMatrix, walkVectorNodes, widthProfileAt, widthProfileFromAttribute, widthProfileMaxScale, widthProfilePreset, widthProfilePresetId, widthProfileToAttribute, wigglePaths, zigzagPaths };
|