@tscircuit/schematic-viewer 2.0.92 → 2.0.94
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 +198 -77
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,20 @@ import {
|
|
|
1090
1090
|
getPcbElementsWithinBounds
|
|
1091
1091
|
} from "@tscircuit/circuit-json-util";
|
|
1092
1092
|
import { gzipSync, strToU8 } from "fflate";
|
|
1093
|
+
var getComponentWarnings = (circuitJson, schematicComponent, pcbComponent) => circuitJson.filter((element) => {
|
|
1094
|
+
if (!element.type.endsWith("_warning")) return false;
|
|
1095
|
+
const warning = element;
|
|
1096
|
+
const references = [
|
|
1097
|
+
["source_component", schematicComponent.source_component_id],
|
|
1098
|
+
["schematic_component", schematicComponent.schematic_component_id],
|
|
1099
|
+
["pcb_component", pcbComponent?.pcb_component_id]
|
|
1100
|
+
];
|
|
1101
|
+
return references.some(([type, id]) => {
|
|
1102
|
+
if (!id) return false;
|
|
1103
|
+
const ids = warning[`${type}_ids`];
|
|
1104
|
+
return warning[`${type}_id`] === id || Array.isArray(ids) && ids.includes(id) || warning.schematic_element_type === type && warning.schematic_element_id === id;
|
|
1105
|
+
});
|
|
1106
|
+
});
|
|
1093
1107
|
var hiddenSourceComponentKeys = /* @__PURE__ */ new Set([
|
|
1094
1108
|
"type",
|
|
1095
1109
|
"source_component_id",
|
|
@@ -1198,7 +1212,12 @@ var getSchematicComponentDetails = (circuitJson, schematicComponentId) => {
|
|
|
1198
1212
|
pcbComponent,
|
|
1199
1213
|
footprinterString,
|
|
1200
1214
|
footprintPreviewCircuitJson: footprintPreview?.circuitJson,
|
|
1201
|
-
footprintPreviewViewBox: footprintPreview?.viewBox
|
|
1215
|
+
footprintPreviewViewBox: footprintPreview?.viewBox,
|
|
1216
|
+
warnings: getComponentWarnings(
|
|
1217
|
+
circuitJson,
|
|
1218
|
+
schematicComponent,
|
|
1219
|
+
pcbComponent
|
|
1220
|
+
)
|
|
1202
1221
|
};
|
|
1203
1222
|
};
|
|
1204
1223
|
var PCB_PREVIEW_PADDING_MM = 2;
|
|
@@ -1433,6 +1452,7 @@ var detailLabelStyle = {
|
|
|
1433
1452
|
};
|
|
1434
1453
|
var SchematicComponentDetailsTooltip = ({
|
|
1435
1454
|
sourceComponent,
|
|
1455
|
+
warnings = [],
|
|
1436
1456
|
footprinterString,
|
|
1437
1457
|
footprintPreviewCircuitJson,
|
|
1438
1458
|
footprintPreviewViewBox,
|
|
@@ -1567,6 +1587,31 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1567
1587
|
]
|
|
1568
1588
|
}
|
|
1569
1589
|
),
|
|
1590
|
+
warnings.length > 0 && /* @__PURE__ */ jsxs2(
|
|
1591
|
+
"section",
|
|
1592
|
+
{
|
|
1593
|
+
"aria-label": "Component warnings",
|
|
1594
|
+
style: {
|
|
1595
|
+
margin: "0 8px 8px",
|
|
1596
|
+
padding: "8px",
|
|
1597
|
+
border: "1px solid #fcd34d",
|
|
1598
|
+
borderRadius: "4px",
|
|
1599
|
+
backgroundColor: "#fffbeb",
|
|
1600
|
+
color: "#92400e",
|
|
1601
|
+
fontSize: "12px",
|
|
1602
|
+
lineHeight: 1.45,
|
|
1603
|
+
overflowWrap: "anywhere"
|
|
1604
|
+
},
|
|
1605
|
+
children: [
|
|
1606
|
+
/* @__PURE__ */ jsxs2("strong", { children: [
|
|
1607
|
+
"Warnings (",
|
|
1608
|
+
warnings.length,
|
|
1609
|
+
")"
|
|
1610
|
+
] }),
|
|
1611
|
+
/* @__PURE__ */ jsx3("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx3("li", { children: warning.message }, `${warning.type}-${index}`)) })
|
|
1612
|
+
]
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1570
1615
|
footprintPreviewUrl && /* @__PURE__ */ jsx3("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx3(
|
|
1571
1616
|
"div",
|
|
1572
1617
|
{
|
|
@@ -2653,6 +2698,68 @@ var SchematicSheetSelector = ({
|
|
|
2653
2698
|
] });
|
|
2654
2699
|
};
|
|
2655
2700
|
|
|
2701
|
+
// lib/components/SchematicWarningsButton.tsx
|
|
2702
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2703
|
+
var SchematicWarningsButton = ({
|
|
2704
|
+
count,
|
|
2705
|
+
showWarnings,
|
|
2706
|
+
onToggle
|
|
2707
|
+
}) => {
|
|
2708
|
+
const label = `${showWarnings ? "Hide" : "Show"} ${count} ${count === 1 ? "warning" : "warnings"}`;
|
|
2709
|
+
return /* @__PURE__ */ jsxs7(
|
|
2710
|
+
"button",
|
|
2711
|
+
{
|
|
2712
|
+
type: "button",
|
|
2713
|
+
"data-schematic-warnings": true,
|
|
2714
|
+
title: label,
|
|
2715
|
+
"aria-label": label,
|
|
2716
|
+
"aria-pressed": showWarnings,
|
|
2717
|
+
onClick: onToggle,
|
|
2718
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
2719
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
2720
|
+
onTouchStart: (event) => event.stopPropagation(),
|
|
2721
|
+
onTouchEnd: (event) => event.stopPropagation(),
|
|
2722
|
+
style: {
|
|
2723
|
+
height: "32px",
|
|
2724
|
+
display: "flex",
|
|
2725
|
+
alignItems: "center",
|
|
2726
|
+
gap: "4px",
|
|
2727
|
+
padding: "0 8px",
|
|
2728
|
+
border: "none",
|
|
2729
|
+
borderRadius: "4px",
|
|
2730
|
+
backgroundColor: showWarnings ? "#fff3cd" : "#ffffff",
|
|
2731
|
+
color: "#946200",
|
|
2732
|
+
cursor: "pointer",
|
|
2733
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
2734
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
2735
|
+
fontSize: "12px",
|
|
2736
|
+
fontWeight: 600
|
|
2737
|
+
},
|
|
2738
|
+
children: [
|
|
2739
|
+
/* @__PURE__ */ jsxs7(
|
|
2740
|
+
"svg",
|
|
2741
|
+
{
|
|
2742
|
+
width: "16",
|
|
2743
|
+
height: "16",
|
|
2744
|
+
viewBox: "0 0 24 24",
|
|
2745
|
+
fill: "none",
|
|
2746
|
+
stroke: "currentColor",
|
|
2747
|
+
strokeWidth: "2",
|
|
2748
|
+
strokeLinecap: "round",
|
|
2749
|
+
strokeLinejoin: "round",
|
|
2750
|
+
"aria-hidden": "true",
|
|
2751
|
+
children: [
|
|
2752
|
+
/* @__PURE__ */ jsx9("path", { d: "M10.3 3.9 1.8 18.1A2 2 0 0 0 3.5 21h17a2 2 0 0 0 1.7-2.9L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
|
|
2753
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 9v4m0 4h.01" })
|
|
2754
|
+
]
|
|
2755
|
+
}
|
|
2756
|
+
),
|
|
2757
|
+
/* @__PURE__ */ jsx9("span", { children: count })
|
|
2758
|
+
]
|
|
2759
|
+
}
|
|
2760
|
+
);
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2656
2763
|
// lib/components/ViewMenu.tsx
|
|
2657
2764
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
2658
2765
|
import { su as su3 } from "@tscircuit/soup-util";
|
|
@@ -2661,7 +2768,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
2661
2768
|
// package.json
|
|
2662
2769
|
var package_default = {
|
|
2663
2770
|
name: "@tscircuit/schematic-viewer",
|
|
2664
|
-
version: "2.0.
|
|
2771
|
+
version: "2.0.93",
|
|
2665
2772
|
repository: {
|
|
2666
2773
|
type: "git",
|
|
2667
2774
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -2717,7 +2824,7 @@ var package_default = {
|
|
|
2717
2824
|
};
|
|
2718
2825
|
|
|
2719
2826
|
// lib/components/ViewMenu.tsx
|
|
2720
|
-
import { jsx as
|
|
2827
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2721
2828
|
var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
2722
2829
|
var contentStyles2 = {
|
|
2723
2830
|
backgroundColor: "#262626",
|
|
@@ -2766,7 +2873,7 @@ var HIGHLIGHT_CSS = `
|
|
|
2766
2873
|
.sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
|
|
2767
2874
|
.sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
|
|
2768
2875
|
`;
|
|
2769
|
-
var CheckIcon2 = () => /* @__PURE__ */
|
|
2876
|
+
var CheckIcon2 = () => /* @__PURE__ */ jsx10(
|
|
2770
2877
|
"svg",
|
|
2771
2878
|
{
|
|
2772
2879
|
width: "14",
|
|
@@ -2778,7 +2885,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx9(
|
|
|
2778
2885
|
strokeLinecap: "round",
|
|
2779
2886
|
strokeLinejoin: "round",
|
|
2780
2887
|
"aria-hidden": "true",
|
|
2781
|
-
children: /* @__PURE__ */
|
|
2888
|
+
children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
|
|
2782
2889
|
}
|
|
2783
2890
|
);
|
|
2784
2891
|
var ViewMenu = ({
|
|
@@ -2830,7 +2937,7 @@ var ViewMenu = ({
|
|
|
2830
2937
|
return false;
|
|
2831
2938
|
}
|
|
2832
2939
|
}, [circuitJsonKey]);
|
|
2833
|
-
return /* @__PURE__ */
|
|
2940
|
+
return /* @__PURE__ */ jsx10(
|
|
2834
2941
|
"div",
|
|
2835
2942
|
{
|
|
2836
2943
|
ref: menuRef,
|
|
@@ -2841,9 +2948,9 @@ var ViewMenu = ({
|
|
|
2841
2948
|
width: 0,
|
|
2842
2949
|
height: 0
|
|
2843
2950
|
},
|
|
2844
|
-
children: /* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2951
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
|
|
2952
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx10("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
2953
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs8(
|
|
2847
2954
|
DropdownMenu2.Content,
|
|
2848
2955
|
{
|
|
2849
2956
|
style: contentStyles2,
|
|
@@ -2852,8 +2959,8 @@ var ViewMenu = ({
|
|
|
2852
2959
|
collisionPadding: 10,
|
|
2853
2960
|
avoidCollisions: true,
|
|
2854
2961
|
children: [
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2962
|
+
/* @__PURE__ */ jsx10("style", { children: HIGHLIGHT_CSS }),
|
|
2963
|
+
/* @__PURE__ */ jsxs8(
|
|
2857
2964
|
DropdownMenu2.Item,
|
|
2858
2965
|
{
|
|
2859
2966
|
className: "sv-vm-item",
|
|
@@ -2866,12 +2973,12 @@ var ViewMenu = ({
|
|
|
2866
2973
|
if (hasPorts) onTogglePorts(!showPorts);
|
|
2867
2974
|
},
|
|
2868
2975
|
children: [
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2977
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Schematic Ports" })
|
|
2871
2978
|
]
|
|
2872
2979
|
}
|
|
2873
2980
|
),
|
|
2874
|
-
/* @__PURE__ */
|
|
2981
|
+
/* @__PURE__ */ jsxs8(
|
|
2875
2982
|
DropdownMenu2.Item,
|
|
2876
2983
|
{
|
|
2877
2984
|
className: "sv-vm-item",
|
|
@@ -2884,12 +2991,12 @@ var ViewMenu = ({
|
|
|
2884
2991
|
if (hasGroups) onToggleGroups(!showGroups);
|
|
2885
2992
|
},
|
|
2886
2993
|
children: [
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
2994
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2995
|
+
/* @__PURE__ */ jsx10("span", { children: "View Schematic Groups" })
|
|
2889
2996
|
]
|
|
2890
2997
|
}
|
|
2891
2998
|
),
|
|
2892
|
-
/* @__PURE__ */
|
|
2999
|
+
/* @__PURE__ */ jsxs8(
|
|
2893
3000
|
DropdownMenu2.Item,
|
|
2894
3001
|
{
|
|
2895
3002
|
className: "sv-vm-item",
|
|
@@ -2900,12 +3007,12 @@ var ViewMenu = ({
|
|
|
2900
3007
|
onToggleGrid(!showGrid);
|
|
2901
3008
|
},
|
|
2902
3009
|
children: [
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
3011
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Grid" })
|
|
2905
3012
|
]
|
|
2906
3013
|
}
|
|
2907
3014
|
),
|
|
2908
|
-
/* @__PURE__ */
|
|
3015
|
+
/* @__PURE__ */ jsxs8(
|
|
2909
3016
|
DropdownMenu2.CheckboxItem,
|
|
2910
3017
|
{
|
|
2911
3018
|
className: "sv-vm-item",
|
|
@@ -2914,26 +3021,26 @@ var ViewMenu = ({
|
|
|
2914
3021
|
onCheckedChange: onToggleWarnings,
|
|
2915
3022
|
onSelect: (event) => event.preventDefault(),
|
|
2916
3023
|
children: [
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx10(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx10(CheckIcon2, {}) }) }),
|
|
3025
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Warnings" })
|
|
2919
3026
|
]
|
|
2920
3027
|
}
|
|
2921
3028
|
),
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
/* @__PURE__ */
|
|
3029
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
3030
|
+
/* @__PURE__ */ jsxs8(
|
|
2924
3031
|
DropdownMenu2.Item,
|
|
2925
3032
|
{
|
|
2926
3033
|
className: "sv-vm-item",
|
|
2927
3034
|
style: itemStyles2,
|
|
2928
3035
|
onSelect: onRunStyleAnalysis,
|
|
2929
3036
|
children: [
|
|
2930
|
-
/* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
3037
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2 }),
|
|
3038
|
+
/* @__PURE__ */ jsx10("span", { children: "Run Style Analysis" })
|
|
2932
3039
|
]
|
|
2933
3040
|
}
|
|
2934
3041
|
),
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
3042
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
3043
|
+
/* @__PURE__ */ jsxs8(
|
|
2937
3044
|
"div",
|
|
2938
3045
|
{
|
|
2939
3046
|
style: {
|
|
@@ -2959,7 +3066,7 @@ var ViewMenu = ({
|
|
|
2959
3066
|
};
|
|
2960
3067
|
|
|
2961
3068
|
// lib/components/SchematicViewer.tsx
|
|
2962
|
-
import { jsx as
|
|
3069
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2963
3070
|
var SchematicViewer = ({
|
|
2964
3071
|
circuitJson,
|
|
2965
3072
|
containerStyle,
|
|
@@ -3024,6 +3131,9 @@ var SchematicViewer = ({
|
|
|
3024
3131
|
const [showGridInternal, setShowGridInternal] = useState9(false);
|
|
3025
3132
|
const [analysisCircuitJson, setAnalysisCircuitJson] = useState9(null);
|
|
3026
3133
|
const [showWarnings, setShowWarnings] = useState9(false);
|
|
3134
|
+
const warningCount = circuitJson.filter(
|
|
3135
|
+
(element) => element.type.startsWith("schematic_") && element.type.endsWith("_warning")
|
|
3136
|
+
).length;
|
|
3027
3137
|
const showGrid = debugGrid || showGridInternal;
|
|
3028
3138
|
const [isInteractionEnabled, setIsInteractionEnabled] = useState9(
|
|
3029
3139
|
!clickToInteractEnabled
|
|
@@ -3123,7 +3233,9 @@ var SchematicViewer = ({
|
|
|
3123
3233
|
};
|
|
3124
3234
|
const shouldPanSchematic = useCallback7(
|
|
3125
3235
|
(event) => {
|
|
3126
|
-
if (event.target instanceof Element && event.target.closest(
|
|
3236
|
+
if (event.target instanceof Element && event.target.closest(
|
|
3237
|
+
"[data-schematic-search], [data-schematic-warnings]"
|
|
3238
|
+
)) {
|
|
3127
3239
|
return false;
|
|
3128
3240
|
}
|
|
3129
3241
|
if (event.type !== "mousedown" || !("button" in event)) return true;
|
|
@@ -3290,7 +3402,7 @@ var SchematicViewer = ({
|
|
|
3290
3402
|
enabled: netHoverHighlightEnabled
|
|
3291
3403
|
});
|
|
3292
3404
|
const svgDiv = useMemo6(
|
|
3293
|
-
() => /* @__PURE__ */
|
|
3405
|
+
() => /* @__PURE__ */ jsx11(
|
|
3294
3406
|
"div",
|
|
3295
3407
|
{
|
|
3296
3408
|
ref: svgDivRef,
|
|
@@ -3304,10 +3416,10 @@ var SchematicViewer = ({
|
|
|
3304
3416
|
),
|
|
3305
3417
|
[svgString, isInteractionEnabled, clickToInteractEnabled]
|
|
3306
3418
|
);
|
|
3307
|
-
return /* @__PURE__ */
|
|
3308
|
-
netHoverHighlightEnabled && /* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ jsxs9(MouseTracker, { children: [
|
|
3420
|
+
netHoverHighlightEnabled && /* @__PURE__ */ jsx11("style", { children: `.sch-net-faded { opacity: 0.35; }
|
|
3309
3421
|
svg :is(g.trace, g.trace-overlays, g[data-schematic-component-id], [data-schematic-net-label-id]) { transition: opacity 0.12s ease-in-out; }` }),
|
|
3310
|
-
searchEnabled && /* @__PURE__ */
|
|
3422
|
+
searchEnabled && /* @__PURE__ */ jsx11("style", { children: `.schematic-search-match text,
|
|
3311
3423
|
text.schematic-search-match {
|
|
3312
3424
|
fill: #ff00d4 !important;
|
|
3313
3425
|
}
|
|
@@ -3323,9 +3435,9 @@ var SchematicViewer = ({
|
|
|
3323
3435
|
flex-direction: column;
|
|
3324
3436
|
}
|
|
3325
3437
|
}` }),
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
onSchematicPortClicked && /* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3438
|
+
/* @__PURE__ */ jsx11("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
|
|
3439
|
+
onSchematicPortClicked && /* @__PURE__ */ jsx11("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
|
|
3440
|
+
/* @__PURE__ */ jsxs9(
|
|
3329
3441
|
"div",
|
|
3330
3442
|
{
|
|
3331
3443
|
ref: containerRef,
|
|
@@ -3360,7 +3472,7 @@ var SchematicViewer = ({
|
|
|
3360
3472
|
},
|
|
3361
3473
|
onTouchCancel: contextMenuEventHandlers.onTouchCancel,
|
|
3362
3474
|
children: [
|
|
3363
|
-
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */
|
|
3475
|
+
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx11(
|
|
3364
3476
|
"div",
|
|
3365
3477
|
{
|
|
3366
3478
|
onClick: (e) => {
|
|
@@ -3379,7 +3491,7 @@ var SchematicViewer = ({
|
|
|
3379
3491
|
pointerEvents: "all",
|
|
3380
3492
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
3381
3493
|
},
|
|
3382
|
-
children: /* @__PURE__ */
|
|
3494
|
+
children: /* @__PURE__ */ jsx11(
|
|
3383
3495
|
"div",
|
|
3384
3496
|
{
|
|
3385
3497
|
style: {
|
|
@@ -3396,14 +3508,14 @@ var SchematicViewer = ({
|
|
|
3396
3508
|
)
|
|
3397
3509
|
}
|
|
3398
3510
|
),
|
|
3399
|
-
analysisCircuitJson && /* @__PURE__ */
|
|
3511
|
+
analysisCircuitJson && /* @__PURE__ */ jsx11(
|
|
3400
3512
|
StyleAnalysisDialog,
|
|
3401
3513
|
{
|
|
3402
3514
|
circuitJson: analysisCircuitJson,
|
|
3403
3515
|
onClose: () => setAnalysisCircuitJson(null)
|
|
3404
3516
|
}
|
|
3405
3517
|
),
|
|
3406
|
-
menuVisible && /* @__PURE__ */
|
|
3518
|
+
menuVisible && /* @__PURE__ */ jsx11(
|
|
3407
3519
|
ViewMenu,
|
|
3408
3520
|
{
|
|
3409
3521
|
circuitJson,
|
|
@@ -3436,7 +3548,7 @@ var SchematicViewer = ({
|
|
|
3436
3548
|
onToggleGrid: setShowGridInternal
|
|
3437
3549
|
}
|
|
3438
3550
|
),
|
|
3439
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsxs9(
|
|
3440
3552
|
"div",
|
|
3441
3553
|
{
|
|
3442
3554
|
className: "schematic-viewer-toolbar",
|
|
@@ -3450,7 +3562,7 @@ var SchematicViewer = ({
|
|
|
3450
3562
|
zIndex: zIndexMap.schematicSearch
|
|
3451
3563
|
},
|
|
3452
3564
|
children: [
|
|
3453
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx11(
|
|
3454
3566
|
SchematicSheetSelector,
|
|
3455
3567
|
{
|
|
3456
3568
|
sheets: schematicSheets,
|
|
@@ -3458,7 +3570,7 @@ var SchematicViewer = ({
|
|
|
3458
3570
|
onSelectSheet: handleSelectSheet
|
|
3459
3571
|
}
|
|
3460
3572
|
),
|
|
3461
|
-
searchEnabled && /* @__PURE__ */
|
|
3573
|
+
searchEnabled && /* @__PURE__ */ jsx11(
|
|
3462
3574
|
SchematicSearch,
|
|
3463
3575
|
{
|
|
3464
3576
|
query: searchQuery,
|
|
@@ -3468,11 +3580,19 @@ var SchematicViewer = ({
|
|
|
3468
3580
|
onSelect: handleSearchResultSelect,
|
|
3469
3581
|
viewerContainerRef: containerRef
|
|
3470
3582
|
}
|
|
3583
|
+
),
|
|
3584
|
+
warningCount > 0 && /* @__PURE__ */ jsx11(
|
|
3585
|
+
SchematicWarningsButton,
|
|
3586
|
+
{
|
|
3587
|
+
count: warningCount,
|
|
3588
|
+
showWarnings,
|
|
3589
|
+
onToggle: () => setShowWarnings((show) => !show)
|
|
3590
|
+
}
|
|
3471
3591
|
)
|
|
3472
3592
|
]
|
|
3473
3593
|
}
|
|
3474
3594
|
),
|
|
3475
|
-
schematicComponentIds.map((componentId) => /* @__PURE__ */
|
|
3595
|
+
schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx11(
|
|
3476
3596
|
SchematicComponentMouseTarget,
|
|
3477
3597
|
{
|
|
3478
3598
|
componentId,
|
|
@@ -3486,17 +3606,18 @@ var SchematicViewer = ({
|
|
|
3486
3606
|
componentId
|
|
3487
3607
|
)),
|
|
3488
3608
|
svgDiv,
|
|
3489
|
-
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */
|
|
3609
|
+
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx11(
|
|
3490
3610
|
SchematicComponentDetailsTooltip,
|
|
3491
3611
|
{
|
|
3492
3612
|
sourceComponent: selectedComponentDetails.sourceComponent,
|
|
3613
|
+
warnings: selectedComponentDetails.warnings,
|
|
3493
3614
|
footprinterString: selectedComponentDetails.footprinterString,
|
|
3494
3615
|
footprintPreviewCircuitJson: selectedComponentDetails.footprintPreviewCircuitJson,
|
|
3495
3616
|
footprintPreviewViewBox: selectedComponentDetails.footprintPreviewViewBox,
|
|
3496
3617
|
...componentTooltipLayout
|
|
3497
3618
|
}
|
|
3498
3619
|
),
|
|
3499
|
-
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */
|
|
3620
|
+
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx11(
|
|
3500
3621
|
SchematicPortMouseTarget,
|
|
3501
3622
|
{
|
|
3502
3623
|
portId,
|
|
@@ -3545,7 +3666,7 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
|
|
|
3545
3666
|
// lib/components/AnalogSimulationSelector.tsx
|
|
3546
3667
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
3547
3668
|
import { useState as useState10 } from "react";
|
|
3548
|
-
import { Fragment as Fragment6, jsx as
|
|
3669
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3549
3670
|
var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
3550
3671
|
var contentStyles3 = {
|
|
3551
3672
|
backgroundColor: "#ffffff",
|
|
@@ -3595,7 +3716,7 @@ var MENU_CSS2 = `
|
|
|
3595
3716
|
.sv-simulation-chevron { transition: transform 0.2s ease; }
|
|
3596
3717
|
[data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
|
|
3597
3718
|
`;
|
|
3598
|
-
var CheckIcon3 = () => /* @__PURE__ */
|
|
3719
|
+
var CheckIcon3 = () => /* @__PURE__ */ jsx12(
|
|
3599
3720
|
"svg",
|
|
3600
3721
|
{
|
|
3601
3722
|
width: "14",
|
|
@@ -3607,10 +3728,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx11(
|
|
|
3607
3728
|
strokeLinecap: "round",
|
|
3608
3729
|
strokeLinejoin: "round",
|
|
3609
3730
|
"aria-hidden": "true",
|
|
3610
|
-
children: /* @__PURE__ */
|
|
3731
|
+
children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
|
|
3611
3732
|
}
|
|
3612
3733
|
);
|
|
3613
|
-
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */
|
|
3734
|
+
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx12(
|
|
3614
3735
|
"svg",
|
|
3615
3736
|
{
|
|
3616
3737
|
className,
|
|
@@ -3624,7 +3745,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx11(
|
|
|
3624
3745
|
strokeLinejoin: "round",
|
|
3625
3746
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
3626
3747
|
"aria-hidden": "true",
|
|
3627
|
-
children: /* @__PURE__ */
|
|
3748
|
+
children: /* @__PURE__ */ jsx12("path", { d: "m6 9 6 6 6-6" })
|
|
3628
3749
|
}
|
|
3629
3750
|
);
|
|
3630
3751
|
var getSimulationLabels = (simulations) => {
|
|
@@ -3650,10 +3771,10 @@ var AnalogSimulationSelector = ({
|
|
|
3650
3771
|
({ simulation }) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
3651
3772
|
);
|
|
3652
3773
|
const selectedLabel = selectedSimulation?.label ?? "Select simulation";
|
|
3653
|
-
return /* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
3775
|
+
/* @__PURE__ */ jsx12("style", { children: MENU_CSS2 }),
|
|
3776
|
+
/* @__PURE__ */ jsxs10(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
3777
|
+
/* @__PURE__ */ jsx12(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
3657
3778
|
"button",
|
|
3658
3779
|
{
|
|
3659
3780
|
type: "button",
|
|
@@ -3680,13 +3801,13 @@ var AnalogSimulationSelector = ({
|
|
|
3680
3801
|
zIndex: zIndexMap.viewMenuIcon
|
|
3681
3802
|
},
|
|
3682
3803
|
children: [
|
|
3683
|
-
/* @__PURE__ */
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3804
|
+
/* @__PURE__ */ jsx12("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
|
|
3805
|
+
/* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
|
|
3806
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon2, { className: "sv-simulation-chevron" })
|
|
3686
3807
|
]
|
|
3687
3808
|
}
|
|
3688
3809
|
) }),
|
|
3689
|
-
/* @__PURE__ */
|
|
3810
|
+
/* @__PURE__ */ jsx12(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx12(
|
|
3690
3811
|
DropdownMenu3.Content,
|
|
3691
3812
|
{
|
|
3692
3813
|
style: contentStyles3,
|
|
@@ -3696,7 +3817,7 @@ var AnalogSimulationSelector = ({
|
|
|
3696
3817
|
collisionPadding: 10,
|
|
3697
3818
|
children: simulationLabels.map(({ simulation, label }) => {
|
|
3698
3819
|
const selected = simulation.simulation_experiment_id === selectedSimulationExperimentId;
|
|
3699
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsxs10(
|
|
3700
3821
|
DropdownMenu3.Item,
|
|
3701
3822
|
{
|
|
3702
3823
|
className: "sv-simulation-item",
|
|
@@ -3708,8 +3829,8 @@ var AnalogSimulationSelector = ({
|
|
|
3708
3829
|
setOpen(false);
|
|
3709
3830
|
},
|
|
3710
3831
|
children: [
|
|
3711
|
-
/* @__PURE__ */
|
|
3712
|
-
/* @__PURE__ */
|
|
3832
|
+
/* @__PURE__ */ jsx12("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx12(CheckIcon3, {}) }),
|
|
3833
|
+
/* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
|
|
3713
3834
|
]
|
|
3714
3835
|
},
|
|
3715
3836
|
simulation.simulation_experiment_id
|
|
@@ -3722,7 +3843,7 @@ var AnalogSimulationSelector = ({
|
|
|
3722
3843
|
};
|
|
3723
3844
|
|
|
3724
3845
|
// lib/components/AnalogSimulationViewer.tsx
|
|
3725
|
-
import { jsx as
|
|
3846
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3726
3847
|
var DEFAULT_RENDER_WIDTH = 1200;
|
|
3727
3848
|
var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
|
|
3728
3849
|
var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
|
|
@@ -3856,7 +3977,7 @@ var AnalogSimulationViewer = ({
|
|
|
3856
3977
|
};
|
|
3857
3978
|
}, []);
|
|
3858
3979
|
if (isLoading) {
|
|
3859
|
-
return /* @__PURE__ */
|
|
3980
|
+
return /* @__PURE__ */ jsx13(
|
|
3860
3981
|
"div",
|
|
3861
3982
|
{
|
|
3862
3983
|
style: {
|
|
@@ -3876,7 +3997,7 @@ var AnalogSimulationViewer = ({
|
|
|
3876
3997
|
);
|
|
3877
3998
|
}
|
|
3878
3999
|
if (error) {
|
|
3879
|
-
return /* @__PURE__ */
|
|
4000
|
+
return /* @__PURE__ */ jsx13(
|
|
3880
4001
|
"div",
|
|
3881
4002
|
{
|
|
3882
4003
|
style: {
|
|
@@ -3891,15 +4012,15 @@ var AnalogSimulationViewer = ({
|
|
|
3891
4012
|
...containerStyle
|
|
3892
4013
|
},
|
|
3893
4014
|
className,
|
|
3894
|
-
children: /* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
4015
|
+
children: /* @__PURE__ */ jsxs11("div", { style: { textAlign: "center", padding: "20px" }, children: [
|
|
4016
|
+
/* @__PURE__ */ jsx13("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
|
|
4017
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: "14px" }, children: error })
|
|
3897
4018
|
] })
|
|
3898
4019
|
}
|
|
3899
4020
|
);
|
|
3900
4021
|
}
|
|
3901
4022
|
if (!simulationSvg) {
|
|
3902
|
-
return /* @__PURE__ */
|
|
4023
|
+
return /* @__PURE__ */ jsxs11(
|
|
3903
4024
|
"div",
|
|
3904
4025
|
{
|
|
3905
4026
|
style: {
|
|
@@ -3915,11 +4036,11 @@ var AnalogSimulationViewer = ({
|
|
|
3915
4036
|
},
|
|
3916
4037
|
className,
|
|
3917
4038
|
children: [
|
|
3918
|
-
/* @__PURE__ */
|
|
3919
|
-
/* @__PURE__ */
|
|
4039
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
|
|
4040
|
+
/* @__PURE__ */ jsxs11("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
|
|
3920
4041
|
"Use",
|
|
3921
4042
|
" ",
|
|
3922
|
-
/* @__PURE__ */
|
|
4043
|
+
/* @__PURE__ */ jsx13(
|
|
3923
4044
|
"code",
|
|
3924
4045
|
{
|
|
3925
4046
|
style: {
|
|
@@ -3939,7 +4060,7 @@ var AnalogSimulationViewer = ({
|
|
|
3939
4060
|
}
|
|
3940
4061
|
);
|
|
3941
4062
|
}
|
|
3942
|
-
return /* @__PURE__ */
|
|
4063
|
+
return /* @__PURE__ */ jsxs11(
|
|
3943
4064
|
"div",
|
|
3944
4065
|
{
|
|
3945
4066
|
ref: (node) => {
|
|
@@ -3958,7 +4079,7 @@ var AnalogSimulationViewer = ({
|
|
|
3958
4079
|
onMouseDown: handleMouseDown,
|
|
3959
4080
|
onTouchStart: handleTouchStart,
|
|
3960
4081
|
children: [
|
|
3961
|
-
/* @__PURE__ */
|
|
4082
|
+
/* @__PURE__ */ jsx13(
|
|
3962
4083
|
AnalogSimulationSelector,
|
|
3963
4084
|
{
|
|
3964
4085
|
simulations: simulationExperiments,
|
|
@@ -3966,7 +4087,7 @@ var AnalogSimulationViewer = ({
|
|
|
3966
4087
|
onSelectSimulation: handleSelectSimulation
|
|
3967
4088
|
}
|
|
3968
4089
|
),
|
|
3969
|
-
svgObjectUrl ? /* @__PURE__ */
|
|
4090
|
+
svgObjectUrl ? /* @__PURE__ */ jsx13(
|
|
3970
4091
|
"img",
|
|
3971
4092
|
{
|
|
3972
4093
|
ref: imgRef,
|
|
@@ -3980,7 +4101,7 @@ var AnalogSimulationViewer = ({
|
|
|
3980
4101
|
objectFit: "contain"
|
|
3981
4102
|
}
|
|
3982
4103
|
}
|
|
3983
|
-
) : /* @__PURE__ */
|
|
4104
|
+
) : /* @__PURE__ */ jsx13(
|
|
3984
4105
|
"div",
|
|
3985
4106
|
{
|
|
3986
4107
|
style: {
|