@tscircuit/core 0.0.1421 → 0.0.1423

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
@@ -126756,6 +126756,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
126756
126756
  } & {
126757
126757
  frequency: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
126758
126758
  loadCapacitance: zod.ZodEffects<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>, number, string | number>;
126759
+ maxTraceLength: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
126759
126760
  manufacturerPartNumber: zod.ZodOptional<zod.ZodString>;
126760
126761
  mpn: zod.ZodOptional<zod.ZodString>;
126761
126762
  pinVariant: zod.ZodOptional<zod.ZodEnum<["two_pin", "four_pin"]>>;
@@ -127344,6 +127345,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
127344
127345
  connections?: Partial<Record<"left" | "right" | "pin1" | "pin2", string | readonly string[] | string[]>> | undefined;
127345
127346
  schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
127346
127347
  pinVariant?: "two_pin" | "four_pin" | undefined;
127348
+ maxTraceLength?: number | undefined;
127347
127349
  mpn?: string | undefined;
127348
127350
  }, {
127349
127351
  name: string;
@@ -127930,6 +127932,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
127930
127932
  connections?: Partial<Record<"left" | "right" | "pin1" | "pin2", string | readonly string[] | string[]>> | undefined;
127931
127933
  schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
127932
127934
  pinVariant?: "two_pin" | "four_pin" | undefined;
127935
+ maxTraceLength?: string | number | undefined;
127933
127936
  mpn?: string | undefined;
127934
127937
  }>;
127935
127938
  sourceFtype: Ftype;
package/dist/index.js CHANGED
@@ -5347,9 +5347,9 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
5347
5347
  board._connectedSchematicPortPairs.add(portPairKey);
5348
5348
  };
5349
5349
 
