@huaqiu/dsh-hardware-ui 0.7.14 → 0.7.15
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/lib/client.js +421 -142
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/components.tsx +44 -38
- package/src/client/copy.ts +346 -0
- package/src/client/ecad.ts +2 -1
- package/src/client/index.ts +7 -4
- package/src/client/model.ts +14 -5
- package/src/client/order.tsx +63 -61
- package/src/client/preview.tsx +23 -26
- package/src/client/transport.ts +23 -1
- package/src/client/wizard.tsx +26 -30
package/lib/client.js
CHANGED
|
@@ -5,7 +5,268 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
7
|
let react = require("react");
|
|
8
|
+
//#region src/client/copy.ts
|
|
9
|
+
const COPY = {
|
|
10
|
+
/** Product name — tab title, settings section label, wizard title. */
|
|
11
|
+
product: { name: "硬件工程" },
|
|
12
|
+
/** The five persistent destinations, in `DESTINATIONS` order. */
|
|
13
|
+
destinations: {
|
|
14
|
+
schematic: "原理图",
|
|
15
|
+
pcb: "PCB",
|
|
16
|
+
bom: "BOM",
|
|
17
|
+
"3d": "3D 模型",
|
|
18
|
+
order: "下单"
|
|
19
|
+
},
|
|
20
|
+
/** Navigation row + viewer strip. */
|
|
21
|
+
viewer: {
|
|
22
|
+
discoveryFailed: (detail) => `产物扫描失败:${detail}`,
|
|
23
|
+
installationFailed: (detail) => `安装检查失败:${detail}`,
|
|
24
|
+
noArtifact: "未选择产物",
|
|
25
|
+
kicadMissing: "未找到 KiCad",
|
|
26
|
+
kicadVersion: (version) => `KiCad ${version}`,
|
|
27
|
+
openInKicad: "用 KiCad 打开",
|
|
28
|
+
openInKicadTitle: (path) => `在 KiCad 中打开 ${path}`,
|
|
29
|
+
selectArtifactFirst: "请先选择一个产物",
|
|
30
|
+
configureKicad: "请在「设置 → 硬件工程」中配置 KiCad",
|
|
31
|
+
nothingToShow: "暂无可显示内容",
|
|
32
|
+
selectProject: "选择工程…",
|
|
33
|
+
projectField: "工程",
|
|
34
|
+
schematicSheetField: "原理图页",
|
|
35
|
+
boardField: "板文件"
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Discovery outcomes. These are the panel's OWN sentences for a host state —
|
|
39
|
+
* the host also sends a `message`, but re-deriving it here keeps the copy in
|
|
40
|
+
* one place and lets the count/cwd be woven in. {@link issueText} bridges the
|
|
41
|
+
* two: known codes get translated, unknown ones fall back to the host text.
|
|
42
|
+
*/
|
|
43
|
+
discovery: {
|
|
44
|
+
selectionRequiredCount: (count) => `发现 ${count} 个硬件工程,请明确选择一个。`,
|
|
45
|
+
selectionRequiredArtifact: "该工程包含多个可选产物,请明确选择一个。",
|
|
46
|
+
noProjectSelected: "尚未选择硬件工程。请打开或选择一个硬件工程。",
|
|
47
|
+
noSchematic: "该工程没有可用的根原理图。",
|
|
48
|
+
noBoard: "该工程没有可用的 .kicad_pcb 板文件。",
|
|
49
|
+
noBoardToOrder: "请先选择板文件,再报价或下单制板。",
|
|
50
|
+
noProject: (cwd) => cwd === "" ? "未找到 .kicad_pro 工程文件" : `${cwd} 下未找到 .kicad_pro 工程文件`,
|
|
51
|
+
missingProject: (path) => `工程文件不存在:${path}`,
|
|
52
|
+
badManifest: (detail) => `配置文件 .hardware-engineering.json 无效:${detail}`
|
|
53
|
+
},
|
|
54
|
+
/** schematic / pcb / 3d / bom stages. */
|
|
55
|
+
preview: {
|
|
56
|
+
loading: "正在加载已保存的产物…",
|
|
57
|
+
unavailable: "不可用",
|
|
58
|
+
kindSchematic: "原理图",
|
|
59
|
+
kindBoard: "PCB",
|
|
60
|
+
revision: (revision) => `版本 ${revision}`,
|
|
61
|
+
ecadHint: "仅预览已保存的文件;文件必须存在且可解析。",
|
|
62
|
+
ecadKindMismatch: (expected, actual) => `宿主返回的产物类型(${actual})与预览类型(${expected})不一致。`,
|
|
63
|
+
ecadOverlay: "已保存文件 · 滚轮缩放,拖拽平移",
|
|
64
|
+
kicadNotConfigured: "KiCad 尚未配置。",
|
|
65
|
+
glbExporting: "正在用 kicad-cli 导出 PCB 的 GLB…",
|
|
66
|
+
glbLoading: "正在加载 3D 模型…",
|
|
67
|
+
glbCached: "缓存",
|
|
68
|
+
glbGenerated: "已生成",
|
|
69
|
+
glbOverlay: "拖拽旋转 · 滚轮缩放",
|
|
70
|
+
bomHint: "BOM 行来自 kicad-cli sch export bom。请在「设置 → 硬件工程」中配置 KiCad。",
|
|
71
|
+
bomTitle: (lines) => `物料清单 · ${String(lines)} 行`,
|
|
72
|
+
bomPlacements: (count) => `${String(count)} 个元件位`,
|
|
73
|
+
bomColumns: [
|
|
74
|
+
"位号",
|
|
75
|
+
"数量",
|
|
76
|
+
"值",
|
|
77
|
+
"封装",
|
|
78
|
+
"备注"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
/** Order Placing destination. */
|
|
82
|
+
order: {
|
|
83
|
+
title: "制板与贴片",
|
|
84
|
+
packaging: "打包中…",
|
|
85
|
+
packageReady: "打包完成",
|
|
86
|
+
packagePending: "尚未打包",
|
|
87
|
+
packageRunning: "正在运行 kicad-cli 导出 Gerber 与钻孔…",
|
|
88
|
+
packageNotPrepared: "尚未打包。",
|
|
89
|
+
packageCard: "制板文件包",
|
|
90
|
+
packageFiles: (files, size) => `${String(files)} 个文件 · ${size}`,
|
|
91
|
+
pcbTitle: "裸板制板",
|
|
92
|
+
pcbSubtitle: "通过华秋制板服务对选中的板文件报价并下单。",
|
|
93
|
+
pcbSummary: (zip, files, size) => `${zip} · ${String(files)} 个 Gerber/钻孔文件 · ${size}`,
|
|
94
|
+
pcbAction: "提交 PCB 订单",
|
|
95
|
+
smtTitle: "整包贴片",
|
|
96
|
+
smtSubtitle: "需要工程根原理图以生成 BOM 与元件坐标。",
|
|
97
|
+
smtSummary: (placements, lines, size) => `${String(placements)} 个贴片点位 · ${String(lines)} 行 BOM · ${size}`,
|
|
98
|
+
smtAction: "提交贴片订单",
|
|
99
|
+
boardFile: "板文件",
|
|
100
|
+
placements: "贴片点位",
|
|
101
|
+
bomLines: "BOM 行数",
|
|
102
|
+
credential: "登录凭据",
|
|
103
|
+
signedIn: "华秋登录",
|
|
104
|
+
signedOut: "未登录",
|
|
105
|
+
signInToOrder: "请先登录华秋账号再下单——订单页将以你的账号打开。",
|
|
106
|
+
signInToOrderSmt: "请先登录华秋账号再下单贴片——订单页将以你的账号打开。",
|
|
107
|
+
waitingForPackage: "正在等待制板文件包。",
|
|
108
|
+
configureToPackage: "请配置 KiCad 以打包板文件。",
|
|
109
|
+
selectRootSchematic: "请选择根原理图,以便生成 BOM 与坐标。",
|
|
110
|
+
layers: "层数",
|
|
111
|
+
layersValue: (layers) => `${String(layers)} 层`,
|
|
112
|
+
outline: "外形尺寸",
|
|
113
|
+
thickness: "板厚",
|
|
114
|
+
minTrace: "最小线宽",
|
|
115
|
+
minDrill: "最小钻孔",
|
|
116
|
+
outerCopper: "外层铜厚",
|
|
117
|
+
defaultValue: "默认",
|
|
118
|
+
copperValue: (oz) => `${String(oz)} oz`,
|
|
119
|
+
agentEntryPoints: "Agent 入口",
|
|
120
|
+
submitting: "提交中…",
|
|
121
|
+
resultTitlePcb: "PCB 订单已创建",
|
|
122
|
+
resultTitleSmt: "贴片订单已创建",
|
|
123
|
+
resultLaunched: "已在浏览器打开",
|
|
124
|
+
resultReady: "待打开",
|
|
125
|
+
resultNote: "与 KiCad 在下单窗口中展示的是同一个页面,已在你的默认浏览器中打开。",
|
|
126
|
+
resultLaunchedMessage: (kind) => `已在默认浏览器中打开「${kind}」订单页。`,
|
|
127
|
+
resultReadyMessage: (kind) => `「${kind}」订单页已就绪,打开链接即可继续。`,
|
|
128
|
+
openInBrowser: "在浏览器打开",
|
|
129
|
+
opening: "正在打开…",
|
|
130
|
+
copyUrl: "复制链接",
|
|
131
|
+
copied: "已复制",
|
|
132
|
+
confirmAria: "确认下单上传",
|
|
133
|
+
confirmTitlePcb: "上传板文件并创建 PCB 订单?",
|
|
134
|
+
confirmTitleSmt: "上传贴片文件包?",
|
|
135
|
+
confirmBody: "以下文件将发送到华秋下单服务。订单在那里创建,其页面会在你的默认浏览器中打开;付款仍在该页面完成。",
|
|
136
|
+
confirmZip: (zip, size) => `${zip} — Gerber 与钻孔文件(${size})`,
|
|
137
|
+
confirmPositions: (size) => `元件坐标(${size})`,
|
|
138
|
+
confirmBom: (size) => `贴片 BOM(${size})`,
|
|
139
|
+
confirmHost: (baseUrl) => baseUrl ?? "已配置的下单服务",
|
|
140
|
+
confirmAck: "我了解这些板文件将离开本机。",
|
|
141
|
+
cancel: "取消",
|
|
142
|
+
uploadAndOpen: "上传并打开订单页",
|
|
143
|
+
uploading: "正在上传…",
|
|
144
|
+
batch: "生产数量",
|
|
145
|
+
batchUnits: (count) => `${String(count)} 片`,
|
|
146
|
+
quoteBasis: (count) => `报价基准 · ${String(count)} 片`
|
|
147
|
+
},
|
|
148
|
+
/** First-run setup wizard. */
|
|
149
|
+
wizard: {
|
|
150
|
+
steps: [
|
|
151
|
+
"欢迎",
|
|
152
|
+
"KiCad",
|
|
153
|
+
"SolidCraft"
|
|
154
|
+
],
|
|
155
|
+
stepCounter: (index, total, label) => `${String(index)}/${String(total)} · ${label}`,
|
|
156
|
+
aria: "硬件工程初始化",
|
|
157
|
+
welcomeTitle: "配置你的硬件工具链",
|
|
158
|
+
welcomeKicker: "仅需一次 · 可跳过",
|
|
159
|
+
welcomeLead: "硬件工程可预览 KiCad 工程、导出 PCB 三维模型、打包制板文件并调用本地程序打开文件。只需指定一次本地安装位置。",
|
|
160
|
+
welcomeUsesTitle: "使用到的组件",
|
|
161
|
+
welcomeUses: "kicad-cli 负责预览、BOM、GLB 与 Gerber/钻孔打包。SolidCraft 仅作为环境上下文提供给 Agent。",
|
|
162
|
+
welcomeLocal: "只使用本机的可执行文件。不会上传任何内容,也不会替你安装任何东西。",
|
|
163
|
+
kicadTitle: "KiCad 安装位置",
|
|
164
|
+
kicadOptional: "可选",
|
|
165
|
+
kicadLead: "填写 KiCad 安装目录或 kicad-cli 路径。它用于 .kicad_sch / .kicad_pcb 预览、PCB 的 GLB 导出、制板文件打包,以及「用 KiCad 打开」。",
|
|
166
|
+
kicadPlaceholder: "C:\\Program Files\\KiCad\\8.0\\ 或 /usr/bin/kicad-cli",
|
|
167
|
+
kicadSkipHint: "留空即跳过。之后可在「设置 → 硬件工程」中配置。",
|
|
168
|
+
solidcraftTitle: "SolidCraft 安装位置",
|
|
169
|
+
solidcraftLead: "本 POC 中 SolidCraft 仅作为环境上下文提供给 Agent——不启动本地程序,也不做结构预览。",
|
|
170
|
+
solidcraftPlaceholder: "C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe",
|
|
171
|
+
skip: "跳过设置",
|
|
172
|
+
back: "上一步",
|
|
173
|
+
next: "下一步",
|
|
174
|
+
finish: "完成",
|
|
175
|
+
saving: "保存中…",
|
|
176
|
+
footerNote: "随时可在「设置 → 硬件工程」中修改。"
|
|
177
|
+
},
|
|
178
|
+
/** Settings section (the two CAD installation roots). */
|
|
179
|
+
settings: {
|
|
180
|
+
title: "硬件工程",
|
|
181
|
+
lead: "用于预览、制板打包、一键调用本地程序以及 Agent 环境上下文的本地 EDA / MCAD 可执行文件。",
|
|
182
|
+
kicadTitle: "KiCad EDA 套件",
|
|
183
|
+
kicadBlurb: "可填 KiCad 安装目录或 kicad-cli 路径。用于 .kicad_sch / .kicad_pcb 预览、GLB 导出、BOM、Gerber 打包与本地打开。",
|
|
184
|
+
kicadPlaceholder: "C:\\Program Files\\KiCad\\8.0\\ 或 /usr/bin/kicad-cli",
|
|
185
|
+
solidcraftTitle: "SolidCraft 三维 CAD",
|
|
186
|
+
solidcraftBlurb: "本 POC 中仅用于 Agent 环境上下文。不启动本地程序,也不做结构预览;「3D 模型」页签渲染的是所选 PCB。",
|
|
187
|
+
solidcraftPlaceholder: "C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe",
|
|
188
|
+
pathField: (title) => `${title}路径`,
|
|
189
|
+
validate: "校验并保存",
|
|
190
|
+
validating: "校验中…",
|
|
191
|
+
configured: "已配置",
|
|
192
|
+
notConfigured: "未配置",
|
|
193
|
+
notDetected: "未检测到",
|
|
194
|
+
savedAndValidated: (application) => `${application} 校验通过并已保存。`,
|
|
195
|
+
savedButInvalid: (application, detail) => `${application} 已保存,但校验失败:${detail}`,
|
|
196
|
+
hostSettingsUnavailable: "宿主未提供设置服务,无法保存。",
|
|
197
|
+
hostRejected: (application) => `宿主拒绝了${application}的设置。`
|
|
198
|
+
},
|
|
199
|
+
/**
|
|
200
|
+
* Host error sentences, keyed by the stable `code` in the route envelope
|
|
201
|
+
* (`packages/hardware-artifacts/src/routes.ts`). A code missing here is not a
|
|
202
|
+
* bug in the UI: the host detail is then shown verbatim, which is the right
|
|
203
|
+
* answer for an unmodelled failure.
|
|
204
|
+
*/
|
|
205
|
+
errors: {
|
|
206
|
+
unauthorized: "没有权限访问该产物:它不在当前会话的工作区授权范围内。",
|
|
207
|
+
forbidden: "没有权限执行该操作。",
|
|
208
|
+
"missing-artifact": "该产物不存在。",
|
|
209
|
+
"unsupported-artifact": "不支持该产物类型。",
|
|
210
|
+
"invalid-identity": "产物路径无效。",
|
|
211
|
+
"missing-executable": "已配置的 KiCad 中没有可打开该产物的程序。",
|
|
212
|
+
"not-configured": "尚未配置 KiCad。请在「设置 → 硬件工程」中填写安装位置。",
|
|
213
|
+
"too-large": "产物超过可预览的大小上限。",
|
|
214
|
+
"export-timeout": "kicad-cli 执行超时。",
|
|
215
|
+
"export-failed": "kicad-cli 导出失败。",
|
|
216
|
+
"stale-revision": "文件已变化,请刷新后重试。",
|
|
217
|
+
"invalid-request": "请求参数不完整。",
|
|
218
|
+
"invalid-application": "不支持该本地程序。",
|
|
219
|
+
"confirmation-required": "下单需要先在上传确认框中确认。",
|
|
220
|
+
"invalid-order-url": "订单链接无效,已拒绝打开。",
|
|
221
|
+
"order-unreachable": "无法连接下单服务。",
|
|
222
|
+
"order-rejected": "下单服务未能返回可用的订单页。",
|
|
223
|
+
"not-found": "未找到该接口。",
|
|
224
|
+
internal: "服务内部错误。"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Codes whose host detail is a technical tail worth keeping next to the
|
|
229
|
+
* translated sentence: kicad-cli stderr, an HTTP failure, a backend payload.
|
|
230
|
+
* For the rest the detail merely restates the sentence in English.
|
|
231
|
+
*/
|
|
232
|
+
const KEEPS_DETAIL = /* @__PURE__ */ new Set([
|
|
233
|
+
"export-failed",
|
|
234
|
+
"order-unreachable",
|
|
235
|
+
"order-rejected",
|
|
236
|
+
"invalid-order-url",
|
|
237
|
+
"internal"
|
|
238
|
+
]);
|
|
239
|
+
/**
|
|
240
|
+
* One host error → one zh_CN sentence.
|
|
241
|
+
*
|
|
242
|
+
* `detail` is the host's own message. Unknown codes keep it untouched, so an
|
|
243
|
+
* unmodelled failure still says something specific instead of collapsing into
|
|
244
|
+
* a generic "出错了".
|
|
245
|
+
*/
|
|
246
|
+
function describeHostError(code, detail) {
|
|
247
|
+
if (code === void 0) return detail;
|
|
248
|
+
const sentence = COPY.errors[code];
|
|
249
|
+
if (sentence === void 0) return detail;
|
|
250
|
+
return KEEPS_DETAIL.has(code) && detail !== "" ? `${sentence}(${detail})` : sentence;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Translate one discovery `issue` without losing the host's specifics.
|
|
254
|
+
*
|
|
255
|
+
* The count and the workspace come from the discovery result, not from the
|
|
256
|
+
* host sentence, so the wording does not depend on how the host phrased it.
|
|
257
|
+
*/
|
|
258
|
+
function issueText(issue, context = {}) {
|
|
259
|
+
switch (issue.code) {
|
|
260
|
+
case "selection-required": return context.count !== void 0 && context.count > 1 ? COPY.discovery.selectionRequiredCount(context.count) : COPY.discovery.selectionRequiredArtifact;
|
|
261
|
+
case "no-project": return COPY.discovery.noProject(context.cwd ?? "");
|
|
262
|
+
case "missing-project": return COPY.discovery.missingProject(issue.message.replace(/\s+does not exist\s*$/u, ""));
|
|
263
|
+
case "bad-manifest": return COPY.discovery.badManifest(issue.message.replace(/^invalid \.hardware-engineering\.json:\s*/u, ""));
|
|
264
|
+
default: return issue.message;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
8
268
|
//#region src/client/model.ts
|
|
269
|
+
/** Product-owned navigation and artifact identity. No shadow project database. */
|
|
9
270
|
const DESTINATIONS = Object.freeze([
|
|
10
271
|
"schematic",
|
|
11
272
|
"pcb",
|
|
@@ -13,12 +274,20 @@ window.__ModuleLoader__.load({
|
|
|
13
274
|
"3d",
|
|
14
275
|
"order"
|
|
15
276
|
]);
|
|
277
|
+
/**
|
|
278
|
+
* Visible destination labels, in `DESTINATIONS` order.
|
|
279
|
+
*
|
|
280
|
+
* Read from the copy module rather than written here: the same strings are
|
|
281
|
+
* rendered from the navigation row and the viewer strip, and the two must never
|
|
282
|
+
* disagree. Keys stay in destination order because the navigation maps over
|
|
283
|
+
* `DESTINATIONS`, not over this object.
|
|
284
|
+
*/
|
|
16
285
|
const DESTINATION_LABELS = Object.freeze({
|
|
17
|
-
schematic:
|
|
18
|
-
pcb:
|
|
19
|
-
bom:
|
|
20
|
-
"3d": "
|
|
21
|
-
order:
|
|
286
|
+
schematic: COPY.destinations.schematic,
|
|
287
|
+
pcb: COPY.destinations.pcb,
|
|
288
|
+
bom: COPY.destinations.bom,
|
|
289
|
+
"3d": COPY.destinations["3d"],
|
|
290
|
+
order: COPY.destinations.order
|
|
22
291
|
});
|
|
23
292
|
/** Which native application a destination can open, if any. */
|
|
24
293
|
function applicationFor(destination) {
|
|
@@ -105943,16 +106212,37 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
105943
106212
|
*/
|
|
105944
106213
|
//#endregion
|
|
105945
106214
|
//#region src/client/transport.ts
|
|
106215
|
+
/** Same-origin calls to the `@huaqiu/hardware-artifacts` Host routes. */
|
|
105946
106216
|
const PREFIX = "/api/v1/hardware";
|
|
106217
|
+
/**
|
|
106218
|
+
* One failed call → one `Error` whose message is already user-facing zh_CN.
|
|
106219
|
+
*
|
|
106220
|
+
* The route envelope carries a stable `code`, so the sentence is chosen here
|
|
106221
|
+
* instead of at every render site (the panel, the stages and the settings
|
|
106222
|
+
* section all show `error.message`). The code stays on the error object for
|
|
106223
|
+
* callers that branch on it. Host detail survives inside the message only when
|
|
106224
|
+
* {@link describeHostError} judges it technical rather than prose.
|
|
106225
|
+
*/
|
|
105947
106226
|
async function request(path, init) {
|
|
105948
106227
|
const response = await fetch(`${PREFIX}${path}`, init);
|
|
105949
106228
|
const body = await response.json().catch(() => void 0);
|
|
105950
106229
|
if (!response.ok || body?.ok === false) {
|
|
106230
|
+
const code = body?.error?.code;
|
|
105951
106231
|
const detail = body?.error?.message ?? `HTTP ${response.status}`;
|
|
105952
|
-
|
|
106232
|
+
const error = new Error(describeHostError(code, detail));
|
|
106233
|
+
throw code === void 0 ? error : Object.assign(error, { code });
|
|
105953
106234
|
}
|
|
105954
106235
|
return body;
|
|
105955
106236
|
}
|
|
106237
|
+
/**
|
|
106238
|
+
* Readable text of a thrown value.
|
|
106239
|
+
*
|
|
106240
|
+
* `String(new Error('x'))` is `"Error: x"`, which is why every message the UI
|
|
106241
|
+
* renders goes through here instead of `String(error)`.
|
|
106242
|
+
*/
|
|
106243
|
+
function messageOf(error) {
|
|
106244
|
+
return error instanceof Error ? error.message : String(error);
|
|
106245
|
+
}
|
|
105956
106246
|
function query(cwd, project, session) {
|
|
105957
106247
|
const params = new URLSearchParams();
|
|
105958
106248
|
if (cwd !== void 0 && cwd !== "") params.set("cwd", cwd);
|
|
@@ -106079,7 +106369,7 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
106079
106369
|
...options.session === void 0 ? {} : { session: options.session }
|
|
106080
106370
|
});
|
|
106081
106371
|
if (options.signal.aborted) throw aborted$1(options.signal);
|
|
106082
|
-
if (source.kind !== void 0 && source.kind !== kind) throw new Error(
|
|
106372
|
+
if (source.kind !== void 0 && source.kind !== kind) throw new Error(COPY.preview.ecadKindMismatch(kind, source.kind));
|
|
106083
106373
|
const canvas = document.createElement("canvas");
|
|
106084
106374
|
canvas.style.cssText = "position:absolute;inset:0;display:block;width:100%;height:100%;outline:none";
|
|
106085
106375
|
container.append(canvas);
|
|
@@ -143508,34 +143798,31 @@ void main() {
|
|
|
143508
143798
|
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
143509
143799
|
return `${(bytes / 1048576).toFixed(2)} MB`;
|
|
143510
143800
|
}
|
|
143511
|
-
function describe$1(error) {
|
|
143512
|
-
return error instanceof Error ? error.message : String(error);
|
|
143513
|
-
}
|
|
143514
143801
|
function specRows(facts) {
|
|
143515
143802
|
return [
|
|
143516
143803
|
{
|
|
143517
|
-
label:
|
|
143518
|
-
value:
|
|
143804
|
+
label: COPY.order.layers,
|
|
143805
|
+
value: COPY.order.layersValue(facts.layers)
|
|
143519
143806
|
},
|
|
143520
143807
|
{
|
|
143521
|
-
label:
|
|
143808
|
+
label: COPY.order.outline,
|
|
143522
143809
|
value: `${facts.widthMm.toFixed(1)} × ${facts.heightMm.toFixed(1)} mm`
|
|
143523
143810
|
},
|
|
143524
143811
|
{
|
|
143525
|
-
label:
|
|
143812
|
+
label: COPY.order.thickness,
|
|
143526
143813
|
value: `${facts.thicknessMm.toFixed(2)} mm`
|
|
143527
143814
|
},
|
|
143528
143815
|
{
|
|
143529
|
-
label:
|
|
143530
|
-
value: facts.minTrackMm === void 0 ?
|
|
143816
|
+
label: COPY.order.minTrace,
|
|
143817
|
+
value: facts.minTrackMm === void 0 ? COPY.order.defaultValue : `${facts.minTrackMm.toFixed(2)} mm`
|
|
143531
143818
|
},
|
|
143532
143819
|
{
|
|
143533
|
-
label:
|
|
143534
|
-
value: facts.minViaDrillMm === void 0 ?
|
|
143820
|
+
label: COPY.order.minDrill,
|
|
143821
|
+
value: facts.minViaDrillMm === void 0 ? COPY.order.defaultValue : `${facts.minViaDrillMm.toFixed(2)} mm`
|
|
143535
143822
|
},
|
|
143536
143823
|
{
|
|
143537
|
-
label:
|
|
143538
|
-
value:
|
|
143824
|
+
label: COPY.order.outerCopper,
|
|
143825
|
+
value: COPY.order.copperValue(facts.outerOz ?? 1)
|
|
143539
143826
|
}
|
|
143540
143827
|
];
|
|
143541
143828
|
}
|
|
@@ -143656,7 +143943,7 @@ void main() {
|
|
|
143656
143943
|
disabled: blocked || input.busy,
|
|
143657
143944
|
"data-hardware-order-action": input.tag.toLowerCase(),
|
|
143658
143945
|
onClick: input.onAction
|
|
143659
|
-
}, input.busy ?
|
|
143946
|
+
}, input.busy ? COPY.order.submitting : input.action));
|
|
143660
143947
|
}
|
|
143661
143948
|
function OrderPanel(props) {
|
|
143662
143949
|
const { boardPath, boardTitle, schematicPath, workspaceRoot, session, configured } = props;
|
|
@@ -143682,7 +143969,7 @@ void main() {
|
|
|
143682
143969
|
loadOrderConfig().then((value) => {
|
|
143683
143970
|
if (live.current) setConfig(value);
|
|
143684
143971
|
}).catch((error) => {
|
|
143685
|
-
if (live.current) setMessage(
|
|
143972
|
+
if (live.current) setMessage(messageOf(error));
|
|
143686
143973
|
});
|
|
143687
143974
|
}, []);
|
|
143688
143975
|
(0, react.useEffect)(() => {
|
|
@@ -143698,7 +143985,7 @@ void main() {
|
|
|
143698
143985
|
if (!controller.signal.aborted) setPrepared(value);
|
|
143699
143986
|
}).catch((error) => {
|
|
143700
143987
|
if (controller.signal.aborted || isAbortError(error)) return;
|
|
143701
|
-
setMessage(
|
|
143988
|
+
setMessage(messageOf(error));
|
|
143702
143989
|
}).finally(() => {
|
|
143703
143990
|
if (!controller.signal.aborted) setPreparing(false);
|
|
143704
143991
|
});
|
|
@@ -143730,7 +144017,7 @@ void main() {
|
|
|
143730
144017
|
setConfirming(void 0);
|
|
143731
144018
|
setAcknowledged(false);
|
|
143732
144019
|
} catch (error) {
|
|
143733
|
-
setMessage(
|
|
144020
|
+
setMessage(messageOf(error));
|
|
143734
144021
|
} finally {
|
|
143735
144022
|
setPlacing(void 0);
|
|
143736
144023
|
}
|
|
@@ -143759,7 +144046,7 @@ void main() {
|
|
|
143759
144046
|
status: "launched"
|
|
143760
144047
|
});
|
|
143761
144048
|
} catch (error) {
|
|
143762
|
-
setMessage(
|
|
144049
|
+
setMessage(messageOf(error));
|
|
143763
144050
|
} finally {
|
|
143764
144051
|
setReopening(false);
|
|
143765
144052
|
}
|
|
@@ -143779,12 +144066,12 @@ void main() {
|
|
|
143779
144066
|
display: "flex",
|
|
143780
144067
|
alignItems: "center",
|
|
143781
144068
|
gap: 6
|
|
143782
|
-
} }, (0, react.createElement)("span", { style: dotStyle(C.accent) }),
|
|
144069
|
+
} }, (0, react.createElement)("span", { style: dotStyle(C.accent) }), COPY.order.title), preparing ? (0, react.createElement)("span", { style: pillStyle("info") }, COPY.order.packaging) : prepared !== void 0 ? (0, react.createElement)("span", { style: pillStyle("ok") }, COPY.order.packageReady) : (0, react.createElement)("span", { style: pillStyle(configured ? "muted" : "warn") }, configured ? COPY.order.packagePending : COPY.viewer.kicadMissing)), (0, react.createElement)("p", { style: {
|
|
143783
144070
|
...MUTED,
|
|
143784
144071
|
...MONO_TEXT,
|
|
143785
144072
|
fontSize: 10.5
|
|
143786
144073
|
} }, boardTitle));
|
|
143787
|
-
const packageCard = (0, react.createElement)("div", { style: cardStyle() }, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE },
|
|
144074
|
+
const packageCard = (0, react.createElement)("div", { style: cardStyle() }, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE }, COPY.order.packageCard), prepared === void 0 ? null : (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.order.packageFiles(prepared.archive.files.length, zipSize ?? ""))), prepared === void 0 ? (0, react.createElement)("p", { style: MUTED }, preparing ? COPY.order.packageRunning : COPY.order.packageNotPrepared) : (0, react.createElement)("div", { style: {
|
|
143788
144075
|
display: "flex",
|
|
143789
144076
|
flexWrap: "wrap",
|
|
143790
144077
|
gap: 4,
|
|
@@ -143806,46 +144093,46 @@ void main() {
|
|
|
143806
144093
|
const pcbCard = workflowCard({
|
|
143807
144094
|
tag: "PCB",
|
|
143808
144095
|
tagColor: C.ok,
|
|
143809
|
-
title:
|
|
143810
|
-
subtitle: prepared === void 0 ?
|
|
144096
|
+
title: COPY.order.pcbTitle,
|
|
144097
|
+
subtitle: prepared === void 0 ? COPY.order.pcbSubtitle : COPY.order.pcbSummary(prepared.archive.zipName, prepared.archive.files.length, zipSize ?? ""),
|
|
143811
144098
|
details: specs.length === 0 ? [{
|
|
143812
|
-
label:
|
|
144099
|
+
label: COPY.order.boardFile,
|
|
143813
144100
|
value: boardTitle
|
|
143814
144101
|
}] : specs,
|
|
143815
|
-
action:
|
|
144102
|
+
action: COPY.order.pcbAction,
|
|
143816
144103
|
onAction: () => {
|
|
143817
144104
|
setAcknowledged(false);
|
|
143818
144105
|
setConfirming("pcb");
|
|
143819
144106
|
},
|
|
143820
144107
|
busy: placing === "pcb",
|
|
143821
|
-
...configured && prepared !== void 0 ? tokenReady ? {} : { blocked:
|
|
144108
|
+
...configured && prepared !== void 0 ? tokenReady ? {} : { blocked: COPY.order.signInToOrder } : { blocked: configured ? COPY.order.waitingForPackage : COPY.order.configureToPackage }
|
|
143822
144109
|
});
|
|
143823
144110
|
const smtCard = workflowCard({
|
|
143824
144111
|
tag: "PCBA",
|
|
143825
144112
|
tagColor: C.info,
|
|
143826
|
-
title:
|
|
143827
|
-
subtitle: assembly === void 0 ?
|
|
144113
|
+
title: COPY.order.smtTitle,
|
|
144114
|
+
subtitle: assembly === void 0 ? COPY.order.smtSubtitle : COPY.order.smtSummary(assembly.positions, assembly.bomLines, formatBytes(assembly.bomBytes + assembly.positionsBytes)),
|
|
143828
144115
|
details: [
|
|
143829
144116
|
{
|
|
143830
|
-
label:
|
|
144117
|
+
label: COPY.order.placements,
|
|
143831
144118
|
value: assembly === void 0 ? "—" : String(assembly.positions)
|
|
143832
144119
|
},
|
|
143833
144120
|
{
|
|
143834
|
-
label:
|
|
144121
|
+
label: COPY.order.bomLines,
|
|
143835
144122
|
value: assembly === void 0 ? "—" : String(assembly.bomLines)
|
|
143836
144123
|
},
|
|
143837
144124
|
{
|
|
143838
|
-
label:
|
|
143839
|
-
value: tokenReady ?
|
|
144125
|
+
label: COPY.order.credential,
|
|
144126
|
+
value: tokenReady ? COPY.order.signedIn : COPY.order.signedOut
|
|
143840
144127
|
}
|
|
143841
144128
|
],
|
|
143842
|
-
action:
|
|
144129
|
+
action: COPY.order.smtAction,
|
|
143843
144130
|
onAction: () => {
|
|
143844
144131
|
setAcknowledged(false);
|
|
143845
144132
|
setConfirming("smt");
|
|
143846
144133
|
},
|
|
143847
144134
|
busy: placing === "smt",
|
|
143848
|
-
...assembly === void 0 ? { blocked:
|
|
144135
|
+
...assembly === void 0 ? { blocked: COPY.order.selectRootSchematic } : tokenReady ? {} : { blocked: COPY.order.signInToOrderSmt }
|
|
143849
144136
|
});
|
|
143850
144137
|
const agentHint = (0, react.createElement)("div", { style: {
|
|
143851
144138
|
...ROW$2,
|
|
@@ -143854,7 +144141,7 @@ void main() {
|
|
|
143854
144141
|
} }, (0, react.createElement)("span", { style: {
|
|
143855
144142
|
fontSize: 10,
|
|
143856
144143
|
color: C.text3
|
|
143857
|
-
} },
|
|
144144
|
+
} }, COPY.order.agentEntryPoints), ...[
|
|
143858
144145
|
"quote_pcb",
|
|
143859
144146
|
"place_pcb_order",
|
|
143860
144147
|
"quote_smt",
|
|
@@ -143869,7 +144156,7 @@ void main() {
|
|
|
143869
144156
|
const resultCard = placed === void 0 ? null : (0, react.createElement)("div", {
|
|
143870
144157
|
style: cardStyle({ borderColor: "rgba(52,211,153,0.4)" }),
|
|
143871
144158
|
"data-hardware-order-result": placed.kind
|
|
143872
|
-
}, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE },
|
|
144159
|
+
}, (0, react.createElement)("div", { style: SPREAD$1 }, (0, react.createElement)("span", { style: SECTION_TITLE }, placed.kind === "pcb" ? COPY.order.resultTitlePcb : COPY.order.resultTitleSmt), (0, react.createElement)("span", { style: pillStyle(placed.launched ? "ok" : "muted") }, placed.launched ? COPY.order.resultLaunched : COPY.order.resultReady)), (0, react.createElement)("p", { style: MUTED }, placed.launched ? COPY.order.resultLaunchedMessage(placed.kind === "pcb" ? "PCB" : "贴片") : COPY.order.resultReadyMessage(placed.kind === "pcb" ? "PCB" : "贴片")), (0, react.createElement)("a", {
|
|
143873
144160
|
style: LINK,
|
|
143874
144161
|
href: placed.orderUrl,
|
|
143875
144162
|
target: "_blank",
|
|
@@ -143878,7 +144165,7 @@ void main() {
|
|
|
143878
144165
|
}, placed.orderUrl), (0, react.createElement)("p", { style: {
|
|
143879
144166
|
...MUTED,
|
|
143880
144167
|
fontSize: 10
|
|
143881
|
-
} },
|
|
144168
|
+
} }, COPY.order.resultNote), (0, react.createElement)("div", { style: ROW$2 }, (0, react.createElement)("button", {
|
|
143882
144169
|
type: "button",
|
|
143883
144170
|
style: {
|
|
143884
144171
|
...buttonStyle("primary"),
|
|
@@ -143889,13 +144176,13 @@ void main() {
|
|
|
143889
144176
|
onClick: () => {
|
|
143890
144177
|
reopen();
|
|
143891
144178
|
}
|
|
143892
|
-
}, reopening ?
|
|
144179
|
+
}, reopening ? COPY.order.opening : COPY.order.openInBrowser), (0, react.createElement)("button", {
|
|
143893
144180
|
type: "button",
|
|
143894
144181
|
style: buttonStyle("secondary"),
|
|
143895
144182
|
onClick: () => {
|
|
143896
144183
|
copy();
|
|
143897
144184
|
}
|
|
143898
|
-
}, copied ?
|
|
144185
|
+
}, copied ? COPY.order.copied : COPY.order.copyUrl), (0, react.createElement)("span", { style: {
|
|
143899
144186
|
...MUTED,
|
|
143900
144187
|
...MONO_TEXT,
|
|
143901
144188
|
fontSize: 10
|
|
@@ -143904,7 +144191,7 @@ void main() {
|
|
|
143904
144191
|
style: DIALOG_BACKDROP,
|
|
143905
144192
|
role: "dialog",
|
|
143906
144193
|
"aria-modal": true,
|
|
143907
|
-
"aria-label":
|
|
144194
|
+
"aria-label": COPY.order.confirmAria,
|
|
143908
144195
|
"data-hardware-order-confirm": confirming
|
|
143909
144196
|
}, (0, react.createElement)("div", { style: DIALOG }, (0, react.createElement)("div", { style: {
|
|
143910
144197
|
display: "flex",
|
|
@@ -143914,13 +144201,13 @@ void main() {
|
|
|
143914
144201
|
margin: 0,
|
|
143915
144202
|
fontSize: 13,
|
|
143916
144203
|
fontWeight: 600
|
|
143917
|
-
} }, confirming === "pcb" ?
|
|
144204
|
+
} }, confirming === "pcb" ? COPY.order.confirmTitlePcb : COPY.order.confirmTitleSmt), (0, react.createElement)("p", { style: MUTED }, COPY.order.confirmBody)), (0, react.createElement)("ul", { style: {
|
|
143918
144205
|
margin: 0,
|
|
143919
144206
|
paddingLeft: 16,
|
|
143920
144207
|
fontSize: 11,
|
|
143921
144208
|
color: C.text2,
|
|
143922
144209
|
lineHeight: 1.7
|
|
143923
|
-
} }, (0, react.createElement)("li", null,
|
|
144210
|
+
} }, (0, react.createElement)("li", null, COPY.order.confirmZip(prepared?.archive.zipName ?? "board.zip", zipSize ?? "—")), ...confirming === "smt" ? [(0, react.createElement)("li", { key: "pos" }, COPY.order.confirmPositions(assembly === void 0 ? "—" : formatBytes(assembly.positionsBytes))), (0, react.createElement)("li", { key: "bom" }, COPY.order.confirmBom(assembly === void 0 ? "—" : formatBytes(assembly.bomBytes)))] : [], (0, react.createElement)("li", { key: "host" }, (0, react.createElement)("span", { style: MONO_TEXT }, COPY.order.confirmHost(config?.baseUrl)))), (0, react.createElement)("label", { style: {
|
|
143924
144211
|
...ROW$2,
|
|
143925
144212
|
alignItems: "flex-start",
|
|
143926
144213
|
fontSize: 11,
|
|
@@ -143937,7 +144224,7 @@ void main() {
|
|
|
143937
144224
|
setAcknowledged(event.currentTarget.checked);
|
|
143938
144225
|
},
|
|
143939
144226
|
"data-hardware-order-ack": true
|
|
143940
|
-
}),
|
|
144227
|
+
}), COPY.order.confirmAck), (0, react.createElement)("div", { style: {
|
|
143941
144228
|
...ROW$2,
|
|
143942
144229
|
justifyContent: "flex-end"
|
|
143943
144230
|
} }, (0, react.createElement)("button", {
|
|
@@ -143947,7 +144234,7 @@ void main() {
|
|
|
143947
144234
|
setConfirming(void 0);
|
|
143948
144235
|
setAcknowledged(false);
|
|
143949
144236
|
}
|
|
143950
|
-
},
|
|
144237
|
+
}, COPY.order.cancel), (0, react.createElement)("button", {
|
|
143951
144238
|
type: "button",
|
|
143952
144239
|
style: {
|
|
143953
144240
|
...buttonStyle("primary"),
|
|
@@ -143958,7 +144245,7 @@ void main() {
|
|
|
143958
144245
|
onClick: () => {
|
|
143959
144246
|
submit(confirming);
|
|
143960
144247
|
}
|
|
143961
|
-
}, placing === void 0 ?
|
|
144248
|
+
}, placing === void 0 ? COPY.order.uploadAndOpen : COPY.order.uploading))));
|
|
143962
144249
|
return (0, react.createElement)("div", {
|
|
143963
144250
|
style: {
|
|
143964
144251
|
position: "relative",
|
|
@@ -143990,7 +144277,7 @@ void main() {
|
|
|
143990
144277
|
} }, (0, react.createElement)("span", { style: {
|
|
143991
144278
|
fontSize: 11,
|
|
143992
144279
|
color: C.text2
|
|
143993
|
-
} },
|
|
144280
|
+
} }, COPY.order.batch), (0, react.createElement)("select", {
|
|
143994
144281
|
style: {
|
|
143995
144282
|
...SELECT,
|
|
143996
144283
|
width: "auto"
|
|
@@ -144003,11 +144290,11 @@ void main() {
|
|
|
144003
144290
|
}, ...QUANTITIES.map((count) => (0, react.createElement)("option", {
|
|
144004
144291
|
key: count,
|
|
144005
144292
|
value: count
|
|
144006
|
-
},
|
|
144293
|
+
}, COPY.order.batchUnits(count)))), (0, react.createElement)("span", { style: {
|
|
144007
144294
|
...MUTED,
|
|
144008
144295
|
...MONO_TEXT,
|
|
144009
144296
|
fontSize: 10
|
|
144010
|
-
} },
|
|
144297
|
+
} }, COPY.order.quoteBasis(quantity))), packageCard, resultCard, agentHint, dialog);
|
|
144011
144298
|
}
|
|
144012
144299
|
//#endregion
|
|
144013
144300
|
//#region src/client/preview.tsx
|
|
@@ -144098,14 +144385,11 @@ void main() {
|
|
|
144098
144385
|
color: C.text
|
|
144099
144386
|
};
|
|
144100
144387
|
R.md, C.base, C.text2;
|
|
144101
|
-
function describe(error) {
|
|
144102
|
-
return error instanceof Error ? error.message : String(error);
|
|
144103
|
-
}
|
|
144104
144388
|
function shortRevision(revision) {
|
|
144105
144389
|
return revision === void 0 ? "" : revision.slice(0, 10);
|
|
144106
144390
|
}
|
|
144107
144391
|
function statusLine(status, message, hint) {
|
|
144108
|
-
const text = message ?? (status === "loading" ?
|
|
144392
|
+
const text = message ?? (status === "loading" ? COPY.preview.loading : "");
|
|
144109
144393
|
return (0, react.createElement)("div", {
|
|
144110
144394
|
style: CENTER,
|
|
144111
144395
|
role: "status",
|
|
@@ -144120,7 +144404,7 @@ void main() {
|
|
|
144120
144404
|
} }) : (0, react.createElement)("span", { style: {
|
|
144121
144405
|
...pillStyle("warn"),
|
|
144122
144406
|
fontFamily: MONO
|
|
144123
|
-
} },
|
|
144407
|
+
} }, COPY.preview.unavailable), (0, react.createElement)("p", { style: CENTER_TEXT }, text), hint === void 0 ? null : (0, react.createElement)("p", { style: {
|
|
144124
144408
|
...CENTER_TEXT,
|
|
144125
144409
|
fontSize: 10,
|
|
144126
144410
|
color: C.text3
|
|
@@ -144166,7 +144450,7 @@ void main() {
|
|
|
144166
144450
|
}).catch((error) => {
|
|
144167
144451
|
if (!live || isAbortError(error)) return;
|
|
144168
144452
|
setStatus("error");
|
|
144169
|
-
setMessage(
|
|
144453
|
+
setMessage(messageOf(error));
|
|
144170
144454
|
});
|
|
144171
144455
|
return () => {
|
|
144172
144456
|
live = false;
|
|
@@ -144190,22 +144474,22 @@ void main() {
|
|
|
144190
144474
|
...pillStyle("muted"),
|
|
144191
144475
|
fontSize: 9.5
|
|
144192
144476
|
}
|
|
144193
|
-
}, kind === "schematic" ?
|
|
144477
|
+
}, kind === "schematic" ? COPY.preview.kindSchematic : COPY.preview.kindBoard), sourceRevision === void 0 ? null : (0, react.createElement)("span", {
|
|
144194
144478
|
key: "rev",
|
|
144195
144479
|
style: {
|
|
144196
144480
|
...pillStyle("muted"),
|
|
144197
144481
|
fontSize: 9.5
|
|
144198
144482
|
}
|
|
144199
|
-
},
|
|
144483
|
+
}, COPY.preview.revision(shortRevision(sourceRevision)))] : void 0,
|
|
144200
144484
|
overlay: status === "ready" ? [(0, react.createElement)("span", {
|
|
144201
144485
|
key: "dot",
|
|
144202
144486
|
style: dotStyle(kind === "schematic" ? C.info : C.ok, 6)
|
|
144203
|
-
}),
|
|
144487
|
+
}), COPY.preview.ecadOverlay] : void 0
|
|
144204
144488
|
}, (0, react.createElement)("div", { style: {
|
|
144205
144489
|
position: "relative",
|
|
144206
144490
|
flex: "1 1 0",
|
|
144207
144491
|
minHeight: 160
|
|
144208
|
-
} }, ...status === "ready" ? [] : [statusLine(status, message, status === "error" ?
|
|
144492
|
+
} }, ...status === "ready" ? [] : [statusLine(status, message, status === "error" ? COPY.preview.ecadHint : void 0)], (0, react.createElement)("div", {
|
|
144209
144493
|
key: "canvas",
|
|
144210
144494
|
ref: container,
|
|
144211
144495
|
style: {
|
|
@@ -144225,21 +144509,21 @@ void main() {
|
|
|
144225
144509
|
if (element === null) return;
|
|
144226
144510
|
if (!configured) {
|
|
144227
144511
|
setStatus("error");
|
|
144228
|
-
setMessage(
|
|
144512
|
+
setMessage(COPY.preview.kicadNotConfigured);
|
|
144229
144513
|
return;
|
|
144230
144514
|
}
|
|
144231
144515
|
const controller = new AbortController();
|
|
144232
144516
|
let live = true;
|
|
144233
144517
|
let mounted;
|
|
144234
144518
|
setStatus("loading");
|
|
144235
|
-
setMessage(
|
|
144519
|
+
setMessage(COPY.preview.glbExporting);
|
|
144236
144520
|
element.replaceChildren();
|
|
144237
144521
|
const run = async () => {
|
|
144238
144522
|
const glb = await prepareBoardGlb(boardPath, cwd, controller.signal, session);
|
|
144239
144523
|
if (!live) return;
|
|
144240
144524
|
setRevision(glb.revision);
|
|
144241
144525
|
setCached(glb.cached);
|
|
144242
|
-
setMessage(
|
|
144526
|
+
setMessage(COPY.preview.glbLoading);
|
|
144243
144527
|
mounted = await mountGlb(glb.url, element, { signal: controller.signal });
|
|
144244
144528
|
if (!live) {
|
|
144245
144529
|
mounted.dispose();
|
|
@@ -144251,7 +144535,7 @@ void main() {
|
|
|
144251
144535
|
run().catch((error) => {
|
|
144252
144536
|
if (!live || isAbortError(error)) return;
|
|
144253
144537
|
setStatus("error");
|
|
144254
|
-
setMessage(
|
|
144538
|
+
setMessage(messageOf(error));
|
|
144255
144539
|
});
|
|
144256
144540
|
return () => {
|
|
144257
144541
|
live = false;
|
|
@@ -144271,11 +144555,11 @@ void main() {
|
|
|
144271
144555
|
topRight: status === "ready" ? [(0, react.createElement)("span", {
|
|
144272
144556
|
key: "mode",
|
|
144273
144557
|
style: pillStyle("muted", { fontSize: 9.5 })
|
|
144274
|
-
}, cached ?
|
|
144558
|
+
}, cached ? COPY.preview.glbCached : COPY.preview.glbGenerated), (0, react.createElement)("span", {
|
|
144275
144559
|
key: "rev",
|
|
144276
144560
|
style: pillStyle("muted", { fontSize: 9.5 })
|
|
144277
|
-
},
|
|
144278
|
-
overlay: status === "ready" ?
|
|
144561
|
+
}, COPY.preview.revision(shortRevision(revision)))] : void 0,
|
|
144562
|
+
overlay: status === "ready" ? COPY.preview.glbOverlay : "kicad-cli pcb export glb"
|
|
144279
144563
|
}, (0, react.createElement)("div", { style: {
|
|
144280
144564
|
position: "relative",
|
|
144281
144565
|
flex: "1 1 0",
|
|
@@ -144303,7 +144587,7 @@ void main() {
|
|
|
144303
144587
|
(0, react.useEffect)(() => {
|
|
144304
144588
|
if (!configured) {
|
|
144305
144589
|
setStatus("error");
|
|
144306
|
-
setMessage(
|
|
144590
|
+
setMessage(COPY.preview.kicadNotConfigured);
|
|
144307
144591
|
return;
|
|
144308
144592
|
}
|
|
144309
144593
|
const controller = new AbortController();
|
|
@@ -144320,7 +144604,7 @@ void main() {
|
|
|
144320
144604
|
}).catch((error) => {
|
|
144321
144605
|
if (!live || isAbortError(error)) return;
|
|
144322
144606
|
setStatus("error");
|
|
144323
|
-
setMessage(
|
|
144607
|
+
setMessage(messageOf(error));
|
|
144324
144608
|
});
|
|
144325
144609
|
return () => {
|
|
144326
144610
|
live = false;
|
|
@@ -144339,7 +144623,7 @@ void main() {
|
|
|
144339
144623
|
}, (0, react.createElement)("div", { style: {
|
|
144340
144624
|
flex: "1 1 0",
|
|
144341
144625
|
display: "flex"
|
|
144342
|
-
} }, statusLine(status, message, status === "error" && !configured ?
|
|
144626
|
+
} }, statusLine(status, message, status === "error" && !configured ? COPY.preview.bomHint : void 0)));
|
|
144343
144627
|
const total = bom.rows.reduce((sum, row) => sum + row.quantity, 0);
|
|
144344
144628
|
return (0, react.createElement)("div", {
|
|
144345
144629
|
style: cardStyle({
|
|
@@ -144356,21 +144640,15 @@ void main() {
|
|
|
144356
144640
|
gap: 8,
|
|
144357
144641
|
padding: "8px 10px",
|
|
144358
144642
|
borderBottom: `1px solid ${C.border}`
|
|
144359
|
-
} }, (0, react.createElement)("span", { style: SECTION_TITLE },
|
|
144643
|
+
} }, (0, react.createElement)("span", { style: SECTION_TITLE }, COPY.preview.bomTitle(bom.rows.length)), (0, react.createElement)("div", { style: {
|
|
144360
144644
|
display: "flex",
|
|
144361
144645
|
gap: 4,
|
|
144362
144646
|
alignItems: "center"
|
|
144363
|
-
} }, (0, react.createElement)("span", { style: pillStyle("muted") },
|
|
144647
|
+
} }, (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.preview.bomPlacements(total)), (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.preview.revision(shortRevision(bom.revision))))), (0, react.createElement)("div", { style: {
|
|
144364
144648
|
flex: "1 1 0",
|
|
144365
144649
|
minHeight: 0,
|
|
144366
144650
|
overflow: "auto"
|
|
144367
|
-
} }, (0, react.createElement)("table", { style: TABLE }, (0, react.createElement)("thead", {}, (0, react.createElement)("tr", {}, ...
|
|
144368
|
-
"Refs",
|
|
144369
|
-
"Qty",
|
|
144370
|
-
"Value",
|
|
144371
|
-
"Footprint",
|
|
144372
|
-
"Notes"
|
|
144373
|
-
].map((label) => (0, react.createElement)("th", {
|
|
144651
|
+
} }, (0, react.createElement)("table", { style: TABLE }, (0, react.createElement)("thead", {}, (0, react.createElement)("tr", {}, ...COPY.preview.bomColumns.map((label) => (0, react.createElement)("th", {
|
|
144374
144652
|
key: label,
|
|
144375
144653
|
style: TH
|
|
144376
144654
|
}, label)))), (0, react.createElement)("tbody", {}, ...bom.rows.map((row, index) => (0, react.createElement)("tr", {
|
|
@@ -144524,11 +144802,8 @@ void main() {
|
|
|
144524
144802
|
flexDirection: "column",
|
|
144525
144803
|
gap: 6
|
|
144526
144804
|
};
|
|
144527
|
-
|
|
144528
|
-
|
|
144529
|
-
"KiCad",
|
|
144530
|
-
"SolidCraft"
|
|
144531
|
-
];
|
|
144805
|
+
/** Step titles, in order (also the dot-strip tooltips and the counter label). */
|
|
144806
|
+
const STEPS = COPY.wizard.steps;
|
|
144532
144807
|
/**
|
|
144533
144808
|
* Dismissal remembered for the life of this client bundle, not one mount.
|
|
144534
144809
|
*
|
|
@@ -144612,7 +144887,7 @@ void main() {
|
|
|
144612
144887
|
if (kicadRoot !== "") await saveInstallation("kicad", kicadRoot);
|
|
144613
144888
|
if (solidcraftRoot !== "") await saveInstallation("solidcraft", solidcraftRoot);
|
|
144614
144889
|
} catch (error) {
|
|
144615
|
-
setMessage(
|
|
144890
|
+
setMessage(messageOf(error));
|
|
144616
144891
|
setBusy(false);
|
|
144617
144892
|
return;
|
|
144618
144893
|
}
|
|
@@ -144640,41 +144915,41 @@ void main() {
|
|
|
144640
144915
|
display: "flex",
|
|
144641
144916
|
flexDirection: "column",
|
|
144642
144917
|
gap: 1
|
|
144643
|
-
} }, (0, react.createElement)("h2", { style: TITLE },
|
|
144918
|
+
} }, (0, react.createElement)("h2", { style: TITLE }, COPY.wizard.welcomeTitle), (0, react.createElement)("span", { style: STEP_LABEL }, COPY.wizard.welcomeKicker))), (0, react.createElement)("p", { style: LEAD }, COPY.wizard.welcomeLead), (0, react.createElement)("div", { style: FIELD_CARD }, (0, react.createElement)("span", { style: {
|
|
144644
144919
|
fontSize: 11,
|
|
144645
144920
|
fontWeight: 600
|
|
144646
|
-
} },
|
|
144921
|
+
} }, COPY.wizard.welcomeUsesTitle), (0, react.createElement)("p", { style: {
|
|
144647
144922
|
...MUTED,
|
|
144648
144923
|
color: C.text3
|
|
144649
|
-
} },
|
|
144924
|
+
} }, COPY.wizard.welcomeUses)), (0, react.createElement)("p", { style: {
|
|
144650
144925
|
...MUTED,
|
|
144651
144926
|
color: C.text3
|
|
144652
|
-
} },
|
|
144927
|
+
} }, COPY.wizard.welcomeLocal));
|
|
144653
144928
|
if (step === 1) return (0, react.createElement)("div", { style: {
|
|
144654
144929
|
display: "flex",
|
|
144655
144930
|
flexDirection: "column",
|
|
144656
144931
|
gap: 8
|
|
144657
|
-
} }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE },
|
|
144932
|
+
} }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE }, COPY.wizard.kicadTitle), (0, react.createElement)("span", { style: facts?.kicad?.configured === true ? pillStyle("ok") : pillStyle("muted") }, facts?.kicad?.configured === true ? `v${facts.kicad.version ?? "?"}` : COPY.wizard.kicadOptional)), (0, react.createElement)("p", { style: LEAD }, COPY.wizard.kicadLead), (0, react.createElement)("input", {
|
|
144658
144933
|
style: INPUT,
|
|
144659
144934
|
value: kicadRoot,
|
|
144660
144935
|
autoFocus: true,
|
|
144661
144936
|
spellCheck: false,
|
|
144662
|
-
placeholder:
|
|
144937
|
+
placeholder: COPY.wizard.kicadPlaceholder,
|
|
144663
144938
|
onChange: (event) => setKicadRoot(event.currentTarget.value)
|
|
144664
144939
|
}), (0, react.createElement)("p", { style: {
|
|
144665
144940
|
...MUTED,
|
|
144666
144941
|
color: C.text3
|
|
144667
|
-
} },
|
|
144942
|
+
} }, COPY.wizard.kicadSkipHint));
|
|
144668
144943
|
return (0, react.createElement)("div", { style: {
|
|
144669
144944
|
display: "flex",
|
|
144670
144945
|
flexDirection: "column",
|
|
144671
144946
|
gap: 8
|
|
144672
|
-
} }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE },
|
|
144947
|
+
} }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("h2", { style: TITLE }, COPY.wizard.solidcraftTitle), (0, react.createElement)("span", { style: pillStyle("muted") }, COPY.wizard.kicadOptional)), (0, react.createElement)("p", { style: LEAD }, COPY.wizard.solidcraftLead), (0, react.createElement)("input", {
|
|
144673
144948
|
style: INPUT,
|
|
144674
144949
|
value: solidcraftRoot,
|
|
144675
144950
|
autoFocus: true,
|
|
144676
144951
|
spellCheck: false,
|
|
144677
|
-
placeholder:
|
|
144952
|
+
placeholder: COPY.wizard.solidcraftPlaceholder,
|
|
144678
144953
|
onChange: (event) => setSolidcraftRoot(event.currentTarget.value)
|
|
144679
144954
|
}));
|
|
144680
144955
|
};
|
|
@@ -144682,7 +144957,7 @@ void main() {
|
|
|
144682
144957
|
style: BACKDROP,
|
|
144683
144958
|
role: "dialog",
|
|
144684
144959
|
"aria-modal": true,
|
|
144685
|
-
"aria-label":
|
|
144960
|
+
"aria-label": COPY.wizard.aria,
|
|
144686
144961
|
"data-hardware-wizard": true
|
|
144687
144962
|
}, (0, react.createElement)("div", { style: PANEL }, (0, react.createElement)("div", { style: SPREAD }, (0, react.createElement)("div", { style: {
|
|
144688
144963
|
...ROW$1,
|
|
@@ -144694,13 +144969,13 @@ void main() {
|
|
|
144694
144969
|
})), (0, react.createElement)("span", { style: {
|
|
144695
144970
|
...STEP_LABEL,
|
|
144696
144971
|
...MONO_TEXT
|
|
144697
|
-
} },
|
|
144972
|
+
} }, COPY.wizard.stepCounter(step + 1, STEPS.length, STEPS[step] ?? ""))), (0, react.createElement)("button", {
|
|
144698
144973
|
type: "button",
|
|
144699
144974
|
style: buttonStyle("quiet", { fontSize: 10.5 }),
|
|
144700
144975
|
onClick: () => {
|
|
144701
144976
|
complete();
|
|
144702
144977
|
}
|
|
144703
|
-
},
|
|
144978
|
+
}, COPY.wizard.skip)), stepBody(), ...message === "" ? [] : [(0, react.createElement)("p", {
|
|
144704
144979
|
key: "msg",
|
|
144705
144980
|
style: {
|
|
144706
144981
|
...MUTED,
|
|
@@ -144715,20 +144990,20 @@ void main() {
|
|
|
144715
144990
|
...MUTED,
|
|
144716
144991
|
color: C.text3,
|
|
144717
144992
|
fontSize: 10
|
|
144718
|
-
} },
|
|
144993
|
+
} }, COPY.wizard.footerNote), (0, react.createElement)("span", { style: ROW$1 }, step > 0 ? (0, react.createElement)("button", {
|
|
144719
144994
|
type: "button",
|
|
144720
144995
|
style: buttonStyle("secondary"),
|
|
144721
144996
|
onClick: () => {
|
|
144722
144997
|
setStep(step - 1);
|
|
144723
144998
|
}
|
|
144724
|
-
},
|
|
144999
|
+
}, COPY.wizard.back) : null, (0, react.createElement)("button", {
|
|
144725
145000
|
type: "button",
|
|
144726
145001
|
style: buttonStyle("primary"),
|
|
144727
145002
|
disabled: busy,
|
|
144728
145003
|
onClick: () => {
|
|
144729
145004
|
next();
|
|
144730
145005
|
}
|
|
144731
|
-
}, busy ?
|
|
145006
|
+
}, busy ? COPY.wizard.saving : step === STEPS.length - 1 ? COPY.wizard.finish : COPY.wizard.next)))));
|
|
144732
145007
|
}
|
|
144733
145008
|
//#endregion
|
|
144734
145009
|
//#region src/client/components.tsx
|
|
@@ -144896,7 +145171,7 @@ void main() {
|
|
|
144896
145171
|
discover(cwd, void 0, sessionId).then((discovery) => {
|
|
144897
145172
|
if (live) actions.setDiscovery(discovery);
|
|
144898
145173
|
}).catch((error) => {
|
|
144899
|
-
if (live) actions.setNotice(
|
|
145174
|
+
if (live) actions.setNotice(COPY.viewer.discoveryFailed(messageOf(error)));
|
|
144900
145175
|
});
|
|
144901
145176
|
return () => {
|
|
144902
145177
|
live = false;
|
|
@@ -144952,16 +145227,16 @@ void main() {
|
|
|
144952
145227
|
function missingReason(state, destination) {
|
|
144953
145228
|
const discovery = state.discovery;
|
|
144954
145229
|
if (discovery === void 0) return void 0;
|
|
144955
|
-
if (discovery.issue?.code === "selection-required" && (discovery.projects?.length ?? 0) > 1) return
|
|
144956
|
-
if (discovery.selected === void 0) return
|
|
145230
|
+
if (discovery.issue?.code === "selection-required" && (discovery.projects?.length ?? 0) > 1) return COPY.discovery.selectionRequiredCount(discovery.projects?.length ?? 0);
|
|
145231
|
+
if (discovery.selected === void 0) return COPY.discovery.noProjectSelected;
|
|
144957
145232
|
if (destination === "schematic" || destination === "bom") {
|
|
144958
|
-
if (discovery.selected.schematic === void 0) return
|
|
145233
|
+
if (discovery.selected.schematic === void 0) return COPY.discovery.noSchematic;
|
|
144959
145234
|
}
|
|
144960
145235
|
if (destination === "pcb" || destination === "3d") {
|
|
144961
|
-
if ((discovery.selected.boards?.length ?? 0) === 0) return
|
|
145236
|
+
if ((discovery.selected.boards?.length ?? 0) === 0) return COPY.discovery.noBoard;
|
|
144962
145237
|
}
|
|
144963
145238
|
if (destination === "order") {
|
|
144964
|
-
if ((discovery.selected.boards?.length ?? 0) === 0) return
|
|
145239
|
+
if ((discovery.selected.boards?.length ?? 0) === 0) return COPY.discovery.noBoardToOrder;
|
|
144965
145240
|
}
|
|
144966
145241
|
}
|
|
144967
145242
|
/** Native-open affordance for the artifact currently on screen. */
|
|
@@ -144979,7 +145254,7 @@ void main() {
|
|
|
144979
145254
|
},
|
|
144980
145255
|
disabled: !canOpen,
|
|
144981
145256
|
"data-hardware-native-open": true,
|
|
144982
|
-
title: canOpen ?
|
|
145257
|
+
title: canOpen ? COPY.viewer.openInKicadTitle(artifact.path) : configured ? COPY.viewer.selectArtifactFirst : COPY.viewer.configureKicad,
|
|
144983
145258
|
onClick: () => {
|
|
144984
145259
|
if (artifact === void 0) return;
|
|
144985
145260
|
openNative({
|
|
@@ -144987,10 +145262,10 @@ void main() {
|
|
|
144987
145262
|
artifactPath: artifact.path,
|
|
144988
145263
|
kind: active === "3d" ? "pcb-3d" : active === "bom" ? "bom" : artifact.kind
|
|
144989
145264
|
}).catch((error) => {
|
|
144990
|
-
notice(
|
|
145265
|
+
notice(messageOf(error));
|
|
144991
145266
|
});
|
|
144992
145267
|
}
|
|
144993
|
-
}, (0, react.createElement)("span", { style: dotStyle(configured ? C.ok : C.text3, 6) }),
|
|
145268
|
+
}, (0, react.createElement)("span", { style: dotStyle(configured ? C.ok : C.text3, 6) }), COPY.viewer.openInKicad);
|
|
144994
145269
|
}
|
|
144995
145270
|
/** Keyframes the stages reference; rendered once per panel. */
|
|
144996
145271
|
const PANEL_STYLE = `
|
|
@@ -145033,7 +145308,7 @@ void main() {
|
|
|
145033
145308
|
discover(cwd, params?.projectPath, sessionId).then((result) => {
|
|
145034
145309
|
if (live) actions.setDiscovery(result, params?.path !== void 0);
|
|
145035
145310
|
}).catch((error) => {
|
|
145036
|
-
if (live) actions.setNotice(
|
|
145311
|
+
if (live) actions.setNotice(COPY.viewer.discoveryFailed(messageOf(error)));
|
|
145037
145312
|
});
|
|
145038
145313
|
return () => {
|
|
145039
145314
|
live = false;
|
|
@@ -145050,7 +145325,7 @@ void main() {
|
|
|
145050
145325
|
installations().then((result) => {
|
|
145051
145326
|
if (live) actions.setInstallations(result);
|
|
145052
145327
|
}).catch((error) => {
|
|
145053
|
-
if (live) actions.setNotice(
|
|
145328
|
+
if (live) actions.setNotice(COPY.viewer.installationFailed(messageOf(error)));
|
|
145054
145329
|
});
|
|
145055
145330
|
return () => {
|
|
145056
145331
|
live = false;
|
|
@@ -145086,7 +145361,7 @@ void main() {
|
|
|
145086
145361
|
const meta = (0, react.createElement)("div", { style: META }, (0, react.createElement)("span", {
|
|
145087
145362
|
style: META_PATH,
|
|
145088
145363
|
title: artifact?.path ?? ""
|
|
145089
|
-
}, artifact === void 0 ?
|
|
145364
|
+
}, artifact === void 0 ? COPY.viewer.noArtifact : artifact.path), (0, react.createElement)("span", { style: {
|
|
145090
145365
|
display: "flex",
|
|
145091
145366
|
alignItems: "center",
|
|
145092
145367
|
gap: 4,
|
|
@@ -145097,11 +145372,11 @@ void main() {
|
|
|
145097
145372
|
}, selectedProject.name)], ...kicadConfigured ? [(0, react.createElement)("span", {
|
|
145098
145373
|
key: "kicad",
|
|
145099
145374
|
style: pillStyle("ok")
|
|
145100
|
-
},
|
|
145375
|
+
}, COPY.viewer.kicadVersion(installed?.kicad?.version ?? "").trim())] : [(0, react.createElement)("span", {
|
|
145101
145376
|
key: "kicad",
|
|
145102
145377
|
style: pillStyle("warn"),
|
|
145103
145378
|
title: installed?.kicad?.error ?? ""
|
|
145104
|
-
},
|
|
145379
|
+
}, COPY.viewer.kicadMissing)]));
|
|
145105
145380
|
const selectors = [];
|
|
145106
145381
|
const selectStyle = {
|
|
145107
145382
|
...INPUT,
|
|
@@ -145113,20 +145388,20 @@ void main() {
|
|
|
145113
145388
|
key: "project",
|
|
145114
145389
|
style: selectStyle,
|
|
145115
145390
|
value: projectPath ?? "",
|
|
145116
|
-
"aria-label":
|
|
145391
|
+
"aria-label": COPY.viewer.projectField,
|
|
145117
145392
|
onChange: (event) => {
|
|
145118
145393
|
const path = event.currentTarget.value;
|
|
145119
145394
|
actions.selectProject(path);
|
|
145120
|
-
discover(cwd, path, sessionId).then((result) => actions.setDiscovery(result)).catch((error) => actions.setNotice(
|
|
145395
|
+
discover(cwd, path, sessionId).then((result) => actions.setDiscovery(result)).catch((error) => actions.setNotice(messageOf(error)));
|
|
145121
145396
|
}
|
|
145122
|
-
}, option("",
|
|
145397
|
+
}, option("", COPY.viewer.selectProject), ...(discovery?.projects ?? []).map((project) => option(project.path, project.name))));
|
|
145123
145398
|
if ((active === "schematic" || active === "bom") && selectedProject !== void 0) {
|
|
145124
145399
|
const candidates = [selectedProject.schematic, ...selectedProject.sheets ?? []].filter((candidate) => candidate !== void 0);
|
|
145125
145400
|
if (candidates.length > 1) selectors.push((0, react.createElement)("select", {
|
|
145126
145401
|
key: "sheet",
|
|
145127
145402
|
style: selectStyle,
|
|
145128
145403
|
value: schematicPath ?? "",
|
|
145129
|
-
"aria-label":
|
|
145404
|
+
"aria-label": COPY.viewer.schematicSheetField,
|
|
145130
145405
|
onChange: (event) => {
|
|
145131
145406
|
const path = event.currentTarget.value;
|
|
145132
145407
|
actions.selectArtifact(path, "schematic");
|
|
@@ -145139,7 +145414,7 @@ void main() {
|
|
|
145139
145414
|
key: "board",
|
|
145140
145415
|
style: selectStyle,
|
|
145141
145416
|
value: pcbPath ?? "",
|
|
145142
|
-
"aria-label":
|
|
145417
|
+
"aria-label": COPY.viewer.boardField,
|
|
145143
145418
|
onChange: (event) => {
|
|
145144
145419
|
const path = event.currentTarget.value;
|
|
145145
145420
|
actions.selectArtifact(path, "pcb");
|
|
@@ -145163,7 +145438,10 @@ void main() {
|
|
|
145163
145438
|
key: "issue",
|
|
145164
145439
|
role: "status",
|
|
145165
145440
|
style: MUTED
|
|
145166
|
-
}, discovery.issue
|
|
145441
|
+
}, issueText(discovery.issue, {
|
|
145442
|
+
...discovery.cwd === void 0 ? {} : { cwd: discovery.cwd },
|
|
145443
|
+
...discovery.projects === void 0 ? {} : { count: discovery.projects.length }
|
|
145444
|
+
}))]);
|
|
145167
145445
|
return (0, react.createElement)("div", {
|
|
145168
145446
|
style: PANEL_ROOT,
|
|
145169
145447
|
"data-hardware-destination": active
|
|
@@ -145188,7 +145466,7 @@ void main() {
|
|
|
145188
145466
|
gap: 6
|
|
145189
145467
|
}),
|
|
145190
145468
|
"data-hardware-state": "missing"
|
|
145191
|
-
}, (0, react.createElement)("span", { style: pillStyle("warn") },
|
|
145469
|
+
}, (0, react.createElement)("span", { style: pillStyle("warn") }, COPY.viewer.nothingToShow), (0, react.createElement)("p", {
|
|
145192
145470
|
role: "status",
|
|
145193
145471
|
style: {
|
|
145194
145472
|
...MUTED,
|
|
@@ -145230,9 +145508,10 @@ void main() {
|
|
|
145230
145508
|
const refreshed = await installations();
|
|
145231
145509
|
actions.setInstallations(refreshed);
|
|
145232
145510
|
const state = application === "kicad" ? refreshed.kicad : refreshed.solidcraft;
|
|
145233
|
-
|
|
145511
|
+
const applicationName = application === "kicad" ? "KiCad" : "SolidCraft";
|
|
145512
|
+
setMessage(state?.configured === true ? COPY.settings.savedAndValidated(applicationName) : COPY.settings.savedButInvalid(applicationName, state?.error ?? COPY.settings.notDetected));
|
|
145234
145513
|
} catch (error) {
|
|
145235
|
-
setMessage(
|
|
145514
|
+
setMessage(messageOf(error));
|
|
145236
145515
|
} finally {
|
|
145237
145516
|
setBusy(void 0);
|
|
145238
145517
|
}
|
|
@@ -145270,7 +145549,7 @@ void main() {
|
|
|
145270
145549
|
value: input.value,
|
|
145271
145550
|
placeholder: input.placeholder,
|
|
145272
145551
|
spellCheck: false,
|
|
145273
|
-
"aria-label":
|
|
145552
|
+
"aria-label": COPY.settings.pathField(input.title),
|
|
145274
145553
|
onChange: (event) => input.onChange(event.currentTarget.value)
|
|
145275
145554
|
}), (0, react.createElement)("div", { style: {
|
|
145276
145555
|
...ROW,
|
|
@@ -145285,7 +145564,7 @@ void main() {
|
|
|
145285
145564
|
onClick: () => {
|
|
145286
145565
|
save(input.key, input.value);
|
|
145287
145566
|
}
|
|
145288
|
-
}, busy === input.key ?
|
|
145567
|
+
}, busy === input.key ? COPY.settings.validating : COPY.settings.validate), input.detail === void 0 ? null : (0, react.createElement)("span", { style: {
|
|
145289
145568
|
...MUTED,
|
|
145290
145569
|
...MONO_TEXT,
|
|
145291
145570
|
fontSize: 10,
|
|
@@ -145305,28 +145584,28 @@ void main() {
|
|
|
145305
145584
|
margin: 0,
|
|
145306
145585
|
fontSize: 15,
|
|
145307
145586
|
fontWeight: 600
|
|
145308
|
-
} },
|
|
145587
|
+
} }, COPY.settings.title), (0, react.createElement)("p", { style: MUTED }, COPY.settings.lead), installationCard({
|
|
145309
145588
|
key: "kicad",
|
|
145310
145589
|
letter: "Ki",
|
|
145311
145590
|
color: C.info,
|
|
145312
|
-
title:
|
|
145313
|
-
blurb:
|
|
145591
|
+
title: COPY.settings.kicadTitle,
|
|
145592
|
+
blurb: COPY.settings.kicadBlurb,
|
|
145314
145593
|
value: kicadRoot,
|
|
145315
|
-
placeholder:
|
|
145594
|
+
placeholder: COPY.settings.kicadPlaceholder,
|
|
145316
145595
|
ok: kicad?.configured === true,
|
|
145317
|
-
status: kicad?.configured ? `v${kicad.version ?? "?"}` :
|
|
145596
|
+
status: kicad?.configured ? `v${kicad.version ?? "?"}` : COPY.settings.notConfigured,
|
|
145318
145597
|
...kicad?.cli === void 0 ? {} : { detail: kicad.cli },
|
|
145319
145598
|
onChange: setKicadRoot
|
|
145320
145599
|
}), installationCard({
|
|
145321
145600
|
key: "solidcraft",
|
|
145322
145601
|
letter: "Sc",
|
|
145323
145602
|
color: C.warn,
|
|
145324
|
-
title:
|
|
145325
|
-
blurb:
|
|
145603
|
+
title: COPY.settings.solidcraftTitle,
|
|
145604
|
+
blurb: COPY.settings.solidcraftBlurb,
|
|
145326
145605
|
value: solidcraftRoot,
|
|
145327
|
-
placeholder:
|
|
145606
|
+
placeholder: COPY.settings.solidcraftPlaceholder,
|
|
145328
145607
|
ok: solidcraft?.configured === true,
|
|
145329
|
-
status: solidcraft?.configured ?
|
|
145608
|
+
status: solidcraft?.configured ? COPY.settings.configured : COPY.settings.notConfigured,
|
|
145330
145609
|
...solidcraft?.executable === void 0 ? {} : { detail: solidcraft.executable },
|
|
145331
145610
|
onChange: setSolidcraftRoot
|
|
145332
145611
|
}), ...message === "" ? [] : [(0, react.createElement)("p", {
|
|
@@ -145506,9 +145785,9 @@ void main() {
|
|
|
145506
145785
|
},
|
|
145507
145786
|
async saveInstallation(application, root) {
|
|
145508
145787
|
const form = ctx.configForms?.get(HARDWARE_CONFIG_ENTRY);
|
|
145509
|
-
if (form === void 0) throw new Error(
|
|
145788
|
+
if (form === void 0) throw new Error(COPY.settings.hostSettingsUnavailable);
|
|
145510
145789
|
const field = application === "kicad" ? "kicadRoot" : "solidcraftRoot";
|
|
145511
|
-
if (!await form.set(field, root)) throw new Error(
|
|
145790
|
+
if (!await form.set(field, root)) throw new Error(COPY.settings.hostRejected(application === "kicad" ? "KiCad" : "SolidCraft"));
|
|
145512
145791
|
},
|
|
145513
145792
|
configForm() {
|
|
145514
145793
|
return ctx.configForms?.get(HARDWARE_CONFIG_ENTRY);
|
|
@@ -145539,7 +145818,7 @@ void main() {
|
|
|
145539
145818
|
id: "@huaqiu/dsh-hardware-ui",
|
|
145540
145819
|
kind: "hardware-engineering",
|
|
145541
145820
|
keepMounted: true,
|
|
145542
|
-
title: () =>
|
|
145821
|
+
title: () => COPY.product.name
|
|
145543
145822
|
}) ?? (() => {}), "hardware-ui: right-panel tab type");
|
|
145544
145823
|
const slots = ctx.slots;
|
|
145545
145824
|
if (slots === void 0) return;
|
|
@@ -145558,7 +145837,7 @@ void main() {
|
|
|
145558
145837
|
name: "settings.section",
|
|
145559
145838
|
id: HARDWARE_SETTINGS_ID,
|
|
145560
145839
|
order: 85,
|
|
145561
|
-
label: () =>
|
|
145840
|
+
label: () => COPY.product.name,
|
|
145562
145841
|
store: rootStore,
|
|
145563
145842
|
inject: () => controller
|
|
145564
145843
|
}, HardwareSettingsSection)), "hardware-ui: CAD installation settings");
|