|
1 | | -import { frequency, rotation, voltage } from "circuit-json" |
2 | | -import { |
3 | | - commonComponentProps, |
4 | | - type CommonComponentProps, |
5 | | -} from "@tscircuit/props" |
6 | | -import { z } from "zod" |
| 1 | +import { voltageSourceProps } from "@tscircuit/props" |
7 | 2 | import { NormalComponent } from "../base-components/NormalComponent/NormalComponent" |
8 | | -import { FTYPE, type BaseSymbolName, type Ftype } from "lib/utils/constants" |
| 3 | +import { type BaseSymbolName, type Ftype } from "lib/utils/constants" |
9 | 4 | import type { SimulationAcVoltageSource } from "circuit-json" |
10 | | -import { Port } from "../primitive-components/Port" |
| 5 | + |
11 | 6 | import type { RenderPhase } from "lib/components/base-components/Renderable" |
12 | 7 |
|
13 | 8 | export type WaveShape = "sinewave" | "square" | "triangle" | "sawtooth" |
14 | 9 |
|
15 | | -export interface VoltageSourceProps extends CommonComponentProps { |
16 | | - voltage?: number | string |
17 | | - frequency?: number | string |
18 | | - peakToPeakVoltage?: number | string |
19 | | - waveShape?: WaveShape |
20 | | - phase?: number | string |
21 | | - dutyCycle?: number |
22 | | -} |
23 | | - |
24 | | -export const voltageSourceProps = commonComponentProps.extend({ |
25 | | - voltage: voltage.optional(), |
26 | | - frequency: frequency.optional(), |
27 | | - peakToPeakVoltage: voltage.optional(), |
28 | | - waveShape: z.enum(["sinewave", "square", "triangle", "sawtooth"]).optional(), |
29 | | - phase: rotation.optional(), |
30 | | - dutyCycle: z.number().optional(), |
31 | | -}) |
32 | | - |
33 | 10 | export class VoltageSource extends NormalComponent< |
34 | 11 | typeof voltageSourceProps, |
35 | 12 | "terminal1" | "terminal2" |
|
0 commit comments