5350
- // lib/components/primitive-components/Trace/trace-utils/get-max-length-from-connected-capacitors.ts
5351
- var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
5352
- const capacitorMaxLengths = ports.map((port) => {
5350
+ // lib/components/primitive-components/Trace/trace-utils/get-max-length-from-connected-components.ts
5351
+ var getMaxLengthFromConnectedComponents = (ports, { db }) => {
5352
+ const componentMaxLengths = ports.map((port) => {
5353
5353
  const sourcePort = db.source_port.get(port.source_port_id);
5354
5354
  if (!sourcePort?.source_component_id) return null;
5355
5355
  const sourceComponent = db.source_component.get(
@@ -5358,10 +5358,14 @@ var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
5358
5358
  if (sourceComponent?.ftype === "simple_capacitor") {
5359
5359
  return sourceComponent.max_decoupling_trace_length;
5360
5360
  }
5361
+ if (sourceComponent?.ftype === "simple_crystal") {
5362
+ const crystalProps2 = port.parent?._parsedProps;
5363
+ return crystalProps2?.maxTraceLength ?? 10;
5364
+ }
5361
5365
  return null;
5362
5366
  }).filter((length7) => length7 !== null);
5363
- if (capacitorMaxLengths.length === 0) return void 0;
5364
- return Math.min(...capacitorMaxLengths);
5367
+ if (componentMaxLengths.length === 0) return void 0;
5368
+ return Math.min(...componentMaxLengths);
5365
5369
  };
5366
5370
 
5367
5371
  // lib/components/primitive-components/Trace/trace-utils/get-trace-display-name.ts
@@ -5556,7 +5560,7 @@ var Trace3 = class extends PrimitiveComponent2 {
5556
5560
  connected_source_net_ids: nets.map((n) => n.source_net_id),
5557
5561
  subcircuit_id: this.getSubcircuit()?.subcircuit_id,
5558
5562
  name: props.name,
5559
- max_length: getMaxLengthFromConnectedCapacitors(
5563
+ max_length: getMaxLengthFromConnectedComponents(
5560
5564
  ports.map((p) => p.port),
5561
5565
  { db }
5562
5566
  ) ?? props.maxLength,
@@ -22933,6 +22937,38 @@ function insertAutoplacedJumpers(params) {
22933
22937
  }
22934
22938
  }
22935
22939
 
22940
+ // lib/components/primitive-components/Group/insert-pcb-trace-too-long-warnings.ts
22941
+ var insertPcbTraceTooLongWarnings = ({
22942
+ db,
22943
+ subcircuitId
22944
+ }) => {
22945
+ for (const warning of db.pcb_trace_too_long_warning.list()) {
22946
+ if (warning.subcircuit_id === subcircuitId) {
22947
+ db.pcb_trace_too_long_warning.delete(
22948
+ warning.pcb_trace_too_long_warning_id
22949
+ );
22950
+ }
22951
+ }
22952
+ const pcbTraces = db.pcb_trace.list().filter((pcbTrace) => pcbTrace.subcircuit_id === subcircuitId);
22953
+ for (const pcbTrace of pcbTraces) {
22954
+ if (!pcbTrace.source_trace_id) continue;
22955
+ const sourceTrace = db.source_trace.get(pcbTrace.source_trace_id);
22956
+ const maximumTraceLength = sourceTrace?.max_length;
22957
+ if (maximumTraceLength === void 0) continue;
22958
+ const actualTraceLength = pcbTrace.trace_length ?? getTraceLength(pcbTrace.route);
22959
+ if (actualTraceLength <= maximumTraceLength) continue;
22960
+ db.pcb_trace_too_long_warning.insert({
22961
+ warning_type: "pcb_trace_too_long_warning",
22962
+ message: `PCB trace is ${actualTraceLength.toFixed(2)}mm long, exceeding the ${maximumTraceLength}mm maximum`,
22963
+ pcb_trace_id: pcbTrace.pcb_trace_id,
22964
+ source_trace_id: pcbTrace.source_trace_id,
22965
+ actual_trace_length: actualTraceLength,
22966
+ maximum_trace_length: maximumTraceLength,
22967
+ subcircuit_id: subcircuitId
22968
+ });
22969
+ }
22970
+ };
22971
+
22936
22972
  // lib/components/primitive-components/Group/region-replacement/convert-pcb-trace-to-simplified-pcb-trace.ts
22937
22973
  function convertPcbTraceToSimplifiedPcbTrace(trace) {
22938
22974
  return {
@@ -24482,6 +24518,10 @@ var Group5 = class extends NormalComponent3 {
24482
24518
  });
24483
24519
  }
24484
24520
  }
24521
+ insertPcbTraceTooLongWarnings({
24522
+ db,
24523
+ subcircuitId: this.subcircuit_id
24524
+ });
24485
24525
  }
24486
24526
  }
24487
24527
  doInitialSchematicReplaceNetLabelsWithSymbols() {
@@ -25612,7 +25652,7 @@ import { identity as identity5 } from "transformation-matrix";
25612
25652
  var package_default = {
25613
25653
  name: "@tscircuit/core",
25614
25654
  type: "module",
25615
- version: "0.0.1420",
25655
+ version: "0.0.1422",
25616
25656
  types: "dist/index.d.ts",
25617
25657
  main: "dist/index.js",
25618
25658
  module: "dist/index.js",
@@ -25661,7 +25701,7 @@ var package_default = {
25661
25701
  "@tscircuit/math-utils": "^0.0.36",
25662
25702
  "@tscircuit/miniflex": "^0.0.4",
25663
25703
  "@tscircuit/ngspice-spice-engine": "^0.0.19",
25664
- "@tscircuit/props": "^0.0.570",
25704
+ "@tscircuit/props": "^0.0.571",
25665
25705
  "@tscircuit/schematic-match-adapt": "^0.0.18",
25666
25706
  "@tscircuit/schematic-trace-solver": "^0.0.95",
25667
25707
  "@tscircuit/solver-utils": "^0.0.16",
@@ -25675,7 +25715,7 @@ var package_default = {
25675
25715
  "bun-match-svg": "0.0.12",
25676
25716
  "calculate-elbow": "^0.0.12",
25677
25717
  "chokidar-cli": "^3.0.0",
25678
- "circuit-json": "^0.0.446",
25718
+ "circuit-json": "^0.0.447",
25679
25719
  "circuit-json-to-bpc": "^0.0.13",
25680
25720
  "circuit-json-to-connectivity-map": "^0.0.23",
25681
25721
  "circuit-json-to-gltf": "^0.0.105",
@@ -25693,7 +25733,7 @@ var package_default = {
25693
25733
  "looks-same": "^9.0.1",
25694
25734
  minicssgrid: "^0.0.9",
25695
25735
  "pkg-pr-new": "^0.0.37",
25696
- poppygl: "^0.0.24",
25736
+ poppygl: "^0.0.25",
25697
25737
  react: "^19.1.0",
25698
25738
  "react-dom": "^19.1.0",
25699
25739
  "schematic-symbols": "^0.0.231",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1421",
4
+ "version": "0.0.1423",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "@tscircuit/math-utils": "^0.0.36",
51
51
  "@tscircuit/miniflex": "^0.0.4",
52
52
  "@tscircuit/ngspice-spice-engine": "^0.0.19",
53
- "@tscircuit/props": "^0.0.570",
53
+ "@tscircuit/props": "^0.0.571",
54
54
  "@tscircuit/schematic-match-adapt": "^0.0.18",
55
55
  "@tscircuit/schematic-trace-solver": "^0.0.95",
56
56
  "@tscircuit/solver-utils": "^0.0.16",
@@ -64,7 +64,7 @@
64
64
  "bun-match-svg": "0.0.12",
65
65
  "calculate-elbow": "^0.0.12",
66
66
  "chokidar-cli": "^3.0.0",
67
- "circuit-json": "^0.0.446",
67
+ "circuit-json": "^0.0.447",
68
68
  "circuit-json-to-bpc": "^0.0.13",
69
69
  "circuit-json-to-connectivity-map": "^0.0.23",
70
70
  "circuit-json-to-gltf": "^0.0.105",
@@ -82,7 +82,7 @@
82
82
  "looks-same": "^9.0.1",
83
83
  "minicssgrid": "^0.0.9",
84
84
  "pkg-pr-new": "^0.0.37",
85
- "poppygl": "^0.0.24",
85
+ "poppygl": "^0.0.25",
86
86
  "react": "^19.1.0",
87
87
  "react-dom": "^19.1.0",
88
88
  "schematic-symbols": "^0.0.231",