@tscircuit/core 0.0.2153 → 0.0.2155

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 +29 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10727,6 +10727,9 @@ var Keepout = class extends PrimitiveComponent2 {
10727
10727
  const subcircuit = this.getSubcircuit();
10728
10728
  const { db: db2 } = this.root;
10729
10729
  const { _parsedProps: props } = this;
10730
+ const pcbComponentId = this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
10731
+ const pcbKeepoutOwnershipProps = pcbComponentId ? { pcb_component_id: pcbComponentId } : {};
10732
+ const pcbGroupId = this.getGroup()?.pcb_group_id ?? void 0;
10730
10733
  const position = this._getGlobalPcbPositionBeforeLayout();
10731
10734
  const decomposedMat = decomposeTSR3(
10732
10735
  this._computePcbGlobalTransformBeforeLayout()
@@ -10746,6 +10749,7 @@ var Keepout = class extends PrimitiveComponent2 {
10746
10749
  pcb_keepout = db2.pcb_keepout.insert({
10747
10750
  layers,
10748
10751
  shape: "circle",
10752
+ ...pcbKeepoutOwnershipProps,
10749
10753
  ...pcbKeepoutExclusionProps,
10750
10754
  ...props.allowTraces !== void 0 ? { allow_traces: props.allowTraces } : {},
10751
10755
  ...props.allowPlacements !== void 0 ? { allow_placements: props.allowPlacements } : {},
@@ -10757,12 +10761,13 @@ var Keepout = class extends PrimitiveComponent2 {
10757
10761
  y: position.y
10758
10762
  },
10759
10763
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
10760
- pcb_group_id: subcircuit?.getGroup()?.pcb_group_id ?? void 0
10764
+ pcb_group_id: pcbGroupId
10761
10765
  });
10762
10766
  } else if (props.shape === "rect") {
10763
10767
  pcb_keepout = db2.pcb_keepout.insert({
10764
10768
  layers,
10765
10769
  shape: "rect",
10770
+ ...pcbKeepoutOwnershipProps,
10766
10771
  ...pcbKeepoutExclusionProps,
10767
10772
  ...props.allowTraces !== void 0 ? { allow_traces: props.allowTraces } : {},
10768
10773
  ...props.allowPlacements !== void 0 ? { allow_placements: props.allowPlacements } : {},
@@ -10774,7 +10779,7 @@ var Keepout = class extends PrimitiveComponent2 {
10774
10779
  y: position.y
10775
10780
  },
10776
10781
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
10777
- pcb_group_id: subcircuit?.getGroup()?.pcb_group_id ?? void 0
10782
+ pcb_group_id: pcbGroupId
10778
10783
  });
10779
10784
  }
10780
10785
  if (pcb_keepout) {
@@ -119162,7 +119167,7 @@ var RoutingPhasePreparationError = class extends Error {
119162
119167
  var package_default = {
119163
119168
  name: "@tscircuit/core",
119164
119169
  type: "module",
119165
- version: "0.0.2152",
119170
+ version: "0.0.2154",
119166
119171
  types: "dist/index.d.ts",
119167
119172
  main: "dist/index.js",
119168
119173
  module: "dist/index.js",
@@ -119929,6 +119934,7 @@ function getAccumulatedPcbTracesWithStageOutputReplacements({
119929
119934
  // lib/components/primitive-components/Group/get-source-trace-id-for-routed-trace.ts
119930
119935
  import { distance as distance18, pointToSegmentDistance as pointToSegmentDistance4 } from "@tscircuit/math-utils";
119931
119936
  import { ConnectivityMap as ConnectivityMap6 } from "circuit-json-to-connectivity-map";
119937
+ import { applyToPoint as applyToPoint39, rotateDEG as rotateDEG4 } from "transformation-matrix";
119932
119938
  var POINT_EPSILON3 = 1e-6;
119933
119939
  function isPointOnWireSegment({
119934
119940
  point: point6,
@@ -119946,7 +119952,8 @@ function isPointInSmtPad({
119946
119952
  traceWidth = 0
119947
119953
  }) {
119948
119954
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
119949
- return Math.abs(point6.x - pad.x) <= pad.width / 2 + traceWidth / 2 && Math.abs(point6.y - pad.y) <= pad.height / 2 + traceWidth / 2;
119955
+ const unrotatedPoint = pad.shape === "rotated_rect" ? applyToPoint39(rotateDEG4(-pad.ccw_rotation, pad.x, pad.y), point6) : point6;
119956
+ return Math.abs(unrotatedPoint.x - pad.x) <= pad.width / 2 + traceWidth / 2 && Math.abs(unrotatedPoint.y - pad.y) <= pad.height / 2 + traceWidth / 2;
119950
119957
  }
119951
119958
  if (pad.shape === "circle") {
119952
119959
  return distance18(point6, pad) <= pad.radius + traceWidth / 2;
@@ -122571,7 +122578,7 @@ import { symbols as symbols7 } from "schematic-symbols";
122571
122578
  import { ledProps, resolveManufacturerPartNumber as resolveManufacturerPartNumber9 } from "@tscircuit/props";
122572
122579
 
122573
122580
  // lib/components/normal-components/Led_addPolarityFabricationSymbol.ts
122574
- import { applyToPoint as applyToPoint39, compose as compose17, rotate as rotate7, translate as translate17 } from "transformation-matrix";
122581
+ import { applyToPoint as applyToPoint40, compose as compose17, rotate as rotate7, translate as translate17 } from "transformation-matrix";
122575
122582
  var generatedNotes = /* @__PURE__ */ new WeakMap();
122576
122583
  var getPolarity2 = (port) => {
122577
122584
  const hints = [port.name, ...port.port_hints ?? []].map(
@@ -122616,7 +122623,7 @@ var Led_addPolarityFabricationSymbol = (led) => {
122616
122623
  translate17((a2.x + k2.x) / 2, (a2.y + k2.y) / 2),
122617
122624
  rotate7(angle)
122618
122625
  );
122619
- const point6 = (x2, y2) => applyToPoint39(frame, { x: x2, y: y2 });
122626
+ const point6 = (x2, y2) => applyToPoint40(frame, { x: x2, y: y2 });
122620
122627
  const common = {
122621
122628
  pcb_component_id: pcb.pcb_component_id,
122622
122629
  subcircuit_id: led.getSubcircuit()?.subcircuit_id ?? void 0,
@@ -127891,10 +127898,10 @@ var AutoroutingPhase = class extends PrimitiveComponent2 {
127891
127898
 
127892
127899
  // lib/components/primitive-components/FabricationNoteDimension.ts
127893
127900
  import { fabricationNoteDimensionProps } from "@tscircuit/props";
127894
- import { applyToPoint as applyToPoint41 } from "transformation-matrix";
127901
+ import { applyToPoint as applyToPoint42 } from "transformation-matrix";
127895
127902
 
127896
127903
  // lib/utils/pcb/resolve-pcb-dimension-offset-direction.ts
127897
- import { applyToPoint as applyToPoint40 } from "transformation-matrix";
127904
+ import { applyToPoint as applyToPoint41 } from "transformation-matrix";
127898
127905
  var resolvePcbDimensionOffsetDirection = ({
127899
127906
  from,
127900
127907
  offset,
@@ -127903,7 +127910,7 @@ var resolvePcbDimensionOffsetDirection = ({
127903
127910
  transform
127904
127911
  }) => {
127905
127912
  if (offsetDirection) {
127906
- return applyToPoint40({ ...transform, e: 0, f: 0 }, offsetDirection);
127913
+ return applyToPoint41({ ...transform, e: 0, f: 0 }, offsetDirection);
127907
127914
  }
127908
127915
  const dx2 = to.x - from.x;
127909
127916
  const dy2 = to.y - from.y;
@@ -127931,13 +127938,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
127931
127938
  this.renderError(
127932
127939
  `FabricationNoteDimension could not find selector "${input}"`
127933
127940
  );
127934
- return applyToPoint41(transform, { x: 0, y: 0 });
127941
+ return applyToPoint42(transform, { x: 0, y: 0 });
127935
127942
  }
127936
127943
  return target._getGlobalPcbPositionBeforeLayout();
127937
127944
  }
127938
127945
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
127939
127946
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
127940
- return applyToPoint41(transform, { x: numericX, y: numericY });
127947
+ return applyToPoint42(transform, { x: numericX, y: numericY });
127941
127948
  }
127942
127949
  doInitialPcbPrimitiveRender() {
127943
127950
  if (this.root?.pcbDisabled) return;
@@ -128041,7 +128048,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
128041
128048
 
128042
128049
  // lib/components/primitive-components/PcbNoteDimension.ts
128043
128050
  import { pcbNoteDimensionProps } from "@tscircuit/props";
128044
- import { applyToPoint as applyToPoint42 } from "transformation-matrix";
128051
+ import { applyToPoint as applyToPoint43 } from "transformation-matrix";
128045
128052
  var PcbNoteDimension = class extends PrimitiveComponent2 {
128046
128053
  pcb_note_dimension_id = null;
128047
128054
  isPcbPrimitive = true;
@@ -128058,7 +128065,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
128058
128065
  );
128059
128066
  if (!target) {
128060
128067
  this.renderError(`PcbNoteDimension could not find selector "${input}"`);
128061
- return applyToPoint42(transform, { x: 0, y: 0 });
128068
+ return applyToPoint43(transform, { x: 0, y: 0 });
128062
128069
  }
128063
128070
  const targetPcbComponentId = target.pcb_component_id;
128064
128071
  const root = this.root;
@@ -128075,7 +128082,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
128075
128082
  }
128076
128083
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
128077
128084
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
128078
- return applyToPoint42(transform, { x: numericX, y: numericY });
128085
+ return applyToPoint43(transform, { x: numericX, y: numericY });
128079
128086
  }
128080
128087
  doInitialPcbPrimitiveRender() {
128081
128088
  if (this.root?.pcbDisabled) return;
@@ -130853,7 +130860,7 @@ import {
130853
130860
  getTransformedSvgPathRoutes,
130854
130861
  loadImageSource
130855
130862
  } from "@tscircuit/image-utils";
130856
- import { applyToPoint as applyToPoint43 } from "transformation-matrix";
130863
+ import { applyToPoint as applyToPoint44 } from "transformation-matrix";
130857
130864
  var SilkscreenGraphic = class extends PrimitiveComponent2 {
130858
130865
  pcb_silkscreen_graphic_id = null;
130859
130866
  pcb_silkscreen_graphic_ids = [];
@@ -130955,7 +130962,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
130955
130962
  { x: halfWidth, y: -halfHeight },
130956
130963
  { x: -halfWidth, y: -halfHeight }
130957
130964
  ]).map(
130958
- (point6) => applyToPoint43(transform, point6)
130965
+ (point6) => applyToPoint44(transform, point6)
130959
130966
  )
130960
130967
  },
130961
130968
  inner_rings: []
@@ -134608,7 +134615,7 @@ var SpiceModel = class extends PrimitiveComponent2 {
134608
134615
 
134609
134616
  // lib/components/primitive-components/PcbBend.ts
134610
134617
  import { pcbBendProps } from "@tscircuit/props";
134611
- import { applyToPoint as applyToPoint44 } from "transformation-matrix";
134618
+ import { applyToPoint as applyToPoint45 } from "transformation-matrix";
134612
134619
 
134613
134620
  // lib/components/primitive-components/getPcbFlexBoardTransform.ts
134614
134621
  import { compose as compose20, translate as translate20 } from "transformation-matrix";
@@ -134642,8 +134649,8 @@ var PcbBend = class extends PrimitiveComponent2 {
134642
134649
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
134643
134650
  subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
134644
134651
  name: props.name,
134645
- start: applyToPoint44(transform, { x: props.x1, y: props.y1 }),
134646
- end: applyToPoint44(transform, { x: props.x2, y: props.y2 }),
134652
+ start: applyToPoint45(transform, { x: props.x1, y: props.y1 }),
134653
+ end: applyToPoint45(transform, { x: props.x2, y: props.y2 }),
134647
134654
  bend_angle: props.bendAngle,
134648
134655
  bend_radius: props.bendRadius,
134649
134656
  bend_side: props.bendSide
@@ -134679,7 +134686,7 @@ var PcbBend = class extends PrimitiveComponent2 {
134679
134686
 
134680
134687
  // lib/components/primitive-components/PcbStiffener.ts
134681
134688
  import { pcbStiffenerProps } from "@tscircuit/props";
134682
- import { applyToPoint as applyToPoint45, decomposeTSR as decomposeTSR12 } from "transformation-matrix";
134689
+ import { applyToPoint as applyToPoint46, decomposeTSR as decomposeTSR12 } from "transformation-matrix";
134683
134690
  var PcbStiffener = class extends PrimitiveComponent2 {
134684
134691
  pcb_stiffener_id = null;
134685
134692
  get config() {
@@ -134702,14 +134709,14 @@ var PcbStiffener = class extends PrimitiveComponent2 {
134702
134709
  };
134703
134710
  const geometry = props.shape === "rect" ? {
134704
134711
  shape: "rect",
134705
- center: applyToPoint45(transform, { x: 0, y: 0 }),
134712
+ center: applyToPoint46(transform, { x: 0, y: 0 }),
134706
134713
  rotation: decomposeTSR12(transform).rotation.angle * 180 / Math.PI,
134707
134714
  width: props.width,
134708
134715
  height: props.height
134709
134716
  } : {
134710
134717
  shape: "polygon",
134711
134718
  outline: props.outline.map(
134712
- (point6) => applyToPoint45(transform, point6)
134719
+ (point6) => applyToPoint46(transform, point6)
134713
134720
  )
134714
134721
  };
134715
134722
  this.pcb_stiffener_id = db2.pcb_stiffener.insert({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2153",
4
+ "version": "0.0.2155",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",