dsh-custom-theme 0.1.1 → 0.1.2
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 +7 -4
- package/lib/client.js +34 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -392,10 +392,13 @@ button: no code is swapped until you click it.
|
|
|
392
392
|
**Where it shows up.** Both surfaces read the same cached answer:
|
|
393
393
|
|
|
394
394
|
- A row on **设置 → 主题与背景**, next to the theme and background pickers.
|
|
395
|
-
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
- Three contributions to the plugin manager's own page for this bundle, each with one
|
|
396
|
+
job: **升级** in the page's actions area beside the enable switch and uninstall, an
|
|
397
|
+
*Update available* badge beside the title, and a section under the page's content
|
|
398
|
+
carrying the version detail and **检查更新**. All three are drawn only when a newer
|
|
399
|
+
release exists, and every other plugin's page is untouched — an entry renders nothing
|
|
400
|
+
for a subject it has nothing to say about. The upgrade button lives in one place, so
|
|
401
|
+
the section does not repeat it.
|
|
399
402
|
|
|
400
403
|
**Upgrading.** **升级** installs the exact version the check resolved, through the
|
|
401
404
|
plugin manager's own `installBundle`, so the profile's lockfile and bundle list stay
|
package/lib/client.js
CHANGED
|
@@ -1362,15 +1362,17 @@ window.__ModuleLoader__.load({
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
/**
|
|
1365
|
-
* The update controls, rendered
|
|
1366
|
-
*
|
|
1367
|
-
* @param props - `t
|
|
1365
|
+
* The update controls, rendered as a row on this card and as a section on the
|
|
1366
|
+
* plugin manager's page for this bundle.
|
|
1367
|
+
* @param props - `t`; `as`, the element and class the controls sit in; and
|
|
1368
|
+
* `primary`, which drops the upgrade button where the page's own actions area
|
|
1369
|
+
* already carries it, so the same button is never drawn twice on one page.
|
|
1368
1370
|
*/
|
|
1369
|
-
function UpdateRow({ t, as = 'row' }) {
|
|
1371
|
+
function UpdateRow({ t, as = 'row', primary = true }) {
|
|
1370
1372
|
const snapshot = useUpdate()
|
|
1371
1373
|
const busy = snapshot.phase === 'loading' || snapshot.phase === 'applying'
|
|
1372
1374
|
const controls = [
|
|
1373
|
-
canUpgrade(snapshot) ? h('button', {
|
|
1375
|
+
primary && canUpgrade(snapshot) ? h('button', {
|
|
1374
1376
|
key: 'upgrade',
|
|
1375
1377
|
type: 'button',
|
|
1376
1378
|
className: 'dct-button dct-upgrade',
|
|
@@ -1415,10 +1417,28 @@ window.__ModuleLoader__.load({
|
|
|
1415
1417
|
return h('span', { className: 'dct-update-badge' }, `${t('updateBadge')} ${snapshot.state.latest}`)
|
|
1416
1418
|
}
|
|
1417
1419
|
|
|
1420
|
+
/**
|
|
1421
|
+
* The upgrade button in the plugin page's own actions area, beside its enable
|
|
1422
|
+
* switch and uninstall. Drawn only for this bundle and only when a newer release
|
|
1423
|
+
* exists, so every other plugin's page is left exactly as the shell built it.
|
|
1424
|
+
*/
|
|
1425
|
+
function PluginUpdateAction({ subject, t }) {
|
|
1426
|
+
const snapshot = useUpdate()
|
|
1427
|
+
if (!isOwnBundle(subject)) return null
|
|
1428
|
+
if (!canUpgrade(snapshot)) return null
|
|
1429
|
+
const busy = snapshot.phase === 'loading' || snapshot.phase === 'applying'
|
|
1430
|
+
return h('button', {
|
|
1431
|
+
type: 'button',
|
|
1432
|
+
className: 'dct-button dct-upgrade',
|
|
1433
|
+
disabled: busy,
|
|
1434
|
+
onClick: () => { applyUpdateNow() },
|
|
1435
|
+
}, snapshot.phase === 'applying' ? t('updateUpgrading') : `${t('updateUpgrade')} ${snapshot.state.latest}`)
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1418
1438
|
/** The update section under the plugin page's own content. */
|
|
1419
1439
|
function PluginUpdateSection({ subject, t }) {
|
|
1420
1440
|
if (!isOwnBundle(subject)) return null
|
|
1421
|
-
return h(UpdateRow, { t, as: 'section' })
|
|
1441
|
+
return h(UpdateRow, { t, as: 'section', primary: false })
|
|
1422
1442
|
}
|
|
1423
1443
|
|
|
1424
1444
|
function ThemeRow({ t }) {
|
|
@@ -1695,6 +1715,14 @@ window.__ModuleLoader__.load({
|
|
|
1695
1715
|
* newer release is worth mentioning. Both entries render null for any other
|
|
1696
1716
|
* subject; the page's own version and switch stay untouched.
|
|
1697
1717
|
*/
|
|
1718
|
+
ctx.slots.inject('plugins.detail.actions', () => ctx.slots.register({
|
|
1719
|
+
name: 'plugins.detail.actions',
|
|
1720
|
+
id: 'dsh-custom-theme-update',
|
|
1721
|
+
order: 40,
|
|
1722
|
+
label: () => ctx.locale.bind(LOCALE_NS)('updateTitle'),
|
|
1723
|
+
locale: LOCALE_NS,
|
|
1724
|
+
}, PluginUpdateAction))
|
|
1725
|
+
|
|
1698
1726
|
ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
|
|
1699
1727
|
name: 'plugins.detail.badge',
|
|
1700
1728
|
id: 'dsh-custom-theme-update',
|
package/package.json
CHANGED