@tscircuit/core 0.0.1013 → 0.0.1014

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.
Files changed (2) hide show
  1. package/dist/index.js +34 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7546,7 +7546,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
7546
7546
  layer: currentLayer,
7547
7547
  start_pcb_port_id: anchorPort.pcb_port_id
7548
7548
  });
7549
- const transform = anchorPort?._computePcbGlobalTransformBeforeLayout?.() || identity3();
7549
+ const transform = subcircuit._isInflatedFromCircuitJson ? trace._computePcbGlobalTransformBeforeLayout() : anchorPort?._computePcbGlobalTransformBeforeLayout?.() || identity3();
7550
7550
  const pcbPath = props.pcbPath;
7551
7551
  for (const pt of pcbPath) {
7552
7552
  let coordinates;
@@ -16190,6 +16190,25 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
16190
16190
  }
16191
16191
  }
16192
16192
 
16193
+ // lib/utils/pcbTraceRouteToPcbPath.ts
16194
+ function pcbTraceRouteToPcbPath(route) {
16195
+ if (route.length <= 2) {
16196
+ return [];
16197
+ }
16198
+ return route.slice(1, -1).map((point6) => {
16199
+ if (point6.route_type === "via") {
16200
+ return {
16201
+ x: point6.x,
16202
+ y: point6.y,
16203
+ via: true,
16204
+ fromLayer: point6.from_layer,
16205
+ toLayer: point6.to_layer
16206
+ };
16207
+ }
16208
+ return { x: point6.x, y: point6.y };
16209
+ });
16210
+ }
16211
+
16193
16212
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceTrace.ts
16194
16213
  var getSelectorPath = (component, inflatorContext) => {
16195
16214
  const { injectionDb, subcircuit, groupsMap } = inflatorContext;
@@ -16245,9 +16264,20 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
16245
16264
  if (connectedSelectors.length < 2) {
16246
16265
  return;
16247
16266
  }
16248
- const trace = new Trace3({
16249
- path: connectedSelectors
16267
+ const pcbTrace = injectionDb.pcb_trace.getWhere({
16268
+ source_trace_id: sourceTrace.source_trace_id
16250
16269
  });
16270
+ let pcbPath;
16271
+ if (pcbTrace) {
16272
+ pcbPath = pcbTraceRouteToPcbPath(pcbTrace.route);
16273
+ }
16274
+ const traceProps2 = {
16275
+ path: connectedSelectors
16276
+ };
16277
+ if (pcbPath && pcbPath.length > 0) {
16278
+ traceProps2.pcbPath = pcbPath;
16279
+ }
16280
+ const trace = new Trace3(traceProps2);
16251
16281
  trace.source_trace_id = sourceTrace.source_trace_id;
16252
16282
  subcircuit.add(trace);
16253
16283
  }
@@ -22063,7 +22093,7 @@ import { identity as identity5 } from "transformation-matrix";
22063
22093
  var package_default = {
22064
22094
  name: "@tscircuit/core",
22065
22095
  type: "module",
22066
- version: "0.0.1012",
22096
+ version: "0.0.1013",
22067
22097
  types: "dist/index.d.ts",
22068
22098
  main: "dist/index.js",
22069
22099
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1013",
4
+ "version": "0.0.1014",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",