@tscircuit/props 0.0.709 → 0.0.711
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 +8 -0
- package/dist/index.d.ts +127 -1
- package/dist/index.js +1520 -1495
- package/dist/index.js.map +1 -1
- package/lib/assembly/drawing/dimension.ts +45 -0
- package/lib/assembly/drawing/index.ts +3 -0
- package/lib/assembly/drawing/partview.ts +3 -0
- package/lib/components/transistor.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
3
|
+
|
|
4
|
+
/** Authoring intent for a dimension of model geometry or a part view's extent.
|
|
5
|
+
* Core resolves geometry, measurement text and paper placement in a follow-up.
|
|
6
|
+
*/
|
|
7
|
+
export interface AssemblyDrawingDimensionProps {
|
|
8
|
+
/** Stable circuit identity; does not choose a measurement or its formatting. */
|
|
9
|
+
name?: string
|
|
10
|
+
/** Selector for one model-defined named edge or outline, e.g. .tube > .inner_top; never a preset or mesh edge index. */
|
|
11
|
+
edgeRef?: string
|
|
12
|
+
/** Request the selected geometry's width in the view. Conflicts with edgeRef and heightOfView=true. */
|
|
13
|
+
widthOfView?: boolean
|
|
14
|
+
/** Request the selected geometry's height in the view. Conflicts with edgeRef and widthOfView=true. */
|
|
15
|
+
heightOfView?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const assemblyDrawingDimensionProps = z
|
|
19
|
+
.object({
|
|
20
|
+
name: z.string().optional(),
|
|
21
|
+
edgeRef: z.string().trim().min(1).optional(),
|
|
22
|
+
widthOfView: z.boolean().optional(),
|
|
23
|
+
heightOfView: z.boolean().optional(),
|
|
24
|
+
})
|
|
25
|
+
.superRefine((dimension, ctx) => {
|
|
26
|
+
const targets = [
|
|
27
|
+
dimension.edgeRef !== undefined,
|
|
28
|
+
dimension.widthOfView === true,
|
|
29
|
+
dimension.heightOfView === true,
|
|
30
|
+
].filter(Boolean).length
|
|
31
|
+
if (targets !== 1)
|
|
32
|
+
ctx.addIssue({
|
|
33
|
+
code: "custom",
|
|
34
|
+
message:
|
|
35
|
+
"Specify exactly one of edgeRef, widthOfView=true, or heightOfView=true",
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export type InferredAssemblyDrawingDimensionProps = z.input<
|
|
40
|
+
typeof assemblyDrawingDimensionProps
|
|
41
|
+
>
|
|
42
|
+
expectTypesMatch<
|
|
43
|
+
AssemblyDrawingDimensionProps,
|
|
44
|
+
z.input<typeof assemblyDrawingDimensionProps>
|
|
45
|
+
>(true)
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { assemblyDrawingTitleBlockProps } from "./titleblock"
|
|
2
2
|
import { assemblyDrawingPageProps } from "./page"
|
|
3
3
|
import { assemblyDrawingPartViewProps } from "./partview"
|
|
4
|
+
import { assemblyDrawingDimensionProps } from "./dimension"
|
|
4
5
|
|
|
5
6
|
export * from "./page"
|
|
6
7
|
export * from "./page-size"
|
|
7
8
|
export * from "./titleblock"
|
|
8
9
|
export * from "./partview"
|
|
10
|
+
export * from "./dimension"
|
|
9
11
|
|
|
10
12
|
/** Drawing namespace; pages contain configured part views. */
|
|
11
13
|
export const assemblyDrawingProps = {
|
|
12
14
|
page: assemblyDrawingPageProps,
|
|
13
15
|
titleblock: assemblyDrawingTitleBlockProps,
|
|
14
16
|
partview: assemblyDrawingPartViewProps,
|
|
17
|
+
dimension: assemblyDrawingDimensionProps,
|
|
15
18
|
} as const
|
|
@@ -56,6 +56,8 @@ export interface AssemblyDrawingPartViewProps {
|
|
|
56
56
|
showHiddenEdges?: boolean
|
|
57
57
|
/** A planar cut with diagonal hatching on closed cut surfaces. */
|
|
58
58
|
section?: AssemblyDrawingSectionPlane
|
|
59
|
+
/** Nested assembly.drawing.dimension annotations; these do not change the selected geometry. */
|
|
60
|
+
children?: any
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export const assemblyDrawingPartViewProps = z
|
|
@@ -74,6 +76,7 @@ export const assemblyDrawingPartViewProps = z
|
|
|
74
76
|
height: distance.pipe(z.number().finite().positive()),
|
|
75
77
|
showHiddenEdges: z.boolean().default(false),
|
|
76
78
|
section: assemblyDrawingSectionPlane.optional(),
|
|
79
|
+
children: z.any().optional(),
|
|
77
80
|
})
|
|
78
81
|
.superRefine((view, ctx) => {
|
|
79
82
|
for (const [center, negative, positive] of [
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
import { expectTypesMatch } from "lib/typecheck"
|
|
6
6
|
import { z } from "zod"
|
|
7
7
|
import type { Connections } from "lib/utility-types/connections-and-selectors"
|
|
8
|
+
import { pinLabelsProp, type PinLabelsProp } from "./chip"
|
|
8
9
|
import { createConnectionsProp } from "lib/common/connectionsProp"
|
|
9
10
|
|
|
10
11
|
export const transistorPinsLabels = [
|
|
@@ -23,11 +24,19 @@ export type transistorPinsLabels = (typeof transistorPinsLabels)[number]
|
|
|
23
24
|
export interface TransistorProps<PinLabel extends string = string>
|
|
24
25
|
extends CommonComponentProps<PinLabel> {
|
|
25
26
|
type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet" | "igbt"
|
|
27
|
+
/**
|
|
28
|
+
* Physical package pins mapped to semantic terminal names (and optional aliases).
|
|
29
|
+
* For MMBT3904 SOT-23: { pin1: "base", pin2: "emitter", pin3: "collector" }.
|
|
30
|
+
* Use full terminal names to retain schematic and simulation semantics.
|
|
31
|
+
* Omit to retain the symbol's default pin order; no package pinout is inferred.
|
|
32
|
+
*/
|
|
33
|
+
pinLabels?: PinLabelsProp<string, PinLabel>
|
|
26
34
|
connections?: Connections<transistorPinsLabels>
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
export const transistorProps = commonComponentProps.extend({
|
|
30
38
|
type: z.enum(["npn", "pnp", "bjt", "jfet", "mosfet", "igbt"]),
|
|
39
|
+
pinLabels: pinLabelsProp.optional(),
|
|
31
40
|
connections: createConnectionsProp(transistorPinsLabels).optional(),
|
|
32
41
|
})
|
|
33
42
|
|