@tscircuit/runframe 0.0.796 → 0.0.798
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/{chunk-3DZPGPUQ.js → chunk-IR4TNPH4.js} +1 -1
- package/dist/preview.js +1 -1
- package/dist/runner.d.ts +5 -0
- package/dist/runner.js +320 -285
- package/dist/standalone-preview.min.js +1 -1
- package/dist/standalone.min.js +670 -670
- package/package.json +2 -2
package/dist/runner.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
useOrderDialogCli,
|
|
40
40
|
useRunFrameStore,
|
|
41
41
|
useRunnerStore
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-IR4TNPH4.js";
|
|
43
43
|
|
|
44
44
|
// lib/components/RunFrame/RunFrame.tsx
|
|
45
45
|
import { createCircuitWebWorker } from "@tscircuit/eval/worker";
|
|
@@ -141,8 +141,133 @@ function useMutex() {
|
|
|
141
141
|
return { runWithMutex, isLocked, cancel };
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
// lib/optional-features/exporting/formats/export-fabrication-files.ts
|
|
145
|
+
import JSZip from "jszip";
|
|
146
|
+
import {
|
|
147
|
+
stringifyGerberCommandLayers,
|
|
148
|
+
convertSoupToGerberCommands,
|
|
149
|
+
convertSoupToExcellonDrillCommands,
|
|
150
|
+
stringifyExcellonDrill
|
|
151
|
+
} from "circuit-json-to-gerber";
|
|
152
|
+
import {
|
|
153
|
+
convertCircuitJsonToBomRows,
|
|
154
|
+
convertBomRowsToCsv
|
|
155
|
+
} from "circuit-json-to-bom-csv";
|
|
156
|
+
import { convertCircuitJsonToPickAndPlaceCsv } from "circuit-json-to-pnp-csv";
|
|
157
|
+
|
|
158
|
+
// lib/optional-features/exporting/open-for-download.ts
|
|
159
|
+
var openForDownload = (content, opts) => {
|
|
160
|
+
const { fileName, mimeType = "text/plain" } = opts;
|
|
161
|
+
const blob = content instanceof Blob ? content : new Blob([content], { type: mimeType });
|
|
162
|
+
const url = URL.createObjectURL(blob);
|
|
163
|
+
const a = document.createElement("a");
|
|
164
|
+
a.href = url;
|
|
165
|
+
a.download = fileName;
|
|
166
|
+
document.body.appendChild(a);
|
|
167
|
+
a.click();
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
document.body.removeChild(a);
|
|
170
|
+
URL.revokeObjectURL(url);
|
|
171
|
+
}, 0);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// lib/optional-features/exporting/formats/export-fabrication-files.ts
|
|
175
|
+
var exportFabricationFiles = async ({
|
|
176
|
+
circuitJson,
|
|
177
|
+
projectName
|
|
178
|
+
}) => {
|
|
179
|
+
const zip = new JSZip();
|
|
180
|
+
const filteredCircuitJson = circuitJson.filter(
|
|
181
|
+
(element) => !("error_type" in element) && !("warning_type" in element)
|
|
182
|
+
);
|
|
183
|
+
const gerberLayerCmds = convertSoupToGerberCommands(filteredCircuitJson, {
|
|
184
|
+
flip_y_axis: false
|
|
185
|
+
});
|
|
186
|
+
const gerberFileContents = stringifyGerberCommandLayers(gerberLayerCmds);
|
|
187
|
+
for (const [fileName, fileContents] of Object.entries(gerberFileContents)) {
|
|
188
|
+
zip.file(`gerber/${fileName}.gbr`, fileContents);
|
|
189
|
+
}
|
|
190
|
+
const drillCmds = convertSoupToExcellonDrillCommands({
|
|
191
|
+
circuitJson: filteredCircuitJson,
|
|
192
|
+
is_plated: true,
|
|
193
|
+
flip_y_axis: false
|
|
194
|
+
});
|
|
195
|
+
const drillFileContents = stringifyExcellonDrill(drillCmds);
|
|
196
|
+
zip.file("gerber/drill.drl", drillFileContents);
|
|
197
|
+
const bomRows = await convertCircuitJsonToBomRows({ circuitJson });
|
|
198
|
+
const bomCsv = await convertBomRowsToCsv(bomRows);
|
|
199
|
+
zip.file("bom.csv", bomCsv);
|
|
200
|
+
const pnpCsv = await convertCircuitJsonToPickAndPlaceCsv(circuitJson);
|
|
201
|
+
zip.file("pick_and_place.csv", pnpCsv);
|
|
202
|
+
const zipBlob = await zip.generateAsync({ type: "blob" });
|
|
203
|
+
openForDownload(zipBlob, {
|
|
204
|
+
fileName: `${projectName}_fabrication_files.zip`
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// lib/optional-features/exporting/export-and-download.ts
|
|
209
|
+
var availableExports = [
|
|
210
|
+
{ extension: "json", name: "Circuit JSON" },
|
|
211
|
+
{ extension: "zip", name: "Fabrication Files" }
|
|
212
|
+
// { extension: "svg", name: "SVG" },
|
|
213
|
+
// { extension: "dsn", name: "Specctra DSN" },
|
|
214
|
+
// { extension: "glb", name: "GLB (Binary GLTF)" },
|
|
215
|
+
// { extension: "kicad_mod", name: "KiCad Module" },
|
|
216
|
+
// { extension: "kicad_project", name: "KiCad Project" },
|
|
217
|
+
// { extension: "gbr", name: "Gerbers" },
|
|
218
|
+
];
|
|
219
|
+
var exportAndDownload = async ({
|
|
220
|
+
exportName,
|
|
221
|
+
circuitJson,
|
|
222
|
+
projectName
|
|
223
|
+
}) => {
|
|
224
|
+
if (exportName === "Fabrication Files") {
|
|
225
|
+
exportFabricationFiles({ circuitJson, projectName });
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (exportName === "Circuit JSON") {
|
|
229
|
+
openForDownload(JSON.stringify(circuitJson, null, 2), {
|
|
230
|
+
fileName: `${projectName}.circuit.json`,
|
|
231
|
+
mimeType: "application/json"
|
|
232
|
+
});
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
throw new Error(`Unsupported export type: "${exportName}"`);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// lib/components/RunFrame/FileMenu.tsx
|
|
239
|
+
import { ChevronRight } from "lucide-react";
|
|
240
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
241
|
+
var RunFrameFileMenu = () => {
|
|
242
|
+
const circuitJson = useRunFrameStore((s) => s.circuitJson);
|
|
243
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
244
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "rf-inline-flex rf-items-center rf-justify-center rf-h-9 rf-rounded-lg rf-bg-zinc-100 rf-px-3 rf-mx-1 rf-text-sm rf-font-medium rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400 rf-whitespace-nowrap rf-cursor-pointer rf-relative", children: [
|
|
245
|
+
/* @__PURE__ */ jsx("span", { children: "File" }),
|
|
246
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "rf-ml-1 rf-h-4 rf-w-4" })
|
|
247
|
+
] }) }),
|
|
248
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { children: /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
|
|
249
|
+
/* @__PURE__ */ jsx(DropdownMenuSubTrigger, { className: "rf-text-xs", children: "Download" }),
|
|
250
|
+
/* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(DropdownMenuSubContent, { children: availableExports.map((exp, i) => /* @__PURE__ */ jsx(
|
|
251
|
+
DropdownMenuItem,
|
|
252
|
+
{
|
|
253
|
+
onSelect: () => {
|
|
254
|
+
if (!circuitJson) return;
|
|
255
|
+
exportAndDownload({
|
|
256
|
+
exportName: exp.name,
|
|
257
|
+
circuitJson,
|
|
258
|
+
projectName: "circuit"
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
children: /* @__PURE__ */ jsx("span", { className: "rf-text-xs", children: exp.name })
|
|
262
|
+
},
|
|
263
|
+
i
|
|
264
|
+
)) }) })
|
|
265
|
+
] }) })
|
|
266
|
+
] });
|
|
267
|
+
};
|
|
268
|
+
|
|
144
269
|
// lib/components/RunFrame/RunFrame.tsx
|
|
145
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
270
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
146
271
|
var numRenderPhases = 26;
|
|
147
272
|
var debug = Debug("run-frame:RunFrame");
|
|
148
273
|
var fetchLatestEvalVersion = async () => {
|
|
@@ -240,6 +365,7 @@ var RunFrame = (props) => {
|
|
|
240
365
|
const [activeTab, setActiveTab] = useState(
|
|
241
366
|
props.defaultActiveTab ?? props.defaultTab ?? "pcb"
|
|
242
367
|
);
|
|
368
|
+
const showFileMenu = props.showFileMenu ?? true;
|
|
243
369
|
useEffect(() => {
|
|
244
370
|
if (props.debug) Debug.enable("run-frame*");
|
|
245
371
|
}, [props.debug]);
|
|
@@ -482,7 +608,7 @@ var RunFrame = (props) => {
|
|
|
482
608
|
}
|
|
483
609
|
});
|
|
484
610
|
};
|
|
485
|
-
return /* @__PURE__ */
|
|
611
|
+
return /* @__PURE__ */ jsx2(
|
|
486
612
|
CircuitJsonPreview,
|
|
487
613
|
{
|
|
488
614
|
code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
|
|
@@ -494,9 +620,9 @@ var RunFrame = (props) => {
|
|
|
494
620
|
autoroutingGraphics,
|
|
495
621
|
autoroutingLog,
|
|
496
622
|
onReportAutoroutingLog: props.onReportAutoroutingLog || handleReportAutoroutingLog,
|
|
497
|
-
leftHeaderContent: /* @__PURE__ */
|
|
498
|
-
props.showRunButton && /* @__PURE__ */
|
|
499
|
-
/* @__PURE__ */
|
|
623
|
+
leftHeaderContent: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
624
|
+
props.showRunButton && /* @__PURE__ */ jsxs2("div", { className: "rf-relative rf-inline-flex", children: [
|
|
625
|
+
/* @__PURE__ */ jsxs2(
|
|
500
626
|
"button",
|
|
501
627
|
{
|
|
502
628
|
type: "button",
|
|
@@ -508,11 +634,11 @@ var RunFrame = (props) => {
|
|
|
508
634
|
children: [
|
|
509
635
|
"Run",
|
|
510
636
|
" ",
|
|
511
|
-
isRunning || !dependenciesLoaded ? /* @__PURE__ */
|
|
637
|
+
isRunning || !dependenciesLoaded ? /* @__PURE__ */ jsx2(Loader2, { className: "rf-w-3 rf-h-3 rf-animate-spin" }) : /* @__PURE__ */ jsx2(Play, { className: "rf-w-3 rf-h-3" })
|
|
512
638
|
]
|
|
513
639
|
}
|
|
514
640
|
),
|
|
515
|
-
isRunning && /* @__PURE__ */
|
|
641
|
+
isRunning && /* @__PURE__ */ jsx2("div", { className: "rf-flex rf-items-center rf-ml-1", children: /* @__PURE__ */ jsx2(
|
|
516
642
|
Button,
|
|
517
643
|
{
|
|
518
644
|
onClick: (e) => {
|
|
@@ -534,7 +660,7 @@ var RunFrame = (props) => {
|
|
|
534
660
|
variant: "ghost",
|
|
535
661
|
size: "icon",
|
|
536
662
|
className: "rf-text-red-300 hover:rf-text-red-400 hover:!rf-bg-transparent [&>svg]:rf-text-red-300 [&>svg]:hover:rf-text-red-400 rf-flex rf-items-center rf-justify-center",
|
|
537
|
-
children: /* @__PURE__ */
|
|
663
|
+
children: /* @__PURE__ */ jsx2(
|
|
538
664
|
Square,
|
|
539
665
|
{
|
|
540
666
|
className: "!rf-h-2.5 !rf-w-2.5",
|
|
@@ -545,6 +671,7 @@ var RunFrame = (props) => {
|
|
|
545
671
|
}
|
|
546
672
|
) })
|
|
547
673
|
] }),
|
|
674
|
+
showFileMenu && /* @__PURE__ */ jsx2(RunFrameFileMenu, {}),
|
|
548
675
|
props.leftHeaderContent
|
|
549
676
|
] }),
|
|
550
677
|
onActiveTabChange: setActiveTab,
|
|
@@ -658,8 +785,8 @@ import * as React from "react";
|
|
|
658
785
|
import "@radix-ui/react-dialog";
|
|
659
786
|
import { Command as CommandPrimitive } from "cmdk";
|
|
660
787
|
import { Search } from "lucide-react";
|
|
661
|
-
import { jsx as
|
|
662
|
-
var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
788
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
789
|
+
var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
663
790
|
CommandPrimitive,
|
|
664
791
|
{
|
|
665
792
|
ref,
|
|
@@ -671,14 +798,14 @@ var Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
671
798
|
}
|
|
672
799
|
));
|
|
673
800
|
Command.displayName = CommandPrimitive.displayName;
|
|
674
|
-
var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
801
|
+
var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs3(
|
|
675
802
|
"div",
|
|
676
803
|
{
|
|
677
804
|
className: "rf-flex rf-items-center rf-border-b rf-px-3",
|
|
678
805
|
"cmdk-input-wrapper": "",
|
|
679
806
|
children: [
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
807
|
+
/* @__PURE__ */ jsx3(Search, { className: "rf-mr-2 rf-h-4 rf-w-4 rf-shrink-0 rf-opacity-50" }),
|
|
808
|
+
/* @__PURE__ */ jsx3(
|
|
682
809
|
CommandPrimitive.Input,
|
|
683
810
|
{
|
|
684
811
|
ref,
|
|
@@ -693,7 +820,7 @@ var CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
693
820
|
}
|
|
694
821
|
));
|
|
695
822
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
696
|
-
var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
823
|
+
var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
697
824
|
CommandPrimitive.List,
|
|
698
825
|
{
|
|
699
826
|
ref,
|
|
@@ -705,7 +832,7 @@ var CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
705
832
|
}
|
|
706
833
|
));
|
|
707
834
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
708
|
-
var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */
|
|
835
|
+
var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx3(
|
|
709
836
|
CommandPrimitive.Empty,
|
|
710
837
|
{
|
|
711
838
|
ref,
|
|
@@ -714,7 +841,7 @@ var CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx2(
|
|
|
714
841
|
}
|
|
715
842
|
));
|
|
716
843
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
717
|
-
var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
844
|
+
var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
718
845
|
CommandPrimitive.Group,
|
|
719
846
|
{
|
|
720
847
|
ref,
|
|
@@ -726,7 +853,7 @@ var CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
726
853
|
}
|
|
727
854
|
));
|
|
728
855
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
729
|
-
var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
856
|
+
var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
730
857
|
CommandPrimitive.Separator,
|
|
731
858
|
{
|
|
732
859
|
ref,
|
|
@@ -738,7 +865,7 @@ var CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
738
865
|
}
|
|
739
866
|
));
|
|
740
867
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
741
|
-
var CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
868
|
+
var CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
742
869
|
CommandPrimitive.Item,
|
|
743
870
|
{
|
|
744
871
|
ref,
|
|
@@ -754,7 +881,7 @@ var CommandShortcut = ({
|
|
|
754
881
|
className,
|
|
755
882
|
...props
|
|
756
883
|
}) => {
|
|
757
|
-
return /* @__PURE__ */
|
|
884
|
+
return /* @__PURE__ */ jsx3(
|
|
758
885
|
"span",
|
|
759
886
|
{
|
|
760
887
|
className: cn(
|
|
@@ -770,10 +897,10 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
770
897
|
// lib/components/ui/popover.tsx
|
|
771
898
|
import * as React2 from "react";
|
|
772
899
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
773
|
-
import { jsx as
|
|
900
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
774
901
|
var Popover = PopoverPrimitive.Root;
|
|
775
902
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
776
|
-
var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */
|
|
903
|
+
var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
|
|
777
904
|
PopoverPrimitive.Content,
|
|
778
905
|
{
|
|
779
906
|
ref,
|
|
@@ -790,7 +917,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
790
917
|
|
|
791
918
|
// lib/components/RunFrameWithApi/file-selector-combobox.tsx
|
|
792
919
|
import { ChevronsUpDown, Check } from "lucide-react";
|
|
793
|
-
import { jsx as
|
|
920
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
794
921
|
var FileSelectorCombobox = ({
|
|
795
922
|
files,
|
|
796
923
|
onFileChange,
|
|
@@ -801,8 +928,8 @@ var FileSelectorCombobox = ({
|
|
|
801
928
|
useEffect4(() => {
|
|
802
929
|
setFile(currentFile);
|
|
803
930
|
}, [currentFile]);
|
|
804
|
-
return /* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
931
|
+
return /* @__PURE__ */ jsxs4(Popover, { open, onOpenChange: setOpen, children: [
|
|
932
|
+
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
|
|
806
933
|
Button,
|
|
807
934
|
{
|
|
808
935
|
variant: "outline",
|
|
@@ -811,17 +938,17 @@ var FileSelectorCombobox = ({
|
|
|
811
938
|
className: "rf-w-30 rf-justify-between !rf-font-normal",
|
|
812
939
|
children: [
|
|
813
940
|
file ? file : "Select file",
|
|
814
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ jsx5(ChevronsUpDown, { className: "rf-opacity-50" })
|
|
815
942
|
]
|
|
816
943
|
}
|
|
817
944
|
) }),
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ jsx5(PopoverContent, { className: "rf-w-fit !rf-p-0", children: /* @__PURE__ */ jsxs4(Command, { children: [
|
|
946
|
+
/* @__PURE__ */ jsx5(CommandInput, { placeholder: "Search for file", className: "rf-h-9" }),
|
|
947
|
+
/* @__PURE__ */ jsxs4(CommandList, { children: [
|
|
948
|
+
/* @__PURE__ */ jsx5(CommandEmpty, { children: "No file found." }),
|
|
949
|
+
/* @__PURE__ */ jsx5(CommandGroup, { children: files.filter(
|
|
823
950
|
(file2) => (file2.endsWith(".tsx") || file2.endsWith(".ts") || file2.endsWith(".jsx") || file2.endsWith(".js")) && !file2.endsWith(".d.ts")
|
|
824
|
-
).map((file2, i) => /* @__PURE__ */
|
|
951
|
+
).map((file2, i) => /* @__PURE__ */ jsxs4(
|
|
825
952
|
CommandItem,
|
|
826
953
|
{
|
|
827
954
|
value: file2,
|
|
@@ -832,7 +959,7 @@ var FileSelectorCombobox = ({
|
|
|
832
959
|
},
|
|
833
960
|
children: [
|
|
834
961
|
file2,
|
|
835
|
-
/* @__PURE__ */
|
|
962
|
+
/* @__PURE__ */ jsx5(
|
|
836
963
|
Check,
|
|
837
964
|
{
|
|
838
965
|
className: cn(
|
|
@@ -851,7 +978,7 @@ var FileSelectorCombobox = ({
|
|
|
851
978
|
};
|
|
852
979
|
|
|
853
980
|
// lib/components/RunFrameWithApi/RunFrameWithApi.tsx
|
|
854
|
-
import { jsx as
|
|
981
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
855
982
|
var debug3 = Debug2("run-frame:RunFrameWithApi");
|
|
856
983
|
var guessEntrypoint = (files) => files.find((file) => file.includes("entrypoint.")) ?? files.find((file) => file.includes("index.")) ?? files.find((file) => file.includes("main.")) ?? files.find((file) => file.endsWith(".tsx"));
|
|
857
984
|
var guessManualEditsFilePath = (files) => files.find((file) => file.includes("manual-edits.")) ?? files.find((file) => file.includes("manual-edit.")) ?? files.find((file) => file.endsWith(".json"));
|
|
@@ -912,16 +1039,16 @@ var RunFrameWithApi = (props) => {
|
|
|
912
1039
|
} : {},
|
|
913
1040
|
[componentPath]
|
|
914
1041
|
);
|
|
915
|
-
return /* @__PURE__ */
|
|
1042
|
+
return /* @__PURE__ */ jsx6(
|
|
916
1043
|
RunFrame,
|
|
917
1044
|
{
|
|
918
1045
|
fsMap,
|
|
919
1046
|
evalVersion: props.evalVersion,
|
|
920
1047
|
forceLatestEvalVersion: props.forceLatestEvalVersion,
|
|
921
1048
|
evalWebWorkerBlobUrl: props.evalWebWorkerBlobUrl ?? props.workerBlobUrl,
|
|
922
|
-
leftHeaderContent: /* @__PURE__ */
|
|
1049
|
+
leftHeaderContent: /* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-items-center rf-justify-between rf-w-full", children: [
|
|
923
1050
|
props.leftHeaderContent,
|
|
924
|
-
props.showFilesSwitch && /* @__PURE__ */
|
|
1051
|
+
props.showFilesSwitch && /* @__PURE__ */ jsx6("div", { className: "rf-absolute rf-left-1/2 rf-transform rf--translate-x-1/2", children: /* @__PURE__ */ jsx6(
|
|
925
1052
|
FileSelectorCombobox,
|
|
926
1053
|
{
|
|
927
1054
|
currentFile: componentPath,
|
|
@@ -934,6 +1061,7 @@ var RunFrameWithApi = (props) => {
|
|
|
934
1061
|
}
|
|
935
1062
|
) })
|
|
936
1063
|
] }),
|
|
1064
|
+
showFileMenu: props.showFileMenu,
|
|
937
1065
|
defaultToFullScreen: props.defaultToFullScreen,
|
|
938
1066
|
showToggleFullScreen: props.showToggleFullScreen,
|
|
939
1067
|
onInitialRender: () => {
|
|
@@ -985,7 +1113,7 @@ import { useEffect as useEffect10, useMemo as useMemo4, useState as useState10 }
|
|
|
985
1113
|
|
|
986
1114
|
// lib/components/RunFrameForCli/SelectSnippetDialog.tsx
|
|
987
1115
|
import { useState as useState5 } from "react";
|
|
988
|
-
import { jsx as
|
|
1116
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
989
1117
|
var SelectSnippetDialog = ({
|
|
990
1118
|
snippetNames,
|
|
991
1119
|
onSelect,
|
|
@@ -1008,9 +1136,9 @@ var SelectSnippetDialog = ({
|
|
|
1008
1136
|
}
|
|
1009
1137
|
}
|
|
1010
1138
|
};
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
/* @__PURE__ */
|
|
1139
|
+
return /* @__PURE__ */ jsx7("div", { className: "rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]", children: /* @__PURE__ */ jsxs6("div", { className: "rf-bg-white rf-rounded-lg rf-p-6 rf-w-96", children: [
|
|
1140
|
+
/* @__PURE__ */ jsx7("h2", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Select Snippet" }),
|
|
1141
|
+
/* @__PURE__ */ jsx7(
|
|
1014
1142
|
"input",
|
|
1015
1143
|
{
|
|
1016
1144
|
type: "text",
|
|
@@ -1021,8 +1149,8 @@ var SelectSnippetDialog = ({
|
|
|
1021
1149
|
onKeyDown: handleKeyDown
|
|
1022
1150
|
}
|
|
1023
1151
|
),
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
filteredSnippets.map((name) => /* @__PURE__ */
|
|
1152
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-h-60 rf-overflow-y-auto", children: [
|
|
1153
|
+
filteredSnippets.map((name) => /* @__PURE__ */ jsx7(
|
|
1026
1154
|
"button",
|
|
1027
1155
|
{
|
|
1028
1156
|
type: "button",
|
|
@@ -1032,7 +1160,7 @@ var SelectSnippetDialog = ({
|
|
|
1032
1160
|
},
|
|
1033
1161
|
name
|
|
1034
1162
|
)),
|
|
1035
|
-
showCreateNew && /* @__PURE__ */
|
|
1163
|
+
showCreateNew && /* @__PURE__ */ jsxs6(
|
|
1036
1164
|
"button",
|
|
1037
1165
|
{
|
|
1038
1166
|
type: "button",
|
|
@@ -1046,8 +1174,8 @@ var SelectSnippetDialog = ({
|
|
|
1046
1174
|
}
|
|
1047
1175
|
)
|
|
1048
1176
|
] }),
|
|
1049
|
-
/* @__PURE__ */
|
|
1050
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ jsxs6("div", { className: "rf-mt-4 rf-flex rf-justify-end rf-gap-2", children: [
|
|
1178
|
+
/* @__PURE__ */ jsx7(
|
|
1051
1179
|
"button",
|
|
1052
1180
|
{
|
|
1053
1181
|
type: "button",
|
|
@@ -1056,7 +1184,7 @@ var SelectSnippetDialog = ({
|
|
|
1056
1184
|
children: "Cancel"
|
|
1057
1185
|
}
|
|
1058
1186
|
),
|
|
1059
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ jsx7(
|
|
1060
1188
|
"button",
|
|
1061
1189
|
{
|
|
1062
1190
|
type: "button",
|
|
@@ -1088,10 +1216,10 @@ var useEventHandler = (callback) => {
|
|
|
1088
1216
|
// lib/components/ui/alert-dialog.tsx
|
|
1089
1217
|
import * as React3 from "react";
|
|
1090
1218
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1091
|
-
import { jsx as
|
|
1219
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1092
1220
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
1093
1221
|
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
1094
|
-
var AlertDialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1222
|
+
var AlertDialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
1095
1223
|
AlertDialogPrimitive.Overlay,
|
|
1096
1224
|
{
|
|
1097
1225
|
className: cn(
|
|
@@ -1103,9 +1231,9 @@ var AlertDialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /*
|
|
|
1103
1231
|
}
|
|
1104
1232
|
));
|
|
1105
1233
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
1106
|
-
var AlertDialogContent = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
/* @__PURE__ */
|
|
1234
|
+
var AlertDialogContent = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs7(AlertDialogPortal, { children: [
|
|
1235
|
+
/* @__PURE__ */ jsx8(AlertDialogOverlay, {}),
|
|
1236
|
+
/* @__PURE__ */ jsx8(
|
|
1109
1237
|
AlertDialogPrimitive.Content,
|
|
1110
1238
|
{
|
|
1111
1239
|
ref,
|
|
@@ -1121,7 +1249,7 @@ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
|
1121
1249
|
var AlertDialogHeader = ({
|
|
1122
1250
|
className,
|
|
1123
1251
|
...props
|
|
1124
|
-
}) => /* @__PURE__ */
|
|
1252
|
+
}) => /* @__PURE__ */ jsx8(
|
|
1125
1253
|
"div",
|
|
1126
1254
|
{
|
|
1127
1255
|
className: cn(
|
|
@@ -1135,7 +1263,7 @@ AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
|
1135
1263
|
var AlertDialogFooter = ({
|
|
1136
1264
|
className,
|
|
1137
1265
|
...props
|
|
1138
|
-
}) => /* @__PURE__ */
|
|
1266
|
+
}) => /* @__PURE__ */ jsx8(
|
|
1139
1267
|
"div",
|
|
1140
1268
|
{
|
|
1141
1269
|
className: cn(
|
|
@@ -1146,7 +1274,7 @@ var AlertDialogFooter = ({
|
|
|
1146
1274
|
}
|
|
1147
1275
|
);
|
|
1148
1276
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
1149
|
-
var AlertDialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1277
|
+
var AlertDialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
1150
1278
|
AlertDialogPrimitive.Title,
|
|
1151
1279
|
{
|
|
1152
1280
|
ref,
|
|
@@ -1155,7 +1283,7 @@ var AlertDialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
1155
1283
|
}
|
|
1156
1284
|
));
|
|
1157
1285
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
1158
|
-
var AlertDialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1286
|
+
var AlertDialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
1159
1287
|
AlertDialogPrimitive.Description,
|
|
1160
1288
|
{
|
|
1161
1289
|
ref,
|
|
@@ -1167,7 +1295,7 @@ var AlertDialogDescription = React3.forwardRef(({ className, ...props }, ref) =>
|
|
|
1167
1295
|
}
|
|
1168
1296
|
));
|
|
1169
1297
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
1170
|
-
var AlertDialogAction = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1298
|
+
var AlertDialogAction = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
1171
1299
|
AlertDialogPrimitive.Action,
|
|
1172
1300
|
{
|
|
1173
1301
|
ref,
|
|
@@ -1176,7 +1304,7 @@ var AlertDialogAction = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1176
1304
|
}
|
|
1177
1305
|
));
|
|
1178
1306
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
1179
|
-
var AlertDialogCancel = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1307
|
+
var AlertDialogCancel = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
1180
1308
|
AlertDialogPrimitive.Cancel,
|
|
1181
1309
|
{
|
|
1182
1310
|
ref,
|
|
@@ -1194,8 +1322,8 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
|
1194
1322
|
import * as React4 from "react";
|
|
1195
1323
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
1196
1324
|
import { Check as Check2 } from "lucide-react";
|
|
1197
|
-
import { jsx as
|
|
1198
|
-
var Checkbox = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1325
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1326
|
+
var Checkbox = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
1199
1327
|
CheckboxPrimitive.Root,
|
|
1200
1328
|
{
|
|
1201
1329
|
ref,
|
|
@@ -1204,13 +1332,13 @@ var Checkbox = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1204
1332
|
className
|
|
1205
1333
|
),
|
|
1206
1334
|
...props,
|
|
1207
|
-
children: /* @__PURE__ */
|
|
1335
|
+
children: /* @__PURE__ */ jsx9(
|
|
1208
1336
|
CheckboxPrimitive.Indicator,
|
|
1209
1337
|
{
|
|
1210
1338
|
className: cn(
|
|
1211
1339
|
"rf-flex rf-items-center rf-justify-center rf-text-current"
|
|
1212
1340
|
),
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1341
|
+
children: /* @__PURE__ */ jsx9(Check2, { className: "rf-h-4 rf-w-4" })
|
|
1214
1342
|
}
|
|
1215
1343
|
)
|
|
1216
1344
|
}
|
|
@@ -1290,7 +1418,7 @@ var mapTscircuitSnippetToSearchResult = (tscircuitSnippet) => {
|
|
|
1290
1418
|
};
|
|
1291
1419
|
|
|
1292
1420
|
// lib/components/ImportComponentDialog/ImportComponentDialog.tsx
|
|
1293
|
-
import { Fragment as Fragment2, jsx as
|
|
1421
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1294
1422
|
var ImportComponentDialog = ({
|
|
1295
1423
|
isOpen,
|
|
1296
1424
|
onClose,
|
|
@@ -1374,8 +1502,8 @@ var ImportComponentDialog = ({
|
|
|
1374
1502
|
fetchPackageDetails(component.owner, packageName);
|
|
1375
1503
|
}
|
|
1376
1504
|
};
|
|
1377
|
-
return /* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1505
|
+
return /* @__PURE__ */ jsxs8(Dialog, { open: isOpen, onOpenChange: () => onClose(), children: [
|
|
1506
|
+
/* @__PURE__ */ jsxs8(
|
|
1379
1507
|
DialogContent,
|
|
1380
1508
|
{
|
|
1381
1509
|
style: {
|
|
@@ -1383,18 +1511,18 @@ var ImportComponentDialog = ({
|
|
|
1383
1511
|
},
|
|
1384
1512
|
className: "rf-rounded-sm rf-max-h-[90vh] rf-overflow-y-auto rf-flex rf-flex-col",
|
|
1385
1513
|
children: [
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ jsxs8(DialogHeader, { children: [
|
|
1515
|
+
/* @__PURE__ */ jsx10(DialogTitle, { className: "rf-text-lg sm:rf-text-xl", children: "Import Component" }),
|
|
1516
|
+
/* @__PURE__ */ jsx10(DialogDescription, { className: "rf-text-sm", children: "Search for components from tscircuit.com or JLCPCB parts library." })
|
|
1389
1517
|
] }),
|
|
1390
|
-
/* @__PURE__ */
|
|
1518
|
+
/* @__PURE__ */ jsxs8(
|
|
1391
1519
|
Tabs,
|
|
1392
1520
|
{
|
|
1393
1521
|
value: activeTab,
|
|
1394
1522
|
onValueChange: (value) => setActiveTab(value),
|
|
1395
1523
|
children: [
|
|
1396
|
-
/* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ jsxs8(TabsList, { className: "rf-grid rf-w-full rf-grid-cols-2 rf-h-auto", children: [
|
|
1525
|
+
/* @__PURE__ */ jsx10(
|
|
1398
1526
|
TabsTrigger,
|
|
1399
1527
|
{
|
|
1400
1528
|
value: "tscircuit.com",
|
|
@@ -1402,12 +1530,12 @@ var ImportComponentDialog = ({
|
|
|
1402
1530
|
children: "tscircuit.com"
|
|
1403
1531
|
}
|
|
1404
1532
|
),
|
|
1405
|
-
/* @__PURE__ */
|
|
1533
|
+
/* @__PURE__ */ jsx10(TabsTrigger, { value: "jlcpcb", className: "rf-text-xs sm:rf-text-sm", children: "JLCPCB Parts" })
|
|
1406
1534
|
] }),
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-center rf-gap-2 rf-mt-4", children: [
|
|
1536
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-relative rf-flex-grow", children: [
|
|
1537
|
+
/* @__PURE__ */ jsx10(Search2, { className: "rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground" }),
|
|
1538
|
+
/* @__PURE__ */ jsx10(
|
|
1411
1539
|
Input,
|
|
1412
1540
|
{
|
|
1413
1541
|
placeholder: activeTab === "tscircuit.com" ? "Search components..." : "Search JLCPCB parts (e.g. C14663)...",
|
|
@@ -1420,33 +1548,33 @@ var ImportComponentDialog = ({
|
|
|
1420
1548
|
}
|
|
1421
1549
|
)
|
|
1422
1550
|
] }),
|
|
1423
|
-
/* @__PURE__ */
|
|
1551
|
+
/* @__PURE__ */ jsx10(
|
|
1424
1552
|
Button,
|
|
1425
1553
|
{
|
|
1426
1554
|
onClick: handleSearch,
|
|
1427
1555
|
disabled: isLoading || searchQuery.trim().length < 1,
|
|
1428
1556
|
className: "sm:rf-px-4 rf-px-3",
|
|
1429
|
-
children: isLoading ? /* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1557
|
+
children: isLoading ? /* @__PURE__ */ jsx10(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
1558
|
+
/* @__PURE__ */ jsx10(Search2, { className: "rf-h-4 rf-w-4 sm:rf-hidden" }),
|
|
1559
|
+
/* @__PURE__ */ jsx10("span", { className: "rf-hidden sm:rf-inline", children: "Search" })
|
|
1432
1560
|
] })
|
|
1433
1561
|
}
|
|
1434
1562
|
)
|
|
1435
1563
|
] }),
|
|
1436
|
-
/* @__PURE__ */
|
|
1564
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-mt-4 rf-flex-1 rf-min-h-[200px] !rf-max-h-[40vh] !rf-overflow-y-auto rf-border rf-rounded-md", children: searchResults.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "rf-divide-y", children: searchResults.map((result) => /* @__PURE__ */ jsxs8(
|
|
1437
1565
|
"div",
|
|
1438
1566
|
{
|
|
1439
1567
|
className: `rf-p-3 rf-flex rf-flex-col sm:rf-flex-row rf-items-start sm:rf-items-center rf-justify-between rf-cursor-pointer hover:rf-bg-zinc-100 rf-gap-2 ${selectedComponent?.id === result.id ? "rf-bg-zinc-100" : ""}`,
|
|
1440
1568
|
onClick: () => setSelectedComponent(result),
|
|
1441
1569
|
children: [
|
|
1442
|
-
/* @__PURE__ */
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
result.partNumber && /* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1 rf-min-w-0", children: [
|
|
1571
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-font-medium rf-text-sm rf-truncate", children: result.name }),
|
|
1572
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-text-xs rf-text-zinc-500 rf-break-words", children: [
|
|
1573
|
+
result.partNumber && /* @__PURE__ */ jsx10("span", { className: "rf-mr-2", children: result.partNumber }),
|
|
1446
1574
|
result.description
|
|
1447
1575
|
] })
|
|
1448
1576
|
] }),
|
|
1449
|
-
/* @__PURE__ */
|
|
1577
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-flex rf-gap-2 rf-flex-shrink-0 rf-w-full sm:rf-w-auto", children: result.source === "tscircuit.com" && /* @__PURE__ */ jsx10(
|
|
1450
1578
|
Button,
|
|
1451
1579
|
{
|
|
1452
1580
|
variant: "outline",
|
|
@@ -1462,15 +1590,15 @@ var ImportComponentDialog = ({
|
|
|
1462
1590
|
]
|
|
1463
1591
|
},
|
|
1464
1592
|
result.id
|
|
1465
|
-
)) }) : isLoading ? /* @__PURE__ */
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
] }) : /* @__PURE__ */
|
|
1593
|
+
)) }) : isLoading ? /* @__PURE__ */ jsxs8("div", { className: "rf-p-8 rf-text-center rf-text-zinc-500", children: [
|
|
1594
|
+
/* @__PURE__ */ jsx10(Loader22, { className: "rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2" }),
|
|
1595
|
+
/* @__PURE__ */ jsx10("p", { children: "Searching..." })
|
|
1596
|
+
] }) : /* @__PURE__ */ jsx10("div", { className: "rf-p-8 rf-text-center rf-text-zinc-500", children: hasSearched ? "No results found" : "Enter a search term to find components" }) })
|
|
1469
1597
|
]
|
|
1470
1598
|
}
|
|
1471
1599
|
),
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1600
|
+
/* @__PURE__ */ jsxs8(DialogFooter, { className: "rf-flex rf-flex-col sm:rf-flex-row rf-gap-2", children: [
|
|
1601
|
+
/* @__PURE__ */ jsx10(
|
|
1474
1602
|
Button,
|
|
1475
1603
|
{
|
|
1476
1604
|
variant: "outline",
|
|
@@ -1479,7 +1607,7 @@ var ImportComponentDialog = ({
|
|
|
1479
1607
|
children: "Cancel"
|
|
1480
1608
|
}
|
|
1481
1609
|
),
|
|
1482
|
-
/* @__PURE__ */
|
|
1610
|
+
/* @__PURE__ */ jsx10(
|
|
1483
1611
|
Button,
|
|
1484
1612
|
{
|
|
1485
1613
|
onClick: () => {
|
|
@@ -1496,7 +1624,7 @@ var ImportComponentDialog = ({
|
|
|
1496
1624
|
]
|
|
1497
1625
|
}
|
|
1498
1626
|
),
|
|
1499
|
-
/* @__PURE__ */
|
|
1627
|
+
/* @__PURE__ */ jsx10(Dialog, { open: detailsOpen, onOpenChange: setDetailsOpen, children: /* @__PURE__ */ jsxs8(
|
|
1500
1628
|
DialogContent,
|
|
1501
1629
|
{
|
|
1502
1630
|
showOverlay: false,
|
|
@@ -1505,7 +1633,7 @@ var ImportComponentDialog = ({
|
|
|
1505
1633
|
},
|
|
1506
1634
|
className: "rf-max-w-5xl !rf-overflow-y-auto rf-max-h-[90vh] rf-overflow-hidden rf-flex rf-flex-col rf-rounded-sm",
|
|
1507
1635
|
children: [
|
|
1508
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx10(DialogHeader, { className: "rf-pb-4 rf-border-b", children: /* @__PURE__ */ jsx10("div", { className: "rf-flex rf-items-start rf-justify-between rf-gap-4", children: /* @__PURE__ */ jsx10("div", { className: "rf-flex-1 rf-min-w-0", children: /* @__PURE__ */ jsx10(DialogTitle, { className: "rf-text-xl rf-font-semibold rf-truncate", children: /* @__PURE__ */ jsx10(
|
|
1509
1637
|
"a",
|
|
1510
1638
|
{
|
|
1511
1639
|
href: `https://tscircuit.com/${detailsComponent?.owner}/${detailsComponent?.name}`,
|
|
@@ -1515,10 +1643,10 @@ var ImportComponentDialog = ({
|
|
|
1515
1643
|
children: detailsComponent?.name?.split("/").pop() || detailsComponent?.name
|
|
1516
1644
|
}
|
|
1517
1645
|
) }) }) }) }),
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__PURE__ */
|
|
1646
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1 rf-overflow-y-auto rf-py-4 rf-space-y-6", children: [
|
|
1647
|
+
/* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("div", { className: "rf-space-y-3", children: detailsComponent?.owner && /* @__PURE__ */ jsxs8("div", { children: [
|
|
1648
|
+
/* @__PURE__ */ jsx10("label", { className: "rf-text-xs rf-font-medium rf-text-gray-500 rf-uppercase rf-tracking-wide", children: "Created by" }),
|
|
1649
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-mt-1 rf-text-sm rf-font-medium", children: /* @__PURE__ */ jsx10(
|
|
1522
1650
|
"a",
|
|
1523
1651
|
{
|
|
1524
1652
|
href: `https://tscircuit.com/${detailsComponent?.owner}`,
|
|
@@ -1529,16 +1657,16 @@ var ImportComponentDialog = ({
|
|
|
1529
1657
|
}
|
|
1530
1658
|
) })
|
|
1531
1659
|
] }) }) }),
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1660
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1661
|
+
/* @__PURE__ */ jsx10("h3", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Preview" }),
|
|
1662
|
+
/* @__PURE__ */ jsxs8(
|
|
1535
1663
|
Tabs,
|
|
1536
1664
|
{
|
|
1537
1665
|
value: previewActiveTab,
|
|
1538
1666
|
onValueChange: (value) => setPreviewActiveTab(value),
|
|
1539
1667
|
children: [
|
|
1540
|
-
/* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ jsxs8(TabsList, { className: "rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400", children: [
|
|
1669
|
+
/* @__PURE__ */ jsx10(
|
|
1542
1670
|
TabsTrigger,
|
|
1543
1671
|
{
|
|
1544
1672
|
value: "pcb",
|
|
@@ -1546,7 +1674,7 @@ var ImportComponentDialog = ({
|
|
|
1546
1674
|
children: "PCB"
|
|
1547
1675
|
}
|
|
1548
1676
|
),
|
|
1549
|
-
/* @__PURE__ */
|
|
1677
|
+
/* @__PURE__ */ jsx10(
|
|
1550
1678
|
TabsTrigger,
|
|
1551
1679
|
{
|
|
1552
1680
|
value: "schematic",
|
|
@@ -1555,13 +1683,13 @@ var ImportComponentDialog = ({
|
|
|
1555
1683
|
}
|
|
1556
1684
|
)
|
|
1557
1685
|
] }),
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1686
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-mt-4", children: [
|
|
1687
|
+
/* @__PURE__ */ jsx10(
|
|
1560
1688
|
TabsContent,
|
|
1561
1689
|
{
|
|
1562
1690
|
value: "pcb",
|
|
1563
1691
|
className: "rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",
|
|
1564
|
-
children: detailsComponent?.owner && detailsComponent?.name ? /* @__PURE__ */
|
|
1692
|
+
children: detailsComponent?.owner && detailsComponent?.name ? /* @__PURE__ */ jsx10("div", { className: "rf-w-full rf-h-fit rf-min-h-[300px] rf-bg-white rf-flex rf-items-center rf-justify-center rf-p-4", children: /* @__PURE__ */ jsx10(
|
|
1565
1693
|
"img",
|
|
1566
1694
|
{
|
|
1567
1695
|
src: `https://registry-api.tscircuit.com/packages/images/${detailsComponent.owner}/${detailsComponent.name}/pcb.png`,
|
|
@@ -1576,18 +1704,18 @@ var ImportComponentDialog = ({
|
|
|
1576
1704
|
}
|
|
1577
1705
|
}
|
|
1578
1706
|
}
|
|
1579
|
-
) }) : /* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
/* @__PURE__ */
|
|
1707
|
+
) }) : /* @__PURE__ */ jsx10("div", { className: "rf-h-[400px] rf-flex rf-items-center rf-justify-center rf-text-gray-500", children: /* @__PURE__ */ jsxs8("div", { className: "rf-text-center", children: [
|
|
1708
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-text-sm rf-font-medium", children: "No PCB preview available" }),
|
|
1709
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-text-xs rf-mt-1", children: "Preview cannot be generated" })
|
|
1582
1710
|
] }) })
|
|
1583
1711
|
}
|
|
1584
1712
|
),
|
|
1585
|
-
/* @__PURE__ */
|
|
1713
|
+
/* @__PURE__ */ jsx10(
|
|
1586
1714
|
TabsContent,
|
|
1587
1715
|
{
|
|
1588
1716
|
value: "schematic",
|
|
1589
1717
|
className: "rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",
|
|
1590
|
-
children: detailsComponent?.owner && detailsComponent?.name ? /* @__PURE__ */
|
|
1718
|
+
children: detailsComponent?.owner && detailsComponent?.name ? /* @__PURE__ */ jsx10("div", { className: "rf-w-full rf-h-fit rf-min-h-[300px] rf-bg-white rf-flex rf-items-center rf-justify-center rf-p-4", children: /* @__PURE__ */ jsx10(
|
|
1591
1719
|
"img",
|
|
1592
1720
|
{
|
|
1593
1721
|
src: `https://registry-api.tscircuit.com/packages/images/${detailsComponent.owner}/${detailsComponent.name}/schematic.png`,
|
|
@@ -1602,9 +1730,9 @@ var ImportComponentDialog = ({
|
|
|
1602
1730
|
}
|
|
1603
1731
|
}
|
|
1604
1732
|
}
|
|
1605
|
-
) }) : /* @__PURE__ */
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1733
|
+
) }) : /* @__PURE__ */ jsx10("div", { className: "rf-h-[400px] rf-flex rf-items-center rf-justify-center rf-text-gray-500", children: /* @__PURE__ */ jsxs8("div", { className: "rf-text-center", children: [
|
|
1734
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-text-sm rf-font-medium", children: "No schematic preview available" }),
|
|
1735
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-text-xs rf-mt-1", children: "Preview cannot be generated" })
|
|
1608
1736
|
] }) })
|
|
1609
1737
|
}
|
|
1610
1738
|
)
|
|
@@ -1613,21 +1741,21 @@ var ImportComponentDialog = ({
|
|
|
1613
1741
|
}
|
|
1614
1742
|
)
|
|
1615
1743
|
] }),
|
|
1616
|
-
packageDetails?.ai_description && /* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1744
|
+
packageDetails?.ai_description && /* @__PURE__ */ jsxs8("div", { children: [
|
|
1745
|
+
/* @__PURE__ */ jsx10("h3", { className: "rf-text-lg rf-font-semibold rf-mb-3", children: "AI Description" }),
|
|
1746
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4", children: /* @__PURE__ */ jsx10("p", { className: "rf-text-sm rf-text-gray-700 rf-leading-relaxed", children: packageDetails.ai_description }) })
|
|
1619
1747
|
] }),
|
|
1620
|
-
packageDetails?.ai_usage_instructions && /* @__PURE__ */
|
|
1621
|
-
/* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1748
|
+
packageDetails?.ai_usage_instructions && /* @__PURE__ */ jsxs8("div", { children: [
|
|
1749
|
+
/* @__PURE__ */ jsx10("h3", { className: "rf-text-lg rf-font-semibold rf-mb-3", children: "Usage Instructions" }),
|
|
1750
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4", children: /* @__PURE__ */ jsx10("p", { className: "rf-text-sm rf-text-gray-700 rf-leading-relaxed rf-whitespace-pre-wrap", children: packageDetails.ai_usage_instructions }) })
|
|
1623
1751
|
] }),
|
|
1624
|
-
packageDetailsLoading && /* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1752
|
+
packageDetailsLoading && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-justify-center rf-text-center rf-items-center rf-gap-2 rf-text-gray-500", children: [
|
|
1753
|
+
/* @__PURE__ */ jsx10(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }),
|
|
1754
|
+
/* @__PURE__ */ jsx10("span", { className: "rf-text-sm", children: "Loading package details..." })
|
|
1627
1755
|
] })
|
|
1628
1756
|
] }),
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1757
|
+
/* @__PURE__ */ jsxs8(DialogFooter, { className: "rf-pt-4 rf-border-t rf-flex rf-flex-col sm:rf-flex-row rf-justify-between rf-items-stretch sm:rf-items-center rf-gap-2", children: [
|
|
1758
|
+
/* @__PURE__ */ jsx10("div", { className: "rf-flex-1 rf-order-3 sm:rf-order-1", children: /* @__PURE__ */ jsxs8(
|
|
1631
1759
|
Button,
|
|
1632
1760
|
{
|
|
1633
1761
|
variant: "outline",
|
|
@@ -1638,13 +1766,13 @@ var ImportComponentDialog = ({
|
|
|
1638
1766
|
window.open(url, "_blank");
|
|
1639
1767
|
},
|
|
1640
1768
|
children: [
|
|
1641
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx10(ExternalLink, { className: "rf-h-4 rf-w-4" }),
|
|
1642
1770
|
"View on tscircuit.com"
|
|
1643
1771
|
]
|
|
1644
1772
|
}
|
|
1645
1773
|
) }),
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-flex-col sm:rf-flex-row rf-gap-2 sm:rf-gap-3 rf-order-1 sm:rf-order-2", children: [
|
|
1775
|
+
/* @__PURE__ */ jsx10(
|
|
1648
1776
|
Button,
|
|
1649
1777
|
{
|
|
1650
1778
|
variant: "outline",
|
|
@@ -1653,7 +1781,7 @@ var ImportComponentDialog = ({
|
|
|
1653
1781
|
children: "Close"
|
|
1654
1782
|
}
|
|
1655
1783
|
),
|
|
1656
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ jsx10(
|
|
1657
1785
|
Button,
|
|
1658
1786
|
{
|
|
1659
1787
|
onClick: () => {
|
|
@@ -1675,106 +1803,12 @@ var ImportComponentDialog = ({
|
|
|
1675
1803
|
] });
|
|
1676
1804
|
};
|
|
1677
1805
|
|
|
1678
|
-
// lib/optional-features/exporting/formats/export-fabrication-files.ts
|
|
1679
|
-
import JSZip from "jszip";
|
|
1680
|
-
import {
|
|
1681
|
-
stringifyGerberCommandLayers,
|
|
1682
|
-
convertSoupToGerberCommands,
|
|
1683
|
-
convertSoupToExcellonDrillCommands,
|
|
1684
|
-
stringifyExcellonDrill
|
|
1685
|
-
} from "circuit-json-to-gerber";
|
|
1686
|
-
import {
|
|
1687
|
-
convertCircuitJsonToBomRows,
|
|
1688
|
-
convertBomRowsToCsv
|
|
1689
|
-
} from "circuit-json-to-bom-csv";
|
|
1690
|
-
import { convertCircuitJsonToPickAndPlaceCsv } from "circuit-json-to-pnp-csv";
|
|
1691
|
-
|
|
1692
|
-
// lib/optional-features/exporting/open-for-download.ts
|
|
1693
|
-
var openForDownload = (content, opts) => {
|
|
1694
|
-
const { fileName, mimeType = "text/plain" } = opts;
|
|
1695
|
-
const blob = content instanceof Blob ? content : new Blob([content], { type: mimeType });
|
|
1696
|
-
const url = URL.createObjectURL(blob);
|
|
1697
|
-
const a = document.createElement("a");
|
|
1698
|
-
a.href = url;
|
|
1699
|
-
a.download = fileName;
|
|
1700
|
-
document.body.appendChild(a);
|
|
1701
|
-
a.click();
|
|
1702
|
-
setTimeout(() => {
|
|
1703
|
-
document.body.removeChild(a);
|
|
1704
|
-
URL.revokeObjectURL(url);
|
|
1705
|
-
}, 0);
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
|
-
// lib/optional-features/exporting/formats/export-fabrication-files.ts
|
|
1709
|
-
var exportFabricationFiles = async ({
|
|
1710
|
-
circuitJson,
|
|
1711
|
-
projectName
|
|
1712
|
-
}) => {
|
|
1713
|
-
const zip = new JSZip();
|
|
1714
|
-
const filteredCircuitJson = circuitJson.filter(
|
|
1715
|
-
(element) => !("error_type" in element) && !("warning_type" in element)
|
|
1716
|
-
);
|
|
1717
|
-
const gerberLayerCmds = convertSoupToGerberCommands(filteredCircuitJson, {
|
|
1718
|
-
flip_y_axis: false
|
|
1719
|
-
});
|
|
1720
|
-
const gerberFileContents = stringifyGerberCommandLayers(gerberLayerCmds);
|
|
1721
|
-
for (const [fileName, fileContents] of Object.entries(gerberFileContents)) {
|
|
1722
|
-
zip.file(`gerber/${fileName}.gbr`, fileContents);
|
|
1723
|
-
}
|
|
1724
|
-
const drillCmds = convertSoupToExcellonDrillCommands({
|
|
1725
|
-
circuitJson: filteredCircuitJson,
|
|
1726
|
-
is_plated: true,
|
|
1727
|
-
flip_y_axis: false
|
|
1728
|
-
});
|
|
1729
|
-
const drillFileContents = stringifyExcellonDrill(drillCmds);
|
|
1730
|
-
zip.file("gerber/drill.drl", drillFileContents);
|
|
1731
|
-
const bomRows = await convertCircuitJsonToBomRows({ circuitJson });
|
|
1732
|
-
const bomCsv = await convertBomRowsToCsv(bomRows);
|
|
1733
|
-
zip.file("bom.csv", bomCsv);
|
|
1734
|
-
const pnpCsv = await convertCircuitJsonToPickAndPlaceCsv(circuitJson);
|
|
1735
|
-
zip.file("pick_and_place.csv", pnpCsv);
|
|
1736
|
-
const zipBlob = await zip.generateAsync({ type: "blob" });
|
|
1737
|
-
openForDownload(zipBlob, {
|
|
1738
|
-
fileName: `${projectName}_fabrication_files.zip`
|
|
1739
|
-
});
|
|
1740
|
-
};
|
|
1741
|
-
|
|
1742
|
-
// lib/optional-features/exporting/export-and-download.ts
|
|
1743
|
-
var availableExports = [
|
|
1744
|
-
{ extension: "json", name: "Circuit JSON" },
|
|
1745
|
-
{ extension: "zip", name: "Fabrication Files" }
|
|
1746
|
-
// { extension: "svg", name: "SVG" },
|
|
1747
|
-
// { extension: "dsn", name: "Specctra DSN" },
|
|
1748
|
-
// { extension: "glb", name: "GLB (Binary GLTF)" },
|
|
1749
|
-
// { extension: "kicad_mod", name: "KiCad Module" },
|
|
1750
|
-
// { extension: "kicad_project", name: "KiCad Project" },
|
|
1751
|
-
// { extension: "gbr", name: "Gerbers" },
|
|
1752
|
-
];
|
|
1753
|
-
var exportAndDownload = async ({
|
|
1754
|
-
exportName,
|
|
1755
|
-
circuitJson,
|
|
1756
|
-
projectName
|
|
1757
|
-
}) => {
|
|
1758
|
-
if (exportName === "Fabrication Files") {
|
|
1759
|
-
exportFabricationFiles({ circuitJson, projectName });
|
|
1760
|
-
return;
|
|
1761
|
-
}
|
|
1762
|
-
if (exportName === "Circuit JSON") {
|
|
1763
|
-
openForDownload(JSON.stringify(circuitJson, null, 2), {
|
|
1764
|
-
fileName: `${projectName}.circuit.json`,
|
|
1765
|
-
mimeType: "application/json"
|
|
1766
|
-
});
|
|
1767
|
-
return;
|
|
1768
|
-
}
|
|
1769
|
-
throw new Error(`Unsupported export type: "${exportName}"`);
|
|
1770
|
-
};
|
|
1771
|
-
|
|
1772
1806
|
// lib/components/AiReviewDialog/AiReviewDialog.tsx
|
|
1773
1807
|
import { useState as useState9 } from "react";
|
|
1774
1808
|
|
|
1775
1809
|
// lib/components/AiReviewDialog/ListAiReviewsView.tsx
|
|
1776
1810
|
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
1777
|
-
import { Fragment as Fragment3, jsx as
|
|
1811
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1778
1812
|
var AiReviewListView = ({
|
|
1779
1813
|
packageName,
|
|
1780
1814
|
onSelectReview
|
|
@@ -1820,12 +1854,12 @@ var AiReviewListView = ({
|
|
|
1820
1854
|
setCreating(false);
|
|
1821
1855
|
}
|
|
1822
1856
|
};
|
|
1823
|
-
return /* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1857
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
1858
|
+
/* @__PURE__ */ jsxs9(DialogHeader, { children: [
|
|
1859
|
+
/* @__PURE__ */ jsx11(DialogTitle, { children: "AI Review" }),
|
|
1860
|
+
/* @__PURE__ */ jsx11(DialogDescription, { children: "Select an AI review or request a new one." })
|
|
1827
1861
|
] }),
|
|
1828
|
-
/* @__PURE__ */
|
|
1862
|
+
/* @__PURE__ */ jsx11("div", { className: "rf-flex rf-gap-4 rf-mt-4", children: /* @__PURE__ */ jsx11("div", { className: "rf-w-48 rf-h-64 rf-overflow-y-auto rf-border rf-rounded rf-p-2 rf-flex-shrink-0", children: loading ? /* @__PURE__ */ jsx11("div", { className: "rf-text-sm", children: "Loading..." }) : reviews.length > 0 ? reviews.map((review) => /* @__PURE__ */ jsx11(
|
|
1829
1863
|
"div",
|
|
1830
1864
|
{
|
|
1831
1865
|
className: "rf-text-sm rf-p-2 rf-cursor-pointer rf-rounded hover:rf-bg-zinc-100",
|
|
@@ -1833,15 +1867,15 @@ var AiReviewListView = ({
|
|
|
1833
1867
|
children: new Date(review.created_at || "").toLocaleString()
|
|
1834
1868
|
},
|
|
1835
1869
|
review.ai_review_id
|
|
1836
|
-
)) : /* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1870
|
+
)) : /* @__PURE__ */ jsx11("div", { className: "rf-text-sm rf-text-muted-foreground", children: "No AI reviews found." }) }) }),
|
|
1871
|
+
/* @__PURE__ */ jsx11(DialogFooter, { className: "rf-mt-4", children: /* @__PURE__ */ jsx11(Button, { onClick: requestReview, disabled: creating, children: creating ? "Requesting..." : "Review my Board" }) })
|
|
1838
1872
|
] });
|
|
1839
1873
|
};
|
|
1840
1874
|
|
|
1841
1875
|
// lib/components/AiReviewDialog/ViewAiReviewView.tsx
|
|
1842
1876
|
import { useEffect as useEffect9, useMemo as useMemo3, useState as useState8 } from "react";
|
|
1843
1877
|
import { marked } from "marked";
|
|
1844
|
-
import { Fragment as Fragment4, jsx as
|
|
1878
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1845
1879
|
var AiReviewViewView = ({
|
|
1846
1880
|
review,
|
|
1847
1881
|
onBack
|
|
@@ -1879,19 +1913,19 @@ var AiReviewViewView = ({
|
|
|
1879
1913
|
() => marked.parse(review.ai_review_text || ""),
|
|
1880
1914
|
[review.ai_review_text]
|
|
1881
1915
|
);
|
|
1882
|
-
return /* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1917
|
+
/* @__PURE__ */ jsxs10(DialogHeader, { className: "rf-flex rf-flex-row rf-items-center rf-justify-between", children: [
|
|
1918
|
+
/* @__PURE__ */ jsx12(Button, { variant: "ghost", size: "sm", onClick: onBack, children: "Back" }),
|
|
1919
|
+
/* @__PURE__ */ jsx12(DialogTitle, { children: "AI Review" })
|
|
1886
1920
|
] }),
|
|
1887
|
-
aiReviewText ? /* @__PURE__ */
|
|
1921
|
+
aiReviewText ? /* @__PURE__ */ jsx12(
|
|
1888
1922
|
"div",
|
|
1889
1923
|
{
|
|
1890
1924
|
className: "rf-h-64 rf-overflow-y-auto rf-prose rf-max-w-none rf-mt-2",
|
|
1891
1925
|
dangerouslySetInnerHTML: { __html: html }
|
|
1892
1926
|
}
|
|
1893
|
-
) : /* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1927
|
+
) : /* @__PURE__ */ jsx12("div", { className: "rf-h-64 rf-overflow-y-auto rf-prose rf-max-w-none rf-mt-2", children: /* @__PURE__ */ jsxs10("div", { className: "rf-flex rf-items-center rf-justify-center rf-h-full", children: [
|
|
1928
|
+
/* @__PURE__ */ jsxs10(
|
|
1895
1929
|
"svg",
|
|
1896
1930
|
{
|
|
1897
1931
|
className: "rf-animate-spin rf-h-6 rf-w-6 rf-text-zinc-400 rf-mr-2",
|
|
@@ -1900,7 +1934,7 @@ var AiReviewViewView = ({
|
|
|
1900
1934
|
viewBox: "0 0 24 24",
|
|
1901
1935
|
"aria-hidden": "true",
|
|
1902
1936
|
children: [
|
|
1903
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx12(
|
|
1904
1938
|
"circle",
|
|
1905
1939
|
{
|
|
1906
1940
|
className: "rf-opacity-25",
|
|
@@ -1911,7 +1945,7 @@ var AiReviewViewView = ({
|
|
|
1911
1945
|
strokeWidth: "4"
|
|
1912
1946
|
}
|
|
1913
1947
|
),
|
|
1914
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ jsx12(
|
|
1915
1949
|
"path",
|
|
1916
1950
|
{
|
|
1917
1951
|
className: "rf-opacity-75",
|
|
@@ -1922,13 +1956,13 @@ var AiReviewViewView = ({
|
|
|
1922
1956
|
]
|
|
1923
1957
|
}
|
|
1924
1958
|
),
|
|
1925
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ jsx12("span", { children: "Loading..." })
|
|
1926
1960
|
] }) })
|
|
1927
1961
|
] });
|
|
1928
1962
|
};
|
|
1929
1963
|
|
|
1930
1964
|
// lib/components/AiReviewDialog/AiReviewDialog.tsx
|
|
1931
|
-
import { jsx as
|
|
1965
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1932
1966
|
var AiReviewDialog = ({
|
|
1933
1967
|
isOpen,
|
|
1934
1968
|
onClose,
|
|
@@ -1942,7 +1976,7 @@ var AiReviewDialog = ({
|
|
|
1942
1976
|
setSelectedReview(review);
|
|
1943
1977
|
setStage("view_review");
|
|
1944
1978
|
};
|
|
1945
|
-
return /* @__PURE__ */
|
|
1979
|
+
return /* @__PURE__ */ jsx13(
|
|
1946
1980
|
Dialog,
|
|
1947
1981
|
{
|
|
1948
1982
|
open: isOpen,
|
|
@@ -1953,15 +1987,15 @@ var AiReviewDialog = ({
|
|
|
1953
1987
|
onClose();
|
|
1954
1988
|
}
|
|
1955
1989
|
},
|
|
1956
|
-
children: /* @__PURE__ */
|
|
1957
|
-
stage === "list_reviews" && /* @__PURE__ */
|
|
1990
|
+
children: /* @__PURE__ */ jsxs11(DialogContent, { className: "rf-max-w-2xl", children: [
|
|
1991
|
+
stage === "list_reviews" && /* @__PURE__ */ jsx13(
|
|
1958
1992
|
AiReviewListView,
|
|
1959
1993
|
{
|
|
1960
1994
|
packageName,
|
|
1961
1995
|
onSelectReview: handleSelect
|
|
1962
1996
|
}
|
|
1963
1997
|
),
|
|
1964
|
-
stage === "view_review" && selectedReview && /* @__PURE__ */
|
|
1998
|
+
stage === "view_review" && selectedReview && /* @__PURE__ */ jsx13(
|
|
1965
1999
|
AiReviewViewView,
|
|
1966
2000
|
{
|
|
1967
2001
|
review: selectedReview,
|
|
@@ -2014,7 +2048,7 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber) => {
|
|
|
2014
2048
|
};
|
|
2015
2049
|
|
|
2016
2050
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
2017
|
-
import { Fragment as Fragment5, jsx as
|
|
2051
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2018
2052
|
var RunframeCliLeftHeader = (props) => {
|
|
2019
2053
|
const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
|
|
2020
2054
|
const [snippetName, setSnippetName] = useState10(null);
|
|
@@ -2106,11 +2140,11 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2106
2140
|
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
2107
2141
|
const [isImportDialogOpen, setIsImportDialogOpen] = useState10(false);
|
|
2108
2142
|
const [isAiReviewDialogOpen, setIsAiReviewDialogOpen] = useState10(false);
|
|
2109
|
-
return /* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2144
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2145
|
+
/* @__PURE__ */ jsx14(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx14("div", { className: "rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative", children: "File" }) }),
|
|
2146
|
+
/* @__PURE__ */ jsxs12(DropdownMenuContent, { children: [
|
|
2147
|
+
/* @__PURE__ */ jsx14(
|
|
2114
2148
|
DropdownMenuItem,
|
|
2115
2149
|
{
|
|
2116
2150
|
className: "rf-text-xs",
|
|
@@ -2119,7 +2153,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2119
2153
|
children: isSaving ? "Saving..." : "Push"
|
|
2120
2154
|
}
|
|
2121
2155
|
),
|
|
2122
|
-
parseInt(window.location.port) > 5e3 && /* @__PURE__ */
|
|
2156
|
+
parseInt(window.location.port) > 5e3 && /* @__PURE__ */ jsx14(
|
|
2123
2157
|
DropdownMenuItem,
|
|
2124
2158
|
{
|
|
2125
2159
|
className: "rf-text-xs",
|
|
@@ -2129,7 +2163,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2129
2163
|
children: "Order"
|
|
2130
2164
|
}
|
|
2131
2165
|
),
|
|
2132
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ jsx14(
|
|
2133
2167
|
DropdownMenuItem,
|
|
2134
2168
|
{
|
|
2135
2169
|
className: "rf-text-xs",
|
|
@@ -2138,7 +2172,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2138
2172
|
children: "Import"
|
|
2139
2173
|
}
|
|
2140
2174
|
),
|
|
2141
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsx14(
|
|
2142
2176
|
DropdownMenuItem,
|
|
2143
2177
|
{
|
|
2144
2178
|
className: "rf-text-xs",
|
|
@@ -2152,8 +2186,8 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2152
2186
|
children: "AI Review"
|
|
2153
2187
|
}
|
|
2154
2188
|
),
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ jsxs12(DropdownMenuSub, { children: [
|
|
2190
|
+
/* @__PURE__ */ jsx14(
|
|
2157
2191
|
DropdownMenuSubTrigger,
|
|
2158
2192
|
{
|
|
2159
2193
|
className: "rf-text-xs",
|
|
@@ -2161,7 +2195,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2161
2195
|
children: isExporting ? "Exporting..." : "Export"
|
|
2162
2196
|
}
|
|
2163
2197
|
),
|
|
2164
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ jsx14(DropdownMenuPortal, { children: /* @__PURE__ */ jsx14(DropdownMenuSubContent, { children: availableExports.map((exp, i) => /* @__PURE__ */ jsx14(
|
|
2165
2199
|
DropdownMenuItem,
|
|
2166
2200
|
{
|
|
2167
2201
|
onSelect: () => {
|
|
@@ -2176,16 +2210,16 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2176
2210
|
});
|
|
2177
2211
|
},
|
|
2178
2212
|
disabled: isExporting,
|
|
2179
|
-
children: /* @__PURE__ */
|
|
2213
|
+
children: /* @__PURE__ */ jsx14("span", { className: "rf-text-xs", children: exp.name })
|
|
2180
2214
|
},
|
|
2181
2215
|
i
|
|
2182
2216
|
)) }) })
|
|
2183
2217
|
] }),
|
|
2184
|
-
/* @__PURE__ */
|
|
2185
|
-
/* @__PURE__ */
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ jsxs12(DropdownMenuSub, { children: [
|
|
2219
|
+
/* @__PURE__ */ jsx14(DropdownMenuSubTrigger, { className: "rf-text-xs", children: "Advanced" }),
|
|
2220
|
+
/* @__PURE__ */ jsx14(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs12(DropdownMenuSubContent, { children: [
|
|
2221
|
+
/* @__PURE__ */ jsx14(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs12("div", { className: "rf-flex rf-items-center rf-gap-2", children: [
|
|
2222
|
+
/* @__PURE__ */ jsx14(
|
|
2189
2223
|
Checkbox,
|
|
2190
2224
|
{
|
|
2191
2225
|
id: "load-latest-eval",
|
|
@@ -2195,7 +2229,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2195
2229
|
}
|
|
2196
2230
|
}
|
|
2197
2231
|
),
|
|
2198
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ jsx14(
|
|
2199
2233
|
"label",
|
|
2200
2234
|
{
|
|
2201
2235
|
htmlFor: "load-latest-eval",
|
|
@@ -2204,31 +2238,31 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2204
2238
|
}
|
|
2205
2239
|
)
|
|
2206
2240
|
] }) }),
|
|
2207
|
-
lastRunEvalVersion && /* @__PURE__ */
|
|
2241
|
+
lastRunEvalVersion && /* @__PURE__ */ jsx14(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx14("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs12("span", { className: "rf-text-xs", children: [
|
|
2208
2242
|
"@tscircuit/eval@",
|
|
2209
2243
|
lastRunEvalVersion
|
|
2210
2244
|
] }) }) }),
|
|
2211
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ jsx14(
|
|
2212
2246
|
DropdownMenuItem,
|
|
2213
2247
|
{
|
|
2214
2248
|
className: "rf-flex rf-items-center rf-gap-2",
|
|
2215
2249
|
onClick: () => {
|
|
2216
2250
|
window.open("/api/admin", "_blank");
|
|
2217
2251
|
},
|
|
2218
|
-
children: /* @__PURE__ */
|
|
2252
|
+
children: /* @__PURE__ */ jsx14("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx14("span", { className: "rf-text-xs", children: "CLI Admin Panel" }) })
|
|
2219
2253
|
}
|
|
2220
2254
|
)
|
|
2221
2255
|
] }) })
|
|
2222
2256
|
] })
|
|
2223
2257
|
] }),
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ jsx14(AlertDialog, { open: isError, onOpenChange: setIsError, children: /* @__PURE__ */ jsxs12(AlertDialogContent, { children: [
|
|
2259
|
+
/* @__PURE__ */ jsxs12(AlertDialogHeader, { children: [
|
|
2260
|
+
/* @__PURE__ */ jsx14(AlertDialogTitle, { children: "Error Saving Snippet" }),
|
|
2261
|
+
/* @__PURE__ */ jsx14(AlertDialogDescription, { children: errorMessage })
|
|
2228
2262
|
] }),
|
|
2229
|
-
/* @__PURE__ */
|
|
2263
|
+
/* @__PURE__ */ jsx14(AlertDialogFooter, { children: /* @__PURE__ */ jsx14(AlertDialogCancel, { onClick: () => setIsError(false), children: "Dismiss" }) })
|
|
2230
2264
|
] }) }),
|
|
2231
|
-
/* @__PURE__ */
|
|
2265
|
+
/* @__PURE__ */ jsx14(
|
|
2232
2266
|
SelectSnippetDialog,
|
|
2233
2267
|
{
|
|
2234
2268
|
snippetNames: availableSnippets ?? [],
|
|
@@ -2247,7 +2281,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2247
2281
|
}
|
|
2248
2282
|
)
|
|
2249
2283
|
] }),
|
|
2250
|
-
/* @__PURE__ */
|
|
2284
|
+
/* @__PURE__ */ jsx14(
|
|
2251
2285
|
ImportComponentDialog,
|
|
2252
2286
|
{
|
|
2253
2287
|
isOpen: isImportDialogOpen,
|
|
@@ -2280,7 +2314,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2280
2314
|
}
|
|
2281
2315
|
}
|
|
2282
2316
|
),
|
|
2283
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ jsx14(
|
|
2284
2318
|
AiReviewDialog,
|
|
2285
2319
|
{
|
|
2286
2320
|
isOpen: isAiReviewDialogOpen,
|
|
@@ -2288,7 +2322,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2288
2322
|
packageName: snippetName
|
|
2289
2323
|
}
|
|
2290
2324
|
),
|
|
2291
|
-
/* @__PURE__ */
|
|
2325
|
+
/* @__PURE__ */ jsx14(
|
|
2292
2326
|
Toaster,
|
|
2293
2327
|
{
|
|
2294
2328
|
position: "top-center",
|
|
@@ -2297,7 +2331,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2297
2331
|
toastOptions: { style: { zIndex: 1e5 } }
|
|
2298
2332
|
}
|
|
2299
2333
|
),
|
|
2300
|
-
/* @__PURE__ */
|
|
2334
|
+
/* @__PURE__ */ jsx14(
|
|
2301
2335
|
orderDialog.OrderDialog,
|
|
2302
2336
|
{
|
|
2303
2337
|
isOpen: orderDialog.isOpen,
|
|
@@ -2310,13 +2344,13 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2310
2344
|
};
|
|
2311
2345
|
|
|
2312
2346
|
// lib/components/RunFrameForCli/RunFrameForCli.tsx
|
|
2313
|
-
import { jsx as
|
|
2347
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2314
2348
|
var RunFrameForCli = (props) => {
|
|
2315
2349
|
const [shouldLoadLatestEval, setLoadLatestEval] = useLocalStorageState(
|
|
2316
2350
|
"load-latest-eval",
|
|
2317
2351
|
true
|
|
2318
2352
|
);
|
|
2319
|
-
return /* @__PURE__ */
|
|
2353
|
+
return /* @__PURE__ */ jsx15(
|
|
2320
2354
|
RunFrameWithApi,
|
|
2321
2355
|
{
|
|
2322
2356
|
debug: props.debug,
|
|
@@ -2325,8 +2359,9 @@ var RunFrameForCli = (props) => {
|
|
|
2325
2359
|
showToggleFullScreen: false,
|
|
2326
2360
|
workerBlobUrl: props.workerBlobUrl,
|
|
2327
2361
|
showFilesSwitch: true,
|
|
2328
|
-
|
|
2329
|
-
|
|
2362
|
+
showFileMenu: false,
|
|
2363
|
+
leftHeaderContent: /* @__PURE__ */ jsxs13("div", { className: "rf-flex rf-items-center rf-justify-between", children: [
|
|
2364
|
+
/* @__PURE__ */ jsx15(
|
|
2330
2365
|
RunframeCliLeftHeader,
|
|
2331
2366
|
{
|
|
2332
2367
|
shouldLoadLatestEval: !props.workerBlobUrl && shouldLoadLatestEval,
|