@tscircuit/props 0.0.435 → 0.0.436
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/dist/index.d.ts +83 -8
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/lib/components/schematic-arc.ts +17 -1
- package/lib/components/schematic-box.ts +25 -1
- package/lib/components/schematic-circle.ts +18 -1
- package/lib/components/schematic-line.ts +16 -1
- package/lib/components/schematic-path.ts +12 -1
- package/lib/components/schematic-rect.ts +19 -1
- package/lib/components/schematic-text.ts +16 -1
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { distance, point, rotation } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import type { Point } from "lib/common/point"
|
|
5
|
+
import type { Distance } from "lib/common/distance"
|
|
3
6
|
|
|
4
7
|
export const schematicArcProps = z.object({
|
|
5
8
|
center: point,
|
|
@@ -14,4 +17,17 @@ export const schematicArcProps = z.object({
|
|
|
14
17
|
isDashed: z.boolean().optional().default(false),
|
|
15
18
|
})
|
|
16
19
|
|
|
17
|
-
export
|
|
20
|
+
export interface SchematicArcProps {
|
|
21
|
+
center: Point
|
|
22
|
+
radius: Distance
|
|
23
|
+
startAngleDegrees: number | string
|
|
24
|
+
endAngleDegrees: number | string
|
|
25
|
+
direction?: "clockwise" | "counterclockwise"
|
|
26
|
+
strokeWidth?: Distance
|
|
27
|
+
color?: string
|
|
28
|
+
isDashed?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type InferredSchematicArcProps = z.input<typeof schematicArcProps>
|
|
32
|
+
|
|
33
|
+
expectTypesMatch<SchematicArcProps, z.input<typeof schematicArcProps>>(true)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { distance } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
3
|
import { ninePointAnchor } from "lib/common/ninePointAnchor"
|
|
4
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
5
|
+
import type { Distance } from "lib/common/distance"
|
|
4
6
|
|
|
5
7
|
export const schematicBoxProps = z
|
|
6
8
|
.object({
|
|
@@ -45,4 +47,26 @@ export const schematicBoxProps = z
|
|
|
45
47
|
"Cannot provide both `width`/`height` and `overlay` at the same time.",
|
|
46
48
|
},
|
|
47
49
|
)
|
|
48
|
-
|
|
50
|
+
|
|
51
|
+
export interface SchematicBoxProps {
|
|
52
|
+
schX?: Distance
|
|
53
|
+
schY?: Distance
|
|
54
|
+
width?: Distance
|
|
55
|
+
height?: Distance
|
|
56
|
+
overlay?: string[]
|
|
57
|
+
padding?: Distance
|
|
58
|
+
paddingLeft?: Distance
|
|
59
|
+
paddingRight?: Distance
|
|
60
|
+
paddingTop?: Distance
|
|
61
|
+
paddingBottom?: Distance
|
|
62
|
+
title?: string
|
|
63
|
+
titleAlignment?: z.infer<typeof ninePointAnchor>
|
|
64
|
+
titleColor?: string
|
|
65
|
+
titleFontSize?: Distance
|
|
66
|
+
titleInside?: boolean
|
|
67
|
+
strokeStyle?: "solid" | "dashed"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type InferredSchematicBoxProps = z.input<typeof schematicBoxProps>
|
|
71
|
+
|
|
72
|
+
expectTypesMatch<SchematicBoxProps, z.input<typeof schematicBoxProps>>(true)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { distance, point } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import type { Point } from "lib/common/point"
|
|
5
|
+
import type { Distance } from "lib/common/distance"
|
|
3
6
|
|
|
4
7
|
export const schematicCircleProps = z.object({
|
|
5
8
|
center: point,
|
|
@@ -11,4 +14,18 @@ export const schematicCircleProps = z.object({
|
|
|
11
14
|
isDashed: z.boolean().optional().default(false),
|
|
12
15
|
})
|
|
13
16
|
|
|
14
|
-
export
|
|
17
|
+
export interface SchematicCircleProps {
|
|
18
|
+
center: Point
|
|
19
|
+
radius: Distance
|
|
20
|
+
strokeWidth?: Distance
|
|
21
|
+
color?: string
|
|
22
|
+
isFilled?: boolean
|
|
23
|
+
fillColor?: string
|
|
24
|
+
isDashed?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type InferredSchematicCircleProps = z.input<typeof schematicCircleProps>
|
|
28
|
+
|
|
29
|
+
expectTypesMatch<SchematicCircleProps, z.input<typeof schematicCircleProps>>(
|
|
30
|
+
true,
|
|
31
|
+
)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { distance } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import type { Distance } from "lib/common/distance"
|
|
3
5
|
|
|
4
6
|
export const schematicLineProps = z.object({
|
|
5
7
|
x1: distance,
|
|
@@ -10,4 +12,17 @@ export const schematicLineProps = z.object({
|
|
|
10
12
|
color: z.string().optional(),
|
|
11
13
|
isDashed: z.boolean().optional().default(false),
|
|
12
14
|
})
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
export interface SchematicLineProps {
|
|
17
|
+
x1: Distance
|
|
18
|
+
y1: Distance
|
|
19
|
+
x2: Distance
|
|
20
|
+
y2: Distance
|
|
21
|
+
strokeWidth?: Distance
|
|
22
|
+
color?: string
|
|
23
|
+
isDashed?: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type InferredSchematicLineProps = z.input<typeof schematicLineProps>
|
|
27
|
+
|
|
28
|
+
expectTypesMatch<SchematicLineProps, z.input<typeof schematicLineProps>>(true)
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { point } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import type { Point } from "lib/common/point"
|
|
3
5
|
|
|
4
6
|
export const schematicPathProps = z.object({
|
|
5
7
|
points: z.array(point),
|
|
6
8
|
isFilled: z.boolean().optional().default(false),
|
|
7
9
|
fillColor: z.enum(["red", "blue"]).optional(),
|
|
8
10
|
})
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
export interface SchematicPathProps {
|
|
13
|
+
points: Point[]
|
|
14
|
+
isFilled?: boolean
|
|
15
|
+
fillColor?: "red" | "blue"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type InferredSchematicPathProps = z.input<typeof schematicPathProps>
|
|
19
|
+
|
|
20
|
+
expectTypesMatch<SchematicPathProps, z.input<typeof schematicPathProps>>(true)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { distance, point, rotation } from "circuit-json"
|
|
2
2
|
import { z } from "zod"
|
|
3
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
4
|
+
import type { Distance } from "lib/common/distance"
|
|
3
5
|
|
|
4
6
|
export const schematicRectProps = z.object({
|
|
5
7
|
schX: distance.optional(),
|
|
@@ -15,4 +17,20 @@ export const schematicRectProps = z.object({
|
|
|
15
17
|
cornerRadius: distance.optional(),
|
|
16
18
|
})
|
|
17
19
|
|
|
18
|
-
export
|
|
20
|
+
export interface SchematicRectProps {
|
|
21
|
+
schX?: Distance
|
|
22
|
+
schY?: Distance
|
|
23
|
+
width: Distance
|
|
24
|
+
height: Distance
|
|
25
|
+
rotation?: number | string
|
|
26
|
+
strokeWidth?: Distance
|
|
27
|
+
color?: string
|
|
28
|
+
isFilled?: boolean
|
|
29
|
+
fillColor?: string
|
|
30
|
+
isDashed?: boolean
|
|
31
|
+
cornerRadius?: Distance
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type InferredSchematicRectProps = z.input<typeof schematicRectProps>
|
|
35
|
+
|
|
36
|
+
expectTypesMatch<SchematicRectProps, z.input<typeof schematicRectProps>>(true)
|
|
@@ -2,6 +2,8 @@ import { distance, rotation } from "circuit-json"
|
|
|
2
2
|
import { z } from "zod"
|
|
3
3
|
import { ninePointAnchor } from "lib/common/ninePointAnchor"
|
|
4
4
|
import { fivePointAnchor } from "lib/common/fivePointAnchor"
|
|
5
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
6
|
+
import type { Distance } from "lib/common/distance"
|
|
5
7
|
|
|
6
8
|
export const schematicTextProps = z.object({
|
|
7
9
|
schX: distance.optional(),
|
|
@@ -14,4 +16,17 @@ export const schematicTextProps = z.object({
|
|
|
14
16
|
color: z.string().default("#000000"),
|
|
15
17
|
schRotation: rotation.default(0),
|
|
16
18
|
})
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
export interface SchematicTextProps {
|
|
21
|
+
schX?: Distance
|
|
22
|
+
schY?: Distance
|
|
23
|
+
text: string
|
|
24
|
+
fontSize?: number
|
|
25
|
+
anchor?: z.infer<typeof fivePointAnchor> | z.infer<typeof ninePointAnchor>
|
|
26
|
+
color?: string
|
|
27
|
+
schRotation?: number | string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type InferredSchematicTextProps = z.input<typeof schematicTextProps>
|
|
31
|
+
|
|
32
|
+
expectTypesMatch<SchematicTextProps, z.input<typeof schematicTextProps>>(true)
|