@tscircuit/runframe 0.0.313 → 0.0.315
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-U2ZLCEUS.js → chunk-MZVSWVSS.js} +1 -1
- package/dist/preview.js +1 -1
- package/dist/runner.d.ts +3 -2
- package/dist/runner.js +185 -196
- package/dist/standalone-preview.min.js +447 -447
- package/dist/standalone.min.js +635 -635
- package/package.json +3 -3
package/dist/runner.js
CHANGED
|
@@ -20,13 +20,62 @@ import {
|
|
|
20
20
|
buttonVariants,
|
|
21
21
|
cn,
|
|
22
22
|
linkify
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MZVSWVSS.js";
|
|
24
24
|
|
|
25
25
|
// lib/components/RunFrame/RunFrame.tsx
|
|
26
26
|
import { createCircuitWebWorker } from "@tscircuit/eval/worker";
|
|
27
|
-
import { useEffect, useReducer, useRef as useRef2, useState } from "react";
|
|
28
27
|
import Debug2 from "debug";
|
|
29
28
|
import { Loader2, Play, Square } from "lucide-react";
|
|
29
|
+
import { useEffect, useReducer, useRef as useRef2, useState } from "react";
|
|
30
|
+
|
|
31
|
+
// lib/render-logging/getPhaseTimingsFromRenderEvents.ts
|
|
32
|
+
import { orderedRenderPhases } from "@tscircuit/core";
|
|
33
|
+
var getPhaseTimingsFromRenderEvents = (renderEvents) => {
|
|
34
|
+
const phaseTimings = {};
|
|
35
|
+
if (!renderEvents) return phaseTimings;
|
|
36
|
+
for (const renderPhase of orderedRenderPhases) {
|
|
37
|
+
phaseTimings[renderPhase] = 0;
|
|
38
|
+
}
|
|
39
|
+
const startEvents = /* @__PURE__ */ new Map();
|
|
40
|
+
for (const event of renderEvents) {
|
|
41
|
+
const [, , phase, eventType] = event.type.split(":");
|
|
42
|
+
if (eventType === "start") {
|
|
43
|
+
startEvents.set(`${phase}:${event.renderId}`, event);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (eventType === "end") {
|
|
47
|
+
const startEvent = startEvents.get(`${phase}:${event.renderId}`);
|
|
48
|
+
if (startEvent) {
|
|
49
|
+
const duration = event.createdAt - startEvent.createdAt;
|
|
50
|
+
phaseTimings[phase] = (phaseTimings[phase] || 0) + duration;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return phaseTimings;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// lib/utils/getChangesBetweenFsMaps.tsx
|
|
58
|
+
var getChangesBetweenFsMaps = (fsMap1, fsMap2) => {
|
|
59
|
+
const changes = {};
|
|
60
|
+
for (const [path, oldContent] of fsMap1.entries()) {
|
|
61
|
+
const newContent = fsMap2.get(path);
|
|
62
|
+
if (newContent !== oldContent) {
|
|
63
|
+
changes[path] = {
|
|
64
|
+
old: oldContent,
|
|
65
|
+
new: newContent
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
for (const [path, newContent] of fsMap2.entries()) {
|
|
70
|
+
if (!fsMap1.has(path)) {
|
|
71
|
+
changes[path] = {
|
|
72
|
+
old: void 0,
|
|
73
|
+
new: newContent
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return changes;
|
|
78
|
+
};
|
|
30
79
|
|
|
31
80
|
// lib/components/RunFrameWithApi/store.ts
|
|
32
81
|
import { applyEditEventsToManualEditsFile } from "@tscircuit/core";
|
|
@@ -195,54 +244,20 @@ var useRunFrameStore = create()(
|
|
|
195
244
|
)
|
|
196
245
|
);
|
|
197
246
|
|
|
198
|
-
// lib/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
for (const [path, newContent] of fsMap2.entries()) {
|
|
211
|
-
if (!fsMap1.has(path)) {
|
|
212
|
-
changes[path] = {
|
|
213
|
-
old: void 0,
|
|
214
|
-
new: newContent
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return changes;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// lib/render-logging/getPhaseTimingsFromRenderEvents.ts
|
|
222
|
-
import { orderedRenderPhases } from "@tscircuit/core";
|
|
223
|
-
var getPhaseTimingsFromRenderEvents = (renderEvents) => {
|
|
224
|
-
const phaseTimings = {};
|
|
225
|
-
if (!renderEvents) return phaseTimings;
|
|
226
|
-
for (const renderPhase of orderedRenderPhases) {
|
|
227
|
-
phaseTimings[renderPhase] = 0;
|
|
228
|
-
}
|
|
229
|
-
const startEvents = /* @__PURE__ */ new Map();
|
|
230
|
-
for (const event of renderEvents) {
|
|
231
|
-
const [, , phase, eventType] = event.type.split(":");
|
|
232
|
-
if (eventType === "start") {
|
|
233
|
-
startEvents.set(`${phase}:${event.renderId}`, event);
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
if (eventType === "end") {
|
|
237
|
-
const startEvent = startEvents.get(`${phase}:${event.renderId}`);
|
|
238
|
-
if (startEvent) {
|
|
239
|
-
const duration = event.createdAt - startEvent.createdAt;
|
|
240
|
-
phaseTimings[phase] = (phaseTimings[phase] || 0) + duration;
|
|
247
|
+
// lib/components/RunFrame/runner-store/use-runner-store.ts
|
|
248
|
+
import { create as create2 } from "zustand";
|
|
249
|
+
import { devtools as devtools2 } from "zustand/middleware";
|
|
250
|
+
var useRunnerStore = create2()(
|
|
251
|
+
devtools2(
|
|
252
|
+
(set) => ({
|
|
253
|
+
lastRunEvalVersion: void 0,
|
|
254
|
+
setLastRunEvalVersion: (version) => {
|
|
255
|
+
set({ lastRunEvalVersion: version });
|
|
241
256
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
257
|
+
}),
|
|
258
|
+
{ name: "runframe-runner-store" }
|
|
259
|
+
)
|
|
260
|
+
);
|
|
246
261
|
|
|
247
262
|
// lib/components/RunFrame/useMutex.tsx
|
|
248
263
|
import { useCallback, useRef } from "react";
|
|
@@ -271,21 +286,6 @@ function useMutex() {
|
|
|
271
286
|
return { runWithMutex, isLocked };
|
|
272
287
|
}
|
|
273
288
|
|
|
274
|
-
// lib/components/RunFrame/runner-store/use-runner-store.ts
|
|
275
|
-
import { create as create2 } from "zustand";
|
|
276
|
-
import { devtools as devtools2 } from "zustand/middleware";
|
|
277
|
-
var useRunnerStore = create2()(
|
|
278
|
-
devtools2(
|
|
279
|
-
(set) => ({
|
|
280
|
-
lastRunEvalVersion: void 0,
|
|
281
|
-
setLastRunEvalVersion: (version) => {
|
|
282
|
-
set({ lastRunEvalVersion: version });
|
|
283
|
-
}
|
|
284
|
-
}),
|
|
285
|
-
{ name: "runframe-runner-store" }
|
|
286
|
-
)
|
|
287
|
-
);
|
|
288
|
-
|
|
289
289
|
// lib/components/RunFrame/RunFrame.tsx
|
|
290
290
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
291
291
|
var numRenderPhases = 26;
|
|
@@ -401,14 +401,6 @@ var RunFrame = (props) => {
|
|
|
401
401
|
globalThis.runFrameWorker = worker;
|
|
402
402
|
props.onRenderStarted?.();
|
|
403
403
|
const fsMapObj2 = fsMap instanceof Map ? Object.fromEntries(fsMap.entries()) : fsMap;
|
|
404
|
-
if (!fsMapObj2[props.entrypoint]) {
|
|
405
|
-
setError({
|
|
406
|
-
error: `Entrypoint not found (entrypoint: "${props.entrypoint}", fsMapKeys: ${Object.keys(fsMapObj2).join(", ")})`,
|
|
407
|
-
stack: ""
|
|
408
|
-
});
|
|
409
|
-
setIsRunning(false);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
404
|
const renderIds = /* @__PURE__ */ new Set();
|
|
413
405
|
const startRenderTime = Date.now();
|
|
414
406
|
let lastRenderLogSet = Date.now();
|
|
@@ -503,6 +495,12 @@ var RunFrame = (props) => {
|
|
|
503
495
|
const lastEditEventRef = useRef2(null);
|
|
504
496
|
const dragTimeout = useRef2(null);
|
|
505
497
|
const handleEditEvent = (event) => {
|
|
498
|
+
if (!event || event === null) {
|
|
499
|
+
console.warn(
|
|
500
|
+
"[RunFrame] handleEditEvent received null or undefined event."
|
|
501
|
+
);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
506
504
|
if (event.in_progress) {
|
|
507
505
|
lastEditEventRef.current = event;
|
|
508
506
|
if (dragTimeout.current) {
|
|
@@ -514,7 +512,8 @@ var RunFrame = (props) => {
|
|
|
514
512
|
clearTimeout(dragTimeout.current);
|
|
515
513
|
}
|
|
516
514
|
dragTimeout.current = setTimeout(() => {
|
|
517
|
-
|
|
515
|
+
const eventToSend = event || lastEditEventRef.current;
|
|
516
|
+
props.onEditEvent?.(eventToSend);
|
|
518
517
|
lastEditEventRef.current = null;
|
|
519
518
|
dragTimeout.current = null;
|
|
520
519
|
}, 100);
|
|
@@ -586,7 +585,7 @@ var RunFrame = (props) => {
|
|
|
586
585
|
};
|
|
587
586
|
|
|
588
587
|
// lib/components/RunFrameWithApi/RunFrameWithApi.tsx
|
|
589
|
-
import
|
|
588
|
+
import Debug3 from "debug";
|
|
590
589
|
|
|
591
590
|
// lib/hooks/use-edit-event-controller.ts
|
|
592
591
|
import { useState as useState2, useCallback as useCallback2, useEffect as useEffect2 } from "react";
|
|
@@ -646,9 +645,9 @@ var useEditEventController = () => {
|
|
|
646
645
|
};
|
|
647
646
|
|
|
648
647
|
// lib/components/RunFrameWithApi/RunFrameWithApi.tsx
|
|
649
|
-
import
|
|
650
|
-
import {
|
|
651
|
-
import { jsx as jsx2
|
|
648
|
+
import { useEffect as useEffect3 } from "react";
|
|
649
|
+
import { applyEditEventsToManualEditsFile as applyEditEventsToManualEditsFile2 } from "@tscircuit/core";
|
|
650
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
652
651
|
var debug5 = Debug3("run-frame:RunFrameWithApi");
|
|
653
652
|
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"));
|
|
654
653
|
var guessManualEditsFilePath = (files) => files.find((file) => file.includes("manual-edits.")) ?? files.find((file) => file.includes("manual-edit.")) ?? files.find((file) => file.endsWith(".json"));
|
|
@@ -684,19 +683,6 @@ var RunFrameWithApi = (props) => {
|
|
|
684
683
|
startPolling();
|
|
685
684
|
return () => stopPolling();
|
|
686
685
|
}, [startPolling, stopPolling]);
|
|
687
|
-
const entrypoint = guessEntrypoint(Array.from(fsMap.keys())) ?? "entrypoint.tsx";
|
|
688
|
-
useEffect3(() => {
|
|
689
|
-
debug5(`entrypoint set to ${entrypoint}`, {
|
|
690
|
-
fsKeys: Array.from(fsMap.keys())
|
|
691
|
-
});
|
|
692
|
-
}, [entrypoint]);
|
|
693
|
-
if (!fsMap.get(entrypoint)) {
|
|
694
|
-
return /* @__PURE__ */ jsxs2("div", { children: [
|
|
695
|
-
"No entrypoint found for Run Frame! Found files:",
|
|
696
|
-
" ",
|
|
697
|
-
Array.from(fsMap.keys()).join(",")
|
|
698
|
-
] });
|
|
699
|
-
}
|
|
700
686
|
return /* @__PURE__ */ jsx2(
|
|
701
687
|
RunFrame,
|
|
702
688
|
{
|
|
@@ -714,7 +700,6 @@ var RunFrameWithApi = (props) => {
|
|
|
714
700
|
debug5("onRenderFinished / markRenderComplete");
|
|
715
701
|
markRenderComplete();
|
|
716
702
|
},
|
|
717
|
-
entrypoint,
|
|
718
703
|
editEvents: editEventsForRender,
|
|
719
704
|
onEditEvent: (ee) => {
|
|
720
705
|
pushEditEvent(ee);
|
|
@@ -728,10 +713,13 @@ var RunFrameWithApi = (props) => {
|
|
|
728
713
|
});
|
|
729
714
|
const manualEditsFilePath = guessManualEditsFilePath(Array.from(fsMap.keys())) ?? "manual-edits.json";
|
|
730
715
|
const manualEditsFile = fsMap.get(manualEditsFilePath);
|
|
731
|
-
const updatedManualEdits =
|
|
716
|
+
const updatedManualEdits = JSON.parse(
|
|
717
|
+
manualEditsFile ?? "{}"
|
|
718
|
+
);
|
|
719
|
+
applyEditEventsToManualEditsFile2({
|
|
732
720
|
circuitJson,
|
|
733
721
|
editEvents: [ee],
|
|
734
|
-
manualEditsFile:
|
|
722
|
+
manualEditsFile: updatedManualEdits
|
|
735
723
|
});
|
|
736
724
|
fetch(`${API_BASE}/files/upsert`, {
|
|
737
725
|
method: "POST",
|
|
@@ -770,11 +758,11 @@ function useLocalStorageState(key, initialValue) {
|
|
|
770
758
|
}
|
|
771
759
|
|
|
772
760
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
773
|
-
import { useEffect as useEffect8, useMemo as
|
|
761
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useState as useState10 } from "react";
|
|
774
762
|
|
|
775
763
|
// lib/components/RunFrameForCli/SelectSnippetDialog.tsx
|
|
776
764
|
import { useState as useState4 } from "react";
|
|
777
|
-
import { jsx as jsx3, jsxs as
|
|
765
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
778
766
|
var SelectSnippetDialog = ({
|
|
779
767
|
snippetNames,
|
|
780
768
|
onSelect,
|
|
@@ -797,7 +785,7 @@ var SelectSnippetDialog = ({
|
|
|
797
785
|
}
|
|
798
786
|
}
|
|
799
787
|
};
|
|
800
|
-
return /* @__PURE__ */ jsx3("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__ */
|
|
788
|
+
return /* @__PURE__ */ jsx3("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__ */ jsxs2("div", { className: "rf-bg-white rf-rounded-lg rf-p-6 rf-w-96", children: [
|
|
801
789
|
/* @__PURE__ */ jsx3("h2", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Select Snippet" }),
|
|
802
790
|
/* @__PURE__ */ jsx3(
|
|
803
791
|
"input",
|
|
@@ -810,7 +798,7 @@ var SelectSnippetDialog = ({
|
|
|
810
798
|
onKeyDown: handleKeyDown
|
|
811
799
|
}
|
|
812
800
|
),
|
|
813
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ jsxs2("div", { className: "rf-h-60 rf-overflow-y-auto", children: [
|
|
814
802
|
filteredSnippets.map((name) => /* @__PURE__ */ jsx3(
|
|
815
803
|
"button",
|
|
816
804
|
{
|
|
@@ -821,7 +809,7 @@ var SelectSnippetDialog = ({
|
|
|
821
809
|
},
|
|
822
810
|
name
|
|
823
811
|
)),
|
|
824
|
-
showCreateNew && /* @__PURE__ */
|
|
812
|
+
showCreateNew && /* @__PURE__ */ jsxs2(
|
|
825
813
|
"button",
|
|
826
814
|
{
|
|
827
815
|
type: "button",
|
|
@@ -835,7 +823,7 @@ var SelectSnippetDialog = ({
|
|
|
835
823
|
}
|
|
836
824
|
)
|
|
837
825
|
] }),
|
|
838
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ jsxs2("div", { className: "rf-mt-4 rf-flex rf-justify-end rf-gap-2", children: [
|
|
839
827
|
/* @__PURE__ */ jsx3(
|
|
840
828
|
"button",
|
|
841
829
|
{
|
|
@@ -880,7 +868,7 @@ import "lucide-react";
|
|
|
880
868
|
// lib/components/ui/alert-dialog.tsx
|
|
881
869
|
import * as React from "react";
|
|
882
870
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
883
|
-
import { jsx as jsx4, jsxs as
|
|
871
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
884
872
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
885
873
|
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
886
874
|
var AlertDialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
@@ -895,7 +883,7 @@ var AlertDialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
895
883
|
}
|
|
896
884
|
));
|
|
897
885
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
898
|
-
var AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
886
|
+
var AlertDialogContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs3(AlertDialogPortal, { children: [
|
|
899
887
|
/* @__PURE__ */ jsx4(AlertDialogOverlay, {}),
|
|
900
888
|
/* @__PURE__ */ jsx4(
|
|
901
889
|
AlertDialogPrimitive.Content,
|
|
@@ -1101,7 +1089,7 @@ var mapTscircuitSnippetToSearchResult = (tscircuitSnippet) => {
|
|
|
1101
1089
|
|
|
1102
1090
|
// lib/components/ImportComponentDialog/ImportComponentDialog.tsx
|
|
1103
1091
|
import { createSvgUrl as createPngUrl } from "@tscircuit/create-snippet-url";
|
|
1104
|
-
import { jsx as jsx7, jsxs as
|
|
1092
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1105
1093
|
var ImportComponentDialog = ({
|
|
1106
1094
|
isOpen,
|
|
1107
1095
|
onClose,
|
|
@@ -1163,24 +1151,24 @@ var ImportComponentDialog = ({
|
|
|
1163
1151
|
setDetailsComponent(component);
|
|
1164
1152
|
setDetailsOpen(true);
|
|
1165
1153
|
};
|
|
1166
|
-
return /* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1154
|
+
return /* @__PURE__ */ jsxs4(AlertDialog, { open: isOpen, onOpenChange: () => onClose(), children: [
|
|
1155
|
+
/* @__PURE__ */ jsxs4(AlertDialogContent, { className: "rf-max-w-3xl rf-w-full rf-max-h-[90vh] rf-overflow-y-auto rf-flex rf-flex-col", children: [
|
|
1156
|
+
/* @__PURE__ */ jsxs4(AlertDialogHeader, { children: [
|
|
1169
1157
|
/* @__PURE__ */ jsx7(AlertDialogTitle, { children: "Import Component" }),
|
|
1170
1158
|
/* @__PURE__ */ jsx7(AlertDialogDescription, { children: "Search for components from tscircuit.com or JLCPCB parts library." })
|
|
1171
1159
|
] }),
|
|
1172
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsxs4(
|
|
1173
1161
|
Tabs,
|
|
1174
1162
|
{
|
|
1175
1163
|
value: activeTab,
|
|
1176
1164
|
onValueChange: (value) => setActiveTab(value),
|
|
1177
1165
|
children: [
|
|
1178
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ jsxs4(TabsList, { className: "rf-grid rf-w-full rf-grid-cols-2", children: [
|
|
1179
1167
|
/* @__PURE__ */ jsx7(TabsTrigger, { value: "tscircuit.com", children: "tscircuit.com" }),
|
|
1180
1168
|
/* @__PURE__ */ jsx7(TabsTrigger, { value: "jlcpcb", children: "JLCPCB Parts" })
|
|
1181
1169
|
] }),
|
|
1182
|
-
/* @__PURE__ */
|
|
1183
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-gap-2 rf-mt-4", children: [
|
|
1171
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-relative rf-flex-grow", children: [
|
|
1184
1172
|
/* @__PURE__ */ jsx7(Search, { className: "rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground" }),
|
|
1185
1173
|
/* @__PURE__ */ jsx7(
|
|
1186
1174
|
Input,
|
|
@@ -1195,15 +1183,15 @@ var ImportComponentDialog = ({
|
|
|
1195
1183
|
] }),
|
|
1196
1184
|
/* @__PURE__ */ jsx7(Button, { onClick: handleSearch, disabled: isLoading, children: isLoading ? /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }) : "Search" })
|
|
1197
1185
|
] }),
|
|
1198
|
-
/* @__PURE__ */ jsx7("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__ */ jsx7("div", { className: "rf-divide-y", children: searchResults.map((result) => /* @__PURE__ */
|
|
1186
|
+
/* @__PURE__ */ jsx7("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__ */ jsx7("div", { className: "rf-divide-y", children: searchResults.map((result) => /* @__PURE__ */ jsxs4(
|
|
1199
1187
|
"div",
|
|
1200
1188
|
{
|
|
1201
1189
|
className: `rf-p-3 rf-flex rf-items-center rf-justify-between rf-cursor-pointer hover:rf-bg-zinc-100 ${selectedComponent?.id === result.id ? "rf-bg-zinc-100" : ""}`,
|
|
1202
1190
|
onClick: () => setSelectedComponent(result),
|
|
1203
1191
|
children: [
|
|
1204
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1205
1193
|
/* @__PURE__ */ jsx7("div", { className: "rf-font-medium", children: result.name }),
|
|
1206
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-text-sm rf-text-zinc-500", children: [
|
|
1207
1195
|
result.partNumber && /* @__PURE__ */ jsx7("span", { className: "rf-mr-2", children: result.partNumber }),
|
|
1208
1196
|
result.description
|
|
1209
1197
|
] })
|
|
@@ -1223,14 +1211,14 @@ var ImportComponentDialog = ({
|
|
|
1223
1211
|
]
|
|
1224
1212
|
},
|
|
1225
1213
|
result.id
|
|
1226
|
-
)) }) : isLoading ? /* @__PURE__ */
|
|
1214
|
+
)) }) : isLoading ? /* @__PURE__ */ jsxs4("div", { className: "rf-p-8 rf-text-center rf-text-zinc-500", children: [
|
|
1227
1215
|
/* @__PURE__ */ jsx7(Loader22, { className: "rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2" }),
|
|
1228
1216
|
/* @__PURE__ */ jsx7("p", { children: "Searching..." })
|
|
1229
1217
|
] }) : /* @__PURE__ */ jsx7("div", { className: "rf-p-8 rf-text-center rf-text-zinc-500", children: hasSearched ? "No results found" : "Enter a search term to find components" }) })
|
|
1230
1218
|
]
|
|
1231
1219
|
}
|
|
1232
1220
|
),
|
|
1233
|
-
/* @__PURE__ */
|
|
1221
|
+
/* @__PURE__ */ jsxs4(AlertDialogFooter, { children: [
|
|
1234
1222
|
/* @__PURE__ */ jsx7(AlertDialogCancel, { onClick: onClose, children: "Cancel" }),
|
|
1235
1223
|
/* @__PURE__ */ jsx7(
|
|
1236
1224
|
Button,
|
|
@@ -1247,46 +1235,46 @@ var ImportComponentDialog = ({
|
|
|
1247
1235
|
)
|
|
1248
1236
|
] })
|
|
1249
1237
|
] }),
|
|
1250
|
-
/* @__PURE__ */ jsx7(AlertDialog, { open: detailsOpen, onOpenChange: setDetailsOpen, children: /* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ jsx7(AlertDialog, { open: detailsOpen, onOpenChange: setDetailsOpen, children: /* @__PURE__ */ jsxs4(AlertDialogContent, { className: "!rf-max-h-[70%] !rf-overflow-y-auto rf-flex rf-flex-col !rf-max-w-[60vw] !rf-overflow-x-hidden", children: [
|
|
1239
|
+
/* @__PURE__ */ jsxs4(AlertDialogHeader, { children: [
|
|
1252
1240
|
/* @__PURE__ */ jsx7(AlertDialogTitle, { children: detailsComponent?.name }),
|
|
1253
1241
|
/* @__PURE__ */ jsx7(AlertDialogDescription, { children: "Detailed information about the selected component" }),
|
|
1254
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-text-sm rf-text-muted-foreground", children: [
|
|
1255
1243
|
detailsComponent?.partNumber && /* @__PURE__ */ jsx7("div", { className: "rf-font-mono rf-text-sm rf-mb-2", children: detailsComponent.partNumber }),
|
|
1256
1244
|
detailsComponent?.description
|
|
1257
1245
|
] })
|
|
1258
1246
|
] }),
|
|
1259
|
-
detailsComponent?.source === "jlcpcb" && /* @__PURE__ */
|
|
1247
|
+
detailsComponent?.source === "jlcpcb" && /* @__PURE__ */ jsxs4("div", { className: "rf-my-4 rf-border rf-rounded-md rf-p-4", children: [
|
|
1260
1248
|
/* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium rf-mb-2", children: "JLCPCB Details" }),
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
detailsComponent.package && /* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-grid rf-grid-cols-2 rf-gap-2", children: [
|
|
1250
|
+
detailsComponent.package && /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-flex-col", children: [
|
|
1263
1251
|
/* @__PURE__ */ jsx7("span", { className: "rf-text-xs rf-text-zinc-500", children: "Package" }),
|
|
1264
1252
|
/* @__PURE__ */ jsx7("span", { className: "rf-font-medium", children: detailsComponent.package })
|
|
1265
1253
|
] }),
|
|
1266
|
-
detailsComponent.price !== void 0 && /* @__PURE__ */
|
|
1254
|
+
detailsComponent.price !== void 0 && /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-flex-col", children: [
|
|
1267
1255
|
/* @__PURE__ */ jsx7("span", { className: "rf-text-xs rf-text-zinc-500", children: "Price" }),
|
|
1268
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsxs4("span", { className: "rf-font-medium", children: [
|
|
1269
1257
|
"$",
|
|
1270
1258
|
detailsComponent.price.toFixed(4)
|
|
1271
1259
|
] })
|
|
1272
1260
|
] })
|
|
1273
1261
|
] })
|
|
1274
1262
|
] }),
|
|
1275
|
-
detailsComponent?.source === "tscircuit.com" && /* @__PURE__ */
|
|
1263
|
+
detailsComponent?.source === "tscircuit.com" && /* @__PURE__ */ jsxs4("div", { className: "rf-my-4 rf-border rf-rounded-md rf-p-4 !rf-max-w-[60vw] !rf-overflow-x-hidden", children: [
|
|
1276
1264
|
/* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium rf-mb-2", children: "tscircuit Details" }),
|
|
1277
|
-
/* @__PURE__ */ jsx7("div", { className: "rf-grid rf-grid-cols-2 rf-gap-2", children: detailsComponent.owner && /* @__PURE__ */
|
|
1265
|
+
/* @__PURE__ */ jsx7("div", { className: "rf-grid rf-grid-cols-2 rf-gap-2", children: detailsComponent.owner && /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-flex-col", children: [
|
|
1278
1266
|
/* @__PURE__ */ jsx7("span", { className: "rf-text-xs rf-text-zinc-500", children: "Owner" }),
|
|
1279
1267
|
/* @__PURE__ */ jsx7("span", { className: "rf-font-medium", children: detailsComponent.owner })
|
|
1280
1268
|
] }) }),
|
|
1281
|
-
detailsComponent.code && /* @__PURE__ */
|
|
1269
|
+
detailsComponent.code && /* @__PURE__ */ jsxs4("div", { className: "rf-mt-2", children: [
|
|
1282
1270
|
/* @__PURE__ */ jsx7("div", { className: "rf-text-xs rf-text-zinc-500 rf-mb-1", children: "Code Preview" }),
|
|
1283
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ jsxs4("pre", { className: "rf-bg-zinc-50 rf-p-2 rf-rounded rf-text-xs rf-font-mono rf-max-h-32 rf-overflow-y-auto", children: [
|
|
1284
1272
|
detailsComponent.code.substring(0, 500),
|
|
1285
1273
|
detailsComponent.code.length > 500 && "..."
|
|
1286
1274
|
] })
|
|
1287
1275
|
] })
|
|
1288
1276
|
] }),
|
|
1289
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-my-4 rf-border rf-rounded-md rf-p-4", children: [
|
|
1290
1278
|
/* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium rf-mb-2", children: "Preview" }),
|
|
1291
1279
|
detailsComponent?.source === "tscircuit.com" && detailsComponent.code ? /* @__PURE__ */ jsx7("div", { className: "rf-flex rf-justify-center", children: /* @__PURE__ */ jsx7("div", { className: "rf-border rf-rounded rf-p-4 rf-bg-zinc-50", children: /* @__PURE__ */ jsx7(
|
|
1292
1280
|
"img",
|
|
@@ -1297,8 +1285,8 @@ var ImportComponentDialog = ({
|
|
|
1297
1285
|
}
|
|
1298
1286
|
) }) }) : /* @__PURE__ */ jsx7("div", { className: "rf-text-center rf-text-zinc-500 rf-p-4", children: "No preview available" })
|
|
1299
1287
|
] }),
|
|
1300
|
-
/* @__PURE__ */
|
|
1301
|
-
/* @__PURE__ */
|
|
1288
|
+
/* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-justify-between", children: [
|
|
1289
|
+
/* @__PURE__ */ jsxs4(
|
|
1302
1290
|
Button,
|
|
1303
1291
|
{
|
|
1304
1292
|
variant: "outline",
|
|
@@ -1437,6 +1425,7 @@ import { fetchEasyEDAComponent, convertRawEasyToTsx } from "easyeda/browser";
|
|
|
1437
1425
|
import ky from "ky";
|
|
1438
1426
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber) => {
|
|
1439
1427
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber, {
|
|
1428
|
+
// @ts-ignore
|
|
1440
1429
|
fetch: (url, options) => {
|
|
1441
1430
|
return fetch(`${API_BASE}/proxy`, {
|
|
1442
1431
|
...options,
|
|
@@ -1480,7 +1469,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
|
|
|
1480
1469
|
import { MapPin } from "lucide-react";
|
|
1481
1470
|
import { useState as useState6 } from "react";
|
|
1482
1471
|
import { toast as toast2 } from "react-hot-toast";
|
|
1483
|
-
import { jsx as jsx8, jsxs as
|
|
1472
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1484
1473
|
var CheckoutOrder = ({
|
|
1485
1474
|
finalCost,
|
|
1486
1475
|
onConfirmCheckout,
|
|
@@ -1548,14 +1537,14 @@ var CheckoutOrder = ({
|
|
|
1548
1537
|
toast2.success("Your PCB order has been placed successfully.");
|
|
1549
1538
|
onConfirmCheckout();
|
|
1550
1539
|
};
|
|
1551
|
-
return /* @__PURE__ */
|
|
1540
|
+
return /* @__PURE__ */ jsxs5("div", { className: "rf-bg-white rf-rounded-xl rf-p-6 rf-mx-auto", children: [
|
|
1552
1541
|
/* @__PURE__ */ jsx8("h2", { className: "rf-text-2xl rf-font-bold rf-mb-6", children: "Checkout" }),
|
|
1553
|
-
/* @__PURE__ */
|
|
1554
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-grid rf-grid-cols-1 md:rf-grid-cols-2 rf-gap-8", children: [
|
|
1543
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-6", children: [
|
|
1555
1544
|
/* @__PURE__ */ jsx8("h3", { className: "rf-text-lg rf-font-semibold", children: "Shipping Address" }),
|
|
1556
|
-
savedAddresses.length > 0 && /* @__PURE__ */
|
|
1545
|
+
savedAddresses.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "rf-space-y-4", children: [
|
|
1557
1546
|
/* @__PURE__ */ jsx8("div", { className: "rf-text-sm rf-font-medium rf-text-gray-500", children: "Saved Addresses" }),
|
|
1558
|
-
/* @__PURE__ */ jsx8("div", { className: "rf-flex rf-flex-wrap rf-gap-3", children: savedAddresses.map((address) => /* @__PURE__ */
|
|
1547
|
+
/* @__PURE__ */ jsx8("div", { className: "rf-flex rf-flex-wrap rf-gap-3", children: savedAddresses.map((address) => /* @__PURE__ */ jsxs5(
|
|
1559
1548
|
"button",
|
|
1560
1549
|
{
|
|
1561
1550
|
type: "button",
|
|
@@ -1573,8 +1562,8 @@ var CheckoutOrder = ({
|
|
|
1573
1562
|
address.id
|
|
1574
1563
|
)) })
|
|
1575
1564
|
] }),
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */ jsx8("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: /* @__PURE__ */
|
|
1565
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-4", children: [
|
|
1566
|
+
/* @__PURE__ */ jsx8("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: /* @__PURE__ */ jsxs5("div", { className: "rf-space-y-2", children: [
|
|
1578
1567
|
/* @__PURE__ */ jsx8("label", { htmlFor: "name", children: "Address Name" }),
|
|
1579
1568
|
/* @__PURE__ */ jsx8(
|
|
1580
1569
|
Input,
|
|
@@ -1587,7 +1576,7 @@ var CheckoutOrder = ({
|
|
|
1587
1576
|
}
|
|
1588
1577
|
)
|
|
1589
1578
|
] }) }),
|
|
1590
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-2", children: [
|
|
1591
1580
|
/* @__PURE__ */ jsx8("label", { htmlFor: "street", children: "Street Address" }),
|
|
1592
1581
|
/* @__PURE__ */ jsx8(
|
|
1593
1582
|
Input,
|
|
@@ -1600,8 +1589,8 @@ var CheckoutOrder = ({
|
|
|
1600
1589
|
}
|
|
1601
1590
|
)
|
|
1602
1591
|
] }),
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: [
|
|
1593
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-2", children: [
|
|
1605
1594
|
/* @__PURE__ */ jsx8("label", { htmlFor: "city", children: "City" }),
|
|
1606
1595
|
/* @__PURE__ */ jsx8(
|
|
1607
1596
|
Input,
|
|
@@ -1614,7 +1603,7 @@ var CheckoutOrder = ({
|
|
|
1614
1603
|
}
|
|
1615
1604
|
)
|
|
1616
1605
|
] }),
|
|
1617
|
-
/* @__PURE__ */
|
|
1606
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-2", children: [
|
|
1618
1607
|
/* @__PURE__ */ jsx8("label", { htmlFor: "state", children: "State" }),
|
|
1619
1608
|
/* @__PURE__ */ jsx8(
|
|
1620
1609
|
Input,
|
|
@@ -1628,8 +1617,8 @@ var CheckoutOrder = ({
|
|
|
1628
1617
|
)
|
|
1629
1618
|
] })
|
|
1630
1619
|
] }),
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-grid rf-grid-cols-2 rf-gap-4", children: [
|
|
1621
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-2", children: [
|
|
1633
1622
|
/* @__PURE__ */ jsx8("label", { htmlFor: "zipCode", children: "Zip Code" }),
|
|
1634
1623
|
/* @__PURE__ */ jsx8(
|
|
1635
1624
|
Input,
|
|
@@ -1642,7 +1631,7 @@ var CheckoutOrder = ({
|
|
|
1642
1631
|
}
|
|
1643
1632
|
)
|
|
1644
1633
|
] }),
|
|
1645
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-2", children: [
|
|
1646
1635
|
/* @__PURE__ */ jsx8("label", { htmlFor: "country", children: "Country" }),
|
|
1647
1636
|
/* @__PURE__ */ jsx8(
|
|
1648
1637
|
Input,
|
|
@@ -1658,42 +1647,42 @@ var CheckoutOrder = ({
|
|
|
1658
1647
|
] })
|
|
1659
1648
|
] })
|
|
1660
1649
|
] }),
|
|
1661
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-bg-gray-50 rf-p-6 rf-rounded-lg", children: [
|
|
1662
1651
|
/* @__PURE__ */ jsx8("h3", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Order Summary" }),
|
|
1663
|
-
/* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */
|
|
1652
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-space-y-4", children: [
|
|
1653
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1665
1654
|
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "PCB Manufacturing" }),
|
|
1666
|
-
/* @__PURE__ */
|
|
1655
|
+
/* @__PURE__ */ jsxs5("span", { className: "rf-font-medium", children: [
|
|
1667
1656
|
"$",
|
|
1668
1657
|
(finalCost * 0.6).toFixed(2)
|
|
1669
1658
|
] })
|
|
1670
1659
|
] }),
|
|
1671
|
-
/* @__PURE__ */
|
|
1660
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1672
1661
|
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "Components" }),
|
|
1673
|
-
/* @__PURE__ */
|
|
1662
|
+
/* @__PURE__ */ jsxs5("span", { className: "rf-font-medium", children: [
|
|
1674
1663
|
"$",
|
|
1675
1664
|
(finalCost * 0.3).toFixed(2)
|
|
1676
1665
|
] })
|
|
1677
1666
|
] }),
|
|
1678
|
-
/* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1679
1668
|
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "Assembly" }),
|
|
1680
|
-
/* @__PURE__ */
|
|
1669
|
+
/* @__PURE__ */ jsxs5("span", { className: "rf-font-medium", children: [
|
|
1681
1670
|
"$",
|
|
1682
1671
|
(finalCost * 0.1).toFixed(2)
|
|
1683
1672
|
] })
|
|
1684
1673
|
] }),
|
|
1685
|
-
/* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-justify-between rf-py-2 rf-border-b rf-border-gray-200", children: [
|
|
1686
1675
|
/* @__PURE__ */ jsx8("span", { className: "rf-text-gray-600", children: "Shipping" }),
|
|
1687
1676
|
/* @__PURE__ */ jsx8("span", { className: "rf-font-medium", children: "$15.00" })
|
|
1688
1677
|
] }),
|
|
1689
|
-
/* @__PURE__ */
|
|
1678
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-justify-between rf-py-2 rf-text-lg rf-font-bold", children: [
|
|
1690
1679
|
/* @__PURE__ */ jsx8("span", { children: "Total" }),
|
|
1691
|
-
/* @__PURE__ */
|
|
1680
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1692
1681
|
"$",
|
|
1693
1682
|
(finalCost + 15).toFixed(2)
|
|
1694
1683
|
] })
|
|
1695
1684
|
] }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1685
|
+
/* @__PURE__ */ jsxs5("div", { className: "rf-pt-4", children: [
|
|
1697
1686
|
/* @__PURE__ */ jsx8(
|
|
1698
1687
|
Button,
|
|
1699
1688
|
{
|
|
@@ -1722,10 +1711,10 @@ var CheckoutOrder = ({
|
|
|
1722
1711
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
1723
1712
|
import { Check as Check2, ChevronDown, ChevronUp } from "lucide-react";
|
|
1724
1713
|
import * as React5 from "react";
|
|
1725
|
-
import { jsx as jsx9, jsxs as
|
|
1714
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1726
1715
|
var Select = SelectPrimitive.Root;
|
|
1727
1716
|
var SelectValue = SelectPrimitive.Value;
|
|
1728
|
-
var SelectTrigger = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
1717
|
+
var SelectTrigger = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs6(
|
|
1729
1718
|
SelectPrimitive.Trigger,
|
|
1730
1719
|
{
|
|
1731
1720
|
ref,
|
|
@@ -1767,7 +1756,7 @@ var SelectScrollDownButton = React5.forwardRef(({ className, ...props }, ref) =>
|
|
|
1767
1756
|
}
|
|
1768
1757
|
));
|
|
1769
1758
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1770
|
-
var SelectContent = React5.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx9(SelectPrimitive.Portal, { children: /* @__PURE__ */
|
|
1759
|
+
var SelectContent = React5.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx9(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs6(
|
|
1771
1760
|
SelectPrimitive.Content,
|
|
1772
1761
|
{
|
|
1773
1762
|
ref,
|
|
@@ -1807,7 +1796,7 @@ var SelectLabel = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1807
1796
|
}
|
|
1808
1797
|
));
|
|
1809
1798
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1810
|
-
var SelectItem = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
1799
|
+
var SelectItem = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs6(
|
|
1811
1800
|
SelectPrimitive.Item,
|
|
1812
1801
|
{
|
|
1813
1802
|
ref,
|
|
@@ -1852,7 +1841,7 @@ function Skeleton({
|
|
|
1852
1841
|
import { ArrowDown } from "lucide-react";
|
|
1853
1842
|
import { useEffect as useEffect7 } from "react";
|
|
1854
1843
|
import { useState as useState7 } from "react";
|
|
1855
|
-
import { jsx as jsx11, jsxs as
|
|
1844
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1856
1845
|
var InitialOrderScreen = ({
|
|
1857
1846
|
onCancel,
|
|
1858
1847
|
onContinue
|
|
@@ -1884,9 +1873,9 @@ var InitialOrderScreen = ({
|
|
|
1884
1873
|
setIsLoading(false);
|
|
1885
1874
|
}, 1500);
|
|
1886
1875
|
};
|
|
1887
|
-
return /* @__PURE__ */
|
|
1876
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-flex-col rf-bg-white rf-rounded-xl rf-p-8 rf-max-w-md rf-w-full rf-mx-auto", children: [
|
|
1888
1877
|
/* @__PURE__ */ jsx11("h2", { className: "rf-text-3xl rf-font-bold rf-text-center rf-mb-8", children: "Order PCB" }),
|
|
1889
|
-
/* @__PURE__ */
|
|
1878
|
+
/* @__PURE__ */ jsxs7("div", { className: "rf-mb-8", children: [
|
|
1890
1879
|
/* @__PURE__ */ jsx11(
|
|
1891
1880
|
"label",
|
|
1892
1881
|
{
|
|
@@ -1895,7 +1884,7 @@ var InitialOrderScreen = ({
|
|
|
1895
1884
|
children: "Select Product Category"
|
|
1896
1885
|
}
|
|
1897
1886
|
),
|
|
1898
|
-
/* @__PURE__ */
|
|
1887
|
+
/* @__PURE__ */ jsxs7(
|
|
1899
1888
|
Select,
|
|
1900
1889
|
{
|
|
1901
1890
|
onValueChange: handleSelectCategory,
|
|
@@ -1907,22 +1896,22 @@ var InitialOrderScreen = ({
|
|
|
1907
1896
|
}
|
|
1908
1897
|
)
|
|
1909
1898
|
] }),
|
|
1910
|
-
isLoading ? /* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
1899
|
+
isLoading ? /* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-flex-col rf-items-center rf-mb-8", children: [
|
|
1900
|
+
/* @__PURE__ */ jsxs7("div", { className: "rf-animate-pulse rf-flex rf-space-x-2 rf-items-center rf-mb-3", children: [
|
|
1912
1901
|
/* @__PURE__ */ jsx11(ArrowDown, { className: "rf-h-5 rf-w-5 rf-text-gray-400" }),
|
|
1913
1902
|
/* @__PURE__ */ jsx11("span", { className: "rf-text-gray-500", children: "Fetching estimate..." })
|
|
1914
1903
|
] }),
|
|
1915
1904
|
/* @__PURE__ */ jsx11(Skeleton, { className: "rf-h-6 rf-w-3/4 rf-mb-2" }),
|
|
1916
1905
|
/* @__PURE__ */ jsx11(Skeleton, { className: "rf-h-6 rf-w-1/2" })
|
|
1917
|
-
] }) : estimatedCost !== null ? /* @__PURE__ */
|
|
1906
|
+
] }) : estimatedCost !== null ? /* @__PURE__ */ jsxs7("div", { className: "rf-bg-gray-50 rf-p-4 rf-rounded-lg rf-mb-8", children: [
|
|
1918
1907
|
/* @__PURE__ */ jsx11("p", { className: "rf-text-sm rf-text-gray-600 rf-mb-2", children: "Estimated Cost:" }),
|
|
1919
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsxs7("p", { className: "rf-text-2xl rf-font-bold rf-text-gray-900", children: [
|
|
1920
1909
|
"$",
|
|
1921
1910
|
estimatedCost.toFixed(2)
|
|
1922
1911
|
] }),
|
|
1923
1912
|
/* @__PURE__ */ jsx11("p", { className: "rf-text-xs rf-text-gray-500 rf-mt-1", children: "Pricing may vary based on specifications" })
|
|
1924
1913
|
] }) : null,
|
|
1925
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ jsxs7("div", { className: "rf-flex rf-justify-between rf-mt-auto", children: [
|
|
1926
1915
|
/* @__PURE__ */ jsx11(
|
|
1927
1916
|
Button,
|
|
1928
1917
|
{
|
|
@@ -2040,7 +2029,7 @@ var orderSteps = [
|
|
|
2040
2029
|
}));
|
|
2041
2030
|
|
|
2042
2031
|
// lib/components/OrderDialog/StepwiseProgress.tsx
|
|
2043
|
-
import { jsx as jsx13, jsxs as
|
|
2032
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2044
2033
|
var StepwiseProgressPanel = ({
|
|
2045
2034
|
orderId,
|
|
2046
2035
|
title = "Order PCB",
|
|
@@ -2085,10 +2074,10 @@ var StepwiseProgressPanel = ({
|
|
|
2085
2074
|
const totalSteps = steps.length;
|
|
2086
2075
|
const progress = Math.round(completedSteps.length / totalSteps * 100);
|
|
2087
2076
|
const loading = isLoading || externalLoading;
|
|
2088
|
-
return /* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-flex-col rf-bg-white rf-rounded-xl rf-p-6 rf-max-w-xl rf-w-full rf-mx-auto", children: [
|
|
2078
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-center rf-justify-between rf-mb-6", children: [
|
|
2090
2079
|
/* @__PURE__ */ jsx13("h2", { className: "rf-text-2xl rf-font-bold", children: title }),
|
|
2091
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-text-sm rf-text-muted-foreground", children: [
|
|
2092
2081
|
completedSteps.length,
|
|
2093
2082
|
" of ",
|
|
2094
2083
|
totalSteps,
|
|
@@ -2096,12 +2085,12 @@ var StepwiseProgressPanel = ({
|
|
|
2096
2085
|
] })
|
|
2097
2086
|
] }),
|
|
2098
2087
|
/* @__PURE__ */ jsx13(Progress, { value: progress, className: "rf-h-2 rf-mb-8" }),
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
lastCompletedStep && /* @__PURE__ */
|
|
2088
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-space-y-6 rf-mb-8", children: [
|
|
2089
|
+
lastCompletedStep && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-start rf-gap-4", children: [
|
|
2101
2090
|
/* @__PURE__ */ jsx13("div", { className: "rf-flex-shrink-0 rf-mt-0.5", children: /* @__PURE__ */ jsx13("div", { className: "rf-w-8 rf-h-8 rf-rounded-full rf-bg-green-100 rf-flex rf-items-center rf-justify-center", children: /* @__PURE__ */ jsx13(Check3, { className: "rf-h-5 rf-w-5 rf-text-green-600" }) }) }),
|
|
2102
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
2103
2092
|
/* @__PURE__ */ jsx13("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: "Last Completed" }),
|
|
2104
|
-
/* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-green-600", children: [
|
|
2105
2094
|
lastCompletedStep.order_step_id,
|
|
2106
2095
|
". ",
|
|
2107
2096
|
lastCompletedStep.title
|
|
@@ -2109,11 +2098,11 @@ var StepwiseProgressPanel = ({
|
|
|
2109
2098
|
] })
|
|
2110
2099
|
] }),
|
|
2111
2100
|
lastCompletedStep && activeStep && /* @__PURE__ */ jsx13("div", { className: "rf-pl-4", children: /* @__PURE__ */ jsx13(ArrowDown2, { className: "rf-h-5 rf-w-5 rf-text-muted-foreground" }) }),
|
|
2112
|
-
activeStep && /* @__PURE__ */
|
|
2101
|
+
activeStep && /* @__PURE__ */ jsxs8("div", { className: "rf-flex rf-items-start rf-gap-4", children: [
|
|
2113
2102
|
/* @__PURE__ */ jsx13("div", { className: "rf-flex-shrink-0 rf-mt-0.5", children: /* @__PURE__ */ jsx13("div", { className: "rf-w-8 rf-h-8 rf-rounded-full rf-bg-blue-100 rf-flex rf-items-center rf-justify-center", children: loading ? /* @__PURE__ */ jsx13(Loader23, { className: "rf-h-5 rf-w-5 rf-text-blue-600 rf-animate-spin" }) : /* @__PURE__ */ jsx13("div", { className: "rf-h-2.5 rf-w-2.5 rf-rounded-full rf-bg-blue-600" }) }) }),
|
|
2114
|
-
/* @__PURE__ */
|
|
2103
|
+
/* @__PURE__ */ jsxs8("div", { className: "rf-flex-1", children: [
|
|
2115
2104
|
/* @__PURE__ */ jsx13("p", { className: "rf-text-sm rf-font-medium rf-text-muted-foreground", children: "Current Step" }),
|
|
2116
|
-
/* @__PURE__ */
|
|
2105
|
+
/* @__PURE__ */ jsxs8("p", { className: "rf-font-medium rf-text-blue-600", children: [
|
|
2117
2106
|
activeStep.order_step_id,
|
|
2118
2107
|
". ",
|
|
2119
2108
|
activeStep.title
|
|
@@ -2126,7 +2115,7 @@ var StepwiseProgressPanel = ({
|
|
|
2126
2115
|
};
|
|
2127
2116
|
|
|
2128
2117
|
// lib/components/OrderDialog/OrderDialog.tsx
|
|
2129
|
-
import { jsx as jsx14, jsxs as
|
|
2118
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2130
2119
|
var queryClient = new QueryClient();
|
|
2131
2120
|
var OrderDialog = ({
|
|
2132
2121
|
isOpen,
|
|
@@ -2153,7 +2142,7 @@ var OrderDialog = ({
|
|
|
2153
2142
|
setOrder(order2);
|
|
2154
2143
|
setStage("progress");
|
|
2155
2144
|
};
|
|
2156
|
-
return /* @__PURE__ */ jsx14(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx14(AlertDialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx14(AlertDialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */
|
|
2145
|
+
return /* @__PURE__ */ jsx14(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx14(AlertDialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx14(AlertDialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */ jsxs9("div", { className: "rf-relative rf-w-full", children: [
|
|
2157
2146
|
stage === "initial" && /* @__PURE__ */ jsx14(
|
|
2158
2147
|
InitialOrderScreen,
|
|
2159
2148
|
{
|
|
@@ -2241,7 +2230,7 @@ var useOrderDialog = () => {
|
|
|
2241
2230
|
};
|
|
2242
2231
|
|
|
2243
2232
|
// lib/components/RunFrameForCli/LeftHeader.tsx
|
|
2244
|
-
import { Fragment as Fragment2, jsx as jsx17, jsxs as
|
|
2233
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2245
2234
|
var RunframeCliLeftHeader = (props) => {
|
|
2246
2235
|
const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
|
|
2247
2236
|
const [snippetName, setSnippetName] = useState10(null);
|
|
@@ -2264,7 +2253,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2264
2253
|
const orderDialog = useOrderDialog();
|
|
2265
2254
|
const pushEvent = useRunFrameStore((state) => state.pushEvent);
|
|
2266
2255
|
const recentEvents = useRunFrameStore((state) => state.recentEvents);
|
|
2267
|
-
const firstRenderTime =
|
|
2256
|
+
const firstRenderTime = useMemo2(() => Date.now(), []);
|
|
2268
2257
|
useEventHandler((event) => {
|
|
2269
2258
|
if (new Date(event.created_at).valueOf() < firstRenderTime + 500) return;
|
|
2270
2259
|
if (event.event_type === "FILE_UPDATED") {
|
|
@@ -2332,10 +2321,10 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2332
2321
|
};
|
|
2333
2322
|
const circuitJson = useRunFrameStore((state) => state.circuitJson);
|
|
2334
2323
|
const [isImportDialogOpen, setIsImportDialogOpen] = useState10(false);
|
|
2335
|
-
return /* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2324
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2325
|
+
/* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2337
2326
|
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx17("div", { className: "rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative", children: "File" }) }),
|
|
2338
|
-
/* @__PURE__ */
|
|
2327
|
+
/* @__PURE__ */ jsxs10(DropdownMenuContent, { children: [
|
|
2339
2328
|
/* @__PURE__ */ jsx17(
|
|
2340
2329
|
DropdownMenuItem,
|
|
2341
2330
|
{
|
|
@@ -2364,7 +2353,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2364
2353
|
children: "Import"
|
|
2365
2354
|
}
|
|
2366
2355
|
),
|
|
2367
|
-
/* @__PURE__ */
|
|
2356
|
+
/* @__PURE__ */ jsxs10(DropdownMenuSub, { children: [
|
|
2368
2357
|
/* @__PURE__ */ jsx17(
|
|
2369
2358
|
DropdownMenuSubTrigger,
|
|
2370
2359
|
{
|
|
@@ -2393,10 +2382,10 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2393
2382
|
i
|
|
2394
2383
|
)) }) })
|
|
2395
2384
|
] }),
|
|
2396
|
-
/* @__PURE__ */
|
|
2385
|
+
/* @__PURE__ */ jsxs10(DropdownMenuSub, { children: [
|
|
2397
2386
|
/* @__PURE__ */ jsx17(DropdownMenuSubTrigger, { className: "rf-text-xs", children: "Advanced" }),
|
|
2398
|
-
/* @__PURE__ */ jsx17(DropdownMenuPortal, { children: /* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */ jsx17(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */
|
|
2387
|
+
/* @__PURE__ */ jsx17(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(DropdownMenuSubContent, { children: [
|
|
2388
|
+
/* @__PURE__ */ jsx17(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs10("div", { className: "rf-flex rf-items-center rf-gap-2", children: [
|
|
2400
2389
|
/* @__PURE__ */ jsx17(
|
|
2401
2390
|
Checkbox,
|
|
2402
2391
|
{
|
|
@@ -2416,7 +2405,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2416
2405
|
}
|
|
2417
2406
|
)
|
|
2418
2407
|
] }) }),
|
|
2419
|
-
lastRunEvalVersion && /* @__PURE__ */ jsx17(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx17("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */
|
|
2408
|
+
lastRunEvalVersion && /* @__PURE__ */ jsx17(DropdownMenuItem, { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsx17("div", { className: "rf-flex rf-items-center rf-gap-2", children: /* @__PURE__ */ jsxs10("span", { className: "rf-text-xs", children: [
|
|
2420
2409
|
"@tscircuit/eval@",
|
|
2421
2410
|
lastRunEvalVersion
|
|
2422
2411
|
] }) }) }),
|
|
@@ -2433,8 +2422,8 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2433
2422
|
] }) })
|
|
2434
2423
|
] })
|
|
2435
2424
|
] }),
|
|
2436
|
-
/* @__PURE__ */ jsx17(AlertDialog, { open: isError, onOpenChange: setIsError, children: /* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2425
|
+
/* @__PURE__ */ jsx17(AlertDialog, { open: isError, onOpenChange: setIsError, children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2426
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2438
2427
|
/* @__PURE__ */ jsx17(AlertDialogTitle, { children: "Error Saving Snippet" }),
|
|
2439
2428
|
/* @__PURE__ */ jsx17(AlertDialogDescription, { children: errorMessage })
|
|
2440
2429
|
] }),
|
|
@@ -2502,7 +2491,7 @@ var RunframeCliLeftHeader = (props) => {
|
|
|
2502
2491
|
};
|
|
2503
2492
|
|
|
2504
2493
|
// lib/components/RunFrameForCli/RunFrameForCli.tsx
|
|
2505
|
-
import { jsx as jsx18, jsxs as
|
|
2494
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2506
2495
|
var RunFrameForCli = (props) => {
|
|
2507
2496
|
const [shouldLoadLatestEval, setLoadLatestEval] = useLocalStorageState(
|
|
2508
2497
|
"load-latest-eval",
|
|
@@ -2515,7 +2504,7 @@ var RunFrameForCli = (props) => {
|
|
|
2515
2504
|
forceLatestEvalVersion: shouldLoadLatestEval,
|
|
2516
2505
|
defaultToFullScreen: true,
|
|
2517
2506
|
showToggleFullScreen: false,
|
|
2518
|
-
leftHeaderContent: /* @__PURE__ */
|
|
2507
|
+
leftHeaderContent: /* @__PURE__ */ jsxs11("div", { className: "rf-flex rf-items-center rf-justify-between", children: [
|
|
2519
2508
|
/* @__PURE__ */ jsx18(
|
|
2520
2509
|
RunframeCliLeftHeader,
|
|
2521
2510
|
{
|