@tscircuit/cli 0.1.1320 → 0.1.1322
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 +205 -39
- 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.1321";
|
|
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",
|
|
@@ -241260,8 +241260,9 @@ var generateCapacitorOrientationIssues = (componentPlacements, circuitJson) => {
|
|
|
241260
241260
|
});
|
|
241261
241261
|
};
|
|
241262
241262
|
|
|
241263
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/schematic-box-sizing.ts
|
|
241264
|
-
var
|
|
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";
|
|
241265
241266
|
var PIN_HEADER_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP = 0.1;
|
|
241266
241267
|
var CHIP_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP = 1;
|
|
241267
241268
|
var PIN_LABEL_EDGE_PADDING = 0.1;
|
|
@@ -241270,6 +241271,7 @@ var FALLBACK_CHARACTER_WIDTH = 0.13;
|
|
|
241270
241271
|
var GAP_COMPARISON_EPSILON = 0.000000001;
|
|
241271
241272
|
var isSchematicPort = (element) => element.type === "schematic_port";
|
|
241272
241273
|
var isSourcePort = (element) => element.type === "source_port";
|
|
241274
|
+
var isSchematicComponent2 = (element) => element.type === "schematic_component";
|
|
241273
241275
|
var getSourceComponentWithFtype = (element) => {
|
|
241274
241276
|
if (element.type !== "source_component" || !("source_component_id" in element) || typeof element.source_component_id !== "string") {
|
|
241275
241277
|
return null;
|
|
@@ -241281,11 +241283,15 @@ var getSourceComponentWithFtype = (element) => {
|
|
|
241281
241283
|
};
|
|
241282
241284
|
};
|
|
241283
241285
|
var isHorizontalSide = (side) => side === "left" || side === "right";
|
|
241286
|
+
var isVerticalSide = (side) => side === "top" || side === "bottom";
|
|
241284
241287
|
var getCenteredRectBounds = (box2) => {
|
|
241285
241288
|
const halfWidth = box2.width / 2;
|
|
241289
|
+
const halfHeight = box2.height / 2;
|
|
241286
241290
|
return {
|
|
241287
241291
|
left: box2.schX - halfWidth,
|
|
241288
|
-
right: box2.schX + halfWidth
|
|
241292
|
+
right: box2.schX + halfWidth,
|
|
241293
|
+
top: box2.schY + halfHeight,
|
|
241294
|
+
bottom: box2.schY - halfHeight
|
|
241289
241295
|
};
|
|
241290
241296
|
};
|
|
241291
241297
|
var isPinNameLabel = (label, sourcePort) => {
|
|
@@ -241297,6 +241303,172 @@ var estimateLabelWidth = (label, sourcePort) => {
|
|
|
241297
241303
|
const characterWidth = isPinNameLabel(label, sourcePort) ? PIN_NAME_CHARACTER_WIDTH : FALLBACK_CHARACTER_WIDTH;
|
|
241298
241304
|
return Array.from(label).length * characterWidth;
|
|
241299
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
|
|
241300
241472
|
var getLabelColumn = (side, ports, sourcePortById) => {
|
|
241301
241473
|
const labelWidths = ports.filter((port) => port.side_of_component === side).flatMap((port) => port.display_pin_label ? [
|
|
241302
241474
|
estimateLabelWidth(port.display_pin_label, sourcePortById.get(port.source_port_id))
|
|
@@ -241316,14 +241488,13 @@ var getInnerLabelEdge = (bounds, labelColumn) => {
|
|
|
241316
241488
|
return bounds.right - PIN_LABEL_EDGE_PADDING - labelColumn.maxLabelWidth;
|
|
241317
241489
|
};
|
|
241318
241490
|
var getSuggestedWidth = (input) => input.currentWidth - input.measuredInnerLabelHorizontalEmptySpace + input.maxAllowedInnerLabelHorizontalEmptySpace;
|
|
241319
|
-
var exceedsMaxAllowedGap = (measuredInnerLabelHorizontalEmptySpace, maxAllowedInnerLabelHorizontalEmptySpace) => measuredInnerLabelHorizontalEmptySpace - maxAllowedInnerLabelHorizontalEmptySpace > GAP_COMPARISON_EPSILON;
|
|
241320
241491
|
var createPinHeaderIssue = (input) => ({
|
|
241321
241492
|
lineItemType: "SchematicBoxTooWideForPinHeader",
|
|
241322
241493
|
schematicBox: input.schematicBox,
|
|
241323
241494
|
measuredInnerLabelHorizontalEmptySpace: input.measuredInnerLabelHorizontalEmptySpace,
|
|
241324
241495
|
maxAllowedInnerLabelHorizontalEmptySpace: PIN_HEADER_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP,
|
|
241325
241496
|
suggestedSchWidth: input.suggestedSchWidth,
|
|
241326
|
-
message:
|
|
241497
|
+
message: SCHEMATIC_BOX_TOO_WIDE_MESSAGE
|
|
241327
241498
|
});
|
|
241328
241499
|
var createChipIssue = (input) => ({
|
|
241329
241500
|
lineItemType: "SchematicBoxTooWideForChip",
|
|
@@ -241331,31 +241502,13 @@ var createChipIssue = (input) => ({
|
|
|
241331
241502
|
measuredInnerLabelHorizontalEmptySpace: input.measuredInnerLabelHorizontalEmptySpace,
|
|
241332
241503
|
maxAllowedInnerLabelHorizontalEmptySpace: CHIP_SCHEMATIC_BOX_SIZING_MAX_ALLOWED_GAP,
|
|
241333
241504
|
suggestedSchWidth: input.suggestedSchWidth,
|
|
241334
|
-
message:
|
|
241505
|
+
message: SCHEMATIC_BOX_TOO_WIDE_MESSAGE
|
|
241335
241506
|
});
|
|
241336
|
-
var
|
|
241337
|
-
const placementBySchematicComponentId =
|
|
241338
|
-
const sourcePortById =
|
|
241339
|
-
const sourceComponentById =
|
|
241340
|
-
|
|
241341
|
-
return sourceComponent ? [sourceComponent] : [];
|
|
241342
|
-
}).map((sourceComponent) => [
|
|
241343
|
-
sourceComponent.source_component_id,
|
|
241344
|
-
sourceComponent
|
|
241345
|
-
]));
|
|
241346
|
-
const portsBySchematicComponentId = new Map;
|
|
241347
|
-
for (const port of circuitJson.filter(isSchematicPort)) {
|
|
241348
|
-
if (!port.schematic_component_id)
|
|
241349
|
-
continue;
|
|
241350
|
-
if (!isHorizontalSide(port.side_of_component))
|
|
241351
|
-
continue;
|
|
241352
|
-
const ports = portsBySchematicComponentId.get(port.schematic_component_id);
|
|
241353
|
-
if (ports) {
|
|
241354
|
-
ports.push(port);
|
|
241355
|
-
} else {
|
|
241356
|
-
portsBySchematicComponentId.set(port.schematic_component_id, [port]);
|
|
241357
|
-
}
|
|
241358
|
-
}
|
|
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);
|
|
241359
241512
|
const candidates = [];
|
|
241360
241513
|
for (const [schematicComponentId, ports] of portsBySchematicComponentId) {
|
|
241361
241514
|
const schematicBox = placementBySchematicComponentId.get(schematicComponentId);
|
|
@@ -241364,7 +241517,7 @@ var generateSchematicBoxSizingCandidates = (componentPlacements, circuitJson) =>
|
|
|
241364
241517
|
const bounds = getCenteredRectBounds(schematicBox);
|
|
241365
241518
|
const leftLabelColumn = getLabelColumn("left", ports, sourcePortById);
|
|
241366
241519
|
const rightLabelColumn = getLabelColumn("right", ports, sourcePortById);
|
|
241367
|
-
const sourceComponentFtype = schematicBox
|
|
241520
|
+
const sourceComponentFtype = getSourceComponentFtype(schematicBox, sourceComponentById);
|
|
241368
241521
|
if (leftLabelColumn && rightLabelColumn) {
|
|
241369
241522
|
const measuredInnerLabelHorizontalEmptySpace = getInnerLabelEdge(bounds, rightLabelColumn) - getInnerLabelEdge(bounds, leftLabelColumn);
|
|
241370
241523
|
candidates.push({
|
|
@@ -241411,9 +241564,8 @@ var getSchematicBoxTooWideForChipIssues = (candidates) => candidates.filter((can
|
|
|
241411
241564
|
currentWidth: candidate.schematicBox.width
|
|
241412
241565
|
})
|
|
241413
241566
|
}));
|
|
241414
|
-
var generateSchematicBoxTooWideForPinHeaderIssues = (componentPlacements, circuitJson) => getSchematicBoxTooWideForPinHeaderIssues(
|
|
241415
|
-
var generateSchematicBoxTooWideForChipIssues = (componentPlacements, circuitJson) => getSchematicBoxTooWideForChipIssues(
|
|
241416
|
-
|
|
241567
|
+
var generateSchematicBoxTooWideForPinHeaderIssues = (componentPlacements, circuitJson) => getSchematicBoxTooWideForPinHeaderIssues(generateSchematicBoxWidthSizingCandidates(componentPlacements, circuitJson));
|
|
241568
|
+
var generateSchematicBoxTooWideForChipIssues = (componentPlacements, circuitJson) => getSchematicBoxTooWideForChipIssues(generateSchematicBoxWidthSizingCandidates(componentPlacements, circuitJson));
|
|
241417
241569
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyzers/schematic-box-overlap.ts
|
|
241418
241570
|
var getCenteredRectBounds2 = (box2) => {
|
|
241419
241571
|
const halfWidth = box2.width / 2;
|
|
@@ -241578,7 +241730,7 @@ var fmtDelta = (value) => {
|
|
|
241578
241730
|
return value > 0 ? `+${formattedValue}` : formattedValue;
|
|
241579
241731
|
};
|
|
241580
241732
|
var isSchematicBox = (element) => element.type === "schematic_box";
|
|
241581
|
-
var
|
|
241733
|
+
var isSchematicComponent3 = (element) => element.type === "schematic_component";
|
|
241582
241734
|
var getSourceComponentName = (circuitJson, sourceComponentId) => {
|
|
241583
241735
|
if (!sourceComponentId)
|
|
241584
241736
|
return;
|
|
@@ -241683,6 +241835,17 @@ var schematicBoxTooWideIssueToString = (issue) => {
|
|
|
241683
241835
|
addAttr(attrs, "suggestedSchWidth", issue.suggestedSchWidth);
|
|
241684
241836
|
return `<${issue.lineItemType} ${attrs.join(" ")} />`;
|
|
241685
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
|
+
};
|
|
241686
241849
|
var correctionSuggestionToString = (suggestion) => {
|
|
241687
241850
|
const attrs = [];
|
|
241688
241851
|
addAttr(attrs, "target", suggestion.targetComponentName);
|
|
@@ -241729,6 +241892,8 @@ class SchematicPlacementAnalysis {
|
|
|
241729
241892
|
case "SchematicBoxTooWideForPinHeader":
|
|
241730
241893
|
case "SchematicBoxTooWideForChip":
|
|
241731
241894
|
return schematicBoxTooWideIssueToString(issue);
|
|
241895
|
+
case "SchematicPinPaddingToEdgeTooLarge":
|
|
241896
|
+
return schematicPinPaddingToEdgeTooLargeIssueToString(issue);
|
|
241732
241897
|
default:
|
|
241733
241898
|
return "";
|
|
241734
241899
|
}
|
|
@@ -241741,9 +241906,9 @@ class SchematicPlacementAnalysis {
|
|
|
241741
241906
|
}
|
|
241742
241907
|
var analyzeSchematicPlacement = (circuitJson) => {
|
|
241743
241908
|
const schematicBoxes = circuitJson.filter(isSchematicBox);
|
|
241744
|
-
const schematicComponentIds = new Set(circuitJson.filter(
|
|
241909
|
+
const schematicComponentIds = new Set(circuitJson.filter(isSchematicComponent3).map((schematicComponent) => schematicComponent.schematic_component_id));
|
|
241745
241910
|
const lineItems = [
|
|
241746
|
-
...circuitJson.filter(
|
|
241911
|
+
...circuitJson.filter(isSchematicComponent3).map((schematicComponent) => schematicComponentToLineItem(schematicComponent, circuitJson, schematicBoxes.find((schematicBox) => schematicBox.schematic_component_id === schematicComponent.schematic_component_id))),
|
|
241747
241912
|
...schematicBoxes.filter((schematicBox) => !schematicBox.schematic_component_id || !schematicComponentIds.has(schematicBox.schematic_component_id)).map((schematicBox) => schematicBoxToLineItem(schematicBox, circuitJson))
|
|
241748
241913
|
];
|
|
241749
241914
|
const issues = [
|
|
@@ -241751,7 +241916,8 @@ var analyzeSchematicPlacement = (circuitJson) => {
|
|
|
241751
241916
|
...generateCapacitorOrientationIssues(lineItems, circuitJson),
|
|
241752
241917
|
...generateVerboseNetLabelIssues(circuitJson),
|
|
241753
241918
|
...generateSchematicBoxTooWideForPinHeaderIssues(lineItems, circuitJson),
|
|
241754
|
-
...generateSchematicBoxTooWideForChipIssues(lineItems, circuitJson)
|
|
241919
|
+
...generateSchematicBoxTooWideForChipIssues(lineItems, circuitJson),
|
|
241920
|
+
...generateSchematicPinPaddingToEdgeTooLargeIssues(lineItems, circuitJson)
|
|
241755
241921
|
];
|
|
241756
241922
|
return new SchematicPlacementAnalysis([
|
|
241757
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.1321";
|
|
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.1322",
|
|
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",
|