@pyreon/ui-core 0.18.0 → 0.19.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/lib/index.js +1 -1
- package/package.json +6 -6
- package/src/PyreonUI.tsx +6 -1
package/lib/index.js
CHANGED
|
@@ -297,7 +297,7 @@ const _isBrowser = typeof window !== "undefined" && typeof matchMedia === "funct
|
|
|
297
297
|
let _systemMode;
|
|
298
298
|
function getSystemMode() {
|
|
299
299
|
if (_systemMode) return _systemMode;
|
|
300
|
-
_systemMode = signal(_isBrowser
|
|
300
|
+
_systemMode = signal((_isBrowser ? matchMedia("(prefers-color-scheme: dark)").matches : false) ? "dark" : "light");
|
|
301
301
|
if (_isBrowser) matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
|
|
302
302
|
_systemMode?.set(e.matches ? "dark" : "light");
|
|
303
303
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Core utilities, config, and context for Pyreon UI System",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@pyreon/manifest": "0.13.1",
|
|
41
|
-
"@pyreon/typescript": "^0.
|
|
41
|
+
"@pyreon/typescript": "^0.19.0",
|
|
42
42
|
"@vitus-labs/tools-rolldown": "^2.3.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">= 22"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@pyreon/core": "^0.
|
|
49
|
-
"@pyreon/reactivity": "^0.
|
|
50
|
-
"@pyreon/styler": "^0.
|
|
51
|
-
"@pyreon/unistyle": "^0.
|
|
48
|
+
"@pyreon/core": "^0.19.0",
|
|
49
|
+
"@pyreon/reactivity": "^0.19.0",
|
|
50
|
+
"@pyreon/styler": "^0.19.0",
|
|
51
|
+
"@pyreon/unistyle": "^0.19.0"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/src/PyreonUI.tsx
CHANGED
|
@@ -35,7 +35,12 @@ let _systemMode: ReturnType<typeof signal<ThemeMode>> | undefined
|
|
|
35
35
|
function getSystemMode(): ReturnType<typeof signal<ThemeMode>> {
|
|
36
36
|
if (_systemMode) return _systemMode
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// Ternary (not `&&`) so the typeof-derived `_isBrowser` guard is
|
|
39
|
+
// statically verifiable as protecting the `matchMedia` access — same
|
|
40
|
+
// runtime value (`false` on the server), SSR-safe + analyzer-clear.
|
|
41
|
+
const prefersDark = _isBrowser
|
|
42
|
+
? matchMedia('(prefers-color-scheme: dark)').matches
|
|
43
|
+
: false
|
|
39
44
|
_systemMode = signal<ThemeMode>(prefersDark ? 'dark' : 'light')
|
|
40
45
|
|
|
41
46
|
if (_isBrowser) {
|