react-native-unistyles 3.0.0-alpha.7 → 3.0.0-alpha.9
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Helpers.h +58 -0
- package/cxx/core/Unistyle.h +0 -6
- package/cxx/core/UnistyleData.h +3 -2
- package/cxx/core/UnistyleWrapper.h +6 -6
- package/cxx/core/UnistylesRegistry.cpp +11 -10
- package/cxx/core/UnistylesRegistry.h +4 -3
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +4 -2
- package/cxx/parser/Parser.cpp +24 -78
- package/cxx/parser/Parser.h +1 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +77 -0
- package/lib/commonjs/web/convert/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/breakpoint.js +25 -0
- package/lib/commonjs/web/convert/breakpoint.js.map +1 -0
- package/lib/commonjs/web/convert/index.js +76 -0
- package/lib/commonjs/web/convert/index.js.map +1 -0
- package/lib/commonjs/web/convert/module.d.js +2 -0
- package/lib/commonjs/web/convert/module.d.js.map +1 -0
- package/lib/commonjs/web/convert/shadow.js +68 -0
- package/lib/commonjs/web/convert/shadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +89 -0
- package/lib/commonjs/web/convert/style.js.map +1 -0
- package/lib/commonjs/web/convert/textShadow.js +73 -0
- package/lib/commonjs/web/convert/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/transform.js +72 -0
- package/lib/commonjs/web/convert/transform.js.map +1 -0
- package/lib/commonjs/web/convert/types.js +9 -0
- package/lib/commonjs/web/convert/types.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +55 -0
- package/lib/commonjs/web/convert/utils.js.map +1 -0
- package/lib/commonjs/web/create.js +89 -0
- package/lib/commonjs/web/create.js.map +1 -0
- package/lib/commonjs/web/index.js +51 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/listener/index.js +13 -0
- package/lib/commonjs/web/listener/index.js.map +1 -0
- package/lib/commonjs/web/listener/listener.js +36 -0
- package/lib/commonjs/web/listener/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +37 -0
- package/lib/commonjs/web/mock.js.map +1 -0
- package/lib/commonjs/web/mq.js +23 -0
- package/lib/commonjs/web/mq.js.map +1 -0
- package/lib/commonjs/web/pseudo.js +11 -0
- package/lib/commonjs/web/pseudo.js.map +1 -0
- package/lib/commonjs/web/registry.js +37 -0
- package/lib/commonjs/web/registry.js.map +1 -0
- package/lib/commonjs/web/runtime.js +164 -0
- package/lib/commonjs/web/runtime.js.map +1 -0
- package/lib/commonjs/web/state.js +121 -0
- package/lib/commonjs/web/state.js.map +1 -0
- package/lib/commonjs/web/utils.js +78 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web/variants/getVariants.js +39 -0
- package/lib/commonjs/web/variants/getVariants.js.map +1 -0
- package/lib/commonjs/web/variants/index.js +28 -0
- package/lib/commonjs/web/variants/index.js.map +1 -0
- package/lib/commonjs/web/variants/useVariants.js +75 -0
- package/lib/commonjs/web/variants/useVariants.js.map +1 -0
- package/lib/module/specs/ShadowRegistry/index.js +2 -2
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/index.web.js +1 -1
- package/lib/module/specs/index.web.js.map +1 -1
- package/lib/module/web/convert/boxShadow.js +72 -0
- package/lib/module/web/convert/boxShadow.js.map +1 -0
- package/lib/module/web/convert/breakpoint.js +20 -0
- package/lib/module/web/convert/breakpoint.js.map +1 -0
- package/lib/module/web/convert/index.js +71 -0
- package/lib/module/web/convert/index.js.map +1 -0
- package/lib/module/web/convert/module.d.js +2 -0
- package/lib/module/web/convert/module.d.js.map +1 -0
- package/lib/module/web/convert/shadow.js +63 -0
- package/lib/module/web/convert/shadow.js.map +1 -0
- package/lib/module/web/convert/style.js +84 -0
- package/lib/module/web/convert/style.js.map +1 -0
- package/lib/module/web/convert/textShadow.js +68 -0
- package/lib/module/web/convert/textShadow.js.map +1 -0
- package/lib/module/web/convert/transform.js +67 -0
- package/lib/module/web/convert/transform.js.map +1 -0
- package/lib/module/web/convert/types.js +5 -0
- package/lib/module/web/convert/types.js.map +1 -0
- package/lib/module/web/convert/utils.js +43 -0
- package/lib/module/web/convert/utils.js.map +1 -0
- package/lib/module/web/create.js +84 -0
- package/lib/module/web/create.js.map +1 -0
- package/lib/module/web/index.js +24 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/listener/index.js +4 -0
- package/lib/module/web/listener/index.js.map +1 -0
- package/lib/module/web/listener/listener.js +31 -0
- package/lib/module/web/listener/listener.js.map +1 -0
- package/lib/module/web/mock.js +33 -0
- package/lib/module/web/mock.js.map +1 -0
- package/lib/module/web/mq.js +17 -0
- package/lib/module/web/mq.js.map +1 -0
- package/lib/module/web/pseudo.js +6 -0
- package/lib/module/web/pseudo.js.map +1 -0
- package/lib/module/web/registry.js +33 -0
- package/lib/module/web/registry.js.map +1 -0
- package/lib/module/web/runtime.js +160 -0
- package/lib/module/web/runtime.js.map +1 -0
- package/lib/module/web/state.js +117 -0
- package/lib/module/web/state.js.map +1 -0
- package/lib/module/web/utils.js +65 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/module/web/variants/getVariants.js +34 -0
- package/lib/module/web/variants/getVariants.js.map +1 -0
- package/lib/module/web/variants/index.js +5 -0
- package/lib/module/web/variants/index.js.map +1 -0
- package/lib/module/web/variants/useVariants.js +70 -0
- package/lib/module/web/variants/useVariants.js.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +1 -1
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/index.d.ts +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/create.d.ts +11 -11
- package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
- package/lib/typescript/{web → src/web}/index.d.ts +12 -12
- package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener/index.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/listener/listener.d.ts +1 -1
- package/lib/typescript/src/web/listener/listener.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/mock.d.ts +2 -2
- package/lib/typescript/src/web/mock.d.ts.map +1 -0
- package/lib/typescript/src/web/mq.d.ts.map +1 -0
- package/lib/typescript/src/web/pseudo.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/registry.d.ts +1 -1
- package/lib/typescript/src/web/registry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/runtime.d.ts +6 -6
- package/lib/typescript/src/web/runtime.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/state.d.ts +4 -4
- package/lib/typescript/src/web/state.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/utils.d.ts +5 -3
- package/lib/typescript/src/web/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/index.d.ts +3 -0
- package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
- package/package.json +1 -1
- package/plugin/__tests__/dependencies.spec.js +5 -5
- package/plugin/__tests__/ref.spec.js +132 -17
- package/plugin/__tests__/stylesheet.spec.js +9 -9
- package/plugin/index.js +12 -13
- package/plugin/ref.js +18 -14
- package/plugin/style.js +13 -7
- package/src/specs/ShadowRegistry/index.ts +4 -4
- package/src/specs/index.web.ts +1 -1
- package/src/types/stylesheet.ts +1 -1
- package/{web → src/web}/convert/breakpoint.ts +1 -1
- package/{web → src/web}/convert/index.ts +1 -1
- package/{web → src/web}/convert/types.ts +1 -1
- package/{web → src/web}/create.ts +36 -33
- package/{web → src/web}/listener/listener.ts +1 -1
- package/{web → src/web}/mock.ts +2 -2
- package/{web → src/web}/registry.ts +1 -1
- package/{web → src/web}/runtime.ts +4 -4
- package/{web → src/web}/state.ts +5 -5
- package/{web → src/web}/utils.ts +5 -5
- package/src/web/variants/getVariants.ts +42 -0
- package/src/web/variants/index.ts +2 -0
- package/{web → src/web/variants}/useVariants.ts +24 -44
- package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/web/convert/index.d.ts.map +0 -1
- package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/style.d.ts.map +0 -1
- package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/transform.d.ts.map +0 -1
- package/lib/typescript/web/convert/types.d.ts.map +0 -1
- package/lib/typescript/web/convert/utils.d.ts.map +0 -1
- package/lib/typescript/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/web/mock.d.ts.map +0 -1
- package/lib/typescript/web/mq.d.ts.map +0 -1
- package/lib/typescript/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/web/registry.d.ts.map +0 -1
- package/lib/typescript/web/runtime.d.ts.map +0 -1
- package/lib/typescript/web/state.d.ts.map +0 -1
- package/lib/typescript/web/useVariants.d.ts +0 -3
- package/lib/typescript/web/useVariants.d.ts.map +0 -1
- package/lib/typescript/web/utils.d.ts.map +0 -1
- /package/lib/typescript/{web → src/web}/convert/boxShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/breakpoint.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/shadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/style.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/textShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/transform.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/utils.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/listener/index.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/mq.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/pseudo.d.ts +0 -0
- /package/{web → src/web}/convert/boxShadow.ts +0 -0
- /package/{web → src/web}/convert/module.d.ts +0 -0
- /package/{web → src/web}/convert/shadow.ts +0 -0
- /package/{web → src/web}/convert/style.ts +0 -0
- /package/{web → src/web}/convert/textShadow.ts +0 -0
- /package/{web → src/web}/convert/transform.ts +0 -0
- /package/{web → src/web}/convert/utils.ts +0 -0
- /package/{web → src/web}/index.ts +0 -0
- /package/{web → src/web}/listener/index.ts +0 -0
- /package/{web → src/web}/mq.ts +0 -0
- /package/{web → src/web}/pseudo.ts +0 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.convertToTypeStyle = void 0;
|
7
|
+
var _typestyle = require("typestyle");
|
8
|
+
var _pseudo = require("../pseudo");
|
9
|
+
var _breakpoint = require("./breakpoint");
|
10
|
+
var _style = require("./style");
|
11
|
+
var _utils = require("../utils");
|
12
|
+
var _transform = require("./transform");
|
13
|
+
var _utils2 = require("./utils");
|
14
|
+
var _textShadow = require("./textShadow");
|
15
|
+
var _boxShadow = require("./boxShadow");
|
16
|
+
const convertToTypeStyle = value => {
|
17
|
+
// Flag to mark if textShadow is already created
|
18
|
+
let hasTextShadow = false;
|
19
|
+
// Flag to mark if boxShadow is already created
|
20
|
+
let hasBoxShadow = false;
|
21
|
+
const stylesArray = Object.entries({
|
22
|
+
...value,
|
23
|
+
...value._web
|
24
|
+
}).flatMap(([unistylesKey, unistylesValue]) => {
|
25
|
+
// Keys to omit
|
26
|
+
if (['_css', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey)) {
|
27
|
+
return [];
|
28
|
+
}
|
29
|
+
|
30
|
+
// Pseudo classes :hover, :before etc.
|
31
|
+
if ((0, _pseudo.isPseudo)(unistylesKey)) {
|
32
|
+
const typestyleValues = convertToTypeStyle(unistylesValue);
|
33
|
+
return {
|
34
|
+
$nest: {
|
35
|
+
[unistylesKey.replace('_', '&:')]: typestyleValues
|
36
|
+
}
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
// Text shadow
|
41
|
+
if ((0, _utils2.isTextShadow)(unistylesKey)) {
|
42
|
+
if (hasTextShadow) {
|
43
|
+
return [];
|
44
|
+
}
|
45
|
+
hasTextShadow = true;
|
46
|
+
return (0, _textShadow.getTextShadowStyle)(value);
|
47
|
+
}
|
48
|
+
|
49
|
+
// Box shadow
|
50
|
+
if ((0, _utils2.isBoxShadow)(unistylesKey)) {
|
51
|
+
if (hasBoxShadow) {
|
52
|
+
return [];
|
53
|
+
}
|
54
|
+
hasBoxShadow = true;
|
55
|
+
return (0, _boxShadow.getBoxShadowStyle)(value);
|
56
|
+
}
|
57
|
+
|
58
|
+
// Transforms
|
59
|
+
if ((0, _utils2.isTransform)(unistylesKey, unistylesValue)) {
|
60
|
+
return (0, _transform.getTransformStyle)(unistylesValue);
|
61
|
+
}
|
62
|
+
|
63
|
+
// Breakpoints
|
64
|
+
if (typeof unistylesValue === 'object' && unistylesValue !== null) {
|
65
|
+
return Object.entries(unistylesValue).map(([breakpointKey, breakpointValue]) => {
|
66
|
+
return (0, _typestyle.media)((0, _breakpoint.convertBreakpoint)(breakpointKey), (0, _style.getStyle)(unistylesKey, breakpointValue));
|
67
|
+
});
|
68
|
+
}
|
69
|
+
|
70
|
+
// Regular styles
|
71
|
+
return (0, _style.getStyle)(unistylesKey, unistylesValue);
|
72
|
+
});
|
73
|
+
return (0, _utils.deepMergeObjects)(...stylesArray);
|
74
|
+
};
|
75
|
+
exports.convertToTypeStyle = convertToTypeStyle;
|
76
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_typestyle","require","_pseudo","_breakpoint","_style","_utils","_transform","_utils2","_textShadow","_boxShadow","convertToTypeStyle","value","hasTextShadow","hasBoxShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","isPseudo","typestyleValues","$nest","replace","isTextShadow","getTextShadowStyle","isBoxShadow","getBoxShadowStyle","isTransform","getTransformStyle","map","breakpointKey","breakpointValue","media","convertBreakpoint","getStyle","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAEO,MAAMS,kBAAkB,GAAIC,KAAsB,IAAK;EAC1D;EACA,IAAIC,aAAa,GAAG,KAAK;EACzB;EACA,IAAIC,YAAY,GAAG,KAAK;EAExB,MAAMC,WAAW,GAAGC,MAAM,CAACC,OAAO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AAC,6BAAiB,EAACH,aAAa,CAAC,EAAE,IAAAI,eAAQ,EAAClB,YAAY,EAAEe,eAAe,CAAC,CAAC;MAC3F,CAAC,CAAC;IACN;;IAEA;IACA,OAAO,IAAAG,eAAQ,EAAClB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAO,IAAAkB,uBAAgB,EAAC,GAAGxB,WAAW,CAAC;AAC3C,CAAC;AAAAyB,OAAA,CAAA7B,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["web/convert/module.d.ts"],"mappings":"","ignoreList":[]}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.validateShadow = void 0;
|
7
|
+
const validateShadow = (shadowProperties, styles, breakpoints) => {
|
8
|
+
// Collect breakpoints
|
9
|
+
shadowProperties.forEach(key => {
|
10
|
+
const value = styles[key];
|
11
|
+
if (typeof value !== 'object') {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
15
|
+
const {
|
16
|
+
width,
|
17
|
+
height
|
18
|
+
} = value;
|
19
|
+
|
20
|
+
// If shadowOffset.width has breakpoints
|
21
|
+
if (typeof width === 'object') {
|
22
|
+
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
|
23
|
+
}
|
24
|
+
|
25
|
+
// If shadowOffset.height has breakpoints
|
26
|
+
if (typeof height === 'object') {
|
27
|
+
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
|
28
|
+
}
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
|
32
|
+
// Collect regular breakpoints
|
33
|
+
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
34
|
+
});
|
35
|
+
|
36
|
+
// Validate if all breakpoints are present
|
37
|
+
shadowProperties.forEach(key => {
|
38
|
+
const value = styles[key];
|
39
|
+
if (typeof value !== 'object') {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
43
|
+
const {
|
44
|
+
width,
|
45
|
+
height
|
46
|
+
} = value;
|
47
|
+
if (typeof width === 'object') {
|
48
|
+
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
|
49
|
+
if (missingBreakpoints.length) {
|
50
|
+
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
if (typeof height === 'object') {
|
54
|
+
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
|
55
|
+
if (missingBreakpoints.length) {
|
56
|
+
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
|
62
|
+
if (missingBreakpoints.length) {
|
63
|
+
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
67
|
+
exports.validateShadow = validateShadow;
|
68
|
+
//# sourceMappingURL=shadow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["validateShadow","shadowProperties","styles","breakpoints","forEach","key","value","width","height","Object","keys","breakpoint","add","missingBreakpoints","Array","from","filter","length","join","exports"],"sourceRoot":"../../../../src","sources":["web/convert/shadow.ts"],"mappings":";;;;;;AAEO,MAAMA,cAAc,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,EAAEC,WAAwB,KAAK;EAC9H;EACAF,gBAAgB,CAACG,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGJ,MAAM,CAACG,GAAG,CAAC;IAEzB,IAAI,OAAOC,KA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I,CAAC,IAAI,CAAC,EAAE;QACjF;MACJ;MAEA,IAAI,OAAOV,MAAM,KAAK,QAAQ,EAAE;QAC5B,MAAMK,kBAAkB,GAAGC,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC,CAACa,MAAM,CAACL,UAAU,IAAI,EAAEA,UAAU,IAAIH,MAAM,CAAC,CAAC;QAEhG,IAAIK,kBAAkB,CAACI,MAAM,EAAE;UAC3B,MAAM,0BAA0BZ,GAAG,YAAYQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;QAClF;MACJ;MAEA;IACJ;IAEA,MAAML,kBAAkB,GAAGC,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC,CAACa,MAAM,CAACL,UAAU,IAAI,EAAEA,UAAU,IAAIL,KAAK,CAAC,CAAC;IAE/F,IAAIO,kBAAkB,CAACI,MAAM,EAAE;MAC3B,MAAM,0BAA0BZ,GAAG,KAAKQ,kBAAkB,CAACK,IAAI,CAAC,IAAI,CAAC,EAAE;IAC3E;EACJ,CAAC,CAAC;AACN,CAAC;AAAAC,OAAA,CAAAnB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getStyle = void 0;
|
7
|
+
var _utils = require("../utils");
|
8
|
+
const stylesToSkip = ['borderCurve', 'elevation', 'textAlignVertical', 'includeFontPadding', 'overlayColor', 'tintColor'];
|
9
|
+
const convertMap = {
|
10
|
+
marginHorizontal: value => ({
|
11
|
+
marginInline: value
|
12
|
+
}),
|
13
|
+
marginVertical: value => ({
|
14
|
+
marginBlock: value
|
15
|
+
}),
|
16
|
+
paddingHorizontal: value => ({
|
17
|
+
paddingInline: value
|
18
|
+
}),
|
19
|
+
paddingVertical: value => ({
|
20
|
+
paddingBlock: value
|
21
|
+
}),
|
22
|
+
writingDirection: value => ({
|
23
|
+
direction: value
|
24
|
+
}),
|
25
|
+
borderBottomEndRadius: value => ({
|
26
|
+
borderBottomRightRadius: value
|
27
|
+
}),
|
28
|
+
borderBottomStartRadius: value => ({
|
29
|
+
borderBottomLeftRadius: value
|
30
|
+
}),
|
31
|
+
borderEndColor: value => ({
|
32
|
+
borderInlineEndColor: value
|
33
|
+
}),
|
34
|
+
borderStartColor: value => ({
|
35
|
+
borderInlineStartColor: value
|
36
|
+
}),
|
37
|
+
borderTopEndRadius: value => ({
|
38
|
+
borderTopRightRadius: value
|
39
|
+
}),
|
40
|
+
borderTopStartRadius: value => ({
|
41
|
+
borderTopLeftRadius: value
|
42
|
+
}),
|
43
|
+
borderEndWidth: value => ({
|
44
|
+
borderInlineEndWidth: value
|
45
|
+
}),
|
46
|
+
borderStartWidth: value => ({
|
47
|
+
borderInlineStartWidth: value
|
48
|
+
}),
|
49
|
+
end: value => ({
|
50
|
+
right: value
|
51
|
+
}),
|
52
|
+
start: value => ({
|
53
|
+
left: value
|
54
|
+
}),
|
55
|
+
marginEnd: value => ({
|
56
|
+
marginRight: value
|
57
|
+
}),
|
58
|
+
marginStart: value => ({
|
59
|
+
marginLeft: value
|
60
|
+
}),
|
61
|
+
paddingEnd: value => ({
|
62
|
+
paddingRight: value
|
63
|
+
}),
|
64
|
+
paddingStart: value => ({
|
65
|
+
paddingLeft: value
|
66
|
+
}),
|
67
|
+
transformMatrix: value => ({
|
68
|
+
transform: `matrix(${value.join(', ')})`
|
69
|
+
}),
|
70
|
+
resizeMode: value => ({
|
71
|
+
backgroundSize: value
|
72
|
+
}),
|
73
|
+
lineHeight: value => ({
|
74
|
+
lineHeight: `${value}px`
|
75
|
+
})
|
76
|
+
};
|
77
|
+
const getStyle = (key, value) => {
|
78
|
+
if (stylesToSkip.includes(key)) {
|
79
|
+
return {};
|
80
|
+
}
|
81
|
+
if ((0, _utils.keyInObject)(convertMap, key)) {
|
82
|
+
return convertMap[key]?.(value) ?? {};
|
83
|
+
}
|
84
|
+
return {
|
85
|
+
[key]: value
|
86
|
+
};
|
87
|
+
};
|
88
|
+
exports.getStyle = getStyle;
|
89
|
+
//# sourceMappingURL=style.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_utils","require","stylesToSkip","convertMap","marginHorizontal","value","marginInline","marginVertical","marginBlock","paddingHorizontal","paddingInline","paddingVertical","paddingBlock","writingDirection","direction","borderBottomEndRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomLeftRadius","borderEndColor","borderInlineEndColor","borderStartColor","borderInlineStartColor","borderTopEndRadius","borderTopRightRadius","borderTopStartRadius","borderTopLeftRadius","borderEndWidth","borderInlineEndWidth","borderStartWidth","borderInlineStartWidth","end","right","start","left","marginEnd","marginRight","marginStart","marginLeft","paddingEnd","paddingRight","paddingStart","paddingLeft","transformMatrix","transform","join","resizeMode","backgroundSize","lineHeight","getStyle","key","includes","keyInObject","exports"],"sourceRoot":"../../../../src","sources":["web/convert/style.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,MAAMC,YAAY,GAAG,CACjB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,CACd;AAED,MAAMC,UAAU,GAAG;EACfC,gBAAgB,EAAGC,KAAa,KAAM;IAClCC,YAAY,EAAED;EAClB,CAAC,CAAC;EACFE,cAAc,EAAGF,KAAa,KAAM;IAChCG,WAAW,EAAEH;EACjB,CAAC,CAAC;EACFI,iBAAiB,EAAGJ,KAAa,KAAM;IACnCK,aAAa,EAAEL;EACnB,CAAC,CAAC;EACFM,eAAe,EAAGN,KAAa,KAAM;IACjCO,YAAY,EAAEP;EAClB,CAAC,CAAC;EACFQ,gBAAgB,EAAGR,KAAa,KAAM;IAClCS,SAAS,EAAET;EACf,CAAC,CAAC;EACFU,qBAAqB,EAAGV,KAAa,KAAM;IACvCW,uBAAuB,EAAEX;EAC7B,CAAC,CAAC;EACFY,uBAAuB,EAAGZ,KAAa,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EACxB,CAAC;AACL,CAA6D;AAEtD,MAAM4C,QAAQ,GAAGA,CAACC,GAAW,EAAE7C,KAAU,KAAK;EACjD,IAAIH,YAAY,CAACiD,QAAQ,CAACD,GAAG,CAAC,EAAE;IAC5B,OAAO,CAAC,CAAC;EACb;EAEA,IAAI,IAAAE,kBAAW,EAACjD,UAAU,EAAE+C,GAAG,CAAC,EAAE;IAC9B,OAAO/C,UAAU,CAAC+C,GAAG,CAAC,GAAG7C,KAAK,CAAC,IAAI,CAAC,CAAC;EACzC;EAEA,OAAO;IACH,CAAC6C,GAAG,GAAG7C;EACX,CAAC;AACL,CAAC;AAAAgD,OAAA,CAAAJ,QAAA,GAAAA,QAAA","ignoreList":[]}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getTextShadowStyle = void 0;
|
7
|
+
var _typestyle = require("typestyle");
|
8
|
+
var _utils = require("../utils");
|
9
|
+
var _shadow = require("./shadow");
|
10
|
+
var _breakpoint = require("./breakpoint");
|
11
|
+
var _types = require("./types");
|
12
|
+
var _utils2 = require("./utils");
|
13
|
+
const createTextShadowValue = style => {
|
14
|
+
const {
|
15
|
+
textShadowColor,
|
16
|
+
textShadowOffset,
|
17
|
+
textShadowRadius
|
18
|
+
} = style;
|
19
|
+
const offsetX = (0, _utils2.normalizeNumericValue)(textShadowOffset.width);
|
20
|
+
const offsetY = (0, _utils2.normalizeNumericValue)(textShadowOffset.height);
|
21
|
+
const radius = (0, _utils2.normalizeNumericValue)(textShadowRadius);
|
22
|
+
const color = (0, _utils2.normalizeColor)(textShadowColor);
|
23
|
+
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
24
|
+
};
|
25
|
+
const getTextShadowStyle = styles => {
|
26
|
+
const missingStyles = _types.TEXT_SHADOW_STYLES.filter(key => !(key in styles));
|
27
|
+
if (missingStyles.length) {
|
28
|
+
(0, _utils.warn)(`can't apply text shadow as you miss these properties: ${missingStyles.join(', ')}`);
|
29
|
+
return {};
|
30
|
+
}
|
31
|
+
const breakpointsSet = new Set();
|
32
|
+
try {
|
33
|
+
(0, _shadow.validateShadow)(_types.TEXT_SHADOW_STYLES, styles, breakpointsSet);
|
34
|
+
} catch (error) {
|
35
|
+
if (typeof error === 'string') {
|
36
|
+
(0, _utils.warn)(error);
|
37
|
+
}
|
38
|
+
return {};
|
39
|
+
}
|
40
|
+
const breakpoints = Array.from(breakpointsSet);
|
41
|
+
|
42
|
+
// If no breakpoints were used return styles without media queries
|
43
|
+
if (breakpoints.length === 0) {
|
44
|
+
return {
|
45
|
+
textShadow: createTextShadowValue(styles)
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
// Create textShadow for each breakpoint
|
50
|
+
const breakpointStyles = breakpoints.map(breakpoint => {
|
51
|
+
const color = (0, _utils2.extractShadowValue)('textShadowColor', breakpoint, styles);
|
52
|
+
const {
|
53
|
+
width,
|
54
|
+
height
|
55
|
+
} = (0, _utils2.extractShadowValue)('textShadowOffset', breakpoint, styles);
|
56
|
+
const radius = (0, _utils2.extractShadowValue)('textShadowRadius', breakpoint, styles);
|
57
|
+
return (0, _typestyle.media)((0, _breakpoint.convertBreakpoint)(breakpoint), {
|
58
|
+
textShadow: createTextShadowValue({
|
59
|
+
textShadowColor: color,
|
60
|
+
textShadowOffset: {
|
61
|
+
width,
|
62
|
+
height
|
63
|
+
},
|
64
|
+
textShadowRadius: radius
|
65
|
+
})
|
66
|
+
});
|
67
|
+
});
|
68
|
+
|
69
|
+
// Merge all breakpoints styles into one
|
70
|
+
return (0, _utils.deepMergeObjects)(...breakpointStyles);
|
71
|
+
};
|
72
|
+
exports.getTextShadowStyle = getTextShadowStyle;
|
73
|
+
//# sourceMappingURL=textShadow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_typestyle","require","_utils","_shadow","_breakpoint","_types","_utils2","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","normalizeNumericValue","width","offsetY","height","radius","color","normalizeColor","getTextShadowStyle","styles","missingStyles","TEXT_SHADOW_STYLES","filter","key","length","warn","join","breakpointsSet","Set","validateShadow","error","breakpoints","Array","from","textShadow","breakpointStyles","map","breakpoint","extractShadowValue","media","convertBreakpoint","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/textShadow.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,MAAMM,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAG,IAAAC,6BAAqB,EAACH,gBAAgB,CAACI,KAAK,CAAC;EAC7D,MAAMC,OAAO,GAAG,IAAAF,6BAAqB,EAACH,gBAAgB,CAACM,MAAM,CAAC;EAC9D,MAAMC,MAAM,GAAG,IAAAJ,6BAAqB,EAACF,gBAAgB,CAAC;EACtD,MAAMO,KAAK,GAAG,IAAAC,sBAAc,EAACV,eAAyB,CAAC;EAEvD,OAAO,GAAGG,OAAO,IAAIG,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAEM,MAAME,kBAAkB,GAAIC,MAA2B,IAA0B;EACpF,MAAMC,aAAa,GAAGC,yBAAkB,CAACC,MAAM,CAACC,GAAG,IAAI,EAAEA,GAAG,IAAIJ,MAAM,CAAC,CAAC;EAExE,IAAIC,aAAa,CAACI,MAAM,EAAE;IACtB,IAAAC,WAAI,EAAC,yDAAyDL,aAAa,CAACM,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAEzF,OAAO,CAAC,CAAC;EAC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@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getTransformStyle = void 0;
|
7
|
+
var _typestyle = require("typestyle");
|
8
|
+
var _utils = require("../utils");
|
9
|
+
var _utils2 = require("./utils");
|
10
|
+
var _breakpoint = require("./breakpoint");
|
11
|
+
const normalizeTransform = (key, value) => {
|
12
|
+
if (key.includes('scale')) {
|
13
|
+
return value;
|
14
|
+
}
|
15
|
+
if (typeof value === 'number') {
|
16
|
+
return (0, _utils2.normalizeNumericValue)(value);
|
17
|
+
}
|
18
|
+
return value;
|
19
|
+
};
|
20
|
+
const createTransformValue = transforms => transforms.map(transform => {
|
21
|
+
const [key] = Object.keys(transform);
|
22
|
+
if (!key) {
|
23
|
+
return undefined;
|
24
|
+
}
|
25
|
+
const value = transform[key];
|
26
|
+
switch (key) {
|
27
|
+
case 'matrix':
|
28
|
+
case 'matrix3d':
|
29
|
+
return `${key}(${value.join(',')})`;
|
30
|
+
default:
|
31
|
+
return `${key}(${normalizeTransform(key, value)})`;
|
32
|
+
}
|
33
|
+
}).filter(Boolean).join(' ');
|
34
|
+
const getTransformStyle = transforms => {
|
35
|
+
const breakpoints = new Set();
|
36
|
+
const normalTransforms = [];
|
37
|
+
transforms.forEach(transform => {
|
38
|
+
const [property] = Object.keys(transform);
|
39
|
+
if (!property) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
const value = transform[property];
|
43
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
44
|
+
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
normalTransforms.push(transform);
|
48
|
+
});
|
49
|
+
const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
|
50
|
+
const transformsPerBreakpoint = transforms.flatMap(transform => {
|
51
|
+
const [property] = Object.keys(transform);
|
52
|
+
if (!property) {
|
53
|
+
return [];
|
54
|
+
}
|
55
|
+
const value = transform[property];
|
56
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
57
|
+
return (0, _utils.keyInObject)(value, breakpoint) ? [{
|
58
|
+
[property]: value[breakpoint]
|
59
|
+
}] : [];
|
60
|
+
}
|
61
|
+
return [];
|
62
|
+
});
|
63
|
+
return (0, _typestyle.media)((0, _breakpoint.convertBreakpoint)(breakpoint), {
|
64
|
+
transform: createTransformValue(transformsPerBreakpoint)
|
65
|
+
});
|
66
|
+
});
|
67
|
+
return (0, _utils.deepMergeObjects)({
|
68
|
+
transform: createTransformValue(normalTransforms)
|
69
|
+
}, ...breakpointTransforms);
|
70
|
+
};
|
71
|
+
exports.getTransformStyle = getTransformStyle;
|
72
|
+
//# sourceMappingURL=transform.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_typestyle","require","_utils","_utils2","_breakpoint","normalizeTransform","key","value","includes","normalizeNumericValue","createTransformValue","transforms","map","transform","Object","keys","undefined","join","filter","Boolean","getTransformStyle","breakpoints","Set","normalTransforms","forEach","property","Array","isArray","breakpoint","add","push","breakpointTransforms","from","flatMap","transformsPerBreakpoint","keyInObject","media","convertBreakpoint","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/convert/transform.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAIA,MAAMI,kBAAkB,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAK;EACpD,IAAID,GAAG,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IACvB,OAAOD,KAAK;EAChB;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAO,IAAAE,6BAAqB,EAACF,KAAK,CAAC;EACvC;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,MAAMG,oBAAoB,GAA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AW,CAAC,CAACY,OAAO,CAACL,UAAU,IAAI;IACvE,MAAMM,uBAAuB,GAAGvB,UAAU,CAACsB,OAAO,CAACpB,SAAS,IAAI;MAC5D,MAAM,CAACY,QAAQ,CAAC,GAAGX,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;MAEzC,IAAI,CAACY,QAAQ,EAAE;QACX,OAAO,EAAE;MACb;MAEA,MAAMlB,KAAK,GAAGM,SAAS,CAACY,QAAQ,CAAC;MAEjC,IAAI,OAAOlB,KAAK,KAAK,QAAQ,IAAI,CAACmB,KAAK,CAACC,OAAO,CAACpB,KAAK,CAAC,EAAE;QACpD,OAAO,IAAA4B,kBAAW,EAAC5B,KAAK,EAAEqB,UAAU,CAAC,GAAG,CAAC;UAAE,CAACH,QAAQ,GAAGlB,KAAK,CAACqB,UAAU;QAAE,CAAC,CAAC,GAAG,EAAE;MACpF;MAEA,OAAO,EAAE;IACb,CAAC,CAAC;IAEF,OAAO,IAAAQ,gBAAK,EAAC,IAAAC,6BAAiB,EAACT,UAAU,CAAC,EAAE;MACxCf,SAAS,EAAEH,oBAAoB,CAACwB,uBAAuB;IAC3D,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO,IAAAI,uBAAgB,EAAC;IACpBzB,SAAS,EAAEH,oBAAoB,CAACa,gBAAgB;EACpD,CAAC,EAAE,GAAGQ,oBAAoB,CAAC;AAC/B,CAAC;AAAAQ,OAAA,CAAAnB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.TEXT_SHADOW_STYLES = exports.BOX_SHADOW_STYLES = void 0;
|
7
|
+
const TEXT_SHADOW_STYLES = exports.TEXT_SHADOW_STYLES = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
|
8
|
+
const BOX_SHADOW_STYLES = exports.BOX_SHADOW_STYLES = ['shadowColor', 'shadowRadius', 'shadowOpacity', 'shadowOffset'];
|
9
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["TEXT_SHADOW_STYLES","exports","BOX_SHADOW_STYLES"],"sourceRoot":"../../../../src","sources":["web/convert/types.ts"],"mappings":";;;;;;AAKO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAU;AAI/F,MAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAU","ignoreList":[]}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.normalizeNumericValue = exports.normalizeColor = exports.isTransform = exports.isTextShadow = exports.isBoxShadow = exports.extractShadowValue = void 0;
|
7
|
+
var _normalizeColors = _interopRequireDefault(require("@react-native/normalize-colors"));
|
8
|
+
var _types = require("./types");
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
+
// based on react-native-web normalizer
|
11
|
+
// https://github.com/necolas/react-native-web
|
12
|
+
|
13
|
+
const isTransform = (key, value) => key === 'transform' && Array.isArray(value);
|
14
|
+
exports.isTransform = isTransform;
|
15
|
+
const isTextShadow = key => _types.TEXT_SHADOW_STYLES.includes(key);
|
16
|
+
exports.isTextShadow = isTextShadow;
|
17
|
+
const isBoxShadow = key => _types.BOX_SHADOW_STYLES.includes(key);
|
18
|
+
exports.isBoxShadow = isBoxShadow;
|
19
|
+
const normalizeNumericValue = value => value ? `${value}px` : value;
|
20
|
+
exports.normalizeNumericValue = normalizeNumericValue;
|
21
|
+
const normalizeColor = (color, opacity = 1) => {
|
22
|
+
// If the opacity is 1 there's no need to normalize the color
|
23
|
+
if (opacity === 1) {
|
24
|
+
return color;
|
25
|
+
}
|
26
|
+
const integer = (0, _normalizeColors.default)(color);
|
27
|
+
|
28
|
+
// If the color is an unknown format, the return value is null
|
29
|
+
if (integer === null) {
|
30
|
+
return color;
|
31
|
+
}
|
32
|
+
const hex = integer.toString(16).padStart(8, '0');
|
33
|
+
if (hex.length === 8) {
|
34
|
+
const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
|
35
|
+
return `rgba(${r},${g},${b},${a / 255 * opacity})`;
|
36
|
+
}
|
37
|
+
return color;
|
38
|
+
};
|
39
|
+
exports.normalizeColor = normalizeColor;
|
40
|
+
const extractShadowValue = (key, breakpoint, styles) => {
|
41
|
+
const value = styles[key];
|
42
|
+
if (key === 'textShadowOffset' || key === 'shadowOffset') {
|
43
|
+
const {
|
44
|
+
width,
|
45
|
+
height
|
46
|
+
} = value;
|
47
|
+
return {
|
48
|
+
width: typeof width === 'object' ? width[breakpoint] : width,
|
49
|
+
height: typeof height === 'object' ? height[breakpoint] : height
|
50
|
+
};
|
51
|
+
}
|
52
|
+
return typeof value === 'object' ? value[breakpoint] : value;
|
53
|
+
};
|
54
|
+
exports.extractShadowValue = extractShadowValue;
|
55
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","_types","e","__esModule","default","isTransform","key","value","Array","isArray","exports","isTextShadow","TEXT_SHADOW_STYLES","includes","isBoxShadow","BOX_SHADOW_STYLES","normalizeNumericValue","normalizeColor","color","opacity","integer","normalizeColors","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAm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,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,CAACD,CAAC,EAAE,EAAE,CAAC,CAAC,CACzBE,MAAM,CAACC,GAAG,IAAI,CAACC,KAAK,CAACD,GAAG,CAAC,CAAC;IAE/B,OAAO,QAAQT,CAAC,IAAIC,CAAC,IAAIC,CAAC,IAAKC,CAAC,GAAG,GAAG,GAAIV,OAAO,GAAG;EACxD;EAEA,OAAOD,KAAK;AAChB,CAAC;AAAAR,OAAA,CAAAO,cAAA,GAAAA,cAAA;AAEM,MAAMoB,kBAAkB,GAAGA,CAA6B/B,GAAS,EAAEgC,UAAkB,EAAEC,MAAW,KAAsB;EAC3H,MAAMhC,KAAK,GAAGgC,MAAM,CAACjC,GAAG,CAAC;EAEzB,IAAIA,GAAG,KAAK,kBAAkB,IAAIA,GAAG,KAAK,cAAc,EAAE;IACtD,MAAM;MAAEkC,KAAK;MAAEC;IAAO,CAAC,GAAGlC,KAAK;IAE/B,OAAO;MACHiC,KAAK,EAAE,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAACF,UAAU,CAAC,GAAGE,KAAK;MAC5DC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,CAACH,UAAU,CAAC,GAAGG;IAC9D,CAAC;EACL;EAEA,OAAO,OAAOlC,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAAC+B,UAAU,CAAC,GAAG/B,KAAK;AAChE,CAAC;AAAAG,OAAA,CAAA2B,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.create = void 0;
|
7
|
+
var _registry = require("./registry");
|
8
|
+
var _utils = require("./utils");
|
9
|
+
var _runtime = require("./runtime");
|
10
|
+
var _variants = require("./variants");
|
11
|
+
var _listener = require("./listener");
|
12
|
+
const create = stylesheet => {
|
13
|
+
const computedStylesheet = typeof stylesheet === 'function' ? stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime) : stylesheet;
|
14
|
+
let lastlySelectedVariants = {};
|
15
|
+
const listenToDependencies = ({
|
16
|
+
key,
|
17
|
+
className,
|
18
|
+
unistyles,
|
19
|
+
value,
|
20
|
+
args = []
|
21
|
+
}) => {
|
22
|
+
const dependencies = 'uni__dependencies' in value ? value['uni__dependencies'] : [];
|
23
|
+
if (dependencies.length === 0) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
return _listener.UnistylesListener.addListeners(dependencies, () => {
|
27
|
+
const newComputedStylesheet = typeof stylesheet === 'function' ? stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime) : stylesheet;
|
28
|
+
if (!(0, _utils.keyInObject)(newComputedStylesheet, key)) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
const value = newComputedStylesheet[key];
|
32
|
+
const result = typeof value === 'function' ? value(...args) : value;
|
33
|
+
_registry.UnistylesRegistry.updateStyles(unistyles, result, className);
|
34
|
+
});
|
35
|
+
};
|
36
|
+
const styles = (0, _utils.reduceObject)(computedStylesheet, (value, key) => {
|
37
|
+
if (typeof value === 'function') {
|
38
|
+
const webUnistyleByRef = new Map();
|
39
|
+
const disposeByRef = new Map();
|
40
|
+
return (...args) => {
|
41
|
+
const [ref] = args.slice(-1);
|
42
|
+
const result = value(...args);
|
43
|
+
const variants = Object.fromEntries((0, _variants.getVariants)({
|
44
|
+
[key]: result
|
45
|
+
}, lastlySelectedVariants));
|
46
|
+
const resultWithVariants = {
|
47
|
+
...result,
|
48
|
+
...variants[key]
|
49
|
+
};
|
50
|
+
if (ref instanceof HTMLElement) {
|
51
|
+
const storedWebUnistyle = webUnistyleByRef.get(ref);
|
52
|
+
const webUnistyle = storedWebUnistyle ?? _registry.UnistylesRegistry.createStyles(resultWithVariants, key);
|
53
|
+
webUnistyleByRef.set(ref, webUnistyle);
|
54
|
+
disposeByRef.get(ref)?.();
|
55
|
+
disposeByRef.set(ref, listenToDependencies({
|
56
|
+
key,
|
57
|
+
value,
|
58
|
+
unistyles: webUnistyle.unistyles,
|
59
|
+
className: webUnistyle.className,
|
60
|
+
args
|
61
|
+
}));
|
62
|
+
ref.classList.add(webUnistyle.className);
|
63
|
+
if (storedWebUnistyle) {
|
64
|
+
_registry.UnistylesRegistry.updateStyles(webUnistyle.unistyles, resultWithVariants, webUnistyle.className);
|
65
|
+
}
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
return (0, _utils.toReactNativeClassName)(null, resultWithVariants);
|
69
|
+
};
|
70
|
+
}
|
71
|
+
const {
|
72
|
+
className,
|
73
|
+
unistyles
|
74
|
+
} = _registry.UnistylesRegistry.createStyles(value, key);
|
75
|
+
listenToDependencies({
|
76
|
+
key,
|
77
|
+
value,
|
78
|
+
unistyles,
|
79
|
+
className
|
80
|
+
});
|
81
|
+
return (0, _utils.toReactNativeClassName)(className, value);
|
82
|
+
});
|
83
|
+
(0, _variants.createUseVariants)(styles, newVariants => {
|
84
|
+
lastlySelectedVariants = newVariants;
|
85
|
+
});
|
86
|
+
return styles;
|
87
|
+
};
|
88
|
+
exports.create = create;
|
89
|
+
//# sourceMappingURL=create.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_registry","require","_utils","_runtime","_variants","_listener","create","stylesheet","computedStylesheet","UnistylesRuntime","theme","miniRuntime","lastlySelectedVariants","listenToDependencies","key","className","unistyles","value","args","dependencies","length","UnistylesListener","addListeners","newComputedStylesheet","keyInObject","result","UnistylesRegistry","updateStyles","styles","reduceObject","webUnistyleByRef","Map","disposeByRef","ref","slice","variants","Object","fromEntries","getVariants","resultWithVariants","HTMLElement","storedWebUnistyle","get","webUnistyle","createStyles","set","classList","add","toReactNativeClassName","createUseVariants","newVariants","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,M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AACgB,WAAW,CAAC3B,SAAS,EAAEuB,kBAAkB,EAAEI,WAAW,CAAC5B,SAAS,CAAC;UACpG;UAGA;QACJ;QAEA,OAAO,IAAAiC,6BAAsB,EAAC,IAAI,EAAET,kBAAkB,CAAC;MAC3D,CAAC;IACL;IAEA,MAAM;MAAExB,SAAS;MAAEC;IAAU,CAAC,GAAGU,2BAAiB,CAACkB,YAAY,CAAC3B,KAAK,EAAEH,GAAG,CAAC;IAE3ED,oBAAoB,CAAC;MAAEC,GAAG;MAAEG,KAAK;MAAED,SAAS;MAAED;IAAU,CAAC,CAAC;IAE1D,OAAO,IAAAiC,6BAAsB,EAACjC,SAAS,EAAEE,KAAK,CAAC;EACnD,CAAC,CAAsC;EAEvC,IAAAgC,2BAAiB,EAACrB,MAAM,EAAEsB,WAAW,IAAI;IACrCtC,sBAAsB,GAAGsC,WAAW;EACxC,CAAC,CAAC;EAEF,OAAOtB,MAAM;AACjB,CAAC;AAAAuB,OAAA,CAAA7C,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _exportNames = {
|
7
|
+
StyleSheet: true,
|
8
|
+
getSSRUnistyles: true,
|
9
|
+
UnistylesRuntime: true
|
10
|
+
};
|
11
|
+
exports.StyleSheet = void 0;
|
12
|
+
Object.defineProperty(exports, "UnistylesRuntime", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _runtime.UnistylesRuntime;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
exports.getSSRUnistyles = void 0;
|
19
|
+
var _create = require("./create");
|
20
|
+
var _runtime = require("./runtime");
|
21
|
+
var _state = require("./state");
|
22
|
+
var _utils = require("./utils");
|
23
|
+
var _mock = require("./mock");
|
24
|
+
Object.keys(_mock).forEach(function (key) {
|
25
|
+
if (key === "default" || key === "__esModule") return;
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
27
|
+
if (key in exports && exports[key] === _mock[key]) return;
|
28
|
+
Object.defineProperty(exports, key, {
|
29
|
+
enumerable: true,
|
30
|
+
get: function () {
|
31
|
+
return _mock[key];
|
32
|
+
}
|
33
|
+
});
|
34
|
+
});
|
35
|
+
const StyleSheet = exports.StyleSheet = {
|
36
|
+
configure: _state.UnistylesState.init,
|
37
|
+
create: _create.create,
|
38
|
+
absoluteFill: {
|
39
|
+
position: 'absolute',
|
40
|
+
left: 0,
|
41
|
+
top: 0,
|
42
|
+
right: 0,
|
43
|
+
bottom: 0
|
44
|
+
},
|
45
|
+
compose: (a, b) => (0, _utils.deepMergeObjects)(a, b),
|
46
|
+
flatten: (...styles) => (0, _utils.deepMergeObjects)(...styles),
|
47
|
+
hairlineWidth: 1
|
48
|
+
};
|
49
|
+
const getSSRUnistyles = () => _runtime.UnistylesRuntime.getSSRUnistyles();
|
50
|
+
exports.getSSRUnistyles = getSSRUnistyles;
|
51
|
+
//# sourceMappingURL=index.js.map
|