@tscircuit/runframe 0.0.699 → 0.0.701

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/runner.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  useOrderDialogCli,
38
38
  useRunFrameStore,
39
39
  useRunnerStore
40
- } from "./chunk-77DDNVNN.js";
40
+ } from "./chunk-IZIOLTYT.js";
41
41
 
42
42
  // lib/components/RunFrame/RunFrame.tsx
43
43
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -235,7 +235,7 @@ var RunFrame = (props) => {
235
235
  const [renderLog, setRenderLog] = useState(null);
236
236
  const [autoroutingLog, setAutoroutingLog] = useState({});
237
237
  const [activeTab, setActiveTab] = useState(
238
- props.defaultActiveTab ?? "pcb"
238
+ props.defaultActiveTab ?? props.defaultTab ?? "pcb"
239
239
  );
240
240
  useEffect(() => {
241
241
  if (props.debug) Debug.enable("run-frame*");
@@ -472,7 +472,9 @@ var RunFrame = (props) => {
472
472
  CircuitJsonPreview,
473
473
  {
474
474
  code: fsMap.get(props.entrypoint ?? props.mainComponentPath),
475
- defaultActiveTab: props.defaultActiveTab,
475
+ defaultActiveTab: props.defaultActiveTab ?? props.defaultTab,
476
+ defaultTab: props.defaultTab,
477
+ availableTabs: props.availableTabs,
476
478
  showToggleFullScreen: props.showToggleFullScreen,
477
479
  autoroutingGraphics,
478
480
  autoroutingLog,
@@ -1071,7 +1073,7 @@ var mapTscircuitSnippetToSearchResult = (tscircuitSnippet) => {
1071
1073
  };
1072
1074
 
1073
1075
  // lib/components/ImportComponentDialog/ImportComponentDialog.tsx
1074
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1076
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1075
1077
  var ImportComponentDialog = ({
1076
1078
  isOpen,
1077
1079
  onClose,
@@ -1159,256 +1161,303 @@ var ImportComponentDialog = ({
1159
1161
  }
1160
1162
  };
1161
1163
  return /* @__PURE__ */ jsxs4(Dialog, { open: isOpen, onOpenChange: () => onClose(), children: [
1162
- /* @__PURE__ */ jsxs4(DialogContent, { className: "rf-max-w-3xl rf-w-full rf-max-h-[90vh] rf-overflow-y-auto rf-flex rf-flex-col", children: [
1163
- /* @__PURE__ */ jsxs4(DialogHeader, { children: [
1164
- /* @__PURE__ */ jsx7(DialogTitle, { children: "Import Component" }),
1165
- /* @__PURE__ */ jsx7(DialogDescription, { children: "Search for components from tscircuit.com or JLCPCB parts library." })
1166
- ] }),
1167
- /* @__PURE__ */ jsxs4(
1168
- Tabs,
1169
- {
1170
- value: activeTab,
1171
- onValueChange: (value) => setActiveTab(value),
1172
- children: [
1173
- /* @__PURE__ */ jsxs4(TabsList, { className: "rf-grid rf-w-full rf-grid-cols-2", children: [
1174
- /* @__PURE__ */ jsx7(TabsTrigger, { value: "tscircuit.com", children: "tscircuit.com" }),
1175
- /* @__PURE__ */ jsx7(TabsTrigger, { value: "jlcpcb", children: "JLCPCB Parts" })
1176
- ] }),
1177
- /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-gap-2 rf-mt-4", children: [
1178
- /* @__PURE__ */ jsxs4("div", { className: "rf-relative rf-flex-grow", children: [
1179
- /* @__PURE__ */ jsx7(Search, { className: "rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground" }),
1180
- /* @__PURE__ */ jsx7(
1181
- Input,
1182
- {
1183
- placeholder: activeTab === "tscircuit.com" ? "Search components..." : "Search JLCPCB parts (e.g. C14663)...",
1184
- className: "rf-pl-8",
1185
- spellCheck: false,
1186
- autoComplete: "off",
1187
- value: searchQuery,
1188
- onChange: (e) => setSearchQuery(e.target.value),
1189
- onKeyDown: handleKeyDown
1190
- }
1191
- )
1192
- ] }),
1193
- /* @__PURE__ */ jsx7(
1194
- Button,
1195
- {
1196
- onClick: handleSearch,
1197
- disabled: isLoading || searchQuery.trim().length < 1,
1198
- children: isLoading ? /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }) : "Search"
1199
- }
1200
- )
1201
- ] }),
1202
- /* @__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(
1203
- "div",
1204
- {
1205
- 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" : ""}`,
1206
- onClick: () => setSelectedComponent(result),
1207
- children: [
1208
- /* @__PURE__ */ jsxs4("div", { children: [
1209
- /* @__PURE__ */ jsx7("div", { className: "rf-font-medium", children: result.name }),
1210
- /* @__PURE__ */ jsxs4("div", { className: "rf-text-sm rf-text-zinc-500", children: [
1211
- result.partNumber && /* @__PURE__ */ jsx7("span", { className: "rf-mr-2", children: result.partNumber }),
1212
- result.description
1213
- ] })
1214
- ] }),
1215
- /* @__PURE__ */ jsx7("div", { className: "rf-flex rf-gap-2", children: result.source === "tscircuit.com" && /* @__PURE__ */ jsx7(
1216
- Button,
1217
- {
1218
- variant: "outline",
1219
- size: "sm",
1220
- onClick: (e) => {
1221
- e.stopPropagation();
1222
- showDetails(result);
1223
- },
1224
- children: "See Details"
1225
- }
1226
- ) })
1227
- ]
1228
- },
1229
- result.id
1230
- )) }) : isLoading ? /* @__PURE__ */ jsxs4("div", { className: "rf-p-8 rf-text-center rf-text-zinc-500", children: [
1231
- /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2" }),
1232
- /* @__PURE__ */ jsx7("p", { children: "Searching..." })
1233
- ] }) : /* @__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" }) })
1234
- ]
1235
- }
1236
- ),
1237
- /* @__PURE__ */ jsxs4(DialogFooter, { children: [
1238
- /* @__PURE__ */ jsx7(Button, { variant: "outline", onClick: onClose, children: "Cancel" }),
1239
- /* @__PURE__ */ jsx7(
1240
- Button,
1241
- {
1242
- onClick: () => {
1243
- if (selectedComponent) {
1244
- onImport(selectedComponent);
1245
- onClose();
1246
- }
1247
- },
1248
- disabled: !selectedComponent,
1249
- children: "Import Component"
1250
- }
1251
- )
1252
- ] })
1253
- ] }),
1254
- /* @__PURE__ */ jsx7(Dialog, { open: detailsOpen, onOpenChange: setDetailsOpen, children: /* @__PURE__ */ jsxs4(DialogContent, { className: "rf-max-w-5xl rf-max-h-[90vh] rf-overflow-hidden rf-flex rf-flex-col rf-overflow-y-auto", children: [
1255
- /* @__PURE__ */ jsx7(DialogHeader, { className: "rf-pb-4 rf-border-b", children: /* @__PURE__ */ jsx7("div", { className: "rf-flex rf-items-start rf-justify-between rf-gap-4", children: /* @__PURE__ */ jsx7("div", { className: "rf-flex-1 rf-min-w-0", children: /* @__PURE__ */ jsx7(DialogTitle, { className: "rf-text-xl rf-font-semibold rf-truncate", children: /* @__PURE__ */ jsx7(
1256
- "a",
1257
- {
1258
- href: `https://tscircuit.com/${detailsComponent?.owner}/${detailsComponent?.name}`,
1259
- target: "_blank",
1260
- rel: "noopener noreferrer",
1261
- className: "rf-text-black hover:rf-underline",
1262
- children: detailsComponent?.name?.split("/").pop() || detailsComponent?.name
1263
- }
1264
- ) }) }) }) }),
1265
- /* @__PURE__ */ jsxs4("div", { className: "rf-flex-1 rf-overflow-y-auto rf-py-4 rf-space-y-6", children: [
1266
- /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7("div", { className: "rf-space-y-3", children: detailsComponent?.owner && /* @__PURE__ */ jsxs4("div", { children: [
1267
- /* @__PURE__ */ jsx7("label", { className: "rf-text-xs rf-font-medium rf-text-gray-500 rf-uppercase rf-tracking-wide", children: "Created by" }),
1268
- /* @__PURE__ */ jsx7("div", { className: "rf-mt-1 rf-text-sm rf-font-medium", children: /* @__PURE__ */ jsx7(
1269
- "a",
1270
- {
1271
- href: `https://tscircuit.com/${detailsComponent?.owner}`,
1272
- target: "_blank",
1273
- rel: "noopener noreferrer",
1274
- className: "rf-text-black hover:rf-underline",
1275
- children: detailsComponent?.owner
1276
- }
1277
- ) })
1278
- ] }) }) }),
1279
- /* @__PURE__ */ jsxs4("div", { children: [
1280
- /* @__PURE__ */ jsx7("h3", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Preview" }),
1164
+ /* @__PURE__ */ jsxs4(
1165
+ DialogContent,
1166
+ {
1167
+ style: {
1168
+ width: "calc(100vw - 2rem)"
1169
+ },
1170
+ className: "rf-rounded-sm rf-max-h-[90vh] rf-overflow-y-auto rf-flex rf-flex-col",
1171
+ children: [
1172
+ /* @__PURE__ */ jsxs4(DialogHeader, { children: [
1173
+ /* @__PURE__ */ jsx7(DialogTitle, { className: "rf-text-lg sm:rf-text-xl", children: "Import Component" }),
1174
+ /* @__PURE__ */ jsx7(DialogDescription, { className: "rf-text-sm", children: "Search for components from tscircuit.com or JLCPCB parts library." })
1175
+ ] }),
1281
1176
  /* @__PURE__ */ jsxs4(
1282
1177
  Tabs,
1283
1178
  {
1284
- value: previewActiveTab,
1285
- onValueChange: (value) => setPreviewActiveTab(value),
1179
+ value: activeTab,
1180
+ onValueChange: (value) => setActiveTab(value),
1286
1181
  children: [
1287
- /* @__PURE__ */ jsxs4(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: [
1182
+ /* @__PURE__ */ jsxs4(TabsList, { className: "rf-grid rf-w-full rf-grid-cols-2 rf-h-auto", children: [
1288
1183
  /* @__PURE__ */ jsx7(
1289
1184
  TabsTrigger,
1290
1185
  {
1291
- value: "pcb",
1292
- className: "rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",
1293
- children: "PCB"
1186
+ value: "tscircuit.com",
1187
+ className: "rf-text-xs sm:rf-text-sm",
1188
+ children: "tscircuit.com"
1294
1189
  }
1295
1190
  ),
1191
+ /* @__PURE__ */ jsx7(TabsTrigger, { value: "jlcpcb", className: "rf-text-xs sm:rf-text-sm", children: "JLCPCB Parts" })
1192
+ ] }),
1193
+ /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-items-center rf-gap-2 rf-mt-4", children: [
1194
+ /* @__PURE__ */ jsxs4("div", { className: "rf-relative rf-flex-grow", children: [
1195
+ /* @__PURE__ */ jsx7(Search, { className: "rf-absolute rf-left-2 rf-top-2.5 rf-h-4 rf-w-4 rf-text-muted-foreground" }),
1196
+ /* @__PURE__ */ jsx7(
1197
+ Input,
1198
+ {
1199
+ placeholder: activeTab === "tscircuit.com" ? "Search components..." : "Search JLCPCB parts (e.g. C14663)...",
1200
+ className: "rf-pl-8",
1201
+ spellCheck: false,
1202
+ autoComplete: "off",
1203
+ value: searchQuery,
1204
+ onChange: (e) => setSearchQuery(e.target.value),
1205
+ onKeyDown: handleKeyDown
1206
+ }
1207
+ )
1208
+ ] }),
1296
1209
  /* @__PURE__ */ jsx7(
1297
- TabsTrigger,
1210
+ Button,
1298
1211
  {
1299
- value: "schematic",
1300
- className: "rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",
1301
- children: "Schematic"
1212
+ onClick: handleSearch,
1213
+ disabled: isLoading || searchQuery.trim().length < 1,
1214
+ className: "sm:rf-px-4 rf-px-3",
1215
+ children: isLoading ? /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1216
+ /* @__PURE__ */ jsx7(Search, { className: "rf-h-4 rf-w-4 sm:rf-hidden" }),
1217
+ /* @__PURE__ */ jsx7("span", { className: "rf-hidden sm:rf-inline", children: "Search" })
1218
+ ] })
1302
1219
  }
1303
1220
  )
1304
1221
  ] }),
1305
- /* @__PURE__ */ jsxs4("div", { className: "rf-mt-4", children: [
1306
- /* @__PURE__ */ jsx7(
1307
- TabsContent,
1308
- {
1309
- value: "pcb",
1310
- className: "rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",
1311
- children: detailsComponent?.code ? /* @__PURE__ */ jsx7("div", { className: "rf-w-full rf-h-[400px] rf-bg-white rf-flex rf-items-center rf-justify-center rf-p-4", children: /* @__PURE__ */ jsx7(
1312
- "img",
1222
+ /* @__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(
1223
+ "div",
1224
+ {
1225
+ 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" : ""}`,
1226
+ onClick: () => setSelectedComponent(result),
1227
+ children: [
1228
+ /* @__PURE__ */ jsxs4("div", { className: "rf-flex-1 rf-min-w-0", children: [
1229
+ /* @__PURE__ */ jsx7("div", { className: "rf-font-medium rf-text-sm rf-truncate", children: result.name }),
1230
+ /* @__PURE__ */ jsxs4("div", { className: "rf-text-xs rf-text-zinc-500 rf-break-words", children: [
1231
+ result.partNumber && /* @__PURE__ */ jsx7("span", { className: "rf-mr-2", children: result.partNumber }),
1232
+ result.description
1233
+ ] })
1234
+ ] }),
1235
+ /* @__PURE__ */ jsx7("div", { className: "rf-flex rf-gap-2 rf-flex-shrink-0 rf-w-full sm:rf-w-auto", children: result.source === "tscircuit.com" && /* @__PURE__ */ jsx7(
1236
+ Button,
1237
+ {
1238
+ variant: "outline",
1239
+ size: "sm",
1240
+ className: "rf-text-xs rf-w-full sm:rf-w-auto",
1241
+ onClick: (e) => {
1242
+ e.stopPropagation();
1243
+ showDetails(result);
1244
+ },
1245
+ children: "See Details"
1246
+ }
1247
+ ) })
1248
+ ]
1249
+ },
1250
+ result.id
1251
+ )) }) : isLoading ? /* @__PURE__ */ jsxs4("div", { className: "rf-p-8 rf-text-center rf-text-zinc-500", children: [
1252
+ /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-8 rf-w-8 rf-animate-spin rf-mx-auto rf-mb-2" }),
1253
+ /* @__PURE__ */ jsx7("p", { children: "Searching..." })
1254
+ ] }) : /* @__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" }) })
1255
+ ]
1256
+ }
1257
+ ),
1258
+ /* @__PURE__ */ jsxs4(DialogFooter, { className: "rf-flex rf-flex-col sm:rf-flex-row rf-gap-2", children: [
1259
+ /* @__PURE__ */ jsx7(
1260
+ Button,
1261
+ {
1262
+ variant: "outline",
1263
+ onClick: onClose,
1264
+ className: "rf-order-2 sm:rf-order-1",
1265
+ children: "Cancel"
1266
+ }
1267
+ ),
1268
+ /* @__PURE__ */ jsx7(
1269
+ Button,
1270
+ {
1271
+ onClick: () => {
1272
+ if (selectedComponent) {
1273
+ onImport(selectedComponent);
1274
+ onClose();
1275
+ }
1276
+ },
1277
+ disabled: !selectedComponent,
1278
+ children: "Import Component"
1279
+ }
1280
+ )
1281
+ ] })
1282
+ ]
1283
+ }
1284
+ ),
1285
+ /* @__PURE__ */ jsx7(Dialog, { open: detailsOpen, onOpenChange: setDetailsOpen, children: /* @__PURE__ */ jsxs4(
1286
+ DialogContent,
1287
+ {
1288
+ showOverlay: false,
1289
+ style: {
1290
+ width: "calc(100vw - 2rem)"
1291
+ },
1292
+ className: "rf-max-w-5xl !rf-overflow-y-auto rf-max-h-[90vh] rf-overflow-hidden rf-flex rf-flex-col rf-rounded-sm",
1293
+ children: [
1294
+ /* @__PURE__ */ jsx7(DialogHeader, { className: "rf-pb-4 rf-border-b", children: /* @__PURE__ */ jsx7("div", { className: "rf-flex rf-items-start rf-justify-between rf-gap-4", children: /* @__PURE__ */ jsx7("div", { className: "rf-flex-1 rf-min-w-0", children: /* @__PURE__ */ jsx7(DialogTitle, { className: "rf-text-xl rf-font-semibold rf-truncate", children: /* @__PURE__ */ jsx7(
1295
+ "a",
1296
+ {
1297
+ href: `https://tscircuit.com/${detailsComponent?.owner}/${detailsComponent?.name}`,
1298
+ target: "_blank",
1299
+ rel: "noopener noreferrer",
1300
+ className: "rf-text-black hover:rf-underline",
1301
+ children: detailsComponent?.name?.split("/").pop() || detailsComponent?.name
1302
+ }
1303
+ ) }) }) }) }),
1304
+ /* @__PURE__ */ jsxs4("div", { className: "rf-flex-1 rf-overflow-y-auto rf-py-4 rf-space-y-6", children: [
1305
+ /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7("div", { className: "rf-space-y-3", children: detailsComponent?.owner && /* @__PURE__ */ jsxs4("div", { children: [
1306
+ /* @__PURE__ */ jsx7("label", { className: "rf-text-xs rf-font-medium rf-text-gray-500 rf-uppercase rf-tracking-wide", children: "Created by" }),
1307
+ /* @__PURE__ */ jsx7("div", { className: "rf-mt-1 rf-text-sm rf-font-medium", children: /* @__PURE__ */ jsx7(
1308
+ "a",
1309
+ {
1310
+ href: `https://tscircuit.com/${detailsComponent?.owner}`,
1311
+ target: "_blank",
1312
+ rel: "noopener noreferrer",
1313
+ className: "rf-text-black hover:rf-underline",
1314
+ children: detailsComponent?.owner
1315
+ }
1316
+ ) })
1317
+ ] }) }) }),
1318
+ /* @__PURE__ */ jsxs4("div", { children: [
1319
+ /* @__PURE__ */ jsx7("h3", { className: "rf-text-lg rf-font-semibold rf-mb-4", children: "Preview" }),
1320
+ /* @__PURE__ */ jsxs4(
1321
+ Tabs,
1322
+ {
1323
+ value: previewActiveTab,
1324
+ onValueChange: (value) => setPreviewActiveTab(value),
1325
+ children: [
1326
+ /* @__PURE__ */ jsxs4(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: [
1327
+ /* @__PURE__ */ jsx7(
1328
+ TabsTrigger,
1329
+ {
1330
+ value: "pcb",
1331
+ className: "rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",
1332
+ children: "PCB"
1333
+ }
1334
+ ),
1335
+ /* @__PURE__ */ jsx7(
1336
+ TabsTrigger,
1313
1337
  {
1314
- src: `https://registry-api.tscircuit.com/packages/images/${detailsComponent.owner}/${detailsComponent.name}/pcb.png`,
1315
- alt: `${detailsComponent.name} PCB preview`,
1316
- className: "rf-max-w-full rf-max-h-full rf-object-contain rf-rounded",
1317
- onError: (e) => {
1318
- const target = e.target;
1319
- target.style.display = "none";
1320
- const parent = target.parentElement;
1321
- if (parent) {
1322
- parent.innerHTML = '<div class="rf-text-center rf-text-gray-500"><div class="rf-text-sm rf-font-medium">PCB preview not available</div><div class="rf-text-xs rf-mt-1">Image failed to load</div></div>';
1338
+ value: "schematic",
1339
+ className: "rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",
1340
+ children: "Schematic"
1341
+ }
1342
+ )
1343
+ ] }),
1344
+ /* @__PURE__ */ jsxs4("div", { className: "rf-mt-4", children: [
1345
+ /* @__PURE__ */ jsx7(
1346
+ TabsContent,
1347
+ {
1348
+ value: "pcb",
1349
+ className: "rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",
1350
+ children: detailsComponent?.code ? /* @__PURE__ */ jsx7("div", { className: "rf-w-full rf-h-[400px] rf-bg-white rf-flex rf-items-center rf-justify-center rf-p-4", children: /* @__PURE__ */ jsx7(
1351
+ "img",
1352
+ {
1353
+ src: `https://registry-api.tscircuit.com/packages/images/${detailsComponent.owner}/${detailsComponent.name}/pcb.png`,
1354
+ alt: `${detailsComponent.name} PCB preview`,
1355
+ className: "rf-max-w-full rf-max-h-full rf-object-contain rf-rounded",
1356
+ onError: (e) => {
1357
+ const target = e.target;
1358
+ target.style.display = "none";
1359
+ const parent = target.parentElement;
1360
+ if (parent) {
1361
+ parent.innerHTML = '<div class="rf-text-center rf-text-gray-500"><div class="rf-text-sm rf-font-medium">PCB preview not available</div><div class="rf-text-xs rf-mt-1">Image failed to load</div></div>';
1362
+ }
1363
+ }
1323
1364
  }
1324
- }
1365
+ ) }) : /* @__PURE__ */ jsx7("div", { className: "rf-h-[400px] rf-flex rf-items-center rf-justify-center rf-text-gray-500", children: /* @__PURE__ */ jsxs4("div", { className: "rf-text-center", children: [
1366
+ /* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium", children: "No PCB preview available" }),
1367
+ /* @__PURE__ */ jsx7("div", { className: "rf-text-xs rf-mt-1", children: "Preview cannot be generated" })
1368
+ ] }) })
1325
1369
  }
1326
- ) }) : /* @__PURE__ */ jsx7("div", { className: "rf-h-[400px] rf-flex rf-items-center rf-justify-center rf-text-gray-500", children: /* @__PURE__ */ jsxs4("div", { className: "rf-text-center", children: [
1327
- /* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium", children: "No PCB preview available" }),
1328
- /* @__PURE__ */ jsx7("div", { className: "rf-text-xs rf-mt-1", children: "Preview cannot be generated" })
1329
- ] }) })
1330
- }
1331
- ),
1332
- /* @__PURE__ */ jsx7(
1333
- TabsContent,
1334
- {
1335
- value: "schematic",
1336
- className: "rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",
1337
- children: detailsComponent?.code ? /* @__PURE__ */ jsx7("div", { className: "rf-w-full rf-h-[400px] rf-bg-white rf-flex rf-items-center rf-justify-center rf-p-4", children: /* @__PURE__ */ jsx7(
1338
- "img",
1370
+ ),
1371
+ /* @__PURE__ */ jsx7(
1372
+ TabsContent,
1339
1373
  {
1340
- src: `https://registry-api.tscircuit.com/packages/images/${detailsComponent.owner}/${detailsComponent.name}/schematic.png`,
1341
- alt: `${detailsComponent.name} schematic preview`,
1342
- className: "rf-max-w-full rf-max-h-full rf-object-contain rf-rounded",
1343
- onError: (e) => {
1344
- const target = e.target;
1345
- target.style.display = "none";
1346
- const parent = target.parentElement;
1347
- if (parent) {
1348
- parent.innerHTML = '<div class="rf-text-center rf-text-gray-500"><div class="rf-text-sm rf-font-medium">Schematic preview not available</div><div class="rf-text-xs rf-mt-1">Image failed to load</div></div>';
1374
+ value: "schematic",
1375
+ className: "rf-border rf-rounded-lg rf-overflow-hidden rf-bg-gray-50",
1376
+ children: detailsComponent?.code ? /* @__PURE__ */ jsx7("div", { className: "rf-w-full rf-h-[400px] rf-bg-white rf-flex rf-items-center rf-justify-center rf-p-4", children: /* @__PURE__ */ jsx7(
1377
+ "img",
1378
+ {
1379
+ src: `https://registry-api.tscircuit.com/packages/images/${detailsComponent.owner}/${detailsComponent.name}/schematic.png`,
1380
+ alt: `${detailsComponent.name} schematic preview`,
1381
+ className: "rf-max-w-full rf-max-h-full rf-object-contain rf-rounded",
1382
+ onError: (e) => {
1383
+ const target = e.target;
1384
+ target.style.display = "none";
1385
+ const parent = target.parentElement;
1386
+ if (parent) {
1387
+ parent.innerHTML = '<div class="rf-text-center rf-text-gray-500"><div class="rf-text-sm rf-font-medium">Schematic preview not available</div><div class="rf-text-xs rf-mt-1">Image failed to load</div></div>';
1388
+ }
1389
+ }
1349
1390
  }
1350
- }
1391
+ ) }) : /* @__PURE__ */ jsx7("div", { className: "rf-h-[400px] rf-flex rf-items-center rf-justify-center rf-text-gray-500", children: /* @__PURE__ */ jsxs4("div", { className: "rf-text-center", children: [
1392
+ /* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium", children: "No schematic preview available" }),
1393
+ /* @__PURE__ */ jsx7("div", { className: "rf-text-xs rf-mt-1", children: "Preview cannot be generated" })
1394
+ ] }) })
1351
1395
  }
1352
- ) }) : /* @__PURE__ */ jsx7("div", { className: "rf-h-[400px] rf-flex rf-items-center rf-justify-center rf-text-gray-500", children: /* @__PURE__ */ jsxs4("div", { className: "rf-text-center", children: [
1353
- /* @__PURE__ */ jsx7("div", { className: "rf-text-sm rf-font-medium", children: "No schematic preview available" }),
1354
- /* @__PURE__ */ jsx7("div", { className: "rf-text-xs rf-mt-1", children: "Preview cannot be generated" })
1355
- ] }) })
1396
+ )
1397
+ ] })
1398
+ ]
1399
+ }
1400
+ )
1401
+ ] }),
1402
+ packageDetails?.ai_description && /* @__PURE__ */ jsxs4("div", { children: [
1403
+ /* @__PURE__ */ jsx7("h3", { className: "rf-text-lg rf-font-semibold rf-mb-3", children: "AI Description" }),
1404
+ /* @__PURE__ */ jsx7("div", { className: "rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4", children: /* @__PURE__ */ jsx7("p", { className: "rf-text-sm rf-text-gray-700 rf-leading-relaxed", children: packageDetails.ai_description }) })
1405
+ ] }),
1406
+ packageDetails?.ai_usage_instructions && /* @__PURE__ */ jsxs4("div", { children: [
1407
+ /* @__PURE__ */ jsx7("h3", { className: "rf-text-lg rf-font-semibold rf-mb-3", children: "Usage Instructions" }),
1408
+ /* @__PURE__ */ jsx7("div", { className: "rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4", children: /* @__PURE__ */ jsx7("p", { className: "rf-text-sm rf-text-gray-700 rf-leading-relaxed rf-whitespace-pre-wrap", children: packageDetails.ai_usage_instructions }) })
1409
+ ] }),
1410
+ packageDetailsLoading && /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-justify-center rf-text-center rf-items-center rf-gap-2 rf-text-gray-500", children: [
1411
+ /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }),
1412
+ /* @__PURE__ */ jsx7("span", { className: "rf-text-sm", children: "Loading package details..." })
1413
+ ] })
1414
+ ] }),
1415
+ /* @__PURE__ */ jsxs4(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: [
1416
+ /* @__PURE__ */ jsx7("div", { className: "rf-flex-1 rf-order-3 sm:rf-order-1", children: /* @__PURE__ */ jsxs4(
1417
+ Button,
1418
+ {
1419
+ variant: "outline",
1420
+ size: "sm",
1421
+ className: "rf-gap-2 rf-w-full sm:rf-w-auto",
1422
+ onClick: () => {
1423
+ const url = `https://tscircuit.com/${detailsComponent?.owner}/${detailsComponent?.name.split("/").pop()}`;
1424
+ window.open(url, "_blank");
1425
+ },
1426
+ children: [
1427
+ /* @__PURE__ */ jsx7(ExternalLink, { className: "rf-h-4 rf-w-4" }),
1428
+ "View on tscircuit.com"
1429
+ ]
1430
+ }
1431
+ ) }),
1432
+ /* @__PURE__ */ jsxs4("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: [
1433
+ /* @__PURE__ */ jsx7(
1434
+ Button,
1435
+ {
1436
+ variant: "outline",
1437
+ onClick: () => setDetailsOpen(false),
1438
+ className: "rf-order-2 sm:rf-order-1",
1439
+ children: "Close"
1440
+ }
1441
+ ),
1442
+ /* @__PURE__ */ jsx7(
1443
+ Button,
1444
+ {
1445
+ onClick: () => {
1446
+ setDetailsOpen(false);
1447
+ if (detailsComponent) {
1448
+ onImport(detailsComponent);
1449
+ onClose();
1356
1450
  }
1357
- )
1358
- ] })
1359
- ]
1360
- }
1361
- )
1362
- ] }),
1363
- packageDetails?.ai_description && /* @__PURE__ */ jsxs4("div", { children: [
1364
- /* @__PURE__ */ jsx7("h3", { className: "rf-text-lg rf-font-semibold rf-mb-3", children: "AI Description" }),
1365
- /* @__PURE__ */ jsx7("div", { className: "rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4", children: /* @__PURE__ */ jsx7("p", { className: "rf-text-sm rf-text-gray-700 rf-leading-relaxed", children: packageDetails.ai_description }) })
1366
- ] }),
1367
- packageDetails?.ai_usage_instructions && /* @__PURE__ */ jsxs4("div", { children: [
1368
- /* @__PURE__ */ jsx7("h3", { className: "rf-text-lg rf-font-semibold rf-mb-3", children: "Usage Instructions" }),
1369
- /* @__PURE__ */ jsx7("div", { className: "rf-bg-gray-50 rf-border rf-border-gray-200 rf-rounded-lg rf-p-4", children: /* @__PURE__ */ jsx7("p", { className: "rf-text-sm rf-text-gray-700 rf-leading-relaxed rf-whitespace-pre-wrap", children: packageDetails.ai_usage_instructions }) })
1370
- ] }),
1371
- packageDetailsLoading && /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-justify-center rf-text-center rf-items-center rf-gap-2 rf-text-gray-500", children: [
1372
- /* @__PURE__ */ jsx7(Loader22, { className: "rf-h-4 rf-w-4 rf-animate-spin" }),
1373
- /* @__PURE__ */ jsx7("span", { className: "rf-text-sm", children: "Loading package details..." })
1374
- ] })
1375
- ] }),
1376
- /* @__PURE__ */ jsxs4(DialogFooter, { className: "rf-pt-4 rf-border-t rf-flex rf-justify-between rf-items-center", children: [
1377
- /* @__PURE__ */ jsx7("div", { className: "rf-flex-1", children: /* @__PURE__ */ jsxs4(
1378
- Button,
1379
- {
1380
- variant: "outline",
1381
- size: "sm",
1382
- className: "rf-gap-2",
1383
- onClick: () => {
1384
- const url = `https://tscircuit.com/${detailsComponent?.owner}/${detailsComponent?.name.split("/").pop()}`;
1385
- window.open(url, "_blank");
1386
- },
1387
- children: [
1388
- /* @__PURE__ */ jsx7(ExternalLink, { className: "rf-h-4 rf-w-4" }),
1389
- "View on tscircuit.com"
1390
- ]
1391
- }
1392
- ) }),
1393
- /* @__PURE__ */ jsxs4("div", { className: "rf-flex rf-gap-2", children: [
1394
- /* @__PURE__ */ jsx7(Button, { variant: "outline", onClick: () => setDetailsOpen(false), children: "Close" }),
1395
- /* @__PURE__ */ jsx7(
1396
- Button,
1397
- {
1398
- onClick: () => {
1399
- setDetailsOpen(false);
1400
- if (detailsComponent) {
1401
- onImport(detailsComponent);
1402
- onClose();
1451
+ },
1452
+ className: "rf-bg-blue-600 hover:rf-bg-blue-700 rf-order-1 sm:rf-order-2",
1453
+ children: "Import Component"
1403
1454
  }
1404
- },
1405
- className: "rf-bg-blue-600 hover:rf-bg-blue-700",
1406
- children: "Import Component"
1407
- }
1408
- )
1409
- ] })
1410
- ] })
1411
- ] }) })
1455
+ )
1456
+ ] })
1457
+ ] })
1458
+ ]
1459
+ }
1460
+ ) })
1412
1461
  ] });
