@tscircuit/props 0.0.703 → 0.0.704
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 +14 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/lib/components/symbol.ts +31 -0
- package/package.json +1 -1
package/lib/components/symbol.ts
CHANGED
|
@@ -12,6 +12,20 @@ export interface SymbolProps {
|
|
|
12
12
|
originalFacingDirection?: "up" | "down" | "left" | "right"
|
|
13
13
|
width?: string | number
|
|
14
14
|
height?: string | number
|
|
15
|
+
/** CSS-style fill (default) and stretch resize axes independently; contain preserves proportions. */
|
|
16
|
+
fit?: "fill" | "contain" | "stretch"
|
|
17
|
+
/**
|
|
18
|
+
* Source sizing bounds in the local symbol coordinate space (mm, +X right, +Y up).
|
|
19
|
+
* With width/height, maps the bounds center to the symbol position; all artwork
|
|
20
|
+
* and ports use the same transform. Omitted uses automatic bounds including ports.
|
|
21
|
+
* maxX must exceed minX and maxY must exceed minY. No aliases; no change to existing defaults.
|
|
22
|
+
*/
|
|
23
|
+
viewbox?: {
|
|
24
|
+
minX: number | string
|
|
25
|
+
maxX: number | string
|
|
26
|
+
minY: number | string
|
|
27
|
+
maxY: number | string
|
|
28
|
+
}
|
|
15
29
|
name?: string
|
|
16
30
|
}
|
|
17
31
|
|
|
@@ -22,6 +36,23 @@ export const symbolProps = z.object({
|
|
|
22
36
|
.optional(),
|
|
23
37
|
width: distance.optional(),
|
|
24
38
|
height: distance.optional(),
|
|
39
|
+
fit: z.enum(["fill", "contain", "stretch"]).optional(),
|
|
40
|
+
viewbox: z
|
|
41
|
+
.object({
|
|
42
|
+
minX: distance,
|
|
43
|
+
maxX: distance,
|
|
44
|
+
minY: distance,
|
|
45
|
+
maxY: distance,
|
|
46
|
+
})
|
|
47
|
+
.refine((bounds) => bounds.maxX > bounds.minX, {
|
|
48
|
+
message: "viewbox maxX must exceed minX",
|
|
49
|
+
path: ["maxX"],
|
|
50
|
+
})
|
|
51
|
+
.refine((bounds) => bounds.maxY > bounds.minY, {
|
|
52
|
+
message: "viewbox maxY must exceed minY",
|
|
53
|
+
path: ["maxY"],
|
|
54
|
+
})
|
|
55
|
+
.optional(),
|
|
25
56
|
name: z.string().optional(),
|
|
26
57
|
})
|
|
27
58
|
|