@tscircuit/core 0.0.1420 → 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.
- package/dist/index.js +20 -4
- package/package.json +1 -1
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
|
|
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.
|
|
25615
|
+
version: "0.0.1420",
|
|
25600
25616
|
types: "dist/index.d.ts",
|
|
25601
25617
|
main: "dist/index.js",
|
|
25602
25618
|
module: "dist/index.js",
|