@tscircuit/schematic-viewer 2.0.97 → 2.0.98
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 +22 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -873,6 +873,23 @@ var getSchematicSearchResults = (circuitJson, query) => {
|
|
|
873
873
|
results.push(result);
|
|
874
874
|
resultScores.set(result, getTextMatchScore(netLabel.text, normalizedQuery));
|
|
875
875
|
}
|
|
876
|
+
for (const element of circuitJson) {
|
|
877
|
+
if (element.type !== "schematic_text" || !element.source_trace_id) continue;
|
|
878
|
+
const score = getTextMatchScore(element.text, normalizedQuery);
|
|
879
|
+
if (!Number.isFinite(score)) continue;
|
|
880
|
+
const result = {
|
|
881
|
+
label: element.text,
|
|
882
|
+
kind: "net",
|
|
883
|
+
schematicSheetId: element.schematic_sheet_id,
|
|
884
|
+
schematicSheetName: getSchematicSheetName({
|
|
885
|
+
schematicSheets,
|
|
886
|
+
schematicSheetId: element.schematic_sheet_id
|
|
887
|
+
}),
|
|
888
|
+
target: { type: "schematic_text", id: element.schematic_text_id }
|
|
889
|
+
};
|
|
890
|
+
results.push(result);
|
|
891
|
+
resultScores.set(result, score);
|
|
892
|
+
}
|
|
876
893
|
return results.sort((a, b) => {
|
|
877
894
|
return (resultScores.get(a) ?? Number.POSITIVE_INFINITY) - (resultScores.get(b) ?? Number.POSITIVE_INFINITY) || a.label.localeCompare(b.label);
|
|
878
895
|
});
|
|
@@ -940,6 +957,9 @@ var useSchematicSearch = ({
|
|
|
940
957
|
if (result.target.type === "schematic_component") {
|
|
941
958
|
attribute = "data-schematic-component-id";
|
|
942
959
|
}
|
|
960
|
+
if (result.target.type === "schematic_text") {
|
|
961
|
+
attribute = "data-schematic-text-id";
|
|
962
|
+
}
|
|
943
963
|
const target = Array.from(
|
|
944
964
|
svgRoot.querySelectorAll(`[${attribute}]`)
|
|
945
965
|
).find((element) => element.getAttribute(attribute) === result.target.id);
|
|
@@ -2925,7 +2945,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
2925
2945
|
// package.json
|
|
2926
2946
|
var package_default = {
|
|
2927
2947
|
name: "@tscircuit/schematic-viewer",
|
|
2928
|
-
version: "2.0.
|
|
2948
|
+
version: "2.0.97",
|
|
2929
2949
|
repository: {
|
|
2930
2950
|
type: "git",
|
|
2931
2951
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -2972,7 +2992,7 @@ var package_default = {
|
|
|
2972
2992
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
2973
2993
|
"@tscircuit/circuit-json-util": "^0.0.108",
|
|
2974
2994
|
"circuit-json": "^0.0.479",
|
|
2975
|
-
"circuit-to-svg": "^0.0.
|
|
2995
|
+
"circuit-to-svg": "^0.0.432",
|
|
2976
2996
|
debug: "^4.4.0",
|
|
2977
2997
|
fflate: "^0.8.3",
|
|
2978
2998
|
"performance-now": "^2.1.0",
|