@tscircuit/props 0.0.154 → 0.0.156

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.
@@ -1,5 +1,5 @@
1
1
  import type { LayoutBuilder } from "@tscircuit/layout"
2
- import { length } from "circuit-json"
2
+ import { layer_ref, length } from "circuit-json"
3
3
  import type { Distance } from "lib/common/distance"
4
4
  import {
5
5
  type CommonLayoutProps,
@@ -15,10 +15,62 @@ import {
15
15
  type ManualEditsFileInput,
16
16
  } from "lib/manual-edits"
17
17
 
18
- export interface BaseGroupProps extends CommonLayoutProps {
18
+ export const layoutConfig = z.object({
19
+ layoutMode: z.enum(["grid", "flex", "none"]).optional(),
20
+ position: z.enum(["absolute", "relative"]).optional(),
21
+
22
+ grid: z.boolean().optional(),
23
+ gridCols: z.number().or(z.string()).optional(),
24
+ gridRows: z.number().or(z.string()).optional(),
25
+ gridTemplateRows: z.string().optional(),
26
+ gridTemplateColumns: z.string().optional(),
27
+ gridTemplate: z.string().optional(),
28
+ gridGap: z.number().or(z.string()).optional(),
29
+
30
+ flex: z.boolean().or(z.string()).optional(),
31
+ flexDirection: z.enum(["row", "column"]).optional(),
32
+ alignItems: z.enum(["start", "center", "end", "stretch"]).optional(),
33
+ justifyContent: z.enum(["start", "center", "end", "stretch"]).optional(),
34
+ flexRow: z.boolean().optional(),
35
+ flexColumn: z.boolean().optional(),
36
+ gap: z.number().or(z.string()).optional(),
37
+ })
38
+
39
+ export interface LayoutConfig {
40
+ layoutMode?: "grid" | "flex" | "none"
41
+ position?: "absolute" | "relative"
42
+
43
+ grid?: boolean
44
+ gridCols?: number | string
45
+ gridRows?: number | string
46
+ gridTemplateRows?: string
47
+ gridTemplateColumns?: string
48
+ gridTemplate?: string
49
+ gridGap?: number | string
50
+
51
+ flex?: boolean | string
52
+ flexDirection?: "row" | "column"
53
+ alignItems?: "start" | "center" | "end" | "stretch"
54
+ justifyContent?: "start" | "center" | "end" | "stretch"
55
+ flexRow?: boolean
56
+ flexColumn?: boolean
57
+ gap?: number | string
58
+ }
59
+
60
+ expectTypesMatch<LayoutConfig, z.input<typeof layoutConfig>>(true)
61
+
62
+ export interface BaseGroupProps extends CommonLayoutProps, LayoutConfig {
19
63
  name?: string
20
64
  key?: any
21
65
  children?: any
66
+
67
+ pcbWidth?: Distance
68
+ pcbHeight?: Distance
69
+ schWidth?: Distance
70
+ schHeight?: Distance
71
+
72
+ pcbLayout?: LayoutConfig
73
+ schLayout?: LayoutConfig
22
74
  }
23
75
 
24
76
  export type PartsEngine = {
@@ -109,6 +161,14 @@ export const baseGroupProps = commonLayoutProps.extend({
109
161
  name: z.string().optional(),
110
162
  children: z.any().optional(),
111
163
  key: z.any().optional(),
164
+
165
+ ...layoutConfig.shape,
166
+ pcbWidth: length.optional(),
167
+ pcbHeight: length.optional(),
168
+ schWidth: length.optional(),
169
+ schHeight: length.optional(),
170
+ pcbLayout: layoutConfig.optional(),
171
+ schLayout: layoutConfig.optional(),
112
172
  })
113
173
 
114
174
  export const partsEngine = z.custom<PartsEngine>((v) => "findPart" in v)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.154",
3
+ "version": "0.0.156",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",