@tscircuit/props 0.0.491 → 0.0.492
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/dist/index.d.ts +276 -107
- package/dist/index.js +847 -863
- package/dist/index.js.map +1 -1
- package/lib/common/layout.ts +1 -123
- package/lib/common/pinAttributeMap.ts +77 -0
- package/lib/index.ts +1 -0
- package/package.json +1 -1
package/lib/common/layout.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from "./kicadSymbolMetadata"
|
|
21
21
|
import { type PcbStyle, pcbStyle } from "./pcbStyle"
|
|
22
22
|
import { type PcbSx, pcbSx } from "./pcbSx"
|
|
23
|
+
import { pinAttributeMap, type PinAttributeMap } from "./pinAttributeMap"
|
|
23
24
|
import { type SchStyle, schStyle } from "./schStyle"
|
|
24
25
|
import { type SymbolProp, symbolProp } from "./symbolProp"
|
|
25
26
|
import { url } from "./url"
|
|
@@ -229,129 +230,6 @@ export const supplierProps = z.object({
|
|
|
229
230
|
|
|
230
231
|
expectTypesMatch<SupplierProps, z.input<typeof supplierProps>>(true)
|
|
231
232
|
|
|
232
|
-
export interface PinAttributeMap {
|
|
233
|
-
capabilities?: Array<
|
|
234
|
-
| "i2c_sda"
|
|
235
|
-
| "i2c_scl"
|
|
236
|
-
| "spi_cs"
|
|
237
|
-
| "spi_sck"
|
|
238
|
-
| "spi_mosi"
|
|
239
|
-
| "spi_miso"
|
|
240
|
-
| "uart_tx"
|
|
241
|
-
| "uart_rx"
|
|
242
|
-
>
|
|
243
|
-
activeCapabilities?: Array<
|
|
244
|
-
| "i2c_sda"
|
|
245
|
-
| "i2c_scl"
|
|
246
|
-
| "spi_cs"
|
|
247
|
-
| "spi_sck"
|
|
248
|
-
| "spi_mosi"
|
|
249
|
-
| "spi_miso"
|
|
250
|
-
| "uart_tx"
|
|
251
|
-
| "uart_rx"
|
|
252
|
-
>
|
|
253
|
-
activeCapability?:
|
|
254
|
-
| "i2c_sda"
|
|
255
|
-
| "i2c_scl"
|
|
256
|
-
| "spi_cs"
|
|
257
|
-
| "spi_sck"
|
|
258
|
-
| "spi_mosi"
|
|
259
|
-
| "spi_miso"
|
|
260
|
-
| "uart_tx"
|
|
261
|
-
| "uart_rx"
|
|
262
|
-
providesPower?: boolean
|
|
263
|
-
requiresPower?: boolean
|
|
264
|
-
providesGround?: boolean
|
|
265
|
-
requiresGround?: boolean
|
|
266
|
-
providesVoltage?: string | number
|
|
267
|
-
requiresVoltage?: string | number
|
|
268
|
-
doNotConnect?: boolean
|
|
269
|
-
includeInBoardPinout?: boolean
|
|
270
|
-
highlightColor?: string
|
|
271
|
-
mustBeConnected?: boolean
|
|
272
|
-
canUseInternalPullup?: boolean
|
|
273
|
-
isUsingInternalPullup?: boolean
|
|
274
|
-
needsExternalPullup?: boolean
|
|
275
|
-
canUseInternalPulldown?: boolean
|
|
276
|
-
isUsingInternalPulldown?: boolean
|
|
277
|
-
needsExternalPulldown?: boolean
|
|
278
|
-
canUseOpenDrain?: boolean
|
|
279
|
-
isUsingOpenDrain?: boolean
|
|
280
|
-
canUsePushPull?: boolean
|
|
281
|
-
isUsingPushPull?: boolean
|
|
282
|
-
shouldHaveDecouplingCapacitor?: boolean
|
|
283
|
-
recommendedDecouplingCapacitorCapacitance?: string | number
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
export const pinAttributeMap = z.object({
|
|
287
|
-
capabilities: z
|
|
288
|
-
.array(
|
|
289
|
-
z.enum([
|
|
290
|
-
"i2c_sda",
|
|
291
|
-
"i2c_scl",
|
|
292
|
-
"spi_cs",
|
|
293
|
-
"spi_sck",
|
|
294
|
-
"spi_mosi",
|
|
295
|
-
"spi_miso",
|
|
296
|
-
"uart_tx",
|
|
297
|
-
"uart_rx",
|
|
298
|
-
]),
|
|
299
|
-
)
|
|
300
|
-
.optional(),
|
|
301
|
-
activeCapabilities: z
|
|
302
|
-
.array(
|
|
303
|
-
z.enum([
|
|
304
|
-
"i2c_sda",
|
|
305
|
-
"i2c_scl",
|
|
306
|
-
"spi_cs",
|
|
307
|
-
"spi_sck",
|
|
308
|
-
"spi_mosi",
|
|
309
|
-
"spi_miso",
|
|
310
|
-
"uart_tx",
|
|
311
|
-
"uart_rx",
|
|
312
|
-
]),
|
|
313
|
-
)
|
|
314
|
-
.optional(),
|
|
315
|
-
activeCapability: z
|
|
316
|
-
.enum([
|
|
317
|
-
"i2c_sda",
|
|
318
|
-
"i2c_scl",
|
|
319
|
-
"spi_cs",
|
|
320
|
-
"spi_sck",
|
|
321
|
-
"spi_mosi",
|
|
322
|
-
"spi_miso",
|
|
323
|
-
"uart_tx",
|
|
324
|
-
"uart_rx",
|
|
325
|
-
])
|
|
326
|
-
.optional(),
|
|
327
|
-
providesPower: z.boolean().optional(),
|
|
328
|
-
requiresPower: z.boolean().optional(),
|
|
329
|
-
providesGround: z.boolean().optional(),
|
|
330
|
-
requiresGround: z.boolean().optional(),
|
|
331
|
-
providesVoltage: z.union([z.string(), z.number()]).optional(),
|
|
332
|
-
requiresVoltage: z.union([z.string(), z.number()]).optional(),
|
|
333
|
-
doNotConnect: z.boolean().optional(),
|
|
334
|
-
includeInBoardPinout: z.boolean().optional(),
|
|
335
|
-
highlightColor: z.string().optional(),
|
|
336
|
-
mustBeConnected: z.boolean().optional(),
|
|
337
|
-
canUseInternalPullup: z.boolean().optional(),
|
|
338
|
-
isUsingInternalPullup: z.boolean().optional(),
|
|
339
|
-
needsExternalPullup: z.boolean().optional(),
|
|
340
|
-
canUseInternalPulldown: z.boolean().optional(),
|
|
341
|
-
isUsingInternalPulldown: z.boolean().optional(),
|
|
342
|
-
needsExternalPulldown: z.boolean().optional(),
|
|
343
|
-
canUseOpenDrain: z.boolean().optional(),
|
|
344
|
-
isUsingOpenDrain: z.boolean().optional(),
|
|
345
|
-
canUsePushPull: z.boolean().optional(),
|
|
346
|
-
isUsingPushPull: z.boolean().optional(),
|
|
347
|
-
shouldHaveDecouplingCapacitor: z.boolean().optional(),
|
|
348
|
-
recommendedDecouplingCapacitorCapacitance: z
|
|
349
|
-
.union([z.string(), z.number()])
|
|
350
|
-
.optional(),
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
expectTypesMatch<PinAttributeMap, z.input<typeof pinAttributeMap>>(true)
|
|
354
|
-
|
|
355
233
|
export interface CommonComponentProps<PinLabel extends string = string>
|
|
356
234
|
extends CommonLayoutProps {
|
|
357
235
|
key?: any
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { expectTypesMatch } from "../typecheck"
|
|
3
|
+
|
|
4
|
+
export const pinCapability = z.enum([
|
|
5
|
+
"i2c_sda",
|
|
6
|
+
"i2c_scl",
|
|
7
|
+
"spi_cs",
|
|
8
|
+
"spi_sck",
|
|
9
|
+
"spi_mosi",
|
|
10
|
+
"spi_miso",
|
|
11
|
+
"uart_tx",
|
|
12
|
+
"uart_rx",
|
|
13
|
+
])
|
|
14
|
+
|
|
15
|
+
export type PinCapability = z.input<typeof pinCapability>
|
|
16
|
+
|
|
17
|
+
export interface PinAttributeMap {
|
|
18
|
+
capabilities?: Array<PinCapability>
|
|
19
|
+
activeCapabilities?: Array<PinCapability>
|
|
20
|
+
activeCapability?: PinCapability
|
|
21
|
+
providesPower?: boolean
|
|
22
|
+
requiresPower?: boolean
|
|
23
|
+
providesGround?: boolean
|
|
24
|
+
requiresGround?: boolean
|
|
25
|
+
providesVoltage?: string | number
|
|
26
|
+
requiresVoltage?: string | number
|
|
27
|
+
doNotConnect?: boolean
|
|
28
|
+
includeInBoardPinout?: boolean
|
|
29
|
+
highlightColor?: string
|
|
30
|
+
mustBeConnected?: boolean
|
|
31
|
+
canUseInternalPullup?: boolean
|
|
32
|
+
isUsingInternalPullup?: boolean
|
|
33
|
+
needsExternalPullup?: boolean
|
|
34
|
+
canUseInternalPulldown?: boolean
|
|
35
|
+
isUsingInternalPulldown?: boolean
|
|
36
|
+
needsExternalPulldown?: boolean
|
|
37
|
+
canUseOpenDrain?: boolean
|
|
38
|
+
isUsingOpenDrain?: boolean
|
|
39
|
+
canUsePushPull?: boolean
|
|
40
|
+
isUsingPushPull?: boolean
|
|
41
|
+
shouldHaveDecouplingCapacitor?: boolean
|
|
42
|
+
recommendedDecouplingCapacitorCapacitance?: string | number
|
|
43
|
+
isGpio?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const pinAttributeMap = z.object({
|
|
47
|
+
capabilities: z.array(pinCapability).optional(),
|
|
48
|
+
activeCapabilities: z.array(pinCapability).optional(),
|
|
49
|
+
activeCapability: pinCapability.optional(),
|
|
50
|
+
providesPower: z.boolean().optional(),
|
|
51
|
+
requiresPower: z.boolean().optional(),
|
|
52
|
+
providesGround: z.boolean().optional(),
|
|
53
|
+
requiresGround: z.boolean().optional(),
|
|
54
|
+
providesVoltage: z.union([z.string(), z.number()]).optional(),
|
|
55
|
+
requiresVoltage: z.union([z.string(), z.number()]).optional(),
|
|
56
|
+
doNotConnect: z.boolean().optional(),
|
|
57
|
+
includeInBoardPinout: z.boolean().optional(),
|
|
58
|
+
highlightColor: z.string().optional(),
|
|
59
|
+
mustBeConnected: z.boolean().optional(),
|
|
60
|
+
canUseInternalPullup: z.boolean().optional(),
|
|
61
|
+
isUsingInternalPullup: z.boolean().optional(),
|
|
62
|
+
needsExternalPullup: z.boolean().optional(),
|
|
63
|
+
canUseInternalPulldown: z.boolean().optional(),
|
|
64
|
+
isUsingInternalPulldown: z.boolean().optional(),
|
|
65
|
+
needsExternalPulldown: z.boolean().optional(),
|
|
66
|
+
canUseOpenDrain: z.boolean().optional(),
|
|
67
|
+
isUsingOpenDrain: z.boolean().optional(),
|
|
68
|
+
canUsePushPull: z.boolean().optional(),
|
|
69
|
+
isUsingPushPull: z.boolean().optional(),
|
|
70
|
+
shouldHaveDecouplingCapacitor: z.boolean().optional(),
|
|
71
|
+
recommendedDecouplingCapacitorCapacitance: z
|
|
72
|
+
.union([z.string(), z.number()])
|
|
73
|
+
.optional(),
|
|
74
|
+
isGpio: z.boolean().optional(),
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
expectTypesMatch<PinAttributeMap, z.input<typeof pinAttributeMap>>(true)
|
package/lib/index.ts
CHANGED