@tscircuit/core 0.0.682 → 0.0.683
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 +51 -28
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5188,7 +5188,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
5188
5188
|
const dbTrace2 = db.schematic_trace.insert({
|
|
5189
5189
|
source_trace_id: trace.source_trace_id,
|
|
5190
5190
|
edges: edges2,
|
|
5191
|
-
junctions: []
|
|
5191
|
+
junctions: [],
|
|
5192
|
+
subcircuit_connectivity_map_key: trace.subcircuit_connectivity_map_key ?? void 0
|
|
5192
5193
|
});
|
|
5193
5194
|
trace.schematic_trace_id = dbTrace2.schematic_trace_id;
|
|
5194
5195
|
return;
|
|
@@ -5418,7 +5419,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
5418
5419
|
const dbTrace = db.schematic_trace.insert({
|
|
5419
5420
|
source_trace_id: trace.source_trace_id,
|
|
5420
5421
|
edges,
|
|
5421
|
-
junctions
|
|
5422
|
+
junctions,
|
|
5423
|
+
subcircuit_connectivity_map_key: trace.subcircuit_connectivity_map_key ?? void 0
|
|
5422
5424
|
});
|
|
5423
5425
|
trace.schematic_trace_id = dbTrace.schematic_trace_id;
|
|
5424
5426
|
for (const { port } of connectedPorts) {
|
|
@@ -10105,7 +10107,10 @@ function computeCrossings(traces, opts = {}) {
|
|
|
10105
10107
|
}
|
|
10106
10108
|
}
|
|
10107
10109
|
}
|
|
10108
|
-
const out = traces.map((t) => ({
|
|
10110
|
+
const out = traces.map((t) => ({
|
|
10111
|
+
source_trace_id: t.source_trace_id,
|
|
10112
|
+
edges: []
|
|
10113
|
+
}));
|
|
10109
10114
|
for (let ti = 0; ti < traces.length; ti++) {
|
|
10110
10115
|
const trace = traces[ti];
|
|
10111
10116
|
for (let ei = 0; ei < trace.edges.length; ei++) {
|
|
@@ -10206,7 +10211,7 @@ function getCornerOrientationAtPoint(trace, p, tol = TOL2) {
|
|
|
10206
10211
|
function computeJunctions(traces, opts = {}) {
|
|
10207
10212
|
const tol = opts.tolerance ?? TOL2;
|
|
10208
10213
|
const result = {};
|
|
10209
|
-
for (const t of traces) result[t.
|
|
10214
|
+
for (const t of traces) result[t.source_trace_id] = [];
|
|
10210
10215
|
const endpointsByTrace = traces.map((t) => {
|
|
10211
10216
|
const pts = [];
|
|
10212
10217
|
for (const e of t.edges) {
|
|
@@ -10232,8 +10237,9 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10232
10237
|
const bCorner = getCornerOrientationAtPoint(B, pb, tol);
|
|
10233
10238
|
const sameCornerOrientation = aCorner !== null && bCorner !== null && aCorner === bCorner;
|
|
10234
10239
|
if (hasCorner && !sameCornerOrientation) {
|
|
10235
|
-
result[A.
|
|
10236
|
-
if (A.
|
|
10240
|
+
result[A.source_trace_id].push(pa);
|
|
10241
|
+
if (A.source_trace_id !== B.source_trace_id)
|
|
10242
|
+
result[B.source_trace_id].push(pb);
|
|
10237
10243
|
}
|
|
10238
10244
|
}
|
|
10239
10245
|
}
|
|
@@ -10248,8 +10254,9 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10248
10254
|
const bCorner = bEndpointNearPa ? getCornerOrientationAtPoint(B, bEndpointNearPa, tol) : null;
|
|
10249
10255
|
const sameCornerOrientation = aCorner !== null && bCorner !== null && aCorner === bCorner;
|
|
10250
10256
|
if (hasCorner && !sameCornerOrientation) {
|
|
10251
|
-
result[A.
|
|
10252
|
-
if (A.
|
|
10257
|
+
result[A.source_trace_id].push(pa);
|
|
10258
|
+
if (A.source_trace_id !== B.source_trace_id)
|
|
10259
|
+
result[B.source_trace_id].push(pa);
|
|
10253
10260
|
}
|
|
10254
10261
|
}
|
|
10255
10262
|
}
|
|
@@ -10264,8 +10271,9 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10264
10271
|
const aCorner = aEndpointNearPb ? getCornerOrientationAtPoint(A, aEndpointNearPb, tol) : null;
|
|
10265
10272
|
const sameCornerOrientation = aCorner !== null && bCorner !== null && aCorner === bCorner;
|
|
10266
10273
|
if (hasCorner && !sameCornerOrientation) {
|
|
10267
|
-
result[B.
|
|
10268
|
-
if (A.
|
|
10274
|
+
result[B.source_trace_id].push(pb);
|
|
10275
|
+
if (A.source_trace_id !== B.source_trace_id)
|
|
10276
|
+
result[A.source_trace_id].push(pb);
|
|
10269
10277
|
}
|
|
10270
10278
|
}
|
|
10271
10279
|
}
|
|
@@ -10280,12 +10288,12 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10280
10288
|
|
|
10281
10289
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyTracesFromSolverOutput.ts
|
|
10282
10290
|
function applyTracesFromSolverOutput(args) {
|
|
10283
|
-
const { group, solver, pinIdToSchematicPortId,
|
|
10291
|
+
const { group, solver, pinIdToSchematicPortId, userNetIdToSck } = args;
|
|
10284
10292
|
const { db } = group.root;
|
|
10285
10293
|
const correctedMap = solver.traceOverlapShiftSolver?.correctedTraceMap;
|
|
10286
10294
|
const pendingTraces = [];
|
|
10287
|
-
for (const
|
|
10288
|
-
const points =
|
|
10295
|
+
for (const solvedTracePath of Object.values(correctedMap ?? {})) {
|
|
10296
|
+
const points = solvedTracePath?.tracePath;
|
|
10289
10297
|
if (!Array.isArray(points) || points.length < 2) continue;
|
|
10290
10298
|
const edges = [];
|
|
10291
10299
|
for (let i = 0; i < points.length - 1; i++) {
|
|
@@ -10295,35 +10303,47 @@ function applyTracesFromSolverOutput(args) {
|
|
|
10295
10303
|
});
|
|
10296
10304
|
}
|
|
10297
10305
|
let source_trace_id = null;
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
const
|
|
10306
|
+
let subcircuit_connectivity_map_key;
|
|
10307
|
+
if (Array.isArray(solvedTracePath?.pins) && solvedTracePath.pins.length === 2) {
|
|
10308
|
+
const pA = pinIdToSchematicPortId.get(solvedTracePath.pins[0]?.pinId);
|
|
10309
|
+
const pB = pinIdToSchematicPortId.get(solvedTracePath.pins[1]?.pinId);
|
|
10301
10310
|
if (pA && pB) {
|
|
10302
|
-
const pairKey = [pA, pB].sort().join("::");
|
|
10303
|
-
source_trace_id = pairKeyToSourceTraceId.get(pairKey) || `solver_${solved.mspPairId || pairKey}`;
|
|
10304
10311
|
for (const schPid of [pA, pB]) {
|
|
10305
10312
|
const existing = db.schematic_port.get(schPid);
|
|
10306
10313
|
if (existing) db.schematic_port.update(schPid, { is_connected: true });
|
|
10307
10314
|
}
|
|
10315
|
+
subcircuit_connectivity_map_key = userNetIdToSck.get(
|
|
10316
|
+
String(solvedTracePath.userNetId)
|
|
10317
|
+
);
|
|
10308
10318
|
}
|
|
10309
10319
|
}
|
|
10310
10320
|
if (!source_trace_id) {
|
|
10311
|
-
source_trace_id = `solver_${
|
|
10321
|
+
source_trace_id = `solver_${solvedTracePath?.mspPairId}`;
|
|
10322
|
+
subcircuit_connectivity_map_key = userNetIdToSck.get(
|
|
10323
|
+
String(solvedTracePath.userNetId)
|
|
10324
|
+
);
|
|
10312
10325
|
}
|
|
10313
10326
|
pendingTraces.push({
|
|
10314
|
-
|
|
10315
|
-
edges
|
|
10327
|
+
source_trace_id,
|
|
10328
|
+
edges,
|
|
10329
|
+
subcircuit_connectivity_map_key
|
|
10316
10330
|
});
|
|
10317
10331
|
}
|
|
10318
10332
|
const withCrossings = computeCrossings(
|
|
10319
|
-
pendingTraces.map((t) => ({
|
|
10333
|
+
pendingTraces.map((t) => ({
|
|
10334
|
+
source_trace_id: t.source_trace_id,
|
|
10335
|
+
edges: t.edges
|
|
10336
|
+
}))
|
|
10320
10337
|
);
|
|
10321
10338
|
const junctionsById = computeJunctions(withCrossings);
|
|
10322
10339
|
for (const t of withCrossings) {
|
|
10323
10340
|
db.schematic_trace.insert({
|
|
10324
|
-
source_trace_id: t.
|
|
10341
|
+
source_trace_id: t.source_trace_id,
|
|
10325
10342
|
edges: t.edges,
|
|
10326
|
-
junctions: junctionsById[t.
|
|
10343
|
+
junctions: junctionsById[t.source_trace_id] ?? [],
|
|
10344
|
+
subcircuit_connectivity_map_key: pendingTraces.find(
|
|
10345
|
+
(p) => p.source_trace_id === t.source_trace_id
|
|
10346
|
+
)?.subcircuit_connectivity_map_key
|
|
10327
10347
|
});
|
|
10328
10348
|
}
|
|
10329
10349
|
}
|
|
@@ -10566,7 +10586,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
10566
10586
|
group,
|
|
10567
10587
|
solver,
|
|
10568
10588
|
pinIdToSchematicPortId,
|
|
10569
|
-
|
|
10589
|
+
userNetIdToSck
|
|
10570
10590
|
});
|
|
10571
10591
|
applyNetLabelPlacements({
|
|
10572
10592
|
group,
|
|
@@ -12838,16 +12858,19 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
12838
12858
|
});
|
|
12839
12859
|
}
|
|
12840
12860
|
let source_trace_id;
|
|
12861
|
+
let subcircuit_connectivity_map_key;
|
|
12841
12862
|
if (net?.source_net_id && port.source_port_id) {
|
|
12842
12863
|
const st = db.source_trace.list().find(
|
|
12843
12864
|
(s) => s.connected_source_net_ids?.includes(net.source_net_id) && s.connected_source_port_ids?.includes(port.source_port_id)
|
|
12844
12865
|
);
|
|
12845
12866
|
source_trace_id = st?.source_trace_id;
|
|
12867
|
+
subcircuit_connectivity_map_key = st?.subcircuit_connectivity_map_key || db.source_net.get(net.source_net_id)?.subcircuit_connectivity_map_key;
|
|
12846
12868
|
}
|
|
12847
12869
|
db.schematic_trace.insert({
|
|
12848
12870
|
source_trace_id,
|
|
12849
12871
|
edges,
|
|
12850
|
-
junctions: []
|
|
12872
|
+
junctions: [],
|
|
12873
|
+
subcircuit_connectivity_map_key
|
|
12851
12874
|
});
|
|
12852
12875
|
db.schematic_port.update(port.schematic_port_id, { is_connected: true });
|
|
12853
12876
|
}
|
|
@@ -14027,7 +14050,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
14027
14050
|
var package_default = {
|
|
14028
14051
|
name: "@tscircuit/core",
|
|
14029
14052
|
type: "module",
|
|
14030
|
-
version: "0.0.
|
|
14053
|
+
version: "0.0.682",
|
|
14031
14054
|
types: "dist/index.d.ts",
|
|
14032
14055
|
main: "dist/index.js",
|
|
14033
14056
|
module: "dist/index.js",
|
|
@@ -14080,7 +14103,7 @@ var package_default = {
|
|
|
14080
14103
|
"bun-match-svg": "0.0.12",
|
|
14081
14104
|
"calculate-elbow": "^0.0.9",
|
|
14082
14105
|
"chokidar-cli": "^3.0.0",
|
|
14083
|
-
"circuit-json": "^0.0.
|
|
14106
|
+
"circuit-json": "^0.0.238",
|
|
14084
14107
|
"circuit-json-to-bpc": "^0.0.13",
|
|
14085
14108
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
14086
14109
|
"circuit-json-to-simple-3d": "^0.0.6",
|
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.683",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"bun-match-svg": "0.0.12",
|
|
55
55
|
"calculate-elbow": "^0.0.9",
|
|
56
56
|
"chokidar-cli": "^3.0.0",
|
|
57
|
-
"circuit-json": "^0.0.
|
|
57
|
+
"circuit-json": "^0.0.238",
|
|
58
58
|
"circuit-json-to-bpc": "^0.0.13",
|
|
59
59
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
60
60
|
"circuit-json-to-simple-3d": "^0.0.6",
|