@tscircuit/props 0.0.642 → 0.0.644
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 +13 -1
- package/dist/index.d.ts +30 -4
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/lib/components/antenna.ts +39 -1
- package/lib/components/bus.ts +3 -3
- package/package.json +1 -1
|
@@ -6,8 +6,44 @@ import { type PcbPath, pcbPath } from "lib/common/pcbPath"
|
|
|
6
6
|
import { expectTypesMatch } from "lib/typecheck"
|
|
7
7
|
import { z } from "zod"
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/** Band-qualified PCB-trace antenna topologies. */
|
|
10
|
+
export const antennaShapes = [
|
|
11
|
+
"2.4ghz_quarter_wave_monopole",
|
|
12
|
+
"2.4ghz_meandered_monopole",
|
|
13
|
+
"2.4ghz_inverted_f",
|
|
14
|
+
"2.4ghz_meandered_inverted_f",
|
|
15
|
+
"2.4ghz_folded_dipole",
|
|
16
|
+
] as const
|
|
17
|
+
|
|
18
|
+
export type AntennaShape = (typeof antennaShapes)[number]
|
|
19
|
+
export const antennaShape = z.enum(antennaShapes)
|
|
20
|
+
|
|
21
|
+
/** Nominal Wi-Fi and Bluetooth operating-band configurations. */
|
|
22
|
+
export const antennaFrequencyBands = [
|
|
23
|
+
"2.4ghz",
|
|
24
|
+
"5ghz",
|
|
25
|
+
"6ghz",
|
|
26
|
+
"dual_band_2.4ghz_5ghz",
|
|
27
|
+
"tri_band_2.4ghz_5ghz_6ghz",
|
|
28
|
+
] as const
|
|
29
|
+
|
|
30
|
+
export type AntennaFrequencyBand = (typeof antennaFrequencyBands)[number]
|
|
31
|
+
export const antennaFrequencyBand = z.enum(antennaFrequencyBands)
|
|
32
|
+
|
|
33
|
+
/** Props for an antenna component with optional generated or explicit geometry. */
|
|
10
34
|
export interface AntennaProps extends CommonComponentProps {
|
|
35
|
+
/**
|
|
36
|
+
* Band-qualified PCB-trace topology to generate. The encoded band is enough
|
|
37
|
+
* to select the geometry without frequencyBand. No shape is assumed when
|
|
38
|
+
* omitted. An explicit pcbPath takes precedence when both are provided.
|
|
39
|
+
*/
|
|
40
|
+
antennaShape?: AntennaShape
|
|
41
|
+
/**
|
|
42
|
+
* Nominal operating band or multiband configuration. This is redundant when
|
|
43
|
+
* antennaShape is present; the band encoded in antennaShape controls generated
|
|
44
|
+
* geometry.
|
|
45
|
+
*/
|
|
46
|
+
frequencyBand?: AntennaFrequencyBand
|
|
11
47
|
/**
|
|
12
48
|
* Explicit antenna path. Entries use the same selector, point, and via
|
|
13
49
|
* syntax as trace pcbPath entries.
|
|
@@ -16,6 +52,8 @@ export interface AntennaProps extends CommonComponentProps {
|
|
|
16
52
|
}
|
|
17
53
|
|
|
18
54
|
export const antennaProps = commonComponentProps.extend({
|
|
55
|
+
antennaShape: antennaShape.optional(),
|
|
56
|
+
frequencyBand: antennaFrequencyBand.optional(),
|
|
19
57
|
pcbPath: pcbPath.optional(),
|
|
20
58
|
})
|
|
21
59
|
|
package/lib/components/bus.ts
CHANGED
|
@@ -10,12 +10,12 @@ import { z } from "zod"
|
|
|
10
10
|
export type BusName = string
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Declares
|
|
13
|
+
* Declares one or more connections that an autorouter should route as a group.
|
|
14
14
|
* Each connection may be a trace name or a port selector.
|
|
15
15
|
*/
|
|
16
16
|
export interface BusProps {
|
|
17
17
|
name?: string
|
|
18
|
-
/**
|
|
18
|
+
/** One or more trace names or port selectors for the connections in the bus. */
|
|
19
19
|
connections: string[]
|
|
20
20
|
/** If set, every trace in this bus is assigned to this autorouting phase. */
|
|
21
21
|
routingPhaseIndex?: number | null
|
|
@@ -35,7 +35,7 @@ export interface BusProps {
|
|
|
35
35
|
|
|
36
36
|
export const busProps = z.object({
|
|
37
37
|
name: z.string().optional(),
|
|
38
|
-
connections: z.array(z.string()).min(
|
|
38
|
+
connections: z.array(z.string()).min(1),
|
|
39
39
|
routingPhaseIndex: z.number().nullable().optional(),
|
|
40
40
|
maxLengthSkew: distance.pipe(z.number().min(0).finite()).optional(),
|
|
41
41
|
targetImpedance: resistance.pipe(z.number().positive().finite()).optional(),
|