react-native-unistyles 2.0.0-alpha.9 → 2.0.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +28 -0
- package/android/build.gradle +40 -0
- package/android/src/main/cxx/cpp-adapter.cpp +108 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +159 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +18 -0
- package/cxx/UnistylesRuntime.cpp +55 -2
- package/cxx/UnistylesRuntime.h +15 -9
- package/ios/UnistylesModule.mm +16 -6
- package/lib/commonjs/common.js +30 -16
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/core/UnistyleRegistry.js +65 -3
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/core/Unistyles.js +1 -1
- package/lib/commonjs/core/Unistyles.js.map +1 -1
- package/lib/commonjs/core/UnistylesModule.web.js +187 -0
- package/lib/commonjs/core/UnistylesModule.web.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +15 -16
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/createStyleSheet.js +1 -6
- package/lib/commonjs/createStyleSheet.js.map +1 -1
- package/lib/commonjs/hooks/index.js +7 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useUnistyles.js +12 -9
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
- package/lib/commonjs/hooks/useVariants.js +14 -0
- package/lib/commonjs/hooks/useVariants.js.map +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugins/index.js +38 -0
- package/lib/commonjs/plugins/index.js.map +1 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/commonjs/plugins/normalizer/index.js +32 -0
- package/lib/commonjs/plugins/normalizer/index.js.map +1 -0
- package/lib/commonjs/plugins/normalizer/module.d.js.map +1 -0
- package/lib/commonjs/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +5 -5
- package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +1 -0
- package/lib/commonjs/{utils → plugins/normalizer}/normalizer.js +1 -1
- package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -0
- package/lib/commonjs/types/{mq.js → plugin.js} +1 -1
- package/lib/commonjs/types/{mq.js.map → plugin.js.map} +1 -1
- package/lib/commonjs/types/stylesheet.js +6 -0
- package/lib/commonjs/types/stylesheet.js.map +1 -0
- package/lib/commonjs/types/variants.js +2 -0
- package/lib/commonjs/{utils/module.d.js.map → types/variants.js.map} +1 -1
- package/lib/commonjs/useStyles.js +10 -20
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/commonjs/utils/breakpoints.js +13 -59
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/index.js +13 -51
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +36 -68
- package/lib/commonjs/utils/mq.js.map +1 -1
- package/lib/commonjs/utils/mqParser.js +4 -1
- package/lib/commonjs/utils/mqParser.js.map +1 -1
- package/lib/commonjs/utils/styles.js +35 -20
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/withPlugins.js +15 -0
- package/lib/commonjs/utils/withPlugins.js.map +1 -0
- package/lib/module/common.js +28 -17
- package/lib/module/common.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +65 -3
- package/lib/module/core/UnistyleRegistry.js.map +1 -1
- package/lib/module/core/Unistyles.js +2 -2
- package/lib/module/core/Unistyles.js.map +1 -1
- package/lib/module/core/UnistylesModule.web.js +180 -0
- package/lib/module/core/UnistylesModule.web.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +15 -16
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/createStyleSheet.js +1 -6
- package/lib/module/createStyleSheet.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useUnistyles.js +13 -10
- package/lib/module/hooks/useUnistyles.js.map +1 -1
- package/lib/module/hooks/useVariants.js +7 -0
- package/lib/module/hooks/useVariants.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugins/index.js +3 -0
- package/lib/module/plugins/index.js.map +1 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/module/plugins/normalizer/index.js +3 -0
- package/lib/module/plugins/normalizer/index.js.map +1 -0
- package/lib/module/plugins/normalizer/module.d.js.map +1 -0
- package/lib/module/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +3 -3
- package/lib/module/plugins/normalizer/normalizeStyle.js.map +1 -0
- package/lib/module/{utils → plugins/normalizer}/normalizer.js +1 -1
- package/lib/module/plugins/normalizer/normalizer.js.map +1 -0
- package/lib/module/types/plugin.js +2 -0
- package/lib/module/types/{mq.js.map → plugin.js.map} +1 -1
- package/lib/module/types/stylesheet.js +2 -0
- package/lib/module/types/stylesheet.js.map +1 -0
- package/lib/module/types/variants.js +2 -0
- package/lib/module/{utils/module.d.js.map → types/variants.js.map} +1 -1
- package/lib/module/useStyles.js +12 -22
- package/lib/module/useStyles.js.map +1 -1
- package/lib/module/utils/breakpoints.js +12 -56
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/index.js +4 -6
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +35 -67
- package/lib/module/utils/mq.js.map +1 -1
- package/lib/module/utils/mqParser.js +3 -3
- package/lib/module/utils/mqParser.js.map +1 -1
- package/lib/module/utils/styles.js +35 -20
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/withPlugins.js +8 -0
- package/lib/module/utils/withPlugins.js.map +1 -0
- package/lib/typescript/src/common.d.ts +23 -12
- package/lib/typescript/src/common.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +45 -4
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesModule.web.d.ts +19 -0
- package/lib/typescript/src/core/UnistylesModule.web.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +8 -9
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +1 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/createStyleSheet.d.ts +2 -2
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
- package/lib/typescript/src/global.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts +2 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
- package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +51 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/plugins/index.d.ts +3 -0
- package/lib/typescript/src/plugins/index.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizer/index.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizer/index.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +1 -0
- package/lib/typescript/src/{utils → plugins/normalizer}/normalizer.d.ts +1 -1
- package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/types/breakpoints.d.ts +25 -12
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +6 -27
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +4 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/plugin.d.ts +7 -0
- package/lib/typescript/src/types/plugin.d.ts.map +1 -0
- package/lib/typescript/src/types/stylesheet.d.ts +40 -0
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +16 -11
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/lib/typescript/src/types/variants.d.ts +14 -0
- package/lib/typescript/src/types/variants.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +3 -3
- package/lib/typescript/src/useStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/breakpoints.d.ts +2 -5
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +4 -6
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +15 -14
- package/lib/typescript/src/utils/mq.d.ts.map +1 -1
- package/lib/typescript/src/utils/mqParser.d.ts +14 -2
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
- package/lib/typescript/src/utils/styles.d.ts +3 -4
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +3 -0
- package/lib/typescript/src/utils/withPlugins.d.ts.map +1 -0
- package/package.json +19 -16
- package/src/__tests__/mocks.ts +24 -0
- package/src/common.ts +30 -14
- package/src/core/UnistyleRegistry.ts +66 -4
- package/src/core/Unistyles.ts +2 -2
- package/src/core/UnistylesModule.web.ts +214 -0
- package/src/core/UnistylesRuntime.ts +18 -20
- package/src/core/index.ts +1 -0
- package/src/createStyleSheet.ts +2 -8
- package/src/global.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useUnistyles.ts +12 -10
- package/src/hooks/useVariants.ts +10 -0
- package/src/index.ts +3 -1
- package/src/plugins/index.ts +2 -0
- package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
- package/src/plugins/normalizer/index.ts +2 -0
- package/src/{utils/normalizeStyles.web.ts → plugins/normalizer/normalizeStyle.ts} +3 -3
- package/src/{utils → plugins/normalizer}/normalizer.ts +3 -3
- package/src/types/breakpoints.ts +57 -25
- package/src/types/core.ts +9 -43
- package/src/types/index.ts +11 -2
- package/src/types/plugin.ts +7 -0
- package/src/types/stylesheet.ts +49 -0
- package/src/types/unistyles.ts +18 -13
- package/src/types/variants.ts +19 -0
- package/src/useStyles.ts +18 -25
- package/src/utils/breakpoints.ts +11 -67
- package/src/utils/index.ts +4 -6
- package/src/utils/mq.ts +31 -84
- package/src/utils/mqParser.ts +5 -5
- package/src/utils/styles.ts +44 -50
- package/src/utils/withPlugins.ts +13 -0
- package/lib/commonjs/utils/common.js +0 -25
- package/lib/commonjs/utils/common.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.js +0 -10
- package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
- package/lib/commonjs/utils/normalizer.js.map +0 -1
- package/lib/module/types/mq.js +0 -2
- package/lib/module/utils/common.js +0 -17
- package/lib/module/utils/common.js.map +0 -1
- package/lib/module/utils/normalizeStyles.js +0 -3
- package/lib/module/utils/normalizeStyles.js.map +0 -1
- package/lib/module/utils/normalizeStyles.web.js.map +0 -1
- package/lib/module/utils/normalizer.js.map +0 -1
- package/lib/typescript/src/types/mq.d.ts +0 -3
- package/lib/typescript/src/types/mq.d.ts.map +0 -1
- package/lib/typescript/src/utils/common.d.ts +0 -12
- package/lib/typescript/src/utils/common.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
- package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
- package/src/types/mq.ts +0 -3
- package/src/utils/common.ts +0 -20
- package/src/utils/normalizeStyles.ts +0 -2
- /package/lib/commonjs/{utils → plugins/normalizer}/module.d.js +0 -0
- /package/lib/module/{utils → plugins/normalizer}/module.d.js +0 -0
- /package/src/{utils → plugins/normalizer}/module.d.ts +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
import { getValueForBreakpoint } from './breakpoints';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
export const proxifyFunction = (
|
5
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList),
|
2
|
+
import { isAndroid, isIOS } from '../common';
|
3
|
+
import { withPlugins } from './withPlugins';
|
4
|
+
export const proxifyFunction = (key, fn, variant) => new Proxy(fn, {
|
5
|
+
apply: (target, thisArg, argumentsList) => withPlugins(key, parseStyle(target.apply(thisArg, argumentsList), variant))
|
6
6
|
});
|
7
7
|
export const isPlatformColor = value => {
|
8
8
|
if (isIOS) {
|
@@ -10,25 +10,40 @@ export const isPlatformColor = value => {
|
|
10
10
|
}
|
11
11
|
return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
|
12
12
|
};
|
13
|
-
export const parseStyle = (style
|
14
|
-
|
15
|
-
|
13
|
+
export const parseStyle = function (style) {
|
14
|
+
let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
15
|
+
return Object.entries(style || {}).reduce((acc, _ref) => {
|
16
16
|
let [key, value] = _ref;
|
17
|
-
|
18
|
-
if (
|
19
|
-
|
17
|
+
// nested objects
|
18
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
19
|
+
acc[key] = parseStyle(value, variant);
|
20
|
+
return acc;
|
20
21
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
// transforms
|
24
|
+
if (key === 'transform' && Array.isArray(value)) {
|
25
|
+
acc[key] = value.map(value => parseStyle(value, variant));
|
26
|
+
return acc;
|
24
27
|
}
|
25
|
-
|
26
|
-
|
27
|
-
if (
|
28
|
-
|
28
|
+
|
29
|
+
// values or platform colors
|
30
|
+
if (typeof value !== 'object' || isPlatformColor(value)) {
|
31
|
+
acc[key] = value;
|
32
|
+
return acc;
|
29
33
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
if (key === 'variants') {
|
35
|
+
return {
|
36
|
+
...acc,
|
37
|
+
...Object.keys(value).reduce((acc, key) => ({
|
38
|
+
...acc,
|
39
|
+
...parseStyle(value[key][variant[key] || 'default'] ?? {})
|
40
|
+
}), {})
|
41
|
+
};
|
42
|
+
}
|
43
|
+
return {
|
44
|
+
...acc,
|
45
|
+
[key]: getValueForBreakpoint(value)
|
46
|
+
};
|
47
|
+
}, {});
|
33
48
|
};
|
34
49
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getValueForBreakpoint","
|
1
|
+
{"version":3,"names":["getValueForBreakpoint","isAndroid","isIOS","withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","arguments","length","undefined","Object","entries","reduce","acc","_ref","Array","isArray","map","keys"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC,OAA0C,KAC/B,IAAIC,KAAK,CAACF,EAAE,EAAE;EACzBG,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAAKT,WAAW,CAACE,GAAG,EAAEQ,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEL,OAAO,CAAC;AACzH,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAA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CAAC,CACXS,MAAM,CAAC,CAACC,GAAG,EAAEpB,GAAG,MAAM;UACnB,GAAGoB,GAAG;UACN,GAAGZ,UAAU,CAAEE,KAAK,CAAEV,GAAG,CAAC,CAACE,OAAO,CAACF,GAAG,CAAyB,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QACvF,CAAC,CAAC,EAAE,CAAC,CAAC;MACd,CAAC;IACL;IAEA,OAAO;MACH,GAAGoB,GAAG;MACN,CAACpB,GAAG,GAAGL,qBAAqB,CAACe,KAAgC;IACjE,CAAC;EACL,CAAC,EAAE,CAAC,CAAM,CAAC;AAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { unistyles } from '../core';
|
2
|
+
export const withPlugins = (key, style) => unistyles.registry.plugins.reduce((acc, plugin) => {
|
3
|
+
if (plugin.onParsedStyle) {
|
4
|
+
return plugin.onParsedStyle(key, acc, unistyles.runtime);
|
5
|
+
}
|
6
|
+
return acc;
|
7
|
+
}, style);
|
8
|
+
//# sourceMappingURL=withPlugins.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["unistyles","withPlugins","key","style","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbH,SAAS,CAACI,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACP,GAAG,EAAEK,GAAG,EAAEP,SAAS,CAACU,OAAO,CAAC;EAC5D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEJ,KAAK,CAAC"}
|
@@ -1,17 +1,28 @@
|
|
1
|
-
export declare
|
1
|
+
export declare const warn: (message: string) => void;
|
2
|
+
export declare const isWeb: boolean;
|
3
|
+
export declare const isIOS: boolean;
|
4
|
+
export declare const isAndroid: boolean;
|
5
|
+
export declare const isMobile: boolean;
|
6
|
+
export declare const isServer: boolean;
|
7
|
+
export declare const ScreenOrientation: {
|
8
|
+
readonly Landscape: "landscape";
|
9
|
+
readonly Portrait: "portrait";
|
10
|
+
};
|
11
|
+
export declare enum UnistylesEventType {
|
2
12
|
Theme = "theme",
|
3
|
-
Layout = "layout"
|
13
|
+
Layout = "layout",
|
14
|
+
Plugin = "plugin"
|
4
15
|
}
|
5
16
|
export declare enum UnistylesError {
|
6
|
-
RuntimeUnavailable = "
|
7
|
-
ThemeNotFound = "
|
8
|
-
ThemeNotRegistered = "
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions",
|
18
|
+
ThemeNotFound = "You are trying to get a theme that is not registered with UnistylesRegistry",
|
19
|
+
ThemeNotRegistered = "You are trying to set a theme that was not registered with UnistylesRegistry",
|
20
|
+
ThemeNotSelected = "Your themes are registered, but you didn't select the initial theme",
|
21
|
+
ThemesCannotBeEmpty = "You are trying to register empty themes object",
|
22
|
+
BreakpointsCannotBeEmpty = "You are trying to register empty breakpoints object",
|
23
|
+
BreakpointsMustStartFromZero = "You are trying to register breakpoints that don't start from 0",
|
24
|
+
InvalidPluginName = "Plugin name can't start from reserved prefix __unistyles",
|
25
|
+
DuplicatePluginName = "You are trying to register a plugin with a name that is already registered",
|
26
|
+
CantRemoveInternalPlugin = "You are trying to remove an internal unistyles plugin"
|
16
27
|
}
|
17
28
|
//# sourceMappingURL=common.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,6FAA6F;IAC/G,aAAa,gFAAgF;IAC7F,kBAAkB,iFAAiF;IACnG,gBAAgB,wEAAyE;IACzF,mBAAmB,mDAAmD;IACtE,wBAAwB,wDAAwD;IAChF,4BAA4B,mEAAoE;IAChG,iBAAiB,6DAA8D;IAC/E,mBAAmB,+EAA+E;IAClG,wBAAwB,0DAA0D;CACrF"}
|
@@ -1,15 +1,56 @@
|
|
1
|
-
import type { UnistylesBridge, UnistylesConfig } from '../types';
|
1
|
+
import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types';
|
2
2
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
3
3
|
export declare class UnistyleRegistry {
|
4
4
|
private unistylesBridge;
|
5
5
|
config: UnistylesConfig;
|
6
|
+
plugins: Array<UnistylesPlugin>;
|
6
7
|
themeNames: Array<keyof UnistylesThemes>;
|
7
8
|
themes: UnistylesThemes;
|
8
9
|
breakpoints: UnistylesBreakpoints;
|
9
10
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
10
11
|
constructor(unistylesBridge: UnistylesBridge);
|
11
|
-
addThemes: (themes: UnistylesThemes) =>
|
12
|
-
|
13
|
-
|
12
|
+
addThemes: (themes: UnistylesThemes) => {
|
13
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
14
|
+
addThemes: any;
|
15
|
+
addConfig: (config: UnistylesConfig) => {
|
16
|
+
addBreakpoints: any;
|
17
|
+
addThemes: any;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
addConfig: (config: UnistylesConfig) => {
|
21
|
+
addBreakpoints: any;
|
22
|
+
addThemes: any;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
26
|
+
addThemes: (themes: UnistylesThemes) => {
|
27
|
+
addBreakpoints: any;
|
28
|
+
addConfig: (config: UnistylesConfig) => {
|
29
|
+
addBreakpoints: any;
|
30
|
+
addThemes: any;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
addConfig: (config: UnistylesConfig) => {
|
34
|
+
addBreakpoints: any;
|
35
|
+
addThemes: any;
|
36
|
+
};
|
37
|
+
};
|
38
|
+
addConfig: (config: UnistylesConfig) => {
|
39
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
40
|
+
addThemes: (themes: UnistylesThemes) => {
|
41
|
+
addBreakpoints: any;
|
42
|
+
addConfig: any;
|
43
|
+
};
|
44
|
+
addConfig: any;
|
45
|
+
};
|
46
|
+
addThemes: (themes: UnistylesThemes) => {
|
47
|
+
addBreakpoints: any;
|
48
|
+
addConfig: any;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
getTheme: (forName: keyof UnistylesThemes) => never;
|
52
|
+
addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
|
53
|
+
removePlugin: (plugin: UnistylesPlugin) => void;
|
54
|
+
hasTheme: (name: keyof UnistylesThemes) => boolean;
|
14
55
|
}
|
15
56
|
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -1 +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;
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAItE,qBAAa,gBAAgB;IAUb,OAAO,CAAC,eAAe;IAT5B,MAAM,EAAE,eAAe,CAAK;IAC5B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAE9B;IACD,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;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;MA4C1C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAchD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAW3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export declare class UnistylesBridgeWeb {
|
2
|
+
#private;
|
3
|
+
constructor();
|
4
|
+
install(): boolean;
|
5
|
+
private useTheme;
|
6
|
+
private useBreakpoints;
|
7
|
+
private useAdaptiveThemes;
|
8
|
+
private addPlugin;
|
9
|
+
private removePlugin;
|
10
|
+
private getTheme;
|
11
|
+
private setupListeners;
|
12
|
+
private getBreakpointFromScreenWidth;
|
13
|
+
private getPreferredColorScheme;
|
14
|
+
private emitPluginChange;
|
15
|
+
private emitThemeChange;
|
16
|
+
private emitLayoutChange;
|
17
|
+
}
|
18
|
+
export declare const UnistylesModule: UnistylesBridgeWeb;
|
19
|
+
//# sourceMappingURL=UnistylesModule.web.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesModule.web.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.web.ts"],"names":[],"mappings":"AAKA,qBAAa,kBAAkB;;;IAkBpB,OAAO;IA0Dd,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAe3B;AAED,eAAO,MAAM,eAAe,oBAA2B,CAAA"}
|
@@ -1,24 +1,23 @@
|
|
1
|
-
import {
|
2
|
-
import type { UnistylesBridge } from '../types';
|
1
|
+
import type { UnistylesBridge, UnistylesPlugin } from '../types';
|
3
2
|
import type { UnistylesThemes } from '../global';
|
4
3
|
import type { UnistyleRegistry } from './UnistyleRegistry';
|
5
4
|
export declare class UnistylesRuntime {
|
6
5
|
private unistylesBridge;
|
7
|
-
private
|
8
|
-
constructor(unistylesBridge: UnistylesBridge,
|
6
|
+
private unistylesRegistry;
|
7
|
+
constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
|
9
8
|
get colorScheme(): import("../types").ColorSchemeName;
|
10
9
|
get hasAdaptiveThemes(): boolean;
|
11
|
-
get sortedBreakpoints(): [keyof import("../global").UnistylesBreakpoints, number | undefined][];
|
12
10
|
get themeName(): never;
|
13
11
|
get breakpoint(): keyof import("../global").UnistylesBreakpoints;
|
12
|
+
get enabledPlugins(): string[];
|
14
13
|
get screen(): {
|
15
14
|
width: number;
|
16
15
|
height: number;
|
17
16
|
};
|
18
|
-
get orientation():
|
19
|
-
setTheme: (name: keyof UnistylesThemes) =>
|
20
|
-
getTheme: (forName: keyof UnistylesThemes) => never;
|
17
|
+
get orientation(): "landscape" | "portrait";
|
18
|
+
setTheme: (name: keyof UnistylesThemes) => true | undefined;
|
21
19
|
setAdaptiveThemes: (enable: boolean) => void;
|
22
|
-
|
20
|
+
addPlugin: (plugin: UnistylesPlugin) => void;
|
21
|
+
removePlugin: (plugin: UnistylesPlugin) => void;
|
23
22
|
}
|
24
23
|
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,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,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,cAAc,aAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,6BAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAEM,SAAS,WAAY,eAAe,UAE1C;IAEM,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
export declare const createStyleSheet: <S
|
1
|
+
import type { StyleSheetWithSuperPowers } from './types';
|
2
|
+
export declare const createStyleSheet: <S extends StyleSheetWithSuperPowers>(stylesheet: S) => S;
|
3
3
|
//# sourceMappingURL=createStyleSheet.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,gBAAgB,2DAAwE,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IAEjC,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,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
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;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
export declare const useUnistyles: () => {
|
2
|
+
plugins: string[];
|
2
3
|
theme: never;
|
3
4
|
layout: {
|
4
5
|
breakpoint: keyof import("..").UnistylesBreakpoints;
|
5
|
-
orientation:
|
6
|
+
orientation: "landscape" | "portrait";
|
6
7
|
screenSize: {
|
7
8
|
width: number;
|
8
9
|
height: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;CAgDxB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,WAAW,iBAAkB,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,+CAMzE,CAAA"}
|
@@ -1,15 +1,61 @@
|
|
1
1
|
import { mq } from './utils';
|
2
2
|
import { useInitialTheme } from './hooks';
|
3
|
+
import type { UnistylesPlugin } from './types';
|
3
4
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
4
5
|
import { ScreenOrientation } from './common';
|
5
6
|
import { useStyles } from './useStyles';
|
6
7
|
import { createStyleSheet } from './createStyleSheet';
|
7
8
|
declare const UnistylesRegistry: {
|
8
|
-
addThemes: (themes: UnistylesThemes) =>
|
9
|
-
|
10
|
-
|
9
|
+
addThemes: (themes: UnistylesThemes) => {
|
10
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
11
|
+
addThemes: any;
|
12
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
13
|
+
addBreakpoints: any;
|
14
|
+
addThemes: any;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
18
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
19
|
+
addThemes: any;
|
20
|
+
addConfig: any;
|
21
|
+
};
|
22
|
+
addThemes: any;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
26
|
+
addThemes: (themes: UnistylesThemes) => {
|
27
|
+
addBreakpoints: any;
|
28
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
29
|
+
addBreakpoints: any;
|
30
|
+
addThemes: any;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
34
|
+
addBreakpoints: any;
|
35
|
+
addThemes: (themes: UnistylesThemes) => {
|
36
|
+
addBreakpoints: any;
|
37
|
+
addConfig: any;
|
38
|
+
};
|
39
|
+
};
|
40
|
+
};
|
41
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
42
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
43
|
+
addThemes: (themes: UnistylesThemes) => {
|
44
|
+
addBreakpoints: any;
|
45
|
+
addConfig: any;
|
46
|
+
};
|
47
|
+
addConfig: any;
|
48
|
+
};
|
49
|
+
addThemes: (themes: UnistylesThemes) => {
|
50
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
51
|
+
addThemes: any;
|
52
|
+
addConfig: any;
|
53
|
+
};
|
54
|
+
addConfig: any;
|
55
|
+
};
|
56
|
+
};
|
11
57
|
};
|
12
|
-
declare const UnistylesRuntime: import("./core
|
58
|
+
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
13
59
|
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
14
|
-
export type { UnistylesThemes, UnistylesBreakpoints };
|
60
|
+
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin };
|
15
61
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
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
|
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,MAAM,SAAS,CAAA;AAC9C,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,mCAAoB,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,EACpB,eAAe,EAClB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizeWebStylesPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/normalizeWebStylesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizeStyle.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/normalizeStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoE,OAAO,EAAE,MAAM,aAAa,CAAA;AAuD5G,eAAO,MAAM,cAAc,oCAwB1B,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { TextShadow, Transforms, BoxShadow } from '
|
1
|
+
import type { TextShadow, Transforms, BoxShadow } from '../../types';
|
2
2
|
type Preprocessor = {
|
3
3
|
createTextShadowValue(style: TextShadow): string;
|
4
4
|
createBoxShadowValue(style: Required<BoxShadow>): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAY,MAAM,aAAa,CAAA;AAE9E,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"}
|
@@ -1,15 +1,28 @@
|
|
1
|
-
import type { OpaqueColorValue } from 'react-native';
|
2
|
-
import type {
|
3
|
-
import type {
|
4
|
-
type
|
5
|
-
type
|
6
|
-
[K in keyof T]:
|
7
|
-
};
|
8
|
-
type
|
9
|
-
[K in keyof T
|
10
|
-
} : {
|
11
|
-
[K in keyof T]: RemoveKeysWithPrefix<T[K]>;
|
1
|
+
import type { ColorValue, OpaqueColorValue } from 'react-native';
|
2
|
+
import type { UnistylesTheme } from '../types';
|
3
|
+
import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet';
|
4
|
+
import type { TransformStyles } from './core';
|
5
|
+
type ExtractTransformArray<T> = T extends object ? {
|
6
|
+
[K in keyof T]: ExtractBreakpoints<T[K]>;
|
7
|
+
} : never;
|
8
|
+
type ExtractBreakpoints<T> = T extends object ? keyof T extends BreakpointsOrMediaQueries ? T[keyof T] : T extends Array<ToDeepUnistyles<TransformStyles>> ? Array<ExtractTransformArray<T[number]>> : {
|
9
|
+
[K in keyof T]: ExtractBreakpoints<T[K]>;
|
12
10
|
} : T;
|
13
|
-
|
11
|
+
type ParseNestedObject<T> = T extends (...args: infer A) => infer R ? (...args: A) => ParseNestedObject<R> : T extends object ? T extends {
|
12
|
+
variants: infer R;
|
13
|
+
} ? ParseVariants<FlattenVariants<R>> & ParseNestedObject<Omit<T, 'variants'>> : {
|
14
|
+
[K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
|
15
|
+
} : T;
|
16
|
+
type FlattenVariants<T> = T extends object ? {
|
17
|
+
[K in keyof T]: T[K] extends object ? {
|
18
|
+
[key in keyof T[K]]: T[K][key] extends object ? ParseNestedObject<T[K][key]> : never;
|
19
|
+
} : never;
|
20
|
+
} : never;
|
21
|
+
type ParseVariants<T> = T extends object ? T[keyof T] extends object ? UnionToIntersection<ParseVariants<T[keyof T]>> : T : T;
|
22
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
23
|
+
type ParseStyleKeys<T> = T extends object ? {
|
24
|
+
[K in keyof T]: ParseNestedObject<T[K]>;
|
25
|
+
} : never;
|
26
|
+
export type ReactNativeStyleSheet<T> = T extends (theme: UnistylesTheme) => infer R ? ParseStyleKeys<R> : ParseStyleKeys<T>;
|
14
27
|
export {};
|
15
28
|
//# 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;
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC5C,KAAK,CAAA;AAEX,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACvC,MAAM,CAAC,SAAS,yBAAyB,GACrC,CAAC,CAAC,MAAM,CAAC,CAAC,GACV,CAAC,SAAS,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,GAC7C,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACvC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,GACP,CAAC,CAAA;AAEP,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE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AAS,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEvF,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACnC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC3C,KAAK,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC,GAC7E,cAAc,CAAC,CAAC,CAAC,GACjB,cAAc,CAAC,CAAC,CAAC,CAAA"}
|
@@ -1,39 +1,18 @@
|
|
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
3
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
4
|
-
|
5
|
-
type ShadowOffset = {
|
4
|
+
export type ShadowOffset = {
|
6
5
|
width: number;
|
7
6
|
height: number;
|
8
7
|
};
|
8
|
+
export type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
|
9
9
|
export type ScreenSize = {
|
10
10
|
width: number;
|
11
11
|
height: number;
|
12
12
|
};
|
13
|
-
type
|
14
|
-
type
|
15
|
-
|
16
|
-
|
17
|
-
transform?: Array<DeepUniStyle<TransformStyles>>;
|
18
|
-
};
|
19
|
-
type UniStyle<V> = {
|
20
|
-
[innerKey in keyof UnistylesBreakpoints]?: V;
|
21
|
-
} | {
|
22
|
-
[innerKey in MediaQuery]: V;
|
23
|
-
};
|
24
|
-
type DeepUniStyle<T> = {
|
25
|
-
[K in keyof T]?: UniStyle<T[K]> | T[K];
|
26
|
-
};
|
27
|
-
type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
28
|
-
type UnistyleView = DeepUniStyle<Omit<ViewStyle, NestedTypes>>;
|
29
|
-
type UnistyleText = DeepUniStyle<Omit<TextStyle, NestedTypes>>;
|
30
|
-
type UnistyleImage = DeepUniStyle<Omit<ImageStyle, NestedTypes>>;
|
31
|
-
export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & UnistyleNested;
|
32
|
-
export type CustomNamedStyles<T> = {
|
33
|
-
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
|
34
|
-
};
|
35
|
-
export type NestedKeys = Array<[keyof UnistylesBreakpoints | MediaQuery, string | number | undefined]>;
|
13
|
+
export type RNStyle = ViewStyle & TextStyle & ImageStyle;
|
14
|
+
export type RNValue = ViewStyle[keyof ViewStyle] | TextStyle[keyof TextStyle] | ImageStyle[keyof ImageStyle];
|
15
|
+
export type NestedStyle = Record<keyof UnistylesBreakpoints | symbol, RNValue>;
|
16
|
+
export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | symbol, RNValue]>;
|
36
17
|
export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
|
37
|
-
export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
|
38
|
-
export {};
|
39
18
|
//# 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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