@moonsand/dsh-ui-optimize 0.12.0 → 0.12.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.
Files changed (2) hide show
  1. package/client.js +64 -12
  2. package/package.json +3 -2
package/client.js CHANGED
@@ -137,9 +137,8 @@ window.__ModuleLoader__.load({
137
137
  'updates.section.blocked': 'Not loadable on this DSH',
138
138
  'updates.section.blockedHint': 'The running DSH version cannot load these releases. Upgrade DSH first, or wait for the plugin to publish a compatible one.',
139
139
  'updates.compatTag': 'Needs {version}',
140
- 'updates.applyStarted': 'Installing {n} more that were loaded — DSH restarts when that finishes, so this page drops for a moment.',
140
+ 'updates.applyStarted': '{n} loaded plugin(s) are queued: DSH stops once, installs the whole batch, then starts once — not one restart per plugin. The page reconnects on its own.',
141
141
  'updates.applyFailed': 'Could not start the background install. Try again in a moment.',
142
- 'updates.pendingStarting': 'Stopping DSH, installing, then starting again — the page reconnects on its own.',
143
142
  'updates.waitingRestart': 'waiting for restart',
144
143
  'updates.compatTagUnknown': 'Not loadable on this DSH',
145
144
  'updates.queued': 'Queued',
@@ -255,9 +254,8 @@ window.__ModuleLoader__.load({
255
254
  'updates.section.blocked': '与当前 DSH 不兼容',
256
255
  'updates.section.blockedHint': '当前运行的 DSH 版本加载不了这些版本。先升级 DSH,或等插件发布兼容版本。',
257
256
  'updates.compatTag': '需要 {version}',
258
- 'updates.applyStarted': '另外 {n} 个正在运行的插件已开始安装——装完会自动重启 DSH,页面会短暂断开,稍后刷新即可。',
257
+ 'updates.applyStarted': '{n} 个插件正在运行的,会一起停机安装:DSH 先退出、这批一次装完、再启动一次(不是每个插件重启一遍)。装完页面会自动重连。',
259
258
  'updates.applyFailed': '后台安装没能启动,稍后再试一次。',
260
- 'updates.pendingStarting': '正在停掉 DSH 安装新版本,随后自动启动——页面会自己重连。',
261
259
  'updates.waitingRestart': '等待重启',
262
260
  'updates.compatTagUnknown': '与当前 DSH 不兼容',
263
261
  'updates.queued': '排队中',
@@ -868,7 +866,18 @@ body:not([data-ds-dark-theme]) .dsuik-mc > .dsuik-mc-b{display:none;}
868
866
  const restartGate = featureGate('restart', env)
869
867
  /* The shelf also needs the slot API: without it the switch stays off and
870
868
  * says why, instead of offering something that cannot work. */
871
- const sidebarGate = slotsCoreApi
869
+ /* What the shelf actually needs is the slots *service* (entriesOfSlot);
870
+ * the resolveSlotLabel helper is a bonus for nicer labels. Gating on the
871
+ * module alone disabled the switch on hosts that do not expose it. */
872
+ let slotsService = null
873
+ try {
874
+ slotsService = ctx.slots || (typeof ctx.get === 'function' ? ctx.get('slots') : null)
875
+ } catch (err) {
876
+ slotsService = null
877
+ }
878
+ const shelfReady =
879
+ (slotsService && typeof slotsService.entriesOfSlot === 'function') || slotsCoreApi !== null
880
+ const sidebarGate = shelfReady
872
881
  ? featureGate('sidebar', env)
873
882
  : { available: false, reason: translate('sidebar.unavailable') }
874
883
 
@@ -1563,6 +1572,11 @@ body:not([data-ds-dark-theme]) .dsuik-mc > .dsuik-mc-b{display:none;}
1563
1572
  const SHELF_ID = 'muik-panels'
1564
1573
  const SHELF_ATTR = 'data-muik-shelf'
1565
1574
  const SHELF_ROW_ATTR = 'data-muik-shelf-row'
1575
+ /* The rows we need to hide live in the same list as our own row. Marking that
1576
+ * list is nesting-proof: earlier builds nested it two levels below the
1577
+ * sidebar root, newer ones deeper, and a fixed `> nav > *` selector silently
1578
+ * stopped matching — which showed the whole menu twice. */
1579
+ const SHELF_LIST_ATTR = 'data-muik-shelf-list'
1566
1580
 
1567
1581
  let slotsCoreApi = null
1568
1582
  try {
@@ -1580,6 +1594,7 @@ body:not([data-ds-dark-theme]) .dsuik-mc > .dsuik-mc-b{display:none;}
1580
1594
 
1581
1595
  const SHELF_CSS = `
1582
1596
  [${SHELF_ATTR}="on"] > nav > *:not([${SHELF_ROW_ATTR}]):not([data-muik-keep]){display:none!important}
1597
+ [${SHELF_LIST_ATTR}] > *:not([${SHELF_ROW_ATTR}]):not([data-muik-keep]){display:none!important}
1583
1598
  button.muik-shelf-row{display:flex;align-items:center;gap:10px;box-sizing:border-box;width:100%;height:36px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:13px;text-align:left;cursor:pointer}
1584
1599
  button.muik-shelf-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}
1585
1600
  button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4d6bfe);outline-offset:-2px}
@@ -1719,13 +1734,41 @@ button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-prim
1719
1734
  // label itself, so the row to mark is that wrapper — not our glyph.
1720
1735
  const row = glyph && typeof glyph.closest === 'function' ? glyph.closest('button') : null
1721
1736
  if (!row) return undefined
1722
- const nav = row.parentElement
1737
+ /* Newer shells wrap every row in its own element (`panelEntry` in
1738
+ * 0.2.2-rc.3), so `row.parentElement` is a one-child wrapper, not the
1739
+ * list. Walk up through single-child wrappers to find the real list:
1740
+ * hiding that list's other children is what folds the menu. */
1741
+ /* The list is a real <nav>; anchors beat guessing wrapper depth.
1742
+ * Rows now live inside `panelEntry` divs that also hold an unpin
1743
+ * button, so counting children never finds the list. */
1744
+ const navElement = typeof row.closest === 'function' ? row.closest('nav') : null
1745
+ let entry = row
1746
+ if (navElement) {
1747
+ for (const child of Array.from(navElement.children)) {
1748
+ if (child !== row && child.contains(row)) {
1749
+ entry = child
1750
+ break
1751
+ }
1752
+ }
1753
+ } else {
1754
+ for (let depth = 0; depth < 5; depth += 1) {
1755
+ const parent = entry.parentElement
1756
+ if (!parent || parent.children.length !== 1) break
1757
+ entry = parent
1758
+ }
1759
+ }
1760
+ const list = navElement || entry.parentElement
1761
+ const nav = list || row.parentElement
1723
1762
  const root = nav ? nav.parentElement : null
1724
1763
  if (!root) return undefined
1725
1764
  rowRef.current = row
1726
1765
  row.setAttribute(SHELF_ROW_ATTR, '')
1766
+ /* The wrapper has to survive too: hiding it would take our row with it. */
1767
+ if (entry !== row) entry.setAttribute(SHELF_ROW_ATTR, '')
1727
1768
  row.style.display = enabled ? '' : 'none'
1728
1769
  root.setAttribute(SHELF_ATTR, enabled ? 'on' : 'off')
1770
+ if (enabled) nav.setAttribute(SHELF_LIST_ATTR, '')
1771
+ else nav.removeAttribute(SHELF_LIST_ATTR)
1729
1772
 
1730
1773
  // The shell appends its own "More" row after the registered rows, and its
1731
1774
  // menu holds content that is not a panellist entry. Hiding that row would
@@ -1736,7 +1779,7 @@ button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-prim
1736
1779
  if (actions.length > 0) {
1737
1780
  const kids = nav.children
1738
1781
  for (let i = kids.length - 1; i >= 0; i -= 1) {
1739
- if (kids[i] !== row) {
1782
+ if (kids[i] !== row && kids[i] !== entry) {
1740
1783
  keepRow = kids[i]
1741
1784
  // Kept visible on purpose. The shell's More menu only opens from a
1742
1785
  // trusted click: synthetic click(), full pointer sequences and a
@@ -2354,11 +2397,16 @@ button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-prim
2354
2397
  const installed = (listed.value || []).filter(function (item) {
2355
2398
  return item && item.installed === true
2356
2399
  })
2357
- /* `updatable` is the Host's own verdict: a registry dependency saved
2358
- * under its own name with a semver version. Links and local paths are
2359
- * excluded for us — updating those would overwrite the checkout. */
2400
+ /* The Host's own verdict on whether this bundle can be replaced from a
2401
+ * registry. Newer hosts (0.2.2-rc.5+) dropped the boolean `updatable`
2402
+ * for `update: 'registry' | 'git'`; keep both so the list does not go
2403
+ * empty on either side. Links and local paths stay excluded — updating
2404
+ * those would overwrite the checkout. */
2360
2405
  const candidates = installed.filter(function (item) {
2361
- return item.updatable === true && typeof item.version === 'string' && item.version !== ''
2406
+ if (!item || typeof item.version !== 'string' || item.version === '') return false
2407
+ if (item.update === 'registry') return true
2408
+ if (item.update === 'git') return false
2409
+ return item.updatable === true
2362
2410
  })
2363
2411
  const found = []
2364
2412
  const stats = { tried: 0, failed: 0 }
@@ -3136,8 +3184,12 @@ button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-prim
3136
3184
  /* The host answers 202 before pnpm starts, so show the batch as in
3137
3185
  * flight right away — otherwise the click looks like a no-op until
3138
3186
  * the page reloads under the new DSH process. */
3187
+ /* No per-row sentence here: the batch is one restart for all of
3188
+ * them, so repeating "stopping DSH..." on every card reads like
3189
+ * each plugin reboots the host on its own. The line under the
3190
+ * batch says it once. */
3139
3191
  pendingRows.forEach(function (row) {
3140
- patch(row.name, { state: 'applied', percent: null, detail: translate('updates.pendingStarting') })
3192
+ patch(row.name, { state: 'applied', percent: null, detail: '' })
3141
3193
  })
3142
3194
  } catch (err) {
3143
3195
  applyFailed = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonsand/dsh-ui-optimize",
3
- "version": "0.12.0",
3
+ "version": "0.12.3",
4
4
  "type": "module",
5
5
  "description": "Switches that tune how DeepSeek Harness looks and behaves across the whole interface, not just a few screens — each works on its own and more arrive as the shell grows: an eight-theme minimalist gallery, sidebar panel folding, and reload/restart buttons at the sidebar foot. · 调 DeepSeek Harness 整体观感与操作的开关集合,管的是整套界面而不只是某几块;每个开关独立生效,随宿主能力增长继续增加:8 套极简主题画廊、侧栏面板收纳,以及侧栏底部的刷新界面与重启应用按钮。",
6
6
  "license": "MIT",
@@ -50,7 +50,8 @@
50
50
  "platform": "web",
51
51
  "immediately": true,
52
52
  "inject": [
53
- "@deepseek-ai/dsh-api-remotes"
53
+ "@deepseek-ai/dsh-api-remotes",
54
+ "@deepseek-ai/dsh-client-ui-slots"
54
55
  ]
55
56
  }
56
57
  }