@tscircuit/props 0.0.189 → 0.0.191
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 +28 -0
- package/dist/index.d.ts +795 -1
- package/dist/index.js +338 -319
- package/dist/index.js.map +1 -1
- package/lib/components/connector.ts +53 -0
- package/lib/components/pin-header.ts +10 -0
- package/lib/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { distance } from "circuit-json"
|
|
2
|
+
import {
|
|
3
|
+
type CommonComponentProps,
|
|
4
|
+
commonComponentProps,
|
|
5
|
+
} from "lib/common/layout"
|
|
6
|
+
import {
|
|
7
|
+
type SchematicPortArrangement,
|
|
8
|
+
schematicPortArrangement,
|
|
9
|
+
} from "lib/common/schematicPinDefinitions"
|
|
10
|
+
import {
|
|
11
|
+
type SchematicPinStyle,
|
|
12
|
+
schematicPinStyle,
|
|
13
|
+
} from "lib/common/schematicPinStyle"
|
|
14
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
15
|
+
import { z } from "zod"
|
|
16
|
+
|
|
17
|
+
export interface ConnectorProps extends CommonComponentProps {
|
|
18
|
+
manufacturerPartNumber?: string
|
|
19
|
+
pinLabels?: Record<number | string, string | string[]>
|
|
20
|
+
schPinStyle?: SchematicPinStyle
|
|
21
|
+
schPinSpacing?: number | string
|
|
22
|
+
schWidth?: number | string
|
|
23
|
+
schHeight?: number | string
|
|
24
|
+
schDirection?: "left" | "right"
|
|
25
|
+
schPortArrangement?: SchematicPortArrangement
|
|
26
|
+
/**
|
|
27
|
+
* Groups of pins that are internally connected (bridged)
|
|
28
|
+
* e.g., [["1","2"], ["2","3"]]
|
|
29
|
+
*/
|
|
30
|
+
internallyConnectedPins?: string[][]
|
|
31
|
+
/**
|
|
32
|
+
* Connector standard, e.g. usb_c, m2
|
|
33
|
+
*/
|
|
34
|
+
standard?: "usb_c" | "m2"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const connectorProps = commonComponentProps.extend({
|
|
38
|
+
manufacturerPartNumber: z.string().optional(),
|
|
39
|
+
pinLabels: z
|
|
40
|
+
.record(z.number().or(z.string()), z.string().or(z.array(z.string())))
|
|
41
|
+
.optional(),
|
|
42
|
+
schPinStyle: schematicPinStyle.optional(),
|
|
43
|
+
schPinSpacing: distance.optional(),
|
|
44
|
+
schWidth: distance.optional(),
|
|
45
|
+
schHeight: distance.optional(),
|
|
46
|
+
schDirection: z.enum(["left", "right"]).optional(),
|
|
47
|
+
schPortArrangement: schematicPortArrangement.optional(),
|
|
48
|
+
internallyConnectedPins: z.array(z.array(z.string())).optional(),
|
|
49
|
+
standard: z.enum(["usb_c", "m2"]).optional(),
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
type InferredConnectorProps = z.input<typeof connectorProps>
|
|
53
|
+
expectTypesMatch<ConnectorProps, InferredConnectorProps>(true)
|
|
@@ -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/connector"
|
|
14
15
|
export * from "./components/fuse"
|
|
15
16
|
export * from "./components/platedhole"
|
|
16
17
|
|