@tscircuit/core 0.0.2024 → 0.0.2025
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 +6 -6
- package/dist/index.js +62 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -108453,6 +108453,7 @@ declare const pcbViaProps: z.ZodObject<{
|
|
|
108453
108453
|
}>>;
|
|
108454
108454
|
connectsTo: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
108455
108455
|
holeDiameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
108456
|
+
netIsAssignable: z.ZodOptional<z.ZodBoolean>;
|
|
108456
108457
|
footprint: z.ZodOptional<z.ZodType<_tscircuit_props.FootprintProp, z.ZodTypeDef, _tscircuit_props.FootprintProp>>;
|
|
108457
108458
|
schX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
108458
108459
|
schY: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
@@ -108534,7 +108535,6 @@ declare const pcbViaProps: z.ZodObject<{
|
|
|
108534
108535
|
tentedOnTop: z.ZodOptional<z.ZodBoolean>;
|
|
108535
108536
|
tentedOnBottom: z.ZodOptional<z.ZodBoolean>;
|
|
108536
108537
|
outerDiameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
108537
|
-
netIsAssignable: z.ZodOptional<z.ZodBoolean>;
|
|
108538
108538
|
}, "strip", z.ZodTypeAny, {
|
|
108539
108539
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
108540
108540
|
name?: string | undefined;
|
|
@@ -108544,6 +108544,7 @@ declare const pcbViaProps: z.ZodObject<{
|
|
|
108544
108544
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | undefined;
|
|
108545
108545
|
connectsTo?: string | string[] | undefined;
|
|
108546
108546
|
holeDiameter?: number | undefined;
|
|
108547
|
+
netIsAssignable?: boolean | undefined;
|
|
108547
108548
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
108548
108549
|
schX?: number | undefined;
|
|
108549
108550
|
schY?: number | undefined;
|
|
@@ -108595,7 +108596,6 @@ declare const pcbViaProps: z.ZodObject<{
|
|
|
108595
108596
|
tentedOnTop?: boolean | undefined;
|
|
108596
108597
|
tentedOnBottom?: boolean | undefined;
|
|
108597
108598
|
outerDiameter?: number | undefined;
|
|
108598
|
-
netIsAssignable?: boolean | undefined;
|
|
108599
108599
|
}, {
|
|
108600
108600
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
108601
108601
|
name?: string | undefined;
|
|
@@ -108613,6 +108613,7 @@ declare const pcbViaProps: z.ZodObject<{
|
|
|
108613
108613
|
} | undefined;
|
|
108614
108614
|
connectsTo?: string | string[] | undefined;
|
|
108615
108615
|
holeDiameter?: string | number | undefined;
|
|
108616
|
+
netIsAssignable?: boolean | undefined;
|
|
108616
108617
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
108617
108618
|
schX?: string | number | undefined;
|
|
108618
108619
|
schY?: string | number | undefined;
|
|
@@ -108664,7 +108665,6 @@ declare const pcbViaProps: z.ZodObject<{
|
|
|
108664
108665
|
tentedOnTop?: boolean | undefined;
|
|
108665
108666
|
tentedOnBottom?: boolean | undefined;
|
|
108666
108667
|
outerDiameter?: string | number | undefined;
|
|
108667
|
-
netIsAssignable?: boolean | undefined;
|
|
108668
108668
|
}>;
|
|
108669
108669
|
declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
108670
108670
|
pcb_via_id: string | null;
|
|
@@ -108713,6 +108713,7 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
|
108713
108713
|
}>>;
|
|
108714
108714
|
connectsTo: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
108715
108715
|
holeDiameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
108716
|
+
netIsAssignable: z.ZodOptional<z.ZodBoolean>;
|
|
108716
108717
|
footprint: z.ZodOptional<z.ZodType<_tscircuit_props.FootprintProp, z.ZodTypeDef, _tscircuit_props.FootprintProp>>;
|
|
108717
108718
|
schX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
108718
108719
|
schY: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
@@ -108794,7 +108795,6 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
|
108794
108795
|
tentedOnTop: z.ZodOptional<z.ZodBoolean>;
|
|
108795
108796
|
tentedOnBottom: z.ZodOptional<z.ZodBoolean>;
|
|
108796
108797
|
outerDiameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
108797
|
-
netIsAssignable: z.ZodOptional<z.ZodBoolean>;
|
|
108798
108798
|
}, "strip", z.ZodTypeAny, {
|
|
108799
108799
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
108800
108800
|
name?: string | undefined;
|
|
@@ -108804,6 +108804,7 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
|
108804
108804
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | undefined;
|
|
108805
108805
|
connectsTo?: string | string[] | undefined;
|
|
108806
108806
|
holeDiameter?: number | undefined;
|
|
108807
|
+
netIsAssignable?: boolean | undefined;
|
|
108807
108808
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
108808
108809
|
schX?: number | undefined;
|
|
108809
108810
|
schY?: number | undefined;
|
|
@@ -108855,7 +108856,6 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
|
108855
108856
|
tentedOnTop?: boolean | undefined;
|
|
108856
108857
|
tentedOnBottom?: boolean | undefined;
|
|
108857
108858
|
outerDiameter?: number | undefined;
|
|
108858
|
-
netIsAssignable?: boolean | undefined;
|
|
108859
108859
|
}, {
|
|
108860
108860
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
108861
108861
|
name?: string | undefined;
|
|
@@ -108873,6 +108873,7 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
|
108873
108873
|
} | undefined;
|
|
108874
108874
|
connectsTo?: string | string[] | undefined;
|
|
108875
108875
|
holeDiameter?: string | number | undefined;
|
|
108876
|
+
netIsAssignable?: boolean | undefined;
|
|
108876
108877
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
108877
108878
|
schX?: string | number | undefined;
|
|
108878
108879
|
schY?: string | number | undefined;
|
|
@@ -108924,7 +108925,6 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
|
|
|
108924
108925
|
tentedOnTop?: boolean | undefined;
|
|
108925
108926
|
tentedOnBottom?: boolean | undefined;
|
|
108926
108927
|
outerDiameter?: string | number | undefined;
|
|
108927
|
-
netIsAssignable?: boolean | undefined;
|
|
108928
108928
|
}>;
|
|
108929
108929
|
};
|
|
108930
108930
|
private _getLayers;
|
package/dist/index.js
CHANGED
|
@@ -3280,10 +3280,70 @@ var getAxisAlignedRectFromPolygon = (points) => {
|
|
|
3280
3280
|
};
|
|
3281
3281
|
};
|
|
3282
3282
|
|
|
3283
|
+
// lib/utils/obstacles/getCircumscribedRectFromCircularPcbKeepoutOutline.ts
|
|
3284
|
+
var MINIMUM_CIRCULAR_OUTLINE_POINT_COUNT = 12;
|
|
3285
|
+
var MINIMUM_CIRCULAR_OUTLINE_ASPECT_RATIO = 0.99;
|
|
3286
|
+
var MAXIMUM_RADIUS_VARIATION_RATIO = 1e-3;
|
|
3287
|
+
var getCircumscribedRectFromCircularPcbKeepoutOutline = (keepout) => {
|
|
3288
|
+
const { outline, stroke_width } = keepout;
|
|
3289
|
+
const firstPoint = outline[0];
|
|
3290
|
+
const lastPoint = outline.at(-1);
|
|
3291
|
+
if (!firstPoint || !lastPoint) return null;
|
|
3292
|
+
if (firstPoint.x !== lastPoint.x || firstPoint.y !== lastPoint.y) return null;
|
|
3293
|
+
const centerlinePoints = outline.slice(0, -1);
|
|
3294
|
+
if (centerlinePoints.length < MINIMUM_CIRCULAR_OUTLINE_POINT_COUNT)
|
|
3295
|
+
return null;
|
|
3296
|
+
const minX = Math.min(...centerlinePoints.map(({ x }) => x));
|
|
3297
|
+
const maxX = Math.max(...centerlinePoints.map(({ x }) => x));
|
|
3298
|
+
const minY = Math.min(...centerlinePoints.map(({ y }) => y));
|
|
3299
|
+
const maxY = Math.max(...centerlinePoints.map(({ y }) => y));
|
|
3300
|
+
const centerlineWidth = maxX - minX;
|
|
3301
|
+
const centerlineHeight = maxY - minY;
|
|
3302
|
+
const centerlineDiameter = Math.max(centerlineWidth, centerlineHeight);
|
|
3303
|
+
if (!Number.isFinite(centerlineDiameter) || centerlineDiameter <= 0 || Math.min(centerlineWidth, centerlineHeight) / centerlineDiameter < MINIMUM_CIRCULAR_OUTLINE_ASPECT_RATIO) {
|
|
3304
|
+
return null;
|
|
3305
|
+
}
|
|
3306
|
+
const center = { x: (minX + maxX) / 2, y: (minY + maxY) / 2 };
|
|
3307
|
+
const radii = centerlinePoints.map(
|
|
3308
|
+
({ x, y }) => Math.hypot(x - center.x, y - center.y)
|
|
3309
|
+
);
|
|
3310
|
+
if (Math.max(...radii) - Math.min(...radii) > centerlineDiameter * MAXIMUM_RADIUS_VARIATION_RATIO) {
|
|
3311
|
+
return null;
|
|
3312
|
+
}
|
|
3313
|
+
const angles = centerlinePoints.map(
|
|
3314
|
+
({ x, y }) => Math.atan2(y - center.y, x - center.x)
|
|
3315
|
+
);
|
|
3316
|
+
const angularSteps = angles.map((angle, angleIndex) => {
|
|
3317
|
+
const nextAngle = angles[(angleIndex + 1) % angles.length];
|
|
3318
|
+
return Math.atan2(Math.sin(nextAngle - angle), Math.cos(nextAngle - angle));
|
|
3319
|
+
});
|
|
3320
|
+
const traversalDirection = Math.sign(angularSteps[0]);
|
|
3321
|
+
if (traversalDirection === 0 || angularSteps.some(
|
|
3322
|
+
(angularStep) => Math.sign(angularStep) !== traversalDirection || Math.abs(angularStep) > 4 * Math.PI / centerlinePoints.length
|
|
3323
|
+
)) {
|
|
3324
|
+
return null;
|
|
3325
|
+
}
|
|
3326
|
+
const outerDiameter = centerlineDiameter + stroke_width;
|
|
3327
|
+
return { center, width: outerDiameter, height: outerDiameter };
|
|
3328
|
+
};
|
|
3329
|
+
|
|
3283
3330
|
// lib/utils/obstacles/getObstaclesFromPcbKeepoutOutline.ts
|
|
3284
3331
|
var getObstaclesFromPcbKeepoutOutline = (keepout, componentId) => {
|
|
3285
3332
|
const { outline, stroke_width } = keepout;
|
|
3286
3333
|
if (!Number.isFinite(stroke_width) || stroke_width <= 0) return [];
|
|
3334
|
+
const circularKeepoutRect = getCircumscribedRectFromCircularPcbKeepoutOutline(keepout);
|
|
3335
|
+
if (circularKeepoutRect) {
|
|
3336
|
+
return [
|
|
3337
|
+
{
|
|
3338
|
+
obstacleId: keepout.pcb_keepout_id,
|
|
3339
|
+
componentId,
|
|
3340
|
+
type: "rect",
|
|
3341
|
+
layers: keepout.layers,
|
|
3342
|
+
...circularKeepoutRect,
|
|
3343
|
+
connectedTo: []
|
|
3344
|
+
}
|
|
3345
|
+
];
|
|
3346
|
+
}
|
|
3287
3347
|
const obstacles = [];
|
|
3288
3348
|
for (let segmentIndex = 0; segmentIndex < outline.length - 1; segmentIndex++) {
|
|
3289
3349
|
const start = outline[segmentIndex];
|
|
@@ -3548,8 +3608,7 @@ var getObstaclesFromCircuitJson = (circuitJson, connMap) => {
|
|
|
3548
3608
|
if (element.shape === "circle") {
|
|
3549
3609
|
obstacles.push({
|
|
3550
3610
|
componentId: pcbComponentId,
|
|
3551
|
-
|
|
3552
|
-
type: "oval",
|
|
3611
|
+
type: "rect",
|
|
3553
3612
|
layers: element.layers,
|
|
3554
3613
|
center: {
|
|
3555
3614
|
x: element.center.x,
|
|
@@ -64553,7 +64612,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
64553
64612
|
var package_default = {
|
|
64554
64613
|
name: "@tscircuit/core",
|
|
64555
64614
|
type: "module",
|
|
64556
|
-
version: "0.0.
|
|
64615
|
+
version: "0.0.2024",
|
|
64557
64616
|
types: "dist/index.d.ts",
|
|
64558
64617
|
main: "dist/index.js",
|
|
64559
64618
|
module: "dist/index.js",
|