@tscircuit/core 0.0.1379 → 0.0.1381
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.js +34 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4450,6 +4450,7 @@ import { distance as distance2, doesLineIntersectLine } from "@tscircuit/math-ut
|
|
|
4450
4450
|
var getOtherSchematicTraces = ({
|
|
4451
4451
|
db,
|
|
4452
4452
|
source_trace_id,
|
|
4453
|
+
schematic_sheet_id,
|
|
4453
4454
|
sameNetOnly,
|
|
4454
4455
|
differentNetOnly
|
|
4455
4456
|
}) => {
|
|
@@ -4460,6 +4461,9 @@ var getOtherSchematicTraces = ({
|
|
|
4460
4461
|
const traces = [];
|
|
4461
4462
|
for (const otherSchematicTrace of db.schematic_trace.list()) {
|
|
4462
4463
|
if (otherSchematicTrace.source_trace_id === source_trace_id) continue;
|
|
4464
|
+
if (schematic_sheet_id !== void 0 && otherSchematicTrace.schematic_sheet_id !== schematic_sheet_id) {
|
|
4465
|
+
continue;
|
|
4466
|
+
}
|
|
4463
4467
|
const otherSourceTrace = db.source_trace.get(
|
|
4464
4468
|
otherSchematicTrace.source_trace_id
|
|
4465
4469
|
);
|
|
@@ -4606,11 +4610,13 @@ var getIntersectionPoint = (edge1, edge2) => {
|
|
|
4606
4610
|
var createSchematicTraceJunctions = ({
|
|
4607
4611
|
edges: myEdges,
|
|
4608
4612
|
db,
|
|
4609
|
-
source_trace_id
|
|
4613
|
+
source_trace_id,
|
|
4614
|
+
schematic_sheet_id
|
|
4610
4615
|
}) => {
|
|
4611
4616
|
const otherEdges = getOtherSchematicTraces({
|
|
4612
4617
|
db,
|
|
4613
4618
|
source_trace_id,
|
|
4619
|
+
schematic_sheet_id,
|
|
4614
4620
|
sameNetOnly: true
|
|
4615
4621
|
}).flatMap((t) => t.edges);
|
|
4616
4622
|
const junctions = /* @__PURE__ */ new Map();
|
|
@@ -4892,12 +4898,13 @@ import { doesLineIntersectLine as doesLineIntersectLine2 } from "@tscircuit/math
|
|
|
4892
4898
|
var pushEdgesOfSchematicTraceToPreventOverlap = ({
|
|
4893
4899
|
edges,
|
|
4894
4900
|
db,
|
|
4895
|
-
source_trace_id
|
|
4901
|
+
source_trace_id,
|
|
4902
|
+
schematic_sheet_id
|
|
4896
4903
|
}) => {
|
|
4897
|
-
const mySourceTrace = db.source_trace.get(source_trace_id);
|
|
4898
4904
|
const otherEdges = getOtherSchematicTraces({
|
|
4899
4905
|
db,
|
|
4900
4906
|
source_trace_id,
|
|
4907
|
+
schematic_sheet_id,
|
|
4901
4908
|
differentNetOnly: true
|
|
4902
4909
|
}).flatMap((t) => t.edges);
|
|
4903
4910
|
const edgeOrientation = (edge) => {
|
|
@@ -4953,6 +4960,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
4953
4960
|
const { db } = trace.root;
|
|
4954
4961
|
const { _parsedProps: props, parent } = trace;
|
|
4955
4962
|
const schematicNetLabelText = trace._getSchematicNetLabelText();
|
|
4963
|
+
const schematicSheetId = trace._resolveSchematicSheetId();
|
|
4956
4964
|
if (!parent) throw new Error("Trace has no parent");
|
|
4957
4965
|
let allPortsFound;
|
|
4958
4966
|
let connectedPorts;
|
|
@@ -5031,14 +5039,15 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
5031
5039
|
const junctions2 = createSchematicTraceJunctions({
|
|
5032
5040
|
edges: edges2,
|
|
5033
5041
|
db,
|
|
5034
|
-
source_trace_id: trace.source_trace_id
|
|
5042
|
+
source_trace_id: trace.source_trace_id,
|
|
5043
|
+
schematic_sheet_id: schematicSheetId
|
|
5035
5044
|
});
|
|
5036
5045
|
const dbTrace2 = db.schematic_trace.insert({
|
|
5037
5046
|
source_trace_id: trace.source_trace_id,
|
|
5038
5047
|
edges: edges2,
|
|
5039
5048
|
junctions: junctions2,
|
|
5040
5049
|
subcircuit_connectivity_map_key: trace.subcircuit_connectivity_map_key ?? void 0,
|
|
5041
|
-
schematic_sheet_id:
|
|
5050
|
+
schematic_sheet_id: schematicSheetId
|
|
5042
5051
|
});
|
|
5043
5052
|
trace.schematic_trace_id = dbTrace2.schematic_trace_id;
|
|
5044
5053
|
return;
|
|
@@ -5233,17 +5242,24 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
5233
5242
|
const source_trace_id = trace.source_trace_id;
|
|
5234
5243
|
let junctions = [];
|
|
5235
5244
|
if (!skipOtherTraceInteraction) {
|
|
5236
|
-
pushEdgesOfSchematicTraceToPreventOverlap({
|
|
5245
|
+
pushEdgesOfSchematicTraceToPreventOverlap({
|
|
5246
|
+
edges,
|
|
5247
|
+
db,
|
|
5248
|
+
source_trace_id,
|
|
5249
|
+
schematic_sheet_id: schematicSheetId
|
|
5250
|
+
});
|
|
5237
5251
|
const otherEdges = getOtherSchematicTraces({
|
|
5238
5252
|
db,
|
|
5239
5253
|
source_trace_id,
|
|
5254
|
+
schematic_sheet_id: schematicSheetId,
|
|
5240
5255
|
differentNetOnly: true
|
|
5241
5256
|
}).flatMap((t) => t.edges);
|
|
5242
5257
|
edges = createSchematicTraceCrossingSegments({ edges, otherEdges });
|
|
5243
5258
|
junctions = createSchematicTraceJunctions({
|
|
5244
5259
|
edges,
|
|
5245
5260
|
db,
|
|
5246
|
-
source_trace_id: trace.source_trace_id
|
|
5261
|
+
source_trace_id: trace.source_trace_id,
|
|
5262
|
+
schematic_sheet_id: schematicSheetId
|
|
5247
5263
|
});
|
|
5248
5264
|
}
|
|
5249
5265
|
if (!edges || edges.length === 0) {
|
|
@@ -5275,7 +5291,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
5275
5291
|
edges,
|
|
5276
5292
|
junctions,
|
|
5277
5293
|
subcircuit_connectivity_map_key: trace.subcircuit_connectivity_map_key ?? void 0,
|
|
5278
|
-
schematic_sheet_id:
|
|
5294
|
+
schematic_sheet_id: schematicSheetId
|
|
5279
5295
|
});
|
|
5280
5296
|
trace.schematic_trace_id = dbTrace.schematic_trace_id;
|
|
5281
5297
|
for (const { port } of connectedPorts) {
|
|
@@ -20338,8 +20354,10 @@ function applyTracesFromSolverOutput(args) {
|
|
|
20338
20354
|
}))
|
|
20339
20355
|
);
|
|
20340
20356
|
const existingTracesForJunctions = [];
|
|
20357
|
+
const schematicSheetId = group._resolveSchematicSheetId();
|
|
20341
20358
|
for (const t of db.schematic_trace.list()) {
|
|
20342
20359
|
if (t.edges.length === 0) continue;
|
|
20360
|
+
if (t.schematic_sheet_id !== schematicSheetId) continue;
|
|
20343
20361
|
const sourceTrace = t.source_trace_id ? db.source_trace.get(t.source_trace_id) : void 0;
|
|
20344
20362
|
existingTracesForJunctions.push({
|
|
20345
20363
|
schematic_trace_id: t.schematic_trace_id,
|
|
@@ -20377,7 +20395,7 @@ function applyTracesFromSolverOutput(args) {
|
|
|
20377
20395
|
subcircuit_connectivity_map_key: pendingTraces.find(
|
|
20378
20396
|
(p) => p.source_trace_id === t.source_trace_id
|
|
20379
20397
|
)?.subcircuit_connectivity_map_key,
|
|
20380
|
-
schematic_sheet_id:
|
|
20398
|
+
schematic_sheet_id: schematicSheetId
|
|
20381
20399
|
});
|
|
20382
20400
|
}
|
|
20383
20401
|
}
|
|
@@ -20671,6 +20689,8 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
20671
20689
|
const connKey = sourcePort?.subcircuit_connectivity_map_key;
|
|
20672
20690
|
if (!connKey) continue;
|
|
20673
20691
|
const sourceNet = connKeyToSourceNet.get(connKey);
|
|
20692
|
+
const schComponent = schPort.schematic_component_id ? db.schematic_component.get(schPort.schematic_component_id) : void 0;
|
|
20693
|
+
const portSchematicSheetId = schComponent?.schematic_sheet_id ?? group._resolveSchematicSheetId();
|
|
20674
20694
|
const connectedSourcePortIdsForKey = Array.from(
|
|
20675
20695
|
allSourceAndSchematicPortIdsInScope
|
|
20676
20696
|
).map((portId) => schPortIdToSourcePortId.get(portId)).filter((sourcePortId) => {
|
|
@@ -20711,6 +20731,7 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
20711
20731
|
text
|
|
20712
20732
|
});
|
|
20713
20733
|
const existingNetLabelForCurrentSourceConnection = db.schematic_net_label.list().find((nl) => {
|
|
20734
|
+
if (nl.schematic_sheet_id !== portSchematicSheetId) return false;
|
|
20714
20735
|
return doesSchematicNetLabelRepresentCurrentSourceConnection({
|
|
20715
20736
|
nl,
|
|
20716
20737
|
connKey,
|
|
@@ -20764,6 +20785,7 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
20764
20785
|
continue;
|
|
20765
20786
|
}
|
|
20766
20787
|
const existingAtPort = db.schematic_net_label.list().some((nl) => {
|
|
20788
|
+
if (nl.schematic_sheet_id !== portSchematicSheetId) return false;
|
|
20767
20789
|
const dx2 = nl.anchor_position.x - schPort.center.x;
|
|
20768
20790
|
const dy2 = nl.anchor_position.y - schPort.center.y;
|
|
20769
20791
|
if (dx2 * dx2 + dy2 * dy2 >= SAME_ANCHOR_POSITION_DISTANCE * SAME_ANCHOR_POSITION_DISTANCE) {
|
|
@@ -20781,6 +20803,7 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
20781
20803
|
if (!sourceNet) {
|
|
20782
20804
|
for (const nl of db.schematic_net_label.list()) {
|
|
20783
20805
|
if (nl.source_net_id !== connKey) continue;
|
|
20806
|
+
if (nl.schematic_sheet_id !== portSchematicSheetId) continue;
|
|
20784
20807
|
const isAttachedToConnectedPort = connectedSourcePortIdsForKey.some(
|
|
20785
20808
|
(sourcePortId) => {
|
|
20786
20809
|
const schPortId = Array.from(
|
|
@@ -20807,7 +20830,7 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
20807
20830
|
anchor_position: schPort.center,
|
|
20808
20831
|
center,
|
|
20809
20832
|
anchor_side: side,
|
|
20810
|
-
schematic_sheet_id:
|
|
20833
|
+
schematic_sheet_id: portSchematicSheetId
|
|
20811
20834
|
};
|
|
20812
20835
|
db.schematic_net_label.insert(netLabel);
|
|
20813
20836
|
}
|
|
@@ -24849,7 +24872,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
24849
24872
|
var package_default = {
|
|
24850
24873
|
name: "@tscircuit/core",
|
|
24851
24874
|
type: "module",
|
|
24852
|
-
version: "0.0.
|
|
24875
|
+
version: "0.0.1380",
|
|
24853
24876
|
types: "dist/index.d.ts",
|
|
24854
24877
|
main: "dist/index.js",
|
|
24855
24878
|
module: "dist/index.js",
|