react-native-unistyles 1.0.0-rc.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/README.md +16 -3
  2. package/lib/commonjs/UnistylesTheme.js +2 -2
  3. package/lib/commonjs/UnistylesTheme.js.map +1 -1
  4. package/lib/commonjs/hooks/useDimensions.web.js +3 -2
  5. package/lib/commonjs/hooks/useDimensions.web.js.map +1 -1
  6. package/lib/commonjs/types/index.js +15 -0
  7. package/lib/commonjs/types/index.js.map +1 -1
  8. package/lib/commonjs/types/normalizer.js +6 -0
  9. package/lib/commonjs/types/normalizer.js.map +1 -0
  10. package/lib/commonjs/utils/common.js +3 -3
  11. package/lib/commonjs/utils/common.js.map +1 -1
  12. package/lib/commonjs/utils/index.js +34 -0
  13. package/lib/commonjs/utils/index.js.map +1 -1
  14. package/lib/commonjs/utils/normalizeStyles.web.js +13 -13
  15. package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -1
  16. package/lib/commonjs/utils/normalizer.js +83 -0
  17. package/lib/commonjs/utils/normalizer.js.map +1 -0
  18. package/lib/commonjs/utils/styles.js +1 -1
  19. package/lib/commonjs/utils/styles.js.map +1 -1
  20. package/lib/module/hooks/useDimensions.web.js +3 -2
  21. package/lib/module/hooks/useDimensions.web.js.map +1 -1
  22. package/lib/module/types/index.js +1 -1
  23. package/lib/module/types/index.js.map +1 -1
  24. package/lib/module/types/normalizer.js +2 -0
  25. package/lib/module/types/normalizer.js.map +1 -0
  26. package/lib/module/utils/common.js +2 -1
  27. package/lib/module/utils/common.js.map +1 -1
  28. package/lib/module/utils/index.js +2 -0
  29. package/lib/module/utils/index.js.map +1 -1
  30. package/lib/module/utils/normalizeStyles.web.js +13 -13
  31. package/lib/module/utils/normalizeStyles.web.js.map +1 -1
  32. package/lib/module/utils/normalizer.js +75 -0
  33. package/lib/module/utils/normalizer.js.map +1 -0
  34. package/lib/module/utils/styles.js +1 -1
  35. package/lib/module/utils/styles.js.map +1 -1
  36. package/lib/typescript/examples/expo/src/App.d.ts +3 -0
  37. package/lib/typescript/examples/expo/src/App.d.ts.map +1 -0
  38. package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +3 -0
  39. package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +1 -0
  40. package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +3 -0
  41. package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +1 -0
  42. package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +7 -0
  43. package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +1 -0
  44. package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +3 -0
  45. package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +1 -0
  46. package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +3 -0
  47. package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +1 -0
  48. package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +3 -0
  49. package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +1 -0
  50. package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +3 -0
  51. package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +1 -0
  52. package/lib/typescript/examples/expo/src/examples/Theme.d.ts +3 -0
  53. package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +1 -0
  54. package/lib/typescript/examples/expo/src/examples/index.d.ts +8 -0
  55. package/lib/typescript/examples/expo/src/examples/index.d.ts.map +1 -0
  56. package/lib/typescript/examples/expo/src/index.d.ts +2 -0
  57. package/lib/typescript/examples/expo/src/index.d.ts.map +1 -0
  58. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +8 -0
  59. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +1 -0
  60. package/lib/typescript/examples/expo/src/styles/index.d.ts +46 -0
  61. package/lib/typescript/examples/expo/src/styles/index.d.ts.map +1 -0
  62. package/lib/typescript/examples/expo/src/styles/theme.d.ts +24 -0
  63. package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +1 -0
  64. package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -1
  65. package/lib/typescript/src/types/index.d.ts +1 -0
  66. package/lib/typescript/src/types/index.d.ts.map +1 -1
  67. package/lib/typescript/src/types/normalizer.d.ts +20 -0
  68. package/lib/typescript/src/types/normalizer.d.ts.map +1 -0
  69. package/lib/typescript/src/utils/common.d.ts +2 -1
  70. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  71. package/lib/typescript/src/utils/index.d.ts +2 -0
  72. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  73. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +4 -1
  74. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -1
  75. package/lib/typescript/src/utils/normalizer.d.ts +11 -0
  76. package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
  77. package/package.json +16 -11
  78. package/src/hooks/useDimensions.web.ts +3 -2
  79. package/src/types/index.ts +1 -0
  80. package/src/types/normalizer.ts +29 -0
  81. package/src/utils/common.ts +2 -1
  82. package/src/utils/index.ts +2 -0
  83. package/src/utils/normalizeStyles.web.ts +21 -42
  84. package/src/utils/normalizer.ts +105 -0
  85. package/src/utils/styles.ts +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ![GitHub package.json version](https://img.shields.io/github/package-json/v/jpudysz/react-native-unistyles?style=for-the-badge)
10
10
  [![npm downloads](https://img.shields.io/npm/dm/react-native-unistyles.svg?style=for-the-badge)](https://www.npmjs.com/package/react-native-unistyles)
11
- ![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20iOS%20%7C%20RNWeb-blue.svg?style=for-the-badge)
11
+ ![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20IOS%20%7C%20SSR%20%7C%20Web-blue.svg?style=for-the-badge)
12
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
13
13
 
14
14
  ## Features
@@ -18,7 +18,8 @@
18
18
  - 🖥️ Supports custom breakpoints and css-like media queries
19
19
  - 🎨 Access theme in your StyleSheets and components
20
20
  - 🪄 Supports dynamic functions to access values from JSX
21
- - 🥳 Compatible with Expo, Expo Go, Bare React Native and React Native Web
21
+ - 🥳 Compatible with Expo, Expo Go, Bare React Native, React Native Web and SSR
22
+ - 🛡️ ~99% Test coverage
22
23
  - ⚔️ No 3rd party dependencies
23
24
 
24
25
  *-based on this [benchmark](https://github.com/efstathiosntonas/react-native-style-libraries-benchmark)
@@ -26,7 +27,7 @@
26
27
  ## Installation
27
28
 
28
29
  ```cmd
29
- yarn add react-native-unistyles@rc
30
+ yarn add react-native-unistyles
30
31
  ```
31
32
 
32
33
  ## [Documentation](https://reactnativeunistyles.vercel.app/)
@@ -34,6 +35,18 @@ yarn add react-native-unistyles@rc
34
35
  - [References](https://reactnativeunistyles.vercel.app/reference/create-stylesheet/)
35
36
  - [Examples](https://reactnativeunistyles.vercel.app/example/breakpoints/)
36
37
 
38
+ ## Faster, better and simpler - v.2.0 🚀
39
+
40
+ There is ongoing work on branch [2.0](https://github.com/jpudysz/react-native-unistyles/tree/2.0).
41
+
42
+ ---
43
+
44
+ Join early testers and discussion [here](https://github.com/jpudysz/react-native-unistyles/discussions/41).
45
+
46
+ ```cmd
47
+ yarn add react-native-unistyles@next
48
+ ```
49
+
37
50
  ## Blog post
38
51
 
39
52
  Read about what drove me to create this library in this blog post [here](https://www.reactnativecrossroads.com/posts/level-up-react-native-styles).
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.UnistylesTheme = exports.UnistylesContext = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
10
  const UnistylesContext = exports.UnistylesContext = /*#__PURE__*/(0, _react.createContext)({});
11
11
  const UnistylesTheme = _ref => {
12
12
  let {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnistylesContext","exports","createContext","UnistylesTheme","_ref","theme","children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C,OAAA,CAAAD,gBAAA,gBAAG,IAAAE,oBAAa,EAAC,CAAC,CAAC,CAAC;AAE1C,MAAMC,cAA4D,GAAGC,IAAA;EAAA,IAAC;IACzEC,KAAK;IACLC;EACJ,CAAC,GAAAF,IAAA;EAAA,oBACG7B,MAAA,CAAAU,OAAA,CAAAsB,aAAA,CAACP,gBAAgB,CAACQ,QAAQ;IAACC,KAAK,EAAEJ;EAAM,GACnCC,QACsB,CAAC;AAAA,CAC/B;AAAAL,OAAA,CAAAE,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","UnistylesContext","exports","createContext","UnistylesTheme","_ref","theme","children","createElement","Provider","value"],"sourceRoot":"../../src","sources":["UnistylesTheme.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA4C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAOrC,MAAMY,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,gBAAG,IAAAE,oBAAa,EAAC,CAAC,CAAC,CAAC;AAE1C,MAAMC,cAA4D,GAAGC,IAAA;EAAA,IAAC;IACzEC,KAAK;IACLC;EACJ,CAAC,GAAAF,IAAA;EAAA,oBACG5B,MAAA,CAAAS,OAAA,CAAAsB,aAAA,CAACP,gBAAgB,CAACQ,QAAQ;IAACC,KAAK,EAAEJ;EAAM,GACnCC,QACsB,CAAC;AAAA,CAC/B;AAAAL,OAAA,CAAAE,cAAA,GAAAA,cAAA"}
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useDimensions = void 0;
7
7
  var _react = require("react");
8
+ var _utils = require("../utils");
8
9
  const useDimensions = () => {
9
10
  const timerRef = (0, _react.useRef)();
10
11
  const [screenSize, setScreenSize] = (0, _react.useState)({
11
- width: window.innerWidth,
12
- height: window.innerHeight
12
+ width: _utils.isServer ? 0 : window.innerWidth,
13
+ height: _utils.isServer ? 0 : window.innerHeight
13
14
  });
14
15
  (0, _react.useEffect)(() => {
15
16
  const handleResize = () => {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","useDimensions","timerRef","useRef","screenSize","setScreenSize","useState","width","window","innerWidth","height","innerHeight","useEffect","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener","exports"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAAgC,CAAC;EACxD,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAAa;IACrDC,KAAK,EAAEC,MAAM,CAACC,UAAU;IACxBC,MAAM,EAAEF,MAAM,CAACG;EACnB,CAAC,CAAC;EAEF,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACZ,QAAQ,CAACa,OAAO,CAAC;MAE9Bb,QAAQ,CAACa,OAAO,GAAGC,UAAU,CAAC,MAAMX,aAAa,CAAC;QAC9CE,KAAK,EAAEC,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACS,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTL,MAAM,CAACU,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACZ,QAAQ,CAACa,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOX,UAAU;AACrB,CAAC;AAAAe,OAAA,CAAAlB,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_react","require","_utils","useDimensions","timerRef","useRef","screenSize","setScreenSize","useState","width","isServer","window","innerWidth","height","innerHeight","useEffect","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener","exports"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAAgC,CAAC;EACxD,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAAa;IACrDC,KAAK,EAAEC,eAAQ,GAAG,CAAC,GAAGC,MAAM,CAACC,UAAU;IACvCC,MAAM,EAAEH,eAAQ,GAAG,CAAC,GAAGC,MAAM,CAACG;EAClC,CAAC,CAAC;EAEF,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACb,QAAQ,CAACc,OAAO,CAAC;MAE9Bd,QAAQ,CAACc,OAAO,GAAGC,UAAU,CAAC,MAAMZ,aAAa,CAAC;QAC9CE,KAAK,EAAEE,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACS,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTL,MAAM,CAACU,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACb,QAAQ,CAACc,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOZ,UAAU;AACrB,CAAC;AAAAgB,OAAA,CAAAnB,aAAA,GAAAA,aAAA"}
@@ -1,2 +1,17 @@
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
+ });
2
17
  //# 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"],"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"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=normalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/normalizer.ts"],"mappings":""}
@@ -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 = () => _reactNative.Platform.OS === 'web';
17
- exports.isWeb = isWeb;
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,GAAGA,CAAA,KAAMC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAAAL,OAAA,CAAAG,KAAA,GAAAA,KAAA"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA"}
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"}
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.normalizeStyles = void 0;
7
7
  var _common = require("./common");
8
- const preprocessor = require('react-native-web/src/exports/StyleSheet/preprocess.js');
9
- const normalizeBoxShadow = styles => {
8
+ var _normalizer = require("./normalizer");
9
+ const normalizeBoxShadow = style => {
10
10
  const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
11
- if (!requiredBoxShadowProperties.every(prop => prop in styles)) {
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(styles),
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 = styles => {
28
+ const normalizeTextShadow = style => {
29
29
  const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
30
- if (!requiredTextShadowProperties.every(prop => prop in styles)) {
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(styles),
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 = styles => {
46
- const normalizedTransform = 'transform' in styles && Array.isArray(styles.transform) ? {
47
- transform: preprocessor.createTransformValue(styles.transform)
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 styles || 'shadowOffset' in styles || 'shadowOpacity' in styles || 'shadowRadius' in styles ? normalizeBoxShadow(styles) : {};
50
- const normalizedTextShadow = 'textShadowColor' in styles || 'textShadowOffset' in styles || 'textShadowRadius' in styles ? normalizeTextShadow(styles) : {};
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
- ...styles,
52
+ ...style,
53
53
  ...normalizedTransform,
54
54
  ...normalizedBoxShadow,
55
55
  ...normalizedTextShadow
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","preprocessor","normalizeBoxShadow","styles","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","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;AAEA,MAAMC,YAA0B,GAAGD,OAAO,CAAC,uDAAuD,CAAC;AAuBnG,MAAME,kBAAkB,GAAkBC,MAAS,IAA0B;EACzE,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,MAAM,CAAC,EAAE;IAC5D,IAAAI,YAAI,EA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BAAmB,GACrB,aAAa,IAAI1B,MAAM,IACvB,cAAc,IAAIA,MAAM,IACxB,eAAe,IAAIA,MAAM,IACzB,cAAc,IAAIA,MAAM,GACxBD,kBAAkB,CAACC,MAAM,CAAC,GAAG,CAAC,CAAC;EAEnC,MAAM2B,oBAAoB,GACtB,iBAAiB,IAAI3B,MAAM,IAC3B,kBAAkB,IAAIA,MAAM,IAC5B,kBAAkB,IAAIA,MAAM,GAC5Ba,mBAAmB,CAACb,MAAM,CAAC,GAAG,CAAC,CAAC;EAEpC,OAAO;IACH,GAAGA,MAAM;IACT,GAAGqB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,eAAA,GAAAA,eAAA"}
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,S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kB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM4B,oBAAoB,GACtB,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,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.preprocessor = exports.normalizeNumericValue = exports.normalizeColor = void 0;
7
+ // based on react-native-web normalizer
8
+ // https://github.com/necolas/react-native-web
9
+
10
+ // for now supports
11
+ // hex colors (3, 6, 8) chars
12
+ // colors like orange red etc.
13
+ const normalizeColor = function (color) {
14
+ let opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
15
+ if (!color.startsWith('#')) {
16
+ return color;
17
+ }
18
+ if (color.length === 9) {
19
+ const [r, g, b, a] = color.slice(1).split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
20
+ return `rgba(${r},${g},${b},${a / 255})`;
21
+ }
22
+ const sanitizedHex = color.length === 4 ? color.slice(1).split('').map(char => `${char}${char}`).join('') : color.slice(1);
23
+ return sanitizedHex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num)).reduce((acc, color) => `${acc}${color},`, 'rgba(').concat(`${opacity})`);
24
+ };
25
+ exports.normalizeColor = normalizeColor;
26
+ const normalizeNumericValue = value => value ? `${value}px` : value;
27
+ exports.normalizeNumericValue = normalizeNumericValue;
28
+ const normalizeTransform = (key, value) => {
29
+ if (key.includes('scale')) {
30
+ return value;
31
+ }
32
+ if (typeof value === 'number') {
33
+ return normalizeNumericValue(value);
34
+ }
35
+ return value;
36
+ };
37
+ const createTextShadowValue = style => {
38
+ // at this point every prop is present
39
+ const {
40
+ textShadowColor,
41
+ textShadowOffset,
42
+ textShadowRadius
43
+ } = style;
44
+ const offsetX = normalizeNumericValue(textShadowOffset.width);
45
+ const offsetY = normalizeNumericValue(textShadowOffset.height);
46
+ const radius = normalizeNumericValue(textShadowRadius);
47
+ const color = normalizeColor(textShadowColor);
48
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
49
+ };
50
+ const createBoxShadowValue = style => {
51
+ // at this point every prop is present
52
+ const {
53
+ shadowColor,
54
+ shadowOffset,
55
+ shadowOpacity,
56
+ shadowRadius
57
+ } = style;
58
+ const offsetX = normalizeNumericValue(shadowOffset.width);
59
+ const offsetY = normalizeNumericValue(shadowOffset.height);
60
+ const radius = normalizeNumericValue(shadowRadius);
61
+ const color = normalizeColor(shadowColor, shadowOpacity);
62
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
63
+ };
64
+ const createTransformValue = transforms => transforms.map(transform => {
65
+ const [key] = Object.keys(transform);
66
+ if (!key) {
67
+ return undefined;
68
+ }
69
+ const value = transform[key];
70
+ switch (key) {
71
+ case 'matrix':
72
+ case 'matrix3d':
73
+ return `${key}(${value.join(',')})`;
74
+ default:
75
+ return `${key}(${normalizeTransform(key, value)})`;
76
+ }
77
+ }).filter(Boolean).join(' ');
78
+ const preprocessor = exports.preprocessor = {
79
+ createTextShadowValue,
80
+ createBoxShadowValue,
81
+ createTransformValue
82
+ };
83
+ //# sourceMappingURL=normalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeColor","color","opacity","arguments","length","undefined","startsWith","r","g","b","a","slice","split","map","x","parseInt","filter","num","isNaN","sanitizedHex","char","join","reduce","acc","concat","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","Boolean","preprocessor"],"sourceRoot":"../../../src","sources":["utils/normalizer.ts"],"mappings":";;;;;;AAAA;AACA;;AASA;AACA;AACA;AACO,MAAMA,cAAc,GAAG,SAAAA,CAACC,KAAa,EAA0B;EAAA,IAAxBC,OAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC7D,IAAI,CAACF,KAAK,CAACK,UAAU,CAAC,GAAG,CAAC,EAAE;IACxB,OAAOL,KAAK;EAChB;EAEA,IAAIA,KAAK,CAACG,MAAM,KAAK,CAAC,EAAE;IACpB,MAAM,CAACG,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC,GAAGT,KAAK,CACrBU,KAAK,CAAC,CAAC,CAAC,CACRC,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,CAACD,CAAC,EAAE,EAAE,CAAC,CAAC,CACzBE,MAAM,CAACC,GAAG,IAAI,CAACC,KAAK,CAACD,GAAG,CAAC,CAAC;IAE/B,OAAQ,QAAOV,CAAE,IAAGC,CAAE,IAAGC,CAAE,IAAIC,CAAC,GAAc,GAAI,GAAE;EACxD;EAEA,MAAMS,YAAY,GAAGlB,KAAK,CAACG,MAAM,KAAK,CAAC,GACjCH,KAAK,CACFU,KAAK,CAAC,CAAC,CAAC,CACRC,KAAK,CAAC,EAAE,CAAC,CACTC,GAAG,CAACO,IAAI,IAAK,GAAEA,IAAK,GAAEA,IAAK,EAAC,CAAC,CAC7BC,IAAI,CAAC,EAAE,CAAC,GACXpB,KAAK,CAACU,KAAK,CAAC,CAAC,CAAC;EAEpB,OAAOQ,YAAY,CACdP,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,CAACD,CAAC,EAAE,EAAE,CAAC,CAAC,CACzBE,MAAM,CAACC,GAAG,IAAI,CAACC,KAA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MI,OAAO,GAAGV,qBAAqB,CAACiB,YAAY,CAACN,KAAK,CAAC;EACzD,MAAMC,OAAO,GAAGZ,qBAAqB,CAACiB,YAAY,CAACJ,MAAM,CAAC;EAC1D,MAAMC,MAAM,GAAGd,qBAAqB,CAACmB,YAAY,CAAC;EAClD,MAAM5C,KAAK,GAAGD,cAAc,CAAC0C,WAAW,EAAYE,aAAuB,CAAC;EAE5E,OAAQ,GAAER,OAAQ,IAAGE,OAAQ,IAAGE,MAAO,IAAGvC,KAAM,EAAC;AACrD,CAAC;AAED,MAAM6C,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,CAC9DlC,GAAG,CAACmC,SAAS,IAAI;EACd,MAAM,CAACnB,GAAG,CAAC,GAAGoB,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACnB,GAAG,EAAE;IACN,OAAOxB,SAAS;EACpB;EAEA,MAAMsB,KAAK,GAAGqB,SAAS,CAACnB,GAAG,CAA2B;EAEtD,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAQ,GAAEA,GAAI,IAAIF,KAAK,CAAmBN,IAAI,CAAC,GAAG,CAAE,GAAE;IAC1D;MACI,OAAQ,GAAEQ,GAAI,IAAGD,kBAAkB,CAACC,GAAG,EAAEF,KAAK,CAAE,GAAE;EAC1D;AACJ,CAAC,CAAC,CACDX,MAAM,CAACmC,OAAO,CAAC,CACf9B,IAAI,CAAC,GAAG,CAAC;AAEP,MAAM+B,YAA0B,GAAA3B,OAAA,CAAA2B,YAAA,GAAG;EACtCrB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
@@ -77,7 +77,7 @@ const parseStyle = (style, breakpoint, screenSize, breakpointPairs) => {
77
77
  }
78
78
  return [key, (0, _breakpoints.getValueForBreakpoint)(value, breakpoint, screenSize, breakpointPairs)];
79
79
  }));
80
- return (0, _common.isWeb)() ? (0, _normalizeStyles.normalizeStyles)(parsedStyles) : parsedStyles;
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","breakpointPairs","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;AAEA;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,UAA4B,EAC1CC,UAAsB,EACtBC,eAA2C,KAChC,IAAIC,KAAK,CAACJ,EAAE,EAAE;EACzBK,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEP,UAAU,EAAEC,UAAU,EAAEC,eAAe;AAChG,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,OAAA,CAAAX,eAAA,GAAAA,eAAA;AAyBO,MAAMU,UAAU,GAAGA,CACtBE,KAA8B,EAC9BV,UAA4B,EAC5BC,UAAsB,EACtBC,eAA2C,KACvC;EACJ,MAAMS,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,CAGnC;EAED,MAAMG,YAAY,GAAGD,MAAM,CACtBE,WAAW,CAACH,OAAO,CACfI,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACd,MAAMG,mBAAmB,GAAGF,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB;IAEhF,IAAIE,mBAAmB,EAAE;MACrB,OAAO,CACHF,GAAG,EACHT,UAAU,CAACU,KAAK,EAA6BlB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CACxF;IACL;IAEA,MAAMkB,WAAW,GAAGH,GAAG,KAAK,WAAW;IAEvC,IAAIG,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;MACrC,OAAO,CACHD,GAAG,EACHC,KAAK,CAACH,GAAG,CAACG,KAAK,IAAIV,UAAU,CAACU,KAAK,EAAElB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CAAC,CACjF;IACL;IAEA,MAAMqB,iBAAiB,GAAG,OAAOL,KAAK,KAAK,UAAU;IACrD,MAAMM,YAAY,GAAG,OAAON,KAAK,KAAK,QAAQ;IAE9C,IAAIK,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACP,GAAG,EAAEC,KAAK,CAAC;IACvB;IAEA,OAAO,CACHD,GAAG,EACH,IAAAQ,kCAAqB,EACjBP,KAAK,EACLlB,UAAU,EACVC,UAAU,EACVC,eACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAO,IAAAwB,aAAK,EAAC,CAAC,GACR,IAAAC,gCAAe,EAACd,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC;AAAAJ,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","breakpointPairs","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;AAEA;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,UAA4B,EAC1CC,UAAsB,EACtBC,eAA2C,KAChC,IAAIC,KAAK,CAACJ,EAAE,EAAE;EACzBK,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEP,UAAU,EAAEC,UAAU,EAAEC,eAAe;AAChG,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,OAAA,CAAAX,eAAA,GAAAA,eAAA;AAyBO,MAAMU,UAAU,GAAGA,CACtBE,KAA8B,EAC9BV,UAA4B,EAC5BC,UAAsB,EACtBC,eAA2C,KACvC;EACJ,MAAMS,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,CAGnC;EAED,MAAMG,YAAY,GAAGD,MAAM,CACtBE,WAAW,CAACH,OAAO,CACfI,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACd,MAAMG,mBAAmB,GAAGF,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB;IAEhF,IAAIE,mBAAmB,EAAE;MACrB,OAAO,CACHF,GAAG,EACHT,UAAU,CAACU,KAAK,EAA6BlB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CACxF;IACL;IAEA,MAAMkB,WAAW,GAAGH,GAAG,KAAK,WAAW;IAEvC,IAAIG,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;MACrC,OAAO,CACHD,GAAG,EACHC,KAAK,CAACH,GAAG,CAACG,KAAK,IAAIV,UAAU,CAACU,KAAK,EAAElB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CAAC,CACjF;IACL;IAEA,MAAMqB,iBAAiB,GAAG,OAAOL,KAAK,KAAK,UAAU;IACrD,MAAMM,YAAY,GAAG,OAAON,KAAK,KAAK,QAAQ;IAE9C,IAAIK,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACP,GAAG,EAAEC,KAAK,CAAC;IACvB;IAEA,OAAO,CACHD,GAAG,EACH,IAAAQ,kCAAqB,EACjBP,KAAK,EACLlB,UAAU,EACVC,UAAU,EACVC,eACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOwB,aAAK,GACN,IAAAC,gCAAe,EAACd,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC;AAAAJ,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
@@ -1,9 +1,10 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
+ import { isServer } from '../utils';
2
3
  export const useDimensions = () => {
3
4
  const timerRef = useRef();
4
5
  const [screenSize, setScreenSize] = useState({
5
- width: window.innerWidth,
6
- height: window.innerHeight
6
+ width: isServer ? 0 : window.innerWidth,
7
+ height: isServer ? 0 : window.innerHeight
7
8
  });
8
9
  useEffect(() => {
9
10
  const handleResize = () => {
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","useState","useDimensions","timerRef","screenSize","setScreenSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGnD,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGH,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACI,UAAU,EAAEC,aAAa,CAAC,GAAGJ,QAAQ,CAAa;IACrDK,KAAK,EAAEC,MAAM,CAACC,UAAU;IACxBC,MAAM,EAAEF,MAAM,CAACG;EACnB,CAAC,CAAC;EAEFX,SAAS,CAAC,MAAM;IACZ,MAAMY,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;MAE9BV,QAAQ,CAACU,OAAO,GAAGC,UAAU,CAAC,MAAMT,aAAa,CAAC;QAC9CC,KAAK,EAAEC,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTJ,MAAM,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOT,UAAU;AACrB,CAAC"}
1
+ {"version":3,"names":["useEffect","useRef","useState","isServer","useDimensions","timerRef","screenSize","setScreenSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,QAAQ,QAAQ,UAAU;AAEnC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGJ,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACK,UAAU,EAAEC,aAAa,CAAC,GAAGL,QAAQ,CAAa;IACrDM,KAAK,EAAEL,QAAQ,GAAG,CAAC,GAAGM,MAAM,CAACC,UAAU;IACvCC,MAAM,EAAER,QAAQ,GAAG,CAAC,GAAGM,MAAM,CAACG;EAClC,CAAC,CAAC;EAEFZ,SAAS,CAAC,MAAM;IACZ,MAAMa,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;MAE9BV,QAAQ,CAACU,OAAO,GAAGC,UAAU,CAAC,MAAMT,aAAa,CAAC;QAC9CC,KAAK,EAAEC,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTJ,MAAM,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOT,UAAU;AACrB,CAAC"}
@@ -1,2 +1,2 @@
1
-
1
+ export * from './normalizer';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":""}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAAA,cAAc,cAAc"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=normalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/normalizer.ts"],"mappings":""}
@@ -5,5 +5,6 @@ export const throwError = message => {
5
5
  export const warn = message => {
6
6
  console.warn(`🦄 [react-native-unistyles]: ${message}`);
7
7
  };
8
- export const isWeb = () => Platform.OS === 'web';
8
+ export const isWeb = Platform.OS === 'web';
9
+ export const isServer = typeof window === 'undefined';
9
10
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","throwError","message","Error","warn","console","isWeb","OS"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAED,OAAO,MAAME,IAAI,GAAIF,OAAe,IAAK;EACrCG,OAAO,CAACD,IAAI,CAAE,gCAA+BF,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAMI,KAAK,GAAGA,CAAA,KAAMN,QAAQ,CAACO,EAAE,KAAK,KAAK"}
1
+ {"version":3,"names":["Platform","throwError","message","Error","warn","console","isWeb","OS","isServer","window"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAED,OAAO,MAAME,IAAI,GAAIF,OAAe,IAAK;EACrCG,OAAO,CAACD,IAAI,CAAE,gCAA+BF,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAMI,KAAK,GAAGN,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMC,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW"}
@@ -1,5 +1,7 @@
1
1
  export { normalizeStyles } from './normalizeStyles';
2
+ export * from './normalizer';
2
3
  export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForBreakpoint } from './breakpoints';
3
4
  export { proxifyFunction, parseStyle } from './styles';
5
+ export { isServer } from './common';
4
6
  export { extractValues, getKeyForCustomMediaQuery, isMediaQuery, isWithinTheHeight, isWithinTheWidth, isWithinTheWidthAndHeight } from './mediaQueries';
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeStyles","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForBreakpoint","proxifyFunction","parseStyle","extractValues","getKeyForCustomMediaQuery","isMediaQuery","isWithinTheHeight","isWithinTheWidth","isWithinTheWidthAndHeight"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,4BAA4B,EAAEC,0BAA0B,EAAEC,qBAAqB,QAAQ,eAAe;AAC/G,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SACIC,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,yBAAyB,QACtB,gBAAgB"}
1
+ {"version":3,"names":["normalizeStyles","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForBreakpoint","proxifyFunction","parseStyle","isServer","extractValues","getKeyForCustomMediaQuery","isMediaQuery","isWithinTheHeight","isWithinTheWidth","isWithinTheWidthAndHeight"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,cAAc,cAAc;AAC5B,SAASC,4BAA4B,EAAEC,0BAA0B,EAAEC,qBAAqB,QAAQ,eAAe;AAC/G,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SAASC,QAAQ,QAAQ,UAAU;AACnC,SACIC,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,yBAAyB,QACtB,gBAAgB"}
@@ -1,8 +1,8 @@
1
1
  import { warn } from './common';
2
- const preprocessor = require('react-native-web/src/exports/StyleSheet/preprocess.js');
3
- const normalizeBoxShadow = styles => {
2
+ import { preprocessor } from './normalizer';
3
+ const normalizeBoxShadow = style => {
4
4
  const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
5
- if (!requiredBoxShadowProperties.every(prop => prop in styles)) {
5
+ if (!requiredBoxShadowProperties.every(prop => prop in style)) {
6
6
  warn(`can't apply box shadow as you miss at least one of these properties: ${requiredBoxShadowProperties.join(', ')}`);
7
7
  return {
8
8
  shadowColor: undefined,
@@ -12,16 +12,16 @@ const normalizeBoxShadow = styles => {
12
12
  };
13
13
  }
14
14
  return {
15
- boxShadow: preprocessor.createBoxShadowValue(styles),
15
+ boxShadow: preprocessor.createBoxShadowValue(style),
16
16
  shadowColor: undefined,
17
17
  shadowOffset: undefined,
18
18
  shadowOpacity: undefined,
19
19
  shadowRadius: undefined
20
20
  };
21
21
  };
22
- const normalizeTextShadow = styles => {
22
+ const normalizeTextShadow = style => {
23
23
  const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
24
- if (!requiredTextShadowProperties.every(prop => prop in styles)) {
24
+ if (!requiredTextShadowProperties.every(prop => prop in style)) {
25
25
  warn(`can't apply text shadow as you miss at least one of these properties: ${requiredTextShadowProperties.join(', ')}`);
26
26
  return {
27
27
  textShadowColor: undefined,
@@ -30,20 +30,20 @@ const normalizeTextShadow = styles => {
30
30
  };
31
31
  }
32
32
  return {
33
- textShadow: preprocessor.createTextShadowValue(styles),
33
+ textShadow: preprocessor.createTextShadowValue(style),
34
34
  textShadowColor: undefined,
35
35
  textShadowOffset: undefined,
36
36
  textShadowRadius: undefined
37
37
  };
38
38
  };
39
- export const normalizeStyles = styles => {
40
- const normalizedTransform = 'transform' in styles && Array.isArray(styles.transform) ? {
41
- transform: preprocessor.createTransformValue(styles.transform)
39
+ export const normalizeStyles = style => {
40
+ const normalizedTransform = 'transform' in style && Array.isArray(style.transform) ? {
41
+ transform: preprocessor.createTransformValue(style.transform)
42
42
  } : {};
43
- const normalizedBoxShadow = 'shadowColor' in styles || 'shadowOffset' in styles || 'shadowOpacity' in styles || 'shadowRadius' in styles ? normalizeBoxShadow(styles) : {};
44
- const normalizedTextShadow = 'textShadowColor' in styles || 'textShadowOffset' in styles || 'textShadowRadius' in styles ? normalizeTextShadow(styles) : {};
43
+ const normalizedBoxShadow = 'shadowColor' in style || 'shadowOffset' in style || 'shadowOpacity' in style || 'shadowRadius' in style ? normalizeBoxShadow(style) : {};
44
+ const normalizedTextShadow = 'textShadowColor' in style || 'textShadowOffset' in style || 'textShadowRadius' in style ? normalizeTextShadow(style) : {};
45
45
  return {
46
- ...styles,
46
+ ...style,
47
47
  ...normalizedTransform,
48
48
  ...normalizedBoxShadow,
49
49
  ...normalizedTextShadow
@@ -1 +1 @@
1
- {"version":3,"names":["warn","preprocessor","require","normalizeBoxShadow","styles","requiredBoxShadowProperties","every","prop","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAE/B,MAAMC,YAA0B,GAAGC,OAAO,CAAC,uDAAuD,CAAC;AAuBnG,MAAMC,kBAAkB,GAAkBC,MAAS,IAA0B;EACzE,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,MAAM,CAAC,EAAE;IAC5DJ,IAAI,CAAE,wEAAuEK,2BAA2B,CAACG,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW,EAAEC,SAAS;MACtBC,YAAY,EAAED,SAAS;MACvBE,aAAa,EAAEF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G,CAAC,CAAC;EAEnC,MAAM0B,oBAAoB,GACtB,iBAAiB,IAAI1B,MAAM,IAC3B,kBAAkB,IAAIA,MAAM,IAC5B,kBAAkB,IAAIA,MAAM,GAC5BY,mBAAmB,CAACZ,MAAM,CAAC,GAAG,CAAC,CAAC;EAEpC,OAAO;IACH,GAAGA,MAAM;IACT,GAAGoB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["warn","preprocessor","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAC/B,SAASC,YAAY,QAAQ,cAAc;AAG3C,MAAMC,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;IAC3DH,IAAI,CAAE,wEAAuEI,2BAA2B,CAACG,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;EACL;EAEA,OAAO;IACHI,SAAS,EAAEZ,YAAY,CAACa,oBAAoB,CAACX,KAAK,CAAC;IACnDK,WAAW,EAAEC,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,S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