@svgsketch/core 0.7.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +611 -38
- package/dist/index.d.ts +611 -38
- package/dist/index.js +11 -10
- package/dist/index.mjs +11 -10
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -269,6 +269,43 @@ interface SerializedAnimationTimeline {
|
|
|
269
269
|
x: number;
|
|
270
270
|
y: number;
|
|
271
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* CSS selector for a DOM element to animate directly, used when the
|
|
274
|
+
* animation target is not an editor Shape — e.g. an `<animateTransform
|
|
275
|
+
* xlink:href="#rect1"/>` whose target lives inside a `<clipPath>`
|
|
276
|
+
* definition. The track's `shapeId` is a synthetic `__dom__<id>` in
|
|
277
|
+
* this case (no editor Shape exists to bind to). Without this field,
|
|
278
|
+
* the SMIL exporter has no way to re-locate the target after a
|
|
279
|
+
* save/reload round-trip and silently drops every clip/mask-internal
|
|
280
|
+
* animation.
|
|
281
|
+
*/
|
|
282
|
+
domTargetSelector?: string;
|
|
283
|
+
/**
|
|
284
|
+
* For `property === 'domTransformStack'` tracks: the original
|
|
285
|
+
* `<animateTransform>` `type` function (`translate` / `scale` /
|
|
286
|
+
* `rotate` / `skewX` / `skewY` / `matrix`). The SMIL exporter
|
|
287
|
+
* (`addDomTransformStackEntry`) early-returns when this is missing,
|
|
288
|
+
* silently dropping every stacked DOM-transform animation across
|
|
289
|
+
* save/reload. Per SVG Animation §19.4.2 the export must re-emit
|
|
290
|
+
* the same `type` — and per SMIL §4.2 the document-order index
|
|
291
|
+
* (`transformStackIndex`) controls additive composition of the
|
|
292
|
+
* stack. Both are essential for clip/mask internal animations.
|
|
293
|
+
*/
|
|
294
|
+
transformFunction?: 'translate' | 'scale' | 'rotate' | 'skewX' | 'skewY' | 'matrix';
|
|
295
|
+
/**
|
|
296
|
+
* For `property === 'domTransformStack'` tracks: document-order
|
|
297
|
+
* index within the target element's `<animateTransform>` stack.
|
|
298
|
+
* The renderer sorts tracks by this index before applying the
|
|
299
|
+
* SMIL animation sandwich (SVG 2 §19.2.7).
|
|
300
|
+
*/
|
|
301
|
+
transformStackIndex?: number;
|
|
302
|
+
/**
|
|
303
|
+
* For `property === 'domTransformStack'` tracks: the target
|
|
304
|
+
* element's pre-animation `transform` attribute value (the
|
|
305
|
+
* underlying value in the SMIL animation sandwich). Captured at
|
|
306
|
+
* import time.
|
|
307
|
+
*/
|
|
308
|
+
transformBaseValue?: string;
|
|
272
309
|
keyframes: {
|
|
273
310
|
time: number;
|
|
274
311
|
value: number | string;
|
|
@@ -312,7 +349,7 @@ interface AnimatablePropertyDescriptor {
|
|
|
312
349
|
* Only enums referenced by SerializedShape or HistorySnapshot live here.
|
|
313
350
|
* Editor-only enums (Mode, ControlPointPosition, etc.) stay in the editor.
|
|
314
351
|
*/
|
|
315
|
-
declare enum
|
|
352
|
+
declare enum PathCurveType {
|
|
316
353
|
LINEAR = "linear",
|
|
317
354
|
QUADRATIC = "quadratic",
|
|
318
355
|
CUBIC = "cubic",
|
|
@@ -321,7 +358,7 @@ declare enum SplineCurveType {
|
|
|
321
358
|
BASIS = "basis",
|
|
322
359
|
MIXED = "mixed"
|
|
323
360
|
}
|
|
324
|
-
declare enum
|
|
361
|
+
declare enum PathPointType {
|
|
325
362
|
SMOOTH = "smooth",
|
|
326
363
|
CORNER = "corner",
|
|
327
364
|
SYMMETRIC = "symmetric"
|
|
@@ -419,6 +456,14 @@ interface RadialGradient {
|
|
|
419
456
|
r: number;
|
|
420
457
|
ry: number;
|
|
421
458
|
rotation: number;
|
|
459
|
+
/**
|
|
460
|
+
* Focal-circle radius (SVG 2 §14.2.3.1 `fr`). When present and > 0, the
|
|
461
|
+
* gradient's first stop is rendered along this circle (not at a single
|
|
462
|
+
* focal point) — produces a "donut" radial gradient. Same coordinate
|
|
463
|
+
* space as `r` (i.e. governed by `gradientUnits`). Defaults to 0
|
|
464
|
+
* when omitted, matching the spec's initial value and pre-SVG-2 behaviour.
|
|
465
|
+
*/
|
|
466
|
+
fr?: number;
|
|
422
467
|
stops: GradientStop[];
|
|
423
468
|
spreadMethod: GradientSpreadMethod;
|
|
424
469
|
opacity: number;
|
|
@@ -563,7 +608,7 @@ interface CustomPatternDef {
|
|
|
563
608
|
/** Tile height in userSpaceOnUse coordinates. */
|
|
564
609
|
height: number;
|
|
565
610
|
}
|
|
566
|
-
type FilterType = 'drop-shadow' | 'inner-shadow' | 'gaussian-blur' | 'motion-blur' | 'point-light' | 'spot-light' | 'diffuse-lighting' | 'specular-lighting' | 'outline' | 'sharpen' | 'pixelate' | 'warp' | 'morphology' | 'contouring-discrete' | 'contouring-table' | 'round-edges' | 'grayscale' | 'channel-painter' | 'brightness' | 'contrast' | 'opacity' | 'invert' | 'hue-rotate' | 'saturate' | 'black-and-white' | 'sepia' | 'duotone' | 'xray' | 'noise' | 'emboss' | 'film-grain' | 'watercolor' | 'gouache' | 'ink-blot' | 'crumpled-plastic' | 'riddled' | 'glow' | 'inner-glow' | 'raw-svg';
|
|
611
|
+
type FilterType = 'drop-shadow' | 'inner-shadow' | 'gaussian-blur' | 'motion-blur' | 'point-light' | 'spot-light' | 'diffuse-lighting' | 'specular-lighting' | 'outline' | 'sharpen' | 'pixelate' | 'warp' | 'morphology' | 'contouring-discrete' | 'contouring-table' | 'round-edges' | 'grayscale' | 'channel-painter' | 'brightness' | 'contrast' | 'opacity' | 'invert' | 'hue-rotate' | 'saturate' | 'black-and-white' | 'sepia' | 'duotone' | 'xray' | 'noise' | 'emboss' | 'film-grain' | 'watercolor' | 'gouache' | 'ink-blot' | 'crumpled-plastic' | 'riddled' | 'glow' | 'inner-glow' | 'raw-svg' | 'svg-primitive-chain';
|
|
567
612
|
type BlurQuality = 'normal' | 'high';
|
|
568
613
|
interface BaseFilter {
|
|
569
614
|
id: string;
|
|
@@ -831,14 +876,265 @@ interface RawSvgFilter extends BaseFilter {
|
|
|
831
876
|
floodOpacity?: string;
|
|
832
877
|
lightingColor?: string;
|
|
833
878
|
}
|
|
834
|
-
type ShapeFilter = DropShadowFilter | InnerShadowFilter | GaussianBlurFilter | MotionBlurFilter | PointLightFilter | SpotLightFilter | DiffuseLightingFilter | SpecularLightingFilter | OutlineFilter | SharpenFilter | PixelateFilter | WarpFilter | MorphologyFilter | ContouringDiscreteFilter | ContouringTableFilter | RoundEdgesFilter | GrayscaleFilter | ChannelPainterFilter | BrightnessFilter | ContrastFilter | OpacityFilter | InvertFilter | HueRotateFilter | SaturateFilter | BlackAndWhiteFilter | SepiaFilter | DuotoneFilter | XrayFilter | NoiseFilter | EmbossFilter | FilmGrainFilter | WatercolorFilter | GouacheFilter | InkBlotFilter | CrumpledPlasticFilter | RiddledFilter | GlowFilter | InnerGlowFilter | RawSvgFilter;
|
|
835
|
-
|
|
836
|
-
interface
|
|
879
|
+
type ShapeFilter = DropShadowFilter | InnerShadowFilter | GaussianBlurFilter | MotionBlurFilter | PointLightFilter | SpotLightFilter | DiffuseLightingFilter | SpecularLightingFilter | OutlineFilter | SharpenFilter | PixelateFilter | WarpFilter | MorphologyFilter | ContouringDiscreteFilter | ContouringTableFilter | RoundEdgesFilter | GrayscaleFilter | ChannelPainterFilter | BrightnessFilter | ContrastFilter | OpacityFilter | InvertFilter | HueRotateFilter | SaturateFilter | BlackAndWhiteFilter | SepiaFilter | DuotoneFilter | XrayFilter | NoiseFilter | EmbossFilter | FilmGrainFilter | WatercolorFilter | GouacheFilter | InkBlotFilter | CrumpledPlasticFilter | RiddledFilter | GlowFilter | InnerGlowFilter | RawSvgFilter | SvgPrimitiveChainFilter;
|
|
880
|
+
/** Common attributes on every filter primitive (FE1 §7.2). */
|
|
881
|
+
interface BaseFilterPrimitive {
|
|
882
|
+
/** Editor-only stable id; not serialized to SVG. */
|
|
883
|
+
id: string;
|
|
884
|
+
/** SourceGraphic | SourceAlpha | BackgroundImage | BackgroundAlpha |
|
|
885
|
+
* FillPaint | StrokePaint | <filter-primitive-reference>. Omitted ⇒
|
|
886
|
+
* defaults to previous primitive's result (or SourceGraphic if first). */
|
|
887
|
+
in?: string;
|
|
888
|
+
/** Custom result name for forward references. Omitted ⇒ implicit. */
|
|
889
|
+
result?: string;
|
|
890
|
+
/** Filter primitive subregion (FE1 §7.3). */
|
|
891
|
+
x?: string;
|
|
892
|
+
y?: string;
|
|
893
|
+
width?: string;
|
|
894
|
+
height?: string;
|
|
895
|
+
/** Per-primitive override of color-interpolation-filters. */
|
|
896
|
+
colorInterpolationFilters?: 'auto' | 'sRGB' | 'linearRGB';
|
|
897
|
+
/** Carry of attributes the editor doesn't model (style, class, data-*,
|
|
898
|
+
* unknown spec attrs). Re-emitted verbatim. Keys exclude attrs already
|
|
899
|
+
* modeled on this primitive. */
|
|
900
|
+
unknownAttrs?: Record<string, string>;
|
|
901
|
+
/** SMIL animation children attached to this primitive — preserved
|
|
902
|
+
* verbatim. Each entry is the outerHTML of an <animate>, <set>,
|
|
903
|
+
* <animateTransform>, or <animateMotion> element. */
|
|
904
|
+
animations?: string[];
|
|
905
|
+
}
|
|
906
|
+
/** Blend modes per Compositing 1 §3 + the FE1-specific extensions. */
|
|
907
|
+
type FilterBlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'plus-darker' | 'plus-lighter';
|
|
908
|
+
interface FeBlendPrimitive extends BaseFilterPrimitive {
|
|
909
|
+
type: 'feBlend';
|
|
910
|
+
in2?: string;
|
|
911
|
+
mode?: FilterBlendMode;
|
|
912
|
+
/** FE1 extension — boolean attribute, presence-based. */
|
|
913
|
+
noComposite?: boolean;
|
|
914
|
+
}
|
|
915
|
+
interface FeColorMatrixPrimitive extends BaseFilterPrimitive {
|
|
916
|
+
type: 'feColorMatrix';
|
|
917
|
+
matrixType?: 'matrix' | 'saturate' | 'hueRotate' | 'luminanceToAlpha';
|
|
918
|
+
/** Verbatim attribute string so we preserve the exact author spelling
|
|
919
|
+
* (matrix arg counts, whitespace inside). Omitted ⇒ spec defaults
|
|
920
|
+
* apply (matrix=identity, saturate=1, hueRotate=0). */
|
|
921
|
+
values?: string;
|
|
922
|
+
}
|
|
923
|
+
type TransferFunc = {
|
|
924
|
+
type: 'identity';
|
|
925
|
+
} | {
|
|
926
|
+
type: 'table' | 'discrete';
|
|
927
|
+
tableValues: number[];
|
|
928
|
+
} | {
|
|
929
|
+
type: 'linear';
|
|
930
|
+
slope?: number;
|
|
931
|
+
intercept?: number;
|
|
932
|
+
} | {
|
|
933
|
+
type: 'gamma';
|
|
934
|
+
amplitude?: number;
|
|
935
|
+
exponent?: number;
|
|
936
|
+
offset?: number;
|
|
937
|
+
};
|
|
938
|
+
interface FeComponentTransferPrimitive extends BaseFilterPrimitive {
|
|
939
|
+
type: 'feComponentTransfer';
|
|
940
|
+
funcR?: TransferFunc;
|
|
941
|
+
funcG?: TransferFunc;
|
|
942
|
+
funcB?: TransferFunc;
|
|
943
|
+
funcA?: TransferFunc;
|
|
944
|
+
}
|
|
945
|
+
interface FeCompositePrimitive extends BaseFilterPrimitive {
|
|
946
|
+
type: 'feComposite';
|
|
947
|
+
in2?: string;
|
|
948
|
+
operator?: 'over' | 'in' | 'out' | 'atop' | 'xor' | 'lighter' | 'arithmetic';
|
|
949
|
+
k1?: number;
|
|
950
|
+
k2?: number;
|
|
951
|
+
k3?: number;
|
|
952
|
+
k4?: number;
|
|
953
|
+
}
|
|
954
|
+
interface FeConvolveMatrixPrimitive extends BaseFilterPrimitive {
|
|
955
|
+
type: 'feConvolveMatrix';
|
|
956
|
+
/** <number-optional-number>; preserved as authored (e.g. "3" or "3 3"). */
|
|
957
|
+
order?: string;
|
|
958
|
+
/** Space-separated kernel values, preserved as authored. */
|
|
959
|
+
kernelMatrix?: string;
|
|
960
|
+
divisor?: number;
|
|
961
|
+
bias?: number;
|
|
962
|
+
targetX?: number;
|
|
963
|
+
targetY?: number;
|
|
964
|
+
edgeMode?: 'duplicate' | 'wrap' | 'none';
|
|
965
|
+
/** <number-optional-number>; preserved as authored. */
|
|
966
|
+
kernelUnitLength?: string;
|
|
967
|
+
preserveAlpha?: boolean;
|
|
968
|
+
}
|
|
969
|
+
/** Light source elements (FE1 §16) — never appear at <filter> top level,
|
|
970
|
+
* only as children of feDiffuseLighting/feSpecularLighting. */
|
|
971
|
+
type FilterLightSource = {
|
|
972
|
+
kind: 'feDistantLight';
|
|
973
|
+
azimuth?: number;
|
|
974
|
+
elevation?: number;
|
|
975
|
+
} | {
|
|
976
|
+
kind: 'fePointLight';
|
|
977
|
+
x?: number;
|
|
978
|
+
y?: number;
|
|
979
|
+
z?: number;
|
|
980
|
+
} | {
|
|
981
|
+
kind: 'feSpotLight';
|
|
982
|
+
x?: number;
|
|
983
|
+
y?: number;
|
|
984
|
+
z?: number;
|
|
985
|
+
pointsAtX?: number;
|
|
986
|
+
pointsAtY?: number;
|
|
987
|
+
pointsAtZ?: number;
|
|
988
|
+
specularExponent?: number;
|
|
989
|
+
limitingConeAngle?: number;
|
|
990
|
+
};
|
|
991
|
+
interface FeDiffuseLightingPrimitive extends BaseFilterPrimitive {
|
|
992
|
+
type: 'feDiffuseLighting';
|
|
993
|
+
surfaceScale?: number;
|
|
994
|
+
diffuseConstant?: number;
|
|
995
|
+
/** <number-optional-number>; preserved as authored. */
|
|
996
|
+
kernelUnitLength?: string;
|
|
997
|
+
lightingColor?: string;
|
|
998
|
+
lightSource?: FilterLightSource;
|
|
999
|
+
}
|
|
1000
|
+
interface FeSpecularLightingPrimitive extends BaseFilterPrimitive {
|
|
1001
|
+
type: 'feSpecularLighting';
|
|
1002
|
+
surfaceScale?: number;
|
|
1003
|
+
specularConstant?: number;
|
|
1004
|
+
specularExponent?: number;
|
|
1005
|
+
kernelUnitLength?: string;
|
|
1006
|
+
lightingColor?: string;
|
|
1007
|
+
lightSource?: FilterLightSource;
|
|
1008
|
+
}
|
|
1009
|
+
interface FeDisplacementMapPrimitive extends BaseFilterPrimitive {
|
|
1010
|
+
type: 'feDisplacementMap';
|
|
1011
|
+
in2?: string;
|
|
1012
|
+
scale?: number;
|
|
1013
|
+
xChannelSelector?: 'R' | 'G' | 'B' | 'A';
|
|
1014
|
+
yChannelSelector?: 'R' | 'G' | 'B' | 'A';
|
|
1015
|
+
}
|
|
1016
|
+
interface FeDropShadowPrimitive extends BaseFilterPrimitive {
|
|
1017
|
+
type: 'feDropShadow';
|
|
1018
|
+
dx?: number;
|
|
1019
|
+
dy?: number;
|
|
1020
|
+
/** <number-optional-number>; preserved as authored. */
|
|
1021
|
+
stdDeviation?: string;
|
|
1022
|
+
floodColor?: string;
|
|
1023
|
+
/** Numeric value or the literal 'inherit'. */
|
|
1024
|
+
floodOpacity?: string;
|
|
1025
|
+
}
|
|
1026
|
+
interface FeFloodPrimitive extends BaseFilterPrimitive {
|
|
1027
|
+
type: 'feFlood';
|
|
1028
|
+
floodColor?: string;
|
|
1029
|
+
floodOpacity?: string;
|
|
1030
|
+
}
|
|
1031
|
+
interface FeGaussianBlurPrimitive extends BaseFilterPrimitive {
|
|
1032
|
+
type: 'feGaussianBlur';
|
|
1033
|
+
/** <number-optional-number>; preserved as authored (e.g. "3" or "3 1"). */
|
|
1034
|
+
stdDeviation?: string;
|
|
1035
|
+
edgeMode?: 'duplicate' | 'wrap' | 'none';
|
|
1036
|
+
}
|
|
1037
|
+
interface FeImagePrimitive extends BaseFilterPrimitive {
|
|
1038
|
+
type: 'feImage';
|
|
1039
|
+
/** Canonical (SVG 2). */
|
|
1040
|
+
href?: string;
|
|
1041
|
+
/** Back-compat alias re-emitted only when the original used xlink:href
|
|
1042
|
+
* and no href was authored. */
|
|
1043
|
+
xlinkHref?: string;
|
|
1044
|
+
preserveAspectRatio?: string;
|
|
1045
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
1046
|
+
}
|
|
1047
|
+
interface FeMergePrimitive extends BaseFilterPrimitive {
|
|
1048
|
+
type: 'feMerge';
|
|
1049
|
+
/** <feMergeNode> children inlined. */
|
|
1050
|
+
nodes: {
|
|
1051
|
+
in?: string;
|
|
1052
|
+
}[];
|
|
1053
|
+
}
|
|
1054
|
+
interface FeMorphologyPrimitive extends BaseFilterPrimitive {
|
|
1055
|
+
type: 'feMorphology';
|
|
1056
|
+
operator?: 'erode' | 'dilate';
|
|
1057
|
+
/** <number-optional-number>; preserved as authored. */
|
|
1058
|
+
radius?: string;
|
|
1059
|
+
}
|
|
1060
|
+
interface FeOffsetPrimitive extends BaseFilterPrimitive {
|
|
1061
|
+
type: 'feOffset';
|
|
1062
|
+
dx?: number;
|
|
1063
|
+
dy?: number;
|
|
1064
|
+
}
|
|
1065
|
+
interface FeTilePrimitive extends BaseFilterPrimitive {
|
|
1066
|
+
type: 'feTile';
|
|
1067
|
+
}
|
|
1068
|
+
interface FeTurbulencePrimitive extends BaseFilterPrimitive {
|
|
1069
|
+
type: 'feTurbulence';
|
|
1070
|
+
/** <number-optional-number>; preserved as authored. */
|
|
1071
|
+
baseFrequency?: string;
|
|
1072
|
+
numOctaves?: number;
|
|
1073
|
+
seed?: number;
|
|
1074
|
+
stitchTiles?: 'stitch' | 'noStitch';
|
|
1075
|
+
turbulenceType?: 'fractalNoise' | 'turbulence';
|
|
1076
|
+
}
|
|
1077
|
+
type FilterPrimitive = FeBlendPrimitive | FeColorMatrixPrimitive | FeComponentTransferPrimitive | FeCompositePrimitive | FeConvolveMatrixPrimitive | FeDiffuseLightingPrimitive | FeSpecularLightingPrimitive | FeDisplacementMapPrimitive | FeDropShadowPrimitive | FeFloodPrimitive | FeGaussianBlurPrimitive | FeImagePrimitive | FeMergePrimitive | FeMorphologyPrimitive | FeOffsetPrimitive | FeTilePrimitive | FeTurbulencePrimitive;
|
|
1078
|
+
type FilterPrimitiveType = FilterPrimitive['type'];
|
|
1079
|
+
/**
|
|
1080
|
+
* A `<filter>` element modeled as an ordered list of editable primitives.
|
|
1081
|
+
*
|
|
1082
|
+
* This variant is the parser's default when no curated stylized preset
|
|
1083
|
+
* matches — it preserves every spec primitive 1:1 so imported third-party
|
|
1084
|
+
* SVG round-trips with semantic equivalence and remains editable in the
|
|
1085
|
+
* filters panel. Distinct from `RawSvgFilter` (which is opaque XML
|
|
1086
|
+
* passthrough); this one walks the primitives.
|
|
1087
|
+
*/
|
|
1088
|
+
interface SvgPrimitiveChainFilter extends BaseFilter {
|
|
1089
|
+
type: 'svg-primitive-chain';
|
|
1090
|
+
/** <filter> wrapper attributes — all optional; omitted ⇒ UA spec default. */
|
|
1091
|
+
filterUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1092
|
+
primitiveUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1093
|
+
x?: string;
|
|
1094
|
+
y?: string;
|
|
1095
|
+
width?: string;
|
|
1096
|
+
height?: string;
|
|
1097
|
+
filterColorInterpolation?: 'auto' | 'sRGB' | 'linearRGB';
|
|
1098
|
+
/** Inheritable presentation attrs author placed on <filter> so child
|
|
1099
|
+
* primitives can resolve them via the CSS `inherit` keyword. */
|
|
1100
|
+
floodColor?: string;
|
|
1101
|
+
floodOpacity?: string;
|
|
1102
|
+
lightingColor?: string;
|
|
1103
|
+
/** <title> child text, captured for a11y/round-trip. */
|
|
1104
|
+
filterTitle?: string;
|
|
1105
|
+
filterDescription?: string;
|
|
1106
|
+
/** SMIL animation children directly on <filter> (rare). */
|
|
1107
|
+
filterAnimations?: string[];
|
|
1108
|
+
/** The primitive chain. Order is significant — implicit input chains
|
|
1109
|
+
* match document order. */
|
|
1110
|
+
primitives: FilterPrimitive[];
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Per-segment command hint, recording the SVG path command the segment
|
|
1114
|
+
* was authored with. Lets the serializer emit the original command form
|
|
1115
|
+
* (H, V, S, T, A) when the current geometry still satisfies its
|
|
1116
|
+
* constraints — and auto-demote to L/C/Q when a user edit invalidates
|
|
1117
|
+
* the shorthand condition. Replaces the old `originalD` round-trip
|
|
1118
|
+
* cache with a property of the geometry itself.
|
|
1119
|
+
*
|
|
1120
|
+
* - LINEAR → `L` (default for handle-less segments)
|
|
1121
|
+
* - HORIZONTAL → `H`; valid when `from.y === to.y`
|
|
1122
|
+
* - VERTICAL → `V`; valid when `from.x === to.x`
|
|
1123
|
+
* - CUBIC → `C`
|
|
1124
|
+
* - SMOOTH_CUBIC → `S`; valid when `to.handleIn` reflects the previous
|
|
1125
|
+
* segment's exit-tangent about the previous endpoint
|
|
1126
|
+
* - QUADRATIC → `Q`
|
|
1127
|
+
* - SMOOTH_QUADRATIC → `T`; valid when the implicit control reflects the
|
|
1128
|
+
* previous quadratic's control about the current point
|
|
1129
|
+
* - ARC → `A`
|
|
1130
|
+
*/
|
|
1131
|
+
type SegmentCurveType = 'LINEAR' | 'HORIZONTAL' | 'VERTICAL' | 'CUBIC' | 'SMOOTH_CUBIC' | 'QUADRATIC' | 'SMOOTH_QUADRATIC' | 'ARC';
|
|
1132
|
+
interface PathPoint {
|
|
837
1133
|
x: number;
|
|
838
1134
|
y: number;
|
|
839
1135
|
handleIn?: Point;
|
|
840
1136
|
handleOut?: Point;
|
|
841
|
-
pointType:
|
|
1137
|
+
pointType: PathPointType;
|
|
842
1138
|
isSubpathStart?: boolean;
|
|
843
1139
|
segmentType?: SegmentCurveType;
|
|
844
1140
|
arcParams?: ArcParams$1;
|
|
@@ -850,6 +1146,12 @@ interface ArcParams$1 {
|
|
|
850
1146
|
largeArc: boolean;
|
|
851
1147
|
sweep: boolean;
|
|
852
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Hyperlink target per SVG 2 §16.2. Kept for UI convenience — the four
|
|
1151
|
+
* well-known keywords plus any authored `<XML-Name>` (custom named
|
|
1152
|
+
* browsing context). Hyperlink shapes themselves store target as a plain
|
|
1153
|
+
* string so arbitrary names round-trip.
|
|
1154
|
+
*/
|
|
853
1155
|
type LinkTarget = '_self' | '_blank' | '_parent' | '_top';
|
|
854
1156
|
type AriaRole = '' | 'img' | 'button' | 'link' | 'presentation' | 'none' | 'graphics-document' | 'graphics-object' | 'graphics-symbol';
|
|
855
1157
|
interface ShapeMetadata {
|
|
@@ -859,9 +1161,14 @@ interface ShapeMetadata {
|
|
|
859
1161
|
description: string;
|
|
860
1162
|
role: AriaRole;
|
|
861
1163
|
ariaLabel: string;
|
|
862
|
-
linkUrl: string;
|
|
863
|
-
linkTarget: LinkTarget;
|
|
864
1164
|
customData: Record<string, string>;
|
|
1165
|
+
/**
|
|
1166
|
+
* Hyperlink target — when set, the shape is rendered inside an SVG `<a>`
|
|
1167
|
+
* element with `href="${linkUrl}"`. Round-trips through SVG import/export.
|
|
1168
|
+
*/
|
|
1169
|
+
linkUrl?: string;
|
|
1170
|
+
/** Hyperlink target window — maps to `<a target="...">`. */
|
|
1171
|
+
linkTarget?: LinkTarget;
|
|
865
1172
|
/**
|
|
866
1173
|
* Lossless carrier for any `<metadata>` elements that appeared as children
|
|
867
1174
|
* of this shape's SVG element. Stored as a serialized string containing
|
|
@@ -1028,6 +1335,24 @@ interface DocumentStyle {
|
|
|
1028
1335
|
}
|
|
1029
1336
|
/** Type of a template variable's value. */
|
|
1030
1337
|
type TemplateVariableType = 'string' | 'color' | 'number';
|
|
1338
|
+
/**
|
|
1339
|
+
* How the variable participates in export. Two genuinely different
|
|
1340
|
+
* substitution mechanisms — declaring intent up-front lets the export
|
|
1341
|
+
* pipeline pick the right one.
|
|
1342
|
+
*
|
|
1343
|
+
* - `live` → emitted as `var(--name, fallback)` references; the
|
|
1344
|
+
* variable definition rides along in a `<style>` block,
|
|
1345
|
+
* so consumers can re-theme the SVG at runtime via the
|
|
1346
|
+
* CSS cascade.
|
|
1347
|
+
* - `stamped` → resolved to its literal value at export time. Used
|
|
1348
|
+
* for `{{name}}` template-style stamping, and for
|
|
1349
|
+
* attributes (`width`, `x`, geometry) where `var()`
|
|
1350
|
+
* in attribute values has uneven interop.
|
|
1351
|
+
*
|
|
1352
|
+
* Defaults to `live` for `color` (well-supported in browsers), `stamped`
|
|
1353
|
+
* for `number`/`string` (where attribute-level var() is unreliable).
|
|
1354
|
+
*/
|
|
1355
|
+
type TemplateVariableMode = 'live' | 'stamped';
|
|
1031
1356
|
/**
|
|
1032
1357
|
* Where a TemplateVariable came from. `user` is hand-authored in the
|
|
1033
1358
|
* Variables panel; `palette` is auto-generated by the palette-token
|
|
@@ -1074,7 +1399,19 @@ interface TemplateVariable {
|
|
|
1074
1399
|
* settings palette.
|
|
1075
1400
|
*/
|
|
1076
1401
|
source?: TemplateVariableSource;
|
|
1402
|
+
/**
|
|
1403
|
+
* Substitution mode at export time. When omitted, callers should
|
|
1404
|
+
* apply the type-based default in `defaultVariableMode()`:
|
|
1405
|
+
* `color` → `live`, `number`/`string` → `stamped`.
|
|
1406
|
+
*/
|
|
1407
|
+
mode?: TemplateVariableMode;
|
|
1077
1408
|
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Type-based default substitution mode. Color variables work reliably as
|
|
1411
|
+
* runtime `var()` references in browsers; numbers and strings are far
|
|
1412
|
+
* better baked into literal attribute values at export time.
|
|
1413
|
+
*/
|
|
1414
|
+
declare function defaultVariableMode(type: TemplateVariableType): TemplateVariableMode;
|
|
1078
1415
|
interface Guide {
|
|
1079
1416
|
id: string;
|
|
1080
1417
|
orientation: 'horizontal' | 'vertical';
|
|
@@ -1148,11 +1485,31 @@ interface SerializedShape {
|
|
|
1148
1485
|
textDirection?: 'ltr' | 'rtl';
|
|
1149
1486
|
unicodeBidi?: 'normal' | 'embed' | 'bidi-override' | 'isolate' | 'isolate-override' | 'plaintext';
|
|
1150
1487
|
fontVariationSettings?: Record<string, number>;
|
|
1151
|
-
|
|
1488
|
+
/**
|
|
1489
|
+
* Per-glyph positioning data, mirroring SVG 2 §11.2's five attribute
|
|
1490
|
+
* lists (`x`, `y`, `dx`, `dy`, `rotate`).
|
|
1491
|
+
*
|
|
1492
|
+
* - `x`/`y` are absolute user coordinates; `null` means "no
|
|
1493
|
+
* override at this glyph — the cursor advances naturally".
|
|
1494
|
+
* - `dx`/`dy` are additive shifts on top of natural advance.
|
|
1495
|
+
* - `rotate` is per-glyph rotation in degrees.
|
|
1496
|
+
*
|
|
1497
|
+
* For backward compatibility, the legacy three-field shape
|
|
1498
|
+
* `{x, y, rotate}` (produced before the spec-aligned model shipped)
|
|
1499
|
+
* is still accepted on read; its `x`/`y` are interpreted as the
|
|
1500
|
+
* additive shifts (`dx`/`dy`).
|
|
1501
|
+
*/
|
|
1502
|
+
charOffsets?: ({
|
|
1503
|
+
x: number | null;
|
|
1504
|
+
y: number | null;
|
|
1505
|
+
dx: number;
|
|
1506
|
+
dy: number;
|
|
1507
|
+
rotate: number;
|
|
1508
|
+
} | {
|
|
1152
1509
|
x: number;
|
|
1153
1510
|
y: number;
|
|
1154
1511
|
rotate: number;
|
|
1155
|
-
}[];
|
|
1512
|
+
})[];
|
|
1156
1513
|
linePositions?: {
|
|
1157
1514
|
x: number;
|
|
1158
1515
|
dy: number;
|
|
@@ -1181,9 +1538,29 @@ interface SerializedShape {
|
|
|
1181
1538
|
borderColor?: string;
|
|
1182
1539
|
borderWidth?: number | string;
|
|
1183
1540
|
strokeOpacity?: number;
|
|
1541
|
+
/**
|
|
1542
|
+
* Inherit `fill` from the ancestor cascade rather than emit an explicit
|
|
1543
|
+
* attribute. Set at import for shapes inside `<defs>`/`<symbol>` that
|
|
1544
|
+
* have no own `fill` — they're reachable only via `<use>`, whose shadow
|
|
1545
|
+
* tree inherits paint from the `<use>` element itself (SVG 2 §5.5.4).
|
|
1546
|
+
* Baking the SVG-default black onto the inner shape would block the
|
|
1547
|
+
* `<use fill="…">` cascade and render the instance override dead.
|
|
1548
|
+
*/
|
|
1549
|
+
inheritFill?: boolean;
|
|
1550
|
+
/** See {@link inheritFill}. */
|
|
1551
|
+
inheritStroke?: boolean;
|
|
1184
1552
|
/** CSS `paint-order` (SVG 2). Canonical SVG token string, e.g.
|
|
1185
1553
|
* 'stroke fill markers'. Omitted when equivalent to default 'normal'. */
|
|
1186
1554
|
paintOrder?: string;
|
|
1555
|
+
/**
|
|
1556
|
+
* CSS Transforms 2 §6.2 — `transform-box` reference box. SVG
|
|
1557
|
+
* default is `view-box`; persisted on the shape so authored values
|
|
1558
|
+
* (`fill-box`, `stroke-box`) survive round-trip. The editor bakes
|
|
1559
|
+
* `transform-origin` into a numeric pivot at import using the
|
|
1560
|
+
* resolved box, so this field exists for export fidelity rather
|
|
1561
|
+
* than rendering.
|
|
1562
|
+
*/
|
|
1563
|
+
transformBox?: 'view-box' | 'fill-box' | 'stroke-box' | 'content-box' | 'border-box';
|
|
1187
1564
|
/** Marker id applied as `marker-start` (rendered `url(#id)` in SVG). */
|
|
1188
1565
|
markerStart?: string;
|
|
1189
1566
|
/** Marker id applied as `marker-mid`. */
|
|
@@ -1304,17 +1681,49 @@ interface SerializedShape {
|
|
|
1304
1681
|
/** @deprecated v2 — see `filterX`. */
|
|
1305
1682
|
filterHeight?: string;
|
|
1306
1683
|
rawTransform?: string;
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1684
|
+
ancestorTransform?: number[];
|
|
1685
|
+
pathPoints?: PathPoint[];
|
|
1686
|
+
pathCurveType?: PathCurveType;
|
|
1687
|
+
pathClosed?: boolean;
|
|
1688
|
+
pathTension?: number;
|
|
1689
|
+
pathArcParams?: ArcParams$1[];
|
|
1690
|
+
/**
|
|
1691
|
+
* SVG 2 §6 `pathLength` — author's stated total length of the path.
|
|
1692
|
+
* Used to scale distance-along-a-path computations (text-on-path,
|
|
1693
|
+
* `<animateMotion>`, `stroke-dasharray`) by `pathLength / actualLength`.
|
|
1694
|
+
* A non-negative number; negative values are an error per spec.
|
|
1695
|
+
*/
|
|
1696
|
+
pathLength?: number;
|
|
1697
|
+
/**
|
|
1698
|
+
* CSS Vector Effects — `vector-effect` property. `non-scaling-stroke`
|
|
1699
|
+
* keeps stroke width constant under zoom/transforms (heavily used in
|
|
1700
|
+
* CAD/diagram SVGs). Applies to any graphic element, not just paths;
|
|
1701
|
+
* persists at the SerializedShape state level so all shape types can
|
|
1702
|
+
* round-trip it.
|
|
1703
|
+
*/
|
|
1704
|
+
vectorEffect?: 'none' | 'non-scaling-stroke' | 'non-scaling-size' | 'non-rotation' | 'fixed-position';
|
|
1312
1705
|
polylinePoints?: Point[];
|
|
1313
1706
|
polylineClosed?: boolean;
|
|
1314
1707
|
href?: string;
|
|
1315
1708
|
originalWidth?: number;
|
|
1316
1709
|
originalHeight?: number;
|
|
1710
|
+
/**
|
|
1711
|
+
* Editor-internal flag controlling whether interactive resize keeps
|
|
1712
|
+
* the image's natural aspect ratio. NOT the SVG `preserveAspectRatio`
|
|
1713
|
+
* attribute — this is purely a UX behavior switch on the resize
|
|
1714
|
+
* handles. Persisted so the user's setting survives reload.
|
|
1715
|
+
*/
|
|
1317
1716
|
preserveAspectRatio?: boolean;
|
|
1717
|
+
/**
|
|
1718
|
+
* SVG 2 §8.7 — verbatim `preserveAspectRatio` attribute value
|
|
1719
|
+
* (e.g. `'xMidYMid slice'`, `'defer xMidYMid meet'`, `'none'`). When
|
|
1720
|
+
* unset, the spec default applies. The editor canvas always renders
|
|
1721
|
+
* `<image>` with `preserveAspectRatio="none"` so the visible box
|
|
1722
|
+
* matches the resize handles; this field carries the author's
|
|
1723
|
+
* intent through round-trip and is restored on export by
|
|
1724
|
+
* `SvgExportFinalizer`.
|
|
1725
|
+
*/
|
|
1726
|
+
specPreserveAspectRatio?: string;
|
|
1318
1727
|
imageOpacity?: number;
|
|
1319
1728
|
mediaKind?: 'audio' | 'video';
|
|
1320
1729
|
mediaMimeType?: string;
|
|
@@ -1350,12 +1759,36 @@ interface SerializedShape {
|
|
|
1350
1759
|
* soundtracks / captioned video versions.
|
|
1351
1760
|
*/
|
|
1352
1761
|
systemLanguage?: string;
|
|
1762
|
+
/**
|
|
1763
|
+
* Space-separated list of required IRI references that the user agent
|
|
1764
|
+
* must support for this shape to be rendered. SVG 2 §15.4 conditional
|
|
1765
|
+
* processing — typically `http://www.w3.org/TR/SVG11/feature#…` strings.
|
|
1766
|
+
* Persisted alongside `systemLanguage` so `<switch>` content round-trips.
|
|
1767
|
+
*/
|
|
1768
|
+
requiredExtensions?: string;
|
|
1353
1769
|
shapeInsideRef?: string;
|
|
1354
1770
|
shapePadding?: number;
|
|
1355
1771
|
isTextPath?: boolean;
|
|
1356
|
-
textPathPoints?:
|
|
1772
|
+
textPathPoints?: PathPoint[];
|
|
1773
|
+
/**
|
|
1774
|
+
* Curve type used to interpolate `textPathPoints` into a renderable
|
|
1775
|
+
* path. Mirrors `pathCurveType` for plain path shapes; persisted
|
|
1776
|
+
* separately so author-set text-path curves don't have to share the
|
|
1777
|
+
* shape's geometry curve type.
|
|
1778
|
+
*/
|
|
1779
|
+
textPathCurveType?: PathCurveType;
|
|
1357
1780
|
textPathStartOffset?: number;
|
|
1781
|
+
textPathStartOffsetUnit?: '%' | 'user';
|
|
1358
1782
|
textPathSide?: 'left' | 'right';
|
|
1783
|
+
textPathMethod?: 'align' | 'stretch';
|
|
1784
|
+
textPathSpacing?: 'auto' | 'exact';
|
|
1785
|
+
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1786
|
+
textPathLength?: number;
|
|
1787
|
+
textPathLengthUnit?: '%' | 'user';
|
|
1788
|
+
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1789
|
+
textPathRefShapeId?: string;
|
|
1790
|
+
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
1791
|
+
textPathImportRefId?: string;
|
|
1359
1792
|
fillRule?: 'nonzero' | 'evenodd';
|
|
1360
1793
|
strokeLinejoin?: 'miter' | 'round' | 'bevel';
|
|
1361
1794
|
strokeLinecap?: 'butt' | 'round' | 'square';
|
|
@@ -1382,6 +1815,33 @@ interface SerializedShape {
|
|
|
1382
1815
|
* variant (`def.shapes`). Only meaningful on `symbol-instance` shapes.
|
|
1383
1816
|
*/
|
|
1384
1817
|
variantKey?: string;
|
|
1818
|
+
/**
|
|
1819
|
+
* Per-instance presentation cascade (SVG 2 §5.5.4): attributes set on
|
|
1820
|
+
* the source `<use>` element that are inherited into the symbol shadow
|
|
1821
|
+
* tree on render and re-emitted on export. Keyed by the SVG attribute
|
|
1822
|
+
* name in its canonical kebab-case form (`fill`, `stroke-width`,
|
|
1823
|
+
* `color-interpolation-filters`, `paint-order`, etc.). Values are the
|
|
1824
|
+
* verbatim attribute string — numeric parsing happens at the edit /
|
|
1825
|
+
* render boundary, not at storage time.
|
|
1826
|
+
*
|
|
1827
|
+
* The map is the single source of truth: importing a `<use>` stores
|
|
1828
|
+
* every presentation-class attribute the author wrote, applying it
|
|
1829
|
+
* mirrors every entry onto the wrapper `<g>`, and exporting emits
|
|
1830
|
+
* every entry back onto the `<use>`. No whitelist — any attribute the
|
|
1831
|
+
* SVG cascade honors round-trips.
|
|
1832
|
+
*
|
|
1833
|
+
* Special case: `transform` is composed with the editor's geometry
|
|
1834
|
+
* (position / rotation / skew / scale) rather than applied raw to the
|
|
1835
|
+
* wrapper. See `SymbolInstance.buildTransformString`.
|
|
1836
|
+
*
|
|
1837
|
+
* Legacy (pre-refactor) documents may carry camelCase keys
|
|
1838
|
+
* (`fillOpacity`, `strokeWidth`, …). `SymbolInstance.createFromSerialized`
|
|
1839
|
+
* normalises them to kebab-case on load; no runtime readers of this
|
|
1840
|
+
* field should assume either form.
|
|
1841
|
+
*
|
|
1842
|
+
* Only meaningful on `symbol-instance` shapes.
|
|
1843
|
+
*/
|
|
1844
|
+
instancePresentation?: Record<string, string>;
|
|
1385
1845
|
/**
|
|
1386
1846
|
* Id of the canvas shape this `shape-reference` (Linked Copy) targets.
|
|
1387
1847
|
* A Linked Copy renders as a live clone of another top-level shape and
|
|
@@ -1446,6 +1906,44 @@ interface SerializedShape {
|
|
|
1446
1906
|
topWidthPercent?: number;
|
|
1447
1907
|
/** Document shape: wave amplitude as a % of height. */
|
|
1448
1908
|
waveAmplitudePercent?: number;
|
|
1909
|
+
/** View shape: viewBox X component (animatable axis of the 4-tuple). */
|
|
1910
|
+
viewBoxX?: number;
|
|
1911
|
+
/** View shape: viewBox Y component (animatable axis of the 4-tuple). */
|
|
1912
|
+
viewBoxY?: number;
|
|
1913
|
+
/** View shape: viewBox width component (animatable axis of the 4-tuple). */
|
|
1914
|
+
viewBoxWidth?: number;
|
|
1915
|
+
/** View shape: viewBox height component (animatable axis of the 4-tuple). */
|
|
1916
|
+
viewBoxHeight?: number;
|
|
1917
|
+
/** View shape: name used as `<view id="...">` and fragment URL target. */
|
|
1918
|
+
viewName?: string;
|
|
1919
|
+
/** View shape: optional preserveAspectRatio (SVG 2 §7.8 — animatable). */
|
|
1920
|
+
viewPreserveAspectRatio?: string;
|
|
1921
|
+
/** View shape: SVG 1.1 §16.5 zoomAndPan. */
|
|
1922
|
+
viewZoomAndPan?: 'disable' | 'magnify';
|
|
1923
|
+
/** View shape: deprecated SVG 1.1 viewTarget — preserved verbatim. */
|
|
1924
|
+
viewTarget?: string;
|
|
1925
|
+
/** View shape: when true, this View's viewBox becomes the root SVG viewBox. */
|
|
1926
|
+
isHomeView?: boolean;
|
|
1927
|
+
/** SvgShape: viewBox X component (animatable). */
|
|
1928
|
+
svgViewBoxX?: number;
|
|
1929
|
+
/** SvgShape: viewBox Y component (animatable). */
|
|
1930
|
+
svgViewBoxY?: number;
|
|
1931
|
+
/** SvgShape: viewBox width component (animatable). */
|
|
1932
|
+
svgViewBoxWidth?: number;
|
|
1933
|
+
/** SvgShape: viewBox height component (animatable). */
|
|
1934
|
+
svgViewBoxHeight?: number;
|
|
1935
|
+
/** SvgShape: preserveAspectRatio (SVG 2 §7.8 — animatable, discrete). */
|
|
1936
|
+
svgPreserveAspectRatio?: string;
|
|
1937
|
+
/** SvgShape: outermost = intrinsic doc size, embedded = viewport rect width. */
|
|
1938
|
+
svgWidth?: number;
|
|
1939
|
+
/** SvgShape: outermost = intrinsic doc size, embedded = viewport rect height. */
|
|
1940
|
+
svgHeight?: number;
|
|
1941
|
+
/** SvgShape: x position (no effect on outermost per §5.1.4 ¶3, embedded only). */
|
|
1942
|
+
svgX?: number;
|
|
1943
|
+
/** SvgShape: y position (no effect on outermost per §5.1.4 ¶3, embedded only). */
|
|
1944
|
+
svgY?: number;
|
|
1945
|
+
/** SvgShape: marks the singleton root <svg> shape (one per document). */
|
|
1946
|
+
isRootSvg?: boolean;
|
|
1449
1947
|
};
|
|
1450
1948
|
}
|
|
1451
1949
|
type SerializedViewbox = Viewbox;
|
|
@@ -1507,6 +2005,18 @@ interface HistorySnapshot {
|
|
|
1507
2005
|
* MarkerManager and are NOT persisted here — only user-authored defs are.
|
|
1508
2006
|
*/
|
|
1509
2007
|
library?: LibraryDef[];
|
|
2008
|
+
/**
|
|
2009
|
+
* Raw XML fragments for `<mask>` / `<clipPath>` defs that live in editor
|
|
2010
|
+
* defs but have no typed entry in `library`. Populated by paste pipelines
|
|
2011
|
+
* that clone source paint-server defs verbatim (preserving original ids so
|
|
2012
|
+
* `url(#id)` refs resolve). Without this field, the save/reload cycle
|
|
2013
|
+
* drops the masks entirely because `library` has no kind for them; shapes
|
|
2014
|
+
* that reference those ids render without their mask.
|
|
2015
|
+
*
|
|
2016
|
+
* Each entry is a serialised fragment (`<mask id="…">…</mask>`) ready to
|
|
2017
|
+
* `innerHTML`-append into editor defs on restore.
|
|
2018
|
+
*/
|
|
2019
|
+
rawPaintServerDefs?: string[];
|
|
1510
2020
|
/** @deprecated v2 — use `library`. Read-only: v1 docs migrate into `library`. */
|
|
1511
2021
|
customPatterns?: CustomPatternDef[];
|
|
1512
2022
|
/** @deprecated v2 — use `library`. Read-only: v1 docs migrate into `library`. */
|
|
@@ -1556,6 +2066,14 @@ interface SerializedGroup {
|
|
|
1556
2066
|
parentId: string | null;
|
|
1557
2067
|
/** CSS transform-origin value (e.g. "50px 50px") for group animations */
|
|
1558
2068
|
transformOrigin?: string;
|
|
2069
|
+
/**
|
|
2070
|
+
* SVG `<g>` transform attribute (e.g. "matrix(...)" or "scale(2,1)").
|
|
2071
|
+
* Preserved verbatim from import so the group carries its ancestor/own
|
|
2072
|
+
* transform through serialization (clipboard, undo/redo, collab).
|
|
2073
|
+
* Shapes inside stay in the group's local frame — the browser composes
|
|
2074
|
+
* `groupTransform × child` natively at render.
|
|
2075
|
+
*/
|
|
2076
|
+
transform?: string;
|
|
1559
2077
|
/**
|
|
1560
2078
|
* Zero-based position of this group among its parent container's
|
|
1561
2079
|
* children (including both sibling groups and sibling shape nodes).
|
|
@@ -1700,7 +2218,28 @@ interface LibraryDefBase {
|
|
|
1700
2218
|
*/
|
|
1701
2219
|
interface SymbolLibraryDef extends LibraryDefBase {
|
|
1702
2220
|
kind: 'symbol';
|
|
2221
|
+
/**
|
|
2222
|
+
* Source SVG element form for round-trip fidelity. Most symbols are
|
|
2223
|
+
* authored as `<symbol>` (SVG 2 §5.5.1); `<defs><g id="X"/>` referenced
|
|
2224
|
+
* by `<use href="#X"/>` is a legally distinct pattern that the editor
|
|
2225
|
+
* also models as a SymbolLibraryDef but must export as `<g>` to remain
|
|
2226
|
+
* spec-faithful — `<symbol>` would silently introduce viewport-
|
|
2227
|
+
* establishment (SVG 2 §5.5.2) and `overflow: hidden` defaulting that
|
|
2228
|
+
* the source `<g>` does not have. Default `'symbol'` for backward
|
|
2229
|
+
* compatibility with documents authored before this field existed.
|
|
2230
|
+
*/
|
|
2231
|
+
defKind?: 'symbol' | 'group';
|
|
1703
2232
|
viewBox: string;
|
|
2233
|
+
/**
|
|
2234
|
+
* Wrapper attributes from the source `<g id="X">` def root that apply to
|
|
2235
|
+
* the def's contents (transform, opacity, fill cascade, mask, filter,
|
|
2236
|
+
* clip-path). Re-emitted on the exported `<g id="X">` when `defKind === 'group'`
|
|
2237
|
+
* — `<symbol>` doesn't legally accept these attributes per SVG 2 §5.5.1.
|
|
2238
|
+
* Without this, `<use href="#X"/>` would silently render the children at
|
|
2239
|
+
* their unwrapped local coords / paint, losing every non-id attribute on
|
|
2240
|
+
* the source `<g>` def root.
|
|
2241
|
+
*/
|
|
2242
|
+
wrapperAttrs?: Record<string, string>;
|
|
1704
2243
|
/**
|
|
1705
2244
|
* Default variant shapes. When `variantAxes` is present this represents the
|
|
1706
2245
|
* variant where every axis is at its first value.
|
|
@@ -1858,6 +2397,7 @@ interface CommonNodeProps {
|
|
|
1858
2397
|
filterWidth: string | null;
|
|
1859
2398
|
filterHeight: string | null;
|
|
1860
2399
|
rawTransform: string | null;
|
|
2400
|
+
ancestorTransform: number[] | null;
|
|
1861
2401
|
metadata: unknown | null;
|
|
1862
2402
|
cssClipPath: string | null;
|
|
1863
2403
|
cssMaskProperties: Record<string, string> | null;
|
|
@@ -1933,11 +2473,22 @@ interface TextNodeProps extends CommonNodeProps {
|
|
|
1933
2473
|
scaleAnchor: Point | null;
|
|
1934
2474
|
useRichText: boolean;
|
|
1935
2475
|
richTextData: unknown | null;
|
|
1936
|
-
|
|
2476
|
+
/**
|
|
2477
|
+
* Per-glyph positioning data — see `SerializedShape['state'].charOffsets`
|
|
2478
|
+
* in `serialized.ts` for full semantics. Legacy `{x, y, rotate}` form
|
|
2479
|
+
* accepted on read for back-compat with pre-spec-aligned saves.
|
|
2480
|
+
*/
|
|
2481
|
+
charOffsets: ({
|
|
2482
|
+
x: number | null;
|
|
2483
|
+
y: number | null;
|
|
2484
|
+
dx: number;
|
|
2485
|
+
dy: number;
|
|
2486
|
+
rotate: number;
|
|
2487
|
+
} | {
|
|
1937
2488
|
x: number;
|
|
1938
2489
|
y: number;
|
|
1939
2490
|
rotate: number;
|
|
1940
|
-
}[] | null;
|
|
2491
|
+
})[] | null;
|
|
1941
2492
|
fontVariationSettings: Record<string, number>;
|
|
1942
2493
|
isTextPath: boolean;
|
|
1943
2494
|
textPathPoints: unknown[] | null;
|
|
@@ -1957,14 +2508,14 @@ interface ImageNodeProps extends CommonNodeProps {
|
|
|
1957
2508
|
preserveAspectRatio: boolean;
|
|
1958
2509
|
imageOpacity: number;
|
|
1959
2510
|
}
|
|
1960
|
-
interface
|
|
2511
|
+
interface PathNodeProps extends CommonNodeProps {
|
|
1961
2512
|
x: number;
|
|
1962
2513
|
y: number;
|
|
1963
2514
|
width: number;
|
|
1964
2515
|
height: number;
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
2516
|
+
pathPoints: unknown[];
|
|
2517
|
+
pathArcParams: unknown[];
|
|
2518
|
+
pathControlBounds: {
|
|
1968
2519
|
x: number;
|
|
1969
2520
|
y: number;
|
|
1970
2521
|
width: number;
|
|
@@ -2042,7 +2593,7 @@ interface NodeTypePropsMap {
|
|
|
2042
2593
|
line: LineNodeProps;
|
|
2043
2594
|
text: TextNodeProps;
|
|
2044
2595
|
image: ImageNodeProps;
|
|
2045
|
-
|
|
2596
|
+
path: PathNodeProps;
|
|
2046
2597
|
polyline: PolylineNodeProps;
|
|
2047
2598
|
triangle: TriangleNodeProps;
|
|
2048
2599
|
ngon: NGonNodeProps;
|
|
@@ -2057,7 +2608,7 @@ interface NodeTypePropsMap {
|
|
|
2057
2608
|
document: DocumentNodeProps;
|
|
2058
2609
|
}
|
|
2059
2610
|
/** Union of all node prop types. */
|
|
2060
|
-
type AnyNodeProps = RectangleNodeProps | SquareNodeProps | CircleNodeProps | EllipseNodeProps | LineNodeProps | TextNodeProps | ImageNodeProps |
|
|
2611
|
+
type AnyNodeProps = RectangleNodeProps | SquareNodeProps | CircleNodeProps | EllipseNodeProps | LineNodeProps | TextNodeProps | ImageNodeProps | PathNodeProps | PolylineNodeProps | TriangleNodeProps | NGonNodeProps | StarNodeProps | CrossNodeProps | RingNodeProps | SpiralNodeProps | GearNodeProps | ArrowNodeProps | SymbolInstanceNodeProps | GroupNodeProps | DocumentNodeProps;
|
|
2061
2612
|
|
|
2062
2613
|
/**
|
|
2063
2614
|
* @svgsketch/core — Schema migrations.
|
|
@@ -2452,6 +3003,28 @@ declare function renderToSvg(snapshot: HistorySnapshot, options?: RenderOptions)
|
|
|
2452
3003
|
* @packageDocumentation
|
|
2453
3004
|
*/
|
|
2454
3005
|
|
|
3006
|
+
/**
|
|
3007
|
+
* Render a single `FilterPrimitive` to its SVG element string.
|
|
3008
|
+
*
|
|
3009
|
+
* Walks every modeled spec attribute and re-emits it. Author-preserved
|
|
3010
|
+
* attributes (e.g. <number-optional-number> spellings, kernelMatrix
|
|
3011
|
+
* whitespace) are stored as strings on the primitive and emitted verbatim,
|
|
3012
|
+
* so import → render produces semantically equivalent output.
|
|
3013
|
+
*
|
|
3014
|
+
* `unknownAttrs` are emitted last (alphabetised) so re-export is stable.
|
|
3015
|
+
* `animations` children are appended inside the element.
|
|
3016
|
+
*/
|
|
3017
|
+
declare function renderFilterPrimitive(p: FilterPrimitive): string;
|
|
3018
|
+
/**
|
|
3019
|
+
* Render an `SvgPrimitiveChainFilter` as a complete `<filter>` element.
|
|
3020
|
+
*
|
|
3021
|
+
* Wrapper attributes are author-faithful: omitted ⇒ unset on the element ⇒
|
|
3022
|
+
* UA spec defaults apply (filterUnits=objectBoundingBox, primitiveUnits=
|
|
3023
|
+
* userSpaceOnUse, region -10%/-10%/120%/120%, color-interpolation-filters=
|
|
3024
|
+
* linearRGB). The chain is emitted in document order with no synthetic
|
|
3025
|
+
* `in`/`result` rewriting.
|
|
3026
|
+
*/
|
|
3027
|
+
declare function renderSvgPrimitiveChainFilter(filterId: string, f: SvgPrimitiveChainFilter): string;
|
|
2455
3028
|
/**
|
|
2456
3029
|
* Render SVG filter primitive string(s) for a single filter.
|
|
2457
3030
|
*
|
|
@@ -3600,26 +4173,26 @@ declare class Arrow extends PolygonShapeBuilder<Arrow> {
|
|
|
3600
4173
|
/** Set the arrow shaft width as a percent (0–100). */
|
|
3601
4174
|
shaftWidth(percent: number): Arrow;
|
|
3602
4175
|
}
|
|
3603
|
-
declare class
|
|
3604
|
-
constructor(points?: (Point |
|
|
4176
|
+
declare class Path extends ShapeBuilder<Path> {
|
|
4177
|
+
constructor(points?: (Point | PathPoint)[]);
|
|
3605
4178
|
/** Set the spline points. */
|
|
3606
|
-
points(pts: (Point |
|
|
4179
|
+
points(pts: (Point | PathPoint)[]): Path;
|
|
3607
4180
|
/** Add a point to the spline. */
|
|
3608
|
-
addPoint(x: number, y: number):
|
|
4181
|
+
addPoint(x: number, y: number): Path;
|
|
3609
4182
|
/** Set the curve type. */
|
|
3610
|
-
curveType(type:
|
|
4183
|
+
curveType(type: PathCurveType): Path;
|
|
3611
4184
|
/** Set whether the spline is closed. */
|
|
3612
|
-
closed(value?: boolean):
|
|
4185
|
+
closed(value?: boolean): Path;
|
|
3613
4186
|
/** Set the tension for Catmull-Rom curves (0–1). */
|
|
3614
|
-
tension(value: number):
|
|
4187
|
+
tension(value: number): Path;
|
|
3615
4188
|
/** Set arc params for ARC curve type. */
|
|
3616
|
-
arcParams(params: ArcParams$1[]):
|
|
4189
|
+
arcParams(params: ArcParams$1[]): Path;
|
|
3617
4190
|
/** Set the start endpoint marker. */
|
|
3618
|
-
markerStart(style: EndpointStyle):
|
|
4191
|
+
markerStart(style: EndpointStyle): Path;
|
|
3619
4192
|
/** Set the end endpoint marker. */
|
|
3620
|
-
markerEnd(style: EndpointStyle):
|
|
4193
|
+
markerEnd(style: EndpointStyle): Path;
|
|
3621
4194
|
/** Convenience: set both markers. */
|
|
3622
|
-
markers(start: EndpointStyle, end: EndpointStyle):
|
|
4195
|
+
markers(start: EndpointStyle, end: EndpointStyle): Path;
|
|
3623
4196
|
}
|
|
3624
4197
|
declare class Polyline extends ShapeBuilder<Polyline> {
|
|
3625
4198
|
constructor(points?: Point[]);
|
|
@@ -3746,7 +4319,7 @@ declare class Track {
|
|
|
3746
4319
|
*
|
|
3747
4320
|
* @example
|
|
3748
4321
|
* ```ts
|
|
3749
|
-
* const curve = new
|
|
4322
|
+
* const curve = new Path(...).id('curve');
|
|
3750
4323
|
* doc.add(curve);
|
|
3751
4324
|
*
|
|
3752
4325
|
* const track = new Track('rect-1', 'pathMotion')
|
|
@@ -4178,4 +4751,4 @@ declare class Document {
|
|
|
4178
4751
|
private _ensureMetadata;
|
|
4179
4752
|
}
|
|
4180
4753
|
|
|
4181
|
-
export { type AnimatablePropertyDescriptor, type AnimationKeyframe, type AnimationTimeline, type AnimationTrack, type AnimationTrigger, type AnimationTriggerType, type AnyNodeProps, type ArcParams$1 as ArcParams, type AriaRole, Arrow, type ArrowNodeProps, BUILTIN_MARKER_ID_MAP, type BaseFilter, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, type CodeFormat, type CodegenOptions, type CommonNodeProps, type ConnectionDirection, type ConnectionPoint, type ContouringDiscreteFilter, type ContouringTableFilter, type ContrastFilter, type CornerShapeValue, type CreateDocumentOptions, type CreateShapeOptions, Cross, type CrossNodeProps, type CrumpledPlasticFilter, type CustomPatternDef, type CycleBehavior, DEFAULT_COORDINATE_PRECISION, type DiffuseLightingFilter, Document, type DocumentMetadata, type DocumentNodeProps, type DocumentOptions, type DocumentScript, type DocumentStyle, type DropShadowFilter, type DuotoneFilter, EASING_CURVES, EVENT_TRIGGER_OPTIONS, EasingType, Ellipse, type EllipseNodeProps, type EmbossFilter, type ExtractedVariables, type FillType, type FilmGrainFilter, type FilterLibraryDef, type FilterType, type GaussianBlurFilter, Gear, type GearNodeProps, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GradientUnits, type GrayscaleFilter, type GroupNodeProps, type Guide, type HistorySnapshot, type HueRotateFilter, type ImageAttribution, type ImageNodeProps, ImageShape, type InkBlotFilter, type InnerGlowFilter, type InnerShadowFilter, type InvertFilter, LIBRARY_EMIT_ORDER, type LibraryDef, type LibraryDefBase, type LibraryDefOfKind, type LibraryKind, type LicenseType, type LightSource, Line, type LineEndpointValue, type LineNodeProps, type LinearEasingPoint, type LinearGradient, LinearGradientBuilder, type LinearGradientLibraryDef, type LinkTarget, MARKER_HEIGHT, MARKER_VIEWBOX, MARKER_WIDTH, MAX_COORDINATE_PRECISION, MIGRATIONS, type MarkerDescriptor, type MarkerLibraryDef, type Measurement, type Migration, type MorphologyFilter, type MorphologyOperator, type MotionBlurFilter, NGon, type NGonNodeProps, type NodeTypePropsMap, type NoiseFilter, type OpacityFilter, type OutlineFilter, type OutlinePosition, type ParseOptions, PatternBuilder, type PatternElement, type PatternFill, type PatternLibraryDef, type PatternParams, type PatternSvgContentResult, type PatternType, type PixelateFilter, type Point, type PointLightFilter, type PolygonBaseNodeProps, Polyline, type PolylineNodeProps, type RadialGradient, RadialGradientBuilder, type RadialGradientLibraryDef, type RawSvgFilter, Rectangle, type RectangleNodeProps, type RenderOptions, type RichTextData, type RichTextLine, type RichTextSegment, type RichTextSegmentStyle, type RiddledFilter, Ring, type RingNodeProps, type RoundEdgesFilter, type SaturateFilter, type SegmentCurveType, type SepiaFilter, type SerializedAnimationTimeline, type SerializedClipMaskGroup, type SerializedGroup, type SerializedMarkerDef, type SerializedShape, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, type SharpenFilter, type SpecularLightingFilter, Spiral, type SpiralNodeProps,
|
|
4754
|
+
export { type AnimatablePropertyDescriptor, type AnimationKeyframe, type AnimationTimeline, type AnimationTrack, type AnimationTrigger, type AnimationTriggerType, type AnyNodeProps, type ArcParams$1 as ArcParams, type AriaRole, Arrow, type ArrowNodeProps, BUILTIN_MARKER_ID_MAP, type BaseFilter, type BaseFilterPrimitive, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, type CodeFormat, type CodegenOptions, type CommonNodeProps, type ConnectionDirection, type ConnectionPoint, type ContouringDiscreteFilter, type ContouringTableFilter, type ContrastFilter, type CornerShapeValue, type CreateDocumentOptions, type CreateShapeOptions, Cross, type CrossNodeProps, type CrumpledPlasticFilter, type CustomPatternDef, type CycleBehavior, DEFAULT_COORDINATE_PRECISION, type DiffuseLightingFilter, Document, type DocumentMetadata, type DocumentNodeProps, type DocumentOptions, type DocumentScript, type DocumentStyle, type DropShadowFilter, type DuotoneFilter, EASING_CURVES, EVENT_TRIGGER_OPTIONS, EasingType, Ellipse, type EllipseNodeProps, type EmbossFilter, type ExtractedVariables, type FeBlendPrimitive, type FeColorMatrixPrimitive, type FeComponentTransferPrimitive, type FeCompositePrimitive, type FeConvolveMatrixPrimitive, type FeDiffuseLightingPrimitive, type FeDisplacementMapPrimitive, type FeDropShadowPrimitive, type FeFloodPrimitive, type FeGaussianBlurPrimitive, type FeImagePrimitive, type FeMergePrimitive, type FeMorphologyPrimitive, type FeOffsetPrimitive, type FeSpecularLightingPrimitive, type FeTilePrimitive, type FeTurbulencePrimitive, type FillType, type FilmGrainFilter, type FilterBlendMode, type FilterLibraryDef, type FilterLightSource, type FilterPrimitive, type FilterPrimitiveType, type FilterType, type GaussianBlurFilter, Gear, type GearNodeProps, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GradientUnits, type GrayscaleFilter, type GroupNodeProps, type Guide, type HistorySnapshot, type HueRotateFilter, type ImageAttribution, type ImageNodeProps, ImageShape, type InkBlotFilter, type InnerGlowFilter, type InnerShadowFilter, type InvertFilter, LIBRARY_EMIT_ORDER, type LibraryDef, type LibraryDefBase, type LibraryDefOfKind, type LibraryKind, type LicenseType, type LightSource, Line, type LineEndpointValue, type LineNodeProps, type LinearEasingPoint, type LinearGradient, LinearGradientBuilder, type LinearGradientLibraryDef, type LinkTarget, MARKER_HEIGHT, MARKER_VIEWBOX, MARKER_WIDTH, MAX_COORDINATE_PRECISION, MIGRATIONS, type MarkerDescriptor, type MarkerLibraryDef, type Measurement, type Migration, type MorphologyFilter, type MorphologyOperator, type MotionBlurFilter, NGon, type NGonNodeProps, type NodeTypePropsMap, type NoiseFilter, type OpacityFilter, type OutlineFilter, type OutlinePosition, type ParseOptions, Path, PathCurveType, type PathNodeProps, type PathPoint, PathPointType, PatternBuilder, type PatternElement, type PatternFill, type PatternLibraryDef, type PatternParams, type PatternSvgContentResult, type PatternType, type PixelateFilter, type Point, type PointLightFilter, type PolygonBaseNodeProps, Polyline, type PolylineNodeProps, type RadialGradient, RadialGradientBuilder, type RadialGradientLibraryDef, type RawSvgFilter, Rectangle, type RectangleNodeProps, type RenderOptions, type RichTextData, type RichTextLine, type RichTextSegment, type RichTextSegmentStyle, type RiddledFilter, Ring, type RingNodeProps, type RoundEdgesFilter, type SaturateFilter, type SegmentCurveType, type SepiaFilter, type SerializedAnimationTimeline, type SerializedClipMaskGroup, type SerializedGroup, type SerializedMarkerDef, type SerializedShape, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, type SharpenFilter, type SpecularLightingFilter, Spiral, type SpiralNodeProps, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type SvgPrimitiveChainFilter, type SymbolInstanceNodeProps, type SymbolLibraryDef, type TemplateVariable, type TemplateVariableMode, type TemplateVariableSource, type TemplateVariableType, Text, type TextNodeProps, Timeline, Track, type TransferFunc, Triangle, type TriangleNodeProps, type ValidationError, type ValidationResult, type VariableMap, type Viewbox, type WarpFilter, type WarpType, type WatercolorFilter, type XrayFilter, collectReferencedLibraryIds, computeArrowVertices, computeCloudPath, computeCrossVertices, computeDashArray, computeGearPath, computeGearVertices, computeHeartPath, computeLightningVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpeechBubbleVertices, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createShape, createViewbox, defaultVariableMode, escXml, extractVariables, filterAttr, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generateReactCode, generateSvgCode, generateVueCode, getBuiltInMarkerDefs, getEasingCubicBezier, getEffectivePrecision, getMarkerDescriptors, getPatternElements, linearGradient, migrateSnapshot, parseDocument, parseVariableArgs, pattern, radialGradient, renderAnimationElements, renderBuiltinMarkerDefs, renderCircle, renderEllipse, renderFilterDefs, renderFilterLibraryDef, renderFilterPrimitive, renderFilterPrimitivesForType, renderImage, renderLibraryDef, renderLibraryDefs, renderLine, renderLinearGradientLibraryDef, renderMarkerLibraryDef, renderPatternLibraryDef, renderPolygonShape, renderPolyline, renderRadialGradientLibraryDef, renderRectangle, renderReferencedLibraryDefs, renderShape, renderSpline, renderSvgPrimitiveChainFilter, renderSymbolLibraryDef, renderText, renderToSvg, roundCoord, roundNumberString, roundSerializedShape, roundSnapshot, stringifyDocument, substituteString, substituteVariables, validateSnapshot, verticesToPath };
|