@tscircuit/props 0.0.546 → 0.0.548
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 +8 -0
- package/dist/index.d.ts +101 -1
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/lib/components/analogsimulation.ts +18 -0
- package/lib/components/voltageprobe.ts +18 -0
- package/lib/components/voltagesource.ts +11 -1
- package/package.json +1 -1
|
@@ -6,21 +6,39 @@ import { z } from "zod"
|
|
|
6
6
|
export interface AnalogSimulationProps {
|
|
7
7
|
simulationType?: "spice_transient_analysis"
|
|
8
8
|
duration?: number | string
|
|
9
|
+
startTime?: number | string
|
|
9
10
|
timePerStep?: number | string
|
|
10
11
|
spiceEngine?: AutocompleteString<"spicey" | "ngspice">
|
|
12
|
+
spiceOptions?: SpiceOptions
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
const spiceEngine = z.custom<AutocompleteString<"spicey" | "ngspice">>(
|
|
14
16
|
(value) => typeof value === "string",
|
|
15
17
|
)
|
|
16
18
|
|
|
19
|
+
export interface SpiceOptions {
|
|
20
|
+
method?: "trap" | "gear"
|
|
21
|
+
reltol?: number | string
|
|
22
|
+
abstol?: number | string
|
|
23
|
+
vntol?: number | string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const spiceOptions = z.object({
|
|
27
|
+
method: z.enum(["trap", "gear"]).optional(),
|
|
28
|
+
reltol: z.union([z.number(), z.string()]).optional(),
|
|
29
|
+
abstol: z.union([z.number(), z.string()]).optional(),
|
|
30
|
+
vntol: z.union([z.number(), z.string()]).optional(),
|
|
31
|
+
})
|
|
32
|
+
|
|
17
33
|
export const analogSimulationProps = z.object({
|
|
18
34
|
simulationType: z
|
|
19
35
|
.literal("spice_transient_analysis")
|
|
20
36
|
.default("spice_transient_analysis"),
|
|
21
37
|
duration: ms.optional(),
|
|
38
|
+
startTime: ms.optional(),
|
|
22
39
|
timePerStep: ms.optional(),
|
|
23
40
|
spiceEngine: spiceEngine.optional(),
|
|
41
|
+
spiceOptions: spiceOptions.optional(),
|
|
24
42
|
})
|
|
25
43
|
|
|
26
44
|
expectTypesMatch<AnalogSimulationProps, z.input<typeof analogSimulationProps>>(
|
|
@@ -10,6 +10,15 @@ export interface VoltageProbeProps extends Omit<CommonComponentProps, "name"> {
|
|
|
10
10
|
connectsTo: string
|
|
11
11
|
referenceTo?: string
|
|
12
12
|
color?: string
|
|
13
|
+
display?: VoltageProbeDisplayOptions
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface VoltageProbeDisplayOptions {
|
|
17
|
+
label?: string
|
|
18
|
+
center?: number
|
|
19
|
+
offsetDivs?: number
|
|
20
|
+
unitsPerDiv?: number
|
|
21
|
+
color?: string
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
export const voltageProbeProps = commonComponentProps
|
|
@@ -19,6 +28,15 @@ export const voltageProbeProps = commonComponentProps
|
|
|
19
28
|
connectsTo: z.string(),
|
|
20
29
|
referenceTo: z.string().optional(),
|
|
21
30
|
color: z.string().optional(),
|
|
31
|
+
display: z
|
|
32
|
+
.object({
|
|
33
|
+
label: z.string().optional(),
|
|
34
|
+
center: z.number().optional(),
|
|
35
|
+
offsetDivs: z.number().optional(),
|
|
36
|
+
unitsPerDiv: z.number().optional(),
|
|
37
|
+
color: z.string().optional(),
|
|
38
|
+
})
|
|
39
|
+
.optional(),
|
|
22
40
|
})
|
|
23
41
|
|
|
24
42
|
expectTypesMatch<VoltageProbeProps, z.input<typeof voltageProbeProps>>(true)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { frequency, rotation, voltage } from "circuit-json"
|
|
1
|
+
import { frequency, ms, rotation, voltage } from "circuit-json"
|
|
2
2
|
import {
|
|
3
3
|
type CommonComponentProps,
|
|
4
4
|
commonComponentProps,
|
|
@@ -22,6 +22,11 @@ export interface VoltageSourceProps<PinLabel extends string = string>
|
|
|
22
22
|
waveShape?: WaveShape
|
|
23
23
|
phase?: number | string
|
|
24
24
|
dutyCycle?: number | string
|
|
25
|
+
pulseDelay?: number | string
|
|
26
|
+
riseTime?: number | string
|
|
27
|
+
fallTime?: number | string
|
|
28
|
+
pulseWidth?: number | string
|
|
29
|
+
period?: number | string
|
|
25
30
|
connections?: Connections<VoltageSourcePinLabels>
|
|
26
31
|
}
|
|
27
32
|
|
|
@@ -50,6 +55,11 @@ export const voltageSourceProps = commonComponentProps.extend({
|
|
|
50
55
|
waveShape: z.enum(["sinewave", "square", "triangle", "sawtooth"]).optional(),
|
|
51
56
|
phase: rotation.optional(),
|
|
52
57
|
dutyCycle: percentage.optional(),
|
|
58
|
+
pulseDelay: ms.optional(),
|
|
59
|
+
riseTime: ms.optional(),
|
|
60
|
+
fallTime: ms.optional(),
|
|
61
|
+
pulseWidth: ms.optional(),
|
|
62
|
+
period: ms.optional(),
|
|
53
63
|
connections: createConnectionsProp(voltageSourcePinLabels).optional(),
|
|
54
64
|
})
|
|
55
65
|
|