dsh-tiddlywiki 0.1.1 → 0.1.2

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.
package/lib/client.js CHANGED
@@ -80,6 +80,13 @@ html[data-dsh-tw-active] .dshDesktopConversationSurface > :not([data-dsh-tw-view
80
80
  }
81
81
  .dsh-tw-panel-bar button:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.12)); }
82
82
  .dsh-tw-panel-title { font-weight: 600; margin-right: auto; }
83
+ /* dsh-better-sidebar coexistence: the floating toggle cluster (two 28px
84
+ buttons at the viewport's top-right) lives above the panel (z-index is
85
+ handled in JS — the panel stays below the host layer), so reserve the
86
+ cluster's width at the panel bar's right end — mirroring how
87
+ dsh-better-sidebar pads the DSH session header — and the panel's own
88
+ 状态/重载 buttons never sit underneath it. */
89
+ .dsh-tw-view[data-sidebar-host] .dsh-tw-panel-bar { padding-right: 80px; }
83
90
  .dsh-tw-status-chip { font-variant-numeric: tabular-nums; }
84
91
  .dsh-tw-status-chip[data-state="running"] { color: var(--dsw-alias-state-success-primary, #3eaa5f); }
85
92
  .dsh-tw-status-chip[data-state="starting"] { color: var(--dsw-alias-state-warning-primary, #d9822b); }
@@ -435,10 +442,35 @@ const ACTIVATE_EVENT = "dsh-panel-activate";
435
442
  const PANEL_NAME = "dsh-tiddlywiki";
436
443
  /** Overlay z-index: above the shell content, below the note widget (950). */
437
444
  const PANEL_Z_INDEX = 40;
445
+ /**
446
+ * dsh-better-sidebar's unified fixed host layer (its persistent
447
+ * expand/collapse toggle cluster lives inside it, at a global z-index of 25
448
+ * — its internal 45 is trapped by the host's stacking context). When this
449
+ * host is present the panel must stay BELOW it, so the sidebar toggle
450
+ * buttons stay visible and clickable above the full-screen TW panel.
451
+ */
452
+ const PANEL_HOST_SELECTOR = "[data-dsh-panel-host]";
453
+ /** The app's own shell overlay layer (dsh-client-ui-layout pins it at 20). */
454
+ const APP_OVERLAY_Z_INDEX = 20;
438
455
  /** Safety re-measure cadence for shell layout changes CSS can't see. */
439
456
  const SYNC_INTERVAL_MS = 2e3;
440
457
  const STATUS_ENDPOINT$1 = "/dsh-tiddlywiki/status";
441
458
  const RESTART_ENDPOINT$1 = "/dsh-tiddlywiki/restart";
459
+ /**
460
+ * The panel's z-index: below any dsh-better-sidebar host layer so its
461
+ * persistent toggle cluster (top-right corner) stays visible and clickable
462
+ * above the full-screen TW panel, otherwise the default 40. The host's live
463
+ * computed z-index is read instead of hardcoding 25, so the rule tracks
464
+ * plugin updates; the panel is still clamped above the app's own shell
465
+ * overlay layer (dsh-client-ui-layout pins it at 20).
466
+ */
467
+ function resolvePanelZIndex() {
468
+ const host = document.querySelector(PANEL_HOST_SELECTOR);
469
+ if (host === null) return PANEL_Z_INDEX;
470
+ const parsed = parseInt(getComputedStyle(host).zIndex, 10);
471
+ if (!Number.isFinite(parsed)) return PANEL_Z_INDEX;
472
+ return Math.max(APP_OVERLAY_Z_INDEX, Math.min(PANEL_Z_INDEX, parsed - 1));
473
+ }
442
474
  function conversationColumn() {
443
475
  for (const selector of COLUMN_SELECTORS) {
444
476
  const el = document.querySelector(selector);
@@ -532,13 +564,25 @@ function mountPanel(state) {
532
564
  if (container.style.width !== width) container.style.width = width;
533
565
  if (container.style.height !== height) container.style.height = height;
534
566
  };
567
+ /**
568
+ * Coexist with dsh-better-sidebar: keep the panel's z-index below the
569
+ * host layer (so its toggle cluster stays clickable above the panel) and
570
+ * flag the host's presence so CSS can reserve the cluster's width at the
571
+ * panel bar's right end. Re-run whenever the host mounts/unmounts.
572
+ */
573
+ const applyChrome = () => {
574
+ if (container === void 0) return;
575
+ container.style.zIndex = String(resolvePanelZIndex());
576
+ if (document.querySelector(PANEL_HOST_SELECTOR) !== null) container.dataset.sidebarHost = "1";
577
+ else delete container.dataset.sidebarHost;
578
+ };
535
579
  const ensure = () => {
536
580
  if (container !== void 0) return;
537
581
  columnEl = conversationColumn();
538
582
  if (columnEl === void 0) return;
539
583
  container = build();
540
584
  container.style.position = "fixed";
541
- container.style.zIndex = String(PANEL_Z_INDEX);
585
+ applyChrome();
542
586
  document.body.append(container);
543
587
  syncRect();
544
588
  };
@@ -640,6 +684,7 @@ function mountPanel(state) {
640
684
  };
641
685
  const waitObserver = new MutationObserver(() => {
642
686
  ensure();
687
+ applyChrome();
643
688
  });
644
689
  waitObserver.observe(document.body, {
645
690
  childList: true,