@tscircuit/core 0.0.128 → 0.0.130
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 +42 -1
- package/dist/index.js +44 -11
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -4546,7 +4546,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
4546
4546
|
isPcbPrimitive: boolean;
|
|
4547
4547
|
get config(): {
|
|
4548
4548
|
componentName: string;
|
|
4549
|
-
zodProps: zod.
|
|
4549
|
+
zodProps: zod.ZodDiscriminatedUnion<"shape", [zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
4550
4550
|
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4551
4551
|
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4552
4552
|
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -4622,6 +4622,47 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
4622
4622
|
pcbY?: string | number | undefined;
|
|
4623
4623
|
name?: string | undefined;
|
|
4624
4624
|
portHints?: (string | number)[] | undefined;
|
|
4625
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
4626
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4627
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4628
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
4629
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
4630
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
4631
|
+
}, "strip", zod.ZodTypeAny, {
|
|
4632
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4633
|
+
}, {
|
|
4634
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4635
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
4636
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
4637
|
+
}>>;
|
|
4638
|
+
}, "layer" | "pcbRotation">, {
|
|
4639
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
4640
|
+
shape: zod.ZodLiteral<"pill">;
|
|
4641
|
+
outerWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4642
|
+
outerHeight: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4643
|
+
innerWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4644
|
+
innerHeight: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
4645
|
+
portHints: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, "many">>;
|
|
4646
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
4647
|
+
shape: "pill";
|
|
4648
|
+
outerWidth: number;
|
|
4649
|
+
outerHeight: number;
|
|
4650
|
+
innerWidth: number;
|
|
4651
|
+
innerHeight: number;
|
|
4652
|
+
pcbX?: number | undefined;
|
|
4653
|
+
pcbY?: number | undefined;
|
|
4654
|
+
name?: string | undefined;
|
|
4655
|
+
portHints?: (string | number)[] | undefined;
|
|
4656
|
+
}, {
|
|
4657
|
+
shape: "pill";
|
|
4658
|
+
outerWidth: string | number;
|
|
4659
|
+
outerHeight: string | number;
|
|
4660
|
+
innerWidth: string | number;
|
|
4661
|
+
innerHeight: string | number;
|
|
4662
|
+
pcbX?: string | number | undefined;
|
|
4663
|
+
pcbY?: string | number | undefined;
|
|
4664
|
+
name?: string | undefined;
|
|
4665
|
+
portHints?: (string | number)[] | undefined;
|
|
4625
4666
|
}>]>;
|
|
4626
4667
|
};
|
|
4627
4668
|
getAvailablePcbLayers(): string[];
|
package/dist/index.js
CHANGED
|
@@ -1151,7 +1151,7 @@ var PlatedHole = class extends PrimitiveComponent {
|
|
|
1151
1151
|
if (props.shape === "circle") {
|
|
1152
1152
|
return { width: props.outerDiameter, height: props.outerDiameter };
|
|
1153
1153
|
}
|
|
1154
|
-
if (props.shape === "oval") {
|
|
1154
|
+
if (props.shape === "oval" || props.shape === "pill") {
|
|
1155
1155
|
return { width: props.outerWidth, height: props.outerHeight };
|
|
1156
1156
|
}
|
|
1157
1157
|
throw new Error(
|
|
@@ -1216,6 +1216,22 @@ var PlatedHole = class extends PrimitiveComponent {
|
|
|
1216
1216
|
layers: ["top", "bottom"]
|
|
1217
1217
|
});
|
|
1218
1218
|
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
1219
|
+
} else if (props.shape === "pill") {
|
|
1220
|
+
const pcb_plated_hole = db.pcb_plated_hole.insert({
|
|
1221
|
+
pcb_component_id,
|
|
1222
|
+
pcb_port_id: this.matchedPort?.pcb_port_id,
|
|
1223
|
+
outer_width: props.outerWidth,
|
|
1224
|
+
outer_height: props.outerHeight,
|
|
1225
|
+
hole_width: props.innerWidth,
|
|
1226
|
+
hole_height: props.innerHeight,
|
|
1227
|
+
shape: "pill",
|
|
1228
|
+
port_hints: this.getNameAndAliases(),
|
|
1229
|
+
x: position.x,
|
|
1230
|
+
y: position.y,
|
|
1231
|
+
layers: ["top", "bottom"]
|
|
1232
|
+
// NOTE: currently PcbPlatedHoleOval erroneously includes both the shape "pill" and "oval"
|
|
1233
|
+
});
|
|
1234
|
+
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
1219
1235
|
}
|
|
1220
1236
|
}
|
|
1221
1237
|
doInitialPcbPortAttachment() {
|
|
@@ -2530,6 +2546,7 @@ var FTYPE = stringProxy;
|
|
|
2530
2546
|
import { traceProps } from "@tscircuit/props";
|
|
2531
2547
|
import {
|
|
2532
2548
|
MultilayerIjump,
|
|
2549
|
+
IJumpAutorouter,
|
|
2533
2550
|
getObstaclesFromSoup
|
|
2534
2551
|
} from "@tscircuit/infgrid-ijump-astar";
|
|
2535
2552
|
|
|
@@ -2542,6 +2559,22 @@ var computeObstacleBounds = (obstacles) => {
|
|
|
2542
2559
|
return { minX, maxX, minY, maxY };
|
|
2543
2560
|
};
|
|
2544
2561
|
|
|
2562
|
+
// lib/utils/projectPointInDirection.ts
|
|
2563
|
+
var projectPointInDirection = (point, direction, distance) => {
|
|
2564
|
+
switch (direction) {
|
|
2565
|
+
case "up":
|
|
2566
|
+
return { x: point.x, y: point.y - distance };
|
|
2567
|
+
case "down":
|
|
2568
|
+
return { x: point.x, y: point.y + distance };
|
|
2569
|
+
case "left":
|
|
2570
|
+
return { x: point.x - distance, y: point.y };
|
|
2571
|
+
case "right":
|
|
2572
|
+
return { x: point.x + distance, y: point.y };
|
|
2573
|
+
default:
|
|
2574
|
+
throw new Error(`Unknown direction "${direction}"`);
|
|
2575
|
+
}
|
|
2576
|
+
};
|
|
2577
|
+
|
|
2545
2578
|
// lib/utils/autorouting/findPossibleTraceLayerCombinations.ts
|
|
2546
2579
|
var LAYER_SELECTION_PREFERENCE = ["top", "bottom", "inner1", "inner2"];
|
|
2547
2580
|
var findPossibleTraceLayerCombinations = (hints, layer_path = []) => {
|
|
@@ -3154,11 +3187,11 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
3154
3187
|
for (const { port } of ports) {
|
|
3155
3188
|
connection.pointsToConnect.push({
|
|
3156
3189
|
...port._getGlobalSchematicPositionAfterLayout(),
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3190
|
+
...projectPointInDirection(
|
|
3191
|
+
port._getGlobalSchematicPositionAfterLayout(),
|
|
3192
|
+
port.facingDirection,
|
|
3193
|
+
0.1501
|
|
3194
|
+
),
|
|
3162
3195
|
layer: "top"
|
|
3163
3196
|
});
|
|
3164
3197
|
}
|
|
@@ -3183,7 +3216,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
3183
3216
|
});
|
|
3184
3217
|
}
|
|
3185
3218
|
}
|
|
3186
|
-
let Autorouter =
|
|
3219
|
+
let Autorouter = IJumpAutorouter;
|
|
3187
3220
|
if (this.getSubcircuit().props._schDirectLineRoutingEnabled) {
|
|
3188
3221
|
Autorouter = DirectLineRouter;
|
|
3189
3222
|
}
|
|
@@ -3507,10 +3540,10 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
3507
3540
|
processSide("bottom", bottomSide, "left-to-right");
|
|
3508
3541
|
}
|
|
3509
3542
|
const trueEdgePositions = {
|
|
3510
|
-
left: { x: -schWidth / 2, y: schHeight / 2 },
|
|
3511
|
-
bottom: { x: -schWidth / 2, y: schHeight / 2 },
|
|
3512
|
-
right: { x: schWidth / 2, y: -schHeight / 2 },
|
|
3513
|
-
top: { x: schWidth / 2, y: -schHeight / 2 }
|
|
3543
|
+
left: { x: -schWidth / 2 - 0.2, y: schHeight / 2 },
|
|
3544
|
+
bottom: { x: -schWidth / 2, y: schHeight / 2 + 0.2 },
|
|
3545
|
+
right: { x: schWidth / 2 + 0.2, y: -schHeight / 2 },
|
|
3546
|
+
top: { x: schWidth / 2, y: -schHeight / 2 - 0.2 }
|
|
3514
3547
|
};
|
|
3515
3548
|
const trueEdgeTraversalDirections = {
|
|
3516
3549
|
left: { x: 0, y: -1 },
|
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.130",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsup-node index.ts --format esm --dts",
|
|
17
|
+
"format": "biome format . --write",
|
|
17
18
|
"measure-bundle": "howfat -r table ."
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
@@ -38,12 +39,12 @@
|
|
|
38
39
|
"@tscircuit/footprinter": "^0.0.77",
|
|
39
40
|
"@tscircuit/infgrid-ijump-astar": "^0.0.21",
|
|
40
41
|
"@tscircuit/math-utils": "^0.0.4",
|
|
41
|
-
"@tscircuit/props": "^0.0.
|
|
42
|
+
"@tscircuit/props": "^0.0.77",
|
|
42
43
|
"@tscircuit/schematic-autolayout": "^0.0.5",
|
|
43
44
|
"@tscircuit/soup-util": "^0.0.33",
|
|
44
|
-
"circuit-json": "^0.0.
|
|
45
|
+
"circuit-json": "^0.0.91",
|
|
45
46
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
46
|
-
"circuit-to-svg": "^0.0.
|
|
47
|
+
"circuit-to-svg": "^0.0.53",
|
|
47
48
|
"nanoid": "^5.0.7",
|
|
48
49
|
"performance-now": "^2.1.0",
|
|
49
50
|
"react": "^18.3.1",
|