@pollinations/ui 0.1.0-alpha.11 → 0.1.0-alpha.13

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/dist/index.d.cts CHANGED
@@ -690,7 +690,7 @@ declare const ChevronIcon: FC<ChevronIconProps>;
690
690
  * document head, reading the same key) to avoid a flash of light before React
691
691
  * mounts; this store is the source of truth after hydration.
692
692
  *
693
- * Side-effect-free on import: the <html> sync and the cross-tab listener are
693
+ * Side-effect-free on import: the <html> sync and browser listeners are
694
694
  * attached lazily on first subscribe, so importing this module (e.g. via the
695
695
  * package barrel) never mutates the DOM on its own.
696
696
  */
package/dist/index.d.ts CHANGED
@@ -690,7 +690,7 @@ declare const ChevronIcon: FC<ChevronIconProps>;
690
690
  * document head, reading the same key) to avoid a flash of light before React
691
691
  * mounts; this store is the source of truth after hydration.
692
692
  *
693
- * Side-effect-free on import: the <html> sync and the cross-tab listener are
693
+ * Side-effect-free on import: the <html> sync and browser listeners are
694
694
  * attached lazily on first subscribe, so importing this module (e.g. via the
695
695
  * package barrel) never mutates the DOM on its own.
696
696
  */
package/dist/index.js CHANGED
@@ -1692,8 +1692,10 @@ var Tooltip = ({
1692
1692
  });
1693
1693
  }
1694
1694
  };
1695
+ const isControl = triggerAs === "button" || tapEnabled;
1695
1696
  const triggerClassName = cn(
1696
- "polli-control polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
1697
+ isControl && "polli-control",
1698
+ "polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
1697
1699
  className
1698
1700
  );
1699
1701
  const cursorClass = displayContents ? "polli:contents" : "polli:cursor-inherit";
@@ -4517,6 +4519,7 @@ function systemMode() {
4517
4519
  }
4518
4520
  var current = readStored() ?? systemMode();
4519
4521
  var listeners = /* @__PURE__ */ new Set();
4522
+ var systemQuery;
4520
4523
  function apply() {
4521
4524
  if (typeof document === "undefined") return;
4522
4525
  document.documentElement.classList.toggle("dark", current === "dark");
@@ -4545,16 +4548,28 @@ function handleStorage(event) {
4545
4548
  apply();
4546
4549
  emit();
4547
4550
  }
4551
+ function handleSystemChange() {
4552
+ if (readStored() !== null) return;
4553
+ const next = systemMode();
4554
+ if (next === current) return;
4555
+ current = next;
4556
+ apply();
4557
+ emit();
4558
+ }
4548
4559
  function subscribe(listener) {
4549
4560
  if (listeners.size === 0 && typeof window !== "undefined") {
4550
4561
  apply();
4551
4562
  window.addEventListener("storage", handleStorage);
4563
+ systemQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
4564
+ systemQuery?.addEventListener("change", handleSystemChange);
4552
4565
  }
4553
4566
  listeners.add(listener);
4554
4567
  return () => {
4555
4568
  listeners.delete(listener);
4556
4569
  if (listeners.size === 0 && typeof window !== "undefined") {
4557
4570
  window.removeEventListener("storage", handleStorage);
4571
+ systemQuery?.removeEventListener("change", handleSystemChange);
4572
+ systemQuery = void 0;
4558
4573
  }
4559
4574
  };
4560
4575
  }