@tscircuit/props 0.0.372 → 0.0.373

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,4 +1,5 @@
1
1
  import { ms } from "circuit-json"
2
+ import type { AutocompleteString } from "lib/common/autocomplete"
2
3
  import { expectTypesMatch } from "lib/typecheck"
3
4
  import { z } from "zod"
4
5
 
@@ -6,14 +7,20 @@ export interface AnalogSimulationProps {
6
7
  simulationType?: "spice_transient_analysis"
7
8
  duration?: number | string
8
9
  timePerStep?: number | string
10
+ spiceEngine?: AutocompleteString<"spicey" | "ngspice">
9
11
  }
10
12
 
13
+ const spiceEngine = z.custom<AutocompleteString<"spicey" | "ngspice">>(
14
+ (value) => typeof value === "string",
15
+ )
16
+
11
17
  export const analogSimulationProps = z.object({
12
18
  simulationType: z
13
19
  .literal("spice_transient_analysis")
14
20
  .default("spice_transient_analysis"),
15
21
  duration: ms.optional(),
16
22
  timePerStep: ms.optional(),
23
+ spiceEngine: spiceEngine.optional(),
17
24
  })
18
25
 
19
26
  expectTypesMatch<AnalogSimulationProps, z.input<typeof analogSimulationProps>>(
@@ -4,6 +4,7 @@ import {
4
4
  type PartsEngine,
5
5
  partsEngine,
6
6
  } from "./components/group"
7
+ import type { AutocompleteString } from "./common/autocomplete"
7
8
  import { expectTypesMatch } from "./typecheck"
8
9
  import { z } from "zod"
9
10
  import { type CadModelProp, cadModelProp } from "./common/cadModel"
@@ -64,6 +65,8 @@ export interface PlatformConfig {
64
65
  includeBoardFiles?: string[]
65
66
  snapshotsDir?: string
66
67
 
68
+ defaultSpiceEngine?: AutocompleteString<"spicey" | "ngspice">
69
+
67
70
  pcbDisabled?: boolean
68
71
  schematicDisabled?: boolean
69
72
  partsEngineDisabled?: boolean
@@ -118,6 +121,10 @@ const spiceEngineZod = z.object({
118
121
  ),
119
122
  })
120
123
 
124
+ const defaultSpiceEngine = z.custom<AutocompleteString<"spicey" | "ngspice">>(
125
+ (value) => typeof value === "string",
126
+ )
127
+
121
128
  const autorouterInstance = z.object({
122
129
  run: z
123
130
  .function()
@@ -162,6 +169,7 @@ export const platformConfig = z.object({
162
169
  'The directory where snapshots are stored for "tsci snapshot", defaults to "tests/__snapshots__"',
163
170
  )
164
171
  .optional(),
172
+ defaultSpiceEngine: defaultSpiceEngine.optional(),
165
173
  localCacheEngine: z.any().optional(),
166
174
  pcbDisabled: z.boolean().optional(),
167
175
  schematicDisabled: z.boolean().optional(),
@@ -12,6 +12,7 @@ export interface ProjectConfig
12
12
  | "printBoardInformationToSilkscreen"
13
13
  | "includeBoardFiles"
14
14
  | "snapshotsDir"
15
+ | "defaultSpiceEngine"
15
16
  > {}
16
17
 
17
18
  const platformConfigObject = platformConfig as z.ZodObject<any>
@@ -24,6 +25,7 @@ export const projectConfig = platformConfigObject.pick({
24
25
  printBoardInformationToSilkscreen: true,
25
26
  includeBoardFiles: true,
26
27
  snapshotsDir: true,
28
+ defaultSpiceEngine: true,
27
29
  }) as z.ZodType<ProjectConfig>
28
30
 
29
31
  expectTypesMatch<ProjectConfig, z.infer<typeof projectConfig>>(true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.372",
3
+ "version": "0.0.373",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",