@pyreon/ui-core 0.18.0 → 0.20.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.d.ts +3 -5
- package/lib/index.js +1 -1
- package/package.json +6 -6
- package/src/PyreonUI.tsx +6 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as _$_pyreon_styler0 from "@pyreon/styler";
|
|
2
1
|
import { StyledFunction, css, keyframes, styled } from "@pyreon/styler";
|
|
3
|
-
import * as _$_pyreon_core0 from "@pyreon/core";
|
|
4
2
|
import { ComponentFn, VNodeChild } from "@pyreon/core";
|
|
5
3
|
import { PyreonTheme } from "@pyreon/unistyle";
|
|
6
4
|
|
|
@@ -156,9 +154,9 @@ type InitConfig = Partial<CSSEngineConnector & PlatformConfig>;
|
|
|
156
154
|
* no lazy initialization or connector pattern needed.
|
|
157
155
|
*/
|
|
158
156
|
declare class Configuration {
|
|
159
|
-
css: (strings: TemplateStringsArray, ...values:
|
|
157
|
+
css: (strings: TemplateStringsArray, ...values: import("@pyreon/styler").Interpolation[]) => import("@pyreon/styler").CSSResult;
|
|
160
158
|
styled: StyledFunction;
|
|
161
|
-
keyframes: (strings: TemplateStringsArray, ...values:
|
|
159
|
+
keyframes: (strings: TemplateStringsArray, ...values: import("@pyreon/styler").Interpolation[]) => {
|
|
162
160
|
readonly name: string;
|
|
163
161
|
toString(): string;
|
|
164
162
|
};
|
|
@@ -192,7 +190,7 @@ interface CoreContextValue {
|
|
|
192
190
|
*
|
|
193
191
|
* ReactiveContext means useContext() returns `() => CoreContextValue`.
|
|
194
192
|
*/
|
|
195
|
-
declare const context:
|
|
193
|
+
declare const context: import("@pyreon/core").ReactiveContext<CoreContextValue>;
|
|
196
194
|
type Theme = Partial<{
|
|
197
195
|
rootSize: number;
|
|
198
196
|
breakpoints: Breakpoints;
|
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.20.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.20.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.20.0",
|
|
49
|
+
"@pyreon/reactivity": "^0.20.0",
|
|
50
|
+
"@pyreon/styler": "^0.20.0",
|
|
51
|
+
"@pyreon/unistyle": "^0.20.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) {
|