@tscircuit/props 0.0.458 → 0.0.459
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 +970 -321
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/lib/common/schematicPinDefinitions.ts +26 -8
- package/package.json +2 -2
|
@@ -30,11 +30,13 @@ export interface PinSideDefinition {
|
|
|
30
30
|
| "right-to-left"
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export type PinSideDefinitionInput = PinSideDefinition | Array<number | string>
|
|
34
|
+
|
|
33
35
|
export interface SchematicPortArrangementWithSides {
|
|
34
|
-
leftSide?:
|
|
35
|
-
topSide?:
|
|
36
|
-
rightSide?:
|
|
37
|
-
bottomSide?:
|
|
36
|
+
leftSide?: PinSideDefinitionInput
|
|
37
|
+
topSide?: PinSideDefinitionInput
|
|
38
|
+
rightSide?: PinSideDefinitionInput
|
|
39
|
+
bottomSide?: PinSideDefinitionInput
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
export interface SchematicPortArrangement
|
|
@@ -58,6 +60,22 @@ export const explicitPinSideDefinition = z.object({
|
|
|
58
60
|
]),
|
|
59
61
|
})
|
|
60
62
|
|
|
63
|
+
const pinSideDefinitionInput = z.array(z.union([z.number(), z.string()]))
|
|
64
|
+
|
|
65
|
+
const pinSideDefinitionWithDefaultDirection = (
|
|
66
|
+
direction: PinSideDefinition["direction"],
|
|
67
|
+
) =>
|
|
68
|
+
z
|
|
69
|
+
.union([explicitPinSideDefinition, pinSideDefinitionInput])
|
|
70
|
+
.transform((value) =>
|
|
71
|
+
Array.isArray(value)
|
|
72
|
+
? {
|
|
73
|
+
pins: value,
|
|
74
|
+
direction,
|
|
75
|
+
}
|
|
76
|
+
: value,
|
|
77
|
+
)
|
|
78
|
+
|
|
61
79
|
/**
|
|
62
80
|
* @deprecated Use schematicPinArrangement instead.
|
|
63
81
|
*/
|
|
@@ -70,10 +88,10 @@ export const schematicPortArrangement = z.object({
|
|
|
70
88
|
rightPinCount: z.number().optional(),
|
|
71
89
|
topPinCount: z.number().optional(),
|
|
72
90
|
bottomPinCount: z.number().optional(),
|
|
73
|
-
leftSide:
|
|
74
|
-
rightSide:
|
|
75
|
-
topSide:
|
|
76
|
-
bottomSide:
|
|
91
|
+
leftSide: pinSideDefinitionWithDefaultDirection("top-to-bottom").optional(),
|
|
92
|
+
rightSide: pinSideDefinitionWithDefaultDirection("top-to-bottom").optional(),
|
|
93
|
+
topSide: pinSideDefinitionWithDefaultDirection("left-to-right").optional(),
|
|
94
|
+
bottomSide: pinSideDefinitionWithDefaultDirection("left-to-right").optional(),
|
|
77
95
|
})
|
|
78
96
|
|
|
79
97
|
export const schematicPinArrangement = schematicPortArrangement
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/props",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.459",
|
|
4
4
|
"description": "Props for tscircuit builtin component types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/react": "^18.3.2",
|
|
33
33
|
"ava": "^6.1.3",
|
|
34
34
|
"circuit-json": "^0.0.363",
|
|
35
|
-
"expect-type": "^1.
|
|
35
|
+
"expect-type": "^1.3.0",
|
|
36
36
|
"glob": "^11.0.0",
|
|
37
37
|
"madge": "^8.0.0",
|
|
38
38
|
"prettier": "^3.3.3",
|