@tscircuit/cli 0.1.2231 → 0.1.2232
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/cli/main.js +484 -444
- package/dist/lib/index.js +2 -2
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -154298,7 +154298,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
|
|
|
154298
154298
|
// lib/getVersion.ts
|
|
154299
154299
|
import { createRequire as createRequire2 } from "node:module";
|
|
154300
154300
|
// package.json
|
|
154301
|
-
var version = "0.1.
|
|
154301
|
+
var version = "0.1.2231";
|
|
154302
154302
|
var package_default = {
|
|
154303
154303
|
name: "@tscircuit/cli",
|
|
154304
154304
|
version,
|
|
@@ -154367,7 +154367,7 @@ var package_default = {
|
|
|
154367
154367
|
debug: "^4.4.0",
|
|
154368
154368
|
delay: "^6.0.0",
|
|
154369
154369
|
"dsn-converter": "^0.0.90",
|
|
154370
|
-
easyeda: "^0.0.
|
|
154370
|
+
easyeda: "^0.0.368",
|
|
154371
154371
|
"fuse.js": "^7.1.0",
|
|
154372
154372
|
"get-port": "^7.1.0",
|
|
154373
154373
|
globby: "^14.1.0",
|
|
@@ -363942,6 +363942,29 @@ function compose27(...matrices) {
|
|
|
363942
363942
|
return transform2(...matrices);
|
|
363943
363943
|
}
|
|
363944
363944
|
var { cos: cos3, sin: sin3, PI: PI3 } = Math;
|
|
363945
|
+
function rotate20(angle, cx, cy) {
|
|
363946
|
+
const cosAngle = cos3(angle);
|
|
363947
|
+
const sinAngle = sin3(angle);
|
|
363948
|
+
const rotationMatrix = {
|
|
363949
|
+
a: cosAngle,
|
|
363950
|
+
c: -sinAngle,
|
|
363951
|
+
e: 0,
|
|
363952
|
+
b: sinAngle,
|
|
363953
|
+
d: cosAngle,
|
|
363954
|
+
f: 0
|
|
363955
|
+
};
|
|
363956
|
+
if (isUndefined3(cx) || isUndefined3(cy)) {
|
|
363957
|
+
return rotationMatrix;
|
|
363958
|
+
}
|
|
363959
|
+
return transform2([
|
|
363960
|
+
translate26(cx, cy),
|
|
363961
|
+
rotationMatrix,
|
|
363962
|
+
translate26(-cx, -cy)
|
|
363963
|
+
]);
|
|
363964
|
+
}
|
|
363965
|
+
function rotateDEG2(angle, cx = undefined, cy = undefined) {
|
|
363966
|
+
return rotate20(angle * PI3 / 180, cx, cy);
|
|
363967
|
+
}
|
|
363945
363968
|
function scale14(sx, sy = undefined, cx = undefined, cy = undefined) {
|
|
363946
363969
|
if (isUndefined3(sy))
|
|
363947
363970
|
sy = sx;
|
|
@@ -365428,6 +365451,95 @@ var PIN1_LOCATION_PARTS = {
|
|
|
365428
365451
|
bottomside_right: { side: "bottomside", alignment: "right" }
|
|
365429
365452
|
};
|
|
365430
365453
|
var PIN1_LOCATIONS2 = Object.keys(PIN1_LOCATION_PARTS);
|
|
365454
|
+
var unitToMm3 = {
|
|
365455
|
+
in: 25.4,
|
|
365456
|
+
inch: 25.4,
|
|
365457
|
+
mil: 0.0254,
|
|
365458
|
+
mm: 1,
|
|
365459
|
+
m: 1000,
|
|
365460
|
+
cm: 10,
|
|
365461
|
+
ft: 304.8,
|
|
365462
|
+
feet: 304.8
|
|
365463
|
+
};
|
|
365464
|
+
var mmNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
365465
|
+
useGrouping: false,
|
|
365466
|
+
notation: "standard",
|
|
365467
|
+
maximumFractionDigits: 12
|
|
365468
|
+
});
|
|
365469
|
+
var mm4 = (n) => {
|
|
365470
|
+
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
365471
|
+
if (!unit)
|
|
365472
|
+
unit = "mm";
|
|
365473
|
+
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
365474
|
+
if (unit in unitToMm3) {
|
|
365475
|
+
return val * unitToMm3[unit];
|
|
365476
|
+
}
|
|
365477
|
+
throw new Error(`Unsupported unit: ${unit}`);
|
|
365478
|
+
};
|
|
365479
|
+
var mmStr2 = (n) => {
|
|
365480
|
+
return `${mmNumberFormatter.format(mm4(n))}mm`;
|
|
365481
|
+
};
|
|
365482
|
+
var mil2mm = (mil) => {
|
|
365483
|
+
if (typeof mil === "number")
|
|
365484
|
+
return mm4(`${mil}mil`);
|
|
365485
|
+
if (mil.match(/^\d+$/))
|
|
365486
|
+
return mm4(`${mil}mil`);
|
|
365487
|
+
return mm4(mil);
|
|
365488
|
+
};
|
|
365489
|
+
var getEasyEdaPlatedHoleGeometry = (pad) => {
|
|
365490
|
+
const holeDiameterMm = mil2mm(pad.holeRadius) * 2;
|
|
365491
|
+
const holeLengthMm = pad.holeLength ? mil2mm(pad.holeLength) : 0;
|
|
365492
|
+
let holeWidthMm = holeDiameterMm;
|
|
365493
|
+
let holeHeightMm = holeDiameterMm;
|
|
365494
|
+
if (holeLengthMm > holeDiameterMm) {
|
|
365495
|
+
if (!pad.holePoints) {
|
|
365496
|
+
throw new Error(`Slot on pad ${pad.number} is missing hole endpoints`);
|
|
365497
|
+
}
|
|
365498
|
+
const [start, end] = pad.holePoints;
|
|
365499
|
+
const localHoleDirection = applyToPoint106(rotateDEG2(pad.rotation), {
|
|
365500
|
+
x: end.x - start.x,
|
|
365501
|
+
y: end.y - start.y
|
|
365502
|
+
});
|
|
365503
|
+
const absX = Math.abs(localHoleDirection.x);
|
|
365504
|
+
const absY = Math.abs(localHoleDirection.y);
|
|
365505
|
+
if (Math.min(absX, absY) > Math.max(absX, absY) * 0.001) {
|
|
365506
|
+
throw new Error(`Slot on pad ${pad.number} is not aligned with its pad`);
|
|
365507
|
+
}
|
|
365508
|
+
if (absX > absY)
|
|
365509
|
+
holeWidthMm = holeLengthMm;
|
|
365510
|
+
else
|
|
365511
|
+
holeHeightMm = holeLengthMm;
|
|
365512
|
+
}
|
|
365513
|
+
if (pad.shape === "RECT") {
|
|
365514
|
+
return {
|
|
365515
|
+
shape: "rotated_pill_hole_with_rect_pad",
|
|
365516
|
+
hole_shape: "rotated_pill",
|
|
365517
|
+
pad_shape: "rect",
|
|
365518
|
+
hole_width: holeWidthMm,
|
|
365519
|
+
hole_height: holeHeightMm,
|
|
365520
|
+
hole_ccw_rotation: pad.rotation,
|
|
365521
|
+
rect_ccw_rotation: pad.rotation,
|
|
365522
|
+
rect_pad_width: mil2mm(pad.width),
|
|
365523
|
+
rect_pad_height: mil2mm(pad.height)
|
|
365524
|
+
};
|
|
365525
|
+
}
|
|
365526
|
+
if (pad.shape === "OVAL" || holeLengthMm > holeDiameterMm) {
|
|
365527
|
+
return {
|
|
365528
|
+
shape: "pill",
|
|
365529
|
+
hole_width: holeWidthMm,
|
|
365530
|
+
hole_height: holeHeightMm,
|
|
365531
|
+
outer_width: mil2mm(pad.width),
|
|
365532
|
+
outer_height: mil2mm(pad.height),
|
|
365533
|
+
ccw_rotation: pad.rotation
|
|
365534
|
+
};
|
|
365535
|
+
}
|
|
365536
|
+
return {
|
|
365537
|
+
shape: "circle",
|
|
365538
|
+
hole_diameter: holeDiameterMm,
|
|
365539
|
+
outer_diameter: mil2mm(pad.width),
|
|
365540
|
+
radius: mil2mm(pad.holeRadius)
|
|
365541
|
+
};
|
|
365542
|
+
};
|
|
365431
365543
|
var normalizeActiveLowPinLabel = (label) => {
|
|
365432
365544
|
const hasActiveLowMarker = label.startsWith("#") || label.endsWith("#");
|
|
365433
365545
|
if (!hasActiveLowMarker)
|
|
@@ -365647,41 +365759,6 @@ var getBoardOutlinePolygons3 = (tracks) => {
|
|
|
365647
365759
|
}
|
|
365648
365760
|
return polygons;
|
|
365649
365761
|
};
|
|
365650
|
-
var unitToMm3 = {
|
|
365651
|
-
in: 25.4,
|
|
365652
|
-
inch: 25.4,
|
|
365653
|
-
mil: 0.0254,
|
|
365654
|
-
mm: 1,
|
|
365655
|
-
m: 1000,
|
|
365656
|
-
cm: 10,
|
|
365657
|
-
ft: 304.8,
|
|
365658
|
-
feet: 304.8
|
|
365659
|
-
};
|
|
365660
|
-
var mmNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
365661
|
-
useGrouping: false,
|
|
365662
|
-
notation: "standard",
|
|
365663
|
-
maximumFractionDigits: 12
|
|
365664
|
-
});
|
|
365665
|
-
var mm4 = (n) => {
|
|
365666
|
-
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
365667
|
-
if (!unit)
|
|
365668
|
-
unit = "mm";
|
|
365669
|
-
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
365670
|
-
if (unit in unitToMm3) {
|
|
365671
|
-
return val * unitToMm3[unit];
|
|
365672
|
-
}
|
|
365673
|
-
throw new Error(`Unsupported unit: ${unit}`);
|
|
365674
|
-
};
|
|
365675
|
-
var mmStr2 = (n) => {
|
|
365676
|
-
return `${mmNumberFormatter.format(mm4(n))}mm`;
|
|
365677
|
-
};
|
|
365678
|
-
var mil2mm = (mil) => {
|
|
365679
|
-
if (typeof mil === "number")
|
|
365680
|
-
return mm4(`${mil}mil`);
|
|
365681
|
-
if (mil.match(/^\d+$/))
|
|
365682
|
-
return mm4(`${mil}mil`);
|
|
365683
|
-
return mm4(mil);
|
|
365684
|
-
};
|
|
365685
365762
|
var DEFAULT_PCB_THICKNESS_MM = 1.6;
|
|
365686
365763
|
function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag, sweepFlag) {
|
|
365687
365764
|
const start = { x: startX, y: startY };
|
|
@@ -366331,68 +366408,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
366331
366408
|
pcb_component_id: "pcb_component_1",
|
|
366332
366409
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
366333
366410
|
};
|
|
366334
|
-
|
|
366335
|
-
if (pad.shape === "OVAL") {
|
|
366336
|
-
const largestOuterDimensionName = mil2mm(pad.width) > mil2mm(pad.height) ? "width" : "height";
|
|
366337
|
-
const smallestOuterDimension = Math.min(mil2mm(pad.width), mil2mm(pad.height));
|
|
366338
|
-
const largestOuterDimension = Math.max(mil2mm(pad.width), mil2mm(pad.height));
|
|
366339
|
-
const distanceFromOuterPlatingToHole = smallestOuterDimension / 2 - mil2mm(pad.holeRadius);
|
|
366340
|
-
const largestInnerDimension = largestOuterDimension - distanceFromOuterPlatingToHole * 2;
|
|
366341
|
-
const smallestInnerDimension = mil2mm(pad.holeRadius) * 2;
|
|
366342
|
-
const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
|
|
366343
|
-
const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
|
|
366344
|
-
additionalPlatedHoleProps = {
|
|
366345
|
-
shape: "pill",
|
|
366346
|
-
hole_width: innerWidth,
|
|
366347
|
-
hole_height: innerHeight,
|
|
366348
|
-
outer_width: mil2mm(pad.width),
|
|
366349
|
-
outer_height: mil2mm(pad.height),
|
|
366350
|
-
ccw_rotation: pad.rotation || 0
|
|
366351
|
-
};
|
|
366352
|
-
} else if (pad.shape === "RECT") {
|
|
366353
|
-
const padWidth = mil2mm(pad.width);
|
|
366354
|
-
const padHeight = mil2mm(pad.height);
|
|
366355
|
-
const holeRadius = mil2mm(pad.holeRadius);
|
|
366356
|
-
const holeDiameter = holeRadius * 2;
|
|
366357
|
-
const aspectRatio = Math.max(padWidth, padHeight) / Math.min(padWidth, padHeight);
|
|
366358
|
-
const isSignificantlyRectangular = aspectRatio > 1.5;
|
|
366359
|
-
if (isSignificantlyRectangular) {
|
|
366360
|
-
const baseWidth = holeDiameter;
|
|
366361
|
-
const pillHeight = baseWidth * 2.6;
|
|
366362
|
-
const holeWidth = padWidth > padHeight ? pillHeight : baseWidth;
|
|
366363
|
-
const holeHeight = padHeight > padWidth ? pillHeight : baseWidth;
|
|
366364
|
-
additionalPlatedHoleProps = {
|
|
366365
|
-
shape: "rotated_pill_hole_with_rect_pad",
|
|
366366
|
-
hole_shape: "rotated_pill",
|
|
366367
|
-
pad_shape: "rect",
|
|
366368
|
-
hole_width: holeWidth,
|
|
366369
|
-
hole_height: holeHeight,
|
|
366370
|
-
hole_ccw_rotation: pad.rotation || 0,
|
|
366371
|
-
rect_ccw_rotation: pad.rotation || 0,
|
|
366372
|
-
rect_pad_width: padWidth,
|
|
366373
|
-
rect_pad_height: padHeight
|
|
366374
|
-
};
|
|
366375
|
-
} else {
|
|
366376
|
-
additionalPlatedHoleProps = {
|
|
366377
|
-
shape: "rotated_pill_hole_with_rect_pad",
|
|
366378
|
-
hole_shape: "rotated_pill",
|
|
366379
|
-
pad_shape: "rect",
|
|
366380
|
-
hole_width: holeDiameter,
|
|
366381
|
-
hole_height: holeDiameter,
|
|
366382
|
-
hole_ccw_rotation: pad.rotation || 0,
|
|
366383
|
-
rect_ccw_rotation: pad.rotation || 0,
|
|
366384
|
-
rect_pad_width: padWidth,
|
|
366385
|
-
rect_pad_height: padHeight
|
|
366386
|
-
};
|
|
366387
|
-
}
|
|
366388
|
-
} else {
|
|
366389
|
-
additionalPlatedHoleProps = {
|
|
366390
|
-
shape: "circle",
|
|
366391
|
-
hole_diameter: mil2mm(pad.holeRadius) * 2,
|
|
366392
|
-
outer_diameter: mil2mm(pad.width),
|
|
366393
|
-
radius: mil2mm(pad.holeRadius)
|
|
366394
|
-
};
|
|
366395
|
-
}
|
|
366411
|
+
const additionalPlatedHoleProps = getEasyEdaPlatedHoleGeometry(pad);
|
|
366396
366412
|
circuitElements.push(pcb_plated_hole.parse({
|
|
366397
366413
|
...commonPlatedHoleProps,
|
|
366398
366414
|
...additionalPlatedHoleProps
|
|
@@ -366745,6 +366761,8 @@ var PadSchema = BaseShapeSchema.extend({
|
|
|
366745
366761
|
net: external_exports2.union([external_exports2.string(), external_exports2.number()]).optional(),
|
|
366746
366762
|
number: external_exports2.union([external_exports2.string(), external_exports2.number()]),
|
|
366747
366763
|
holeRadius: tenthmil,
|
|
366764
|
+
holeLength: tenthmil.optional(),
|
|
366765
|
+
holePoints: external_exports2.array(PointSchema).length(2).optional(),
|
|
366748
366766
|
points: external_exports2.array(PointSchema).optional(),
|
|
366749
366767
|
rotation: safeNumber(0),
|
|
366750
366768
|
plated: external_exports2.boolean()
|
|
@@ -366877,6 +366895,8 @@ var ShapeItemSchema = external_exports2.object({
|
|
|
366877
366895
|
net,
|
|
366878
366896
|
number: padNumber,
|
|
366879
366897
|
holeRadius,
|
|
366898
|
+
holeLength: rest[3] === undefined || rest[3] === "" ? undefined : rest[3],
|
|
366899
|
+
holePoints: rest[4] ? parsePoints(String(rest[4])) : undefined,
|
|
366880
366900
|
points,
|
|
366881
366901
|
rotation: rotation2,
|
|
366882
366902
|
plated: rest.includes("Y")
|
|
@@ -368628,8 +368648,9 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
|
368628
368648
|
return "pushbutton";
|
|
368629
368649
|
if (isDipSwitchCategoryComponent(betterEasy))
|
|
368630
368650
|
return "chip";
|
|
368631
|
-
if (isSwitchCategoryComponent(betterEasy))
|
|
368632
|
-
return "switch";
|
|
368651
|
+
if (isSwitchCategoryComponent(betterEasy)) {
|
|
368652
|
+
return pinCount > 2 ? "chip" : "switch";
|
|
368653
|
+
}
|
|
368633
368654
|
if (isCapacitorComponent(betterEasy))
|
|
368634
368655
|
return "capacitor";
|
|
368635
368656
|
if (isResistorComponent(betterEasy) && pinCount === 2)
|
|
@@ -368721,7 +368742,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
368721
368742
|
jlcpcb: [betterEasy.lcsc.number]
|
|
368722
368743
|
};
|
|
368723
368744
|
const componentType = getGeneratedComponentType(betterEasy, sourcePorts.length);
|
|
368724
|
-
const
|
|
368745
|
+
const isSwitchRenderedAsChip = isDipSwitchCategoryComponent(betterEasy) || isSwitchCategoryComponent(betterEasy) && sourcePorts.length > 2;
|
|
368725
368746
|
const inductance2 = componentType === "inductor" ? betterEasy.dataStr.head.c_para.Value?.trim() : undefined;
|
|
368726
368747
|
const capacitance2 = componentType === "capacitor" ? normalizeCapacitanceValue(betterEasy.dataStr.head.c_para.Value) : undefined;
|
|
368727
368748
|
const resistance2 = componentType === "resistor" ? normalizeResistorValue(betterEasy.dataStr.head.c_para.Value) : undefined;
|
|
@@ -368730,7 +368751,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
368730
368751
|
const isMultiPinDiode = isDiodeCategoryComponent(betterEasy) && sourcePorts.length !== 2;
|
|
368731
368752
|
const isMultiPinInductor = isInductorComponent(betterEasy) && sourcePorts.length !== 2;
|
|
368732
368753
|
const isPassiveWithCustomSymbol = componentType === "capacitor" && sourcePorts.length !== 2;
|
|
368733
|
-
const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && !isMultiPinInductor && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
|
|
368754
|
+
const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && !isMultiPinInductor && !isSwitchRenderedAsChip && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx2(betterEasy, circuitJson, {
|
|
368734
368755
|
alignPortsToDrawing: isPassiveWithCustomSymbol
|
|
368735
368756
|
}) : undefined;
|
|
368736
368757
|
const schPinArrangement = symbolTsx ? undefined : getVisibleSchematicPinArrangement(betterEasy);
|
|
@@ -368750,8 +368771,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
368750
368771
|
crystalFrequency,
|
|
368751
368772
|
crystalPinVariant,
|
|
368752
368773
|
symbolTsx,
|
|
368753
|
-
schPinArrangement
|
|
368754
|
-
useSymbolPortsOnly: isDipSwitch && Boolean(symbolTsx)
|
|
368774
|
+
schPinArrangement
|
|
368755
368775
|
});
|
|
368756
368776
|
};
|
|
368757
368777
|
var checkModelObjUrlValidity = async (url) => {
|
|
@@ -369152,6 +369172,360 @@ var __export6 = (target, all) => {
|
|
|
369152
369172
|
for (var name in all)
|
|
369153
369173
|
__defProp7(target, name, { get: all[name], enumerable: true });
|
|
369154
369174
|
};
|
|
369175
|
+
var unitToMm4 = {
|
|
369176
|
+
in: 25.4,
|
|
369177
|
+
inch: 25.4,
|
|
369178
|
+
mil: 0.0254,
|
|
369179
|
+
mm: 1,
|
|
369180
|
+
m: 1000,
|
|
369181
|
+
cm: 10,
|
|
369182
|
+
ft: 304.8,
|
|
369183
|
+
feet: 304.8
|
|
369184
|
+
};
|
|
369185
|
+
var mmNumberFormatter2 = new Intl.NumberFormat("en-US", {
|
|
369186
|
+
useGrouping: false,
|
|
369187
|
+
notation: "standard",
|
|
369188
|
+
maximumFractionDigits: 12
|
|
369189
|
+
});
|
|
369190
|
+
var mm5 = (n) => {
|
|
369191
|
+
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
369192
|
+
if (!unit)
|
|
369193
|
+
unit = "mm";
|
|
369194
|
+
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
369195
|
+
if (unit in unitToMm4) {
|
|
369196
|
+
return val * unitToMm4[unit];
|
|
369197
|
+
}
|
|
369198
|
+
throw new Error(`Unsupported unit: ${unit}`);
|
|
369199
|
+
};
|
|
369200
|
+
var mil2mm2 = (mil) => {
|
|
369201
|
+
if (typeof mil === "number")
|
|
369202
|
+
return mm5(`${mil}mil`);
|
|
369203
|
+
if (mil.match(/^\d+$/))
|
|
369204
|
+
return mm5(`${mil}mil`);
|
|
369205
|
+
return mm5(mil);
|
|
369206
|
+
};
|
|
369207
|
+
function applyToPoint107(matrix, point2) {
|
|
369208
|
+
return Array.isArray(point2) ? [
|
|
369209
|
+
matrix.a * point2[0] + matrix.c * point2[1] + matrix.e,
|
|
369210
|
+
matrix.b * point2[0] + matrix.d * point2[1] + matrix.f
|
|
369211
|
+
] : {
|
|
369212
|
+
x: matrix.a * point2.x + matrix.c * point2.y + matrix.e,
|
|
369213
|
+
y: matrix.b * point2.x + matrix.d * point2.y + matrix.f
|
|
369214
|
+
};
|
|
369215
|
+
}
|
|
369216
|
+
function isUndefined4(val) {
|
|
369217
|
+
return typeof val === "undefined";
|
|
369218
|
+
}
|
|
369219
|
+
function translate27(tx, ty = 0) {
|
|
369220
|
+
return {
|
|
369221
|
+
a: 1,
|
|
369222
|
+
c: 0,
|
|
369223
|
+
e: tx,
|
|
369224
|
+
b: 0,
|
|
369225
|
+
d: 1,
|
|
369226
|
+
f: ty
|
|
369227
|
+
};
|
|
369228
|
+
}
|
|
369229
|
+
function transform3(...matrices) {
|
|
369230
|
+
matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;
|
|
369231
|
+
const multiply = (m1, m2) => {
|
|
369232
|
+
return {
|
|
369233
|
+
a: m1.a * m2.a + m1.c * m2.b,
|
|
369234
|
+
c: m1.a * m2.c + m1.c * m2.d,
|
|
369235
|
+
e: m1.a * m2.e + m1.c * m2.f + m1.e,
|
|
369236
|
+
b: m1.b * m2.a + m1.d * m2.b,
|
|
369237
|
+
d: m1.b * m2.c + m1.d * m2.d,
|
|
369238
|
+
f: m1.b * m2.e + m1.d * m2.f + m1.f
|
|
369239
|
+
};
|
|
369240
|
+
};
|
|
369241
|
+
switch (matrices.length) {
|
|
369242
|
+
case 0:
|
|
369243
|
+
throw new Error("no matrices provided");
|
|
369244
|
+
case 1:
|
|
369245
|
+
return matrices[0];
|
|
369246
|
+
case 2:
|
|
369247
|
+
return multiply(matrices[0], matrices[1]);
|
|
369248
|
+
default: {
|
|
369249
|
+
const [m1, m2, ...rest] = matrices;
|
|
369250
|
+
const m3 = multiply(m1, m2);
|
|
369251
|
+
return transform3(m3, ...rest);
|
|
369252
|
+
}
|
|
369253
|
+
}
|
|
369254
|
+
}
|
|
369255
|
+
function compose28(...matrices) {
|
|
369256
|
+
return transform3(...matrices);
|
|
369257
|
+
}
|
|
369258
|
+
var { cos: cos4, sin: sin4, PI: PI4 } = Math;
|
|
369259
|
+
function rotate21(angle, cx, cy) {
|
|
369260
|
+
const cosAngle = cos4(angle);
|
|
369261
|
+
const sinAngle = sin4(angle);
|
|
369262
|
+
const rotationMatrix = {
|
|
369263
|
+
a: cosAngle,
|
|
369264
|
+
c: -sinAngle,
|
|
369265
|
+
e: 0,
|
|
369266
|
+
b: sinAngle,
|
|
369267
|
+
d: cosAngle,
|
|
369268
|
+
f: 0
|
|
369269
|
+
};
|
|
369270
|
+
if (isUndefined4(cx) || isUndefined4(cy)) {
|
|
369271
|
+
return rotationMatrix;
|
|
369272
|
+
}
|
|
369273
|
+
return transform3([
|
|
369274
|
+
translate27(cx, cy),
|
|
369275
|
+
rotationMatrix,
|
|
369276
|
+
translate27(-cx, -cy)
|
|
369277
|
+
]);
|
|
369278
|
+
}
|
|
369279
|
+
function rotateDEG3(angle, cx = undefined, cy = undefined) {
|
|
369280
|
+
return rotate21(angle * PI4 / 180, cx, cy);
|
|
369281
|
+
}
|
|
369282
|
+
function scale15(sx, sy = undefined, cx = undefined, cy = undefined) {
|
|
369283
|
+
if (isUndefined4(sy))
|
|
369284
|
+
sy = sx;
|
|
369285
|
+
const scaleMatrix = {
|
|
369286
|
+
a: sx,
|
|
369287
|
+
c: 0,
|
|
369288
|
+
e: 0,
|
|
369289
|
+
b: 0,
|
|
369290
|
+
d: sy,
|
|
369291
|
+
f: 0
|
|
369292
|
+
};
|
|
369293
|
+
if (isUndefined4(cx) || isUndefined4(cy)) {
|
|
369294
|
+
return scaleMatrix;
|
|
369295
|
+
}
|
|
369296
|
+
return transform3([
|
|
369297
|
+
translate27(cx, cy),
|
|
369298
|
+
scaleMatrix,
|
|
369299
|
+
translate27(-cx, -cy)
|
|
369300
|
+
]);
|
|
369301
|
+
}
|
|
369302
|
+
var { tan: tan4 } = Math;
|
|
369303
|
+
function peg$subclass3(child, parent) {
|
|
369304
|
+
function C() {
|
|
369305
|
+
this.constructor = child;
|
|
369306
|
+
}
|
|
369307
|
+
C.prototype = parent.prototype;
|
|
369308
|
+
child.prototype = new C;
|
|
369309
|
+
}
|
|
369310
|
+
function peg$SyntaxError3(message, expected, found, location) {
|
|
369311
|
+
var self2 = Error.call(this, message);
|
|
369312
|
+
if (Object.setPrototypeOf) {
|
|
369313
|
+
Object.setPrototypeOf(self2, peg$SyntaxError3.prototype);
|
|
369314
|
+
}
|
|
369315
|
+
self2.expected = expected;
|
|
369316
|
+
self2.found = found;
|
|
369317
|
+
self2.location = location;
|
|
369318
|
+
self2.name = "SyntaxError";
|
|
369319
|
+
return self2;
|
|
369320
|
+
}
|
|
369321
|
+
peg$subclass3(peg$SyntaxError3, Error);
|
|
369322
|
+
function peg$padEnd3(str, targetLength, padString) {
|
|
369323
|
+
padString = padString || " ";
|
|
369324
|
+
if (str.length > targetLength) {
|
|
369325
|
+
return str;
|
|
369326
|
+
}
|
|
369327
|
+
targetLength -= str.length;
|
|
369328
|
+
padString += padString.repeat(targetLength);
|
|
369329
|
+
return str + padString.slice(0, targetLength);
|
|
369330
|
+
}
|
|
369331
|
+
peg$SyntaxError3.prototype.format = function(sources) {
|
|
369332
|
+
var str = "Error: " + this.message;
|
|
369333
|
+
if (this.location) {
|
|
369334
|
+
var src = null;
|
|
369335
|
+
var k;
|
|
369336
|
+
for (k = 0;k < sources.length; k++) {
|
|
369337
|
+
if (sources[k].source === this.location.source) {
|
|
369338
|
+
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
369339
|
+
break;
|
|
369340
|
+
}
|
|
369341
|
+
}
|
|
369342
|
+
var s = this.location.start;
|
|
369343
|
+
var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
|
|
369344
|
+
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
|
|
369345
|
+
if (src) {
|
|
369346
|
+
var e = this.location.end;
|
|
369347
|
+
var filler = peg$padEnd3("", offset_s.line.toString().length, " ");
|
|
369348
|
+
var line = src[s.line - 1];
|
|
369349
|
+
var last = s.line === e.line ? e.column : line.length + 1;
|
|
369350
|
+
var hatLen = last - s.column || 1;
|
|
369351
|
+
str += `
|
|
369352
|
+
--> ` + loc + `
|
|
369353
|
+
` + filler + ` |
|
|
369354
|
+
` + offset_s.line + " | " + line + `
|
|
369355
|
+
` + filler + " | " + peg$padEnd3("", s.column - 1, " ") + peg$padEnd3("", hatLen, "^");
|
|
369356
|
+
} else {
|
|
369357
|
+
str += `
|
|
369358
|
+
at ` + loc;
|
|
369359
|
+
}
|
|
369360
|
+
}
|
|
369361
|
+
return str;
|
|
369362
|
+
};
|
|
369363
|
+
peg$SyntaxError3.buildMessage = function(expected, found) {
|
|
369364
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
|
369365
|
+
literal: function(expectation) {
|
|
369366
|
+
return '"' + literalEscape(expectation.text) + '"';
|
|
369367
|
+
},
|
|
369368
|
+
class: function(expectation) {
|
|
369369
|
+
var escapedParts = expectation.parts.map(function(part) {
|
|
369370
|
+
return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
|
|
369371
|
+
});
|
|
369372
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
369373
|
+
},
|
|
369374
|
+
any: function() {
|
|
369375
|
+
return "any character";
|
|
369376
|
+
},
|
|
369377
|
+
end: function() {
|
|
369378
|
+
return "end of input";
|
|
369379
|
+
},
|
|
369380
|
+
other: function(expectation) {
|
|
369381
|
+
return expectation.description;
|
|
369382
|
+
}
|
|
369383
|
+
};
|
|
369384
|
+
function hex(ch) {
|
|
369385
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
369386
|
+
}
|
|
369387
|
+
function literalEscape(s) {
|
|
369388
|
+
return s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
|
|
369389
|
+
return "\\x0" + hex(ch);
|
|
369390
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
369391
|
+
return "\\x" + hex(ch);
|
|
369392
|
+
});
|
|
369393
|
+
}
|
|
369394
|
+
function classEscape(s) {
|
|
369395
|
+
return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
|
|
369396
|
+
return "\\x0" + hex(ch);
|
|
369397
|
+
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
369398
|
+
return "\\x" + hex(ch);
|
|
369399
|
+
});
|
|
369400
|
+
}
|
|
369401
|
+
function describeExpectation(expectation) {
|
|
369402
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
369403
|
+
}
|
|
369404
|
+
function describeExpected(expected2) {
|
|
369405
|
+
var descriptions = expected2.map(describeExpectation);
|
|
369406
|
+
var i, j;
|
|
369407
|
+
descriptions.sort();
|
|
369408
|
+
if (descriptions.length > 0) {
|
|
369409
|
+
for (i = 1, j = 1;i < descriptions.length; i++) {
|
|
369410
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
369411
|
+
descriptions[j] = descriptions[i];
|
|
369412
|
+
j++;
|
|
369413
|
+
}
|
|
369414
|
+
}
|
|
369415
|
+
descriptions.length = j;
|
|
369416
|
+
}
|
|
369417
|
+
switch (descriptions.length) {
|
|
369418
|
+
case 1:
|
|
369419
|
+
return descriptions[0];
|
|
369420
|
+
case 2:
|
|
369421
|
+
return descriptions[0] + " or " + descriptions[1];
|
|
369422
|
+
default:
|
|
369423
|
+
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
|
|
369424
|
+
}
|
|
369425
|
+
}
|
|
369426
|
+
function describeFound(found2) {
|
|
369427
|
+
return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
|
|
369428
|
+
}
|
|
369429
|
+
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
369430
|
+
};
|
|
369431
|
+
function decomposeTSR3(matrix, flipX = false, flipY = false) {
|
|
369432
|
+
if (flipX) {
|
|
369433
|
+
if (flipY) {
|
|
369434
|
+
matrix = compose28(matrix, scale15(-1, -1));
|
|
369435
|
+
} else {
|
|
369436
|
+
matrix = compose28(matrix, scale15(1, -1));
|
|
369437
|
+
}
|
|
369438
|
+
} else if (flipY) {
|
|
369439
|
+
matrix = compose28(matrix, scale15(-1, 1));
|
|
369440
|
+
}
|
|
369441
|
+
const a = matrix.a;
|
|
369442
|
+
const b = matrix.b;
|
|
369443
|
+
const c = matrix.c;
|
|
369444
|
+
const d = matrix.d;
|
|
369445
|
+
let scaleX, scaleY, rotation2;
|
|
369446
|
+
if (a !== 0 || c !== 0) {
|
|
369447
|
+
const hypotAc = Math.hypot(a, c);
|
|
369448
|
+
scaleX = hypotAc;
|
|
369449
|
+
scaleY = (a * d - b * c) / hypotAc;
|
|
369450
|
+
const acos = Math.acos(a / hypotAc);
|
|
369451
|
+
rotation2 = c > 0 ? -acos : acos;
|
|
369452
|
+
} else if (b !== 0 || d !== 0) {
|
|
369453
|
+
const hypotBd = Math.hypot(b, d);
|
|
369454
|
+
scaleX = (a * d - b * c) / hypotBd;
|
|
369455
|
+
scaleY = hypotBd;
|
|
369456
|
+
const acos = Math.acos(b / hypotBd);
|
|
369457
|
+
rotation2 = Math.PI / 2 + (d > 0 ? -acos : acos);
|
|
369458
|
+
} else {
|
|
369459
|
+
scaleX = 0;
|
|
369460
|
+
scaleY = 0;
|
|
369461
|
+
rotation2 = 0;
|
|
369462
|
+
}
|
|
369463
|
+
if (flipY) {
|
|
369464
|
+
scaleX = -scaleX;
|
|
369465
|
+
}
|
|
369466
|
+
if (flipX) {
|
|
369467
|
+
scaleY = -scaleY;
|
|
369468
|
+
}
|
|
369469
|
+
return {
|
|
369470
|
+
translate: { tx: matrix.e, ty: matrix.f },
|
|
369471
|
+
scale: { sx: scaleX, sy: scaleY },
|
|
369472
|
+
rotation: { angle: rotation2 }
|
|
369473
|
+
};
|
|
369474
|
+
}
|
|
369475
|
+
var getEasyEdaPlatedHoleGeometry2 = (pad) => {
|
|
369476
|
+
const holeDiameterMm = mil2mm2(pad.holeRadius) * 2;
|
|
369477
|
+
const holeLengthMm = pad.holeLength ? mil2mm2(pad.holeLength) : 0;
|
|
369478
|
+
let holeWidthMm = holeDiameterMm;
|
|
369479
|
+
let holeHeightMm = holeDiameterMm;
|
|
369480
|
+
if (holeLengthMm > holeDiameterMm) {
|
|
369481
|
+
if (!pad.holePoints) {
|
|
369482
|
+
throw new Error(`Slot on pad ${pad.number} is missing hole endpoints`);
|
|
369483
|
+
}
|
|
369484
|
+
const [start, end] = pad.holePoints;
|
|
369485
|
+
const localHoleDirection = applyToPoint107(rotateDEG3(pad.rotation), {
|
|
369486
|
+
x: end.x - start.x,
|
|
369487
|
+
y: end.y - start.y
|
|
369488
|
+
});
|
|
369489
|
+
const absX = Math.abs(localHoleDirection.x);
|
|
369490
|
+
const absY = Math.abs(localHoleDirection.y);
|
|
369491
|
+
if (Math.min(absX, absY) > Math.max(absX, absY) * 0.001) {
|
|
369492
|
+
throw new Error(`Slot on pad ${pad.number} is not aligned with its pad`);
|
|
369493
|
+
}
|
|
369494
|
+
if (absX > absY)
|
|
369495
|
+
holeWidthMm = holeLengthMm;
|
|
369496
|
+
else
|
|
369497
|
+
holeHeightMm = holeLengthMm;
|
|
369498
|
+
}
|
|
369499
|
+
if (pad.shape === "RECT") {
|
|
369500
|
+
return {
|
|
369501
|
+
shape: "rotated_pill_hole_with_rect_pad",
|
|
369502
|
+
hole_shape: "rotated_pill",
|
|
369503
|
+
pad_shape: "rect",
|
|
369504
|
+
hole_width: holeWidthMm,
|
|
369505
|
+
hole_height: holeHeightMm,
|
|
369506
|
+
hole_ccw_rotation: pad.rotation,
|
|
369507
|
+
rect_ccw_rotation: pad.rotation,
|
|
369508
|
+
rect_pad_width: mil2mm2(pad.width),
|
|
369509
|
+
rect_pad_height: mil2mm2(pad.height)
|
|
369510
|
+
};
|
|
369511
|
+
}
|
|
369512
|
+
if (pad.shape === "OVAL" || holeLengthMm > holeDiameterMm) {
|
|
369513
|
+
return {
|
|
369514
|
+
shape: "pill",
|
|
369515
|
+
hole_width: holeWidthMm,
|
|
369516
|
+
hole_height: holeHeightMm,
|
|
369517
|
+
outer_width: mil2mm2(pad.width),
|
|
369518
|
+
outer_height: mil2mm2(pad.height),
|
|
369519
|
+
ccw_rotation: pad.rotation
|
|
369520
|
+
};
|
|
369521
|
+
}
|
|
369522
|
+
return {
|
|
369523
|
+
shape: "circle",
|
|
369524
|
+
hole_diameter: holeDiameterMm,
|
|
369525
|
+
outer_diameter: mil2mm2(pad.width),
|
|
369526
|
+
radius: mil2mm2(pad.holeRadius)
|
|
369527
|
+
};
|
|
369528
|
+
};
|
|
369155
369529
|
var normalizeActiveLowPinLabel2 = (label) => {
|
|
369156
369530
|
const hasActiveLowMarker = label.startsWith("#") || label.endsWith("#");
|
|
369157
369531
|
if (!hasActiveLowMarker)
|
|
@@ -373576,251 +373950,6 @@ var any_circuit_element2 = z198.union([
|
|
|
373576
373950
|
var any_soup_element5 = any_circuit_element2;
|
|
373577
373951
|
expectTypesMatch3(true);
|
|
373578
373952
|
expectStringUnionsMatch2(true);
|
|
373579
|
-
function applyToPoint107(matrix, point2) {
|
|
373580
|
-
return Array.isArray(point2) ? [
|
|
373581
|
-
matrix.a * point2[0] + matrix.c * point2[1] + matrix.e,
|
|
373582
|
-
matrix.b * point2[0] + matrix.d * point2[1] + matrix.f
|
|
373583
|
-
] : {
|
|
373584
|
-
x: matrix.a * point2.x + matrix.c * point2.y + matrix.e,
|
|
373585
|
-
y: matrix.b * point2.x + matrix.d * point2.y + matrix.f
|
|
373586
|
-
};
|
|
373587
|
-
}
|
|
373588
|
-
function isUndefined4(val) {
|
|
373589
|
-
return typeof val === "undefined";
|
|
373590
|
-
}
|
|
373591
|
-
function translate27(tx, ty = 0) {
|
|
373592
|
-
return {
|
|
373593
|
-
a: 1,
|
|
373594
|
-
c: 0,
|
|
373595
|
-
e: tx,
|
|
373596
|
-
b: 0,
|
|
373597
|
-
d: 1,
|
|
373598
|
-
f: ty
|
|
373599
|
-
};
|
|
373600
|
-
}
|
|
373601
|
-
function transform3(...matrices) {
|
|
373602
|
-
matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;
|
|
373603
|
-
const multiply = (m1, m2) => {
|
|
373604
|
-
return {
|
|
373605
|
-
a: m1.a * m2.a + m1.c * m2.b,
|
|
373606
|
-
c: m1.a * m2.c + m1.c * m2.d,
|
|
373607
|
-
e: m1.a * m2.e + m1.c * m2.f + m1.e,
|
|
373608
|
-
b: m1.b * m2.a + m1.d * m2.b,
|
|
373609
|
-
d: m1.b * m2.c + m1.d * m2.d,
|
|
373610
|
-
f: m1.b * m2.e + m1.d * m2.f + m1.f
|
|
373611
|
-
};
|
|
373612
|
-
};
|
|
373613
|
-
switch (matrices.length) {
|
|
373614
|
-
case 0:
|
|
373615
|
-
throw new Error("no matrices provided");
|
|
373616
|
-
case 1:
|
|
373617
|
-
return matrices[0];
|
|
373618
|
-
case 2:
|
|
373619
|
-
return multiply(matrices[0], matrices[1]);
|
|
373620
|
-
default: {
|
|
373621
|
-
const [m1, m2, ...rest] = matrices;
|
|
373622
|
-
const m3 = multiply(m1, m2);
|
|
373623
|
-
return transform3(m3, ...rest);
|
|
373624
|
-
}
|
|
373625
|
-
}
|
|
373626
|
-
}
|
|
373627
|
-
function compose28(...matrices) {
|
|
373628
|
-
return transform3(...matrices);
|
|
373629
|
-
}
|
|
373630
|
-
var { cos: cos4, sin: sin4, PI: PI4 } = Math;
|
|
373631
|
-
function scale15(sx, sy = undefined, cx = undefined, cy = undefined) {
|
|
373632
|
-
if (isUndefined4(sy))
|
|
373633
|
-
sy = sx;
|
|
373634
|
-
const scaleMatrix = {
|
|
373635
|
-
a: sx,
|
|
373636
|
-
c: 0,
|
|
373637
|
-
e: 0,
|
|
373638
|
-
b: 0,
|
|
373639
|
-
d: sy,
|
|
373640
|
-
f: 0
|
|
373641
|
-
};
|
|
373642
|
-
if (isUndefined4(cx) || isUndefined4(cy)) {
|
|
373643
|
-
return scaleMatrix;
|
|
373644
|
-
}
|
|
373645
|
-
return transform3([
|
|
373646
|
-
translate27(cx, cy),
|
|
373647
|
-
scaleMatrix,
|
|
373648
|
-
translate27(-cx, -cy)
|
|
373649
|
-
]);
|
|
373650
|
-
}
|
|
373651
|
-
var { tan: tan4 } = Math;
|
|
373652
|
-
function peg$subclass3(child, parent) {
|
|
373653
|
-
function C() {
|
|
373654
|
-
this.constructor = child;
|
|
373655
|
-
}
|
|
373656
|
-
C.prototype = parent.prototype;
|
|
373657
|
-
child.prototype = new C;
|
|
373658
|
-
}
|
|
373659
|
-
function peg$SyntaxError3(message, expected, found, location) {
|
|
373660
|
-
var self2 = Error.call(this, message);
|
|
373661
|
-
if (Object.setPrototypeOf) {
|
|
373662
|
-
Object.setPrototypeOf(self2, peg$SyntaxError3.prototype);
|
|
373663
|
-
}
|
|
373664
|
-
self2.expected = expected;
|
|
373665
|
-
self2.found = found;
|
|
373666
|
-
self2.location = location;
|
|
373667
|
-
self2.name = "SyntaxError";
|
|
373668
|
-
return self2;
|
|
373669
|
-
}
|
|
373670
|
-
peg$subclass3(peg$SyntaxError3, Error);
|
|
373671
|
-
function peg$padEnd3(str, targetLength, padString) {
|
|
373672
|
-
padString = padString || " ";
|
|
373673
|
-
if (str.length > targetLength) {
|
|
373674
|
-
return str;
|
|
373675
|
-
}
|
|
373676
|
-
targetLength -= str.length;
|
|
373677
|
-
padString += padString.repeat(targetLength);
|
|
373678
|
-
return str + padString.slice(0, targetLength);
|
|
373679
|
-
}
|
|
373680
|
-
peg$SyntaxError3.prototype.format = function(sources) {
|
|
373681
|
-
var str = "Error: " + this.message;
|
|
373682
|
-
if (this.location) {
|
|
373683
|
-
var src = null;
|
|
373684
|
-
var k;
|
|
373685
|
-
for (k = 0;k < sources.length; k++) {
|
|
373686
|
-
if (sources[k].source === this.location.source) {
|
|
373687
|
-
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
373688
|
-
break;
|
|
373689
|
-
}
|
|
373690
|
-
}
|
|
373691
|
-
var s = this.location.start;
|
|
373692
|
-
var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
|
|
373693
|
-
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
|
|
373694
|
-
if (src) {
|
|
373695
|
-
var e = this.location.end;
|
|
373696
|
-
var filler = peg$padEnd3("", offset_s.line.toString().length, " ");
|
|
373697
|
-
var line = src[s.line - 1];
|
|
373698
|
-
var last = s.line === e.line ? e.column : line.length + 1;
|
|
373699
|
-
var hatLen = last - s.column || 1;
|
|
373700
|
-
str += `
|
|
373701
|
-
--> ` + loc + `
|
|
373702
|
-
` + filler + ` |
|
|
373703
|
-
` + offset_s.line + " | " + line + `
|
|
373704
|
-
` + filler + " | " + peg$padEnd3("", s.column - 1, " ") + peg$padEnd3("", hatLen, "^");
|
|
373705
|
-
} else {
|
|
373706
|
-
str += `
|
|
373707
|
-
at ` + loc;
|
|
373708
|
-
}
|
|
373709
|
-
}
|
|
373710
|
-
return str;
|
|
373711
|
-
};
|
|
373712
|
-
peg$SyntaxError3.buildMessage = function(expected, found) {
|
|
373713
|
-
var DESCRIBE_EXPECTATION_FNS = {
|
|
373714
|
-
literal: function(expectation) {
|
|
373715
|
-
return '"' + literalEscape(expectation.text) + '"';
|
|
373716
|
-
},
|
|
373717
|
-
class: function(expectation) {
|
|
373718
|
-
var escapedParts = expectation.parts.map(function(part) {
|
|
373719
|
-
return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
|
|
373720
|
-
});
|
|
373721
|
-
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
373722
|
-
},
|
|
373723
|
-
any: function() {
|
|
373724
|
-
return "any character";
|
|
373725
|
-
},
|
|
373726
|
-
end: function() {
|
|
373727
|
-
return "end of input";
|
|
373728
|
-
},
|
|
373729
|
-
other: function(expectation) {
|
|
373730
|
-
return expectation.description;
|
|
373731
|
-
}
|
|
373732
|
-
};
|
|
373733
|
-
function hex(ch) {
|
|
373734
|
-
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
373735
|
-
}
|
|
373736
|
-
function literalEscape(s) {
|
|
373737
|
-
return s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
|
|
373738
|
-
return "\\x0" + hex(ch);
|
|
373739
|
-
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
373740
|
-
return "\\x" + hex(ch);
|
|
373741
|
-
});
|
|
373742
|
-
}
|
|
373743
|
-
function classEscape(s) {
|
|
373744
|
-
return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
|
|
373745
|
-
return "\\x0" + hex(ch);
|
|
373746
|
-
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
|
|
373747
|
-
return "\\x" + hex(ch);
|
|
373748
|
-
});
|
|
373749
|
-
}
|
|
373750
|
-
function describeExpectation(expectation) {
|
|
373751
|
-
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
373752
|
-
}
|
|
373753
|
-
function describeExpected(expected2) {
|
|
373754
|
-
var descriptions = expected2.map(describeExpectation);
|
|
373755
|
-
var i, j;
|
|
373756
|
-
descriptions.sort();
|
|
373757
|
-
if (descriptions.length > 0) {
|
|
373758
|
-
for (i = 1, j = 1;i < descriptions.length; i++) {
|
|
373759
|
-
if (descriptions[i - 1] !== descriptions[i]) {
|
|
373760
|
-
descriptions[j] = descriptions[i];
|
|
373761
|
-
j++;
|
|
373762
|
-
}
|
|
373763
|
-
}
|
|
373764
|
-
descriptions.length = j;
|
|
373765
|
-
}
|
|
373766
|
-
switch (descriptions.length) {
|
|
373767
|
-
case 1:
|
|
373768
|
-
return descriptions[0];
|
|
373769
|
-
case 2:
|
|
373770
|
-
return descriptions[0] + " or " + descriptions[1];
|
|
373771
|
-
default:
|
|
373772
|
-
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
|
|
373773
|
-
}
|
|
373774
|
-
}
|
|
373775
|
-
function describeFound(found2) {
|
|
373776
|
-
return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
|
|
373777
|
-
}
|
|
373778
|
-
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
373779
|
-
};
|
|
373780
|
-
function decomposeTSR3(matrix, flipX = false, flipY = false) {
|
|
373781
|
-
if (flipX) {
|
|
373782
|
-
if (flipY) {
|
|
373783
|
-
matrix = compose28(matrix, scale15(-1, -1));
|
|
373784
|
-
} else {
|
|
373785
|
-
matrix = compose28(matrix, scale15(1, -1));
|
|
373786
|
-
}
|
|
373787
|
-
} else if (flipY) {
|
|
373788
|
-
matrix = compose28(matrix, scale15(-1, 1));
|
|
373789
|
-
}
|
|
373790
|
-
const a = matrix.a;
|
|
373791
|
-
const b = matrix.b;
|
|
373792
|
-
const c = matrix.c;
|
|
373793
|
-
const d = matrix.d;
|
|
373794
|
-
let scaleX, scaleY, rotation2;
|
|
373795
|
-
if (a !== 0 || c !== 0) {
|
|
373796
|
-
const hypotAc = Math.hypot(a, c);
|
|
373797
|
-
scaleX = hypotAc;
|
|
373798
|
-
scaleY = (a * d - b * c) / hypotAc;
|
|
373799
|
-
const acos = Math.acos(a / hypotAc);
|
|
373800
|
-
rotation2 = c > 0 ? -acos : acos;
|
|
373801
|
-
} else if (b !== 0 || d !== 0) {
|
|
373802
|
-
const hypotBd = Math.hypot(b, d);
|
|
373803
|
-
scaleX = (a * d - b * c) / hypotBd;
|
|
373804
|
-
scaleY = hypotBd;
|
|
373805
|
-
const acos = Math.acos(b / hypotBd);
|
|
373806
|
-
rotation2 = Math.PI / 2 + (d > 0 ? -acos : acos);
|
|
373807
|
-
} else {
|
|
373808
|
-
scaleX = 0;
|
|
373809
|
-
scaleY = 0;
|
|
373810
|
-
rotation2 = 0;
|
|
373811
|
-
}
|
|
373812
|
-
if (flipY) {
|
|
373813
|
-
scaleX = -scaleX;
|
|
373814
|
-
}
|
|
373815
|
-
if (flipX) {
|
|
373816
|
-
scaleY = -scaleY;
|
|
373817
|
-
}
|
|
373818
|
-
return {
|
|
373819
|
-
translate: { tx: matrix.e, ty: matrix.f },
|
|
373820
|
-
scale: { sx: scaleX, sy: scaleY },
|
|
373821
|
-
rotation: { angle: rotation2 }
|
|
373822
|
-
};
|
|
373823
|
-
}
|
|
373824
373953
|
function connect3(map, a, b) {
|
|
373825
373954
|
if (!a || !b)
|
|
373826
373955
|
return;
|
|
@@ -375113,38 +375242,6 @@ var PIN1_LOCATION_PARTS2 = {
|
|
|
375113
375242
|
bottomside_right: { side: "bottomside", alignment: "right" }
|
|
375114
375243
|
};
|
|
375115
375244
|
var PIN1_LOCATIONS3 = Object.keys(PIN1_LOCATION_PARTS2);
|
|
375116
|
-
var unitToMm4 = {
|
|
375117
|
-
in: 25.4,
|
|
375118
|
-
inch: 25.4,
|
|
375119
|
-
mil: 0.0254,
|
|
375120
|
-
mm: 1,
|
|
375121
|
-
m: 1000,
|
|
375122
|
-
cm: 10,
|
|
375123
|
-
ft: 304.8,
|
|
375124
|
-
feet: 304.8
|
|
375125
|
-
};
|
|
375126
|
-
var mmNumberFormatter2 = new Intl.NumberFormat("en-US", {
|
|
375127
|
-
useGrouping: false,
|
|
375128
|
-
notation: "standard",
|
|
375129
|
-
maximumFractionDigits: 12
|
|
375130
|
-
});
|
|
375131
|
-
var mm5 = (n) => {
|
|
375132
|
-
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
375133
|
-
if (!unit)
|
|
375134
|
-
unit = "mm";
|
|
375135
|
-
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
375136
|
-
if (unit in unitToMm4) {
|
|
375137
|
-
return val * unitToMm4[unit];
|
|
375138
|
-
}
|
|
375139
|
-
throw new Error(`Unsupported unit: ${unit}`);
|
|
375140
|
-
};
|
|
375141
|
-
var mil2mm2 = (mil) => {
|
|
375142
|
-
if (typeof mil === "number")
|
|
375143
|
-
return mm5(`${mil}mil`);
|
|
375144
|
-
if (mil.match(/^\d+$/))
|
|
375145
|
-
return mm5(`${mil}mil`);
|
|
375146
|
-
return mm5(mil);
|
|
375147
|
-
};
|
|
375148
375245
|
var DEFAULT_PCB_THICKNESS_MM2 = 1.6;
|
|
375149
375246
|
function generateArcFromSweep2(startX, startY, endX, endY, radius, largeArcFlag, sweepFlag) {
|
|
375150
375247
|
const start = { x: startX, y: startY };
|
|
@@ -375780,68 +375877,7 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
|
|
|
375780
375877
|
pcb_component_id: "pcb_component_1",
|
|
375781
375878
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
375782
375879
|
};
|
|
375783
|
-
|
|
375784
|
-
if (pad.shape === "OVAL") {
|
|
375785
|
-
const largestOuterDimensionName = mil2mm2(pad.width) > mil2mm2(pad.height) ? "width" : "height";
|
|
375786
|
-
const smallestOuterDimension = Math.min(mil2mm2(pad.width), mil2mm2(pad.height));
|
|
375787
|
-
const largestOuterDimension = Math.max(mil2mm2(pad.width), mil2mm2(pad.height));
|
|
375788
|
-
const distanceFromOuterPlatingToHole = smallestOuterDimension / 2 - mil2mm2(pad.holeRadius);
|
|
375789
|
-
const largestInnerDimension = largestOuterDimension - distanceFromOuterPlatingToHole * 2;
|
|
375790
|
-
const smallestInnerDimension = mil2mm2(pad.holeRadius) * 2;
|
|
375791
|
-
const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
|
|
375792
|
-
const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
|
|
375793
|
-
additionalPlatedHoleProps = {
|
|
375794
|
-
shape: "pill",
|
|
375795
|
-
hole_width: innerWidth,
|
|
375796
|
-
hole_height: innerHeight,
|
|
375797
|
-
outer_width: mil2mm2(pad.width),
|
|
375798
|
-
outer_height: mil2mm2(pad.height),
|
|
375799
|
-
ccw_rotation: pad.rotation || 0
|
|
375800
|
-
};
|
|
375801
|
-
} else if (pad.shape === "RECT") {
|
|
375802
|
-
const padWidth = mil2mm2(pad.width);
|
|
375803
|
-
const padHeight = mil2mm2(pad.height);
|
|
375804
|
-
const holeRadius = mil2mm2(pad.holeRadius);
|
|
375805
|
-
const holeDiameter = holeRadius * 2;
|
|
375806
|
-
const aspectRatio = Math.max(padWidth, padHeight) / Math.min(padWidth, padHeight);
|
|
375807
|
-
const isSignificantlyRectangular = aspectRatio > 1.5;
|
|
375808
|
-
if (isSignificantlyRectangular) {
|
|
375809
|
-
const baseWidth = holeDiameter;
|
|
375810
|
-
const pillHeight = baseWidth * 2.6;
|
|
375811
|
-
const holeWidth = padWidth > padHeight ? pillHeight : baseWidth;
|
|
375812
|
-
const holeHeight = padHeight > padWidth ? pillHeight : baseWidth;
|
|
375813
|
-
additionalPlatedHoleProps = {
|
|
375814
|
-
shape: "rotated_pill_hole_with_rect_pad",
|
|
375815
|
-
hole_shape: "rotated_pill",
|
|
375816
|
-
pad_shape: "rect",
|
|
375817
|
-
hole_width: holeWidth,
|
|
375818
|
-
hole_height: holeHeight,
|
|
375819
|
-
hole_ccw_rotation: pad.rotation || 0,
|
|
375820
|
-
rect_ccw_rotation: pad.rotation || 0,
|
|
375821
|
-
rect_pad_width: padWidth,
|
|
375822
|
-
rect_pad_height: padHeight
|
|
375823
|
-
};
|
|
375824
|
-
} else {
|
|
375825
|
-
additionalPlatedHoleProps = {
|
|
375826
|
-
shape: "rotated_pill_hole_with_rect_pad",
|
|
375827
|
-
hole_shape: "rotated_pill",
|
|
375828
|
-
pad_shape: "rect",
|
|
375829
|
-
hole_width: holeDiameter,
|
|
375830
|
-
hole_height: holeDiameter,
|
|
375831
|
-
hole_ccw_rotation: pad.rotation || 0,
|
|
375832
|
-
rect_ccw_rotation: pad.rotation || 0,
|
|
375833
|
-
rect_pad_width: padWidth,
|
|
375834
|
-
rect_pad_height: padHeight
|
|
375835
|
-
};
|
|
375836
|
-
}
|
|
375837
|
-
} else {
|
|
375838
|
-
additionalPlatedHoleProps = {
|
|
375839
|
-
shape: "circle",
|
|
375840
|
-
hole_diameter: mil2mm2(pad.holeRadius) * 2,
|
|
375841
|
-
outer_diameter: mil2mm2(pad.width),
|
|
375842
|
-
radius: mil2mm2(pad.holeRadius)
|
|
375843
|
-
};
|
|
375844
|
-
}
|
|
375880
|
+
const additionalPlatedHoleProps = getEasyEdaPlatedHoleGeometry2(pad);
|
|
375845
375881
|
circuitElements.push(pcb_plated_hole2.parse({
|
|
375846
375882
|
...commonPlatedHoleProps,
|
|
375847
375883
|
...additionalPlatedHoleProps
|
|
@@ -376216,6 +376252,8 @@ var PadSchema2 = BaseShapeSchema2.extend({
|
|
|
376216
376252
|
net: z200.union([z200.string(), z200.number()]).optional(),
|
|
376217
376253
|
number: z200.union([z200.string(), z200.number()]),
|
|
376218
376254
|
holeRadius: tenthmil2,
|
|
376255
|
+
holeLength: tenthmil2.optional(),
|
|
376256
|
+
holePoints: z200.array(PointSchema3).length(2).optional(),
|
|
376219
376257
|
points: z200.array(PointSchema3).optional(),
|
|
376220
376258
|
rotation: safeNumber2(0),
|
|
376221
376259
|
plated: z200.boolean()
|
|
@@ -376348,6 +376386,8 @@ var ShapeItemSchema2 = z200.object({
|
|
|
376348
376386
|
net,
|
|
376349
376387
|
number: padNumber,
|
|
376350
376388
|
holeRadius,
|
|
376389
|
+
holeLength: rest[3] === undefined || rest[3] === "" ? undefined : rest[3],
|
|
376390
|
+
holePoints: rest[4] ? parsePoints3(String(rest[4])) : undefined,
|
|
376351
376391
|
points,
|
|
376352
376392
|
rotation: rotation2,
|
|
376353
376393
|
plated: rest.includes("Y")
|
package/dist/lib/index.js
CHANGED
|
@@ -69109,7 +69109,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
69109
69109
|
}));
|
|
69110
69110
|
};
|
|
69111
69111
|
// package.json
|
|
69112
|
-
var version = "0.1.
|
|
69112
|
+
var version = "0.1.2231";
|
|
69113
69113
|
var package_default = {
|
|
69114
69114
|
name: "@tscircuit/cli",
|
|
69115
69115
|
version,
|
|
@@ -69178,7 +69178,7 @@ var package_default = {
|
|
|
69178
69178
|
debug: "^4.4.0",
|
|
69179
69179
|
delay: "^6.0.0",
|
|
69180
69180
|
"dsn-converter": "^0.0.90",
|
|
69181
|
-
easyeda: "^0.0.
|
|
69181
|
+
easyeda: "^0.0.368",
|
|
69182
69182
|
"fuse.js": "^7.1.0",
|
|
69183
69183
|
"get-port": "^7.1.0",
|
|
69184
69184
|
globby: "^14.1.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2232",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tscircuit/cli"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"debug": "^4.4.0",
|
|
67
67
|
"delay": "^6.0.0",
|
|
68
68
|
"dsn-converter": "^0.0.90",
|
|
69
|
-
"easyeda": "^0.0.
|
|
69
|
+
"easyeda": "^0.0.368",
|
|
70
70
|
"fuse.js": "^7.1.0",
|
|
71
71
|
"get-port": "^7.1.0",
|
|
72
72
|
"globby": "^14.1.0",
|