@tscircuit/core 0.0.828 → 0.0.830

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 CHANGED
@@ -1040,6 +1040,11 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
1040
1040
  doInitialSourceParentAttachment(): void;
1041
1041
  doInitialPcbPortRender(): void;
1042
1042
  updatePcbPortRender(): void;
1043
+ /**
1044
+ * Get the best display label for this port based on port_hints
1045
+ * Filters out generic patterns and applies showPinAliases logic
1046
+ */
1047
+ _getBestDisplayPinLabel(): string | undefined;
1043
1048
  doInitialSchematicPortRender(): void;
1044
1049
  _getSubcircuitConnectivityKey(): string | undefined;
1045
1050
  _setPositionFromLayout(newCenter: {
@@ -1189,6 +1194,10 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1189
1194
  * appear on a schematic box, e.g. for a pin header
1190
1195
  */
1191
1196
  _getSchematicPortArrangement(): SchematicPortArrangement | null;
1197
+ /**
1198
+ * Extract pin labels from ports using existing Port logic
1199
+ */
1200
+ _getPinLabelsFromPorts(): Record<string, string>;
1192
1201
  _getSchematicBoxDimensions(): SchematicBoxDimensions | null;
1193
1202
  getFootprinterString(): string | null;
1194
1203
  doInitialCadModelRender(): void;
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ __export(components_exports, {
86
86
  // lib/components/base-components/NormalComponent/NormalComponent.ts
87
87
  import { fp } from "@tscircuit/footprinter";
88
88
  import {
89
- distance as distance4,
89
+ distance as distance5,
90
90
  pcb_manual_edit_conflict_warning,
91
91
  pcb_component_invalid_layer_error,
92
92
  point3 as point32,
@@ -1844,7 +1844,10 @@ var createNetsFromProps = (component, props) => {
1844
1844
 
1845
1845
  // lib/components/primitive-components/SmtPad.ts
1846
1846
  import { smtPadProps } from "@tscircuit/props";
1847
- import { decomposeTSR } from "transformation-matrix";
1847
+ import {
1848
+ distance
1849
+ } from "circuit-json";
1850
+ import { applyToPoint as applyToPoint2, decomposeTSR } from "transformation-matrix";
1848
1851
  var SmtPad = class extends PrimitiveComponent2 {
1849
1852
  pcb_smtpad_id = null;
1850
1853
  matchedPort = null;
@@ -1913,6 +1916,7 @@ var SmtPad = class extends PrimitiveComponent2 {
1913
1916
  if (!props.portHints) return;
1914
1917
  const subcircuit = this.getSubcircuit();
1915
1918
  const position = this._getGlobalPcbPositionBeforeLayout();
1919
+ const globalTransform = this._computePcbGlobalTransformBeforeLayout();
1916
1920
  const decomposedTransform = decomposeTSR(
1917
1921
  this._computePcbGlobalTransformBeforeLayout()
1918
1922
  );
@@ -2056,16 +2060,23 @@ var SmtPad = class extends PrimitiveComponent2 {
2056
2060
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
2057
2061
  });
2058
2062
  } else if (props.shape === "polygon") {
2063
+ const transformedPoints = props.points.map((point) => {
2064
+ const transformed = applyToPoint2(globalTransform, {
2065
+ x: distance.parse(point.x),
2066
+ y: distance.parse(point.y)
2067
+ });
2068
+ return {
2069
+ x: transformed.x,
2070
+ y: transformed.y
2071
+ };
2072
+ });
2059
2073
  pcb_smtpad = db.pcb_smtpad.insert({
2060
2074
  pcb_component_id,
2061
2075
  pcb_port_id: this.matchedPort?.pcb_port_id,
2062
2076
  // port likely isn't matched
2063
2077
  layer: maybeFlipLayer(props.layer ?? "top"),
2064
2078
  shape: "polygon",
2065
- points: props.points.map((p) => ({
2066
- x: p.x + position.x,
2067
- y: p.y + position.y
2068
- })),
2079
+ points: transformedPoints,
2069
2080
  port_hints: props.portHints.map((ph) => ph.toString()),
2070
2081
  is_covered_with_solder_mask: isCoveredWithSolderMask,
2071
2082
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
@@ -2207,7 +2218,7 @@ var SmtPad = class extends PrimitiveComponent2 {
2207
2218
 
2208
2219
  // lib/components/primitive-components/SilkscreenPath.ts
2209
2220
  import { silkscreenPathProps } from "@tscircuit/props";
2210
- import { applyToPoint as applyToPoint2 } from "transformation-matrix";
2221
+ import { applyToPoint as applyToPoint3 } from "transformation-matrix";
2211
2222
  var SilkscreenPath = class extends PrimitiveComponent2 {
2212
2223
  pcb_silkscreen_path_id = null;
2213
2224
  isPcbPrimitive = true;
@@ -2235,7 +2246,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
2235
2246
  pcb_component_id,
2236
2247
  layer,
2237
2248
  route: props.route.map((p) => {
2238
- const transformedPosition = applyToPoint2(transform, {
2249
+ const transformedPosition = applyToPoint3(transform, {
2239
2250
  x: p.x,
2240
2251
  y: p.y
2241
2252
  });
@@ -2297,7 +2308,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
2297
2308
  // lib/components/primitive-components/PcbTrace.ts
2298
2309
  import { z as z5 } from "zod";
2299
2310
  import { pcb_trace_route_point } from "circuit-json";
2300
- import { applyToPoint as applyToPoint3 } from "transformation-matrix";
2311
+ import { applyToPoint as applyToPoint4 } from "transformation-matrix";
2301
2312
  var pcbTraceProps = z5.object({
2302
2313
  route: z5.array(pcb_trace_route_point),
2303
2314
  // If this primitive PcbTrace needs to be associated with a source_trace_id
@@ -2323,7 +2334,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
2323
2334
  const parentTransform = this._computePcbGlobalTransformBeforeLayout();
2324
2335
  const transformedRoute = props.route.map((point) => {
2325
2336
  const { x, y, ...restOfPoint } = point;
2326
- const transformedPoint = applyToPoint3(parentTransform, { x, y });
2337
+ const transformedPoint = applyToPoint4(parentTransform, { x, y });
2327
2338
  if (point.route_type === "wire" && point.layer) {
2328
2339
  return {
2329
2340
  ...transformedPoint,
@@ -2810,7 +2821,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
2810
2821
  };
2811
2822
 
2812
2823
  // lib/components/primitive-components/Cutout.ts
2813
- import { applyToPoint as applyToPoint4 } from "transformation-matrix";
2824
+ import { applyToPoint as applyToPoint5 } from "transformation-matrix";
2814
2825
  import { cutoutProps } from "@tscircuit/props";
2815
2826
  var Cutout = class extends PrimitiveComponent2 {
2816
2827
  pcb_cutout_id = null;
@@ -2855,7 +2866,7 @@ var Cutout = class extends PrimitiveComponent2 {
2855
2866
  } else if (props.shape === "polygon") {
2856
2867
  const transform = this._computePcbGlobalTransformBeforeLayout();
2857
2868
  const transformedPoints = props.points.map(
2858
- (p) => applyToPoint4(transform, p)
2869
+ (p) => applyToPoint5(transform, p)
2859
2870
  );
2860
2871
  const polygonData = {
2861
2872
  shape: "polygon",
@@ -3411,7 +3422,7 @@ function getRelativeDirection(pointA, pointB) {
3411
3422
 
3412
3423
  // lib/components/primitive-components/Port/Port.ts
3413
3424
  import "schematic-symbols";
3414
- import { applyToPoint as applyToPoint5, compose as compose3, translate as translate3 } from "transformation-matrix";
3425
+ import { applyToPoint as applyToPoint6, compose as compose3, translate as translate3 } from "transformation-matrix";
3415
3426
  import { z as z6 } from "zod";
3416
3427
 
3417
3428
  // lib/components/primitive-components/Port/areAllPcbPrimitivesOverlapping.ts
@@ -3610,7 +3621,7 @@ var Port = class extends PrimitiveComponent2 {
3610
3621
  parentNormalComponent.computeSchematicGlobalTransform(),
3611
3622
  translate3(-symbol.center.x, -symbol.center.y)
3612
3623
  );
3613
- return applyToPoint5(transform, schematicSymbolPortDef);
3624
+ return applyToPoint6(transform, schematicSymbolPortDef);
3614
3625
  }
3615
3626
  const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
3616
3627
  if (parentBoxDim && this.props.pinNumber !== void 0) {
@@ -3622,7 +3633,7 @@ var Port = class extends PrimitiveComponent2 {
3622
3633
  `Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`
3623
3634
  );
3624
3635
  }
3625
- return applyToPoint5(
3636
+ return applyToPoint6(
3626
3637
  parentNormalComponent.computeSchematicGlobalTransform(),
3627
3638
  localPortPosition
3628
3639
  );
@@ -3818,6 +3829,29 @@ var Port = class extends PrimitiveComponent2 {
3818
3829
  });
3819
3830
  this.pcb_port_id = pcb_port.pcb_port_id;
3820
3831
  }
3832
+ /**
3833
+ * Get the best display label for this port based on port_hints
3834
+ * Filters out generic patterns and applies showPinAliases logic
3835
+ */
3836
+ _getBestDisplayPinLabel() {
3837
+ const { db } = this.root;
3838
+ const sourcePort = db.source_port.get(this.source_port_id);
3839
+ const labelHints = [];
3840
+ for (const portHint of sourcePort?.port_hints ?? []) {
3841
+ if (portHint.match(/^(pin)?\d+$/)) continue;
3842
+ if (portHint.match(/^(left|right)/) && !sourcePort?.name.match(/^(left|right)/))
3843
+ continue;
3844
+ labelHints.push(portHint);
3845
+ }
3846
+ const parentNormalComponent = this.getParentNormalComponent();
3847
+ const showPinAliases = parentNormalComponent?.props?.showPinAliases;
3848
+ if (showPinAliases && labelHints.length > 0) {
3849
+ return labelHints.join("/");
3850
+ } else if (labelHints.length > 0) {
3851
+ return labelHints[0];
3852
+ }
3853
+ return void 0;
3854
+ }
3821
3855
  doInitialSchematicPortRender() {
3822
3856
  const { db } = this.root;
3823
3857
  const { _parsedProps: props } = this;
@@ -3853,22 +3887,8 @@ var Port = class extends PrimitiveComponent2 {
3853
3887
  bottom: "down"
3854
3888
  }[localPortInfo.side];
3855
3889
  }
3856
- const sourcePort = db.source_port.get(this.source_port_id);
3857
- const labelHints = [];
3858
- for (const portHint of sourcePort?.port_hints ?? []) {
3859
- if (portHint.match(/^(pin)?\d+$/)) continue;
3860
- if (portHint.match(/^(left|right)/) && !sourcePort?.name.match(/^(left|right)/))
3861
- continue;
3862
- labelHints.push(portHint);
3863
- }
3864
- let bestDisplayPinLabel = void 0;
3890
+ const bestDisplayPinLabel = this._getBestDisplayPinLabel();
3865
3891
  const parentNormalComponent = this.getParentNormalComponent();
3866
- const showPinAliases = parentNormalComponent?.props?.showPinAliases;
3867
- if (showPinAliases && labelHints.length > 0) {
3868
- bestDisplayPinLabel = labelHints.join("/");
3869
- } else if (labelHints.length > 0) {
3870
- bestDisplayPinLabel = labelHints[0];
3871
- }
3872
3892
  const schematicPortInsertProps = {
3873
3893
  type: "schematic_port",
3874
3894
  schematic_component_id: parentNormalComponent?.schematic_component_id,
@@ -3969,6 +3989,7 @@ var getSizeOfSidesFromPortArrangement = (pa) => {
3969
3989
  };
3970
3990
 
3971
3991
  // lib/utils/schematic/getAllDimensionsForSchematicBox.ts
3992
+ var DEFAULT_SCHEMATIC_BOX_PADDING_MM = 0.4;
3972
3993
  function isExplicitPinMappingArrangement(arrangement) {
3973
3994
  const a = arrangement;
3974
3995
  return a.leftSide !== void 0 || a.rightSide !== void 0 || a.topSide !== void 0 || a.bottomSide !== void 0;
@@ -4146,12 +4167,24 @@ var getAllDimensionsForSchematicBox = (params) => {
4146
4167
  }
4147
4168
  truePinIndex++;
4148
4169
  }
4149
- let schWidth = params.schWidth;
4150
- if (schWidth === void 0) {
4151
- schWidth = Math.max(
4152
- sideLengths.top + params.schPinSpacing * 2,
4153
- sideLengths.bottom + params.schPinSpacing * 2
4170
+ let resolvedSchWidth = params.schWidth;
4171
+ if (resolvedSchWidth === void 0) {
4172
+ resolvedSchWidth = Math.max(
4173
+ sideLengths.top + DEFAULT_SCHEMATIC_BOX_PADDING_MM,
4174
+ sideLengths.bottom + DEFAULT_SCHEMATIC_BOX_PADDING_MM
4154
4175
  );
4176
+ if (params.pinLabels) {
4177
+ const leftRightPins = orderedTruePorts.filter(
4178
+ (p) => p.side === "left" || p.side === "right"
4179
+ );
4180
+ const hasLeftRightLabels = leftRightPins.some(
4181
+ (p) => params.pinLabels?.[`pin${p.pinNumber}`] || params.pinLabels?.[p.pinNumber]
4182
+ );
4183
+ if (hasLeftRightLabels) {
4184
+ const MIN_WIDTH_FOR_SIDE_PINS = 0.5;
4185
+ resolvedSchWidth = Math.max(resolvedSchWidth, MIN_WIDTH_FOR_SIDE_PINS);
4186
+ }
4187
+ }
4155
4188
  const labelWidth = params.pinLabels ? Math.max(
4156
4189
  ...Object.values(params.pinLabels).map(
4157
4190
  (label) => label.length * 0.1
@@ -4159,19 +4192,19 @@ var getAllDimensionsForSchematicBox = (params) => {
4159
4192
  )
4160
4193
  ) : 0;
4161
4194
  const LABEL_PADDING = labelWidth > 0 ? 1.1 : 0;
4162
- schWidth = Math.max(schWidth, labelWidth + LABEL_PADDING);
4195
+ resolvedSchWidth = Math.max(resolvedSchWidth, labelWidth + LABEL_PADDING);
4163
4196
  }
4164
4197
  let schHeight = params.schHeight;
4165
4198
  if (!schHeight) {
4166
4199
  schHeight = Math.max(
4167
- sideLengths.left + params.schPinSpacing * 2,
4168
- sideLengths.right + params.schPinSpacing * 2
4200
+ sideLengths.left + DEFAULT_SCHEMATIC_BOX_PADDING_MM,
4201
+ sideLengths.right + DEFAULT_SCHEMATIC_BOX_PADDING_MM
4169
4202
  );
4170
4203
  }
4171
4204
  const trueEdgePositions = {
4172
4205
  // Top left corner
4173
4206
  left: {
4174
- x: -schWidth / 2 - portDistanceFromEdge,
4207
+ x: -resolvedSchWidth / 2 - portDistanceFromEdge,
4175
4208
  y: sideLengths.left / 2
4176
4209
  },
4177
4210
  // bottom left corner
@@ -4181,7 +4214,7 @@ var getAllDimensionsForSchematicBox = (params) => {
4181
4214
  },
4182
4215
  // bottom right corner
4183
4216
  right: {
4184
- x: schWidth / 2 + portDistanceFromEdge,
4217
+ x: resolvedSchWidth / 2 + portDistanceFromEdge,
4185
4218
  y: -sideLengths.right / 2
4186
4219
  },
4187
4220
  // top right corner
@@ -4217,11 +4250,11 @@ var getAllDimensionsForSchematicBox = (params) => {
4217
4250
  return port;
4218
4251
  },
4219
4252
  getSize() {
4220
- return { width: schWidth, height: schHeight };
4253
+ return { width: resolvedSchWidth, height: schHeight };
4221
4254
  },
4222
4255
  getSizeIncludingPins() {
4223
4256
  return {
4224
- width: schWidth + (sidePinCounts.leftSize || sidePinCounts.rightSize ? 0.4 : 0),
4257
+ width: resolvedSchWidth + (sidePinCounts.leftSize || sidePinCounts.rightSize ? 0.4 : 0),
4225
4258
  height: schHeight + (sidePinCounts.topSize || sidePinCounts.bottomSize ? 0.4 : 0)
4226
4259
  };
4227
4260
  },
@@ -4450,7 +4483,7 @@ var Footprint = class extends PrimitiveComponent2 {
4450
4483
  // lib/components/primitive-components/CadModel.ts
4451
4484
  import { cadmodelProps, point3 } from "@tscircuit/props";
4452
4485
  import { z as z7 } from "zod";
4453
- import { distance } from "circuit-json";
4486
+ import { distance as distance2 } from "circuit-json";
4454
4487
  import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
4455
4488
 
4456
4489
  // lib/components/base-components/NormalComponent/utils/getFileExtension.ts
@@ -4527,7 +4560,7 @@ var CadModel = class extends PrimitiveComponent2 {
4527
4560
  z: props.pcbZ ?? 0,
4528
4561
  ...typeof props.positionOffset === "object" ? props.positionOffset : {}
4529
4562
  });
4530
- const zOffsetFromSurface = props.zOffsetFromSurface !== void 0 ? distance.parse(props.zOffsetFromSurface) : 0;
4563
+ const zOffsetFromSurface = props.zOffsetFromSurface !== void 0 ? distance2.parse(props.zOffsetFromSurface) : 0;
4531
4564
  const layer = parent.props.layer === "bottom" ? "bottom" : "top";
4532
4565
  const ext = props.modelUrl ? getFileExtension(props.modelUrl) : void 0;
4533
4566
  const urlProps = {};
@@ -4840,7 +4873,7 @@ var getEnteringEdgeFromDirection = (direction) => {
4840
4873
  };
4841
4874
 
4842
4875
  // lib/utils/schematic/getStubEdges.ts
4843
- import { distance as distance2 } from "@tscircuit/math-utils";
4876
+ import { distance as distance3 } from "@tscircuit/math-utils";
4844
4877
  var getStubEdges = ({
4845
4878
  firstEdge,
4846
4879
  firstEdgePort,
@@ -4887,7 +4920,7 @@ var getStubEdges = ({
4887
4920
  });
4888
4921
  }
4889
4922
  }
4890
- edges = edges.filter((e) => distance2(e.from, e.to) > 0.01);
4923
+ edges = edges.filter((e) => distance3(e.from, e.to) > 0.01);
4891
4924
  return edges;
4892
4925
  };
4893
4926
 
@@ -5390,7 +5423,7 @@ import { calculateElbow } from "calculate-elbow";
5390
5423
  import { doesLineIntersectLine as doesLineIntersectLine3 } from "@tscircuit/math-utils";
5391
5424
 
5392
5425
  // lib/components/primitive-components/Trace/trace-utils/create-schematic-trace-crossing-segments.ts
5393
- import { distance as distance3, doesLineIntersectLine } from "@tscircuit/math-utils";
5426
+ import { distance as distance4, doesLineIntersectLine } from "@tscircuit/math-utils";
5394
5427
 
5395
5428
  // lib/components/primitive-components/Trace/trace-utils/get-other-schematic-traces.ts
5396
5429
  var getOtherSchematicTraces = ({
@@ -5457,7 +5490,7 @@ var createSchematicTraceCrossingSegments = ({
5457
5490
  otherEdgesIntersections.push({
5458
5491
  otherEdge,
5459
5492
  crossingPoint: crossingPoint2,
5460
- distanceFromEdgeFrom: distance3(edge.from, crossingPoint2)
5493
+ distanceFromEdgeFrom: distance4(edge.from, crossingPoint2)
5461
5494
  });
5462
5495
  }
5463
5496
  }
@@ -5482,7 +5515,7 @@ var createSchematicTraceCrossingSegments = ({
5482
5515
  x: crossingPoint.x + crossingUnitVec.x * crossingSegmentLength / 2,
5483
5516
  y: crossingPoint.y + crossingUnitVec.y * crossingSegmentLength / 2
5484
5517
  };
5485
- const overshot = distance3(afterCrossing, edge.to) < crossingSegmentLength;
5518
+ const overshot = distance4(afterCrossing, edge.to) < crossingSegmentLength;
5486
5519
  const newEdges = [
5487
5520
  { from: edge.from, to: beforeCrossing },
5488
5521
  { from: beforeCrossing, to: afterCrossing, is_crossing: true },
@@ -6411,7 +6444,7 @@ function Trace_doInitialPcbTraceRender(trace) {
6411
6444
  }
6412
6445
 
6413
6446
  // lib/components/primitive-components/Trace/Trace_doInitialPcbManualTraceRender.ts
6414
- import { applyToPoint as applyToPoint6, identity as identity3 } from "transformation-matrix";
6447
+ import { applyToPoint as applyToPoint7, identity as identity3 } from "transformation-matrix";
6415
6448
  function Trace_doInitialPcbManualTraceRender(trace) {
6416
6449
  if (trace.root?.pcbDisabled) return;
6417
6450
  const { db } = trace.root;
@@ -6489,7 +6522,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
6489
6522
  coordinates = { x: pt.x, y: pt.y };
6490
6523
  isGlobalPosition = false;
6491
6524
  }
6492
- const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint6(transform, coordinates);
6525
+ const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint7(transform, coordinates);
6493
6526
  route.push({
6494
6527
  route_type: "wire",
6495
6528
  x: finalCoordinates.x,
@@ -8394,23 +8427,45 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8394
8427
  _getSchematicPortArrangement() {
8395
8428
  return this._parsedProps.schPinArrangement ?? this._parsedProps.schPortArrangement;
8396
8429
  }
8430
+ /**
8431
+ * Extract pin labels from ports using existing Port logic
8432
+ */
8433
+ _getPinLabelsFromPorts() {
8434
+ const ports = this.selectAll("port");
8435
+ const pinLabels = {};
8436
+ for (const port of ports) {
8437
+ const pinNumber = port.props.pinNumber;
8438
+ if (pinNumber !== void 0) {
8439
+ const bestLabel = port._getBestDisplayPinLabel();
8440
+ if (bestLabel) {
8441
+ pinLabels[`pin${pinNumber}`] = bestLabel;
8442
+ }
8443
+ }
8444
+ }
8445
+ return pinLabels;
8446
+ }
8397
8447
  _getSchematicBoxDimensions() {
8398
8448
  if (this.getSchematicSymbol()) return null;
8399
8449
  if (!this.config.shouldRenderAsSchematicBox) return null;
8400
8450
  const { _parsedProps: props } = this;
8401
8451
  const pinCount = this._getPinCount();
8402
8452
  const pinSpacing = props.schPinSpacing ?? 0.2;
8453
+ const pinLabelsFromPorts = this._getPinLabelsFromPorts();
8454
+ const allPinLabels = {
8455
+ ...pinLabelsFromPorts,
8456
+ ...props.pinLabels
8457
+ };
8403
8458
  const dimensions = getAllDimensionsForSchematicBox({
8404
8459
  schWidth: props.schWidth,
8405
8460
  schHeight: props.schHeight,
8406
8461
  schPinSpacing: pinSpacing,
8407
8462
  numericSchPinStyle: getNumericSchPinStyle(
8408
8463
  props.schPinStyle,
8409
- props.pinLabels
8464
+ allPinLabels
8410
8465
  ),
8411
8466
  pinCount,
8412
8467
  schPortArrangement: this._getSchematicPortArrangement(),
8413
- pinLabels: props.pinLabels
8468
+ pinLabels: allPinLabels
8414
8469
  });
8415
8470
  return dimensions;
8416
8471
  }
@@ -8447,7 +8502,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8447
8502
  z: 0,
8448
8503
  ...typeof cadModel?.positionOffset === "object" ? cadModel.positionOffset : {}
8449
8504
  });
8450
- const zOffsetFromSurface = cadModel && typeof cadModel === "object" && "zOffsetFromSurface" in cadModel ? cadModel.zOffsetFromSurface !== void 0 ? distance4.parse(
8505
+ const zOffsetFromSurface = cadModel && typeof cadModel === "object" && "zOffsetFromSurface" in cadModel ? cadModel.zOffsetFromSurface !== void 0 ? distance5.parse(
8451
8506
  cadModel.zOffsetFromSurface
8452
8507
  ) : 0 : 0;
8453
8508
  const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
@@ -8861,14 +8916,14 @@ var CapacityMeshAutorouter = class {
8861
8916
 
8862
8917
  // lib/components/primitive-components/Group/Group.ts
8863
8918
  import {
8864
- distance as distance5
8919
+ distance as distance6
8865
8920
  } from "circuit-json";
8866
8921
  import Debug13 from "debug";
8867
8922
  import "zod";
8868
8923
 
8869
8924
  // lib/components/primitive-components/TraceHint.ts
8870
8925
  import { traceHintProps } from "@tscircuit/props";
8871
- import { applyToPoint as applyToPoint7 } from "transformation-matrix";
8926
+ import { applyToPoint as applyToPoint8 } from "transformation-matrix";
8872
8927
  var TraceHint = class extends PrimitiveComponent2 {
8873
8928
  matchedPort = null;
8874
8929
  get config() {
@@ -8908,7 +8963,7 @@ var TraceHint = class extends PrimitiveComponent2 {
8908
8963
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
8909
8964
  return offsets.map(
8910
8965
  (offset) => ({
8911
- ...applyToPoint7(globalTransform, offset),
8966
+ ...applyToPoint8(globalTransform, offset),
8912
8967
  via: offset.via,
8913
8968
  to_layer: offset.to_layer,
8914
8969
  trace_width: offset.trace_width
@@ -12793,8 +12848,8 @@ var Group6 = class extends NormalComponent3 {
12793
12848
  const groupProps2 = props;
12794
12849
  const hasOutline = groupProps2.outline && groupProps2.outline.length > 0;
12795
12850
  const numericOutline = hasOutline ? groupProps2.outline.map((point) => ({
12796
- x: distance5.parse(point.x),
12797
- y: distance5.parse(point.y)
12851
+ x: distance6.parse(point.x),
12852
+ y: distance6.parse(point.y)
12798
12853
  })) : void 0;
12799
12854
  const pcb_group = db.pcb_group.insert({
12800
12855
  is_subcircuit: this.isSubcircuit,
@@ -12824,8 +12879,8 @@ var Group6 = class extends NormalComponent3 {
12824
12879
  const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
12825
12880
  if (hasOutline) {
12826
12881
  const numericOutline = props.outline.map((point) => ({
12827
- x: distance5.parse(point.x),
12828
- y: distance5.parse(point.y)
12882
+ x: distance6.parse(point.x),
12883
+ y: distance6.parse(point.y)
12829
12884
  }));
12830
12885
  const outlineBounds = getBoundsFromPoints3(numericOutline);
12831
12886
  if (!outlineBounds) return;
@@ -14895,7 +14950,7 @@ var FabricationNoteRect = class extends PrimitiveComponent2 {
14895
14950
 
14896
14951
  // lib/components/primitive-components/FabricationNotePath.ts
14897
14952
  import { fabricationNotePathProps } from "@tscircuit/props";
14898
- import { applyToPoint as applyToPoint9 } from "transformation-matrix";
14953
+ import { applyToPoint as applyToPoint10 } from "transformation-matrix";
14899
14954
  var FabricationNotePath = class extends PrimitiveComponent2 {
14900
14955
  fabrication_note_path_id = null;
14901
14956
  get config() {
@@ -14922,7 +14977,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
14922
14977
  layer,
14923
14978
  color: props.color,
14924
14979
  route: props.route.map((p) => {
14925
- const transformedPosition = applyToPoint9(transform, {
14980
+ const transformedPosition = applyToPoint10(transform, {
14926
14981
  x: p.x,
14927
14982
  y: p.y
14928
14983
  });
@@ -14974,7 +15029,7 @@ var FabricationNoteText = class extends PrimitiveComponent2 {
14974
15029
 
14975
15030
  // lib/components/primitive-components/FabricationNoteDimension.ts
14976
15031
  import { fabricationNoteDimensionProps } from "@tscircuit/props";
14977
- import { applyToPoint as applyToPoint10 } from "transformation-matrix";
15032
+ import { applyToPoint as applyToPoint11 } from "transformation-matrix";
14978
15033
  var FabricationNoteDimension = class extends PrimitiveComponent2 {
14979
15034
  fabrication_note_dimension_id = null;
14980
15035
  isPcbPrimitive = true;
@@ -14993,13 +15048,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
14993
15048
  this.renderError(
14994
15049
  `FabricationNoteDimension could not find selector "${input}"`
14995
15050
  );
14996
- return applyToPoint10(transform, { x: 0, y: 0 });
15051
+ return applyToPoint11(transform, { x: 0, y: 0 });
14997
15052
  }
14998
15053
  return target._getGlobalPcbPositionBeforeLayout();
14999
15054
  }
15000
15055
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
15001
15056
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
15002
- return applyToPoint10(transform, { x: numericX, y: numericY });
15057
+ return applyToPoint11(transform, { x: numericX, y: numericY });
15003
15058
  }
15004
15059
  doInitialPcbPrimitiveRender() {
15005
15060
  if (this.root?.pcbDisabled) return;
@@ -15068,7 +15123,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
15068
15123
 
15069
15124
  // lib/components/primitive-components/PcbNoteLine.ts
15070
15125
  import { pcbNoteLineProps } from "@tscircuit/props";
15071
- import { applyToPoint as applyToPoint11 } from "transformation-matrix";
15126
+ import { applyToPoint as applyToPoint12 } from "transformation-matrix";
15072
15127
  var PcbNoteLine = class extends PrimitiveComponent2 {
15073
15128
  pcb_note_line_id = null;
15074
15129
  isPcbPrimitive = true;
@@ -15085,8 +15140,8 @@ var PcbNoteLine = class extends PrimitiveComponent2 {
15085
15140
  const subcircuit = this.getSubcircuit();
15086
15141
  const group = this.getGroup();
15087
15142
  const transform = this._computePcbGlobalTransformBeforeLayout();
15088
- const start = applyToPoint11(transform, { x: props.x1, y: props.y1 });
15089
- const end = applyToPoint11(transform, { x: props.x2, y: props.y2 });
15143
+ const start = applyToPoint12(transform, { x: props.x1, y: props.y1 });
15144
+ const end = applyToPoint12(transform, { x: props.x2, y: props.y2 });
15090
15145
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
15091
15146
  const pcb_note_line = db.pcb_note_line.insert({
15092
15147
  pcb_component_id,
@@ -15113,7 +15168,7 @@ var PcbNoteLine = class extends PrimitiveComponent2 {
15113
15168
 
15114
15169
  // lib/components/primitive-components/PcbNoteRect.ts
15115
15170
  import { pcbNoteRectProps } from "@tscircuit/props";
15116
- import { applyToPoint as applyToPoint12 } from "transformation-matrix";
15171
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
15117
15172
  var PcbNoteRect = class extends PrimitiveComponent2 {
15118
15173
  pcb_note_rect_id = null;
15119
15174
  isPcbPrimitive = true;
@@ -15128,7 +15183,7 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
15128
15183
  const { db } = this.root;
15129
15184
  const { _parsedProps: props } = this;
15130
15185
  const transform = this._computePcbGlobalTransformBeforeLayout();
15131
- const center = applyToPoint12(transform, { x: 0, y: 0 });
15186
+ const center = applyToPoint13(transform, { x: 0, y: 0 });
15132
15187
  const subcircuit = this.getSubcircuit();
15133
15188
  const group = this.getGroup();
15134
15189
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
@@ -15157,7 +15212,7 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
15157
15212
 
15158
15213
  // lib/components/primitive-components/PcbNoteText.ts
15159
15214
  import { pcbNoteTextProps } from "@tscircuit/props";
15160
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
15215
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
15161
15216
  var PcbNoteText = class extends PrimitiveComponent2 {
15162
15217
  pcb_note_text_id = null;
15163
15218
  isPcbPrimitive = true;
@@ -15172,7 +15227,7 @@ var PcbNoteText = class extends PrimitiveComponent2 {
15172
15227
  const { db } = this.root;
15173
15228
  const { _parsedProps: props } = this;
15174
15229
  const transform = this._computePcbGlobalTransformBeforeLayout();
15175
- const anchorPosition = applyToPoint13(transform, { x: 0, y: 0 });
15230
+ const anchorPosition = applyToPoint14(transform, { x: 0, y: 0 });
15176
15231
  const subcircuit = this.getSubcircuit();
15177
15232
  const group = this.getGroup();
15178
15233
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
@@ -15201,7 +15256,7 @@ var PcbNoteText = class extends PrimitiveComponent2 {
15201
15256
 
15202
15257
  // lib/components/primitive-components/PcbNotePath.ts
15203
15258
  import { pcbNotePathProps } from "@tscircuit/props";
15204
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
15259
+ import { applyToPoint as applyToPoint15 } from "transformation-matrix";
15205
15260
  var PcbNotePath = class extends PrimitiveComponent2 {
15206
15261
  pcb_note_path_id = null;
15207
15262
  isPcbPrimitive = true;
@@ -15223,7 +15278,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
15223
15278
  const { x, y, ...rest } = point;
15224
15279
  const numericX = typeof x === "string" ? parseFloat(x) : x;
15225
15280
  const numericY = typeof y === "string" ? parseFloat(y) : y;
15226
- const transformed = applyToPoint14(transform, { x: numericX, y: numericY });
15281
+ const transformed = applyToPoint15(transform, { x: numericX, y: numericY });
15227
15282
  return { ...rest, x: transformed.x, y: transformed.y };
15228
15283
  });
15229
15284
  const pcb_note_path = db.pcb_note_path.insert({
@@ -15255,7 +15310,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
15255
15310
 
15256
15311
  // lib/components/primitive-components/PcbNoteDimension.ts
15257
15312
  import { pcbNoteDimensionProps } from "@tscircuit/props";
15258
- import { applyToPoint as applyToPoint15 } from "transformation-matrix";
15313
+ import { applyToPoint as applyToPoint16 } from "transformation-matrix";
15259
15314
  var PcbNoteDimension = class extends PrimitiveComponent2 {
15260
15315
  pcb_note_dimension_id = null;
15261
15316
  isPcbPrimitive = true;
@@ -15272,13 +15327,13 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
15272
15327
  );
15273
15328
  if (!target) {
15274
15329
  this.renderError(`PcbNoteDimension could not find selector "${input}"`);
15275
- return applyToPoint15(transform, { x: 0, y: 0 });
15330
+ return applyToPoint16(transform, { x: 0, y: 0 });
15276
15331
  }
15277
15332
  return target._getGlobalPcbPositionBeforeLayout();
15278
15333
  }
15279
15334
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
15280
15335
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
15281
- return applyToPoint15(transform, { x: numericX, y: numericY });
15336
+ return applyToPoint16(transform, { x: numericX, y: numericY });
15282
15337
  }
15283
15338
  doInitialPcbPrimitiveRender() {
15284
15339
  if (this.root?.pcbDisabled) return;
@@ -15458,7 +15513,7 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
15458
15513
  // lib/components/primitive-components/NetLabel.ts
15459
15514
  import { netLabelProps } from "@tscircuit/props";
15460
15515
  import {
15461
- applyToPoint as applyToPoint16,
15516
+ applyToPoint as applyToPoint17,
15462
15517
  identity as identity5,
15463
15518
  translate as translate6
15464
15519
  } from "transformation-matrix";
@@ -15509,7 +15564,7 @@ var NetLabel = class extends PrimitiveComponent2 {
15509
15564
  const connectedPorts = this._getConnectedPorts();
15510
15565
  if (connectedPorts.length > 0) {
15511
15566
  const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
15512
- const parentCenter = applyToPoint16(
15567
+ const parentCenter = applyToPoint17(
15513
15568
  this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
15514
15569
  { x: 0, y: 0 }
15515
15570
  );
@@ -17354,7 +17409,7 @@ import { identity as identity6 } from "transformation-matrix";
17354
17409
  var package_default = {
17355
17410
  name: "@tscircuit/core",
17356
17411
  type: "module",
17357
- version: "0.0.827",
17412
+ version: "0.0.829",
17358
17413
  types: "dist/index.d.ts",
17359
17414
  main: "dist/index.js",
17360
17415
  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.828",
4
+ "version": "0.0.830",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",