@idealyst/svg 1.2.63

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/src/types.ts ADDED
@@ -0,0 +1,446 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ /**
4
+ * Common SVG presentation attributes shared across all SVG elements
5
+ */
6
+ export interface SvgPresentationProps {
7
+ /** Fill color for the shape */
8
+ fill?: string;
9
+ /** Fill opacity (0-1) */
10
+ fillOpacity?: number;
11
+ /** Fill rule for complex paths */
12
+ fillRule?: 'nonzero' | 'evenodd';
13
+ /** Stroke color */
14
+ stroke?: string;
15
+ /** Stroke width */
16
+ strokeWidth?: number | string;
17
+ /** Stroke opacity (0-1) */
18
+ strokeOpacity?: number;
19
+ /** Stroke line cap style */
20
+ strokeLinecap?: 'butt' | 'round' | 'square';
21
+ /** Stroke line join style */
22
+ strokeLinejoin?: 'miter' | 'round' | 'bevel';
23
+ /** Stroke dash array pattern */
24
+ strokeDasharray?: string | number[];
25
+ /** Stroke dash offset */
26
+ strokeDashoffset?: number | string;
27
+ /** Stroke miter limit */
28
+ strokeMiterlimit?: number;
29
+ /** Overall opacity (0-1) */
30
+ opacity?: number;
31
+ /** Visibility */
32
+ visibility?: 'visible' | 'hidden' | 'collapse';
33
+ /** Clip path reference */
34
+ clipPath?: string;
35
+ /** Clip rule */
36
+ clipRule?: 'nonzero' | 'evenodd';
37
+ /** Mask reference */
38
+ mask?: string;
39
+ /** Filter reference */
40
+ filter?: string;
41
+ /** Marker at the start of a line */
42
+ markerStart?: string;
43
+ /** Marker in the middle of a line */
44
+ markerMid?: string;
45
+ /** Marker at the end of a line */
46
+ markerEnd?: string;
47
+ }
48
+
49
+ /**
50
+ * Common props for all SVG elements
51
+ */
52
+ export interface SvgCommonProps extends SvgPresentationProps {
53
+ /** Unique identifier */
54
+ id?: string;
55
+ /** Test ID for testing */
56
+ testID?: string;
57
+ /** Transform attribute */
58
+ transform?: string;
59
+ /** Transform origin (for CSS transforms) */
60
+ transformOrigin?: string;
61
+ /** Children elements */
62
+ children?: ReactNode;
63
+ /** Press handler */
64
+ onPress?: () => void;
65
+ /** Long press handler */
66
+ onLongPress?: () => void;
67
+ /** Press in handler */
68
+ onPressIn?: () => void;
69
+ /** Press out handler */
70
+ onPressOut?: () => void;
71
+ }
72
+
73
+ /**
74
+ * Root SVG element props
75
+ */
76
+ export interface SvgProps extends SvgCommonProps {
77
+ /** Width of the SVG viewport */
78
+ width?: number | string;
79
+ /** Height of the SVG viewport */
80
+ height?: number | string;
81
+ /** ViewBox attribute defining the coordinate system */
82
+ viewBox?: string;
83
+ /** How the SVG content should fit within the viewport */
84
+ preserveAspectRatio?: string;
85
+ /** XML namespace (auto-set on web) */
86
+ xmlns?: string;
87
+ /** XLink namespace for href attributes */
88
+ xmlnsXlink?: string;
89
+ /** Color prop for currentColor inheritance */
90
+ color?: string;
91
+ /** Title for accessibility */
92
+ title?: string;
93
+ /** Description for accessibility */
94
+ desc?: string;
95
+ }
96
+
97
+ /**
98
+ * Group element props
99
+ */
100
+ export interface GProps extends SvgCommonProps {
101
+ /** X translation */
102
+ x?: number | string;
103
+ /** Y translation */
104
+ y?: number | string;
105
+ /** Rotation in degrees */
106
+ rotation?: number;
107
+ /** Scale factor */
108
+ scale?: number;
109
+ /** X origin for transforms */
110
+ originX?: number;
111
+ /** Y origin for transforms */
112
+ originY?: number;
113
+ }
114
+
115
+ /**
116
+ * Path element props
117
+ */
118
+ export interface PathProps extends SvgCommonProps {
119
+ /** Path data string (d attribute) */
120
+ d: string;
121
+ }
122
+
123
+ /**
124
+ * Rectangle element props
125
+ */
126
+ export interface RectProps extends SvgCommonProps {
127
+ /** X coordinate of top-left corner */
128
+ x?: number | string;
129
+ /** Y coordinate of top-left corner */
130
+ y?: number | string;
131
+ /** Width of the rectangle */
132
+ width: number | string;
133
+ /** Height of the rectangle */
134
+ height: number | string;
135
+ /** Horizontal corner radius */
136
+ rx?: number | string;
137
+ /** Vertical corner radius */
138
+ ry?: number | string;
139
+ }
140
+
141
+ /**
142
+ * Circle element props
143
+ */
144
+ export interface CircleProps extends SvgCommonProps {
145
+ /** X coordinate of center */
146
+ cx: number | string;
147
+ /** Y coordinate of center */
148
+ cy: number | string;
149
+ /** Radius */
150
+ r: number | string;
151
+ }
152
+
153
+ /**
154
+ * Ellipse element props
155
+ */
156
+ export interface EllipseProps extends SvgCommonProps {
157
+ /** X coordinate of center */
158
+ cx: number | string;
159
+ /** Y coordinate of center */
160
+ cy: number | string;
161
+ /** Horizontal radius */
162
+ rx: number | string;
163
+ /** Vertical radius */
164
+ ry: number | string;
165
+ }
166
+
167
+ /**
168
+ * Line element props
169
+ */
170
+ export interface LineProps extends SvgCommonProps {
171
+ /** X coordinate of start point */
172
+ x1: number | string;
173
+ /** Y coordinate of start point */
174
+ y1: number | string;
175
+ /** X coordinate of end point */
176
+ x2: number | string;
177
+ /** Y coordinate of end point */
178
+ y2: number | string;
179
+ }
180
+
181
+ /**
182
+ * Polyline element props (open shape)
183
+ */
184
+ export interface PolylineProps extends SvgCommonProps {
185
+ /** Points as string "x1,y1 x2,y2 ..." or array of numbers */
186
+ points: string | number[];
187
+ }
188
+
189
+ /**
190
+ * Polygon element props (closed shape)
191
+ */
192
+ export interface PolygonProps extends SvgCommonProps {
193
+ /** Points as string "x1,y1 x2,y2 ..." or array of numbers */
194
+ points: string | number[];
195
+ }
196
+
197
+ /**
198
+ * Text element props
199
+ */
200
+ export interface TextProps extends SvgCommonProps {
201
+ /** X coordinate */
202
+ x?: number | string;
203
+ /** Y coordinate */
204
+ y?: number | string;
205
+ /** X offset for each character */
206
+ dx?: number | string;
207
+ /** Y offset for each character */
208
+ dy?: number | string;
209
+ /** Rotation for each character */
210
+ rotate?: string | number[];
211
+ /** Font size */
212
+ fontSize?: number | string;
213
+ /** Font family */
214
+ fontFamily?: string;
215
+ /** Font weight */
216
+ fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | number | string;
217
+ /** Font style */
218
+ fontStyle?: 'normal' | 'italic' | 'oblique';
219
+ /** Text anchor/alignment */
220
+ textAnchor?: 'start' | 'middle' | 'end';
221
+ /** Dominant baseline */
222
+ dominantBaseline?: 'auto' | 'text-bottom' | 'alphabetic' | 'ideographic' | 'middle' | 'central' | 'mathematical' | 'hanging' | 'text-top';
223
+ /** Alignment baseline */
224
+ alignmentBaseline?: 'auto' | 'baseline' | 'before-edge' | 'text-before-edge' | 'middle' | 'central' | 'after-edge' | 'text-after-edge' | 'ideographic' | 'alphabetic' | 'hanging' | 'mathematical';
225
+ /** Text decoration */
226
+ textDecoration?: 'none' | 'underline' | 'overline' | 'line-through';
227
+ /** Letter spacing */
228
+ letterSpacing?: number | string;
229
+ /** Word spacing */
230
+ wordSpacing?: number | string;
231
+ /** Text content */
232
+ children?: ReactNode;
233
+ }
234
+
235
+ /**
236
+ * TSpan element props (text span within Text)
237
+ */
238
+ export interface TSpanProps extends TextProps {
239
+ /** Inline element (no children required) */
240
+ inlineSize?: number | string;
241
+ }
242
+
243
+ /**
244
+ * TextPath element props (text along a path)
245
+ */
246
+ export interface TextPathProps extends TextProps {
247
+ /** Reference to path element (href or xlinkHref) */
248
+ href?: string;
249
+ /** Start offset along the path */
250
+ startOffset?: number | string;
251
+ /** Method of rendering text along path */
252
+ method?: 'align' | 'stretch';
253
+ /** Spacing between characters */
254
+ spacing?: 'auto' | 'exact';
255
+ /** Side of path to render text */
256
+ side?: 'left' | 'right';
257
+ /** Path data directly (alternative to href) */
258
+ path?: string;
259
+ }
260
+
261
+ /**
262
+ * Use element props (reference another element)
263
+ */
264
+ export interface UseProps extends SvgCommonProps {
265
+ /** Reference to element (href or xlinkHref) */
266
+ href?: string;
267
+ /** X position */
268
+ x?: number | string;
269
+ /** Y position */
270
+ y?: number | string;
271
+ /** Width */
272
+ width?: number | string;
273
+ /** Height */
274
+ height?: number | string;
275
+ }
276
+
277
+ /**
278
+ * Symbol element props (reusable graphics)
279
+ */
280
+ export interface SymbolProps extends SvgCommonProps {
281
+ /** ViewBox for the symbol */
282
+ viewBox?: string;
283
+ /** Preserve aspect ratio */
284
+ preserveAspectRatio?: string;
285
+ }
286
+
287
+ /**
288
+ * Defs element props (definitions container)
289
+ */
290
+ export interface DefsProps extends SvgCommonProps {}
291
+
292
+ /**
293
+ * Image element props
294
+ */
295
+ export interface ImageProps extends SvgCommonProps {
296
+ /** Image source URL (href or xlinkHref) */
297
+ href?: string;
298
+ /** X position */
299
+ x?: number | string;
300
+ /** Y position */
301
+ y?: number | string;
302
+ /** Width */
303
+ width?: number | string;
304
+ /** Height */
305
+ height?: number | string;
306
+ /** Preserve aspect ratio */
307
+ preserveAspectRatio?: string;
308
+ }
309
+
310
+ /**
311
+ * ClipPath element props
312
+ */
313
+ export interface ClipPathProps extends SvgCommonProps {
314
+ /** Clip path units */
315
+ clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
316
+ }
317
+
318
+ /**
319
+ * Mask element props
320
+ */
321
+ export interface MaskProps extends SvgCommonProps {
322
+ /** X position */
323
+ x?: number | string;
324
+ /** Y position */
325
+ y?: number | string;
326
+ /** Width */
327
+ width?: number | string;
328
+ /** Height */
329
+ height?: number | string;
330
+ /** Mask units */
331
+ maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
332
+ /** Mask content units */
333
+ maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
334
+ }
335
+
336
+ /**
337
+ * LinearGradient element props
338
+ */
339
+ export interface LinearGradientProps extends SvgCommonProps {
340
+ /** X coordinate of start point (0-1 or percentage) */
341
+ x1?: number | string;
342
+ /** Y coordinate of start point (0-1 or percentage) */
343
+ y1?: number | string;
344
+ /** X coordinate of end point (0-1 or percentage) */
345
+ x2?: number | string;
346
+ /** Y coordinate of end point (0-1 or percentage) */
347
+ y2?: number | string;
348
+ /** Gradient units */
349
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
350
+ /** Gradient transform */
351
+ gradientTransform?: string;
352
+ /** Spread method */
353
+ spreadMethod?: 'pad' | 'reflect' | 'repeat';
354
+ }
355
+
356
+ /**
357
+ * RadialGradient element props
358
+ */
359
+ export interface RadialGradientProps extends SvgCommonProps {
360
+ /** X coordinate of center */
361
+ cx?: number | string;
362
+ /** Y coordinate of center */
363
+ cy?: number | string;
364
+ /** Radius */
365
+ r?: number | string;
366
+ /** X coordinate of focal point */
367
+ fx?: number | string;
368
+ /** Y coordinate of focal point */
369
+ fy?: number | string;
370
+ /** Gradient units */
371
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
372
+ /** Gradient transform */
373
+ gradientTransform?: string;
374
+ /** Spread method */
375
+ spreadMethod?: 'pad' | 'reflect' | 'repeat';
376
+ }
377
+
378
+ /**
379
+ * Stop element props (for gradients)
380
+ */
381
+ export interface StopProps {
382
+ /** Offset along the gradient (0-1 or percentage) */
383
+ offset: number | string;
384
+ /** Stop color */
385
+ stopColor?: string;
386
+ /** Stop opacity (0-1) */
387
+ stopOpacity?: number;
388
+ }
389
+
390
+ /**
391
+ * Pattern element props
392
+ */
393
+ export interface PatternProps extends SvgCommonProps {
394
+ /** X position */
395
+ x?: number | string;
396
+ /** Y position */
397
+ y?: number | string;
398
+ /** Width */
399
+ width?: number | string;
400
+ /** Height */
401
+ height?: number | string;
402
+ /** ViewBox for the pattern */
403
+ viewBox?: string;
404
+ /** Pattern units */
405
+ patternUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
406
+ /** Pattern content units */
407
+ patternContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
408
+ /** Pattern transform */
409
+ patternTransform?: string;
410
+ }
411
+
412
+ /**
413
+ * Marker element props
414
+ */
415
+ export interface MarkerProps extends SvgCommonProps {
416
+ /** Reference X coordinate */
417
+ refX?: number | string;
418
+ /** Reference Y coordinate */
419
+ refY?: number | string;
420
+ /** Marker width */
421
+ markerWidth?: number | string;
422
+ /** Marker height */
423
+ markerHeight?: number | string;
424
+ /** Marker units */
425
+ markerUnits?: 'userSpaceOnUse' | 'strokeWidth';
426
+ /** Orientation */
427
+ orient?: 'auto' | 'auto-start-reverse' | number | string;
428
+ /** ViewBox */
429
+ viewBox?: string;
430
+ /** Preserve aspect ratio */
431
+ preserveAspectRatio?: string;
432
+ }
433
+
434
+ /**
435
+ * ForeignObject element props (embed HTML in SVG)
436
+ */
437
+ export interface ForeignObjectProps extends SvgCommonProps {
438
+ /** X position */
439
+ x?: number | string;
440
+ /** Y position */
441
+ y?: number | string;
442
+ /** Width */
443
+ width?: number | string;
444
+ /** Height */
445
+ height?: number | string;
446
+ }