@tscircuit/props 0.0.317 → 0.0.318

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,25 @@
1
+ import { type LayerRef, layer_ref } from "circuit-json"
2
+ import { expectTypesMatch } from "lib/typecheck"
3
+ import { z } from "zod"
4
+
5
+ export interface CadAssemblyProps {
6
+ /**
7
+ * The layer that the CAD assembly is designed for. If you set this to "top"
8
+ * then it means the children were intended to represent the top layer. If
9
+ * the <chip /> with this assembly is moved to the bottom layer, then the
10
+ * components will be mirrored.
11
+ *
12
+ * Generally, you shouldn't set this except where it can help prevent
13
+ * confusion because you have a complex multi-layer assembly. Default is
14
+ * "top" and this is most intuitive.
15
+ */
16
+ originalLayer?: LayerRef
17
+ }
18
+
19
+ export const cadassemblyProps = z.object({
20
+ originalLayer: layer_ref.default("top").optional(),
21
+ })
22
+
23
+ export type CadAssemblyPropsInput = z.input<typeof cadassemblyProps>
24
+ type InferredCadAssemblyProps = z.infer<typeof cadassemblyProps>
25
+ expectTypesMatch<InferredCadAssemblyProps, CadAssemblyProps>(true)
@@ -0,0 +1,28 @@
1
+ import { distance, type Distance } from "lib/common/distance"
2
+ import { expectTypesMatch } from "lib/typecheck"
3
+ import { cadModelBase, type CadModelBase } from "../common/cadModel"
4
+ import { z } from "zod"
5
+
6
+ export interface CadModelProps extends CadModelBase {
7
+ modelUrl: string
8
+ pcbX?: Distance
9
+ pcbY?: Distance
10
+ pcbZ?: Distance
11
+ }
12
+
13
+ const pcbPosition = z.object({
14
+ pcbX: distance.optional(),
15
+ pcbY: distance.optional(),
16
+ pcbZ: distance.optional(),
17
+ })
18
+
19
+ const cadModelBaseWithUrl = cadModelBase.extend({
20
+ modelUrl: z.string(),
21
+ })
22
+
23
+ const cadModelObject = cadModelBaseWithUrl.merge(pcbPosition)
24
+ expectTypesMatch<CadModelProps, z.input<typeof cadModelObject>>(true)
25
+
26
+ export const cadmodelProps = z.union([z.null(), z.string(), cadModelObject])
27
+
28
+ export type CadModelPropsInput = z.input<typeof cadmodelProps>
package/lib/index.ts CHANGED
@@ -61,6 +61,8 @@ export * from "./components/testpoint"
61
61
  export * from "./components/breakoutpoint"
62
62
  export * from "./components/pcb-keepout"
63
63
  export * from "./components/copper-pour"
64
+ export * from "./components/cadassembly"
65
+ export * from "./components/cadmodel"
64
66
  export * from "./components/power-source"
65
67
  export * from "./components/voltagesource"
66
68
  export * from "./components/schematic-box"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.317",
3
+ "version": "0.0.318",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",