1413
1462
  };
1414
1463
 
@@ -1508,7 +1557,7 @@ import { useState as useState8 } from "react";
1508
1557
 
1509
1558
  // lib/components/AiReviewDialog/ListAiReviewsView.tsx
1510
1559
  import { useEffect as useEffect8, useState as useState6 } from "react";
1511
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1560
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1512
1561
  var AiReviewListView = ({
1513
1562
  packageName,
1514
1563
  onSelectReview
@@ -1554,7 +1603,7 @@ var AiReviewListView = ({
1554
1603
  setCreating(false);
1555
1604
  }
1556
1605
  };
1557
- return /* @__PURE__ */ jsxs5(Fragment2, { children: [
1606
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
1558
1607
  /* @__PURE__ */ jsxs5(DialogHeader, { children: [
1559
1608
  /* @__PURE__ */ jsx8(DialogTitle, { children: "AI Review" }),
1560
1609
  /* @__PURE__ */ jsx8(DialogDescription, { children: "Select an AI review or request a new one." })
@@ -1575,7 +1624,7 @@ var AiReviewListView = ({
1575
1624
  // lib/components/AiReviewDialog/ViewAiReviewView.tsx
1576
1625
  import { useEffect as useEffect9, useMemo as useMemo2, useState as useState7 } from "react";
1577
1626
  import { marked } from "marked";
1578
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1627
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1579
1628
  var AiReviewViewView = ({
1580
1629
  review,
1581
1630
  onBack
@@ -1613,7 +1662,7 @@ var AiReviewViewView = ({
1613
1662
  () => marked.parse(review.ai_review_text || ""),
1614
1663
  [review.ai_review_text]
1615
1664
  );
1616
- return /* @__PURE__ */ jsxs6(Fragment3, { children: [
1665
+ return /* @__PURE__ */ jsxs6(Fragment4, { children: [
1617
1666
  /* @__PURE__ */ jsxs6(DialogHeader, { className: "rf-flex rf-flex-row rf-items-center rf-justify-between", children: [
1618
1667
  /* @__PURE__ */ jsx9(Button, { variant: "ghost", size: "sm", onClick: onBack, children: "Back" }),
1619
1668
  /* @__PURE__ */ jsx9(DialogTitle, { children: "AI Review" })
@@ -1748,7 +1797,7 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber) => {
1748
1797
  };
1749
1798
 
1750
1799
  // lib/components/RunFrameForCli/LeftHeader.tsx
1751
- import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1800
+ import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1752
1801
  var RunframeCliLeftHeader = (props) => {
1753
1802
  const lastRunEvalVersion = useRunnerStore((s) => s.lastRunEvalVersion);
1754
1803
  const [snippetName, setSnippetName] = useState9(null);
@@ -1840,7 +1889,7 @@ var RunframeCliLeftHeader = (props) => {
1840
1889
  const circuitJson = useRunFrameStore((state) => state.circuitJson);
1841
1890
  const [isImportDialogOpen, setIsImportDialogOpen] = useState9(false);
1842
1891
  const [isAiReviewDialogOpen, setIsAiReviewDialogOpen] = useState9(false);
1843
- return /* @__PURE__ */ jsxs8(Fragment4, { children: [
1892
+ return /* @__PURE__ */ jsxs8(Fragment5, { children: [
1844
1893
  /* @__PURE__ */ jsxs8(DropdownMenu, { children: [
1845
1894
  /* @__PURE__ */ jsx11(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx11("div", { className: "rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative", children: "File" }) }),
1846
1895
  /* @__PURE__ */ jsxs8(DropdownMenuContent, { children: [