@tscircuit/core 0.0.865 → 0.0.867
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 +118 -14
- 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
|
@@ -609,16 +609,19 @@ var cssSelectPrimitiveComponentAdapterOnlySubcircuits = {
|
|
|
609
609
|
};
|
|
610
610
|
|
|
611
611
|
// lib/components/base-components/PrimitiveComponent/preprocessSelector.ts
|
|
612
|
-
var
|
|
612
|
+
var buildPlusMinusNetErrorMessage = (selector, component) => {
|
|
613
|
+
const netName = selector.split("net.")[1]?.split(/[ >]/)[0] ?? selector;
|
|
614
|
+
const componentName = component?.componentName ?? "Unknown component";
|
|
615
|
+
return `Net names cannot contain "+" or "-" (component "${componentName}" received "${netName}" via "${selector}"). Try using underscores instead, e.g. VCC_P`;
|
|
616
|
+
};
|
|
617
|
+
var preprocessSelector = (selector, component) => {
|
|
613
618
|
if (/net\.[^\s>]*\./.test(selector)) {
|
|
614
619
|
throw new Error(
|
|
615
620
|
'Net names cannot contain a period, try using "sel.net..." to autocomplete with conventional net names, e.g. V3_3'
|
|
616
621
|
);
|
|
617
622
|
}
|
|
618
623
|
if (/net\.[^\s>]*[+-]/.test(selector)) {
|
|
619
|
-
throw new Error(
|
|
620
|
-
'Net names cannot contain "+" or "-", try using underscores instead, e.g. VCC_P'
|
|
621
|
-
);
|
|
624
|
+
throw new Error(buildPlusMinusNetErrorMessage(selector, component));
|
|
622
625
|
}
|
|
623
626
|
if (/net\.[0-9]/.test(selector)) {
|
|
624
627
|
const match = selector.match(/net\.([^ >]+)/);
|
|
@@ -1166,7 +1169,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1166
1169
|
if (this._cachedSelectAllQueries.has(selectorRaw)) {
|
|
1167
1170
|
return this._cachedSelectAllQueries.get(selectorRaw);
|
|
1168
1171
|
}
|
|
1169
|
-
const selector = preprocessSelector(selectorRaw);
|
|
1172
|
+
const selector = preprocessSelector(selectorRaw, this);
|
|
1170
1173
|
const result = selectAll(
|
|
1171
1174
|
selector,
|
|
1172
1175
|
this,
|
|
@@ -1190,7 +1193,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1190
1193
|
if (this._cachedSelectOneQueries.has(selectorRaw)) {
|
|
1191
1194
|
return this._cachedSelectOneQueries.get(selectorRaw);
|
|
1192
1195
|
}
|
|
1193
|
-
const selector = preprocessSelector(selectorRaw);
|
|
1196
|
+
const selector = preprocessSelector(selectorRaw, this);
|
|
1194
1197
|
if (options?.port) {
|
|
1195
1198
|
options.type = "port";
|
|
1196
1199
|
}
|
|
@@ -1649,7 +1652,9 @@ import { autoroute } from "@tscircuit/infgrid-ijump-astar";
|
|
|
1649
1652
|
var netProps = z4.object({
|
|
1650
1653
|
name: z4.string().refine(
|
|
1651
1654
|
(val) => !/[+-]/.test(val),
|
|
1652
|
-
|
|
1655
|
+
(val) => ({
|
|
1656
|
+
message: `Net names cannot contain "+" or "-" (component "Net" received "${val}"). Try using underscores instead, e.g. VCC_P`
|
|
1657
|
+
})
|
|
1653
1658
|
)
|
|
1654
1659
|
});
|
|
1655
1660
|
var Net = class extends PrimitiveComponent2 {
|
|
@@ -1840,9 +1845,9 @@ var createNetsFromProps = (component, props) => {
|
|
|
1840
1845
|
);
|
|
1841
1846
|
}
|
|
1842
1847
|
if (/net\.[^\s>]*[+-]/.test(prop)) {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
);
|
|
1848
|
+
const netName = prop.split("net.")[1];
|
|
1849
|
+
const message = `Net names cannot contain "+" or "-" (component "${component.componentName}" received "${netName}" via "${prop}"). Try using underscores instead, e.g. VCC_P`;
|
|
1850
|
+
throw new Error(message);
|
|
1846
1851
|
}
|
|
1847
1852
|
if (/net\.[0-9]/.test(prop)) {
|
|
1848
1853
|
const netName = prop.split("net.")[1];
|
|
@@ -2429,6 +2434,24 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2429
2434
|
if (props.shape === "pill_hole_with_rect_pad") {
|
|
2430
2435
|
return { width: props.rectPadWidth, height: props.rectPadHeight };
|
|
2431
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
|
+
}
|
|
2432
2455
|
throw new Error(
|
|
2433
2456
|
`getPcbSize for shape "${props.shape}" not implemented for ${this.componentName}`
|
|
2434
2457
|
);
|
|
@@ -2621,6 +2644,34 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2621
2644
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2622
2645
|
});
|
|
2623
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;
|
|
2624
2675
|
}
|
|
2625
2676
|
}
|
|
2626
2677
|
doInitialPcbPortAttachment() {
|
|
@@ -3170,6 +3221,22 @@ var createComponentsFromCircuitJson = ({
|
|
|
3170
3221
|
holeOffsetY: elm.hole_offset_y
|
|
3171
3222
|
})
|
|
3172
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
|
+
);
|
|
3173
3240
|
}
|
|
3174
3241
|
} else if (elm.type === "pcb_keepout" && elm.shape === "circle") {
|
|
3175
3242
|
components.push(
|
|
@@ -5500,6 +5567,29 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
|
|
|
5500
5567
|
height: element.outer_height,
|
|
5501
5568
|
connectedTo: withNetId([element.pcb_plated_hole_id])
|
|
5502
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
|
+
}
|
|
5503
5593
|
}
|
|
5504
5594
|
} else if (element.type === "pcb_trace") {
|
|
5505
5595
|
const traceObstacles = getObstaclesFromRoute(
|
|
@@ -11636,6 +11726,20 @@ function getObstacleDimensionsFromPlatedHole(hole) {
|
|
|
11636
11726
|
width: hole.outer_width,
|
|
11637
11727
|
height: hole.outer_height
|
|
11638
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
|
+
};
|
|
11639
11743
|
default:
|
|
11640
11744
|
return null;
|
|
11641
11745
|
}
|
|
@@ -17898,7 +18002,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17898
18002
|
var package_default = {
|
|
17899
18003
|
name: "@tscircuit/core",
|
|
17900
18004
|
type: "module",
|
|
17901
|
-
version: "0.0.
|
|
18005
|
+
version: "0.0.866",
|
|
17902
18006
|
types: "dist/index.d.ts",
|
|
17903
18007
|
main: "dist/index.js",
|
|
17904
18008
|
module: "dist/index.js",
|
|
@@ -17942,7 +18046,7 @@ var package_default = {
|
|
|
17942
18046
|
"@tscircuit/math-utils": "^0.0.29",
|
|
17943
18047
|
"@tscircuit/miniflex": "^0.0.4",
|
|
17944
18048
|
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
17945
|
-
"@tscircuit/props": "^0.0.
|
|
18049
|
+
"@tscircuit/props": "^0.0.403",
|
|
17946
18050
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
17947
18051
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
17948
18052
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
@@ -17956,13 +18060,13 @@ var package_default = {
|
|
|
17956
18060
|
"bun-match-svg": "0.0.12",
|
|
17957
18061
|
"calculate-elbow": "^0.0.12",
|
|
17958
18062
|
"chokidar-cli": "^3.0.0",
|
|
17959
|
-
"circuit-json": "^0.0.
|
|
18063
|
+
"circuit-json": "^0.0.308",
|
|
17960
18064
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17961
18065
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17962
18066
|
"circuit-json-to-gltf": "^0.0.31",
|
|
17963
18067
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
17964
18068
|
"circuit-json-to-spice": "^0.0.16",
|
|
17965
|
-
"circuit-to-svg": "^0.0.
|
|
18069
|
+
"circuit-to-svg": "^0.0.269",
|
|
17966
18070
|
concurrently: "^9.1.2",
|
|
17967
18071
|
"connectivity-map": "^1.0.0",
|
|
17968
18072
|
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.867",
|
|
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",
|