@svgsketch/core 1.2.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 +86 -4
- package/dist/index.d.ts +86 -4
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1622,6 +1622,8 @@ interface SerializedShape {
|
|
|
1622
1622
|
richTextData?: RichTextData;
|
|
1623
1623
|
scaleX?: number;
|
|
1624
1624
|
scaleY?: number;
|
|
1625
|
+
translateX?: number;
|
|
1626
|
+
translateY?: number;
|
|
1625
1627
|
textX?: number;
|
|
1626
1628
|
textY?: number;
|
|
1627
1629
|
scaleAnchor?: Point | null;
|
|
@@ -1881,6 +1883,7 @@ interface SerializedShape {
|
|
|
1881
1883
|
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1882
1884
|
textPathLength?: number;
|
|
1883
1885
|
textPathLengthUnit?: '%' | 'user';
|
|
1886
|
+
textPathPathLength?: number;
|
|
1884
1887
|
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1885
1888
|
textPathRefShapeId?: string;
|
|
1886
1889
|
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
@@ -2574,6 +2577,8 @@ interface CommonNodeProps {
|
|
|
2574
2577
|
opacity: number;
|
|
2575
2578
|
fillOpacity: number;
|
|
2576
2579
|
strokeOpacity: number;
|
|
2580
|
+
translateX: number;
|
|
2581
|
+
translateY: number;
|
|
2577
2582
|
rotation: number;
|
|
2578
2583
|
skewX: number;
|
|
2579
2584
|
skewY: number;
|
|
@@ -2615,6 +2620,8 @@ interface RectangleNodeProps extends CommonNodeProps {
|
|
|
2615
2620
|
y: number;
|
|
2616
2621
|
width: number;
|
|
2617
2622
|
height: number;
|
|
2623
|
+
rx: number;
|
|
2624
|
+
ry: number;
|
|
2618
2625
|
cornerRadius: number;
|
|
2619
2626
|
cornerShape: CornerShapeValue;
|
|
2620
2627
|
cornerMode: 'uniform' | 'non-uniform';
|
|
@@ -2634,8 +2641,8 @@ interface CircleNodeProps extends CommonNodeProps {
|
|
|
2634
2641
|
radius: number;
|
|
2635
2642
|
}
|
|
2636
2643
|
interface EllipseNodeProps extends CommonNodeProps {
|
|
2637
|
-
|
|
2638
|
-
|
|
2644
|
+
cx: number;
|
|
2645
|
+
cy: number;
|
|
2639
2646
|
rx: number;
|
|
2640
2647
|
ry: number;
|
|
2641
2648
|
}
|
|
@@ -2783,7 +2790,7 @@ interface SymbolInstanceNodeProps extends CommonNodeProps {
|
|
|
2783
2790
|
height: number;
|
|
2784
2791
|
symbolId: string;
|
|
2785
2792
|
}
|
|
2786
|
-
interface GroupNodeProps {
|
|
2793
|
+
interface GroupNodeProps extends CommonNodeProps {
|
|
2787
2794
|
groupId: string | null;
|
|
2788
2795
|
}
|
|
2789
2796
|
type DocumentNodeProps = Record<string, never>;
|
|
@@ -3547,6 +3554,7 @@ declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
|
3547
3554
|
* - `<animate>` for numeric and color properties
|
|
3548
3555
|
* - `<animateTransform>` for rotation, skewX, skewY
|
|
3549
3556
|
* - `<animateMotion>` for path-based motion
|
|
3557
|
+
* - `<discard>` for remove-at-time tracks
|
|
3550
3558
|
*
|
|
3551
3559
|
* The output is a map from shape ID → array of SVG element strings
|
|
3552
3560
|
* so the main renderer can inject them as children of each shape element.
|
|
@@ -4281,6 +4289,8 @@ declare class Rectangle extends ShapeBuilder<Rectangle> {
|
|
|
4281
4289
|
size(width: number, height: number): Rectangle;
|
|
4282
4290
|
/** Set the corner radius for rounded rectangles. */
|
|
4283
4291
|
cornerRadius(r: number): Rectangle;
|
|
4292
|
+
/** Set independent SVG rect corner radii. */
|
|
4293
|
+
radii(rx: number, ry: number): Rectangle;
|
|
4284
4294
|
}
|
|
4285
4295
|
declare class Square extends ShapeBuilder<Square> {
|
|
4286
4296
|
constructor(x: number, y: number, size: number);
|
|
@@ -4288,6 +4298,8 @@ declare class Square extends ShapeBuilder<Square> {
|
|
|
4288
4298
|
size(value: number): Square;
|
|
4289
4299
|
/** Set the corner radius for rounded squares. */
|
|
4290
4300
|
cornerRadius(r: number): Square;
|
|
4301
|
+
/** Set independent SVG rect corner radii. */
|
|
4302
|
+
radii(rx: number, ry: number): Square;
|
|
4291
4303
|
}
|
|
4292
4304
|
declare class Line extends ShapeBuilder<Line> {
|
|
4293
4305
|
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
@@ -5292,4 +5304,74 @@ declare class Document {
|
|
|
5292
5304
|
private _ensureMetadata;
|
|
5293
5305
|
}
|
|
5294
5306
|
|
|
5295
|
-
|
|
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
|
@@ -1622,6 +1622,8 @@ interface SerializedShape {
|
|
|
1622
1622
|
richTextData?: RichTextData;
|
|
1623
1623
|
scaleX?: number;
|
|
1624
1624
|
scaleY?: number;
|
|
1625
|
+
translateX?: number;
|
|
1626
|
+
translateY?: number;
|
|
1625
1627
|
textX?: number;
|
|
1626
1628
|
textY?: number;
|
|
1627
1629
|
scaleAnchor?: Point | null;
|
|
@@ -1881,6 +1883,7 @@ interface SerializedShape {
|
|
|
1881
1883
|
textPathLengthAdjust?: 'spacing' | 'spacingAndGlyphs';
|
|
1882
1884
|
textPathLength?: number;
|
|
1883
1885
|
textPathLengthUnit?: '%' | 'user';
|
|
1886
|
+
textPathPathLength?: number;
|
|
1884
1887
|
textPathInlineFormat?: 'defs-path' | 'path-attr';
|
|
1885
1888
|
textPathRefShapeId?: string;
|
|
1886
1889
|
/** Transient: import-time href target id, resolved away by ImportExportManager. */
|
|
@@ -2574,6 +2577,8 @@ interface CommonNodeProps {
|
|
|
2574
2577
|
opacity: number;
|
|
2575
2578
|
fillOpacity: number;
|
|
2576
2579
|
strokeOpacity: number;
|
|
2580
|
+
translateX: number;
|
|
2581
|
+
translateY: number;
|
|
2577
2582
|
rotation: number;
|
|
2578
2583
|
skewX: number;
|
|
2579
2584
|
skewY: number;
|
|
@@ -2615,6 +2620,8 @@ interface RectangleNodeProps extends CommonNodeProps {
|
|
|
2615
2620
|
y: number;
|
|
2616
2621
|
width: number;
|
|
2617
2622
|
height: number;
|
|
2623
|
+
rx: number;
|
|
2624
|
+
ry: number;
|
|
2618
2625
|
cornerRadius: number;
|
|
2619
2626
|
cornerShape: CornerShapeValue;
|
|
2620
2627
|
cornerMode: 'uniform' | 'non-uniform';
|
|
@@ -2634,8 +2641,8 @@ interface CircleNodeProps extends CommonNodeProps {
|
|
|
2634
2641
|
radius: number;
|
|
2635
2642
|
}
|
|
2636
2643
|
interface EllipseNodeProps extends CommonNodeProps {
|
|
2637
|
-
|
|
2638
|
-
|
|
2644
|
+
cx: number;
|
|
2645
|
+
cy: number;
|
|
2639
2646
|
rx: number;
|
|
2640
2647
|
ry: number;
|
|
2641
2648
|
}
|
|
@@ -2783,7 +2790,7 @@ interface SymbolInstanceNodeProps extends CommonNodeProps {
|
|
|
2783
2790
|
height: number;
|
|
2784
2791
|
symbolId: string;
|
|
2785
2792
|
}
|
|
2786
|
-
interface GroupNodeProps {
|
|
2793
|
+
interface GroupNodeProps extends CommonNodeProps {
|
|
2787
2794
|
groupId: string | null;
|
|
2788
2795
|
}
|
|
2789
2796
|
type DocumentNodeProps = Record<string, never>;
|
|
@@ -3547,6 +3554,7 @@ declare function getBuiltInMarkerDefs(): SerializedMarkerDef[];
|
|
|
3547
3554
|
* - `<animate>` for numeric and color properties
|
|
3548
3555
|
* - `<animateTransform>` for rotation, skewX, skewY
|
|
3549
3556
|
* - `<animateMotion>` for path-based motion
|
|
3557
|
+
* - `<discard>` for remove-at-time tracks
|
|
3550
3558
|
*
|
|
3551
3559
|
* The output is a map from shape ID → array of SVG element strings
|
|
3552
3560
|
* so the main renderer can inject them as children of each shape element.
|
|
@@ -4281,6 +4289,8 @@ declare class Rectangle extends ShapeBuilder<Rectangle> {
|
|
|
4281
4289
|
size(width: number, height: number): Rectangle;
|
|
4282
4290
|
/** Set the corner radius for rounded rectangles. */
|
|
4283
4291
|
cornerRadius(r: number): Rectangle;
|
|
4292
|
+
/** Set independent SVG rect corner radii. */
|
|
4293
|
+
radii(rx: number, ry: number): Rectangle;
|
|
4284
4294
|
}
|
|
4285
4295
|
declare class Square extends ShapeBuilder<Square> {
|
|
4286
4296
|
constructor(x: number, y: number, size: number);
|
|
@@ -4288,6 +4298,8 @@ declare class Square extends ShapeBuilder<Square> {
|
|
|
4288
4298
|
size(value: number): Square;
|
|
4289
4299
|
/** Set the corner radius for rounded squares. */
|
|
4290
4300
|
cornerRadius(r: number): Square;
|
|
4301
|
+
/** Set independent SVG rect corner radii. */
|
|
4302
|
+
radii(rx: number, ry: number): Square;
|
|
4291
4303
|
}
|
|
4292
4304
|
declare class Line extends ShapeBuilder<Line> {
|
|
4293
4305
|
constructor(x1: number, y1: number, x2: number, y2: number);
|
|
@@ -5292,4 +5304,74 @@ declare class Document {
|
|
|
5292
5304
|
private _ensureMetadata;
|
|
5293
5305
|
}
|
|
5294
5306
|
|
|
5295
|
-
|
|
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 };
|