@svgsketch/core 1.8.0 → 1.10.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/README.md +47 -31
- package/dist/index.d.mts +81 -3
- package/dist/index.d.ts +81 -3
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,19 +21,19 @@ const doc = new Document({ width: 400, height: 300 })
|
|
|
21
21
|
.add(new Circle(200, 150, 80).fill('#2563eb'))
|
|
22
22
|
.add(new Rectangle(10, 10, 100, 60).fill('#ef4444').cornerRadius(8));
|
|
23
23
|
|
|
24
|
-
const svg = doc.toSVG();
|
|
25
|
-
const svgs = doc.toJSON();
|
|
24
|
+
const svg = doc.toSVG(); // rendered SVG string
|
|
25
|
+
const svgs = doc.toJSON(); // canonical `.svgs` document
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## What it includes
|
|
29
29
|
|
|
30
|
-
| Module
|
|
31
|
-
|
|
|
32
|
-
| `types`
|
|
33
|
-
| `format`
|
|
34
|
-
| `renderer`
|
|
35
|
-
| `sdk`
|
|
36
|
-
| `codegen`
|
|
30
|
+
| Module | Exports |
|
|
31
|
+
| ---------- | -------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `types` | `HistorySnapshot`, `SerializedShape`, `SerializedSymbolDef`, … |
|
|
33
|
+
| `format` | `parseDocument`, `stringifyDocument`, `migrateSnapshot`, `validateSnapshot`, `substituteVariables` |
|
|
34
|
+
| `renderer` | `renderToSvg` |
|
|
35
|
+
| `sdk` | `Document`, `Circle`, `Rectangle`, …, `Timeline`, `Track` |
|
|
36
|
+
| `codegen` | `generateCode` — SVG / React / Vue / D3 / CSS output |
|
|
37
37
|
|
|
38
38
|
## The `.svgs` format
|
|
39
39
|
|
|
@@ -52,17 +52,39 @@ designed for:
|
|
|
52
52
|
```jsonc
|
|
53
53
|
{
|
|
54
54
|
"schemaVersion": 1,
|
|
55
|
-
"documentMetadata": {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
55
|
+
"documentMetadata": {
|
|
56
|
+
/* title, author, license, … */
|
|
57
|
+
},
|
|
58
|
+
"templateVariables": [
|
|
59
|
+
/* { name, type, defaultValue, … } */
|
|
60
|
+
],
|
|
61
|
+
"viewboxes": [
|
|
62
|
+
/* { id, x, y, width, height } */
|
|
63
|
+
],
|
|
64
|
+
"guides": [
|
|
65
|
+
/* { id, orientation, position, … } */
|
|
66
|
+
],
|
|
67
|
+
"measurements": [
|
|
68
|
+
/* dimensioning annotations */
|
|
69
|
+
],
|
|
70
|
+
"groups": [
|
|
71
|
+
/* { id, parentId, siblingIndex, … } */
|
|
72
|
+
],
|
|
73
|
+
"clipMaskGroups": [
|
|
74
|
+
/* <clipPath> / <mask> definitions */
|
|
75
|
+
],
|
|
76
|
+
"customPatterns": [
|
|
77
|
+
/* user-defined fill patterns */
|
|
78
|
+
],
|
|
79
|
+
"symbols": [
|
|
80
|
+
/* reusable component definitions */
|
|
81
|
+
],
|
|
82
|
+
"animationTimeline": {
|
|
83
|
+
/* tracks + keyframes */
|
|
84
|
+
},
|
|
85
|
+
"shapes": [
|
|
86
|
+
/* array — order IS z-order */
|
|
87
|
+
],
|
|
66
88
|
}
|
|
67
89
|
```
|
|
68
90
|
|
|
@@ -72,7 +94,7 @@ exhaustive schema.
|
|
|
72
94
|
### Ordering rules
|
|
73
95
|
|
|
74
96
|
- **`shapes` preserves array order** — the position of a shape in the
|
|
75
|
-
array
|
|
97
|
+
array _is_ its painter's-model z-order. Sorting would silently reorder
|
|
76
98
|
rendering and destroy user intent.
|
|
77
99
|
- **Id-keyed collections** (`groups`, `viewboxes`, `guides`,
|
|
78
100
|
`clipMaskGroups`, `customPatterns`, `symbols`) are sorted by `id`.
|
|
@@ -122,7 +144,7 @@ Two complementary mechanisms for parameterizing documents:
|
|
|
122
144
|
|
|
123
145
|
- **`state.bindings`** — a map from a geometry property name to a CSS
|
|
124
146
|
custom-property name (without the leading `--`). When a property is
|
|
125
|
-
bound, `state[property]` holds the
|
|
147
|
+
bound, `state[property]` holds the _resolved_ value (what the renderer
|
|
126
148
|
uses if no substitution runs), and `bindings` records the variable the
|
|
127
149
|
editor should re-bind to on the next edit. Example:
|
|
128
150
|
|
|
@@ -132,8 +154,8 @@ Two complementary mechanisms for parameterizing documents:
|
|
|
132
154
|
"type": "circle",
|
|
133
155
|
"state": {
|
|
134
156
|
"radius": 50,
|
|
135
|
-
"bindings": { "radius": "card-radius" }
|
|
136
|
-
}
|
|
157
|
+
"bindings": { "radius": "card-radius" },
|
|
158
|
+
},
|
|
137
159
|
}
|
|
138
160
|
```
|
|
139
161
|
|
|
@@ -173,13 +195,7 @@ Errors block loading; warnings are surfaced but do not.
|
|
|
173
195
|
## Minimal example
|
|
174
196
|
|
|
175
197
|
```ts
|
|
176
|
-
import {
|
|
177
|
-
Document,
|
|
178
|
-
Circle,
|
|
179
|
-
parseDocument,
|
|
180
|
-
substituteVariables,
|
|
181
|
-
renderToSvg,
|
|
182
|
-
} from '@svgsketch/core';
|
|
198
|
+
import { Document, Circle, parseDocument, substituteVariables, renderToSvg } from '@svgsketch/core';
|
|
183
199
|
|
|
184
200
|
// Build
|
|
185
201
|
const doc = new Document({ width: 200, height: 200 })
|
package/dist/index.d.mts
CHANGED
|
@@ -368,8 +368,8 @@ interface AnimatablePropertyDescriptor {
|
|
|
368
368
|
key: string;
|
|
369
369
|
/** Human-readable label. */
|
|
370
370
|
label: string;
|
|
371
|
-
/** Value type: number, color
|
|
372
|
-
type: 'number' | 'color' | 'path' | 'points';
|
|
371
|
+
/** Value type: number, color, path, points, or discrete string/keyword values. */
|
|
372
|
+
type: 'number' | 'color' | 'path' | 'points' | 'discrete';
|
|
373
373
|
/** The SVG attribute name this maps to (e.g. 'cx', 'fill'). */
|
|
374
374
|
attr?: string;
|
|
375
375
|
/** Minimum value for numeric properties. */
|
|
@@ -1611,6 +1611,12 @@ declare const COMMON_TRANSFORM_NODE_DEFAULTS: CommonTransformNodeProps;
|
|
|
1611
1611
|
|
|
1612
1612
|
type SerializedShapeState = ShapeTransformState & {
|
|
1613
1613
|
[key: string]: unknown;
|
|
1614
|
+
/**
|
|
1615
|
+
* Editor layer label shown in the Elements panel. This is intentionally
|
|
1616
|
+
* separate from ShapeMetadata.name / SVG id so it may contain arbitrary
|
|
1617
|
+
* user-facing text without changing exported element identifiers.
|
|
1618
|
+
*/
|
|
1619
|
+
layerName?: string;
|
|
1614
1620
|
x?: number;
|
|
1615
1621
|
y?: number;
|
|
1616
1622
|
width?: number;
|
|
@@ -2753,6 +2759,7 @@ type LibraryDefOfKind<K extends LibraryKind> = Extract<LibraryDef, {
|
|
|
2753
2759
|
*/
|
|
2754
2760
|
|
|
2755
2761
|
interface CommonNodeProps extends CommonTransformNodeProps {
|
|
2762
|
+
layerName: string | null;
|
|
2756
2763
|
fillColor: string;
|
|
2757
2764
|
borderColor: string;
|
|
2758
2765
|
borderWidth: number;
|
|
@@ -5642,4 +5649,75 @@ declare function solveSudoku(grid: SudokuGrid, options?: SolveSudokuOptions): Su
|
|
|
5642
5649
|
declare function validateSudokuPuzzle(grid: SudokuGrid): SudokuValidationResult;
|
|
5643
5650
|
declare function generateSudokuPuzzle(options: GenerateSudokuOptions): GeneratedSudokuPuzzle;
|
|
5644
5651
|
|
|
5645
|
-
|
|
5652
|
+
/**
|
|
5653
|
+
* Pure word-search parsing, validation, masking, and generation.
|
|
5654
|
+
*
|
|
5655
|
+
* The editor plugin imports this module through @svgsketch/core so puzzle
|
|
5656
|
+
* generation stays deterministic and testable outside the DOM.
|
|
5657
|
+
*/
|
|
5658
|
+
type WordSearchDirection = 'E' | 'S' | 'SE' | 'NE' | 'W' | 'N' | 'NW' | 'SW';
|
|
5659
|
+
type WordSearchPrimitiveMask = 'rectangle' | 'circle' | 'triangle' | 'diamond' | 'star' | 'heart' | 'cross';
|
|
5660
|
+
interface WordSearchAxes {
|
|
5661
|
+
across: boolean;
|
|
5662
|
+
down: boolean;
|
|
5663
|
+
diagonal: boolean;
|
|
5664
|
+
}
|
|
5665
|
+
interface WordSearchOptions {
|
|
5666
|
+
width: number;
|
|
5667
|
+
height: number;
|
|
5668
|
+
words: readonly string[];
|
|
5669
|
+
axes: WordSearchAxes;
|
|
5670
|
+
allowBackwards: boolean;
|
|
5671
|
+
seed: number;
|
|
5672
|
+
mask?: readonly (readonly boolean[])[];
|
|
5673
|
+
fillerAlphabet?: string | readonly string[];
|
|
5674
|
+
title?: string;
|
|
5675
|
+
creator?: string;
|
|
5676
|
+
maxBacktrackNodes?: number;
|
|
5677
|
+
}
|
|
5678
|
+
interface WordSearchCellPath {
|
|
5679
|
+
row: number;
|
|
5680
|
+
col: number;
|
|
5681
|
+
grapheme: string;
|
|
5682
|
+
}
|
|
5683
|
+
interface WordSearchPlacement {
|
|
5684
|
+
word: string;
|
|
5685
|
+
row: number;
|
|
5686
|
+
col: number;
|
|
5687
|
+
direction: WordSearchDirection;
|
|
5688
|
+
path: WordSearchCellPath[];
|
|
5689
|
+
}
|
|
5690
|
+
interface RejectedWordSearchWord {
|
|
5691
|
+
input: string;
|
|
5692
|
+
reason: string;
|
|
5693
|
+
}
|
|
5694
|
+
interface WordSearchLintResult {
|
|
5695
|
+
valid: boolean;
|
|
5696
|
+
acceptedWords: string[];
|
|
5697
|
+
rejectedWords: RejectedWordSearchWord[];
|
|
5698
|
+
errors: string[];
|
|
5699
|
+
warnings: string[];
|
|
5700
|
+
minWords: number;
|
|
5701
|
+
maxWords: number;
|
|
5702
|
+
activeCells: number;
|
|
5703
|
+
directions: WordSearchDirection[];
|
|
5704
|
+
}
|
|
5705
|
+
interface GeneratedWordSearch {
|
|
5706
|
+
width: number;
|
|
5707
|
+
height: number;
|
|
5708
|
+
grid: string[][];
|
|
5709
|
+
mask: boolean[][];
|
|
5710
|
+
normalizedWords: string[];
|
|
5711
|
+
placements: WordSearchPlacement[];
|
|
5712
|
+
seed: number;
|
|
5713
|
+
title?: string;
|
|
5714
|
+
creator?: string;
|
|
5715
|
+
lint: WordSearchLintResult;
|
|
5716
|
+
}
|
|
5717
|
+
declare function parseWordSearchWords(input: string): string[];
|
|
5718
|
+
declare function getWordSearchDirections(axes: WordSearchAxes, allowBackwards: boolean): WordSearchDirection[];
|
|
5719
|
+
declare function lintWordSearchOptions(options: WordSearchOptions): WordSearchLintResult;
|
|
5720
|
+
declare function generateWordSearch(options: WordSearchOptions): GeneratedWordSearch;
|
|
5721
|
+
declare function createWordSearchPrimitiveMask(width: number, height: number, primitive: WordSearchPrimitiveMask): boolean[][];
|
|
5722
|
+
|
|
5723
|
+
export { type Affine2D, type AffineTransformMatrix, 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, COMMON_TRANSFORM_NODE_DEFAULTS, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, Cloud, type CodeFormat, type CodegenOptions, type CommonNodeProps, type CommonTransformNodeProps, 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 GeneratedWordSearch, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GradientUnits, type GrayscaleFilter, type GroupNodeProps, type Guide, Heart, type HistorySnapshot, type HueRotateFilter, Hyperlink, IDENTITY_AFFINE, 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, NUMERIC_SHAPE_TRANSFORM_STATE_KEYS, 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 RejectedWordSearchWord, type RenderOptions, type RichTextData, type RichTextLine, type RichTextSegment, type RichTextSegmentStyle, type RiddledFilter, Ring, type RingNodeProps, type RoundEdgesFilter, SHAPE_TRANSFORM_STATE_KEYS, type SaturateFilter, type SegmentCurveType, type SepiaFilter, type SerializedAnimationTimeline, type SerializedClipMaskGroup, type SerializedColorGlyph, type SerializedColorGlyphLibrary, type SerializedExportItem, type SerializedGroup, type SerializedMarkerDef, type SerializedPaintServerDef, type SerializedSceneNodePlacement, type SerializedShape, type SerializedShapeState, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, ShapeReference, type ShapeTransformState, 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 WordSearchAxes, type WordSearchCellPath, type WordSearchDirection, type WordSearchLintResult, type WordSearchOptions, type WordSearchPlacement, type WordSearchPrimitiveMask, type XrayFilter, affine, affineFromArray, affineToArray, around, canonicalPolygonTransformString, canonicalTransformString, collectReferencedLibraryIds, composeLegacyTransformMatrix, computeArrowVertices, computeCloudPath, computeCrossVertices, computeDashArray, computeGearPath, computeGearVertices, computeHeartPath, computeLightningVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpeechBubbleVertices, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createShape, createViewbox, createWordSearchPrimitiveMask, defaultVariableMode, escXml, extractVariables, filterAttr, foldLegacyAncestorTransformIntoMatrix, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generatePuzzlePieces, generateReactCode, generateSudokuPuzzle, generateSvgCode, generateVueCode, generateWordSearch, getBuiltInMarkerDefs, getEasingCubicBezier, getEffectivePrecision, getMarkerDescriptors, getPatternElements, getWordSearchDirections, isFiniteAffineArray, isIdentityAffine, linearGradient, lintWordSearchOptions, matrixTransformPart, migrateSnapshot, multiplyAffine, parseDocument, parseSvgTransformList, parseVariableArgs, parseWordSearchWords, 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, rotateAffine, roundCoord, roundNumberString, roundSerializedShape, roundSnapshot, scaleAffine, skewXAffine, skewYAffine, solveSudoku, stringifyDocument, substituteString, substituteVariables, translateAffine, validateSnapshot, validateSudokuPuzzle, verticesToPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -368,8 +368,8 @@ interface AnimatablePropertyDescriptor {
|
|
|
368
368
|
key: string;
|
|
369
369
|
/** Human-readable label. */
|
|
370
370
|
label: string;
|
|
371
|
-
/** Value type: number, color
|
|
372
|
-
type: 'number' | 'color' | 'path' | 'points';
|
|
371
|
+
/** Value type: number, color, path, points, or discrete string/keyword values. */
|
|
372
|
+
type: 'number' | 'color' | 'path' | 'points' | 'discrete';
|
|
373
373
|
/** The SVG attribute name this maps to (e.g. 'cx', 'fill'). */
|
|
374
374
|
attr?: string;
|
|
375
375
|
/** Minimum value for numeric properties. */
|
|
@@ -1611,6 +1611,12 @@ declare const COMMON_TRANSFORM_NODE_DEFAULTS: CommonTransformNodeProps;
|
|
|
1611
1611
|
|
|
1612
1612
|
type SerializedShapeState = ShapeTransformState & {
|
|
1613
1613
|
[key: string]: unknown;
|
|
1614
|
+
/**
|
|
1615
|
+
* Editor layer label shown in the Elements panel. This is intentionally
|
|
1616
|
+
* separate from ShapeMetadata.name / SVG id so it may contain arbitrary
|
|
1617
|
+
* user-facing text without changing exported element identifiers.
|
|
1618
|
+
*/
|
|
1619
|
+
layerName?: string;
|
|
1614
1620
|
x?: number;
|
|
1615
1621
|
y?: number;
|
|
1616
1622
|
width?: number;
|
|
@@ -2753,6 +2759,7 @@ type LibraryDefOfKind<K extends LibraryKind> = Extract<LibraryDef, {
|
|
|
2753
2759
|
*/
|
|
2754
2760
|
|
|
2755
2761
|
interface CommonNodeProps extends CommonTransformNodeProps {
|
|
2762
|
+
layerName: string | null;
|
|
2756
2763
|
fillColor: string;
|
|
2757
2764
|
borderColor: string;
|
|
2758
2765
|
borderWidth: number;
|
|
@@ -5642,4 +5649,75 @@ declare function solveSudoku(grid: SudokuGrid, options?: SolveSudokuOptions): Su
|
|
|
5642
5649
|
declare function validateSudokuPuzzle(grid: SudokuGrid): SudokuValidationResult;
|
|
5643
5650
|
declare function generateSudokuPuzzle(options: GenerateSudokuOptions): GeneratedSudokuPuzzle;
|
|
5644
5651
|
|
|
5645
|
-
|
|
5652
|
+
/**
|
|
5653
|
+
* Pure word-search parsing, validation, masking, and generation.
|
|
5654
|
+
*
|
|
5655
|
+
* The editor plugin imports this module through @svgsketch/core so puzzle
|
|
5656
|
+
* generation stays deterministic and testable outside the DOM.
|
|
5657
|
+
*/
|
|
5658
|
+
type WordSearchDirection = 'E' | 'S' | 'SE' | 'NE' | 'W' | 'N' | 'NW' | 'SW';
|
|
5659
|
+
type WordSearchPrimitiveMask = 'rectangle' | 'circle' | 'triangle' | 'diamond' | 'star' | 'heart' | 'cross';
|
|
5660
|
+
interface WordSearchAxes {
|
|
5661
|
+
across: boolean;
|
|
5662
|
+
down: boolean;
|
|
5663
|
+
diagonal: boolean;
|
|
5664
|
+
}
|
|
5665
|
+
interface WordSearchOptions {
|
|
5666
|
+
width: number;
|
|
5667
|
+
height: number;
|
|
5668
|
+
words: readonly string[];
|
|
5669
|
+
axes: WordSearchAxes;
|
|
5670
|
+
allowBackwards: boolean;
|
|
5671
|
+
seed: number;
|
|
5672
|
+
mask?: readonly (readonly boolean[])[];
|
|
5673
|
+
fillerAlphabet?: string | readonly string[];
|
|
5674
|
+
title?: string;
|
|
5675
|
+
creator?: string;
|
|
5676
|
+
maxBacktrackNodes?: number;
|
|
5677
|
+
}
|
|
5678
|
+
interface WordSearchCellPath {
|
|
5679
|
+
row: number;
|
|
5680
|
+
col: number;
|
|
5681
|
+
grapheme: string;
|
|
5682
|
+
}
|
|
5683
|
+
interface WordSearchPlacement {
|
|
5684
|
+
word: string;
|
|
5685
|
+
row: number;
|
|
5686
|
+
col: number;
|
|
5687
|
+
direction: WordSearchDirection;
|
|
5688
|
+
path: WordSearchCellPath[];
|
|
5689
|
+
}
|
|
5690
|
+
interface RejectedWordSearchWord {
|
|
5691
|
+
input: string;
|
|
5692
|
+
reason: string;
|
|
5693
|
+
}
|
|
5694
|
+
interface WordSearchLintResult {
|
|
5695
|
+
valid: boolean;
|
|
5696
|
+
acceptedWords: string[];
|
|
5697
|
+
rejectedWords: RejectedWordSearchWord[];
|
|
5698
|
+
errors: string[];
|
|
5699
|
+
warnings: string[];
|
|
5700
|
+
minWords: number;
|
|
5701
|
+
maxWords: number;
|
|
5702
|
+
activeCells: number;
|
|
5703
|
+
directions: WordSearchDirection[];
|
|
5704
|
+
}
|
|
5705
|
+
interface GeneratedWordSearch {
|
|
5706
|
+
width: number;
|
|
5707
|
+
height: number;
|
|
5708
|
+
grid: string[][];
|
|
5709
|
+
mask: boolean[][];
|
|
5710
|
+
normalizedWords: string[];
|
|
5711
|
+
placements: WordSearchPlacement[];
|
|
5712
|
+
seed: number;
|
|
5713
|
+
title?: string;
|
|
5714
|
+
creator?: string;
|
|
5715
|
+
lint: WordSearchLintResult;
|
|
5716
|
+
}
|
|
5717
|
+
declare function parseWordSearchWords(input: string): string[];
|
|
5718
|
+
declare function getWordSearchDirections(axes: WordSearchAxes, allowBackwards: boolean): WordSearchDirection[];
|
|
5719
|
+
declare function lintWordSearchOptions(options: WordSearchOptions): WordSearchLintResult;
|
|
5720
|
+
declare function generateWordSearch(options: WordSearchOptions): GeneratedWordSearch;
|
|
5721
|
+
declare function createWordSearchPrimitiveMask(width: number, height: number, primitive: WordSearchPrimitiveMask): boolean[][];
|
|
5722
|
+
|
|
5723
|
+
export { type Affine2D, type AffineTransformMatrix, 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, COMMON_TRANSFORM_NODE_DEFAULTS, CURRENT_SCHEMA_VERSION, type ChannelPainterFilter, Circle, type CircleNodeProps, Cloud, type CodeFormat, type CodegenOptions, type CommonNodeProps, type CommonTransformNodeProps, 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 GeneratedWordSearch, type GlowFilter, type GouacheFilter, type GradientDefinition, type GradientSpreadMethod, type GradientStop, type GradientUnits, type GrayscaleFilter, type GroupNodeProps, type Guide, Heart, type HistorySnapshot, type HueRotateFilter, Hyperlink, IDENTITY_AFFINE, 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, NUMERIC_SHAPE_TRANSFORM_STATE_KEYS, 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 RejectedWordSearchWord, type RenderOptions, type RichTextData, type RichTextLine, type RichTextSegment, type RichTextSegmentStyle, type RiddledFilter, Ring, type RingNodeProps, type RoundEdgesFilter, SHAPE_TRANSFORM_STATE_KEYS, type SaturateFilter, type SegmentCurveType, type SepiaFilter, type SerializedAnimationTimeline, type SerializedClipMaskGroup, type SerializedColorGlyph, type SerializedColorGlyphLibrary, type SerializedExportItem, type SerializedGroup, type SerializedMarkerDef, type SerializedPaintServerDef, type SerializedSceneNodePlacement, type SerializedShape, type SerializedShapeState, type SerializedSymbolDef, type SerializedVariantAxis, type SerializedViewbox, ShapeBuilder, type ShapeFilter, type ShapeMetadata, ShapeReference, type ShapeTransformState, 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 WordSearchAxes, type WordSearchCellPath, type WordSearchDirection, type WordSearchLintResult, type WordSearchOptions, type WordSearchPlacement, type WordSearchPrimitiveMask, type XrayFilter, affine, affineFromArray, affineToArray, around, canonicalPolygonTransformString, canonicalTransformString, collectReferencedLibraryIds, composeLegacyTransformMatrix, computeArrowVertices, computeCloudPath, computeCrossVertices, computeDashArray, computeGearPath, computeGearVertices, computeHeartPath, computeLightningVertices, computePolygonVertices, computeRectanglePath, computeRingPath, computeSpeechBubbleVertices, computeSpiralPath, computeSplinePath, computeStarVertices, createDocument, createShape, createViewbox, createWordSearchPrimitiveMask, defaultVariableMode, escXml, extractVariables, filterAttr, foldLegacyAncestorTransformIntoMatrix, generateCode, generateCssCode, generateD3Code, generateId, generatePatternSvgContent, generatePuzzlePieces, generateReactCode, generateSudokuPuzzle, generateSvgCode, generateVueCode, generateWordSearch, getBuiltInMarkerDefs, getEasingCubicBezier, getEffectivePrecision, getMarkerDescriptors, getPatternElements, getWordSearchDirections, isFiniteAffineArray, isIdentityAffine, linearGradient, lintWordSearchOptions, matrixTransformPart, migrateSnapshot, multiplyAffine, parseDocument, parseSvgTransformList, parseVariableArgs, parseWordSearchWords, 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, rotateAffine, roundCoord, roundNumberString, roundSerializedShape, roundSnapshot, scaleAffine, skewXAffine, skewYAffine, solveSudoku, stringifyDocument, substituteString, substituteVariables, translateAffine, validateSnapshot, validateSudokuPuzzle, verticesToPath };
|