@tscircuit/props 0.0.569 → 0.0.571
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 +3 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +136 -134
- package/dist/index.js.map +1 -1
- package/lib/components/crystal.ts +7 -4
- package/lib/components/mosfet.ts +14 -10
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { capacitance, distance, frequency } from "circuit-json"
|
|
2
|
+
import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
2
3
|
import {
|
|
3
4
|
type CommonComponentProps,
|
|
4
5
|
commonComponentProps,
|
|
5
6
|
lrPins,
|
|
6
7
|
} from "lib/common/layout"
|
|
7
|
-
import type { Connections } from "lib/utility-types/connections-and-selectors"
|
|
8
|
-
import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
9
8
|
import {
|
|
10
|
-
schematicOrientation,
|
|
11
9
|
type SchematicOrientation,
|
|
10
|
+
schematicOrientation,
|
|
12
11
|
} from "lib/common/schematicOrientation"
|
|
13
12
|
import { expectTypesMatch } from "lib/typecheck"
|
|
13
|
+
import type { Connections } from "lib/utility-types/connections-and-selectors"
|
|
14
14
|
import { z } from "zod"
|
|
15
15
|
|
|
16
16
|
export type PinVariant = "two_pin" | "four_pin"
|
|
@@ -22,6 +22,8 @@ export interface CrystalProps<PinLabel extends string = string>
|
|
|
22
22
|
extends CommonComponentProps<PinLabel> {
|
|
23
23
|
frequency: number | string
|
|
24
24
|
loadCapacitance: number | string
|
|
25
|
+
/** Maximum allowed PCB trace length between the crystal and its connected component */
|
|
26
|
+
maxTraceLength?: number | string
|
|
25
27
|
manufacturerPartNumber?: string
|
|
26
28
|
mpn?: string
|
|
27
29
|
pinVariant?: PinVariant
|
|
@@ -32,6 +34,7 @@ export interface CrystalProps<PinLabel extends string = string>
|
|
|
32
34
|
export const crystalProps = commonComponentProps.extend({
|
|
33
35
|
frequency: frequency,
|
|
34
36
|
loadCapacitance: capacitance,
|
|
37
|
+
maxTraceLength: distance.optional(),
|
|
35
38
|
manufacturerPartNumber: z.string().optional(),
|
|
36
39
|
mpn: z.string().optional(),
|
|
37
40
|
pinVariant: z.enum(["two_pin", "four_pin"]).optional(),
|
package/lib/components/mosfet.ts
CHANGED
|
@@ -2,29 +2,33 @@ import {
|
|
|
2
2
|
type CommonComponentProps,
|
|
3
3
|
commonComponentProps,
|
|
4
4
|
} from "../common/layout"
|
|
5
|
+
import { createConnectionsProp } from "../common/connectionsProp"
|
|
5
6
|
import { expectTypesMatch } from "../typecheck"
|
|
7
|
+
import type { Connections } from "../utility-types/connections-and-selectors"
|
|
6
8
|
import { z } from "zod"
|
|
7
9
|
|
|
10
|
+
export const mosfetPins = [
|
|
11
|
+
"pin1",
|
|
12
|
+
"drain",
|
|
13
|
+
"pin2",
|
|
14
|
+
"source",
|
|
15
|
+
"pin3",
|
|
16
|
+
"gate",
|
|
17
|
+
] as const
|
|
18
|
+
export type MosfetPinLabels = (typeof mosfetPins)[number]
|
|
19
|
+
|
|
8
20
|
export interface MosfetProps<PinLabel extends string = string>
|
|
9
21
|
extends CommonComponentProps<PinLabel> {
|
|
10
22
|
channelType: "n" | "p"
|
|
11
23
|
mosfetMode: "enhancement" | "depletion"
|
|
24
|
+
connections?: Connections<MosfetPinLabels>
|
|
12
25
|
}
|
|
13
26
|
|
|
14
27
|
export const mosfetProps = commonComponentProps.extend({
|
|
15
28
|
channelType: z.enum(["n", "p"]),
|
|
16
29
|
mosfetMode: z.enum(["enhancement", "depletion"]),
|
|
30
|
+
connections: createConnectionsProp(mosfetPins).optional(),
|
|
17
31
|
})
|
|
18
32
|
|
|
19
|
-
export const mosfetPins = [
|
|
20
|
-
"pin1",
|
|
21
|
-
"drain",
|
|
22
|
-
"pin2",
|
|
23
|
-
"source",
|
|
24
|
-
"pin3",
|
|
25
|
-
"gate",
|
|
26
|
-
] as const
|
|
27
|
-
export type MosfetPinLabels = (typeof mosfetPins)[number]
|
|
28
|
-
|
|
29
33
|
type InferredMosfetProps = z.input<typeof mosfetProps>
|
|
30
34
|
expectTypesMatch<MosfetProps, InferredMosfetProps>(true)
|