@tscircuit/core 0.0.348 → 0.0.350

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
@@ -5805,6 +5805,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
5805
5805
 
5806
5806
  declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircleProps> {
5807
5807
  pcb_silkscreen_circle_id: string | null;
5808
+ isPcbPrimitive: boolean;
5808
5809
  get config(): {
5809
5810
  componentName: string;
5810
5811
  zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
@@ -5846,10 +5847,15 @@ declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircl
5846
5847
  }>;
5847
5848
  };
5848
5849
  doInitialPcbPrimitiveRender(): void;
5850
+ getPcbSize(): {
5851
+ width: number;
5852
+ height: number;
5853
+ };
5849
5854
  }
5850
5855
 
5851
5856
  declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathProps> {
5852
5857
  pcb_silkscreen_path_id: string | null;
5858
+ isPcbPrimitive: boolean;
5853
5859
  get config(): {
5854
5860
  componentName: string;
5855
5861
  zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
@@ -5923,10 +5929,15 @@ declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathPro
5923
5929
  }>;
5924
5930
  };
5925
5931
  doInitialPcbPrimitiveRender(): void;
5932
+ getPcbSize(): {
5933
+ width: number;
5934
+ height: number;
5935
+ };
5926
5936
  }
5927
5937
 
5928
5938
  declare class SilkscreenRect extends PrimitiveComponent<typeof silkscreenRectProps> {
5929
5939
  pcb_silkscreen_rect_id: string | null;
5940
+ isPcbPrimitive: boolean;
5930
5941
  get config(): {
5931
5942
  componentName: string;
5932
5943
  zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
@@ -5971,6 +5982,10 @@ declare class SilkscreenRect extends PrimitiveComponent<typeof silkscreenRectPro
5971
5982
  }>;
5972
5983
  };
5973
5984
  doInitialPcbPrimitiveRender(): void;
5985
+ getPcbSize(): {
5986
+ width: number;
5987
+ height: number;
5988
+ };
5974
5989
  }
5975
5990
 
5976
5991
  declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextProps> {
@@ -6026,6 +6041,7 @@ declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextPro
6026
6041
 
6027
6042
  declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLineProps> {
6028
6043
  pcb_silkscreen_line_id: string | null;
6044
+ isPcbPrimitive: boolean;
6029
6045
  get config(): {
6030
6046
  componentName: string;
6031
6047
  zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
@@ -6066,6 +6082,10 @@ declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLinePro
6066
6082
  }>;
6067
6083
  };
6068
6084
  doInitialPcbPrimitiveRender(): void;
6085
+ getPcbSize(): {
6086
+ width: number;
6087
+ height: number;
6088
+ };
6069
6089
  }
6070
6090
 
6071
6091
  declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
package/dist/index.js CHANGED
@@ -1568,6 +1568,7 @@ import { silkscreenPathProps } from "@tscircuit/props";
1568
1568
  import { applyToPoint as applyToPoint2 } from "transformation-matrix";
