@tscircuit/props 0.0.640 → 0.0.642
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 +21 -0
- package/dist/index.d.ts +5939 -527
- package/dist/index.js +1022 -1003
- package/dist/index.js.map +1 -1
- package/lib/common/pcbPath.ts +41 -0
- package/lib/components/antenna.ts +23 -0
- package/lib/components/trace.ts +2 -27
- package/lib/index.ts +2 -0
- package/lib/platformConfig.ts +6 -0
- package/lib/projectConfig.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { layer_ref, type LayerRefInput } from "circuit-json"
|
|
2
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
import { point, type Point } from "./point"
|
|
5
|
+
|
|
6
|
+
export interface PcbPathPoint extends Point {
|
|
7
|
+
via?: boolean
|
|
8
|
+
fromLayer?: LayerRefInput
|
|
9
|
+
toLayer?: LayerRefInput
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const basePcbPathPoint = point.extend({
|
|
13
|
+
via: z.boolean().optional(),
|
|
14
|
+
fromLayer: layer_ref.optional(),
|
|
15
|
+
toLayer: layer_ref.optional(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const pcbPathPoint = basePcbPathPoint.superRefine((value, ctx) => {
|
|
19
|
+
if (value.via) {
|
|
20
|
+
if (!value.toLayer) {
|
|
21
|
+
ctx.addIssue({
|
|
22
|
+
code: z.ZodIssueCode.custom,
|
|
23
|
+
message: "toLayer is required when via is true",
|
|
24
|
+
path: ["toLayer"],
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
} else if (value.fromLayer || value.toLayer) {
|
|
28
|
+
ctx.addIssue({
|
|
29
|
+
code: z.ZodIssueCode.custom,
|
|
30
|
+
message: "fromLayer/toLayer are only allowed when via is true",
|
|
31
|
+
path: ["via"],
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export const pcbPath = z.array(z.union([pcbPathPoint, z.string()]))
|
|
37
|
+
|
|
38
|
+
export type PcbPath = Array<PcbPathPoint | string>
|
|
39
|
+
|
|
40
|
+
expectTypesMatch<PcbPathPoint, z.input<typeof pcbPathPoint>>(true)
|
|
41
|
+
expectTypesMatch<PcbPath, z.input<typeof pcbPath>>(true)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CommonComponentProps,
|
|
3
|
+
commonComponentProps,
|
|
4
|
+
} from "lib/common/layout"
|
|
5
|
+
import { type PcbPath, pcbPath } from "lib/common/pcbPath"
|
|
6
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
7
|
+
import { z } from "zod"
|
|
8
|
+
|
|
9
|
+
/** Props for an antenna component with an optional explicit PCB path. */
|
|
10
|
+
export interface AntennaProps extends CommonComponentProps {
|
|
11
|
+
/**
|
|
12
|
+
* Explicit antenna path. Entries use the same selector, point, and via
|
|
13
|
+
* syntax as trace pcbPath entries.
|
|
14
|
+
*/
|
|
15
|
+
pcbPath?: PcbPath
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const antennaProps = commonComponentProps.extend({
|
|
19
|
+
pcbPath: pcbPath.optional(),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
type InferredAntennaProps = z.input<typeof antennaProps>
|
|
23
|
+
expectTypesMatch<AntennaProps, InferredAntennaProps>(true)
|
package/lib/components/trace.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { distance,
|
|
1
|
+
import { distance, route_hint_point } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
3
|
import { point } from "../common/point"
|
|
4
|
+
import { pcbPath } from "../common/pcbPath"
|
|
4
5
|
|
|
5
6
|
export const portRef = z.union([
|
|
6
7
|
z.string(),
|
|
@@ -13,32 +14,6 @@ export const portRef = z.union([
|
|
|
13
14
|
),
|
|
14
15
|
])
|
|
15
16
|
|
|
16
|
-
const pcbPathPoint = point
|
|
17
|
-
.extend({
|
|
18
|
-
via: z.boolean().optional(),
|
|
19
|
-
fromLayer: layer_ref.optional(),
|
|
20
|
-
toLayer: layer_ref.optional(),
|
|
21
|
-
})
|
|
22
|
-
.superRefine((value, ctx) => {
|
|
23
|
-
if (value.via) {
|
|
24
|
-
if (!value.toLayer) {
|
|
25
|
-
ctx.addIssue({
|
|
26
|
-
code: z.ZodIssueCode.custom,
|
|
27
|
-
message: "toLayer is required when via is true",
|
|
28
|
-
path: ["toLayer"],
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
} else if (value.fromLayer || value.toLayer) {
|
|
32
|
-
ctx.addIssue({
|
|
33
|
-
code: z.ZodIssueCode.custom,
|
|
34
|
-
message: "fromLayer/toLayer are only allowed when via is true",
|
|
35
|
-
path: ["via"],
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const pcbPath = z.array(z.union([pcbPathPoint, z.string()]))
|
|
41
|
-
|
|
42
17
|
const baseTraceProps = z.object({
|
|
43
18
|
key: z.string().optional(),
|
|
44
19
|
name: z.string().optional(),
|
package/lib/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./common/portHints"
|
|
|
6
6
|
export * from "./common/layout"
|
|
7
7
|
export * from "./common/pinAttributeMap"
|
|
8
8
|
export * from "./common/point3"
|
|
9
|
+
export * from "./common/pcbPath"
|
|
9
10
|
export * from "./common/portHints"
|
|
10
11
|
export * from "./common/footprintProp"
|
|
11
12
|
export * from "./common/symbolProp"
|
|
@@ -57,6 +58,7 @@ export * from "./components/drc-check"
|
|
|
57
58
|
export * from "./components/smtpad"
|
|
58
59
|
export * from "./components/solderpaste"
|
|
59
60
|
export * from "./components/hole"
|
|
61
|
+
export * from "./components/antenna"
|
|
60
62
|
export * from "./components/trace"
|
|
61
63
|
export * from "./components/bus"
|
|
62
64
|
export * from "./components/differentialpair"
|
package/lib/platformConfig.ts
CHANGED
|
@@ -113,6 +113,11 @@ export interface PlatformConfig {
|
|
|
113
113
|
routingDisabled?: boolean
|
|
114
114
|
schematicDisabled?: boolean
|
|
115
115
|
partsEngineDisabled?: boolean
|
|
116
|
+
/**
|
|
117
|
+
* Disables analog simulation model processing and simulator execution.
|
|
118
|
+
* Defaults to false.
|
|
119
|
+
*/
|
|
120
|
+
analogSimulationDisabled?: boolean
|
|
116
121
|
drcChecksDisabled?: boolean
|
|
117
122
|
netlistDrcChecksDisabled?: boolean
|
|
118
123
|
routingDrcChecksDisabled?: boolean
|
|
@@ -266,6 +271,7 @@ export const platformConfig = z.object({
|
|
|
266
271
|
routingDisabled: z.boolean().optional(),
|
|
267
272
|
schematicDisabled: z.boolean().optional(),
|
|
268
273
|
partsEngineDisabled: z.boolean().optional(),
|
|
274
|
+
analogSimulationDisabled: z.boolean().optional(),
|
|
269
275
|
drcChecksDisabled: z.boolean().optional(),
|
|
270
276
|
netlistDrcChecksDisabled: z.boolean().optional(),
|
|
271
277
|
routingDrcChecksDisabled: z.boolean().optional(),
|
package/lib/projectConfig.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface ProjectConfig
|
|
|
15
15
|
| "defaultSpiceEngine"
|
|
16
16
|
| "pcbDisabled"
|
|
17
17
|
| "schematicDisabled"
|
|
18
|
+
| "analogSimulationDisabled"
|
|
18
19
|
> {}
|
|
19
20
|
|
|
20
21
|
const platformConfigObject = platformConfig as z.ZodObject<any>
|
|
@@ -30,6 +31,7 @@ export const projectConfig = platformConfigObject.pick({
|
|
|
30
31
|
defaultSpiceEngine: true,
|
|
31
32
|
pcbDisabled: true,
|
|
32
33
|
schematicDisabled: true,
|
|
34
|
+
analogSimulationDisabled: true,
|
|
33
35
|
}) as z.ZodType<ProjectConfig>
|
|
34
36
|
|
|
35
37
|
expectTypesMatch<ProjectConfig, z.infer<typeof projectConfig>>(true)
|