react-native-unistyles 2.0.0-alpha.1 → 2.0.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/ios/UnistylesModule.h +10 -0
- package/ios/UnistylesModule.mm +108 -0
- package/ios/UnistylesRuntime.h +30 -0
- package/ios/UnistylesRuntime.mm +191 -0
- package/lib/commonjs/UnistyleRegistry.js +37 -0
- package/lib/commonjs/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/Unistyles.js +36 -0
- package/lib/commonjs/Unistyles.js.map +1 -0
- package/lib/commonjs/UnistylesEngine.js +22 -0
- package/lib/commonjs/UnistylesEngine.js.map +1 -0
- package/lib/commonjs/UnistylesModule.js +9 -0
- package/lib/commonjs/UnistylesModule.js.map +1 -0
- package/lib/commonjs/UnistylesRuntime.js +52 -0
- package/lib/commonjs/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/createStyleSheet.js +14 -0
- package/lib/commonjs/createStyleSheet.js.map +1 -0
- package/lib/commonjs/global.js +2 -0
- package/lib/commonjs/global.js.map +1 -0
- package/lib/commonjs/hooks/useDimensions.web.js +3 -2
- package/lib/commonjs/hooks/useDimensions.web.js.map +1 -1
- package/lib/commonjs/index.js +33 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/cxx.js +23 -0
- package/lib/commonjs/types/cxx.js.map +1 -0
- package/lib/commonjs/types/index.js +26 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/normalizer.js +6 -0
- package/lib/commonjs/types/normalizer.js.map +1 -0
- package/lib/commonjs/useInitialTheme.js +13 -0
- package/lib/commonjs/useInitialTheme.js.map +1 -0
- package/lib/commonjs/useStyles.js +48 -0
- package/lib/commonjs/useStyles.js.map +1 -0
- package/lib/commonjs/useUnistyles.js +59 -0
- package/lib/commonjs/useUnistyles.js.map +1 -0
- package/lib/commonjs/utils/breakpoints.js +4 -2
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/common.js +3 -3
- package/lib/commonjs/utils/common.js.map +1 -1
- package/lib/commonjs/utils/index.js +34 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/module.d.js +2 -0
- package/lib/commonjs/utils/module.d.js.map +1 -0
- package/lib/commonjs/utils/normalizeStyles.web.js +13 -13
- package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -1
- package/lib/commonjs/utils/normalizer.js +89 -0
- package/lib/commonjs/utils/normalizer.js.map +1 -0
- package/lib/commonjs/utils/styles.js +7 -7
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/module/UnistyleRegistry.js +30 -0
- package/lib/module/UnistyleRegistry.js.map +1 -0
- package/lib/module/Unistyles.js +30 -0
- package/lib/module/Unistyles.js.map +1 -0
- package/lib/module/UnistylesEngine.js +15 -0
- package/lib/module/UnistylesEngine.js.map +1 -0
- package/lib/module/UnistylesModule.js +3 -0
- package/lib/module/UnistylesModule.js.map +1 -0
- package/lib/module/UnistylesRuntime.js +45 -0
- package/lib/module/UnistylesRuntime.js.map +1 -0
- package/lib/module/createStyleSheet.js +7 -0
- package/lib/module/createStyleSheet.js.map +1 -0
- package/lib/module/global.js +2 -0
- package/lib/module/global.js.map +1 -0
- package/lib/module/hooks/useDimensions.web.js +3 -2
- package/lib/module/hooks/useDimensions.web.js.map +1 -1
- package/lib/module/index.js +18 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/cxx.js +17 -0
- package/lib/module/types/cxx.js.map +1 -0
- package/lib/module/types/index.js +2 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/normalizer.js +2 -0
- package/lib/module/types/normalizer.js.map +1 -0
- package/lib/module/useInitialTheme.js +6 -0
- package/lib/module/useInitialTheme.js.map +1 -0
- package/lib/module/useStyles.js +42 -0
- package/lib/module/useStyles.js.map +1 -0
- package/lib/module/useUnistyles.js +52 -0
- package/lib/module/useUnistyles.js.map +1 -0
- package/lib/module/utils/breakpoints.js +4 -3
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/common.js +2 -1
- package/lib/module/utils/common.js.map +1 -1
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/module.d.js +2 -0
- package/lib/module/utils/module.d.js.map +1 -0
- package/lib/module/utils/normalizeStyles.web.js +13 -13
- package/lib/module/utils/normalizeStyles.web.js.map +1 -1
- package/lib/module/utils/normalizer.js +79 -0
- package/lib/module/utils/normalizer.js.map +1 -0
- package/lib/module/utils/styles.js +7 -8
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/typescript/examples/expo/src/App.d.ts +3 -0
- package/lib/typescript/examples/expo/src/App.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/Cxx.d.ts +3 -0
- package/lib/typescript/examples/expo/src/examples/Cxx.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/examples/index.d.ts +2 -0
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/index.d.ts +2 -0
- package/lib/typescript/examples/expo/src/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +8 -0
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/index.d.ts +16 -0
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +1 -0
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +40 -0
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +1 -0
- package/lib/typescript/src/UnistyleRegistry.d.ts +15 -0
- package/lib/typescript/src/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/Unistyles.d.ts +16 -0
- package/lib/typescript/src/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/UnistylesEngine.d.ts +8 -0
- package/lib/typescript/src/UnistylesEngine.d.ts.map +1 -0
- package/lib/typescript/src/UnistylesModule.d.ts +6 -0
- package/lib/typescript/src/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/UnistylesRuntime.d.ts +56 -0
- package/lib/typescript/src/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/createStyleSheet.d.ts +6 -0
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
- package/lib/typescript/src/global.d.ts +5 -0
- package/lib/typescript/src/global.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +14 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +6 -7
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +4 -4
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/cxx.d.ts +50 -0
- package/lib/typescript/src/types/cxx.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +4 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/normalizer.d.ts +20 -0
- package/lib/typescript/src/types/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +46 -0
- package/lib/typescript/src/useStyles.d.ts.map +1 -0
- package/lib/typescript/src/useUnistyles.d.ts +45 -0
- package/lib/typescript/src/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +5 -4
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/common.d.ts +2 -1
- package/lib/typescript/src/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +2 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +4 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -1
- package/lib/typescript/src/utils/normalizer.d.ts +11 -0
- package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +4 -3
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/package.json +13 -3
- package/react-native-unistyles.podspec +21 -0
- package/src/UnistyleRegistry.ts +39 -0
- package/src/Unistyles.ts +41 -0
- package/src/UnistylesEngine.ts +15 -0
- package/src/UnistylesModule.ts +7 -0
- package/src/UnistylesRuntime.ts +58 -0
- package/src/createStyleSheet.ts +12 -0
- package/src/global.ts +2 -0
- package/src/hooks/useDimensions.web.ts +3 -2
- package/src/index.ts +30 -2
- package/src/types/breakpoints.ts +9 -11
- package/src/types/core.ts +6 -6
- package/src/types/cxx.ts +61 -0
- package/src/types/index.ts +4 -3
- package/src/types/normalizer.ts +29 -0
- package/src/useInitialTheme.ts +7 -0
- package/src/useStyles.ts +49 -0
- package/src/useUnistyles.ts +67 -0
- package/src/utils/breakpoints.ts +16 -14
- package/src/utils/common.ts +2 -1
- package/src/utils/index.ts +2 -0
- package/src/utils/module.d.ts +3 -0
- package/src/utils/normalizeStyles.web.ts +21 -42
- package/src/utils/normalizer.ts +99 -0
- package/src/utils/styles.ts +17 -19
- package/lib/commonjs/UnistylesTheme.js +0 -21
- package/lib/commonjs/UnistylesTheme.js.map +0 -1
- package/lib/commonjs/createUnistyles.js +0 -57
- package/lib/commonjs/createUnistyles.js.map +0 -1
- package/lib/module/UnistylesTheme.js +0 -12
- package/lib/module/UnistylesTheme.js.map +0 -1
- package/lib/module/createUnistyles.js +0 -50
- package/lib/module/createUnistyles.js.map +0 -1
- package/lib/typescript/src/UnistylesTheme.d.ts +0 -9
- package/lib/typescript/src/UnistylesTheme.d.ts.map +0 -1
- package/lib/typescript/src/createUnistyles.d.ts +0 -10
- package/lib/typescript/src/createUnistyles.d.ts.map +0 -1
- package/src/UnistylesTheme.tsx +0 -17
- package/src/__tests__/createUnistyles.spec.tsx +0 -192
- package/src/createUnistyles.ts +0 -70
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_Unistyles","require","_types","_useInitialTheme","_useStyles","_createStyleSheet","addThemes","addBreakpoints","addConfig","unistyles","registry","UnistylesRuntime","exports","runtime","UnistylesRegistry"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAEA,MAAM;EAAEK,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGC,oBAAS,CAACC,QAAQ;AACpE,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGF,oBAAS,CAACI,OAAO;AAC1C,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAG;EACtBR,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.UnistylesError = exports.UnistylesColorScheme = exports.CxxUnistylesEventTypes = void 0;
|
7
|
+
let UnistylesColorScheme = exports.UnistylesColorScheme = /*#__PURE__*/function (UnistylesColorScheme) {
|
8
|
+
UnistylesColorScheme["System"] = "system";
|
9
|
+
UnistylesColorScheme["Manual"] = "manual";
|
10
|
+
return UnistylesColorScheme;
|
11
|
+
}({});
|
12
|
+
let CxxUnistylesEventTypes = exports.CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
|
13
|
+
CxxUnistylesEventTypes["Theme"] = "theme";
|
14
|
+
CxxUnistylesEventTypes["Size"] = "size";
|
15
|
+
CxxUnistylesEventTypes["Breakpoint"] = "breakpoint";
|
16
|
+
return CxxUnistylesEventTypes;
|
17
|
+
}({});
|
18
|
+
let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
19
|
+
UnistylesError["RuntimeUnavailable"] = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE";
|
20
|
+
UnistylesError["ThemeNotFound"] = "UNISTYLES_ERROR_THEME_NOT_FOUND";
|
21
|
+
return UnistylesError;
|
22
|
+
}({});
|
23
|
+
//# sourceMappingURL=cxx.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["UnistylesColorScheme","exports","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":";;;;;;IAGYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAA,IAwBpBE,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IA8BtBC,cAAc,GAAAF,OAAA,CAAAE,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
@@ -1,2 +1,28 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _normalizer = require("./normalizer");
|
7
|
+
Object.keys(_normalizer).forEach(function (key) {
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
9
|
+
if (key in exports && exports[key] === _normalizer[key]) return;
|
10
|
+
Object.defineProperty(exports, key, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return _normalizer[key];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
var _cxx = require("./cxx");
|
18
|
+
Object.keys(_cxx).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (key in exports && exports[key] === _cxx[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function () {
|
24
|
+
return _cxx[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
2
28
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":""}
|
1
|
+
{"version":3,"names":["_normalizer","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_cxx"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":";;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,IAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,IAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,IAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,IAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/normalizer.ts"],"mappings":""}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useInitialTheme = void 0;
|
7
|
+
var _react = require("react");
|
8
|
+
var _Unistyles = require("./Unistyles");
|
9
|
+
const useInitialTheme = forName => {
|
10
|
+
(0, _react.useRef)(_Unistyles.unistyles.runtime.setTheme(forName));
|
11
|
+
};
|
12
|
+
exports.useInitialTheme = useInitialTheme;
|
13
|
+
//# sourceMappingURL=useInitialTheme.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_react","require","_Unistyles","useInitialTheme","forName","useRef","unistyles","runtime","setTheme","exports"],"sourceRoot":"../../src","sources":["useInitialTheme.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAGO,MAAME,eAAe,GAAIC,OAA8B,IAAK;EAC/D,IAAAC,aAAM,EAACC,oBAAS,CAACC,OAAO,CAACC,QAAQ,CAACJ,OAAO,CAAC,CAAC;AAC/C,CAAC;AAAAK,OAAA,CAAAN,eAAA,GAAAA,eAAA"}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useStyles = void 0;
|
7
|
+
var _react = require("react");
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
var _utils = require("./utils");
|
10
|
+
var _useUnistyles = require("./useUnistyles");
|
11
|
+
// todo types
|
12
|
+
|
13
|
+
const useStyles = stylesheet => {
|
14
|
+
const {
|
15
|
+
theme,
|
16
|
+
breakpoint,
|
17
|
+
screenSize
|
18
|
+
} = (0, _useUnistyles.useUnistyles)();
|
19
|
+
if (!stylesheet) {
|
20
|
+
return {
|
21
|
+
theme,
|
22
|
+
breakpoint,
|
23
|
+
styles: {}
|
24
|
+
};
|
25
|
+
}
|
26
|
+
const parsedStyles = (0, _react.useMemo)(() => typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet, [theme, stylesheet]);
|
27
|
+
const dynamicStyleSheet = (0, _react.useMemo)(() => Object.entries(parsedStyles).reduce((acc, _ref) => {
|
28
|
+
let [key, value] = _ref;
|
29
|
+
const style = value;
|
30
|
+
if (typeof value === 'function') {
|
31
|
+
return {
|
32
|
+
...acc,
|
33
|
+
[key]: (0, _utils.proxifyFunction)(value, breakpoint, screenSize)
|
34
|
+
};
|
35
|
+
}
|
36
|
+
return _reactNative.StyleSheet.create({
|
37
|
+
...acc,
|
38
|
+
[key]: (0, _utils.parseStyle)(style, breakpoint, screenSize)
|
39
|
+
});
|
40
|
+
}, {}), [breakpoint, screenSize, parsedStyles]);
|
41
|
+
return {
|
42
|
+
theme,
|
43
|
+
breakpoint,
|
44
|
+
styles: dynamicStyleSheet
|
45
|
+
};
|
46
|
+
};
|
47
|
+
exports.useStyles = useStyles;
|
48
|
+
//# sourceMappingURL=useStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_utils","_useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","useUnistyles","styles","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","proxifyFunction","StyleSheet","create","parseStyle","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAGA;;AAGO,MAAMI,SAAS,GAAsCC,UAA4C,IAAK;EACzG,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAG,IAAAC,0BAAY,EAAC,CAAC;EAExD,IAAI,CAACJ,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLC,UAAU;MACVG,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOP,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAM,CAAC,GAClBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMQ,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,CAAC,CACrBK,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,GAAG,IAAAG,sBAAe,EAACF,KAAK,EAAEb,UAAU,EAAGC,UAAU;MACzD,CAAC;IACL;IAEA,OAAOe,uBAAU,CAACC,MAAM,CAAC;MACrB,GAAGP,GAAG;MACN,CAACE,GAAG,GAAG,IAAAM,iBAAU,EAAKJ,KAAK,EAAEd,UAAU,EAAGC,UAAU;IACxD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACD,UAAU,EAAEC,UAAU,EAAEG,YAAY,CAAC,CAAC;EAEzD,OAAO;IACHL,KAAK;IACLC,UAAU;IACVG,MAAM,EAAEG;EACZ,CAAC;AACL,CAAC;AAAAa,OAAA,CAAAtB,SAAA,GAAAA,SAAA"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useUnistyles = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
var _react = require("react");
|
9
|
+
var _types = require("./types");
|
10
|
+
var _Unistyles = require("./Unistyles");
|
11
|
+
const unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
|
12
|
+
const useUnistyles = () => {
|
13
|
+
const [theme, setTheme] = (0, _react.useState)(_Unistyles.unistyles.runtime.getTheme(_Unistyles.unistyles.runtime.theme));
|
14
|
+
const [breakpoint, setBreakpoint] = (0, _react.useState)(_Unistyles.unistyles.runtime.currentBreakpoint);
|
15
|
+
const [screenSize, setScreenSize] = (0, _react.useState)({
|
16
|
+
width: 0,
|
17
|
+
height: 0
|
18
|
+
});
|
19
|
+
(0, _react.useEffect)(() => {
|
20
|
+
const subscription = unistylesEvents.addListener('onChange', event => {
|
21
|
+
switch (event.type) {
|
22
|
+
case _types.CxxUnistylesEventTypes.Theme:
|
23
|
+
{
|
24
|
+
const themeEvent = event;
|
25
|
+
setTheme(_Unistyles.unistyles.runtime.getTheme(themeEvent.payload.currentTheme));
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
case _types.CxxUnistylesEventTypes.Size:
|
29
|
+
{
|
30
|
+
const sizeEvent = event;
|
31
|
+
setScreenSize({
|
32
|
+
width: sizeEvent.payload.width,
|
33
|
+
height: sizeEvent.payload.height
|
34
|
+
});
|
35
|
+
// todo
|
36
|
+
// setBreakpoint(unistyles.runtime.currentBreakpoint)
|
37
|
+
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
case _types.CxxUnistylesEventTypes.Breakpoint:
|
41
|
+
{
|
42
|
+
const breakpointEvent = event;
|
43
|
+
setBreakpoint(breakpointEvent.payload.currentBreakpoint);
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
default:
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
});
|
50
|
+
return subscription.remove;
|
51
|
+
}, []);
|
52
|
+
return {
|
53
|
+
theme,
|
54
|
+
breakpoint,
|
55
|
+
screenSize
|
56
|
+
};
|
57
|
+
};
|
58
|
+
exports.useUnistyles = useUnistyles;
|
59
|
+
//# sourceMappingURL=useUnistyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_types","_Unistyles","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","theme","setTheme","useState","unistyles","runtime","getTheme","breakpoint","setBreakpoint","currentBreakpoint","screenSize","setScreenSize","width","height","useEffect","subscription","addListener","event","type","CxxUnistylesEventTypes","Theme","themeEvent","payload","currentTheme","Size","sizeEvent","Breakpoint","breakpointEvent","remove","exports"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,oBAAS,CAACC,OAAO,CAACC,QAAQ,CAACF,oBAAS,CAACC,OAAO,CAACJ,KAAK,CAAC,CAAC;EACvF,MAAM,CAACM,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAL,eAAQ,EAACC,oBAAS,CAACC,OAAO,CAACI,iBAAiB,CAAC;EACjF,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAR,eAAQ,EAAC;IACzCS,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGnB,eAAe,CAACoB,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKC,6BAAsB,CAACC,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGJ,KAA+B;YAElDf,QAAQ,CAACE,oBAAS,CAACC,OAAO,CAACC,QAAQ,CAACe,UAAU,CAACC,OAAO,CAACC,YAAY,CAAC,CAAC;YAErE;UACJ;QACA,KAAKJ,6BAAsB,CAACK,IAAI;UAAE;YAC9B,MAAMC,SAAS,GAAGR,KAA8B;YAEhDN,aAAa,CAAC;cACVC,KAAK,EAAEa,SAAS,CAACH,OAAO,CAACV,KAAK;cAC9BC,MAAM,EAAEY,SAAS,CAACH,OAAO,CAACT;YAC9B,CAAC,CAAC;YACF;YACA;;YAEA;UACJ;QACA,KAAKM,6BAAsB,CAACO,UAAU;UAAE;YACpC,MAAMC,eAAe,GAAGV,KAAoC;YAE5DT,aAAa,CAACmB,eAAe,CAACL,OAAO,CAACb,iBAAiB,CAAC;YAExD;UACJ;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOM,YAAY,CAACa,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH3B,KAAK;IACLM,UAAU;IACVG;EACJ,CAAC;AACL,CAAC;AAAAmB,OAAA,CAAA7B,YAAA,GAAAA,YAAA"}
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.sortAndValidateBreakpoints = exports.getValueForBreakpoint = exports.getBreakpointFromScreenWidth = void 0;
|
7
|
+
var _Unistyles = require("../Unistyles");
|
7
8
|
var _common = require("./common");
|
8
9
|
var _mediaQueries = require("./mediaQueries");
|
9
10
|
/**
|
@@ -97,7 +98,7 @@ const getBreakpointFromScreenWidth = (width, breakpointEntries) => {
|
|
97
98
|
* getValueForBreakpoint(values, 'sm', screenSize, breakpoints); // 'value1'
|
98
99
|
*/
|
99
100
|
exports.getBreakpointFromScreenWidth = getBreakpointFromScreenWidth;
|
100
|
-
const getValueForBreakpoint = (value, breakpoint, screenSize
|
101
|
+
const getValueForBreakpoint = (value, breakpoint, screenSize) => {
|
101
102
|
// the highest priority is for custom media queries
|
102
103
|
const customMediaQueries = Object.entries(value).filter(_ref2 => {
|
103
104
|
let [key] = _ref2;
|
@@ -109,7 +110,7 @@ const getValueForBreakpoint = (value, breakpoint, screenSize, breakpointPairs) =
|
|
109
110
|
}
|
110
111
|
|
111
112
|
// if no custom media query, or didn't match, proceed with defined breakpoints
|
112
|
-
const unifiedKey = breakpoint
|
113
|
+
const unifiedKey = breakpoint?.toLowerCase();
|
113
114
|
const directBreakpoint = value[unifiedKey];
|
114
115
|
|
115
116
|
// if there is a direct key like 'sm' or 'md', or value for this key exists but its undefined
|
@@ -118,6 +119,7 @@ const getValueForBreakpoint = (value, breakpoint, screenSize, breakpointPairs) =
|
|
118
119
|
}
|
119
120
|
|
120
121
|
// there is no direct hit for breakpoint nor media-query, so let's simulate CSS cascading
|
122
|
+
const breakpointPairs = _Unistyles.unistyles.runtime.sortedBreakpoints;
|
121
123
|
const currentBreakpoint = breakpointPairs.findIndex(_ref3 => {
|
122
124
|
let [key] = _ref3;
|
123
125
|
return key === unifiedKey;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_Unistyles","require","_common","_mediaQueries","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","throwError","length","Set","size","exports","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","isMediaQuery","customMediaQueryKey","getKeyForCustomMediaQuery","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","unistyles","runtime","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,0BAA0B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R,MAAM,CAAC,CAAAe,KAAA,EAAQxB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAA2B,KAAA;IAAA,OAAYxB,KAAK,GAAGoB,iBAAiB,IAAIvB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EuB,GAAG,CAACC,KAAA;IAAA,IAAC,CAAC7B,GAAG,CAAC,GAAA6B,KAAA;IAAA,OAAK7B,GAAG;EAAA,EAAC;EAExB,OAAOoB,eAAe,CAAC3B,MAAM,GAAG,CAAC,GAC3BY,KAAK,CAACqB,oBAAoB,CAACA,oBAAoB,CAACjC,MAAM,GAAG,CAAC,CAAC,CAAwC,GACnGqC,SAAS;AACnB,CAAC;AAAAlC,OAAA,CAAAY,qBAAA,GAAAA,qBAAA"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.warn = exports.throwError = exports.isWeb = void 0;
|
6
|
+
exports.warn = exports.throwError = exports.isWeb = exports.isServer = void 0;
|
7
7
|
var _reactNative = require("react-native");
|
8
8
|
const throwError = message => {
|
9
9
|
throw new Error(`🦄 [react-native-unistyles]: ${message}`);
|
@@ -13,6 +13,6 @@ const warn = message => {
|
|
13
13
|
console.warn(`🦄 [react-native-unistyles]: ${message}`);
|
14
14
|
};
|
15
15
|
exports.warn = warn;
|
16
|
-
const isWeb =
|
17
|
-
exports.
|
16
|
+
const isWeb = exports.isWeb = _reactNative.Platform.OS === 'web';
|
17
|
+
const isServer = exports.isServer = typeof window === 'undefined';
|
18
18
|
//# sourceMappingURL=common.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","throwError","message","Error","exports","warn","console","isWeb","Platform","OS"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAAAE,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEM,MAAMI,IAAI,GAAIH,OAAe,IAAK;EACrCI,OAAO,CAACD,IAAI,CAAE,gCAA+BH,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAC,IAAA,GAAAA,IAAA;AAEM,MAAME,KAAK,
|
1
|
+
{"version":3,"names":["_reactNative","require","throwError","message","Error","exports","warn","console","isWeb","Platform","OS","isServer","window"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAAAE,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEM,MAAMI,IAAI,GAAIH,OAAe,IAAK;EACrCI,OAAO,CAACD,IAAI,CAAE,gCAA+BH,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAC,IAAA,GAAAA,IAAA;AAEM,MAAME,KAAK,GAAAH,OAAA,CAAAG,KAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMC,QAAQ,GAAAN,OAAA,CAAAM,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW"}
|
@@ -3,6 +3,21 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
var _exportNames = {
|
7
|
+
normalizeStyles: true,
|
8
|
+
getBreakpointFromScreenWidth: true,
|
9
|
+
sortAndValidateBreakpoints: true,
|
10
|
+
getValueForBreakpoint: true,
|
11
|
+
proxifyFunction: true,
|
12
|
+
parseStyle: true,
|
13
|
+
isServer: true,
|
14
|
+
extractValues: true,
|
15
|
+
getKeyForCustomMediaQuery: true,
|
16
|
+
isMediaQuery: true,
|
17
|
+
isWithinTheHeight: true,
|
18
|
+
isWithinTheWidth: true,
|
19
|
+
isWithinTheWidthAndHeight: true
|
20
|
+
};
|
6
21
|
Object.defineProperty(exports, "extractValues", {
|
7
22
|
enumerable: true,
|
8
23
|
get: function () {
|
@@ -33,6 +48,12 @@ Object.defineProperty(exports, "isMediaQuery", {
|
|
33
48
|
return _mediaQueries.isMediaQuery;
|
34
49
|
}
|
35
50
|
});
|
51
|
+
Object.defineProperty(exports, "isServer", {
|
52
|
+
enumerable: true,
|
53
|
+
get: function () {
|
54
|
+
return _common.isServer;
|
55
|
+
}
|
56
|
+
});
|
36
57
|
Object.defineProperty(exports, "isWithinTheHeight", {
|
37
58
|
enumerable: true,
|
38
59
|
get: function () {
|
@@ -76,7 +97,20 @@ Object.defineProperty(exports, "sortAndValidateBreakpoints", {
|
|
76
97
|
}
|
77
98
|
});
|
78
99
|
var _normalizeStyles = require("./normalizeStyles");
|
100
|
+
var _normalizer = require("./normalizer");
|
101
|
+
Object.keys(_normalizer).forEach(function (key) {
|
102
|
+
if (key === "default" || key === "__esModule") return;
|
103
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
104
|
+
if (key in exports && exports[key] === _normalizer[key]) return;
|
105
|
+
Object.defineProperty(exports, key, {
|
106
|
+
enumerable: true,
|
107
|
+
get: function () {
|
108
|
+
return _normalizer[key];
|
109
|
+
}
|
110
|
+
});
|
111
|
+
});
|
79
112
|
var _breakpoints = require("./breakpoints");
|
80
113
|
var _styles = require("./styles");
|
114
|
+
var _common = require("./common");
|
81
115
|
var _mediaQueries = require("./mediaQueries");
|
82
116
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_normalizeStyles","require","_breakpoints","_styles","_mediaQueries"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_normalizeStyles","require","_normalizer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_breakpoints","_styles","_common","_mediaQueries"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,YAAA,GAAAd,OAAA;AACA,IAAAe,OAAA,GAAAf,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/module.d.ts"],"mappings":""}
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.normalizeStyles = void 0;
|
7
7
|
var _common = require("./common");
|
8
|
-
|
9
|
-
const normalizeBoxShadow =
|
8
|
+
var _normalizer = require("./normalizer");
|
9
|
+
const normalizeBoxShadow = style => {
|
10
10
|
const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
|
11
|
-
if (!requiredBoxShadowProperties.every(prop => prop in
|
11
|
+
if (!requiredBoxShadowProperties.every(prop => prop in style)) {
|
12
12
|
(0, _common.warn)(`can't apply box shadow as you miss at least one of these properties: ${requiredBoxShadowProperties.join(', ')}`);
|
13
13
|
return {
|
14
14
|
shadowColor: undefined,
|
@@ -18,16 +18,16 @@ const normalizeBoxShadow = styles => {
|
|
18
18
|
};
|
19
19
|
}
|
20
20
|
return {
|
21
|
-
boxShadow: preprocessor.createBoxShadowValue(
|
21
|
+
boxShadow: _normalizer.preprocessor.createBoxShadowValue(style),
|
22
22
|
shadowColor: undefined,
|
23
23
|
shadowOffset: undefined,
|
24
24
|
shadowOpacity: undefined,
|
25
25
|
shadowRadius: undefined
|
26
26
|
};
|
27
27
|
};
|
28
|
-
const normalizeTextShadow =
|
28
|
+
const normalizeTextShadow = style => {
|
29
29
|
const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
|
30
|
-
if (!requiredTextShadowProperties.every(prop => prop in
|
30
|
+
if (!requiredTextShadowProperties.every(prop => prop in style)) {
|
31
31
|
(0, _common.warn)(`can't apply text shadow as you miss at least one of these properties: ${requiredTextShadowProperties.join(', ')}`);
|
32
32
|
return {
|
33
33
|
textShadowColor: undefined,
|
@@ -36,20 +36,20 @@ const normalizeTextShadow = styles => {
|
|
36
36
|
};
|
37
37
|
}
|
38
38
|
return {
|
39
|
-
textShadow: preprocessor.createTextShadowValue(
|
39
|
+
textShadow: _normalizer.preprocessor.createTextShadowValue(style),
|
40
40
|
textShadowColor: undefined,
|
41
41
|
textShadowOffset: undefined,
|
42
42
|
textShadowRadius: undefined
|
43
43
|
};
|
44
44
|
};
|
45
|
-
const normalizeStyles =
|
46
|
-
const normalizedTransform = 'transform' in
|
47
|
-
transform: preprocessor.createTransformValue(
|
45
|
+
const normalizeStyles = style => {
|
46
|
+
const normalizedTransform = 'transform' in style && Array.isArray(style.transform) ? {
|
47
|
+
transform: _normalizer.preprocessor.createTransformValue(style.transform)
|
48
48
|
} : {};
|
49
|
-
const normalizedBoxShadow = 'shadowColor' in
|
50
|
-
const normalizedTextShadow = 'textShadowColor' in
|
49
|
+
const normalizedBoxShadow = 'shadowColor' in style || 'shadowOffset' in style || 'shadowOpacity' in style || 'shadowRadius' in style ? normalizeBoxShadow(style) : {};
|
50
|
+
const normalizedTextShadow = 'textShadowColor' in style || 'textShadowOffset' in style || 'textShadowRadius' in style ? normalizeTextShadow(style) : {};
|
51
51
|
return {
|
52
|
-
...
|
52
|
+
...style,
|
53
53
|
...normalizedTransform,
|
54
54
|
...normalizedBoxShadow,
|
55
55
|
...normalizedTextShadow
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","
|
1
|
+
{"version":3,"names":["_common","require","_normalizer","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","preprocessor","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow","exports"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA,MAAME,kBAAkB,GAAyBC,KAAQ,IAA0B;EAC/E,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC3D,IAAAI,YAAI,EAAE,wEAAuEH,2BAA2B,CAACI,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW,EAAEC,SAAS;MACtBC,YAAY,EAAED,SAAS;MACvBE,aAAa,EAAEF,SAAS;MACxBG,YAAY,EAAEH;IAClB,CAAC;EAC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ACtB,iBAAiB,IAAI5B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3Bc,mBAAmB,CAACd,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGsB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,eAAA,GAAAA,eAAA"}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.preprocessor = exports.normalizeNumericValue = exports.normalizeColor = void 0;
|
7
|
+
var _normalizeColors = _interopRequireDefault(require("@react-native/normalize-colors"));
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
+
// based on react-native-web normalizer
|
10
|
+
// https://github.com/necolas/react-native-web
|
11
|
+
|
12
|
+
const normalizeColor = function (color) {
|
13
|
+
let opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
14
|
+
// If the opacity is 1 there's no need to normalize the color
|
15
|
+
if (opacity === 1) {
|
16
|
+
return color;
|
17
|
+
}
|
18
|
+
const integer = (0, _normalizeColors.default)(color);
|
19
|
+
|
20
|
+
// If the colour is an unknown format, the return value is null
|
21
|
+
if (integer === null) {
|
22
|
+
return color;
|
23
|
+
}
|
24
|
+
const hex = integer.toString(16).padStart(8, '0');
|
25
|
+
if (hex.length === 8) {
|
26
|
+
const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
|
27
|
+
return `rgba(${r},${g},${b},${a / 255 * opacity})`;
|
28
|
+
}
|
29
|
+
return color;
|
30
|
+
};
|
31
|
+
exports.normalizeColor = normalizeColor;
|
32
|
+
const normalizeNumericValue = value => value ? `${value}px` : value;
|
33
|
+
exports.normalizeNumericValue = normalizeNumericValue;
|
34
|
+
const normalizeTransform = (key, value) => {
|
35
|
+
if (key.includes('scale')) {
|
36
|
+
return value;
|
37
|
+
}
|
38
|
+
if (typeof value === 'number') {
|
39
|
+
return normalizeNumericValue(value);
|
40
|
+
}
|
41
|
+
return value;
|
42
|
+
};
|
43
|
+
const createTextShadowValue = style => {
|
44
|
+
// at this point every prop is present
|
45
|
+
const {
|
46
|
+
textShadowColor,
|
47
|
+
textShadowOffset,
|
48
|
+
textShadowRadius
|
49
|
+
} = style;
|
50
|
+
const offsetX = normalizeNumericValue(textShadowOffset.width);
|
51
|
+
const offsetY = normalizeNumericValue(textShadowOffset.height);
|
52
|
+
const radius = normalizeNumericValue(textShadowRadius);
|
53
|
+
const color = normalizeColor(textShadowColor);
|
54
|
+
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
55
|
+
};
|
56
|
+
const createBoxShadowValue = style => {
|
57
|
+
// at this point every prop is present
|
58
|
+
const {
|
59
|
+
shadowColor,
|
60
|
+
shadowOffset,
|
61
|
+
shadowOpacity,
|
62
|
+
shadowRadius
|
63
|
+
} = style;
|
64
|
+
const offsetX = normalizeNumericValue(shadowOffset.width);
|
65
|
+
const offsetY = normalizeNumericValue(shadowOffset.height);
|
66
|
+
const radius = normalizeNumericValue(shadowRadius);
|
67
|
+
const color = normalizeColor(shadowColor, shadowOpacity);
|
68
|
+
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
69
|
+
};
|
70
|
+
const createTransformValue = transforms => transforms.map(transform => {
|
71
|
+
const [key] = Object.keys(transform);
|
72
|
+
if (!key) {
|
73
|
+
return undefined;
|
74
|
+
}
|
75
|
+
const value = transform[key];
|
76
|
+
switch (key) {
|
77
|
+
case 'matrix':
|
78
|
+
case 'matrix3d':
|
79
|
+
return `${key}(${value.join(',')})`;
|
80
|
+
default:
|
81
|
+
return `${key}(${normalizeTransform(key, value)})`;
|
82
|
+
}
|
83
|
+
}).filter(Boolean).join(' ');
|
84
|
+
const preprocessor = exports.preprocessor = {
|
85
|
+
createTextShadowValue,
|
86
|
+
createBoxShadowValue,
|
87
|
+
createTransformValue
|
88
|
+
};
|
89
|
+
//# sourceMappingURL=normalizer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","obj","__esModule","default","normalizeColor","color","opacity","arguments","length","undefined","integer","normalizeColors","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","exports","normalizeNumericValue","value","normalizeTransform","key","includes","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","createBoxShadowValue","shadowColor","shadowOffset","shadowOpacity","shadowRadius","createTransformValue","transforms","transform","Object","keys","join","Boolean","preprocessor"],"sourceRoot":"../../../src","sources":["utils/normalizer.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAF5D;AACA;;AAUO,MAAMG,cAAc,GAAG,SAAAA,CAACC,KAAa,EAA0B;EAAA,IAAxBC,OAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC7D;EACA,IAAID,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EAEA,MAAMK,OAAO,GAAG,IAAAC,wBAAe,EAACN,KAAK,CAAkB;;EAEvD;EACA,IAAIK,OAAO,KAAK,IAAI,EAAE;IAClB,OAAOL,KAAK;EAChB;EAEA,MAAMO,GAAG,GAAGF,OAAO,CAACG,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAEjD,IAAIF,GAAG,CAACJ,MAAM,KAAK,CAAC,EAAE;IAClB,MAAM,CAACO,CAA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;EACpBK;AACJ,CAAC"}
|
@@ -28,8 +28,8 @@ var _common = require("./common");
|
|
28
28
|
* const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
|
29
29
|
* proxifiedFunction() // parsed style based on screenSize and breakpoints
|
30
30
|
*/
|
31
|
-
const proxifyFunction = (fn, breakpoint, screenSize
|
32
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize
|
31
|
+
const proxifyFunction = (fn, breakpoint, screenSize) => new Proxy(fn, {
|
32
|
+
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize)
|
33
33
|
});
|
34
34
|
|
35
35
|
/**
|
@@ -58,26 +58,26 @@ const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) => new Pro
|
|
58
58
|
* // { fontSize: '12px' }
|
59
59
|
*/
|
60
60
|
exports.proxifyFunction = proxifyFunction;
|
61
|
-
const parseStyle = (style, breakpoint, screenSize
|
61
|
+
const parseStyle = (style, breakpoint, screenSize) => {
|
62
62
|
const entries = Object.entries(style);
|
63
63
|
const parsedStyles = Object.fromEntries(entries.map(_ref => {
|
64
64
|
let [key, value] = _ref;
|
65
65
|
const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
|
66
66
|
if (hasNestedProperties) {
|
67
|
-
return [key, parseStyle(value, breakpoint, screenSize
|
67
|
+
return [key, parseStyle(value, breakpoint, screenSize)];
|
68
68
|
}
|
69
69
|
const isTransform = key === 'transform';
|
70
70
|
if (isTransform && Array.isArray(value)) {
|
71
|
-
return [key, value.map(value => parseStyle(value, breakpoint, screenSize
|
71
|
+
return [key, value.map(value => parseStyle(value, breakpoint, screenSize))];
|
72
72
|
}
|
73
73
|
const isDynamicFunction = typeof value === 'function';
|
74
74
|
const isValidStyle = typeof value !== 'object';
|
75
75
|
if (isDynamicFunction || isValidStyle) {
|
76
76
|
return [key, value];
|
77
77
|
}
|
78
|
-
return [key, (0, _breakpoints.getValueForBreakpoint)(value, breakpoint, screenSize
|
78
|
+
return [key, (0, _breakpoints.getValueForBreakpoint)(value, breakpoint, screenSize)];
|
79
79
|
}));
|
80
|
-
return
|
80
|
+
return _common.isWeb ? (0, _normalizeStyles.normalizeStyles)(parsedStyles) : parsedStyles;
|
81
81
|
};
|
82
82
|
exports.parseStyle = parseStyle;
|
83
83
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","
|
1
|
+
{"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","exports","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","value","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle","getValueForBreakpoint","isWeb","normalizeStyles"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxBAO,OAA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