@tscircuit/core 0.0.251 → 0.0.253
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 +417 -3
- package/dist/index.js +119 -13
- 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
|
*/
|
|
@@ -2098,6 +2098,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
|
|
|
2098
2098
|
schPinSpacing: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
2099
2099
|
schWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
2100
2100
|
schHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
2101
|
+
noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
|
|
2101
2102
|
}>, "strip", zod.ZodTypeAny, {
|
|
2102
2103
|
name: string;
|
|
2103
2104
|
pcbX?: number | undefined;
|
|
@@ -2202,6 +2203,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
|
|
|
2202
2203
|
schPinSpacing?: number | undefined;
|
|
2203
2204
|
schWidth?: number | undefined;
|
|
2204
2205
|
schHeight?: number | undefined;
|
|
2206
|
+
noSchematicRepresentation?: boolean | undefined;
|
|
2205
2207
|
}, {
|
|
2206
2208
|
name: string;
|
|
2207
2209
|
pcbX?: string | number | undefined;
|
|
@@ -2308,9 +2310,11 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
|
|
|
2308
2310
|
schPinSpacing?: string | number | undefined;
|
|
2309
2311
|
schWidth?: string | number | undefined;
|
|
2310
2312
|
schHeight?: string | number | undefined;
|
|
2313
|
+
noSchematicRepresentation?: boolean | undefined;
|
|
2311
2314
|
}>;
|
|
2312
2315
|
shouldRenderAsSchematicBox: boolean;
|
|
2313
2316
|
};
|
|
2317
|
+
doInitialSchematicComponentRender(): void;
|
|
2314
2318
|
doInitialSourceRender(): void;
|
|
2315
2319
|
doInitialPcbComponentRender(): void;
|
|
2316
2320
|
}
|
|
@@ -9134,6 +9138,415 @@ declare class Transistor extends NormalComponent<typeof transistorProps> {
|
|
|
9134
9138
|
doInitialSourceRender(): void;
|
|
9135
9139
|
}
|
|
9136
9140
|
|
|
9141
|
+
declare class Mosfet extends NormalComponent<typeof mosfetProps> {
|
|
9142
|
+
get config(): {
|
|
9143
|
+
componentName: string;
|
|
9144
|
+
schematicSymbolName: "n_channel_d_mosfet_transistor" | "n_channel_e_mosfet_transistor" | "p_channel_d_mosfet_transistor" | "p_channel_e_mosfet_transistor";
|
|
9145
|
+
zodProps: zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
9146
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9147
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9148
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9149
|
+
schX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9150
|
+
schY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9151
|
+
schRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
9152
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
9153
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
9154
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9155
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9156
|
+
}, {
|
|
9157
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9158
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
9159
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9160
|
+
}>>;
|
|
9161
|
+
footprint: zod.ZodOptional<zod.ZodType<_tscircuit_props.Footprint, zod.ZodTypeDef, _tscircuit_props.Footprint>>;
|
|
9162
|
+
}, {
|
|
9163
|
+
supplierPartNumbers: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<["jlcpcb", "macrofab", "pcbway", "digikey", "mouser", "lcsc"]>, zod.ZodArray<zod.ZodString, "many">>>;
|
|
9164
|
+
}>, {
|
|
9165
|
+
key: zod.ZodOptional<zod.ZodAny>;
|
|
9166
|
+
name: zod.ZodString;
|
|
9167
|
+
cadModel: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
9168
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
9169
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9170
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9171
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9172
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9173
|
+
x: string | number;
|
|
9174
|
+
y: string | number;
|
|
9175
|
+
z: string | number;
|
|
9176
|
+
}, {
|
|
9177
|
+
x: string | number;
|
|
9178
|
+
y: string | number;
|
|
9179
|
+
z: string | number;
|
|
9180
|
+
}>]>>;
|
|
9181
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
9182
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9183
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9184
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9185
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9186
|
+
x: number;
|
|
9187
|
+
y: number;
|
|
9188
|
+
z: number;
|
|
9189
|
+
}, {
|
|
9190
|
+
x: string | number;
|
|
9191
|
+
y: string | number;
|
|
9192
|
+
z: string | number;
|
|
9193
|
+
}>>;
|
|
9194
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
9195
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9196
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9197
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9198
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9199
|
+
x: number;
|
|
9200
|
+
y: number;
|
|
9201
|
+
z: number;
|
|
9202
|
+
}, {
|
|
9203
|
+
x: string | number;
|
|
9204
|
+
y: string | number;
|
|
9205
|
+
z: string | number;
|
|
9206
|
+
}>>;
|
|
9207
|
+
}, {
|
|
9208
|
+
stlUrl: zod.ZodString;
|
|
9209
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9210
|
+
stlUrl: string;
|
|
9211
|
+
rotationOffset?: number | {
|
|
9212
|
+
x: string | number;
|
|
9213
|
+
y: string | number;
|
|
9214
|
+
z: string | number;
|
|
9215
|
+
} | undefined;
|
|
9216
|
+
positionOffset?: {
|
|
9217
|
+
x: number;
|
|
9218
|
+
y: number;
|
|
9219
|
+
z: number;
|
|
9220
|
+
} | undefined;
|
|
9221
|
+
size?: {
|
|
9222
|
+
x: number;
|
|
9223
|
+
y: number;
|
|
9224
|
+
z: number;
|
|
9225
|
+
} | undefined;
|
|
9226
|
+
}, {
|
|
9227
|
+
stlUrl: string;
|
|
9228
|
+
rotationOffset?: number | {
|
|
9229
|
+
x: string | number;
|
|
9230
|
+
y: string | number;
|
|
9231
|
+
z: string | number;
|
|
9232
|
+
} | undefined;
|
|
9233
|
+
positionOffset?: {
|
|
9234
|
+
x: string | number;
|
|
9235
|
+
y: string | number;
|
|
9236
|
+
z: string | number;
|
|
9237
|
+
} | undefined;
|
|
9238
|
+
size?: {
|
|
9239
|
+
x: string | number;
|
|
9240
|
+
y: string | number;
|
|
9241
|
+
z: string | number;
|
|
9242
|
+
} | undefined;
|
|
9243
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
9244
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
9245
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9246
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9247
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9248
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9249
|
+
x: string | number;
|
|
9250
|
+
y: string | number;
|
|
9251
|
+
z: string | number;
|
|
9252
|
+
}, {
|
|
9253
|
+
x: string | number;
|
|
9254
|
+
y: string | number;
|
|
9255
|
+
z: string | number;
|
|
9256
|
+
}>]>>;
|
|
9257
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
9258
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9259
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9260
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9261
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9262
|
+
x: number;
|
|
9263
|
+
y: number;
|
|
9264
|
+
z: number;
|
|
9265
|
+
}, {
|
|
9266
|
+
x: string | number;
|
|
9267
|
+
y: string | number;
|
|
9268
|
+
z: string | number;
|
|
9269
|
+
}>>;
|
|
9270
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
9271
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9272
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9273
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9274
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9275
|
+
x: number;
|
|
9276
|
+
y: number;
|
|
9277
|
+
z: number;
|
|
9278
|
+
}, {
|
|
9279
|
+
x: string | number;
|
|
9280
|
+
y: string | number;
|
|
9281
|
+
z: string | number;
|
|
9282
|
+
}>>;
|
|
9283
|
+
}, {
|
|
9284
|
+
objUrl: zod.ZodString;
|
|
9285
|
+
mtlUrl: zod.ZodOptional<zod.ZodString>;
|
|
9286
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9287
|
+
objUrl: string;
|
|
9288
|
+
rotationOffset?: number | {
|
|
9289
|
+
x: string | number;
|
|
9290
|
+
y: string | number;
|
|
9291
|
+
z: string | number;
|
|
9292
|
+
} | undefined;
|
|
9293
|
+
positionOffset?: {
|
|
9294
|
+
x: number;
|
|
9295
|
+
y: number;
|
|
9296
|
+
z: number;
|
|
9297
|
+
} | undefined;
|
|
9298
|
+
size?: {
|
|
9299
|
+
x: number;
|
|
9300
|
+
y: number;
|
|
9301
|
+
z: number;
|
|
9302
|
+
} | undefined;
|
|
9303
|
+
mtlUrl?: string | undefined;
|
|
9304
|
+
}, {
|
|
9305
|
+
objUrl: string;
|
|
9306
|
+
rotationOffset?: number | {
|
|
9307
|
+
x: string | number;
|
|
9308
|
+
y: string | number;
|
|
9309
|
+
z: string | number;
|
|
9310
|
+
} | undefined;
|
|
9311
|
+
positionOffset?: {
|
|
9312
|
+
x: string | number;
|
|
9313
|
+
y: string | number;
|
|
9314
|
+
z: string | number;
|
|
9315
|
+
} | undefined;
|
|
9316
|
+
size?: {
|
|
9317
|
+
x: string | number;
|
|
9318
|
+
y: string | number;
|
|
9319
|
+
z: string | number;
|
|
9320
|
+
} | undefined;
|
|
9321
|
+
mtlUrl?: string | undefined;
|
|
9322
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
9323
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
9324
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9325
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9326
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
9327
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9328
|
+
x: string | number;
|
|
9329
|
+
y: string | number;
|
|
9330
|
+
z: string | number;
|
|
9331
|
+
}, {
|
|
9332
|
+
x: string | number;
|
|
9333
|
+
y: string | number;
|
|
9334
|
+
z: string | number;
|
|
9335
|
+
}>]>>;
|
|
9336
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
9337
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9338
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9339
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9340
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9341
|
+
x: number;
|
|
9342
|
+
y: number;
|
|
9343
|
+
z: number;
|
|
9344
|
+
}, {
|
|
9345
|
+
x: string | number;
|
|
9346
|
+
y: string | number;
|
|
9347
|
+
z: string | number;
|
|
9348
|
+
}>>;
|
|
9349
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
9350
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9351
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9352
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
9353
|
+
}, "strip", zod.ZodTypeAny, {
|
|
9354
|
+
x: number;
|
|
9355
|
+
y: number;
|
|
9356
|
+
z: number;
|
|
9357
|
+
}, {
|
|
9358
|
+
x: string | number;
|
|
9359
|
+
y: string | number;
|
|
9360
|
+
z: string | number;
|
|
9361
|
+
}>>;
|
|
9362
|
+
}, {
|
|
9363
|
+
jscad: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
|
|
9364
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9365
|
+
jscad: Record<string, any>;
|
|
9366
|
+
rotationOffset?: number | {
|
|
9367
|
+
x: string | number;
|
|
9368
|
+
y: string | number;
|
|
9369
|
+
z: string | number;
|
|
9370
|
+
} | undefined;
|
|
9371
|
+
positionOffset?: {
|
|
9372
|
+
x: number;
|
|
9373
|
+
y: number;
|
|
9374
|
+
z: number;
|
|
9375
|
+
} | undefined;
|
|
9376
|
+
size?: {
|
|
9377
|
+
x: number;
|
|
9378
|
+
y: number;
|
|
9379
|
+
z: number;
|
|
9380
|
+
} | undefined;
|
|
9381
|
+
}, {
|
|
9382
|
+
jscad: Record<string, any>;
|
|
9383
|
+
rotationOffset?: number | {
|
|
9384
|
+
x: string | number;
|
|
9385
|
+
y: string | number;
|
|
9386
|
+
z: string | number;
|
|
9387
|
+
} | undefined;
|
|
9388
|
+
positionOffset?: {
|
|
9389
|
+
x: string | number;
|
|
9390
|
+
y: string | number;
|
|
9391
|
+
z: string | number;
|
|
9392
|
+
} | undefined;
|
|
9393
|
+
size?: {
|
|
9394
|
+
x: string | number;
|
|
9395
|
+
y: string | number;
|
|
9396
|
+
z: string | number;
|
|
9397
|
+
} | undefined;
|
|
9398
|
+
}>]>>;
|
|
9399
|
+
children: zod.ZodOptional<zod.ZodAny>;
|
|
9400
|
+
symbolName: zod.ZodOptional<zod.ZodString>;
|
|
9401
|
+
}>, {
|
|
9402
|
+
channelType: zod.ZodEnum<["n", "p"]>;
|
|
9403
|
+
mosfetMode: zod.ZodEnum<["enhancement", "depletion"]>;
|
|
9404
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
9405
|
+
name: string;
|
|
9406
|
+
channelType: "n" | "p";
|
|
9407
|
+
mosfetMode: "enhancement" | "depletion";
|
|
9408
|
+
pcbX?: number | undefined;
|
|
9409
|
+
pcbY?: number | undefined;
|
|
9410
|
+
pcbRotation?: number | undefined;
|
|
9411
|
+
schX?: number | undefined;
|
|
9412
|
+
schY?: number | undefined;
|
|
9413
|
+
schRotation?: number | undefined;
|
|
9414
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
9415
|
+
footprint?: _tscircuit_props.Footprint | undefined;
|
|
9416
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
9417
|
+
key?: any;
|
|
9418
|
+
cadModel?: string | {
|
|
9419
|
+
stlUrl: string;
|
|
9420
|
+
rotationOffset?: number | {
|
|
9421
|
+
x: string | number;
|
|
9422
|
+
y: string | number;
|
|
9423
|
+
z: string | number;
|
|
9424
|
+
} | undefined;
|
|
9425
|
+
positionOffset?: {
|
|
9426
|
+
x: number;
|
|
9427
|
+
y: number;
|
|
9428
|
+
z: number;
|
|
9429
|
+
} | undefined;
|
|
9430
|
+
size?: {
|
|
9431
|
+
x: number;
|
|
9432
|
+
y: number;
|
|
9433
|
+
z: number;
|
|
9434
|
+
} | undefined;
|
|
9435
|
+
} | {
|
|
9436
|
+
objUrl: string;
|
|
9437
|
+
rotationOffset?: number | {
|
|
9438
|
+
x: string | number;
|
|
9439
|
+
y: string | number;
|
|
9440
|
+
z: string | number;
|
|
9441
|
+
} | undefined;
|
|
9442
|
+
positionOffset?: {
|
|
9443
|
+
x: number;
|
|
9444
|
+
y: number;
|
|
9445
|
+
z: number;
|
|
9446
|
+
} | undefined;
|
|
9447
|
+
size?: {
|
|
9448
|
+
x: number;
|
|
9449
|
+
y: number;
|
|
9450
|
+
z: number;
|
|
9451
|
+
} | undefined;
|
|
9452
|
+
mtlUrl?: string | undefined;
|
|
9453
|
+
} | {
|
|
9454
|
+
jscad: Record<string, any>;
|
|
9455
|
+
rotationOffset?: number | {
|
|
9456
|
+
x: string | number;
|
|
9457
|
+
y: string | number;
|
|
9458
|
+
z: string | number;
|
|
9459
|
+
} | undefined;
|
|
9460
|
+
positionOffset?: {
|
|
9461
|
+
x: number;
|
|
9462
|
+
y: number;
|
|
9463
|
+
z: number;
|
|
9464
|
+
} | undefined;
|
|
9465
|
+
size?: {
|
|
9466
|
+
x: number;
|
|
9467
|
+
y: number;
|
|
9468
|
+
z: number;
|
|
9469
|
+
} | undefined;
|
|
9470
|
+
} | undefined;
|
|
9471
|
+
children?: any;
|
|
9472
|
+
symbolName?: string | undefined;
|
|
9473
|
+
}, {
|
|
9474
|
+
name: string;
|
|
9475
|
+
channelType: "n" | "p";
|
|
9476
|
+
mosfetMode: "enhancement" | "depletion";
|
|
9477
|
+
pcbX?: string | number | undefined;
|
|
9478
|
+
pcbY?: string | number | undefined;
|
|
9479
|
+
pcbRotation?: string | number | undefined;
|
|
9480
|
+
schX?: string | number | undefined;
|
|
9481
|
+
schY?: string | number | undefined;
|
|
9482
|
+
schRotation?: string | number | undefined;
|
|
9483
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
9484
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
9485
|
+
} | undefined;
|
|
9486
|
+
footprint?: _tscircuit_props.Footprint | undefined;
|
|
9487
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
9488
|
+
key?: any;
|
|
9489
|
+
cadModel?: string | {
|
|
9490
|
+
stlUrl: string;
|
|
9491
|
+
rotationOffset?: number | {
|
|
9492
|
+
x: string | number;
|
|
9493
|
+
y: string | number;
|
|
9494
|
+
z: string | number;
|
|
9495
|
+
} | undefined;
|
|
9496
|
+
positionOffset?: {
|
|
9497
|
+
x: string | number;
|
|
9498
|
+
y: string | number;
|
|
9499
|
+
z: string | number;
|
|
9500
|
+
} | undefined;
|
|
9501
|
+
size?: {
|
|
9502
|
+
x: string | number;
|
|
9503
|
+
y: string | number;
|
|
9504
|
+
z: string | number;
|
|
9505
|
+
} | undefined;
|
|
9506
|
+
} | {
|
|
9507
|
+
objUrl: string;
|
|
9508
|
+
rotationOffset?: number | {
|
|
9509
|
+
x: string | number;
|
|
9510
|
+
y: string | number;
|
|
9511
|
+
z: string | number;
|
|
9512
|
+
} | undefined;
|
|
9513
|
+
positionOffset?: {
|
|
9514
|
+
x: string | number;
|
|
9515
|
+
y: string | number;
|
|
9516
|
+
z: string | number;
|
|
9517
|
+
} | undefined;
|
|
9518
|
+
size?: {
|
|
9519
|
+
x: string | number;
|
|
9520
|
+
y: string | number;
|
|
9521
|
+
z: string | number;
|
|
9522
|
+
} | undefined;
|
|
9523
|
+
mtlUrl?: string | undefined;
|
|
9524
|
+
} | {
|
|
9525
|
+
jscad: Record<string, any>;
|
|
9526
|
+
rotationOffset?: number | {
|
|
9527
|
+
x: string | number;
|
|
9528
|
+
y: string | number;
|
|
9529
|
+
z: string | number;
|
|
9530
|
+
} | undefined;
|
|
9531
|
+
positionOffset?: {
|
|
9532
|
+
x: string | number;
|
|
9533
|
+
y: string | number;
|
|
9534
|
+
z: string | number;
|
|
9535
|
+
} | undefined;
|
|
9536
|
+
size?: {
|
|
9537
|
+
x: string | number;
|
|
9538
|
+
y: string | number;
|
|
9539
|
+
z: string | number;
|
|
9540
|
+
} | undefined;
|
|
9541
|
+
} | undefined;
|
|
9542
|
+
children?: any;
|
|
9543
|
+
symbolName?: string | undefined;
|
|
9544
|
+
}>;
|
|
9545
|
+
shouldRenderAsSchematicBox: boolean;
|
|
9546
|
+
};
|
|
9547
|
+
doInitialSourceRender(): void;
|
|
9548
|
+
}
|
|
9549
|
+
|
|
9137
9550
|
declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
|
|
9138
9551
|
isLoading: boolean;
|
|
9139
9552
|
error?: Error | null;
|
|
@@ -9491,6 +9904,7 @@ interface TscircuitElements {
|
|
|
9491
9904
|
resonator: _tscircuit_props.ResonatorProps;
|
|
9492
9905
|
subcircuit: _tscircuit_props.SubcircuitGroupProps;
|
|
9493
9906
|
transistor: _tscircuit_props.TransistorProps;
|
|
9907
|
+
mosfet: _tscircuit_props.MosfetProps;
|
|
9494
9908
|
jscad: any;
|
|
9495
9909
|
}
|
|
9496
9910
|
declare module "react" {
|
|
@@ -9506,4 +9920,4 @@ declare module "react/jsx-runtime" {
|
|
|
9506
9920
|
}
|
|
9507
9921
|
}
|
|
9508
9922
|
|
|
9509
|
-
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 };
|
|
9923
|
+
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
|
}
|
|
@@ -4391,6 +4448,20 @@ var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
|
|
|
4391
4448
|
return Math.min(...capacitorMaxLengths);
|
|
4392
4449
|
};
|
|
4393
4450
|
|
|
4451
|
+
// lib/components/primitive-components/Trace/get-trace-display-name.ts
|
|
4452
|
+
function getTraceDisplayName({
|
|
4453
|
+
ports,
|
|
4454
|
+
nets
|
|
4455
|
+
}) {
|
|
4456
|
+
if (ports.length >= 2) {
|
|
4457
|
+
return `${ports[0]?.selector} to ${ports[1]?.selector}`;
|
|
4458
|
+
}
|
|
4459
|
+
if (ports.length === 1 && nets.length === 1) {
|
|
4460
|
+
return `${ports[0]?.selector} to net.${nets[0]._parsedProps.name}`;
|
|
4461
|
+
}
|
|
4462
|
+
return void 0;
|
|
4463
|
+
}
|
|
4464
|
+
|
|
4394
4465
|
// lib/components/primitive-components/Trace/Trace.ts
|
|
4395
4466
|
var portToObjective = (port) => {
|
|
4396
4467
|
const portPosition = port._getGlobalPcbPositionAfterLayout();
|
|
@@ -4534,13 +4605,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4534
4605
|
const { allPortsFound, portsWithSelectors: ports } = this._findConnectedPorts();
|
|
4535
4606
|
if (!allPortsFound) return;
|
|
4536
4607
|
const nets = this._findConnectedNets().nets;
|
|
4608
|
+
const displayName = getTraceDisplayName({ ports, nets });
|
|
4537
4609
|
const trace = db.source_trace.insert({
|
|
4538
4610
|
connected_source_port_ids: ports.map((p) => p.port.source_port_id),
|
|
4539
4611
|
connected_source_net_ids: nets.map((n) => n.source_net_id),
|
|
4540
4612
|
max_length: getMaxLengthFromConnectedCapacitors(
|
|
4541
4613
|
ports.map((p) => p.port),
|
|
4542
4614
|
{ db }
|
|
4543
|
-
) ?? props.maxLength
|
|
4615
|
+
) ?? props.maxLength,
|
|
4616
|
+
display_name: displayName
|
|
4544
4617
|
});
|
|
4545
4618
|
this.source_trace_id = trace.source_trace_id;
|
|
4546
4619
|
}
|
|
@@ -5152,6 +5225,11 @@ var Chip = class extends NormalComponent {
|
|
|
5152
5225
|
shouldRenderAsSchematicBox: true
|
|
5153
5226
|
};
|
|
5154
5227
|
}
|
|
5228
|
+
doInitialSchematicComponentRender() {
|
|
5229
|
+
const { _parsedProps: props } = this;
|
|
5230
|
+
if (props?.noSchematicRepresentation === true) return;
|
|
5231
|
+
super.doInitialSchematicComponentRender();
|
|
5232
|
+
}
|
|
5155
5233
|
doInitialSourceRender() {
|
|
5156
5234
|
const { db } = this.root;
|
|
5157
5235
|
const { _parsedProps: props } = this;
|
|
@@ -6022,6 +6100,33 @@ var Transistor = class extends NormalComponent {
|
|
|
6022
6100
|
}
|
|
6023
6101
|
};
|
|
6024
6102
|
|
|
6103
|
+
// lib/components/normal-components/Mosfet.ts
|
|
6104
|
+
import { mosfetProps } from "@tscircuit/props";
|
|
6105
|
+
var Mosfet = class extends NormalComponent {
|
|
6106
|
+
get config() {
|
|
6107
|
+
const mosfetMode = this.props.mosfetMode === "depletion" ? "d" : "e";
|
|
6108
|
+
const channelType = this.props.channelType;
|
|
6109
|
+
const baseSymbolName = `${channelType}_channel_${mosfetMode}_mosfet_transistor`;
|
|
6110
|
+
return {
|
|
6111
|
+
componentName: "Mosfet",
|
|
6112
|
+
schematicSymbolName: baseSymbolName,
|
|
6113
|
+
zodProps: mosfetProps,
|
|
6114
|
+
shouldRenderAsSchematicBox: false
|
|
6115
|
+
};
|
|
6116
|
+
}
|
|
6117
|
+
doInitialSourceRender() {
|
|
6118
|
+
const { db } = this.root;
|
|
6119
|
+
const { _parsedProps: props } = this;
|
|
6120
|
+
const source_component = db.source_component.insert({
|
|
6121
|
+
ftype: "simple_mosfet",
|
|
6122
|
+
name: props.name,
|
|
6123
|
+
mosfet_mode: props.mosfetMode,
|
|
6124
|
+
channel_type: props.channelType
|
|
6125
|
+
});
|
|
6126
|
+
this.source_component_id = source_component.source_component_id;
|
|
6127
|
+
}
|
|
6128
|
+
};
|
|
6129
|
+
|
|
6025
6130
|
// lib/RootCircuit.ts
|
|
6026
6131
|
import { su } from "@tscircuit/soup-util";
|
|
6027
6132
|
import { isValidElement as isValidElement2 } from "react";
|
|
@@ -6352,6 +6457,7 @@ export {
|
|
|
6352
6457
|
Jumper,
|
|
6353
6458
|
Keepout,
|
|
6354
6459
|
Led,
|
|
6460
|
+
Mosfet,
|
|
6355
6461
|
Net,
|
|
6356
6462
|
NetAlias,
|
|
6357
6463
|
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.253",
|
|
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.126",
|
|
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",
|