1569
1569
  var SilkscreenPath = class extends PrimitiveComponent {
1570
1570
  pcb_silkscreen_path_id = null;
1571
+ isPcbPrimitive = true;
1571
1572
  get config() {
1572
1573
  return {
1573
1574
  componentName: "SilkscreenPath",
@@ -1578,7 +1579,8 @@ var SilkscreenPath = class extends PrimitiveComponent {
1578
1579
  if (this.root?.pcbDisabled) return;
1579
1580
  const { db } = this.root;
1580
1581
  const { _parsedProps: props } = this;
1581
- const layer = props.layer ?? "top";
1582
+ const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
1583
+ const layer = maybeFlipLayer(props.layer ?? "top");
1582
1584
  if (layer !== "top" && layer !== "bottom") {
1583
1585
  throw new Error(
1584
1586
  `Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`
@@ -1606,6 +1608,23 @@ var SilkscreenPath = class extends PrimitiveComponent {
1606
1608
  });
1607
1609
  this.pcb_silkscreen_path_id = pcb_silkscreen_path.pcb_silkscreen_path_id;
1608
1610
  }
1611
+ getPcbSize() {
1612
+ const { _parsedProps: props } = this;
1613
+ if (!props.route || props.route.length === 0) {
1614
+ return { width: 0, height: 0 };
1615
+ }
1616
+ let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
1617
+ for (const point of props.route) {
1618
+ minX = Math.min(minX, point.x);
1619
+ maxX = Math.max(maxX, point.x);
1620
+ minY = Math.min(minY, point.y);
1621
+ maxY = Math.max(maxY, point.y);
1622
+ }
1623
+ return {
1624
+ width: maxX - minX,
1625
+ height: maxY - minY
1626
+ };
1627
+ }
1609
1628
  };
1610
1629
 
1611
1630
  // lib/components/primitive-components/PlatedHole.ts
@@ -1988,7 +2007,7 @@ function getBoundsOfPcbComponents(components) {
1988
2007
  let maxX = -Infinity;
1989
2008
  let maxY = -Infinity;
1990
2009
  for (const child of components) {
1991
- if (child.isPcbPrimitive && child.componentName !== "SilkscreenText") {
2010
+ if (child.isPcbPrimitive && !child.componentName.startsWith("Silkscreen")) {
1992
2011
  const { x, y } = child._getGlobalPcbPositionBeforeLayout();
1993
2012
  const { width: width2, height: height2 } = child.getPcbSize();
1994
2013
  minX = Math.min(minX, x - width2 / 2);
@@ -3831,7 +3850,8 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
3831
3850
  ports.map((p) => p.port),
3832
3851
  { db }
3833
3852
  ) ?? props.maxLength,
3834
- display_name: displayName
3853
+ display_name: displayName,
3854
+ min_trace_thickness: props.thickness
3835
3855
  });
3836
3856
  this.source_trace_id = trace.source_trace_id;
3837
3857
  }
@@ -6700,6 +6720,7 @@ var NetAlias = class extends PrimitiveComponent {
6700
6720
  import { silkscreenCircleProps } from "@tscircuit/props";
6701
6721
  var SilkscreenCircle = class extends PrimitiveComponent {
6702
6722
  pcb_silkscreen_circle_id = null;
6723
+ isPcbPrimitive = true;
6703
6724
  get config() {
6704
6725
  return {
6705
6726
  componentName: "SilkscreenCircle",
@@ -6710,7 +6731,8 @@ var SilkscreenCircle = class extends PrimitiveComponent {
6710
6731
  if (this.root?.pcbDisabled) return;
6711
6732
  const { db } = this.root;
6712
6733
  const { _parsedProps: props } = this;
6713
- const layer = props.layer ?? "top";
6734
+ const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
6735
+ const layer = maybeFlipLayer(props.layer ?? "top");
6714
6736
  if (layer !== "top" && layer !== "bottom") {
6715
6737
  throw new Error(
6716
6738
  `Invalid layer "${layer}" for SilkscreenCircle. Must be "top" or "bottom".`
@@ -6732,12 +6754,18 @@ var SilkscreenCircle = class extends PrimitiveComponent {
6732
6754
  });
6733
6755
  this.pcb_silkscreen_circle_id = pcb_silkscreen_circle.pcb_silkscreen_circle_id;
6734
6756
  }
6757
+ getPcbSize() {
6758
+ const { _parsedProps: props } = this;
6759
+ const diameter = props.radius * 2;
6760
+ return { width: diameter, height: diameter };
6761
+ }
6735
6762
  };
6736
6763
 
6737
6764
  // lib/components/primitive-components/SilkscreenRect.ts
6738
6765
  import { silkscreenRectProps } from "@tscircuit/props";
6739
6766
  var SilkscreenRect = class extends PrimitiveComponent {
6740
6767
  pcb_silkscreen_rect_id = null;
6768
+ isPcbPrimitive = true;
6741
6769
  get config() {
6742
6770
  return {
6743
6771
  componentName: "SilkscreenRect",
@@ -6748,7 +6776,8 @@ var SilkscreenRect = class extends PrimitiveComponent {
6748
6776
  if (this.root?.pcbDisabled) return;
6749
6777
  const { db } = this.root;
6750
6778
  const { _parsedProps: props } = this;
6751
- const layer = props.layer ?? "top";
6779
+ const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
6780
+ const layer = maybeFlipLayer(props.layer ?? "top");
6752
6781
  if (layer !== "top" && layer !== "bottom") {
6753
6782
  throw new Error(
6754
6783
  `Invalid layer "${layer}" for SilkscreenRect. Must be "top" or "bottom".`
@@ -6770,12 +6799,17 @@ var SilkscreenRect = class extends PrimitiveComponent {
6770
6799
  });
6771
6800
  this.pcb_silkscreen_rect_id = pcb_silkscreen_rect.pcb_silkscreen_rect_id;
6772
6801
  }
6802
+ getPcbSize() {
6803
+ const { _parsedProps: props } = this;
6804
+ return { width: props.width, height: props.height };
6805
+ }
6773
6806
  };
6774
6807
 
6775
6808
  // lib/components/primitive-components/SilkscreenLine.ts
6776
6809
  import { silkscreenLineProps } from "@tscircuit/props";
6777
6810
  var SilkscreenLine = class extends PrimitiveComponent {
6778
6811
  pcb_silkscreen_line_id = null;
6812
+ isPcbPrimitive = true;
6779
6813
  get config() {
6780
6814
  return {
6781
6815
  componentName: "SilkscreenLine",
@@ -6786,7 +6820,8 @@ var SilkscreenLine = class extends PrimitiveComponent {
6786
6820
  if (this.root?.pcbDisabled) return;
6787
6821
  const { db } = this.root;
6788
6822
  const { _parsedProps: props } = this;
6789
- const layer = props.layer ?? "top";
6823
+ const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
6824
+ const layer = maybeFlipLayer(props.layer ?? "top");
6790
6825
  if (layer !== "top" && layer !== "bottom") {
6791
6826
  throw new Error(
6792
6827
  `Invalid layer "${layer}" for SilkscreenLine. Must be "top" or "bottom".`
@@ -6806,6 +6841,12 @@ var SilkscreenLine = class extends PrimitiveComponent {
6806
6841
  });
6807
6842
  this.pcb_silkscreen_line_id = pcb_silkscreen_line.pcb_silkscreen_line_id;
6808
6843
  }
6844
+ getPcbSize() {
6845
+ const { _parsedProps: props } = this;
6846
+ const width = Math.abs(props.x2 - props.x1);
6847
+ const height = Math.abs(props.y2 - props.y1);
6848
+ return { width, height };
6849
+ }
6809
6850
  };
6810
6851
 
6811
6852
  // lib/components/primitive-components/Via.ts
@@ -7264,7 +7305,7 @@ import { identity as identity4 } from "transformation-matrix";
7264
7305
  var package_default = {
7265
7306
  name: "@tscircuit/core",
7266
7307
  type: "module",
7267
- version: "0.0.347",
7308
+ version: "0.0.349",
7268
7309
  types: "dist/index.d.ts",
7269
7310
  main: "dist/index.js",
7270
7311
  module: "dist/index.js",
@@ -7297,7 +7338,7 @@ var package_default = {
7297
7338
  "@types/react-reconciler": "^0.28.9",
7298
7339
  "bun-match-svg": "0.0.8",
7299
7340
  "chokidar-cli": "^3.0.0",
7300
- "circuit-to-svg": "^0.0.99",
7341
+ "circuit-to-svg": "^0.0.113",
7301
7342
  concurrently: "^9.1.2",
7302
7343
  debug: "^4.3.6",
7303
7344
  "graphics-debug": "^0.0.4",
@@ -7311,8 +7352,8 @@ var package_default = {
7311
7352
  tsup: "^8.2.4"
7312
7353
  },
7313
7354
  peerDependencies: {
7314
- typescript: "^5.0.0",
7315
- "@tscircuit/footprinter": "*"
7355
+ "@tscircuit/footprinter": "*",
7356
+ typescript: "^5.0.0"
7316
7357
  },
7317
7358
  dependencies: {
7318
7359
  "@lume/kiwi": "^0.4.3",
@@ -7322,7 +7363,7 @@ var package_default = {
7322
7363
  "@tscircuit/props": "^0.0.159",
7323
7364
  "@tscircuit/schematic-autolayout": "^0.0.6",
7324
7365
  "@tscircuit/soup-util": "^0.0.41",
7325
- "circuit-json": "^0.0.151",
7366
+ "circuit-json": "^0.0.153",
7326
7367
  "circuit-json-to-connectivity-map": "^0.0.17",
7327
7368
  "format-si-unit": "^0.0.3",
7328
7369
  nanoid: "^5.0.7",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.348",
4
+ "version": "0.0.350",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "@types/react-reconciler": "^0.28.9",
35
35
  "bun-match-svg": "0.0.8",
36
36
  "chokidar-cli": "^3.0.0",
37
- "circuit-to-svg": "^0.0.99",
37
+ "circuit-to-svg": "^0.0.113",
38
38
  "concurrently": "^9.1.2",
39
39
  "debug": "^4.3.6",
40
40
  "graphics-debug": "^0.0.4",
@@ -48,8 +48,8 @@
48
48
  "tsup": "^8.2.4"
49
49
  },
50
50
  "peerDependencies": {
51
- "typescript": "^5.0.0",
52
- "@tscircuit/footprinter": "*"
51
+ "@tscircuit/footprinter": "*",
52
+ "typescript": "^5.0.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "@lume/kiwi": "^0.4.3",
@@ -59,7 +59,7 @@
59
59
  "@tscircuit/props": "^0.0.159",
60
60
  "@tscircuit/schematic-autolayout": "^0.0.6",
61
61
  "@tscircuit/soup-util": "^0.0.41",
62
- "circuit-json": "^0.0.151",
62
+ "circuit-json": "^0.0.153",
63
63
  "circuit-json-to-connectivity-map": "^0.0.17",
64
64
  "format-si-unit": "^0.0.3",
65
65
  "nanoid": "^5.0.7",