@tscircuit/core 0.0.252 → 0.0.254
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 +419 -3
- package/dist/index.js +122 -15
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
2
|
-
import { subcircuitGroupProps, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, CapacitorProps, ChipProps, ResistorProps, ManualEditEvent, manual_edits_file } from '@tscircuit/props';
|
|
2
|
+
import { subcircuitGroupProps, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, CapacitorProps, ChipProps, ResistorProps, ManualEditEvent, manual_edits_file } from '@tscircuit/props';
|
|
3
3
|
import React, { ReactElement } from 'react';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import { z, ZodType } from 'zod';
|
|
@@ -718,7 +718,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
|
|
|
718
718
|
getNameAndAliases(): string[];
|
|
719
719
|
isMatchingPort(port: Port): boolean;
|
|
720
720
|
getPortSelector(): string;
|
|
721
|
-
getAvailablePcbLayers():
|
|
721
|
+
getAvailablePcbLayers(): LayerRef[];
|
|
722
722
|
/**
|
|
723
723
|
* Return traces that are explicitly connected to this port (not via a net)
|
|
724
724
|
*/
|
|
@@ -1151,6 +1151,8 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1151
1151
|
x: string | number;
|
|
1152
1152
|
y: string | number;
|
|
1153
1153
|
}>, "many">>;
|
|
1154
|
+
outlineOffsetX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1155
|
+
outlineOffsetY: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1154
1156
|
}>, "strip", z.ZodTypeAny, {
|
|
1155
1157
|
pcbX?: number | undefined;
|
|
1156
1158
|
pcbY?: number | undefined;
|
|
@@ -1209,6 +1211,8 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1209
1211
|
x: number;
|
|
1210
1212
|
y: number;
|
|
1211
1213
|
}[] | undefined;
|
|
1214
|
+
outlineOffsetX?: number | undefined;
|
|
1215
|
+
outlineOffsetY?: number | undefined;
|
|
1212
1216
|
}, {
|
|
1213
1217
|
pcbX?: string | number | undefined;
|
|
1214
1218
|
pcbY?: string | number | undefined;
|
|
@@ -1271,6 +1275,8 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1271
1275
|
x: string | number;
|
|
1272
1276
|
y: string | number;
|
|
1273
1277
|
}[] | undefined;
|
|
1278
|
+
outlineOffsetX?: string | number | undefined;
|
|
1279
|
+
outlineOffsetY?: string | number | undefined;
|
|
1274
1280
|
}>;
|
|
1275
1281
|
};
|
|
1276
1282
|
get boardThickness(): number;
|
|
@@ -9138,6 +9144,415 @@ declare class Transistor extends NormalComponent<typeof transistorProps> {
|
|
|
9138
9144
|
doInitialSourceRender(): void;
|
|
9139
9145
|
}
|
|
9140
9146
|
|
|
9147
|
+
declare class Mosfet extends NormalComponent<typeof mosfetProps> {
|
|
9148
|
+
get config(): {
|
|
9149
|
+
componentName: string;
|
|
9150
|
+
schematicSymbolName: "n_channel_d_mosfet_transistor" | "n_channel_e_mosfet_transistor" | "p_channel_d_mosfet_transistor" | "p_channel_e_mosfet_transistor";
|
|
9151
|
+
zodProps: zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
9152
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9153
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9154
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9155
|
+
schX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9156
|
+
schY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9157
|
+
schRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9158
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
9159
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
9160
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9161
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9162
|
+
}, {
|
|
9163
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9164
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
9165
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9166
|
+
}>>;
|
|
9167
|
+
footprint: zod.ZodOptional<zod.ZodType<_tscircuit_props.Footprint, zod.ZodTypeDef, _tscircuit_props.Footprint>>;
|
|
9168
|
+
}, {
|
|
9169
|
+
supplierPartNumbers: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<["jlcpcb", "macrofab", "pcbway", "digikey", "mouser", "lcsc"]>, zod.ZodArray<zod.ZodString, "many">>>;
|
|
9170
|
+
}>, {
|
|
9171
|
+
key: zod.ZodOptional<zod.ZodAny>;
|
|
9172
|
+
name: zod.ZodString;
|
|
9173
|
+
cadModel: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
9174
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
9175
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9176
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9177
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9178
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9179
|
+
x: string | number;
|
|
9180
|
+
y: string | number;
|
|
9181
|
+
z: string | number;
|
|
9182
|
+
}, {
|
|
9183
|
+
x: string | number;
|
|
9184
|
+
y: string | number;
|
|
9185
|
+
z: string | number;
|
|
9186
|
+
}>]>>;
|
|
9187
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
9188
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9189
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9190
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9191
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9192
|
+
x: number;
|
|
9193
|
+
y: number;
|
|
9194
|
+
z: number;
|
|
9195
|
+
}, {
|
|
9196
|
+
x: string | number;
|
|
9197
|
+
y: string | number;
|
|
9198
|
+
z: string | number;
|
|
9199
|
+
}>>;
|
|
9200
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
9201
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9202
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9203
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9204
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9205
|
+
x: number;
|
|
9206
|
+
y: number;
|
|
9207
|
+
z: number;
|
|
9208
|
+
}, {
|
|
9209
|
+
x: string | number;
|
|
9210
|
+
y: string | number;
|
|
9211
|
+
z: string | number;
|
|
9212
|
+
}>>;
|
|
9213
|
+
}, {
|
|
9214
|
+
stlUrl: zod.ZodString;
|
|
9215
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9216
|
+
stlUrl: string;
|
|
9217
|
+
rotationOffset?: number | {
|
|
9218
|
+
x: string | number;
|
|
9219
|
+
y: string | number;
|
|
9220
|
+
z: string | number;
|
|
9221
|
+
} | undefined;
|
|
9222
|
+
positionOffset?: {
|
|
9223
|
+
x: number;
|
|
9224
|
+
y: number;
|
|
9225
|
+
z: number;
|
|
9226
|
+
} | undefined;
|
|
9227
|
+
size?: {
|
|
9228
|
+
x: number;
|
|
9229
|
+
y: number;
|
|
9230
|
+
z: number;
|
|
9231
|
+
} | undefined;
|
|
9232
|
+
}, {
|
|
9233
|
+
stlUrl: string;
|
|
9234
|
+
rotationOffset?: number | {
|
|
9235
|
+
x: string | number;
|
|
9236
|
+
y: string | number;
|
|
9237
|
+
z: string | number;
|
|
9238
|
+
} | undefined;
|
|
9239
|
+
positionOffset?: {
|
|
9240
|
+
x: string | number;
|
|
9241
|
+
y: string | number;
|
|
9242
|
+
z: string | number;
|
|
9243
|
+
} | undefined;
|
|
9244
|
+
size?: {
|
|
9245
|
+
x: string | number;
|
|
9246
|
+
y: string | number;
|
|
9247
|
+
z: string | number;
|
|
9248
|
+
} | undefined;
|
|
9249
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
9250
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
9251
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9252
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9253
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9254
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9255
|
+
x: string | number;
|
|
9256
|
+
y: string | number;
|
|
9257
|
+
z: string | number;
|
|
9258
|
+
}, {
|
|
9259
|
+
x: string | number;
|
|
9260
|
+
y: string | number;
|
|
9261
|
+
z: string | number;
|
|
9262
|
+
}>]>>;
|
|
9263
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
9264
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9265
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9266
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9267
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9268
|
+
x: number;
|
|
9269
|
+
y: number;
|
|
9270
|
+
z: number;
|
|
9271
|
+
}, {
|
|
9272
|
+
x: string | number;
|
|
9273
|
+
y: string | number;
|
|
9274
|
+
z: string | number;
|
|
9275
|
+
}>>;
|
|
9276
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
9277
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9278
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9279
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9280
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9281
|
+
x: number;
|
|
9282
|
+
y: number;
|
|
9283
|
+
z: number;
|
|
9284
|
+
}, {
|
|
9285
|
+
x: string | number;
|
|
9286
|
+
y: string | number;
|
|
9287
|
+
z: string | number;
|
|
9288
|
+
}>>;
|
|
9289
|
+
}, {
|
|
9290
|
+
objUrl: zod.ZodString;
|
|
9291
|
+
mtlUrl: zod.ZodOptional<zod.ZodString>;
|
|
9292
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9293
|
+
objUrl: string;
|
|
9294
|
+
rotationOffset?: number | {
|
|
9295
|
+
x: string | number;
|
|
9296
|
+
y: string | number;
|
|
9297
|
+
z: string | number;
|
|
9298
|
+
} | undefined;
|
|
9299
|
+
positionOffset?: {
|
|
9300
|
+
x: number;
|
|
9301
|
+
y: number;
|
|
9302
|
+
z: number;
|
|
9303
|
+
} | undefined;
|
|
9304
|
+
size?: {
|
|
9305
|
+
x: number;
|
|
9306
|
+
y: number;
|
|
9307
|
+
z: number;
|
|
9308
|
+
} | undefined;
|
|
9309
|
+
mtlUrl?: string | undefined;
|
|
9310
|
+
}, {
|
|
9311
|
+
objUrl: string;
|
|
9312
|
+
rotationOffset?: number | {
|
|
9313
|
+
x: string | number;
|
|
9314
|
+
y: string | number;
|
|
9315
|
+
z: string | number;
|
|
9316
|
+
} | undefined;
|
|
9317
|
+
positionOffset?: {
|
|
9318
|
+
x: string | number;
|
|
9319
|
+
y: string | number;
|
|
9320
|
+
z: string | number;
|
|
9321
|
+
} | undefined;
|
|
9322
|
+
size?: {
|
|
9323
|
+
x: string | number;
|
|
9324
|
+
y: string | number;
|
|
9325
|
+
z: string | number;
|
|
9326
|
+
} | undefined;
|
|
9327
|
+
mtlUrl?: string | undefined;
|
|
9328
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
9329
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
9330
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9331
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9332
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9333
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9334
|
+
x: string | number;
|
|
9335
|
+
y: string | number;
|
|
9336
|
+
z: string | number;
|
|
9337
|
+
}, {
|
|
9338
|
+
x: string | number;
|
|
9339
|
+
y: string | number;
|
|
9340
|
+
z: string | number;
|
|
9341
|
+
}>]>>;
|
|
9342
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
9343
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9344
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9345
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9346
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9347
|
+
x: number;
|
|
9348
|
+
y: number;
|
|
9349
|
+
z: number;
|
|
9350
|
+
}, {
|
|
9351
|
+
x: string | number;
|
|
9352
|
+
y: string | number;
|
|
9353
|
+
z: string | number;
|
|
9354
|
+
}>>;
|
|
9355
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
9356
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9357
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9358
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9359
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9360
|
+
x: number;
|
|
9361
|
+
y: number;
|
|
9362
|
+
z: number;
|
|
9363
|
+
}, {
|
|
9364
|
+
x: string | number;
|
|
9365
|
+
y: string | number;
|
|
9366
|
+
z: string | number;
|
|
9367
|
+
}>>;
|
|
9368
|
+
}, {
|
|
9369
|
+
jscad: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
|
|
9370
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9371
|
+
jscad: Record<string, any>;
|
|
9372
|
+
rotationOffset?: number | {
|
|
9373
|
+
x: string | number;
|
|
9374
|
+
y: string | number;
|
|
9375
|
+
z: string | number;
|
|
9376
|
+
} | undefined;
|
|
9377
|
+
positionOffset?: {
|
|
9378
|
+
x: number;
|
|
9379
|
+
y: number;
|
|
9380
|
+
z: number;
|
|
9381
|
+
} | undefined;
|
|
9382
|
+
size?: {
|
|
9383
|
+
x: number;
|
|
9384
|
+
y: number;
|
|
9385
|
+
z: number;
|
|
9386
|
+
} | undefined;
|
|
9387
|
+
}, {
|
|
9388
|
+
jscad: Record<string, any>;
|
|
9389
|
+
rotationOffset?: number | {
|
|
9390
|
+
x: string | number;
|
|
9391
|
+
y: string | number;
|
|
9392
|
+
z: string | number;
|
|
9393
|
+
} | undefined;
|
|
9394
|
+
positionOffset?: {
|
|
9395
|
+
x: string | number;
|
|
9396
|
+
y: string | number;
|
|
9397
|
+
z: string | number;
|
|
9398
|
+
} | undefined;
|
|
9399
|
+
size?: {
|
|
9400
|
+
x: string | number;
|
|
9401
|
+
y: string | number;
|
|
9402
|
+
z: string | number;
|
|
9403
|
+
} | undefined;
|
|
9404
|
+
}>]>>;
|
|
9405
|
+
children: zod.ZodOptional<zod.ZodAny>;
|
|
9406
|
+
symbolName: zod.ZodOptional<zod.ZodString>;
|
|
9407
|
+
}>, {
|
|
9408
|
+
channelType: zod.ZodEnum<["n", "p"]>;
|
|
9409
|
+
mosfetMode: zod.ZodEnum<["enhancement", "depletion"]>;
|
|
9410
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9411
|
+
name: string;
|
|
9412
|
+
channelType: "n" | "p";
|
|
9413
|
+
mosfetMode: "enhancement" | "depletion";
|
|
9414
|
+
pcbX?: number | undefined;
|
|
9415
|
+
pcbY?: number | undefined;
|
|
9416
|
+
pcbRotation?: number | undefined;
|
|
9417
|
+
schX?: number | undefined;
|
|
9418
|
+
schY?: number | undefined;
|
|
9419
|
+
schRotation?: number | undefined;
|
|
9420
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
9421
|
+
footprint?: _tscircuit_props.Footprint | undefined;
|
|
9422
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
9423
|
+
key?: any;
|
|
9424
|
+
cadModel?: string | {
|
|
9425
|
+
stlUrl: string;
|
|
9426
|
+
rotationOffset?: number | {
|
|
9427
|
+
x: string | number;
|
|
9428
|
+
y: string | number;
|
|
9429
|
+
z: string | number;
|
|
9430
|
+
} | undefined;
|
|
9431
|
+
positionOffset?: {
|
|
9432
|
+
x: number;
|
|
9433
|
+
y: number;
|
|
9434
|
+
z: number;
|
|
9435
|
+
} | undefined;
|
|
9436
|
+
size?: {
|
|
9437
|
+
x: number;
|
|
9438
|
+
y: number;
|
|
9439
|
+
z: number;
|
|
9440
|
+
} | undefined;
|
|
9441
|
+
} | {
|
|
9442
|
+
objUrl: string;
|
|
9443
|
+
rotationOffset?: number | {
|
|
9444
|
+
x: string | number;
|
|
9445
|
+
y: string | number;
|
|
9446
|
+
z: string | number;
|
|
9447
|
+
} | undefined;
|
|
9448
|
+
positionOffset?: {
|
|
9449
|
+
x: number;
|
|
9450
|
+
y: number;
|
|
9451
|
+
z: number;
|
|
9452
|
+
} | undefined;
|
|
9453
|
+
size?: {
|
|
9454
|
+
x: number;
|
|
9455
|
+
y: number;
|
|
9456
|
+
z: number;
|
|
9457
|
+
} | undefined;
|
|
9458
|
+
mtlUrl?: string | undefined;
|
|
9459
|
+
} | {
|
|
9460
|
+
jscad: Record<string, any>;
|
|
9461
|
+
rotationOffset?: number | {
|
|
9462
|
+
x: string | number;
|
|
9463
|
+
y: string | number;
|
|
9464
|
+
z: string | number;
|
|
9465
|
+
} | undefined;
|
|
9466
|
+
positionOffset?: {
|
|
9467
|
+
x: number;
|
|
9468
|
+
y: number;
|
|
9469
|
+
z: number;
|
|
9470
|
+
} | undefined;
|
|
9471
|
+
size?: {
|
|
9472
|
+
x: number;
|
|
9473
|
+
y: number;
|
|
9474
|
+
z: number;
|
|
9475
|
+
} | undefined;
|
|
9476
|
+
} | undefined;
|
|
9477
|
+
children?: any;
|
|
9478
|
+
symbolName?: string | undefined;
|
|
9479
|
+
}, {
|
|
9480
|
+
name: string;
|
|
9481
|
+
channelType: "n" | "p";
|
|
9482
|
+
mosfetMode: "enhancement" | "depletion";
|
|
9483
|
+
pcbX?: string | number | undefined;
|
|
9484
|
+
pcbY?: string | number | undefined;
|
|
9485
|
+
pcbRotation?: string | number | undefined;
|
|
9486
|
+
schX?: string | number | undefined;
|
|
9487
|
+
schY?: string | number | undefined;
|
|
9488
|
+
schRotation?: string | number | undefined;
|
|
9489
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
9490
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9491
|
+
} | undefined;
|
|
9492
|
+
footprint?: _tscircuit_props.Footprint | undefined;
|
|
9493
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
9494
|
+
key?: any;
|
|
9495
|
+
cadModel?: string | {
|
|
9496
|
+
stlUrl: string;
|
|
9497
|
+
rotationOffset?: number | {
|
|
9498
|
+
x: string | number;
|
|
9499
|
+
y: string | number;
|
|
9500
|
+
z: string | number;
|
|
9501
|
+
} | undefined;
|
|
9502
|
+
positionOffset?: {
|
|
9503
|
+
x: string | number;
|
|
9504
|
+
y: string | number;
|
|
9505
|
+
z: string | number;
|
|
9506
|
+
} | undefined;
|
|
9507
|
+
size?: {
|
|
9508
|
+
x: string | number;
|
|
9509
|
+
y: string | number;
|
|
9510
|
+
z: string | number;
|
|
9511
|
+
} | undefined;
|
|
9512
|
+
} | {
|
|
9513
|
+
objUrl: string;
|
|
9514
|
+
rotationOffset?: number | {
|
|
9515
|
+
x: string | number;
|
|
9516
|
+
y: string | number;
|
|
9517
|
+
z: string | number;
|
|
9518
|
+
} | undefined;
|
|
9519
|
+
positionOffset?: {
|
|
9520
|
+
x: string | number;
|
|
9521
|
+
y: string | number;
|
|
9522
|
+
z: string | number;
|
|
9523
|
+
} | undefined;
|
|
9524
|
+
size?: {
|
|
9525
|
+
x: string | number;
|
|
9526
|
+
y: string | number;
|
|
9527
|
+
z: string | number;
|
|
9528
|
+
} | undefined;
|
|
9529
|
+
mtlUrl?: string | undefined;
|
|
9530
|
+
} | {
|
|
9531
|
+
jscad: Record<string, any>;
|
|
9532
|
+
rotationOffset?: number | {
|
|
9533
|
+
x: string | number;
|
|
9534
|
+
y: string | number;
|
|
9535
|
+
z: string | number;
|
|
9536
|
+
} | undefined;
|
|
9537
|
+
positionOffset?: {
|
|
9538
|
+
x: string | number;
|
|
9539
|
+
y: string | number;
|
|
9540
|
+
z: string | number;
|
|
9541
|
+
} | undefined;
|
|
9542
|
+
size?: {
|
|
9543
|
+
x: string | number;
|
|
9544
|
+
y: string | number;
|
|
9545
|
+
z: string | number;
|
|
9546
|
+
} | undefined;
|
|
9547
|
+
} | undefined;
|
|
9548
|
+
children?: any;
|
|
9549
|
+
symbolName?: string | undefined;
|
|
9550
|
+
}>;
|
|
9551
|
+
shouldRenderAsSchematicBox: boolean;
|
|
9552
|
+
};
|
|
9553
|
+
doInitialSourceRender(): void;
|
|
9554
|
+
}
|
|
9555
|
+
|
|
9141
9556
|
declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
|
|
9142
9557
|
isLoading: boolean;
|
|
9143
9558
|
error?: Error | null;
|
|
@@ -9495,6 +9910,7 @@ interface TscircuitElements {
|
|
|
9495
9910
|
resonator: _tscircuit_props.ResonatorProps;
|
|
9496
9911
|
subcircuit: _tscircuit_props.SubcircuitGroupProps;
|
|
9497
9912
|
transistor: _tscircuit_props.TransistorProps;
|
|
9913
|
+
mosfet: _tscircuit_props.MosfetProps;
|
|
9498
9914
|
jscad: any;
|
|
9499
9915
|
}
|
|
9500
9916
|
declare module "react" {
|
|
@@ -9510,4 +9926,4 @@ declare module "react/jsx-runtime" {
|
|
|
9510
9926
|
}
|
|
9511
9927
|
}
|
|
9512
9928
|
|
|
9513
|
-
export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, Renderable, Resistor, Resonator, RootCircuit, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
9929
|
+
export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, Renderable, Resistor, Resonator, RootCircuit, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(components_exports, {
|
|
|
23
23
|
Jumper: () => Jumper,
|
|
24
24
|
Keepout: () => Keepout,
|
|
25
25
|
Led: () => Led,
|
|
26
|
+
Mosfet: () => Mosfet,
|
|
26
27
|
Net: () => Net,
|
|
27
28
|
NetAlias: () => NetAlias,
|
|
28
29
|
NormalComponent: () => NormalComponent,
|
|
@@ -1414,9 +1415,9 @@ var SmtPad = class extends PrimitiveComponent {
|
|
|
1414
1415
|
center: { x: smtpad.x, y: smtpad.y },
|
|
1415
1416
|
bounds: {
|
|
1416
1417
|
left: smtpad.x - smtpad.width / 2,
|
|
1417
|
-
top: smtpad.y
|
|
1418
|
+
top: smtpad.y + smtpad.height / 2,
|
|
1418
1419
|
right: smtpad.x + smtpad.width / 2,
|
|
1419
|
-
bottom: smtpad.y
|
|
1420
|
+
bottom: smtpad.y - smtpad.height / 2
|
|
1420
1421
|
},
|
|
1421
1422
|
width: smtpad.width,
|
|
1422
1423
|
height: smtpad.height
|
|
@@ -1551,9 +1552,9 @@ var PlatedHole = class extends PrimitiveComponent {
|
|
|
1551
1552
|
center: { x: platedHole.x, y: platedHole.y },
|
|
1552
1553
|
bounds: {
|
|
1553
1554
|
left: platedHole.x - size.width / 2,
|
|
1554
|
-
top: platedHole.y
|
|
1555
|
+
top: platedHole.y + size.height / 2,
|
|
1555
1556
|
right: platedHole.x + size.width / 2,
|
|
1556
|
-
bottom: platedHole.y
|
|
1557
|
+
bottom: platedHole.y - size.height / 2
|
|
1557
1558
|
},
|
|
1558
1559
|
width: size.width,
|
|
1559
1560
|
height: size.height
|
|
@@ -1860,10 +1861,59 @@ function getRelativeDirection(pointA, pointB) {
|
|
|
1860
1861
|
return dy >= 0 ? "up" : "down";
|
|
1861
1862
|
}
|
|
1862
1863
|
|
|
1863
|
-
// lib/components/primitive-components/Port.ts
|
|
1864
|
+
// lib/components/primitive-components/Port/Port.ts
|
|
1864
1865
|
import "schematic-symbols";
|
|
1865
1866
|
import { applyToPoint as applyToPoint4, compose as compose3, translate as translate3 } from "transformation-matrix";
|
|
1866
1867
|
import { z as z4 } from "zod";
|
|
1868
|
+
|
|
1869
|
+
// lib/components/primitive-components/Port/areAllPcbPrimitivesOverlapping.ts
|
|
1870
|
+
var areAllPcbPrimitivesOverlapping = (pcbPrimitives) => {
|
|
1871
|
+
if (pcbPrimitives.length <= 1) return true;
|
|
1872
|
+
const bounds = pcbPrimitives.map((p) => {
|
|
1873
|
+
const circuitBounds = p._getPcbCircuitJsonBounds();
|
|
1874
|
+
return {
|
|
1875
|
+
left: circuitBounds.bounds.left,
|
|
1876
|
+
right: circuitBounds.bounds.right,
|
|
1877
|
+
top: circuitBounds.bounds.top,
|
|
1878
|
+
bottom: circuitBounds.bounds.bottom
|
|
1879
|
+
};
|
|
1880
|
+
});
|
|
1881
|
+
const overlaps = Array(bounds.length).fill(false).map(() => Array(bounds.length).fill(false));
|
|
1882
|
+
for (let i = 0; i < bounds.length; i++) {
|
|
1883
|
+
for (let j = i + 1; j < bounds.length; j++) {
|
|
1884
|
+
const a = bounds[i];
|
|
1885
|
+
const b = bounds[j];
|
|
1886
|
+
overlaps[i][j] = overlaps[j][i] = !(a.right < b.left || a.left > b.right || a.bottom > b.top || a.top < b.bottom);
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1890
|
+
const dfs = (node) => {
|
|
1891
|
+
visited.add(node);
|
|
1892
|
+
for (let i = 0; i < bounds.length; i++) {
|
|
1893
|
+
if (overlaps[node][i] && !visited.has(i)) {
|
|
1894
|
+
dfs(i);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
dfs(0);
|
|
1899
|
+
return visited.size === bounds.length;
|
|
1900
|
+
};
|
|
1901
|
+
|
|
1902
|
+
// lib/components/primitive-components/Port/getCenterOfPcbPrimitives.ts
|
|
1903
|
+
var getCenterOfPcbPrimitives = (pcbPrimitives) => {
|
|
1904
|
+
if (pcbPrimitives.length === 0) {
|
|
1905
|
+
throw new Error("Cannot get center of empty PCB primitives array");
|
|
1906
|
+
}
|
|
1907
|
+
const positions = pcbPrimitives.map((p) => p._getPcbCircuitJsonBounds().center).filter(Boolean);
|
|
1908
|
+
const sumX = positions.reduce((sum, pos) => sum + pos.x, 0);
|
|
1909
|
+
const sumY = positions.reduce((sum, pos) => sum + pos.y, 0);
|
|
1910
|
+
return {
|
|
1911
|
+
x: sumX / positions.length,
|
|
1912
|
+
y: sumY / positions.length
|
|
1913
|
+
};
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
// lib/components/primitive-components/Port/Port.ts
|
|
1867
1917
|
var portProps = z4.object({
|
|
1868
1918
|
name: z4.string().optional(),
|
|
1869
1919
|
pinNumber: z4.number().optional(),
|
|
@@ -2035,23 +2085,30 @@ var Port = class extends PrimitiveComponent {
|
|
|
2035
2085
|
}
|
|
2036
2086
|
const pcbMatches = matchedComponents.filter((c) => c.isPcbPrimitive);
|
|
2037
2087
|
if (pcbMatches.length === 0) return;
|
|
2088
|
+
let matchCenter = null;
|
|
2089
|
+
if (pcbMatches.length === 1) {
|
|
2090
|
+
matchCenter = pcbMatches[0]._getPcbCircuitJsonBounds().center;
|
|
2091
|
+
}
|
|
2038
2092
|
if (pcbMatches.length > 1) {
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2093
|
+
if (!areAllPcbPrimitivesOverlapping(pcbMatches)) {
|
|
2094
|
+
throw new Error(
|
|
2095
|
+
`${this.getString()} has multiple non-overlapping pcb matches, unclear how to place pcb_port: ${pcbMatches.map((c) => c.getString()).join(", ")}. (Note: tscircuit core does not currently allow you to specify internally connected pcb primitives with the same port hints, try giving them different port hints and specifying they are connected externally- or file an issue)`
|
|
2096
|
+
);
|
|
2097
|
+
}
|
|
2098
|
+
matchCenter = getCenterOfPcbPrimitives(pcbMatches);
|
|
2042
2099
|
}
|
|
2043
|
-
|
|
2044
|
-
if ("_getPcbCircuitJsonBounds" in pcbMatch) {
|
|
2100
|
+
if (matchCenter) {
|
|
2045
2101
|
const pcb_port = db.pcb_port.insert({
|
|
2046
2102
|
pcb_component_id: this.parent?.pcb_component_id,
|
|
2047
2103
|
layers: this.getAvailablePcbLayers(),
|
|
2048
|
-
...
|
|
2104
|
+
...matchCenter,
|
|
2049
2105
|
source_port_id: this.source_port_id
|
|
2050
2106
|
});
|
|
2051
2107
|
this.pcb_port_id = pcb_port.pcb_port_id;
|
|
2052
2108
|
} else {
|
|
2109
|
+
const pcbMatch = pcbMatches[0];
|
|
2053
2110
|
throw new Error(
|
|
2054
|
-
`${pcbMatch.getString()} does not have a _getGlobalPcbPositionBeforeLayout method (needed for pcb_port placement)`
|
|
2111
|
+
`${pcbMatch.getString()} does not have a center or _getGlobalPcbPositionBeforeLayout method (needed for pcb_port placement)`
|
|
2055
2112
|
);
|
|
2056
2113
|
}
|
|
2057
2114
|
}
|
|
@@ -3732,12 +3789,18 @@ var Board = class extends Group {
|
|
|
3732
3789
|
throw new Error("Board width and height or an outline are required");
|
|
3733
3790
|
}
|
|
3734
3791
|
const pcb_board = db.pcb_board.insert({
|
|
3735
|
-
center: {
|
|
3792
|
+
center: {
|
|
3793
|
+
x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
|
|
3794
|
+
y: (props.pcbY ?? 0) + (props.outlineOffsetY ?? 0)
|
|
3795
|
+
},
|
|
3736
3796
|
thickness: this.boardThickness,
|
|
3737
3797
|
num_layers: this.allLayers.length,
|
|
3738
3798
|
width: props.width,
|
|
3739
3799
|
height: props.height,
|
|
3740
|
-
outline: props.outline
|
|
3800
|
+
outline: props.outline?.map((point) => ({
|
|
3801
|
+
x: point.x + (props.outlineOffsetX ?? 0),
|
|
3802
|
+
y: point.y + (props.outlineOffsetY ?? 0)
|
|
3803
|
+
}))
|
|
3741
3804
|
});
|
|
3742
3805
|
this.pcb_board_id = pcb_board.pcb_board_id;
|
|
3743
3806
|
}
|
|
@@ -4391,6 +4454,20 @@ var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
|
|
|
4391
4454
|
return Math.min(...capacitorMaxLengths);
|
|
4392
4455
|
};
|
|
4393
4456
|
|
|
4457
|
+
// lib/components/primitive-components/Trace/get-trace-display-name.ts
|
|
4458
|
+
function getTraceDisplayName({
|
|
4459
|
+
ports,
|
|
4460
|
+
nets
|
|
4461
|
+
}) {
|
|
4462
|
+
if (ports.length >= 2) {
|
|
4463
|
+
return `${ports[0]?.selector} to ${ports[1]?.selector}`;
|
|
4464
|
+
}
|
|
4465
|
+
if (ports.length === 1 && nets.length === 1) {
|
|
4466
|
+
return `${ports[0]?.selector} to net.${nets[0]._parsedProps.name}`;
|
|
4467
|
+
}
|
|
4468
|
+
return void 0;
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4394
4471
|
// lib/components/primitive-components/Trace/Trace.ts
|
|
4395
4472
|
var portToObjective = (port) => {
|
|
4396
4473
|
const portPosition = port._getGlobalPcbPositionAfterLayout();
|
|
@@ -4534,13 +4611,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4534
4611
|
const { allPortsFound, portsWithSelectors: ports } = this._findConnectedPorts();
|
|
4535
4612
|
if (!allPortsFound) return;
|
|
4536
4613
|
const nets = this._findConnectedNets().nets;
|
|
4614
|
+
const displayName = getTraceDisplayName({ ports, nets });
|
|
4537
4615
|
const trace = db.source_trace.insert({
|
|
4538
4616
|
connected_source_port_ids: ports.map((p) => p.port.source_port_id),
|
|
4539
4617
|
connected_source_net_ids: nets.map((n) => n.source_net_id),
|
|
4540
4618
|
max_length: getMaxLengthFromConnectedCapacitors(
|
|
4541
4619
|
ports.map((p) => p.port),
|
|
4542
4620
|
{ db }
|
|
4543
|
-
) ?? props.maxLength
|
|
4621
|
+
) ?? props.maxLength,
|
|
4622
|
+
display_name: displayName
|
|
4544
4623
|
});
|
|
4545
4624
|
this.source_trace_id = trace.source_trace_id;
|
|
4546
4625
|
}
|
|
@@ -6027,6 +6106,33 @@ var Transistor = class extends NormalComponent {
|
|
|
6027
6106
|
}
|
|
6028
6107
|
};
|
|
6029
6108
|
|
|
6109
|
+
// lib/components/normal-components/Mosfet.ts
|
|
6110
|
+
import { mosfetProps } from "@tscircuit/props";
|
|
6111
|
+
var Mosfet = class extends NormalComponent {
|
|
6112
|
+
get config() {
|
|
6113
|
+
const mosfetMode = this.props.mosfetMode === "depletion" ? "d" : "e";
|
|
6114
|
+
const channelType = this.props.channelType;
|
|
6115
|
+
const baseSymbolName = `${channelType}_channel_${mosfetMode}_mosfet_transistor`;
|
|
6116
|
+
return {
|
|
6117
|
+
componentName: "Mosfet",
|
|
6118
|
+
schematicSymbolName: baseSymbolName,
|
|
6119
|
+
zodProps: mosfetProps,
|
|
6120
|
+
shouldRenderAsSchematicBox: false
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6123
|
+
doInitialSourceRender() {
|
|
6124
|
+
const { db } = this.root;
|
|
6125
|
+
const { _parsedProps: props } = this;
|
|
6126
|
+
const source_component = db.source_component.insert({
|
|
6127
|
+
ftype: "simple_mosfet",
|
|
6128
|
+
name: props.name,
|
|
6129
|
+
mosfet_mode: props.mosfetMode,
|
|
6130
|
+
channel_type: props.channelType
|
|
6131
|
+
});
|
|
6132
|
+
this.source_component_id = source_component.source_component_id;
|
|
6133
|
+
}
|
|
6134
|
+
};
|
|
6135
|
+
|
|
6030
6136
|
// lib/RootCircuit.ts
|
|
6031
6137
|
import { su } from "@tscircuit/soup-util";
|
|
6032
6138
|
import { isValidElement as isValidElement2 } from "react";
|
|
@@ -6357,6 +6463,7 @@ export {
|
|
|
6357
6463
|
Jumper,
|
|
6358
6464
|
Keepout,
|
|
6359
6465
|
Led,
|
|
6466
|
+
Mosfet,
|
|
6360
6467
|
Net,
|
|
6361
6468
|
NetAlias,
|
|
6362
6469
|
NormalComponent,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.254",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@lume/kiwi": "^0.4.3",
|
|
43
|
-
"@tscircuit/footprinter": "^0.0.
|
|
43
|
+
"@tscircuit/footprinter": "^0.0.97",
|
|
44
44
|
"@tscircuit/infgrid-ijump-astar": "^0.0.26",
|
|
45
45
|
"@tscircuit/math-utils": "^0.0.5",
|
|
46
|
-
"@tscircuit/props": "^0.0.
|
|
46
|
+
"@tscircuit/props": "^0.0.128",
|
|
47
47
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
48
48
|
"@tscircuit/soup-util": "^0.0.41",
|
|
49
|
-
"circuit-json": "^0.0.
|
|
49
|
+
"circuit-json": "^0.0.128",
|
|
50
50
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
51
51
|
"format-si-unit": "^0.0.2",
|
|
52
52
|
"nanoid": "^5.0.7",
|