@tscircuit/props 0.0.565 → 0.0.566
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 +1 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/lib/components/diode.ts +16 -3
- package/package.json +1 -1
package/lib/components/diode.ts
CHANGED
|
@@ -9,6 +9,13 @@ import {
|
|
|
9
9
|
schematicOrientation,
|
|
10
10
|
type SchematicOrientation,
|
|
11
11
|
} from "lib/common/schematicOrientation"
|
|
12
|
+
import { schematicPinLabel } from "lib/common/schematicPinLabel"
|
|
13
|
+
|
|
14
|
+
export const diodePins = lrPolarPins
|
|
15
|
+
export type DiodePinLabels = (typeof diodePins)[number]
|
|
16
|
+
export type DiodePinLabelsProp<PinLabel extends string = string> = Partial<
|
|
17
|
+
Record<DiodePinLabels, PinLabel | PinLabel[] | readonly PinLabel[]>
|
|
18
|
+
>
|
|
12
19
|
|
|
13
20
|
const diodeConnectionKeys = z.enum([
|
|
14
21
|
"anode",
|
|
@@ -26,6 +33,13 @@ const connectionTarget = z
|
|
|
26
33
|
|
|
27
34
|
const connectionsProp = z.record(diodeConnectionKeys, connectionTarget)
|
|
28
35
|
|
|
36
|
+
const diodePinLabelsProp = z.record(
|
|
37
|
+
z.enum(diodePins),
|
|
38
|
+
schematicPinLabel
|
|
39
|
+
.or(z.array(schematicPinLabel).readonly())
|
|
40
|
+
.or(z.array(schematicPinLabel)),
|
|
41
|
+
)
|
|
42
|
+
|
|
29
43
|
const diodeVariant = z.enum([
|
|
30
44
|
"standard",
|
|
31
45
|
"schottky",
|
|
@@ -46,6 +60,7 @@ export const diodeProps = commonComponentProps
|
|
|
46
60
|
photo: z.boolean().optional(),
|
|
47
61
|
tvs: z.boolean().optional(),
|
|
48
62
|
schOrientation: schematicOrientation.optional(),
|
|
63
|
+
pinLabels: diodePinLabelsProp.optional(),
|
|
49
64
|
})
|
|
50
65
|
.superRefine((data, ctx) => {
|
|
51
66
|
// Check if multiple boolean flags are set directly
|
|
@@ -112,11 +127,9 @@ export const diodeProps = commonComponentProps
|
|
|
112
127
|
return result
|
|
113
128
|
})
|
|
114
129
|
|
|
115
|
-
export const diodePins = lrPolarPins
|
|
116
|
-
export type DiodePinLabels = (typeof diodePins)[number]
|
|
117
|
-
|
|
118
130
|
export interface DiodeProps<PinLabel extends string = string>
|
|
119
131
|
extends CommonComponentProps<PinLabel> {
|
|
132
|
+
pinLabels?: DiodePinLabelsProp<PinLabel>
|
|
120
133
|
connections?: {
|
|
121
134
|
anode?: string | string[] | readonly string[]
|
|
122
135
|
cathode?: string | string[] | readonly string[]
|