@tscircuit/props 0.0.668 → 0.0.669
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 +2 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/lib/common/schematicSize.ts +3 -2
- package/lib/components/diode.ts +8 -0
- package/lib/components/led.ts +4 -0
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { distance } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
3
|
|
|
4
|
-
export const schematicSymbolSize =
|
|
5
|
-
.
|
|
4
|
+
export const schematicSymbolSize = z
|
|
5
|
+
.enum(["xs", "sm", "default", "md"])
|
|
6
|
+
.or(distance.pipe(z.number().finite()))
|
|
6
7
|
.describe("distance between pin1 and pin2 of the schematic symbol")
|
|
7
8
|
|
|
8
9
|
export type SchematicSymbolSize = z.input<typeof schematicSymbolSize>
|
package/lib/components/diode.ts
CHANGED
|
@@ -11,6 +11,11 @@ import {
|
|
|
11
11
|
} from "lib/common/schematicOrientation"
|
|
12
12
|
import { schematicPinLabel } from "lib/common/schematicPinLabel"
|
|
13
13
|
|
|
14
|
+
import {
|
|
15
|
+
schematicSymbolSize,
|
|
16
|
+
type SchematicSymbolSize,
|
|
17
|
+
} from "lib/common/schematicSize"
|
|
18
|
+
|
|
14
19
|
export const diodePins = lrPolarPins
|
|
15
20
|
export type DiodePinLabels = (typeof diodePins)[number]
|
|
16
21
|
export type DiodePinLabelsProp<PinLabel extends string = string> = Partial<
|
|
@@ -60,6 +65,7 @@ export const diodeProps = commonComponentProps
|
|
|
60
65
|
photo: z.boolean().optional(),
|
|
61
66
|
tvs: z.boolean().optional(),
|
|
62
67
|
schOrientation: schematicOrientation.optional(),
|
|
68
|
+
schSize: schematicSymbolSize.optional(),
|
|
63
69
|
pinLabels: diodePinLabelsProp.optional(),
|
|
64
70
|
})
|
|
65
71
|
.superRefine((data, ctx) => {
|
|
@@ -146,6 +152,8 @@ export interface DiodeProps<PinLabel extends string = string>
|
|
|
146
152
|
photo?: boolean
|
|
147
153
|
tvs?: boolean
|
|
148
154
|
schOrientation?: SchematicOrientation
|
|
155
|
+
/** Select a compact schematic symbol; omitted, default, and md retain the standard symbol. */
|
|
156
|
+
schSize?: SchematicSymbolSize
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
export type InferredDiodeProps = z.input<typeof diodeProps>
|
package/lib/components/led.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
|
5
5
|
import { diodePinLabelsProp } from "lib/components/diode"
|
|
6
6
|
import { schematicPinLabel } from "lib/common/schematicPinLabel"
|
|
7
7
|
|
|
8
|
+
import { schematicSymbolSize } from "lib/common/schematicSize"
|
|
9
|
+
|
|
8
10
|
export type LedPinLabels = (typeof lrPolarPins)[number]
|
|
9
11
|
|
|
10
12
|
const legacyNumericLedPinLabelsProp = z
|
|
@@ -24,6 +26,8 @@ export const ledProps = commonComponentProps.extend({
|
|
|
24
26
|
wavelength: z.string().optional(),
|
|
25
27
|
schDisplayValue: z.string().optional(),
|
|
26
28
|
schOrientation: schematicOrientation.optional(),
|
|
29
|
+
/** Select a compact schematic symbol; omitted, default, and md retain the standard symbol. */
|
|
30
|
+
schSize: schematicSymbolSize.optional(),
|
|
27
31
|
// Numeric keys are accepted for compatibility with legacy generated LED
|
|
28
32
|
// wrappers, then normalized to the canonical pin1/pin2 representation.
|
|
29
33
|
pinLabels: diodePinLabelsProp.or(legacyNumericLedPinLabelsProp).optional(),
|