@pollinations/ui 0.1.0-alpha.12 → 0.1.0-alpha.14
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/auth/index.cjs +13 -0
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +13 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +25 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +3 -1
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.js +3 -1
- package/dist/markdown.js.map +1 -1
- package/package.json +3 -1
package/dist/auth/index.js
CHANGED
|
@@ -1276,6 +1276,7 @@ function systemMode() {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
var current = readStored() ?? systemMode();
|
|
1278
1278
|
var listeners = /* @__PURE__ */ new Set();
|
|
1279
|
+
var systemQuery;
|
|
1279
1280
|
function apply() {
|
|
1280
1281
|
if (typeof document === "undefined") return;
|
|
1281
1282
|
document.documentElement.classList.toggle("dark", current === "dark");
|
|
@@ -1304,16 +1305,28 @@ function handleStorage(event) {
|
|
|
1304
1305
|
apply();
|
|
1305
1306
|
emit();
|
|
1306
1307
|
}
|
|
1308
|
+
function handleSystemChange() {
|
|
1309
|
+
if (readStored() !== null) return;
|
|
1310
|
+
const next = systemMode();
|
|
1311
|
+
if (next === current) return;
|
|
1312
|
+
current = next;
|
|
1313
|
+
apply();
|
|
1314
|
+
emit();
|
|
1315
|
+
}
|
|
1307
1316
|
function subscribe(listener) {
|
|
1308
1317
|
if (listeners.size === 0 && typeof window !== "undefined") {
|
|
1309
1318
|
apply();
|
|
1310
1319
|
window.addEventListener("storage", handleStorage);
|
|
1320
|
+
systemQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
1321
|
+
systemQuery?.addEventListener("change", handleSystemChange);
|
|
1311
1322
|
}
|
|
1312
1323
|
listeners.add(listener);
|
|
1313
1324
|
return () => {
|
|
1314
1325
|
listeners.delete(listener);
|
|
1315
1326
|
if (listeners.size === 0 && typeof window !== "undefined") {
|
|
1316
1327
|
window.removeEventListener("storage", handleStorage);
|
|
1328
|
+
systemQuery?.removeEventListener("change", handleSystemChange);
|
|
1329
|
+
systemQuery = void 0;
|
|
1317
1330
|
}
|
|
1318
1331
|
};
|
|
1319
1332
|
}
|