@tscircuit/props 0.0.438 → 0.0.439
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 -0
- package/dist/index.d.ts +1136 -1
- package/dist/index.js +284 -266
- package/dist/index.js.map +1 -1
- package/lib/components/opamp.ts +42 -0
- package/lib/index.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CommonComponentProps,
|
|
3
|
+
commonComponentProps,
|
|
4
|
+
} from "lib/common/layout"
|
|
5
|
+
import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
6
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
7
|
+
import type { Connections } from "lib/utility-types/connections-and-selectors"
|
|
8
|
+
import { z } from "zod"
|
|
9
|
+
|
|
10
|
+
export const opampPinLabels = [
|
|
11
|
+
"inverting_input",
|
|
12
|
+
"non_inverting_input",
|
|
13
|
+
"output",
|
|
14
|
+
"positive_supply",
|
|
15
|
+
"negative_supply",
|
|
16
|
+
] as const
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pin labels for an op-amp component. This includes common aliases.
|
|
20
|
+
*/
|
|
21
|
+
export type OpAmpPinLabels = (typeof opampPinLabels)[number]
|
|
22
|
+
|
|
23
|
+
export interface OpAmpProps<PinLabel extends string = string>
|
|
24
|
+
extends CommonComponentProps<PinLabel> {
|
|
25
|
+
connections?: Connections<OpAmpPinLabels>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Zod schema for validating op-amp props.
|
|
30
|
+
*/
|
|
31
|
+
export const opampProps = commonComponentProps.extend({
|
|
32
|
+
connections: createConnectionsProp(opampPinLabels).optional(),
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The standard five pins for an op-amp.
|
|
37
|
+
* Used for building schematic symbols.
|
|
38
|
+
*/
|
|
39
|
+
export const opampPins = opampPinLabels
|
|
40
|
+
|
|
41
|
+
type InferredOpAmpProps = z.input<typeof opampProps>
|
|
42
|
+
expectTypesMatch<OpAmpProps, InferredOpAmpProps>(true)
|
package/lib/index.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from "./components/analogsimulation"
|
|
|
58
58
|
export * from "./manual-edits"
|
|
59
59
|
export * from "./components/transistor"
|
|
60
60
|
export * from "./components/mosfet"
|
|
61
|
+
export * from "./components/opamp"
|
|
61
62
|
export * from "./components/inductor"
|
|
62
63
|
export * from "./components/diode"
|
|
63
64
|
export * from "./components/led"
|