@tscircuit/core 0.0.682 → 0.0.684
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 +72 -43
- 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) {
|
|
@@ -5741,6 +5743,7 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
5741
5743
|
}
|
|
5742
5744
|
|
|
5743
5745
|
// lib/components/primitive-components/Trace/Trace_doInitialPcbManualTraceRender.ts
|
|
5746
|
+
import { applyToPoint as applyToPoint6, identity as identity3 } from "transformation-matrix";
|
|
5744
5747
|
function Trace_doInitialPcbManualTraceRender(trace) {
|
|
5745
5748
|
if (trace.root?.pcbDisabled) return;
|
|
5746
5749
|
const { db } = trace.root;
|
|
@@ -5792,11 +5795,16 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
5792
5795
|
layer,
|
|
5793
5796
|
start_pcb_port_id: anchorPort.pcb_port_id
|
|
5794
5797
|
});
|
|
5798
|
+
const transform = anchorPort?._computePcbGlobalTransformBeforeLayout?.() || identity3();
|
|
5795
5799
|
for (const pt of props.pcbPath) {
|
|
5800
|
+
const transformed = applyToPoint6(transform, {
|
|
5801
|
+
x: pt.x,
|
|
5802
|
+
y: pt.y
|
|
5803
|
+
});
|
|
5796
5804
|
route.push({
|
|
5797
5805
|
route_type: "wire",
|
|
5798
|
-
x:
|
|
5799
|
-
y:
|
|
5806
|
+
x: transformed.x,
|
|
5807
|
+
y: transformed.y,
|
|
5800
5808
|
width,
|
|
5801
5809
|
layer
|
|
5802
5810
|
});
|
|
@@ -7357,7 +7365,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
7357
7365
|
|
|
7358
7366
|
// lib/components/normal-components/Board.ts
|
|
7359
7367
|
import { boardProps } from "@tscircuit/props";
|
|
7360
|
-
import { identity as
|
|
7368
|
+
import { identity as identity4 } from "transformation-matrix";
|
|
7361
7369
|
|
|
7362
7370
|
// lib/components/primitive-components/Group/Group.ts
|
|
7363
7371
|
import {
|
|
@@ -7519,7 +7527,7 @@ import "zod";
|
|
|
7519
7527
|
|
|
7520
7528
|
// lib/components/primitive-components/TraceHint.ts
|
|
7521
7529
|
import { traceHintProps } from "@tscircuit/props";
|
|
7522
|
-
import { applyToPoint as
|
|
7530
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
7523
7531
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
7524
7532
|
matchedPort = null;
|
|
7525
7533
|
get config() {
|
|
@@ -7559,7 +7567,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
7559
7567
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
7560
7568
|
return offsets.map(
|
|
7561
7569
|
(offset) => ({
|
|
7562
|
-
...
|
|
7570
|
+
...applyToPoint7(globalTransform, offset),
|
|
7563
7571
|
via: offset.via,
|
|
7564
7572
|
to_layer: offset.to_layer,
|
|
7565
7573
|
trace_width: offset.trace_width
|
|
@@ -10105,7 +10113,10 @@ function computeCrossings(traces, opts = {}) {
|
|
|
10105
10113
|
}
|
|
10106
10114
|
}
|
|
10107
10115
|
}
|
|
10108
|
-
const out = traces.map((t) => ({
|
|
10116
|
+
const out = traces.map((t) => ({
|
|
10117
|
+
source_trace_id: t.source_trace_id,
|
|
10118
|
+
edges: []
|
|
10119
|
+
}));
|
|
10109
10120
|
for (let ti = 0; ti < traces.length; ti++) {
|
|
10110
10121
|
const trace = traces[ti];
|
|
10111
10122
|
for (let ei = 0; ei < trace.edges.length; ei++) {
|
|
@@ -10206,7 +10217,7 @@ function getCornerOrientationAtPoint(trace, p, tol = TOL2) {
|
|
|
10206
10217
|
function computeJunctions(traces, opts = {}) {
|
|
10207
10218
|
const tol = opts.tolerance ?? TOL2;
|
|
10208
10219
|
const result = {};
|
|
10209
|
-
for (const t of traces) result[t.
|
|
10220
|
+
for (const t of traces) result[t.source_trace_id] = [];
|
|
10210
10221
|
const endpointsByTrace = traces.map((t) => {
|
|
10211
10222
|
const pts = [];
|
|
10212
10223
|
for (const e of t.edges) {
|
|
@@ -10232,8 +10243,9 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10232
10243
|
const bCorner = getCornerOrientationAtPoint(B, pb, tol);
|
|
10233
10244
|
const sameCornerOrientation = aCorner !== null && bCorner !== null && aCorner === bCorner;
|
|
10234
10245
|
if (hasCorner && !sameCornerOrientation) {
|
|
10235
|
-
result[A.
|
|
10236
|
-
if (A.
|
|
10246
|
+
result[A.source_trace_id].push(pa);
|
|
10247
|
+
if (A.source_trace_id !== B.source_trace_id)
|
|
10248
|
+
result[B.source_trace_id].push(pb);
|
|
10237
10249
|
}
|
|
10238
10250
|
}
|
|
10239
10251
|
}
|
|
@@ -10248,8 +10260,9 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10248
10260
|
const bCorner = bEndpointNearPa ? getCornerOrientationAtPoint(B, bEndpointNearPa, tol) : null;
|
|
10249
10261
|
const sameCornerOrientation = aCorner !== null && bCorner !== null && aCorner === bCorner;
|
|
10250
10262
|
if (hasCorner && !sameCornerOrientation) {
|
|
10251
|
-
result[A.
|
|
10252
|
-
if (A.
|
|
10263
|
+
result[A.source_trace_id].push(pa);
|
|
10264
|
+
if (A.source_trace_id !== B.source_trace_id)
|
|
10265
|
+
result[B.source_trace_id].push(pa);
|
|
10253
10266
|
}
|
|
10254
10267
|
}
|
|
10255
10268
|
}
|
|
@@ -10264,8 +10277,9 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10264
10277
|
const aCorner = aEndpointNearPb ? getCornerOrientationAtPoint(A, aEndpointNearPb, tol) : null;
|
|
10265
10278
|
const sameCornerOrientation = aCorner !== null && bCorner !== null && aCorner === bCorner;
|
|
10266
10279
|
if (hasCorner && !sameCornerOrientation) {
|
|
10267
|
-
result[B.
|
|
10268
|
-
if (A.
|
|
10280
|
+
result[B.source_trace_id].push(pb);
|
|
10281
|
+
if (A.source_trace_id !== B.source_trace_id)
|
|
10282
|
+
result[A.source_trace_id].push(pb);
|
|
10269
10283
|
}
|
|
10270
10284
|
}
|
|
10271
10285
|
}
|
|
@@ -10280,12 +10294,12 @@ function computeJunctions(traces, opts = {}) {
|
|
|
10280
10294
|
|
|
10281
10295
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyTracesFromSolverOutput.ts
|
|
10282
10296
|
function applyTracesFromSolverOutput(args) {
|
|
10283
|
-
const { group, solver, pinIdToSchematicPortId,
|
|
10297
|
+
const { group, solver, pinIdToSchematicPortId, userNetIdToSck } = args;
|
|
10284
10298
|
const { db } = group.root;
|
|
10285
10299
|
const correctedMap = solver.traceOverlapShiftSolver?.correctedTraceMap;
|
|
10286
10300
|
const pendingTraces = [];
|
|
10287
|
-
for (const
|
|
10288
|
-
const points =
|
|
10301
|
+
for (const solvedTracePath of Object.values(correctedMap ?? {})) {
|
|
10302
|
+
const points = solvedTracePath?.tracePath;
|
|
10289
10303
|
if (!Array.isArray(points) || points.length < 2) continue;
|
|
10290
10304
|
const edges = [];
|
|
10291
10305
|
for (let i = 0; i < points.length - 1; i++) {
|
|
@@ -10295,35 +10309,47 @@ function applyTracesFromSolverOutput(args) {
|
|
|
10295
10309
|
});
|
|
10296
10310
|
}
|
|
10297
10311
|
let source_trace_id = null;
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
const
|
|
10312
|
+
let subcircuit_connectivity_map_key;
|
|
10313
|
+
if (Array.isArray(solvedTracePath?.pins) && solvedTracePath.pins.length === 2) {
|
|
10314
|
+
const pA = pinIdToSchematicPortId.get(solvedTracePath.pins[0]?.pinId);
|
|
10315
|
+
const pB = pinIdToSchematicPortId.get(solvedTracePath.pins[1]?.pinId);
|
|
10301
10316
|
if (pA && pB) {
|
|
10302
|
-
const pairKey = [pA, pB].sort().join("::");
|
|
10303
|
-
source_trace_id = pairKeyToSourceTraceId.get(pairKey) || `solver_${solved.mspPairId || pairKey}`;
|
|
10304
10317
|
for (const schPid of [pA, pB]) {
|
|
10305
10318
|
const existing = db.schematic_port.get(schPid);
|
|
10306
10319
|
if (existing) db.schematic_port.update(schPid, { is_connected: true });
|
|
10307
10320
|
}
|
|
10321
|
+
subcircuit_connectivity_map_key = userNetIdToSck.get(
|
|
10322
|
+
String(solvedTracePath.userNetId)
|
|
10323
|
+
);
|
|
10308
10324
|
}
|
|
10309
10325
|
}
|
|
10310
10326
|
if (!source_trace_id) {
|
|
10311
|
-
source_trace_id = `solver_${
|
|
10327
|
+
source_trace_id = `solver_${solvedTracePath?.mspPairId}`;
|
|
10328
|
+
subcircuit_connectivity_map_key = userNetIdToSck.get(
|
|
10329
|
+
String(solvedTracePath.userNetId)
|
|
10330
|
+
);
|
|
10312
10331
|
}
|
|
10313
10332
|
pendingTraces.push({
|
|
10314
|
-
|
|
10315
|
-
edges
|
|
10333
|
+
source_trace_id,
|
|
10334
|
+
edges,
|
|
10335
|
+
subcircuit_connectivity_map_key
|
|
10316
10336
|
});
|
|
10317
10337
|
}
|
|
10318
10338
|
const withCrossings = computeCrossings(
|
|
10319
|
-
pendingTraces.map((t) => ({
|
|
10339
|
+
pendingTraces.map((t) => ({
|
|
10340
|
+
source_trace_id: t.source_trace_id,
|
|
10341
|
+
edges: t.edges
|
|
10342
|
+
}))
|
|
10320
10343
|
);
|
|
10321
10344
|
const junctionsById = computeJunctions(withCrossings);
|
|
10322
10345
|
for (const t of withCrossings) {
|
|
10323
10346
|
db.schematic_trace.insert({
|
|
10324
|
-
source_trace_id: t.
|
|
10347
|
+
source_trace_id: t.source_trace_id,
|
|
10325
10348
|
edges: t.edges,
|
|
10326
|
-
junctions: junctionsById[t.
|
|
10349
|
+
junctions: junctionsById[t.source_trace_id] ?? [],
|
|
10350
|
+
subcircuit_connectivity_map_key: pendingTraces.find(
|
|
10351
|
+
(p) => p.source_trace_id === t.source_trace_id
|
|
10352
|
+
)?.subcircuit_connectivity_map_key
|
|
10327
10353
|
});
|
|
10328
10354
|
}
|
|
10329
10355
|
}
|
|
@@ -10566,7 +10592,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
10566
10592
|
group,
|
|
10567
10593
|
solver,
|
|
10568
10594
|
pinIdToSchematicPortId,
|
|
10569
|
-
|
|
10595
|
+
userNetIdToSck
|
|
10570
10596
|
});
|
|
10571
10597
|
applyNetLabelPlacements({
|
|
10572
10598
|
group,
|
|
@@ -11514,7 +11540,7 @@ var Board = class extends Group6 {
|
|
|
11514
11540
|
this.pcb_board_id = null;
|
|
11515
11541
|
}
|
|
11516
11542
|
_computePcbGlobalTransformBeforeLayout() {
|
|
11517
|
-
return
|
|
11543
|
+
return identity4();
|
|
11518
11544
|
}
|
|
11519
11545
|
doInitialPcbDesignRuleChecks() {
|
|
11520
11546
|
if (this.root?.pcbDisabled) return;
|
|
@@ -12460,7 +12486,7 @@ var Constraint2 = class extends PrimitiveComponent2 {
|
|
|
12460
12486
|
|
|
12461
12487
|
// lib/components/primitive-components/FabricationNotePath.ts
|
|
12462
12488
|
import { fabricationNotePathProps } from "@tscircuit/props";
|
|
12463
|
-
import { applyToPoint as
|
|
12489
|
+
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
12464
12490
|
var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
12465
12491
|
fabrication_note_path_id = null;
|
|
12466
12492
|
get config() {
|
|
@@ -12487,7 +12513,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
12487
12513
|
layer,
|
|
12488
12514
|
color: props.color,
|
|
12489
12515
|
route: props.route.map((p) => {
|
|
12490
|
-
const transformedPosition =
|
|
12516
|
+
const transformedPosition = applyToPoint8(transform, {
|
|
12491
12517
|
x: p.x,
|
|
12492
12518
|
y: p.y
|
|
12493
12519
|
});
|
|
@@ -12661,8 +12687,8 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
12661
12687
|
// lib/components/primitive-components/NetLabel.ts
|
|
12662
12688
|
import { netLabelProps } from "@tscircuit/props";
|
|
12663
12689
|
import {
|
|
12664
|
-
applyToPoint as
|
|
12665
|
-
identity as
|
|
12690
|
+
applyToPoint as applyToPoint9,
|
|
12691
|
+
identity as identity5,
|
|
12666
12692
|
translate as translate6
|
|
12667
12693
|
} from "transformation-matrix";
|
|
12668
12694
|
import { calculateElbow as calculateElbow2 } from "calculate-elbow";
|
|
@@ -12712,8 +12738,8 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
12712
12738
|
const connectedPorts = this._getConnectedPorts();
|
|
12713
12739
|
if (connectedPorts.length > 0) {
|
|
12714
12740
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
12715
|
-
const parentCenter =
|
|
12716
|
-
this.parent?.computeSchematicGlobalTransform?.() ??
|
|
12741
|
+
const parentCenter = applyToPoint9(
|
|
12742
|
+
this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
|
|
12717
12743
|
{ x: 0, y: 0 }
|
|
12718
12744
|
);
|
|
12719
12745
|
return translate6(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
@@ -12838,16 +12864,19 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
12838
12864
|
});
|
|
12839
12865
|
}
|
|
12840
12866
|
let source_trace_id;
|
|
12867
|
+
let subcircuit_connectivity_map_key;
|
|
12841
12868
|
if (net?.source_net_id && port.source_port_id) {
|
|
12842
12869
|
const st = db.source_trace.list().find(
|
|
12843
12870
|
(s) => s.connected_source_net_ids?.includes(net.source_net_id) && s.connected_source_port_ids?.includes(port.source_port_id)
|
|
12844
12871
|
);
|
|
12845
12872
|
source_trace_id = st?.source_trace_id;
|
|
12873
|
+
subcircuit_connectivity_map_key = st?.subcircuit_connectivity_map_key || db.source_net.get(net.source_net_id)?.subcircuit_connectivity_map_key;
|
|
12846
12874
|
}
|
|
12847
12875
|
db.schematic_trace.insert({
|
|
12848
12876
|
source_trace_id,
|
|
12849
12877
|
edges,
|
|
12850
|
-
junctions: []
|
|
12878
|
+
junctions: [],
|
|
12879
|
+
subcircuit_connectivity_map_key
|
|
12851
12880
|
});
|
|
12852
12881
|
db.schematic_port.update(port.schematic_port_id, { is_connected: true });
|
|
12853
12882
|
}
|
|
@@ -14021,13 +14050,13 @@ var SchematicCell = class extends PrimitiveComponent2 {
|
|
|
14021
14050
|
// lib/RootCircuit.ts
|
|
14022
14051
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
14023
14052
|
import { isValidElement as isValidElement2 } from "react";
|
|
14024
|
-
import { identity as
|
|
14053
|
+
import { identity as identity6 } from "transformation-matrix";
|
|
14025
14054
|
|
|
14026
14055
|
// package.json
|
|
14027
14056
|
var package_default = {
|
|
14028
14057
|
name: "@tscircuit/core",
|
|
14029
14058
|
type: "module",
|
|
14030
|
-
version: "0.0.
|
|
14059
|
+
version: "0.0.683",
|
|
14031
14060
|
types: "dist/index.d.ts",
|
|
14032
14061
|
main: "dist/index.js",
|
|
14033
14062
|
module: "dist/index.js",
|
|
@@ -14080,7 +14109,7 @@ var package_default = {
|
|
|
14080
14109
|
"bun-match-svg": "0.0.12",
|
|
14081
14110
|
"calculate-elbow": "^0.0.9",
|
|
14082
14111
|
"chokidar-cli": "^3.0.0",
|
|
14083
|
-
"circuit-json": "^0.0.
|
|
14112
|
+
"circuit-json": "^0.0.238",
|
|
14084
14113
|
"circuit-json-to-bpc": "^0.0.13",
|
|
14085
14114
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
14086
14115
|
"circuit-json-to-simple-3d": "^0.0.6",
|
|
@@ -14269,10 +14298,10 @@ var RootCircuit = class {
|
|
|
14269
14298
|
throw new Error("project.preview is not yet implemented");
|
|
14270
14299
|
}
|
|
14271
14300
|
computeSchematicGlobalTransform() {
|
|
14272
|
-
return
|
|
14301
|
+
return identity6();
|
|
14273
14302
|
}
|
|
14274
14303
|
_computePcbGlobalTransformBeforeLayout() {
|
|
14275
|
-
return
|
|
14304
|
+
return identity6();
|
|
14276
14305
|
}
|
|
14277
14306
|
selectAll(selector) {
|
|
14278
14307
|
this._guessRootComponent();
|
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.684",
|
|
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",
|