react-native-unistyles 2.0.0-alpha.7 → 2.0.0-alpha.9
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/UnistylesRuntime.cpp +24 -31
- package/cxx/UnistylesRuntime.h +11 -12
- package/ios/UnistylesModule.mm +20 -20
- package/lib/commonjs/{types/cxx.js → common.js} +6 -6
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/{UnistyleRegistry.js → core/UnistyleRegistry.js} +1 -8
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/{Unistyles.js → core/Unistyles.js} +2 -7
- package/lib/commonjs/core/Unistyles.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -0
- package/lib/commonjs/{UnistylesRuntime.js → core/UnistylesRuntime.js} +6 -6
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/hooks/index.js +10 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/{useInitialTheme.js → hooks/useInitialTheme.js} +6 -2
- package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +54 -0
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
- package/lib/commonjs/index.js +10 -16
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
- package/lib/commonjs/types/index.js +4 -4
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/mq.js +6 -0
- package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
- package/lib/commonjs/types/unistyles.js +6 -0
- package/lib/commonjs/types/unistyles.js.map +1 -0
- package/lib/commonjs/useStyles.js +7 -4
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/commonjs/utils/breakpoints.js +18 -20
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/index.js +10 -38
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +67 -53
- package/lib/commonjs/utils/mq.js.map +1 -1
- package/lib/commonjs/utils/mqParser.js +86 -0
- package/lib/commonjs/utils/mqParser.js.map +1 -0
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/module/{types/cxx.js → common.js} +8 -6
- package/lib/module/common.js.map +1 -0
- package/lib/module/{UnistyleRegistry.js → core/UnistyleRegistry.js} +1 -8
- package/lib/module/core/UnistyleRegistry.js.map +1 -0
- package/lib/module/{Unistyles.js → core/Unistyles.js} +1 -6
- package/lib/module/core/Unistyles.js.map +1 -0
- package/lib/module/core/UnistylesModule.js.map +1 -0
- package/lib/module/{UnistylesRuntime.js → core/UnistylesRuntime.js} +2 -2
- package/lib/module/core/UnistylesRuntime.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/hooks/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useInitialTheme.js +10 -0
- package/lib/module/hooks/useInitialTheme.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +47 -0
- package/lib/module/hooks/useUnistyles.js.map +1 -0
- package/lib/module/index.js +11 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/mq.js +2 -0
- package/lib/module/types/mq.js.map +1 -0
- package/lib/module/types/unistyles.js +2 -0
- package/lib/module/types/unistyles.js.map +1 -0
- package/lib/module/useStyles.js +6 -3
- package/lib/module/useStyles.js.map +1 -1
- package/lib/module/utils/breakpoints.js +14 -16
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/index.js +2 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +65 -51
- package/lib/module/utils/mq.js.map +1 -1
- package/lib/module/utils/mqParser.js +79 -0
- package/lib/module/utils/mqParser.js.map +1 -0
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/typescript/src/common.d.ts +17 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/{UnistyleRegistry.d.ts → core/UnistyleRegistry.d.ts} +2 -3
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/{Unistyles.d.ts → core/Unistyles.d.ts} +0 -3
- package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/{UnistylesRuntime.d.ts → core/UnistylesRuntime.d.ts} +6 -6
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +2 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +10 -12
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +5 -9
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +3 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/lib/typescript/src/types/core.d.ts +9 -4
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +5 -4
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/mq.d.ts +3 -0
- package/lib/typescript/src/types/mq.d.ts.map +1 -0
- package/lib/typescript/src/types/{cxx.d.ts → unistyles.d.ts} +4 -23
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +8 -6
- package/lib/typescript/src/useStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/breakpoints.d.ts +2 -2
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +2 -2
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +15 -9
- package/lib/typescript/src/utils/mq.d.ts.map +1 -1
- package/lib/typescript/src/utils/mqParser.d.ts +3 -0
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common.ts +19 -0
- package/src/{UnistyleRegistry.ts → core/UnistyleRegistry.ts} +3 -12
- package/src/{Unistyles.ts → core/Unistyles.ts} +2 -9
- package/src/{UnistylesRuntime.ts → core/UnistylesRuntime.ts} +4 -4
- package/src/core/index.ts +1 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useInitialTheme.ts +11 -0
- package/src/hooks/useUnistyles.ts +55 -0
- package/src/index.ts +17 -20
- package/src/types/breakpoints.ts +6 -11
- package/src/types/common.ts +2 -0
- package/src/types/core.ts +10 -4
- package/src/types/index.ts +5 -9
- package/src/types/mq.ts +3 -0
- package/src/types/{cxx.ts → unistyles.ts} +4 -28
- package/src/useStyles.ts +15 -8
- package/src/utils/breakpoints.ts +13 -12
- package/src/utils/index.ts +2 -9
- package/src/utils/mq.ts +75 -46
- package/src/utils/mqParser.ts +99 -0
- package/src/utils/styles.ts +2 -2
- package/lib/commonjs/UnistyleRegistry.js.map +0 -1
- package/lib/commonjs/Unistyles.js.map +0 -1
- package/lib/commonjs/UnistylesEngine.js +0 -26
- package/lib/commonjs/UnistylesEngine.js.map +0 -1
- package/lib/commonjs/UnistylesModule.js.map +0 -1
- package/lib/commonjs/UnistylesRuntime.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.js +0 -10
- package/lib/commonjs/hooks/useDimensions.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.web.js +0 -34
- package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
- package/lib/commonjs/types/cxx.js.map +0 -1
- package/lib/commonjs/types/mediaQueries.js +0 -2
- package/lib/commonjs/useInitialTheme.js.map +0 -1
- package/lib/commonjs/useUnistyles.js +0 -51
- package/lib/commonjs/useUnistyles.js.map +0 -1
- package/lib/commonjs/utils/mediaQueries.js +0 -98
- package/lib/commonjs/utils/mediaQueries.js.map +0 -1
- package/lib/module/UnistyleRegistry.js.map +0 -1
- package/lib/module/Unistyles.js.map +0 -1
- package/lib/module/UnistylesEngine.js +0 -19
- package/lib/module/UnistylesEngine.js.map +0 -1
- package/lib/module/UnistylesModule.js.map +0 -1
- package/lib/module/UnistylesRuntime.js.map +0 -1
- package/lib/module/hooks/useDimensions.js +0 -3
- package/lib/module/hooks/useDimensions.js.map +0 -1
- package/lib/module/hooks/useDimensions.web.js +0 -27
- package/lib/module/hooks/useDimensions.web.js.map +0 -1
- package/lib/module/types/cxx.js.map +0 -1
- package/lib/module/types/mediaQueries.js +0 -2
- package/lib/module/useInitialTheme.js +0 -6
- package/lib/module/useInitialTheme.js.map +0 -1
- package/lib/module/useUnistyles.js +0 -44
- package/lib/module/useUnistyles.js.map +0 -1
- package/lib/module/utils/mediaQueries.js +0 -85
- package/lib/module/utils/mediaQueries.js.map +0 -1
- package/lib/typescript/src/UnistyleRegistry.d.ts.map +0 -1
- package/lib/typescript/src/Unistyles.d.ts.map +0 -1
- package/lib/typescript/src/UnistylesEngine.d.ts +0 -11
- package/lib/typescript/src/UnistylesEngine.d.ts.map +0 -1
- package/lib/typescript/src/UnistylesModule.d.ts.map +0 -1
- package/lib/typescript/src/UnistylesRuntime.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
- package/lib/typescript/src/types/cxx.d.ts.map +0 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +0 -10
- package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/useInitialTheme.d.ts +0 -3
- package/lib/typescript/src/useInitialTheme.d.ts.map +0 -1
- package/lib/typescript/src/useUnistyles.d.ts +0 -10
- package/lib/typescript/src/useUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +0 -11
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
- package/src/UnistylesEngine.ts +0 -24
- package/src/hooks/useDimensions.ts +0 -4
- package/src/hooks/useDimensions.web.ts +0 -34
- package/src/types/mediaQueries.ts +0 -15
- package/src/useInitialTheme.ts +0 -7
- package/src/useUnistyles.ts +0 -61
- package/src/utils/mediaQueries.ts +0 -152
- /package/lib/commonjs/{UnistylesModule.js → core/UnistylesModule.js} +0 -0
- /package/lib/module/{UnistylesModule.js → core/UnistylesModule.js} +0 -0
- /package/lib/typescript/src/{UnistylesModule.d.ts → core/UnistylesModule.d.ts} +0 -0
- /package/src/{UnistylesModule.ts → core/UnistylesModule.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["unistyles"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["useInitialTheme","useUnistyles"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { useMemo } from 'react';
|
2
|
+
import { unistyles } from '../core';
|
3
|
+
export const useInitialTheme = forName => {
|
4
|
+
useMemo(() => {
|
5
|
+
if (!unistyles.runtime.themeName) {
|
6
|
+
unistyles.runtime.setTheme(forName);
|
7
|
+
}
|
8
|
+
}, []);
|
9
|
+
};
|
10
|
+
//# sourceMappingURL=useInitialTheme.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useMemo","unistyles","useInitialTheme","forName","runtime","themeName","setTheme"],"sourceRoot":"../../../src","sources":["hooks/useInitialTheme.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,SAAS,QAAQ,SAAS;AAGnC,OAAO,MAAMC,eAAe,GAAIC,OAA8B,IAAK;EAC/DH,OAAO,CAAC,MAAM;IACV,IAAI,CAACC,SAAS,CAACG,OAAO,CAACC,SAAS,EAAE;MAC9BJ,SAAS,CAACG,OAAO,CAACE,QAAQ,CAACH,OAAO,CAAC;IACvC;EACJ,CAAC,EAAE,EAAE,CAAC;AACV,CAAC"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { NativeEventEmitter, NativeModules } from 'react-native';
|
2
|
+
import { useEffect, useState } from 'react';
|
3
|
+
import { unistyles } from '../core';
|
4
|
+
import { CxxUnistylesEventTypes } from '../common';
|
5
|
+
const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
|
6
|
+
export const useUnistyles = () => {
|
7
|
+
const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName));
|
8
|
+
const [layout, setLayout] = useState({
|
9
|
+
breakpoint: unistyles.runtime.breakpoint,
|
10
|
+
orientation: unistyles.runtime.orientation,
|
11
|
+
screenSize: {
|
12
|
+
width: unistyles.runtime.screen.width,
|
13
|
+
height: unistyles.runtime.screen.height
|
14
|
+
}
|
15
|
+
});
|
16
|
+
useEffect(() => {
|
17
|
+
const subscription = unistylesEvents.addListener('onChange', event => {
|
18
|
+
switch (event.type) {
|
19
|
+
case CxxUnistylesEventTypes.Theme:
|
20
|
+
{
|
21
|
+
const themeEvent = event;
|
22
|
+
return setTheme(unistyles.runtime.getTheme(themeEvent.payload.themeName));
|
23
|
+
}
|
24
|
+
case CxxUnistylesEventTypes.Layout:
|
25
|
+
{
|
26
|
+
const layoutEvent = event;
|
27
|
+
return setLayout({
|
28
|
+
breakpoint: layoutEvent.payload.breakpoint,
|
29
|
+
orientation: layoutEvent.payload.orientation,
|
30
|
+
screenSize: {
|
31
|
+
width: layoutEvent.payload.screen.width,
|
32
|
+
height: layoutEvent.payload.screen.height
|
33
|
+
}
|
34
|
+
});
|
35
|
+
}
|
36
|
+
default:
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
});
|
40
|
+
return subscription.remove;
|
41
|
+
}, []);
|
42
|
+
return {
|
43
|
+
theme,
|
44
|
+
layout
|
45
|
+
};
|
46
|
+
};
|
47
|
+
//# sourceMappingURL=useUnistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","CxxUnistylesEventTypes","unistylesEvents","Unistyles","useUnistyles","theme","setTheme","runtime","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,sBAAsB,QAAQ,WAAW;AAGlD,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAACC,SAAS,CAACO,OAAO,CAACC,QAAQ,CAACR,SAAS,CAACO,OAAO,CAACE,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GA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
|
5
|
-
|
6
|
-
|
7
|
-
const {
|
8
|
-
addThemes,
|
9
|
-
addBreakpoints,
|
10
|
-
addConfig
|
11
|
-
} = unistyles.registry;
|
12
|
-
const UnistylesRuntime = unistyles.runtime;
|
1
|
+
import { unistyles } from './core';
|
2
|
+
import { mq } from './utils';
|
3
|
+
import { useInitialTheme } from './hooks';
|
4
|
+
import { ScreenOrientation } from './common';
|
5
|
+
import { useStyles } from './useStyles';
|
6
|
+
import { createStyleSheet } from './createStyleSheet';
|
13
7
|
const UnistylesRegistry = {
|
14
|
-
addThemes,
|
15
|
-
addBreakpoints,
|
16
|
-
addConfig
|
8
|
+
addThemes: unistyles.registry.addThemes,
|
9
|
+
addBreakpoints: unistyles.registry.addBreakpoints,
|
10
|
+
addConfig: unistyles.registry.addConfig
|
17
11
|
};
|
18
|
-
|
19
|
-
export {
|
20
|
-
export { ScreenOrientation };
|
12
|
+
const UnistylesRuntime = unistyles.runtime;
|
13
|
+
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
21
14
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["unistyles","
|
1
|
+
{"version":3,"names":["unistyles","mq","useInitialTheme","ScreenOrientation","useStyles","createStyleSheet","UnistylesRegistry","addThemes","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,SAAS;AAEzC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,iBAAiB,GAAG;EACtBC,SAAS,EAAEP,SAAS,CAACQ,QAAQ,CAACD,SAAS;EACvCE,cAAc,EAAET,SAAS,CAACQ,QAAQ,CAACC,cAAc;EACjDC,SAAS,EAAEV,SAAS,CAACQ,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAGX,SAAS,CAACY,OAAO;AAE1C,SACIX,EAAE,EACFG,SAAS,EACTF,eAAe,EACfG,gBAAgB,EAChBF,iBAAiB,EACjBG,iBAAiB,EACjBK,gBAAgB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/common.ts"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,aAAa"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mq.ts"],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/unistyles.ts"],"mappings":""}
|
package/lib/module/useStyles.js
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
2
|
import { StyleSheet } from 'react-native';
|
3
3
|
import { parseStyle, proxifyFunction } from './utils';
|
4
|
-
import { useUnistyles } from './
|
4
|
+
import { useUnistyles } from './hooks';
|
5
5
|
export const useStyles = stylesheet => {
|
6
6
|
const {
|
7
7
|
theme,
|
8
|
-
|
9
|
-
screenSize
|
8
|
+
layout
|
10
9
|
} = useUnistyles();
|
10
|
+
const {
|
11
|
+
screenSize,
|
12
|
+
breakpoint
|
13
|
+
} = layout;
|
11
14
|
if (!stylesheet) {
|
12
15
|
return {
|
13
16
|
theme,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","
|
1
|
+
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","layout","screenSize","breakpoint","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAErD,SAASC,YAAY,QAAQ,SAAS;AAStC,OAAO,MAAMC,SAAS,GAAsCC,UAAyD,IAA2B;EAC5I,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGJ,YAAY,CAAC,CAAC;EACxC,MAAM;IAAEK,UAAU;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAEzC,IAAI,CAACF,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLG,UAAU;MACVC,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGZ,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAK,CAAC,GACjBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMO,iBAAiB,GAAGb,OAAO,CAAC,MAAMc,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGhB,eAAe,CAACiB,KAAK,EAAEV,UAAU,EAAED,UAAU;MACxD,CAAC;IACL;IAEA,OAAOR,UAAU,CAACqB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGjB,UAAU,CAAKmB,KAAK,EAAEX,UAAU,EAAED,UAAU;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACC,UAAU,EAAED,UAAU,EAAEG,YAAY,CAAC,CAA8B;EAEtF,OAAO;IACHL,KAAK;IACLG,UAAU;IACVC,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { unistyles } from '../
|
1
|
+
import { unistyles } from '../core';
|
2
2
|
import { isMobile, Orientation, throwError } from './common';
|
3
|
-
import { ScreenOrientation } from '../
|
3
|
+
import { ScreenOrientation } from '../common';
|
4
|
+
import { getKeyForUnistylesMediaQuery } from './mqParser';
|
4
5
|
export const sortAndValidateBreakpoints = breakpoints => {
|
5
6
|
const sortedPairs = Object.entries(breakpoints).sort((breakpoint1, breakpoint2) => {
|
6
7
|
const [, value1] = breakpoint1;
|
@@ -32,13 +33,8 @@ export const getBreakpointFromScreenWidth = (width, breakpointEntries) => {
|
|
32
33
|
};
|
33
34
|
export const getValueForBreakpoint = value => {
|
34
35
|
// the highest priority is for custom media queries
|
35
|
-
const
|
36
|
-
|
37
|
-
return unistyles.engine.isMediaQuery(key);
|
38
|
-
});
|
39
|
-
// const customMediaQueryKey = getKeyForCustomMediaQuery(customMediaQueries, screenSize) as keyof typeof value
|
40
|
-
const customMediaQueryKey = unistyles.engine.didMatchMediaQuery(customMediaQueries);
|
41
|
-
if (customMediaQueryKey && customMediaQueryKey in value) {
|
36
|
+
const customMediaQueryKey = getKeyForUnistylesMediaQuery(Object.entries(value), unistyles.runtime.screen);
|
37
|
+
if (customMediaQueryKey) {
|
42
38
|
return value[customMediaQueryKey];
|
43
39
|
}
|
44
40
|
|
@@ -46,10 +42,12 @@ export const getValueForBreakpoint = value => {
|
|
46
42
|
// check if user defined any breakpoints
|
47
43
|
const hasBreakpoints = unistyles.runtime.sortedBreakpoints.length > 0;
|
48
44
|
|
49
|
-
// if not then we can
|
45
|
+
// if not then we can fall back to horizontal and portrait (mobile only)
|
50
46
|
if (!hasBreakpoints && isMobile && (Orientation.Landscape in value || Orientation.Portrait in value)) {
|
51
47
|
return value[unistyles.runtime.orientation === ScreenOrientation.Portrait ? Orientation.Portrait : Orientation.Landscape];
|
52
48
|
}
|
49
|
+
|
50
|
+
// let's get the current breakpoint
|
53
51
|
const breakpoint = unistyles.runtime.breakpoint;
|
54
52
|
if (!breakpoint) {
|
55
53
|
return undefined;
|
@@ -65,15 +63,15 @@ export const getValueForBreakpoint = value => {
|
|
65
63
|
|
66
64
|
// there is no direct hit for breakpoint nor media-query, let's simulate CSS cascading
|
67
65
|
const breakpointPairs = unistyles.runtime.sortedBreakpoints;
|
68
|
-
const currentBreakpoint = breakpointPairs.findIndex(
|
69
|
-
let [key] =
|
66
|
+
const currentBreakpoint = breakpointPairs.findIndex(_ref2 => {
|
67
|
+
let [key] = _ref2;
|
70
68
|
return key === breakpoint;
|
71
69
|
});
|
72
|
-
const availableBreakpoints = breakpointPairs.filter((
|
73
|
-
let [key] =
|
70
|
+
const availableBreakpoints = breakpointPairs.filter((_ref3, index) => {
|
71
|
+
let [key] = _ref3;
|
74
72
|
return index < currentBreakpoint && key && key in value;
|
75
|
-
}).map(
|
76
|
-
let [key] =
|
73
|
+
}).map(_ref4 => {
|
74
|
+
let [key] = _ref4;
|
77
75
|
return key;
|
78
76
|
});
|
79
77
|
return breakpointPairs.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["unistyles","isMobile","Orientation","throwError","ScreenOrientation","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","
|
1
|
+
{"version":3,"names":["unistyles","isMobile","Orientation","throwError","ScreenOrientation","getKeyForUnistylesMediaQuery","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","customMediaQueryKey","runtime","screen","hasBreakpoints","Landscape","Portrait","orientation","breakpoint","undefined","directBreakpoint","breakpointPairs","currentBreakpoint","findIndex","_ref2","availableBreakpoints","filter","_ref3","map","_ref4"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,SAAS;AACnC,SAASC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ,UAAU;AAG5D,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,SAASC,4BAA4B,QAAQ,YAAY;AAEzD,OAAO,MAAMC,0BAA0B,GAAIC,WAAiC,IAA2B;EACnG,MAAMC,WAAW,GAAGC,MAAM,CACrBC,OAAO,CAACH,WAAW,CAAC,CACpBI,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;IAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;IAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;IAE9B,OAAQC,MAAM,GAAeC,MAAiB;EAClD,CAAC,CAAC;EAEN,MAAMC,iBAAiB,GAAIP,MAAM,CAACQ,MAAM,CAACR,MAAM,CAACS,WAAW,CAACV,WAAW,CAAC,CAAyB;EACjG,MAAMW,gBAAgB,GAAGV,MAAM,CAACW,MAAM,CAACJ,iBAAiB,CAAC;EACzD,MAAM,CAACK,eAAe,CAAC,GAAGF,gBAAgB;EAE1C,IAAIE,eAAe,KAAK,CAAC,EAAE;IACvBlB,UAAU,CAAC,oCAAoC,CAAC;EACpD;EAEA,IAAIgB,gBAAgB,CAACG,MAAM,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,GACtDxC,WAAW,CAACwC,QAAQ,GACpBxC,WAAW,CAACuC,SAAS,CAC9B;EACL;;EAEA;EACA,MAAMG,UAAU,GAAG5C,SAAS,CAACsC,OAAO,CAACM,UAAU;EAE/C,IAAI,CAACA,UAAU,EAAE;IACb,OAAOC,SAAS;EACpB;;EAEA;EACA,MAAMC,gBAAgB,GAAGb,KAAK,CAACW,UAAU,CAAC;;EAE1C;EACA,IAAIE,gBAAgB,IAAKF,UAAU,IAAIX,KAAM,EAAE;IAC3C,OAAOa,gBAAgB;EAC3B;;EAEA;EACA,MAAMC,eAAe,GAAG/C,SAAS,CAACsC,OAAO,CAACtB,iBAAiB;EAC3D,MAAMgC,iBAAiB,GAAGD,eAAe,CACpCE,SAAS,CAACC,KAAA;IAAA,IAAC,CAACtB,GAAG,CAAC,GAAAsB,KAAA;IAAA,OAAKtB,GAAG,KAAKgB,UAAU;EAAA,EAAC;EAE7C,MAAMO,oBAAoB,GAAGJ,eAAe,CACvCK,MAAM,CAAC,CAAAC,KAAA,EAAQtB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAAyB,KAAA;IAAA,OAAYtB,KAAK,GAAGiB,iBAAiB,IAAIpB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EqB,GAAG,CAACC,KAAA;IAAA,IAAC,CAAC3B,GAAG,CAAC,GAAA2B,KAAA;IAAA,OAAK3B,GAAG;EAAA,EAAC;EAExB,OAAOmB,eAAe,CAACzB,MAAM,GAAG,CAAC,GAC3BW,KAAK,CAACkB,oBAAoB,CAACA,oBAAoB,CAAC7B,MAAM,GAAG,CAAC,CAAC,CAAwC,GACnGuB,SAAS;AACnB,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
export { normalizeStyles } from './normalizeStyles';
|
2
2
|
export * from './normalizer';
|
3
|
-
export { mq } from './mq';
|
3
|
+
export { mq, MQSymbol } from './mq';
|
4
|
+
export { getKeyForUnistylesMediaQuery } from './mqParser';
|
4
5
|
export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForBreakpoint } from './breakpoints';
|
5
6
|
export { proxifyFunction, parseStyle } from './styles';
|
6
7
|
export { isServer, Orientation } from './common';
|
7
|
-
export { extractValues, getKeyForCustomMediaQuery, isMediaQuery, isWithinTheHeight, isWithinTheWidth, isWithinTheWidthAndHeight } from './mediaQueries';
|
8
8
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["normalizeStyles","mq","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForBreakpoint","proxifyFunction","parseStyle","isServer","Orientation"
|
1
|
+
{"version":3,"names":["normalizeStyles","mq","MQSymbol","getKeyForUnistylesMediaQuery","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForBreakpoint","proxifyFunction","parseStyle","isServer","Orientation"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,cAAc,cAAc;AAC5B,SAASC,EAAE,EAAEC,QAAQ,QAAQ,MAAM;AACnC,SAASC,4BAA4B,QAAQ,YAAY;AACzD,SAASC,4BAA4B,EAAEC,0BAA0B,EAAEC,qBAAqB,QAAQ,eAAe;AAC/G,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SAASC,QAAQ,EAAEC,WAAW,QAAQ,UAAU"}
|
package/lib/module/utils/mq.js
CHANGED
@@ -1,69 +1,83 @@
|
|
1
|
-
import { unistyles } from '../
|
2
|
-
const MQSymbol = Symbol('unistyles-mq');
|
1
|
+
import { unistyles } from '../core';
|
2
|
+
export const MQSymbol = Symbol('unistyles-mq');
|
3
3
|
var MQProp = /*#__PURE__*/function (MQProp) {
|
4
4
|
MQProp["toString"] = "toString";
|
5
5
|
MQProp["width"] = "width";
|
6
6
|
MQProp["height"] = "height";
|
7
|
+
MQProp["shortW"] = "w";
|
8
|
+
MQProp["shortH"] = "h";
|
7
9
|
return MQProp;
|
8
10
|
}(MQProp || {});
|
9
11
|
const getMQValue = value => {
|
10
12
|
if (typeof value === 'number') {
|
11
13
|
return value;
|
12
14
|
}
|
15
|
+
if (value === null) {
|
16
|
+
return 0;
|
17
|
+
}
|
13
18
|
return unistyles.registry.breakpoints[value] ?? 0;
|
14
19
|
};
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
32
|
-
}
|
33
|
-
return Reflect.get(target, prop, receiver);
|
20
|
+
const widthHandler = function () {
|
21
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
22
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
23
|
+
return new Proxy({}, {
|
24
|
+
get: (target, prop, receiver) => {
|
25
|
+
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
26
|
+
return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
27
|
+
}
|
28
|
+
if (prop === MQProp.width || prop === MQProp.shortW) {
|
29
|
+
return function () {
|
30
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
31
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
32
|
+
return new Proxy({}, {
|
33
|
+
get: (target, prop, receiver) => {
|
34
|
+
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
35
|
+
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
34
36
|
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
return Reflect.get(target, prop, receiver);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
};
|
41
|
+
}
|
42
|
+
return Reflect.get(target, prop, receiver);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
};
|
46
|
+
const heightHandler = function () {
|
47
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
48
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
49
|
+
return new Proxy({}, {
|
50
|
+
get: (target, prop, receiver) => {
|
51
|
+
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
52
|
+
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
|
39
53
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
|
49
|
-
}
|
50
|
-
if (prop === MQProp.height) {
|
51
|
-
return function () {
|
52
|
-
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
53
|
-
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
54
|
-
return new Proxy({}, {
|
55
|
-
get: (target, prop, receiver) => {
|
56
|
-
if (prop === Symbol.toPrimitive || MQProp.toString) {
|
57
|
-
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
58
|
-
}
|
59
|
-
return Reflect.get(target, prop, receiver);
|
54
|
+
if (prop === MQProp.height || prop === MQProp.shortH) {
|
55
|
+
return function () {
|
56
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
57
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
58
|
+
return new Proxy({}, {
|
59
|
+
get: (target, prop, receiver) => {
|
60
|
+
if (prop === Symbol.toPrimitive || MQProp.toString) {
|
61
|
+
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
60
62
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
return Reflect.get(target, prop, receiver);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
65
67
|
}
|
66
|
-
|
67
|
-
|
68
|
+
return Reflect.get(target, prop, receiver);
|
69
|
+
}
|
70
|
+
});
|
68
71
|
};
|
72
|
+
export const mq = new Proxy({}, {
|
73
|
+
get: (target, prop, receiver) => {
|
74
|
+
if (prop === MQProp.shortW || prop === MQProp.width) {
|
75
|
+
return heightHandler;
|
76
|
+
}
|
77
|
+
if (prop === MQProp.shortH || prop === MQProp.height) {
|
78
|
+
return widthHandler;
|
79
|
+
}
|
80
|
+
return Reflect.get(target, prop, receiver);
|
81
|
+
}
|
82
|
+
});
|
69
83
|
//# sourceMappingURL=mq.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["unistyles","MQSymbol","Symbol","MQProp","getMQValue","value","registry","breakpoints","
|
1
|
+
{"version":3,"names":["unistyles","MQSymbol","Symbol","MQProp","getMQValue","value","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","shortW","wMin","wMax","Reflect","heightHandler","height","shortH","mq"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":"AAEA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,QAAQ,GAAGC,MAAM,CAAC,cAAc,CAAC;AAAA,IAyBzCC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,EAANA,MAAM;AAQX,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;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inity))?]/;
|
4
|
+
const parseMq = mq => {
|
5
|
+
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
6
|
+
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
7
|
+
return {
|
8
|
+
width: width ? {
|
9
|
+
from: Number(fromW),
|
10
|
+
to: Number(toW)
|
11
|
+
} : undefined,
|
12
|
+
height: height ? {
|
13
|
+
from: Number(fromH),
|
14
|
+
to: Number(toH)
|
15
|
+
} : undefined
|
16
|
+
};
|
17
|
+
};
|
18
|
+
const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
19
|
+
const isValidMq = parsedMq => {
|
20
|
+
const {
|
21
|
+
width,
|
22
|
+
height
|
23
|
+
} = parsedMq;
|
24
|
+
if (width && height) {
|
25
|
+
return width.from <= width.to && height.from <= height.to;
|
26
|
+
}
|
27
|
+
if (width) {
|
28
|
+
return width.from <= width.to;
|
29
|
+
}
|
30
|
+
if (height) {
|
31
|
+
return height.from <= height.to;
|
32
|
+
}
|
33
|
+
return false;
|
34
|
+
};
|
35
|
+
const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
|
36
|
+
const {
|
37
|
+
width,
|
38
|
+
height
|
39
|
+
} = parsedMq;
|
40
|
+
if (width && height) {
|
41
|
+
return isWithinTheWidth(width, screenSize.width) && isWithinTheHeight(height, screenSize.height);
|
42
|
+
}
|
43
|
+
if (width) {
|
44
|
+
return isWithinTheWidth(width, screenSize.width);
|
45
|
+
}
|
46
|
+
if (height) {
|
47
|
+
return isWithinTheHeight(height, screenSize.height);
|
48
|
+
}
|
49
|
+
return false;
|
50
|
+
};
|
51
|
+
const isWithinTheWidth = (width, screenWidth) => {
|
52
|
+
const {
|
53
|
+
from,
|
54
|
+
to
|
55
|
+
} = width;
|
56
|
+
return screenWidth >= from && screenWidth <= to;
|
57
|
+
};
|
58
|
+
const isWithinTheHeight = (height, screenHeight) => {
|
59
|
+
const {
|
60
|
+
from,
|
61
|
+
to
|
62
|
+
} = height;
|
63
|
+
return screenHeight >= from && screenHeight <= to;
|
64
|
+
};
|
65
|
+
export const getKeyForUnistylesMediaQuery = (mediaQueries, screenSize) => {
|
66
|
+
const mq = mediaQueries.find(_ref => {
|
67
|
+
let [key] = _ref;
|
68
|
+
if (!isUnistylesMq(key)) {
|
69
|
+
return false;
|
70
|
+
}
|
71
|
+
const parsedMq = parseMq(key);
|
72
|
+
if (!isValidMq(parsedMq)) {
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
return isWithinTheWidthAndHeight(parsedMq, screenSize);
|
76
|
+
});
|
77
|
+
return mq?.at(0);
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=mqParser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CA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U,CAACZ,MAAM,CAAC;EACvD;EAEA,OAAO,KAAK;AAChB,CAAC;AAED,MAAMa,gBAAgB,GAAGA,CAACjB,KAAiC,EAAEmB,WAAmB,KAAc;EAC1F,MAAM;IAAEZ,IAAI;IAAEE;EAAG,CAAC,GAAGT,KAA0B;EAE/C,OAAOmB,WAAW,IAAIZ,IAAI,IAAIY,WAAW,IAAIV,EAAE;AACnD,CAAC;AAED,MAAMS,iBAAiB,GAAGA,CAACd,MAAmC,EAAEgB,YAAoB,KAAc;EAC9F,MAAM;IAAEb,IAAI;IAAEE;EAAG,CAAC,GAAGL,MAA2B;EAEhD,OAAOgB,YAAY,IAAIb,IAAI,IAAIa,YAAY,IAAIX,EAAE;AACrD,CAAC;AAED,OAAO,MAAMY,4BAA4B,GAAGA,CAACC,YAAwB,EAAEN,UAAsB,KAAK;EAC9F,MAAMjB,EAAE,GAAGuB,YAAY,CAACC,IAAI,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IAC/B,IAAI,CAACb,aAAa,CAACc,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMX,QAAQ,GAAGhB,OAAO,CAAC2B,GAAa,CAAC;IAEvC,IAAI,CAACZ,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOjB,EAAE,EAAE2B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getValueForBreakpoint","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot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AAGF,GAAG,KAAK,WAAW;IAEvC,IAAIE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC,EAAE;MACrC,OAAO,CACHU,GAAG,EACHV,KAAK,CAACQ,GAAG,CAACR,KAAK,IAAIF,UAAU,CAACE,KAAK,EAAET,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAMuB,iBAAiB,GAAG,OAAOf,KAAK,KAAK,UAAU;IACrD,MAAMgB,YAAY,GAAG,OAAOhB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIe,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEV,KAAK,CAAC;IACvB;IAEA,OAAO,CACHU,GAAG,EACH1B,qBAAqB,CAACgB,
|
1
|
+
{"version":3,"names":["getValueForBreakpoint","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,UAAU;AAElD,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,KACX,IAAIC,KAAK,CAACH,EAAE,EAAE;EACzBI,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEN,UAAU,EAAEC,UAAU;AAC/E,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;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AAqB,CAACgB,KAAqF,CAAC,CAC/G;EACL,CAAC,CACL,CAAC;EAEL,OAAOZ,KAAK,GACNH,eAAe,CAACqB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare enum CxxUnistylesEventTypes {
|
2
|
+
Theme = "theme",
|
3
|
+
Layout = "layout"
|
4
|
+
}
|
5
|
+
export declare enum UnistylesError {
|
6
|
+
RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
|
7
|
+
ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
|
8
|
+
ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
|
9
|
+
ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
|
10
|
+
BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
|
11
|
+
BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
|
12
|
+
}
|
13
|
+
export declare enum ScreenOrientation {
|
14
|
+
Portrait = 1,
|
15
|
+
Landscape = 2
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=common.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF;AAGD,oBAAY,iBAAiB;IACzB,QAAQ,IAAI;IACZ,SAAS,IAAI;CAChB"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { UnistylesBridge, UnistylesConfig } from '
|
2
|
-
import type {
|
1
|
+
import type { UnistylesBridge, UnistylesConfig } from '../types';
|
2
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
3
3
|
export declare class UnistyleRegistry {
|
4
4
|
private unistylesBridge;
|
5
5
|
config: UnistylesConfig;
|
@@ -11,6 +11,5 @@ export declare class UnistyleRegistry {
|
|
11
11
|
addThemes: (themes: UnistylesThemes) => this;
|
12
12
|
addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
|
13
13
|
addConfig: (config: UnistylesConfig) => this;
|
14
|
-
dangerouslyUnregister: () => void;
|
15
14
|
}
|
16
15
|
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEtE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,MAAM,EAAE,eAAe,CAAK;IAC5B,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,UAS1C;IAEM,cAAc,gBAAiB,oBAAoB,UAMzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;CACJ"}
|