@tscircuit/props 0.0.575 → 0.0.577
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 +12 -2
- package/dist/index.d.ts +21 -5
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/lib/components/crystal.ts +8 -2
- package/lib/components/netlabel.ts +17 -9
- package/package.json +1 -1
|
@@ -3,7 +3,6 @@ import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
|
3
3
|
import {
|
|
4
4
|
type CommonComponentProps,
|
|
5
5
|
commonComponentProps,
|
|
6
|
-
lrPins,
|
|
7
6
|
} from "lib/common/layout"
|
|
8
7
|
import {
|
|
9
8
|
type SchematicOrientation,
|
|
@@ -15,7 +14,14 @@ import { z } from "zod"
|
|
|
15
14
|
|
|
16
15
|
export type PinVariant = "two_pin" | "four_pin"
|
|
17
16
|
|
|
18
|
-
export const crystalPins =
|
|
17
|
+
export const crystalPins = [
|
|
18
|
+
"pin1",
|
|
19
|
+
"left",
|
|
20
|
+
"pin2",
|
|
21
|
+
"right",
|
|
22
|
+
"pin3",
|
|
23
|
+
"pin4",
|
|
24
|
+
] as const
|
|
19
25
|
export type CrystalPinLabels = (typeof crystalPins)[number]
|
|
20
26
|
|
|
21
27
|
export interface CrystalProps<PinLabel extends string = string>
|
|
@@ -13,15 +13,23 @@ export interface NetLabelProps {
|
|
|
13
13
|
anchorSide?: "left" | "top" | "right" | "bottom"
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const netLabelProps = z
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
export const netLabelProps = z
|
|
17
|
+
.object({
|
|
18
|
+
net: z.string().optional(),
|
|
19
|
+
connection: z.string().optional(),
|
|
20
|
+
connectsTo: z.string().or(z.array(z.string())).optional(),
|
|
21
|
+
schX: distance.optional(),
|
|
22
|
+
schY: distance.optional(),
|
|
23
|
+
schRotation: rotation.optional(),
|
|
24
|
+
anchorSide: z.enum(["left", "top", "right", "bottom"]).optional(),
|
|
25
|
+
})
|
|
26
|
+
.refine(
|
|
27
|
+
(props) => props.net === undefined || props.connection === undefined,
|
|
28
|
+
{
|
|
29
|
+
message: "net and connection cannot be provided together",
|
|
30
|
+
path: ["connection"],
|
|
31
|
+
},
|
|
32
|
+
)
|
|
25
33
|
|
|
26
34
|
type InferredNetLabelProps = z.input<typeof netLabelProps>
|
|
27
35
|
expectTypesMatch<NetLabelProps, InferredNetLabelProps>(true)
|