@tscircuit/runframe 0.0.340 → 0.0.342

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.
@@ -988,7 +988,7 @@ var RenderLogViewer = ({
988
988
  };
989
989
 
990
990
  // package.json
991
- var version = "0.0.339";
991
+ var version = "0.0.341";
992
992
 
993
993
  // lib/components/CircuitJsonPreview/CircuitJsonPreview.tsx
994
994
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
package/dist/preview.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  PcbViewerWithContainerHeight,
7
7
  SchematicViewer,
8
8
  linkify
9
- } from "./chunk-GOL53HNF.js";
9
+ } from "./chunk-IK6C5EEI.js";
10
10
  export {
11
11
  BomTable,
12
12
  CadViewer,
package/dist/runner.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  buttonVariants,
21
21
  cn,
22
22
  linkify
23
- } from "./chunk-GOL53HNF.js";
23
+ } from "./chunk-IK6C5EEI.js";
24
24
 
25
25
  // lib/components/RunFrame/RunFrame.tsx
26
26
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -628,8 +628,33 @@ var useEditEventController = () => {
628
628
  };
629
629
  };
630
630
 
631
- // lib/components/RunFrameWithApi/RunFrameWithApi.tsx
631
+ // lib/hooks/use-sync-page-title.ts
632
632
  import { useEffect as useEffect3 } from "react";
633
+ var useSyncPageTitle = () => {
634
+ const fsMap = useRunFrameStore((s) => s.fsMap);
635
+ useEffect3(() => {
636
+ if (!document || !fsMap) return;
637
+ const fileKeys = Array.from(fsMap.keys());
638
+ const entrypoint = guessEntrypoint(fileKeys);
639
+ const packageJsonContent = fsMap.get("package.json");
640
+ try {
641
+ if (packageJsonContent) {
642
+ const parsedPackageJson = JSON.parse(packageJsonContent);
643
+ if (parsedPackageJson?.name) {
644
+ document.title = parsedPackageJson.name;
645
+ return;
646
+ }
647
+ }
648
+ } catch (e) {
649
+ }
650
+ if (entrypoint) {
651
+ document.title = entrypoint;
652
+ }
653
+ }, [fsMap]);
654
+ };
655
+
656
+ // lib/components/RunFrameWithApi/RunFrameWithApi.tsx
657
+ import { useEffect as useEffect4 } from "react";
633
658
  import { applyEditEventsToManualEditsFile as applyEditEventsToManualEditsFile2 } from "@tscircuit/core";
634
659
  import { jsx as jsx2 } from "react/jsx-runtime";
635
660
  var debug5 = Debug3("run-frame:RunFrameWithApi");
