@tscircuit/props 0.0.190 → 0.0.192
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 +643 -1
- package/dist/index.js +338 -319
- package/dist/index.js.map +1 -1
- package/lib/components/connector.ts +53 -0
- package/lib/index.ts +1 -0
- package/lib/platformConfig.ts +6 -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)
|
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
|
|
package/lib/platformConfig.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface PlatformConfig {
|
|
|
15
15
|
registryApiUrl?: string
|
|
16
16
|
|
|
17
17
|
cloudAutorouterUrl?: string
|
|
18
|
+
|
|
19
|
+
footprintLibraryMap?: Record<string, Record<string, any[]>>
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export const platformConfig = z.object({
|
|
@@ -22,6 +24,10 @@ export const platformConfig = z.object({
|
|
|
22
24
|
autorouter: autorouterProp.optional(),
|
|
23
25
|
registryApiUrl: z.string().optional(),
|
|
24
26
|
cloudAutorouterUrl: z.string().optional(),
|
|
27
|
+
|
|
28
|
+
footprintLibraryMap: z
|
|
29
|
+
.record(z.string(), z.record(z.string(), z.any().array()))
|
|
30
|
+
.optional(),
|
|
25
31
|
})
|
|
26
32
|
|
|
27
33
|
expectTypesMatch<PlatformConfig, z.infer<typeof platformConfig>>(true)
|