@tscircuit/props 0.0.154 → 0.0.155

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,60 @@ 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
+ })
37
+
38
+ export interface LayoutConfig {
39
+ layoutMode?: "grid" | "flex" | "none"
40
+ position?: "absolute" | "relative"
41
+
42
+ grid?: boolean
43
+ gridCols?: number | string
44
+ gridRows?: number | string
45
+ gridTemplateRows?: string
46
+ gridTemplateColumns?: string
47
+ gridTemplate?: string
48
+ gridGap?: number | string
49
+
50
+ flex?: boolean | string
51
+ flexDirection?: "row" | "column"
52
+ alignItems?: "start" | "center" | "end" | "stretch"
53
+ justifyContent?: "start" | "center" | "end" | "stretch"
54
+ flexRow?: boolean
55
+ flexColumn?: boolean
56
+ }
57
+
58
+ expectTypesMatch<LayoutConfig, z.input<typeof layoutConfig>>(true)
59
+
60
+ export interface BaseGroupProps extends CommonLayoutProps, LayoutConfig {
19
61
  name?: string
20
62
  key?: any
21
63
  children?: any
64
+
65
+ pcbWidth?: Distance
66
+ pcbHeight?: Distance
67
+ schWidth?: Distance
68
+ schHeight?: Distance
69
+
70
+ pcbLayout?: LayoutConfig
71
+ schLayout?: LayoutConfig
22
72
  }
23
73
 
24
74
  export type PartsEngine = {
@@ -109,6 +159,14 @@ export const baseGroupProps = commonLayoutProps.extend({
109
159
  name: z.string().optional(),
110
160
  children: z.any().optional(),
111
161
  key: z.any().optional(),
162
+
163
+ ...layoutConfig.shape,
164
+ pcbWidth: length.optional(),
165
+ pcbHeight: length.optional(),
166
+ schWidth: length.optional(),
167
+ schHeight: length.optional(),
168
+ pcbLayout: layoutConfig.optional(),
169
+ schLayout: layoutConfig.optional(),
112
170
  })
113
171
 
114
172
  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.155",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",