@iasiv5/dsh-skins 1.5.5 → 1.5.7

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/lib/client.js +58 -7
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -587,6 +587,30 @@
587
587
  return `${selector}{${light.join(";")}}
588
588
  ${darkSelector}{${dark.join(";")}}`;
589
589
  }
590
+ const BRAND_PRIORITY_BASE = -20;
591
+ function occupantPriorities(name) {
592
+ try {
593
+ return (ctx.slots.entries?.(name) ?? []).map((entry) => entry.options.priority ?? 0);
594
+ } catch {
595
+ return [];
596
+ }
597
+ }
598
+ function registerBrandSeat(name, component) {
599
+ for (let attempt = 0; attempt < 4; attempt += 1) {
600
+ const taken = occupantPriorities(name);
601
+ const floor = taken.length > 0 ? Math.min(...taken) - 1 : BRAND_PRIORITY_BASE;
602
+ const priority = Math.min(BRAND_PRIORITY_BASE, floor);
603
+ try {
604
+ return ctx.slots.register({ name, priority }, component);
605
+ } catch (error) {
606
+ if (!/already has a registration/.test(String(error?.message ?? error))) throw error;
607
+ console.warn(`[dsh-skins] brand seat "${name}" priority ${priority} taken; retrying deeper`);
608
+ }
609
+ }
610
+ console.warn(`[dsh-skins] brand seat "${name}" stays with its occupant; skin mounts without it`);
611
+ return () => {
612
+ };
613
+ }
590
614
  function buildEffects(skin, effects) {
591
615
  if (!ctx) throw new Error("[dsh-skins] mount before apply");
592
616
  const body = document.body;
@@ -606,9 +630,9 @@ ${darkSelector}{${dark.join(";")}}`;
606
630
  "sidebar.brand.name",
607
631
  () => ctx.slots.inject("conversation.hero.brand.mark", () => {
608
632
  const registrations = [
609
- ctx.slots.register({ name: "sidebar.brand.mark", priority: -10 }, skin.Mark),
610
- ctx.slots.register({ name: "sidebar.brand.name", priority: -10 }, skin.Name),
611
- ctx.slots.register({ name: "conversation.hero.brand.mark", priority: -10 }, skin.Mark)
633
+ registerBrandSeat("sidebar.brand.mark", skin.Mark),
634
+ registerBrandSeat("sidebar.brand.name", skin.Name),
635
+ registerBrandSeat("conversation.hero.brand.mark", skin.Mark)
612
636
  ];
613
637
  return () => {
614
638
  for (let index = registrations.length - 1; index >= 0; index -= 1) {
@@ -1679,7 +1703,13 @@ ${names}`,
1679
1703
  // 毛玻璃弹层(dsh-quota-watch 同款配方):86% 不透明底 + blur14 提饱和,
1680
1704
  // 下层文字被底色盖住、只余柔光,弹层文字保持清晰可读;首条 solid 声明
1681
1705
  // 兜底不支持 color-mix 的浏览器。
1682
- ".dsh-skins-pop{position:fixed;z-index:60;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;width:min(390px,calc(100vw - 24px));max-height:calc(100vh - 24px);padding:14px;border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-elevated,var(--dsw-alias-bg-overlay));background:color-mix(in srgb,var(--dsw-alias-bg-base,#1f1f1f) 86%,transparent);backdrop-filter:blur(14px) saturate(1.3);-webkit-backdrop-filter:blur(14px) saturate(1.3);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.14));overflow-y:auto;transition:width .2s ease-out}",
1706
+ // Width term reserves 16px margins per side on sub-414px viewports (the
1707
+ // 390px cap keeps every wider viewport untouched). The old 24px term left
1708
+ // only ~10px of right margin once the trigger-anchored left offset was
1709
+ // paid, and — combined with the fixed 360px list column — clipped the
1710
+ // gear column at the pop's own edge on phones (field report 2026-10-14:
1711
+ // 手机上齿轮被截半 + 横向滚动条).
1712
+ ".dsh-skins-pop{position:fixed;z-index:60;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;width:min(390px,calc(100vw - 32px));max-height:calc(100vh - 24px);padding:14px;border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-elevated,var(--dsw-alias-bg-overlay));background:color-mix(in srgb,var(--dsw-alias-bg-base,#1f1f1f) 86%,transparent);backdrop-filter:blur(14px) saturate(1.3);-webkit-backdrop-filter:blur(14px) saturate(1.3);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.14));overflow-y:auto;transition:width .2s ease-out}",
1683
1713
  // Slim themed scrollbars for the shell's own scroll region (list-only
1684
1714
  // popover): thin + token-colored thumb, WebKit and Firefox both covered.
1685
1715
  ".dsh-skins-pop{scrollbar-width:thin;scrollbar-color:var(--dsw-alias-border-l2) transparent}",
@@ -1725,7 +1755,11 @@ ${names}`,
1725
1755
  "body[data-ds-dark-theme]:not([data-dsh-meirenzhi-skin]):not([data-dsh-openbmc-skin]):not([data-dsh-uefi-harness]) .dsh-skins-pop{background:rgba(41,42,44,0.97)}",
1726
1756
  // -- combined shell (Q44/Q46): list column + docked panel column ----------
1727
1757
  ".dsh-skins-pop.dsh-skins-wide{flex-direction:row;align-items:stretch;width:min(1105px,calc(100vw - 24px))}",
1728
- ".dsh-skins-pop-main{display:flex;flex-direction:column;gap:8px;min-width:0;width:360px;flex:none}",
1758
+ // List column: exactly 360px wherever the 390px narrow shell fits (the
1759
+ // v2.5 宽度恒定 ruling #10/#11), shrinking only BELOW a 414px viewport —
1760
+ // a fixed 360px column inside a narrower pop overflowed horizontally and
1761
+ // pushed the gear column behind the pop's right edge (same field report).
1762
+ ".dsh-skins-pop-main{display:flex;flex-direction:column;gap:8px;min-width:0;width:min(360px,100%);flex:none}",
1729
1763
  ".dsh-skins-pop.dsh-skins-wide .dsh-skins-pop-main{flex:0 0 360px}",
1730
1764
  // box-sizing is NOT inherited: without border-box here, the sweep's
1731
1765
  // measured rect width feeds flex-basis as a CONTENT width (+15px padding/
@@ -1850,7 +1884,11 @@ ${names}`,
1850
1884
  jsx("path", { d: "M8 21h8M12 17v4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
1851
1885
  ] });
