@tscircuit/cli 0.1.1880 → 0.1.1882
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 +151 -257
- package/dist/lib/index.js +2 -2
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -77175,6 +77175,13 @@ import {
|
|
|
77175
77175
|
import { applyToPoint as applyToPoint29, identity as identity10 } from "transformation-matrix";
|
|
77176
77176
|
import { convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg22 } from "circuit-to-svg";
|
|
77177
77177
|
import { deflateSync } from "node:zlib";
|
|
77178
|
+
import {
|
|
77179
|
+
glyphAdvanceRatio as glyphAdvanceRatio2,
|
|
77180
|
+
glyphWidthRatio,
|
|
77181
|
+
spaceWidthRatio,
|
|
77182
|
+
strokeWidthRatio,
|
|
77183
|
+
svgAlphabet as svgAlphabet2
|
|
77184
|
+
} from "@tscircuit/alphabet";
|
|
77178
77185
|
|
|
77179
77186
|
class BitmapCanvasContext {
|
|
77180
77187
|
canvas;
|
|
@@ -77588,57 +77595,6 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
77588
77595
|
}
|
|
77589
77596
|
}
|
|
77590
77597
|
}
|
|
77591
|
-
}, drawDebugFilledCircle = ({
|
|
77592
|
-
rgba,
|
|
77593
|
-
width,
|
|
77594
|
-
height,
|
|
77595
|
-
center: center2,
|
|
77596
|
-
radius,
|
|
77597
|
-
color,
|
|
77598
|
-
alpha
|
|
77599
|
-
}) => {
|
|
77600
|
-
const minX = Math.max(0, Math.floor(center2.x - radius));
|
|
77601
|
-
const maxX = Math.min(width - 1, Math.ceil(center2.x + radius));
|
|
77602
|
-
const minY = Math.max(0, Math.floor(center2.y - radius));
|
|
77603
|
-
const maxY = Math.min(height - 1, Math.ceil(center2.y + radius));
|
|
77604
|
-
for (let y4 = minY;y4 <= maxY; y4++) {
|
|
77605
|
-
for (let x4 = minX;x4 <= maxX; x4++) {
|
|
77606
|
-
const distance49 = Math.hypot(x4 + 0.5 - center2.x, y4 + 0.5 - center2.y);
|
|
77607
|
-
if (distance49 <= radius) {
|
|
77608
|
-
blendRgbaPixel(rgba, y4 * width + x4, color, alpha);
|
|
77609
|
-
}
|
|
77610
|
-
}
|
|
77611
|
-
}
|
|
77612
|
-
}, drawDebugLine = ({
|
|
77613
|
-
rgba,
|
|
77614
|
-
width,
|
|
77615
|
-
height,
|
|
77616
|
-
start,
|
|
77617
|
-
end,
|
|
77618
|
-
color,
|
|
77619
|
-
alpha,
|
|
77620
|
-
strokeWidth = 1.5
|
|
77621
|
-
}) => {
|
|
77622
|
-
const strokeRadius = strokeWidth / 2;
|
|
77623
|
-
const minX = Math.max(0, Math.floor(Math.min(start.x, end.x) - strokeRadius));
|
|
77624
|
-
const maxX = Math.min(width - 1, Math.ceil(Math.max(start.x, end.x) + strokeRadius));
|
|
77625
|
-
const minY = Math.max(0, Math.floor(Math.min(start.y, end.y) - strokeRadius));
|
|
77626
|
-
const maxY = Math.min(height - 1, Math.ceil(Math.max(start.y, end.y) + strokeRadius));
|
|
77627
|
-
const lineLength = Math.hypot(end.x - start.x, end.y - start.y);
|
|
77628
|
-
if (lineLength === 0)
|
|
77629
|
-
return;
|
|
77630
|
-
for (let y4 = minY;y4 <= maxY; y4++) {
|
|
77631
|
-
for (let x4 = minX;x4 <= maxX; x4++) {
|
|
77632
|
-
const px3 = x4 + 0.5;
|
|
77633
|
-
const py3 = y4 + 0.5;
|
|
77634
|
-
const t50 = Math.max(0, Math.min(1, ((px3 - start.x) * (end.x - start.x) + (py3 - start.y) * (end.y - start.y)) / lineLength ** 2));
|
|
77635
|
-
const nearestX = start.x + (end.x - start.x) * t50;
|
|
77636
|
-
const nearestY = start.y + (end.y - start.y) * t50;
|
|
77637
|
-
if (Math.hypot(px3 - nearestX, py3 - nearestY) <= strokeRadius) {
|
|
77638
|
-
blendRgbaPixel(rgba, y4 * width + x4, color, alpha);
|
|
77639
|
-
}
|
|
77640
|
-
}
|
|
77641
|
-
}
|
|
77642
77598
|
}, overlayPcbPortMarkers = ({
|
|
77643
77599
|
circuitJson,
|
|
77644
77600
|
bounds,
|
|
@@ -77673,7 +77629,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
77673
77629
|
height,
|
|
77674
77630
|
rgba
|
|
77675
77631
|
}) => {
|
|
77676
|
-
const markerColor = [
|
|
77632
|
+
const markerColor = [255, 0, 255];
|
|
77677
77633
|
for (const short of shorts) {
|
|
77678
77634
|
const point9 = getPixelPointFromReal({
|
|
77679
77635
|
x: short.center.x,
|
|
@@ -77687,43 +77643,43 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
77687
77643
|
width,
|
|
77688
77644
|
height,
|
|
77689
77645
|
center: point9,
|
|
77690
|
-
radius:
|
|
77646
|
+
radius: 14,
|
|
77691
77647
|
color: markerColor,
|
|
77692
|
-
alpha:
|
|
77693
|
-
strokeWidth:
|
|
77648
|
+
alpha: 1,
|
|
77649
|
+
strokeWidth: 4
|
|
77694
77650
|
});
|
|
77695
|
-
|
|
77651
|
+
drawDebugCircleOutline({
|
|
77696
77652
|
rgba,
|
|
77697
77653
|
width,
|
|
77698
77654
|
height,
|
|
77699
77655
|
center: point9,
|
|
77700
|
-
radius:
|
|
77701
|
-
color: markerColor,
|
|
77702
|
-
alpha: 0.4
|
|
77703
|
-
});
|
|
77704
|
-
drawDebugLine({
|
|
77705
|
-
rgba,
|
|
77706
|
-
width,
|
|
77707
|
-
height,
|
|
77708
|
-
start: { x: point9.x - 16, y: point9.y },
|
|
77709
|
-
end: { x: point9.x + 16, y: point9.y },
|
|
77710
|
-
color: markerColor,
|
|
77711
|
-
alpha: 0.65,
|
|
77712
|
-
strokeWidth: 3
|
|
77713
|
-
});
|
|
77714
|
-
drawDebugLine({
|
|
77715
|
-
rgba,
|
|
77716
|
-
width,
|
|
77717
|
-
height,
|
|
77718
|
-
start: { x: point9.x, y: point9.y - 16 },
|
|
77719
|
-
end: { x: point9.x, y: point9.y + 16 },
|
|
77656
|
+
radius: 6,
|
|
77720
77657
|
color: markerColor,
|
|
77721
|
-
alpha:
|
|
77658
|
+
alpha: 1,
|
|
77722
77659
|
strokeWidth: 3
|
|
77723
77660
|
});
|
|
77724
77661
|
}
|
|
77725
|
-
}, getGerberLayerName2 = (layer) =>
|
|
77726
|
-
|
|
77662
|
+
}, getGerberLayerName2 = (layer) => {
|
|
77663
|
+
if (layer === "top")
|
|
77664
|
+
return "F_Cu";
|
|
77665
|
+
if (layer === "bottom")
|
|
77666
|
+
return "B_Cu";
|
|
77667
|
+
return `In${layer.slice("inner".length)}_Cu`;
|
|
77668
|
+
}, normalizeRotation = (rotation11) => (rotation11 % 360 + 360) % 360, isOddQuarterTurn = (rotation11) => Math.abs(rotation11 - 90) < 0.000001 || Math.abs(rotation11 - 270) < 0.000001, normalizeOrthogonalSmtpadRotations = (elements) => elements.map((element) => {
|
|
77669
|
+
if (element.type !== "pcb_smtpad" || element.shape !== "rotated_rect") {
|
|
77670
|
+
return element;
|
|
77671
|
+
}
|
|
77672
|
+
const rotation11 = normalizeRotation(element.ccw_rotation);
|
|
77673
|
+
if (!isOddQuarterTurn(rotation11))
|
|
77674
|
+
return element;
|
|
77675
|
+
return {
|
|
77676
|
+
...element,
|
|
77677
|
+
width: element.height,
|
|
77678
|
+
height: element.width,
|
|
77679
|
+
ccw_rotation: 0
|
|
77680
|
+
};
|
|
77681
|
+
}), getGerberLayerString = (elements, layer) => {
|
|
77682
|
+
const gerberLayers = stringifyGerberCommandLayers(convertSoupToGerberCommands(normalizeOrthogonalSmtpadRotations(elements)));
|
|
77727
77683
|
return gerberLayers[getGerberLayerName2(layer)];
|
|
77728
77684
|
}, assertGerberLayerCanBeGenerated = (circuitJson, layer) => {
|
|
77729
77685
|
const gerberLayers = convertSoupToGerberCommands(circuitJson);
|
|
@@ -77862,7 +77818,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
77862
77818
|
}) => {
|
|
77863
77819
|
const ctx = new BitmapCanvasContext(width, height);
|
|
77864
77820
|
const drawer = new CircuitToCanvasDrawer(ctx);
|
|
77865
|
-
const renderLayer = layer
|
|
77821
|
+
const renderLayer = `${layer}_copper`;
|
|
77866
77822
|
const layerElements = getPcbLayerElements(elements, layer);
|
|
77867
77823
|
drawer.setCameraBounds(bounds);
|
|
77868
77824
|
drawer.drawElements(layerElements, {
|
|
@@ -77948,6 +77904,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
77948
77904
|
return clampBounds(expandBounds2(bounds ?? boardBounds, 0.2), boardBounds);
|
|
77949
77905
|
}, createGroupMask = async ({
|
|
77950
77906
|
elements,
|
|
77907
|
+
pcbBoard,
|
|
77951
77908
|
bounds,
|
|
77952
77909
|
width,
|
|
77953
77910
|
height,
|
|
@@ -77955,7 +77912,13 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
77955
77912
|
mode
|
|
77956
77913
|
}) => {
|
|
77957
77914
|
if (mode === "gerber") {
|
|
77958
|
-
return createGerberGroupMask({
|
|
77915
|
+
return createGerberGroupMask({
|
|
77916
|
+
elements: pcbBoard ? [pcbBoard, ...elements] : elements,
|
|
77917
|
+
bounds,
|
|
77918
|
+
width,
|
|
77919
|
+
height,
|
|
77920
|
+
layer
|
|
77921
|
+
});
|
|
77959
77922
|
}
|
|
77960
77923
|
return createPcbGroupMask({ elements, bounds, width, height, layer });
|
|
77961
77924
|
}, getBitmapDimensions = (bounds, options) => {
|
|
@@ -78025,6 +77988,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78025
77988
|
};
|
|
78026
77989
|
}, createBitmapMask = async ({
|
|
78027
77990
|
elements,
|
|
77991
|
+
pcbBoard,
|
|
78028
77992
|
boardBounds,
|
|
78029
77993
|
width,
|
|
78030
77994
|
height,
|
|
@@ -78048,6 +78012,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78048
78012
|
});
|
|
78049
78013
|
const mask = await createGroupMask({
|
|
78050
78014
|
elements,
|
|
78015
|
+
pcbBoard,
|
|
78051
78016
|
bounds: maskBounds,
|
|
78052
78017
|
width: rect.width,
|
|
78053
78018
|
height: rect.height,
|
|
@@ -78140,6 +78105,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78140
78105
|
const bounds = getBoardBounds2(circuitJson);
|
|
78141
78106
|
const { width, height } = getBitmapDimensions(bounds, options);
|
|
78142
78107
|
const db2 = cju22(circuitJson);
|
|
78108
|
+
const pcbBoard = circuitJson.find((element) => element.type === "pcb_board");
|
|
78143
78109
|
const connectivityGroups = buildConnectivityGroups({
|
|
78144
78110
|
circuitJson,
|
|
78145
78111
|
connMap,
|
|
@@ -78162,6 +78128,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78162
78128
|
const color = getDebugColorForConnectivityKey(key);
|
|
78163
78129
|
const bitmapMask = await createBitmapMask({
|
|
78164
78130
|
elements,
|
|
78131
|
+
pcbBoard,
|
|
78165
78132
|
boardBounds: bounds,
|
|
78166
78133
|
width,
|
|
78167
78134
|
height,
|
|
@@ -78229,6 +78196,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78229
78196
|
}
|
|
78230
78197
|
const copperPourMask = await createBitmapMask({
|
|
78231
78198
|
elements: copperPourElements,
|
|
78199
|
+
pcbBoard,
|
|
78232
78200
|
boardBounds: bounds,
|
|
78233
78201
|
width,
|
|
78234
78202
|
height,
|
|
@@ -78247,6 +78215,7 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78247
78215
|
}
|
|
78248
78216
|
const nonPourMask = await createBitmapMask({
|
|
78249
78217
|
elements: nonPourElements,
|
|
78218
|
+
pcbBoard,
|
|
78250
78219
|
boardBounds: bounds,
|
|
78251
78220
|
width,
|
|
78252
78221
|
height,
|
|
@@ -78331,10 +78300,8 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78331
78300
|
return `
|
|
78332
78301
|
<g data-type="short-debug" data-mode="${escapeXml(short.mode)}" data-layer="${escapeXml(short.layer)}">
|
|
78333
78302
|
<title>${escapeXml(text)}</title>
|
|
78334
|
-
<circle cx="${point9.x.toFixed(2)}" cy="${point9.y.toFixed(2)}" r="
|
|
78335
|
-
<circle cx="${point9.x.toFixed(2)}" cy="${point9.y.toFixed(2)}" r="
|
|
78336
|
-
<line x1="${(point9.x - 16).toFixed(2)}" y1="${point9.y.toFixed(2)}" x2="${(point9.x + 16).toFixed(2)}" y2="${point9.y.toFixed(2)}" stroke="${shortMarkerStroke}" stroke-width="3" stroke-opacity="0.65"/>
|
|
78337
|
-
<line x1="${point9.x.toFixed(2)}" y1="${(point9.y - 16).toFixed(2)}" x2="${point9.x.toFixed(2)}" y2="${(point9.y + 16).toFixed(2)}" stroke="${shortMarkerStroke}" stroke-width="3" stroke-opacity="0.65"/>
|
|
78303
|
+
<circle cx="${point9.x.toFixed(2)}" cy="${point9.y.toFixed(2)}" r="14" fill="none" stroke="${shortMarkerStroke}" stroke-width="4"/>
|
|
78304
|
+
<circle cx="${point9.x.toFixed(2)}" cy="${point9.y.toFixed(2)}" r="6" fill="none" stroke="${shortMarkerStroke}" stroke-width="3"/>
|
|
78338
78305
|
</g>`;
|
|
78339
78306
|
}).join("");
|
|
78340
78307
|
return baseSvg.replace("</svg>", `${overlays}
|
|
@@ -78391,109 +78358,75 @@ var import_gerber_to_svg, renderTscircuitRepro = async (tsx, options = {}) => {
|
|
|
78391
78358
|
createChunk("IDAT", deflateSync(scanlines, { level: 1 })),
|
|
78392
78359
|
createChunk("IEND", new Uint8Array)
|
|
78393
78360
|
]);
|
|
78394
|
-
},
|
|
78395
|
-
const
|
|
78396
|
-
|
|
78397
|
-
|
|
78398
|
-
|
|
78399
|
-
rgba[offset + 3] = 255;
|
|
78400
|
-
}, fillRect = ({
|
|
78401
|
-
rgba,
|
|
78402
|
-
width,
|
|
78361
|
+
}, getLegendLabel = (entry) => {
|
|
78362
|
+
const labels = entry.labels.length > 0 ? entry.labels.join(",") : entry.connectivityKey;
|
|
78363
|
+
return labels.length > 36 ? `${labels.slice(0, 33)}...` : labels;
|
|
78364
|
+
}, markerLegend, createAlphabetTextSvg = ({
|
|
78365
|
+
text,
|
|
78403
78366
|
x: x4,
|
|
78404
|
-
|
|
78405
|
-
|
|
78406
|
-
|
|
78407
|
-
color
|
|
78367
|
+
top,
|
|
78368
|
+
size,
|
|
78369
|
+
maxWidth
|
|
78408
78370
|
}) => {
|
|
78409
|
-
|
|
78410
|
-
|
|
78411
|
-
|
|
78371
|
+
let cursorX = 0;
|
|
78372
|
+
const paths = [];
|
|
78373
|
+
for (const character of text) {
|
|
78374
|
+
const path49 = svgAlphabet2[character];
|
|
78375
|
+
if (path49) {
|
|
78376
|
+
paths.push(`<path d="${path49}" transform="translate(${cursorX} 0)"/>`);
|
|
78412
78377
|
}
|
|
78378
|
+
cursorX += glyphAdvanceRatio2[character] ?? (character === " " ? spaceWidthRatio : glyphWidthRatio);
|
|
78413
78379
|
}
|
|
78414
|
-
|
|
78415
|
-
|
|
78380
|
+
const renderedSize = maxWidth === undefined || cursorX === 0 ? size : Math.min(size, maxWidth / cursorX);
|
|
78381
|
+
return `<g fill="none" stroke="#111" stroke-width="${strokeWidthRatio}" stroke-linecap="round" stroke-linejoin="round" transform="translate(${x4} ${top - 0.24 * renderedSize}) scale(${renderedSize})">${paths.join("")}</g>`;
|
|
78382
|
+
}, createBitmapLegendSvg = ({
|
|
78416
78383
|
width,
|
|
78417
|
-
|
|
78418
|
-
|
|
78419
|
-
text,
|
|
78420
|
-
color,
|
|
78421
|
-
scale: scale6 = 2
|
|
78384
|
+
height,
|
|
78385
|
+
legend
|
|
78422
78386
|
}) => {
|
|
78423
|
-
|
|
78424
|
-
|
|
78425
|
-
|
|
78426
|
-
|
|
78427
|
-
|
|
78428
|
-
|
|
78429
|
-
|
|
78430
|
-
|
|
78431
|
-
|
|
78432
|
-
|
|
78433
|
-
|
|
78434
|
-
|
|
78435
|
-
|
|
78436
|
-
|
|
78437
|
-
|
|
78438
|
-
|
|
78439
|
-
|
|
78440
|
-
|
|
78441
|
-
|
|
78442
|
-
|
|
78443
|
-
|
|
78444
|
-
|
|
78445
|
-
|
|
78446
|
-
|
|
78387
|
+
const headerHeight = 26;
|
|
78388
|
+
const rowHeight = 20;
|
|
78389
|
+
const rows = [
|
|
78390
|
+
...markerLegend.map((entry, index) => `
|
|
78391
|
+
<rect x="10" y="${headerHeight + index * rowHeight + 3}" width="14" height="10" rx="1" fill="${entry.color}"/>
|
|
78392
|
+
${createAlphabetTextSvg({
|
|
78393
|
+
text: entry.label,
|
|
78394
|
+
x: 32,
|
|
78395
|
+
top: headerHeight + index * rowHeight + 2,
|
|
78396
|
+
size: 16,
|
|
78397
|
+
maxWidth: width - 42
|
|
78398
|
+
})}`),
|
|
78399
|
+
...legend.map((entry, index) => `
|
|
78400
|
+
<rect x="10" y="${headerHeight + (markerLegend.length + index) * rowHeight + 3}" width="14" height="10" rx="1" fill="rgb(${entry.color.join(",")})"/>
|
|
78401
|
+
${createAlphabetTextSvg({
|
|
78402
|
+
text: getLegendLabel(entry),
|
|
78403
|
+
x: 32,
|
|
78404
|
+
top: headerHeight + (markerLegend.length + index) * rowHeight + 2,
|
|
78405
|
+
size: 16,
|
|
78406
|
+
maxWidth: width - 42
|
|
78407
|
+
})}`)
|
|
78408
|
+
].join("");
|
|
78409
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
|
|
78410
|
+
<rect width="100%" height="100%" fill="white"/>
|
|
78411
|
+
${createAlphabetTextSvg({ text: "Legend", x: 10, top: 4, size: 15 })}${rows}
|
|
78412
|
+
</svg>`;
|
|
78447
78413
|
}, appendBitmapLegend = (debugRender) => {
|
|
78448
|
-
const
|
|
78449
|
-
const legendRows = Math.max(1, debugRender.legend.length + 2);
|
|
78450
|
-
const legendHeight = legendRows * rowHeight + 8;
|
|
78414
|
+
const legendHeight = 34 + (markerLegend.length + debugRender.legend.length) * 20;
|
|
78451
78415
|
const width = debugRender.width;
|
|
78452
78416
|
const height = debugRender.height + legendHeight;
|
|
78453
78417
|
const rgba = new Uint8Array(width * height * 4);
|
|
78454
|
-
for (let i4 = 0;i4 < width * height; i4++) {
|
|
78455
|
-
setPixel(rgba, width, i4 % width, Math.floor(i4 / width), [255, 255, 255]);
|
|
78456
|
-
}
|
|
78457
78418
|
for (let y4 = 0;y4 < debugRender.height; y4++) {
|
|
78458
78419
|
rgba.set(debugRender.rgba.subarray(y4 * debugRender.width * 4, (y4 + 1) * debugRender.width * 4), y4 * width * 4);
|
|
78459
78420
|
}
|
|
78460
|
-
const
|
|
78461
|
-
drawText2({
|
|
78462
|
-
rgba,
|
|
78421
|
+
const legendPng = decodePng(renderSvgToPng(createBitmapLegendSvg({
|
|
78463
78422
|
width,
|
|
78464
|
-
|
|
78465
|
-
|
|
78466
|
-
|
|
78467
|
-
|
|
78468
|
-
|
|
78469
|
-
|
|
78470
|
-
|
|
78471
|
-
width,
|
|
78472
|
-
x: 96,
|
|
78473
|
-
y: legendY,
|
|
78474
|
-
text: "RED:SHORT MARKER ORANGE:PORT BLACK:UNASSIGNED",
|
|
78475
|
-
color: [0, 0, 0]
|
|
78476
|
-
});
|
|
78477
|
-
debugRender.legend.forEach((entry, index) => {
|
|
78478
|
-
const y4 = legendY + rowHeight * (index + 1);
|
|
78479
|
-
fillRect({
|
|
78480
|
-
rgba,
|
|
78481
|
-
width,
|
|
78482
|
-
x: 10,
|
|
78483
|
-
y: y4,
|
|
78484
|
-
rectWidth: 14,
|
|
78485
|
-
rectHeight: 10,
|
|
78486
|
-
color: entry.color
|
|
78487
|
-
});
|
|
78488
|
-
drawText2({
|
|
78489
|
-
rgba,
|
|
78490
|
-
width,
|
|
78491
|
-
x: 32,
|
|
78492
|
-
y: y4,
|
|
78493
|
-
text: getLegendLabel(entry),
|
|
78494
|
-
color: [0, 0, 0]
|
|
78495
|
-
});
|
|
78496
|
-
});
|
|
78423
|
+
height: legendHeight,
|
|
78424
|
+
legend: debugRender.legend
|
|
78425
|
+
})));
|
|
78426
|
+
if (legendPng.width !== width || legendPng.height !== legendHeight || legendPng.channels !== 4 || legendPng.depth !== 8) {
|
|
78427
|
+
throw new Error("Unable to render bitmap debug legend");
|
|
78428
|
+
}
|
|
78429
|
+
rgba.set(legendPng.data, debugRender.height * width * 4);
|
|
78497
78430
|
return { ...debugRender, width, height, rgba };
|
|
78498
78431
|
};
|
|
78499
78432
|
var init_dist3 = __esm(() => {
|
|
@@ -78501,6 +78434,7 @@ var init_dist3 = __esm(() => {
|
|
|
78501
78434
|
init_dist();
|
|
78502
78435
|
init_lib();
|
|
78503
78436
|
init_dist2();
|
|
78437
|
+
init_lib();
|
|
78504
78438
|
import_gerber_to_svg = __toESM2(require_gerber_to_svg(), 1);
|
|
78505
78439
|
crcTable2 = new Uint32Array(256);
|
|
78506
78440
|
for (let i4 = 0;i4 < crcTable2.length; i4++) {
|
|
@@ -78511,51 +78445,11 @@ var init_dist3 = __esm(() => {
|
|
|
78511
78445
|
crcTable2[i4] = crc2 >>> 0;
|
|
78512
78446
|
}
|
|
78513
78447
|
textEncoder = new TextEncoder;
|
|
78514
|
-
|
|
78515
|
-
|
|
78516
|
-
|
|
78517
|
-
|
|
78518
|
-
|
|
78519
|
-
"-": ["000", "000", "111", "000", "000"],
|
|
78520
|
-
">": ["100", "010", "001", "010", "100"],
|
|
78521
|
-
"/": ["001", "001", "010", "100", "100"],
|
|
78522
|
-
"0": ["111", "101", "101", "101", "111"],
|
|
78523
|
-
"1": ["010", "110", "010", "010", "111"],
|
|
78524
|
-
"2": ["111", "001", "111", "100", "111"],
|
|
78525
|
-
"3": ["111", "001", "111", "001", "111"],
|
|
78526
|
-
"4": ["101", "101", "111", "001", "001"],
|
|
78527
|
-
"5": ["111", "100", "111", "001", "111"],
|
|
78528
|
-
"6": ["111", "100", "111", "101", "111"],
|
|
78529
|
-
"7": ["111", "001", "010", "010", "010"],
|
|
78530
|
-
"8": ["111", "101", "111", "101", "111"],
|
|
78531
|
-
"9": ["111", "101", "111", "001", "111"],
|
|
78532
|
-
A: ["010", "101", "111", "101", "101"],
|
|
78533
|
-
B: ["110", "101", "110", "101", "110"],
|
|
78534
|
-
C: ["011", "100", "100", "100", "011"],
|
|
78535
|
-
D: ["110", "101", "101", "101", "110"],
|
|
78536
|
-
E: ["111", "100", "110", "100", "111"],
|
|
78537
|
-
F: ["111", "100", "110", "100", "100"],
|
|
78538
|
-
G: ["011", "100", "101", "101", "011"],
|
|
78539
|
-
H: ["101", "101", "111", "101", "101"],
|
|
78540
|
-
I: ["111", "010", "010", "010", "111"],
|
|
78541
|
-
J: ["001", "001", "001", "101", "111"],
|
|
78542
|
-
K: ["101", "101", "110", "101", "101"],
|
|
78543
|
-
L: ["100", "100", "100", "100", "111"],
|
|
78544
|
-
M: ["101", "111", "111", "101", "101"],
|
|
78545
|
-
N: ["101", "111", "111", "111", "101"],
|
|
78546
|
-
O: ["111", "101", "101", "101", "111"],
|
|
78547
|
-
P: ["111", "101", "111", "100", "100"],
|
|
78548
|
-
Q: ["111", "101", "101", "111", "001"],
|
|
78549
|
-
R: ["110", "101", "110", "101", "101"],
|
|
78550
|
-
S: ["111", "100", "111", "001", "111"],
|
|
78551
|
-
T: ["111", "010", "010", "010", "010"],
|
|
78552
|
-
U: ["101", "101", "101", "101", "111"],
|
|
78553
|
-
V: ["101", "101", "101", "101", "010"],
|
|
78554
|
-
W: ["101", "101", "111", "111", "101"],
|
|
78555
|
-
X: ["101", "101", "010", "101", "101"],
|
|
78556
|
-
Y: ["101", "101", "010", "010", "010"],
|
|
78557
|
-
Z: ["111", "001", "010", "100", "111"]
|
|
78558
|
-
};
|
|
78448
|
+
markerLegend = [
|
|
78449
|
+
{ color: "#ff00ff", label: "Short marker" },
|
|
78450
|
+
{ color: "#ffa500", label: "PCB port" },
|
|
78451
|
+
{ color: "#000000", label: "Unassigned" }
|
|
78452
|
+
];
|
|
78559
78453
|
});
|
|
78560
78454
|
|
|
78561
78455
|
// node_modules/circuit-json-trace-length-analysis/lib/analyze-circuit-json-trace-length.ts
|
|
@@ -120694,19 +120588,19 @@ var require_StandardFontEmbedder = __commonJS((exports2) => {
|
|
|
120694
120588
|
this.customName = customName;
|
|
120695
120589
|
}
|
|
120696
120590
|
StandardFontEmbedder2.prototype.encodeText = function(text) {
|
|
120697
|
-
var
|
|
120698
|
-
var hexCodes = new Array(
|
|
120699
|
-
for (var idx = 0, len =
|
|
120700
|
-
hexCodes[idx] = utils_1.toHexString(
|
|
120591
|
+
var glyphs = this.encodeTextAsGlyphs(text);
|
|
120592
|
+
var hexCodes = new Array(glyphs.length);
|
|
120593
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
120594
|
+
hexCodes[idx] = utils_1.toHexString(glyphs[idx].code);
|
|
120701
120595
|
}
|
|
120702
120596
|
return PDFHexString_1.default.of(hexCodes.join(""));
|
|
120703
120597
|
};
|
|
120704
120598
|
StandardFontEmbedder2.prototype.widthOfTextAtSize = function(text, size) {
|
|
120705
|
-
var
|
|
120599
|
+
var glyphs = this.encodeTextAsGlyphs(text);
|
|
120706
120600
|
var totalWidth = 0;
|
|
120707
|
-
for (var idx = 0, len =
|
|
120708
|
-
var left =
|
|
120709
|
-
var right = (
|
|
120601
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
120602
|
+
var left = glyphs[idx].name;
|
|
120603
|
+
var right = (glyphs[idx + 1] || {}).name;
|
|
120710
120604
|
var kernAmount = this.font.getXAxisKerningForPair(left, right) || 0;
|
|
120711
120605
|
totalWidth += this.widthOfGlyph(left) + kernAmount;
|
|
120712
120606
|
}
|
|
@@ -120751,12 +120645,12 @@ var require_StandardFontEmbedder = __commonJS((exports2) => {
|
|
|
120751
120645
|
};
|
|
120752
120646
|
StandardFontEmbedder2.prototype.encodeTextAsGlyphs = function(text) {
|
|
120753
120647
|
var codePoints = Array.from(text);
|
|
120754
|
-
var
|
|
120648
|
+
var glyphs = new Array(codePoints.length);
|
|
120755
120649
|
for (var idx = 0, len = codePoints.length;idx < len; idx++) {
|
|
120756
120650
|
var codePoint = utils_1.toCodePoint(codePoints[idx]);
|
|
120757
|
-
|
|
120651
|
+
glyphs[idx] = this.encoding.encodeUnicodeCodePoint(codePoint);
|
|
120758
120652
|
}
|
|
120759
|
-
return
|
|
120653
|
+
return glyphs;
|
|
120760
120654
|
};
|
|
120761
120655
|
StandardFontEmbedder2.for = function(fontName, customName) {
|
|
120762
120656
|
return new StandardFontEmbedder2(fontName, customName);
|
|
@@ -120772,10 +120666,10 @@ var require_CMap = __commonJS((exports2) => {
|
|
|
120772
120666
|
exports2.createCmap = undefined;
|
|
120773
120667
|
var utils_1 = require_utils8();
|
|
120774
120668
|
var unicode_1 = require_unicode();
|
|
120775
|
-
exports2.createCmap = function(
|
|
120776
|
-
var bfChars = new Array(
|
|
120777
|
-
for (var idx = 0, len =
|
|
120778
|
-
var glyph =
|
|
120669
|
+
exports2.createCmap = function(glyphs, glyphId) {
|
|
120670
|
+
var bfChars = new Array(glyphs.length);
|
|
120671
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
120672
|
+
var glyph = glyphs[idx];
|
|
120779
120673
|
var id2 = cmapHexFormat(cmapHexString(glyphId(glyph)));
|
|
120780
120674
|
var unicode = cmapHexFormat.apply(undefined, glyph.codePoints.map(cmapCodePointFormat));
|
|
120781
120675
|
bfChars[idx] = [id2, unicode];
|
|
@@ -121002,12 +120896,12 @@ var require_CustomFontEmbedder = __commonJS((exports2) => {
|
|
|
121002
120896
|
function CustomFontEmbedder2(font, fontData, customName, fontFeatures) {
|
|
121003
120897
|
var _this = this;
|
|
121004
120898
|
this.allGlyphsInFontSortedById = function() {
|
|
121005
|
-
var
|
|
121006
|
-
for (var idx = 0, len =
|
|
120899
|
+
var glyphs = new Array(_this.font.characterSet.length);
|
|
120900
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
121007
120901
|
var codePoint = _this.font.characterSet[idx];
|
|
121008
|
-
|
|
120902
|
+
glyphs[idx] = _this.font.glyphForCodePoint(codePoint);
|
|
121009
120903
|
}
|
|
121010
|
-
return utils_1.sortedUniq(
|
|
120904
|
+
return utils_1.sortedUniq(glyphs.sort(utils_1.byAscendingId), function(g6) {
|
|
121011
120905
|
return g6.id;
|
|
121012
120906
|
});
|
|
121013
120907
|
};
|
|
@@ -121035,18 +120929,18 @@ var require_CustomFontEmbedder = __commonJS((exports2) => {
|
|
|
121035
120929
|
});
|
|
121036
120930
|
};
|
|
121037
120931
|
CustomFontEmbedder2.prototype.encodeText = function(text) {
|
|
121038
|
-
var
|
|
121039
|
-
var hexCodes = new Array(
|
|
121040
|
-
for (var idx = 0, len =
|
|
121041
|
-
hexCodes[idx] = utils_1.toHexStringOfMinLength(
|
|
120932
|
+
var glyphs = this.font.layout(text, this.fontFeatures).glyphs;
|
|
120933
|
+
var hexCodes = new Array(glyphs.length);
|
|
120934
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
120935
|
+
hexCodes[idx] = utils_1.toHexStringOfMinLength(glyphs[idx].id, 4);
|
|
121042
120936
|
}
|
|
121043
120937
|
return PDFHexString_1.default.of(hexCodes.join(""));
|
|
121044
120938
|
};
|
|
121045
120939
|
CustomFontEmbedder2.prototype.widthOfTextAtSize = function(text, size) {
|
|
121046
|
-
var
|
|
120940
|
+
var glyphs = this.font.layout(text, this.fontFeatures).glyphs;
|
|
121047
120941
|
var totalWidth = 0;
|
|
121048
|
-
for (var idx = 0, len =
|
|
121049
|
-
totalWidth +=
|
|
120942
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
120943
|
+
totalWidth += glyphs[idx].advanceWidth * this.scale;
|
|
121050
120944
|
}
|
|
121051
120945
|
var scale6 = size / 1000;
|
|
121052
120946
|
return totalWidth * scale6;
|
|
@@ -121196,12 +121090,12 @@ var require_CustomFontEmbedder = __commonJS((exports2) => {
|
|
|
121196
121090
|
return glyph ? glyph.id : -1;
|
|
121197
121091
|
};
|
|
121198
121092
|
CustomFontEmbedder2.prototype.computeWidths = function() {
|
|
121199
|
-
var
|
|
121093
|
+
var glyphs = this.glyphCache.access();
|
|
121200
121094
|
var widths = [];
|
|
121201
121095
|
var currSection = [];
|
|
121202
|
-
for (var idx = 0, len =
|
|
121203
|
-
var currGlyph =
|
|
121204
|
-
var prevGlyph =
|
|
121096
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
121097
|
+
var currGlyph = glyphs[idx];
|
|
121098
|
+
var prevGlyph = glyphs[idx - 1];
|
|
121205
121099
|
var currGlyphId = this.glyphId(currGlyph);
|
|
121206
121100
|
var prevGlyphId = this.glyphId(prevGlyph);
|
|
121207
121101
|
if (idx === 0) {
|
|
@@ -121255,10 +121149,10 @@ var require_CustomFontSubsetEmbedder = __commonJS((exports2) => {
|
|
|
121255
121149
|
});
|
|
121256
121150
|
};
|
|
121257
121151
|
CustomFontSubsetEmbedder2.prototype.encodeText = function(text) {
|
|
121258
|
-
var
|
|
121259
|
-
var hexCodes = new Array(
|
|
121260
|
-
for (var idx = 0, len =
|
|
121261
|
-
var glyph =
|
|
121152
|
+
var glyphs = this.font.layout(text, this.fontFeatures).glyphs;
|
|
121153
|
+
var hexCodes = new Array(glyphs.length);
|
|
121154
|
+
for (var idx = 0, len = glyphs.length;idx < len; idx++) {
|
|
121155
|
+
var glyph = glyphs[idx];
|
|
121262
121156
|
var subsetGlyphId = this.subset.includeGlyph(glyph);
|
|
121263
121157
|
this.glyphs[subsetGlyphId - 1] = glyph;
|
|
121264
121158
|
this.glyphIdMap.set(glyph.id, subsetGlyphId);
|
|
@@ -135252,7 +135146,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
135252
135146
|
// lib/getVersion.ts
|
|
135253
135147
|
import { createRequire as createRequire2 } from "node:module";
|
|
135254
135148
|
// package.json
|
|
135255
|
-
var version = "0.1.
|
|
135149
|
+
var version = "0.1.1880";
|
|
135256
135150
|
var package_default = {
|
|
135257
135151
|
name: "@tscircuit/cli",
|
|
135258
135152
|
version,
|
|
@@ -135264,7 +135158,7 @@ var package_default = {
|
|
|
135264
135158
|
devDependencies: {
|
|
135265
135159
|
"@babel/standalone": "^7.26.9",
|
|
135266
135160
|
"@biomejs/biome": "^1.9.4",
|
|
135267
|
-
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.
|
|
135161
|
+
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.19.tgz",
|
|
135268
135162
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
135269
135163
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.6",
|
|
135270
135164
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#bb0b41d80c9714695b498e182c2a558f1e0ceb2d",
|
|
@@ -309596,7 +309490,7 @@ import {
|
|
|
309596
309490
|
getRotationBetweenPcbPin1Locations
|
|
309597
309491
|
} from "circuit-json";
|
|
309598
309492
|
var fixedDecimals = 3;
|
|
309599
|
-
var
|
|
309493
|
+
var normalizeRotation2 = (rotation11) => (rotation11 % 360 + 360) % 360;
|
|
309600
309494
|
var getPickAndPlaceRotation = (pcbComponent, supplier) => {
|
|
309601
309495
|
if (!supplier || !pcbComponent.pin1_location)
|
|
309602
309496
|
return pcbComponent.rotation;
|
|
@@ -309606,7 +309500,7 @@ var getPickAndPlaceRotation = (pcbComponent, supplier) => {
|
|
|
309606
309500
|
const rotationAdjustment = getRotationBetweenPcbPin1Locations(supplierPin1Location, pcbComponent.pin1_location);
|
|
309607
309501
|
if (rotationAdjustment === null)
|
|
309608
309502
|
return pcbComponent.rotation;
|
|
309609
|
-
return
|
|
309503
|
+
return normalizeRotation2(pcbComponent.rotation + rotationAdjustment);
|
|
309610
309504
|
};
|
|
309611
309505
|
var convertCircuitJsonToPickAndPlaceRows = (circuitJson, opts = {}) => {
|
|
309612
309506
|
const rows = [];
|
package/dist/lib/index.js
CHANGED
|
@@ -65757,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65757
65757
|
}));
|
|
65758
65758
|
};
|
|
65759
65759
|
// package.json
|
|
65760
|
-
var version = "0.1.
|
|
65760
|
+
var version = "0.1.1880";
|
|
65761
65761
|
var package_default = {
|
|
65762
65762
|
name: "@tscircuit/cli",
|
|
65763
65763
|
version,
|
|
@@ -65769,7 +65769,7 @@ var package_default = {
|
|
|
65769
65769
|
devDependencies: {
|
|
65770
65770
|
"@babel/standalone": "^7.26.9",
|
|
65771
65771
|
"@biomejs/biome": "^1.9.4",
|
|
65772
|
-
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.
|
|
65772
|
+
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.19.tgz",
|
|
65773
65773
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
65774
65774
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.6",
|
|
65775
65775
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#bb0b41d80c9714695b498e182c2a558f1e0ceb2d",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1882",
|
|
4
4
|
"main": "dist/cli/main.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/cli/main.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@babel/standalone": "^7.26.9",
|
|
11
11
|
"@biomejs/biome": "^1.9.4",
|
|
12
|
-
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.
|
|
12
|
+
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.19.tgz",
|
|
13
13
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
14
14
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.6",
|
|
15
15
|
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#bb0b41d80c9714695b498e182c2a558f1e0ceb2d",
|