@tscircuit/core 0.0.1506 → 0.0.1507

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
@@ -128091,6 +128091,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, CrystalPorts>
128091
128091
  initPorts(): void;
128092
128092
  _getSchematicSymbolDisplayValue(): string | undefined;
128093
128093
  doInitialSourceRender(): void;
128094
+ doInitialSourceDesignRuleChecks(): void;
128094
128095
  }
128095
128096
 
128096
128097
  declare class Transistor extends NormalComponent<typeof transistorProps, TransistorPorts> {
package/dist/index.js CHANGED
@@ -5527,12 +5527,8 @@ var getMaxLengthFromConnectedComponents = (ports, { db }) => {
5527
5527
  if (sourceComponent?.ftype === "simple_capacitor") {
5528
5528
  return sourceComponent.max_decoupling_trace_length;
5529
5529
  }
5530
- if (sourceComponent?.ftype === "simple_crystal") {
5531
- const crystalProps2 = port.parent?._parsedProps;
5532
- return crystalProps2?.maxTraceLength ?? 10;
5533
- }
5534
5530
  return null;
5535
- }).filter((length7) => length7 !== null);
5531
+ }).filter((length7) => typeof length7 === "number");
5536
5532
  if (componentMaxLengths.length === 0) return void 0;
5537
5533
  return Math.min(...componentMaxLengths);
5538
5534
  };
@@ -23652,7 +23648,7 @@ function Group_getRoutingPhasePlans(group) {
23652
23648
  var package_default = {
23653
23649
  name: "@tscircuit/core",
23654
23650
  type: "module",
23655
- version: "0.0.1505",
23651
+ version: "0.0.1506",
23656
23652
  types: "dist/index.d.ts",
23657
23653
  main: "dist/index.js",
23658
23654
  module: "dist/index.js",
@@ -23687,7 +23683,7 @@ var package_default = {
23687
23683
  "@tscircuit/alphabet": "0.0.25",
23688
23684
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
23689
23685
  "@tscircuit/capacity-autorouter": "^0.0.710",
23690
- "@tscircuit/checks": "0.0.145",
23686
+ "@tscircuit/checks": "0.0.146",
23691
23687
  "@tscircuit/circuit-json-util": "^0.0.101",
23692
23688
  "@tscircuit/common": "^0.0.20",
23693
23689
  "@tscircuit/copper-pour-solver": "0.0.39",
@@ -23769,7 +23765,7 @@ var package_default = {
23769
23765
  "@flatten-js/core": "^1.6.2",
23770
23766
  "@lume/kiwi": "^0.4.3",
23771
23767
  "calculate-cell-boundaries": "^0.0.13",
23772
- "calculate-packing": "^0.0.79",
23768
+ "calculate-packing": "^0.0.82",
23773
23769
  "css-select": "5.1.0",
23774
23770
  "format-si-unit": "^0.0.7",
23775
23771
  nanoid: "^5.0.7",
@@ -24437,38 +24433,6 @@ function insertAutoplacedJumpers(params) {
24437
24433
  }
24438
24434
  }
24439
24435
 
24440
- // lib/components/primitive-components/Group/insert-pcb-trace-too-long-warnings.ts
24441
- var insertPcbTraceTooLongWarnings = ({
24442
- db,
24443
- subcircuitId
24444
- }) => {
24445
- for (const warning of db.pcb_trace_too_long_warning.list()) {
24446
- if (warning.subcircuit_id === subcircuitId) {
24447
- db.pcb_trace_too_long_warning.delete(
24448
- warning.pcb_trace_too_long_warning_id
24449
- );
24450
- }
24451
- }
24452
- const pcbTraces = db.pcb_trace.list().filter((pcbTrace) => pcbTrace.subcircuit_id === subcircuitId);
24453
- for (const pcbTrace of pcbTraces) {
24454
- if (!pcbTrace.source_trace_id) continue;
24455
- const sourceTrace = db.source_trace.get(pcbTrace.source_trace_id);
24456
- const maximumTraceLength = sourceTrace?.max_length;
24457
- if (maximumTraceLength === void 0) continue;
24458
- const actualTraceLength = pcbTrace.trace_length ?? getTraceLength(pcbTrace.route);
24459
- if (actualTraceLength <= maximumTraceLength) continue;
24460
- db.pcb_trace_too_long_warning.insert({
24461
- warning_type: "pcb_trace_too_long_warning",
24462
- message: `PCB trace is ${actualTraceLength.toFixed(2)}mm long, exceeding the ${maximumTraceLength}mm maximum`,
24463
- pcb_trace_id: pcbTrace.pcb_trace_id,
24464
- source_trace_id: pcbTrace.source_trace_id,
24465
- actual_trace_length: actualTraceLength,
24466
- maximum_trace_length: maximumTraceLength,
24467
- subcircuit_id: subcircuitId
24468
- });
24469
- }
24470
- };
24471
-
24472
24436
  // lib/components/primitive-components/Group/region-replacement/convert-pcb-trace-to-simplified-pcb-trace.ts
24473
24437
  function convertPcbTraceToSimplifiedPcbTrace(trace) {
24474
24438
  return {
@@ -26047,10 +26011,6 @@ var Group = class extends NormalComponent3 {
26047
26011
  });
26048
26012
  }
26049
26013
  }
26050
- insertPcbTraceTooLongWarnings({
26051
- db,
26052
- subcircuitId: this.subcircuit_id
26053
- });
26054
26014
  }
26055
26015
  }