1852
1886
  }
1853
- function SidebarAction({ wide, t }) {
1887
+ function SidebarAction(props) {
1888
+ if (shellTakeover()) return null;
1889
+ return jsx(SidebarActionBody, props);
1890
+ }
1891
+ function SidebarActionBody({ wide, t }) {
1854
1892
  const tr = typeof t === "function" ? (key, params) => t(key, params) : fallbackTranslate;
1855
1893
  const [open, setOpen] = react.useState(false);
1856
1894
  const [activeId, setActiveId] = react.useState(runtime.active);
@@ -1977,7 +2015,7 @@ ${names}`,
1977
2015
  });
1978
2016
  const showPersonalization = personalizeId !== null && PersonalizationPanel !== null;
1979
2017
  const stackedSheet = showPersonalization && typeof window !== "undefined" && window.innerWidth <= 904;
1980
- const shellLeft = box === null ? void 0 : showPersonalization && typeof window !== "undefined" ? Math.max(12, Math.min(box.left, window.innerWidth - 1117)) : box.left;
2018
+ const shellLeft = box === null ? void 0 : showPersonalization && typeof window !== "undefined" ? Math.max(12, Math.min(box.left, window.innerWidth - 1117)) : typeof window !== "undefined" ? Math.max(16, Math.min(box.left, window.innerWidth - Math.min(390, window.innerWidth - 32) - 16)) : box.left;
1981
2019
  const shellMaxHeight = box === null || typeof window === "undefined" || typeof window.innerHeight !== "number" ? void 0 : stackedSheet ? window.innerHeight - 24 : Math.max(220, window.innerHeight - box.bottom - 12);
1982
2020
  react.useLayoutEffect(() => {
1983
2021
  if (!open || box === null) return void 0;
@@ -2053,9 +2091,22 @@ ${names}`,
2053
2091
  };
2054
2092
  }
2055
2093
  }, "dsh-skins: sidebar switcher dictionary");
2094
+ const shellTakeover = () => {
2095
+ try {
2096
+ return (ctx.slots.entries?.("sidebar.workspaces") ?? []).some((entry) => (entry.options.priority ?? 0) < 0);
2097
+ } catch {
2098
+ return false;
2099
+ }
2100
+ };
2056
2101
  ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
2057
2102
  name: "sidebar.footer.action",
2058
2103
  id: "skins-switcher",
2104
+ // Footer order stays at the positive utility seat (4): the bot view is
2105
+ // handled by the shell-takeover sentinel below (we render nothing there),
2106
+ // so order only sorts the PLAIN harness foot — where the DS Bot entry
2107
+ // (-200) belongs ABOVE these utility rows (ruling 2026-10-13: a deep
2108
+ // negative order was tried and reverted because it sank the DS Bot entry
2109
+ // to the bottom of the harness foot).
2059
2110
  order: 4,
2060
2111
  locale: NS,
2061
2112
  label: () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iasiv5/dsh-skins",
3
3
  "description": "DSH Web 皮肤插件:多套品牌皮肤侧栏热切换。",
4
- "version": "1.5.5",
4
+ "version": "1.5.7",
5
5
  "homepage": "https://github.com/iasiv5/dsh-skins#readme",
6
6
  "repository": {
7
7
  "type": "git",