@tscircuit/schematic-viewer 2.0.87 → 2.0.89

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 CHANGED
@@ -449,9 +449,13 @@ var humanizeComponentType = (ftype) => {
449
449
  };
450
450
  var getComponentDetail = (sourceComponent, schematicComponent, primaryLabel) => {
451
451
  const componentType = humanizeComponentType(sourceComponent?.ftype);
452
- let displayName;
453
- if (sourceComponent?.display_name !== primaryLabel) {
454
- displayName = sourceComponent?.display_name;
452
+ let componentDescription = componentType;
453
+ if (sourceComponent?.ftype === "simple_chip" && sourceComponent.manufacturer_part_number) {
454
+ componentDescription = sourceComponent.manufacturer_part_number;
455
+ }
456
+ const detailParts = [];
457
+ if (sourceComponent?.display_name === primaryLabel && sourceComponent.name !== primaryLabel) {
458
+ detailParts.push(sourceComponent.name);
455
459
  }
456
460
  let componentValue = sourceComponent?.display_value;
457
461
  if (!componentValue && sourceComponent) {
@@ -472,10 +476,17 @@ var getComponentDetail = (sourceComponent, schematicComponent, primaryLabel) =>
472
476
  }
473
477
  }
474
478
  componentValue ?? (componentValue = schematicComponent.symbol_display_value);
475
- if (componentType && componentValue) {
476
- return `${componentType} \xB7 ${componentValue}`;
479
+ if (componentDescription) {
480
+ detailParts.push(componentDescription);
481
+ }
482
+ if (componentValue) {
483
+ detailParts.push(componentValue);
484
+ }
485
+ if (!componentDescription && !componentValue && sourceComponent?.manufacturer_part_number) {
486
+ detailParts.push(sourceComponent.manufacturer_part_number);
477
487
  }
478
- return componentValue ?? displayName ?? sourceComponent?.manufacturer_part_number ?? componentType;
488
+ if (detailParts.length === 0) return void 0;
489
+ return detailParts.join(" \xB7 ");
479
490
  };
480
491
  var isSourceComponent = (element) => element.type === "source_component" && "source_component_id" in element;
481
492
  var isSourcePort = (element) => element.type === "source_port";
@@ -509,9 +520,9 @@ var getSchematicSearchResults = (circuitJson, query) => {
509
520
  const resultScores = /* @__PURE__ */ new Map();
510
521
  for (const component of circuitJson.filter(isSchematicComponent)) {
511
522
  const sourceComponent = component.source_component_id ? sourceComponents.get(component.source_component_id) : void 0;
512
- const primaryLabel = sourceComponent?.name ?? sourceComponent?.display_name ?? "Component";
523
+ const primaryLabel = sourceComponent?.display_name ?? sourceComponent?.name ?? "Component";
513
524
  const componentScore = Math.min(
514
- getTextMatchScore(primaryLabel, normalizedQuery),
525
+ getTextMatchScore(sourceComponent?.name, normalizedQuery),
515
526
  getTextMatchScore(sourceComponent?.display_name, normalizedQuery),
516
527
  getTextMatchScore(
517
528
  sourceComponent?.manufacturer_part_number,
@@ -2484,7 +2495,7 @@ import { useMemo as useMemo5 } from "react";
2484
2495
  // package.json
2485
2496
  var package_default = {
2486
2497
  name: "@tscircuit/schematic-viewer",
2487
- version: "2.0.86",
2498
+ version: "2.0.88",
2488
2499
  repository: {
2489
2500
  type: "git",
2490
2501
  url: "https://github.com/tscircuit/schematic-viewer"
@@ -2517,7 +2528,7 @@ var package_default = {
2517
2528
  "react-dom": "^19.1.0",
2518
2529
  "react-reconciler": "^0.31.0",
2519
2530
  semver: "^7.7.2",
2520
- tscircuit: "^0.0.2112",
2531
+ tscircuit: "^0.0.2460",
2521
2532
  tsup: "^8.3.5",
2522
2533
  vite: "^6.0.3"
2523
2534
  },
@@ -2528,8 +2539,8 @@ var package_default = {
2528
2539
  dependencies: {
2529
2540
  "@radix-ui/react-dropdown-menu": "^2.1.16",
2530
2541
  "@tscircuit/circuit-json-util": "^0.0.108",
2531
- "circuit-json": "^0.0.465",
2532
- "circuit-to-svg": "^0.0.393",
2542
+ "circuit-json": "^0.0.479",
2543
+ "circuit-to-svg": "^0.0.410",
2533
2544
  debug: "^4.4.0",
2534
2545
  fflate: "^0.8.3",
2535
2546
  "performance-now": "^2.1.0",