@pixerate/editor 0.99.0 → 0.101.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/animation-editor/index.cjs +39 -39
- package/dist/animation-editor/index.d.cts +1 -1
- package/dist/animation-editor/index.d.ts +1 -1
- package/dist/animation-editor/index.js +1 -1
- package/dist/{chunk-YGZNGDIT.js → chunk-63EFQCT5.js} +807 -73
- package/dist/chunk-63EFQCT5.js.map +1 -0
- package/dist/{chunk-JF5PXN7W.cjs → chunk-KANRAHTL.cjs} +838 -104
- package/dist/chunk-KANRAHTL.cjs.map +1 -0
- package/dist/image-editor/index.cjs +321 -165
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +70 -11
- package/dist/image-editor/index.d.ts +70 -11
- package/dist/image-editor/index.js +165 -9
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{svg-C9r284x8.d.cts → svg-Bj1MQFh6.d.cts} +395 -2
- package/dist/{svg-MVKBqwD4.d.ts → svg-vme0PLNo.d.ts} +395 -2
- package/dist/vector/index.cjs +1352 -584
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +302 -197
- package/dist/vector/index.d.ts +302 -197
- package/dist/vector/index.js +854 -86
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/pixerate-vector/SKILL.md +52 -2
- package/skills/pixerate-vector/references/commands.md +21 -0
- package/dist/chunk-JF5PXN7W.cjs.map +0 -1
- package/dist/chunk-YGZNGDIT.js.map +0 -1
package/dist/vector/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as Vec2$1, e as VectorSubpath, b as VectorBounds, f as VectorAnchor, V as VectorDocument, a as VectorNode, g as VectorPathNode, h as VectorAnchorType, i as VectorPaint, j as VectorGroupNode, k as VectorCornerKind, l as VectorWidthPoint, m as VectorGradientHandle, n as VectorGradient, o as VectorGradientStop, p as VectorViewport, q as
|
|
2
|
-
export {
|
|
1
|
+
import { d as Vec2$1, e as VectorSubpath, b as VectorBounds, f as VectorAnchor, V as VectorDocument, a as VectorNode, g as VectorPathNode, h as VectorAnchorType, i as VectorPaint, j as VectorGroupNode, k as VectorCornerKind, l as VectorWidthPoint, m as VectorGradientHandle, n as VectorGradient, o as VectorGradientStop, p as VectorViewport, q as VectorTransformHandle, r as VectorAnchorRef, s as VectorPathfinderOperation, t as VectorTool, u as VectorDefaults, v as VectorStyle, w as VectorHandleRef, x as VectorSegmentRef, y as VectorBlendOptions, z as VectorModifiers, c as VectorSvgExportOptions, A as VectorGradientPatch, B as VectorBlendMode, C as VectorFilterType, D as VectorEffectType, E as VectorEnvelopeParams, F as VectorAlign, G as VectorDistribute, H as VectorArrange, I as VectorBooleanOperation, J as VectorAverageAxis, K as VectorWarpMesh, L as VectorArrowhead, M as VectorBlendSpacing, N as VectorGradientInterpolation, O as VectorGradientSpread, P as VectorGradientType, Q as VectorStrokeAlign, R as VectorStrokeGradientMode, S as VectorFilterParamSpec, T as VectorEffectParamSpec, U as VectorRenderStrokeParts, W as VectorPaintDef, X as VectorRenderFilter, Y as VectorArrowAlign, Z as VectorEffect, _ as VectorPaintLayer, $ as VectorStrokeLayer, a0 as VectorFilter, a1 as VectorBlend, a2 as VectorMergeMode, a3 as VectorLineJoin, a4 as VectorEffectParamsMap, a5 as VectorStrokeSettings } from '../svg-Bj1MQFh6.cjs';
|
|
2
|
+
export { a6 as VECTOR_ARROWHEADS, a7 as VECTOR_BLEND_MODES, a8 as VECTOR_BLEND_SPACINGS, a9 as VECTOR_CORNER_KINDS, aa as VECTOR_EFFECT_DEFAULTS, ab as VECTOR_EFFECT_LABELS, ac as VECTOR_EFFECT_PARAM_SPECS, ad as VECTOR_EFFECT_TYPES, ae as VECTOR_FILTER_DEFAULTS, af as VECTOR_FILTER_LABELS, ag as VECTOR_FILTER_MENU, ah as VECTOR_FILTER_PARAM_SPECS, ai as VECTOR_FILTER_TYPES, aj as VECTOR_GRADIENT_INTERPOLATIONS, ak as VECTOR_GRADIENT_MAX_PERIODS, al as VECTOR_GRADIENT_MIN_STOPS, am as VECTOR_GRADIENT_SPREADS, an as VECTOR_GRADIENT_TYPES, ao as VECTOR_MERGE_MODES, ap as VECTOR_PATHFINDER_OPERATIONS, aq as VECTOR_STROKE_GRADIENT_MODES, ar as VECTOR_TOOLS, as as VECTOR_TRANSFORM_HANDLES, at as VectorAppearanceShape, au as VectorBooleanOperand, av as VectorCorner, aw as VectorFillRule, ax as VectorFilterParamsMap, ay as VectorFilterPrimitive, az as VectorGradientPoints, aA as VectorGradientRamp, aB as VectorGradientSvgOptions, aC as VectorGradientUnits, aD as VectorLineCap, aE as VectorMatrix, aF as VectorPaintSvgOptions, aG as VectorRgba, aH as VectorStrokeLayerKind, aI as VectorSvgImportOptions, aJ as VectorSvgPatternDef, aK as VectorSvgWrapper, aL as VectorWarpStyle, aM as activeVectorEffects, aN as activeVectorFilters, aO as applyVectorCornersAttribute, aP as applyVectorEffects, aQ as applyVectorGradientPatch, aR as applyVectorGradientSpread, aS as clearVectorLiveBooleanCache, aT as convertVectorGradient, aU as createVectorEffect, aV as createVectorFilter, aW as defaultVectorGradient, aX as expandVectorAppearance, aY as expandVectorAppearances, aZ as expandVectorGradientSpread, a_ as expandVectorGradientStops, a$ as explicitVectorGradient, b0 as foldVectorBooleanOperands, b1 as gradientMidpointRemap, b2 as hasExplicitGradientGeometry, b3 as hasOwnVectorAppearance, b4 as hasVectorAppearance, b5 as insertVectorGradientStop, b6 as isCentredVectorGradient, b7 as isVectorFilterType, b8 as isVectorGradient, b9 as isVectorLiveBoolean, ba as mapVectorGradient, bb as mapVectorPaint, bc as moveVectorGradientHandle, bd as moveVectorGradientStop, be as normalizeVectorEffectParams, bf as normalizeVectorFilterParams, bg as parseSvgTransform, bh as parseVectorColor, bi as parseVectorSvg, bj as patternAttrs, bk as periodicVectorGradientStops, bl as pinVectorGradient, bm as removeVectorGradientStop, bn as reverseVectorGradient, bo as samplePlainStops, bp as sampleVectorGradient, bq as sampleVectorGradientAt, br as sampleVectorPaintDefAt, bs as sanitizeVectorEffects, bt as sanitizeVectorFilters, bu as sanitizeVectorGradient, bv as setVectorGradientVector, bw as sortedVectorGradientStops, bx as spanVectorGradientStops, by as transformVectorEffects, bz as transformVectorGradient, bA as transformVectorPaint, bB as vectorAppearanceNodes, bC as vectorAppearanceOutline, bD as vectorAppearanceShapes, bE as vectorBoxMatrix, bF as vectorCornersAttribute, bG as vectorDocumentToSvg, bH as vectorEffectInputBounds, bI as vectorEffectInputPaths, bJ as vectorEnteredGroups, bK as vectorEnvelopeFrame, bL as vectorEnvelopeMap, bM as vectorEnvelopeMesh, bN as vectorFilterMarkup, bO as vectorFilterParamKeys, bP as vectorFilterReach, bQ as vectorFilterSvg, bR as vectorGradientArea, bS as vectorGradientAspect, bT as vectorGradientFocalParam, bU as vectorGradientHandles, bV as vectorGradientMatrix, bW as vectorGradientMidpointFromPosition, bX as vectorGradientMidpointPosition, bY as vectorGradientNeedsExpansion, bZ as vectorGradientParam, b_ as vectorGradientPoints, b$ as vectorGradientRamp, c0 as vectorGradientSvgDefs, c1 as vectorGradientTAt, c2 as vectorGradientUnitsMatrix, c3 as vectorLiveBooleanSteps, c4 as vectorNodeEnvelope, c5 as vectorNodeFilterSvg, c6 as vectorNodeLocalPaintBounds, c7 as vectorOperandOperation, c8 as vectorPaintToSvg, c9 as vectorPathLocalBounds, ca as vectorStrokeSvgParts, cb as widthProfileFromAttribute, cc as widthProfileToAttribute } from '../svg-Bj1MQFh6.cjs';
|
|
3
3
|
import { P as Point } from '../types-BFkYA4eF.cjs';
|
|
4
4
|
import { a as BezierPathInput, A as AffineMatrix$1, B as BezierPath, c as BezierSegment } from '../bezier-BfwIbVTl.cjs';
|
|
5
5
|
export { S as SvgGradientDef } from '../bezier-BfwIbVTl.cjs';
|
|
@@ -388,17 +388,6 @@ declare function pressureWidthProfile(samples: readonly {
|
|
|
388
388
|
tolerance?: number;
|
|
389
389
|
}): VectorWidthPoint[];
|
|
390
390
|
|
|
391
|
-
/**
|
|
392
|
-
* The Gradient tool's on-canvas annotator: a bar from the start (or centre) handle to the end (or
|
|
393
|
-
* radius) handle with the colour stops under it and midpoint diamonds above it, plus a radial,
|
|
394
|
-
* conic or diamond gradient's extent outline, aspect handle and (radial) focal point. All in
|
|
395
|
-
* screen pixels, for hit-testing and the overlay.
|
|
396
|
-
*
|
|
397
|
-
* After vectorcraft `crates/tools/src/xform/gradient.rs` (`Annotator`: stop chips below the bar,
|
|
398
|
-
* midpoints above it, a stop dragged off the bar is removed, a click on the bar adds one), ArtCraft,
|
|
399
|
-
* MIT OR Apache-2.0 — see THIRD_PARTY_NOTICES.md.
|
|
400
|
-
*/
|
|
401
|
-
|
|
402
391
|
/** Which paint of the selection the Gradient tool and the gradient editor work on. */
|
|
403
392
|
type VectorGradientTarget = 'fill' | 'stroke';
|
|
404
393
|
/** A part of the annotator under the pointer. */
|
|
@@ -456,9 +445,9 @@ interface VectorGradientAnnotator {
|
|
|
456
445
|
extent: string | null;
|
|
457
446
|
}
|
|
458
447
|
/** The path whose `target` paint the annotator shows: the first path of the selection with a gradient there. */
|
|
459
|
-
declare function vectorGradientTargetPath(doc: VectorDocument, selection: readonly string[], target: VectorGradientTarget): VectorPathNode | null;
|
|
448
|
+
declare function vectorGradientTargetPath(doc: VectorDocument, selection: readonly string[], target: VectorGradientTarget, layer?: number | null): VectorPathNode | null;
|
|
460
449
|
/** The annotator of the selection's gradient (`target` paint), in screen pixels, or null when it has none. */
|
|
461
|
-
declare function getVectorGradientAnnotator(doc: VectorDocument, selection: readonly string[], viewport: VectorViewport, target: VectorGradientTarget): VectorGradientAnnotator | null;
|
|
450
|
+
declare function getVectorGradientAnnotator(doc: VectorDocument, selection: readonly string[], viewport: VectorViewport, target: VectorGradientTarget, layer?: number | null): VectorGradientAnnotator | null;
|
|
462
451
|
/** Where `p` lies relative to the bar: offset along it (0 at the start, 1 at the end) and distance towards the stop chips. */
|
|
463
452
|
declare function vectorGradientBarPosition(a: Pick<VectorGradientAnnotator, 'start' | 'end' | 'normal'>, p: Vec2$1): {
|
|
464
453
|
offset: number;
|
|
@@ -467,185 +456,6 @@ declare function vectorGradientBarPosition(a: Pick<VectorGradientAnnotator, 'sta
|
|
|
467
456
|
/** The annotator part under screen point `p`: stops, then midpoints, the handles and the bar. */
|
|
468
457
|
declare function hitVectorGradientAnnotator(a: VectorGradientAnnotator, p: Vec2$1): VectorGradientPart | null;
|
|
469
458
|
|
|
470
|
-
/**
|
|
471
|
-
* Live appearance: path effect stacks and live boolean groups, evaluated on demand while the
|
|
472
|
-
* stored anchors and children stay editable.
|
|
473
|
-
*
|
|
474
|
-
* `expandVectorAppearance` is the one place the effected geometry is made (cached per node
|
|
475
|
-
* object, so an edit recomputes only the nodes it replaced). Rendering, hit-testing, bounds,
|
|
476
|
-
* snapping, booleans, the Pathfinder, the Shape Builder and SVG export all read it, the way they
|
|
477
|
-
* read live corners through `subpathsToBezier`; Expand Appearance stores it.
|
|
478
|
-
*
|
|
479
|
-
* Stacking follows After Effects' shape layers (effectcraft `crates/render/src/shapes.rs`): an
|
|
480
|
-
* effect acts on every path above it — the node's own outline, or for a group every path of its
|
|
481
|
-
* children (nested groups included, as drawn by their own effects) — in the order of the stack,
|
|
482
|
-
* and effects placed after a repeater act on its copies. The result paints with the style of the
|
|
483
|
-
* path each shape came from; Merge Paths and live booleans paint with the bottom one's.
|
|
484
|
-
*
|
|
485
|
-
* Live booleans fold their operands bottom to top, each combined with the result below it by its
|
|
486
|
-
* own operation or the group's, and every prefix of the fold is cached under a rolling hash of the
|
|
487
|
-
* operands it covers, so editing one operand recombines only the operands from it up; the cache
|
|
488
|
-
* drops its least recently used half when full. Live groups are hit by their result except while
|
|
489
|
-
* they are being edited (`vectorEnteredGroups`).
|
|
490
|
-
*
|
|
491
|
-
* Ported from ArtCraft (MIT OR Apache-2.0, © ArtCraft Team and contributors; see
|
|
492
|
-
* THIRD_PARTY_NOTICES.md): the stacking rule of effectcraft `crates/render/src/shapes.rs`
|
|
493
|
-
* (`collect()`); figcraft `crates/render/src/boolean.rs` (`fold_cached`, `PathCache`) and
|
|
494
|
-
* `crates/engine/src/booleans.rs` (`operand_op`, `result_outline`); and the live-object model of
|
|
495
|
-
* vectorcraft `crates/doc/src/live.rs` (`expand_live`, `expanded_group`, `subtree_has_live`).
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
/** One shape of a node's appearance: a path in the node's own space, painted in `source`'s style. */
|
|
499
|
-
interface VectorAppearanceShape {
|
|
500
|
-
/** The path whose style paints it. */
|
|
501
|
-
source: VectorPathNode;
|
|
502
|
-
path: BezierPath;
|
|
503
|
-
/** Opacity factor relative to the node (its own opacity not included). */
|
|
504
|
-
opacity: number;
|
|
505
|
-
/** Draw-order key (compared element by element). */
|
|
506
|
-
order: number[];
|
|
507
|
-
}
|
|
508
|
-
/** Default parameters of each effect type. */
|
|
509
|
-
declare const VECTOR_EFFECT_DEFAULTS: {
|
|
510
|
-
readonly [K in VectorEffectType]: VectorEffectParamsMap[K];
|
|
511
|
-
};
|
|
512
|
-
declare const VECTOR_EFFECT_LABELS: Record<VectorEffectType, string>;
|
|
513
|
-
/** How a panel edits one effect parameter. */
|
|
514
|
-
type VectorEffectParamSpec = {
|
|
515
|
-
key: string;
|
|
516
|
-
label: string;
|
|
517
|
-
kind: 'number';
|
|
518
|
-
min?: number;
|
|
519
|
-
max?: number;
|
|
520
|
-
step: number;
|
|
521
|
-
slider?: boolean;
|
|
522
|
-
} | {
|
|
523
|
-
key: string;
|
|
524
|
-
label: string;
|
|
525
|
-
kind: 'vec2';
|
|
526
|
-
step: number;
|
|
527
|
-
} | {
|
|
528
|
-
key: string;
|
|
529
|
-
label: string;
|
|
530
|
-
kind: 'boolean';
|
|
531
|
-
} | {
|
|
532
|
-
key: string;
|
|
533
|
-
label: string;
|
|
534
|
-
kind: 'select';
|
|
535
|
-
options: {
|
|
536
|
-
value: string;
|
|
537
|
-
label: string;
|
|
538
|
-
}[];
|
|
539
|
-
};
|
|
540
|
-
/** The editable parameters of each effect type, in panel order. */
|
|
541
|
-
declare const VECTOR_EFFECT_PARAM_SPECS: Record<VectorEffectType, VectorEffectParamSpec[]>;
|
|
542
|
-
/** Envelope parameters. */
|
|
543
|
-
type VectorEnvelopeParams = VectorEffectParamsMap['envelope'];
|
|
544
|
-
/**
|
|
545
|
-
* The envelope's mesh over `bounds` (the paths' combined bounds), in the node's space: its own
|
|
546
|
-
* mesh, the flat mesh of `columns × rows` patches, or a preset split exactly into that many patches.
|
|
547
|
-
*/
|
|
548
|
-
declare function vectorEnvelopeMesh(params: VectorEnvelopeParams, bounds: VectorBounds): VectorWarpMesh;
|
|
549
|
-
/** The envelope as a map of the node's space over `bounds`, or null when it changes nothing (or the box is empty). */
|
|
550
|
-
declare function vectorEnvelopeMap(params: VectorEnvelopeParams, bounds: VectorBounds | null): ((p: {
|
|
551
|
-
x: number;
|
|
552
|
-
y: number;
|
|
553
|
-
}) => {
|
|
554
|
-
x: number;
|
|
555
|
-
y: number;
|
|
556
|
-
}) | null;
|
|
557
|
-
/**
|
|
558
|
-
* Effect parameters with defaults filled in and invalid values dropped (unknown keys go too).
|
|
559
|
-
* Returns null for an unknown type.
|
|
560
|
-
*/
|
|
561
|
-
declare function normalizeVectorEffectParams<K extends VectorEffectType>(type: K, params: Record<string, unknown> | null | undefined, base?: VectorEffectParamsMap[K]): VectorEffectParamsMap[K] | null;
|
|
562
|
-
/** A new effect of `type` (defaults merged with `params`), or null for an unknown type. */
|
|
563
|
-
declare function createVectorEffect<K extends VectorEffectType>(type: K, id: string, params?: Partial<VectorEffectParamsMap[K]> | Record<string, unknown>): Extract<VectorEffect, {
|
|
564
|
-
type: K;
|
|
565
|
-
}> | null;
|
|
566
|
-
/** The node's effects that take part (enabled, of a known type). */
|
|
567
|
-
declare function activeVectorEffects(node: VectorNode): VectorEffect[];
|
|
568
|
-
/** Whether the node itself draws differently from its stored geometry (effects or a live boolean). */
|
|
569
|
-
declare function hasOwnVectorAppearance(node: VectorNode): boolean;
|
|
570
|
-
/** Whether the node or anything inside it has a live appearance. */
|
|
571
|
-
declare function hasVectorAppearance(node: VectorNode): boolean;
|
|
572
|
-
/** A live boolean group (its children are operands). */
|
|
573
|
-
declare function isVectorLiveBoolean(node: VectorNode | null | undefined): node is VectorGroupNode & {
|
|
574
|
-
liveBoolean: VectorBooleanOperation;
|
|
575
|
-
};
|
|
576
|
-
/** How operand `child` of a live boolean group combines with the operands below it. */
|
|
577
|
-
declare function vectorOperandOperation(group: VectorGroupNode, child: VectorNode): VectorBooleanOperation;
|
|
578
|
-
/** How many boolean steps (one operand combined with the result below it) live booleans have computed: what a cache miss costs. */
|
|
579
|
-
declare function vectorLiveBooleanSteps(): number;
|
|
580
|
-
/** Empties the live boolean prefix cache. */
|
|
581
|
-
declare function clearVectorLiveBooleanCache(): void;
|
|
582
|
-
/** One operand of a live boolean: its outline (group space), fill rule and operation (unused for the bottom one). */
|
|
583
|
-
interface VectorBooleanOperand {
|
|
584
|
-
path: BezierPath;
|
|
585
|
-
fillRule: VectorFillRule;
|
|
586
|
-
operation: VectorBooleanOperation;
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* The result of folding `operands` bottom to top, reusing the longest cached prefix: only the
|
|
590
|
-
* operands above it are combined. Invalid geometry gives an empty path.
|
|
591
|
-
*/
|
|
592
|
-
declare function foldVectorBooleanOperands(operands: readonly VectorBooleanOperand[]): BezierPath;
|
|
593
|
-
/** Applies an effect stack to shapes, top to bottom (disabled effects skipped). */
|
|
594
|
-
declare function applyVectorEffects(shapes: readonly VectorAppearanceShape[], effects: readonly VectorEffect[] | null | undefined): VectorAppearanceShape[];
|
|
595
|
-
/** The paths entering effect `effectId` of the node's stack (those above it applied), in the node's own space. */
|
|
596
|
-
declare function vectorEffectInputPaths(node: VectorNode, effectId: string): BezierPath[] | null;
|
|
597
|
-
/** The box effect `effectId` (an envelope) bends: the combined bounds of the paths entering it, in the node's own space. */
|
|
598
|
-
declare function vectorEffectInputBounds(node: VectorNode, effectId: string): VectorBounds | null;
|
|
599
|
-
/** The node's first enabled envelope effect, or null. */
|
|
600
|
-
declare function vectorNodeEnvelope(node: VectorNode | null | undefined): Extract<VectorEffect, {
|
|
601
|
-
type: 'envelope';
|
|
602
|
-
}> | null;
|
|
603
|
-
/**
|
|
604
|
-
* The editable mesh of a node's envelope (its own mesh, or the preset or flat mesh it stands for)
|
|
605
|
-
* with the box it bends, in the node's own space; null without an envelope or contents.
|
|
606
|
-
*/
|
|
607
|
-
declare function vectorEnvelopeFrame(node: VectorNode, effectId?: string): {
|
|
608
|
-
effectId: string;
|
|
609
|
-
bounds: VectorBounds;
|
|
610
|
-
mesh: VectorWarpMesh;
|
|
611
|
-
} | null;
|
|
612
|
-
/**
|
|
613
|
-
* What a node draws as: shapes in its own space (its `transform` and opacity not applied),
|
|
614
|
-
* bottom to top, with its effects and those of everything inside it applied. Cached per node
|
|
615
|
-
* object.
|
|
616
|
-
*/
|
|
617
|
-
declare function vectorAppearanceShapes(node: VectorNode): VectorAppearanceShape[];
|
|
618
|
-
/** Everything a node draws as one path in its own space (live corners cut, effects applied). */
|
|
619
|
-
declare function vectorAppearanceOutline(node: VectorNode): BezierPath;
|
|
620
|
-
/** What a node draws as, one plain path per shape (ids `<id>~fx<n>`, opacity relative to the node). */
|
|
621
|
-
declare function vectorAppearanceNodes(node: VectorNode): VectorPathNode[];
|
|
622
|
-
/**
|
|
623
|
-
* The node as plain geometry: path effects and live booleans evaluated into paths (the node
|
|
624
|
-
* itself when nothing inside it is live). A path keeps its id when it draws as one shape;
|
|
625
|
-
* otherwise, like any live group, it becomes a group with that id holding one path per shape
|
|
626
|
-
* (ids `<id>~fx<n>`). Groups without effects of their own keep their structure. Cached per node.
|
|
627
|
-
*/
|
|
628
|
-
declare function expandVectorAppearance(node: VectorNode): VectorNode;
|
|
629
|
-
/** Every node of a list expanded (the same array when nothing in it is live). */
|
|
630
|
-
declare function expandVectorAppearances(nodes: readonly VectorNode[]): VectorNode[];
|
|
631
|
-
/**
|
|
632
|
-
* Reads effects from untrusted data (JSON, agent input): unknown types and malformed entries are
|
|
633
|
-
* dropped, parameters normalized, ids made unique.
|
|
634
|
-
*/
|
|
635
|
-
declare function sanitizeVectorEffects(value: unknown): VectorEffect[];
|
|
636
|
-
/**
|
|
637
|
-
* Effect parameters carried through a linear map baked into a node's geometry (scaling or
|
|
638
|
-
* flipping it): offsets and positions move with it, angles turn the other way when it mirrors.
|
|
639
|
-
* Lengths such as sizes and radii are kept, like stroke widths.
|
|
640
|
-
*/
|
|
641
|
-
declare function transformVectorEffects(effects: readonly VectorEffect[], m: AffineMatrix$1, node?: VectorNode): VectorEffect[];
|
|
642
|
-
/**
|
|
643
|
-
* The live groups (live booleans and groups with effects) being edited: those in `ids` and those
|
|
644
|
-
* holding a node in `ids`. Their children are hit and outlined as stored instead of as drawn, so
|
|
645
|
-
* each operand can be picked (figcraft `crates/engine/src/booleans.rs`, `result_outline`).
|
|
646
|
-
*/
|
|
647
|
-
declare function vectorEnteredGroups(nodes: readonly VectorNode[], ids: readonly string[]): Set<string>;
|
|
648
|
-
|
|
649
459
|
/** A map of the plane (document or node space). */
|
|
650
460
|
type VectorPointMap = (p: Vec2$1) => Vec2$1;
|
|
651
461
|
/** Every anchor and handle of `subpaths` through `f` (no subdivision). */
|
|
@@ -1172,9 +982,11 @@ interface VectorEditorState {
|
|
|
1172
982
|
/** Options new blends get. */
|
|
1173
983
|
blendDefaults: VectorBlendOptions;
|
|
1174
984
|
/** The paint the gradient tool and gradient editor work on, and the selected stop (index into the sorted stops). */
|
|
985
|
+
/** The paint the gradient tool and editor work on: `target`, and `layer` of its stack (null: the top layer, through the shorthand). */
|
|
1175
986
|
gradientEdit: {
|
|
1176
987
|
target: VectorGradientTarget;
|
|
1177
988
|
stop: number | null;
|
|
989
|
+
layer: number | null;
|
|
1178
990
|
};
|
|
1179
991
|
/**
|
|
1180
992
|
* Free Distort mode of the selection box: dragging a corner distorts in perspective (each corner
|
|
@@ -1270,7 +1082,7 @@ interface VectorShapeInput extends VectorStyle {
|
|
|
1270
1082
|
name?: string;
|
|
1271
1083
|
}
|
|
1272
1084
|
/** Every field of `VectorStyle`, in the order style panels and commands list them. */
|
|
1273
|
-
declare const VECTOR_STYLE_KEYS: readonly ["fill", "stroke", "strokeWidth", "strokeLinecap", "strokeLinejoin", "strokeDasharray", "fillRule", "strokeAlign", "startArrow", "endArrow", "arrowAlign", "startArrowScale", "endArrowScale", "strokeWidthProfile"];
|
|
1085
|
+
declare const VECTOR_STYLE_KEYS: readonly ["fill", "stroke", "strokeWidth", "strokeLinecap", "strokeLinejoin", "strokeDasharray", "fillRule", "strokeAlign", "startArrow", "endArrow", "arrowAlign", "startArrowScale", "endArrowScale", "strokeWidthProfile", "fills", "strokes"];
|
|
1274
1086
|
/** Clipboard payload type written by `copy()`. */
|
|
1275
1087
|
declare const VECTOR_CLIPBOARD_TYPE = "pixerate/vector";
|
|
1276
1088
|
/** Screen distance of the rotation handle above the selection box. */
|
|
@@ -1593,7 +1405,7 @@ declare class VectorEditorController {
|
|
|
1593
1405
|
ids?: readonly string[];
|
|
1594
1406
|
}): VectorActionResult;
|
|
1595
1407
|
/** Which paint (fill or stroke) the gradient tool and editor work on. */
|
|
1596
|
-
setGradientTarget(target: VectorGradientTarget): void;
|
|
1408
|
+
setGradientTarget(target: VectorGradientTarget, layer?: number | null): void;
|
|
1597
1409
|
/** Selects a stop of the gradient being edited (index into its sorted stops), or none. */
|
|
1598
1410
|
selectGradientStop(index: number | null): void;
|
|
1599
1411
|
/** The gradient tool's annotator for the selection (screen pixels), or null when its paint is not a gradient. */
|
|
@@ -1608,6 +1420,7 @@ declare class VectorEditorController {
|
|
|
1608
1420
|
setGradient(patch: VectorGradientPatch, options?: {
|
|
1609
1421
|
ids?: readonly string[];
|
|
1610
1422
|
target?: VectorGradientTarget;
|
|
1423
|
+
layer?: number | null;
|
|
1611
1424
|
label?: string;
|
|
1612
1425
|
merge?: string;
|
|
1613
1426
|
}): VectorActionResult;
|
|
@@ -1701,6 +1514,75 @@ declare class VectorEditorController {
|
|
|
1701
1514
|
outlineStroke(options?: {
|
|
1702
1515
|
ids?: readonly string[];
|
|
1703
1516
|
}): string[];
|
|
1517
|
+
/** Paths of the selected (or given) nodes whose stacks can be edited (groups give every path inside; blend steps are left out). */
|
|
1518
|
+
private stackTargets;
|
|
1519
|
+
/** Applies `fn` to the `kind` stack of every target path as one undo step (an error string from any path cancels it). */
|
|
1520
|
+
private editStacks;
|
|
1521
|
+
/**
|
|
1522
|
+
* Reads a layer patch from untrusted input: paint, opacity, blend mode, visibility and (strokes)
|
|
1523
|
+
* the stroke settings, where `null` removes a setting. Returns an error string for invalid values.
|
|
1524
|
+
*/
|
|
1525
|
+
private layerPatch;
|
|
1526
|
+
/**
|
|
1527
|
+
* Adds a fill or stroke layer to the selected (or given) paths (groups: every path inside), at
|
|
1528
|
+
* the top of the stack or at `index` (0 is the bottom). A new stroke takes the settings of the
|
|
1529
|
+
* stack's top stroke unless `layer` gives them. One undo step.
|
|
1530
|
+
*/
|
|
1531
|
+
addPaintLayer(kind: 'fill' | 'stroke', layer?: Record<string, unknown>, options?: {
|
|
1532
|
+
ids?: readonly string[];
|
|
1533
|
+
index?: number;
|
|
1534
|
+
}): VectorActionResult;
|
|
1535
|
+
/**
|
|
1536
|
+
* Changes layer `index` (0 is the bottom) of the fill or stroke stack of the selected (or given)
|
|
1537
|
+
* paths: paint, opacity, blend mode, visibility and, for strokes, any stroke setting (`null`
|
|
1538
|
+
* removes it). Fails, changing nothing, when a path has no layer `index`. With `merge` (true, or
|
|
1539
|
+
* a key), consecutive edits of the layer fold into one undo step (a slider drag).
|
|
1540
|
+
*/
|
|
1541
|
+
updatePaintLayer(kind: 'fill' | 'stroke', index: number, patch: Record<string, unknown>, options?: {
|
|
1542
|
+
ids?: readonly string[];
|
|
1543
|
+
merge?: boolean | string;
|
|
1544
|
+
}): VectorActionResult;
|
|
1545
|
+
/** Removes layer `index` of the fill or stroke stack of the selected (or given) paths. */
|
|
1546
|
+
removePaintLayer(kind: 'fill' | 'stroke', index: number, options?: {
|
|
1547
|
+
ids?: readonly string[];
|
|
1548
|
+
}): VectorActionResult;
|
|
1549
|
+
/** Moves layer `from` of the fill or stroke stack to position `to` (0 is the bottom) on the selected (or given) paths. */
|
|
1550
|
+
movePaintLayer(kind: 'fill' | 'stroke', from: number, to: number, options?: {
|
|
1551
|
+
ids?: readonly string[];
|
|
1552
|
+
}): VectorActionResult;
|
|
1553
|
+
/** Replaces the whole fill or stroke stack of the selected (or given) paths (malformed layers are dropped). */
|
|
1554
|
+
setPaintLayers(kind: 'fill' | 'stroke', layers: readonly unknown[], options?: {
|
|
1555
|
+
ids?: readonly string[];
|
|
1556
|
+
}): VectorActionResult;
|
|
1557
|
+
/** Sets the blend mode of the selected (or given) nodes (paths or groups); `normal` removes it. */
|
|
1558
|
+
setBlendMode(mode: VectorBlendMode, options?: {
|
|
1559
|
+
ids?: readonly string[];
|
|
1560
|
+
}): VectorActionResult;
|
|
1561
|
+
/**
|
|
1562
|
+
* Adds a filter of `type` to the selected (or given) nodes, at the end of each stack (or at
|
|
1563
|
+
* `index`), with default parameters merged with `params`. One undo step; returns the new filter
|
|
1564
|
+
* ids (one per node, in order), empty for an unknown type or nothing selected.
|
|
1565
|
+
*/
|
|
1566
|
+
addFilter(type: VectorFilterType, options?: {
|
|
1567
|
+
ids?: readonly string[];
|
|
1568
|
+
params?: Record<string, unknown>;
|
|
1569
|
+
index?: number;
|
|
1570
|
+
}): string[];
|
|
1571
|
+
private editFilters;
|
|
1572
|
+
/**
|
|
1573
|
+
* Turns a filter on or off and changes its parameters (invalid values are ignored). With
|
|
1574
|
+
* `merge`, consecutive updates of the same filter fold into one undo step.
|
|
1575
|
+
*/
|
|
1576
|
+
updateFilter(nodeId: string, filterId: string, patch: {
|
|
1577
|
+
enabled?: boolean;
|
|
1578
|
+
params?: Record<string, unknown>;
|
|
1579
|
+
}, options?: {
|
|
1580
|
+
merge?: boolean | string;
|
|
1581
|
+
}): VectorActionResult;
|
|
1582
|
+
/** Removes a filter from a node's stack. */
|
|
1583
|
+
removeFilter(nodeId: string, filterId: string): VectorActionResult;
|
|
1584
|
+
/** Moves a filter to position `index` of its node's stack. */
|
|
1585
|
+
moveFilter(nodeId: string, filterId: string, index: number): VectorActionResult;
|
|
1704
1586
|
/** Selected (or given) nodes that can carry effects: the roots of the selection. */
|
|
1705
1587
|
private effectTargets;
|
|
1706
1588
|
/**
|
|
@@ -2246,6 +2128,37 @@ interface VectorRenderPath {
|
|
|
2246
2128
|
* `stroke`; group them under `id`, `transform` and `opacity`.
|
|
2247
2129
|
*/
|
|
2248
2130
|
strokeParts?: VectorRenderStrokeParts;
|
|
2131
|
+
/**
|
|
2132
|
+
* Set when the path paints through its fill and stroke stacks (several layers, or a layer with
|
|
2133
|
+
* its own opacity, blend mode or visibility): draw a `<g>` with `id`, `transform`, `opacity`,
|
|
2134
|
+
* `blendMode` and `filter`, holding each layer in order, bottom to top, as a path of `d` (see
|
|
2135
|
+
* `VectorRenderPaintLayer`). `fill`, `stroke` and `strokeParts` above then describe the top
|
|
2136
|
+
* drawn layers only, for readers that draw one paint.
|
|
2137
|
+
*/
|
|
2138
|
+
layers?: VectorRenderPaintLayer[];
|
|
2139
|
+
/** CSS `mix-blend-mode` of the whole node (absent: normal). */
|
|
2140
|
+
blendMode?: string;
|
|
2141
|
+
/** `url(#id)` of the node's filter in `filters` (shadows, glows, blurs, feather). */
|
|
2142
|
+
filter?: string;
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* One drawn layer of a path's paint stack: a fill (`fill` set, `stroke` none) or a stroke with its
|
|
2146
|
+
* own settings and parts (`strokeParts` as on `VectorRenderPath`). Draw it with `opacity` and
|
|
2147
|
+
* `mix-blend-mode: blendMode` on its element (or on the group of its parts).
|
|
2148
|
+
*/
|
|
2149
|
+
interface VectorRenderPaintLayer {
|
|
2150
|
+
kind: 'fill' | 'stroke';
|
|
2151
|
+
/** Index in its stack (bottom to top). */
|
|
2152
|
+
index: number;
|
|
2153
|
+
fill: string;
|
|
2154
|
+
stroke: string;
|
|
2155
|
+
strokeWidth: number;
|
|
2156
|
+
strokeLinecap?: string;
|
|
2157
|
+
strokeLinejoin?: string;
|
|
2158
|
+
strokeDasharray?: string;
|
|
2159
|
+
opacity: number;
|
|
2160
|
+
blendMode?: string;
|
|
2161
|
+
strokeParts?: VectorRenderStrokeParts;
|
|
2249
2162
|
}
|
|
2250
2163
|
interface VectorRenderGroup {
|
|
2251
2164
|
kind: 'group';
|
|
@@ -2253,6 +2166,10 @@ interface VectorRenderGroup {
|
|
|
2253
2166
|
/** SVG `transform` (`matrix(…)`) for a rotated group. */
|
|
2254
2167
|
transform?: string;
|
|
2255
2168
|
opacity: number;
|
|
2169
|
+
/** CSS `mix-blend-mode` of the group (absent: normal). */
|
|
2170
|
+
blendMode?: string;
|
|
2171
|
+
/** `url(#id)` of the group's filter in `filters`. */
|
|
2172
|
+
filter?: string;
|
|
2256
2173
|
children: VectorRenderNode[];
|
|
2257
2174
|
}
|
|
2258
2175
|
type VectorRenderNode = VectorRenderPath | VectorRenderGroup;
|
|
@@ -2268,6 +2185,8 @@ interface VectorSceneRenderData {
|
|
|
2268
2185
|
* draw each of `gradients`, then each tile filled, inside a `<pattern>`).
|
|
2269
2186
|
*/
|
|
2270
2187
|
defs: VectorPaintDef[];
|
|
2188
|
+
/** Filters referenced by nodes' `filter` (draw each as an SVG `<filter>`, see `VectorRenderFilter`). */
|
|
2189
|
+
filters: VectorRenderFilter[];
|
|
2271
2190
|
/** Visible nodes, bottom to top. */
|
|
2272
2191
|
nodes: VectorRenderNode[];
|
|
2273
2192
|
}
|
|
@@ -2710,6 +2629,8 @@ declare const VECTOR_STROKE_GRADIENT_MODE_LABELS: Readonly<Record<VectorStrokeGr
|
|
|
2710
2629
|
/** What a gradient editor shows for the selection's `target` paint (see `getVectorGradientEditor`). */
|
|
2711
2630
|
interface VectorGradientEditorData {
|
|
2712
2631
|
target: 'fill' | 'stroke';
|
|
2632
|
+
/** The layer of the `target` stack edited (null: the top one). */
|
|
2633
|
+
layer: number | null;
|
|
2713
2634
|
/** The first selected path's paint is a gradient. */
|
|
2714
2635
|
gradient: VectorGradient | null;
|
|
2715
2636
|
/** The paint as a `#rrggbb` colour when it is one (what a new gradient starts from). */
|
|
@@ -2792,6 +2713,65 @@ declare const VECTOR_EFFECT_MENU: readonly {
|
|
|
2792
2713
|
}[];
|
|
2793
2714
|
/** The Effects panel of the selection, or null when nothing that takes effects is selected. */
|
|
2794
2715
|
declare function getVectorEffectsPanel(state: Pick<VectorEditorState, 'document' | 'selection'>): VectorEffectsPanelData | null;
|
|
2716
|
+
/** One fill or stroke layer as an appearance panel lists it. */
|
|
2717
|
+
interface VectorAppearancePanelLayer {
|
|
2718
|
+
kind: 'fill' | 'stroke';
|
|
2719
|
+
/** Index in its stack (0 is the bottom); what `updatePaintLayer` and friends take. */
|
|
2720
|
+
index: number;
|
|
2721
|
+
paint: VectorPaint;
|
|
2722
|
+
/** The paint as `#rrggbb` when it is one (for a colour input). */
|
|
2723
|
+
color: string | null;
|
|
2724
|
+
/** A CSS `background` showing the paint (a colour, or the gradient's ramp). */
|
|
2725
|
+
swatch: string;
|
|
2726
|
+
gradient: boolean;
|
|
2727
|
+
opacity: number;
|
|
2728
|
+
blendMode: VectorBlendMode;
|
|
2729
|
+
visible: boolean;
|
|
2730
|
+
/** Stroke layers: width and alignment (for the compact row). */
|
|
2731
|
+
strokeWidth?: number;
|
|
2732
|
+
strokeAlign?: VectorStrokeAlign;
|
|
2733
|
+
/** A stroke of a kind this version cannot draw (kept, shown read-only). */
|
|
2734
|
+
unknownKind?: string;
|
|
2735
|
+
/** The gradient editor and tool work on this layer. */
|
|
2736
|
+
editing: boolean;
|
|
2737
|
+
}
|
|
2738
|
+
/** What an appearance panel shows for the selection. */
|
|
2739
|
+
interface VectorAppearancePanelData {
|
|
2740
|
+
/** Selected nodes (blend mode and filters apply to them). */
|
|
2741
|
+
nodeIds: string[];
|
|
2742
|
+
/** Paths the stacks belong to (groups give every path inside); the first one's stacks are listed. */
|
|
2743
|
+
pathIds: string[];
|
|
2744
|
+
fills: VectorAppearancePanelLayer[];
|
|
2745
|
+
strokes: VectorAppearancePanelLayer[];
|
|
2746
|
+
/** The first selected node's blend mode. */
|
|
2747
|
+
blendMode: VectorBlendMode;
|
|
2748
|
+
mixed: {
|
|
2749
|
+
fills: boolean;
|
|
2750
|
+
strokes: boolean;
|
|
2751
|
+
blendMode: boolean;
|
|
2752
|
+
};
|
|
2753
|
+
/** The filter stack, listed when one node is selected (`filterNodeId`). */
|
|
2754
|
+
filterNodeId: string | null;
|
|
2755
|
+
filters: VectorFiltersPanelItem[];
|
|
2756
|
+
}
|
|
2757
|
+
/** One filter of the listed stack, with what a panel needs to edit it. */
|
|
2758
|
+
interface VectorFiltersPanelItem {
|
|
2759
|
+
id: string;
|
|
2760
|
+
type: VectorFilterType;
|
|
2761
|
+
label: string;
|
|
2762
|
+
enabled: boolean;
|
|
2763
|
+
params: Record<string, unknown>;
|
|
2764
|
+
specs: readonly VectorFilterParamSpec[];
|
|
2765
|
+
}
|
|
2766
|
+
/** A CSS background for a paint: the colour, or a left-to-right ramp of a gradient's stops. */
|
|
2767
|
+
declare function vectorPaintSwatch(paint: VectorPaint | undefined): string;
|
|
2768
|
+
/** The appearance panel of the selection, or null with nothing selected. */
|
|
2769
|
+
declare function getVectorAppearancePanel(state: Pick<VectorEditorState, 'document' | 'selection' | 'gradientEdit'>): VectorAppearancePanelData | null;
|
|
2770
|
+
/** Blend modes in menu order, with their names. */
|
|
2771
|
+
declare const VECTOR_BLEND_MODE_MENU: readonly {
|
|
2772
|
+
mode: VectorBlendMode;
|
|
2773
|
+
label: string;
|
|
2774
|
+
}[];
|
|
2795
2775
|
|
|
2796
2776
|
interface VectorCommandOptions {
|
|
2797
2777
|
/** Id prefix (default `vector.`); use one per editor when several are registered. */
|
|
@@ -2843,6 +2823,14 @@ interface VectorNodeListing {
|
|
|
2843
2823
|
liveBoolean?: VectorBooleanOperation;
|
|
2844
2824
|
/** An operand's own operation in a live boolean group. */
|
|
2845
2825
|
booleanOperation?: VectorBooleanOperation;
|
|
2826
|
+
/** The fill stack, bottom to top, when the path has more than its `fill` says. */
|
|
2827
|
+
fills?: VectorPaintLayer[];
|
|
2828
|
+
/** The stroke stack, bottom to top, when the path has more than its `stroke` says. */
|
|
2829
|
+
strokes?: VectorStrokeLayer[];
|
|
2830
|
+
/** The node's blend mode, when not normal. */
|
|
2831
|
+
blendMode?: VectorBlendMode;
|
|
2832
|
+
/** The node's visual filters (shadows, glows, blurs, feather). */
|
|
2833
|
+
filters?: VectorFilter[];
|
|
2846
2834
|
}
|
|
2847
2835
|
/**
|
|
2848
2836
|
* Palette and agent commands for a vector editor: list, select, add shapes and paths, style,
|
|
@@ -3641,4 +3629,121 @@ declare function vectorMeshFromOutline(sp: VectorSubpath, columns?: number, rows
|
|
|
3641
3629
|
/** The mesh's border as one closed subpath (clockwise from the top-left corner): what Release gives back as the envelope's shape. */
|
|
3642
3630
|
declare function vectorMeshOutline(m: VectorWarpMesh): VectorSubpath;
|
|
3643
3631
|
|
|
3644
|
-
|
|
3632
|
+
/**
|
|
3633
|
+
* Fill and stroke stacks: several paints per path, each with its own opacity, blend mode and
|
|
3634
|
+
* visibility, and each stroke with its own width, alignment, dashes, arrowheads and profile.
|
|
3635
|
+
*
|
|
3636
|
+
* The stacks live in `fills` / `strokes`, bottom to top; fills draw under strokes. The single
|
|
3637
|
+
* `fill` / `stroke` fields (and the stroke settings) stay as shorthands that mirror the top layer
|
|
3638
|
+
* of each stack, so everything written against one fill and one stroke — booleans, blends, the
|
|
3639
|
+
* gradient tool, agent commands, old documents — keeps working:
|
|
3640
|
+
*
|
|
3641
|
+
* - A node without `fills` has the one-layer stack its `fill` says (none without a paint); the
|
|
3642
|
+
* same for strokes. Stacks of one plain layer are stored that way, so old documents and simple
|
|
3643
|
+
* nodes look exactly as before.
|
|
3644
|
+
* - `normalizeVectorPaintStacks` reconciles the two forms. Loading prefers the stacks (the
|
|
3645
|
+
* shorthand is re-derived); editing prefers the shorthand: a node whose `fill` no longer matches
|
|
3646
|
+
* its top fill was written by shorthand code, so the top layer takes the new paint (`null`
|
|
3647
|
+
* clears the stack). The controller runs it after every change.
|
|
3648
|
+
*
|
|
3649
|
+
* Paint layers are drawn, hit-tested and exported through `vectorPaintLayerNodes`: one plain path
|
|
3650
|
+
* node per layer (the node with only that fill, or only that stroke and its settings), so the
|
|
3651
|
+
* existing paint, stroke-part and gradient code serves each layer unchanged.
|
|
3652
|
+
*
|
|
3653
|
+
* The data model follows figcraft `crates/color/src/lib.rs` (`Paint { kind, opacity, visible,
|
|
3654
|
+
* blend }` in a list per node) and vectorcraft `crates/doc/src/appearance.rs` (`FillLayer` /
|
|
3655
|
+
* `StrokeLayer`, each stroke with its own settings). Ported from ArtCraft (MIT OR Apache-2.0,
|
|
3656
|
+
* © ArtCraft Team and contributors; see THIRD_PARTY_NOTICES.md).
|
|
3657
|
+
*/
|
|
3658
|
+
|
|
3659
|
+
/** The stroke settings each stroke layer has of its own, in `VectorStyle` field names. */
|
|
3660
|
+
declare const VECTOR_STROKE_SETTING_KEYS: readonly (keyof VectorStrokeSettings)[];
|
|
3661
|
+
declare const VECTOR_BLEND_MODE_LABELS: Readonly<Record<VectorBlendMode, string>>;
|
|
3662
|
+
declare function isVectorBlendMode(value: unknown): value is VectorBlendMode;
|
|
3663
|
+
/** A blend mode as a CSS `mix-blend-mode` value, or undefined for `normal` (nothing to write). */
|
|
3664
|
+
declare function vectorBlendModeCss(mode: VectorBlendMode | null | undefined): string | undefined;
|
|
3665
|
+
/** A CSS `mix-blend-mode` value back to a blend mode (`plus-lighter` is `linear-dodge`), or null when SVG offers it but we don't. */
|
|
3666
|
+
declare function vectorBlendModeFromCss(value: string | null | undefined): VectorBlendMode | null;
|
|
3667
|
+
/** A layer with full opacity, `normal` blending, visible and (strokes) a plain paint: what the shorthand alone can say. */
|
|
3668
|
+
declare function isPlainVectorPaintLayer(layer: VectorPaintLayer | VectorStrokeLayer): boolean;
|
|
3669
|
+
/** Whether a layer is drawn: visible, a plain paint (strokes), a paint that draws something, above zero opacity. */
|
|
3670
|
+
declare function isDrawnVectorPaintLayer(layer: VectorPaintLayer | VectorStrokeLayer): boolean;
|
|
3671
|
+
/** The fill stack of a path (or style), bottom to top: `fills`, or the one layer `fill` makes. */
|
|
3672
|
+
declare function vectorFills(style: VectorStyle): VectorPaintLayer[];
|
|
3673
|
+
/** The stroke settings a style gives its shorthand stroke (only those set). */
|
|
3674
|
+
declare function vectorStrokeSettings(style: VectorStyle): VectorStrokeSettings;
|
|
3675
|
+
/** The stroke stack of a path (or style), bottom to top: `strokes`, or the one layer `stroke` and the stroke settings make. */
|
|
3676
|
+
declare function vectorStrokes(style: VectorStyle): VectorStrokeLayer[];
|
|
3677
|
+
/** Whether a style stores a stack (more than its shorthand can say). */
|
|
3678
|
+
declare function hasVectorPaintStacks(style: VectorStyle): boolean;
|
|
3679
|
+
/** The node with `fills` as its fill stack, stored canonically (see the module comment). */
|
|
3680
|
+
declare function withVectorFills<T extends VectorStyle>(node: T, fills: readonly VectorPaintLayer[]): T;
|
|
3681
|
+
/** The node with `strokes` as its stroke stack, stored canonically; the shorthand mirrors the top layer. */
|
|
3682
|
+
declare function withVectorStrokes<T extends VectorStyle>(node: T, strokes: readonly VectorStrokeLayer[]): T;
|
|
3683
|
+
/**
|
|
3684
|
+
* A node with its stacks and shorthands reconciled and stored canonically (the same object when
|
|
3685
|
+
* they already are). `prefer: 'stack'` (loading) re-derives the shorthand from the stacks;
|
|
3686
|
+
* `'shorthand'` (after an edit, the default) reads a shorthand that disagrees with its stack's
|
|
3687
|
+
* top layer as an edit of that layer: a paint repaints it, a stroke setting changes it, `null`
|
|
3688
|
+
* clears the stack.
|
|
3689
|
+
*/
|
|
3690
|
+
declare function normalizeVectorPaintStacks<T extends VectorStyle>(node: T, prefer?: 'stack' | 'shorthand'): T;
|
|
3691
|
+
/** Reads a fill stack from untrusted data (JSON, agent input, SVG): malformed layers are dropped. */
|
|
3692
|
+
declare function sanitizeVectorFills(value: unknown): VectorPaintLayer[];
|
|
3693
|
+
/** Stroke settings from untrusted data: wrong types and out-of-range values are dropped. */
|
|
3694
|
+
declare function sanitizeVectorStrokeSettings(raw: Record<string, unknown>): VectorStrokeSettings;
|
|
3695
|
+
/**
|
|
3696
|
+
* Reads a stroke stack from untrusted data. Layers of a kind this version does not know are kept
|
|
3697
|
+
* as they are (a later version's brushstroke, say), so a round trip does not lose them.
|
|
3698
|
+
*/
|
|
3699
|
+
declare function sanitizeVectorStrokes(value: unknown): VectorStrokeLayer[];
|
|
3700
|
+
/** One layer of a path's paint as a plain path node (see `vectorPaintLayerNodes`). */
|
|
3701
|
+
interface VectorPaintLayerNode {
|
|
3702
|
+
kind: 'fill' | 'stroke';
|
|
3703
|
+
/** Index in its stack, bottom to top. */
|
|
3704
|
+
index: number;
|
|
3705
|
+
layer: VectorPaintLayer | VectorStrokeLayer;
|
|
3706
|
+
/** The path with only this fill, or only this stroke and its settings (no stacks). */
|
|
3707
|
+
node: VectorPathNode;
|
|
3708
|
+
/** Visible, a plain paint, painting something, above zero opacity. */
|
|
3709
|
+
drawn: boolean;
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* Every fill then every stroke of a path, bottom to top, each as the path painted by that layer
|
|
3713
|
+
* alone. Cached per node object (and the layer nodes are the same objects while it is), so the
|
|
3714
|
+
* paint and stroke-part caches keyed by node keep working per layer.
|
|
3715
|
+
*/
|
|
3716
|
+
declare function vectorPaintLayerNodes(node: VectorPathNode): VectorPaintLayerNode[];
|
|
3717
|
+
/** Whether a path draws through its stacks rather than one fill and one stroke (several layers, or one with its own opacity, blend or visibility). */
|
|
3718
|
+
declare function needsVectorPaintLayers(node: VectorPathNode): boolean;
|
|
3719
|
+
/** How far the drawn strokes of a path reach past its outline (the widest layer's reach; 0 without strokes). */
|
|
3720
|
+
declare function vectorStrokeStackReach(node: VectorPathNode): number;
|
|
3721
|
+
/** The layer a point hits (see `hitTestVectorPaintLayer`). */
|
|
3722
|
+
interface VectorPaintLayerHit {
|
|
3723
|
+
kind: 'fill' | 'stroke';
|
|
3724
|
+
index: number;
|
|
3725
|
+
}
|
|
3726
|
+
/**
|
|
3727
|
+
* The topmost drawn layer of a path that `p` hits, or null: strokes top to bottom (their
|
|
3728
|
+
* alignment, arrowheads and profiles respected, `tolerance` added), then fills. `path` is the
|
|
3729
|
+
* node's outline in the same space as `p` (`vectorPathWorldBezier`).
|
|
3730
|
+
*/
|
|
3731
|
+
declare function hitTestVectorPaintLayer(node: VectorPathNode, path: BezierPath, p: Vec2$1, tolerance?: number): VectorPaintLayerHit | null;
|
|
3732
|
+
/**
|
|
3733
|
+
* Whether `p` hits a path as drawn by its stacks: on a drawn layer, or, when it draws no stroke,
|
|
3734
|
+
* within `tolerance` of its outline (so unpainted paths stay pickable).
|
|
3735
|
+
*/
|
|
3736
|
+
declare function hitTestVectorPaintStack(node: VectorPathNode, path: BezierPath, p: Vec2$1, tolerance?: number): boolean;
|
|
3737
|
+
/** Whether a fill or stroke stack holds a gradient anywhere (for transforms that move gradients). */
|
|
3738
|
+
declare function vectorStacksHaveGradient(style: VectorStyle): boolean;
|
|
3739
|
+
/** Defaults of a new layer added to a stack (a stroke takes the settings of the stack's top stroke). */
|
|
3740
|
+
declare function newVectorStrokeLayer(node: VectorStyle, patch?: Partial<VectorStrokeLayer>): VectorStrokeLayer;
|
|
3741
|
+
/**
|
|
3742
|
+
* The paint the gradient tool and editor work on: layer `layer` of the fill or stroke stack, or
|
|
3743
|
+
* (null, or an index the stack doesn't have) the shorthand, which is the top layer.
|
|
3744
|
+
*/
|
|
3745
|
+
declare function vectorTargetPaint(style: VectorStyle, target: 'fill' | 'stroke', layer?: number | null): VectorPaint | undefined;
|
|
3746
|
+
/** The node with `paint` in the place `vectorTargetPaint` reads (stored canonically). */
|
|
3747
|
+
declare function withVectorTargetPaint<T extends VectorStyle>(node: T, target: 'fill' | 'stroke', layer: number | null, paint: VectorPaint): T;
|
|
3748
|
+
|
|
3749
|
+
export { type AddVectorNodeOptions, AffineMatrix$1 as 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, VECTOR_ARROWHEAD_LABELS, VECTOR_BLEND_MAX_SMOOTH_STEPS, VECTOR_BLEND_MAX_STEPS, VECTOR_BLEND_MODE_LABELS, VECTOR_BLEND_MODE_MENU, VECTOR_BLEND_SPACING_LABELS, VECTOR_BUILDER_HATCH_GAP, VECTOR_CLIPBOARD_TYPE, VECTOR_CONSTRUCTION_ANGLES, VECTOR_CORNER_KIND_LABELS, VECTOR_CORNER_WIDGET_INSET, VECTOR_DISTORT_TOLERANCE, VECTOR_EDIT_TOGGLES, VECTOR_EFFECT_MENU, VECTOR_ENVELOPE_STYLE_OPTIONS, VECTOR_FILL_GAP, VECTOR_GRADIENT_INTERPOLATION_LABELS, VECTOR_GRADIENT_MIDPOINT_GAP, VECTOR_GRADIENT_OFF_BAR, VECTOR_GRADIENT_SPREAD_LABELS, VECTOR_GRADIENT_STOP_GAP, VECTOR_GRADIENT_TYPE_LABELS, VECTOR_INK_MAX_CORNERS, VECTOR_OVERLAY_THEME, VECTOR_PATHFINDER_ACTIONS, VECTOR_PATHFINDER_LABELS, VECTOR_PATH_ACTIONS, VECTOR_PENCIL_STRING_PX, VECTOR_PRESSURE_NOMINAL, VECTOR_ROTATE_HANDLE_OFFSET, VECTOR_STROKE_ALIGN_LABELS, VECTOR_STROKE_GRADIENT_MODE_LABELS, VECTOR_STROKE_SETTING_KEYS, VECTOR_STYLE_KEYS, VECTOR_TOOL_GLYPHS, VECTOR_TOOL_SHORTCUTS, VECTOR_WIDTH_PRESETS, VECTOR_WIDTH_PRESET_IDS, VECTOR_WIDTH_PROFILE_MAX_POINTS, VECTOR_WIDTH_PROFILE_MAX_SCALE, VECTOR_WIDTH_SAME_T, type VariableStrokeOptions, Vec2$1 as Vec2, type VectorActionResult, VectorAlign, VectorAnchor, VectorAnchorRef, VectorAnchorType, type VectorAppearancePanelData, type VectorAppearancePanelLayer, VectorArrange, VectorArrowAlign, VectorArrowhead, type VectorArrowheadShape, VectorAverageAxis, VectorBlend, type VectorBlendControls, type VectorBlendInput, VectorBlendMode, VectorBlendOptions, type VectorBlendRail, VectorBlendSpacing, type VectorBlendStart, VectorBooleanOperation, VectorBounds, type VectorBuilderHit, type VectorBuilderLinePiece, type VectorBuilderPreview, type VectorBuilderReplacement, type VectorBuilderTouched, type VectorCommandOptions, type VectorCornerInfo, VectorCornerKind, type VectorCornerWidget, VectorDefaults, type VectorDistortMode, VectorDistribute, VectorDocument, VectorEditorController, type VectorEditorOptions, type VectorEditorState, VectorEffect, VectorEffectParamSpec, VectorEffectParamsMap, VectorEffectType, type VectorEffectsPanelData, type VectorEffectsPanelItem, type VectorEnvelopePanelData, VectorEnvelopeParams, VectorFilter, VectorFilterParamSpec, VectorFilterType, type VectorFiltersPanelItem, VectorGradient, type VectorGradientAnnotator, type VectorGradientEditorData, VectorGradientHandle, VectorGradientInterpolation, type VectorGradientPart, VectorGradientPatch, VectorGradientSpread, VectorGradientStop, type VectorGradientTarget, VectorGradientType, VectorGroupNode, type VectorGuideKind, type VectorGuideLabel, type VectorGuideLine, VectorHandleRef, type VectorHitTestOptions, type VectorHover, type VectorInkShape, type VectorInteraction, type VectorKeyInput, VectorLineJoin, VectorMergeMode, VectorModifiers, type VectorMorph, type VectorMorphContour, type VectorMorphCorrespondence, type VectorMorphOptions, VectorNode, type VectorNodeListing, type VectorOverlayRenderData, VectorPaint, VectorPaintDef, VectorPaintLayer, type VectorPaintLayerHit, type VectorPaintLayerNode, type VectorPathAction, type VectorPathEditOptions, type VectorPathEntry, type VectorPathKeyframe, VectorPathNode, type VectorPathfinderAction, VectorPathfinderOperation, type VectorPathfinderPaint, type VectorPointMap, type VectorPointSnap, type VectorPointerInput, type VectorRectSnap, type VectorRenderAnchor, type VectorRenderCornerWidget, VectorRenderFilter, type VectorRenderGradientAnnotator, type VectorRenderGroup, type VectorRenderGuideLabel, type VectorRenderGuideLine, type VectorRenderHandle, type VectorRenderNode, type VectorRenderPaintLayer, type VectorRenderPath, VectorRenderStrokeParts, type VectorRenderWidthPoint, type VectorRepeaterCopy, type VectorScaleSnap, type VectorSceneRenderData, 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, VectorStrokeAlign, VectorStrokeGradientMode, VectorStrokeLayer, type VectorStrokeParts, VectorStrokeSettings, type VectorStrokeSpot, VectorStyle, VectorSubpath, VectorSvgExportOptions, type VectorTaperOptions, VectorTool, VectorTransformHandle, VectorViewport, VectorWarpMesh, type VectorWaveOptions, type VectorWidthHandle, VectorWidthPoint, type VectorWidthPointEdit, type VectorWidthPointRef, type VectorWidthPreset, type VectorWidthPresetInfo, addBuilderHit, applyMatrix, applyMatrixLinear, applyVectorBlendOptions, arrowheadInset, arrowheadPath, arrowheadWeight, bendSegment, bezierToSubpaths, boundsFromPoints, boundsIntersect, cloneAnchor, cloneSubpath, cloneVectorDocument, cloneVectorNode, collectPathNodes, constrainToLeave, convertAnchor, cornerBisectorPoint, cornerRadiusChange, cornerSetback, correspondMorphContours, createVectorCommands, createVectorMorph, curvatureMoveAnchor, cutSubpathAt, dashIntervals, decomposeRigid, distortVectorNode, effectPathLength, effectPathVertexCount, effectiveStrokeAlign, ellipseSubpath, eraseFromFill, eraseFromOutline, eraserRegion, evaluateVectorPathKeyframes, expandVectorBlend, expandVectorCorners, expandVectorCornersOf, findVectorNode, fitCornerRadius, generateVectorBlendChildren, generateWidthProfile, getAnchor, getAnchorWorld, getEditablePathIds, getTransformHandlePositions, getVectorAppearancePanel, getVectorBlendControls, getVectorCornerWidgets, getVectorEffectsPanel, getVectorEnteredGroups, getVectorEnvelopePanel, getVectorEnvelopeTarget, getVectorGradientAnnotator, getVectorGradientEditor, getVectorOverlayRenderData, getVectorSceneRenderData, getVectorSelectionBoxGeometry, getVectorSelectionFrame, getVectorSelectionStyle, getVectorWidthHandles, getVisibleAnchors, getVisibleHandles, hasPaint, hasStrokeExtras, hasVectorCorners, hasVectorPaintStacks, hitTestVectorNode, hitTestVectorNodes, hitTestVectorPaintLayer, hitTestVectorPaintStack, hitTestVectorStroke, hitVectorGradientAnnotator, inferAnchorType, insertAnchor, insertWidthPoint, interpolateMorphContours, interpolateRigidMatrix, interpolateVectorColor, interpolateVectorPaint, interpolateVectorPaths, interpolateVectorStyle, interpolateWidthProfiles, invertMatrix, isClosedBezierShape, isDrawnVectorPaintLayer, isIdentityMatrix, isPlainVectorPaintLayer, isUniformWidthProfile, isVectorBlendGroup, isVectorBlendMode, isVectorTextTarget, joinSubpaths, knifePath, lineSubpath, locateVectorNode, mapBezierPath, mapVectorPoints, mapVectorSubpaths, matrixRotation, mergePaths, mirrorWidthProfile, morphContourToSubpath, morphPathsCross, moveAnchorHandle, multiplyMatrices, nearestSegment, nearestStrokePosition, needsVectorPaintLayers, newVectorStrokeLayer, nextVectorCornerKind, nodeMatrix, normalizeVectorPaintStacks, offsetPaths, 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, sanitizeVectorFills, sanitizeVectorStrokeSettings, sanitizeVectorStrokes, sanitizeWidthProfile, scaleFor, scaleMatrix, setAnchorCorner, setSubpathCorners, setWidthPoint, simplifyPolyline, smoothSubpath, splitIntoFaces, splitSubpathAt, starSubpath, strokePositionPoint, strokeWidthProfileOf, subpathEnclosesArea, subpathPointAt, subpathSegment, subpathSegmentCount, subpathToMorphContour, subpathsToBezier, taperWaveFactor, toVectorKeyInput, toVectorModifiers, toVectorPointerInput, transformVectorNode, translateAnchor, translateMatrix, trimIntervals, trimPaths, trimPathsIndividually, turnMorphContour, twistPaths, unionBounds, variableStrokeOutline, variableStrokeRings, vectorBlendColorDistance, vectorBlendKeyTargets, vectorBlendKeys, vectorBlendModeCss, vectorBlendModeFromCss, vectorBlendRail, vectorBlendRailAt, vectorBlendSpine, vectorBlendStepCount, vectorBoxCorners, vectorBuilderErasedEdges, vectorCornerAt, vectorCorners, vectorDiamondPath, vectorDistortQuad, vectorFillMap, vectorFills, vectorGradientBarPosition, vectorGradientTargetPath, vectorInkShapeName, vectorMeshFromOutline, vectorMeshOutline, vectorNodeBounds, vectorNodeRotation, vectorNodeToBezier, vectorPaintLayerNodes, vectorPaintSwatch, vectorPaintToHex, vectorParentMatrix, vectorPathData, vectorPathEntries, vectorPathWorldBezier, vectorPathfinderShape, vectorRepeaterCopies, vectorResizeCursor, vectorResultStyle, vectorShapeBuilderHit, vectorShapeBuilderMap, vectorShearForSide, vectorSkewMatrix, vectorStacksHaveGradient, vectorStrokeGradientDefs, vectorStrokeLineArea, vectorStrokeOutline, vectorStrokeOutlinePath, vectorStrokeParts, vectorStrokeReach, vectorStrokeSettings, vectorStrokeStackReach, vectorStrokeWidthGeometry, vectorStrokes, vectorTargetPaint, vectorToolLabel, vectorWorldMatrix, walkVectorNodes, widthProfileAt, widthProfileMaxScale, widthProfilePreset, widthProfilePresetId, wigglePaths, withVectorFills, withVectorStrokes, withVectorTargetPaint, zigzagPaths };
|