react-native-unistyles 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) 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/module.d.js +2 -0
  15. package/lib/commonjs/utils/module.d.js.map +1 -0
  16. package/lib/commonjs/utils/normalizeStyles.web.js +13 -13
  17. package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -1
  18. package/lib/commonjs/utils/normalizer.js +89 -0
  19. package/lib/commonjs/utils/normalizer.js.map +1 -0
  20. package/lib/commonjs/utils/styles.js +1 -1
  21. package/lib/commonjs/utils/styles.js.map +1 -1
  22. package/lib/module/hooks/useDimensions.web.js +3 -2
  23. package/lib/module/hooks/useDimensions.web.js.map +1 -1
  24. package/lib/module/types/index.js +1 -1
  25. package/lib/module/types/index.js.map +1 -1
  26. package/lib/module/types/normalizer.js +2 -0
  27. package/lib/module/types/normalizer.js.map +1 -0
  28. package/lib/module/utils/common.js +2 -1
  29. package/lib/module/utils/common.js.map +1 -1
  30. package/lib/module/utils/index.js +2 -0
  31. package/lib/module/utils/index.js.map +1 -1
  32. package/lib/module/utils/module.d.js +2 -0
  33. package/lib/module/utils/module.d.js.map +1 -0
  34. package/lib/module/utils/normalizeStyles.web.js +13 -13
  35. package/lib/module/utils/normalizeStyles.web.js.map +1 -1
  36. package/lib/module/utils/normalizer.js +79 -0
  37. package/lib/module/utils/normalizer.js.map +1 -0
  38. package/lib/module/utils/styles.js +1 -1
  39. package/lib/module/utils/styles.js.map +1 -1
  40. package/lib/typescript/examples/expo/src/App.d.ts +3 -0
  41. package/lib/typescript/examples/expo/src/App.d.ts.map +1 -0
  42. package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +3 -0
  43. package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +1 -0
  44. package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +3 -0
  45. package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +1 -0
  46. package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +7 -0
  47. package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +1 -0
  48. package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +3 -0
  49. package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +1 -0
  50. package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +3 -0
  51. package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +1 -0
  52. package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +3 -0
  53. package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +1 -0
  54. package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +3 -0
  55. package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +1 -0
  56. package/lib/typescript/examples/expo/src/examples/Theme.d.ts +3 -0
  57. package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +1 -0
  58. package/lib/typescript/examples/expo/src/examples/index.d.ts +8 -0
  59. package/lib/typescript/examples/expo/src/examples/index.d.ts.map +1 -0
  60. package/lib/typescript/examples/expo/src/index.d.ts +2 -0
  61. package/lib/typescript/examples/expo/src/index.d.ts.map +1 -0
  62. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +8 -0
  63. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +1 -0
  64. package/lib/typescript/examples/expo/src/styles/index.d.ts +46 -0
  65. package/lib/typescript/examples/expo/src/styles/index.d.ts.map +1 -0
  66. package/lib/typescript/examples/expo/src/styles/theme.d.ts +24 -0
  67. package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +1 -0
  68. package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -1
  69. package/lib/typescript/src/types/index.d.ts +1 -0
  70. package/lib/typescript/src/types/index.d.ts.map +1 -1
  71. package/lib/typescript/src/types/normalizer.d.ts +20 -0
  72. package/lib/typescript/src/types/normalizer.d.ts.map +1 -0
  73. package/lib/typescript/src/utils/common.d.ts +2 -1
  74. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  75. package/lib/typescript/src/utils/index.d.ts +2 -0
  76. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  77. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +4 -1
  78. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -1
  79. package/lib/typescript/src/utils/normalizer.d.ts +11 -0
  80. package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
  81. package/package.json +10 -3
  82. package/src/hooks/useDimensions.web.ts +3 -2
  83. package/src/types/index.ts +1 -0
  84. package/src/types/normalizer.ts +29 -0
  85. package/src/utils/common.ts +2 -1
  86. package/src/utils/index.ts +2 -0
  87. package/src/utils/module.d.ts +3 -0
  88. package/src/utils/normalizeStyles.web.ts +21 -42
  89. package/src/utils/normalizer.ts +99 -0
  90. package/src/utils/styles.ts +1 -1
