@tscircuit/schematic-viewer 2.0.92 → 2.0.93
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 +151 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2653,6 +2653,68 @@ var SchematicSheetSelector = ({
|
|
|
2653
2653
|
] });
|
|
2654
2654
|
};
|
|
2655
2655
|
|
|
2656
|
+
// lib/components/SchematicWarningsButton.tsx
|
|
2657
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2658
|
+
var SchematicWarningsButton = ({
|
|
2659
|
+
count,
|
|
2660
|
+
showWarnings,
|
|
2661
|
+
onToggle
|
|
2662
|
+
}) => {
|
|
2663
|
+
const label = `${showWarnings ? "Hide" : "Show"} ${count} ${count === 1 ? "warning" : "warnings"}`;
|
|
2664
|
+
return /* @__PURE__ */ jsxs7(
|
|
2665
|
+
"button",
|
|
2666
|
+
{
|
|
2667
|
+
type: "button",
|
|
2668
|
+
"data-schematic-warnings": true,
|
|
2669
|
+
title: label,
|
|
2670
|
+
"aria-label": label,
|
|
2671
|
+
"aria-pressed": showWarnings,
|
|
2672
|
+
onClick: onToggle,
|
|
2673
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
2674
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
2675
|
+
onTouchStart: (event) => event.stopPropagation(),
|
|
2676
|
+
onTouchEnd: (event) => event.stopPropagation(),
|
|
2677
|
+
style: {
|
|
2678
|
+
height: "32px",
|
|
2679
|
+
display: "flex",
|
|
2680
|
+
alignItems: "center",
|
|
2681
|
+
gap: "4px",
|
|
2682
|
+
padding: "0 8px",
|
|
2683
|
+
border: "none",
|
|
2684
|
+
borderRadius: "4px",
|
|
2685
|
+
backgroundColor: showWarnings ? "#fff3cd" : "#ffffff",
|
|
2686
|
+
color: "#946200",
|
|
2687
|
+
cursor: "pointer",
|
|
2688
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
2689
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
2690
|
+
fontSize: "12px",
|
|
2691
|
+
fontWeight: 600
|
|
2692
|
+
},
|
|
2693
|
+
children: [
|
|
2694
|
+
/* @__PURE__ */ jsxs7(
|
|
2695
|
+
"svg",
|
|
2696
|
+
{
|
|
2697
|
+
width: "16",
|
|
2698
|
+
height: "16",
|
|
2699
|
+
viewBox: "0 0 24 24",
|
|
2700
|
+
fill: "none",
|
|
2701
|
+
stroke: "currentColor",
|
|
2702
|
+
strokeWidth: "2",
|
|
2703
|
+
strokeLinecap: "round",
|
|
2704
|
+
strokeLinejoin: "round",
|
|
2705
|
+
"aria-hidden": "true",
|
|
2706
|
+
children: [
|
|
2707
|
+
/* @__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" }),
|
|
2708
|
+
/* @__PURE__ */ jsx9("path", { d: "M12 9v4m0 4h.01" })
|
|
2709
|
+
]
|
|
2710
|
+
}
|
|
2711
|
+
),
|
|
2712
|
+
/* @__PURE__ */ jsx9("span", { children: count })
|
|
2713
|
+
]
|
|
2714
|
+
}
|
|
2715
|
+
);
|
|
2716
|
+
};
|
|
2717
|
+
|
|
2656
2718
|
// lib/components/ViewMenu.tsx
|
|
2657
2719
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
2658
2720
|
import { su as su3 } from "@tscircuit/soup-util";
|
|
@@ -2661,7 +2723,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
2661
2723
|
// package.json
|
|
2662
2724
|
var package_default = {
|
|
2663
2725
|
name: "@tscircuit/schematic-viewer",
|
|
2664
|
-
version: "2.0.
|
|
2726
|
+
version: "2.0.92",
|
|
2665
2727
|
repository: {
|
|
2666
2728
|
type: "git",
|
|
2667
2729
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -2717,7 +2779,7 @@ var package_default = {
|
|
|
2717
2779
|
};
|
|
2718
2780
|
|
|
2719
2781
|
// lib/components/ViewMenu.tsx
|
|
2720
|
-
import { jsx as
|
|
2782
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2721
2783
|
var FONT_FAMILY2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
2722
2784
|
var contentStyles2 = {
|
|
2723
2785
|
backgroundColor: "#262626",
|
|
@@ -2766,7 +2828,7 @@ var HIGHLIGHT_CSS = `
|
|
|
2766
2828
|
.sv-vm-item:hover:not([data-disabled]) { background-color: #404040; }
|
|
2767
2829
|
.sv-vm-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }
|
|
2768
2830
|
`;
|
|
2769
|
-
var CheckIcon2 = () => /* @__PURE__ */
|
|
2831
|
+
var CheckIcon2 = () => /* @__PURE__ */ jsx10(
|
|
2770
2832
|
"svg",
|
|
2771
2833
|
{
|
|
2772
2834
|
width: "14",
|
|
@@ -2778,7 +2840,7 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx9(
|
|
|
2778
2840
|
strokeLinecap: "round",
|
|
2779
2841
|
strokeLinejoin: "round",
|
|
2780
2842
|
"aria-hidden": "true",
|
|
2781
|
-
children: /* @__PURE__ */
|
|
2843
|
+
children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
|
|
2782
2844
|
}
|
|
2783
2845
|
);
|
|
2784
2846
|
var ViewMenu = ({
|
|
@@ -2830,7 +2892,7 @@ var ViewMenu = ({
|
|
|
2830
2892
|
return false;
|
|
2831
2893
|
}
|
|
2832
2894
|
}, [circuitJsonKey]);
|
|
2833
|
-
return /* @__PURE__ */
|
|
2895
|
+
return /* @__PURE__ */ jsx10(
|
|
2834
2896
|
"div",
|
|
2835
2897
|
{
|
|
2836
2898
|
ref: menuRef,
|
|
@@ -2841,9 +2903,9 @@ var ViewMenu = ({
|
|
|
2841
2903
|
width: 0,
|
|
2842
2904
|
height: 0
|
|
2843
2905
|
},
|
|
2844
|
-
children: /* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2906
|
+
children: /* @__PURE__ */ jsxs8(DropdownMenu2.Root, { open: true, onOpenChange, modal: false, children: [
|
|
2907
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx10("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
2908
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs8(
|
|
2847
2909
|
DropdownMenu2.Content,
|
|
2848
2910
|
{
|
|
2849
2911
|
style: contentStyles2,
|
|
@@ -2852,8 +2914,8 @@ var ViewMenu = ({
|
|
|
2852
2914
|
collisionPadding: 10,
|
|
2853
2915
|
avoidCollisions: true,
|
|
2854
2916
|
children: [
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx10("style", { children: HIGHLIGHT_CSS }),
|
|
2918
|
+
/* @__PURE__ */ jsxs8(
|
|
2857
2919
|
DropdownMenu2.Item,
|
|
2858
2920
|
{
|
|
2859
2921
|
className: "sv-vm-item",
|
|
@@ -2866,12 +2928,12 @@ var ViewMenu = ({
|
|
|
2866
2928
|
if (hasPorts) onTogglePorts(!showPorts);
|
|
2867
2929
|
},
|
|
2868
2930
|
children: [
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showPorts && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2932
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Schematic Ports" })
|
|
2871
2933
|
]
|
|
2872
2934
|
}
|
|
2873
2935
|
),
|
|
2874
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ jsxs8(
|
|
2875
2937
|
DropdownMenu2.Item,
|
|
2876
2938
|
{
|
|
2877
2939
|
className: "sv-vm-item",
|
|
@@ -2884,12 +2946,12 @@ var ViewMenu = ({
|
|
|
2884
2946
|
if (hasGroups) onToggleGroups(!showGroups);
|
|
2885
2947
|
},
|
|
2886
2948
|
children: [
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGroups && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2950
|
+
/* @__PURE__ */ jsx10("span", { children: "View Schematic Groups" })
|
|
2889
2951
|
]
|
|
2890
2952
|
}
|
|
2891
2953
|
),
|
|
2892
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsxs8(
|
|
2893
2955
|
DropdownMenu2.Item,
|
|
2894
2956
|
{
|
|
2895
2957
|
className: "sv-vm-item",
|
|
@@ -2900,12 +2962,12 @@ var ViewMenu = ({
|
|
|
2900
2962
|
onToggleGrid(!showGrid);
|
|
2901
2963
|
},
|
|
2902
2964
|
children: [
|
|
2903
|
-
/* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: showGrid && /* @__PURE__ */ jsx10(CheckIcon2, {}) }),
|
|
2966
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Grid" })
|
|
2905
2967
|
]
|
|
2906
2968
|
}
|
|
2907
2969
|
),
|
|
2908
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsxs8(
|
|
2909
2971
|
DropdownMenu2.CheckboxItem,
|
|
2910
2972
|
{
|
|
2911
2973
|
className: "sv-vm-item",
|
|
@@ -2914,26 +2976,26 @@ var ViewMenu = ({
|
|
|
2914
2976
|
onCheckedChange: onToggleWarnings,
|
|
2915
2977
|
onSelect: (event) => event.preventDefault(),
|
|
2916
2978
|
children: [
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2, children: /* @__PURE__ */ jsx10(DropdownMenu2.ItemIndicator, { children: /* @__PURE__ */ jsx10(CheckIcon2, {}) }) }),
|
|
2980
|
+
/* @__PURE__ */ jsx10("span", { children: "Show Warnings" })
|
|
2919
2981
|
]
|
|
2920
2982
|
}
|
|
2921
2983
|
),
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
2985
|
+
/* @__PURE__ */ jsxs8(
|
|
2924
2986
|
DropdownMenu2.Item,
|
|
2925
2987
|
{
|
|
2926
2988
|
className: "sv-vm-item",
|
|
2927
2989
|
style: itemStyles2,
|
|
2928
2990
|
onSelect: onRunStyleAnalysis,
|
|
2929
2991
|
children: [
|
|
2930
|
-
/* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
2992
|
+
/* @__PURE__ */ jsx10("span", { style: iconSlotStyles2 }),
|
|
2993
|
+
/* @__PURE__ */ jsx10("span", { children: "Run Style Analysis" })
|
|
2932
2994
|
]
|
|
2933
2995
|
}
|
|
2934
2996
|
),
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2997
|
+
/* @__PURE__ */ jsx10(DropdownMenu2.Separator, { style: separatorStyles }),
|
|
2998
|
+
/* @__PURE__ */ jsxs8(
|
|
2937
2999
|
"div",
|
|
2938
3000
|
{
|
|
2939
3001
|
style: {
|
|
@@ -2959,7 +3021,7 @@ var ViewMenu = ({
|
|
|
2959
3021
|
};
|
|
2960
3022
|
|
|
2961
3023
|
// lib/components/SchematicViewer.tsx
|
|
2962
|
-
import { jsx as
|
|
3024
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2963
3025
|
var SchematicViewer = ({
|
|
2964
3026
|
circuitJson,
|
|
2965
3027
|
containerStyle,
|
|
@@ -3024,6 +3086,9 @@ var SchematicViewer = ({
|
|
|
3024
3086
|
const [showGridInternal, setShowGridInternal] = useState9(false);
|
|
3025
3087
|
const [analysisCircuitJson, setAnalysisCircuitJson] = useState9(null);
|
|
3026
3088
|
const [showWarnings, setShowWarnings] = useState9(false);
|
|
3089
|
+
const warningCount = circuitJson.filter(
|
|
3090
|
+
(element) => element.type.startsWith("schematic_") && element.type.endsWith("_warning")
|
|
3091
|
+
).length;
|
|
3027
3092
|
const showGrid = debugGrid || showGridInternal;
|
|
3028
3093
|
const [isInteractionEnabled, setIsInteractionEnabled] = useState9(
|
|
3029
3094
|
!clickToInteractEnabled
|
|
@@ -3123,7 +3188,9 @@ var SchematicViewer = ({
|
|
|
3123
3188
|
};
|
|
3124
3189
|
const shouldPanSchematic = useCallback7(
|
|
3125
3190
|
(event) => {
|
|
3126
|
-
if (event.target instanceof Element && event.target.closest(
|
|
3191
|
+
if (event.target instanceof Element && event.target.closest(
|
|
3192
|
+
"[data-schematic-search], [data-schematic-warnings]"
|
|
3193
|
+
)) {
|
|
3127
3194
|
return false;
|
|
3128
3195
|
}
|
|
3129
3196
|
if (event.type !== "mousedown" || !("button" in event)) return true;
|
|
@@ -3290,7 +3357,7 @@ var SchematicViewer = ({
|
|
|
3290
3357
|
enabled: netHoverHighlightEnabled
|
|
3291
3358
|
});
|
|
3292
3359
|
const svgDiv = useMemo6(
|
|
3293
|
-
() => /* @__PURE__ */
|
|
3360
|
+
() => /* @__PURE__ */ jsx11(
|
|
3294
3361
|
"div",
|
|
3295
3362
|
{
|
|
3296
3363
|
ref: svgDivRef,
|
|
@@ -3304,10 +3371,10 @@ var SchematicViewer = ({
|
|
|
3304
3371
|
),
|
|
3305
3372
|
[svgString, isInteractionEnabled, clickToInteractEnabled]
|
|
3306
3373
|
);
|
|
3307
|
-
return /* @__PURE__ */
|
|
3308
|
-
netHoverHighlightEnabled && /* @__PURE__ */
|
|
3374
|
+
return /* @__PURE__ */ jsxs9(MouseTracker, { children: [
|
|
3375
|
+
netHoverHighlightEnabled && /* @__PURE__ */ jsx11("style", { children: `.sch-net-faded { opacity: 0.35; }
|
|
3309
3376
|
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__ */
|
|
3377
|
+
searchEnabled && /* @__PURE__ */ jsx11("style", { children: `.schematic-search-match text,
|
|
3311
3378
|
text.schematic-search-match {
|
|
3312
3379
|
fill: #ff00d4 !important;
|
|
3313
3380
|
}
|
|
@@ -3323,9 +3390,9 @@ var SchematicViewer = ({
|
|
|
3323
3390
|
flex-direction: column;
|
|
3324
3391
|
}
|
|
3325
3392
|
}` }),
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
onSchematicPortClicked && /* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsx11("style", { children: ".schematic-component-clickable [data-schematic-component-id]:hover { cursor: pointer !important; }" }),
|
|
3394
|
+
onSchematicPortClicked && /* @__PURE__ */ jsx11("style", { children: "[data-schematic-port-id]:hover { cursor: pointer !important; }" }),
|
|
3395
|
+
/* @__PURE__ */ jsxs9(
|
|
3329
3396
|
"div",
|
|
3330
3397
|
{
|
|
3331
3398
|
ref: containerRef,
|
|
@@ -3360,7 +3427,7 @@ var SchematicViewer = ({
|
|
|
3360
3427
|
},
|
|
3361
3428
|
onTouchCancel: contextMenuEventHandlers.onTouchCancel,
|
|
3362
3429
|
children: [
|
|
3363
|
-
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */
|
|
3430
|
+
!isInteractionEnabled && clickToInteractEnabled && /* @__PURE__ */ jsx11(
|
|
3364
3431
|
"div",
|
|
3365
3432
|
{
|
|
3366
3433
|
onClick: (e) => {
|
|
@@ -3379,7 +3446,7 @@ var SchematicViewer = ({
|
|
|
3379
3446
|
pointerEvents: "all",
|
|
3380
3447
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
3381
3448
|
},
|
|
3382
|
-
children: /* @__PURE__ */
|
|
3449
|
+
children: /* @__PURE__ */ jsx11(
|
|
3383
3450
|
"div",
|
|
3384
3451
|
{
|
|
3385
3452
|
style: {
|
|
@@ -3396,14 +3463,14 @@ var SchematicViewer = ({
|
|
|
3396
3463
|
)
|
|
3397
3464
|
}
|
|
3398
3465
|
),
|
|
3399
|
-
analysisCircuitJson && /* @__PURE__ */
|
|
3466
|
+
analysisCircuitJson && /* @__PURE__ */ jsx11(
|
|
3400
3467
|
StyleAnalysisDialog,
|
|
3401
3468
|
{
|
|
3402
3469
|
circuitJson: analysisCircuitJson,
|
|
3403
3470
|
onClose: () => setAnalysisCircuitJson(null)
|
|
3404
3471
|
}
|
|
3405
3472
|
),
|
|
3406
|
-
menuVisible && /* @__PURE__ */
|
|
3473
|
+
menuVisible && /* @__PURE__ */ jsx11(
|
|
3407
3474
|
ViewMenu,
|
|
3408
3475
|
{
|
|
3409
3476
|
circuitJson,
|
|
@@ -3436,7 +3503,7 @@ var SchematicViewer = ({
|
|
|
3436
3503
|
onToggleGrid: setShowGridInternal
|
|
3437
3504
|
}
|
|
3438
3505
|
),
|
|
3439
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ jsxs9(
|
|
3440
3507
|
"div",
|
|
3441
3508
|
{
|
|
3442
3509
|
className: "schematic-viewer-toolbar",
|
|
@@ -3450,7 +3517,7 @@ var SchematicViewer = ({
|
|
|
3450
3517
|
zIndex: zIndexMap.schematicSearch
|
|
3451
3518
|
},
|
|
3452
3519
|
children: [
|
|
3453
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx11(
|
|
3454
3521
|
SchematicSheetSelector,
|
|
3455
3522
|
{
|
|
3456
3523
|
sheets: schematicSheets,
|
|
@@ -3458,7 +3525,7 @@ var SchematicViewer = ({
|
|
|
3458
3525
|
onSelectSheet: handleSelectSheet
|
|
3459
3526
|
}
|
|
3460
3527
|
),
|
|
3461
|
-
searchEnabled && /* @__PURE__ */
|
|
3528
|
+
searchEnabled && /* @__PURE__ */ jsx11(
|
|
3462
3529
|
SchematicSearch,
|
|
3463
3530
|
{
|
|
3464
3531
|
query: searchQuery,
|
|
@@ -3468,11 +3535,19 @@ var SchematicViewer = ({
|
|
|
3468
3535
|
onSelect: handleSearchResultSelect,
|
|
3469
3536
|
viewerContainerRef: containerRef
|
|
3470
3537
|
}
|
|
3538
|
+
),
|
|
3539
|
+
warningCount > 0 && /* @__PURE__ */ jsx11(
|
|
3540
|
+
SchematicWarningsButton,
|
|
3541
|
+
{
|
|
3542
|
+
count: warningCount,
|
|
3543
|
+
showWarnings,
|
|
3544
|
+
onToggle: () => setShowWarnings((show) => !show)
|
|
3545
|
+
}
|
|
3471
3546
|
)
|
|
3472
3547
|
]
|
|
3473
3548
|
}
|
|
3474
3549
|
),
|
|
3475
|
-
schematicComponentIds.map((componentId) => /* @__PURE__ */
|
|
3550
|
+
schematicComponentIds.map((componentId) => /* @__PURE__ */ jsx11(
|
|
3476
3551
|
SchematicComponentMouseTarget,
|
|
3477
3552
|
{
|
|
3478
3553
|
componentId,
|
|
@@ -3486,7 +3561,7 @@ var SchematicViewer = ({
|
|
|
3486
3561
|
componentId
|
|
3487
3562
|
)),
|
|
3488
3563
|
svgDiv,
|
|
3489
|
-
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */
|
|
3564
|
+
selectedComponentDetails && componentTooltipLayout && /* @__PURE__ */ jsx11(
|
|
3490
3565
|
SchematicComponentDetailsTooltip,
|
|
3491
3566
|
{
|
|
3492
3567
|
sourceComponent: selectedComponentDetails.sourceComponent,
|
|
@@ -3496,7 +3571,7 @@ var SchematicViewer = ({
|
|
|
3496
3571
|
...componentTooltipLayout
|
|
3497
3572
|
}
|
|
3498
3573
|
),
|
|
3499
|
-
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */
|
|
3574
|
+
showSchematicPortsInternal && schematicPortsInfo.map(({ portId, label }) => /* @__PURE__ */ jsx11(
|
|
3500
3575
|
SchematicPortMouseTarget,
|
|
3501
3576
|
{
|
|
3502
3577
|
portId,
|
|
@@ -3545,7 +3620,7 @@ var getAnalogSimulationBackgroundColor = (simulationSvg, colorOverrides) => getR
|
|
|
3545
3620
|
// lib/components/AnalogSimulationSelector.tsx
|
|
3546
3621
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
3547
3622
|
import { useState as useState10 } from "react";
|
|
3548
|
-
import { Fragment as Fragment6, jsx as
|
|
3623
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3549
3624
|
var FONT_FAMILY3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
3550
3625
|
var contentStyles3 = {
|
|
3551
3626
|
backgroundColor: "#ffffff",
|
|
@@ -3595,7 +3670,7 @@ var MENU_CSS2 = `
|
|
|
3595
3670
|
.sv-simulation-chevron { transition: transform 0.2s ease; }
|
|
3596
3671
|
[data-state="open"] > .sv-simulation-chevron { transform: rotate(180deg); }
|
|
3597
3672
|
`;
|
|
3598
|
-
var CheckIcon3 = () => /* @__PURE__ */
|
|
3673
|
+
var CheckIcon3 = () => /* @__PURE__ */ jsx12(
|
|
3599
3674
|
"svg",
|
|
3600
3675
|
{
|
|
3601
3676
|
width: "14",
|
|
@@ -3607,10 +3682,10 @@ var CheckIcon3 = () => /* @__PURE__ */ jsx11(
|
|
|
3607
3682
|
strokeLinecap: "round",
|
|
3608
3683
|
strokeLinejoin: "round",
|
|
3609
3684
|
"aria-hidden": "true",
|
|
3610
|
-
children: /* @__PURE__ */
|
|
3685
|
+
children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
|
|
3611
3686
|
}
|
|
3612
3687
|
);
|
|
3613
|
-
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */
|
|
3688
|
+
var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx12(
|
|
3614
3689
|
"svg",
|
|
3615
3690
|
{
|
|
3616
3691
|
className,
|
|
@@ -3624,7 +3699,7 @@ var ChevronDownIcon2 = ({ className }) => /* @__PURE__ */ jsx11(
|
|
|
3624
3699
|
strokeLinejoin: "round",
|
|
3625
3700
|
style: { opacity: 0.6, flexShrink: 0 },
|
|
3626
3701
|
"aria-hidden": "true",
|
|
3627
|
-
children: /* @__PURE__ */
|
|
3702
|
+
children: /* @__PURE__ */ jsx12("path", { d: "m6 9 6 6 6-6" })
|
|
3628
3703
|
}
|
|
3629
3704
|
);
|
|
3630
3705
|
var getSimulationLabels = (simulations) => {
|
|
@@ -3650,10 +3725,10 @@ var AnalogSimulationSelector = ({
|
|
|
3650
3725
|
({ simulation }) => simulation.simulation_experiment_id === selectedSimulationExperimentId
|
|
3651
3726
|
);
|
|
3652
3727
|
const selectedLabel = selectedSimulation?.label ?? "Select simulation";
|
|
3653
|
-
return /* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
3729
|
+
/* @__PURE__ */ jsx12("style", { children: MENU_CSS2 }),
|
|
3730
|
+
/* @__PURE__ */ jsxs10(DropdownMenu3.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
3731
|
+
/* @__PURE__ */ jsx12(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
3657
3732
|
"button",
|
|
3658
3733
|
{
|
|
3659
3734
|
type: "button",
|
|
@@ -3680,13 +3755,13 @@ var AnalogSimulationSelector = ({
|
|
|
3680
3755
|
zIndex: zIndexMap.viewMenuIcon
|
|
3681
3756
|
},
|
|
3682
3757
|
children: [
|
|
3683
|
-
/* @__PURE__ */
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3758
|
+
/* @__PURE__ */ jsx12("span", { style: { color: "#888888", flexShrink: 0 }, children: "Simulation:" }),
|
|
3759
|
+
/* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: selectedLabel }),
|
|
3760
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon2, { className: "sv-simulation-chevron" })
|
|
3686
3761
|
]
|
|
3687
3762
|
}
|
|
3688
3763
|
) }),
|
|
3689
|
-
/* @__PURE__ */
|
|
3764
|
+
/* @__PURE__ */ jsx12(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx12(
|
|
3690
3765
|
DropdownMenu3.Content,
|
|
3691
3766
|
{
|
|
3692
3767
|
style: contentStyles3,
|
|
@@ -3696,7 +3771,7 @@ var AnalogSimulationSelector = ({
|
|
|
3696
3771
|
collisionPadding: 10,
|
|
3697
3772
|
children: simulationLabels.map(({ simulation, label }) => {
|
|
3698
3773
|
const selected = simulation.simulation_experiment_id === selectedSimulationExperimentId;
|
|
3699
|
-
return /* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ jsxs10(
|
|
3700
3775
|
DropdownMenu3.Item,
|
|
3701
3776
|
{
|
|
3702
3777
|
className: "sv-simulation-item",
|
|
@@ -3708,8 +3783,8 @@ var AnalogSimulationSelector = ({
|
|
|
3708
3783
|
setOpen(false);
|
|
3709
3784
|
},
|
|
3710
3785
|
children: [
|
|
3711
|
-
/* @__PURE__ */
|
|
3712
|
-
/* @__PURE__ */
|
|
3786
|
+
/* @__PURE__ */ jsx12("span", { style: iconSlotStyles3, children: selected && /* @__PURE__ */ jsx12(CheckIcon3, {}) }),
|
|
3787
|
+
/* @__PURE__ */ jsx12("span", { style: { ...ellipsisStyles2, minWidth: 0 }, children: label })
|
|
3713
3788
|
]
|
|
3714
3789
|
},
|
|
3715
3790
|
simulation.simulation_experiment_id
|
|
@@ -3722,7 +3797,7 @@ var AnalogSimulationSelector = ({
|
|
|
3722
3797
|
};
|
|
3723
3798
|
|
|
3724
3799
|
// lib/components/AnalogSimulationViewer.tsx
|
|
3725
|
-
import { jsx as
|
|
3800
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3726
3801
|
var DEFAULT_RENDER_WIDTH = 1200;
|
|
3727
3802
|
var DEFAULT_COMBINED_RENDER_ASPECT_RATIO = 1;
|
|
3728
3803
|
var DEFAULT_GRAPH_ONLY_RENDER_ASPECT_RATIO = 2;
|
|
@@ -3856,7 +3931,7 @@ var AnalogSimulationViewer = ({
|
|
|
3856
3931
|
};
|
|
3857
3932
|
}, []);
|
|
3858
3933
|
if (isLoading) {
|
|
3859
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ jsx13(
|
|
3860
3935
|
"div",
|
|
3861
3936
|
{
|
|
3862
3937
|
style: {
|
|
@@ -3876,7 +3951,7 @@ var AnalogSimulationViewer = ({
|
|
|
3876
3951
|
);
|
|
3877
3952
|
}
|
|
3878
3953
|
if (error) {
|
|
3879
|
-
return /* @__PURE__ */
|
|
3954
|
+
return /* @__PURE__ */ jsx13(
|
|
3880
3955
|
"div",
|
|
3881
3956
|
{
|
|
3882
3957
|
style: {
|
|
@@ -3891,15 +3966,15 @@ var AnalogSimulationViewer = ({
|
|
|
3891
3966
|
...containerStyle
|
|
3892
3967
|
},
|
|
3893
3968
|
className,
|
|
3894
|
-
children: /* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
3969
|
+
children: /* @__PURE__ */ jsxs11("div", { style: { textAlign: "center", padding: "20px" }, children: [
|
|
3970
|
+
/* @__PURE__ */ jsx13("div", { style: { fontWeight: "bold", marginBottom: "8px" }, children: "Circuit Conversion Error" }),
|
|
3971
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: "14px" }, children: error })
|
|
3897
3972
|
] })
|
|
3898
3973
|
}
|
|
3899
3974
|
);
|
|
3900
3975
|
}
|
|
3901
3976
|
if (!simulationSvg) {
|
|
3902
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ jsxs11(
|
|
3903
3978
|
"div",
|
|
3904
3979
|
{
|
|
3905
3980
|
style: {
|
|
@@ -3915,11 +3990,11 @@ var AnalogSimulationViewer = ({
|
|
|
3915
3990
|
},
|
|
3916
3991
|
className,
|
|
3917
3992
|
children: [
|
|
3918
|
-
/* @__PURE__ */
|
|
3919
|
-
/* @__PURE__ */
|
|
3993
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: "16px", color: "#475569", fontWeight: 500 }, children: "No Simulation Found" }),
|
|
3994
|
+
/* @__PURE__ */ jsxs11("div", { style: { fontSize: "14px", color: "#64748b" }, children: [
|
|
3920
3995
|
"Use",
|
|
3921
3996
|
" ",
|
|
3922
|
-
/* @__PURE__ */
|
|
3997
|
+
/* @__PURE__ */ jsx13(
|
|
3923
3998
|
"code",
|
|
3924
3999
|
{
|
|
3925
4000
|
style: {
|
|
@@ -3939,7 +4014,7 @@ var AnalogSimulationViewer = ({
|
|
|
3939
4014
|
}
|
|
3940
4015
|
);
|
|
3941
4016
|
}
|
|
3942
|
-
return /* @__PURE__ */
|
|
4017
|
+
return /* @__PURE__ */ jsxs11(
|
|
3943
4018
|
"div",
|
|
3944
4019
|
{
|
|
3945
4020
|
ref: (node) => {
|
|
@@ -3958,7 +4033,7 @@ var AnalogSimulationViewer = ({
|
|
|
3958
4033
|
onMouseDown: handleMouseDown,
|
|
3959
4034
|
onTouchStart: handleTouchStart,
|
|
3960
4035
|
children: [
|
|
3961
|
-
/* @__PURE__ */
|
|
4036
|
+
/* @__PURE__ */ jsx13(
|
|
3962
4037
|
AnalogSimulationSelector,
|
|
3963
4038
|
{
|
|
3964
4039
|
simulations: simulationExperiments,
|
|
@@ -3966,7 +4041,7 @@ var AnalogSimulationViewer = ({
|
|
|
3966
4041
|
onSelectSimulation: handleSelectSimulation
|
|
3967
4042
|
}
|
|
3968
4043
|
),
|
|
3969
|
-
svgObjectUrl ? /* @__PURE__ */
|
|
4044
|
+
svgObjectUrl ? /* @__PURE__ */ jsx13(
|
|
3970
4045
|
"img",
|
|
3971
4046
|
{
|
|
3972
4047
|
ref: imgRef,
|
|
@@ -3980,7 +4055,7 @@ var AnalogSimulationViewer = ({
|
|
|
3980
4055
|
objectFit: "contain"
|
|
3981
4056
|
}
|
|
3982
4057
|
}
|
|
3983
|
-
) : /* @__PURE__ */
|
|
4058
|
+
) : /* @__PURE__ */ jsx13(
|
|
3984
4059
|
"div",
|
|
3985
4060
|
{
|
|
3986
4061
|
style: {
|