@huaqiu/dsh-hardware-ui 0.7.14 → 0.7.16

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.
@@ -20,6 +20,8 @@ import {
20
20
  } from 'react'
21
21
  import type { HardwareInstallationConfig, InstallationsInfo } from './model.js'
22
22
  import type { HardwareProps } from './components.js'
23
+ import { COPY } from './copy.js'
24
+ import { messageOf } from './transport.js'
23
25
  import { buttonStyle, C, dotStyle, INPUT, MUTED, MONO_TEXT, pillStyle, R } from './theme.js'
24
26
 
25
27
  const BACKDROP: CSSProperties = {
@@ -50,7 +52,8 @@ const FIELD_CARD: CSSProperties = {
50
52
  display: 'flex', flexDirection: 'column', gap: 6,
51
53
  }
52
54
 
53
- const STEPS = ['Welcome', 'KiCad', 'SolidCraft'] as const
55
+ /** Step titles, in order (also the dot-strip tooltips and the counter label). */
56
+ const STEPS = COPY.wizard.steps
54
57
 
55
58
  /**
56
59
  * Dismissal remembered for the life of this client bundle, not one mount.
@@ -183,7 +186,7 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
183
186
  if (kicadRoot !== '') await saveInstallation('kicad', kicadRoot)
184
187
  if (solidcraftRoot !== '') await saveInstallation('solidcraft', solidcraftRoot)
185
188
  } catch (error) {
186
- setMessage(String(error))
189
+ setMessage(messageOf(error))
187
190
  setBusy(false)
188
191
  return
189
192
  }
@@ -218,20 +221,17 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
218
221
  createElement(
219
222
  'div',
220
223
  { style: { display: 'flex', flexDirection: 'column', gap: 1 } },
221
- createElement('h2', { style: TITLE }, 'Set up your hardware toolchain'),
222
- createElement('span', { style: STEP_LABEL }, 'one-time · skippable'),
224
+ createElement('h2', { style: TITLE }, COPY.wizard.welcomeTitle),
225
+ createElement('span', { style: STEP_LABEL }, COPY.wizard.welcomeKicker),
223
226
  ),
224
227
  ),
225
- createElement('p', { style: LEAD },
226
- 'Hardware Engineering previews KiCad projects, exports PCB 3D models, packages fabrication files and opens native files. Point it at your local installations once.'),
228
+ createElement('p', { style: LEAD }, COPY.wizard.welcomeLead),
227
229
  createElement('div',
228
230
  { style: FIELD_CARD },
229
- createElement('span', { style: { fontSize: 11, fontWeight: 600 } }, 'What it uses'),
230
- createElement('p', { style: { ...MUTED, color: C.text3 } },
231
- 'kicad-cli for previews, BOM, GLB and gerber/drill packaging. SolidCraft is shared with the agent as environment context only.'),
231
+ createElement('span', { style: { fontSize: 11, fontWeight: 600 } }, COPY.wizard.welcomeUsesTitle),
232
+ createElement('p', { style: { ...MUTED, color: C.text3 } }, COPY.wizard.welcomeUses),
232
233
  ),
233
- createElement('p', { style: { ...MUTED, color: C.text3 } },
234
- 'Only local executables are used. Nothing is uploaded, and nothing is installed for you.'),
234
+ createElement('p', { style: { ...MUTED, color: C.text3 } }, COPY.wizard.welcomeLocal),
235
235
  )
236
236
  }
237
237
  if (step === 1) {
@@ -241,19 +241,17 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
241
241
  createElement(
242
242
  'div',
243
243
  { style: SPREAD },
244
- createElement('h2', { style: TITLE }, 'KiCad installation'),
244
+ createElement('h2', { style: TITLE }, COPY.wizard.kicadTitle),
245
245
  createElement('span', { style: facts?.kicad?.configured === true ? pillStyle('ok') : pillStyle('muted') },
246
- facts?.kicad?.configured === true ? `v${facts.kicad.version ?? '?'}` : 'optional'),
246
+ facts?.kicad?.configured === true ? `v${facts.kicad.version ?? '?'}` : COPY.wizard.kicadOptional),
247
247
  ),
248
- createElement('p', { style: LEAD },
249
- 'Enter a KiCad installation folder or a kicad-cli path. It is used for .kicad_sch / .kicad_pcb previews, PCB GLB export, fabrication packaging, and “Open in KiCad”.'),
248
+ createElement('p', { style: LEAD }, COPY.wizard.kicadLead),
250
249
  createElement('input', {
251
250
  style: INPUT, value: kicadRoot, autoFocus: true, spellCheck: false,
252
- placeholder: 'C:\\Program Files\\KiCad\\8.0\\ or /usr/bin/kicad-cli',
251
+ placeholder: COPY.wizard.kicadPlaceholder,
253
252
  onChange: event => setKicadRoot(event.currentTarget.value),
254
253
  }),
255
- createElement('p', { style: { ...MUTED, color: C.text3 } },
256
- 'Leave it empty to skip. You can configure it later in Settings → Hardware Engineering.'),
254
+ createElement('p', { style: { ...MUTED, color: C.text3 } }, COPY.wizard.kicadSkipHint),
257
255
  )
258
256
  }
259
257
  return createElement(
@@ -262,14 +260,13 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
262
260
  createElement(
263
261
  'div',
264
262
  { style: SPREAD },
265
- createElement('h2', { style: TITLE }, 'SolidCraft installation'),
266
- createElement('span', { style: pillStyle('muted') }, 'optional'),
263
+ createElement('h2', { style: TITLE }, COPY.wizard.solidcraftTitle),
264
+ createElement('span', { style: pillStyle('muted') }, COPY.wizard.kicadOptional),
267
265
  ),
268
- createElement('p', { style: LEAD },
269
- 'SolidCraft is shared with the agent as environment context only in this POC — no native launch, no mechanical preview.'),
266
+ createElement('p', { style: LEAD }, COPY.wizard.solidcraftLead),
270
267
  createElement('input', {
271
268
  style: INPUT, value: solidcraftRoot, autoFocus: true, spellCheck: false,
272
- placeholder: 'C:\\Program Files\\SolidCraft\\bin\\SolidCraft.exe',
269
+ placeholder: COPY.wizard.solidcraftPlaceholder,
273
270
  onChange: event => setSolidcraftRoot(event.currentTarget.value),
274
271
  }),
275
272
  )
@@ -277,7 +274,7 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
277
274
 
278
275
  return createElement(
279
276
  'div',
280
- { style: BACKDROP, role: 'dialog', 'aria-modal': true, 'aria-label': 'Hardware Engineering setup', 'data-hardware-wizard': true },
277
+ { style: BACKDROP, role: 'dialog', 'aria-modal': true, 'aria-label': COPY.wizard.aria, 'data-hardware-wizard': true },
281
278
  createElement(
282
279
  'div',
283
280
  { style: PANEL },
@@ -292,20 +289,19 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
292
289
  style: { ...dotStyle(index === step ? C.accent : index < step ? C.ok : C.text3, 6) },
293
290
  title: label,
294
291
  })),
295
- createElement('span', { style: { ...STEP_LABEL, ...MONO_TEXT } }, `${String(step + 1)}/${String(STEPS.length)} · ${STEPS[step]}`),
292
+ createElement('span', { style: { ...STEP_LABEL, ...MONO_TEXT } }, COPY.wizard.stepCounter(step + 1, STEPS.length, STEPS[step] ?? '')),
296
293
  ),
297
294
  createElement('button', {
298
295
  type: 'button', style: buttonStyle('quiet', { fontSize: 10.5 }),
299
296
  onClick: () => { void complete() },
300
- }, 'Skip setup'),
297
+ }, COPY.wizard.skip),
301
298
  ),
302
299
  stepBody(),
303
300
  ...(message === '' ? [] : [createElement('p', { key: 'msg', style: { ...MUTED, color: C.text2 }, role: 'status' }, message)]),
304
301
  createElement(
305
302
  'div',
306
303
  { style: { ...SPREAD, paddingTop: 6, borderTop: `1px solid ${C.borderSoft}` } },
307
- createElement('span', { style: { ...MUTED, color: C.text3, fontSize: 10 } },
308
- 'You can change this any time in Settings → Hardware Engineering.'),
304
+ createElement('span', { style: { ...MUTED, color: C.text3, fontSize: 10 } }, COPY.wizard.footerNote),
309
305
  createElement(
310
306
  'span',
311
307
  { style: ROW },
@@ -313,12 +309,12 @@ export function OnboardingWizard(props: HardwareProps): ReactNode {
313
309
  ? createElement('button', {
314
310
  type: 'button', style: buttonStyle('secondary'),
315
311
  onClick: () => { setStep(step - 1) },
316
- }, 'Back')
312
+ }, COPY.wizard.back)
317
313
  : null,
318
314
  createElement('button', {
319
315
  type: 'button', style: buttonStyle('primary'), disabled: busy,
320
316
  onClick: () => { void next() },
321
- }, busy ? 'Saving…' : step === STEPS.length - 1 ? 'Finish' : 'Next'),
317
+ }, busy ? COPY.wizard.saving : step === STEPS.length - 1 ? COPY.wizard.finish : COPY.wizard.next),
322
318
  ),
323
319
  ),
324
320
  ),
package/src/index.ts CHANGED
@@ -13,9 +13,15 @@ export function apply(): void {}
13
13
  /** The tab kind owned by this product UI. */
14
14
  export const HARDWARE_TAB_KIND = 'hardware-engineering'
15
15
 
16
- /** Slots this product UI occupies. Exported for contract tests and readers. */
16
+ /**
17
+ * Slots this product UI occupies. Exported for contract tests and readers.
18
+ *
19
+ * `conversation.session.header.corner` is DSH's own expand button (we occupy
20
+ * nothing there); it is listed because the product depends on it. The
21
+ * conversation header carries no product navigation any more: the right panel's
22
+ * header is the only one.
23
+ */
17
24
  export const HARDWARE_UI_SLOTS = Object.freeze([
18
- 'conversation.header.leading',
19
25
  'conversation.session.header.corner',
20
26
  'sidebar.right.pane.tab',
21
27
  'settings.section',