@tscircuit/runframe 0.0.660 → 0.0.662

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.
@@ -1261,7 +1261,7 @@ var useErrorTelemetry = ({
1261
1261
  };
1262
1262
 
1263
1263
  // package.json
1264
- var version = "0.0.659";
1264
+ var version = "0.0.661";
1265
1265
 
1266
1266
  // lib/components/RunFrame/runner-store/use-runner-store.ts
1267
1267
  import { create } from "zustand";
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-QFVNPPR6.js";
11
+ } from "./chunk-WXON76RU.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.d.ts CHANGED
@@ -122,4 +122,90 @@ declare const RunFrameForCli: (props: {
122
122
  scenarioSelectorContent?: React.ReactNode;
123
123
  }) => react_jsx_runtime.JSX.Element;
124
124
 
125
- export { RunFrame, RunFrameForCli, type RunFrameProps, RunFrameWithApi, type RunFrameWithApiProps, TabId, guessEntrypoint, guessManualEditsFilePath };
125
+ interface ComponentSearchResult {
126
+ id: string;
127
+ name: string;
128
+ description?: string;
129
+ source: "tscircuit.com" | "jlcpcb";
130
+ partNumber?: string;
131
+ package?: string;
132
+ price?: number;
133
+ code?: string;
134
+ owner?: string;
135
+ }
136
+ interface ImportComponentDialogProps {
137
+ isOpen: boolean;
138
+ onClose: () => void;
139
+ onImport: (component: ComponentSearchResult) => void;
140
+ }
141
+ declare const ImportComponentDialog: ({ isOpen, onClose, onImport, }: ImportComponentDialogProps) => react_jsx_runtime.JSX.Element;
142
+
143
+ /**
144
+ * JLC API service for fetching component data from the JLC search API
145
+ */
146
+ interface JLCComponent {
147
+ description: string;
148
+ lcsc: number;
149
+ mfr: string;
150
+ package: string;
151
+ price: number;
152
+ }
153
+ /**
154
+ * Search for components in the JLC database
155
+ * @param query Search query string
156
+ * @param limit Maximum number of results to return (default: 10)
157
+ * @returns Promise with search results
158
+ */
159
+ declare const searchJLCComponents: (query: string, limit?: number) => Promise<JLCComponent[]>;
160
+ /**
161
+ * Map JLC component data to the ComponentSearchResult format used in the ImportComponentDialog
162
+ * @param jlcComponent JLC component data
163
+ * @returns Formatted component data for the UI
164
+ */
165
+ declare const mapJLCComponentToSearchResult: (jlcComponent: JLCComponent) => {
166
+ id: string;
167
+ name: string;
168
+ description: string;
169
+ source: "jlcpcb";
170
+ partNumber: string;
171
+ package: string;
172
+ price: number;
173
+ };
174
+
175
+ /**
176
+ * tscircuit Registry API service for fetching component data from the tscircuit registry API
177
+ */
178
+ interface TscircuitSnippet {
179
+ snippet_id: string;
180
+ package_release_id: string;
181
+ unscoped_name: string;
182
+ name: string;
183
+ owner_name: string;
184
+ code: string;
185
+ description?: string;
186
+ preview_url?: string;
187
+ }
188
+ /**
189
+ * Search for components in the tscircuit registry
190
+ * @param query Search query string
191
+ * @param limit Maximum number of results to return (default: 10)
192
+ * @returns Promise with search results
193
+ */
194
+ declare const searchTscircuitComponents: (query: string, limit?: number) => Promise<TscircuitSnippet[]>;
195
+ /**
196
+ * Map tscircuit component data to the ComponentSearchResult format used in the ImportComponentDialog
197
+ * @param tscircuitSnippet tscircuit component data
198
+ * @returns Formatted component data for the UI
199
+ */
200
+ declare const mapTscircuitSnippetToSearchResult: (tscircuitSnippet: TscircuitSnippet) => {
201
+ id: string;
202
+ name: string;
203
+ description: string;
204
+ source: "tscircuit.com";
205
+ partNumber: string;
206
+ previewUrl: string | undefined;
207
+ code: string;
208
+ owner: string;
209
+ };
210
+
211
+ export { type ComponentSearchResult, ImportComponentDialog, RunFrame, RunFrameForCli, type RunFrameProps, RunFrameWithApi, type RunFrameWithApiProps, TabId, guessEntrypoint, guessManualEditsFilePath, mapJLCComponentToSearchResult, mapTscircuitSnippetToSearchResult, searchJLCComponents, searchTscircuitComponents };
package/dist/runner.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  useOrderDialogCli,
38
38
  useRunFrameStore,
39
39
  useRunnerStore
40
- } from "./chunk-QFVNPPR6.js";
40
+ } from "./chunk-WXON76RU.js";
41
41
 
42
42
  // lib/components/RunFrame/RunFrame.tsx
43
43
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";
@@ -1115,9 +1115,6 @@ var ImportComponentDialog = ({
1115
1115
  if (!searchQuery.trim()) return;
1116
1116
  setIsLoading(true);
1117
1117
  const isJlcPartNumber = /^C\d+/.test(searchQuery);
1118
- if (isJlcPartNumber) {
1119
- setActiveTab("jlcpcb");
1120
- }
1121
1118
  try {
1122
1119
  if (activeTab === "jlcpcb") {
1123
1120
  const query = isJlcPartNumber ? searchQuery.substring(1) : searchQuery;
@@ -2080,6 +2077,7 @@ export {
2080
2077
  BomTable,
2081
2078
  CadViewer,
2082
2079
  CircuitJsonPreview,
2080
+ ImportComponentDialog,
2083
2081
  PCBViewer as PcbViewer,
2084
2082
  PcbViewerWithContainerHeight,
2085
2083
  RunFrame,
@@ -2089,6 +2087,10 @@ export {
2089
2087
  guessEntrypoint,
2090
2088
  guessManualEditsFilePath,
2091
2089
  linkify,
2090
+ mapJLCComponentToSearchResult,
2091
+ mapTscircuitSnippetToSearchResult,
2092
+ searchJLCComponents,
2093
+ searchTscircuitComponents,
2092
2094
  useOrderDialog,
2093
2095
  useOrderDialogCli
2094
2096
  };