@tscircuit/props 0.0.546 → 0.0.547
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 +7 -0
- package/dist/index.d.ts +60 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/lib/components/analogsimulation.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>>(
|
|
@@ -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
|
|