@tscircuit/runframe 0.0.371 → 0.0.373

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.
@@ -440,42 +440,36 @@ ${errorMessage.slice(0, 2e3)}
440
440
  import { SchematicViewer } from "@tscircuit/schematic-viewer";
441
441
  import { AssemblyViewer } from "@tscircuit/assembly-viewer";
442
442
 
443
- // lib/utils/getRandomTipForUser .ts
443
+ // lib/utils/getRandomTipForUser.ts
444
444
  var tips = [
445
- "Always initialize your project using ['tsci init'](https://github.com/tscircuit/cli) before adding components.",
446
- "Use the visual editor for real-time PCB layout and placement feedback.",
447
- "Leverage automatic routing for faster PCB trace connections.",
448
- "Define reusable subcircuits for common electronic patterns.",
449
- "Utilize board constraints to stay within manufacturing parameters.",
450
- "Run 'tsci dev' to preview your boards before export.",
445
+ "Always initialize your project using [tsci init](https://github.com/tscircuit/cli) before adding components.",
446
+ "Define reusable modules with cached routes using [<subcircuit />](https://docs.tscircuit.com/elements/subcircuit)",
447
+ "Run `tsci dev` on the command line to preview your boards before export",
451
448
  "Use units like mm or mils consistently across your designs.",
452
- "Reference the 'element' docs for correct pin and footprint placement.",
453
- "Consult 'ordering-prototypes' for recommended PCB fab workflows.",
454
- "Use 'net' and 'group' constructs to organize complex schematics.",
455
- "Review 'manual-edits' for advanced board customization.",
456
- "Serialize your circuits to JSON for interoperability and versioning.",
457
- "Import components from external libraries with 'importing-modules-and-chips'.",
458
- "Leverage the image generation API to render board previews.",
459
- "Use 'essential-elements' to quickly scaffold new circuits.",
460
- "Check 'platform-configuration' for custom toolchain commands.",
461
- "Optimize layouts using the 'automatic-layout' guide.",
462
- "Stick to known footprints for easier assembly and rework.",
463
- "Configure chips using pin selectors for precise control.",
464
- "Publish modules via the registry for team-wide access.",
465
- "Explore tutorials for real-world circuit design examples.",
466
- "Upload your Circuit JSON to circuitjson.com for a quick preview.",
467
- "Use the <CircuitJsonPreview /> component to display all available previews for a Circuit JSON array.",
468
- "Use a <group /> element to move multiple components at once in a schematic or PCB layout.",
469
- "Refer to the GitHub Discussions page to request more platform features tailored to your needs.",
470
- "Use the grid function from math-utils to create a grid of components for LED matrix layouts.",
471
- "Use the RootCircuit platform configuration to customize registry and autorouter behavior.",
472
- "Use the <constraint /> element to enforce geometric relationships in PCB designs.",
473
- "Follow the recommended contribution order to understand the tscircuit ecosystem better.",
474
- "Join the Discord server to discuss issues and get help directly from the community.",
475
- "Reach out to enterprise support for running the tscircuit platform privately within your organization."
449
+ "Quickly set footprints with the [footprint prop](https://docs.tscircuit.com/footprints/footprinter-strings)",
450
+ "Check out the guide on [ordering prototypes](https://docs.tscircuit.com/building-electronics/ordering-prototypes)",
451
+ "Use [net labels](https://docs.tscircuit.com/elements/net) and [group elements](https://docs.tscircuit.com/elements/group) to organize complex schematics.",
452
+ "You can manually drag components on the PCB and Schematic using [manual edits](https://docs.tscircuit.com/guides/manual-edits)",
453
+ "Every tscircuit module can export to [Circuit JSON](https://github.com/tscircuit/circuit-json), Gerbers, Pick'n'Place CSV files, Bill of Materials CSV and more",
454
+ "You can import components from [JLCPCB](https://docs.tscircuit.com/guides/importing-modules-and-chips/importing-from-jlcpcb) or [KiCad](https://docs.tscircuit.com/guides/importing-modules-and-chips/importing-from-kicad)",
455
+ "Any module you push to the [registry](https://tscircuit.com/trending) will have [simple image urls](https://docs.tscircuit.com/web-apis/image-generation-api) you can use display images on a website",
456
+ "The default [Parts Engine](https://docs.tscircuit.com/guides/platform-configuration) will automatically find parts from common vendors for your BOM",
457
+ '[Pin selectors](https://docs.tscircuit.com/guides/using-sel-references) are similar to CSS selectors, ".R1 > .pin1" means "connect to the first pin of the component R1"',
458
+ "You can use the [sel](https://docs.tscircuit.com/guides/using-sel-references) object to select pins in a type-safe way",
459
+ "Publish modules via the [registry](https://tscircuit.com/trending) for working with a team or sharing your work",
460
+ "[Explore tutorials](https://docs.tscircuit.com/category/tutorials) for real-world circuit design examples.",
461
+ "Upload your Circuit JSON to [circuitjson.com](https://circuitjson.com) for a quick preview.",
462
+ "You can display Circuit JSON in 3D, PCB or Schematic mode with the [<CircuitJsonPreview />](https://docs.tscircuit.com/elements/circuitjsonpreview) React component",
463
+ "Use a [<group />](https://docs.tscircuit.com/elements/group) element to move multiple components at once in a schematic or PCB layout.",
464
+ "Refer to the [GitHub Discussions page](https://github.com/tscircuit/tscircuit/discussions) to request features",
465
+ "You can customize the autorouter using the [autorouter prop](https://docs.tscircuit.com/elements/board#setting-the-autorouter)",
466
+ "Use the [<constraint />](https://docs.tscircuit.com/footprints/constraint) element to enforce geometric relationships in PCB designs.",
467
+ "Join the [Discord server](https://tscircuit.com/join) to discuss issues and get help directly from the community."
476
468
  ];