@@ -0,0 +1,79 @@
1
+ // based on react-native-web normalizer
2
+ // https://github.com/necolas/react-native-web
3
+ import normalizeColors from '@react-native/normalize-colors';
4
+ export const normalizeColor = function (color) {
5
+ let opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
6
+ // If the opacity is 1 there's no need to normalize the color
7
+ if (opacity === 1) {
8
+ return color;
9
+ }
10
+ const integer = normalizeColors(color);
11
+
12
+ // If the colour is an unknown format, the return value is null
13
+ if (integer === null) {
14
+ return color;
15
+ }
16
+ const hex = integer.toString(16).padStart(8, '0');
17
+ if (hex.length === 8) {
18
+ const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
19
+ return `rgba(${r},${g},${b},${a / 255 * opacity})`;
20
+ }
21
+ return color;
22
+ };
23
+ export const normalizeNumericValue = value => value ? `${value}px` : value;
24
+ const normalizeTransform = (key, value) => {
25
+ if (key.includes('scale')) {
26
+ return value;
27
+ }
28
+ if (typeof value === 'number') {
29
+ return normalizeNumericValue(value);
30
+ }
31
+ return value;
32
+ };
33
+ const createTextShadowValue = style => {
34
+ // at this point every prop is present
35
+ const {
36
+ textShadowColor,
37
+ textShadowOffset,
38
+ textShadowRadius
39
+ } = style;
40
+ const offsetX = normalizeNumericValue(textShadowOffset.width);
41
+ const offsetY = normalizeNumericValue(textShadowOffset.height);
42
+ const radius = normalizeNumericValue(textShadowRadius);
43
+ const color = normalizeColor(textShadowColor);
44
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
45
+ };
46
+ const createBoxShadowValue = style => {
47
+ // at this point every prop is present
48
+ const {
49
+ shadowColor,
50
+ shadowOffset,
51
+ shadowOpacity,
52
+ shadowRadius
53
+ } = style;
54
+ const offsetX = normalizeNumericValue(shadowOffset.width);
55
+ const offsetY = normalizeNumericValue(shadowOffset.height);
56
+ const radius = normalizeNumericValue(shadowRadius);
57
+ const color = normalizeColor(shadowColor, shadowOpacity);
58
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
59
+ };
60
+ const createTransformValue = transforms => transforms.map(transform => {
61
+ const [key] = Object.keys(transform);
62
+ if (!key) {
63
+ return undefined;
64
+ }
65
+ const value = transform[key];
66
+ switch (key) {
67
+ case 'matrix':
68
+ case 'matrix3d':
69
+ return `${key}(${value.join(',')})`;
70
+ default:
71
+ return `${key}(${normalizeTransform(key, value)})`;
72
+ }
73
+ }).filter(Boolean).join(' ');
74
+ export const preprocessor = {
75
+ createTextShadowValue,
76
+ createBoxShadowValue,
77
+ createTransformValue
78
+ };
79
+ //# sourceMappingURL=normalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeColors","normalizeColor","color","opacity","arguments","length","undefined","integer","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","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":"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"}
@@ -71,6 +71,6 @@ export const parseStyle = (style, breakpoint, screenSize, breakpointPairs) => {
71
71
  }
72
72
  return [key, getValueForBreakpoint(value, breakpoint, screenSize, breakpointPairs)];
73
73
  }));
74
- return isWeb() ? normalizeStyles(parsedStyles) : parsedStyles;
74
+ return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
75
75
  };