@@ -637,7 +662,7 @@ var guessEntrypoint = (files) => files.find((file) => file.includes("entrypoint.
637
662
  var guessManualEditsFilePath = (files) => files.find((file) => file.includes("manual-edits.")) ?? files.find((file) => file.includes("manual-edit.")) ?? files.find((file) => file.endsWith(".json"));
638
663
  var RunFrameWithApi = (props) => {
639
664
  const { apiBaseUrl, leftHeaderContent } = props;
640
- useEffect3(() => {
665
+ useEffect4(() => {
641
666
  if (props.debug) Debug3.enable("run-frame*");
642
667
  }, [props.debug]);
643
668
  const { startPolling, stopPolling, loadInitialFiles } = useRunFrameStore(
@@ -649,21 +674,22 @@ var RunFrameWithApi = (props) => {
649
674
  );
650
675
  const fsMap = useRunFrameStore((s) => s.fsMap);
651
676
  const circuitJson = useRunFrameStore((s) => s.circuitJson);
652
- useEffect3(() => {
677
+ useEffect4(() => {
653
678
  loadInitialFiles();
654
679
  }, []);
680
+ useSyncPageTitle();
655
681
  const {
656
682
  editEventsForRender,
657
683
  pushEditEvent,
658
684
  markRenderStarted,
659
685
  markRenderComplete
660
686
  } = useEditEventController();
661
- useEffect3(() => {
687
+ useEffect4(() => {
662
688
  if (apiBaseUrl) {
663
689
  window.API_BASE_URL = apiBaseUrl;
664
690
  }
665
691
  }, [apiBaseUrl]);
666
- useEffect3(() => {
692
+ useEffect4(() => {
667
693
  startPolling();
668
694
  return () => stopPolling();
669
695
  }, [startPolling, stopPolling]);
@@ -720,7 +746,7 @@ var RunFrameWithApi = (props) => {
720
746
  };
721
747
 
722
748
  // lib/hooks/use-local-storage-state.ts
723
- import { useState as useState3, useEffect as useEffect4 } from "react";
749
+ import { useState as useState3, useEffect as useEffect5 } from "react";
724
750
  function useLocalStorageState(key, initialValue) {
725
751
  const [state, setState] = useState3(() => {
726
752
  try {
@@ -731,7 +757,7 @@ function useLocalStorageState(key, initialValue) {
731
757
  return initialValue;
732
758
  }
733
759
  });
734
- useEffect4(() => {
760
+ useEffect5(() => {
735
761
  try {
736
762
  window.localStorage.setItem(key, JSON.stringify(state));
737
763
  } catch (error) {
@@ -742,7 +768,7 @@ function useLocalStorageState(key, initialValue) {
742
768
  }
743
769
 
744
770
  // lib/components/RunFrameForCli/LeftHeader.tsx
745
- import { useEffect as useEffect8, useMemo as useMemo2, useState as useState10 } from "react";
771
+ import { useEffect as useEffect9, useMemo as useMemo2, useState as useState10 } from "react";
746
772
 
747
773
  // lib/components/RunFrameForCli/SelectSnippetDialog.tsx
748
774
  import { useState as useState4 } from "react";
@@ -832,11 +858,11 @@ var SelectSnippetDialog = ({
832
858
  };
833
859
 
834
860
  // lib/components/RunFrameForCli/useEventHandler.ts
835
- import { useEffect as useEffect5, useRef as useRef3 } from "react";
861
+ import { useEffect as useEffect6, useRef as useRef3 } from "react";
836
862
  var useEventHandler = (callback) => {
837
863
  const lastProcessedEventId = useRef3(null);
838
864
  const recentEvents = useRunFrameStore((state) => state.recentEvents);
839
- useEffect5(() => {
865
+ useEffect6(() => {
840
866
  if (recentEvents.length === 0) return;
841
867
  const latestEvent = recentEvents[0];
842
868
  if (latestEvent.event_id !== lastProcessedEventId.current) {
@@ -983,7 +1009,7 @@ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
983
1009
 
984
1010
  // lib/components/ImportComponentDialog/ImportComponentDialog.tsx
985
1011
  import "react";
986
- import { useState as useState5, useEffect as useEffect6 } from "react";
1012
+ import { useState as useState5, useEffect as useEffect7 } from "react";
987
1013
  import { Loader2 as Loader22, Search, ExternalLink } from "lucide-react";
988
1014
 
989
1015
  // lib/components/ui/input.tsx
@@ -1127,7 +1153,7 @@ var ImportComponentDialog = ({
1127
1153
  handleSearch();
1128
1154
  }
1129
1155
  };
1130
- useEffect6(() => {
1156
+ useEffect7(() => {
1131
1157
  setSearchResults([]);
1132
1158
  setSelectedComponent(null);
1133
1159
  }, [activeTab]);
@@ -1823,7 +1849,7 @@ function Skeleton({
1823
1849
 
1824
1850
  // lib/components/OrderDialog/InitialOrder.tsx
1825
1851
  import { ArrowDown } from "lucide-react";
1826
- import { useEffect as useEffect7 } from "react";
1852
+ import { useEffect as useEffect8 } from "react";
1827
1853
  import { useState as useState7 } from "react";
1828
1854
  import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1829
1855
  var InitialOrderScreen = ({
@@ -1837,7 +1863,7 @@ var InitialOrderScreen = ({
1837
1863
  const [isLoading, setIsLoading] = useState7(false);
1838
1864
  const [estimatedCost, setEstimatedCost] = useState7(null);
1839
1865
  const [selectedCategory, setSelectedCategory] = useState7("prototype");
1840
- useEffect7(() => {
1866
+ useEffect8(() => {
1841
1867
  handleGetEstimate();
1842
1868
  }, []);
1843
1869
  const handleSelectCategory = (category) => {
@@ -2262,7 +2288,7 @@ var RunframeCliLeftHeader = (props) => {
2262
2288
  setisExporting(false);
2263
2289
  }
2264
2290
  });
2265
- useEffect8(() => {
2291
+ useEffect9(() => {
2266
2292
  if (!isSaving || requestToSaveSentAt === null) return;
2267
2293
  const eventsSinceRequestToSave = recentEvents.filter(
2268
2294
  (event) => new Date(event.created_at).valueOf() > requestToSaveSentAt