@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.cjs CHANGED
@@ -1864,8 +1864,10 @@ var Tooltip = ({
1864
1864
  });
1865
1865
  }
1866
1866
  };
1867
+ const isControl = triggerAs === "button" || tapEnabled;
1867
1868
  const triggerClassName = cn(
1868
- "polli-control polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
1869
+ isControl && "polli-control",
1870
+ "polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
1869
1871
  className
1870
1872
  );
1871
1873
  const cursorClass = displayContents ? "polli:contents" : "polli:cursor-inherit";
@@ -4678,6 +4680,7 @@ function systemMode() {
4678
4680
  }
4679
4681
  var current = readStored() ?? systemMode();
4680
4682
  var listeners = /* @__PURE__ */ new Set();
4683
+ var systemQuery;
4681
4684
  function apply() {
4682
4685
  if (typeof document === "undefined") return;
4683
4686
  document.documentElement.classList.toggle("dark", current === "dark");
@@ -4706,16 +4709,28 @@ function handleStorage(event) {
4706
4709
  apply();
4707
4710
  emit();
4708
4711
  }
4712
+ function handleSystemChange() {
4713
+ if (readStored() !== null) return;
4714
+ const next = systemMode();
4715
+ if (next === current) return;
4716
+ current = next;
4717
+ apply();
4718
+ emit();
4719
+ }
4709
4720
  function subscribe(listener) {
4710
4721
  if (listeners.size === 0 && typeof window !== "undefined") {
4711
4722
  apply();
4712
4723
  window.addEventListener("storage", handleStorage);
4724
+ systemQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
4725
+ systemQuery?.addEventListener("change", handleSystemChange);
4713
4726
  }
4714
4727
  listeners.add(listener);
4715
4728
  return () => {
4716
4729
  listeners.delete(listener);
4717
4730
  if (listeners.size === 0 && typeof window !== "undefined") {
4718
4731
  window.removeEventListener("storage", handleStorage);
4732
+ systemQuery?.removeEventListener("change", handleSystemChange);
4733
+ systemQuery = void 0;
4719
4734
  }
4720
4735
  };
4721
4736
  }