@karmo-co/drift-kit-public 25.26.6 → 25.27.0

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/components.js CHANGED
@@ -8926,6 +8926,13 @@
8926
8926
  live.slice().forEach(function (h) { if (h.placement === placement && h.container === container)
8927
8927
  h.close(); });
8928
8928
  }
8929
+ function themeAround(node) {
8930
+ var host = node && node.closest ? node.closest('[data-theme]') : null;
8931
+ var t = host ? host.getAttribute('data-theme') : document.documentElement.getAttribute('data-theme');
8932
+ if (t === 'dark' || t === 'light')
8933
+ return t;
8934
+ return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
8935
+ }
8929
8936
  function show(opts) {
8930
8937
  opts = opts || {};
8931
8938
  var variant = opts.variant === 'compact' ? 'compact' : 'default';
@@ -8979,6 +8986,8 @@
8979
8986
  el.innerHTML = '<div class="dk-component-toast__panel">' + icon + text + close + '</div>';
8980
8987
  var r = region(placement, container);
8981
8988
  r.appendChild(el);
8989
+ if (opts.inverse)
8990
+ el.setAttribute('data-theme', themeAround(r) === 'dark' ? 'light' : 'dark');
8982
8991
  var said = variant === 'compact' ? (opts.title || opts.description || '') :
8983
8992
  [opts.title, opts.description].filter(Boolean).map(function (t, i, all) {
8984
8993
  return i < all.length - 1 && !/[.!?]$/.test(t) ? t + '.' : t;
@@ -12371,7 +12380,8 @@
12371
12380
  return;
12372
12381
  }
12373
12382
  var r = root.getBoundingClientRect();
12374
- var bottom = shell && shell.hasAttribute('data-contained') ? shell.getBoundingClientRect().bottom : window.innerHeight;
12383
+ var pinned = window.getComputedStyle(root).position === 'fixed';
12384
+ var bottom = shell && shell.hasAttribute('data-contained') && !pinned ? shell.getBoundingClientRect().bottom : window.innerHeight;
12375
12385
  var h = Math.max(0, Math.round(bottom - r.top));
12376
12386
  if (shell)
12377
12387
  shell.style.setProperty('--_shell-bar', h + 'px');