react-native-unistyles 2.8.0 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +46 -32
- package/android/src/main/java/com/unistyles/Platform.kt +6 -1
- package/ios/platform/Platform_iOS.mm +6 -0
- package/lib/commonjs/core/UnistyleRegistry.js +3 -0
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/core/UnistylesModule.js +17 -6
- package/lib/commonjs/core/UnistylesModule.js.map +1 -1
- package/lib/commonjs/core/UnistylesRuntime.js +1 -2
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/utils/parseColor.js +5 -0
- package/lib/commonjs/utils/parseColor.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +3 -0
- package/lib/module/core/UnistyleRegistry.js.map +1 -1
- package/lib/module/core/UnistylesModule.js +17 -6
- package/lib/module/core/UnistylesModule.js.map +1 -1
- package/lib/module/core/UnistylesRuntime.js +1 -2
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/utils/parseColor.js +5 -0
- package/lib/module/utils/parseColor.js.map +1 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +2 -2
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/types/unistyles.d.ts +2 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/parseColor.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/UnistyleRegistry.ts +4 -0
- package/src/core/UnistylesModule.ts +20 -8
- package/src/core/UnistylesRuntime.ts +1 -3
- package/src/types/unistyles.ts +5 -1
- package/src/utils/parseColor.ts +6 -0
- package/windows/ReactNativeUnistyles/packages.lock.json +31 -31
package/README.md
CHANGED
@@ -18,19 +18,23 @@
|
|
18
18
|
[![platform - windows](https://img.shields.io/badge/windows-00a2ed?logo=windows&style=for-the-badge)](https://microsoft.github.io/react-native-windows/docs/getting-started)
|
19
19
|
[![platform - ssr](https://img.shields.io/badge/SSR-black?style=for-the-badge&logo=next.js&logoColor=white)](https://nextjs.org/)
|
20
20
|
|
21
|
-
<a href="https://github.com/jpudysz?tab=followers">
|
22
|
-
<img src="https://img.shields.io/github/followers/jpudysz?label=Follow%20%40jpudysz&style=social" />
|
23
|
-
</a>
|
24
|
-
<br/>
|
25
|
-
<a href="https://twitter.com/jpudysz">
|
26
|
-
<img src="https://img.shields.io/twitter/follow/jpudysz?label=Follow%20%40jpudysz&style=social" />
|
27
|
-
</a>
|
28
21
|
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
```shell
|
25
|
+
yarn add react-native-unistyles
|
26
|
+
```
|
27
|
+
Install CocoaPods dependencies / generate native folders with Expo:
|
28
|
+
|
29
|
+
```shell
|
30
|
+
pod install
|
31
|
+
npx expo prebuild
|
32
|
+
```
|
29
33
|
|
30
34
|
## [Documentation](https://reactnativeunistyles.vercel.app/)
|
31
35
|
- [Start here](https://reactnativeunistyles.vercel.app/start/introduction/)
|
32
36
|
- [API](https://reactnativeunistyles.vercel.app/reference/create-stylesheet/)
|
33
|
-
- [
|
37
|
+
- [Migration from StyleSheet](https://reactnativeunistyles.vercel.app/start/migration-from-stylesheet/)
|
34
38
|
- [Examples](https://reactnativeunistyles.vercel.app/examples/all/)
|
35
39
|
|
36
40
|
## Features
|
@@ -39,10 +43,10 @@
|
|
39
43
|
- 🔥 Crazy performance, adds under 0.1 ms to your StyleSheet
|
40
44
|
- 🎳 Share up to 100% of your styles across platforms in monorepo
|
41
45
|
- 🎯 Doesn't introduce new components, everything is packed in one hook
|
42
|
-
- ⚛️ No React Context
|
46
|
+
- ⚛️ No React Context, no React Native events
|
43
47
|
- 🖥️ Supports custom breakpoints, css-like media queries and variants
|
44
48
|
- 🎨 Register multiple themes and change them with single function call
|
45
|
-
- 🥳 Compatible with
|
49
|
+
- 🥳 Compatible with all React Native platforms
|
46
50
|
- 🛡️ ~99% Test coverage
|
47
51
|
- 🔌 Extend stylesheets with your own plugins
|
48
52
|
- ⚔️ No 3rd party dependencies
|
@@ -58,47 +62,57 @@
|
|
58
62
|
<a href="https://galaxies.dev">
|
59
63
|
<img src="https://avatars.githubusercontent.com/u/118431096?s=200&v=4" height="70px" width="70px" alt="galaxies-dev" />
|
60
64
|
</a>
|
61
|
-
<a href="https://github.com/kmartinezmedia">
|
62
|
-
<img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="70px" width="70px" alt="kmartinezmedia" />
|
63
|
-
</a>
|
64
65
|
<a href="https://github.com/mobily">
|
65
66
|
<img src="https://avatars.githubusercontent.com/u/1467712?v=4" height="70px" width="70px" alt="mobily" />
|
66
67
|
</a>
|
68
|
+
<a href="https://github.com/abanobboles">
|
69
|
+
<img src="https://avatars.githubusercontent.com/u/9078953?v=4" height="70px" width="70px" alt="abanobboles" />
|
70
|
+
</a>
|
71
|
+
<a href="https://github.com/mwarger">
|
72
|
+
<img src="https://avatars.githubusercontent.com/u/686823?v=4" height="70px" width="70px" alt="mwarger" />
|
73
|
+
</a>
|
74
|
+
|
75
|
+
|
76
|
+
## Past sponsors
|
77
|
+
|
78
|
+
<a href="https://github.com/kmartinezmedia">
|
79
|
+
<img src="https://avatars.githubusercontent.com/u/6308123?s=200&v=4" height="70px" width="70px" alt="kmartinezmedia" />
|
80
|
+
</a>
|
67
81
|
<a href="https://github.com/levibuzolic">
|
68
82
|
<img src="https://avatars.githubusercontent.com/u/721323?v=4" height="70px" width="70px" alt="levibuzolic" />
|
69
83
|
</a>
|
84
|
+
<a href="https://github.com/claudesortwell">
|
85
|
+
<img src="https://avatars.githubusercontent.com/u/41422239?v=4" height="70px" width="70px" alt="claudesortwell" />
|
86
|
+
</a>
|
87
|
+
<a href="https://github.com/luoxuhai">
|
88
|
+
<img src="https://avatars.githubusercontent.com/u/37284154?v=4" height="70px" width="70px" alt="luoxuhai" />
|
89
|
+
</a>
|
90
|
+
<a href="https://github.com">
|
91
|
+
<img src="https://avatars.githubusercontent.com/u/113348625?v=4" height="70px" width="70px" alt="anonymous" />
|
92
|
+
</a>
|
70
93
|
|
71
|
-
##
|
94
|
+
## Sponsor my work
|
72
95
|
|
73
|
-
|
74
|
-
<img src="https://raw.githubusercontent.com/grapp-dev/stacks/main/assets/stacks-logo.png" height="70px" width="70px" alt="Stacks" />
|
75
|
-
</a>
|
96
|
+
If you found the `react-native-unistyles` time-saving and valuable, please consider sponsoring my work. Your support enables me to continue creating libraries with a fresh approach.
|
76
97
|
|
77
|
-
|
98
|
+
Github: https://github.com/sponsors/jpudysz
|
78
99
|
|
79
|
-
|
80
|
-
yarn add react-native-unistyles
|
81
|
-
```
|
100
|
+
Ko-fi: https://ko-fi.com/jpudysz
|
82
101
|
|
83
|
-
|
102
|
+
Your support is greatly appreciated and helps me dedicate more time and resources to creating quality libraries. Thank you for all the support!
|
84
103
|
|
85
|
-
<img src="https://www.unistyl.es/_astro/benchmark-2.CMC1bK7S.png" />
|
86
104
|
|
105
|
+
## UI Kits
|
106
|
+
|
107
|
+
<a href="https://stacks.grapp.dev/">
|
108
|
+
<img src="https://raw.githubusercontent.com/grapp-dev/stacks/main/assets/stacks-logo.png" height="70px" width="70px" alt="Stacks" />
|
109
|
+
</a>
|
87
110
|
|
88
111
|
## Discord
|
89
112
|
Looking for help or you want to chat with me?
|
90
113
|
|
91
114
|
[Join Discord](https://discord.gg/akGHf27P4C)
|
92
115
|
|
93
|
-
## Sponsor my work
|
94
|
-
|
95
|
-
If you found the `react-native-unistyles` time-saving and valuable, please consider sponsoring my work. Your support enables me to continue creating libraries with a fresh approach.
|
96
|
-
|
97
|
-
Github: https://github.com/sponsors/jpudysz
|
98
|
-
|
99
|
-
Ko-fi: https://ko-fi.com/jpudysz
|
100
|
-
|
101
|
-
Your support is greatly appreciated and helps me dedicate more time and resources to creating quality libraries. Thank you for all the support!
|
102
116
|
|
103
117
|
## License
|
104
118
|
|
@@ -99,7 +99,12 @@ class Platform(private val reactApplicationContext: ReactApplicationContext) {
|
|
99
99
|
|
100
100
|
val insets = insetsCompat.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
101
101
|
|
102
|
-
|
102
|
+
// reports inset bottom as 0 when keyboard is visible
|
103
|
+
// otherwise it will break other libraries that manipulates bottom insets
|
104
|
+
val imeInsets = insetsCompat.getInsets(WindowInsetsCompat.Type.ime())
|
105
|
+
val insetsBottom = if (imeInsets.bottom > 0) 0 else insets.bottom
|
106
|
+
|
107
|
+
this.insets = Insets(statusBarTopInset, insetsBottom, insets.left, insets.right)
|
103
108
|
}
|
104
109
|
|
105
110
|
fun getInsets(): Insets {
|
@@ -108,6 +108,12 @@
|
|
108
108
|
|
109
109
|
- (void)onWindowChange:(NSNotification *)notification {
|
110
110
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
111
|
+
UIApplicationState appState = [UIApplication sharedApplication].applicationState;
|
112
|
+
|
113
|
+
if (appState == UIApplicationStateBackground) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
|
111
117
|
Screen screen = [self getScreenDimensions];
|
112
118
|
Insets insets = [self getInsets];
|
113
119
|
Dimensions statusBar = [self getStatusBarDimensions];
|
@@ -50,6 +50,9 @@ class UnistyleRegistry {
|
|
50
50
|
this.plugins = [_plugins.cssMediaQueriesPlugin].concat(this.plugins);
|
51
51
|
this.unistylesBridge.addPlugin(_plugins.cssMediaQueriesPlugin.name, false);
|
52
52
|
}
|
53
|
+
if (_common.isWeb && config.windowResizeDebounceTimeMs !== undefined) {
|
54
|
+
this.unistylesBridge.setWindowResizeDebounceTimeMs(config.windowResizeDebounceTimeMs);
|
55
|
+
}
|
53
56
|
return {
|
54
57
|
addBreakpoints: this.addBreakpoints,
|
55
58
|
addThemes: this.addThemes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","cssMediaQueriesPlugin","concat","name","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","notify","startsWith","InvalidPluginName","isAlreadyRegistered","some","isDev","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","updateTheme","theme","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe,CAACM,cAAc,CAACT,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO;MACHG,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBI,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMA,SAAS,GAAId,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAIA,MAAM,CAACgB,cAAc,EAAE;MACvB,IAAI,CAACP,eAAe,CAACQ,iBAAiB,CAACjB,MAAM,CAACgB,cAAc,CAAC;IACjE;IAEA,IAAIhB,MAAM,CAACC,OAAO,EAAE;MAChBD,MAAM,CAACC,OAAO,CAACiB,OAAO,CAACC,MAAM,IAAI,IAAI,CAACC,SAAS,CAACD,MAAM,EAAE,KAAK,CAAC,CAAC;IACnE;IAEA,IAAInB,MAAM,CAACqB,YAAY,EAAE;MACrB,IAAI,CAACZ,eAAe,CAACa,QAAQ,CAACtB,MAAM,CAACqB,YAAY,CAAC;IACtD;IAEA,IAAIrB,MAAM,CAACuB,2BAA2B,EAAE;MACpC,IAAI,CAACtB,OAAO,GAAG,CAACuB,8BAAqB,CAAC,CAACC,MAAM,CAAC,IAAI,CAACxB,OAAO,CAAC;MAC3D,IAAI,CAACQ,eAAe,CAACW,SAAS,CAACI,8BAAqB,CAACE,IAAI,EAAE,KAAK,CAAC;IACrE;IAEA,OAAO;
|
1
|
+
{"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","cssMediaQueriesPlugin","concat","name","windowResizeDebounceTimeMs","undefined","setWindowResizeDebounceTimeMs","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","notify","startsWith","InvalidPluginName","isAlreadyRegistered","some","isDev","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","updateTheme","theme","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe,CAACM,cAAc,CAACT,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO;MACHG,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBI,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMA,SAAS,GAAId,MAAuB,IAAK;IAC5C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IAAI,CAAC7C,MAAM,CAACqB,IAAI,CAAC,GAAGwB,KAAK;IAEzB,IAAI,IAAI,CAACzC,eAAe,CAACyB,SAAS,KAAKR,IAAI,EAAE;MACzC,IAAI,CAACjB,eAAe,CAACwC,WAAW,CAACvB,IAAI,CAAC;IAC1C;EACJ,CAAC;EAEMO,QAAQ,GAAIP,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAACrB,MAAM;AAC1E;AAAC8C,OAAA,CAAApD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -9,6 +9,7 @@ var _plugins = require("../plugins");
|
|
9
9
|
var _common = require("../common");
|
10
10
|
class UnistylesBridgeWeb {
|
11
11
|
#timerRef = undefined;
|
12
|
+
#windowResizeDebounceTimeMs = 100;
|
12
13
|
#hasAdaptiveThemes = false;
|
13
14
|
#supportsAutomaticColorScheme = false;
|
14
15
|
#screenWidth = _common.isServer ? undefined : window.innerWidth;
|
@@ -101,6 +102,12 @@ class UnistylesBridgeWeb {
|
|
101
102
|
return color => this.setRootViewBackgroundColor(color);
|
102
103
|
case 'setImmersiveMode':
|
103
104
|
return () => {};
|
105
|
+
case 'setWindowResizeDebounceTimeMs':
|
106
|
+
return timeMs => {
|
107
|
+
if (timeMs >= 0) {
|
108
|
+
this.#windowResizeDebounceTimeMs = timeMs;
|
109
|
+
}
|
110
|
+
};
|
104
111
|
default:
|
105
112
|
return Reflect.get(this, prop);
|
106
113
|
}
|
@@ -172,14 +179,18 @@ class UnistylesBridgeWeb {
|
|
172
179
|
return this.#themeName;
|
173
180
|
}
|
174
181
|
setupListeners() {
|
182
|
+
const onResize = () => {
|
183
|
+
this.#screenWidth = window.innerWidth;
|
184
|
+
this.#screenHeight = window.innerHeight;
|
185
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
186
|
+
this.emitLayoutChange();
|
187
|
+
};
|
175
188
|
window.addEventListener('resize', () => {
|
189
|
+
if (this.#windowResizeDebounceTimeMs === 0) {
|
190
|
+
return onResize();
|
191
|
+
}
|
176
192
|
clearTimeout(this.#timerRef);
|
177
|
-
this.#timerRef = setTimeout(
|
178
|
-
this.#screenWidth = window.innerWidth;
|
179
|
-
this.#screenHeight = window.innerHeight;
|
180
|
-
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
181
|
-
this.emitLayoutChange();
|
182
|
-
}, 100);
|
193
|
+
this.#timerRef = setTimeout(onResize, this.#windowResizeDebounceTimeMs);
|
183
194
|
});
|
184
195
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
185
196
|
this.#colorScheme = event.matches ? 'dark' : 'light';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","isServer","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","setHidden","navigationBar","pixelRatio","fontScale","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","
|
1
|
+
{"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","isServer","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","setHidden","navigationBar","pixelRatio","fontScale","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","document","body","style","backgroundColor","emit","type","payload","orientation","screen","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,0BAA0B,GAAW,GAAG;EACzC,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGC,gBAAQ,GAAGL,SAAS,GAAGM,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGH,gBAAQ,GAAGL,SAAS,GAAGM,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAACC,iCAAwB,CAACC,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAA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qB,EAAE;MAC9CC,IAAI,EAAE,OAAO;MACbC,OAAO,EAAE;QACLpF,SAAS,EAAE,IAAI,CAAC,CAACA;MACrB;IACJ,CAAC,CAAC;EACN;EAEQiE,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAAC7D,eAAe,CAAC8E,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACL3E,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5B4E,WAAW,EAAG,IAAI,CAAC,CAAC/F,WAAW,GAAe,IAAI,CAAC,CAACI,YAAuB,GACrE,WAAW,GACX,UAAU;QAChB4F,MAAM,EAAE;UACJpE,KAAK,EAAE,IAAI,CAAC,CAAC5B,WAAW;UACxB2B,MAAM,EAAE,IAAI,CAAC,CAACvB;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAAC6F,OAAA,CAAAvG,kBAAA,GAAAA,kBAAA;AAEM,MAAMwG,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,IAAIxG,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -174,8 +174,7 @@ class UnistylesRuntime {
|
|
174
174
|
* @returns - The font scale
|
175
175
|
*/
|
176
176
|
get fontScale() {
|
177
|
-
|
178
|
-
return fontScale === 1.0 ? 1 : fontScale.toFixed(2);
|
177
|
+
return parseFloat(this.unistylesBridge.fontScale.toFixed(2));
|
179
178
|
}
|
180
179
|
|
181
180
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","_utils","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","parseColor","setHidden","hidden","ScreenOrientation","Landscape","Portrait","toFixed","setImmersiveMode","isEnabled","setRootViewBackgroundColor","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACO,MAAME,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/B,CAAC;MACDE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACd,eAAe,CAACc,WAAW;EAC3C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACf,eAAe,CAACe,iBAAiB;EACj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;MACrE,CAAC;MACDE,SAAS,EAAGC,MAAe,IAAK,IAAI,CAAC5B,eAAe,CAACO,SAAS,CAACoB,SAAS,CAACC,MAAM;IACnF,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWlB,aAAaA,CAAA,EAAG;IACvB,OAAO;MACHF,KAAK,EAAE,IAAI,CAACR,eAAe,CAACU,aAAa,CAACF,KAAK;MAC/CC,MAAM,EAAE,IAAI,CAACT,eAAe,CAACU,aAAa,CAACD,MAAM;MACjDY,QAAQ,EAAEA,CAACC,KAAa,EAAEC,KAAc,KAAK;QACzC,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAG,IAAAC,iBAAU,EAACJ,KAAK,EAAEC,KAAK,CAAC;QAE3D,IAAI,CAACvB,eAAe,CAACU,aAAa,CAACW,QAAQ,CAACG,WAAW,EAAEC,WAAW,CAAC;MACzE,CAAC;MACDE,SAAS,EAAGC,MAAe,IAAK,IAAI,CAAC5B,eAAe,CAACU,aAAa,CAACiB,SAAS,CAACC,MAAM;IACvF,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWjB,WAAWA,CAAA,EAAG;IACrB,MAAM;MAAEH,KAAK;MAAEC;IAAO,CAAC,GAAG,IAAI,CAACJ,MAAM;IAErC,IAAIG,KAAK,GAAGC,MAAM,EAAE;MAChB,OAAOoB,yBAAiB,CAACC,SAAS;IACtC;IAEA,OAAOD,yBAAiB,CAACE,QAAQ;EACrC;;EAEA;AACJ;AACA;AACA;EACI,IAAWnB,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACZ,eAAe,CAACY,UAAU;EAC1C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,
|
1
|
+
{"version":3,"names":["_common","require","_utils","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","parseColor","setHidden","hidden","ScreenOrientation","Landscape","Portrait","parseFloat","toFixed","setImmersiveMode","isEnabled","setRootViewBackgroundColor","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACO,MAAME,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;;EAEpG;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO;MACHC,mBAAmB,EAAE,IAAI,CAACA,mBAAmB;MAC7CC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,SAAS,EAAE;QACPC,KAAK,EAAE,IAAI,CAACD,SAAS,CAACC,KAAK;QAC3BC,MAAM,EAAE,IAAI,CAACF,SAAS,CAACE;MAC3B,CAAC;MACDC,aAAa,EAAE;QACXF,KAAK,EAAE,IAAI,CAACE,aAAa,CAACF,KAAK;QAC/BC,MAAM,EAAE,IAAI,CAACC,aAAa,CAACD;MAC/B,CAAC;MACDE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,UAAU,EAAE,IAAI,CAACA,UAAU;MAC3BC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,C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K;IAC5C,IAAI,CAAClD,iBAAiB,CAACiD,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;;EAED;AACJ;AACA;AACA;EACWC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAClD,iBAAiB,CAACmD,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAAvD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.parseColor = void 0;
|
7
|
+
var _common = require("../common");
|
7
8
|
const parseAlpha = alpha => {
|
8
9
|
if (alpha > 1 || alpha < 0) {
|
9
10
|
return 1;
|
@@ -22,7 +23,11 @@ const parseColor = (color, alpha = 1) => {
|
|
22
23
|
if (color.startsWith('#') && color.length === 7) {
|
23
24
|
return [color, parseAlpha(alpha)];
|
24
25
|
}
|
26
|
+
if (_common.isIOS && color === 'transparent') {
|
27
|
+
return ['#000000', 0];
|
28
|
+
}
|
25
29
|
|
30
|
+
// todo remove this with Unistyles 3.0
|
26
31
|
// named colors
|
27
32
|
return [color, 1];
|
28
33
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["parseAlpha","alpha","parseColor","color","startsWith","length","exports"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":";;;;;;AAEA,
|
1
|
+
{"version":3,"names":["_common","require","parseAlpha","alpha","parseColor","color","startsWith","length","isIOS","exports"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,UAAU,GAAIC,KAAa,IAAK;EAClC,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE;IACxB,OAAO,CAAC;EACZ;EAEA,OAAOA,KAAK;AAChB,CAAC;AAEM,MAAMC,UAAU,GAAGA,CAACC,KAAa,EAAEF,KAAa,GAAG,CAAC,KAAuB;EAC9E,IAAI,CAACE,KAAK,EAAE;IACR,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;EAClB;;EAEA;EACA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAE,CAAC,CAAC;EACrB;EAEA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAEH,UAAU,CAACC,KAAK,CAAC,CAAC;EACrC;EAEA,IAAIK,aAAK,IAAIH,KAAK,KAAK,aAAa,EAAE;IAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;EACzB;;EAEA;EACA;EACA,OAAO,CAACA,KAAK,EAAE,CAAC,CAAC;AACrB,CAAC;AAAAI,OAAA,CAAAL,UAAA,GAAAA,UAAA","ignoreList":[]}
|
@@ -44,6 +44,9 @@ export class UnistyleRegistry {
|
|
44
44
|
this.plugins = [cssMediaQueriesPlugin].concat(this.plugins);
|
45
45
|
this.unistylesBridge.addPlugin(cssMediaQueriesPlugin.name, false);
|
46
46
|
}
|
47
|
+
if (isWeb && config.windowResizeDebounceTimeMs !== undefined) {
|
48
|
+
this.unistylesBridge.setWindowResizeDebounceTimeMs(config.windowResizeDebounceTimeMs);
|
49
|
+
}
|
47
50
|
return {
|
48
51
|
addBreakpoints: this.addBreakpoints,
|
49
52
|
addThemes: this.addThemes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isDev","isWeb","UnistylesError","cssMediaQueriesPlugin","normalizeWebStylesPlugin","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","concat","name","getTheme","forName","length","hasTheme","themeName","Error","ThemeNotFound","ThemeNotSelected","notify","startsWith","InvalidPluginName","isAlreadyRegistered","some","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","updateTheme","theme"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":"AAEA,SAASA,KAAK,EAAEC,KAAK,EAAEC,cAAc,QAAQ,WAAW;AACxD,SAASC,qBAAqB,EAAEC,wBAAwB,QAAQ,YAAY;AAE5E,OAAO,MAAMC,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BN,KAAK,GACxC,CAACG,wBAAwB,CAAC,GAC1B,EAAE;EACDI,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe,CAACM,cAAc,CAACT,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO;MACHG,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBI,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMA,SAAS,GAAIZ,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAIA,MAAM,CAACc,cAAc,EAAE;MACvB,IAAI,CAACP,eAAe,CAACQ,iBAAiB,CAACf,MAAM,CAACc,cAAc,CAAC;IACjE;IAEA,IAAId,MAAM,CAACC,OAAO,EAAE;MAChBD,MAAM,CAACC,OAAO,CAACe,OAAO,CAACC,MAAM,IAAI,IAAI,CAACC,SAAS,CAACD,MAAM,EAAE,KAAK,CAAC,CAAC;IACnE;IAEA,IAAIjB,MAAM,CAACmB,YAAY,EAAE;MACrB,IAAI,CAACZ,eAAe,CAACa,QAAQ,CAACpB,MAAM,CAACmB,YAAY,CAAC;IACtD;IAEA,IAAInB,MAAM,CAACqB,2BAA2B,EAAE;MACpC,IAAI,CAACpB,OAAO,GAAG,CAACJ,qBAAqB,CAAC,CAACyB,MAAM,CAAC,IAAI,CAACrB,OAAO,CAAC;MAC3D,IAAI,CAACM,eAAe,CAACW,SAAS,CAACrB,qBAAqB,CAAC0B,IAAI,EAAE,KAAK,CAAC;IACrE;IAEA,OAAO;
|
1
|
+
{"version":3,"names":["isDev","isWeb","UnistylesError","cssMediaQueriesPlugin","normalizeWebStylesPlugin","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","concat","name","windowResizeDebounceTimeMs","undefined","setWindowResizeDebounceTimeMs","getTheme","forName","length","hasTheme","themeName","Error","ThemeNotFound","ThemeNotSelected","notify","startsWith","InvalidPluginName","isAlreadyRegistered","some","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","updateTheme","theme"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":"AAEA,SAASA,KAAK,EAAEC,K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WAAW,CAACrB,IAAI,CAAC;IAC1C;EACJ,CAAC;EAEMO,QAAQ,GAAIP,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAACpB,MAAM;AAC1E","ignoreList":[]}
|
@@ -3,6 +3,7 @@ import { normalizeWebStylesPlugin } from '../plugins';
|
|
3
3
|
import { isServer } from '../common';
|
4
4
|
export class UnistylesBridgeWeb {
|
5
5
|
#timerRef = undefined;
|
6
|
+
#windowResizeDebounceTimeMs = 100;
|
6
7
|
#hasAdaptiveThemes = false;
|
7
8
|
#supportsAutomaticColorScheme = false;
|
8
9
|
#screenWidth = isServer ? undefined : window.innerWidth;
|
@@ -95,6 +96,12 @@ export class UnistylesBridgeWeb {
|
|
95
96
|
return color => this.setRootViewBackgroundColor(color);
|
96
97
|
case 'setImmersiveMode':
|
97
98
|
return () => {};
|
99
|
+
case 'setWindowResizeDebounceTimeMs':
|
100
|
+
return timeMs => {
|
101
|
+
if (timeMs >= 0) {
|
102
|
+
this.#windowResizeDebounceTimeMs = timeMs;
|
103
|
+
}
|
104
|
+
};
|
98
105
|
default:
|
99
106
|
return Reflect.get(this, prop);
|
100
107
|
}
|
@@ -166,14 +173,18 @@ export class UnistylesBridgeWeb {
|
|
166
173
|
return this.#themeName;
|
167
174
|
}
|
168
175
|
setupListeners() {
|
176
|
+
const onResize = () => {
|
177
|
+
this.#screenWidth = window.innerWidth;
|
178
|
+
this.#screenHeight = window.innerHeight;
|
179
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
180
|
+
this.emitLayoutChange();
|
181
|
+
};
|
169
182
|
window.addEventListener('resize', () => {
|
183
|
+
if (this.#windowResizeDebounceTimeMs === 0) {
|
184
|
+
return onResize();
|
185
|
+
}
|
170
186
|
clearTimeout(this.#timerRef);
|
171
|
-
this.#timerRef = setTimeout(
|
172
|
-
this.#screenWidth = window.innerWidth;
|
173
|
-
this.#screenHeight = window.innerHeight;
|
174
|
-
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
175
|
-
this.emitLayoutChange();
|
176
|
-
}, 100);
|
187
|
+
this.#timerRef = setTimeout(onResize, this.#windowResizeDebounceTimeMs);
|
177
188
|
});
|
178
189
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
179
190
|
this.#colorScheme = event.matches ? 'dark' : 'light';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","name","unistylesEvents","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","setHidden","navigationBar","pixelRatio","fontScale","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","isServer","UnistylesBridgeWeb","timerRef","undefined","windowResizeDebounceTimeMs","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","name","unistylesEvents","Unistyles","sortedBreakpointPairs","breakpoint","contentSizeCategory","insets","top","right","bottom","left","statusBar","height","width","setColor","setHidden","navigationBar","pixelRatio","fontScale","constructor","setupListeners","install","globalThis","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","updateTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","color","setRootViewBackgroundColor","timeMs","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","onResize","emitLayoutChange","addEventListener","clearTimeout","setTimeout","matchMedia","event","matches","find","value","index","otherBreakpoints","minVal","maxVal","document","body","style","backgroundColor","emit","type","payload","orientation","screen","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAGhE,SAASC,wBAAwB,QAAQ,YAAY;AACrD,SAASC,QAAQ,QAAQ,WAAW;AAEpC,OAAO,MAAMC,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,0BAA0B,GAAW,GAAG;EACzC,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGP,QAAQ,GAAGG,SAAS,GAAGK,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGV,QAAQ,GAAGG,SAAS,GAAGK,MAAM,CAACG,WAAW;EACzD,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAAClB,wBAAwB,CAACmB,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAItB,kBAAkB,CAACC,aAAa,CAACsB,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAC5C,CAACC,mBAAmB,GAAW,aAAa;EAC5C,CAACC,MAAM,GAAiB;IACpBC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE;EACV,CAAC;EACD,CA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AAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACL3E,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5B4E,WAAW,EAAG,IAAI,CAAC,CAAC3F,WAAW,GAAe,IAAI,CAAC,CAACG,YAAuB,GACrE,WAAW,GACX,UAAU;QAChByF,MAAM,EAAE;UACJpE,KAAK,EAAE,IAAI,CAAC,CAACxB,WAAW;UACxBuB,MAAM,EAAE,IAAI,CAAC,CAACpB;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAM0F,eAAe,GAAG,IAAInG,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -169,8 +169,7 @@ export class UnistylesRuntime {
|
|
169
169
|
* @returns - The font scale
|
170
170
|
*/
|
171
171
|
get fontScale() {
|
172
|
-
|
173
|
-
return fontScale === 1.0 ? 1 : fontScale.toFixed(2);
|
172
|
+
return parseFloat(this.unistylesBridge.fontScale.toFixed(2));
|
174
173
|
}
|
175
174
|
|
176
175
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ScreenOrientation","UnistylesError","parseColor","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","setHidden","hidden","Landscape","Portrait","toFixed","setImmersiveMode","isEnabled","setRootViewBackgroundColor","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAI7D,SAASC,UAAU,QAAQ,UAAU;;AAErC;AACA;AACA;A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AI,CAACT,eAAe,CAACU,aAAa,CAACD,MAAM;MACjDY,QAAQ,EAAEA,CAACC,KAAa,EAAEC,KAAc,KAAK;QACzC,MAAM,CAACC,WAAW,EAAEC,WAAW,CAAC,GAAG5B,UAAU,CAACyB,KAAK,EAAEC,KAAK,CAAC;QAE3D,IAAI,CAACvB,eAAe,CAACU,aAAa,CAACW,QAAQ,CAACG,WAAW,EAAEC,WAAW,CAAC;MACzE,CAAC;MACDC,SAAS,EAAGC,MAAe,IAAK,IAAI,CAAC3B,eAAe,CAACU,aAAa,CAACgB,SAAS,CAACC,MAAM;IACvF,CAAC;EACL;;EAEA;AACJ;AACA;AACA;EACI,IAAWhB,WAAWA,CAAA,EAAG;IACrB,MAAM;MAAEH,KAAK;MAAEC;IAAO,CAAC,GAAG,IAAI,CAACJ,MAAM;IAErC,IAAIG,KAAK,GAAGC,MAAM,EAAE;MAChB,OAAOd,iBAAiB,CAACiC,SAAS;IACtC;IAEA,OAAOjC,iBAAiB,CAACkC,QAAQ;EACrC;;EAEA;AACJ;AACA;AACA;EACI,IAAWjB,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACZ,eAAe,CAACY,UAAU;EAC1C;;EAEA;AACJ;AACA;AACA;EACI,IAAWC,SAASA,CAAA,EAAG;IACnB,
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesError","parseColor","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","miniRuntime","contentSizeCategory","breakpoint","screen","insets","statusBar","width","height","navigationBar","orientation","pixelRatio","fontScale","colorScheme","hasAdaptiveThemes","themeName","breakpoints","enabledPlugins","screenWidth","screenHeight","setColor","color","alpha","parsedColor","parsedAlpha","setHidden","hidden","Landscape","Portrait","parseFloat","toFixed","setImmersiveMode","isEnabled","setRootViewBackgroundColor","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","updateTheme","updater","getTheme","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../src","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const parseAlpha = alpha => {
|
2
3
|
if (alpha > 1 || alpha < 0) {
|
3
4
|
return 1;
|
@@ -16,7 +17,11 @@ export const parseColor = (color, alpha = 1) => {
|
|
16
17
|
if (color.startsWith('#') && color.length === 7) {
|
17
18
|
return [color, parseAlpha(alpha)];
|
18
19
|
}
|
20
|
+
if (isIOS && color === 'transparent') {
|
21
|
+
return ['#000000', 0];
|
22
|
+
}
|
19
23
|
|
24
|
+
// todo remove this with Unistyles 3.0
|
20
25
|
// named colors
|
21
26
|
return [color, 1];
|
22
27
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["parseAlpha","alpha","parseColor","color","startsWith","length"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["isIOS","parseAlpha","alpha","parseColor","color","startsWith","length"],"sourceRoot":"../../../src","sources":["utils/parseColor.ts"],"mappings":"AACA,SAASA,KAAK,QAAQ,WAAW;AAEjC,MAAMC,UAAU,GAAIC,KAAa,IAAK;EAClC,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAG,CAAC,EAAE;IACxB,OAAO,CAAC;EACZ;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CAACC,KAAa,EAAEF,KAAa,GAAG,CAAC,KAAuB;EAC9E,IAAI,CAACE,KAAK,EAAE;IACR,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;EAClB;;EAEA;EACA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAE,CAAC,CAAC;EACrB;EAEA,IAAIA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7C,OAAO,CAACF,KAAK,EAAEH,UAAU,CAACC,KAAK,CAAC,CAAC;EACrC;EAEA,IAAIF,KAAK,IAAII,KAAK,KAAK,aAAa,EAAE;IAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;EACzB;;EAEA;EACA;EACA,OAAO,CAACA,KAAK,EAAE,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAItE,qBAAa,gBAAgB;IAUb,OAAO,CAAC,eAAe;IAT5B,MAAM,EAAE,eAAe,CAAK;IAC5B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAE9B;IACD,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAItE,qBAAa,gBAAgB;IAUb,OAAO,CAAC,eAAe;IAT5B,MAAM,EAAE,eAAe,CAAK;IAC5B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAE9B;IACD,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;MAqD1C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAchD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAiB3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,WAAW,SAAU,MAAM,eAAe,SAAS,eAAe,CAAC,MAAM,eAAe,CAAC,UAM/F;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;IA6CpB,OAAO;IAqFd,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAe3B;AAED,eAAO,MAAM,eAAe,oBAA2B,CAAA"}
|
@@ -30,7 +30,7 @@ export declare class UnistylesRuntime {
|
|
30
30
|
};
|
31
31
|
orientation: "landscape" | "portrait";
|
32
32
|
pixelRatio: number;
|
33
|
-
fontScale:
|
33
|
+
fontScale: number;
|
34
34
|
};
|
35
35
|
/**
|
36
36
|
* Get the current color scheme
|
@@ -114,7 +114,7 @@ export declare class UnistylesRuntime {
|
|
114
114
|
* Get the font scale
|
115
115
|
* @returns - The font scale
|
116
116
|
*/
|
117
|
-
get fontScale():
|
117
|
+
get fontScale(): number;
|
118
118
|
/**
|
119
119
|
* Get the immersive mode (both status bar and navigation bar hidden (Android))
|
120
120
|
* @param isEnabled
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW;;;;;;;;;;;;;;;;;;;MAkBrB;IAED;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS;;;2BAIO,KAAK,UAAU,MAAM;4BAKpB,OAAO;MAElC;IAED;;;OAGG;IACH,IAAW,aAAa;;;2BAIG,KAAK,UAAU,MAAM;4BAKpB,OAAO;MAElC;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;OAGG;IACH,IAAW,UAAU,WAEpB;IAED;;;OAGG;IACH,IAAW,SAAS,
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D;;GAEG;AACH,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG;;;OAGG;IACH,IAAW,WAAW;;;;;;;;;;;;;;;;;;;MAkBrB;IAED;;;OAGG;IACH,IAAW,WAAW,uCAErB;IAED;;;OAGG;IACH,IAAW,iBAAiB,YAE3B;IAED;;;OAGG;IACH,IAAW,SAAS,UAEnB;IAED;;;OAGG;IACH,IAAW,mBAAmB,gGAE7B;IAED;;;OAGG;IACH,IAAW,UAAU,mDAEpB;IAED;;;OAGG;IACH,IAAW,WAAW,6CAErB;IAED;;;OAGG;IACH,IAAW,cAAc,aAExB;IAED;;;OAGG;IACH,IAAW,MAAM;;;MAKhB;IAED;;;OAGG;IACH,IAAW,MAAM,oCAEhB;IAED;;;OAGG;IACH,IAAW,SAAS;;;2BAIO,KAAK,UAAU,MAAM;4BAKpB,OAAO;MAElC;IAED;;;OAGG;IACH,IAAW,aAAa;;;2BAIG,KAAK,UAAU,MAAM;4BAKpB,OAAO;MAElC;IAED;;;OAGG;IACH,IAAW,WAAW,6BAQrB;IAED;;;OAGG;IACH,IAAW,UAAU,WAEpB;IAED;;;OAGG;IACH,IAAW,SAAS,WAEnB;IAED;;;OAGG;IACI,gBAAgB,CAAC,SAAS,EAAE,OAAO;IAI1C;;;;OAIG;IACI,0BAA0B,WAAY,KAAK,UAAU,MAAM,UAIjE;IAED;;;;OAIG;IACI,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAED;;;;;OAKG;IACI,WAAW,SAAU,MAAM,eAAe,mBAAmB,eAAe,CAAC,MAAM,eAAe,CAAC,KAAK,eAAe,CAAC,MAAM,eAAe,CAAC,UAEpJ;IAED;;;OAGG;IACI,iBAAiB,WAAY,OAAO,UAE1C;IAED;;;OAGG;IACI,SAAS,WAAY,eAAe,UAE1C;IAED;;;OAGG;IACI,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -26,6 +26,7 @@ export type UnistylesConfig = {
|
|
26
26
|
initialTheme?: keyof UnistylesThemes;
|
27
27
|
plugins?: Array<UnistylesPlugin>;
|
28
28
|
experimentalCSSMediaQueries?: boolean;
|
29
|
+
windowResizeDebounceTimeMs?: number;
|
29
30
|
};
|
30
31
|
export type UnistylesBridge = {
|
31
32
|
screenWidth: number;
|
@@ -51,6 +52,7 @@ export type UnistylesBridge = {
|
|
51
52
|
removePlugin(pluginName: string): void;
|
52
53
|
setRootViewBackgroundColor(color?: string, alpha?: number): void;
|
53
54
|
setImmersiveMode(isEnabled: boolean): void;
|
55
|
+
setWindowResizeDebounceTimeMs(timeMs: number): void;
|
54
56
|
};
|
55
57
|
export type UnistylesThemeEvent = {
|
56
58
|
type: UnistylesEventType.Theme;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;CACnC;AAED,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACnD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,C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A6B,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"parseColor.d.ts","sourceRoot":"","sources":["../../../../src/utils/parseColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;
|
1
|
+
{"version":3,"file":"parseColor.d.ts","sourceRoot":"","sources":["../../../../src/utils/parseColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAWrC,eAAO,MAAM,UAAU,WAAY,KAAK,UAAS,MAAM,KAAO,CAAC,MAAM,EAAE,MAAM,CAqB5E,CAAA"}
|
package/package.json
CHANGED
@@ -60,6 +60,10 @@ export class UnistyleRegistry {
|
|
60
60
|
this.unistylesBridge.addPlugin(cssMediaQueriesPlugin.name, false)
|
61
61
|
}
|
62
62
|
|
63
|
+
if (isWeb && config.windowResizeDebounceTimeMs !== undefined) {
|
64
|
+
this.unistylesBridge.setWindowResizeDebounceTimeMs(config.windowResizeDebounceTimeMs)
|
65
|
+
}
|
66
|
+
|
63
67
|
return {
|
64
68
|
addBreakpoints: this.addBreakpoints,
|
65
69
|
addThemes: this.addThemes
|
@@ -6,6 +6,7 @@ import { isServer } from '../common'
|
|
6
6
|
|
7
7
|
export class UnistylesBridgeWeb {
|
8
8
|
#timerRef?: ReturnType<typeof setTimeout> = undefined
|
9
|
+
#windowResizeDebounceTimeMs: number = 100
|
9
10
|
#hasAdaptiveThemes: boolean = false
|
10
11
|
#supportsAutomaticColorScheme = false
|
11
12
|
#screenWidth = isServer ? undefined : window.innerWidth
|
@@ -100,6 +101,12 @@ export class UnistylesBridgeWeb {
|
|
100
101
|
return (color: Color | string) => this.setRootViewBackgroundColor(color)
|
101
102
|
case 'setImmersiveMode':
|
102
103
|
return () => {}
|
104
|
+
case 'setWindowResizeDebounceTimeMs':
|
105
|
+
return (timeMs: number) => {
|
106
|
+
if (timeMs >= 0) {
|
107
|
+
this.#windowResizeDebounceTimeMs = timeMs
|
108
|
+
}
|
109
|
+
}
|
103
110
|
default:
|
104
111
|
return Reflect.get(this, prop)
|
105
112
|
}
|
@@ -188,16 +195,21 @@ export class UnistylesBridgeWeb {
|
|
188
195
|
}
|
189
196
|
|
190
197
|
private setupListeners() {
|
191
|
-
|
192
|
-
|
198
|
+
const onResize = () => {
|
199
|
+
this.#screenWidth = window.innerWidth
|
200
|
+
this.#screenHeight = window.innerHeight
|
201
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth)
|
193
202
|
|
194
|
-
this
|
195
|
-
|
196
|
-
this.#screenHeight = window.innerHeight
|
197
|
-
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth)
|
203
|
+
this.emitLayoutChange()
|
204
|
+
}
|
198
205
|
|
199
|
-
|
200
|
-
|
206
|
+
window.addEventListener('resize', () => {
|
207
|
+
if (this.#windowResizeDebounceTimeMs === 0) {
|
208
|
+
return onResize()
|
209
|
+
}
|
210
|
+
|
211
|
+
clearTimeout(this.#timerRef)
|
212
|
+
this.#timerRef = setTimeout(onResize, this.#windowResizeDebounceTimeMs)
|
201
213
|
})
|
202
214
|
|
203
215
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
@@ -170,9 +170,7 @@ export class UnistylesRuntime {
|
|
170
170
|
* @returns - The font scale
|
171
171
|
*/
|
172
172
|
public get fontScale() {
|
173
|
-
|
174
|
-
|
175
|
-
return fontScale === 1.0 ? 1 : fontScale.toFixed(2)
|
173
|
+
return parseFloat(this.unistylesBridge.fontScale.toFixed(2))
|
176
174
|
}
|
177
175
|
|
178
176
|
/**
|
package/src/types/unistyles.ts
CHANGED
@@ -31,7 +31,8 @@ export type UnistylesConfig = {
|
|
31
31
|
adaptiveThemes?: boolean,
|
32
32
|
initialTheme?: keyof UnistylesThemes,
|
33
33
|
plugins?: Array<UnistylesPlugin>,
|
34
|
-
experimentalCSSMediaQueries?: boolean
|
34
|
+
experimentalCSSMediaQueries?: boolean,
|
35
|
+
windowResizeDebounceTimeMs?: number
|
35
36
|
}
|
36
37
|
|
37
38
|
export type UnistylesBridge = {
|
@@ -61,6 +62,9 @@ export type UnistylesBridge = {
|
|
61
62
|
removePlugin(pluginName: string): void,
|
62
63
|
setRootViewBackgroundColor(color?: string, alpha?: number): void,
|
63
64
|
setImmersiveMode(isEnabled: boolean): void
|
65
|
+
|
66
|
+
// web only
|
67
|
+
setWindowResizeDebounceTimeMs(timeMs: number): void
|
64
68
|
}
|
65
69
|
|
66
70
|
export type UnistylesThemeEvent = {
|
package/src/utils/parseColor.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { Color } from '../types'
|
2
|
+
import { isIOS } from '../common'
|
2
3
|
|
3
4
|
const parseAlpha = (alpha: number) => {
|
4
5
|
if (alpha > 1 || alpha < 0) {
|
@@ -22,6 +23,11 @@ export const parseColor = (color?: Color, alpha: number = 1): [string, number] =
|
|
22
23
|
return [color, parseAlpha(alpha)]
|
23
24
|
}
|
24
25
|
|
26
|
+
if (isIOS && color === 'transparent') {
|
27
|
+
return ['#000000', 0]
|
28
|
+
}
|
29
|
+
|
30
|
+
// todo remove this with Unistyles 3.0
|
25
31
|
// named colors
|
26
32
|
return [color, 1]
|
27
33
|
}
|
@@ -4,17 +4,17 @@
|
|
4
4
|
"native,Version=v0.0": {
|
5
5
|
"Microsoft.ReactNative": {
|
6
6
|
"type": "Direct",
|
7
|
-
"requested": "[0.
|
8
|
-
"resolved": "0.
|
9
|
-
"contentHash": "
|
7
|
+
"requested": "[0.74.9, )",
|
8
|
+
"resolved": "0.74.9",
|
9
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
10
10
|
},
|
11
11
|
"Microsoft.ReactNative.Cxx": {
|
12
12
|
"type": "Direct",
|
13
|
-
"requested": "[0.
|
14
|
-
"resolved": "0.
|
15
|
-
"contentHash": "
|
13
|
+
"requested": "[0.74.9, )",
|
14
|
+
"resolved": "0.74.9",
|
15
|
+
"contentHash": "C+Z2fmjDc7SJXeOWyD/9ImqooU7yX3ALB1Yno2UNYo+Li2SImeG6DdEfcNfSCS2fek1R3znpd6yNEkar/t1n5w==",
|
16
16
|
"dependencies": {
|
17
|
-
"Microsoft.ReactNative": "0.
|
17
|
+
"Microsoft.ReactNative": "0.74.9"
|
18
18
|
}
|
19
19
|
},
|
20
20
|
"Microsoft.UI.Xaml": {
|
@@ -28,9 +28,9 @@
|
|
28
28
|
},
|
29
29
|
"Microsoft.Windows.CppWinRT": {
|
30
30
|
"type": "Direct",
|
31
|
-
"requested": "[2.0.
|
32
|
-
"resolved": "2.0.
|
33
|
-
"contentHash": "
|
31
|
+
"requested": "[2.0.230706.1, )",
|
32
|
+
"resolved": "2.0.230706.1",
|
33
|
+
"contentHash": "l0D7oCw/5X+xIKHqZTi62TtV+1qeSz7KVluNFdrJ9hXsst4ghvqQ/Yhura7JqRdZWBXAuDS0G0KwALptdoxweQ=="
|
34
34
|
},
|
35
35
|
"Microsoft.Web.WebView2": {
|
36
36
|
"type": "Transitive",
|
@@ -41,9 +41,9 @@
|
|
41
41
|
"native,Version=v0.0/win10-arm": {
|
42
42
|
"Microsoft.ReactNative": {
|
43
43
|
"type": "Direct",
|
44
|
-
"requested": "[0.
|
45
|
-
"resolved": "0.
|
46
|
-
"contentHash": "
|
44
|
+
"requested": "[0.74.9, )",
|
45
|
+
"resolved": "0.74.9",
|
46
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
47
47
|
},
|
48
48
|
"Microsoft.Web.WebView2": {
|
49
49
|
"type": "Transitive",
|
@@ -54,9 +54,9 @@
|
|
54
54
|
"native,Version=v0.0/win10-arm-aot": {
|
55
55
|
"Microsoft.ReactNative": {
|
56
56
|
"type": "Direct",
|
57
|
-
"requested": "[0.
|
58
|
-
"resolved": "0.
|
59
|
-
"contentHash": "
|
57
|
+
"requested": "[0.74.9, )",
|
58
|
+
"resolved": "0.74.9",
|
59
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
60
60
|
},
|
61
61
|
"Microsoft.Web.WebView2": {
|
62
62
|
"type": "Transitive",
|
@@ -67,9 +67,9 @@
|
|
67
67
|
"native,Version=v0.0/win10-arm64-aot": {
|
68
68
|
"Microsoft.ReactNative": {
|
69
69
|
"type": "Direct",
|
70
|
-
"requested": "[0.
|
71
|
-
"resolved": "0.
|
72
|
-
"contentHash": "
|
70
|
+
"requested": "[0.74.9, )",
|
71
|
+
"resolved": "0.74.9",
|
72
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
73
73
|
},
|
74
74
|
"Microsoft.Web.WebView2": {
|
75
75
|
"type": "Transitive",
|
@@ -80,9 +80,9 @@
|
|
80
80
|
"native,Version=v0.0/win10-x64": {
|
81
81
|
"Microsoft.ReactNative": {
|
82
82
|
"type": "Direct",
|
83
|
-
"requested": "[0.
|
84
|
-
"resolved": "0.
|
85
|
-
"contentHash": "
|
83
|
+
"requested": "[0.74.9, )",
|
84
|
+
"resolved": "0.74.9",
|
85
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
86
86
|
},
|
87
87
|
"Microsoft.Web.WebView2": {
|
88
88
|
"type": "Transitive",
|
@@ -93,9 +93,9 @@
|
|
93
93
|
"native,Version=v0.0/win10-x64-aot": {
|
94
94
|
"Microsoft.ReactNative": {
|
95
95
|
"type": "Direct",
|
96
|
-
"requested": "[0.
|
97
|
-
"resolved": "0.
|
98
|
-
"contentHash": "
|
96
|
+
"requested": "[0.74.9, )",
|
97
|
+
"resolved": "0.74.9",
|
98
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
99
99
|
},
|
100
100
|
"Microsoft.Web.WebView2": {
|
101
101
|
"type": "Transitive",
|
@@ -106,9 +106,9 @@
|
|
106
106
|
"native,Version=v0.0/win10-x86": {
|
107
107
|
"Microsoft.ReactNative": {
|
108
108
|
"type": "Direct",
|
109
|
-
"requested": "[0.
|
110
|
-
"resolved": "0.
|
111
|
-
"contentHash": "
|
109
|
+
"requested": "[0.74.9, )",
|
110
|
+
"resolved": "0.74.9",
|
111
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
112
112
|
},
|
113
113
|
"Microsoft.Web.WebView2": {
|
114
114
|
"type": "Transitive",
|
@@ -119,9 +119,9 @@
|
|
119
119
|
"native,Version=v0.0/win10-x86-aot": {
|
120
120
|
"Microsoft.ReactNative": {
|
121
121
|
"type": "Direct",
|
122
|
-
"requested": "[0.
|
123
|
-
"resolved": "0.
|
124
|
-
"contentHash": "
|
122
|
+
"requested": "[0.74.9, )",
|
123
|
+
"resolved": "0.74.9",
|
124
|
+
"contentHash": "BmRwnI3nOZu8V78pBRQmkBfg09sKcM8dtqSUmGtH3W2auQtJjioa7cbnARkDhOb1cPCC+qELJHtQstHhSW2aoA=="
|
125
125
|
},
|
126
126
|
"Microsoft.Web.WebView2": {
|
127
127
|
"type": "Transitive",
|