@tscircuit/core 0.0.1419 → 0.0.1421

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -12224,20 +12224,36 @@ var getDefaultExpectedRefDesPrefixesForFtype = (ftype) => {
12224
12224
  return defaultExpectedPrefixesByFtype[ftype];
12225
12225
  };
12226
12226
  var getRefDesPrefix = (refDes) => refDes.match(/^[A-Za-z]+/)?.[0]?.toUpperCase();
12227
+ var chipRefDesRecommendations = [
12228
+ { prefix: "J", recommendation: "a <connector /> or <jumper />" },
12229
+ { prefix: "Q", recommendation: "a <transistor />" },
12230
+ { prefix: "C", recommendation: "a <capacitor />" },
12231
+ { prefix: "R", recommendation: "a <resistor />" },
12232
+ { prefix: "L", recommendation: "an <inductor />" },
12233
+ { prefix: "Y", recommendation: "a <crystal />" },
12234
+ { prefix: "X", recommendation: "a <crystal />" },
12235
+ { prefix: "F", recommendation: "a <fuse />" },
12236
+ { prefix: "S", recommendation: "a <switch /> or <pushbutton />" },
12237
+ { prefix: "TP", recommendation: "a <testpoint />" }
12238
+ ];
12227
12239
  var NormalComponent_doInitialCheckRefDesConvention = (component) => {
12228
12240
  const { db } = component.root;
12229
12241
  if (!component.source_component_id) return;
12230
12242
  const sourceComponent = db.source_component.get(component.source_component_id);
12231
12243
  if (!sourceComponent?.name || !sourceComponent.ftype) return;
12232
- const expectedPrefixes = component.getRefDesPrefixes();
12233
- if (!expectedPrefixes || expectedPrefixes.length === 0) return;
12234
12244
  const actualPrefix = getRefDesPrefix(sourceComponent.name);
12245
+ const chipRefDesRecommendation = component.componentName === "Chip" && sourceComponent.ftype === "simple_chip" && actualPrefix !== void 0 ? chipRefDesRecommendations.find(
12246
+ ({ prefix }) => actualPrefix.startsWith(prefix)
12247
+ ) : void 0;
12248
+ const expectedPrefixes = component.getRefDesPrefixes() ?? (chipRefDesRecommendation ? getDefaultExpectedRefDesPrefixesForFtype("simple_chip") : void 0);
12249
+ if (!expectedPrefixes || expectedPrefixes.length === 0) return;
12235
12250
  if (actualPrefix && expectedPrefixes.includes(actualPrefix)) return;
12236
12251
  const expectedPrefixMessage = expectedPrefixes.length === 1 ? expectedPrefixes[0] : `one of ${expectedPrefixes.join(", ")}`;
12252
+ const message = chipRefDesRecommendation ? `The "${chipRefDesRecommendation.prefix}" prefix is being used with a <chip />, try using it with ${chipRefDesRecommendation.recommendation}` : `Component ${sourceComponent.name} has ftype="${sourceComponent.ftype}" but reference designator should start with ${expectedPrefixMessage}`;
12237
12253
  db.insert({
12238
12254
  type: "source_refdes_convention_warning",
12239
12255
  warning_type: "source_refdes_convention_warning",
12240
- message: `Component ${sourceComponent.name} has ftype="${sourceComponent.ftype}" but reference designator should start with ${expectedPrefixMessage}`,
12256
+ message,
12241
12257
  source_component_id: sourceComponent.source_component_id,
12242
12258
  refdes: sourceComponent.name,
12243
12259
  source_component_ftype: sourceComponent.ftype,
@@ -25596,7 +25612,7 @@ import { identity as identity5 } from "transformation-matrix";
25596
25612
  var package_default = {
25597
25613
  name: "@tscircuit/core",
25598
25614
  type: "module",
25599
- version: "0.0.1418",
25615
+ version: "0.0.1420",
25600
25616
  types: "dist/index.d.ts",
25601
25617
  main: "dist/index.js",
25602
25618
  module: "dist/index.js",
@@ -25633,7 +25649,7 @@ var package_default = {
25633
25649
  "@tscircuit/checks": "0.0.142",
25634
25650
  "@tscircuit/circuit-json-util": "^0.0.97",
25635
25651
  "@tscircuit/common": "^0.0.20",
25636
- "@tscircuit/copper-pour-solver": "0.0.35",
25652
+ "@tscircuit/copper-pour-solver": "0.0.37",
25637
25653
  "@tscircuit/footprinter": "^0.0.371",
25638
25654
  "@tscircuit/image-utils": "^0.0.8",
25639
25655
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1419",
4
+ "version": "0.0.1421",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "@tscircuit/checks": "0.0.142",
39
39
  "@tscircuit/circuit-json-util": "^0.0.97",
40
40
  "@tscircuit/common": "^0.0.20",
41
- "@tscircuit/copper-pour-solver": "0.0.35",
41
+ "@tscircuit/copper-pour-solver": "0.0.37",
42
42
  "@tscircuit/footprinter": "^0.0.371",
43
43
  "@tscircuit/image-utils": "^0.0.8",
44
44
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",