@tscircuit/core 0.0.1505 → 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
  };
@@ -21171,13 +21167,12 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
21171
21167
  sourceComponent
21172
21168
  });
21173
21169
  }).filter((textBox) => Boolean(textBox));
21174
- const componentNameToSectionId = /* @__PURE__ */ new Map();
21170
+ const sectionIdBySchematicComponentId = /* @__PURE__ */ new Map();
21175
21171
  for (const component of group.getDescendants()) {
21176
- if (component.name && component._parsedProps?.schSectionName) {
21177
- componentNameToSectionId.set(
21178
- component.name,
21179
- component._parsedProps.schSectionName
21180
- );
21172
+ const schematicComponentId = component.schematic_component_id;
21173
+ const sectionId = component.getSchematicSectionName();
21174
+ if (schematicComponentId && sectionId) {
21175
+ sectionIdBySchematicComponentId.set(schematicComponentId, sectionId);
21181
21176
  }
21182
21177
  }
21183
21178
  const chips = [];
@@ -21219,10 +21214,9 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
21219
21214
  )
21220
21215
  });
21221
21216
  }
21222
- let sectionId;
21223
- if (sourceComponent?.name) {
21224
- sectionId = componentNameToSectionId.get(sourceComponent.name);
21225
- }
21217
+ const sectionId = sectionIdBySchematicComponentId.get(
21218
+ schematicComponent.schematic_component_id
21219
+ );
21226
21220
  const layoutBounds = getSchematicComponentWithTextBounds({ db, schematicComponent }) ?? getBoundFromCenteredRect4({
21227
21221
  center: schematicComponent.center,
21228
21222
  width: schematicComponent.size.width,
@@ -23654,7 +23648,7 @@ function Group_getRoutingPhasePlans(group) {
23654
23648
  var package_default = {
23655
23649
  name: "@tscircuit/core",
23656
23650
  type: "module",
23657
- version: "0.0.1504",
23651
+ version: "0.0.1506",
23658
23652
  types: "dist/index.d.ts",
23659
23653
  main: "dist/index.js",
23660
23654
  module: "dist/index.js",
@@ -23689,7 +23683,7 @@ var package_default = {
23689
23683
  "@tscircuit/alphabet": "0.0.25",
23690
23684
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
23691
23685
  "@tscircuit/capacity-autorouter": "^0.0.710",
23692
- "@tscircuit/checks": "0.0.145",
23686
+ "@tscircuit/checks": "0.0.146",
23693
23687
  "@tscircuit/circuit-json-util": "^0.0.101",
23694
23688
  "@tscircuit/common": "^0.0.20",
23695
23689
  "@tscircuit/copper-pour-solver": "0.0.39",
@@ -23771,7 +23765,7 @@ var package_default = {
23771
23765
  "@flatten-js/core": "^1.6.2",
23772
23766
  "@lume/kiwi": "^0.4.3",
23773
23767
  "calculate-cell-boundaries": "^0.0.13",
23774
- "calculate-packing": "^0.0.79",
23768
+ "calculate-packing": "^0.0.82",
23775
23769
  "css-select": "5.1.0",
23776
23770
  "format-si-unit": "^0.0.7",
23777
23771
  nanoid: "^5.0.7",
@@ -24439,38 +24433,6 @@ function insertAutoplacedJumpers(params) {
24439
24433
  }
24440
24434
  }
24441
24435
 
24442
- // lib/components/primitive-components/Group/insert-pcb-trace-too-long-warnings.ts
24443
- var insertPcbTraceTooLongWarnings = ({
24444
- db,
24445
- subcircuitId
24446
- }) => {
24447
- for (const warning of db.pcb_trace_too_long_warning.list()) {
24448
- if (warning.subcircuit_id === subcircuitId) {
24449
- db.pcb_trace_too_long_warning.delete(
24450
- warning.pcb_trace_too_long_warning_id
24451
- );
24452
- }
24453
- }
24454
- const pcbTraces = db.pcb_trace.list().filter((pcbTrace) => pcbTrace.subcircuit_id === subcircuitId);
24455
- for (const pcbTrace of pcbTraces) {
24456
- if (!pcbTrace.source_trace_id) continue;
24457
- const sourceTrace = db.source_trace.get(pcbTrace.source_trace_id);
24458
- const maximumTraceLength = sourceTrace?.max_length;
24459
- if (maximumTraceLength === void 0) continue;
24460
- const actualTraceLength = pcbTrace.trace_length ?? getTraceLength(pcbTrace.route);
24461
- if (actualTraceLength <= maximumTraceLength) continue;
24462
- db.pcb_trace_too_long_warning.insert({
24463
- warning_type: "pcb_trace_too_long_warning",
24464
- message: `PCB trace is ${actualTraceLength.toFixed(2)}mm long, exceeding the ${maximumTraceLength}mm maximum`,
24465
- pcb_trace_id: pcbTrace.pcb_trace_id,
24466
- source_trace_id: pcbTrace.source_trace_id,
24467
- actual_trace_length: actualTraceLength,
24468
- maximum_trace_length: maximumTraceLength,
24469
- subcircuit_id: subcircuitId
24470
- });
24471
- }
24472
- };
24473
-
24474
24436
  // lib/components/primitive-components/Group/region-replacement/convert-pcb-trace-to-simplified-pcb-trace.ts
24475
24437
  function convertPcbTraceToSimplifiedPcbTrace(trace) {
24476
24438
  return {
@@ -26049,10 +26011,6 @@ var Group = class extends NormalComponent3 {
26049
26011
  });
26050
26012
  }
26051
26013
  }
26052
- insertPcbTraceTooLongWarnings({
26053
- db,
26054
- subcircuitId: this.subcircuit_id
26055
- });
26056
26014
  }
26057
26015
  }
26058
26016
  doInitialSchematicReplaceNetLabelsWithSymbols() {
@@ -33430,6 +33388,7 @@ var Potentiometer = class extends NormalComponent3 {
33430
33388
  // lib/components/normal-components/Crystal.ts
33431
33389
  import { crystalProps } from "@tscircuit/props";
33432
33390
  import { formatSiUnit as formatSiUnit9 } from "format-si-unit";
33391
+ var DEFAULT_CRYSTAL_MAX_TRACE_LENGTH_MM = 10;
33433
33392
  var Crystal = class extends NormalComponent3 {
33434
33393
  get config() {
33435
33394
  const symbolName = this.props.symbolName ?? (this.props.pinVariant === "four_pin" ? "crystal_4pin" : "crystal");
@@ -33477,6 +33436,38 @@ var Crystal = class extends NormalComponent3 {
33477
33436
  });
33478
33437
  this.source_component_id = source_component.source_component_id;
33479
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
+ }
33480
33471
  };
33481
33472
 
33482
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.1505",
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",
@@ -118,7 +118,7 @@
118
118
  "@flatten-js/core": "^1.6.2",
119
119
  "@lume/kiwi": "^0.4.3",
120
120
  "calculate-cell-boundaries": "^0.0.13",
121
- "calculate-packing": "^0.0.79",
121
+ "calculate-packing": "^0.0.82",
122
122
  "css-select": "5.1.0",
123
123
  "format-si-unit": "^0.0.7",
124
124
  "nanoid": "^5.0.7",