@moonsand/dsh-ui-optimize 0.12.0 → 0.12.1

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 +35 -3
  2. package/package.json +3 -2
package/client.js CHANGED
@@ -868,7 +868,18 @@ body:not([data-ds-dark-theme]) .dsuik-mc > .dsuik-mc-b{display:none;}
868
868
  const restartGate = featureGate('restart', env)
869
869
  /* The shelf also needs the slot API: without it the switch stays off and
870
870
  * says why, instead of offering something that cannot work. */
871
- const sidebarGate = slotsCoreApi
871
+ /* What the shelf actually needs is the slots *service* (entriesOfSlot);
872
+ * the resolveSlotLabel helper is a bonus for nicer labels. Gating on the
873
+ * module alone disabled the switch on hosts that do not expose it. */
874
+ let slotsService = null
875
+ try {
876
+ slotsService = ctx.slots || (typeof ctx.get === 'function' ? ctx.get('slots') : null)
877
+ } catch (err) {
878
+ slotsService = null
879
+ }
880
+ const shelfReady =
881
+ (slotsService && typeof slotsService.entriesOfSlot === 'function') || slotsCoreApi !== null
882
+ const sidebarGate = shelfReady
872
883
  ? featureGate('sidebar', env)
873
884
  : { available: false, reason: translate('sidebar.unavailable') }
874
885
 
@@ -1563,6 +1574,11 @@ body:not([data-ds-dark-theme]) .dsuik-mc > .dsuik-mc-b{display:none;}
1563
1574
  const SHELF_ID = 'muik-panels'
1564
1575
  const SHELF_ATTR = 'data-muik-shelf'
1565
1576
  const SHELF_ROW_ATTR = 'data-muik-shelf-row'
1577
+ /* The rows we need to hide live in the same list as our own row. Marking that
1578
+ * list is nesting-proof: earlier builds nested it two levels below the
1579
+ * sidebar root, newer ones deeper, and a fixed `> nav > *` selector silently
1580
+ * stopped matching — which showed the whole menu twice. */
1581
+ const SHELF_LIST_ATTR = 'data-muik-shelf-list'
1566
1582
 
1567
1583
  let slotsCoreApi = null
1568
1584
  try {
@@ -1580,6 +1596,7 @@ body:not([data-ds-dark-theme]) .dsuik-mc > .dsuik-mc-b{display:none;}
1580
1596
 
1581
1597
  const SHELF_CSS = `
1582
1598
  [${SHELF_ATTR}="on"] > nav > *:not([${SHELF_ROW_ATTR}]):not([data-muik-keep]){display:none!important}
1599
+ [${SHELF_LIST_ATTR}] > *:not([${SHELF_ROW_ATTR}]):not([data-muik-keep]){display:none!important}
1583
1600
  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
1601
  button.muik-shelf-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}
1585
1602
  button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4d6bfe);outline-offset:-2px}
@@ -1719,13 +1736,28 @@ button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-prim
1719
1736
  // label itself, so the row to mark is that wrapper — not our glyph.
1720
1737
  const row = glyph && typeof glyph.closest === 'function' ? glyph.closest('button') : null
1721
1738
  if (!row) return undefined
1722
- const nav = row.parentElement
1739
+ /* Newer shells wrap every row in its own element (`panelEntry` in
1740
+ * 0.2.2-rc.3), so `row.parentElement` is a one-child wrapper, not the
1741
+ * list. Walk up through single-child wrappers to find the real list:
1742
+ * hiding that list's other children is what folds the menu. */
1743
+ let entry = row
1744
+ for (let depth = 0; depth < 5; depth += 1) {
1745
+ const parent = entry.parentElement
1746
+ if (!parent || parent.children.length !== 1) break
1747
+ entry = parent
1748
+ }
1749
+ const list = entry.parentElement
1750
+ const nav = list || row.parentElement
1723
1751
  const root = nav ? nav.parentElement : null
1724
1752
  if (!root) return undefined
1725
1753
  rowRef.current = row
1726
1754
  row.setAttribute(SHELF_ROW_ATTR, '')
1755
+ /* The wrapper has to survive too: hiding it would take our row with it. */
1756
+ if (entry !== row) entry.setAttribute(SHELF_ROW_ATTR, '')
1727
1757
  row.style.display = enabled ? '' : 'none'
1728
1758
  root.setAttribute(SHELF_ATTR, enabled ? 'on' : 'off')
1759
+ if (enabled) nav.setAttribute(SHELF_LIST_ATTR, '')
1760
+ else nav.removeAttribute(SHELF_LIST_ATTR)
1729
1761
 
1730
1762
  // The shell appends its own "More" row after the registered rows, and its
1731
1763
  // menu holds content that is not a panellist entry. Hiding that row would
@@ -1736,7 +1768,7 @@ button.muik-shelf-row:focus-visible{outline:2px solid var(--dsw-alias-brand-prim
1736
1768
  if (actions.length > 0) {
1737
1769
  const kids = nav.children
1738
1770
  for (let i = kids.length - 1; i >= 0; i -= 1) {
1739
- if (kids[i] !== row) {
1771
+ if (kids[i] !== row && kids[i] !== entry) {
1740
1772
  keepRow = kids[i]
1741
1773
  // Kept visible on purpose. The shell's More menu only opens from a
1742
1774
  // trusted click: synthetic click(), full pointer sequences and a
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.1",
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
  }