@svgsketch/core 1.1.0 → 1.3.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 +139 -12
- package/dist/index.d.ts +139 -12
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1454,17 +1454,13 @@ type TemplateVariableType = 'string' | 'color' | 'number';
|
|
|
1454
1454
|
*/
|
|
1455
1455
|
type TemplateVariableMode = 'live' | 'stamped';
|
|
1456
1456
|
/**
|
|
1457
|
-
* Where a TemplateVariable came from. `user`
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1457
|
+
* Where a TemplateVariable came from. Currently only `user` (hand-authored
|
|
1458
|
+
* in the Document Tokens panel or harvested from imported `:root { --foo
|
|
1459
|
+
* }` blocks). Retained as a tagged union so additional sources (e.g.
|
|
1460
|
+
* external design-token imports) can be added without breaking callers.
|
|
1461
1461
|
*/
|
|
1462
1462
|
type TemplateVariableSource = {
|
|
1463
1463
|
kind: 'user';
|
|
1464
|
-
} | {
|
|
1465
|
-
kind: 'palette';
|
|
1466
|
-
paletteId: string;
|
|
1467
|
-
index: number;
|
|
1468
1464
|
};
|
|
1469
1465
|
/**
|
|
1470
1466
|
* A template variable definition stored in the document.
|
|
@@ -1626,6 +1622,8 @@ interface SerializedShape {
|
|
|
1626
1622
|
richTextData?: RichTextData;
|
|
1627
1623
|
scaleX?: number;
|
|
1628
1624
|
scaleY?: number;
|
|
1625
|
+
translateX?: number;
|
|
1626
|
+
translateY?: number;
|
|
1629
1627
|
textX?: number;
|
|
1630
1628
|
textY?: number;
|
|
1631
1629
|
scaleAnchor?: Point | null;
|
|
@@ -1885,6 +1883,7 @@ interface SerializedShape {
|
|
|
1885
1883
|
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1886
1884
|
textPathLength?: number;
|
|
1887
1885
|
textPathLengthUnit?: '%' | 'user';
|
|
1886
|
+
textPathPathLength?: number;
|
|
1888
1887
|
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1889
1888
|
textPathRefShapeId?: string;
|
|
1890
1889
|
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
@@ -2176,6 +2175,55 @@ interface HistorySnapshot {
|
|
|
2176
2175
|
symbols?: SerializedSymbolDef[];
|
|
2177
2176
|
/** @deprecated v2 — use `library`. Read-only: v1 docs migrate into `library`. */
|
|
2178
2177
|
markers?: SerializedMarkerDef[];
|
|
2178
|
+
/**
|
|
2179
|
+
* Color glyph library — Phase 3 of the OT-SVG / COLR foundry. Authored
|
|
2180
|
+
* color glyphs (each a small SVG document plus codepoint mapping) ride
|
|
2181
|
+
* with the document so they survive local save/load and cloud sync.
|
|
2182
|
+
* The base font that the foundry overlays onto is intentionally NOT
|
|
2183
|
+
* stored here — it's a per-browser tool choice (kept in IndexedDB),
|
|
2184
|
+
* not document state. Only the colour-glyph artwork itself rides.
|
|
2185
|
+
*
|
|
2186
|
+
* Optional: documents that never opened the foundry have no entry,
|
|
2187
|
+
* and the field is omitted on serialisation when the library is empty.
|
|
2188
|
+
*/
|
|
2189
|
+
colorGlyphLibrary?: SerializedColorGlyphLibrary;
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Wire format for the color glyph library. Mirrors the in-editor
|
|
2193
|
+
* `GlyphLibrary` exactly, but typed in core so plugins / CLI tooling /
|
|
2194
|
+
* any future export pipeline can consume it without depending on the
|
|
2195
|
+
* editor app.
|
|
2196
|
+
*
|
|
2197
|
+
* Versioned because the entry shape may evolve (e.g. when variable-axis
|
|
2198
|
+
* glyph deltas land in Phase 4). Readers honour `version: 1` only;
|
|
2199
|
+
* future versions will get explicit migration code in `migrateSnapshot`.
|
|
2200
|
+
*/
|
|
2201
|
+
interface SerializedColorGlyphLibrary {
|
|
2202
|
+
version: 1;
|
|
2203
|
+
entries: SerializedColorGlyph[];
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* One color glyph in the library. All fields are JSON-serialisable;
|
|
2207
|
+
* the SVG document is stored as a string, not parsed, so round-tripping
|
|
2208
|
+
* preserves whatever DOM the user authored byte-for-byte.
|
|
2209
|
+
*/
|
|
2210
|
+
interface SerializedColorGlyph {
|
|
2211
|
+
/** Internal glyph ID assigned by the library; resolved against the base font's cmap on export. */
|
|
2212
|
+
glyphId: number;
|
|
2213
|
+
/** PostScript glyph name (e.g. `"uni1F3A8"`). Optional — emitter generates one if absent. */
|
|
2214
|
+
glyphName?: string;
|
|
2215
|
+
/** Unicode codepoints this glyph maps from in `cmap`. Empty = unmapped (referenced only by GSUB). */
|
|
2216
|
+
codepoints: number[];
|
|
2217
|
+
/** Advance width in font units. Defaults to `unitsPerEm` if unset. */
|
|
2218
|
+
advanceWidth?: number;
|
|
2219
|
+
/** SVG document for the glyph. Root `<svg>` should carry `id="glyph${glyphId}"`. */
|
|
2220
|
+
svgDocument: string;
|
|
2221
|
+
/** Source font this glyph came from (when extracted via the Phase 2 break-apart). */
|
|
2222
|
+
sourceFamily?: string;
|
|
2223
|
+
/** Source glyph ID in the originating font. */
|
|
2224
|
+
sourceGlyphId?: number;
|
|
2225
|
+
/** Display label shown in the library panel. */
|
|
2226
|
+
label?: string;
|
|
2179
2227
|
}
|
|
2180
2228
|
/**
|
|
2181
2229
|
* A variant axis on a component symbol. Each axis has a name (e.g.
|
|
@@ -2529,6 +2577,8 @@ interface CommonNodeProps {
|
|
|
2529
2577
|
opacity: number;
|
|
2530
2578
|
fillOpacity: number;
|
|
2531
2579
|
strokeOpacity: number;
|
|
2580
|
+
translateX: number;
|
|
2581
|
+
translateY: number;
|
|
2532
2582
|
rotation: number;
|
|
2533
2583
|
skewX: number;
|
|
2534
2584
|
skewY: number;
|
|
@@ -2570,6 +2620,8 @@ interface RectangleNodeProps extends CommonNodeProps {
|
|
|
2570
2620
|
y: number;
|
|
2571
2621
|
width: number;
|
|
2572
2622
|
height: number;
|
|
2623
|
+
rx: number;
|
|
2624
|
+
ry: number;
|
|
2573
2625
|
cornerRadius: number;
|
|
2574
2626
|
cornerShape: CornerShapeValue;
|
|
2575
2627
|
cornerMode: 'uniform' | 'non-uniform';
|
|
@@ -2589,8 +2641,8 @@ interface CircleNodeProps extends CommonNodeProps {
|
|
|
2589
2641
|
radius: number;
|
|
2590
2642
|
}
|
|
2591
2643
|
interface EllipseNodeProps extends CommonNodeProps {
|
|
2592
|
-
|
|
2593
|
-
|
|
2644
|
+
cx: number;
|
|
2645
|
+
cy: number;
|
|
2594
2646
|
rx: number;
|
|
2595
2647
|
ry: number;
|
|
2596
2648
|
}
|
|
@@ -2738,7 +2790,7 @@ interface SymbolInstanceNodeProps extends CommonNodeProps {
|
|
|
2738
2790
|
height: number;
|
|
2739
2791
|
symbolId: string;
|
|
2740
2792
|
}
|
|
2741
|
-
interface GroupNodeProps {
|
|
2793
|
+
interface GroupNodeProps extends CommonNodeProps {
|
|
2742
2794
|
groupId: string | null;
|
|
2743
2795
|
}
|
|
2744
2796
|
type DocumentNodeProps = Record<string, never>;
|
|
@@ -3502,6 +3554,7 @@ declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
|
3502
3554
|
* - `<animate>` for numeric and color properties
|
|
3503
3555
|
* - `<animateTransform>` for rotation, skewX, skewY
|
|
3504
3556
|
* - `<animateMotion>` for path-based motion
|
|
3557
|
+
* - `<discard>` for remove-at-time tracks
|
|
3505
3558
|
*
|
|
3506
3559
|
* The output is a map from shape ID → array of SVG element strings
|
|
3507
3560
|
* so the main renderer can inject them as children of each shape element.
|
|
@@ -4236,6 +4289,8 @@ declare class Rectangle extends ShapeBuilder<Rectangle> {
|
|
|
4236
4289
|
size(width: number, height: number): Rectangle;
|
|
4237
4290
|
/** Set the corner radius for rounded rectangles. */
|
|
4238
4291
|
cornerRadius(r: number): Rectangle;
|
|
4292
|
+
/** Set independent SVG rect corner radii. */
|
|
4293
|
+
radii(rx: number, ry: number): Rectangle;
|
|
4239
4294
|
}
|
|
4240
4295
|
declare class Square extends ShapeBuilder<Square> {
|
|
4241
4296
|
constructor(x: number, y: number, size: number);
|
|
@@ -4243,6 +4298,8 @@ declare class Square extends ShapeBuilder<Square> {
|
|
|
4243
4298
|
size(value: number): Square;
|
|
4244
4299
|
/** Set the corner radius for rounded squares. */
|
|
4245
4300
|
cornerRadius(r: number): Square;
|
|
4301
|
+
/** Set independent SVG rect corner radii. */
|
|
4302
|
+
radii(rx: number, ry: number): Square;
|
|
4246
4303
|
}
|
|
4247
4304
|
declare class Line extends ShapeBuilder<Line> {
|
|
4248
4305
|
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
@@ -5247,4 +5304,74 @@ declare class Document {
|
|
|
5247
5304
|
private _ensureMetadata;
|
|
5248
5305
|
}
|
|
5249
5306
|
|
|
5250
|
-
|
|
5307
|
+
/**
|
|
5308
|
+
* Pure jigsaw-puzzle piece geometry.
|
|
5309
|
+
*
|
|
5310
|
+
* The classic / curved styles use the algorithm from Draradech's canonical
|
|
5311
|
+
* generator (https://gist.github.com/Draradech/35d36347312ca6d0887aa7d55f366e30):
|
|
5312
|
+
* each edge between adjacent pieces is drawn as three consecutive cubic
|
|
5313
|
+
* Bezier curves through ten control points, producing the rounded "bulb"
|
|
5314
|
+
* tab silhouette.
|
|
5315
|
+
*
|
|
5316
|
+
* Adjacent pieces reference the *same* precomputed edge — one piece
|
|
5317
|
+
* traverses it forward, the other reversed — so the union of pieces tiles
|
|
5318
|
+
* the bounds exactly.
|
|
5319
|
+
*
|
|
5320
|
+
* No DOM, no Canvas — safe to import from the CLI, the editor, or tests.
|
|
5321
|
+
*/
|
|
5322
|
+
/** Axis-aligned bounding box in user units. */
|
|
5323
|
+
interface PuzzleBounds {
|
|
5324
|
+
x: number;
|
|
5325
|
+
y: number;
|
|
5326
|
+
width: number;
|
|
5327
|
+
height: number;
|
|
5328
|
+
}
|
|
5329
|
+
type PuzzleStyle = 'classic' | 'curved' | 'square-tabs' | 'slice';
|
|
5330
|
+
type PuzzleTabPattern = 'random' | 'alternating';
|
|
5331
|
+
interface PuzzleOptions {
|
|
5332
|
+
/** Number of rows (>= 1). */
|
|
5333
|
+
rows: number;
|
|
5334
|
+
/** Number of columns (>= 1). */
|
|
5335
|
+
cols: number;
|
|
5336
|
+
/** Edge style. `'slice'` produces straight cuts (no tabs). */
|
|
5337
|
+
style: PuzzleStyle;
|
|
5338
|
+
/**
|
|
5339
|
+
* Tab depth as a percentage. For curve styles this drives Draradech's
|
|
5340
|
+
* `t = tabDepthPercent / 200`; the bulb extends `3t` of the piece's
|
|
5341
|
+
* perpendicular dimension beyond the boundary line.
|
|
5342
|
+
*/
|
|
5343
|
+
tabDepthPercent: number;
|
|
5344
|
+
/** Whether tab orientations are random or strictly alternating. */
|
|
5345
|
+
tabPattern: PuzzleTabPattern;
|
|
5346
|
+
/** Deterministic seed so the same options produce the same output. */
|
|
5347
|
+
seed: number;
|
|
5348
|
+
}
|
|
5349
|
+
interface PuzzlePiece {
|
|
5350
|
+
/** Stable id derived from row/col/seed. */
|
|
5351
|
+
id: string;
|
|
5352
|
+
row: number;
|
|
5353
|
+
col: number;
|
|
5354
|
+
/** SVG path data, closed (`Z`). Coordinates are in the same space as `bounds`. */
|
|
5355
|
+
d: string;
|
|
5356
|
+
}
|
|
5357
|
+
declare const PUZZLE_DEFAULTS: PuzzleOptions;
|
|
5358
|
+
/**
|
|
5359
|
+
* Produce `rows × cols` puzzle pieces tiling the given bounds.
|
|
5360
|
+
*
|
|
5361
|
+
* Each interior edge between adjacent pieces is computed once and shared:
|
|
5362
|
+
* piece A traverses it forward, piece B reverses the same control-point
|
|
5363
|
+
* sequence. So the union of all pieces equals the bounds with no gaps or
|
|
5364
|
+
* overlaps (within float epsilon).
|
|
5365
|
+
*
|
|
5366
|
+
* @example
|
|
5367
|
+
* ```ts
|
|
5368
|
+
* const pieces = generatePuzzlePieces(
|
|
5369
|
+
* { x: 0, y: 0, width: 400, height: 300 },
|
|
5370
|
+
* { ...PUZZLE_DEFAULTS, rows: 3, cols: 4, seed: 42 }
|
|
5371
|
+
* );
|
|
5372
|
+
* pieces.length === 12;
|
|
5373
|
+
* ```
|
|
5374
|
+
*/
|
|
5375
|
+
declare function generatePuzzlePieces(bounds: PuzzleBounds, options?: Partial<PuzzleOptions>): PuzzlePiece[];
|
|
5376
|
+
|
|
5377
|
+
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, Audio, BUILTIN_MARKER_ID_MAP, type BaseFilter, type BaseFilterPrimitive, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, Cloud, type CodeFormat, type CodegenOptions, type CommonNodeProps, type ConnectionDirection, type ConnectionPoint, Container, ContainerShapeBuilder, 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, Heart, type HistorySnapshot, type HueRotateFilter, Hyperlink, 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, Lightning, 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, NestedSvg, type NodeTypePropsMap, type NoiseFilter, type OpacityFilter, type OutlineFilter, type OutlinePosition, PUZZLE_DEFAULTS, 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 PuzzleBounds, type PuzzleOptions, type PuzzlePiece, type PuzzleStyle, type PuzzleTabPattern, 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 SerializedColorGlyph, type SerializedColorGlyphLibrary, type SerializedGroup, type SerializedMarkerDef, type SerializedShape, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, ShapeReference, type SharpenFilter, type SpecularLightingFilter, SpeechBubble, Spiral, type SpiralNodeProps, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type SvgPrimitiveChainFilter, Switch, 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, Video, View, 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, generatePuzzlePieces, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1454,17 +1454,13 @@ type TemplateVariableType = 'string' | 'color' | 'number';
|
|
|
1454
1454
|
*/
|
|
1455
1455
|
type TemplateVariableMode = 'live' | 'stamped';
|
|
1456
1456
|
/**
|
|
1457
|
-
* Where a TemplateVariable came from. `user`
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1457
|
+
* Where a TemplateVariable came from. Currently only `user` (hand-authored
|
|
1458
|
+
* in the Document Tokens panel or harvested from imported `:root { --foo
|
|
1459
|
+
* }` blocks). Retained as a tagged union so additional sources (e.g.
|
|
1460
|
+
* external design-token imports) can be added without breaking callers.
|
|
1461
1461
|
*/
|
|
1462
1462
|
type TemplateVariableSource = {
|
|
1463
1463
|
kind: 'user';
|
|
1464
|
-
} | {
|
|
1465
|
-
kind: 'palette';
|
|
1466
|
-
paletteId: string;
|
|
1467
|
-
index: number;
|
|
1468
1464
|
};
|
|
1469
1465
|
/**
|
|
1470
1466
|
* A template variable definition stored in the document.
|
|
@@ -1626,6 +1622,8 @@ interface SerializedShape {
|
|
|
1626
1622
|
richTextData?: RichTextData;
|
|
1627
1623
|
scaleX?: number;
|
|
1628
1624
|
scaleY?: number;
|
|
1625
|
+
translateX?: number;
|
|
1626
|
+
translateY?: number;
|
|
1629
1627
|
textX?: number;
|
|
1630
1628
|
textY?: number;
|
|
1631
1629
|
scaleAnchor?: Point | null;
|
|
@@ -1885,6 +1883,7 @@ interface SerializedShape {
|
|
|
1885
1883
|
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1886
1884
|
textPathLength?: number;
|
|
1887
1885
|
textPathLengthUnit?: '%' | 'user';
|
|
1886
|
+
textPathPathLength?: number;
|
|
1888
1887
|
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1889
1888
|
textPathRefShapeId?: string;
|
|
1890
1889
|
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
@@ -2176,6 +2175,55 @@ interface HistorySnapshot {
|
|
|
2176
2175
|
symbols?: SerializedSymbolDef[];
|
|
2177
2176
|
/** @deprecated v2 — use `library`. Read-only: v1 docs migrate into `library`. */
|
|
2178
2177
|
markers?: SerializedMarkerDef[];
|
|
2178
|
+
/**
|
|
2179
|
+
* Color glyph library — Phase 3 of the OT-SVG / COLR foundry. Authored
|
|
2180
|
+
* color glyphs (each a small SVG document plus codepoint mapping) ride
|
|
2181
|
+
* with the document so they survive local save/load and cloud sync.
|
|
2182
|
+
* The base font that the foundry overlays onto is intentionally NOT
|
|
2183
|
+
* stored here — it's a per-browser tool choice (kept in IndexedDB),
|
|
2184
|
+
* not document state. Only the colour-glyph artwork itself rides.
|
|
2185
|
+
*
|
|
2186
|
+
* Optional: documents that never opened the foundry have no entry,
|
|
2187
|
+
* and the field is omitted on serialisation when the library is empty.
|
|
2188
|
+
*/
|
|
2189
|
+
colorGlyphLibrary?: SerializedColorGlyphLibrary;
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Wire format for the color glyph library. Mirrors the in-editor
|
|
2193
|
+
* `GlyphLibrary` exactly, but typed in core so plugins / CLI tooling /
|
|
2194
|
+
* any future export pipeline can consume it without depending on the
|
|
2195
|
+
* editor app.
|
|
2196
|
+
*
|
|
2197
|
+
* Versioned because the entry shape may evolve (e.g. when variable-axis
|
|
2198
|
+
* glyph deltas land in Phase 4). Readers honour `version: 1` only;
|
|
2199
|
+
* future versions will get explicit migration code in `migrateSnapshot`.
|
|
2200
|
+
*/
|
|
2201
|
+
interface SerializedColorGlyphLibrary {
|
|
2202
|
+
version: 1;
|
|
2203
|
+
entries: SerializedColorGlyph[];
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* One color glyph in the library. All fields are JSON-serialisable;
|
|
2207
|
+
* the SVG document is stored as a string, not parsed, so round-tripping
|
|
2208
|
+
* preserves whatever DOM the user authored byte-for-byte.
|
|
2209
|
+
*/
|
|
2210
|
+
interface SerializedColorGlyph {
|
|
2211
|
+
/** Internal glyph ID assigned by the library; resolved against the base font's cmap on export. */
|
|
2212
|
+
glyphId: number;
|
|
2213
|
+
/** PostScript glyph name (e.g. `"uni1F3A8"`). Optional — emitter generates one if absent. */
|
|
2214
|
+
glyphName?: string;
|
|
2215
|
+
/** Unicode codepoints this glyph maps from in `cmap`. Empty = unmapped (referenced only by GSUB). */
|
|
2216
|
+
codepoints: number[];
|
|
2217
|
+
/** Advance width in font units. Defaults to `unitsPerEm` if unset. */
|
|
2218
|
+
advanceWidth?: number;
|
|
2219
|
+
/** SVG document for the glyph. Root `<svg>` should carry `id="glyph${glyphId}"`. */
|
|
2220
|
+
svgDocument: string;
|
|
2221
|
+
/** Source font this glyph came from (when extracted via the Phase 2 break-apart). */
|
|
2222
|
+
sourceFamily?: string;
|
|
2223
|
+
/** Source glyph ID in the originating font. */
|
|
2224
|
+
sourceGlyphId?: number;
|
|
2225
|
+
/** Display label shown in the library panel. */
|
|
2226
|
+
label?: string;
|
|
2179
2227
|
}
|
|
2180
2228
|
/**
|
|
2181
2229
|
* A variant axis on a component symbol. Each axis has a name (e.g.
|
|
@@ -2529,6 +2577,8 @@ interface CommonNodeProps {
|
|
|
2529
2577
|
opacity: number;
|
|
2530
2578
|
fillOpacity: number;
|
|
2531
2579
|
strokeOpacity: number;
|
|
2580
|
+
translateX: number;
|
|
2581
|
+
translateY: number;
|
|
2532
2582
|
rotation: number;
|
|
2533
2583
|
skewX: number;
|
|
2534
2584
|
skewY: number;
|
|
@@ -2570,6 +2620,8 @@ interface RectangleNodeProps extends CommonNodeProps {
|
|
|
2570
2620
|
y: number;
|
|
2571
2621
|
width: number;
|
|
2572
2622
|
height: number;
|
|
2623
|
+
rx: number;
|
|
2624
|
+
ry: number;
|
|
2573
2625
|
cornerRadius: number;
|
|
2574
2626
|
cornerShape: CornerShapeValue;
|
|
2575
2627
|
cornerMode: 'uniform' | 'non-uniform';
|
|
@@ -2589,8 +2641,8 @@ interface CircleNodeProps extends CommonNodeProps {
|
|
|
2589
2641
|
radius: number;
|
|
2590
2642
|
}
|
|
2591
2643
|
interface EllipseNodeProps extends CommonNodeProps {
|
|
2592
|
-
|
|
2593
|
-
|
|
2644
|
+
cx: number;
|
|
2645
|
+
cy: number;
|
|
2594
2646
|
rx: number;
|
|
2595
2647
|
ry: number;
|
|
2596
2648
|
}
|
|
@@ -2738,7 +2790,7 @@ interface SymbolInstanceNodeProps extends CommonNodeProps {
|
|
|
2738
2790
|
height: number;
|
|
2739
2791
|
symbolId: string;
|
|
2740
2792
|
}
|
|
2741
|
-
interface GroupNodeProps {
|
|
2793
|
+
interface GroupNodeProps extends CommonNodeProps {
|
|
2742
2794
|
groupId: string | null;
|
|
2743
2795
|
}
|
|
2744
2796
|
type DocumentNodeProps = Record<string, never>;
|
|
@@ -3502,6 +3554,7 @@ declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
|
3502
3554
|
* - `<animate>` for numeric and color properties
|
|
3503
3555
|
* - `<animateTransform>` for rotation, skewX, skewY
|
|
3504
3556
|
* - `<animateMotion>` for path-based motion
|
|
3557
|
+
* - `<discard>` for remove-at-time tracks
|
|
3505
3558
|
*
|
|
3506
3559
|
* The output is a map from shape ID → array of SVG element strings
|
|
3507
3560
|
* so the main renderer can inject them as children of each shape element.
|
|
@@ -4236,6 +4289,8 @@ declare class Rectangle extends ShapeBuilder<Rectangle> {
|
|
|
4236
4289
|
size(width: number, height: number): Rectangle;
|
|
4237
4290
|
/** Set the corner radius for rounded rectangles. */
|
|
4238
4291
|
cornerRadius(r: number): Rectangle;
|
|
4292
|
+
/** Set independent SVG rect corner radii. */
|
|
4293
|
+
radii(rx: number, ry: number): Rectangle;
|
|
4239
4294
|
}
|
|
4240
4295
|
declare class Square extends ShapeBuilder<Square> {
|
|
4241
4296
|
constructor(x: number, y: number, size: number);
|
|
@@ -4243,6 +4298,8 @@ declare class Square extends ShapeBuilder<Square> {
|
|
|
4243
4298
|
size(value: number): Square;
|
|
4244
4299
|
/** Set the corner radius for rounded squares. */
|
|
4245
4300
|
cornerRadius(r: number): Square;
|
|
4301
|
+
/** Set independent SVG rect corner radii. */
|
|
4302
|
+
radii(rx: number, ry: number): Square;
|
|
4246
4303
|
}
|
|
4247
4304
|
declare class Line extends ShapeBuilder<Line> {
|
|
4248
4305
|
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
@@ -5247,4 +5304,74 @@ declare class Document {
|
|
|
5247
5304
|
private _ensureMetadata;
|
|
5248
5305
|
}
|
|
5249
5306
|
|
|
5250
|
-
|
|
5307
|
+
/**
|
|
5308
|
+
* Pure jigsaw-puzzle piece geometry.
|
|
5309
|
+
*
|
|
5310
|
+
* The classic / curved styles use the algorithm from Draradech's canonical
|
|
5311
|
+
* generator (https://gist.github.com/Draradech/35d36347312ca6d0887aa7d55f366e30):
|
|
5312
|
+
* each edge between adjacent pieces is drawn as three consecutive cubic
|
|
5313
|
+
* Bezier curves through ten control points, producing the rounded "bulb"
|
|
5314
|
+
* tab silhouette.
|
|
5315
|
+
*
|
|
5316
|
+
* Adjacent pieces reference the *same* precomputed edge — one piece
|
|
5317
|
+
* traverses it forward, the other reversed — so the union of pieces tiles
|
|
5318
|
+
* the bounds exactly.
|
|
5319
|
+
*
|
|
5320
|
+
* No DOM, no Canvas — safe to import from the CLI, the editor, or tests.
|
|
5321
|
+
*/
|
|
5322
|
+
/** Axis-aligned bounding box in user units. */
|
|
5323
|
+
interface PuzzleBounds {
|
|
5324
|
+
x: number;
|
|
5325
|
+
y: number;
|
|
5326
|
+
width: number;
|
|
5327
|
+
height: number;
|
|
5328
|
+
}
|
|
5329
|
+
type PuzzleStyle = 'classic' | 'curved' | 'square-tabs' | 'slice';
|
|
5330
|
+
type PuzzleTabPattern = 'random' | 'alternating';
|
|
5331
|
+
interface PuzzleOptions {
|
|
5332
|
+
/** Number of rows (>= 1). */
|
|
5333
|
+
rows: number;
|
|
5334
|
+
/** Number of columns (>= 1). */
|
|
5335
|
+
cols: number;
|
|
5336
|
+
/** Edge style. `'slice'` produces straight cuts (no tabs). */
|
|
5337
|
+
style: PuzzleStyle;
|
|
5338
|
+
/**
|
|
5339
|
+
* Tab depth as a percentage. For curve styles this drives Draradech's
|
|
5340
|
+
* `t = tabDepthPercent / 200`; the bulb extends `3t` of the piece's
|
|
5341
|
+
* perpendicular dimension beyond the boundary line.
|
|
5342
|
+
*/
|
|
5343
|
+
tabDepthPercent: number;
|
|
5344
|
+
/** Whether tab orientations are random or strictly alternating. */
|
|
5345
|
+
tabPattern: PuzzleTabPattern;
|
|
5346
|
+
/** Deterministic seed so the same options produce the same output. */
|
|
5347
|
+
seed: number;
|
|
5348
|
+
}
|
|
5349
|
+
interface PuzzlePiece {
|
|
5350
|
+
/** Stable id derived from row/col/seed. */
|
|
5351
|
+
id: string;
|
|
5352
|
+
row: number;
|
|
5353
|
+
col: number;
|
|
5354
|
+
/** SVG path data, closed (`Z`). Coordinates are in the same space as `bounds`. */
|
|
5355
|
+
d: string;
|
|
5356
|
+
}
|
|
5357
|
+
declare const PUZZLE_DEFAULTS: PuzzleOptions;
|
|
5358
|
+
/**
|
|
5359
|
+
* Produce `rows × cols` puzzle pieces tiling the given bounds.
|
|
5360
|
+
*
|
|
5361
|
+
* Each interior edge between adjacent pieces is computed once and shared:
|
|
5362
|
+
* piece A traverses it forward, piece B reverses the same control-point
|
|
5363
|
+
* sequence. So the union of all pieces equals the bounds with no gaps or
|
|
5364
|
+
* overlaps (within float epsilon).
|
|
5365
|
+
*
|
|
5366
|
+
* @example
|
|
5367
|
+
* ```ts
|
|
5368
|
+
* const pieces = generatePuzzlePieces(
|
|
5369
|
+
* { x: 0, y: 0, width: 400, height: 300 },
|
|
5370
|
+
* { ...PUZZLE_DEFAULTS, rows: 3, cols: 4, seed: 42 }
|
|
5371
|
+
* );
|
|
5372
|
+
* pieces.length === 12;
|
|
5373
|
+
* ```
|
|
5374
|
+
*/
|
|
5375
|
+
declare function generatePuzzlePieces(bounds: PuzzleBounds, options?: Partial<PuzzleOptions>): PuzzlePiece[];
|
|
5376
|
+
|
|
5377
|
+
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, Audio, BUILTIN_MARKER_ID_MAP, type BaseFilter, type BaseFilterPrimitive, type BlackAndWhiteFilter, type BlurQuality, type BrightnessFilter, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, Cloud, type CodeFormat, type CodegenOptions, type CommonNodeProps, type ConnectionDirection, type ConnectionPoint, Container, ContainerShapeBuilder, 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, Heart, type HistorySnapshot, type HueRotateFilter, Hyperlink, 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, Lightning, 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, NestedSvg, type NodeTypePropsMap, type NoiseFilter, type OpacityFilter, type OutlineFilter, type OutlinePosition, PUZZLE_DEFAULTS, 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 PuzzleBounds, type PuzzleOptions, type PuzzlePiece, type PuzzleStyle, type PuzzleTabPattern, 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 SerializedColorGlyph, type SerializedColorGlyphLibrary, type SerializedGroup, type SerializedMarkerDef, type SerializedShape, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, ShapeReference, type SharpenFilter, type SpecularLightingFilter, SpeechBubble, Spiral, type SpiralNodeProps, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type SvgPrimitiveChainFilter, Switch, 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, Video, View, 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, generatePuzzlePieces, 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 };
|