@svgsketch/core 1.2.0 → 1.4.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 +150 -4
- package/dist/index.d.ts +150 -4
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -607,6 +607,12 @@ interface RichTextSegmentStyle {
|
|
|
607
607
|
fontFamily?: string;
|
|
608
608
|
fontWeight?: string;
|
|
609
609
|
fontStyle?: string;
|
|
610
|
+
fontVariant?: string;
|
|
611
|
+
fontVariantLigatures?: string;
|
|
612
|
+
fontVariantPosition?: string;
|
|
613
|
+
fontVariantCaps?: string;
|
|
614
|
+
fontVariantNumeric?: string;
|
|
615
|
+
fontVariantEastAsian?: string;
|
|
610
616
|
textDecoration?: {
|
|
611
617
|
underline?: boolean;
|
|
612
618
|
strikethrough?: boolean;
|
|
@@ -1562,6 +1568,12 @@ interface SerializedShape {
|
|
|
1562
1568
|
fontFamily?: string;
|
|
1563
1569
|
fontWeight?: string;
|
|
1564
1570
|
fontStyle?: string;
|
|
1571
|
+
fontVariant?: string;
|
|
1572
|
+
fontVariantLigatures?: string;
|
|
1573
|
+
fontVariantPosition?: string;
|
|
1574
|
+
fontVariantCaps?: string;
|
|
1575
|
+
fontVariantNumeric?: string;
|
|
1576
|
+
fontVariantEastAsian?: string;
|
|
1565
1577
|
textDecoration?: {
|
|
1566
1578
|
underline?: boolean;
|
|
1567
1579
|
strikethrough?: boolean;
|
|
@@ -1622,6 +1634,8 @@ interface SerializedShape {
|
|
|
1622
1634
|
richTextData?: RichTextData;
|
|
1623
1635
|
scaleX?: number;
|
|
1624
1636
|
scaleY?: number;
|
|
1637
|
+
translateX?: number;
|
|
1638
|
+
translateY?: number;
|
|
1625
1639
|
textX?: number;
|
|
1626
1640
|
textY?: number;
|
|
1627
1641
|
scaleAnchor?: Point | null;
|
|
@@ -1881,6 +1895,7 @@ interface SerializedShape {
|
|
|
1881
1895
|
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1882
1896
|
textPathLength?: number;
|
|
1883
1897
|
textPathLengthUnit?: '%' | 'user';
|
|
1898
|
+
textPathPathLength?: number;
|
|
1884
1899
|
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1885
1900
|
textPathRefShapeId?: string;
|
|
1886
1901
|
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
@@ -2574,6 +2589,8 @@ interface CommonNodeProps {
|
|
|
2574
2589
|
opacity: number;
|
|
2575
2590
|
fillOpacity: number;
|
|
2576
2591
|
strokeOpacity: number;
|
|
2592
|
+
translateX: number;
|
|
2593
|
+
translateY: number;
|
|
2577
2594
|
rotation: number;
|
|
2578
2595
|
skewX: number;
|
|
2579
2596
|
skewY: number;
|
|
@@ -2615,6 +2632,8 @@ interface RectangleNodeProps extends CommonNodeProps {
|
|
|
2615
2632
|
y: number;
|
|
2616
2633
|
width: number;
|
|
2617
2634
|
height: number;
|
|
2635
|
+
rx: number;
|
|
2636
|
+
ry: number;
|
|
2618
2637
|
cornerRadius: number;
|
|
2619
2638
|
cornerShape: CornerShapeValue;
|
|
2620
2639
|
cornerMode: 'uniform' | 'non-uniform';
|
|
@@ -2634,8 +2653,8 @@ interface CircleNodeProps extends CommonNodeProps {
|
|
|
2634
2653
|
radius: number;
|
|
2635
2654
|
}
|
|
2636
2655
|
interface EllipseNodeProps extends CommonNodeProps {
|
|
2637
|
-
|
|
2638
|
-
|
|
2656
|
+
cx: number;
|
|
2657
|
+
cy: number;
|
|
2639
2658
|
rx: number;
|
|
2640
2659
|
ry: number;
|
|
2641
2660
|
}
|
|
@@ -2660,6 +2679,12 @@ interface TextNodeProps extends CommonNodeProps {
|
|
|
2660
2679
|
fontFamily: string;
|
|
2661
2680
|
fontWeight: string;
|
|
2662
2681
|
fontStyle: string;
|
|
2682
|
+
fontVariant: string;
|
|
2683
|
+
fontVariantLigatures: string;
|
|
2684
|
+
fontVariantPosition: string;
|
|
2685
|
+
fontVariantCaps: string;
|
|
2686
|
+
fontVariantNumeric: string;
|
|
2687
|
+
fontVariantEastAsian: string;
|
|
2663
2688
|
textDecoration: Record<string, boolean>;
|
|
2664
2689
|
textTransform: string;
|
|
2665
2690
|
baselineShift: string;
|
|
@@ -2783,7 +2808,7 @@ interface SymbolInstanceNodeProps extends CommonNodeProps {
|
|
|
2783
2808
|
height: number;
|
|
2784
2809
|
symbolId: string;
|
|
2785
2810
|
}
|
|
2786
|
-
interface GroupNodeProps {
|
|
2811
|
+
interface GroupNodeProps extends CommonNodeProps {
|
|
2787
2812
|
groupId: string | null;
|
|
2788
2813
|
}
|
|
2789
2814
|
type DocumentNodeProps = Record<string, never>;
|
|
@@ -3547,6 +3572,7 @@ declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
|
3547
3572
|
* - `<animate>` for numeric and color properties
|
|
3548
3573
|
* - `<animateTransform>` for rotation, skewX, skewY
|
|
3549
3574
|
* - `<animateMotion>` for path-based motion
|
|
3575
|
+
* - `<discard>` for remove-at-time tracks
|
|
3550
3576
|
*
|
|
3551
3577
|
* The output is a map from shape ID → array of SVG element strings
|
|
3552
3578
|
* so the main renderer can inject them as children of each shape element.
|
|
@@ -4281,6 +4307,8 @@ declare class Rectangle extends ShapeBuilder<Rectangle> {
|
|
|
4281
4307
|
size(width: number, height: number): Rectangle;
|
|
4282
4308
|
/** Set the corner radius for rounded rectangles. */
|
|
4283
4309
|
cornerRadius(r: number): Rectangle;
|
|
4310
|
+
/** Set independent SVG rect corner radii. */
|
|
4311
|
+
radii(rx: number, ry: number): Rectangle;
|
|
4284
4312
|
}
|
|
4285
4313
|
declare class Square extends ShapeBuilder<Square> {
|
|
4286
4314
|
constructor(x: number, y: number, size: number);
|
|
@@ -4288,6 +4316,8 @@ declare class Square extends ShapeBuilder<Square> {
|
|
|
4288
4316
|
size(value: number): Square;
|
|
4289
4317
|
/** Set the corner radius for rounded squares. */
|
|
4290
4318
|
cornerRadius(r: number): Square;
|
|
4319
|
+
/** Set independent SVG rect corner radii. */
|
|
4320
|
+
radii(rx: number, ry: number): Square;
|
|
4291
4321
|
}
|
|
4292
4322
|
declare class Line extends ShapeBuilder<Line> {
|
|
4293
4323
|
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
@@ -4314,6 +4344,18 @@ declare class Text extends ShapeBuilder<Text> {
|
|
|
4314
4344
|
fontWeight(weight: FontWeight): Text;
|
|
4315
4345
|
/** Set the font style (italic, normal, etc). */
|
|
4316
4346
|
fontStyle(style: FontStyle): Text;
|
|
4347
|
+
/** Set the CSS Fonts 3 `font-variant` shorthand. */
|
|
4348
|
+
fontVariant(value: string): Text;
|
|
4349
|
+
/** Set CSS `font-variant-ligatures`. */
|
|
4350
|
+
fontVariantLigatures(value: string): Text;
|
|
4351
|
+
/** Set CSS `font-variant-position`. */
|
|
4352
|
+
fontVariantPosition(value: string): Text;
|
|
4353
|
+
/** Set CSS `font-variant-caps`. */
|
|
4354
|
+
fontVariantCaps(value: string): Text;
|
|
4355
|
+
/** Set CSS `font-variant-numeric`. */
|
|
4356
|
+
fontVariantNumeric(value: string): Text;
|
|
4357
|
+
/** Set CSS `font-variant-east-asian`. */
|
|
4358
|
+
fontVariantEastAsian(value: string): Text;
|
|
4317
4359
|
/** Set the text anchor (start, middle, end). */
|
|
4318
4360
|
anchor(value: 'start' | 'middle' | 'end'): Text;
|
|
4319
4361
|
/** Set letter spacing. */
|
|
@@ -5292,4 +5334,108 @@ declare class Document {
|
|
|
5292
5334
|
private _ensureMetadata;
|
|
5293
5335
|
}
|
|
5294
5336
|
|
|
5295
|
-
|
|
5337
|
+
/**
|
|
5338
|
+
* Pure jigsaw-puzzle piece geometry.
|
|
5339
|
+
*
|
|
5340
|
+
* The classic / curved styles use the algorithm from Draradech's canonical
|
|
5341
|
+
* generator (https://gist.github.com/Draradech/35d36347312ca6d0887aa7d55f366e30):
|
|
5342
|
+
* each edge between adjacent pieces is drawn as three consecutive cubic
|
|
5343
|
+
* Bezier curves through ten control points, producing the rounded "bulb"
|
|
5344
|
+
* tab silhouette.
|
|
5345
|
+
*
|
|
5346
|
+
* Adjacent pieces reference the *same* precomputed edge — one piece
|
|
5347
|
+
* traverses it forward, the other reversed — so the union of pieces tiles
|
|
5348
|
+
* the bounds exactly.
|
|
5349
|
+
*
|
|
5350
|
+
* No DOM, no Canvas — safe to import from the CLI, the editor, or tests.
|
|
5351
|
+
*/
|
|
5352
|
+
/** Axis-aligned bounding box in user units. */
|
|
5353
|
+
interface PuzzleBounds {
|
|
5354
|
+
x: number;
|
|
5355
|
+
y: number;
|
|
5356
|
+
width: number;
|
|
5357
|
+
height: number;
|
|
5358
|
+
}
|
|
5359
|
+
type PuzzleStyle = 'classic' | 'curved' | 'square-tabs' | 'slice';
|
|
5360
|
+
type PuzzleTabPattern = 'random' | 'alternating';
|
|
5361
|
+
interface PuzzleOptions {
|
|
5362
|
+
/** Number of rows (>= 1). */
|
|
5363
|
+
rows: number;
|
|
5364
|
+
/** Number of columns (>= 1). */
|
|
5365
|
+
cols: number;
|
|
5366
|
+
/** Edge style. `'slice'` produces straight cuts (no tabs). */
|
|
5367
|
+
style: PuzzleStyle;
|
|
5368
|
+
/**
|
|
5369
|
+
* Tab depth as a percentage. For curve styles this drives Draradech's
|
|
5370
|
+
* `t = tabDepthPercent / 200`; the bulb extends `3t` of the piece's
|
|
5371
|
+
* perpendicular dimension beyond the boundary line.
|
|
5372
|
+
*/
|
|
5373
|
+
tabDepthPercent: number;
|
|
5374
|
+
/** Whether tab orientations are random or strictly alternating. */
|
|
5375
|
+
tabPattern: PuzzleTabPattern;
|
|
5376
|
+
/** Deterministic seed so the same options produce the same output. */
|
|
5377
|
+
seed: number;
|
|
5378
|
+
}
|
|
5379
|
+
interface PuzzlePiece {
|
|
5380
|
+
/** Stable id derived from row/col/seed. */
|
|
5381
|
+
id: string;
|
|
5382
|
+
row: number;
|
|
5383
|
+
col: number;
|
|
5384
|
+
/** SVG path data, closed (`Z`). Coordinates are in the same space as `bounds`. */
|
|
5385
|
+
d: string;
|
|
5386
|
+
}
|
|
5387
|
+
declare const PUZZLE_DEFAULTS: PuzzleOptions;
|
|
5388
|
+
/**
|
|
5389
|
+
* Produce `rows × cols` puzzle pieces tiling the given bounds.
|
|
5390
|
+
*
|
|
5391
|
+
* Each interior edge between adjacent pieces is computed once and shared:
|
|
5392
|
+
* piece A traverses it forward, piece B reverses the same control-point
|
|
5393
|
+
* sequence. So the union of all pieces equals the bounds with no gaps or
|
|
5394
|
+
* overlaps (within float epsilon).
|
|
5395
|
+
*
|
|
5396
|
+
* @example
|
|
5397
|
+
* ```ts
|
|
5398
|
+
* const pieces = generatePuzzlePieces(
|
|
5399
|
+
* { x: 0, y: 0, width: 400, height: 300 },
|
|
5400
|
+
* { ...PUZZLE_DEFAULTS, rows: 3, cols: 4, seed: 42 }
|
|
5401
|
+
* );
|
|
5402
|
+
* pieces.length === 12;
|
|
5403
|
+
* ```
|
|
5404
|
+
*/
|
|
5405
|
+
declare function generatePuzzlePieces(bounds: PuzzleBounds, options?: Partial<PuzzleOptions>): PuzzlePiece[];
|
|
5406
|
+
|
|
5407
|
+
/**
|
|
5408
|
+
* Pure Sudoku generation, solving, and validation.
|
|
5409
|
+
*
|
|
5410
|
+
* The editor plugin imports this module through @svgsketch/core so puzzle
|
|
5411
|
+
* generation stays deterministic and testable outside the DOM.
|
|
5412
|
+
*/
|
|
5413
|
+
type SudokuDifficulty = 'easy' | 'medium' | 'hard' | 'expert';
|
|
5414
|
+
type SudokuGrid = number[][];
|
|
5415
|
+
type SudokuRating = 'singles' | 'hidden-singles' | 'search';
|
|
5416
|
+
interface GenerateSudokuOptions {
|
|
5417
|
+
difficulty: SudokuDifficulty;
|
|
5418
|
+
seed: number;
|
|
5419
|
+
}
|
|
5420
|
+
interface GeneratedSudokuPuzzle {
|
|
5421
|
+
puzzle: SudokuGrid;
|
|
5422
|
+
solution: SudokuGrid;
|
|
5423
|
+
difficulty: SudokuDifficulty;
|
|
5424
|
+
seed: number;
|
|
5425
|
+
givens: number;
|
|
5426
|
+
rating: SudokuRating;
|
|
5427
|
+
}
|
|
5428
|
+
interface SudokuValidationResult {
|
|
5429
|
+
valid: boolean;
|
|
5430
|
+
unique: boolean;
|
|
5431
|
+
solution: SudokuGrid | null;
|
|
5432
|
+
errors: string[];
|
|
5433
|
+
}
|
|
5434
|
+
interface SolveSudokuOptions {
|
|
5435
|
+
maxSolutions?: number;
|
|
5436
|
+
}
|
|
5437
|
+
declare function solveSudoku(grid: SudokuGrid, options?: SolveSudokuOptions): SudokuGrid[];
|
|
5438
|
+
declare function validateSudokuPuzzle(grid: SudokuGrid): SudokuValidationResult;
|
|
5439
|
+
declare function generateSudokuPuzzle(options: GenerateSudokuOptions): GeneratedSudokuPuzzle;
|
|
5440
|
+
|
|
5441
|
+
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 GenerateSudokuOptions, type GeneratedSudokuPuzzle, 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 SolveSudokuOptions, type SpecularLightingFilter, SpeechBubble, Spiral, type SpiralNodeProps, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type SudokuDifficulty, type SudokuGrid, type SudokuRating, type SudokuValidationResult, 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, generateSudokuPuzzle, 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, solveSudoku, stringifyDocument, substituteString, substituteVariables, validateSnapshot, validateSudokuPuzzle, verticesToPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -607,6 +607,12 @@ interface RichTextSegmentStyle {
|
|
|
607
607
|
fontFamily?: string;
|
|
608
608
|
fontWeight?: string;
|
|
609
609
|
fontStyle?: string;
|
|
610
|
+
fontVariant?: string;
|
|
611
|
+
fontVariantLigatures?: string;
|
|
612
|
+
fontVariantPosition?: string;
|
|
613
|
+
fontVariantCaps?: string;
|
|
614
|
+
fontVariantNumeric?: string;
|
|
615
|
+
fontVariantEastAsian?: string;
|
|
610
616
|
textDecoration?: {
|
|
611
617
|
underline?: boolean;
|
|
612
618
|
strikethrough?: boolean;
|
|
@@ -1562,6 +1568,12 @@ interface SerializedShape {
|
|
|
1562
1568
|
fontFamily?: string;
|
|
1563
1569
|
fontWeight?: string;
|
|
1564
1570
|
fontStyle?: string;
|
|
1571
|
+
fontVariant?: string;
|
|
1572
|
+
fontVariantLigatures?: string;
|
|
1573
|
+
fontVariantPosition?: string;
|
|
1574
|
+
fontVariantCaps?: string;
|
|
1575
|
+
fontVariantNumeric?: string;
|
|
1576
|
+
fontVariantEastAsian?: string;
|
|
1565
1577
|
textDecoration?: {
|
|
1566
1578
|
underline?: boolean;
|
|
1567
1579
|
strikethrough?: boolean;
|
|
@@ -1622,6 +1634,8 @@ interface SerializedShape {
|
|
|
1622
1634
|
richTextData?: RichTextData;
|
|
1623
1635
|
scaleX?: number;
|
|
1624
1636
|
scaleY?: number;
|
|
1637
|
+
translateX?: number;
|
|
1638
|
+
translateY?: number;
|
|
1625
1639
|
textX?: number;
|
|
1626
1640
|
textY?: number;
|
|
1627
1641
|
scaleAnchor?: Point | null;
|
|
@@ -1881,6 +1895,7 @@ interface SerializedShape {
|
|
|
1881
1895
|
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1882
1896
|
textPathLength?: number;
|
|
1883
1897
|
textPathLengthUnit?: '%' | 'user';
|
|
1898
|
+
textPathPathLength?: number;
|
|
1884
1899
|
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1885
1900
|
textPathRefShapeId?: string;
|
|
1886
1901
|
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
@@ -2574,6 +2589,8 @@ interface CommonNodeProps {
|
|
|
2574
2589
|
opacity: number;
|
|
2575
2590
|
fillOpacity: number;
|
|
2576
2591
|
strokeOpacity: number;
|
|
2592
|
+
translateX: number;
|
|
2593
|
+
translateY: number;
|
|
2577
2594
|
rotation: number;
|
|
2578
2595
|
skewX: number;
|
|
2579
2596
|
skewY: number;
|
|
@@ -2615,6 +2632,8 @@ interface RectangleNodeProps extends CommonNodeProps {
|
|
|
2615
2632
|
y: number;
|
|
2616
2633
|
width: number;
|
|
2617
2634
|
height: number;
|
|
2635
|
+
rx: number;
|
|
2636
|
+
ry: number;
|
|
2618
2637
|
cornerRadius: number;
|
|
2619
2638
|
cornerShape: CornerShapeValue;
|
|
2620
2639
|
cornerMode: 'uniform' | 'non-uniform';
|
|
@@ -2634,8 +2653,8 @@ interface CircleNodeProps extends CommonNodeProps {
|
|
|
2634
2653
|
radius: number;
|
|
2635
2654
|
}
|
|
2636
2655
|
interface EllipseNodeProps extends CommonNodeProps {
|
|
2637
|
-
|
|
2638
|
-
|
|
2656
|
+
cx: number;
|
|
2657
|
+
cy: number;
|
|
2639
2658
|
rx: number;
|
|
2640
2659
|
ry: number;
|
|
2641
2660
|
}
|
|
@@ -2660,6 +2679,12 @@ interface TextNodeProps extends CommonNodeProps {
|
|
|
2660
2679
|
fontFamily: string;
|
|
2661
2680
|
fontWeight: string;
|
|
2662
2681
|
fontStyle: string;
|
|
2682
|
+
fontVariant: string;
|
|
2683
|
+
fontVariantLigatures: string;
|
|
2684
|
+
fontVariantPosition: string;
|
|
2685
|
+
fontVariantCaps: string;
|
|
2686
|
+
fontVariantNumeric: string;
|
|
2687
|
+
fontVariantEastAsian: string;
|
|
2663
2688
|
textDecoration: Record<string, boolean>;
|
|
2664
2689
|
textTransform: string;
|
|
2665
2690
|
baselineShift: string;
|
|
@@ -2783,7 +2808,7 @@ interface SymbolInstanceNodeProps extends CommonNodeProps {
|
|
|
2783
2808
|
height: number;
|
|
2784
2809
|
symbolId: string;
|
|
2785
2810
|
}
|
|
2786
|
-
interface GroupNodeProps {
|
|
2811
|
+
interface GroupNodeProps extends CommonNodeProps {
|
|
2787
2812
|
groupId: string | null;
|
|
2788
2813
|
}
|
|
2789
2814
|
type DocumentNodeProps = Record<string, never>;
|
|
@@ -3547,6 +3572,7 @@ declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
|
3547
3572
|
* - `<animate>` for numeric and color properties
|
|
3548
3573
|
* - `<animateTransform>` for rotation, skewX, skewY
|
|
3549
3574
|
* - `<animateMotion>` for path-based motion
|
|
3575
|
+
* - `<discard>` for remove-at-time tracks
|
|
3550
3576
|
*
|
|
3551
3577
|
* The output is a map from shape ID → array of SVG element strings
|
|
3552
3578
|
* so the main renderer can inject them as children of each shape element.
|
|
@@ -4281,6 +4307,8 @@ declare class Rectangle extends ShapeBuilder<Rectangle> {
|
|
|
4281
4307
|
size(width: number, height: number): Rectangle;
|
|
4282
4308
|
/** Set the corner radius for rounded rectangles. */
|
|
4283
4309
|
cornerRadius(r: number): Rectangle;
|
|
4310
|
+
/** Set independent SVG rect corner radii. */
|
|
4311
|
+
radii(rx: number, ry: number): Rectangle;
|
|
4284
4312
|
}
|
|
4285
4313
|
declare class Square extends ShapeBuilder<Square> {
|
|
4286
4314
|
constructor(x: number, y: number, size: number);
|
|
@@ -4288,6 +4316,8 @@ declare class Square extends ShapeBuilder<Square> {
|
|
|
4288
4316
|
size(value: number): Square;
|
|
4289
4317
|
/** Set the corner radius for rounded squares. */
|
|
4290
4318
|
cornerRadius(r: number): Square;
|
|
4319
|
+
/** Set independent SVG rect corner radii. */
|
|
4320
|
+
radii(rx: number, ry: number): Square;
|
|
4291
4321
|
}
|
|
4292
4322
|
declare class Line extends ShapeBuilder<Line> {
|
|
4293
4323
|
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
@@ -4314,6 +4344,18 @@ declare class Text extends ShapeBuilder<Text> {
|
|
|
4314
4344
|
fontWeight(weight: FontWeight): Text;
|
|
4315
4345
|
/** Set the font style (italic, normal, etc). */
|
|
4316
4346
|
fontStyle(style: FontStyle): Text;
|
|
4347
|
+
/** Set the CSS Fonts 3 `font-variant` shorthand. */
|
|
4348
|
+
fontVariant(value: string): Text;
|
|
4349
|
+
/** Set CSS `font-variant-ligatures`. */
|
|
4350
|
+
fontVariantLigatures(value: string): Text;
|
|
4351
|
+
/** Set CSS `font-variant-position`. */
|
|
4352
|
+
fontVariantPosition(value: string): Text;
|
|
4353
|
+
/** Set CSS `font-variant-caps`. */
|
|
4354
|
+
fontVariantCaps(value: string): Text;
|
|
4355
|
+
/** Set CSS `font-variant-numeric`. */
|
|
4356
|
+
fontVariantNumeric(value: string): Text;
|
|
4357
|
+
/** Set CSS `font-variant-east-asian`. */
|
|
4358
|
+
fontVariantEastAsian(value: string): Text;
|
|
4317
4359
|
/** Set the text anchor (start, middle, end). */
|
|
4318
4360
|
anchor(value: 'start' | 'middle' | 'end'): Text;
|
|
4319
4361
|
/** Set letter spacing. */
|
|
@@ -5292,4 +5334,108 @@ declare class Document {
|
|
|
5292
5334
|
private _ensureMetadata;
|
|
5293
5335
|
}
|
|
5294
5336
|
|
|
5295
|
-
|
|
5337
|
+
/**
|
|
5338
|
+
* Pure jigsaw-puzzle piece geometry.
|
|
5339
|
+
*
|
|
5340
|
+
* The classic / curved styles use the algorithm from Draradech's canonical
|
|
5341
|
+
* generator (https://gist.github.com/Draradech/35d36347312ca6d0887aa7d55f366e30):
|
|
5342
|
+
* each edge between adjacent pieces is drawn as three consecutive cubic
|
|
5343
|
+
* Bezier curves through ten control points, producing the rounded "bulb"
|
|
5344
|
+
* tab silhouette.
|
|
5345
|
+
*
|
|
5346
|
+
* Adjacent pieces reference the *same* precomputed edge — one piece
|
|
5347
|
+
* traverses it forward, the other reversed — so the union of pieces tiles
|
|
5348
|
+
* the bounds exactly.
|
|
5349
|
+
*
|
|
5350
|
+
* No DOM, no Canvas — safe to import from the CLI, the editor, or tests.
|
|
5351
|
+
*/
|
|
5352
|
+
/** Axis-aligned bounding box in user units. */
|
|
5353
|
+
interface PuzzleBounds {
|
|
5354
|
+
x: number;
|
|
5355
|
+
y: number;
|
|
5356
|
+
width: number;
|
|
5357
|
+
height: number;
|
|
5358
|
+
}
|
|
5359
|
+
type PuzzleStyle = 'classic' | 'curved' | 'square-tabs' | 'slice';
|
|
5360
|
+
type PuzzleTabPattern = 'random' | 'alternating';
|
|
5361
|
+
interface PuzzleOptions {
|
|
5362
|
+
/** Number of rows (>= 1). */
|
|
5363
|
+
rows: number;
|
|
5364
|
+
/** Number of columns (>= 1). */
|
|
5365
|
+
cols: number;
|
|
5366
|
+
/** Edge style. `'slice'` produces straight cuts (no tabs). */
|
|
5367
|
+
style: PuzzleStyle;
|
|
5368
|
+
/**
|
|
5369
|
+
* Tab depth as a percentage. For curve styles this drives Draradech's
|
|
5370
|
+
* `t = tabDepthPercent / 200`; the bulb extends `3t` of the piece's
|
|
5371
|
+
* perpendicular dimension beyond the boundary line.
|
|
5372
|
+
*/
|
|
5373
|
+
tabDepthPercent: number;
|
|
5374
|
+
/** Whether tab orientations are random or strictly alternating. */
|
|
5375
|
+
tabPattern: PuzzleTabPattern;
|
|
5376
|
+
/** Deterministic seed so the same options produce the same output. */
|
|
5377
|
+
seed: number;
|
|
5378
|
+
}
|
|
5379
|
+
interface PuzzlePiece {
|
|
5380
|
+
/** Stable id derived from row/col/seed. */
|
|
5381
|
+
id: string;
|
|
5382
|
+
row: number;
|
|
5383
|
+
col: number;
|
|
5384
|
+
/** SVG path data, closed (`Z`). Coordinates are in the same space as `bounds`. */
|
|
5385
|
+
d: string;
|
|
5386
|
+
}
|
|
5387
|
+
declare const PUZZLE_DEFAULTS: PuzzleOptions;
|
|
5388
|
+
/**
|
|
5389
|
+
* Produce `rows × cols` puzzle pieces tiling the given bounds.
|
|
5390
|
+
*
|
|
5391
|
+
* Each interior edge between adjacent pieces is computed once and shared:
|
|
5392
|
+
* piece A traverses it forward, piece B reverses the same control-point
|
|
5393
|
+
* sequence. So the union of all pieces equals the bounds with no gaps or
|
|
5394
|
+
* overlaps (within float epsilon).
|
|
5395
|
+
*
|
|
5396
|
+
* @example
|
|
5397
|
+
* ```ts
|
|
5398
|
+
* const pieces = generatePuzzlePieces(
|
|
5399
|
+
* { x: 0, y: 0, width: 400, height: 300 },
|
|
5400
|
+
* { ...PUZZLE_DEFAULTS, rows: 3, cols: 4, seed: 42 }
|
|
5401
|
+
* );
|
|
5402
|
+
* pieces.length === 12;
|
|
5403
|
+
* ```
|
|
5404
|
+
*/
|
|
5405
|
+
declare function generatePuzzlePieces(bounds: PuzzleBounds, options?: Partial<PuzzleOptions>): PuzzlePiece[];
|
|
5406
|
+
|
|
5407
|
+
/**
|
|
5408
|
+
* Pure Sudoku generation, solving, and validation.
|
|
5409
|
+
*
|
|
5410
|
+
* The editor plugin imports this module through @svgsketch/core so puzzle
|
|
5411
|
+
* generation stays deterministic and testable outside the DOM.
|
|
5412
|
+
*/
|
|
5413
|
+
type SudokuDifficulty = 'easy' | 'medium' | 'hard' | 'expert';
|
|
5414
|
+
type SudokuGrid = number[][];
|
|
5415
|
+
type SudokuRating = 'singles' | 'hidden-singles' | 'search';
|
|
5416
|
+
interface GenerateSudokuOptions {
|
|
5417
|
+
difficulty: SudokuDifficulty;
|
|
5418
|
+
seed: number;
|
|
5419
|
+
}
|
|
5420
|
+
interface GeneratedSudokuPuzzle {
|
|
5421
|
+
puzzle: SudokuGrid;
|
|
5422
|
+
solution: SudokuGrid;
|
|
5423
|
+
difficulty: SudokuDifficulty;
|
|
5424
|
+
seed: number;
|
|
5425
|
+
givens: number;
|
|
5426
|
+
rating: SudokuRating;
|
|
5427
|
+
}
|
|
5428
|
+
interface SudokuValidationResult {
|
|
5429
|
+
valid: boolean;
|
|
5430
|
+
unique: boolean;
|
|
5431
|
+
solution: SudokuGrid | null;
|
|
5432
|
+
errors: string[];
|
|
5433
|
+
}
|
|
5434
|
+
interface SolveSudokuOptions {
|
|
5435
|
+
maxSolutions?: number;
|
|
5436
|
+
}
|
|
5437
|
+
declare function solveSudoku(grid: SudokuGrid, options?: SolveSudokuOptions): SudokuGrid[];
|
|
5438
|
+
declare function validateSudokuPuzzle(grid: SudokuGrid): SudokuValidationResult;
|
|
5439
|
+
declare function generateSudokuPuzzle(options: GenerateSudokuOptions): GeneratedSudokuPuzzle;
|
|
5440
|
+
|
|
5441
|
+
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 GenerateSudokuOptions, type GeneratedSudokuPuzzle, 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 SolveSudokuOptions, type SpecularLightingFilter, SpeechBubble, Spiral, type SpiralNodeProps, type SpotLightFilter, Square, type SquareNodeProps, Star, type StarNodeProps, type StepPosition, type StepsParams, type StringifyOptions, type StrokeType, type SudokuDifficulty, type SudokuGrid, type SudokuRating, type SudokuValidationResult, 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, generateSudokuPuzzle, 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, solveSudoku, stringifyDocument, substituteString, substituteVariables, validateSnapshot, validateSudokuPuzzle, verticesToPath };
|