@tscircuit/props 0.0.712 → 0.0.713

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
@@ -2545,7 +2545,8 @@ export interface SymbolProps {
2545
2545
  * Source sizing bounds in the local symbol coordinate space (mm, +X right, +Y up).
2546
2546
  * With width/height, maps the bounds center to the symbol position; all artwork
2547
2547
  * and ports use the same transform. Omitted uses automatic bounds including ports.
2548
- * maxX must exceed minX and maxY must exceed minY. No aliases; no change to existing defaults.
2548
+ * maxX must exceed minX and maxY must exceed minY. Other shapes are rejected
2549
+ * with a diagnostic listing the required bounds. No aliases; existing defaults are unchanged.
2549
2550
  */
2550
2551
  viewbox?: {
2551
2552
  minX: number | string;
package/dist/index.d.ts CHANGED
@@ -168287,7 +168287,8 @@ interface SymbolProps {
168287
168287
  * Source sizing bounds in the local symbol coordinate space (mm, +X right, +Y up).
168288
168288
  * With width/height, maps the bounds center to the symbol position; all artwork
168289
168289
  * and ports use the same transform. Omitted uses automatic bounds including ports.
168290
- * maxX must exceed minX and maxY must exceed minY. No aliases; no change to existing defaults.
168290
+ * maxX must exceed minX and maxY must exceed minY. Other shapes are rejected
168291
+ * with a diagnostic listing the required bounds. No aliases; existing defaults are unchanged.
168291
168292
  */
168292
168293
  viewbox?: {
168293
168294
  minX: number | string;
@@ -168302,7 +168303,17 @@ declare const symbolProps: z.ZodObject<{
168302
168303
  width: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
168303
168304
  height: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
168304
168305
  fit: z.ZodOptional<z.ZodEnum<["fill", "contain", "stretch"]>>;
168305
- viewbox: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
168306
+ viewbox: z.ZodOptional<z.ZodPipeline<z.ZodType<{
168307
+ minX: string | number;
168308
+ maxX: string | number;
168309
+ minY: string | number;
168310
+ maxY: string | number;
168311
+ }, z.ZodTypeDef, {
168312
+ minX: string | number;
168313
+ maxX: string | number;
168314
+ minY: string | number;
168315
+ maxY: string | number;
168316
+ }>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
168306
168317
  minX: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
168307
168318
  maxX: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
168308
168319
  minY: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
@@ -168337,7 +168348,7 @@ declare const symbolProps: z.ZodObject<{
168337
168348
  maxX: string | number;
168338
168349
  minY: string | number;
168339
168350
  maxY: string | number;
168340
- }>>;
168351
+ }>>>;
168341
168352
  name: z.ZodOptional<z.ZodString>;
168342
168353
  }, "strip", z.ZodTypeAny, {
168343
168354
  width?: number | undefined;
package/dist/index.js CHANGED
@@ -18722,23 +18722,29 @@ expectTypesMatch(true);
18722
18722
 
18723
18723
  // lib/components/symbol.ts
18724
18724
  import { z as z100 } from "zod";
18725
+ var symbolViewboxBounds = z100.object({
18726
+ minX: distance,
18727
+ maxX: distance,
18728
+ minY: distance,
18729
+ maxY: distance
18730
+ }).refine((bounds) => bounds.maxX > bounds.minX, {
18731
+ message: "viewbox maxX must exceed minX",
18732
+ path: ["maxX"]
18733
+ }).refine((bounds) => bounds.maxY > bounds.minY, {
18734
+ message: "viewbox maxY must exceed minY",
18735
+ path: ["maxY"]
18736
+ });
18725
18737
  var symbolProps = z100.object({
18726
18738
  originalFacingDirection: z100.enum(["up", "down", "left", "right"]).default("right").optional(),
18727
18739
  width: distance.optional(),
18728
18740
  height: distance.optional(),
18729
18741
  fit: z100.enum(["fill", "contain", "stretch"]).optional(),
18730
- viewbox: z100.object({
18731
- minX: distance,
18732
- maxX: distance,
18733
- minY: distance,
18734
- maxY: distance
18735
- }).refine((bounds) => bounds.maxX > bounds.minX, {
18736
- message: "viewbox maxX must exceed minX",
18737
- path: ["maxX"]
18738
- }).refine((bounds) => bounds.maxY > bounds.minY, {
18739
- message: "viewbox maxY must exceed minY",
18740
- path: ["maxY"]
18741
- }).optional(),
18742
+ viewbox: z100.custom(
18743
+ (bounds) => typeof bounds === "object" && bounds !== null && "minX" in bounds && "maxX" in bounds && "minY" in bounds && "maxY" in bounds,
18744
+ {
18745
+ message: "viewbox requires { minX, maxX, minY, maxY } bounds in the local symbol coordinate space."
18746
+ }
18747
+ ).pipe(symbolViewboxBounds).optional(),
18742
18748
  name: z100.string().optional()
18743
18749
  });
18744
18750
  expectTypesMatch(true);