@svfig/core 0.1.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.
@@ -0,0 +1,4 @@
1
+ export * from './serdes';
2
+ export * from './types';
3
+ export { CanvasView, ElementView, generate, type Image, ImageView, type Polygon, PolygonView, type Polyline, PolylineView, resolve, type Textbox, TextboxView, } from './view';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,KAAK,EACV,SAAS,EACT,KAAK,OAAO,EACZ,WAAW,EACX,KAAK,QAAQ,EACb,YAAY,EACZ,OAAO,EACP,KAAK,OAAO,EACZ,WAAW,GACZ,MAAM,QAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,286 @@
1
+ // src/serdes.ts
2
+ var parse = (src, filename = "<input>") => {
3
+ try {
4
+ return JSON.parse(src);
5
+ } catch (error) {
6
+ const message = error instanceof Error ? error.message : String(error);
7
+ throw new Error(`Failed to parse SVFIG document at ${filename}: ${message}`);
8
+ }
9
+ };
10
+ var serialize = (doc) => {
11
+ return `${JSON.stringify(doc, null, 2)}
12
+ `;
13
+ };
14
+
15
+ // src/view/elem/image.tsx
16
+ import { jsx } from "react/jsx-runtime";
17
+ var ImageView = ({ elem }) => {
18
+ const [w, h] = elem.size;
19
+ const [x, y] = elem.pos;
20
+ const cx = x + w / 2;
21
+ const cy = y + h / 2;
22
+ const transform = elem.rot ? `rotate(${elem.rot} ${cx} ${cy})` : void 0;
23
+ return /* @__PURE__ */ jsx(
24
+ "image",
25
+ {
26
+ x,
27
+ y,
28
+ width: w,
29
+ height: h,
30
+ href: elem.path,
31
+ transform,
32
+ preserveAspectRatio: "xMidYMid meet"
33
+ }
34
+ );
35
+ };
36
+ var resolveImage = (p, d) => ({
37
+ path: p.path ?? d.path,
38
+ size: p.size ?? d.size,
39
+ pos: p.pos ?? d.pos,
40
+ rot: p.rot ?? d.rot,
41
+ round: p.round ?? d.round
42
+ });
43
+
44
+ // src/view/elem/polygon.tsx
45
+ import { jsx as jsx2 } from "react/jsx-runtime";
46
+ var PolygonView = ({ elem }) => {
47
+ const points = elem.points.map(([x, y]) => `${x},${y}`).join(" ");
48
+ return /* @__PURE__ */ jsx2(
49
+ "polygon",
50
+ {
51
+ points,
52
+ fill: elem.fill.color,
53
+ fillOpacity: elem.fill.opacity,
54
+ stroke: elem.line.color,
55
+ strokeWidth: elem.line.width
56
+ }
57
+ );
58
+ };
59
+ var resolvePolygon = (p, d) => {
60
+ const merged = {
61
+ ...d,
62
+ ...p,
63
+ fill: { ...d.fill, ...p.fill },
64
+ line: { ...d.line, ...p.line }
65
+ };
66
+ return {
67
+ points: merged.points,
68
+ line: merged.line,
69
+ fill: merged.fill
70
+ };
71
+ };
72
+
73
+ // src/view/elem/polyline.tsx
74
+ import { useId } from "react";
75
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
76
+ var unitDir = (from, to) => {
77
+ const dx = to[0] - from[0];
78
+ const dy = to[1] - from[1];
79
+ const len = Math.hypot(dx, dy);
80
+ if (len === 0) return [0, 0];
81
+ return [dx / len, dy / len];
82
+ };
83
+ var EdgeMark = ({ at, dir, edge, color }) => {
84
+ if (edge.type === "none" || edge.size <= 0) return null;
85
+ if (edge.type === "circle") {
86
+ return /* @__PURE__ */ jsx3("circle", { cx: at[0], cy: at[1], r: edge.size / 2, fill: color });
87
+ }
88
+ const [dx, dy] = dir;
89
+ const baseX = at[0] - dx * edge.size;
90
+ const baseY = at[1] - dy * edge.size;
91
+ const halfW = edge.size / 2;
92
+ const lx = baseX - dy * halfW;
93
+ const ly = baseY + dx * halfW;
94
+ const rx = baseX + dy * halfW;
95
+ const ry = baseY - dx * halfW;
96
+ return /* @__PURE__ */ jsx3("polygon", { points: `${at[0]},${at[1]} ${lx},${ly} ${rx},${ry}`, fill: color });
97
+ };
98
+ var ArrowMaskCut = ({ at, dir, edge }) => {
99
+ if (edge.type !== "arrow" || edge.size <= 0) return null;
100
+ const [dx, dy] = dir;
101
+ const bx = at[0] - dx * edge.size;
102
+ const by = at[1] - dy * edge.size;
103
+ const L = 1e5;
104
+ const px = -dy;
105
+ const py = dx;
106
+ const p1 = [bx + px * L, by + py * L];
107
+ const p2 = [bx - px * L, by - py * L];
108
+ const p3 = [p2[0] + dx * L, p2[1] + dy * L];
109
+ const p4 = [p1[0] + dx * L, p1[1] + dy * L];
110
+ return /* @__PURE__ */ jsx3("polygon", { points: `${p1[0]},${p1[1]} ${p2[0]},${p2[1]} ${p3[0]},${p3[1]} ${p4[0]},${p4[1]}`, fill: "black" });
111
+ };
112
+ var hasArrowEdge = (edge) => edge.type === "arrow" && edge.size > 0;
113
+ var PolylineView = ({ elem }) => {
114
+ const rawId = useId();
115
+ const maskId = `m${rawId.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
116
+ const points = elem.points.map(([x, y]) => `${x},${y}`).join(" ");
117
+ const n = elem.points.length;
118
+ const [beginEdge, endEdge] = elem.edge;
119
+ const beginPt = n > 0 ? elem.points[0] : null;
120
+ const beginDir = n >= 2 ? unitDir(elem.points[1], elem.points[0]) : null;
121
+ const endPt = n > 0 ? elem.points[n - 1] : null;
122
+ const endDir = n >= 2 ? unitDir(elem.points[n - 2], elem.points[n - 1]) : null;
123
+ const useMask = !!beginPt && !!beginDir && hasArrowEdge(beginEdge) || !!endPt && !!endDir && hasArrowEdge(endEdge);
124
+ return /* @__PURE__ */ jsxs("g", { children: [
125
+ useMask && /* @__PURE__ */ jsx3("defs", { children: /* @__PURE__ */ jsxs("mask", { id: maskId, maskUnits: "userSpaceOnUse", children: [
126
+ /* @__PURE__ */ jsx3("rect", { x: -1e5, y: -1e5, width: 2e5, height: 2e5, fill: "white" }),
127
+ beginPt && beginDir && /* @__PURE__ */ jsx3(ArrowMaskCut, { at: beginPt, dir: beginDir, edge: beginEdge }),
128
+ endPt && endDir && /* @__PURE__ */ jsx3(ArrowMaskCut, { at: endPt, dir: endDir, edge: endEdge })
129
+ ] }) }),
130
+ /* @__PURE__ */ jsx3(
131
+ "polyline",
132
+ {
133
+ points,
134
+ fill: "none",
135
+ stroke: elem.line.color,
136
+ strokeWidth: elem.line.width,
137
+ strokeLinejoin: "round",
138
+ strokeLinecap: "round",
139
+ mask: useMask ? `url(#${maskId})` : void 0
140
+ }
141
+ ),
142
+ beginPt && beginDir && /* @__PURE__ */ jsx3(EdgeMark, { at: beginPt, dir: beginDir, edge: beginEdge, color: elem.line.color }),
143
+ endPt && endDir && /* @__PURE__ */ jsx3(EdgeMark, { at: endPt, dir: endDir, edge: endEdge, color: elem.line.color })
144
+ ] });
145
+ };
146
+ var DEFAULT_EDGE = { type: "none", size: 0 };
147
+ var resolvePolyline = (p, d) => {
148
+ const dBegin = d.edge?.[0] ?? DEFAULT_EDGE;
149
+ const dEnd = d.edge?.[1] ?? DEFAULT_EDGE;
150
+ const pBegin = p.edge?.[0];
151
+ const pEnd = p.edge?.[1];
152
+ const merged = {
153
+ ...d,
154
+ ...p,
155
+ line: { ...d.line, ...p.line },
156
+ edge: [
157
+ { ...dBegin, ...pBegin },
158
+ { ...dEnd, ...pEnd }
159
+ ]
160
+ };
161
+ return {
162
+ points: merged.points,
163
+ line: merged.line,
164
+ edge: merged.edge
165
+ };
166
+ };
167
+
168
+ // src/view/elem/textbox.tsx
169
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
170
+ var TextboxView = ({ elem }) => {
171
+ const [w, h] = elem.size;
172
+ const [x, y] = elem.pos;
173
+ const cx = x + w / 2;
174
+ const cy = y + h / 2;
175
+ const transform = elem.rot ? `rotate(${elem.rot} ${cx} ${cy})` : void 0;
176
+ return /* @__PURE__ */ jsxs2("g", { transform, children: [
177
+ /* @__PURE__ */ jsx4(
178
+ "rect",
179
+ {
180
+ x,
181
+ y,
182
+ width: w,
183
+ height: h,
184
+ rx: elem.round || void 0,
185
+ ry: elem.round || void 0,
186
+ fill: elem.fill.color,
187
+ fillOpacity: elem.fill.opacity,
188
+ stroke: elem.line.color,
189
+ strokeWidth: elem.line.width
190
+ }
191
+ ),
192
+ elem.text.text && /* @__PURE__ */ jsx4(
193
+ "text",
194
+ {
195
+ x: cx,
196
+ y: cy,
197
+ fontFamily: elem.text.font,
198
+ fontSize: elem.text.size,
199
+ textAnchor: "middle",
200
+ dominantBaseline: "central",
201
+ fill: elem.line.color,
202
+ children: elem.text.text
203
+ }
204
+ )
205
+ ] });
206
+ };
207
+ var resolveTextbox = (p, d) => {
208
+ const merged = {
209
+ ...d,
210
+ ...p,
211
+ fill: { ...d.fill, ...p.fill },
212
+ line: { ...d.line, ...p.line },
213
+ text: { ...d.text, ...p.text }
214
+ };
215
+ return {
216
+ size: merged.size,
217
+ pos: merged.pos,
218
+ rot: merged.rot,
219
+ round: merged.round,
220
+ fill: merged.fill,
221
+ line: merged.line,
222
+ text: merged.text
223
+ };
224
+ };
225
+
226
+ // src/view/elem/canvas.tsx
227
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
228
+ var CanvasView = ({ canvas, children }) => {
229
+ const [w, h] = canvas.size;
230
+ return (
231
+ // biome-ignore lint/a11y/noSvgWithoutTitle: SVFIG canvases are caller-described.
232
+ /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${w} ${h}`, width: w, height: h, children: [
233
+ canvas.color && canvas.color !== "none" && /* @__PURE__ */ jsx5("rect", { x: 0, y: 0, width: w, height: h, fill: canvas.color }),
234
+ children
235
+ ] })
236
+ );
237
+ };
238
+
239
+ // src/view/generate.tsx
240
+ import { jsx as jsx6 } from "react/jsx-runtime";
241
+ var generate = async (doc) => {
242
+ const elements = doc.elements.map((el) => resolve(el, doc.default));
243
+ return /* @__PURE__ */ jsx6(CanvasView, { canvas: doc.canvas, children: elements.map((elem, i) => (
244
+ // biome-ignore lint/suspicious/noArrayIndexKey: static SVG, no client state.
245
+ /* @__PURE__ */ jsx6(ElementView, { elem }, i)
246
+ )) });
247
+ };
248
+
249
+ // src/view/index.tsx
250
+ import { jsx as jsx7 } from "react/jsx-runtime";
251
+ var resolve = (elem, d) => {
252
+ switch (elem.kind) {
253
+ case "image":
254
+ return { kind: "image", ...resolveImage(elem, d.image) };
255
+ case "textbox":
256
+ return { kind: "textbox", ...resolveTextbox(elem, d.textbox) };
257
+ case "polygon":
258
+ return { kind: "polygon", ...resolvePolygon(elem, d.polygon) };
259
+ case "polyline":
260
+ return { kind: "polyline", ...resolvePolyline(elem, d.polyline) };
261
+ }
262
+ };
263
+ var ElementView = ({ elem }) => {
264
+ switch (elem.kind) {
265
+ case "image":
266
+ return /* @__PURE__ */ jsx7(ImageView, { elem });
267
+ case "textbox":
268
+ return /* @__PURE__ */ jsx7(TextboxView, { elem });
269
+ case "polygon":
270
+ return /* @__PURE__ */ jsx7(PolygonView, { elem });
271
+ case "polyline":
272
+ return /* @__PURE__ */ jsx7(PolylineView, { elem });
273
+ }
274
+ };
275
+ export {
276
+ CanvasView,
277
+ ElementView,
278
+ ImageView,
279
+ PolygonView,
280
+ PolylineView,
281
+ TextboxView,
282
+ generate,
283
+ parse,
284
+ resolve,
285
+ serialize
286
+ };
@@ -0,0 +1,4 @@
1
+ import type { Document } from './types';
2
+ export declare const parse: (src: string, filename?: string) => Document;
3
+ export declare const serialize: (doc: Document) => string;
4
+ //# sourceMappingURL=serdes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serdes.d.ts","sourceRoot":"","sources":["../src/serdes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,EAAE,iBAAoB,KAAG,QAOzD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,KAAK,QAAQ,KAAG,MAEzC,CAAC"}
@@ -0,0 +1,95 @@
1
+ export type Element = ({
2
+ kind: 'image';
3
+ } & Image) | ({
4
+ kind: 'textbox';
5
+ } & Textbox) | ({
6
+ kind: 'polygon';
7
+ } & Polygon) | ({
8
+ kind: 'polyline';
9
+ } & Polyline);
10
+ export type ElementKind = Element['kind'];
11
+ export type PartialElement = ({
12
+ kind: 'image';
13
+ } & Partial<Image>) | ({
14
+ kind: 'textbox';
15
+ } & Partial<Textbox>) | ({
16
+ kind: 'polygon';
17
+ } & Partial<Polygon>) | ({
18
+ kind: 'polyline';
19
+ } & Partial<Polyline>);
20
+ export interface Document {
21
+ version: 1;
22
+ canvas: Canvas;
23
+ default: Default;
24
+ elements: PartialElement[];
25
+ }
26
+ export interface Canvas {
27
+ size: [number, number];
28
+ color: string;
29
+ }
30
+ export interface Default {
31
+ image: Image;
32
+ textbox: Textbox;
33
+ polygon: Polygon;
34
+ polyline: Polyline;
35
+ }
36
+ export interface Image {
37
+ path: string;
38
+ size: [number, number];
39
+ pos: [number, number];
40
+ rot: number;
41
+ round: number;
42
+ }
43
+ export interface Textbox {
44
+ size: [number, number];
45
+ pos: [number, number];
46
+ rot: number;
47
+ round: number;
48
+ fill: Fill;
49
+ line: Line;
50
+ text: Text;
51
+ }
52
+ export interface Polygon {
53
+ points: [number, number][];
54
+ line: Line;
55
+ fill: Fill;
56
+ }
57
+ export interface Polyline {
58
+ points: [number, number][];
59
+ line: Line;
60
+ edge: [Edge, Edge];
61
+ }
62
+ export interface Fill {
63
+ color: string;
64
+ opacity: number;
65
+ }
66
+ export interface Line {
67
+ color: string;
68
+ width: number;
69
+ }
70
+ export interface Text {
71
+ text: string;
72
+ color: string;
73
+ font: Font;
74
+ size: number;
75
+ align: TextAlign;
76
+ vert: TextVert;
77
+ }
78
+ export type Font = 'sans' | 'serif' | 'mono';
79
+ export type TextAlign = 'left' | 'center' | 'right';
80
+ export type TextVert = 'top' | 'middle' | 'bottom';
81
+ export interface Edge {
82
+ type: 'none' | 'arrow' | 'circle';
83
+ size: number;
84
+ }
85
+ export interface Point {
86
+ x: number;
87
+ y: number;
88
+ }
89
+ export interface Box {
90
+ x: number;
91
+ y: number;
92
+ w: number;
93
+ h: number;
94
+ }
95
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,441 @@
1
+ import { z } from 'zod';
2
+ export declare const fillSchema: z.ZodObject<{
3
+ color: z.ZodString;
4
+ opacity: z.ZodNumber;
5
+ }, z.core.$strip>;
6
+ export declare const lineSchema: z.ZodObject<{
7
+ color: z.ZodString;
8
+ width: z.ZodNumber;
9
+ }, z.core.$strip>;
10
+ export declare const edgeSchema: z.ZodObject<{
11
+ type: z.ZodEnum<{
12
+ none: "none";
13
+ arrow: "arrow";
14
+ circle: "circle";
15
+ }>;
16
+ size: z.ZodNumber;
17
+ }, z.core.$strip>;
18
+ export declare const textSchema: z.ZodObject<{
19
+ str: z.ZodString;
20
+ align: z.ZodEnum<{
21
+ left: "left";
22
+ center: "center";
23
+ right: "right";
24
+ }>;
25
+ vert: z.ZodEnum<{
26
+ top: "top";
27
+ middle: "middle";
28
+ bottom: "bottom";
29
+ }>;
30
+ font: z.ZodEnum<{
31
+ sans: "sans";
32
+ serif: "serif";
33
+ mono: "mono";
34
+ }>;
35
+ size: z.ZodNumber;
36
+ }, z.core.$strip>;
37
+ export declare const canvasSchema: z.ZodObject<{
38
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
39
+ color: z.ZodString;
40
+ }, z.core.$strip>;
41
+ export declare const pointSchema: z.ZodObject<{
42
+ x: z.ZodNumber;
43
+ y: z.ZodNumber;
44
+ }, z.core.$strip>;
45
+ export declare const boxSchema: z.ZodObject<{
46
+ x: z.ZodNumber;
47
+ y: z.ZodNumber;
48
+ w: z.ZodNumber;
49
+ h: z.ZodNumber;
50
+ }, z.core.$strip>;
51
+ export declare const imageSchema: z.ZodObject<{
52
+ kind: z.ZodLiteral<"image">;
53
+ path: z.ZodString;
54
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
55
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
56
+ rot: z.ZodNumber;
57
+ round: z.ZodNumber;
58
+ }, z.core.$strip>;
59
+ export declare const textboxSchema: z.ZodObject<{
60
+ kind: z.ZodLiteral<"textbox">;
61
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
62
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
63
+ rot: z.ZodNumber;
64
+ round: z.ZodNumber;
65
+ fill: z.ZodObject<{
66
+ color: z.ZodString;
67
+ opacity: z.ZodNumber;
68
+ }, z.core.$strip>;
69
+ line: z.ZodObject<{
70
+ color: z.ZodString;
71
+ width: z.ZodNumber;
72
+ }, z.core.$strip>;
73
+ text: z.ZodObject<{
74
+ str: z.ZodString;
75
+ align: z.ZodEnum<{
76
+ left: "left";
77
+ center: "center";
78
+ right: "right";
79
+ }>;
80
+ vert: z.ZodEnum<{
81
+ top: "top";
82
+ middle: "middle";
83
+ bottom: "bottom";
84
+ }>;
85
+ font: z.ZodEnum<{
86
+ sans: "sans";
87
+ serif: "serif";
88
+ mono: "mono";
89
+ }>;
90
+ size: z.ZodNumber;
91
+ }, z.core.$strip>;
92
+ }, z.core.$strip>;
93
+ export declare const polygonSchema: z.ZodObject<{
94
+ kind: z.ZodLiteral<"polygon">;
95
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
96
+ line: z.ZodObject<{
97
+ color: z.ZodString;
98
+ width: z.ZodNumber;
99
+ }, z.core.$strip>;
100
+ fill: z.ZodObject<{
101
+ color: z.ZodString;
102
+ opacity: z.ZodNumber;
103
+ }, z.core.$strip>;
104
+ }, z.core.$strip>;
105
+ export declare const polylineSchema: z.ZodObject<{
106
+ kind: z.ZodLiteral<"polyline">;
107
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
108
+ line: z.ZodObject<{
109
+ color: z.ZodString;
110
+ width: z.ZodNumber;
111
+ }, z.core.$strip>;
112
+ edge: z.ZodTuple<[z.ZodObject<{
113
+ type: z.ZodEnum<{
114
+ none: "none";
115
+ arrow: "arrow";
116
+ circle: "circle";
117
+ }>;
118
+ size: z.ZodNumber;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ type: z.ZodEnum<{
121
+ none: "none";
122
+ arrow: "arrow";
123
+ circle: "circle";
124
+ }>;
125
+ size: z.ZodNumber;
126
+ }, z.core.$strip>], null>;
127
+ }, z.core.$strip>;
128
+ export declare const elementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
129
+ kind: z.ZodLiteral<"image">;
130
+ path: z.ZodString;
131
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
132
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
133
+ rot: z.ZodNumber;
134
+ round: z.ZodNumber;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"textbox">;
137
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
138
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
139
+ rot: z.ZodNumber;
140
+ round: z.ZodNumber;
141
+ fill: z.ZodObject<{
142
+ color: z.ZodString;
143
+ opacity: z.ZodNumber;
144
+ }, z.core.$strip>;
145
+ line: z.ZodObject<{
146
+ color: z.ZodString;
147
+ width: z.ZodNumber;
148
+ }, z.core.$strip>;
149
+ text: z.ZodObject<{
150
+ str: z.ZodString;
151
+ align: z.ZodEnum<{
152
+ left: "left";
153
+ center: "center";
154
+ right: "right";
155
+ }>;
156
+ vert: z.ZodEnum<{
157
+ top: "top";
158
+ middle: "middle";
159
+ bottom: "bottom";
160
+ }>;
161
+ font: z.ZodEnum<{
162
+ sans: "sans";
163
+ serif: "serif";
164
+ mono: "mono";
165
+ }>;
166
+ size: z.ZodNumber;
167
+ }, z.core.$strip>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ kind: z.ZodLiteral<"polygon">;
170
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
171
+ line: z.ZodObject<{
172
+ color: z.ZodString;
173
+ width: z.ZodNumber;
174
+ }, z.core.$strip>;
175
+ fill: z.ZodObject<{
176
+ color: z.ZodString;
177
+ opacity: z.ZodNumber;
178
+ }, z.core.$strip>;
179
+ }, z.core.$strip>, z.ZodObject<{
180
+ kind: z.ZodLiteral<"polyline">;
181
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
182
+ line: z.ZodObject<{
183
+ color: z.ZodString;
184
+ width: z.ZodNumber;
185
+ }, z.core.$strip>;
186
+ edge: z.ZodTuple<[z.ZodObject<{
187
+ type: z.ZodEnum<{
188
+ none: "none";
189
+ arrow: "arrow";
190
+ circle: "circle";
191
+ }>;
192
+ size: z.ZodNumber;
193
+ }, z.core.$strip>, z.ZodObject<{
194
+ type: z.ZodEnum<{
195
+ none: "none";
196
+ arrow: "arrow";
197
+ circle: "circle";
198
+ }>;
199
+ size: z.ZodNumber;
200
+ }, z.core.$strip>], null>;
201
+ }, z.core.$strip>], "kind">;
202
+ export declare const defaultSchema: z.ZodObject<{
203
+ image: z.ZodObject<{
204
+ kind: z.ZodLiteral<"image">;
205
+ path: z.ZodString;
206
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
207
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
208
+ rot: z.ZodNumber;
209
+ round: z.ZodNumber;
210
+ }, z.core.$strip>;
211
+ textbox: z.ZodObject<{
212
+ kind: z.ZodLiteral<"textbox">;
213
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
214
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
215
+ rot: z.ZodNumber;
216
+ round: z.ZodNumber;
217
+ fill: z.ZodObject<{
218
+ color: z.ZodString;
219
+ opacity: z.ZodNumber;
220
+ }, z.core.$strip>;
221
+ line: z.ZodObject<{
222
+ color: z.ZodString;
223
+ width: z.ZodNumber;
224
+ }, z.core.$strip>;
225
+ text: z.ZodObject<{
226
+ str: z.ZodString;
227
+ align: z.ZodEnum<{
228
+ left: "left";
229
+ center: "center";
230
+ right: "right";
231
+ }>;
232
+ vert: z.ZodEnum<{
233
+ top: "top";
234
+ middle: "middle";
235
+ bottom: "bottom";
236
+ }>;
237
+ font: z.ZodEnum<{
238
+ sans: "sans";
239
+ serif: "serif";
240
+ mono: "mono";
241
+ }>;
242
+ size: z.ZodNumber;
243
+ }, z.core.$strip>;
244
+ }, z.core.$strip>;
245
+ polygon: z.ZodObject<{
246
+ kind: z.ZodLiteral<"polygon">;
247
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
248
+ line: z.ZodObject<{
249
+ color: z.ZodString;
250
+ width: z.ZodNumber;
251
+ }, z.core.$strip>;
252
+ fill: z.ZodObject<{
253
+ color: z.ZodString;
254
+ opacity: z.ZodNumber;
255
+ }, z.core.$strip>;
256
+ }, z.core.$strip>;
257
+ polyline: z.ZodObject<{
258
+ kind: z.ZodLiteral<"polyline">;
259
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
260
+ line: z.ZodObject<{
261
+ color: z.ZodString;
262
+ width: z.ZodNumber;
263
+ }, z.core.$strip>;
264
+ edge: z.ZodTuple<[z.ZodObject<{
265
+ type: z.ZodEnum<{
266
+ none: "none";
267
+ arrow: "arrow";
268
+ circle: "circle";
269
+ }>;
270
+ size: z.ZodNumber;
271
+ }, z.core.$strip>, z.ZodObject<{
272
+ type: z.ZodEnum<{
273
+ none: "none";
274
+ arrow: "arrow";
275
+ circle: "circle";
276
+ }>;
277
+ size: z.ZodNumber;
278
+ }, z.core.$strip>], null>;
279
+ }, z.core.$strip>;
280
+ }, z.core.$strip>;
281
+ export declare const documentSchema: z.ZodObject<{
282
+ version: z.ZodLiteral<1>;
283
+ canvas: z.ZodObject<{
284
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
285
+ color: z.ZodString;
286
+ }, z.core.$strip>;
287
+ default: z.ZodObject<{
288
+ image: z.ZodObject<{
289
+ kind: z.ZodLiteral<"image">;
290
+ path: z.ZodString;
291
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
292
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
293
+ rot: z.ZodNumber;
294
+ round: z.ZodNumber;
295
+ }, z.core.$strip>;
296
+ textbox: z.ZodObject<{
297
+ kind: z.ZodLiteral<"textbox">;
298
+ size: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
299
+ pos: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
300
+ rot: z.ZodNumber;
301
+ round: z.ZodNumber;
302
+ fill: z.ZodObject<{
303
+ color: z.ZodString;
304
+ opacity: z.ZodNumber;
305
+ }, z.core.$strip>;
306
+ line: z.ZodObject<{
307
+ color: z.ZodString;
308
+ width: z.ZodNumber;
309
+ }, z.core.$strip>;
310
+ text: z.ZodObject<{
311
+ str: z.ZodString;
312
+ align: z.ZodEnum<{
313
+ left: "left";
314
+ center: "center";
315
+ right: "right";
316
+ }>;
317
+ vert: z.ZodEnum<{
318
+ top: "top";
319
+ middle: "middle";
320
+ bottom: "bottom";
321
+ }>;
322
+ font: z.ZodEnum<{
323
+ sans: "sans";
324
+ serif: "serif";
325
+ mono: "mono";
326
+ }>;
327
+ size: z.ZodNumber;
328
+ }, z.core.$strip>;
329
+ }, z.core.$strip>;
330
+ polygon: z.ZodObject<{
331
+ kind: z.ZodLiteral<"polygon">;
332
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
333
+ line: z.ZodObject<{
334
+ color: z.ZodString;
335
+ width: z.ZodNumber;
336
+ }, z.core.$strip>;
337
+ fill: z.ZodObject<{
338
+ color: z.ZodString;
339
+ opacity: z.ZodNumber;
340
+ }, z.core.$strip>;
341
+ }, z.core.$strip>;
342
+ polyline: z.ZodObject<{
343
+ kind: z.ZodLiteral<"polyline">;
344
+ points: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
345
+ line: z.ZodObject<{
346
+ color: z.ZodString;
347
+ width: z.ZodNumber;
348
+ }, z.core.$strip>;
349
+ edge: z.ZodTuple<[z.ZodObject<{
350
+ type: z.ZodEnum<{
351
+ none: "none";
352
+ arrow: "arrow";
353
+ circle: "circle";
354
+ }>;
355
+ size: z.ZodNumber;
356
+ }, z.core.$strip>, z.ZodObject<{
357
+ type: z.ZodEnum<{
358
+ none: "none";
359
+ arrow: "arrow";
360
+ circle: "circle";
361
+ }>;
362
+ size: z.ZodNumber;
363
+ }, z.core.$strip>], null>;
364
+ }, z.core.$strip>;
365
+ }, z.core.$strip>;
366
+ elements: z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
367
+ kind: z.ZodOptional<z.ZodLiteral<"image">>;
368
+ path: z.ZodOptional<z.ZodString>;
369
+ size: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
370
+ pos: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
371
+ rot: z.ZodOptional<z.ZodNumber>;
372
+ round: z.ZodOptional<z.ZodNumber>;
373
+ }, z.core.$strip>, z.ZodObject<{
374
+ kind: z.ZodOptional<z.ZodLiteral<"textbox">>;
375
+ size: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
376
+ pos: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
377
+ rot: z.ZodOptional<z.ZodNumber>;
378
+ round: z.ZodOptional<z.ZodNumber>;
379
+ fill: z.ZodOptional<z.ZodObject<{
380
+ color: z.ZodString;
381
+ opacity: z.ZodNumber;
382
+ }, z.core.$strip>>;
383
+ line: z.ZodOptional<z.ZodObject<{
384
+ color: z.ZodString;
385
+ width: z.ZodNumber;
386
+ }, z.core.$strip>>;
387
+ text: z.ZodOptional<z.ZodObject<{
388
+ str: z.ZodString;
389
+ align: z.ZodEnum<{
390
+ left: "left";
391
+ center: "center";
392
+ right: "right";
393
+ }>;
394
+ vert: z.ZodEnum<{
395
+ top: "top";
396
+ middle: "middle";
397
+ bottom: "bottom";
398
+ }>;
399
+ font: z.ZodEnum<{
400
+ sans: "sans";
401
+ serif: "serif";
402
+ mono: "mono";
403
+ }>;
404
+ size: z.ZodNumber;
405
+ }, z.core.$strip>>;
406
+ }, z.core.$strip>]>, z.ZodObject<{
407
+ kind: z.ZodOptional<z.ZodLiteral<"polygon">>;
408
+ points: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
409
+ line: z.ZodOptional<z.ZodObject<{
410
+ color: z.ZodString;
411
+ width: z.ZodNumber;
412
+ }, z.core.$strip>>;
413
+ fill: z.ZodOptional<z.ZodObject<{
414
+ color: z.ZodString;
415
+ opacity: z.ZodNumber;
416
+ }, z.core.$strip>>;
417
+ }, z.core.$strip>]>, z.ZodObject<{
418
+ kind: z.ZodOptional<z.ZodLiteral<"polyline">>;
419
+ points: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
420
+ line: z.ZodOptional<z.ZodObject<{
421
+ color: z.ZodString;
422
+ width: z.ZodNumber;
423
+ }, z.core.$strip>>;
424
+ edge: z.ZodOptional<z.ZodTuple<[z.ZodObject<{
425
+ type: z.ZodEnum<{
426
+ none: "none";
427
+ arrow: "arrow";
428
+ circle: "circle";
429
+ }>;
430
+ size: z.ZodNumber;
431
+ }, z.core.$strip>, z.ZodObject<{
432
+ type: z.ZodEnum<{
433
+ none: "none";
434
+ arrow: "arrow";
435
+ circle: "circle";
436
+ }>;
437
+ size: z.ZodNumber;
438
+ }, z.core.$strip>], null>>;
439
+ }, z.core.$strip>]>>;
440
+ }, z.core.$strip>;
441
+ //# sourceMappingURL=types.zod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.zod.d.ts","sourceRoot":"","sources":["../src/types.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;iBAGrB,CAAC;AAEH,eAAO,MAAM,UAAU;;;iBAGrB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;iBAGrB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;iBAMrB,CAAC;AAEH,eAAO,MAAM,YAAY;;;iBAGvB,CAAC;AAEH,eAAO,MAAM,WAAW;;;iBAGtB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;iBAKpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;iBAOtB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASxB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;iBAKzB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA4F,CAAC;AAEvH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOzB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ import type { Canvas } from '../../types';
3
+ export declare const CanvasView: FC<{
4
+ canvas: Canvas;
5
+ children?: ReactNode;
6
+ }>;
7
+ //# sourceMappingURL=canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../../src/view/elem/canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAUnE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import type { Image } from '../../types';
3
+ export declare const ImageView: FC<{
4
+ elem: Image;
5
+ }>;
6
+ export declare const resolveImage: (p: Partial<Image>, d: Image) => Image;
7
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/view/elem/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAkBzC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,KAAG,KAMzD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import type { Polygon } from '../../types';
3
+ export declare const PolygonView: FC<{
4
+ elem: Polygon;
5
+ }>;
6
+ export declare const resolvePolygon: (p: Partial<Polygon>, d: Polygon) => Polygon;
7
+ //# sourceMappingURL=polygon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../src/view/elem/polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAW7C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,KAAG,OAahE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type FC } from 'react';
2
+ import type { Polyline } from '../../types';
3
+ export declare const PolylineView: FC<{
4
+ elem: Polyline;
5
+ }>;
6
+ export declare const resolvePolyline: (p: Partial<Polyline>, d: Polyline) => Polyline;
7
+ //# sourceMappingURL=polyline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyline.d.ts","sourceRoot":"","sources":["../../../src/view/elem/polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAS,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,aAAa,CAAC;AAgDlD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAsC/C,CAAC;AAIF,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,GAAG,QAAQ,KAAG,QAoBnE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import type { Textbox } from '../../types';
3
+ export declare const TextboxView: FC<{
4
+ elem: Textbox;
5
+ }>;
6
+ export declare const resolveTextbox: (p: Partial<Textbox>, d: Textbox) => Textbox;
7
+ //# sourceMappingURL=textbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textbox.d.ts","sourceRoot":"","sources":["../../../src/view/elem/textbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAoC7C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,KAAG,OAkBhE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Document } from '../types';
3
+ export declare const generate: (doc: Document) => Promise<ReactElement>;
4
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/view/generate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,eAAO,MAAM,QAAQ,GAAU,KAAK,QAAQ,KAAG,OAAO,CAAC,YAAY,CAUlE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { FC } from 'react';
2
+ import type { Default, Element, PartialElement } from '../types';
3
+ export type { Edge, Image, Polygon, Polyline, Textbox } from '../types';
4
+ export { CanvasView } from './elem/canvas';
5
+ export { ImageView } from './elem/image';
6
+ export { PolygonView } from './elem/polygon';
7
+ export { PolylineView } from './elem/polyline';
8
+ export { TextboxView } from './elem/textbox';
9
+ export { generate } from './generate';
10
+ export declare const resolve: (elem: PartialElement, d: Default) => Element;
11
+ export declare const ElementView: FC<{
12
+ elem: Element;
13
+ }>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAMjE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,eAAO,MAAM,OAAO,GAAI,MAAM,cAAc,EAAE,GAAG,OAAO,KAAG,OAW1D,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAW7C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@svfig/core",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "sideEffects": false,
17
+ "peerDependencies": {
18
+ "react": "^19.0.0"
19
+ },
20
+ "dependencies": {
21
+ "zod": "^4.4.3"
22
+ },
23
+ "devDependencies": {
24
+ "@types/react": "^19.1.0",
25
+ "esbuild": "^0.27.0",
26
+ "react": "^19.1.0"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc -p tsconfig.build.json --emitDeclarationOnly && pnpm exec esbuild src/index.ts --bundle --format=esm --platform=neutral --outfile=dist/index.js --external:react --external:react/jsx-runtime --external:zod",
30
+ "typecheck": "tsc -p tsconfig.json --noEmit"
31
+ }
32
+ }