@tscircuit/core 0.0.866 → 0.0.868
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 +228 -0
- package/dist/index.js +178 -49
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -20671,6 +20671,7 @@ declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
|
|
|
20671
20671
|
get config(): {
|
|
20672
20672
|
componentName: string;
|
|
20673
20673
|
zodProps: zod.ZodObject<{
|
|
20674
|
+
children: zod.ZodOptional<zod.ZodAny>;
|
|
20674
20675
|
originalLayer: zod.ZodOptional<zod.ZodDefault<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
20675
20676
|
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
20676
20677
|
}, "strip", zod.ZodTypeAny, {
|
|
@@ -20680,9 +20681,14 @@ declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
|
|
|
20680
20681
|
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
20681
20682
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
20682
20683
|
}>>>;
|
|
20684
|
+
circuitJson: zod.ZodOptional<zod.ZodArray<zod.ZodAny, "many">>;
|
|
20683
20685
|
}, "strip", zod.ZodTypeAny, {
|
|
20686
|
+
children?: any;
|
|
20687
|
+
circuitJson?: any[] | undefined;
|
|
20684
20688
|
originalLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
20685
20689
|
}, {
|
|
20690
|
+
children?: any;
|
|
20691
|
+
circuitJson?: any[] | undefined;
|
|
20686
20692
|
originalLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
20687
20693
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
20688
20694
|
} | undefined;
|
|
@@ -22387,6 +22393,154 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
22387
22393
|
portHints?: (string | number)[] | undefined;
|
|
22388
22394
|
holeOffsetX?: string | number | undefined;
|
|
22389
22395
|
holeOffsetY?: string | number | undefined;
|
|
22396
|
+
}>, zod.ZodObject<Omit<{
|
|
22397
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22398
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22399
|
+
pcbOffsetX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22400
|
+
pcbOffsetY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22401
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22402
|
+
pcbPositionAnchor: zod.ZodOptional<zod.ZodString>;
|
|
22403
|
+
pcbPositionMode: zod.ZodOptional<zod.ZodEnum<["relative_to_group_anchor", "auto", "relative_to_board_anchor", "relative_to_component_anchor"]>>;
|
|
22404
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
22405
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
22406
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22407
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
22408
|
+
}, {
|
|
22409
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
22410
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
22411
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
22412
|
+
}>>;
|
|
22413
|
+
pcbMarginTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22414
|
+
pcbMarginRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22415
|
+
pcbMarginBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22416
|
+
pcbMarginLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22417
|
+
pcbMarginX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22418
|
+
pcbMarginY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22419
|
+
pcbStyle: zod.ZodOptional<zod.ZodObject<{
|
|
22420
|
+
silkscreenFontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22421
|
+
silkscreenTextPosition: zod.ZodOptional<zod.ZodUnion<[zod.ZodEnum<["centered", "outside", "none"]>, zod.ZodObject<{
|
|
22422
|
+
offsetX: zod.ZodNumber;
|
|
22423
|
+
offsetY: zod.ZodNumber;
|
|
22424
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22425
|
+
offsetX: number;
|
|
22426
|
+
offsetY: number;
|
|
22427
|
+
}, {
|
|
22428
|
+
offsetX: number;
|
|
22429
|
+
offsetY: number;
|
|
22430
|
+
}>]>>;
|
|
22431
|
+
silkscreenTextVisibility: zod.ZodOptional<zod.ZodEnum<["hidden", "visible", "inherit"]>>;
|
|
22432
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22433
|
+
silkscreenFontSize?: number | undefined;
|
|
22434
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
22435
|
+
offsetX: number;
|
|
22436
|
+
offsetY: number;
|
|
22437
|
+
} | undefined;
|
|
22438
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
22439
|
+
}, {
|
|
22440
|
+
silkscreenFontSize?: string | number | undefined;
|
|
22441
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
22442
|
+
offsetX: number;
|
|
22443
|
+
offsetY: number;
|
|
22444
|
+
} | undefined;
|
|
22445
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
22446
|
+
}>>;
|
|
22447
|
+
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
22448
|
+
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
22449
|
+
}, "pcbRotation" | "layer"> & {
|
|
22450
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
22451
|
+
connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
|
|
22452
|
+
shape: zod.ZodLiteral<"hole_with_polygon_pad">;
|
|
22453
|
+
holeShape: zod.ZodEnum<["circle", "oval", "pill", "rotated_pill"]>;
|
|
22454
|
+
holeDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22455
|
+
holeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22456
|
+
holeHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
22457
|
+
padOutline: zod.ZodArray<zod.ZodObject<{
|
|
22458
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
22459
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
22460
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22461
|
+
x: number;
|
|
22462
|
+
y: number;
|
|
22463
|
+
}, {
|
|
22464
|
+
x: string | number;
|
|
22465
|
+
y: string | number;
|
|
22466
|
+
}>, "many">;
|
|
22467
|
+
holeOffsetX: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
22468
|
+
holeOffsetY: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
22469
|
+
portHints: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, "many">>;
|
|
22470
|
+
}, "strip", zod.ZodTypeAny, {
|
|
22471
|
+
shape: "hole_with_polygon_pad";
|
|
22472
|
+
holeOffsetX: number;
|
|
22473
|
+
holeOffsetY: number;
|
|
22474
|
+
holeShape: "circle" | "oval" | "pill" | "rotated_pill";
|
|
22475
|
+
padOutline: {
|
|
22476
|
+
x: number;
|
|
22477
|
+
y: number;
|
|
22478
|
+
}[];
|
|
22479
|
+
pcbX?: number | undefined;
|
|
22480
|
+
pcbY?: number | undefined;
|
|
22481
|
+
pcbOffsetX?: number | undefined;
|
|
22482
|
+
pcbOffsetY?: number | undefined;
|
|
22483
|
+
pcbPositionAnchor?: string | undefined;
|
|
22484
|
+
pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
22485
|
+
pcbMarginTop?: number | undefined;
|
|
22486
|
+
pcbMarginRight?: number | undefined;
|
|
22487
|
+
pcbMarginBottom?: number | undefined;
|
|
22488
|
+
pcbMarginLeft?: number | undefined;
|
|
22489
|
+
pcbMarginX?: number | undefined;
|
|
22490
|
+
pcbMarginY?: number | undefined;
|
|
22491
|
+
pcbStyle?: {
|
|
22492
|
+
silkscreenFontSize?: number | undefined;
|
|
22493
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
22494
|
+
offsetX: number;
|
|
22495
|
+
offsetY: number;
|
|
22496
|
+
} | undefined;
|
|
22497
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
22498
|
+
} | undefined;
|
|
22499
|
+
pcbRelative?: boolean | undefined;
|
|
22500
|
+
relative?: boolean | undefined;
|
|
22501
|
+
name?: string | undefined;
|
|
22502
|
+
connectsTo?: string | string[] | undefined;
|
|
22503
|
+
holeDiameter?: number | undefined;
|
|
22504
|
+
portHints?: (string | number)[] | undefined;
|
|
22505
|
+
holeWidth?: number | undefined;
|
|
22506
|
+
holeHeight?: number | undefined;
|
|
22507
|
+
}, {
|
|
22508
|
+
shape: "hole_with_polygon_pad";
|
|
22509
|
+
holeOffsetX: string | number;
|
|
22510
|
+
holeOffsetY: string | number;
|
|
22511
|
+
holeShape: "circle" | "oval" | "pill" | "rotated_pill";
|
|
22512
|
+
padOutline: {
|
|
22513
|
+
x: string | number;
|
|
22514
|
+
y: string | number;
|
|
22515
|
+
}[];
|
|
22516
|
+
pcbX?: string | number | undefined;
|
|
22517
|
+
pcbY?: string | number | undefined;
|
|
22518
|
+
pcbOffsetX?: string | number | undefined;
|
|
22519
|
+
pcbOffsetY?: string | number | undefined;
|
|
22520
|
+
pcbPositionAnchor?: string | undefined;
|
|
22521
|
+
pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
22522
|
+
pcbMarginTop?: string | number | undefined;
|
|
22523
|
+
pcbMarginRight?: string | number | undefined;
|
|
22524
|
+
pcbMarginBottom?: string | number | undefined;
|
|
22525
|
+
pcbMarginLeft?: string | number | undefined;
|
|
22526
|
+
pcbMarginX?: string | number | undefined;
|
|
22527
|
+
pcbMarginY?: string | number | undefined;
|
|
22528
|
+
pcbStyle?: {
|
|
22529
|
+
silkscreenFontSize?: string | number | undefined;
|
|
22530
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
22531
|
+
offsetX: number;
|
|
22532
|
+
offsetY: number;
|
|
22533
|
+
} | undefined;
|
|
22534
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
22535
|
+
} | undefined;
|
|
22536
|
+
pcbRelative?: boolean | undefined;
|
|
22537
|
+
relative?: boolean | undefined;
|
|
22538
|
+
name?: string | undefined;
|
|
22539
|
+
connectsTo?: string | string[] | undefined;
|
|
22540
|
+
holeDiameter?: string | number | undefined;
|
|
22541
|
+
portHints?: (string | number)[] | undefined;
|
|
22542
|
+
holeWidth?: string | number | undefined;
|
|
22543
|
+
holeHeight?: string | number | undefined;
|
|
22390
22544
|
}>]>, {
|
|
22391
22545
|
shape: "circle";
|
|
22392
22546
|
holeDiameter: number;
|
|
@@ -22557,6 +22711,43 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
22557
22711
|
portHints?: (string | number)[] | undefined;
|
|
22558
22712
|
holeOffsetX?: number | undefined;
|
|
22559
22713
|
holeOffsetY?: number | undefined;
|
|
22714
|
+
} | {
|
|
22715
|
+
shape: "hole_with_polygon_pad";
|
|
22716
|
+
holeOffsetX: number;
|
|
22717
|
+
holeOffsetY: number;
|
|
22718
|
+
holeShape: "circle" | "oval" | "pill" | "rotated_pill";
|
|
22719
|
+
padOutline: {
|
|
22720
|
+
x: number;
|
|
22721
|
+
y: number;
|
|
22722
|
+
}[];
|
|
22723
|
+
pcbX?: number | undefined;
|
|
22724
|
+
pcbY?: number | undefined;
|
|
22725
|
+
pcbOffsetX?: number | undefined;
|
|
22726
|
+
pcbOffsetY?: number | undefined;
|
|
22727
|
+
pcbPositionAnchor?: string | undefined;
|
|
22728
|
+
pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
22729
|
+
pcbMarginTop?: number | undefined;
|
|
22730
|
+
pcbMarginRight?: number | undefined;
|
|
22731
|
+
pcbMarginBottom?: number | undefined;
|
|
22732
|
+
pcbMarginLeft?: number | undefined;
|
|
22733
|
+
pcbMarginX?: number | undefined;
|
|
22734
|
+
pcbMarginY?: number | undefined;
|
|
22735
|
+
pcbStyle?: {
|
|
22736
|
+
silkscreenFontSize?: number | undefined;
|
|
22737
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
22738
|
+
offsetX: number;
|
|
22739
|
+
offsetY: number;
|
|
22740
|
+
} | undefined;
|
|
22741
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
22742
|
+
} | undefined;
|
|
22743
|
+
pcbRelative?: boolean | undefined;
|
|
22744
|
+
relative?: boolean | undefined;
|
|
22745
|
+
name?: string | undefined;
|
|
22746
|
+
connectsTo?: string | string[] | undefined;
|
|
22747
|
+
holeDiameter?: number | undefined;
|
|
22748
|
+
portHints?: (string | number)[] | undefined;
|
|
22749
|
+
holeWidth?: number | undefined;
|
|
22750
|
+
holeHeight?: number | undefined;
|
|
22560
22751
|
}, {
|
|
22561
22752
|
shape: "circle";
|
|
22562
22753
|
holeDiameter: string | number;
|
|
@@ -22727,6 +22918,43 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
22727
22918
|
portHints?: (string | number)[] | undefined;
|
|
22728
22919
|
holeOffsetX?: string | number | undefined;
|
|
22729
22920
|
holeOffsetY?: string | number | undefined;
|
|
22921
|
+
} | {
|
|
22922
|
+
shape: "hole_with_polygon_pad";
|
|
22923
|
+
holeOffsetX: string | number;
|
|
22924
|
+
holeOffsetY: string | number;
|
|
22925
|
+
holeShape: "circle" | "oval" | "pill" | "rotated_pill";
|
|
22926
|
+
padOutline: {
|
|
22927
|
+
x: string | number;
|
|
22928
|
+
y: string | number;
|
|
22929
|
+
}[];
|
|
22930
|
+
pcbX?: string | number | undefined;
|
|
22931
|
+
pcbY?: string | number | undefined;
|
|
22932
|
+
pcbOffsetX?: string | number | undefined;
|
|
22933
|
+
pcbOffsetY?: string | number | undefined;
|
|
22934
|
+
pcbPositionAnchor?: string | undefined;
|
|
22935
|
+
pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
22936
|
+
pcbMarginTop?: string | number | undefined;
|
|
22937
|
+
pcbMarginRight?: string | number | undefined;
|
|
22938
|
+
pcbMarginBottom?: string | number | undefined;
|
|
22939
|
+
pcbMarginLeft?: string | number | undefined;
|
|
22940
|
+
pcbMarginX?: string | number | undefined;
|
|
22941
|
+
pcbMarginY?: string | number | undefined;
|
|
22942
|
+
pcbStyle?: {
|
|
22943
|
+
silkscreenFontSize?: string | number | undefined;
|
|
22944
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
22945
|
+
offsetX: number;
|
|
22946
|
+
offsetY: number;
|
|
22947
|
+
} | undefined;
|
|
22948
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
22949
|
+
} | undefined;
|
|
22950
|
+
pcbRelative?: boolean | undefined;
|
|
22951
|
+
relative?: boolean | undefined;
|
|
22952
|
+
name?: string | undefined;
|
|
22953
|
+
connectsTo?: string | string[] | undefined;
|
|
22954
|
+
holeDiameter?: string | number | undefined;
|
|
22955
|
+
portHints?: (string | number)[] | undefined;
|
|
22956
|
+
holeWidth?: string | number | undefined;
|
|
22957
|
+
holeHeight?: string | number | undefined;
|
|
22730
22958
|
}>;
|
|
22731
22959
|
};
|
|
22732
22960
|
getAvailablePcbLayers(): string[];
|
package/dist/index.js
CHANGED
|
@@ -2434,6 +2434,24 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2434
2434
|
if (props.shape === "pill_hole_with_rect_pad") {
|
|
2435
2435
|
return { width: props.rectPadWidth, height: props.rectPadHeight };
|
|
2436
2436
|
}
|
|
2437
|
+
if (props.shape === "hole_with_polygon_pad") {
|
|
2438
|
+
if (!props.padOutline || props.padOutline.length === 0) {
|
|
2439
|
+
throw new Error(
|
|
2440
|
+
"padOutline is required for hole_with_polygon_pad shape"
|
|
2441
|
+
);
|
|
2442
|
+
}
|
|
2443
|
+
const xs = props.padOutline.map(
|
|
2444
|
+
(p) => typeof p.x === "number" ? p.x : parseFloat(String(p.x))
|
|
2445
|
+
);
|
|
2446
|
+
const ys = props.padOutline.map(
|
|
2447
|
+
(p) => typeof p.y === "number" ? p.y : parseFloat(String(p.y))
|
|
2448
|
+
);
|
|
2449
|
+
const minX = Math.min(...xs);
|
|
2450
|
+
const maxX = Math.max(...xs);
|
|
2451
|
+
const minY = Math.min(...ys);
|
|
2452
|
+
const maxY = Math.max(...ys);
|
|
2453
|
+
return { width: maxX - minX, height: maxY - minY };
|
|
2454
|
+
}
|
|
2437
2455
|
throw new Error(
|
|
2438
2456
|
`getPcbSize for shape "${props.shape}" not implemented for ${this.componentName}`
|
|
2439
2457
|
);
|
|
@@ -2626,6 +2644,34 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2626
2644
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2627
2645
|
});
|
|
2628
2646
|
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
2647
|
+
} else if (props.shape === "hole_with_polygon_pad") {
|
|
2648
|
+
const padOutline = (props.padOutline || []).map((point) => {
|
|
2649
|
+
const x = typeof point.x === "number" ? point.x : parseFloat(String(point.x));
|
|
2650
|
+
const y = typeof point.y === "number" ? point.y : parseFloat(String(point.y));
|
|
2651
|
+
return {
|
|
2652
|
+
x,
|
|
2653
|
+
y
|
|
2654
|
+
};
|
|
2655
|
+
});
|
|
2656
|
+
const pcb_plated_hole = db.pcb_plated_hole.insert({
|
|
2657
|
+
pcb_component_id,
|
|
2658
|
+
pcb_port_id: this.matchedPort?.pcb_port_id,
|
|
2659
|
+
shape: "hole_with_polygon_pad",
|
|
2660
|
+
hole_shape: props.holeShape || "circle",
|
|
2661
|
+
hole_diameter: props.holeDiameter,
|
|
2662
|
+
hole_width: props.holeWidth,
|
|
2663
|
+
hole_height: props.holeHeight,
|
|
2664
|
+
pad_outline: padOutline,
|
|
2665
|
+
hole_offset_x: typeof props.holeOffsetX === "number" ? props.holeOffsetX : parseFloat(String(props.holeOffsetX || 0)),
|
|
2666
|
+
hole_offset_y: typeof props.holeOffsetY === "number" ? props.holeOffsetY : parseFloat(String(props.holeOffsetY || 0)),
|
|
2667
|
+
port_hints: this.getNameAndAliases(),
|
|
2668
|
+
x: position.x,
|
|
2669
|
+
y: position.y,
|
|
2670
|
+
layers: ["top", "bottom"],
|
|
2671
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
2672
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2673
|
+
});
|
|
2674
|
+
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
2629
2675
|
}
|
|
2630
2676
|
}
|
|
2631
2677
|
doInitialPcbPortAttachment() {
|
|
@@ -3175,6 +3221,22 @@ var createComponentsFromCircuitJson = ({
|
|
|
3175
3221
|
holeOffsetY: elm.hole_offset_y
|
|
3176
3222
|
})
|
|
3177
3223
|
);
|
|
3224
|
+
} else if (elm.shape === "hole_with_polygon_pad") {
|
|
3225
|
+
components.push(
|
|
3226
|
+
new PlatedHole({
|
|
3227
|
+
pcbX: elm.x,
|
|
3228
|
+
pcbY: elm.y,
|
|
3229
|
+
shape: "hole_with_polygon_pad",
|
|
3230
|
+
holeShape: elm.hole_shape || "circle",
|
|
3231
|
+
holeDiameter: elm.hole_diameter,
|
|
3232
|
+
holeWidth: elm.hole_width,
|
|
3233
|
+
holeHeight: elm.hole_height,
|
|
3234
|
+
padOutline: elm.pad_outline || [],
|
|
3235
|
+
holeOffsetX: elm.hole_offset_x,
|
|
3236
|
+
holeOffsetY: elm.hole_offset_y,
|
|
3237
|
+
portHints: elm.port_hints
|
|
3238
|
+
})
|
|
3239
|
+
);
|
|
3178
3240
|
}
|
|
3179
3241
|
} else if (elm.type === "pcb_keepout" && elm.shape === "circle") {
|
|
3180
3242
|
components.push(
|
|
@@ -5505,6 +5567,29 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
|
|
|
5505
5567
|
height: element.outer_height,
|
|
5506
5568
|
connectedTo: withNetId([element.pcb_plated_hole_id])
|
|
5507
5569
|
});
|
|
5570
|
+
} else if (element.shape === "hole_with_polygon_pad") {
|
|
5571
|
+
if ("pad_outline" in element && element.pad_outline && element.pad_outline.length > 0) {
|
|
5572
|
+
const xs = element.pad_outline.map((p) => element.x + p.x);
|
|
5573
|
+
const ys = element.pad_outline.map((p) => element.y + p.y);
|
|
5574
|
+
const minX = Math.min(...xs);
|
|
5575
|
+
const maxX = Math.max(...xs);
|
|
5576
|
+
const minY = Math.min(...ys);
|
|
5577
|
+
const maxY = Math.max(...ys);
|
|
5578
|
+
const centerX = (minX + maxX) / 2;
|
|
5579
|
+
const centerY = (minY + maxY) / 2;
|
|
5580
|
+
obstacles.push({
|
|
5581
|
+
// @ts-ignore
|
|
5582
|
+
type: "rect",
|
|
5583
|
+
layers: EVERY_LAYER,
|
|
5584
|
+
center: {
|
|
5585
|
+
x: centerX,
|
|
5586
|
+
y: centerY
|
|
5587
|
+
},
|
|
5588
|
+
width: maxX - minX,
|
|
5589
|
+
height: maxY - minY,
|
|
5590
|
+
connectedTo: withNetId([element.pcb_plated_hole_id])
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5508
5593
|
}
|
|
5509
5594
|
} else if (element.type === "pcb_trace") {
|
|
5510
5595
|
const traceObstacles = getObstaclesFromRoute(
|
|
@@ -11641,6 +11726,20 @@ function getObstacleDimensionsFromPlatedHole(hole) {
|
|
|
11641
11726
|
width: hole.outer_width,
|
|
11642
11727
|
height: hole.outer_height
|
|
11643
11728
|
};
|
|
11729
|
+
case "hole_with_polygon_pad":
|
|
11730
|
+
if (!("pad_outline" in hole) || !hole.pad_outline || hole.pad_outline.length === 0) {
|
|
11731
|
+
return null;
|
|
11732
|
+
}
|
|
11733
|
+
const xs = hole.pad_outline.map((p) => p.x);
|
|
11734
|
+
const ys = hole.pad_outline.map((p) => p.y);
|
|
11735
|
+
const minX = Math.min(...xs);
|
|
11736
|
+
const maxX = Math.max(...xs);
|
|
11737
|
+
const minY = Math.min(...ys);
|
|
11738
|
+
const maxY = Math.max(...ys);
|
|
11739
|
+
return {
|
|
11740
|
+
width: maxX - minX,
|
|
11741
|
+
height: maxY - minY
|
|
11742
|
+
};
|
|
11644
11743
|
default:
|
|
11645
11744
|
return null;
|
|
11646
11745
|
}
|
|
@@ -15983,6 +16082,78 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
|
|
|
15983
16082
|
subcircuit.add(trace);
|
|
15984
16083
|
}
|
|
15985
16084
|
|
|
16085
|
+
// lib/components/normal-components/Transistor.ts
|
|
16086
|
+
import { transistorProps } from "@tscircuit/props";
|
|
16087
|
+
var Transistor = class extends NormalComponent3 {
|
|
16088
|
+
get config() {
|
|
16089
|
+
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
16090
|
+
return {
|
|
16091
|
+
componentName: "Transistor",
|
|
16092
|
+
schematicSymbolName: this.props.symbolName ?? baseSymbolName,
|
|
16093
|
+
zodProps: transistorProps,
|
|
16094
|
+
sourceFtype: "simple_transistor",
|
|
16095
|
+
shouldRenderAsSchematicBox: false
|
|
16096
|
+
};
|
|
16097
|
+
}
|
|
16098
|
+
initPorts() {
|
|
16099
|
+
const pinAliases = {
|
|
16100
|
+
pin1: ["collector", "c"],
|
|
16101
|
+
pin2: ["emitter", "e"],
|
|
16102
|
+
pin3: ["base", "b"]
|
|
16103
|
+
};
|
|
16104
|
+
super.initPorts({
|
|
16105
|
+
pinCount: 3,
|
|
16106
|
+
additionalAliases: pinAliases
|
|
16107
|
+
});
|
|
16108
|
+
}
|
|
16109
|
+
emitter = this.portMap.pin1;
|
|
16110
|
+
collector = this.portMap.pin2;
|
|
16111
|
+
base = this.portMap.pin3;
|
|
16112
|
+
doInitialCreateNetsFromProps() {
|
|
16113
|
+
this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
|
|
16114
|
+
}
|
|
16115
|
+
doInitialCreateTracesFromProps() {
|
|
16116
|
+
this._createTracesFromConnectionsProp();
|
|
16117
|
+
}
|
|
16118
|
+
doInitialSourceRender() {
|
|
16119
|
+
const { db } = this.root;
|
|
16120
|
+
const { _parsedProps: props } = this;
|
|
16121
|
+
const source_component = db.source_component.insert({
|
|
16122
|
+
ftype: "simple_transistor",
|
|
16123
|
+
name: this.name,
|
|
16124
|
+
transistor_type: props.type
|
|
16125
|
+
});
|
|
16126
|
+
this.source_component_id = source_component.source_component_id;
|
|
16127
|
+
}
|
|
16128
|
+
};
|
|
16129
|
+
|
|
16130
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceTransistor.ts
|
|
16131
|
+
function inflateSourceTransistor(sourceElm, inflatorContext) {
|
|
16132
|
+
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
16133
|
+
const pcbElm = injectionDb.pcb_component.getWhere({
|
|
16134
|
+
source_component_id: sourceElm.source_component_id
|
|
16135
|
+
});
|
|
16136
|
+
const cadElm = injectionDb.cad_component.getWhere({
|
|
16137
|
+
source_component_id: sourceElm.source_component_id
|
|
16138
|
+
});
|
|
16139
|
+
const transistor = new Transistor({
|
|
16140
|
+
name: sourceElm.name,
|
|
16141
|
+
type: sourceElm.transistor_type
|
|
16142
|
+
});
|
|
16143
|
+
if (pcbElm) {
|
|
16144
|
+
inflatePcbComponent(pcbElm, {
|
|
16145
|
+
...inflatorContext,
|
|
16146
|
+
normalComponent: transistor
|
|
16147
|
+
});
|
|
16148
|
+
}
|
|
16149
|
+
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16150
|
+
const group = groupsMap.get(sourceElm.source_group_id);
|
|
16151
|
+
group.add(transistor);
|
|
16152
|
+
} else {
|
|
16153
|
+
subcircuit.add(transistor);
|
|
16154
|
+
}
|
|
16155
|
+
}
|
|
16156
|
+
|
|
15986
16157
|
// lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
|
|
15987
16158
|
var Subcircuit = class extends Group6 {
|
|
15988
16159
|
constructor(props) {
|
|
@@ -16040,6 +16211,9 @@ var Subcircuit = class extends Group6 {
|
|
|
16040
16211
|
case "simple_chip":
|
|
16041
16212
|
inflateSourceChip(sourceComponent, inflationCtx);
|
|
16042
16213
|
break;
|
|
16214
|
+
case "simple_transistor":
|
|
16215
|
+
inflateSourceTransistor(sourceComponent, inflationCtx);
|
|
16216
|
+
break;
|
|
16043
16217
|
default:
|
|
16044
16218
|
throw new Error(
|
|
16045
16219
|
`No inflator implemented for source component ftype: "${sourceComponent.ftype}"`
|
|
@@ -17042,51 +17216,6 @@ var Crystal = class extends NormalComponent3 {
|
|
|
17042
17216
|
}
|
|
17043
17217
|
};
|
|
17044
17218
|
|
|
17045
|
-
// lib/components/normal-components/Transistor.ts
|
|
17046
|
-
import { transistorProps } from "@tscircuit/props";
|
|
17047
|
-
var Transistor = class extends NormalComponent3 {
|
|
17048
|
-
get config() {
|
|
17049
|
-
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
17050
|
-
return {
|
|
17051
|
-
componentName: "Transistor",
|
|
17052
|
-
schematicSymbolName: this.props.symbolName ?? baseSymbolName,
|
|
17053
|
-
zodProps: transistorProps,
|
|
17054
|
-
sourceFtype: "simple_transistor",
|
|
17055
|
-
shouldRenderAsSchematicBox: false
|
|
17056
|
-
};
|
|
17057
|
-
}
|
|
17058
|
-
initPorts() {
|
|
17059
|
-
const pinAliases = {
|
|
17060
|
-
pin1: ["collector", "c"],
|
|
17061
|
-
pin2: ["emitter", "e"],
|
|
17062
|
-
pin3: ["base", "b"]
|
|
17063
|
-
};
|
|
17064
|
-
super.initPorts({
|
|
17065
|
-
pinCount: 3,
|
|
17066
|
-
additionalAliases: pinAliases
|
|
17067
|
-
});
|
|
17068
|
-
}
|
|
17069
|
-
emitter = this.portMap.pin1;
|
|
17070
|
-
collector = this.portMap.pin2;
|
|
17071
|
-
base = this.portMap.pin3;
|
|
17072
|
-
doInitialCreateNetsFromProps() {
|
|
17073
|
-
this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
|
|
17074
|
-
}
|
|
17075
|
-
doInitialCreateTracesFromProps() {
|
|
17076
|
-
this._createTracesFromConnectionsProp();
|
|
17077
|
-
}
|
|
17078
|
-
doInitialSourceRender() {
|
|
17079
|
-
const { db } = this.root;
|
|
17080
|
-
const { _parsedProps: props } = this;
|
|
17081
|
-
const source_component = db.source_component.insert({
|
|
17082
|
-
ftype: "simple_transistor",
|
|
17083
|
-
name: this.name,
|
|
17084
|
-
transistor_type: props.type
|
|
17085
|
-
});
|
|
17086
|
-
this.source_component_id = source_component.source_component_id;
|
|
17087
|
-
}
|
|
17088
|
-
};
|
|
17089
|
-
|
|
17090
17219
|
// lib/components/normal-components/Mosfet.ts
|
|
17091
17220
|
import { mosfetProps } from "@tscircuit/props";
|
|
17092
17221
|
var Mosfet = class extends NormalComponent3 {
|
|
@@ -17903,7 +18032,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17903
18032
|
var package_default = {
|
|
17904
18033
|
name: "@tscircuit/core",
|
|
17905
18034
|
type: "module",
|
|
17906
|
-
version: "0.0.
|
|
18035
|
+
version: "0.0.867",
|
|
17907
18036
|
types: "dist/index.d.ts",
|
|
17908
18037
|
main: "dist/index.js",
|
|
17909
18038
|
module: "dist/index.js",
|
|
@@ -17947,7 +18076,7 @@ var package_default = {
|
|
|
17947
18076
|
"@tscircuit/math-utils": "^0.0.29",
|
|
17948
18077
|
"@tscircuit/miniflex": "^0.0.4",
|
|
17949
18078
|
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
17950
|
-
"@tscircuit/props": "^0.0.
|
|
18079
|
+
"@tscircuit/props": "^0.0.403",
|
|
17951
18080
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
17952
18081
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
17953
18082
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
@@ -17961,13 +18090,13 @@ var package_default = {
|
|
|
17961
18090
|
"bun-match-svg": "0.0.12",
|
|
17962
18091
|
"calculate-elbow": "^0.0.12",
|
|
17963
18092
|
"chokidar-cli": "^3.0.0",
|
|
17964
|
-
"circuit-json": "^0.0.
|
|
18093
|
+
"circuit-json": "^0.0.308",
|
|
17965
18094
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17966
18095
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17967
18096
|
"circuit-json-to-gltf": "^0.0.31",
|
|
17968
18097
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
17969
18098
|
"circuit-json-to-spice": "^0.0.16",
|
|
17970
|
-
"circuit-to-svg": "^0.0.
|
|
18099
|
+
"circuit-to-svg": "^0.0.269",
|
|
17971
18100
|
concurrently: "^9.1.2",
|
|
17972
18101
|
"connectivity-map": "^1.0.0",
|
|
17973
18102
|
debug: "^4.3.6",
|
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.868",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@tscircuit/math-utils": "^0.0.29",
|
|
46
46
|
"@tscircuit/miniflex": "^0.0.4",
|
|
47
47
|
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
48
|
-
"@tscircuit/props": "^0.0.
|
|
48
|
+
"@tscircuit/props": "^0.0.403",
|
|
49
49
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
50
50
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
51
51
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"bun-match-svg": "0.0.12",
|
|
60
60
|
"calculate-elbow": "^0.0.12",
|
|
61
61
|
"chokidar-cli": "^3.0.0",
|
|
62
|
-
"circuit-json": "^0.0.
|
|
62
|
+
"circuit-json": "^0.0.308",
|
|
63
63
|
"circuit-json-to-bpc": "^0.0.13",
|
|
64
64
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
65
65
|
"circuit-json-to-gltf": "^0.0.31",
|
|
66
66
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
67
67
|
"circuit-json-to-spice": "^0.0.16",
|
|
68
|
-
"circuit-to-svg": "^0.0.
|
|
68
|
+
"circuit-to-svg": "^0.0.269",
|
|
69
69
|
"concurrently": "^9.1.2",
|
|
70
70
|
"connectivity-map": "^1.0.0",
|
|
71
71
|
"debug": "^4.3.6",
|