76
76
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getValueForBreakpoint","normalizeStyles","isWeb","proxifyFunction","fn","breakpoint","screenSize","breakpointPairs","Proxy","apply","target","thisArg","argumentsList","parseStyle","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","value","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,KAAK,QAAQ,UAAU;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,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;AACA,OAAO,MAAMM,UAAU,GAAGA,CACtBC,KAA8B,EAC9BT,UAA4B,EAC5BC,UAAsB,EACtBC,eAA2C,KACvC;EACJ,MAAMQ,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,EACHR,UAAU,CAACS,KAAK,EAA6BjB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CACxF;IACL;IAEA,MAAMiB,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,IAAIT,UAAU,CAACS,KAAK,EAAEjB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CAAC,CACjF;IACL;IAEA,MAAMoB,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,EACHrB,qBAAqB,CACjBsB,KAAK,EACLjB,UAAU,EACVC,UAAU,EACVC,eACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOL,KAAK,CAAC,CAAC,GACRD,eAAe,CAACgB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
1
+ {"version":3,"names":["getValueForBreakpoint","normalizeStyles","isWeb","proxifyFunction","fn","breakpoint","screenSize","breakpointPairs","Proxy","apply","target","thisArg","argumentsList","parseStyle","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","value","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,KAAK,QAAQ,UAAU;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,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;AACA,OAAO,MAAMM,UAAU,GAAGA,CACtBC,KAA8B,EAC9BT,UAA4B,EAC5BC,UAAsB,EACtBC,eAA2C,KACvC;EACJ,MAAMQ,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,EACHR,UAAU,CAACS,KAAK,EAA6BjB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CACxF;IACL;IAEA,MAAMiB,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,IAAIT,UAAU,CAACS,KAAK,EAAEjB,UAAU,EAAEC,UAAU,EAAEC,eAAe,CAAC,CAAC,CACjF;IACL;IAEA,MAAMoB,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,EACHrB,qBAAqB,CACjBsB,KAAK,EACLjB,UAAU,EACVC,UAAU,EACVC,eACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOL,KAAK,GACND,eAAe,CAACgB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const App: React.FunctionComponent;
3
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../examples/expo/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAUvC,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,iBAgBvB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const Breakpoints: React.FunctionComponent;
3
+ //# sourceMappingURL=Breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breakpoints.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Breakpoints.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAiB/B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const EmptyStyles: React.FunctionComponent;
3
+ //# sourceMappingURL=EmptyStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyStyles.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/EmptyStyles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAU/B,CAAA"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type ExtremeProps = {
3
+ onToggleTheme: VoidFunction;
4
+ };
5
+ export declare const Extreme: React.FunctionComponent<ExtremeProps>;
6
+ export {};
7
+ //# sourceMappingURL=Extreme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Extreme.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Extreme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,KAAK,YAAY,GAAG;IAChB,aAAa,EAAE,YAAY,CAAA;CAC9B,CAAA;AAGD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAezD,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const MediaQueries: React.FunctionComponent;
3
+ //# sourceMappingURL=MediaQueries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaQueries.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/MediaQueries.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAahC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const Memoization: React.FunctionComponent;
3
+ //# sourceMappingURL=Memoization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Memoization.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Memoization.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAY/B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const Minimal: React.FunctionComponent;
3
+ //# sourceMappingURL=Minimal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Minimal.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Minimal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,iBAU3B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const MinimalWithCreateStyleSheet: React.FunctionComponent;
3
+ //# sourceMappingURL=MinimalWithCreateStyleSheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MinimalWithCreateStyleSheet.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/MinimalWithCreateStyleSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,iBAU/C,CAAA"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const Theme: React.FunctionComponent;
3
+ //# sourceMappingURL=Theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,iBAUzB,CAAA"}
@@ -0,0 +1,8 @@
1
+ export { Minimal } from './Minimal';
2
+ export { MinimalWithCreateStyleSheet } from './MinimalWithCreateStyleSheet';
3
+ export { Theme } from './Theme';
4
+ export { Breakpoints } from './Breakpoints';
5
+ export { MediaQueries } from './MediaQueries';
6
+ export { Extreme } from './Extreme';
7
+ export { Memoization } from './Memoization';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../examples/expo/src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export declare const breakpoints: {
2
+ xs: number;
3
+ sm: number;
4
+ md: number;
5
+ lg: number;
6
+ xl: number;
7
+ };
8
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/styles/breakpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAA"}
@@ -0,0 +1,46 @@
1
+ import type { AppTheme } from './theme';
2
+ import { lightTheme, darkTheme } from './theme';
3
+ export declare const useStyles: <ST extends import("../../../../src/types").CustomNamedStyles<ST, {
4
+ xs: number;
5
+ sm: number;
6
+ md: number;
7
+ lg: number;
8
+ xl: number;
9
+ }>>(stylesheet?: ST | import("../../../../src/types").CreateStylesFactory<ST, AppTheme> | undefined) => {
10
+ theme: AppTheme;
11
+ breakpoint: "xs" | "sm" | "md" | "lg" | "xl";
12
+ styles: import("../../../../src/types").ExtractBreakpoints<import("../../../../src/types").RemoveKeysWithPrefix<ST, {
13
+ xs: number;
14
+ sm: number;
15
+ md: number;
16
+ lg: number;
17
+ xl: number;
18
+ }>, {
19
+ xs: number;
20
+ sm: number;
21
+ md: number;
22
+ lg: number;
23
+ xl: number;
24
+ }>;
25
+ }, createStyleSheet: <S extends import("../../../../src/types").CustomNamedStyles<S, {
26
+ xs: number;
27
+ sm: number;
28
+ md: number;
29
+ lg: number;
30
+ xl: number;
31
+ }>, X>(styles: S | X | import("../../../../src/types").CustomNamedStyles<S, {
32
+ xs: number;
33
+ sm: number;
34
+ md: number;
35
+ lg: number;
36
+ xl: number;
37
+ }> | ((theme: AppTheme) => X | import("../../../../src/types").CustomNamedStyles<X, {
38
+ xs: number;
39
+ sm: number;
40
+ md: number;
41
+ lg: number;
42
+ xl: number;
43
+ }>)) => S | X;
44
+ export { lightTheme, darkTheme };
45
+ export type { AppTheme };
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/styles/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAQ,SAAS;;;;;;;;;;;;;;;;;;;;;;GAAE,gBAAgB;;;;;;;;;;;;;;;;;;aAA+D,CAAA;AAEzG,OAAO,EACH,UAAU,EACV,SAAS,EACZ,CAAA;AAED,YAAY,EACR,QAAQ,EACX,CAAA"}
@@ -0,0 +1,24 @@
1
+ export declare const lightTheme: {
2
+ colors: {
3
+ backgroundColor: string;
4
+ typography: string;
5
+ barbie: string;
6
+ oak: string;
7
+ sky: string;
8
+ fog: string;
9
+ aloes: string;
10
+ };
11
+ };
12
+ export declare const darkTheme: {
13
+ colors: {
14
+ backgroundColor: string;
15
+ typography: string;
16
+ barbie: string;
17
+ oak: string;
18
+ sky: string;
19
+ fog: string;
20
+ aloes: string;
21
+ };
22
+ };
23
+ export type AppTheme = typeof lightTheme | typeof darkTheme;
24
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/styles/theme.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU;;;;;;;;;;CAOtB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;CAOrB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,aAAa,QAAO,UA0BhC,CAAA"}
1
+ {"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,eAAO,MAAM,aAAa,QAAO,UA0BhC,CAAA"}
@@ -1,3 +1,4 @@
1
+ export * from './normalizer';
1
2
  export type { CustomNamedStyles } from './core';
2
3
  export type { ScreenSize, Breakpoints, CreateStylesFactory, ExtractBreakpoints, RemoveKeysWithPrefix, SortedBreakpointEntries } from './breakpoints';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC/C,YAAY,EACR,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EAC1B,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC/C,YAAY,EACR,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EAC1B,MAAM,eAAe,CAAA"}
@@ -0,0 +1,20 @@
1
+ import type { ShadowStyleIOS, TextStyle, TransformsStyle } from 'react-native';
2
+ type TransformArrayElement<T> = T extends Array<infer U> ? U : never;
3
+ type BoxShadow = Required<ShadowStyleIOS>;
4
+ type TextShadow = Required<Pick<TextStyle, 'textShadowColor' | 'textShadowOffset' | 'textShadowRadius'>>;
5
+ type Transforms = Array<TransformArrayElement<TransformsStyle['transform']>>;
6
+ type NormalizedBoxShadow = {
7
+ shadowColor: undefined;
8
+ shadowOffset: undefined;
9
+ shadowOpacity: undefined;
10
+ shadowRadius: undefined;
11
+ boxShadow?: string;
12
+ };
13
+ type NormalizedTextShadow = {
14
+ textShadowColor: undefined;
15
+ textShadowOffset: undefined;
16
+ textShadowRadius: undefined;
17
+ textShadow?: string;
18
+ };
19
+ export type { BoxShadow, TextShadow, Transforms, NormalizedBoxShadow, NormalizedTextShadow };
20
+ //# sourceMappingURL=normalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../src/types/normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9E,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AACpE,KAAK,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA;AACzC,KAAK,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC,CAAC,CAAA;AACxG,KAAK,UAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAE5E,KAAK,mBAAmB,GAAG;IACvB,WAAW,EAAE,SAAS,CAAC;IACvB,YAAY,EAAE,SAAS,CAAC;IACxB,aAAa,EAAE,SAAS,CAAC;IACzB,YAAY,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,oBAAoB,GAAG;IACxB,eAAe,EAAE,SAAS,CAAA;IAC1B,gBAAgB,EAAE,SAAS,CAAA;IAC3B,gBAAgB,EAAE,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,YAAY,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACvB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export declare const throwError: (message: string) => never;
2
2
  export declare const warn: (message: string) => void;
3
- export declare const isWeb: () => boolean;
3
+ export declare const isWeb: boolean;
4
+ export declare const isServer: boolean;
4
5
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,eAA8B,CAAA"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA"}
@@ -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.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA"}
@@ -1,2 +1,5 @@
1
- export declare const normalizeStyles: <T extends {}>(styles: T) => T;
1
+ import type { Transforms } from '../types';
2
+ export declare const normalizeStyles: <T extends Required<import("react-native").ShadowStyleIOS> | Required<Pick<import("react-native").TextStyle, "textShadowColor" | "textShadowOffset" | "textShadowRadius">> | {
3
+ transform: Transforms;
4
+ }>(style: T) => T;
2
5
  //# sourceMappingURL=normalizeStyles.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeStyles.web.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalizeStyles.web.ts"],"names":[],"mappings":"AA8EA,eAAO,MAAM,eAAe,gCAwB3B,CAAA"}
