@huaqiu/component-gen-app 0.3.6
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/LICENSE +21 -0
- package/dist/assets/index-DTShI_jq.js +553 -0
- package/dist/index.html +12 -0
- package/lib/index.d.ts +427 -0
- package/lib/index.js +2550 -0
- package/package.json +48 -0
- package/src/App.tsx +101 -0
- package/src/api/component-gen-client.ts +225 -0
- package/src/components/GeometryEditor.tsx +418 -0
- package/src/components/HistoryPanel.tsx +119 -0
- package/src/components/PreviewStage.tsx +67 -0
- package/src/components/ResultStage.tsx +92 -0
- package/src/components/UploadInput.tsx +121 -0
- package/src/copy/en.ts +150 -0
- package/src/copy/index.ts +50 -0
- package/src/copy/zh.ts +154 -0
- package/src/hooks/useAuthGate.ts +51 -0
- package/src/hooks/useJobRunner.ts +127 -0
- package/src/index.ts +37 -0
- package/src/main.tsx +85 -0
- package/src/pages/FootprintGenPage.tsx +185 -0
- package/src/pages/SymbolGenPage.tsx +136 -0
- package/src/ports.ts +149 -0
- package/src/styles/inject.ts +124 -0
- package/src/utils/dims.ts +266 -0
- package/src/utils/ecad.ts +91 -0
- package/src/utils/labels.ts +76 -0
package/dist/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>华秋 Component Gen</title>
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-DTShI_jq.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
//#region src/ports.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* `@huaqiu/component-gen-app` — the whole contract between the portable app
|
|
5
|
+
* and its host (DSH adapter or standalone server).
|
|
6
|
+
*
|
|
7
|
+
* The app has ZERO DSH imports. It only knows this ports interface. Two
|
|
8
|
+
* adapters implement it with the same HTTP client against different origins:
|
|
9
|
+
*
|
|
10
|
+
* - DSH adapter → `createDshPorts()` in `dsh-tool-symbol-footprint`, fetch
|
|
11
|
+
* to `/api/v1/huaqiu/component-gen/*` (plugin-owned webServer route).
|
|
12
|
+
* - Standalone → `createHttpPorts()` in `api/component-gen-client.ts`,
|
|
13
|
+
* fetch to `http://localhost:<port>/api/v1/huaqiu/component-gen/*`.
|
|
14
|
+
*/
|
|
15
|
+
type ComponentGenPage = 'symbol' | 'footprint';
|
|
16
|
+
type JobKind = 'symbol' | 'extract-footprint' | 'generate-footprint';
|
|
17
|
+
type JobStatus = 'queued' | 'running' | 'needs_confirmation' | 'completed' | 'failed' | 'cancelled';
|
|
18
|
+
interface JobInput {
|
|
19
|
+
/** data URL of the uploaded image (server stores a thumbnail into history). */
|
|
20
|
+
imageDataUrl?: string;
|
|
21
|
+
instruction?: string;
|
|
22
|
+
packageType?: string;
|
|
23
|
+
dimensions?: Record<string, number>;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
/** which dimensions the human edited (footprint confirmations). */
|
|
26
|
+
edited?: Record<string, boolean>;
|
|
27
|
+
}
|
|
28
|
+
interface JobState {
|
|
29
|
+
id: string;
|
|
30
|
+
kind: JobKind;
|
|
31
|
+
status: JobStatus;
|
|
32
|
+
progress?: string;
|
|
33
|
+
/** structured result of the generation function (status/kind/fileUrl/...). */
|
|
34
|
+
result?: Record<string, unknown>;
|
|
35
|
+
/** extracted dimensions for the `needs_confirmation` phase. */
|
|
36
|
+
dimensions?: Record<string, unknown>;
|
|
37
|
+
pkgType?: string | null;
|
|
38
|
+
fileName?: string | null;
|
|
39
|
+
error?: string;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
}
|
|
43
|
+
type JobEvent = {
|
|
44
|
+
type: 'progress';
|
|
45
|
+
message: string;
|
|
46
|
+
at: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'needs_confirmation';
|
|
49
|
+
dimensions: Record<string, unknown>;
|
|
50
|
+
pkgType?: string | null;
|
|
51
|
+
fileName?: string | null;
|
|
52
|
+
at: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'completed';
|
|
55
|
+
job: JobState;
|
|
56
|
+
at: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'failed';
|
|
59
|
+
error: string;
|
|
60
|
+
result?: Record<string, unknown>;
|
|
61
|
+
at: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'cancelled';
|
|
64
|
+
at: string;
|
|
65
|
+
};
|
|
66
|
+
interface StartJobRequest {
|
|
67
|
+
kind: JobKind;
|
|
68
|
+
input: JobInput;
|
|
69
|
+
}
|
|
70
|
+
interface HistoryQuery {
|
|
71
|
+
limit?: number;
|
|
72
|
+
cursor?: string | null;
|
|
73
|
+
}
|
|
74
|
+
interface HistoryPage {
|
|
75
|
+
entries: HistoryEntry[];
|
|
76
|
+
nextCursor?: string | null;
|
|
77
|
+
}
|
|
78
|
+
interface HistoryEntry {
|
|
79
|
+
id: string;
|
|
80
|
+
kind: 'symbol' | 'footprint';
|
|
81
|
+
createdAt: string;
|
|
82
|
+
status: 'generated' | 'failed' | 'cancelled';
|
|
83
|
+
input: {
|
|
84
|
+
imageId?: string;
|
|
85
|
+
instruction?: string;
|
|
86
|
+
packageType?: string;
|
|
87
|
+
dimensions?: Record<string, number>;
|
|
88
|
+
};
|
|
89
|
+
/** which dimensions the human edited (footprint confirmations). */
|
|
90
|
+
edited?: Record<string, boolean>;
|
|
91
|
+
result?: {
|
|
92
|
+
artifactId: string;
|
|
93
|
+
filename: string;
|
|
94
|
+
fileUrl?: string;
|
|
95
|
+
size?: number;
|
|
96
|
+
};
|
|
97
|
+
error?: string;
|
|
98
|
+
}
|
|
99
|
+
interface HistoryPatch {
|
|
100
|
+
status?: HistoryEntry['status'];
|
|
101
|
+
result?: HistoryEntry['result'];
|
|
102
|
+
error?: string;
|
|
103
|
+
edited?: Record<string, boolean>;
|
|
104
|
+
}
|
|
105
|
+
/** Request to reopen a generated history entry in the active generation page. */
|
|
106
|
+
interface ReopenRequest {
|
|
107
|
+
/** monotonically increasing so re-clicking the same entry re-applies. */
|
|
108
|
+
n: number;
|
|
109
|
+
entry: HistoryEntry;
|
|
110
|
+
}
|
|
111
|
+
interface ComponentGenConfig {
|
|
112
|
+
hostMode: boolean;
|
|
113
|
+
capabilities: {
|
|
114
|
+
symbol: boolean;
|
|
115
|
+
footprint: boolean;
|
|
116
|
+
};
|
|
117
|
+
limits: {
|
|
118
|
+
/** max accepted input image bytes. */
|
|
119
|
+
imageBytes: number;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** Auth capability consumed through the public `@huaqiu/dsh-auth` surface. */
|
|
123
|
+
interface ComponentGenAuthPort {
|
|
124
|
+
isAuthenticated(): Promise<boolean>;
|
|
125
|
+
getUserInfo(): Promise<{
|
|
126
|
+
nickname?: string;
|
|
127
|
+
} | null>;
|
|
128
|
+
/** Trigger the existing dsh-auth login flow (host-owned). */
|
|
129
|
+
login(): Promise<void>;
|
|
130
|
+
onAuthStateChanged(listener: (authenticated: boolean) => void): () => void;
|
|
131
|
+
}
|
|
132
|
+
/** The whole contract the app needs from its host. */
|
|
133
|
+
interface ComponentGenPorts {
|
|
134
|
+
config(): Promise<ComponentGenConfig>;
|
|
135
|
+
startJob(req: StartJobRequest, signal?: AbortSignal): Promise<JobState>;
|
|
136
|
+
jobEvents(jobId: string, onEvent: (e: JobEvent) => void): () => void;
|
|
137
|
+
abortJob(jobId: string): Promise<void>;
|
|
138
|
+
history(query: HistoryQuery): Promise<HistoryPage>;
|
|
139
|
+
historyEntry(id: string): Promise<HistoryEntry | null>;
|
|
140
|
+
patchHistory(id: string, patch: HistoryPatch): Promise<HistoryEntry>;
|
|
141
|
+
deleteHistory(id: string): Promise<void>;
|
|
142
|
+
/** raw artifact text for preview (from `@huaqiu/dsh-artifacts` routes). */
|
|
143
|
+
artifactContent(artifactId: string): Promise<string>;
|
|
144
|
+
/** data URL of a stored input thumbnail. */
|
|
145
|
+
inputImage(imageId: string): Promise<string>;
|
|
146
|
+
auth: ComponentGenAuthPort;
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/App.d.ts
|
|
150
|
+
interface ComponentGenAppProps {
|
|
151
|
+
ports: ComponentGenPorts;
|
|
152
|
+
page: ComponentGenPage;
|
|
153
|
+
/** host UI language: 'zh' | 'en' (default zh). */
|
|
154
|
+
lang?: string;
|
|
155
|
+
onClose?: () => void;
|
|
156
|
+
}
|
|
157
|
+
declare function ComponentGenApp(props: ComponentGenAppProps): ReactElement;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/copy/zh.d.ts
|
|
160
|
+
/**
|
|
161
|
+
* `@huaqiu/component-gen-app` — zh copy pack (fallback everywhere).
|
|
162
|
+
*
|
|
163
|
+
* House i18n convention (`dsh-pcb-eda`): `ZH as const` → `CopyKey` →
|
|
164
|
+
* `EN: Record<CopyKey, string>` so a missing EN key is a compile error.
|
|
165
|
+
* Punctuation is i18n too(中文全角:;).
|
|
166
|
+
*/
|
|
167
|
+
declare const ZH: {
|
|
168
|
+
readonly app: {
|
|
169
|
+
readonly title: "华秋元器件生成";
|
|
170
|
+
readonly symbolTitle: "符号生成";
|
|
171
|
+
readonly footprintTitle: "封装生成";
|
|
172
|
+
readonly footprintTooltip: "打开封装生成";
|
|
173
|
+
readonly symbolTooltip: "打开符号生成";
|
|
174
|
+
readonly close: "关闭";
|
|
175
|
+
readonly back: "返回";
|
|
176
|
+
readonly loading: "加载中…";
|
|
177
|
+
readonly error: "出错了";
|
|
178
|
+
readonly unknownError: "未知错误";
|
|
179
|
+
};
|
|
180
|
+
readonly upload: {
|
|
181
|
+
readonly drop: "拖拽图片到此处,或点击上传";
|
|
182
|
+
readonly paste: "也可直接 Ctrl/⌘+V 粘贴图片";
|
|
183
|
+
readonly browse: "选择图片";
|
|
184
|
+
readonly imageTooLarge: "图片过大,请使用 4MiB 以内的图片";
|
|
185
|
+
readonly noImage: "请先上传图片";
|
|
186
|
+
readonly replace: "更换图片";
|
|
187
|
+
readonly uploading: "上传中…";
|
|
188
|
+
readonly hint: "提示";
|
|
189
|
+
};
|
|
190
|
+
readonly symbol: {
|
|
191
|
+
readonly generate: "生成符号";
|
|
192
|
+
readonly regenerate: "重新生成";
|
|
193
|
+
readonly instructionPlaceholder: "可选:补充生成说明,如“3 引脚 LDO,引脚 1 为 VIN”";
|
|
194
|
+
readonly progress: "正在生成符号…";
|
|
195
|
+
readonly ready: "生成完成";
|
|
196
|
+
readonly failed: "生成失败";
|
|
197
|
+
readonly download: "下载 .kicad_sym";
|
|
198
|
+
readonly save: "保存到历史";
|
|
199
|
+
readonly saved: "已保存到历史";
|
|
200
|
+
};
|
|
201
|
+
readonly footprint: {
|
|
202
|
+
readonly extract: "提取尺寸";
|
|
203
|
+
readonly generate: "生成封装";
|
|
204
|
+
readonly regenerate: "重新生成";
|
|
205
|
+
readonly hintPlaceholder: "可选:封装类型提示,如 BGA / QFN / SOP";
|
|
206
|
+
readonly extractProgress: "正在提取封装尺寸…";
|
|
207
|
+
readonly generateProgress: "正在生成封装…";
|
|
208
|
+
readonly ready: "生成完成";
|
|
209
|
+
readonly failed: "生成失败";
|
|
210
|
+
readonly needsConfirmation: "请确认或修改提取到的封装尺寸";
|
|
211
|
+
readonly download: "下载 .kicad_mod";
|
|
212
|
+
readonly save: "保存到历史";
|
|
213
|
+
readonly saved: "已保存到历史";
|
|
214
|
+
readonly directGenerated: "已自动生成标准封装,可预览后下载";
|
|
215
|
+
readonly autoGenerated: "自动生成";
|
|
216
|
+
readonly confirm: "确认并生成";
|
|
217
|
+
readonly cancel: "取消";
|
|
218
|
+
};
|
|
219
|
+
readonly editor: {
|
|
220
|
+
readonly essential: "基本参数";
|
|
221
|
+
readonly advanced: "高级参数";
|
|
222
|
+
readonly width: "宽度";
|
|
223
|
+
readonly height: "长度";
|
|
224
|
+
readonly pinCount: "引脚数";
|
|
225
|
+
readonly pitch: "间距";
|
|
226
|
+
readonly packageType: "封装类型";
|
|
227
|
+
readonly fileName: "文件名";
|
|
228
|
+
readonly editedTag: "已修改";
|
|
229
|
+
readonly aiTag: "AI 提取";
|
|
230
|
+
readonly dragHint: "拖动控制柄调整 W / H";
|
|
231
|
+
readonly validationOutOfRange: "超出范围";
|
|
232
|
+
readonly validationMinGtMax: "最小值大于最大值";
|
|
233
|
+
readonly validationInvalid: "无效数值";
|
|
234
|
+
readonly unit: "mm";
|
|
235
|
+
readonly body: "本体";
|
|
236
|
+
readonly pins: "{count} 引脚";
|
|
237
|
+
readonly validationIssue: "{n} 处数值需要修正";
|
|
238
|
+
readonly validationOk: "数值有效";
|
|
239
|
+
readonly issueOutOfRange: "超出允许范围";
|
|
240
|
+
readonly issueMinGtMax: "最小值大于最大值";
|
|
241
|
+
readonly confirmLabel: "确认";
|
|
242
|
+
readonly cancelLabel: "取消";
|
|
243
|
+
};
|
|
244
|
+
readonly field: {
|
|
245
|
+
readonly width: "宽度";
|
|
246
|
+
readonly height: "长度";
|
|
247
|
+
readonly length: "长度";
|
|
248
|
+
readonly depth: "深度";
|
|
249
|
+
readonly span: "跨距";
|
|
250
|
+
readonly bodyWidth: "本体宽度";
|
|
251
|
+
readonly bodyLength: "本体长度";
|
|
252
|
+
readonly bodyHeight: "本体高度";
|
|
253
|
+
readonly boardWidth: "板宽";
|
|
254
|
+
readonly boardHeight: "板高";
|
|
255
|
+
readonly overallWidth: "总宽度";
|
|
256
|
+
readonly overallLength: "总长度";
|
|
257
|
+
readonly overallHeight: "总高度";
|
|
258
|
+
readonly pitch: "间距";
|
|
259
|
+
readonly pitchX: "X 间距";
|
|
260
|
+
readonly pitchY: "Y 间距";
|
|
261
|
+
readonly leadPitch: "引线间距";
|
|
262
|
+
readonly padWidth: "焊盘宽";
|
|
263
|
+
readonly padLength: "焊盘长";
|
|
264
|
+
readonly padHeight: "焊盘高";
|
|
265
|
+
readonly leadWidth: "引线宽";
|
|
266
|
+
readonly leadLength: "引线长";
|
|
267
|
+
readonly leadSpan: "引线跨距";
|
|
268
|
+
readonly pinCount: "引脚数";
|
|
269
|
+
readonly rows: "行数";
|
|
270
|
+
readonly columns: "列数";
|
|
271
|
+
readonly standoff: "离地高度";
|
|
272
|
+
readonly maxOf: "{field} 最大值";
|
|
273
|
+
readonly minOf: "{field} 最小值";
|
|
274
|
+
};
|
|
275
|
+
readonly history: {
|
|
276
|
+
readonly title: "历史记录";
|
|
277
|
+
readonly empty: "暂无历史";
|
|
278
|
+
readonly symbol: "符号";
|
|
279
|
+
readonly footprint: "封装";
|
|
280
|
+
readonly generated: "已生成";
|
|
281
|
+
readonly failed: "失败";
|
|
282
|
+
readonly cancelled: "已取消";
|
|
283
|
+
readonly rename: "重命名";
|
|
284
|
+
readonly delete: "删除";
|
|
285
|
+
readonly download: "下载";
|
|
286
|
+
readonly reopen: "打开";
|
|
287
|
+
readonly view: "查看历史";
|
|
288
|
+
readonly createdAt: "创建时间";
|
|
289
|
+
readonly loadMore: "加载更多";
|
|
290
|
+
readonly noMore: "没有更多了";
|
|
291
|
+
};
|
|
292
|
+
readonly auth: {
|
|
293
|
+
readonly notLoggedIn: "未登录华秋账号";
|
|
294
|
+
readonly login: "登录华秋 EDA";
|
|
295
|
+
readonly loginRequired: "该功能需要登录华秋 EDA 账号";
|
|
296
|
+
readonly loggedIn: "已登录";
|
|
297
|
+
};
|
|
298
|
+
readonly status: {
|
|
299
|
+
readonly queued: "排队中";
|
|
300
|
+
readonly running: "进行中";
|
|
301
|
+
readonly needsConfirmation: "待确认";
|
|
302
|
+
readonly completed: "已完成";
|
|
303
|
+
readonly failed: "失败";
|
|
304
|
+
readonly cancelled: "已取消";
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/copy/en.d.ts
|
|
309
|
+
type DeepStrings<T> = { [K in keyof T]: T[K] extends string ? string : DeepStrings<T[K]>; };
|
|
310
|
+
declare const EN: DeepStrings<typeof ZH>;
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/copy/index.d.ts
|
|
313
|
+
type Translate = (key: string, params?: Record<string, unknown>) => string;
|
|
314
|
+
declare function translate(lang: string | undefined, key: string, params?: Record<string, unknown>): string;
|
|
315
|
+
/** Build a `(key, params?) => string` resolver for a given language. */
|
|
316
|
+
declare function translateFor(lang: string | undefined): Translate;
|
|
317
|
+
/** zh-only fallback (used when no locale is supplied). */
|
|
318
|
+
declare const defaultT: Translate;
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/pages/SymbolGenPage.d.ts
|
|
321
|
+
interface SymbolGenPageProps {
|
|
322
|
+
ports: ComponentGenPorts;
|
|
323
|
+
t: Translate;
|
|
324
|
+
/** reopen a generated history entry into the completed stage. */
|
|
325
|
+
reopen?: ReopenRequest | null;
|
|
326
|
+
/** the app calls back to switch tabs (not used on the symbol page). */
|
|
327
|
+
onClose?: () => void;
|
|
328
|
+
}
|
|
329
|
+
declare function SymbolGenPage({ ports, t, reopen }: SymbolGenPageProps): ReactElement;
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/pages/FootprintGenPage.d.ts
|
|
332
|
+
interface FootprintGenPageProps {
|
|
333
|
+
ports: ComponentGenPorts;
|
|
334
|
+
t: Translate;
|
|
335
|
+
/** reopen a generated history entry into the completed stage. */
|
|
336
|
+
reopen?: ReopenRequest | null;
|
|
337
|
+
}
|
|
338
|
+
declare function FootprintGenPage({ ports, t, reopen }: FootprintGenPageProps): ReactElement;
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/utils/dims.d.ts
|
|
341
|
+
/** A dimension map with all scalar values coerced to numbers. */
|
|
342
|
+
type DimensionValues = Record<string, number>;
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/components/GeometryEditor.d.ts
|
|
345
|
+
interface GeometryEditorProps {
|
|
346
|
+
dimensions: Record<string, unknown>;
|
|
347
|
+
pkgType?: string | null;
|
|
348
|
+
fileName?: string | null;
|
|
349
|
+
disabled?: boolean;
|
|
350
|
+
t: Translate;
|
|
351
|
+
onConfirm: (values: DimensionValues, edited: Record<string, boolean>) => void;
|
|
352
|
+
onCancel: () => void;
|
|
353
|
+
}
|
|
354
|
+
declare const GeometryEditor: import("react").NamedExoticComponent<GeometryEditorProps>;
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/components/PreviewStage.d.ts
|
|
357
|
+
interface PreviewStageProps {
|
|
358
|
+
kind: string | null;
|
|
359
|
+
content: string;
|
|
360
|
+
srcKey: string | null;
|
|
361
|
+
t: Translate;
|
|
362
|
+
}
|
|
363
|
+
declare function PreviewStage({ kind, content, srcKey, t }: PreviewStageProps): ReactElement;
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/components/ResultStage.d.ts
|
|
366
|
+
interface ResultStageProps {
|
|
367
|
+
ports: ComponentGenPorts;
|
|
368
|
+
kind: 'symbol' | 'footprint';
|
|
369
|
+
result: Record<string, unknown>;
|
|
370
|
+
t: Translate;
|
|
371
|
+
/** bump to force a re-render of the preview for a new result. */
|
|
372
|
+
srcKey: string;
|
|
373
|
+
}
|
|
374
|
+
declare function ResultStage({ ports, kind, result, t, srcKey }: ResultStageProps): ReactElement;
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/components/UploadInput.d.ts
|
|
377
|
+
interface UploadInputProps {
|
|
378
|
+
maxBytes: number;
|
|
379
|
+
t: Translate;
|
|
380
|
+
disabled?: boolean;
|
|
381
|
+
imageDataUrl?: string | null;
|
|
382
|
+
/** original file, for the server to store into history. */
|
|
383
|
+
file?: File | null;
|
|
384
|
+
onFile: (file: File | null, dataUrl: string | null) => void;
|
|
385
|
+
}
|
|
386
|
+
/** Downscale an image file to a data URL bounded in edge + bytes. */
|
|
387
|
+
declare function fileToDataUrl(file: File, maxBytes: number): Promise<string>;
|
|
388
|
+
declare function UploadInput(props: UploadInputProps): ReactElement;
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/components/HistoryPanel.d.ts
|
|
391
|
+
interface HistoryPanelProps {
|
|
392
|
+
ports: ComponentGenPorts;
|
|
393
|
+
t: Translate;
|
|
394
|
+
activeKind?: 'symbol' | 'footprint' | null;
|
|
395
|
+
onReopen: (entry: HistoryEntry) => void;
|
|
396
|
+
}
|
|
397
|
+
declare function HistoryPanel({ ports, t, activeKind, onReopen }: HistoryPanelProps): ReactElement;
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/api/component-gen-client.d.ts
|
|
400
|
+
interface HttpPortsOptions {
|
|
401
|
+
/** component-gen API base, e.g. `/api/v1/huaqiu/component-gen`. */
|
|
402
|
+
base: string;
|
|
403
|
+
/** artifacts API base, e.g. `/api/v1/huaqiu/artifacts` (same origin). */
|
|
404
|
+
artifactsBase?: string;
|
|
405
|
+
doFetch?: typeof fetch;
|
|
406
|
+
auth?: ComponentGenAuthPort;
|
|
407
|
+
}
|
|
408
|
+
/** The shared fetch client. */
|
|
409
|
+
declare function createHttpPorts(options: HttpPortsOptions): ComponentGenPorts;
|
|
410
|
+
/** Derive the artifacts base from the component-gen base path. */
|
|
411
|
+
declare function defaultArtifactsBase(componentGenBase: string): string;
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/styles/inject.d.ts
|
|
414
|
+
/**
|
|
415
|
+
* `@huaqiu/component-gen-app` — scoped stylesheet.
|
|
416
|
+
*
|
|
417
|
+
* Injected as a `<style>` tag (never a CSS import) so both build surfaces work:
|
|
418
|
+
* the standalone vite bundle AND the DSH client-module bundle (tsdown has no
|
|
419
|
+
* CSS pipeline). Reuses the `hq-genhit__*` class vocabulary (shared with
|
|
420
|
+
* `dsh-tool-symbol-footprint`) plus an `cga-*` app-shell layer. Uses the same
|
|
421
|
+
* DSW design tokens so the app follows the host palette in DSH.
|
|
422
|
+
*/
|
|
423
|
+
declare const APP_STYLE_ID = "hq-cga-styles";
|
|
424
|
+
declare function injectAppStyles(): void;
|
|
425
|
+
declare function removeAppStyles(): void;
|
|
426
|
+
//#endregion
|
|
427
|
+
export { APP_STYLE_ID, ComponentGenApp, type ComponentGenAppProps, type ComponentGenAuthPort, type ComponentGenConfig, type ComponentGenPage, type ComponentGenPorts, EN, FootprintGenPage, type FootprintGenPageProps, GeometryEditor, type GeometryEditorProps, type HistoryEntry, type HistoryPage, HistoryPanel, type HistoryPanelProps, type HistoryPatch, type HistoryQuery, type HttpPortsOptions, type JobEvent, type JobInput, type JobKind, type JobState, PreviewStage, type PreviewStageProps, ResultStage, type ResultStageProps, type StartJobRequest, SymbolGenPage, type SymbolGenPageProps, type Translate, UploadInput, type UploadInputProps, ZH, createHttpPorts, defaultArtifactsBase, defaultT, fileToDataUrl, injectAppStyles, removeAppStyles, translate, translateFor };
|