@tscircuit/props 0.0.608 → 0.0.610
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.
- package/README.md +8 -2
- package/dist/index.d.ts +351 -3
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/lib/components/smtpad.ts +33 -0
- package/lib/platformConfig.ts +26 -3
- package/package.json +1 -1
package/lib/components/smtpad.ts
CHANGED
|
@@ -66,6 +66,20 @@ export interface PillSmtPadProps extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
|
66
66
|
solderPasteMargin?: Distance
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export interface RotatedPillSmtPadProps
|
|
70
|
+
extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
71
|
+
name?: string
|
|
72
|
+
shape: "rotated_pill"
|
|
73
|
+
width: Distance
|
|
74
|
+
height: Distance
|
|
75
|
+
radius: Distance
|
|
76
|
+
ccwRotation: number
|
|
77
|
+
portHints?: PortHints
|
|
78
|
+
coveredWithSolderMask?: boolean
|
|
79
|
+
solderMaskMargin?: Distance
|
|
80
|
+
solderPasteMargin?: Distance
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
export interface PolygonSmtPadProps
|
|
70
84
|
extends Omit<PcbLayoutProps, "pcbRotation"> {
|
|
71
85
|
name?: string
|
|
@@ -82,6 +96,7 @@ export type SmtPadProps =
|
|
|
82
96
|
| CircleSmtPadProps
|
|
83
97
|
| RotatedRectSmtPadProps
|
|
84
98
|
| PillSmtPadProps
|
|
99
|
+
| RotatedPillSmtPadProps
|
|
85
100
|
| PolygonSmtPadProps
|
|
86
101
|
|
|
87
102
|
// ----------------------------------------------------------------------------
|
|
@@ -160,6 +175,23 @@ export const pillSmtPadProps = pcbLayoutProps
|
|
|
160
175
|
type InferredPillSmtPadProps = z.input<typeof pillSmtPadProps>
|
|
161
176
|
expectTypesMatch<InferredPillSmtPadProps, PillSmtPadProps>(true)
|
|
162
177
|
|
|
178
|
+
export const rotatedPillSmtPadProps = pcbLayoutProps
|
|
179
|
+
.omit({ pcbRotation: true })
|
|
180
|
+
.extend({
|
|
181
|
+
name: z.string().optional(),
|
|
182
|
+
shape: z.literal("rotated_pill"),
|
|
183
|
+
width: distance,
|
|
184
|
+
height: distance,
|
|
185
|
+
radius: distance,
|
|
186
|
+
ccwRotation: z.number(),
|
|
187
|
+
portHints: portHints.optional(),
|
|
188
|
+
coveredWithSolderMask: z.boolean().optional(),
|
|
189
|
+
solderMaskMargin: distance.optional(),
|
|
190
|
+
solderPasteMargin: distance.optional(),
|
|
191
|
+
})
|
|
192
|
+
type InferredRotatedPillSmtPadProps = z.input<typeof rotatedPillSmtPadProps>
|
|
193
|
+
expectTypesMatch<InferredRotatedPillSmtPadProps, RotatedPillSmtPadProps>(true)
|
|
194
|
+
|
|
163
195
|
export const polygonSmtPadProps = pcbLayoutProps
|
|
164
196
|
.omit({ pcbRotation: true })
|
|
165
197
|
.extend({
|
|
@@ -179,6 +211,7 @@ export const smtPadProps = z.discriminatedUnion("shape", [
|
|
|
179
211
|
rectSmtPadProps,
|
|
180
212
|
rotatedRectSmtPadProps,
|
|
181
213
|
pillSmtPadProps,
|
|
214
|
+
rotatedPillSmtPadProps,
|
|
182
215
|
polygonSmtPadProps,
|
|
183
216
|
])
|
|
184
217
|
|
package/lib/platformConfig.ts
CHANGED
|
@@ -45,6 +45,12 @@ export interface AutorouterDefinition {
|
|
|
45
45
|
) => AutorouterInstance | Promise<AutorouterInstance>
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export interface LocalCacheEngine {
|
|
49
|
+
getItem(key: string): string | Promise<string | null> | null
|
|
50
|
+
setItem(key: string, value: string): void | Promise<void>
|
|
51
|
+
removeItem?(key: string): void | Promise<void>
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
/** e.g. "kicad", this is the prefix used to reference libraries in footprinter strings e.g. kicad:Resistor_0402 **/
|
|
49
55
|
type FootprintLibraryPrefix = string
|
|
50
56
|
|
|
@@ -72,8 +78,14 @@ export interface PlatformConfig {
|
|
|
72
78
|
*/
|
|
73
79
|
allowLegacyAutorouters?: boolean
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
localCacheEngine?:
|
|
81
|
+
/** A localStorage-compatible cache used by render phases and engines. */
|
|
82
|
+
localCacheEngine?: LocalCacheEngine
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Analyze rendered and supplier footprints so manufacturing exporters can
|
|
86
|
+
* align their semantic pin 1 orientations.
|
|
87
|
+
*/
|
|
88
|
+
enablePartOrientationAnalysis?: boolean
|
|
77
89
|
|
|
78
90
|
registryApiUrl?: string
|
|
79
91
|
|
|
@@ -205,6 +217,16 @@ const platformFetch = z
|
|
|
205
217
|
.custom<typeof fetch>((value) => typeof value === "function")
|
|
206
218
|
.describe("A fetch-like function to use for platform requests")
|
|
207
219
|
|
|
220
|
+
const localCacheEngine = z.custom<LocalCacheEngine>(
|
|
221
|
+
(value) =>
|
|
222
|
+
typeof value === "object" &&
|
|
223
|
+
value !== null &&
|
|
224
|
+
"getItem" in value &&
|
|
225
|
+
typeof value.getItem === "function" &&
|
|
226
|
+
"setItem" in value &&
|
|
227
|
+
typeof value.setItem === "function",
|
|
228
|
+
)
|
|
229
|
+
|
|
208
230
|
export const platformConfig = z.object({
|
|
209
231
|
partsEngine: partsEngine.optional(),
|
|
210
232
|
autorouter: autorouterProp.optional(),
|
|
@@ -231,7 +253,8 @@ export const platformConfig = z.object({
|
|
|
231
253
|
.optional(),
|
|
232
254
|
defaultSpiceEngine: defaultSpiceEngine.optional(),
|
|
233
255
|
unitPreference: z.enum(["mm", "in", "mil"]).optional(),
|
|
234
|
-
localCacheEngine:
|
|
256
|
+
localCacheEngine: localCacheEngine.optional(),
|
|
257
|
+
enablePartOrientationAnalysis: z.boolean().optional(),
|
|
235
258
|
pcbDisabled: z.boolean().optional(),
|
|
236
259
|
routingDisabled: z.boolean().optional(),
|
|
237
260
|
schematicDisabled: z.boolean().optional(),
|