1
+ {"version":3,"file":"normalizeStyles.web.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalizeStyles.web.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoE,UAAU,EAAE,MAAM,UAAU,CAAA;AAuD5G,eAAO,MAAM,eAAe;;iBAwB3B,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { TextShadow, Transforms, BoxShadow } from '../types';
2
+ type Preprocessor = {
3
+ createTextShadowValue(style: TextShadow): string;
4
+ createBoxShadowValue(style: Required<BoxShadow>): string;
5
+ createTransformValue(transforms: Required<Transforms>): string;
6
+ };
7
+ export declare const normalizeColor: (color: string, opacity?: number) => string;
8
+ export declare const normalizeNumericValue: (value: number) => string | number;
9
+ export declare const preprocessor: Preprocessor;
10
+ export {};
11
+ //# sourceMappingURL=normalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEjE,KAAK,YAAY,GAAG;IAChB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACjD,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;IACzD,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;CAClE,CAAA;AAED,eAAO,MAAM,cAAc,UAAW,MAAM,YAAW,MAAM,WAyB5D,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,MAAM,oBAAiC,CAAA;AAwDpF,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAA"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
7
+ "test:coverage": "jest --coverage",
7
8
  "tsc": "node_modules/typescript/bin/tsc --noEmit",
8
9
  "lint": "eslint . --ext .ts,.tsx",
9
10
  "clean": "del-cli lib",
@@ -40,6 +41,7 @@
40
41
  "devDependencies": {
41
42
  "@commitlint/config-conventional": "17.8.0",
42
43
  "@react-native/eslint-config": "0.74.0",
44
+ "@react-native/normalize-colors": "0.74.1",
43
45
  "@release-it/conventional-changelog": "5.1.1",
44
46
  "@testing-library/react-hooks": "8.0.1",
45
47
  "@types/jest": "29.5.5",
@@ -74,6 +76,7 @@
74
76
  "typescript": "5.2.2"
75
77
  },
76
78
  "peerDependencies": {
79
+ "@react-native/normalize-colors": "*",
77
80
  "react": "*",
78
81
  "react-native": "*",
79
82
  "react-native-web": "*"
@@ -84,7 +87,7 @@
84
87
  }
85
88
  },
