@tscircuit/cli 0.1.1319 → 0.1.1321
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 +350 -15
- package/dist/lib/index.js +2 -2
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -100574,7 +100574,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
100574
100574
|
// lib/getVersion.ts
|
|
100575
100575
|
import { createRequire as createRequire2 } from "node:module";
|
|
100576
100576
|
// package.json
|
|
100577
|
-
var version = "0.1.
|
|
100577
|
+
var version = "0.1.1320";
|
|
100578
100578
|
var package_default = {
|
|
100579
100579
|
name: "@tscircuit/cli",
|
|
100580
100580
|
version,
|
|
@@ -100588,7 +100588,7 @@ var package_default = {
|
|
|
100588
100588
|
"@biomejs/biome": "^1.9.4",
|
|
100589
100589
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
100590
100590
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.1",
|
|
100591
|
-
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#
|
|
100591
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#a8b1e6a5357f8a5aea4881f84ffda7c76d5cfe8e",
|
|
100592
100592
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
100593
100593
|
"@tscircuit/file-server": "^0.0.32",
|
|
100594
100594
|
"@tscircuit/image-utils": "^0.0.3",
|
|
@@ -241231,10 +241231,10 @@ var registerCheckRouting = (program2) => {
|
|
|
241231
241231
|
});
|
|
241232
241232
|
};
|
|
241233
241233
|
|
|
241234
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyze-schematic-placement.ts
|
|
241234
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/analyze-schematic-placement.ts
|
|
241235
241235
|
import { cju as cju7 } from "@tscircuit/circuit-json-util";
|
|
241236
241236
|
|
|
241237
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/capacitor-orientation.ts
|
|
241237
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/capacitor-orientation.ts
|
|
241238
241238
|
var HORIZONTAL_CAPACITOR_SYMBOL_NAMES = new Set([
|
|
241239
241239
|
"capacitor_left",
|
|
241240
241240
|
"capacitor_right"
|
|
@@ -241260,8 +241260,314 @@ var generateCapacitorOrientationIssues = (componentPlacements, circuitJson) => {
|
|
|
241260
241260
|
});
|
|
241261
241261
|
};
|
|
241262
241262
|
|
|
241263
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/schematic-box-
|
|
241263
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/schematic-box-sizing/shared.ts
|
|
241264
|
+
var SCHEMATIC_BOX_TOO_WIDE_MESSAGE = "Shrink schematic box width";
|
|
241265
|
+
var SCHEMATIC_PIN_PADDING_TO_EDGE_TOO_LARGE_MESSAGE = "Move schematic pins closer to the box edge or change the schematic box";
|
|
241266
|
+
var PIN_HEADER_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP = 0.1;
|
|
241267
|
+
var CHIP_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP = 1;
|
|
241268
|
+
var PIN_LABEL_EDGE_PADDING = 0.1;
|
|
241269
|
+
var PIN_NAME_CHARACTER_WIDTH = 0.095;
|
|
241270
|
+
var FALLBACK_CHARACTER_WIDTH = 0.13;
|
|
241271
|
+
var GAP_COMPARISON_EPSILON = 0.000000001;
|
|
241272
|
+
var isSchematicPort = (element) => element.type === "schematic_port";
|
|
241273
|
+
var isSourcePort = (element) => element.type === "source_port";
|
|
241274
|
+
var isSchematicComponent2 = (element) => element.type === "schematic_component";
|
|
241275
|
+
var getSourceComponentWithFtype = (element) => {
|
|
241276
|
+
if (element.type !== "source_component" || !("source_component_id" in element) || typeof element.source_component_id !== "string") {
|
|
241277
|
+
return null;
|
|
241278
|
+
}
|
|
241279
|
+
return {
|
|
241280
|
+
type: "source_component",
|
|
241281
|
+
source_component_id: element.source_component_id,
|
|
241282
|
+
ftype: "ftype" in element && typeof element.ftype === "string" ? element.ftype : undefined
|
|
241283
|
+
};
|
|
241284
|
+
};
|
|
241285
|
+
var isHorizontalSide = (side) => side === "left" || side === "right";
|
|
241286
|
+
var isVerticalSide = (side) => side === "top" || side === "bottom";
|
|
241264
241287
|
var getCenteredRectBounds = (box2) => {
|
|
241288
|
+
const halfWidth = box2.width / 2;
|
|
241289
|
+
const halfHeight = box2.height / 2;
|
|
241290
|
+
return {
|
|
241291
|
+
left: box2.schX - halfWidth,
|
|
241292
|
+
right: box2.schX + halfWidth,
|
|
241293
|
+
top: box2.schY + halfHeight,
|
|
241294
|
+
bottom: box2.schY - halfHeight
|
|
241295
|
+
};
|
|
241296
|
+
};
|
|
241297
|
+
var isPinNameLabel = (label, sourcePort) => {
|
|
241298
|
+
if (!sourcePort)
|
|
241299
|
+
return false;
|
|
241300
|
+
return label === sourcePort.name || label === String(sourcePort.pin_number) || (sourcePort.port_hints ?? []).includes(label);
|
|
241301
|
+
};
|
|
241302
|
+
var estimateLabelWidth = (label, sourcePort) => {
|
|
241303
|
+
const characterWidth = isPinNameLabel(label, sourcePort) ? PIN_NAME_CHARACTER_WIDTH : FALLBACK_CHARACTER_WIDTH;
|
|
241304
|
+
return Array.from(label).length * characterWidth;
|
|
241305
|
+
};
|
|
241306
|
+
var exceedsMaxAllowedGap = (measuredInnerLabelEmptySpace, maxAllowedInnerLabelEmptySpace) => measuredInnerLabelEmptySpace - maxAllowedInnerLabelEmptySpace > GAP_COMPARISON_EPSILON;
|
|
241307
|
+
var getSourcePortById = (circuitJson) => new Map(circuitJson.filter(isSourcePort).map((sourcePort) => [sourcePort.source_port_id, sourcePort]));
|
|
241308
|
+
var getSourceComponentById = (circuitJson) => new Map(circuitJson.flatMap((element) => {
|
|
241309
|
+
const sourceComponent = getSourceComponentWithFtype(element);
|
|
241310
|
+
return sourceComponent ? [sourceComponent] : [];
|
|
241311
|
+
}).map((sourceComponent) => [
|
|
241312
|
+
sourceComponent.source_component_id,
|
|
241313
|
+
sourceComponent
|
|
241314
|
+
]));
|
|
241315
|
+
var getSchematicComponentById = (circuitJson) => new Map(circuitJson.filter(isSchematicComponent2).map((schematicComponent) => [
|
|
241316
|
+
schematicComponent.schematic_component_id,
|
|
241317
|
+
schematicComponent
|
|
241318
|
+
]));
|
|
241319
|
+
var getPlacementBySchematicComponentId = (componentPlacements) => new Map(componentPlacements.filter((placement) => placement.schematicComponentId).map((placement) => [placement.schematicComponentId, placement]));
|
|
241320
|
+
var getPortsBySchematicComponentId = (circuitJson, isRelevantSide) => {
|
|
241321
|
+
const portsBySchematicComponentId = new Map;
|
|
241322
|
+
for (const port of circuitJson.filter(isSchematicPort)) {
|
|
241323
|
+
if (!port.schematic_component_id)
|
|
241324
|
+
continue;
|
|
241325
|
+
if (!isRelevantSide(port.side_of_component))
|
|
241326
|
+
continue;
|
|
241327
|
+
const ports = portsBySchematicComponentId.get(port.schematic_component_id);
|
|
241328
|
+
if (ports) {
|
|
241329
|
+
ports.push(port);
|
|
241330
|
+
} else {
|
|
241331
|
+
portsBySchematicComponentId.set(port.schematic_component_id, [port]);
|
|
241332
|
+
}
|
|
241333
|
+
}
|
|
241334
|
+
return portsBySchematicComponentId;
|
|
241335
|
+
};
|
|
241336
|
+
var getSourceComponentFtype = (schematicBox, sourceComponentById) => schematicBox.sourceComponentId ? sourceComponentById.get(schematicBox.sourceComponentId)?.ftype : undefined;
|
|
241337
|
+
|
|
241338
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/schematic-box-sizing/pin-padding-to-edge.ts
|
|
241339
|
+
var isSchematicSide = (side) => isHorizontalSide(side) || isVerticalSide(side);
|
|
241340
|
+
var getPinSpacing = (schematicBox, schematicComponentById) => {
|
|
241341
|
+
if (!schematicBox.schematicComponentId)
|
|
241342
|
+
return null;
|
|
241343
|
+
const schematicComponent = schematicComponentById.get(schematicBox.schematicComponentId);
|
|
241344
|
+
return typeof schematicComponent?.pin_spacing === "number" ? schematicComponent.pin_spacing : null;
|
|
241345
|
+
};
|
|
241346
|
+
var getPinName = (port, sourcePortById) => {
|
|
241347
|
+
const sourcePort = sourcePortById.get(port.source_port_id);
|
|
241348
|
+
if (sourcePort?.name)
|
|
241349
|
+
return sourcePort.name;
|
|
241350
|
+
if (port.display_pin_label)
|
|
241351
|
+
return port.display_pin_label;
|
|
241352
|
+
if (sourcePort?.pin_number !== undefined)
|
|
241353
|
+
return String(sourcePort.pin_number);
|
|
241354
|
+
return;
|
|
241355
|
+
};
|
|
241356
|
+
var getMaxLabelLengthBySide = (ports, sourcePortById) => {
|
|
241357
|
+
const maxLabelLengthBySide = {
|
|
241358
|
+
left: 0,
|
|
241359
|
+
right: 0,
|
|
241360
|
+
top: 0,
|
|
241361
|
+
bottom: 0
|
|
241362
|
+
};
|
|
241363
|
+
for (const port of ports) {
|
|
241364
|
+
if (!isSchematicSide(port.side_of_component))
|
|
241365
|
+
continue;
|
|
241366
|
+
if (!port.display_pin_label)
|
|
241367
|
+
continue;
|
|
241368
|
+
maxLabelLengthBySide[port.side_of_component] = Math.max(maxLabelLengthBySide[port.side_of_component], estimateLabelWidth(port.display_pin_label, sourcePortById.get(port.source_port_id)));
|
|
241369
|
+
}
|
|
241370
|
+
return maxLabelLengthBySide;
|
|
241371
|
+
};
|
|
241372
|
+
var getOuterPinBySide = (edgeSide, ports) => {
|
|
241373
|
+
if (ports.length === 0)
|
|
241374
|
+
return null;
|
|
241375
|
+
switch (edgeSide) {
|
|
241376
|
+
case "top":
|
|
241377
|
+
return ports.reduce((topPort, port) => port.center.y > topPort.center.y ? port : topPort);
|
|
241378
|
+
case "bottom":
|
|
241379
|
+
return ports.reduce((bottomPort, port) => port.center.y < bottomPort.center.y ? port : bottomPort);
|
|
241380
|
+
case "left":
|
|
241381
|
+
return ports.reduce((leftPort, port) => port.center.x < leftPort.center.x ? port : leftPort);
|
|
241382
|
+
case "right":
|
|
241383
|
+
return ports.reduce((rightPort, port) => port.center.x > rightPort.center.x ? port : rightPort);
|
|
241384
|
+
}
|
|
241385
|
+
};
|
|
241386
|
+
var getPinPaddingToEdge = (input) => {
|
|
241387
|
+
const bounds = getCenteredRectBounds(input.schematicBox);
|
|
241388
|
+
switch (input.edgeSide) {
|
|
241389
|
+
case "top":
|
|
241390
|
+
return Math.max(0, bounds.top - input.port.center.y);
|
|
241391
|
+
case "bottom":
|
|
241392
|
+
return Math.max(0, input.port.center.y - bounds.bottom);
|
|
241393
|
+
case "left":
|
|
241394
|
+
return Math.max(0, input.port.center.x - bounds.left);
|
|
241395
|
+
case "right":
|
|
241396
|
+
return Math.max(0, bounds.right - input.port.center.x);
|
|
241397
|
+
}
|
|
241398
|
+
};
|
|
241399
|
+
var getBoxEdgeSidesForPinSide = (pinSide) => isHorizontalSide(pinSide) ? ["top", "bottom"] : ["left", "right"];
|
|
241400
|
+
var hasPinsOnAllSides = (portsBySide) => portsBySide.has("left") && portsBySide.has("right") && portsBySide.has("top") && portsBySide.has("bottom");
|
|
241401
|
+
var getMaxAllowedPinPadding = (input) => {
|
|
241402
|
+
const edgeAxisSides = isHorizontalSide(input.edgeSide) ? ["left", "right"] : ["top", "bottom"];
|
|
241403
|
+
return (input.maxLabelLengthBySide[edgeAxisSides[0]] + input.maxLabelLengthBySide[edgeAxisSides[1]] + input.spacing) / 2;
|
|
241404
|
+
};
|
|
241405
|
+
var createPinPaddingToEdgeIssue = (candidate) => ({
|
|
241406
|
+
lineItemType: "SchematicPinPaddingToEdgeTooLarge",
|
|
241407
|
+
pinSide: candidate.pinSide,
|
|
241408
|
+
edgeSide: candidate.edgeSide,
|
|
241409
|
+
pinName: candidate.pinName,
|
|
241410
|
+
schematicBox: candidate.schematicBox,
|
|
241411
|
+
measuredPadding: candidate.measuredPadding,
|
|
241412
|
+
maxAllowedPadding: candidate.maxAllowedPadding,
|
|
241413
|
+
message: isHorizontalSide(candidate.pinSide) ? `${SCHEMATIC_PIN_PADDING_TO_EDGE_TOO_LARGE_MESSAGE} height` : `${SCHEMATIC_PIN_PADDING_TO_EDGE_TOO_LARGE_MESSAGE} width`
|
|
241414
|
+
});
|
|
241415
|
+
var generateSchematicPinPaddingToEdgeCandidates = (componentPlacements, circuitJson) => {
|
|
241416
|
+
const placementBySchematicComponentId = getPlacementBySchematicComponentId(componentPlacements);
|
|
241417
|
+
const schematicComponentById = getSchematicComponentById(circuitJson);
|
|
241418
|
+
const sourcePortById = getSourcePortById(circuitJson);
|
|
241419
|
+
const portsBySchematicComponentId = getPortsBySchematicComponentId(circuitJson, isSchematicSide);
|
|
241420
|
+
const candidates = [];
|
|
241421
|
+
for (const [schematicComponentId, ports] of portsBySchematicComponentId) {
|
|
241422
|
+
const schematicBox = placementBySchematicComponentId.get(schematicComponentId);
|
|
241423
|
+
if (!schematicBox)
|
|
241424
|
+
continue;
|
|
241425
|
+
const pinSpacing = getPinSpacing(schematicBox, schematicComponentById);
|
|
241426
|
+
if (pinSpacing === null)
|
|
241427
|
+
continue;
|
|
241428
|
+
const maxLabelLengthBySide = getMaxLabelLengthBySide(ports, sourcePortById);
|
|
241429
|
+
const portsBySide = new Map;
|
|
241430
|
+
for (const port of ports) {
|
|
241431
|
+
if (!isSchematicSide(port.side_of_component))
|
|
241432
|
+
continue;
|
|
241433
|
+
const sidePorts = portsBySide.get(port.side_of_component) ?? [];
|
|
241434
|
+
sidePorts.push(port);
|
|
241435
|
+
portsBySide.set(port.side_of_component, sidePorts);
|
|
241436
|
+
}
|
|
241437
|
+
const useLabelAwareMaxPadding = hasPinsOnAllSides(portsBySide);
|
|
241438
|
+
for (const [pinSide, sidePorts] of portsBySide) {
|
|
241439
|
+
for (const edgeSide of getBoxEdgeSidesForPinSide(pinSide)) {
|
|
241440
|
+
const outerPin = getOuterPinBySide(edgeSide, sidePorts);
|
|
241441
|
+
if (!outerPin)
|
|
241442
|
+
continue;
|
|
241443
|
+
const measuredPinPadding = {
|
|
241444
|
+
pinName: getPinName(outerPin, sourcePortById),
|
|
241445
|
+
measuredPadding: getPinPaddingToEdge({
|
|
241446
|
+
schematicBox,
|
|
241447
|
+
port: outerPin,
|
|
241448
|
+
edgeSide
|
|
241449
|
+
})
|
|
241450
|
+
};
|
|
241451
|
+
candidates.push({
|
|
241452
|
+
schematicBox,
|
|
241453
|
+
pinSide,
|
|
241454
|
+
edgeSide,
|
|
241455
|
+
pinName: measuredPinPadding.pinName,
|
|
241456
|
+
measuredPadding: measuredPinPadding.measuredPadding,
|
|
241457
|
+
maxAllowedPadding: useLabelAwareMaxPadding ? getMaxAllowedPinPadding({
|
|
241458
|
+
spacing: pinSpacing,
|
|
241459
|
+
edgeSide,
|
|
241460
|
+
maxLabelLengthBySide
|
|
241461
|
+
}) : pinSpacing
|
|
241462
|
+
});
|
|
241463
|
+
}
|
|
241464
|
+
}
|
|
241465
|
+
}
|
|
241466
|
+
return candidates;
|
|
241467
|
+
};
|
|
241468
|
+
var getSchematicPinPaddingToEdgeTooLargeIssues = (candidates) => candidates.filter((candidate) => exceedsMaxAllowedGap(candidate.measuredPadding, candidate.maxAllowedPadding)).map(createPinPaddingToEdgeIssue);
|
|
241469
|
+
var generateSchematicPinPaddingToEdgeTooLargeIssues = (componentPlacements, circuitJson) => getSchematicPinPaddingToEdgeTooLargeIssues(generateSchematicPinPaddingToEdgeCandidates(componentPlacements, circuitJson));
|
|
241470
|
+
|
|
241471
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/schematic-box-sizing/too-wide.ts
|
|
241472
|
+
var getLabelColumn = (side, ports, sourcePortById) => {
|
|
241473
|
+
const labelWidths = ports.filter((port) => port.side_of_component === side).flatMap((port) => port.display_pin_label ? [
|
|
241474
|
+
estimateLabelWidth(port.display_pin_label, sourcePortById.get(port.source_port_id))
|
|
241475
|
+
] : []);
|
|
241476
|
+
if (labelWidths.length === 0)
|
|
241477
|
+
return null;
|
|
241478
|
+
return {
|
|
241479
|
+
side,
|
|
241480
|
+
labelCount: labelWidths.length,
|
|
241481
|
+
maxLabelWidth: Math.max(...labelWidths)
|
|
241482
|
+
};
|
|
241483
|
+
};
|
|
241484
|
+
var getInnerLabelEdge = (bounds, labelColumn) => {
|
|
241485
|
+
if (labelColumn.side === "left") {
|
|
241486
|
+
return bounds.left + PIN_LABEL_EDGE_PADDING + labelColumn.maxLabelWidth;
|
|
241487
|
+
}
|
|
241488
|
+
return bounds.right - PIN_LABEL_EDGE_PADDING - labelColumn.maxLabelWidth;
|
|
241489
|
+
};
|
|
241490
|
+
var getSuggestedWidth = (input) => input.currentWidth - input.measuredInnerLabelHorizontalEmptySpace + input.maxAllowedInnerLabelHorizontalEmptySpace;
|
|
241491
|
+
var createPinHeaderIssue = (input) => ({
|
|
241492
|
+
lineItemType: "SchematicBoxTooWideForPinHeader",
|
|
241493
|
+
schematicBox: input.schematicBox,
|
|
241494
|
+
measuredInnerLabelHorizontalEmptySpace: input.measuredInnerLabelHorizontalEmptySpace,
|
|
241495
|
+
maxAllowedInnerLabelHorizontalEmptySpace: PIN_HEADER_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP,
|
|
241496
|
+
suggestedSchWidth: input.suggestedSchWidth,
|
|
241497
|
+
message: SCHEMATIC_BOX_TOO_WIDE_MESSAGE
|
|
241498
|
+
});
|
|
241499
|
+
var createChipIssue = (input) => ({
|
|
241500
|
+
lineItemType: "SchematicBoxTooWideForChip",
|
|
241501
|
+
schematicBox: input.schematicBox,
|
|
241502
|
+
measuredInnerLabelHorizontalEmptySpace: input.measuredInnerLabelHorizontalEmptySpace,
|
|
241503
|
+
maxAllowedInnerLabelHorizontalEmptySpace: CHIP_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP,
|
|
241504
|
+
suggestedSchWidth: input.suggestedSchWidth,
|
|
241505
|
+
message: SCHEMATIC_BOX_TOO_WIDE_MESSAGE
|
|
241506
|
+
});
|
|
241507
|
+
var generateSchematicBoxWidthSizingCandidates = (componentPlacements, circuitJson) => {
|
|
241508
|
+
const placementBySchematicComponentId = getPlacementBySchematicComponentId(componentPlacements);
|
|
241509
|
+
const sourcePortById = getSourcePortById(circuitJson);
|
|
241510
|
+
const sourceComponentById = getSourceComponentById(circuitJson);
|
|
241511
|
+
const portsBySchematicComponentId = getPortsBySchematicComponentId(circuitJson, isHorizontalSide);
|
|
241512
|
+
const candidates = [];
|
|
241513
|
+
for (const [schematicComponentId, ports] of portsBySchematicComponentId) {
|
|
241514
|
+
const schematicBox = placementBySchematicComponentId.get(schematicComponentId);
|
|
241515
|
+
if (!schematicBox)
|
|
241516
|
+
continue;
|
|
241517
|
+
const bounds = getCenteredRectBounds(schematicBox);
|
|
241518
|
+
const leftLabelColumn = getLabelColumn("left", ports, sourcePortById);
|
|
241519
|
+
const rightLabelColumn = getLabelColumn("right", ports, sourcePortById);
|
|
241520
|
+
const sourceComponentFtype = getSourceComponentFtype(schematicBox, sourceComponentById);
|
|
241521
|
+
if (leftLabelColumn && rightLabelColumn) {
|
|
241522
|
+
const measuredInnerLabelHorizontalEmptySpace = getInnerLabelEdge(bounds, rightLabelColumn) - getInnerLabelEdge(bounds, leftLabelColumn);
|
|
241523
|
+
candidates.push({
|
|
241524
|
+
schematicBox,
|
|
241525
|
+
sourceComponentFtype,
|
|
241526
|
+
measuredInnerLabelHorizontalEmptySpace
|
|
241527
|
+
});
|
|
241528
|
+
continue;
|
|
241529
|
+
}
|
|
241530
|
+
if (leftLabelColumn && leftLabelColumn.labelCount >= 4) {
|
|
241531
|
+
const measuredInnerLabelHorizontalEmptySpace = bounds.right - getInnerLabelEdge(bounds, leftLabelColumn);
|
|
241532
|
+
candidates.push({
|
|
241533
|
+
schematicBox,
|
|
241534
|
+
sourceComponentFtype,
|
|
241535
|
+
measuredInnerLabelHorizontalEmptySpace
|
|
241536
|
+
});
|
|
241537
|
+
}
|
|
241538
|
+
if (rightLabelColumn && rightLabelColumn.labelCount >= 4) {
|
|
241539
|
+
const measuredInnerLabelHorizontalEmptySpace = getInnerLabelEdge(bounds, rightLabelColumn) - bounds.left;
|
|
241540
|
+
candidates.push({
|
|
241541
|
+
schematicBox,
|
|
241542
|
+
sourceComponentFtype,
|
|
241543
|
+
measuredInnerLabelHorizontalEmptySpace
|
|
241544
|
+
});
|
|
241545
|
+
}
|
|
241546
|
+
}
|
|
241547
|
+
return candidates;
|
|
241548
|
+
};
|
|
241549
|
+
var getSchematicBoxTooWideForPinHeaderIssues = (candidates) => candidates.filter((candidate) => candidate.sourceComponentFtype === "simple_pin_header").filter((candidate) => exceedsMaxAllowedGap(candidate.measuredInnerLabelHorizontalEmptySpace, PIN_HEADER_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP)).map((candidate) => createPinHeaderIssue({
|
|
241550
|
+
schematicBox: candidate.schematicBox,
|
|
241551
|
+
measuredInnerLabelHorizontalEmptySpace: candidate.measuredInnerLabelHorizontalEmptySpace,
|
|
241552
|
+
suggestedSchWidth: getSuggestedWidth({
|
|
241553
|
+
measuredInnerLabelHorizontalEmptySpace: candidate.measuredInnerLabelHorizontalEmptySpace,
|
|
241554
|
+
maxAllowedInnerLabelHorizontalEmptySpace: PIN_HEADER_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP,
|
|
241555
|
+
currentWidth: candidate.schematicBox.width
|
|
241556
|
+
})
|
|
241557
|
+
}));
|
|
241558
|
+
var getSchematicBoxTooWideForChipIssues = (candidates) => candidates.filter((candidate) => candidate.sourceComponentFtype === "simple_chip").filter((candidate) => exceedsMaxAllowedGap(candidate.measuredInnerLabelHorizontalEmptySpace, CHIP_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP)).map((candidate) => createChipIssue({
|
|
241559
|
+
schematicBox: candidate.schematicBox,
|
|
241560
|
+
measuredInnerLabelHorizontalEmptySpace: candidate.measuredInnerLabelHorizontalEmptySpace,
|
|
241561
|
+
suggestedSchWidth: getSuggestedWidth({
|
|
241562
|
+
measuredInnerLabelHorizontalEmptySpace: candidate.measuredInnerLabelHorizontalEmptySpace,
|
|
241563
|
+
maxAllowedInnerLabelHorizontalEmptySpace: CHIP_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP,
|
|
241564
|
+
currentWidth: candidate.schematicBox.width
|
|
241565
|
+
})
|
|
241566
|
+
}));
|
|
241567
|
+
var generateSchematicBoxTooWideForPinHeaderIssues = (componentPlacements, circuitJson) => getSchematicBoxTooWideForPinHeaderIssues(generateSchematicBoxWidthSizingCandidates(componentPlacements, circuitJson));
|
|
241568
|
+
var generateSchematicBoxTooWideForChipIssues = (componentPlacements, circuitJson) => getSchematicBoxTooWideForChipIssues(generateSchematicBoxWidthSizingCandidates(componentPlacements, circuitJson));
|
|
241569
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/schematic-box-overlap.ts
|
|
241570
|
+
var getCenteredRectBounds2 = (box2) => {
|
|
241265
241571
|
const halfWidth = box2.width / 2;
|
|
241266
241572
|
const halfHeight = box2.height / 2;
|
|
241267
241573
|
return {
|
|
@@ -241272,8 +241578,8 @@ var getCenteredRectBounds = (box2) => {
|
|
|
241272
241578
|
};
|
|
241273
241579
|
};
|
|
241274
241580
|
var getComponentOverlap = (firstComponent, secondComponent) => {
|
|
241275
|
-
const firstBounds =
|
|
241276
|
-
const secondBounds =
|
|
241581
|
+
const firstBounds = getCenteredRectBounds2(firstComponent);
|
|
241582
|
+
const secondBounds = getCenteredRectBounds2(secondComponent);
|
|
241277
241583
|
const left = Math.max(firstBounds.left, secondBounds.left);
|
|
241278
241584
|
const right = Math.min(firstBounds.right, secondBounds.right);
|
|
241279
241585
|
const top = Math.max(firstBounds.top, secondBounds.top);
|
|
@@ -241339,10 +241645,10 @@ var generateSchematicPlacementIssues = (componentPlacements) => {
|
|
|
241339
241645
|
return issues;
|
|
241340
241646
|
};
|
|
241341
241647
|
|
|
241342
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/verbose-net-label.ts
|
|
241648
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/verbose-net-label.ts
|
|
241343
241649
|
var VERBOSE_NET_LABEL_MESSAGE = "Create trace with schDisplayLabel";
|
|
241344
241650
|
var isSchematicNetLabel = (element) => element.type === "schematic_net_label";
|
|
241345
|
-
var
|
|
241651
|
+
var isSourcePort2 = (element) => element.type === "source_port";
|
|
241346
241652
|
var getSourceComponentWithName = (element) => {
|
|
241347
241653
|
if (element.type !== "source_component" || !("source_component_id" in element) || !("name" in element) || typeof element.source_component_id !== "string" || typeof element.name !== "string") {
|
|
241348
241654
|
return null;
|
|
@@ -241369,7 +241675,7 @@ var getLabelTokenToInvolvedPinMap = (circuitJson) => {
|
|
|
241369
241675
|
sourceComponent
|
|
241370
241676
|
]));
|
|
241371
241677
|
const tokenToInvolvedPin = new Map;
|
|
241372
|
-
for (const sourcePort of circuitJson.filter(
|
|
241678
|
+
for (const sourcePort of circuitJson.filter(isSourcePort2)) {
|
|
241373
241679
|
if (!sourcePort.source_component_id)
|
|
241374
241680
|
continue;
|
|
241375
241681
|
const sourceComponent = sourceComponentById.get(sourcePort.source_component_id);
|
|
@@ -241413,7 +241719,7 @@ var generateVerboseNetLabelIssues = (circuitJson) => {
|
|
|
241413
241719
|
return Array.from(issuesByText.values());
|
|
241414
241720
|
};
|
|
241415
241721
|
|
|
241416
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyze-schematic-placement.ts
|
|
241722
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/analyze-schematic-placement.ts
|
|
241417
241723
|
var fmtNumber5 = (value) => {
|
|
241418
241724
|
if (Number.isInteger(value))
|
|
241419
241725
|
return String(value);
|
|
@@ -241424,7 +241730,7 @@ var fmtDelta = (value) => {
|
|
|
241424
241730
|
return value > 0 ? `+${formattedValue}` : formattedValue;
|
|
241425
241731
|
};
|
|
241426
241732
|
var isSchematicBox = (element) => element.type === "schematic_box";
|
|
241427
|
-
var
|
|
241733
|
+
var isSchematicComponent3 = (element) => element.type === "schematic_component";
|
|
241428
241734
|
var getSourceComponentName = (circuitJson, sourceComponentId) => {
|
|
241429
241735
|
if (!sourceComponentId)
|
|
241430
241736
|
return;
|
|
@@ -241519,6 +241825,27 @@ var verboseSchematicNetLabelIssueToString = (issue) => {
|
|
|
241519
241825
|
addAttr(attrs, "schY", issue.schY);
|
|
241520
241826
|
return `<VerboseSchematicNetLabel ${attrs.join(" ")} />`;
|
|
241521
241827
|
};
|
|
241828
|
+
var schematicBoxTooWideIssueToString = (issue) => {
|
|
241829
|
+
const attrs = [];
|
|
241830
|
+
addAttr(attrs, "message", issue.message, { escape: false });
|
|
241831
|
+
addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
|
|
241832
|
+
addAttr(attrs, "currentSchWidth", issue.schematicBox.width);
|
|
241833
|
+
addAttr(attrs, "measuredInnerLabelHorizontalEmptySpace", issue.measuredInnerLabelHorizontalEmptySpace);
|
|
241834
|
+
addAttr(attrs, "maxAllowedInnerLabelHorizontalEmptySpace", issue.maxAllowedInnerLabelHorizontalEmptySpace);
|
|
241835
|
+
addAttr(attrs, "suggestedSchWidth", issue.suggestedSchWidth);
|
|
241836
|
+
return `<${issue.lineItemType} ${attrs.join(" ")} />`;
|
|
241837
|
+
};
|
|
241838
|
+
var schematicPinPaddingToEdgeTooLargeIssueToString = (issue) => {
|
|
241839
|
+
const attrs = [];
|
|
241840
|
+
addAttr(attrs, "message", issue.message, { escape: false });
|
|
241841
|
+
addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
|
|
241842
|
+
addAttr(attrs, "pinSide", issue.pinSide);
|
|
241843
|
+
addAttr(attrs, "edgeSide", issue.edgeSide);
|
|
241844
|
+
addAttr(attrs, "pinName", issue.pinName);
|
|
241845
|
+
addAttr(attrs, "measuredPadding", issue.measuredPadding);
|
|
241846
|
+
addAttr(attrs, "maxAllowedPadding", issue.maxAllowedPadding);
|
|
241847
|
+
return `<SchematicPinPaddingToEdgeTooLarge ${attrs.join(" ")} />`;
|
|
241848
|
+
};
|
|
241522
241849
|
var correctionSuggestionToString = (suggestion) => {
|
|
241523
241850
|
const attrs = [];
|
|
241524
241851
|
addAttr(attrs, "target", suggestion.targetComponentName);
|
|
@@ -241562,6 +241889,11 @@ class SchematicPlacementAnalysis {
|
|
|
241562
241889
|
return capacitorSymbolHorizontalIssueToString(issue);
|
|
241563
241890
|
case "VerboseSchematicNetLabel":
|
|
241564
241891
|
return verboseSchematicNetLabelIssueToString(issue);
|
|
241892
|
+
case "SchematicBoxTooWideForPinHeader":
|
|
241893
|
+
case "SchematicBoxTooWideForChip":
|
|
241894
|
+
return schematicBoxTooWideIssueToString(issue);
|
|
241895
|
+
case "SchematicPinPaddingToEdgeTooLarge":
|
|
241896
|
+
return schematicPinPaddingToEdgeTooLargeIssueToString(issue);
|
|
241565
241897
|
default:
|
|
241566
241898
|
return "";
|
|
241567
241899
|
}
|
|
@@ -241574,15 +241906,18 @@ class SchematicPlacementAnalysis {
|
|
|
241574
241906
|
}
|
|
241575
241907
|
var analyzeSchematicPlacement = (circuitJson) => {
|
|
241576
241908
|
const schematicBoxes = circuitJson.filter(isSchematicBox);
|
|
241577
|
-
const schematicComponentIds = new Set(circuitJson.filter(
|
|
241909
|
+
const schematicComponentIds = new Set(circuitJson.filter(isSchematicComponent3).map((schematicComponent) => schematicComponent.schematic_component_id));
|
|
241578
241910
|
const lineItems = [
|
|
241579
|
-
...circuitJson.filter(
|
|
241911
|
+
...circuitJson.filter(isSchematicComponent3).map((schematicComponent) => schematicComponentToLineItem(schematicComponent, circuitJson, schematicBoxes.find((schematicBox) => schematicBox.schematic_component_id === schematicComponent.schematic_component_id))),
|
|
241580
241912
|
...schematicBoxes.filter((schematicBox) => !schematicBox.schematic_component_id || !schematicComponentIds.has(schematicBox.schematic_component_id)).map((schematicBox) => schematicBoxToLineItem(schematicBox, circuitJson))
|
|
241581
241913
|
];
|
|
241582
241914
|
const issues = [
|
|
241583
241915
|
...generateSchematicPlacementIssues(lineItems),
|
|
241584
241916
|
...generateCapacitorOrientationIssues(lineItems, circuitJson),
|
|
241585
|
-
...generateVerboseNetLabelIssues(circuitJson)
|
|
241917
|
+
...generateVerboseNetLabelIssues(circuitJson),
|
|
241918
|
+
...generateSchematicBoxTooWideForPinHeaderIssues(lineItems, circuitJson),
|
|
241919
|
+
...generateSchematicBoxTooWideForChipIssues(lineItems, circuitJson),
|
|
241920
|
+
...generateSchematicPinPaddingToEdgeTooLargeIssues(lineItems, circuitJson)
|
|
241586
241921
|
];
|
|
241587
241922
|
return new SchematicPlacementAnalysis([
|
|
241588
241923
|
...lineItems,
|
package/dist/lib/index.js
CHANGED
|
@@ -65661,7 +65661,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65661
65661
|
}));
|
|
65662
65662
|
};
|
|
65663
65663
|
// package.json
|
|
65664
|
-
var version = "0.1.
|
|
65664
|
+
var version = "0.1.1320";
|
|
65665
65665
|
var package_default = {
|
|
65666
65666
|
name: "@tscircuit/cli",
|
|
65667
65667
|
version,
|
|
@@ -65675,7 +65675,7 @@ var package_default = {
|
|
|
65675
65675
|
"@biomejs/biome": "^1.9.4",
|
|
65676
65676
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
65677
65677
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.1",
|
|
65678
|
-
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#
|
|
65678
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#a8b1e6a5357f8a5aea4881f84ffda7c76d5cfe8e",
|
|
65679
65679
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
65680
65680
|
"@tscircuit/file-server": "^0.0.32",
|
|
65681
65681
|
"@tscircuit/image-utils": "^0.0.3",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1321",
|
|
4
4
|
"main": "dist/cli/main.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/cli/main.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@biomejs/biome": "^1.9.4",
|
|
12
12
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.6",
|
|
13
13
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.1",
|
|
14
|
-
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#
|
|
14
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#a8b1e6a5357f8a5aea4881f84ffda7c76d5cfe8e",
|
|
15
15
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
16
16
|
"@tscircuit/file-server": "^0.0.32",
|
|
17
17
|
"@tscircuit/image-utils": "^0.0.3",
|