@iasiv5/dsh-skins 1.5.4 → 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 +66 -13
  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) {
@@ -871,8 +895,10 @@ ${darkSelector}{${dark.join(";")}}`;
871
895
  "personalization.confirmTitle": "确认操作",
872
896
  "personalization.confirm": "确认",
873
897
  "personalization.cancel": "取消",
874
- "personalization.resetJoin": "、",
875
- "personalization.resetConfirm": "以下设置将恢复为出厂默认:\n{fields}\n此操作立即生效,确认继续吗?",
898
+ "personalization.resetJoin": "\n• ",
899
+ "personalization.resetConfirm": "以下设置将恢复为出厂默认:\n\n{fields}\n\n此操作立即生效,确认继续吗?",
900
+ "personalization.resetConfirmIntro": "以下设置将恢复为出厂默认:",
901
+ "personalization.resetConfirmOutro": "此操作立即生效,确认继续吗?",
876
902
  "personalization.light": "浅色",
877
903
  "personalization.dark": "深色",
878
904
  "personalization.builtin": "内置画作",
@@ -942,8 +968,10 @@ ${darkSelector}{${dark.join(";")}}`;
942
968
  "personalization.confirmTitle": "Confirm action",
943
969
  "personalization.confirm": "Confirm",
944
970
  "personalization.cancel": "Cancel",
945
- "personalization.resetJoin": ", ",
946
- "personalization.resetConfirm": "These settings will be reset to factory defaults:\n{fields}\nThis takes effect immediately. Continue?",
971
+ "personalization.resetJoin": "\n• ",
972
+ "personalization.resetConfirm": "These settings will be reset to factory defaults:\n\n{fields}\n\nThis takes effect immediately. Continue?",
973
+ "personalization.resetConfirmIntro": "These settings will be reset to factory defaults:",
974
+ "personalization.resetConfirmOutro": "This takes effect immediately. Continue?",
947
975
  "personalization.light": "Light",
948
976
  "personalization.dark": "Dark",
949
977
  "personalization.builtin": "Built-in artwork",
@@ -1112,6 +1140,10 @@ ${darkSelector}{${dark.join(";")}}`;
1112
1140
  ".dsh-skins-pz-dialog{box-sizing:border-box;width:min(480px,calc(100vw - 32px));max-height:calc(100vh - 32px);padding:20px;border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-elevated,var(--dsw-alias-bg-overlay));color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.25));font:inherit}",
1113
1141
  ".dsh-skins-pz-dialog::backdrop{background:rgba(0,0,0,.45)}",
1114
1142
  ".dsh-skins-pz-dialog-message{margin:0 0 20px;white-space:pre-line;line-height:1.6;font-size:14px}",
1143
+ ".dsh-skins-pz-dialog-intro{margin:0;font-size:14px;line-height:1.6}.dsh-skins-pz-dialog-outro{margin:0 0 20px;font-size:14px;line-height:1.6}",
1144
+ ".dsh-skins-pz-dialog-tags{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 16px;padding:0;list-style:none}",
1145
+ ".dsh-skins-pz-dialog-tag{box-sizing:border-box;display:inline-flex;align-items:center;gap:7px;max-width:100%;padding:6px 10px;border:1px solid var(--dsw-alias-border-l2);border-color:color-mix(in srgb,var(--dsw-alias-brand-primary) 42%,transparent);border-radius:999px;background:var(--dsw-alias-bg-layer-1);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 10%,var(--dsw-alias-bg-overlay));color:var(--dsw-alias-label-primary);font-size:13px;line-height:18px;font-weight:600;white-space:normal}",
1146
+ '.dsh-skins-pz-dialog-tag::before{content:"";flex:none;width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-brand-primary)}',
1115
1147
  ".dsh-skins-pz-dialog-actions{display:flex;justify-content:flex-end;gap:8px}",
1116
1148
  // Stacked (<904px) resets MUST come after the rules they override — the
1117
1149
  // array order is the cascade order among equal-specificity selectors.
@@ -1405,13 +1437,13 @@ ${names}`,
1405
1437
  const dialogRef = useRef(null);
1406
1438
  const confirmationRef = useRef(null);
1407
1439
  const [confirmation, setConfirmation] = useState(null);
1408
- const requestConfirm = (message, accept) => {
1440
+ const requestConfirm = (message, accept, { detailItems = null } = {}) => {
1409
1441
  if (!desktopProfile) {
1410
1442
  if (window.confirm(message)) void accept();
1411
1443
  return;
1412
1444
  }
1413
1445
  if (confirmationRef.current !== null) return;
1414
- const next = { message, accept };
1446
+ const next = { message, accept, detailItems };
1415
1447
  confirmationRef.current = next;
1416
1448
  setConfirmation(next);
1417
1449
  };
@@ -1530,11 +1562,11 @@ ${names}`,
1530
1562
  onClick: () => {
1531
1563
  const affected = schema.fields.filter((field) => overrides[field.key] !== void 0).map((field) => tr(field.labelKey));
1532
1564
  requestConfirm(tr("personalization.resetConfirm", {
1533
- fields: affected.length > 0 ? affected.join(tr("personalization.resetJoin")) : "—"
1565
+ fields: affected.length > 0 ? `• ${affected.join(tr("personalization.resetJoin"))}` : "—"
1534
1566
  }), () => {
1535
1567
  for (const field of schema.fields) configClient.previewReset(skinId, field.key);
1536
1568
  void configClient.flushNow();
1537
- });
1569
+ }, { detailItems: affected });
1538
1570
  },
1539
1571
  children: tr("personalization.reset")
1540
1572
  }) : null,
@@ -1562,7 +1594,11 @@ ${names}`,
1562
1594
  },
1563
1595
  children: [
1564
1596
  jsx("div", { id: "dsh-skins-confirm-title", className: "dsh-skins-pop-title", children: tr("personalization.confirmTitle") }),
1565
- jsx("p", { className: "dsh-skins-pz-dialog-message", children: confirmation.message }),
1597
+ confirmation.detailItems === null ? jsx("p", { className: "dsh-skins-pz-dialog-message", children: confirmation.message }) : jsx("div", { children: [
1598
+ jsx("p", { className: "dsh-skins-pz-dialog-intro", children: tr("personalization.resetConfirmIntro") }),
1599
+ confirmation.detailItems.length > 0 ? jsx("ul", { className: "dsh-skins-pz-dialog-tags", children: confirmation.detailItems.map((label) => jsx("li", { className: "dsh-skins-pz-dialog-tag", children: label }, label)) }) : jsx("p", { className: "dsh-skins-pz-dialog-message", children: "—" }),
1600
+ jsx("p", { className: "dsh-skins-pz-dialog-outro", children: tr("personalization.resetConfirmOutro") })
1601
+ ] }),
1566
1602
  jsx("div", { className: "dsh-skins-pz-dialog-actions", children: [
1567
1603
  jsx("button", {
1568
1604
  type: "button",
@@ -1838,7 +1874,11 @@ ${names}`,
1838
1874
  jsx("path", { d: "M8 21h8M12 17v4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
1839
1875
  ] });
1840
1876
  }
1841
- function SidebarAction({ wide, t }) {
1877
+ function SidebarAction(props) {
1878
+ if (shellTakeover()) return null;
1879
+ return jsx(SidebarActionBody, props);
1880
+ }
1881
+ function SidebarActionBody({ wide, t }) {
1842
1882
  const tr = typeof t === "function" ? (key, params) => t(key, params) : fallbackTranslate;
1843
1883
  const [open, setOpen] = react.useState(false);
1844
1884
  const [activeId, setActiveId] = react.useState(runtime.active);
@@ -2041,9 +2081,22 @@ ${names}`,
2041
2081
  };
2042
2082
  }
2043
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
+ };
2044
2091
  ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
2045
2092
  name: "sidebar.footer.action",
2046
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).
2047
2100
  order: 4,
2048
2101
  locale: NS,
2049
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.4",
4
+ "version": "1.5.6",
5
5
  "homepage": "https://github.com/iasiv5/dsh-skins#readme",
6
6
  "repository": {
7
7
  "type": "git",