@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.cjs
CHANGED
|
@@ -1308,6 +1308,7 @@ function systemMode() {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
var current = readStored() ?? systemMode();
|
|
1310
1310
|
var listeners = /* @__PURE__ */ new Set();
|
|
1311
|
+
var systemQuery;
|
|
1311
1312
|
function apply() {
|
|
1312
1313
|
if (typeof document === "undefined") return;
|
|
1313
1314
|
document.documentElement.classList.toggle("dark", current === "dark");
|
|
@@ -1336,16 +1337,28 @@ function handleStorage(event) {
|
|
|
1336
1337
|
apply();
|
|
1337
1338
|
emit();
|
|
1338
1339
|
}
|
|
1340
|
+
function handleSystemChange() {
|
|
1341
|
+
if (readStored() !== null) return;
|
|
1342
|
+
const next = systemMode();
|
|
1343
|
+
if (next === current) return;
|
|
1344
|
+
current = next;
|
|
1345
|
+
apply();
|
|
1346
|
+
emit();
|
|
1347
|
+
}
|
|
1339
1348
|
function subscribe(listener) {
|
|
1340
1349
|
if (listeners.size === 0 && typeof window !== "undefined") {
|
|
1341
1350
|
apply();
|
|
1342
1351
|
window.addEventListener("storage", handleStorage);
|
|
1352
|
+
systemQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
1353
|
+
systemQuery?.addEventListener("change", handleSystemChange);
|
|
1343
1354
|
}
|
|
1344
1355
|
listeners.add(listener);
|
|
1345
1356
|
return () => {
|
|
1346
1357
|
listeners.delete(listener);
|
|
1347
1358
|
if (listeners.size === 0 && typeof window !== "undefined") {
|
|
1348
1359
|
window.removeEventListener("storage", handleStorage);
|
|
1360
|
+
systemQuery?.removeEventListener("change", handleSystemChange);
|
|
1361
|
+
systemQuery = void 0;
|
|
1349
1362
|
}
|
|
1350
1363
|
};
|
|
1351
1364
|
}
|