26056
26016
  doInitialSchematicReplaceNetLabelsWithSymbols() {
@@ -33428,6 +33388,7 @@ var Potentiometer = class extends NormalComponent3 {
33428
33388
  // lib/components/normal-components/Crystal.ts
33429
33389
  import { crystalProps } from "@tscircuit/props";
33430
33390
  import { formatSiUnit as formatSiUnit9 } from "format-si-unit";
33391
+ var DEFAULT_CRYSTAL_MAX_TRACE_LENGTH_MM = 10;
33431
33392
  var Crystal = class extends NormalComponent3 {
33432
33393
  get config() {
33433
33394
  const symbolName = this.props.symbolName ?? (this.props.pinVariant === "four_pin" ? "crystal_4pin" : "crystal");
@@ -33475,6 +33436,38 @@ var Crystal = class extends NormalComponent3 {
33475
33436
  });
33476
33437
  this.source_component_id = source_component.source_component_id;
33477
33438
  }
33439
+ doInitialSourceDesignRuleChecks() {
33440
+ super.doInitialSourceDesignRuleChecks();
33441
+ if (!this.source_component_id) return;
33442
+ const { db } = this.root;
33443
+ const maximumTraceLength = this._parsedProps.maxTraceLength ?? DEFAULT_CRYSTAL_MAX_TRACE_LENGTH_MM;
33444
+ const crystalSourcePortIds = /* @__PURE__ */ new Set();
33445
+ const crystalConnectivityMapKeys = /* @__PURE__ */ new Set();
33446
+ for (const sourcePort of db.source_port.list()) {
33447
+ if (sourcePort.source_component_id !== this.source_component_id) continue;
33448
+ crystalSourcePortIds.add(sourcePort.source_port_id);
33449
+ if (sourcePort.subcircuit_connectivity_map_key) {
33450
+ crystalConnectivityMapKeys.add(
33451
+ sourcePort.subcircuit_connectivity_map_key
33452
+ );
33453
+ }
33454
+ }
33455
+ for (const sourceTrace of db.source_trace.list()) {
33456
+ const isDirectlyConnectedToCrystal = sourceTrace.connected_source_port_ids.some(
33457
+ (sourcePortId) => crystalSourcePortIds.has(sourcePortId)
33458
+ );
33459
+ const isOnCrystalNet = sourceTrace.subcircuit_connectivity_map_key !== void 0 && crystalConnectivityMapKeys.has(
33460
+ sourceTrace.subcircuit_connectivity_map_key
33461
+ );
33462
+ if (!isDirectlyConnectedToCrystal && !isOnCrystalNet) continue;
33463
+ if (typeof sourceTrace.max_length === "number" && sourceTrace.max_length <= maximumTraceLength) {
33464
+ continue;
33465
+ }
33466
+ db.source_trace.update(sourceTrace.source_trace_id, {
33467
+ max_length: maximumTraceLength
33468
+ });
33469
+ }
33470
+ }
33478
33471
  };
33479
33472
 
33480
33473
  // lib/components/normal-components/Mosfet.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1506",
4
+ "version": "0.0.1507",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@tscircuit/alphabet": "0.0.25",
37
37
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
38
38
  "@tscircuit/capacity-autorouter": "^0.0.710",
39
- "@tscircuit/checks": "0.0.145",
39
+ "@tscircuit/checks": "0.0.146",
40
40
  "@tscircuit/circuit-json-util": "^0.0.101",
41
41
  "@tscircuit/common": "^0.0.20",
42
42
  "@tscircuit/copper-pour-solver": "0.0.39",