react-native-unistyles 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/ios/platform/Platform_iOS.mm +6 -1
- package/lib/commonjs/core/UnistylesModule.js +7 -1
- package/lib/commonjs/core/UnistylesModule.js.map +1 -1
- package/lib/module/core/UnistylesModule.js +7 -1
- package/lib/module/core/UnistylesModule.js.map +1 -1
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/UnistylesModule.ts +8 -1
- package/src/index.ts +2 -1
@@ -81,6 +81,7 @@
|
|
81
81
|
return [self setRootViewBackgroundColor:color alpha:alpha];
|
82
82
|
});
|
83
83
|
|
84
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
84
85
|
dispatch_async(dispatch_get_main_queue(), ^{
|
85
86
|
Screen screen = [self getScreenDimensions];
|
86
87
|
|
@@ -92,7 +93,11 @@
|
|
92
93
|
unistylesRuntime->pixelRatio = screen.pixelRatio;
|
93
94
|
unistylesRuntime->fontScale = screen.fontScale;
|
94
95
|
unistylesRuntime->rtl = [self isRtl];
|
96
|
+
|
97
|
+
dispatch_semaphore_signal(semaphore);
|
95
98
|
});
|
99
|
+
|
100
|
+
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
96
101
|
}
|
97
102
|
|
98
103
|
- (void)onAppearanceChange:(NSNotification *)notification {
|
@@ -155,7 +160,7 @@
|
|
155
160
|
BOOL hasForcedRtl = [[NSUserDefaults standardUserDefaults] boolForKey:@"RCTI18nUtil_forceRTL"];
|
156
161
|
// user preferences
|
157
162
|
BOOL isRtl = [UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
|
158
|
-
|
163
|
+
|
159
164
|
return hasForcedRtl || isRtl;
|
160
165
|
}
|
161
166
|
|
@@ -50,7 +50,7 @@ class UnistylesBridgeWeb {
|
|
50
50
|
this.setupListeners();
|
51
51
|
this.#screenWidth = window.innerWidth;
|
52
52
|
this.#screenHeight = window.innerHeight;
|
53
|
-
this.#rtl =
|
53
|
+
this.#rtl = document.documentElement.dir === 'rtl';
|
54
54
|
}
|
55
55
|
}
|
56
56
|
install() {
|
@@ -209,6 +209,12 @@ class UnistylesBridgeWeb {
|
|
209
209
|
this.emitThemeChange();
|
210
210
|
}
|
211
211
|
});
|
212
|
+
new MutationObserver(() => {
|
213
|
+
this.#rtl = document.documentElement.dir === 'rtl';
|
214
|
+
}).observe(document.documentElement, {
|
215
|
+
attributes: true,
|
216
|
+
attributeFilter: ['dir']
|
217
|
+
});
|
212
218
|
}
|
213
219
|
getBreakpointFromScreenWidth(width) {
|
214
220
|
const breakpoint = this.#sortedBreakpointPairs.find(([, value], index, otherBreakpoints) => {
|
@@ -1 +1 @@
|
|
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","hairlineWidth","rtl","constructor","setupListeners","
|
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","hairlineWidth","rtl","constructor","setupListeners","document","documentElement","dir","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","MutationObserver","observe","attributes","attributeFilter","find","value","index","otherBreakpoints","minVal","maxVal","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,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAC5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
this.#screenWidth = window.innerWidth;
|
46
46
|
this.#screenHeight = window.innerHeight;
|
47
|
-
this.#rtl =
|
47
|
+
this.#rtl = document.documentElement.dir === 'rtl';
|
48
48
|
}
|
49
49
|
}
|
50
50
|
install() {
|
@@ -203,6 +203,12 @@ export class UnistylesBridgeWeb {
|
|
203
203
|
this.emitThemeChange();
|
204
204
|
}
|
205
205
|
});
|
206
|
+
new MutationObserver(() => {
|
207
|
+
this.#rtl = document.documentElement.dir === 'rtl';
|
208
|
+
}).observe(document.documentElement, {
|
209
|
+
attributes: true,
|
210
|
+
attributeFilter: ['dir']
|
211
|
+
});
|
206
212
|
}
|
207
213
|
getBreakpointFromScreenWidth(width) {
|
208
214
|
const breakpoint = this.#sortedBreakpointPairs.find(([, value], index, otherBreakpoints) => {
|
@@ -1 +1 @@
|
|
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","hairlineWidth","rtl","constructor","setupListeners","
|
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","hairlineWidth","rtl","constructor","setupListeners","document","documentElement","dir","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","MutationObserver","observe","attributes","attributeFilter","find","value","index","otherBreakpoints","minVal","maxVal","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,CAAC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AU,CAAC,8BAA8B,CAAC,CAACE,OAAO,EAAE;MAC7F,OAAO,MAAM;IACjB;IAEA,OAAO,OAAO;EAClB;EAEQ3B,0BAA0BA,CAACD,KAAsB,EAAE;IACvDpB,QAAQ,CAAC2D,IAAI,CAACC,KAAK,CAACC,eAAe,GAAGzC,KAAe;EACzD;EAEQiB,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAAC3D,eAAe,CAACoF,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEQlC,eAAeA,CAAA,EAAG;IACtB,IAAI,CAAC,CAACnD,eAAe,CAACoF,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,OAAO;MACbC,OAAO,EAAE;QACLzF,SAAS,EAAE,IAAI,CAAC,CAACA;MACrB;IACJ,CAAC,CAAC;EACN;EAEQmE,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAAChE,eAAe,CAACoF,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACLnF,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5BoF,WAAW,EAAG,IAAI,CAAC,CAACnG,WAAW,GAAe,IAAI,CAAC,CAACG,YAAuB,GACrE,WAAW,GACX,UAAU;QAChBiG,MAAM,EAAE;UACJ5E,KAAK,EAAE,IAAI,CAAC,CAACxB,WAAW;UACxBuB,MAAM,EAAE,IAAI,CAAC,CAACpB;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMkG,eAAe,GAAG,IAAI3G,kBAAkB,CAAC,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;IAgDpB,OAAO;IAyFd,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;
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAMA,qBAAa,kBAAkB;;;IAgDpB,OAAO;IAyFd,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;IAyCtB,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"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { mq } from './utils';
|
2
2
|
import { useInitialTheme } from './hooks';
|
3
|
-
import type { UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames } from './types';
|
3
|
+
import type { UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames, UnistylesTheme } from './types';
|
4
4
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
5
5
|
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common';
|
6
6
|
import { useStyles } from './useStyles';
|
@@ -73,5 +73,5 @@ declare const UnistylesRegistry: {
|
|
73
73
|
};
|
74
74
|
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
75
75
|
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory, UnistylesRegistry, UnistylesRuntime };
|
76
|
-
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames as UnistylesVariants };
|
76
|
+
export type { UnistylesTheme, UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames as UnistylesVariants };
|
77
77
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC/
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC/I,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;;GAGG;AACH,QAAA,MAAM,iBAAiB;IACnB;;;OAGG;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;CAEN,CAAA;AAED,QAAA,MAAM,gBAAgB,mCAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,mBAAmB,IAAI,iBAAiB,EAC3C,CAAA"}
|
package/package.json
CHANGED
@@ -48,7 +48,7 @@ export class UnistylesBridgeWeb {
|
|
48
48
|
this.setupListeners()
|
49
49
|
this.#screenWidth = window.innerWidth
|
50
50
|
this.#screenHeight = window.innerHeight
|
51
|
-
this.#rtl =
|
51
|
+
this.#rtl = document.documentElement.dir === 'rtl'
|
52
52
|
}
|
53
53
|
}
|
54
54
|
|
@@ -233,6 +233,13 @@ export class UnistylesBridgeWeb {
|
|
233
233
|
this.emitThemeChange()
|
234
234
|
}
|
235
235
|
})
|
236
|
+
|
237
|
+
new MutationObserver(() => {
|
238
|
+
this.#rtl = document.documentElement.dir === 'rtl'
|
239
|
+
}).observe(document.documentElement, {
|
240
|
+
attributes: true,
|
241
|
+
attributeFilter: ['dir']
|
242
|
+
})
|
236
243
|
}
|
237
244
|
|
238
245
|
private getBreakpointFromScreenWidth(width: number): keyof UnistylesBreakpoints {
|
package/src/index.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { unistyles } from './core'
|
2
2
|
import { mq } from './utils'
|
3
3
|
import { useInitialTheme } from './hooks'
|
4
|
-
import type { UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames } from './types'
|
4
|
+
import type { UnistylesPlugin, UnistylesValues, UnistyleText, UnistyleView, UnistyleImage, ExtractVariantNames, UnistylesTheme } from './types'
|
5
5
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global'
|
6
6
|
import { ScreenOrientation, AndroidContentSizeCategory, IOSContentSizeCategory } from './common'
|
7
7
|
import { useStyles } from './useStyles'
|
@@ -44,6 +44,7 @@ export {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
export type {
|
47
|
+
UnistylesTheme,
|
47
48
|
UnistylesThemes,
|
48
49
|
UnistylesBreakpoints,
|
49
50
|
UnistylesPlugin,
|