react-native-unistyles 2.0.0-alpha.1 → 2.0.0-alpha.3
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 +12 -0
- package/ios/UnistylesModule.mm +163 -0
- package/ios/UnistylesRuntime.h +48 -0
- package/ios/UnistylesRuntime.mm +228 -0
- package/lib/commonjs/UnistyleRegistry.js +34 -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 +63 -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 +57 -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 +27 -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 +56 -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 +50 -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 +14 -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 +60 -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 +53 -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 +35 -0
- package/src/Unistyles.ts +41 -0
- package/src/UnistylesEngine.ts +15 -0
- package/src/UnistylesModule.ts +7 -0
- package/src/UnistylesRuntime.ts +69 -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 +65 -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 +66 -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,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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/module.d.ts"],"mappings":""}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { warn } from './common';
|
2
|
-
|
3
|
-
const normalizeBoxShadow =
|
2
|
+
import { preprocessor } from './normalizer';
|
3
|
+
const normalizeBoxShadow = style => {
|
4
4
|
const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
|
5
|
-
if (!requiredBoxShadowProperties.every(prop => prop in
|
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(
|
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 =
|
22
|
+
const normalizeTextShadow = style => {
|
23
23
|
const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
|
24
|
-
if (!requiredTextShadowProperties.every(prop => prop in
|
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(
|
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 =
|
40
|
-
const normalizedTransform = 'transform' in
|
41
|
-
transform: preprocessor.createTransformValue(
|
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
|
44
|
-
const normalizedTextShadow = 'textShadowColor' in
|
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
|
-
...
|
46
|
+
...style,
|
47
47
|
...normalizedTransform,
|
48
48
|
...normalizedBoxShadow,
|
49
49
|
...normalizedTextShadow
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["warn","preprocessor","
|
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,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMM,mBAAmB,GAA0BZ,KAAQ,IAA2B;EAClF,MAAMa,4BAA4B,GAAG,CACjC,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,CACrB;EAED,IAAI,CAACA,4BAA4B,CAACX,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC5DH,IAAI,CAAE,yEAAwEgB,4BAA4B,CAACT,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAExH,OAAO;MACHU,eAAe,EAAER,SAAS;MAC1BS,gBAAgB,EAAET,SAAS;MAC3BU,gBAAgB,EAAEV;IACtB,CAAC;EACL;EAEA,OAAO;IACHW,UAAU,EAAEnB,YAAY,CAACoB,qBAAqB,CAAClB,KAAK,CAAC;IACrDc,eAAe,EAAER,SAAS;IAC1BS,gBAAgB,EAAET,SAAS;IAC3BU,gBAAgB,EAAEV;EACtB,CAAC;AACL,CAAC;AAED,OAAO,MAAMa,eAAe,GAAkEnB,KAAQ,IAAQ;EAC1G,MAAMoB,mBAAmB,GAAI,WAAW,IAAIpB,KAAK,IAAIqB,KAAK,CAACC,OAAO,CAACtB,KAAK,CAACuB,SAAS,CAAC,GAC7E;IAAEA,SAAS,EAAEzB,YAAY,CAAC0B,oBAAoB,CAACxB,KAAK,CAACuB,SAAS;EAAE,CAAC,GACjE,CAAC,CAAC;EAER,MAAME,mBAAmB,GACrB,aAAa,IAAIzB,KAAK,IACtB,cAAc,IAAIA,KAAK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM0B,oBAAoB,GACtB,iBAAiB,IAAI1B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3BY,mBAAmB,CAACZ,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGoB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC"}
|
@@ -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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"}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { getValueForBreakpoint } from './breakpoints';
|
2
2
|
import { normalizeStyles } from './normalizeStyles';
|
3
3
|
import { isWeb } from './common';
|
4
|
-
|
5
4
|
/**
|
6
5
|
* Proxies a function to parse its return value for custom media queries or breakpoints.
|
7
6
|
*
|
@@ -23,8 +22,8 @@ import { isWeb } from './common';
|
|
23
22
|
* const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
|
24
23
|
* proxifiedFunction() // parsed style based on screenSize and breakpoints
|
25
24
|
*/
|
26
|
-
export const proxifyFunction = (fn, breakpoint, screenSize
|
27
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize
|
25
|
+
export const proxifyFunction = (fn, breakpoint, screenSize) => new Proxy(fn, {
|
26
|
+
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize)
|
28
27
|
});
|
29
28
|
|
30
29
|
/**
|
@@ -52,25 +51,25 @@ export const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) =>
|
|
52
51
|
* const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
|
53
52
|
* // { fontSize: '12px' }
|
54
53
|
*/
|
55
|
-
export const parseStyle = (style, breakpoint, screenSize
|
54
|
+
export const parseStyle = (style, breakpoint, screenSize) => {
|
56
55
|
const entries = Object.entries(style);
|
57
56
|
const parsedStyles = Object.fromEntries(entries.map(_ref => {
|
58
57
|
let [key, value] = _ref;
|
59
58
|
const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
|
60
59
|
if (hasNestedProperties) {
|
61
|
-
return [key, parseStyle(value, breakpoint, screenSize
|
60
|
+
return [key, parseStyle(value, breakpoint, screenSize)];
|
62
61
|
}
|
63
62
|
const isTransform = key === 'transform';
|
64
63
|
if (isTransform && Array.isArray(value)) {
|
65
|
-
return [key, value.map(value => parseStyle(value, breakpoint, screenSize
|
64
|
+
return [key, value.map(value => parseStyle(value, breakpoint, screenSize))];
|
66
65
|
}
|
67
66
|
const isDynamicFunction = typeof value === 'function';
|
68
67
|
const isValidStyle = typeof value !== 'object';
|
69
68
|
if (isDynamicFunction || isValidStyle) {
|
70
69
|
return [key, value];
|
71
70
|
}
|
72
|
-
return [key, getValueForBreakpoint(value, breakpoint, screenSize
|
71
|
+
return [key, getValueForBreakpoint(value, breakpoint, screenSize)];
|
73
72
|
}));
|
74
|
-
return isWeb
|
73
|
+
return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
|
75
74
|
};
|
76
75
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getValueForBreakpoint","normalizeStyles","isWeb","proxifyFunction","fn","breakpoint","screenSize","
|
1
|
+
{"version":3,"names":["getValueForBreakpoint","normalizeStyles","isWeb","proxifyFunction","fn","breakpoint","screenSize","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;AAGhC;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,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;AACA,OAAO,MAAMM,UAAU,GAAGA,CACtBC,KAA2B,EAC3BR,UAA+C,EAC/CC,UAAsB,KAClB;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,EAA0BhB,UAAU,EAAEC,UAAU,CAAC,CACpE;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,EAAEhB,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;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,EACHpB,qBAAqB,CACjBqB,KAAK,EACLhB,UAAU,EACVC,UACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOJ,KAAK,GACND,eAAe,CAACe,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../examples/expo/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAgBzB,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,iBAMvB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Cxx.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/Cxx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,GAAG,yBA8Ef,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../examples/expo/src/examples/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../examples/expo/src/index.ts"],"names":[],"mappings":""}
|
@@ -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,16 @@
|
|
1
|
+
import { breakpoints } from './breakpoints';
|
2
|
+
import { lightTheme, darkTheme, premiumTheme } from './theme';
|
3
|
+
type AppBreakpoints = typeof breakpoints;
|
4
|
+
type AppThemes = {
|
5
|
+
light: typeof lightTheme;
|
6
|
+
dark: typeof darkTheme;
|
7
|
+
premium: typeof premiumTheme;
|
8
|
+
};
|
9
|
+
declare module 'react-native-unistyles' {
|
10
|
+
interface UnistylesThemes extends AppThemes {
|
11
|
+
}
|
12
|
+
interface UnistylesBreakpoints extends AppBreakpoints {
|
13
|
+
}
|
14
|
+
}
|
15
|
+
export { lightTheme, darkTheme, premiumTheme, breakpoints };
|
16
|
+
//# 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":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE7D,KAAK,cAAc,GAAG,OAAO,WAAW,CAAA;AACxC,KAAK,SAAS,GAAG;IACb,KAAK,EAAE,OAAO,UAAU,CAAA;IACxB,IAAI,EAAE,OAAO,SAAS,CAAA;IACtB,OAAO,EAAE,OAAO,YAAY,CAAA;CAC/B,CAAA;AAED,OAAO,QAAQ,wBAAwB,CAAC;IACpC,UAAiB,eAAgB,SAAQ,SAAS;KAAG;IAErD,UAAiB,oBAAqB,SAAQ,cAAc;KAAG;CAClE;AAED,OAAO,EACH,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACd,CAAA"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
export declare const lightTheme: {
|
2
|
+
colors: {
|
3
|
+
backgroundColor: string;
|
4
|
+
typography: string;
|
5
|
+
accent: string;
|
6
|
+
barbie: string;
|
7
|
+
oak: string;
|
8
|
+
sky: string;
|
9
|
+
fog: string;
|
10
|
+
aloes: string;
|
11
|
+
blood: string;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export declare const darkTheme: {
|
15
|
+
colors: {
|
16
|
+
backgroundColor: string;
|
17
|
+
typography: string;
|
18
|
+
accent: string;
|
19
|
+
barbie: string;
|
20
|
+
oak: string;
|
21
|
+
sky: string;
|
22
|
+
fog: string;
|
23
|
+
aloes: string;
|
24
|
+
blood: string;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
export declare const premiumTheme: {
|
28
|
+
colors: {
|
29
|
+
backgroundColor: string;
|
30
|
+
typography: string;
|
31
|
+
accent: string;
|
32
|
+
barbie: string;
|
33
|
+
oak: string;
|
34
|
+
sky: string;
|
35
|
+
fog: string;
|
36
|
+
aloes: string;
|
37
|
+
blood: string;
|
38
|
+
};
|
39
|
+
};
|
40
|
+
//# 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":"AASA,eAAO,MAAM,UAAU;;;;;;;;;;;;CAQtB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;CAQrB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;CAQxB,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { UnistylesBridge, UnistylesConfig } from './types';
|
2
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
3
|
+
export declare class UnistyleRegistry {
|
4
|
+
private unistylesBridge;
|
5
|
+
config: UnistylesConfig;
|
6
|
+
themes: UnistylesThemes;
|
7
|
+
breakpoints: UnistylesBreakpoints;
|
8
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
9
|
+
constructor(unistylesBridge: UnistylesBridge);
|
10
|
+
addThemes: (themes: UnistylesThemes) => this;
|
11
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
|
12
|
+
addConfig: (config: UnistylesConfig) => this;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../src/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAErE,qBAAa,gBAAgB;IAMb,OAAO,CAAC,eAAe;IAL5B,MAAM,EAAE,eAAe,CAAK;IAC5B,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAK1C;IAEM,cAAc,gBAAiB,oBAAoB,UAKzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;CACJ"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { UnistylesRuntime } from './UnistylesRuntime';
|
2
|
+
import { UnistylesEngine } from './UnistylesEngine';
|
3
|
+
import { UnistyleRegistry } from './UnistyleRegistry';
|
4
|
+
declare class Unistyles {
|
5
|
+
private _runtime;
|
6
|
+
private _engine;
|
7
|
+
private _registry;
|
8
|
+
private _bridge;
|
9
|
+
constructor();
|
10
|
+
get registry(): UnistyleRegistry;
|
11
|
+
get runtime(): UnistylesRuntime;
|
12
|
+
get engine(): UnistylesEngine;
|
13
|
+
}
|
14
|
+
export declare const unistyles: Unistyles;
|
15
|
+
export {};
|
16
|
+
//# sourceMappingURL=Unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../src/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAgBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;IAED,IAAW,MAAM,oBAEhB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { UnistyleRegistry } from './UnistyleRegistry';
|
2
|
+
import type { UnistylesRuntime } from './UnistylesRuntime';
|
3
|
+
export declare class UnistylesEngine {
|
4
|
+
private registry;
|
5
|
+
private runtime;
|
6
|
+
constructor(registry: UnistyleRegistry, runtime: UnistylesRuntime);
|
7
|
+
}
|
8
|
+
//# sourceMappingURL=UnistylesEngine.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesEngine.d.ts","sourceRoot":"","sources":["../../../src/UnistylesEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D,qBAAa,eAAe;IAEZ,OAAO,CAAC,QAAQ;IAAoB,OAAO,CAAC,OAAO;gBAA3C,QAAQ,EAAE,gBAAgB,EAAU,OAAO,EAAE,gBAAgB;CAQpF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../src/UnistylesModule.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IACzB,OAAO,IAAI,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,uBAAoD,CAAA"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import type { UnistylesBridge } from './types';
|
2
|
+
import type { UnistyleRegistry } from './UnistyleRegistry';
|
3
|
+
import { ScreenOrientation } from './types';
|
4
|
+
import type { UnistylesThemes } from './global';
|
5
|
+
export declare class UnistylesRuntime {
|
6
|
+
private unistylesBridge;
|
7
|
+
private registry;
|
8
|
+
constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
|
9
|
+
get colorScheme(): import("./types").ColorSchemeName;
|
10
|
+
get hasAdaptiveThemes(): boolean;
|
11
|
+
get sortedBreakpoints(): [keyof import("./global").UnistylesBreakpoints, number][];
|
12
|
+
get themeName(): keyof UnistylesThemes;
|
13
|
+
get breakpoint(): keyof import("./global").UnistylesBreakpoints;
|
14
|
+
get screen(): {
|
15
|
+
width: number;
|
16
|
+
height: number;
|
17
|
+
};
|
18
|
+
get orientation(): ScreenOrientation;
|
19
|
+
setTheme: (name: keyof UnistylesThemes) => boolean;
|
20
|
+
getTheme: (forName: keyof UnistylesThemes) => {
|
21
|
+
colors: {
|
22
|
+
backgroundColor: string;
|
23
|
+
typography: string;
|
24
|
+
accent: string;
|
25
|
+
barbie: string;
|
26
|
+
oak: string;
|
27
|
+
sky: string;
|
28
|
+
fog: string;
|
29
|
+
aloes: string;
|
30
|
+
blood: string;
|
31
|
+
};
|
32
|
+
} | {
|
33
|
+
colors: {
|
34
|
+
backgroundColor: string;
|
35
|
+
typography: string;
|
36
|
+
accent: string;
|
37
|
+
barbie: string;
|
38
|
+
oak: string;
|
39
|
+
sky: string;
|
40
|
+
fog: string;
|
41
|
+
aloes: string;
|
42
|
+
blood: string;
|
43
|
+
};
|
44
|
+
} | {
|
45
|
+
colors: {
|
46
|
+
backgroundColor: string;
|
47
|
+
typography: string;
|
48
|
+
accent: string;
|
49
|
+
barbie: string;
|
50
|
+
oak: string;
|
51
|
+
sky: string;
|
52
|
+
fog: string;
|
53
|
+
aloes: string;
|
54
|
+
blood: string;
|
55
|
+
};
|
56
|
+
};
|
57
|
+
setAdaptiveThemes: (enable: boolean) => void;
|
58
|
+
private hasTheme;
|
59
|
+
}
|
60
|
+
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../src/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,sCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,8DAE3B;IAED,IAAW,SAAS,0BAEnB;IAED,IAAW,UAAU,kDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { CustomNamedStyles } from './types';
|
2
|
+
import type { UnistylesThemes } from './global';
|
3
|
+
type T = UnistylesThemes[keyof UnistylesThemes];
|
4
|
+
export declare const createStyleSheet: <S extends CustomNamedStyles<S>, X>(styles: S | X | CustomNamedStyles<S> | ((theme: T) => X | CustomNamedStyles<X>)) => S | X;
|
5
|
+
export {};
|
6
|
+
//# sourceMappingURL=createStyleSheet.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AAE/C,eAAO,MAAM,gBAAgB,sFAAuF,CAAC,wCAMpH,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;CAAG"}
|
@@ -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;
|
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,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
2
|
+
import { ScreenOrientation } from './types';
|
3
|
+
export { useInitialTheme } from './useInitialTheme';
|
4
|
+
export { useStyles } from './useStyles';
|
5
|
+
export { createStyleSheet } from './createStyleSheet';
|
6
|
+
declare const UnistylesRuntime: import("./UnistylesRuntime").UnistylesRuntime;
|
7
|
+
declare const UnistylesRegistry: {
|
8
|
+
addThemes: (themes: UnistylesThemes) => import("./UnistyleRegistry").UnistyleRegistry;
|
9
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./UnistyleRegistry").UnistyleRegistry;
|
10
|
+
addConfig: (config: import("./types").UnistylesConfig) => import("./UnistyleRegistry").UnistyleRegistry;
|
11
|
+
};
|
12
|
+
export { UnistylesRuntime, UnistylesRegistry };
|
13
|
+
export { ScreenOrientation };
|
14
|
+
export type { UnistylesThemes, UnistylesBreakpoints };
|
3
15
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,QAAA,MAAM,gBAAgB,+CAAoB,CAAA;AAC1C,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACpB,CAAA;AAED,OAAO,EACH,iBAAiB,EACpB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
|
@@ -1,19 +1,18 @@
|
|
1
|
+
import type { UnistylesBreakpoints } from '../global';
|
1
2
|
import type { MediaQueries } from './mediaQueries';
|
2
|
-
export type Breakpoints = Record<string, number>;
|
3
|
-
export type SortedBreakpointEntries<B extends Breakpoints> = [[keyof B & string, number]];
|
4
3
|
export type ScreenSize = {
|
5
4
|
width: number;
|
6
5
|
height: number;
|
7
6
|
};
|
8
7
|
export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
|
9
8
|
type WithEmptyObject<V> = keyof V extends never ? {} : V;
|
10
|
-
export type ExtractBreakpoints<T
|
11
|
-
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R
|
9
|
+
export type ExtractBreakpoints<T> = T extends Partial<Record<keyof UnistylesBreakpoints & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : {
|
10
|
+
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : T[K] extends object ? ExtractBreakpoints<T[K]> : T[K];
|
12
11
|
};
|
13
|
-
export type RemoveKeysWithPrefix<T
|
14
|
-
[K in keyof T as K extends MediaQueries ? keyof
|
12
|
+
export type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends Record<string, infer _V> ? {
|
13
|
+
[K in keyof T as K extends MediaQueries ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
|
15
14
|
} : {
|
16
|
-
[K in keyof T]: RemoveKeysWithPrefix<T[K]
|
15
|
+
[K in keyof T]: RemoveKeysWithPrefix<T[K]>;
|
17
16
|
} : T;
|
18
17
|
export {};
|
19
18
|
//# sourceMappingURL=breakpoints.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,EAAE,CAAA;AAEjE,KAAK,eAAe,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;AAExD,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GACrG,eAAe,CAAC,CAAC,CAAC,GAClB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACnC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,GACrC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACpD,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,GACrC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACf,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACxB,CAAC,CAAC,CAAC,CAAC;CACjB,CAAA;AAET,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,GAC1E,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,GACnD,CAAC,SAAS,MAAM,GACZ,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,YAAY,GAAG,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAClH;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAClD,CAAC,CAAA"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
|
2
2
|
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
3
|
-
import type { Breakpoints } from './breakpoints';
|
4
3
|
import type { MediaQueries } from './mediaQueries';
|
4
|
+
import type { UnistylesBreakpoints } from '../global';
|
5
5
|
type ShadowOffset = {
|
6
6
|
width: number;
|
7
7
|
height: number;
|
@@ -24,9 +24,9 @@ type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
|
24
24
|
type UnistyleView<B> = DeepUniStyle<Omit<ViewStyle, NestedTypes>, B>;
|
25
25
|
type UnistyleText<B> = DeepUniStyle<Omit<TextStyle, NestedTypes>, B>;
|
26
26
|
type UnistyleImage<B> = DeepUniStyle<Omit<ImageStyle, NestedTypes>, B>;
|
27
|
-
export type StaticStyles<B
|
28
|
-
export type CustomNamedStyles<T
|
29
|
-
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<
|
27
|
+
export type StaticStyles<B> = UnistyleView<B> | UnistyleText<B> | UnistyleImage<B> & UnistyleNested<B>;
|
28
|
+
export type CustomNamedStyles<T> = {
|
29
|
+
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<UnistylesBreakpoints> ? (...args: A) => StaticStyles<UnistylesBreakpoints> : StaticStyles<UnistylesBreakpoints>;
|
30
30
|
};
|
31
31
|
export {};
|
32
32
|
//# sourceMappingURL=core.d.ts.map
|