@tscircuit/props 0.0.610 → 0.0.611

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.
@@ -3,15 +3,30 @@ import { schematicOrientation } from "lib/common/schematicOrientation"
3
3
  import { z } from "zod"
4
4
  import { createConnectionsProp } from "lib/common/connectionsProp"
5
5
  import { diodePinLabelsProp } from "lib/components/diode"
6
+ import { schematicPinLabel } from "lib/common/schematicPinLabel"
6
7
 
7
8
  export type LedPinLabels = (typeof lrPolarPins)[number]
8
9
 
10
+ const legacyNumericLedPinLabelsProp = z
11
+ .record(
12
+ z.enum(["1", "2"]),
13
+ schematicPinLabel
14
+ .or(z.array(schematicPinLabel).readonly())
15
+ .or(z.array(schematicPinLabel)),
16
+ )
17
+ .transform((pinLabels) => ({
18
+ ...(pinLabels["1"] === undefined ? {} : { pin1: pinLabels["1"] }),
19
+ ...(pinLabels["2"] === undefined ? {} : { pin2: pinLabels["2"] }),
20
+ }))
21
+
9
22
  export const ledProps = commonComponentProps.extend({
10
23
  color: z.string().optional(),
11
24
  wavelength: z.string().optional(),
12
25
  schDisplayValue: z.string().optional(),
13
26
  schOrientation: schematicOrientation.optional(),
14
- pinLabels: diodePinLabelsProp.optional(),
27
+ // Numeric keys are accepted for compatibility with legacy generated LED
28
+ // wrappers, then normalized to the canonical pin1/pin2 representation.
29
+ pinLabels: diodePinLabelsProp.or(legacyNumericLedPinLabelsProp).optional(),
15
30
  connections: createConnectionsProp(lrPolarPins).optional(),
16
31
  laser: z.boolean().optional(),
17
32
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.610",
3
+ "version": "0.0.611",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",