477
469
  var getRandomTipForUser = () => {
478
470
  let tip = tips[Math.floor(Math.random() * tips.length)];
471
+ tip = tip.replace(/</g, "&lt;");
472
+ tip = tip.replace(/>/g, "&gt;");
479
473
  tip = tip.replace(
480
474
  /(?<!href=")(?<!\()(?<!\]\()(https?:\/\/[^\s\)\]]+)/g,
481
475
  (match, p1) => `<a class="rf-text-blue-500 rf-underline" href="${match}" target="_blank">${match}</a>`
@@ -489,25 +483,29 @@ var getRandomTipForUser = () => {
489
483
 
490
484
  // lib/components/PreviewEmptyState.tsx
491
485
  import { LightbulbIcon, PlayIcon } from "lucide-react";
486
+ import { useMemo } from "react";
492
487
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
493
- var PreviewEmptyState = ({ onRunClicked }) => /* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-flex-col rf-items-center rf-justify-center rf-h-full rf-bg-gray-50 rf-text-gray-500 rf-p-4", children: [
494
- /* @__PURE__ */ jsx7(LightbulbIcon, { className: "rf-size-14 rf-mb-4" }),
495
- /* @__PURE__ */ jsxs5("p", { className: "rf-text-md rf-break-words rf-max-w-xl rf-text-center", children: [
496
- "Tip: ",
497
- /* @__PURE__ */ jsx7("span", { dangerouslySetInnerHTML: { __html: getRandomTipForUser() } })
498
- ] }),
499
- onRunClicked && /* @__PURE__ */ jsxs5(
500
- Button,
501
- {
502
- className: "rf-mt-4 rf-bg-blue-600 rf-hover:bg-blue-500",
503
- onClick: onRunClicked,
504
- children: [
505
- "Run Code",
506
- /* @__PURE__ */ jsx7(PlayIcon, { className: "rf-w-3 rf-h-3 rf-ml-2" })
507
- ]
508
- }
509
- )
510
- ] });
488
+ var PreviewEmptyState = ({ onRunClicked }) => {
489
+ const tipHtml = useMemo(() => getRandomTipForUser(), []);
490
+ return /* @__PURE__ */ jsxs5("div", { className: "rf-flex rf-flex-col rf-items-center rf-justify-center rf-h-full rf-bg-gray-50 rf-text-gray-500 rf-p-4", children: [
491
+ /* @__PURE__ */ jsx7(LightbulbIcon, { className: "rf-size-14 rf-mb-4" }),
492
+ /* @__PURE__ */ jsxs5("p", { className: "rf-text-md rf-break-words rf-max-w-xl rf-text-center", children: [
493
+ "Tip: ",
494
+ /* @__PURE__ */ jsx7("span", { dangerouslySetInnerHTML: { __html: tipHtml } })
495
+ ] }),
496
+ onRunClicked && /* @__PURE__ */ jsxs5(
497
+ Button,
498
+ {
499
+ className: "rf-mt-4 rf-bg-blue-600 rf-hover:bg-blue-500",
500
+ onClick: onRunClicked,
501
+ children: [
502
+ "Run Code",
503
+ /* @__PURE__ */ jsx7(PlayIcon, { className: "rf-w-3 rf-h-3 rf-ml-2" })
504
+ ]
505
+ }
506
+ )
507
+ ] });
508
+ };
511
509
  var PreviewEmptyState_default = PreviewEmptyState;
512
510
 
513
511
  // lib/components/CircuitJsonTableViewer/CircuitJsonTableViewer.tsx
@@ -1039,7 +1037,7 @@ var RenderLogViewer = ({
1039
1037
  };
1040
1038
 
1041
1039
  // package.json
1042
- var version = "0.0.370";
1040
+ var version = "0.0.372";
1043
1041
 
1044
1042
  // lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
1045
1043
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
@@ -1563,14 +1561,14 @@ var useRunFrameStore = create()(
1563
1561
  )
1564
1562
  );
1565
1563
 
1566
- // lib/components/ui/alert-dialog.tsx
1564
+ // lib/components/ui/dialog.tsx
1567
1565
  import * as React6 from "react";
1568
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
1566
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
1569
1567
  import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1570
- var AlertDialog = AlertDialogPrimitive.Root;
1571
- var AlertDialogPortal = AlertDialogPrimitive.Portal;
1572
- var AlertDialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1573
- AlertDialogPrimitive.Overlay,
1568
+ var Dialog = DialogPrimitive.Root;
1569
+ var DialogPortal = DialogPrimitive.Portal;
1570
+ var DialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1571
+ DialogPrimitive.Overlay,
1574
1572
  {
1575
1573
  className: cn(
1576
1574
  "rf-fixed rf-inset-0 rf-z-50 rf-bg-black/80 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0",
@@ -1580,23 +1578,24 @@ var AlertDialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /*
1580
1578
  ref
1581
1579
  }
1582
1580
  ));
1583
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
1584
- var AlertDialogContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs13(AlertDialogPortal, { children: [
1585
- /* @__PURE__ */ jsx17(AlertDialogOverlay, {}),
1581
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1582
+ var DialogContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs13(DialogPortal, { children: [
1583
+ /* @__PURE__ */ jsx17(DialogOverlay, {}),
1586
1584
  /* @__PURE__ */ jsx17(
1587
- AlertDialogPrimitive.Content,
1585
+ DialogPrimitive.Content,
1588
1586
  {
1589
1587
  ref,
1590
1588
  className: cn(
1591
1589
  "rf-fixed rf-left-[50%] rf-top-[50%] rf-z-50 rf-grid rf-w-full rf-max-w-lg rf-translate-x-[-50%] rf-translate-y-[-50%] rf-gap-4 rf-border rf-border-zinc-200 rf-bg-white rf-p-6 rf-shadow-lg rf-duration-200 data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[state=closed]:rf-slide-out-to-left-1/2 data-[state=closed]:rf-slide-out-to-top-[48%] data-[state=open]:rf-slide-in-from-left-1/2 data-[state=open]:rf-slide-in-from-top-[48%] sm:rf-rounded-lg dark:rf-border-zinc-800 dark:rf-bg-zinc-950",
1592
1590
  className
1593
1591
  ),
1594
- ...props
1592
+ ...props,
1593
+ children
1595
1594
  }
1596
1595
  )
1597
1596
  ] }));
1598
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
1599
- var AlertDialogHeader = ({
1597
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
1598
+ var DialogHeader = ({
1600
1599
  className,
1601
1600
  ...props
1602
1601
  }) => /* @__PURE__ */ jsx17(
@@ -1609,8 +1608,8 @@ var AlertDialogHeader = ({
1609
1608
  ...props
1610
1609
  }
1611
1610
  );
1612
- AlertDialogHeader.displayName = "AlertDialogHeader";
1613
- var AlertDialogFooter = ({
1611
+ DialogHeader.displayName = "DialogHeader";
1612
+ var DialogFooter = ({
1614
1613
  className,
1615
1614
  ...props
1616
1615
  }) => /* @__PURE__ */ jsx17(
@@ -1623,18 +1622,18 @@ var AlertDialogFooter = ({
1623
1622
  ...props
1624
1623
  }
1625
1624
  );
1626
- AlertDialogFooter.displayName = "AlertDialogFooter";
1627
- var AlertDialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1628
- AlertDialogPrimitive.Title,
1625
+ DialogFooter.displayName = "DialogFooter";
1626
+ var DialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1627
+ DialogPrimitive.Title,
1629
1628
  {
1630
1629
  ref,
1631
1630
  className: cn("rf-text-lg rf-font-semibold", className),
1632
1631
  ...props
1633
1632
  }
1634
1633
  ));
1635
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
1636
- var AlertDialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1637
- AlertDialogPrimitive.Description,
1634
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
1635
+ var DialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1636
+ DialogPrimitive.Description,
1638
1637
  {
1639
1638
  ref,
1640
1639
  className: cn(
@@ -1644,29 +1643,7 @@ var AlertDialogDescription = React6.forwardRef(({ className, ...props }, ref) =>
1644
1643
  ...props
1645
1644
  }
1646
1645
  ));
1647
- AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
1648
- var AlertDialogAction = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1649
- AlertDialogPrimitive.Action,
1650
- {
1651
- ref,
1652
- className: cn(buttonVariants(), className),
1653
- ...props
1654
- }
1655
- ));
1656
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
1657
- var AlertDialogCancel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx17(
1658
- AlertDialogPrimitive.Cancel,
1659
- {
1660
- ref,
1661
- className: cn(
1662
- buttonVariants({ variant: "outline" }),
1663
- "rf-mt-2 sm:rf-mt-0",
1664
- className
1665
- ),
1666
- ...props
1667
- }
1668
- ));
1669
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
1646
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
1670
1647
 
1671
1648
  // lib/components/OrderDialog/OrderDialog.tsx
1672
1649
  import { QueryClient, QueryClientProvider } from "react-query";
@@ -1929,13 +1906,22 @@ var OrderDialog = ({
1929
1906
  circuitJson,
1930
1907
  packageReleaseId
1931
1908
  }) => {
1932
- return /* @__PURE__ */ jsx20(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx20(AlertDialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx20(AlertDialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */ jsx20("div", { className: "rf-relative rf-w-full", children: stage === "initial" && /* @__PURE__ */ jsx20(
1933
- InitialOrderScreen,
1909
+ return /* @__PURE__ */ jsx20(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx20(
1910
+ Dialog,
1934
1911
  {
1935
- onCancel: onClose,
1936
- packageReleaseId: packageReleaseId ?? ""
1912
+ open: isOpen,
1913
+ onOpenChange: (open) => {
1914
+ if (!open) onClose();
1915
+ },
1916
+ children: /* @__PURE__ */ jsx20(DialogContent, { className: "!rf-max-w-[660px] !rf-p-0", children: /* @__PURE__ */ jsx20("div", { className: "rf-relative rf-w-full", children: stage === "initial" && /* @__PURE__ */ jsx20(
1917
+ InitialOrderScreen,
1918
+ {
1919
+ onCancel: onClose,
1920
+ packageReleaseId: packageReleaseId ?? ""
1921
+ }
1922
+ ) }) })
1937
1923
  }
1938
- ) }) }) }) });
1924
+ ) });
1939
1925
  };
1940
1926
 
1941
1927
  // lib/components/OrderDialog/CliOrderDialog.tsx
@@ -2000,6 +1986,7 @@ export {
2000
1986
  Tabs,
2001
1987
  TabsList,
2002
1988
  TabsTrigger,
1989
+ buttonVariants,
2003
1990
  Button,
2004
1991
  DropdownMenu,
2005
1992
  DropdownMenuTrigger,
@@ -2016,13 +2003,6 @@ export {
2016
2003
  debug_default,
2017
2004
  API_BASE,
2018
2005
  useRunFrameStore,
2019
- AlertDialog,
2020
- AlertDialogContent,
2021
- AlertDialogHeader,
2022
- AlertDialogFooter,
2023
- AlertDialogTitle,
2024
- AlertDialogDescription,
2025
- AlertDialogCancel,
2026
2006
  toast,
2027
2007
  useOrderDialogCli,
2028
2008
  useOrderDialog,
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-43JV2KDS.js";
11
+ } from "./chunk-SYVWM5DF.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,