@tscircuit/core 0.0.599 → 0.0.601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +95 -48
- package/package.json +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -557,6 +557,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
557
557
|
_portsRoutedOnPcb: Port[];
|
|
558
558
|
subcircuit_connectivity_map_key: string | null;
|
|
559
559
|
_traceConnectionHash: string | null;
|
|
560
|
+
_couldNotFindPort?: boolean;
|
|
560
561
|
constructor(props: z.input<typeof traceProps>);
|
|
561
562
|
get config(): {
|
|
562
563
|
zodProps: z.ZodUnion<[z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -2493,13 +2493,17 @@ var Cutout = class extends PrimitiveComponent2 {
|
|
|
2493
2493
|
const subcircuit = this.getSubcircuit();
|
|
2494
2494
|
const pcb_group_id = this.getGroup()?.pcb_group_id ?? void 0;
|
|
2495
2495
|
const globalPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
2496
|
+
const container = this.getPrimitiveContainer();
|
|
2497
|
+
const parentRotation = container?._parsedProps.pcbRotation ?? 0;
|
|
2496
2498
|
let inserted_pcb_cutout = void 0;
|
|
2497
2499
|
if (props.shape === "rect") {
|
|
2500
|
+
const rotationDeg = typeof parentRotation === "string" ? parseInt(parentRotation.replace("deg", ""), 10) : parentRotation;
|
|
2501
|
+
const isRotated90 = Math.abs(rotationDeg % 180) === 90;
|
|
2498
2502
|
const rectData = {
|
|
2499
2503
|
shape: "rect",
|
|
2500
2504
|
center: globalPosition,
|
|
2501
|
-
width: props.width,
|
|
2502
|
-
height: props.height,
|
|
2505
|
+
width: isRotated90 ? props.height : props.width,
|
|
2506
|
+
height: isRotated90 ? props.width : props.height,
|
|
2503
2507
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
2504
2508
|
pcb_group_id
|
|
2505
2509
|
};
|
|
@@ -4998,13 +5002,45 @@ var convertFacingDirectionToElbowDirection = (facingDirection) => {
|
|
|
4998
5002
|
}
|
|
4999
5003
|
};
|
|
5000
5004
|
|
|
5005
|
+
// lib/errors/AutorouterError.ts
|
|
5006
|
+
import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
|
|
5007
|
+
var autorouterVersion = packageJson.version ?? "unknown";
|
|
5008
|
+
var AutorouterError = class extends Error {
|
|
5009
|
+
constructor(message) {
|
|
5010
|
+
super(`${message} (capacity-autorouter@${autorouterVersion})`);
|
|
5011
|
+
this.name = "AutorouterError";
|
|
5012
|
+
}
|
|
5013
|
+
};
|
|
5014
|
+
|
|
5015
|
+
// lib/errors/TraceConnectionError.ts
|
|
5016
|
+
var TraceConnectionError = class extends Error {
|
|
5017
|
+
constructor(errorData) {
|
|
5018
|
+
super(errorData.message);
|
|
5019
|
+
this.errorData = errorData;
|
|
5020
|
+
this.name = "TraceConnectionError";
|
|
5021
|
+
}
|
|
5022
|
+
};
|
|
5023
|
+
|
|
5001
5024
|
// lib/components/primitive-components/Trace/Trace_doInitialSchematicTraceRender.ts
|
|
5002
5025
|
var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
5026
|
+
if (trace._couldNotFindPort) return;
|
|
5003
5027
|
if (trace.root?.schematicDisabled) return;
|
|
5004
5028
|
const { db } = trace.root;
|
|
5005
5029
|
const { _parsedProps: props, parent } = trace;
|
|
5006
5030
|
if (!parent) throw new Error("Trace has no parent");
|
|
5007
|
-
|
|
5031
|
+
let allPortsFound;
|
|
5032
|
+
let connectedPorts;
|
|
5033
|
+
try {
|
|
5034
|
+
const result = trace._findConnectedPorts();
|
|
5035
|
+
allPortsFound = result.allPortsFound;
|
|
5036
|
+
connectedPorts = result.portsWithSelectors ?? [];
|
|
5037
|
+
} catch (error) {
|
|
5038
|
+
if (error instanceof TraceConnectionError) {
|
|
5039
|
+
db.source_trace_not_connected.insert(error.errorData);
|
|
5040
|
+
return;
|
|
5041
|
+
}
|
|
5042
|
+
throw error;
|
|
5043
|
+
}
|
|
5008
5044
|
const { netsWithSelectors } = trace._findConnectedNets();
|
|
5009
5045
|
if (!allPortsFound) return;
|
|
5010
5046
|
const portIds = connectedPorts.map((p) => p.port.schematic_port_id).sort();
|
|
@@ -5703,7 +5739,6 @@ function Trace__doInitialSchematicTraceRenderWithDisplayLabel(trace) {
|
|
|
5703
5739
|
|
|
5704
5740
|
// lib/components/primitive-components/Trace/Trace__findConnectedPorts.ts
|
|
5705
5741
|
function Trace__findConnectedPorts(trace) {
|
|
5706
|
-
const { db } = trace.root;
|
|
5707
5742
|
const { _parsedProps: props, parent } = trace;
|
|
5708
5743
|
if (!parent) throw new Error("Trace has no parent");
|
|
5709
5744
|
const portSelectors = trace.getTracePortPathSelectors();
|
|
@@ -5729,33 +5764,44 @@ function Trace__findConnectedPorts(trace) {
|
|
|
5729
5764
|
targetComponent = trace.getSubcircuit().selectOne(`.${parentSelector}`);
|
|
5730
5765
|
}
|
|
5731
5766
|
if (!targetComponent) {
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
);
|
|
5743
|
-
const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
|
|
5744
|
-
const portNames = ports.flatMap((c) => c.getNameAndAliases());
|
|
5745
|
-
const hasCustomLabels = portNames.some((n) => !/^(pin\d+|\d+)$/.test(n));
|
|
5746
|
-
const labelList = Array.from(new Set(portNames)).join(", ");
|
|
5747
|
-
let detail;
|
|
5748
|
-
if (ports.length === 0) {
|
|
5749
|
-
detail = "It has no ports";
|
|
5750
|
-
} else if (!hasCustomLabels) {
|
|
5751
|
-
detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
|
|
5752
|
-
} else {
|
|
5753
|
-
detail = `It has [${labelList}]`;
|
|
5754
|
-
}
|
|
5755
|
-
trace.renderError(
|
|
5756
|
-
`Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`
|
|
5757
|
-
);
|
|
5767
|
+
const errorMessage2 = parentSelector ? `Could not find port for selector "${selector}". Component "${parentSelector}" not found` : `Could not find port for selector "${selector}"`;
|
|
5768
|
+
const subcircuit2 = trace.getSubcircuit();
|
|
5769
|
+
const sourceGroup2 = subcircuit2.getGroup();
|
|
5770
|
+
throw new TraceConnectionError({
|
|
5771
|
+
error_type: "source_trace_not_connected",
|
|
5772
|
+
message: errorMessage2,
|
|
5773
|
+
subcircuit_id: subcircuit2.subcircuit_id ?? void 0,
|
|
5774
|
+
source_group_id: sourceGroup2?.source_group_id ?? void 0,
|
|
5775
|
+
source_trace_id: trace.source_trace_id ?? void 0,
|
|
5776
|
+
selectors_not_found: [selector]
|
|
5777
|
+
});
|
|
5758
5778
|
}
|
|
5779
|
+
const ports = targetComponent.children.filter(
|
|
5780
|
+
(c) => c.componentName === "Port"
|
|
5781
|
+
);
|
|
5782
|
+
const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
|
|
5783
|
+
const portNames = ports.flatMap((c) => c.getNameAndAliases());
|
|
5784
|
+
const hasCustomLabels = portNames.some((n) => !/^(pin\d+|\d+)$/.test(n));
|
|
5785
|
+
const labelList = Array.from(new Set(portNames)).join(", ");
|
|
5786
|
+
let detail;
|
|
5787
|
+
if (ports.length === 0) {
|
|
5788
|
+
detail = "It has no ports";
|
|
5789
|
+
} else if (!hasCustomLabels) {
|
|
5790
|
+
detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
|
|
5791
|
+
} else {
|
|
5792
|
+
detail = `It has [${labelList}]`;
|
|
5793
|
+
}
|
|
5794
|
+
const errorMessage = `Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`;
|
|
5795
|
+
const subcircuit = trace.getSubcircuit();
|
|
5796
|
+
const sourceGroup = subcircuit.getGroup();
|
|
5797
|
+
throw new TraceConnectionError({
|
|
5798
|
+
error_type: "source_trace_not_connected",
|
|
5799
|
+
message: errorMessage,
|
|
5800
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
5801
|
+
source_group_id: sourceGroup?.source_group_id ?? void 0,
|
|
5802
|
+
source_trace_id: trace.source_trace_id ?? void 0,
|
|
5803
|
+
selectors_not_found: [selector]
|
|
5804
|
+
});
|
|
5759
5805
|
}
|
|
5760
5806
|
}
|
|
5761
5807
|
if (portsWithSelectors.some((p) => !p.port)) {
|
|
@@ -5776,6 +5822,7 @@ var Trace3 = class extends PrimitiveComponent2 {
|
|
|
5776
5822
|
_portsRoutedOnPcb;
|
|
5777
5823
|
subcircuit_connectivity_map_key = null;
|
|
5778
5824
|
_traceConnectionHash = null;
|
|
5825
|
+
_couldNotFindPort;
|
|
5779
5826
|
constructor(props) {
|
|
5780
5827
|
super(props);
|
|
5781
5828
|
this._portsRoutedOnPcb = [];
|
|
@@ -5892,7 +5939,20 @@ var Trace3 = class extends PrimitiveComponent2 {
|
|
|
5892
5939
|
this.renderError("Trace has no parent");
|
|
5893
5940
|
return;
|
|
5894
5941
|
}
|
|
5895
|
-
|
|
5942
|
+
let allPortsFound;
|
|
5943
|
+
let ports;
|
|
5944
|
+
try {
|
|
5945
|
+
const result = this._findConnectedPorts();
|
|
5946
|
+
allPortsFound = result.allPortsFound;
|
|
5947
|
+
ports = result.portsWithSelectors ?? [];
|
|
5948
|
+
} catch (error) {
|
|
5949
|
+
if (error instanceof TraceConnectionError) {
|
|
5950
|
+
db.source_trace_not_connected.insert(error.errorData);
|
|
5951
|
+
this._couldNotFindPort = true;
|
|
5952
|
+
return;
|
|
5953
|
+
}
|
|
5954
|
+
throw error;
|
|
5955
|
+
}
|
|
5896
5956
|
if (!allPortsFound) return;
|
|
5897
5957
|
this._traceConnectionHash = this._computeTraceConnectionHash();
|
|
5898
5958
|
const existingTraces = db.source_trace.list();
|
|
@@ -6835,18 +6895,6 @@ import {
|
|
|
6835
6895
|
|
|
6836
6896
|
// lib/utils/autorouting/CapacityMeshAutorouter.ts
|
|
6837
6897
|
import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
|
|
6838
|
-
|
|
6839
|
-
// lib/errors/AutorouterError.ts
|
|
6840
|
-
import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
|
|
6841
|
-
var autorouterVersion = packageJson.version ?? "unknown";
|
|
6842
|
-
var AutorouterError = class extends Error {
|
|
6843
|
-
constructor(message) {
|
|
6844
|
-
super(`${message} (capacity-autorouter@${autorouterVersion})`);
|
|
6845
|
-
this.name = "AutorouterError";
|
|
6846
|
-
}
|
|
6847
|
-
};
|
|
6848
|
-
|
|
6849
|
-
// lib/utils/autorouting/CapacityMeshAutorouter.ts
|
|
6850
6898
|
var CapacityMeshAutorouter = class {
|
|
6851
6899
|
input;
|
|
6852
6900
|
isRouting = false;
|
|
@@ -11264,7 +11312,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11264
11312
|
var package_default = {
|
|
11265
11313
|
name: "@tscircuit/core",
|
|
11266
11314
|
type: "module",
|
|
11267
|
-
version: "0.0.
|
|
11315
|
+
version: "0.0.600",
|
|
11268
11316
|
types: "dist/index.d.ts",
|
|
11269
11317
|
main: "dist/index.js",
|
|
11270
11318
|
module: "dist/index.js",
|
|
@@ -11288,8 +11336,7 @@ var package_default = {
|
|
|
11288
11336
|
devDependencies: {
|
|
11289
11337
|
"@biomejs/biome": "^1.8.3",
|
|
11290
11338
|
"@tscircuit/capacity-autorouter": "^0.0.100",
|
|
11291
|
-
"@tscircuit/checks": "^0.0.
|
|
11292
|
-
"@tscircuit/circuit-json-flex": "^0.0.2",
|
|
11339
|
+
"@tscircuit/checks": "^0.0.64",
|
|
11293
11340
|
"@tscircuit/circuit-json-util": "^0.0.61",
|
|
11294
11341
|
"@tscircuit/footprinter": "^0.0.204",
|
|
11295
11342
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
@@ -11298,7 +11345,7 @@ var package_default = {
|
|
|
11298
11345
|
"@tscircuit/math-utils": "^0.0.18",
|
|
11299
11346
|
"@tscircuit/props": "^0.0.271",
|
|
11300
11347
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
11301
|
-
"@tscircuit/schematic-corpus": "^0.0.
|
|
11348
|
+
"@tscircuit/schematic-corpus": "^0.0.110",
|
|
11302
11349
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
11303
11350
|
"@tscircuit/simple-3d-svg": "^0.0.6",
|
|
11304
11351
|
"@types/bun": "^1.2.16",
|
|
@@ -11310,7 +11357,7 @@ var package_default = {
|
|
|
11310
11357
|
"bun-match-svg": "0.0.12",
|
|
11311
11358
|
"calculate-elbow": "^0.0.5",
|
|
11312
11359
|
"chokidar-cli": "^3.0.0",
|
|
11313
|
-
"circuit-json": "^0.0.
|
|
11360
|
+
"circuit-json": "^0.0.224",
|
|
11314
11361
|
"circuit-json-to-bpc": "^0.0.13",
|
|
11315
11362
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
11316
11363
|
"circuit-json-to-simple-3d": "^0.0.2",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.601",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@biomejs/biome": "^1.8.3",
|
|
27
27
|
"@tscircuit/capacity-autorouter": "^0.0.100",
|
|
28
|
-
"@tscircuit/checks": "^0.0.
|
|
29
|
-
"@tscircuit/circuit-json-flex": "^0.0.2",
|
|
28
|
+
"@tscircuit/checks": "^0.0.64",
|
|
30
29
|
"@tscircuit/circuit-json-util": "^0.0.61",
|
|
31
30
|
"@tscircuit/footprinter": "^0.0.204",
|
|
32
31
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
"@tscircuit/math-utils": "^0.0.18",
|
|
36
35
|
"@tscircuit/props": "^0.0.271",
|
|
37
36
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
38
|
-
"@tscircuit/schematic-corpus": "^0.0.
|
|
37
|
+
"@tscircuit/schematic-corpus": "^0.0.110",
|
|
39
38
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
40
39
|
"@tscircuit/simple-3d-svg": "^0.0.6",
|
|
41
40
|
"@types/bun": "^1.2.16",
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"bun-match-svg": "0.0.12",
|
|
48
47
|
"calculate-elbow": "^0.0.5",
|
|
49
48
|
"chokidar-cli": "^3.0.0",
|
|
50
|
-
"circuit-json": "^0.0.
|
|
49
|
+
"circuit-json": "^0.0.224",
|
|
51
50
|
"circuit-json-to-bpc": "^0.0.13",
|
|
52
51
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
53
52
|
"circuit-json-to-simple-3d": "^0.0.2",
|