@iasiv5/dsh-skins 1.5.5 → 1.5.6

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 +45 -4
  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) {
@@ -1850,7 +1874,11 @@ ${names}`,
1850
1874
  jsx("path", { d: "M8 21h8M12 17v4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
1851
1875
  ] });
1852
1876
  }
1853
- function SidebarAction({ wide, t }) {
1877
+ function SidebarAction(props) {
1878
+ if (shellTakeover()) return null;
1879
+ return jsx(SidebarActionBody, props);
1880
+ }
1881
+ function SidebarActionBody({ wide, t }) {
1854
1882
  const tr = typeof t === "function" ? (key, params) => t(key, params) : fallbackTranslate;
1855
1883
  const [open, setOpen] = react.useState(false);
1856
1884
  const [activeId, setActiveId] = react.useState(runtime.active);
@@ -2053,9 +2081,22 @@ ${names}`,
2053
2081
  };
2054
2082
  }
2055
2083
  }, "dsh-skins: sidebar switcher dictionary");
2084
+ const shellTakeover = () => {
2085
+ try {
2086
+ return (ctx.slots.entries?.("sidebar.workspaces") ?? []).some((entry) => (entry.options.priority ?? 0) < 0);
2087
+ } catch {
2088
+ return false;
2089
+ }
2090
+ };
2056
2091
  ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
2057
2092
  name: "sidebar.footer.action",
2058
2093
  id: "skins-switcher",
2094
+ // Footer order stays at the positive utility seat (4): the bot view is
2095
+ // handled by the shell-takeover sentinel below (we render nothing there),
2096
+ // so order only sorts the PLAIN harness foot — where the DS Bot entry
2097
+ // (-200) belongs ABOVE these utility rows (ruling 2026-10-13: a deep
2098
+ // negative order was tried and reverted because it sank the DS Bot entry
2099
+ // to the bottom of the harness foot).
2059
2100
  order: 4,
2060
2101
  locale: NS,
2061
2102
  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.6",
5
5
  "homepage": "https://github.com/iasiv5/dsh-skins#readme",
6
6
  "repository": {
7
7
  "type": "git",