@tscircuit/props 0.0.709 → 0.0.710

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.
@@ -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 [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.709",
3
+ "version": "0.0.710",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",