@svgsketch/core 1.9.0 → 2.0.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 CHANGED
@@ -14,9 +14,9 @@ npm install @svgsketch/core
14
14
  ## Quick start
15
15
 
16
16
  ```ts
17
- import { Document, Circle, Rectangle } from '@svgsketch/core';
17
+ import { DocumentBuilder, Circle, Rectangle } from '@svgsketch/core';
18
18
 
19
- const doc = new Document({ width: 400, height: 300 })
19
+ const doc = new DocumentBuilder({ width: 400, height: 300 })
20
20
  .title('Hello')
21
21
  .add(new Circle(200, 150, 80).fill('#2563eb'))
22
22
  .add(new Rectangle(10, 10, 100, 60).fill('#ef4444').cornerRadius(8));
@@ -32,7 +32,7 @@ const svgs = doc.toJSON(); // canonical `.svgs` document
32
32
  | `types` | `HistorySnapshot`, `SerializedShape`, `SerializedSymbolDef`, … |
33
33
  | `format` | `parseDocument`, `stringifyDocument`, `migrateSnapshot`, `validateSnapshot`, `substituteVariables` |
34
34
  | `renderer` | `renderToSvg` |
35
- | `sdk` | `Document`, `Circle`, `Rectangle`, …, `Timeline`, `Track` |
35
+ | `sdk` | `DocumentBuilder`, `Circle`, `Rectangle`, …, `Timeline`, `Track` |
36
36
  | `codegen` | `generateCode` — SVG / React / Vue / D3 / CSS output |
37
37
 
38
38
  ## The `.svgs` format
@@ -52,39 +52,17 @@ designed for:
52
52
  ```jsonc
53
53
  {
54
54
  "schemaVersion": 1,
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
- ],
55
+ "documentMetadata": {/* title, author, license, … */},
56
+ "templateVariables": [/* { name, type, defaultValue, … } */],
57
+ "viewboxes": [/* { id, x, y, width, height } */],
58
+ "guides": [/* { id, orientation, position, … } */],
59
+ "measurements": [/* dimensioning annotations */],
60
+ "groups": [/* { id, parentId, siblingIndex, … } */],
61
+ "clipMaskGroups": [/* <clipPath> / <mask> definitions */],
62
+ "customPatterns": [/* user-defined fill patterns */],
63
+ "symbols": [/* reusable component definitions */],
64
+ "animationTimeline": {/* tracks + keyframes */},
65
+ "shapes": [/* array order IS z-order */],
88
66
  }
89
67
  ```
90
68
 
@@ -195,10 +173,16 @@ Errors block loading; warnings are surfaced but do not.
195
173
  ## Minimal example
196
174
 
197
175
  ```ts
198
- import { Document, Circle, parseDocument, substituteVariables, renderToSvg } from '@svgsketch/core';
176
+ import {
177
+ DocumentBuilder,
178
+ Circle,
179
+ parseDocument,
180
+ substituteVariables,
181
+ renderToSvg,
182
+ } from '@svgsketch/core';
199
183
 
200
184
  // Build
201
- const doc = new Document({ width: 200, height: 200 })
185
+ const doc = new DocumentBuilder({ width: 200, height: 200 })
202
186
  .add(new Circle(100, 100, 75).fill('{{accent}}').id('c1'))
203
187
  .defineVariable('accent', 'color', '#3498db');
204
188