@tscircuit/props 0.0.188 → 0.0.190
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/dist/index.d.ts +593 -3
- package/dist/index.js +240 -220
- package/dist/index.js.map +1 -1
- package/lib/components/fuse.ts +56 -0
- package/lib/components/pin-header.ts +10 -0
- package/lib/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import {
|
|
3
|
+
type CommonComponentProps,
|
|
4
|
+
commonComponentProps,
|
|
5
|
+
} from "lib/common/layout"
|
|
6
|
+
import type { Connections } from "lib/utility-types/connections-and-selectors"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Pin labels for fuse component
|
|
10
|
+
*/
|
|
11
|
+
export const fusePinLabels = ["pin1", "pin2"] as const
|
|
12
|
+
|
|
13
|
+
export type FusePinLabels = (typeof fusePinLabels)[number]
|
|
14
|
+
|
|
15
|
+
export interface FuseProps extends CommonComponentProps {
|
|
16
|
+
/**
|
|
17
|
+
* Current rating of the fuse in amperes
|
|
18
|
+
*/
|
|
19
|
+
currentRating: number | string
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Voltage rating of the fuse
|
|
23
|
+
*/
|
|
24
|
+
voltageRating?: number | string
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether to show ratings on schematic
|
|
28
|
+
*/
|
|
29
|
+
schShowRatings?: boolean
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Connections to other components
|
|
33
|
+
*/
|
|
34
|
+
connections?: Connections<FusePinLabels>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Schema for validating fuse props
|
|
39
|
+
*/
|
|
40
|
+
export const fuseProps = commonComponentProps.extend({
|
|
41
|
+
currentRating: z.union([z.number(), z.string()]),
|
|
42
|
+
voltageRating: z.union([z.number(), z.string()]).optional(),
|
|
43
|
+
schShowRatings: z.boolean().optional(),
|
|
44
|
+
connections: z
|
|
45
|
+
.record(
|
|
46
|
+
z.string(),
|
|
47
|
+
z.union([
|
|
48
|
+
z.string(),
|
|
49
|
+
z.array(z.string()).readonly(),
|
|
50
|
+
z.array(z.string()),
|
|
51
|
+
]),
|
|
52
|
+
)
|
|
53
|
+
.optional(),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export type InferredFuseProps = z.input<typeof fuseProps>
|
|
@@ -3,6 +3,10 @@ import {
|
|
|
3
3
|
type CommonComponentProps,
|
|
4
4
|
commonComponentProps,
|
|
5
5
|
} from "lib/common/layout"
|
|
6
|
+
import {
|
|
7
|
+
schematicPinArrangement,
|
|
8
|
+
type SchematicPinArrangement,
|
|
9
|
+
} from "lib/common/schematicPinDefinitions"
|
|
6
10
|
import { expectTypesMatch } from "lib/typecheck"
|
|
7
11
|
import { z } from "zod"
|
|
8
12
|
|
|
@@ -56,6 +60,11 @@ export interface PinHeaderProps extends CommonComponentProps {
|
|
|
56
60
|
* Direction the header is facing
|
|
57
61
|
*/
|
|
58
62
|
facingDirection?: "left" | "right"
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Pin arrangement in schematic view
|
|
66
|
+
*/
|
|
67
|
+
schPinArrangement?: SchematicPinArrangement
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
export const pinHeaderProps = commonComponentProps.extend({
|
|
@@ -69,6 +78,7 @@ export const pinHeaderProps = commonComponentProps.extend({
|
|
|
69
78
|
platedDiameter: distance.optional(),
|
|
70
79
|
pinLabels: z.array(z.string()).optional(),
|
|
71
80
|
facingDirection: z.enum(["left", "right"]).optional(),
|
|
81
|
+
schPinArrangement: schematicPinArrangement.optional(),
|
|
72
82
|
})
|
|
73
83
|
|
|
74
84
|
type InferredPinHeaderProps = z.input<typeof pinHeaderProps>
|
package/lib/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./common/cadModel"
|
|
|
11
11
|
export * from "./components/board"
|
|
12
12
|
export * from "./components/chip"
|
|
13
13
|
export * from "./components/jumper"
|
|
14
|
+
export * from "./components/fuse"
|
|
14
15
|
export * from "./components/platedhole"
|
|
15
16
|
|
|
16
17
|
export * from "./components/resistor"
|