react-native-unistyles 1.2.0 → 2.0.0-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/UnistylesRuntime.cpp +255 -0
- package/cxx/UnistylesRuntime.h +60 -0
- package/ios/UnistylesHelpers.h +4 -0
- package/ios/UnistylesHelpers.mm +20 -0
- package/ios/UnistylesModule.h +10 -0
- package/ios/UnistylesModule.mm +158 -0
- package/lib/commonjs/common.js +26 -0
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/core/UnistyleRegistry.js +38 -0
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/core/Unistyles.js +31 -0
- package/lib/commonjs/core/Unistyles.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.js +9 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +66 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/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/index.js +10 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useInitialTheme.js +17 -0
- package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +54 -0
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
- package/lib/commonjs/index.js +35 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
- package/lib/commonjs/types/index.js +11 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/mq.js +6 -0
- package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
- package/lib/commonjs/types/unistyles.js +6 -0
- package/lib/commonjs/types/unistyles.js.map +1 -0
- package/lib/commonjs/useStyles.js +49 -0
- package/lib/commonjs/useStyles.js.map +1 -0
- package/lib/commonjs/utils/breakpoints.js +44 -82
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/common.js +6 -1
- package/lib/commonjs/utils/common.js.map +1 -1
- package/lib/commonjs/utils/index.js +25 -30
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +89 -0
- package/lib/commonjs/utils/mq.js.map +1 -0
- package/lib/commonjs/utils/mqParser.js +86 -0
- package/lib/commonjs/utils/mqParser.js.map +1 -0
- package/lib/commonjs/utils/styles.js +6 -53
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/variants.js +20 -0
- package/lib/commonjs/utils/variants.js.map +1 -0
- package/lib/module/common.js +22 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/core/UnistyleRegistry.js +31 -0
- package/lib/module/core/UnistyleRegistry.js.map +1 -0
- package/lib/module/core/Unistyles.js +25 -0
- package/lib/module/core/Unistyles.js.map +1 -0
- package/lib/module/core/UnistylesModule.js +3 -0
- package/lib/module/core/UnistylesModule.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +59 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/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/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useInitialTheme.js +10 -0
- package/lib/module/hooks/useInitialTheme.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +47 -0
- package/lib/module/hooks/useUnistyles.js.map +1 -0
- package/lib/module/index.js +13 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/mq.js +2 -0
- package/lib/module/types/mq.js.map +1 -0
- package/lib/module/types/unistyles.js +2 -0
- package/lib/module/types/unistyles.js.map +1 -0
- package/lib/module/useStyles.js +42 -0
- package/lib/module/useStyles.js.map +1 -0
- package/lib/module/utils/breakpoints.js +43 -82
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/common.js +5 -0
- package/lib/module/utils/common.js.map +1 -1
- package/lib/module/utils/index.js +5 -3
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +83 -0
- package/lib/module/utils/mq.js.map +1 -0
- package/lib/module/utils/mqParser.js +79 -0
- package/lib/module/utils/mqParser.js.map +1 -0
- package/lib/module/utils/styles.js +7 -55
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/variants.js +13 -0
- package/lib/module/utils/variants.js.map +1 -0
- package/lib/typescript/src/common.d.ts +17 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +15 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/core/Unistyles.d.ts +13 -0
- package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts +6 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +24 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/createStyleSheet.d.ts +3 -0
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
- package/lib/typescript/src/global.d.ts +7 -0
- package/lib/typescript/src/global.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +2 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +12 -13
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +3 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/lib/typescript/src/types/core.d.ts +34 -18
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +5 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/mq.d.ts +3 -0
- package/lib/typescript/src/types/mq.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +37 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +10 -0
- package/lib/typescript/src/useStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +5 -62
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/common.d.ts +5 -0
- package/lib/typescript/src/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +5 -3
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +21 -0
- package/lib/typescript/src/utils/mq.d.ts.map +1 -0
- package/lib/typescript/src/utils/mqParser.d.ts +3 -0
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +4 -49
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/variants.d.ts +3 -0
- package/lib/typescript/src/utils/variants.d.ts.map +1 -0
- package/package.json +30 -19
- package/react-native-unistyles.podspec +22 -0
- package/src/common.ts +19 -0
- package/src/core/UnistyleRegistry.ts +41 -0
- package/src/core/Unistyles.ts +34 -0
- package/src/core/UnistylesModule.ts +7 -0
- package/src/core/UnistylesRuntime.ts +73 -0
- package/src/core/index.ts +1 -0
- package/src/createStyleSheet.ts +9 -0
- package/src/global.ts +5 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useInitialTheme.ts +11 -0
- package/src/hooks/useUnistyles.ts +55 -0
- package/src/index.ts +30 -2
- package/src/types/breakpoints.ts +16 -19
- package/src/types/common.ts +2 -0
- package/src/types/core.ts +42 -24
- package/src/types/index.ts +5 -9
- package/src/types/mq.ts +3 -0
- package/src/types/unistyles.ts +45 -0
- package/src/useStyles.ts +56 -0
- package/src/utils/breakpoints.ts +57 -88
- package/src/utils/common.ts +6 -0
- package/src/utils/index.ts +5 -10
- package/src/utils/mq.ts +106 -0
- package/src/utils/mqParser.ts +99 -0
- package/src/utils/styles.ts +17 -64
- package/src/utils/variants.ts +17 -0
- 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/commonjs/hooks/useDimensions.js +0 -10
- package/lib/commonjs/hooks/useDimensions.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.web.js +0 -34
- package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
- package/lib/commonjs/types/mediaQueries.js +0 -2
- package/lib/commonjs/utils/mediaQueries.js +0 -189
- package/lib/commonjs/utils/mediaQueries.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/module/hooks/useDimensions.js +0 -3
- package/lib/module/hooks/useDimensions.js.map +0 -1
- package/lib/module/hooks/useDimensions.web.js +0 -27
- package/lib/module/hooks/useDimensions.web.js.map +0 -1
- package/lib/module/types/mediaQueries.js +0 -2
- package/lib/module/utils/mediaQueries.js +0 -176
- package/lib/module/utils/mediaQueries.js.map +0 -1
- package/lib/typescript/examples/expo/src/App.d.ts +0 -3
- package/lib/typescript/examples/expo/src/App.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +0 -7
- package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/index.d.ts +0 -9
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/index.d.ts +0 -2
- package/lib/typescript/examples/expo/src/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +0 -8
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/index.d.ts +0 -46
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +0 -24
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.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/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +0 -8
- package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +0 -130
- package/lib/typescript/src/utils/mediaQueries.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
- package/src/hooks/useDimensions.ts +0 -4
- package/src/hooks/useDimensions.web.ts +0 -34
- package/src/types/mediaQueries.ts +0 -10
- package/src/utils/mediaQueries.ts +0 -201
@@ -1,30 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { getValueForNestedStyle } from './breakpoints';
|
2
2
|
import { normalizeStyles } from './normalizeStyles';
|
3
3
|
import { isAndroid, isIOS, isWeb } from './common';
|
4
|
-
|
5
|
-
|
6
|
-
* Proxies a function to parse its return value for custom media queries or breakpoints.
|
7
|
-
*
|
8
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
9
|
-
*
|
10
|
-
* @param {Function} fn - The function to be proxified.
|
11
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
12
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
13
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
14
|
-
*
|
15
|
-
* @returns {Function} Returns the proxified function
|
16
|
-
*
|
17
|
-
* @example
|
18
|
-
*
|
19
|
-
* const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
|
20
|
-
* const screenSize = { width: 250, height: 400 }
|
21
|
-
* const breakpoints = { sm: 300, md: 600 }
|
22
|
-
*
|
23
|
-
* const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
|
24
|
-
* proxifiedFunction() // parsed style based on screenSize and breakpoints
|
25
|
-
*/
|
26
|
-
export const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) => new Proxy(fn, {
|
27
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpointPairs)
|
4
|
+
export const proxifyFunction = (fn, breakpoint, screenSize, variant) => new Proxy(fn, {
|
5
|
+
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, variant)
|
28
6
|
});
|
29
7
|
export const isPlatformColor = value => {
|
30
8
|
if (isIOS) {
|
@@ -32,50 +10,24 @@ export const isPlatformColor = value => {
|
|
32
10
|
}
|
33
11
|
return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
|
34
12
|
};
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Parses a style object to resolve custom media queries or breakpoints based on the provided screen size and breakpoints.
|
38
|
-
*
|
39
|
-
* The function processes each key-value pair in the style object. If the value is a function or a valid style (not an object or a 'transform' key),
|
40
|
-
* it is returned as-is. Otherwise, the function attempts to resolve the value based on the provided breakpoint, screen size, and defined breakpoints.
|
41
|
-
*
|
42
|
-
* @template T - The type of the style object.
|
43
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
44
|
-
*
|
45
|
-
* @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
|
46
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
47
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
48
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
49
|
-
*
|
50
|
-
* @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
|
51
|
-
*
|
52
|
-
* @example
|
53
|
-
*
|
54
|
-
* const style = { fontSize: { sm: '12px', md: '16px' } }
|
55
|
-
* const screenSize = { width: 300, height: 400 }
|
56
|
-
* const breakpoints = { xs: 0, sm: 300, md: 600 }
|
57
|
-
*
|
58
|
-
* const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
|
59
|
-
* // { fontSize: '12px' }
|
60
|
-
*/
|
61
|
-
export const parseStyle = (style, breakpoint, screenSize, breakpointPairs) => {
|
13
|
+
export const parseStyle = (style, breakpoint, screenSize, variant) => {
|
62
14
|
const entries = Object.entries(style || {});
|
63
15
|
const parsedStyles = Object.fromEntries(entries.map(_ref => {
|
64
16
|
let [key, value] = _ref;
|
65
17
|
const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
|
66
18
|
if (hasNestedProperties) {
|
67
|
-
return [key, parseStyle(value, breakpoint, screenSize,
|
19
|
+
return [key, parseStyle(value, breakpoint, screenSize, variant)];
|
68
20
|
}
|
69
21
|
const isTransform = key === 'transform';
|
70
22
|
if (isTransform && Array.isArray(value)) {
|
71
|
-
return [key, value.map(value => parseStyle(value, breakpoint, screenSize,
|
23
|
+
return [key, value.map(value => parseStyle(value, breakpoint, screenSize, variant))];
|
72
24
|
}
|
73
25
|
const isDynamicFunction = typeof value === 'function';
|
74
26
|
const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
|
75
27
|
if (isDynamicFunction || isValidStyle) {
|
76
28
|
return [key, value];
|
77
29
|
}
|
78
|
-
return [key,
|
30
|
+
return [key, getValueForNestedStyle(value, variant)];
|
79
31
|
}));
|
80
32
|
return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
|
81
33
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["getValueForNestedStyle","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,eAAe;AACtD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,UAAU;AAElD,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,EACtBC,OAAgB,KACL,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,OAAO;AACxF,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAId,KAAK,EAAE;IACP,OAAO,UAAU,IAAIc,KAAK,IAAI,OAAOA,KAAK,CAACC,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOhB,SAAS,IAAI,gBAAgB,IAAIe,KAAK,IAAI,OAAOA,KAAK,CAACE,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAED,OAAO,MAAMJ,UAAU,GAAGA,CACtBK,KAA2B,EAC3Bb,UAA+C,EAC/CC,UAAsB,EACtBC,OAAgB,KACZ;EACJ,MAAMY,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,IAAI,CAAC,CAAC,CAGzC;EAED,MAAMG,YAAY,GAAGD,MAAM,CACtBE,WAAW,CAACH,OAAO,CACfI,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEV,KAAK,CAAC,GAAAS,IAAA;IACd,MAAME,mBAAmB,GAAGD,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB;IAEhF,IAAIC,mBAAmB,EAAE;MACrB,OAAO,CACHD,GAAG,EACHZ,UAAU,CAACE,KAAK,EAA0BV,UAAU,EAAEC,UAAU,EAAEC,OAAO,CAAC,CAC7E;IACL;IAEA,MAAMoB,WAAW,GAAGF,GAAG,KAAK,WAAW;IAEvC,IAAIE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC,EAAE;MACrC,OAAO,CACHU,GAAG,EACHV,KAAK,CAACQ,GAAG,CAACR,KAAK,IAAIF,UAAU,CAACE,KAAK,EAAEV,UAAU,EAAEC,UAAU,EAAEC,OAAO,CAAC,CAAC,CACzE;IACL;IAEA,MAAMuB,iBAAiB,GAAG,OAAOf,KAAK,KAAK,UAAU;IACrD,MAAMgB,YAAY,GAAG,OAAOhB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIe,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEV,KAAK,CAAC;IACvB;IAEA,OAAO,CACHU,GAAG,EACH3B,sBAAsB,CAClBiB,KAAK,EACLR,OACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOL,KAAK,GACNH,eAAe,CAACsB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export const getKeyForVariant = (value, variant) => {
|
2
|
+
if (!value.variants) {
|
3
|
+
return undefined;
|
4
|
+
}
|
5
|
+
if (variant && variant in value.variants) {
|
6
|
+
return variant;
|
7
|
+
}
|
8
|
+
if ('default' in value.variants) {
|
9
|
+
return 'default';
|
10
|
+
}
|
11
|
+
return undefined;
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=variants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getKeyForVariant","value","variant","variants","undefined"],"sourceRoot":"../../../src","sources":["utils/variants.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAGA,CAACC,KAAkB,EAAEC,OAAgB,KAAmC;EACpG,IAAI,CAACD,KAAK,CAACE,QAAQ,EAAE;IACjB,OAAOC,SAAS;EACpB;EAEA,IAAIF,OAAO,IAAIA,OAAO,IAAID,KAAK,CAACE,QAAQ,EAAE;IACtC,OAAOD,OAAO;EAClB;EAEA,IAAI,SAAS,IAAID,KAAK,CAACE,QAAQ,EAAE;IAC7B,OAAO,SAAS;EACpB;EAEA,OAAOC,SAAS;AACpB,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare enum CxxUnistylesEventTypes {
|
2
|
+
Theme = "theme",
|
3
|
+
Layout = "layout"
|
4
|
+
}
|
5
|
+
export declare enum UnistylesError {
|
6
|
+
RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
|
7
|
+
ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
|
8
|
+
ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
|
9
|
+
ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
|
10
|
+
BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
|
11
|
+
BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
|
12
|
+
}
|
13
|
+
export declare enum ScreenOrientation {
|
14
|
+
Portrait = 1,
|
15
|
+
Landscape = 2
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=common.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF;AAGD,oBAAY,iBAAiB;IACzB,QAAQ,IAAI;IACZ,SAAS,IAAI;CAChB"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { UnistylesBridge, UnistylesConfig } from '../types';
|
2
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
3
|
+
export declare class UnistyleRegistry {
|
4
|
+
private unistylesBridge;
|
5
|
+
config: UnistylesConfig;
|
6
|
+
themeNames: Array<keyof UnistylesThemes>;
|
7
|
+
themes: UnistylesThemes;
|
8
|
+
breakpoints: UnistylesBreakpoints;
|
9
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
10
|
+
constructor(unistylesBridge: UnistylesBridge);
|
11
|
+
addThemes: (themes: UnistylesThemes) => this;
|
12
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
|
13
|
+
addConfig: (config: UnistylesConfig) => this;
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEtE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,MAAM,EAAE,eAAe,CAAK;IAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAS1C;IAEM,cAAc,gBAAiB,oBAAoB,UAMzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;CACJ"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { UnistylesRuntime } from './UnistylesRuntime';
|
2
|
+
import { UnistyleRegistry } from './UnistyleRegistry';
|
3
|
+
declare class Unistyles {
|
4
|
+
private _runtime;
|
5
|
+
private _registry;
|
6
|
+
private _bridge;
|
7
|
+
constructor();
|
8
|
+
get registry(): UnistyleRegistry;
|
9
|
+
get runtime(): UnistylesRuntime;
|
10
|
+
}
|
11
|
+
export declare const unistyles: Unistyles;
|
12
|
+
export {};
|
13
|
+
//# sourceMappingURL=Unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../../src/core/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAehC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IACzB,OAAO,IAAI,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,uBAAoD,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { ScreenOrientation } from '../common';
|
2
|
+
import type { UnistylesBridge } from '../types';
|
3
|
+
import type { UnistylesThemes } from '../global';
|
4
|
+
import type { UnistyleRegistry } from './UnistyleRegistry';
|
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 | undefined][];
|
12
|
+
get themeName(): never;
|
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) => never;
|
21
|
+
setAdaptiveThemes: (enable: boolean) => void;
|
22
|
+
private hasTheme;
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,2EAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAUhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,gBAAgB,yDAA0D,cAAc,wCAMpG,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;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useInitialTheme.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useInitialTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,eAAe,YAAa,MAAM,eAAe,SAM7D,CAAA"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export declare const useUnistyles: () => {
|
2
|
+
theme: never;
|
3
|
+
layout: {
|
4
|
+
breakpoint: keyof import("..").UnistylesBreakpoints;
|
5
|
+
orientation: import("../common").ScreenOrientation;
|
6
|
+
screenSize: {
|
7
|
+
width: number;
|
8
|
+
height: number;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=useUnistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;CA8CxB,CAAA"}
|
@@ -1,3 +1,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { mq } from './utils';
|
2
|
+
import { useInitialTheme } from './hooks';
|
3
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
4
|
+
import { ScreenOrientation } from './common';
|
5
|
+
import { useStyles } from './useStyles';
|
6
|
+
import { createStyleSheet } from './createStyleSheet';
|
7
|
+
declare const UnistylesRegistry: {
|
8
|
+
addThemes: (themes: UnistylesThemes) => import("./core/UnistyleRegistry").UnistyleRegistry;
|
9
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./core/UnistyleRegistry").UnistyleRegistry;
|
10
|
+
addConfig: (config: import("./types").UnistylesConfig) => import("./core/UnistyleRegistry").UnistyleRegistry;
|
11
|
+
};
|
12
|
+
declare const UnistylesRuntime: import("./core/UnistylesRuntime").UnistylesRuntime;
|
13
|
+
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
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,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,oDAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
|
@@ -1,20 +1,19 @@
|
|
1
1
|
import type { OpaqueColorValue } from 'react-native';
|
2
|
-
import type {
|
3
|
-
|
4
|
-
|
5
|
-
export type ScreenSize = {
|
6
|
-
width: number;
|
7
|
-
height: number;
|
8
|
-
};
|
9
|
-
export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
|
2
|
+
import type { UnistylesBreakpoints } from '../global';
|
3
|
+
import type { MediaQuery } from './mq';
|
4
|
+
import type { VariantValue } from './core';
|
10
5
|
type WithEmptyObject<V> = keyof V extends never ? {} : V;
|
11
|
-
|
12
|
-
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R
|
6
|
+
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> : {
|
7
|
+
[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];
|
13
8
|
};
|
14
|
-
|
15
|
-
|
9
|
+
type FlattenObjectTypes<T> = T[keyof T];
|
10
|
+
type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends OpaqueColorValue ? string : T extends Record<string, infer _V> ? T extends {
|
11
|
+
variants: VariantValue;
|
12
|
+
} ? RemoveKeysWithPrefix<FlattenObjectTypes<T['variants']>> : {
|
13
|
+
[K in keyof T as K extends MediaQuery ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
|
16
14
|
} : {
|
17
|
-
[K in keyof T]: RemoveKeysWithPrefix<T[K]
|
15
|
+
[K in keyof T]: RemoveKeysWithPrefix<T[K]>;
|
18
16
|
} : T;
|
17
|
+
export type ReactNativeStyleSheet<T> = ExtractBreakpoints<RemoveKeysWithPrefix<T>>;
|
19
18
|
export {};
|
20
19
|
//# 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,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"breakpoints.d.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AAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,GACnD,CAAC,SAAS,MAAM,GACZ,CAAC,SAAS,gBAAgB,GACtB,MAAM,GACN,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,CAAC,SAAS;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,GAChC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GACvD;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,UAAU,GAAG,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACpH;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtD,CAAC,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,kBAAkB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/types/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AACvC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA"}
|
@@ -1,32 +1,48 @@
|
|
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 {
|
4
|
-
import type {
|
3
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
4
|
+
import type { MediaQuery } from './mq';
|
5
5
|
type ShadowOffset = {
|
6
6
|
width: number;
|
7
7
|
height: number;
|
8
8
|
};
|
9
|
+
export type ScreenSize = {
|
10
|
+
width: number;
|
11
|
+
height: number;
|
12
|
+
};
|
9
13
|
type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
|
10
|
-
type UnistyleNested
|
11
|
-
shadowOffset?: DeepUniStyle<ShadowOffset
|
12
|
-
textShadowOffset?: DeepUniStyle<ShadowOffset
|
13
|
-
transform?: Array<DeepUniStyle<TransformStyles
|
14
|
+
type UnistyleNested = {
|
15
|
+
shadowOffset?: DeepUniStyle<ShadowOffset>;
|
16
|
+
textShadowOffset?: DeepUniStyle<ShadowOffset>;
|
17
|
+
transform?: Array<DeepUniStyle<TransformStyles>>;
|
14
18
|
};
|
15
|
-
type UniStyle<V
|
16
|
-
[innerKey in keyof
|
19
|
+
type UniStyle<V> = {
|
20
|
+
[innerKey in keyof UnistylesBreakpoints]?: V;
|
17
21
|
} | {
|
18
|
-
[innerKey in
|
19
|
-
} |
|
20
|
-
|
21
|
-
|
22
|
+
[innerKey in MediaQuery]: V;
|
23
|
+
} | {
|
24
|
+
[innerKey in 'variants']?: {
|
25
|
+
[variant: string]: V;
|
26
|
+
};
|
27
|
+
};
|
28
|
+
type DeepUniStyle<T> = {
|
29
|
+
[K in keyof T]?: UniStyle<T[K]> | T[K];
|
22
30
|
};
|
23
31
|
type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
24
|
-
type UnistyleView
|
25
|
-
type UnistyleText
|
26
|
-
type UnistyleImage
|
27
|
-
export type StaticStyles
|
28
|
-
export type CustomNamedStyles<T
|
29
|
-
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles
|
32
|
+
type UnistyleView = DeepUniStyle<Omit<ViewStyle, NestedTypes>>;
|
33
|
+
type UnistyleText = DeepUniStyle<Omit<TextStyle, NestedTypes>>;
|
34
|
+
type UnistyleImage = DeepUniStyle<Omit<ImageStyle, NestedTypes>>;
|
35
|
+
export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & UnistyleNested;
|
36
|
+
export type CustomNamedStyles<T> = {
|
37
|
+
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
|
38
|
+
};
|
39
|
+
export type RNValue = number | string | undefined;
|
40
|
+
export type VariantValue = Record<string, RNValue>;
|
41
|
+
export type NestedStyle = Record<keyof UnistylesBreakpoints | MediaQuery | 'variants', RNValue> & {
|
42
|
+
variants: VariantValue;
|
30
43
|
};
|
44
|
+
export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | MediaQuery | 'variants', RNValue | VariantValue]>;
|
45
|
+
export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
|
46
|
+
export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
|
31
47
|
export {};
|
32
48
|
//# sourceMappingURL=core.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,g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eAAe,CAAC,CAAA;AACnE,MAAM,MAAM,mBAAmB,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,EAAE,CAAA"}
|
@@ -1,4 +1,7 @@
|
|
1
1
|
export * from './normalizer';
|
2
|
-
export
|
3
|
-
export type {
|
2
|
+
export * from './unistyles';
|
3
|
+
export type { Optional, Nullable } from './common';
|
4
|
+
export type { MediaQuery } from './mq';
|
5
|
+
export type { CustomNamedStyles, NestedStylePairs, UnistylesTheme, CreateStylesFactory, ScreenSize, NestedStyle, RNValue } from './core';
|
6
|
+
export type { ReactNativeStyleSheet } from './breakpoints';
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,YAAY,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACxI,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/types/mq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,CAAA"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { CxxUnistylesEventTypes, ScreenOrientation } from '../common';
|
2
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
|
3
|
+
import type { ScreenSize } from './core';
|
4
|
+
import type { Optional } from './common';
|
5
|
+
export type ColorSchemeName = Optional<'light' | 'dark'>;
|
6
|
+
export type UnistylesConfig = {
|
7
|
+
adaptiveThemes?: boolean;
|
8
|
+
};
|
9
|
+
export type UnistylesBridge = {
|
10
|
+
screenWidth: number;
|
11
|
+
screenHeight: number;
|
12
|
+
hasAdaptiveThemes: boolean;
|
13
|
+
themeName: keyof UnistylesThemes;
|
14
|
+
breakpoint: keyof UnistylesBreakpoints;
|
15
|
+
colorScheme: ColorSchemeName;
|
16
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
17
|
+
themes: Array<keyof UnistylesThemes>;
|
18
|
+
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
19
|
+
useTheme(name: keyof UnistylesThemes): void;
|
20
|
+
useAdaptiveThemes(enable: boolean): void;
|
21
|
+
};
|
22
|
+
export type UnistylesThemeEvent = {
|
23
|
+
type: CxxUnistylesEventTypes.Theme;
|
24
|
+
payload: {
|
25
|
+
themeName: keyof UnistylesThemes;
|
26
|
+
};
|
27
|
+
};
|
28
|
+
export type UnistylesMobileLayoutEvent = {
|
29
|
+
type: CxxUnistylesEventTypes.Layout;
|
30
|
+
payload: {
|
31
|
+
screen: ScreenSize;
|
32
|
+
breakpoint: keyof UnistylesBreakpoints;
|
33
|
+
orientation: ScreenOrientation;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent;
|
37
|
+
//# sourceMappingURL=unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE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nB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,iBAAiB,CAAA;KACjC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { CreateStylesFactory, CustomNamedStyles, ReactNativeStyleSheet, UnistylesTheme } from './types';
|
2
|
+
import type { UnistylesBreakpoints } from './global';
|
3
|
+
type ParsedStylesheet<ST extends CustomNamedStyles<ST>> = {
|
4
|
+
theme: UnistylesTheme;
|
5
|
+
breakpoint: keyof UnistylesBreakpoints;
|
6
|
+
styles: ReactNativeStyleSheet<ST>;
|
7
|
+
};
|
8
|
+
export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined, variant?: string) => ParsedStylesheet<ST>;
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=useStyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,KAAK,gBAAgB,CAAC,EAAE,SAAS,iBAAiB,CAAC,EAAE,CAAC,IAAI;IACtD,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,6GAER,MAAM,yBAwCnB,CAAA"}
|