@tscircuit/core 0.0.1082 → 0.0.1084
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 +4634 -1
- package/dist/index.js +98 -5
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ __export(components_exports, {
|
|
|
16
16
|
CadModel: () => CadModel,
|
|
17
17
|
Capacitor: () => Capacitor,
|
|
18
18
|
Chip: () => Chip,
|
|
19
|
+
Connector: () => Connector,
|
|
19
20
|
Constraint: () => Constraint3,
|
|
20
21
|
CopperPour: () => CopperPour,
|
|
21
22
|
CopperText: () => CopperText,
|
|
@@ -3748,7 +3749,23 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
3748
3749
|
if (!subcircuit._shouldUseTraceByTraceRouting()) {
|
|
3749
3750
|
return;
|
|
3750
3751
|
}
|
|
3751
|
-
|
|
3752
|
+
let allPortsFound;
|
|
3753
|
+
let ports;
|
|
3754
|
+
try {
|
|
3755
|
+
const connectedPorts = trace._findConnectedPorts();
|
|
3756
|
+
allPortsFound = connectedPorts.allPortsFound;
|
|
3757
|
+
ports = connectedPorts.ports ?? [];
|
|
3758
|
+
} catch (error) {
|
|
3759
|
+
if (error instanceof TraceConnectionError) {
|
|
3760
|
+
db.source_trace_not_connected_error.insert({
|
|
3761
|
+
...error.errorData,
|
|
3762
|
+
error_type: "source_trace_not_connected_error"
|
|
3763
|
+
});
|
|
3764
|
+
trace._couldNotFindPort = true;
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
throw error;
|
|
3768
|
+
}
|
|
3752
3769
|
const portsConnectedOnPcbViaNet = [];
|
|
3753
3770
|
if (!allPortsFound) return;
|
|
3754
3771
|
const portsWithoutMatchedPcbPrimitive = [];
|
|
@@ -4154,7 +4171,25 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
4154
4171
|
const hasPcbPath = props.pcbPath !== void 0;
|
|
4155
4172
|
const wantsStraightLine = Boolean(props.pcbStraightLine);
|
|
4156
4173
|
if (!hasPcbPath && !wantsStraightLine) return;
|
|
4157
|
-
|
|
4174
|
+
let allPortsFound;
|
|
4175
|
+
let ports;
|
|
4176
|
+
let portsWithSelectors;
|
|
4177
|
+
try {
|
|
4178
|
+
const connectedPorts = trace._findConnectedPorts();
|
|
4179
|
+
allPortsFound = connectedPorts.allPortsFound;
|
|
4180
|
+
ports = connectedPorts.ports ?? [];
|
|
4181
|
+
portsWithSelectors = connectedPorts.portsWithSelectors ?? [];
|
|
4182
|
+
} catch (error) {
|
|
4183
|
+
if (error instanceof TraceConnectionError) {
|
|
4184
|
+
db.source_trace_not_connected_error.insert({
|
|
4185
|
+
...error.errorData,
|
|
4186
|
+
error_type: "source_trace_not_connected_error"
|
|
4187
|
+
});
|
|
4188
|
+
trace._couldNotFindPort = true;
|
|
4189
|
+
return;
|
|
4190
|
+
}
|
|
4191
|
+
throw error;
|
|
4192
|
+
}
|
|
4158
4193
|
if (!allPortsFound) return;
|
|
4159
4194
|
const portsWithoutMatchedPcbPrimitive = [];
|
|
4160
4195
|
for (const port of ports) {
|
|
@@ -10412,7 +10447,6 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
10412
10447
|
if (this.root?.pcbDisabled) return;
|
|
10413
10448
|
if (!this.pcb_component_id) return;
|
|
10414
10449
|
const { db } = this.root;
|
|
10415
|
-
const { _parsedProps: props } = this;
|
|
10416
10450
|
const bounds = getBoundsOfPcbComponents(this.children);
|
|
10417
10451
|
if (bounds.width === 0 || bounds.height === 0) return;
|
|
10418
10452
|
const center = {
|
|
@@ -18134,7 +18168,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
18134
18168
|
var package_default = {
|
|
18135
18169
|
name: "@tscircuit/core",
|
|
18136
18170
|
type: "module",
|
|
18137
|
-
version: "0.0.
|
|
18171
|
+
version: "0.0.1083",
|
|
18138
18172
|
types: "dist/index.d.ts",
|
|
18139
18173
|
main: "dist/index.js",
|
|
18140
18174
|
module: "dist/index.js",
|
|
@@ -18172,6 +18206,7 @@ var package_default = {
|
|
|
18172
18206
|
"@tscircuit/common": "^0.0.20",
|
|
18173
18207
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|
|
18174
18208
|
"@tscircuit/footprinter": "^0.0.316",
|
|
18209
|
+
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
18175
18210
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
18176
18211
|
"@tscircuit/log-soup": "^1.0.2",
|
|
18177
18212
|
"@tscircuit/matchpack": "^0.0.16",
|
|
@@ -18192,7 +18227,7 @@ var package_default = {
|
|
|
18192
18227
|
"bun-match-svg": "0.0.12",
|
|
18193
18228
|
"calculate-elbow": "^0.0.12",
|
|
18194
18229
|
"chokidar-cli": "^3.0.0",
|
|
18195
|
-
"circuit-json": "^0.0.
|
|
18230
|
+
"circuit-json": "^0.0.390",
|
|
18196
18231
|
"circuit-json-to-bpc": "^0.0.13",
|
|
18197
18232
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
18198
18233
|
"circuit-json-to-gltf": "^0.0.73",
|
|
@@ -21969,6 +22004,63 @@ var Battery = class extends NormalComponent3 {
|
|
|
21969
22004
|
}
|
|
21970
22005
|
};
|
|
21971
22006
|
|
|
22007
|
+
// lib/components/normal-components/Connector.ts
|
|
22008
|
+
import { guessCableInsertCenter } from "@tscircuit/infer-cable-insertion-point";
|
|
22009
|
+
import { chipProps as chipProps3 } from "@tscircuit/props";
|
|
22010
|
+
var Connector = class extends Chip {
|
|
22011
|
+
get config() {
|
|
22012
|
+
return {
|
|
22013
|
+
componentName: "Connector",
|
|
22014
|
+
zodProps: chipProps3,
|
|
22015
|
+
shouldRenderAsSchematicBox: true
|
|
22016
|
+
};
|
|
22017
|
+
}
|
|
22018
|
+
doInitialSourceRender() {
|
|
22019
|
+
const { db } = this.root;
|
|
22020
|
+
const { _parsedProps: props } = this;
|
|
22021
|
+
const source_component = db.source_component.insert({
|
|
22022
|
+
ftype: "simple_connector",
|
|
22023
|
+
name: this.name,
|
|
22024
|
+
manufacturer_part_number: props.manufacturerPartNumber,
|
|
22025
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
22026
|
+
display_name: props.displayName,
|
|
22027
|
+
standard: props.standard
|
|
22028
|
+
});
|
|
22029
|
+
this.source_component_id = source_component.source_component_id;
|
|
22030
|
+
}
|
|
22031
|
+
doInitialPcbComponentSizeCalculation() {
|
|
22032
|
+
super.doInitialPcbComponentSizeCalculation();
|
|
22033
|
+
if (this.root?.pcbDisabled) return;
|
|
22034
|
+
if (!this.pcb_component_id || !this.source_component_id) return;
|
|
22035
|
+
const { db } = this.root;
|
|
22036
|
+
const connectorCircuitJson = db.toArray().filter((elm) => {
|
|
22037
|
+
if (elm.type === "pcb_component") {
|
|
22038
|
+
return elm.pcb_component_id === this.pcb_component_id;
|
|
22039
|
+
}
|
|
22040
|
+
if (elm.type === "source_component") {
|
|
22041
|
+
return elm.source_component_id === this.source_component_id;
|
|
22042
|
+
}
|
|
22043
|
+
if ("pcb_component_id" in elm && elm.pcb_component_id === this.pcb_component_id) {
|
|
22044
|
+
return true;
|
|
22045
|
+
}
|
|
22046
|
+
if ("source_component_id" in elm && elm.source_component_id === this.source_component_id) {
|
|
22047
|
+
return true;
|
|
22048
|
+
}
|
|
22049
|
+
return false;
|
|
22050
|
+
});
|
|
22051
|
+
if (connectorCircuitJson.length === 0) return;
|
|
22052
|
+
const inferredInsertionCenter = guessCableInsertCenter(
|
|
22053
|
+
connectorCircuitJson
|
|
22054
|
+
);
|
|
22055
|
+
db.pcb_component.update(this.pcb_component_id, {
|
|
22056
|
+
cable_insertion_center: {
|
|
22057
|
+
x: inferredInsertionCenter.x,
|
|
22058
|
+
y: inferredInsertionCenter.y
|
|
22059
|
+
}
|
|
22060
|
+
});
|
|
22061
|
+
}
|
|
22062
|
+
};
|
|
22063
|
+
|
|
21972
22064
|
// lib/components/normal-components/PinHeader.ts
|
|
21973
22065
|
import { pinHeaderProps } from "@tscircuit/props";
|
|
21974
22066
|
var PinHeader = class extends NormalComponent3 {
|
|
@@ -24044,6 +24136,7 @@ export {
|
|
|
24044
24136
|
Capacitor,
|
|
24045
24137
|
Chip,
|
|
24046
24138
|
Circuit,
|
|
24139
|
+
Connector,
|
|
24047
24140
|
Constraint3 as Constraint,
|
|
24048
24141
|
CopperPour,
|
|
24049
24142
|
CopperText,
|
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.1084",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@tscircuit/common": "^0.0.20",
|
|
40
40
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|
|
41
41
|
"@tscircuit/footprinter": "^0.0.316",
|
|
42
|
+
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
42
43
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
43
44
|
"@tscircuit/log-soup": "^1.0.2",
|
|
44
45
|
"@tscircuit/matchpack": "^0.0.16",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"bun-match-svg": "0.0.12",
|
|
60
61
|
"calculate-elbow": "^0.0.12",
|
|
61
62
|
"chokidar-cli": "^3.0.0",
|
|
62
|
-
"circuit-json": "^0.0.
|
|
63
|
+
"circuit-json": "^0.0.390",
|
|
63
64
|
"circuit-json-to-bpc": "^0.0.13",
|
|
64
65
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
65
66
|
"circuit-json-to-gltf": "^0.0.73",
|