86
89
  "workspaces": [
87
- "example",
90
+ "examples/expo",
88
91
  "docs"
89
92
  ],
90
93
  "packageManager": "yarn@3.6.1",
@@ -94,9 +97,13 @@
94
97
  "jest": {
95
98
  "preset": "react-native",
96
99
  "modulePathIgnorePatterns": [
97
- "<rootDir>/example/node_modules",
100
+ "<rootDir>/examples/expo/node_modules",
101
+ "<rootDir>/examples/ssr/node_modules",
98
102
  "<rootDir>/docs/node_modules",
99
103
  "<rootDir>/lib/"
104
+ ],
105
+ "coverageReporters": [
106
+ "html"
100
107
  ]
101
108
  },
102
109
  "commitlint": {
@@ -1,11 +1,12 @@
1
1
  import { useEffect, useRef, useState } from 'react'
2
2
  import type { ScreenSize } from '../types'
3
+ import { isServer } from '../utils'
3
4
 
4
5
  export const useDimensions = (): ScreenSize => {
5
6
  const timerRef = useRef<ReturnType<typeof setTimeout>>()
6
7
  const [screenSize, setScreenSize] = useState<ScreenSize>({
7
- width: window.innerWidth,
8
- height: window.innerHeight
8
+ width: isServer ? 0 : window.innerWidth,
9
+ height: isServer ? 0 : window.innerHeight
9
10
  })
10
11
 
11
12
  useEffect(() => {
@@ -1,3 +1,4 @@
1
+ export * from './normalizer'
1
2
  export type { CustomNamedStyles } from './core'
2
3
  export type {
3
4
  ScreenSize,
@@ -0,0 +1,29 @@
1
+ import type { ShadowStyleIOS, TextStyle, TransformsStyle } from 'react-native'
2
+
3
+ type TransformArrayElement<T> = T extends Array<infer U> ? U : never
4
+ type BoxShadow = Required<ShadowStyleIOS>
5
+ type TextShadow = Required<Pick<TextStyle, 'textShadowColor' | 'textShadowOffset' | 'textShadowRadius'>>
6
+ type Transforms = Array<TransformArrayElement<TransformsStyle['transform']>>
7
+
8
+ type NormalizedBoxShadow = {
9
+ shadowColor: undefined,
10
+ shadowOffset: undefined,
11
+ shadowOpacity: undefined,
12
+ shadowRadius: undefined,
13
+ boxShadow?: string
14
+ }
15
+
16
+ type NormalizedTextShadow = {
17
+ textShadowColor: undefined
18
+ textShadowOffset: undefined
19
+ textShadowRadius: undefined,
20
+ textShadow?: string
21
+ }
22
+
23
+ export type {
24
+ BoxShadow,
25
+ TextShadow,
26
+ Transforms,
27
+ NormalizedBoxShadow,
28
+ NormalizedTextShadow
29
+ }
@@ -8,4 +8,5 @@ export const warn = (message: string) => {
8
8
  console.warn(`🦄 [react-native-unistyles]: ${message}`)
9
9
  }
10
10
 
11
- export const isWeb = () => Platform.OS === 'web'
11
+ export const isWeb = Platform.OS === 'web'
12
+ export const isServer = typeof window === 'undefined'
@@ -1,6 +1,8 @@
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 {
5
7
  extractValues,
6
8
  getKeyForCustomMediaQuery,
@@ -0,0 +1,3 @@
1
+ declare module '@react-native/normalize-colors' {
2
+ export default function normalizeColor(color: string): number | null
3
+ }