react-native-unistyles 2.0.0-alpha.15 → 2.0.0-alpha.17
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/common.js +10 -9
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/core/UnistyleRegistry.js +17 -4
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/useStyles.js +1 -8
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/commonjs/utils/index.js +0 -30
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +37 -83
- package/lib/commonjs/utils/mq.js.map +1 -1
- package/lib/module/common.js +10 -9
- package/lib/module/common.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +17 -4
- package/lib/module/core/UnistyleRegistry.js.map +1 -1
- package/lib/module/useStyles.js +1 -8
- package/lib/module/useStyles.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +36 -82
- package/lib/module/utils/mq.js.map +1 -1
- package/lib/typescript/src/common.d.ts +10 -9
- package/lib/typescript/src/common.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +39 -3
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +48 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +10 -7
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +2 -3
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +0 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +3 -10
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/useStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +4 -9
- package/lib/typescript/src/utils/mq.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common.ts +10 -9
- package/src/core/UnistyleRegistry.ts +19 -4
- package/src/types/breakpoints.ts +17 -14
- package/src/types/core.ts +3 -4
- package/src/types/index.ts +0 -1
- package/src/types/stylesheet.ts +3 -10
- package/src/useStyles.ts +4 -14
- package/src/utils/index.ts +1 -1
- package/src/utils/mq.ts +20 -88
- package/lib/commonjs/types/mq.js +0 -6
- package/lib/commonjs/types/mq.js.map +0 -1
- package/lib/module/types/mq.js +0 -2
- package/lib/module/types/mq.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/src/types/mq.ts +0 -3
package/lib/commonjs/common.js
CHANGED
@@ -25,15 +25,16 @@ let UnistylesEventType = exports.UnistylesEventType = /*#__PURE__*/function (Uni
|
|
25
25
|
return UnistylesEventType;
|
26
26
|
}({});
|
27
27
|
let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
28
|
-
UnistylesError["RuntimeUnavailable"] = "Unistyles runtime is not available. Make sure you followed the installation instructions
|
29
|
-
UnistylesError["ThemeNotFound"] = "You are trying to get a theme that is not registered
|
30
|
-
UnistylesError["ThemeNotRegistered"] = "You are trying to set a theme that
|
31
|
-
UnistylesError["
|
32
|
-
UnistylesError["
|
33
|
-
UnistylesError["
|
34
|
-
UnistylesError["
|
35
|
-
UnistylesError["
|
36
|
-
UnistylesError["
|
28
|
+
UnistylesError["RuntimeUnavailable"] = "Unistyles runtime is not available. Make sure you followed the installation instructions";
|
29
|
+
UnistylesError["ThemeNotFound"] = "You are trying to get a theme that is not registered with UnistylesRegistry";
|
30
|
+
UnistylesError["ThemeNotRegistered"] = "You are trying to set a theme that was not registered with UnistylesRegistry";
|
31
|
+
UnistylesError["ThemeNotSelected"] = "Your themes are registered, but you didn't select the initial theme";
|
32
|
+
UnistylesError["ThemesCannotBeEmpty"] = "You are trying to register empty themes object";
|
33
|
+
UnistylesError["BreakpointsCannotBeEmpty"] = "You are trying to register empty breakpoints object";
|
34
|
+
UnistylesError["BreakpointsMustStartFromZero"] = "You are trying to register breakpoints that don't start from 0";
|
35
|
+
UnistylesError["InvalidPluginName"] = "Plugin name can't start from reserved prefix __unistyles";
|
36
|
+
UnistylesError["DuplicatePluginName"] = "You are trying to register a plugin with a name that is already registered";
|
37
|
+
UnistylesError["CantRemoveInternalPlugin"] = "You are trying to remove an internal unistyles plugin";
|
37
38
|
return UnistylesError;
|
38
39
|
}({});
|
39
40
|
//# sourceMappingURL=common.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","warn","message","console","exports","isMobile","Platform","OS","isWeb","isIOS","isAndroid","isServer","window","ScreenOrientation","Landscape","Portrait","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEM,MAAMI,QAAQ,GAAAD,OAAA,CAAAC,QAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAID,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnE,MAAMC,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGH,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMG,SAAS,GAAAN,OAAA,CAAAM,SAAA,GAAGJ,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMI,QAAQ,GAAAP,OAAA,CAAAO,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW;AAE9C,MAAMC,iBAAiB,GAAAT,OAAA,CAAAS,iBAAA,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAAA,IAEEC,kBAAkB,GAAAZ,OAAA,CAAAY,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAA,IAMlBC,cAAc,GAAAb,OAAA,CAAAa,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
1
|
+
{"version":3,"names":["_reactNative","require","warn","message","console","exports","isMobile","Platform","OS","isWeb","isIOS","isAndroid","isServer","window","ScreenOrientation","Landscape","Portrait","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEM,MAAMI,QAAQ,GAAAD,OAAA,CAAAC,QAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAID,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnE,MAAMC,KAAK,GAAAJ,OAAA,CAAAI,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGH,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMG,SAAS,GAAAN,OAAA,CAAAM,SAAA,GAAGJ,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMI,QAAQ,GAAAP,OAAA,CAAAO,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW;AAE9C,MAAMC,iBAAiB,GAAAT,OAAA,CAAAS,iBAAA,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAAA,IAEEC,kBAAkB,GAAAZ,OAAA,CAAAY,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAA,IAMlBC,cAAc,GAAAb,OAAA,CAAAa,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
@@ -21,13 +21,19 @@ class UnistyleRegistry {
|
|
21
21
|
const keys = Object.keys(themes);
|
22
22
|
this.unistylesBridge.themes = keys;
|
23
23
|
this.themeNames = keys;
|
24
|
-
return
|
24
|
+
return {
|
25
|
+
addBreakpoints: this.addBreakpoints,
|
26
|
+
addConfig: this.addConfig
|
27
|
+
};
|
25
28
|
};
|
26
29
|
addBreakpoints = breakpoints => {
|
27
30
|
this.breakpoints = breakpoints;
|
28
31
|
this.unistylesBridge.useBreakpoints(breakpoints);
|
29
32
|
this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs;
|
30
|
-
return
|
33
|
+
return {
|
34
|
+
addThemes: this.addThemes,
|
35
|
+
addConfig: this.addConfig
|
36
|
+
};
|
31
37
|
};
|
32
38
|
addConfig = config => {
|
33
39
|
this.config = config;
|
@@ -40,15 +46,22 @@ class UnistyleRegistry {
|
|
40
46
|
if (config.initialTheme) {
|
41
47
|
this.unistylesBridge.useTheme(config.initialTheme);
|
42
48
|
}
|
49
|
+
return {
|
50
|
+
addBreakpoints: this.addBreakpoints,
|
51
|
+
addThemes: this.addThemes
|
52
|
+
};
|
43
53
|
};
|
44
54
|
getTheme = forName => {
|
45
55
|
if (this.themeNames.length === 0) {
|
46
56
|
return {};
|
47
57
|
}
|
48
|
-
if (
|
58
|
+
if (this.hasTheme(forName)) {
|
59
|
+
return this.themes[forName];
|
60
|
+
}
|
61
|
+
if (this.unistylesBridge.themeName) {
|
49
62
|
throw new Error(_common.UnistylesError.ThemeNotFound);
|
50
63
|
}
|
51
|
-
|
64
|
+
throw new Error(_common.UnistylesError.ThemeNotSelected);
|
52
65
|
};
|
53
66
|
addPlugin = (() => {
|
54
67
|
var _this = this;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","
|
1
|
+
{"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","experimentalPlugins","forEach","plugin","addPlugin","initialTheme","useTheme","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","_this","notify","arguments","undefined","name","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","concat","removePlugin","CantRemoveInternalPlugin","filter","_ref2","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,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AAA;EAEMU,YAAY,GAAIxB,MAAuB,IAAK;IAC/C,IAAIA,MAAM,CAACiB,IAAI,CAACC,UAAU,CAAC,aAAa,CAAC,EAAE;MACvC,MAAM,IAAIT,KAAK,CAACC,sBAAc,CAACe,wBAAwB,CAAC;IAC5D;IAEA,IAAI,CAAC5C,OAAO,GAAG,IAAI,CAACA,OAAO,CAAC6C,MAAM,CAACC,KAAA;MAAA,IAAC;QAAEV;MAAK,CAAC,GAAAU,KAAA;MAAA,OAAKV,IAAI,KAAKjB,MAAM,CAACiB,IAAI;IAAA,EAAC;IACtE,IAAI,CAAC5B,eAAe,CAACmC,YAAY,CAACxB,MAAM,CAACiB,IAAI,CAAC;EAClD,CAAC;EAEMV,QAAQ,GAAIU,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChC,MAAM;AAC1E;AAAC2C,OAAA,CAAAjD,gBAAA,GAAAA,gBAAA"}
|
@@ -15,16 +15,9 @@ const useStyles = (stylesheet, variantsMap) => {
|
|
15
15
|
layout,
|
16
16
|
plugins
|
17
17
|
} = (0, _hooks.useUnistyles)();
|
18
|
-
if (!stylesheet) {
|
19
|
-
return {
|
20
|
-
theme,
|
21
|
-
breakpoint: layout.breakpoint,
|
22
|
-
styles: {}
|
23
|
-
};
|
24
|
-
}
|
25
18
|
const variants = (0, _hooks.useVariants)(variantsMap);
|
26
19
|
const parsedStyles = (0, _react.useMemo)(() => typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet, [theme, stylesheet, layout]);
|
27
|
-
const dynamicStyleSheet = (0, _react.useMemo)(() => Object.entries(parsedStyles).reduce((acc, _ref) => {
|
20
|
+
const dynamicStyleSheet = (0, _react.useMemo)(() => Object.entries(parsedStyles || {}).reduce((acc, _ref) => {
|
28
21
|
let [key, value] = _ref;
|
29
22
|
if (typeof value === 'function') {
|
30
23
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_utils","_hooks","_core","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_utils","_hooks","_core","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","variants","useVariants","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","proxifyFunction","unistyles","registry","runtime","StyleSheet","create","parseStyle","breakpoint","styles","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAcO,MAAMK,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACN,WAAW,CAAC;EACzC,MAAMO,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOT,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMO,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,IAAI,OAAOE,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAG,IAAAE,sBAAe,EAACF,GAAG,EAAEC,KAAK,EAACE,eAAS,CAACC,QAAQ,CAAChB,OAAO,EAAEe,eAAS,CAACE,OAAO,EAAEf,QAAQ;MAC7F,CAAC;IACL;IAEA,OAAOgB,uBAAU,CAACC,MAAM,CAAC;MACrB,GAAGT,GAAG;MACN,CAACE,GAAG,GAAG,IAAAQ,iBAAU,EACbR,GAAG,EACHC,KAAK,EACLE,eAAS,CAACC,QAAQ,CAAChB,OAAO,EAC1Be,eAAS,CAACE,OAAO,EACjBf,QACJ;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACH,MAAM,EAAEK,YAAY,EAAEF,QAAQ,EAAEF,OAAO,CACpD,CAAC;EAED,OAAO;IACHF,KAAK;IACLuB,UAAU,EAAEtB,MAAM,CAACsB,UAAU;IAC7BC,MAAM,EAAEhB;EACZ,CAAC;AACL,CAAC;AAAAiB,OAAA,CAAA5B,SAAA,GAAAA,SAAA"}
|
@@ -3,36 +3,6 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
Object.defineProperty(exports, "MQHeight", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _mq.MQHeight;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "MQHeightAndWidth", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () {
|
15
|
-
return _mq.MQHeightAndWidth;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
Object.defineProperty(exports, "MQSymbol", {
|
19
|
-
enumerable: true,
|
20
|
-
get: function () {
|
21
|
-
return _mq.MQSymbol;
|
22
|
-
}
|
23
|
-
});
|
24
|
-
Object.defineProperty(exports, "MQWidth", {
|
25
|
-
enumerable: true,
|
26
|
-
get: function () {
|
27
|
-
return _mq.MQWidth;
|
28
|
-
}
|
29
|
-
});
|
30
|
-
Object.defineProperty(exports, "MQWidthAndHeight", {
|
31
|
-
enumerable: true,
|
32
|
-
get: function () {
|
33
|
-
return _mq.MQWidthAndHeight;
|
34
|
-
}
|
35
|
-
});
|
36
6
|
Object.defineProperty(exports, "getKeyForUnistylesMediaQuery", {
|
37
7
|
enumerable: true,
|
38
8
|
get: function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_mq","require","_mqParser","_breakpoints","_styles"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_mq","require","_mqParser","_breakpoints","_styles"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA"}
|
package/lib/commonjs/utils/mq.js
CHANGED
@@ -3,21 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.mq =
|
6
|
+
exports.mq = void 0;
|
7
7
|
var _core = require("../core");
|
8
|
-
const MQSymbol = exports.MQSymbol = Symbol('unistyles-mq');
|
9
|
-
const MQWidth = exports.MQWidth = Symbol('unistyles-mq-width');
|
10
|
-
const MQHeight = exports.MQHeight = Symbol('unistyles-mq-height');
|
11
|
-
const MQWidthAndHeight = exports.MQWidthAndHeight = Symbol('unistyles-mq-width-and-height');
|
12
|
-
const MQHeightAndWidth = exports.MQHeightAndWidth = Symbol('unistyles-mq-height-and-width');
|
13
|
-
var MQProp = /*#__PURE__*/function (MQProp) {
|
14
|
-
MQProp["toString"] = "toString";
|
15
|
-
MQProp["width"] = "width";
|
16
|
-
MQProp["height"] = "height";
|
17
|
-
MQProp["only"] = "only";
|
18
|
-
MQProp["and"] = "and";
|
19
|
-
return MQProp;
|
20
|
-
}(MQProp || {});
|
21
8
|
const getMQValue = value => {
|
22
9
|
if (typeof value === 'number') {
|
23
10
|
return value;
|
@@ -27,77 +14,44 @@ const getMQValue = value => {
|
|
27
14
|
}
|
28
15
|
return _core.unistyles.registry.breakpoints[value] ?? 0;
|
29
16
|
};
|
30
|
-
const
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
42
|
-
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
43
|
-
return new Proxy({}, {
|
44
|
-
get: (target, prop, receiver) => {
|
45
|
-
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
46
|
-
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
47
|
-
}
|
48
|
-
return Reflect.get(target, prop, receiver);
|
49
|
-
}
|
50
|
-
});
|
51
|
-
}
|
52
|
-
};
|
53
|
-
}
|
54
|
-
return Reflect.get(target, prop, receiver);
|
17
|
+
const mq = exports.mq = {
|
18
|
+
only: {
|
19
|
+
width: function () {
|
20
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
21
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
22
|
+
return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
|
23
|
+
},
|
24
|
+
height: function () {
|
25
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
26
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
27
|
+
return `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
55
28
|
}
|
56
|
-
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
29
|
+
},
|
30
|
+
width: function () {
|
31
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
32
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
33
|
+
return {
|
34
|
+
and: {
|
35
|
+
height: function () {
|
36
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
37
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
38
|
+
return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
39
|
+
}
|
65
40
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
});
|
79
|
-
}
|
80
|
-
};
|
41
|
+
};
|
42
|
+
},
|
43
|
+
height: function () {
|
44
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
45
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
46
|
+
return {
|
47
|
+
and: {
|
48
|
+
width: function () {
|
49
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
50
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
51
|
+
return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
52
|
+
}
|
81
53
|
}
|
82
|
-
|
83
|
-
}
|
84
|
-
});
|
85
|
-
};
|
86
|
-
const mq = exports.mq = new Proxy({}, {
|
87
|
-
get: (target, prop, receiver) => {
|
88
|
-
if (prop === MQProp.only) {
|
89
|
-
return {
|
90
|
-
width: heightHandler,
|
91
|
-
height: widthHandler
|
92
|
-
};
|
93
|
-
}
|
94
|
-
if (prop === MQProp.height) {
|
95
|
-
return widthHandler;
|
96
|
-
}
|
97
|
-
if (prop === MQProp.width) {
|
98
|
-
return heightHandler;
|
99
|
-
}
|
100
|
-
return Reflect.get(target, prop, receiver);
|
54
|
+
};
|
101
55
|
}
|
102
|
-
}
|
56
|
+
};
|
103
57
|
//# sourceMappingURL=mq.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_core","require","
|
1
|
+
{"version":3,"names":["_core","require","getMQValue","value","unistyles","registry","breakpoints","mq","exports","only","width","wMin","arguments","length","undefined","wMax","Infinity","height","hMin","hMax","and"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAqBA,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,CAAC;EACZ;EAEA,OAAOC,eAAS,CAACC,QAAQ,CAACC,WAAW,CAACH,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;AAEM,MAAMI,EAAa,GAAAC,OAAA,CAAAD,EAAA,GAAG;EACzBE,IAAI,EAAE;IACFC,KAAK,EAAE,SAAAA,CAAA;MAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;MAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;MAAA,OAAO,MAAKd,UAAU,CAACS,IAAI,CAAE,KAAIT,UAAU,CAACa,IAAI,CAAE,GAAE;IAAA,CAAsB;IACvIE,MAAM,EAAE,SAAAA,CAAA;MAAA,IAACC,IAAuB,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;MAAA,IAAEO,IAAa,GAAAP,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;MAAA,OAAO,M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AA,MAAGI,QAAQ;UAAA,OACvD,MAAKd,UAAU,CAACS,IAAI,CAAE,KAAIT,UAAU,CAACa,IAAI,CAAE,OAAMb,UAAU,CAACgB,IAAI,CAAE,KAAIhB,UAAU,CAACiB,IAAI,CAAE,GAAE;QAAA;MACnG;IACJ,CAAC;EAAA;AACL,CAAC"}
|
package/lib/module/common.js
CHANGED
@@ -18,15 +18,16 @@ export let UnistylesEventType = /*#__PURE__*/function (UnistylesEventType) {
|
|
18
18
|
return UnistylesEventType;
|
19
19
|
}({});
|
20
20
|
export let UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
21
|
-
UnistylesError["RuntimeUnavailable"] = "Unistyles runtime is not available. Make sure you followed the installation instructions
|
22
|
-
UnistylesError["ThemeNotFound"] = "You are trying to get a theme that is not registered
|
23
|
-
UnistylesError["ThemeNotRegistered"] = "You are trying to set a theme that
|
24
|
-
UnistylesError["
|
25
|
-
UnistylesError["
|
26
|
-
UnistylesError["
|
27
|
-
UnistylesError["
|
28
|
-
UnistylesError["
|
29
|
-
UnistylesError["
|
21
|
+
UnistylesError["RuntimeUnavailable"] = "Unistyles runtime is not available. Make sure you followed the installation instructions";
|
22
|
+
UnistylesError["ThemeNotFound"] = "You are trying to get a theme that is not registered with UnistylesRegistry";
|
23
|
+
UnistylesError["ThemeNotRegistered"] = "You are trying to set a theme that was not registered with UnistylesRegistry";
|
24
|
+
UnistylesError["ThemeNotSelected"] = "Your themes are registered, but you didn't select the initial theme";
|
25
|
+
UnistylesError["ThemesCannotBeEmpty"] = "You are trying to register empty themes object";
|
26
|
+
UnistylesError["BreakpointsCannotBeEmpty"] = "You are trying to register empty breakpoints object";
|
27
|
+
UnistylesError["BreakpointsMustStartFromZero"] = "You are trying to register breakpoints that don't start from 0";
|
28
|
+
UnistylesError["InvalidPluginName"] = "Plugin name can't start from reserved prefix __unistyles";
|
29
|
+
UnistylesError["DuplicatePluginName"] = "You are trying to register a plugin with a name that is already registered";
|
30
|
+
UnistylesError["CantRemoveInternalPlugin"] = "You are trying to remove an internal unistyles plugin";
|
30
31
|
return UnistylesError;
|
31
32
|
}({});
|
32
33
|
//# sourceMappingURL=common.js.map
|
package/lib/module/common.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Platform","warn","message","console","isMobile","OS","isWeb","isIOS","isAndroid","isServer","window","ScreenOrientation","Landscape","Portrait","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAME,QAAQ,GAAGJ,QAAQ,CAACK,EAAE,KAAK,SAAS,IAAIL,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1E,OAAO,MAAMC,KAAK,GAAGN,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,KAAK,GAAGP,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMG,SAAS,GAAGR,QAAQ,CAACK,EAAE,KAAK,SAAS;AAClD,OAAO,MAAMI,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,iBAAiB,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAEV,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAM9B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
1
|
+
{"version":3,"names":["Platform","warn","message","console","isMobile","OS","isWeb","isIOS","isAndroid","isServer","window","ScreenOrientation","Landscape","Portrait","UnistylesEventType","UnistylesError"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,IAAI,GAAIC,OAAe,IAAK;EACrCC,OAAO,CAACF,IAAI,CAAE,gCAA+BC,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAME,QAAQ,GAAGJ,QAAQ,CAACK,EAAE,KAAK,SAAS,IAAIL,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1E,OAAO,MAAMC,KAAK,GAAGN,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,KAAK,GAAGP,QAAQ,CAACK,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMG,SAAS,GAAGR,QAAQ,CAACK,EAAE,KAAK,SAAS;AAClD,OAAO,MAAMI,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,iBAAiB,GAAG;EAC7BC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU;AAEV,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAM9B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
@@ -15,13 +15,19 @@ export class UnistyleRegistry {
|
|
15
15
|
const keys = Object.keys(themes);
|
16
16
|
this.unistylesBridge.themes = keys;
|
17
17
|
this.themeNames = keys;
|
18
|
-
return
|
18
|
+
return {
|
19
|
+
addBreakpoints: this.addBreakpoints,
|
20
|
+
addConfig: this.addConfig
|
21
|
+
};
|
19
22
|
};
|
20
23
|
addBreakpoints = breakpoints => {
|
21
24
|
this.breakpoints = breakpoints;
|
22
25
|
this.unistylesBridge.useBreakpoints(breakpoints);
|
23
26
|
this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs;
|
24
|
-
return
|
27
|
+
return {
|
28
|
+
addThemes: this.addThemes,
|
29
|
+
addConfig: this.addConfig
|
30
|
+
};
|
25
31
|
};
|
26
32
|
addConfig = config => {
|
27
33
|
this.config = config;
|
@@ -34,15 +40,22 @@ export class UnistyleRegistry {
|
|
34
40
|
if (config.initialTheme) {
|
35
41
|
this.unistylesBridge.useTheme(config.initialTheme);
|
36
42
|
}
|
43
|
+
return {
|
44
|
+
addBreakpoints: this.addBreakpoints,
|
45
|
+
addThemes: this.addThemes
|
46
|
+
};
|
37
47
|
};
|
38
48
|
getTheme = forName => {
|
39
49
|
if (this.themeNames.length === 0) {
|
40
50
|
return {};
|
41
51
|
}
|
42
|
-
if (
|
52
|
+
if (this.hasTheme(forName)) {
|
53
|
+
return this.themes[forName];
|
54
|
+
}
|
55
|
+
if (this.unistylesBridge.themeName) {
|
43
56
|
throw new Error(UnistylesError.ThemeNotFound);
|
44
57
|
}
|
45
|
-
|
58
|
+
throw new Error(UnistylesError.ThemeNotSelected);
|
46
59
|
};
|
47
60
|
addPlugin = (() => {
|
48
61
|
var _this = this;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isWeb","UnistylesError","normalizeWebStylesPlugin","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","
|
1
|
+
{"version":3,"names":["isWeb","UnistylesError","normalizeWebStylesPlugin","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","experimentalPlugins","forEach","plugin","addPlugin","initialTheme","useTheme","getTheme","forName","length","hasTheme","themeName","Error","ThemeNotFound","ThemeNotSelected","_this","notify","arguments","undefined","name","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","concat","removePlugin","CantRemoveInternalPlugin","filter","_ref2"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":"AAEA,SAASA,KAAK,EAAEC,cAAc,QAAQ,WAAW;AACjD,SAASC,wBAAwB,QAAQ,YAAY;AAErD,OAAO,MAAMC,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BL,KAAK,GACxC,CAACE,wBAAwB,CAAC,GAC1B,EAAE;EACDI,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe,CAACM,cAAc,CAACT,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO;MACHG,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBI,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMA,S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AAM,IAAIR,KAAK,CAAC9B,cAAc,CAACuC,iBAAiB,CAAC;MACrD;MAEA,IAAIN,KAAI,CAAC7B,OAAO,CAACoC,IAAI,CAACC,IAAA;QAAA,IAAC;UAAEJ;QAAK,CAAC,GAAAI,IAAA;QAAA,OAAKJ,IAAI,KAAKhB,MAAM,CAACgB,IAAI;MAAA,EAAC,EAAE;QACvD,MAAM,IAAIP,KAAK,CAAC9B,cAAc,CAAC0C,mBAAmB,CAAC;MACvD;MAEAT,KAAI,CAAC7B,OAAO,GAAG,CAACiB,MAAM,CAAC,CAACsB,MAAM,CAACV,KAAI,CAAC7B,OAAO,CAAC;MAC5C6B,KAAI,CAACvB,eAAe,CAACY,SAAS,CAACD,MAAM,CAACgB,IAAI,EAAEH,MAAM,CAAC;IACvD,CAAC;EAAA;EAEMU,YAAY,GAAIvB,MAAuB,IAAK;IAC/C,IAAIA,MAAM,CAACgB,IAAI,CAACC,UAAU,CAAC,aAAa,CAAC,EAAE;MACvC,MAAM,IAAIR,KAAK,CAAC9B,cAAc,CAAC6C,wBAAwB,CAAC;IAC5D;IAEA,IAAI,CAACzC,OAAO,GAAG,IAAI,CAACA,OAAO,CAAC0C,MAAM,CAACC,KAAA;MAAA,IAAC;QAAEV;MAAK,CAAC,GAAAU,KAAA;MAAA,OAAKV,IAAI,KAAKhB,MAAM,CAACgB,IAAI;IAAA,EAAC;IACtE,IAAI,CAAC3B,eAAe,CAACkC,YAAY,CAACvB,MAAM,CAACgB,IAAI,CAAC;EAClD,CAAC;EAEMT,QAAQ,GAAIS,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAC/B,MAAM;AAC1E"}
|
package/lib/module/useStyles.js
CHANGED
@@ -9,16 +9,9 @@ export const useStyles = (stylesheet, variantsMap) => {
|
|
9
9
|
layout,
|
10
10
|
plugins
|
11
11
|
} = useUnistyles();
|
12
|
-
if (!stylesheet) {
|
13
|
-
return {
|
14
|
-
theme,
|
15
|
-
breakpoint: layout.breakpoint,
|
16
|
-
styles: {}
|
17
|
-
};
|
18
|
-
}
|
19
12
|
const variants = useVariants(variantsMap);
|
20
13
|
const parsedStyles = useMemo(() => typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet, [theme, stylesheet, layout]);
|
21
|
-
const dynamicStyleSheet = useMemo(() => Object.entries(parsedStyles).reduce((acc, _ref) => {
|
14
|
+
const dynamicStyleSheet = useMemo(() => Object.entries(parsedStyles || {}).reduce((acc, _ref) => {
|
22
15
|
let [key, value] = _ref;
|
23
16
|
if (typeof value === 'function') {
|
24
17
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useVariants","unistyles","useStyles","stylesheet","variantsMap","theme","layout","plugins","
|
1
|
+
{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useVariants","unistyles","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","registry","runtime","create","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AACrD,SAASC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAEnD,SAASC,SAAS,QAAQ,QAAQ;AAclC,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGR,YAAY,CAAC,CAAC;EACjD,MAAMS,QAAQ,GAAGR,WAAW,CAACI,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGd,OAAO,CAAC,MAAM,OAAOQ,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMI,iBAAiB,GAAGf,OAAO,CAAC,MAAMgB,MAAM,CACzCC,OAAO,CAACH,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,IAAI,OAAOE,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGlB,eAAe,CAACkB,GAAG,EAAEC,KAAK,EAAChB,SAAS,CAACiB,QAAQ,CAACX,OAAO,EAAEN,SAAS,CAACkB,OAAO,EAAEX,QAAQ;MAC7F,CAAC;IACL;IAEA,OAAOZ,UAAU,CAACwB,MAAM,CAAC;MACrB,GAAGN,GAAG;MACN,CAACE,GAAG,GAAGnB,UAAU,CACbmB,GAAG,EACHC,KAAK,EACLhB,SAAS,CAACiB,QAAQ,CAACX,OAAO,EAC1BN,SAAS,CAACkB,OAAO,EACjBX,QACJ;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACF,MAAM,EAAEG,YAAY,EAAED,QAAQ,EAAED,OAAO,CACpD,CAAC;EAED,OAAO;IACHF,KAAK;IACLgB,UAAU,EAAEf,MAAM,CAACe,UAAU;IAC7BC,MAAM,EAAEZ;EACZ,CAAC;AACL,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { mq
|
1
|
+
export { mq } from './mq';
|
2
2
|
export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq } from './mqParser';
|
3
3
|
export { getValueForBreakpoint } from './breakpoints';
|
4
4
|
export { proxifyFunction, parseStyle } from './styles';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mq","
|
1
|
+
{"version":3,"names":["mq","getKeyForUnistylesMediaQuery","isWithinTheWidthAndHeight","isValidMq","parseMq","getValueForBreakpoint","proxifyFunction","parseStyle"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,EAAE,QAAQ,MAAM;AACzB,SAASC,4BAA4B,EAAEC,yBAAyB,EAAEC,SAAS,EAAEC,OAAO,QAAQ,YAAY;AACxG,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU"}
|