@tscircuit/core 0.0.1485 → 0.0.1487

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
@@ -95131,7 +95131,8 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
95131
95131
  private _getConnectorProps;
95132
95132
  private _hasExplicitFootprint;
95133
95133
  private _shouldUseStandardPartsEngineCircuitJsonFlow;
95134
- private _insertStandardConnectorCircuitJsonError;
95134
+ private _addUsbCCanonicalFallbackPorts;
95135
+ private _handleStandardConnectorCircuitJsonFailure;
95135
95136
  private _getSupplierPartNumbersToTry;
95136
95137
  private _tryFetchPartCircuitJson;
95137
95138
  private _fetchStandardConnectorCircuitJson;
package/dist/index.js CHANGED
@@ -23532,7 +23532,7 @@ function Group_getRoutingPhasePlans(group) {
23532
23532
  var package_default = {
23533
23533
  name: "@tscircuit/core",
23534
23534
  type: "module",
23535
- version: "0.0.1484",
23535
+ version: "0.0.1486",
23536
23536
  types: "dist/index.d.ts",
23537
23537
  main: "dist/index.js",
23538
23538
  module: "dist/index.js",
@@ -23578,7 +23578,7 @@ var package_default = {
23578
23578
  "@tscircuit/jlcpcb-manufacturing-specs": "git+https://github.com/tscircuit/jlcpcb-manufacturing-specs#e08af159db01a37db007e33f0a7268d0e4a279a5",
23579
23579
  "@tscircuit/krt-wasm": "^0.1.1",
23580
23580
  "@tscircuit/log-soup": "^1.0.2",
23581
- "@tscircuit/matchpack": "^0.0.38",
23581
+ "@tscircuit/matchpack": "^0.0.43",
23582
23582
  "@tscircuit/math-utils": "^0.0.36",
23583
23583
  "@tscircuit/miniflex": "^0.0.4",
23584
23584
  "@tscircuit/ngspice-spice-engine": "^0.0.19",
@@ -32545,7 +32545,7 @@ import {
32545
32545
  } from "@tscircuit/props";
32546
32546
  import { source_part_not_found_warning as source_part_not_found_warning3 } from "circuit-json";
32547
32547
 
32548
- // lib/utils/connectors/convertCircuitJsonToUsbCStandardCircuitJson.ts
32548
+ // lib/utils/connectors/usb-c-canonical-pin-definitions.ts
32549
32549
  var STANDARD_USB_C_PIN_LABELS = [
32550
32550
  { label: "GND1", aliases: [] },
32551
32551
  { label: "VBUS1", aliases: [] },
@@ -32564,6 +32564,8 @@ var STANDARD_USB_C_PIN_LABELS = [
32564
32564
  { label: "SHELL3", aliases: ["MH3", "EH3", "MOUNT3"] },
32565
32565
  { label: "SHELL4", aliases: ["MH4", "EH4", "MOUNT4"] }
32566
32566
  ];
32567
+
32568
+ // lib/utils/connectors/convertCircuitJsonToUsbCStandardCircuitJson.ts
32567
32569
  var PIN_NUMBER_HINT_PATTERN = /^(?:pin)?(\d+)$/i;
32568
32570
  var dedupeHintsPreservingOrder = (hints) => Array.from(new Set(hints));
32569
32571
  var convertCircuitJsonToUsbCStandardCircuitJson = (partCircuitJson) => {
@@ -32760,7 +32762,20 @@ var Connector = class extends Chip {
32760
32762
  if (this.getInheritedProperty("partsEngineDisabled")) return false;
32761
32763
  return true;
32762
32764
  }
32763
- _insertStandardConnectorCircuitJsonError(standard, message) {
32765
+ _addUsbCCanonicalFallbackPorts() {
32766
+ if (this.selectAll("port").length > 0) return;
32767
+ this.addAll(
32768
+ STANDARD_USB_C_PIN_LABELS.map(
32769
+ ({ label, aliases }, pinIndex) => new Port({
32770
+ pinNumber: pinIndex + 1,
32771
+ name: label,
32772
+ aliases: [...aliases]
32773
+ })
32774
+ )
32775
+ );
32776
+ this._markDirty("InitializePortsFromChildren");
32777
+ }
32778
+ _handleStandardConnectorCircuitJsonFailure(standard, message) {
32764
32779
  const { db } = this.root;
32765
32780
  const warning = source_part_not_found_warning3.parse({
32766
32781
  type: "source_part_not_found_warning",
@@ -32771,6 +32786,9 @@ var Connector = class extends Chip {
32771
32786
  part_name: this.name
32772
32787
  });
32773
32788
  db.source_part_not_found_warning.insert(warning);
32789
+ if (standard === "usb_c") {
32790
+ this._addUsbCCanonicalFallbackPorts();
32791
+ }
32774
32792
  }
32775
32793
  _getSupplierPartNumbersToTry(supplierPartNumbers) {
32776
32794
  const partNumbers = [];
@@ -32956,7 +32974,7 @@ var Connector = class extends Chip {
32956
32974
  if (this._hasStartedFootprintUrlLoad) return;
32957
32975
  const partsEngine = this.getInheritedProperty("partsEngine");
32958
32976
  if (partsEngine && !partsEngine.fetchPartCircuitJson) {
32959
- this._insertStandardConnectorCircuitJsonError(
32977
+ this._handleStandardConnectorCircuitJsonFailure(
32960
32978
  standard,
32961
32979
  "partsEngine.fetchPartCircuitJson is not configured"
32962
32980
  );
@@ -32991,7 +33009,7 @@ var Connector = class extends Chip {
32991
33009
  sourceComponentForQuery.manufacturer_part_number
32992
33010
  );
32993
33011
  if (!circuitJson) {
32994
- this._insertStandardConnectorCircuitJsonError(
33012
+ this._handleStandardConnectorCircuitJsonFailure(
32995
33013
  standard,
32996
33014
  "part circuit JSON was not found"
32997
33015
  );
@@ -33004,7 +33022,7 @@ var Connector = class extends Chip {
33004
33022
  supplier_part_numbers: {}
33005
33023
  });
33006
33024
  }
33007
- this._insertStandardConnectorCircuitJsonError(standard, error.message);
33025
+ this._handleStandardConnectorCircuitJsonFailure(standard, error.message);
33008
33026
  }
33009
33027
  });
33010
33028
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1485",
4
+ "version": "0.0.1487",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -47,7 +47,7 @@
47
47
  "@tscircuit/jlcpcb-manufacturing-specs": "git+https://github.com/tscircuit/jlcpcb-manufacturing-specs#e08af159db01a37db007e33f0a7268d0e4a279a5",
48
48
  "@tscircuit/krt-wasm": "^0.1.1",
49
49
  "@tscircuit/log-soup": "^1.0.2",
50
- "@tscircuit/matchpack": "^0.0.38",
50
+ "@tscircuit/matchpack": "^0.0.43",
51
51
  "@tscircuit/math-utils": "^0.0.36",
52
52
  "@tscircuit/miniflex": "^0.0.4",
53
53
  "@tscircuit/ngspice-spice-engine": "^0.0.19",