@svgsketch/core 0.4.0 → 0.6.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 +536 -7
- package/dist/index.d.ts +536 -7
- package/dist/index.js +11 -11
- package/dist/index.mjs +11 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -40,7 +40,18 @@ declare enum EasingType {
|
|
|
40
40
|
EASE_OUT_BACK = "ease-out-back",
|
|
41
41
|
EASE_IN_OUT_BACK = "ease-in-out-back",
|
|
42
42
|
CUSTOM_BEZIER = "custom-bezier",
|
|
43
|
-
LINEAR_FUNCTION = "linear-function"
|
|
43
|
+
LINEAR_FUNCTION = "linear-function",
|
|
44
|
+
STEPS = "steps"
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Step position for CSS `steps()` easing. Follows CSS Easing 1 §3.2.
|
|
48
|
+
* `start`/`end` are legacy aliases for `jump-start`/`jump-end`.
|
|
49
|
+
*/
|
|
50
|
+
type StepPosition = 'jump-start' | 'jump-end' | 'jump-none' | 'jump-both';
|
|
51
|
+
/** Parameters for a `steps(count, position)` easing function. */
|
|
52
|
+
interface StepsParams {
|
|
53
|
+
count: number;
|
|
54
|
+
position: StepPosition;
|
|
44
55
|
}
|
|
45
56
|
/**
|
|
46
57
|
* Map from EasingType → cubic-bezier control points [x1, y1, x2, y2].
|
|
@@ -97,6 +108,8 @@ interface AnimationKeyframe {
|
|
|
97
108
|
customBezier?: [number, number, number, number];
|
|
98
109
|
/** Control points for CSS linear() easing when easing is LINEAR_FUNCTION. */
|
|
99
110
|
linearPoints?: LinearEasingPoint[];
|
|
111
|
+
/** Step count and jump position when easing is STEPS. */
|
|
112
|
+
stepsParams?: StepsParams;
|
|
100
113
|
}
|
|
101
114
|
/** A control point for a CSS linear() easing function. */
|
|
102
115
|
interface LinearEasingPoint {
|
|
@@ -152,6 +165,15 @@ interface AnimationTrack {
|
|
|
152
165
|
* @default 'replace' (except transforms, which default to 'sum')
|
|
153
166
|
*/
|
|
154
167
|
additive?: 'sum' | 'replace';
|
|
168
|
+
/**
|
|
169
|
+
* Scoping for this track.
|
|
170
|
+
* - Absent / 'document' — plays on the main document timeline (default).
|
|
171
|
+
* - `'marker:<markerId>'` — scoped to a marker definition's inner shapes.
|
|
172
|
+
* Only evaluated when the editor is isolation-editing that marker;
|
|
173
|
+
* exported as SMIL inside the `<marker>` element so it animates at
|
|
174
|
+
* every attached vertex.
|
|
175
|
+
*/
|
|
176
|
+
scope?: string;
|
|
155
177
|
}
|
|
156
178
|
/**
|
|
157
179
|
* The top-level animation timeline for a document.
|
|
@@ -196,6 +218,8 @@ interface SerializedAnimationTimeline {
|
|
|
196
218
|
};
|
|
197
219
|
motionRotate?: 'auto' | 'auto-reverse' | number;
|
|
198
220
|
additive?: 'sum' | 'replace';
|
|
221
|
+
/** Scoping — see `AnimationTrack.scope`. */
|
|
222
|
+
scope?: string;
|
|
199
223
|
/**
|
|
200
224
|
* 6-element CSS matrix of the track's ancestor transform context, captured
|
|
201
225
|
* at the time the animation was authored. Preserves visual fidelity when
|
|
@@ -222,6 +246,7 @@ interface SerializedAnimationTimeline {
|
|
|
222
246
|
value: number;
|
|
223
247
|
position: number;
|
|
224
248
|
}[];
|
|
249
|
+
stepsParams?: StepsParams;
|
|
225
250
|
}[];
|
|
226
251
|
}[];
|
|
227
252
|
}
|
|
@@ -288,6 +313,19 @@ interface Viewbox {
|
|
|
288
313
|
width: number;
|
|
289
314
|
height: number;
|
|
290
315
|
}
|
|
316
|
+
/** Direction hint for connector routing tangents. */
|
|
317
|
+
type ConnectionDirection = 'n' | 's' | 'e' | 'w' | 'any';
|
|
318
|
+
/** A named anchor point on a shape where connectors can attach. */
|
|
319
|
+
interface ConnectionPoint {
|
|
320
|
+
/** Stable id — 'n','s','e','w','center' for derived; 'custom-<uuid>' for user-placed. */
|
|
321
|
+
id: string;
|
|
322
|
+
/** Location in canvas/workspace coordinates (post-transform). */
|
|
323
|
+
point: Point;
|
|
324
|
+
/** Tangent hint used by connector routing. */
|
|
325
|
+
direction: ConnectionDirection;
|
|
326
|
+
/** 'derived' anchors are computed from shape geometry; 'custom' are persisted overrides. */
|
|
327
|
+
kind: 'derived' | 'custom';
|
|
328
|
+
}
|
|
291
329
|
type FillType = 'solid' | 'linear-gradient' | 'radial-gradient' | 'pattern' | 'none';
|
|
292
330
|
type StrokeType = 'solid' | 'linear-gradient' | 'radial-gradient' | 'pattern' | 'none';
|
|
293
331
|
type GradientSpreadMethod = 'pad' | 'repeat' | 'reflect';
|
|
@@ -297,6 +335,23 @@ interface GradientStop {
|
|
|
297
335
|
color: string;
|
|
298
336
|
opacity: number;
|
|
299
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* How gradient coordinates are interpreted.
|
|
340
|
+
*
|
|
341
|
+
* - `'objectBoundingBox'` (default): coordinates are fractions of the
|
|
342
|
+
* painted element's bounding box, where `1` equals the full width or
|
|
343
|
+
* height. The gradient rescales to each shape.
|
|
344
|
+
* - `'userSpaceOnUse'`: coordinates are absolute user-space values, so
|
|
345
|
+
* the gradient is a fixed color field in the document. Multiple
|
|
346
|
+
* shapes referencing the same gradient see a consistent field, and
|
|
347
|
+
* clipped shapes reveal a specific slice of it. Required for
|
|
348
|
+
* round-tripping source SVGs that author gradients this way.
|
|
349
|
+
*
|
|
350
|
+
* When omitted, the renderer treats the gradient as `objectBoundingBox`
|
|
351
|
+
* for backward compatibility with documents authored before this field
|
|
352
|
+
* was added.
|
|
353
|
+
*/
|
|
354
|
+
type GradientUnits = 'objectBoundingBox' | 'userSpaceOnUse';
|
|
300
355
|
interface LinearGradient {
|
|
301
356
|
type: 'linear-gradient';
|
|
302
357
|
id: string;
|
|
@@ -307,6 +362,20 @@ interface LinearGradient {
|
|
|
307
362
|
stops: GradientStop[];
|
|
308
363
|
spreadMethod: GradientSpreadMethod;
|
|
309
364
|
opacity: number;
|
|
365
|
+
/**
|
|
366
|
+
* When present and equal to `'userSpaceOnUse'`, `x1`/`y1`/`x2`/`y2`
|
|
367
|
+
* are in document user space (post any ancestor bake), not in the
|
|
368
|
+
* element's bbox-normalised [0, 1] space. See `GradientUnits`.
|
|
369
|
+
*/
|
|
370
|
+
gradientUnits?: GradientUnits;
|
|
371
|
+
/**
|
|
372
|
+
* Original `id` from the imported source SVG. Runtime `id` is always
|
|
373
|
+
* a fresh GUID (to keep editor uniqueness invariants), but `sourceId`
|
|
374
|
+
* is retained so export can restore human-friendly ids when there is
|
|
375
|
+
* no collision. Cleared whenever the gradient is mutated through the
|
|
376
|
+
* editor — at that point the source id no longer describes the data.
|
|
377
|
+
*/
|
|
378
|
+
sourceId?: string;
|
|
310
379
|
}
|
|
311
380
|
interface RadialGradient {
|
|
312
381
|
type: 'radial-gradient';
|
|
@@ -321,6 +390,13 @@ interface RadialGradient {
|
|
|
321
390
|
stops: GradientStop[];
|
|
322
391
|
spreadMethod: GradientSpreadMethod;
|
|
323
392
|
opacity: number;
|
|
393
|
+
/**
|
|
394
|
+
* When present and equal to `'userSpaceOnUse'`, `cx`/`cy`/`fx`/`fy`/
|
|
395
|
+
* `r`/`ry` are in document user space. See `GradientUnits`.
|
|
396
|
+
*/
|
|
397
|
+
gradientUnits?: GradientUnits;
|
|
398
|
+
/** See `LinearGradient.sourceId`. */
|
|
399
|
+
sourceId?: string;
|
|
324
400
|
}
|
|
325
401
|
/**
|
|
326
402
|
* Per-pattern-type tuneable parameters.
|
|
@@ -402,6 +478,8 @@ interface PatternFill {
|
|
|
402
478
|
y?: number;
|
|
403
479
|
/** ID of the `CustomPatternDef` this fill was built from (if any). */
|
|
404
480
|
customPatternId?: string;
|
|
481
|
+
/** See `LinearGradient.sourceId`. */
|
|
482
|
+
sourceId?: string;
|
|
405
483
|
}
|
|
406
484
|
type GradientDefinition = LinearGradient | RadialGradient | PatternFill;
|
|
407
485
|
/** Style overrides for a single rich-text segment. */
|
|
@@ -453,7 +531,7 @@ interface CustomPatternDef {
|
|
|
453
531
|
/** Tile height in userSpaceOnUse coordinates. */
|
|
454
532
|
height: number;
|
|
455
533
|
}
|
|
456
|
-
type FilterType = 'drop-shadow' | 'inner-shadow' | 'gaussian-blur' | 'motion-blur' | 'point-light' | 'spot-light' | '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';
|
|
534
|
+
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';
|
|
457
535
|
type BlurQuality = 'normal' | 'high';
|
|
458
536
|
interface BaseFilter {
|
|
459
537
|
id: string;
|
|
@@ -516,6 +594,41 @@ interface SpotLightFilter extends BaseFilter {
|
|
|
516
594
|
specularConstant: number;
|
|
517
595
|
specularExponent: number;
|
|
518
596
|
}
|
|
597
|
+
type LightSource = {
|
|
598
|
+
kind: 'point';
|
|
599
|
+
x: number;
|
|
600
|
+
y: number;
|
|
601
|
+
z: number;
|
|
602
|
+
} | {
|
|
603
|
+
kind: 'spot';
|
|
604
|
+
x: number;
|
|
605
|
+
y: number;
|
|
606
|
+
z: number;
|
|
607
|
+
pointsAtX: number;
|
|
608
|
+
pointsAtY: number;
|
|
609
|
+
pointsAtZ: number;
|
|
610
|
+
limitingConeAngle?: number;
|
|
611
|
+
specularExponent?: number;
|
|
612
|
+
} | {
|
|
613
|
+
kind: 'distant';
|
|
614
|
+
azimuth: number;
|
|
615
|
+
elevation: number;
|
|
616
|
+
};
|
|
617
|
+
interface DiffuseLightingFilter extends BaseFilter {
|
|
618
|
+
type: 'diffuse-lighting';
|
|
619
|
+
surfaceScale: number;
|
|
620
|
+
diffuseConstant: number;
|
|
621
|
+
color: string;
|
|
622
|
+
lightSource: LightSource;
|
|
623
|
+
}
|
|
624
|
+
interface SpecularLightingFilter extends BaseFilter {
|
|
625
|
+
type: 'specular-lighting';
|
|
626
|
+
surfaceScale: number;
|
|
627
|
+
specularConstant: number;
|
|
628
|
+
specularExponent: number;
|
|
629
|
+
color: string;
|
|
630
|
+
lightSource: LightSource;
|
|
631
|
+
}
|
|
519
632
|
type OutlinePosition = 'outside' | 'center' | 'inside';
|
|
520
633
|
interface OutlineFilter extends BaseFilter {
|
|
521
634
|
type: 'outline';
|
|
@@ -664,7 +777,29 @@ interface InnerGlowFilter extends BaseFilter {
|
|
|
664
777
|
radius: number;
|
|
665
778
|
intensity: number;
|
|
666
779
|
}
|
|
667
|
-
|
|
780
|
+
/**
|
|
781
|
+
* Passthrough for `<filter>` definitions the editor doesn't model as a preset.
|
|
782
|
+
* The parser serialises the element's inner markup and authored region
|
|
783
|
+
* attributes verbatim; the filter manager re-emits them on render. Absent
|
|
784
|
+
* attributes stay `undefined` so the UA applies the SVG spec initial values
|
|
785
|
+
* (filterUnits=objectBoundingBox, primitiveUnits=userSpaceOnUse, filter region
|
|
786
|
+
* -10% -10% 120% 120%, color-interpolation-filters=linearRGB).
|
|
787
|
+
*/
|
|
788
|
+
interface RawSvgFilter extends BaseFilter {
|
|
789
|
+
type: 'raw-svg';
|
|
790
|
+
svgContent: string;
|
|
791
|
+
x?: string;
|
|
792
|
+
y?: string;
|
|
793
|
+
width?: string;
|
|
794
|
+
height?: string;
|
|
795
|
+
filterUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
796
|
+
primitiveUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
797
|
+
colorInterpolationFilters?: 'auto' | 'sRGB' | 'linearRGB';
|
|
798
|
+
floodColor?: string;
|
|
799
|
+
floodOpacity?: string;
|
|
800
|
+
lightingColor?: string;
|
|
801
|
+
}
|
|
802
|
+
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;
|
|
668
803
|
type SegmentCurveType = 'LINEAR' | 'CUBIC' | 'QUADRATIC' | 'ARC';
|
|
669
804
|
interface SplinePoint {
|
|
670
805
|
x: number;
|
|
@@ -733,6 +868,84 @@ interface DocumentMetadata {
|
|
|
733
868
|
licenseUrl: string;
|
|
734
869
|
language: string;
|
|
735
870
|
customMetadata: Record<string, string>;
|
|
871
|
+
/**
|
|
872
|
+
* Decimal precision for coordinate values when the document is
|
|
873
|
+
* serialized — file save, cloud sync, undo capture, and SVG export.
|
|
874
|
+
* Stored on the document so collaborators stay consistent and
|
|
875
|
+
* round-trips are deterministic.
|
|
876
|
+
*
|
|
877
|
+
* Range 0-12. Defaults to 3 (sub-pixel precision adequate for screen
|
|
878
|
+
* rendering; matches SVGO's `floatPrecision` and Adobe Illustrator's
|
|
879
|
+
* SVG export defaults). Set higher (6-8) when authoring assets for
|
|
880
|
+
* high-fidelity interchange. Values above 8 carry no practical benefit
|
|
881
|
+
* at the coordinate ranges typical of SVG documents.
|
|
882
|
+
*
|
|
883
|
+
* Imported SVGs are NOT rounded on the way in; the first edit or save
|
|
884
|
+
* conforms them to this precision.
|
|
885
|
+
*/
|
|
886
|
+
coordinatePrecision?: number;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* A document-level `<script>` element. Scripts are stored as inert data
|
|
890
|
+
* alongside document metadata — never executed inside the editor — and
|
|
891
|
+
* re-emitted on export.
|
|
892
|
+
*
|
|
893
|
+
* Spec reference: SVG 2 §15.9 (The `<script>` element).
|
|
894
|
+
*/
|
|
895
|
+
interface DocumentScript {
|
|
896
|
+
/** Internal id (guid) used for list keying inside the editor. */
|
|
897
|
+
id: string;
|
|
898
|
+
/** Preserved `id` attribute from the source SVG, if any. */
|
|
899
|
+
svgId?: string;
|
|
900
|
+
/** Whether this script has inline body text or an external href. */
|
|
901
|
+
source: 'inline' | 'external';
|
|
902
|
+
/** Script body for inline scripts. Empty for external. */
|
|
903
|
+
content: string;
|
|
904
|
+
/** URL for external scripts. */
|
|
905
|
+
href?: string;
|
|
906
|
+
/** MIME type. Defaults to 'application/ecmascript' per SVG 2. */
|
|
907
|
+
type: string;
|
|
908
|
+
/** CORS setting. */
|
|
909
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
910
|
+
/** async attribute (SVG 2 aligns with HTML). */
|
|
911
|
+
async?: boolean;
|
|
912
|
+
/** defer attribute (SVG 2 aligns with HTML). */
|
|
913
|
+
defer?: boolean;
|
|
914
|
+
/** Unknown/extra attributes preserved for round-trip fidelity. */
|
|
915
|
+
customAttrs?: Record<string, string>;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* A document-level `<style>` block captured from the imported SVG and
|
|
919
|
+
* re-emitted verbatim on export.
|
|
920
|
+
*
|
|
921
|
+
* Styles with `preserved: true` are opaque CSS blobs the editor refuses
|
|
922
|
+
* to reinterpret because their matched elements live inside `<defs>`
|
|
923
|
+
* subtrees (mask / clipPath / symbol / pattern) that never become canvas
|
|
924
|
+
* shapes. Keeping them intact is the only way to round-trip author CSS
|
|
925
|
+
* that drives mask-interior animations (e.g. `stroke-dashoffset` flow on
|
|
926
|
+
* `<use>` elements inside a `<mask>`).
|
|
927
|
+
*
|
|
928
|
+
* Spec reference: SVG 2 §16 (The `<style>` element).
|
|
929
|
+
*/
|
|
930
|
+
interface DocumentStyle {
|
|
931
|
+
/** Internal id (guid) used for list keying inside the editor. */
|
|
932
|
+
id: string;
|
|
933
|
+
/** Preserved `id` attribute from the source SVG, if any. */
|
|
934
|
+
svgId?: string;
|
|
935
|
+
/** Raw CSS source — `@keyframes`, rules, `@media`, etc. */
|
|
936
|
+
css: string;
|
|
937
|
+
/** `type` attribute. Defaults to `text/css`. */
|
|
938
|
+
type?: string;
|
|
939
|
+
/** `media` attribute, if specified. */
|
|
940
|
+
media?: string;
|
|
941
|
+
/**
|
|
942
|
+
* When true, this block was captured verbatim during import because
|
|
943
|
+
* the editor cannot safely reinterpret its effect. Must be emitted
|
|
944
|
+
* as-is on export.
|
|
945
|
+
*/
|
|
946
|
+
preserved: boolean;
|
|
947
|
+
/** Unknown/extra attributes preserved for round-trip fidelity. */
|
|
948
|
+
customAttrs?: Record<string, string>;
|
|
736
949
|
}
|
|
737
950
|
/** Type of a template variable's value. */
|
|
738
951
|
type TemplateVariableType = 'string' | 'color' | 'number';
|
|
@@ -842,6 +1055,14 @@ interface CommonNodeProps {
|
|
|
842
1055
|
dashOffset: number;
|
|
843
1056
|
strokeDasharray: string | null;
|
|
844
1057
|
filters: unknown[];
|
|
1058
|
+
filterColorInterpolation: 'auto' | 'sRGB' | 'linearRGB' | null;
|
|
1059
|
+
filterUnits: 'userSpaceOnUse' | 'objectBoundingBox' | null;
|
|
1060
|
+
primitiveUnits: 'userSpaceOnUse' | 'objectBoundingBox' | null;
|
|
1061
|
+
filterX: string | null;
|
|
1062
|
+
filterY: string | null;
|
|
1063
|
+
filterWidth: string | null;
|
|
1064
|
+
filterHeight: string | null;
|
|
1065
|
+
rawTransform: string | null;
|
|
845
1066
|
metadata: unknown | null;
|
|
846
1067
|
cssClipPath: string | null;
|
|
847
1068
|
cssMaskProperties: Record<string, string> | null;
|
|
@@ -1064,6 +1285,16 @@ interface SerializedShape {
|
|
|
1064
1285
|
rx?: number;
|
|
1065
1286
|
ry?: number;
|
|
1066
1287
|
cornerRadius?: number;
|
|
1288
|
+
cornerShape?: 'round' | 'notch' | 'bevel' | 'scoop';
|
|
1289
|
+
cornerMode?: 'uniform' | 'non-uniform';
|
|
1290
|
+
cornerRadiusTL?: number;
|
|
1291
|
+
cornerRadiusTR?: number;
|
|
1292
|
+
cornerRadiusBL?: number;
|
|
1293
|
+
cornerRadiusBR?: number;
|
|
1294
|
+
cornerShapeTL?: 'round' | 'notch' | 'bevel' | 'scoop';
|
|
1295
|
+
cornerShapeTR?: 'round' | 'notch' | 'bevel' | 'scoop';
|
|
1296
|
+
cornerShapeBL?: 'round' | 'notch' | 'bevel' | 'scoop';
|
|
1297
|
+
cornerShapeBR?: 'round' | 'notch' | 'bevel' | 'scoop';
|
|
1067
1298
|
fontSize?: number;
|
|
1068
1299
|
text?: string;
|
|
1069
1300
|
fontFamily?: string;
|
|
@@ -1097,6 +1328,8 @@ interface SerializedShape {
|
|
|
1097
1328
|
x: number;
|
|
1098
1329
|
dy: number;
|
|
1099
1330
|
}[];
|
|
1331
|
+
textLength?: number;
|
|
1332
|
+
lengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1100
1333
|
/**
|
|
1101
1334
|
* Whether this text element uses the rich-text model (styled runs with
|
|
1102
1335
|
* per-character formatting) versus the plain-text model. When true,
|
|
@@ -1119,6 +1352,15 @@ interface SerializedShape {
|
|
|
1119
1352
|
borderColor?: string;
|
|
1120
1353
|
borderWidth?: number | string;
|
|
1121
1354
|
strokeOpacity?: number;
|
|
1355
|
+
/** CSS `paint-order` (SVG 2). Canonical SVG token string, e.g.
|
|
1356
|
+
* 'stroke fill markers'. Omitted when equivalent to default 'normal'. */
|
|
1357
|
+
paintOrder?: string;
|
|
1358
|
+
/** Marker id applied as `marker-start` (rendered `url(#id)` in SVG). */
|
|
1359
|
+
markerStart?: string;
|
|
1360
|
+
/** Marker id applied as `marker-mid`. */
|
|
1361
|
+
markerMid?: string;
|
|
1362
|
+
/** Marker id applied as `marker-end`. */
|
|
1363
|
+
markerEnd?: string;
|
|
1122
1364
|
cx?: number;
|
|
1123
1365
|
cy?: number;
|
|
1124
1366
|
sides?: number;
|
|
@@ -1136,6 +1378,16 @@ interface SerializedShape {
|
|
|
1136
1378
|
headWidthPercent?: number;
|
|
1137
1379
|
headLengthPercent?: number;
|
|
1138
1380
|
shaftWidthPercent?: number;
|
|
1381
|
+
tailAngleDeg?: number;
|
|
1382
|
+
tailLengthPercent?: number;
|
|
1383
|
+
tailWidthPercent?: number;
|
|
1384
|
+
lobeRadiusPercent?: number;
|
|
1385
|
+
cleftDepthPercent?: number;
|
|
1386
|
+
boltSegments?: number;
|
|
1387
|
+
boltJaggednessPercent?: number;
|
|
1388
|
+
boltWidthPercent?: number;
|
|
1389
|
+
cloudBumps?: number;
|
|
1390
|
+
cloudPuffinessPercent?: number;
|
|
1139
1391
|
x1?: number;
|
|
1140
1392
|
y1?: number;
|
|
1141
1393
|
x2?: number;
|
|
@@ -1150,11 +1402,29 @@ interface SerializedShape {
|
|
|
1150
1402
|
endEndpoint?: 'none' | 'arrow' | 'open-arrow' | 'circle' | 'diamond' | 'square';
|
|
1151
1403
|
locked?: boolean;
|
|
1152
1404
|
visible?: boolean;
|
|
1405
|
+
/**
|
|
1406
|
+
* SVG `visibility` presentation attribute. Distinct from `visible`:
|
|
1407
|
+
* `visible` (boolean) is the editor's user-toggled layer hide
|
|
1408
|
+
* (display:none semantics); `visibility` is the SVG attribute
|
|
1409
|
+
* (preserves layout, can be flipped by SMIL
|
|
1410
|
+
* `<animate attributeName="visibility">`). Conflating the two breaks
|
|
1411
|
+
* SMIL visibility animations on imported SVGs because display:none
|
|
1412
|
+
* overrides the SVG visibility attribute.
|
|
1413
|
+
*/
|
|
1414
|
+
visibility?: 'visible' | 'hidden' | 'collapse';
|
|
1153
1415
|
fillType?: FillType;
|
|
1154
1416
|
fillGradient?: LinearGradient | RadialGradient | PatternFill;
|
|
1155
1417
|
strokeType?: StrokeType;
|
|
1156
1418
|
strokeGradient?: LinearGradient | RadialGradient | PatternFill;
|
|
1157
1419
|
filters?: ShapeFilter[];
|
|
1420
|
+
filterColorInterpolation?: 'auto' | 'sRGB' | 'linearRGB';
|
|
1421
|
+
filterUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1422
|
+
primitiveUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
|
|
1423
|
+
filterX?: string;
|
|
1424
|
+
filterY?: string;
|
|
1425
|
+
filterWidth?: string;
|
|
1426
|
+
filterHeight?: string;
|
|
1427
|
+
rawTransform?: string;
|
|
1158
1428
|
splinePoints?: SplinePoint[];
|
|
1159
1429
|
splineCurveType?: SplineCurveType;
|
|
1160
1430
|
splineClosed?: boolean;
|
|
@@ -1167,6 +1437,40 @@ interface SerializedShape {
|
|
|
1167
1437
|
originalHeight?: number;
|
|
1168
1438
|
preserveAspectRatio?: boolean;
|
|
1169
1439
|
imageOpacity?: number;
|
|
1440
|
+
mediaKind?: 'audio' | 'video';
|
|
1441
|
+
mediaMimeType?: string;
|
|
1442
|
+
naturalDuration?: number;
|
|
1443
|
+
begin?: number;
|
|
1444
|
+
trimStart?: number;
|
|
1445
|
+
trimEnd?: number;
|
|
1446
|
+
volume?: number;
|
|
1447
|
+
muted?: boolean;
|
|
1448
|
+
loop?: boolean;
|
|
1449
|
+
playbackRate?: number;
|
|
1450
|
+
mediaOpacity?: number;
|
|
1451
|
+
/** Auto-generated volume ramp length at clip start (seconds). */
|
|
1452
|
+
fadeInDuration?: number;
|
|
1453
|
+
/** Auto-generated volume ramp length at clip end (seconds). */
|
|
1454
|
+
fadeOutDuration?: number;
|
|
1455
|
+
/** First-frame thumbnail (data URI or /api/image-assets URL). Video only. */
|
|
1456
|
+
posterHref?: string;
|
|
1457
|
+
/** Crop rectangle in source pixels. Video only. */
|
|
1458
|
+
sourceRect?: {
|
|
1459
|
+
x: number;
|
|
1460
|
+
y: number;
|
|
1461
|
+
width: number;
|
|
1462
|
+
height: number;
|
|
1463
|
+
};
|
|
1464
|
+
/**
|
|
1465
|
+
* BCP 47 language tag matched against the user agent's language
|
|
1466
|
+
* preferences via SVG's `systemLanguage` conditional-processing
|
|
1467
|
+
* attribute. Meaningful when a `<switch>` wraps multiple
|
|
1468
|
+
* localized media alternatives — the UA picks the foreignObject
|
|
1469
|
+
* whose language matches. No editor UI yet; preserved on
|
|
1470
|
+
* import/export for forward compatibility with translated
|
|
1471
|
+
* soundtracks / captioned video versions.
|
|
1472
|
+
*/
|
|
1473
|
+
systemLanguage?: string;
|
|
1170
1474
|
shapeInsideRef?: string;
|
|
1171
1475
|
shapePadding?: number;
|
|
1172
1476
|
isTextPath?: boolean;
|
|
@@ -1214,6 +1518,40 @@ interface SerializedShape {
|
|
|
1214
1518
|
* when serialized to standalone SVG.
|
|
1215
1519
|
*/
|
|
1216
1520
|
bindings?: Record<string, string>;
|
|
1521
|
+
/** User-placed custom connection anchors. Derived anchors are not persisted. */
|
|
1522
|
+
connectionPoints?: ConnectionPoint[];
|
|
1523
|
+
/** Connector shape: reference to the source shape + anchor it attaches to. */
|
|
1524
|
+
sourceRef?: {
|
|
1525
|
+
shapeId: string;
|
|
1526
|
+
anchorId: string;
|
|
1527
|
+
} | null;
|
|
1528
|
+
/** Connector shape: reference to the target shape + anchor it attaches to. */
|
|
1529
|
+
targetRef?: {
|
|
1530
|
+
shapeId: string;
|
|
1531
|
+
anchorId: string;
|
|
1532
|
+
} | null;
|
|
1533
|
+
/** Connector shape: cached absolute source point (recomputed when source moves). */
|
|
1534
|
+
sourcePoint?: Point;
|
|
1535
|
+
/** Connector shape: cached absolute target point. */
|
|
1536
|
+
targetPoint?: Point;
|
|
1537
|
+
/** Connector shape: interior waypoints for orthogonal routing. */
|
|
1538
|
+
waypoints?: Point[];
|
|
1539
|
+
/** Connector shape: path routing algorithm. */
|
|
1540
|
+
routingMode?: 'straight' | 'orthogonal' | 'rounded-ortho' | 'curved';
|
|
1541
|
+
/** Connector shape: in-path label (double-click to edit). */
|
|
1542
|
+
label?: string;
|
|
1543
|
+
/** Connector shape: label position along the path (0–1). */
|
|
1544
|
+
labelPosition?: number;
|
|
1545
|
+
/** Connector shape: perpendicular offset of the label. */
|
|
1546
|
+
labelOffset?: number;
|
|
1547
|
+
/** Connector shape: stroke style to Mermaid edge mapping. */
|
|
1548
|
+
mermaidEdgeStyle?: 'solid' | 'thick' | 'dotted';
|
|
1549
|
+
/** Parallelogram/trapezoid slant amount as a % of width. */
|
|
1550
|
+
slantPercent?: number;
|
|
1551
|
+
/** Trapezoid top width as a % of the bottom width (0–100). */
|
|
1552
|
+
topWidthPercent?: number;
|
|
1553
|
+
/** Document shape: wave amplitude as a % of height. */
|
|
1554
|
+
waveAmplitudePercent?: number;
|
|
1217
1555
|
};
|
|
1218
1556
|
}
|
|
1219
1557
|
type SerializedViewbox = Viewbox;
|
|
@@ -1255,6 +1593,15 @@ interface HistorySnapshot {
|
|
|
1255
1593
|
clipMaskGroups?: SerializedClipMaskGroup[];
|
|
1256
1594
|
/** Document-level metadata (title, description, author, etc.) */
|
|
1257
1595
|
documentMetadata?: DocumentMetadata;
|
|
1596
|
+
/** Document-level `<script>` elements (SVG 2 §15.9). */
|
|
1597
|
+
documentScripts?: DocumentScript[];
|
|
1598
|
+
/**
|
|
1599
|
+
* Document-level `<style>` blocks captured from the source SVG and
|
|
1600
|
+
* re-emitted verbatim on export. Used for CSS whose effect targets
|
|
1601
|
+
* def-scoped content (mask / clipPath / symbol interiors) that the
|
|
1602
|
+
* editor cannot translate into AnimationTracks.
|
|
1603
|
+
*/
|
|
1604
|
+
documentStyles?: DocumentStyle[];
|
|
1258
1605
|
/** Template variable definitions with defaults. */
|
|
1259
1606
|
templateVariables?: TemplateVariable[];
|
|
1260
1607
|
/** Animation timeline (tracks, keyframes, easing). */
|
|
@@ -1263,6 +1610,12 @@ interface HistorySnapshot {
|
|
|
1263
1610
|
customPatterns?: CustomPatternDef[];
|
|
1264
1611
|
/** Symbol definitions (reusable component templates). */
|
|
1265
1612
|
symbols?: SerializedSymbolDef[];
|
|
1613
|
+
/**
|
|
1614
|
+
* Marker definitions (reusable vertex-attached graphics: arrowheads, dots,
|
|
1615
|
+
* etc.). Built-in markers are reconstituted at load time by MarkerManager
|
|
1616
|
+
* and are NOT persisted here — only user-authored defs are stored.
|
|
1617
|
+
*/
|
|
1618
|
+
markers?: SerializedMarkerDef[];
|
|
1266
1619
|
}
|
|
1267
1620
|
/**
|
|
1268
1621
|
* A variant axis on a component symbol. Each axis has a name (e.g.
|
|
@@ -1322,6 +1675,74 @@ interface SerializedSymbolDef {
|
|
|
1322
1675
|
*/
|
|
1323
1676
|
variantThumbnails?: Record<string, string>;
|
|
1324
1677
|
}
|
|
1678
|
+
/**
|
|
1679
|
+
* A reusable `<marker>` definition (SVG 2 §11.6). Markers are vertex-attached
|
|
1680
|
+
* graphics — arrowheads, vertex dots, decorations — referenced via
|
|
1681
|
+
* `marker-start` / `marker-mid` / `marker-end` attributes on stroked shapes.
|
|
1682
|
+
*
|
|
1683
|
+
* The browser handles per-vertex positioning, scaling (via `markerUnits`),
|
|
1684
|
+
* and orientation (via `orient`, including tangent-aware `auto` mode on
|
|
1685
|
+
* curved paths). MarkerManager only maintains the DOM `<defs>` entries in
|
|
1686
|
+
* sync with this serialized state.
|
|
1687
|
+
*
|
|
1688
|
+
* Simpler than `SerializedSymbolDef` — markers have no variants, no instance
|
|
1689
|
+
* overrides, and no placed instances (they attach via attribute references).
|
|
1690
|
+
*/
|
|
1691
|
+
interface SerializedMarkerDef {
|
|
1692
|
+
/**
|
|
1693
|
+
* Unique identifier.
|
|
1694
|
+
* - Built-in markers use stable ids: `mkr-builtin-arrow`, `mkr-builtin-open-arrow`,
|
|
1695
|
+
* `mkr-builtin-circle`, `mkr-builtin-diamond`, `mkr-builtin-square`.
|
|
1696
|
+
* - User-created markers use `mkr-<guid>`.
|
|
1697
|
+
*/
|
|
1698
|
+
id: string;
|
|
1699
|
+
/** Human-readable name shown in the markers panel. */
|
|
1700
|
+
name: string;
|
|
1701
|
+
/** SVG viewBox string ("minX minY width height"). */
|
|
1702
|
+
viewBox: string;
|
|
1703
|
+
/** X reference point — where the marker's "tip" aligns with the host vertex. */
|
|
1704
|
+
refX: number;
|
|
1705
|
+
refY: number;
|
|
1706
|
+
markerWidth: number;
|
|
1707
|
+
markerHeight: number;
|
|
1708
|
+
/**
|
|
1709
|
+
* `strokeWidth` scales the marker with the host's stroke-width (default,
|
|
1710
|
+
* typical for arrows). `userSpaceOnUse` renders at fixed size regardless
|
|
1711
|
+
* of stroke.
|
|
1712
|
+
*/
|
|
1713
|
+
markerUnits: 'strokeWidth' | 'userSpaceOnUse';
|
|
1714
|
+
/**
|
|
1715
|
+
* `auto` rotates to match the path tangent at each vertex.
|
|
1716
|
+
* `auto-start-reverse` reverses the start marker (so arrowheads don't
|
|
1717
|
+
* point inward at path starts). A number is a fixed rotation in degrees.
|
|
1718
|
+
*/
|
|
1719
|
+
orient: 'auto' | 'auto-start-reverse' | number;
|
|
1720
|
+
/**
|
|
1721
|
+
* Inner geometry. For user markers this is the authoritative source —
|
|
1722
|
+
* edited via isolation mode and re-rendered into the DOM `<marker>` child.
|
|
1723
|
+
* For built-ins this is `[]` in v1; built-ins render from the descriptor
|
|
1724
|
+
* registry (`getMarkerDescriptors()`) and are not editable.
|
|
1725
|
+
*/
|
|
1726
|
+
shapes: SerializedShape[];
|
|
1727
|
+
/** Groups within the marker (mirrors `SerializedSymbolDef.groups`). */
|
|
1728
|
+
groups?: SerializedGroup[];
|
|
1729
|
+
/** Base64 data-URI thumbnail for the markers panel. */
|
|
1730
|
+
thumbnail?: string;
|
|
1731
|
+
/**
|
|
1732
|
+
* Animation tracks scoped to the marker's inner shapes. Each track's
|
|
1733
|
+
* `shapeId` references an id in `shapes`. During isolation editing these
|
|
1734
|
+
* tracks are merged into the document timeline (tagged `scope:
|
|
1735
|
+
* 'marker:<id>'`) so the user can edit them; on save they're extracted
|
|
1736
|
+
* back here. On SVG export the tracks render as SMIL `<animate>` elements
|
|
1737
|
+
* inside the `<marker>` DOM so they play at every attached vertex.
|
|
1738
|
+
*/
|
|
1739
|
+
animations?: SerializedAnimationTimeline['tracks'];
|
|
1740
|
+
/**
|
|
1741
|
+
* True for editor-shipped built-ins (arrow, open-arrow, circle, diamond,
|
|
1742
|
+
* square). Built-ins are non-deletable, non-renamable, and non-editable.
|
|
1743
|
+
*/
|
|
1744
|
+
builtIn?: boolean;
|
|
1745
|
+
}
|
|
1325
1746
|
interface SerializedGroup {
|
|
1326
1747
|
id: string;
|
|
1327
1748
|
parentId: string | null;
|
|
@@ -1715,6 +2136,65 @@ declare function extractVariables(snapshot: HistorySnapshot): ExtractedVariables
|
|
|
1715
2136
|
*/
|
|
1716
2137
|
declare function parseVariableArgs(args: string[]): VariableMap;
|
|
1717
2138
|
|
|
2139
|
+
/**
|
|
2140
|
+
* @svgsketch/core — Coordinate precision utilities.
|
|
2141
|
+
*
|
|
2142
|
+
* Pure rounding utilities used at every state-capture boundary in the
|
|
2143
|
+
* editor (per-shape command capture, full snapshot capture, SVG export)
|
|
2144
|
+
* to enforce a configurable decimal precision on persisted/exported
|
|
2145
|
+
* coordinate values.
|
|
2146
|
+
*
|
|
2147
|
+
* Rounding fires only on the way OUT of the document model (save, export,
|
|
2148
|
+
* undo capture). Imports are never rounded — see DocumentMetadata's
|
|
2149
|
+
* `coordinatePrecision` field for the policy.
|
|
2150
|
+
*
|
|
2151
|
+
* Industry context: Adobe Illustrator, Inkscape, Affinity Designer, and
|
|
2152
|
+
* SVGO all expose a precision control. Default 3 decimals matches SVGO
|
|
2153
|
+
* and Illustrator.
|
|
2154
|
+
*/
|
|
2155
|
+
|
|
2156
|
+
/** Default precision when DocumentMetadata.coordinatePrecision is unset. */
|
|
2157
|
+
declare const DEFAULT_COORDINATE_PRECISION = 3;
|
|
2158
|
+
/**
|
|
2159
|
+
* Maximum precision we accept. Above 12 the rounding becomes a no-op for
|
|
2160
|
+
* practical SVG coordinate ranges (float64 has ~15-17 significant digits).
|
|
2161
|
+
*/
|
|
2162
|
+
declare const MAX_COORDINATE_PRECISION = 12;
|
|
2163
|
+
/**
|
|
2164
|
+
* Resolve an optional precision value to a concrete one. Clamps to the
|
|
2165
|
+
* supported range and substitutes the default for `undefined` / `null` /
|
|
2166
|
+
* non-finite inputs.
|
|
2167
|
+
*/
|
|
2168
|
+
declare function getEffectivePrecision(p: number | undefined | null): number;
|
|
2169
|
+
/**
|
|
2170
|
+
* Round a single number to N decimal places. Non-finite inputs (NaN,
|
|
2171
|
+
* Infinity) pass through unchanged so we never poison data with NaN.
|
|
2172
|
+
*/
|
|
2173
|
+
declare function roundCoord(value: number, precision: number): number;
|
|
2174
|
+
/**
|
|
2175
|
+
* Round every numeric token in a string in place. Does not touch any
|
|
2176
|
+
* non-numeric content (operators, commands, whitespace).
|
|
2177
|
+
*/
|
|
2178
|
+
declare function roundNumberString(s: string, precision: number): string;
|
|
2179
|
+
/**
|
|
2180
|
+
* Round all coordinate-bearing numeric fields in a SerializedShape's
|
|
2181
|
+
* state. Returns a new object — input is not mutated.
|
|
2182
|
+
*
|
|
2183
|
+
* `id` and `type` are passed through unchanged.
|
|
2184
|
+
*/
|
|
2185
|
+
declare function roundSerializedShape(shape: SerializedShape, precision: number): SerializedShape;
|
|
2186
|
+
/**
|
|
2187
|
+
* Round all coordinate-bearing fields in a complete HistorySnapshot.
|
|
2188
|
+
* Used at the snapshot-level capture boundary (file save, cloud sync).
|
|
2189
|
+
*
|
|
2190
|
+
* Returns a new snapshot with shapes, viewboxes, guides, measurements,
|
|
2191
|
+
* and the animation timeline rounded. Document metadata (titles, IDs,
|
|
2192
|
+
* etc.) and structural fields (groups, clipMaskGroups, scripts, symbols)
|
|
2193
|
+
* pass through with their numeric leaves rounded but their structure
|
|
2194
|
+
* preserved.
|
|
2195
|
+
*/
|
|
2196
|
+
declare function roundSnapshot(snapshot: HistorySnapshot, precision: number): HistorySnapshot;
|
|
2197
|
+
|
|
1718
2198
|
/**
|
|
1719
2199
|
* Document-level SVG renderer.
|
|
1720
2200
|
*
|
|
@@ -1832,6 +2312,41 @@ declare function computeCrossVertices(radius: number, armWidthPercent: number, s
|
|
|
1832
2312
|
* Compute arrow vertices (7 points forming an arrow).
|
|
1833
2313
|
*/
|
|
1834
2314
|
declare function computeArrowVertices(radius: number, headWidthPercent: number, headLengthPercent: number, shaftWidthPercent: number, shiftAngleDeg?: number): Point[];
|
|
2315
|
+
/**
|
|
2316
|
+
* Compute speech-bubble vertices — square body with a tail protruding at a
|
|
2317
|
+
* chosen angle. The base endpoints lie on the chosen body edge (keeping the
|
|
2318
|
+
* body outline continuous); the tip extends in the direction of `tailAngleDeg`
|
|
2319
|
+
* at length `tailLengthPercent * radius`.
|
|
2320
|
+
*
|
|
2321
|
+
* The `shiftAngleDeg` rotates the entire shape (body + tail).
|
|
2322
|
+
*/
|
|
2323
|
+
declare function computeSpeechBubbleVertices(radius: number, tailAngleDeg: number, tailLengthPercent: number, tailWidthPercent: number, shiftAngleDeg?: number): Point[];
|
|
2324
|
+
/**
|
|
2325
|
+
* Compute lightning-bolt vertices — a zigzag ribbon from top tip to bottom tip.
|
|
2326
|
+
* `boltSegments` line segments make the zigzag (alternating x offsets of
|
|
2327
|
+
* `boltJaggednessPercent * radius`); the ribbon is `boltWidthPercent * radius`
|
|
2328
|
+
* wide, perpendicular to each segment's bisector normal.
|
|
2329
|
+
*/
|
|
2330
|
+
declare function computeLightningVertices(radius: number, boltSegments: number, boltJaggednessPercent: number, boltWidthPercent: number, shiftAngleDeg?: number): Point[];
|
|
2331
|
+
/**
|
|
2332
|
+
* Compute heart path — two cubic Béziers meeting at the bottom tip and the
|
|
2333
|
+
* upper cleft. `lobeRadiusPercent` controls the horizontal extent of the two
|
|
2334
|
+
* top lobes; `cleftDepthPercent` controls how deep the central dip sits.
|
|
2335
|
+
*/
|
|
2336
|
+
declare function computeHeartPath(radius: number, lobeRadiusPercent: number, cleftDepthPercent: number, shiftAngleDeg?: number): string;
|
|
2337
|
+
/**
|
|
2338
|
+
* Compute cloud path — a classic cartoon-cloud silhouette built as the outer
|
|
2339
|
+
* boundary of N overlapping circles placed around an elongated ellipse.
|
|
2340
|
+
* Circles go all the way around (top, sides, bottom), and the silhouette is
|
|
2341
|
+
* closed by walking each circle's outer arc via the intersection with its
|
|
2342
|
+
* next neighbor. Every transition between bumps is tangent-smooth — no flat
|
|
2343
|
+
* edges, no corners.
|
|
2344
|
+
*
|
|
2345
|
+
* `cloudBumps` (3..8) — number of bump circles forming the silhouette.
|
|
2346
|
+
* `cloudPuffinessPercent` (40..80) — drives bump overlap; higher values
|
|
2347
|
+
* smooth the underside; lower values leave the bumps more pronounced.
|
|
2348
|
+
*/
|
|
2349
|
+
declare function computeCloudPath(radius: number, cloudBumps: number, cloudPuffinessPercent: number, shiftAngleDeg?: number): string;
|
|
1835
2350
|
/**
|
|
1836
2351
|
* Convert an array of vertices to an SVG path string.
|
|
1837
2352
|
* Supports optional rounded corners via quadratic Bézier.
|
|
@@ -1845,9 +2360,6 @@ declare function computeRingPath(radius: number, innerRadiusPercent: number, fil
|
|
|
1845
2360
|
* Generate SVG path for an Archimedean spiral.
|
|
1846
2361
|
*/
|
|
1847
2362
|
declare function computeSpiralPath(radius: number, turns: number, thicknessPercent: number, spiralDirection?: number, shiftAngleDeg?: number): string;
|
|
1848
|
-
/**
|
|
1849
|
-
* Compute gear vertices (4 vertices per tooth).
|
|
1850
|
-
*/
|
|
1851
2363
|
declare function computeGearVertices(teeth: number, radius: number, toothDepthPercent: number, shiftAngleDeg?: number): Point[];
|
|
1852
2364
|
/**
|
|
1853
2365
|
* Generate full gear path including optional center hole.
|
|
@@ -1957,6 +2469,7 @@ declare function generatePatternSvgContent(patternType: string, scale: number, c
|
|
|
1957
2469
|
*
|
|
1958
2470
|
* @packageDocumentation
|
|
1959
2471
|
*/
|
|
2472
|
+
|
|
1960
2473
|
interface MarkerDescriptor {
|
|
1961
2474
|
/** Marker element id (e.g., 'line-marker-arrow'). */
|
|
1962
2475
|
id: string;
|
|
@@ -1981,6 +2494,22 @@ declare const MARKER_HEIGHT = 6;
|
|
|
1981
2494
|
* `markerUnits="strokeWidth"`, and `orient="auto-start-reverse"`.
|
|
1982
2495
|
*/
|
|
1983
2496
|
declare function getMarkerDescriptors(): MarkerDescriptor[];
|
|
2497
|
+
/**
|
|
2498
|
+
* Maps the legacy marker ids (used by line endpoint shape state) to the new
|
|
2499
|
+
* first-class MarkerManager ids. The legacy ids remain valid references in
|
|
2500
|
+
* the DOM — built-ins are emitted under BOTH ids to preserve backwards
|
|
2501
|
+
* compat with saved docs that reference `url(#line-marker-arrow)`.
|
|
2502
|
+
*/
|
|
2503
|
+
declare const BUILTIN_MARKER_ID_MAP: Record<string, string>;
|
|
2504
|
+
/**
|
|
2505
|
+
* Return `SerializedMarkerDef`s for the built-in line endpoint markers.
|
|
2506
|
+
*
|
|
2507
|
+
* Built-ins carry `shapes: []` — their geometry is rendered by the editor
|
|
2508
|
+
* directly from the descriptor registry rather than from `SerializedShape`s.
|
|
2509
|
+
* This keeps descriptor → shape conversion out of v1 scope. Consequence:
|
|
2510
|
+
* built-ins are non-editable (the markers panel disables Edit on them).
|
|
2511
|
+
*/
|
|
2512
|
+
declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
1984
2513
|
|
|
1985
2514
|
/**
|
|
1986
2515
|
* SMIL animation renderer — converts SerializedAnimationTimeline
|
|
@@ -3255,4 +3784,4 @@ declare class Document {
|
|
|
3255
3784
|
private _ensureMetadata;
|
|
3256
3785
|
}
|
|
3257
3786
|
|
|
3258
|
-
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, type BaseFilter, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, type CodeFormat, type CodegenOptions, type CommonNodeProps, type ContouringDiscreteFilter, type ContouringTableFilter, type ContrastFilter, type CornerShapeValue, type CreateDocumentOptions, type CreateShapeOptions, Cross, type CrossNodeProps, type CrumpledPlasticFilter, type CustomPatternDef, type CycleBehavior, Document, type DocumentMetadata, type DocumentNodeProps, type DocumentOptions, type DropShadowFilter, type DuotoneFilter, EASING_CURVES, EVENT_TRIGGER_OPTIONS, EasingType, Ellipse, type EllipseNodeProps, type EmbossFilter, type ExtractedVariables, type FillType, type FilmGrainFilter, type FilterType, type GaussianBlurFilter, Gear, type GearNodeProps, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GrayscaleFilter, type GroupNodeProps, type Guide, type HistorySnapshot, type HueRotateFilter, type ImageAttribution, type ImageNodeProps, ImageShape, type InkBlotFilter, type InnerGlowFilter, type InnerShadowFilter, type InvertFilter, type LicenseType, Line, type LineEndpointValue, type LineNodeProps, type LinearEasingPoint, type LinearGradient, LinearGradientBuilder, type LinkTarget, MARKER_HEIGHT, MARKER_VIEWBOX, MARKER_WIDTH, MIGRATIONS, type MarkerDescriptor, 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 PatternParams, type PatternSvgContentResult, type PatternType, type PixelateFilter, type Point, type PointLightFilter, type PolygonBaseNodeProps, Polyline, type PolylineNodeProps, type RadialGradient, RadialGradientBuilder, 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 SerializedShape, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, type SharpenFilter, Spiral, type SpiralNodeProps, Spline, SplineCurveType, type SplineNodeProps, type SplinePoint, SplinePointType, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StringifyOptions, type StrokeType, type SymbolInstanceNodeProps, type TemplateVariable, type TemplateVariableSource, type TemplateVariableType, Text, type TextNodeProps, Timeline, Track, Triangle, type TriangleNodeProps, type ValidationError, type ValidationResult, type VariableMap, type Viewbox, type WarpFilter, type WarpType, type WatercolorFilter, type XrayFilter, computeArrowVertices, computeCrossVertices, computeDashArray, computeGearPath, computeGearVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createShape, createViewbox, escXml, extractVariables, filterAttr, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generateReactCode, generateSvgCode, generateVueCode, getEasingCubicBezier, getMarkerDescriptors, getPatternElements, linearGradient, migrateSnapshot, parseDocument, parseVariableArgs, pattern, radialGradient, renderAnimationElements, renderCircle, renderEllipse, renderFilterDefs, renderFilterPrimitivesForType, renderImage, renderLine, renderPolygonShape, renderPolyline, renderRectangle, renderShape, renderSpline, renderText, renderToSvg, stringifyDocument, substituteString, substituteVariables, validateSnapshot, verticesToPath };
|
|
3787
|
+
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 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, type LicenseType, type LightSource, Line, type LineEndpointValue, type LineNodeProps, type LinearEasingPoint, type LinearGradient, LinearGradientBuilder, type LinkTarget, MARKER_HEIGHT, MARKER_VIEWBOX, MARKER_WIDTH, MAX_COORDINATE_PRECISION, MIGRATIONS, type MarkerDescriptor, 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 PatternParams, type PatternSvgContentResult, type PatternType, type PixelateFilter, type Point, type PointLightFilter, type PolygonBaseNodeProps, Polyline, type PolylineNodeProps, type RadialGradient, RadialGradientBuilder, 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, Spline, SplineCurveType, type SplineNodeProps, type SplinePoint, SplinePointType, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type SymbolInstanceNodeProps, type TemplateVariable, type TemplateVariableSource, type TemplateVariableType, Text, type TextNodeProps, Timeline, Track, Triangle, type TriangleNodeProps, type ValidationError, type ValidationResult, type VariableMap, type Viewbox, type WarpFilter, type WarpType, type WatercolorFilter, type XrayFilter, computeArrowVertices, computeCloudPath, computeCrossVertices, computeDashArray, computeGearPath, computeGearVertices, computeHeartPath, computeLightningVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpeechBubbleVertices, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createShape, createViewbox, escXml, extractVariables, filterAttr, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generateReactCode, generateSvgCode, generateVueCode, getBuiltInMarkerDefs, getEasingCubicBezier, getEffectivePrecision, getMarkerDescriptors, getPatternElements, linearGradient, migrateSnapshot, parseDocument, parseVariableArgs, pattern, radialGradient, renderAnimationElements, renderCircle, renderEllipse, renderFilterDefs, renderFilterPrimitivesForType, renderImage, renderLine, renderPolygonShape, renderPolyline, renderRectangle, renderShape, renderSpline, renderText, renderToSvg, roundCoord, roundNumberString, roundSerializedShape, roundSnapshot, stringifyDocument, substituteString, substituteVariables, validateSnapshot, verticesToPath };
|