@objectivex666/dsh-settings-search 1.4.1 → 1.4.3
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/README.md +2 -0
- package/lib/client.js +12 -8
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
|
|
31
31
|
const NS = 'settings-search-v5'
|
|
32
32
|
/** Single source of truth is package.json — scripts/check.mjs asserts this matches. */
|
|
33
|
-
const PKG_VERSION = '1.4.
|
|
33
|
+
const PKG_VERSION = '1.4.3'
|
|
34
34
|
const NPM_NAME = '@objectivex666/dsh-settings-search'
|
|
35
35
|
const zh = {
|
|
36
36
|
title: '设置',
|
|
@@ -52,6 +52,7 @@ window.__ModuleLoader__.load({
|
|
|
52
52
|
updErr: '检查失败(网络或注册表不可达),请稍后重试。',
|
|
53
53
|
updCopy: '复制命令',
|
|
54
54
|
updCopied: '已复制 ✓',
|
|
55
|
+
updCopyFail: '复制失败,请长按上方命令手动复制。',
|
|
55
56
|
}
|
|
56
57
|
const en = {
|
|
57
58
|
title: 'Settings',
|
|
@@ -73,6 +74,7 @@ window.__ModuleLoader__.load({
|
|
|
73
74
|
updErr: 'Check failed (network or registry unreachable). Try again later.',
|
|
74
75
|
updCopy: 'Copy command',
|
|
75
76
|
updCopied: 'Copied ✓',
|
|
77
|
+
updCopyFail: 'Copy failed — please long-press the command above.',
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
/** Inner-row slots that represent specific options inside one page. */
|
|
@@ -302,8 +304,6 @@ window.__ModuleLoader__.load({
|
|
|
302
304
|
const buttons = panelButtons()
|
|
303
305
|
const textOf = (b) => (b.textContent ?? '').trim()
|
|
304
306
|
const hit = buttons.find((b) => textOf(b) === want)
|
|
305
|
-
?? buttons.find((b) => textOf(b).startsWith(want))
|
|
306
|
-
?? buttons.find((b) => want.length >= 2 && textOf(b) !== '' && (textOf(b).includes(want) || want.includes(textOf(b))))
|
|
307
307
|
if (!hit) return false
|
|
308
308
|
hit.click()
|
|
309
309
|
return true
|
|
@@ -319,11 +319,12 @@ window.__ModuleLoader__.load({
|
|
|
319
319
|
/** Jump to an in-page option: open its page, select its tab, flash its row. */
|
|
320
320
|
const jumpToOption = async (item) => {
|
|
321
321
|
const opened = await Promise.resolve(clickNavButton(item.parentLabel))
|
|
322
|
+
if (opened !== true) { flashOptionRow(item); return false }
|
|
322
323
|
await delay(160)
|
|
323
324
|
const label = item.label
|
|
324
325
|
const buttons = panelButtons()
|
|
325
|
-
const tab = buttons.find((b) =>
|
|
326
|
-
|
|
326
|
+
const tab = buttons.find((b) =>
|
|
327
|
+
b.getAttribute('role') === 'tab' && (b.textContent ?? '').trim() === label)
|
|
327
328
|
if (tab) { tab.click(); await delay(120) }
|
|
328
329
|
flashOptionRow(item)
|
|
329
330
|
return opened
|
|
@@ -514,16 +515,18 @@ window.__ModuleLoader__.load({
|
|
|
514
515
|
const [state, setState] = React.useState('idle') // idle | loading | newest | outdated | error
|
|
515
516
|
const [latest, setLatest] = React.useState('')
|
|
516
517
|
const [copied, setCopied] = React.useState(false)
|
|
518
|
+
const [copyFailed, setCopyFailed] = React.useState(false)
|
|
517
519
|
|
|
518
520
|
React.useEffect(() => {
|
|
519
521
|
if (!copied) return
|
|
520
|
-
const off = setTimeout(() => setCopied(false), 1600)
|
|
522
|
+
const off = setTimeout(() => { setCopied(false); setCopyFailed(false) }, 1600)
|
|
521
523
|
return () => clearTimeout(off)
|
|
522
524
|
}, [copied])
|
|
523
525
|
|
|
524
526
|
const check = async () => {
|
|
525
527
|
setState('loading')
|
|
526
528
|
setCopied(false)
|
|
529
|
+
setCopyFailed(false)
|
|
527
530
|
try {
|
|
528
531
|
const res = await fetch(`https://registry.npmjs.org/${NPM_NAME}/latest?t=${Date.now()}`)
|
|
529
532
|
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
|
@@ -539,7 +542,7 @@ window.__ModuleLoader__.load({
|
|
|
539
542
|
|
|
540
543
|
const copyCmd = async () => {
|
|
541
544
|
const cmd = `dsh plugin update ${NPM_NAME}`
|
|
542
|
-
try { await navigator.clipboard.writeText(cmd); setCopied(true) } catch {
|
|
545
|
+
try { await navigator.clipboard.writeText(cmd); setCopied(true); setCopyFailed(false) } catch { setCopyFailed(true) }
|
|
543
546
|
}
|
|
544
547
|
|
|
545
548
|
const statusNode = {
|
|
@@ -552,7 +555,8 @@ window.__ModuleLoader__.load({
|
|
|
552
555
|
React.createElement('code', { className: 'sss-cmd' }, `dsh plugin update ${NPM_NAME}`),
|
|
553
556
|
React.createElement('div', null,
|
|
554
557
|
React.createElement('button', { className: 'sss-btn', type: 'button', onClick: () => { void copyCmd() } },
|
|
555
|
-
copied ? t('updCopied') : t('updCopy'))
|
|
558
|
+
copied ? t('updCopied') : t('updCopy')),
|
|
559
|
+
copyFailed ? React.createElement('p', { className: 'sss-upd-note', style: { color: 'var(--dsw-alias-label-danger)' } }, t('updCopyFail')) : null),
|
|
556
560
|
]),
|
|
557
561
|
}
|
|
558
562
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectivex666/dsh-settings-search",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "DSH settings panel search plugin – instantly filter setting sections and general items with navigation guidance. Installable via `dsh plugin add`.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|