react-native-unistyles 3.0.0-alpha.6 → 3.0.0-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Helpers.h +24 -0
- package/cxx/core/HostStyle.cpp +4 -5
- package/cxx/core/HostStyle.h +4 -0
- package/cxx/core/StyleSheet.h +0 -1
- package/cxx/core/StyleSheetRegistry.cpp +9 -17
- package/cxx/core/StyleSheetRegistry.h +3 -4
- package/cxx/core/UnistyleData.h +22 -0
- package/cxx/core/UnistylesCommitHook.cpp +4 -1
- package/cxx/core/UnistylesRegistry.cpp +33 -49
- package/cxx/core/UnistylesRegistry.h +8 -8
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +4 -3
- package/cxx/hybridObjects/HybridStyleSheet.cpp +8 -11
- package/cxx/parser/Parser.cpp +41 -57
- package/cxx/parser/Parser.h +8 -13
- package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/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/StyleSheet/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/example/App.d.ts.map +1 -1
- package/lib/typescript/example/Typography.d.ts +11 -0
- package/lib/typescript/example/Typography.d.ts.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/StyleSheet/index.d.ts +2 -1
- package/lib/typescript/src/specs/StyleSheet/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 +181 -103
- package/plugin/__tests__/ref.spec.js +346 -156
- package/plugin/__tests__/stylesheet.spec.js +148 -55
- package/plugin/index.js +31 -21
- package/plugin/ref.js +67 -15
- package/plugin/style.js +13 -24
- package/plugin/stylesheet.js +44 -1
- package/plugin/variants.js +33 -0
- package/src/specs/ShadowRegistry/index.ts +4 -4
- package/src/specs/StyleSheet/index.ts +3 -1
- 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,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,KAAM;IACzCa,sBAAsB,EAAEb;EAC5B,CAAC,CAAC;EACFc,cAAc,EAAGd,KAAa,KAAM;IAChCe,oBAAoB,EAAEf;EAC1B,CAAC,CAAC;EACFgB,gBAAgB,EAAGhB,KAAa,KAAM;IAClCiB,sBAAsB,EAAEjB;EAC5B,CAAC,CAAC;EACFkB,kBAAkB,EAAGlB,KAAa,KAAM;IACpCmB,oBAAoB,EAAEnB;EAC1B,CAAC,CAAC;EACFoB,oBAAoB,EAAGpB,KAAa,KAAM;IACtCqB,mBAAmB,EAAErB;EACzB,CAAC,CAAC;EACFsB,cAAc,EAAGtB,KAAa,KAAM;IAChCuB,oBAAoB,EAAEvB;EAC1B,CAAC,CAAC;EACFwB,gBAAgB,EAAGxB,KAAa,KAAM;IAClCyB,sBAAsB,EAAEz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|
+
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,KAA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,gBAAgB,GAAGJ,WAAW,CAACK,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMrB,KAAK,GAAG,IAAAsB,0BAAkB,EAAC,iBAAiB,EAAED,UAAU,EAAElB,MAAM,CAAC;IACvE,MAAM;MAAEP,KAAK;MAAEE;IAAO,CAAC,GAAG,IAAAwB,0BAAkB,EAAC,kBAAkB,EAAED,UAAU,EAAElB,MAAM,CAAC;IACpF,MAAMJ,MAAM,GAAG,IAAAuB,0BAAkB,EAAC,kBAAkB,EAAED,UAAU,EAAElB,MAAM,CAAC;IAEzE,OAAO,IAAAoB,gBAAK,EAAC,IAAAC,6BAAiB,EAACH,UAAU,CAAC,EAAE;MACxCH,UAAU,EAAE7B,qBAAqB,CAAC;QAC9BE,eAAe,EAAES,KAAK;QACtBR,gBAAgB,EAAE;UACdI,KAAK;UACLE;QACJ,CAAC;QACDL,gBAAgB,EAAEM;MACtB,CAAC;IACL,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;EACA,OAAO,IAAA0B,uBAAgB,EAAC,GAAGN,gBAAgB,CAAC;AAChD,CAAC;AAAAO,OAAA,CAAAxB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -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,GAAIC,UAAsB,IAAKA,UAAU,CAC9DC,GAAG,CAACC,SAAS,IAAI;EACd,MAAM,CAACP,GAAG,CAAC,GAAGQ,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACP,GAAG,EAAE;IACN,OAAOU,SAAS;EACpB;EAEA,MAAMT,KAAK,GAAGM,SAAS,CAACP,GAAG,CAAC;EAE5B,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAO,GAAGA,GAAG,IAAKC,KAAK,CAAmBU,IAAI,CAAC,GAAG,CAAC,GAAG;IAC1D;MACI,OAAO,GAAGX,GAAG,IAAID,kBAAkB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAG;EAC1D;AACJ,CAAC,CAAC,CACDW,MAAM,CAACC,OAAO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AACqB,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;AAAmG,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAHnG;AACA;;AAIO,MAAMG,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAA0CD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAAAG,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAEjI,MAAMM,YAAY,GAAIL,GAAW,IAAKM,yBAAkB,CAACC,QAAQ,CAACP,GAAwC,CAAC;AAAAI,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAE3G,MAAMG,WAAW,GAAIR,GAAW,IAAKS,wBAAiB,CAACF,QAAQ,CAACP,GAAuC,CAAC;AAAAI,OAAA,CAA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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,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAaO,MAAMK,MAAM,GAAIC,UAAiD,IAAK;EACzE,MAAMC,kBAAkB,GAAG,OAAOD,UAAU,KAAK,UAAU,GACrDA,UAAU,CAACE,yBAAgB,CAACC,KAAK,EAAED,yBAAgB,CAACE,WAAW,CAAC,GAChEJ,UAAU;EAChB,IAAIK,sBAA2C,GAAG,CAAC,CAAC;EAEpD,MAAMC,oBAAoB,GAAGA,CAAC;IAAEC,GAAG;IAAEC,SAAS;IAAEC,SAAS;IAAEC,KAAK;IAAEC,IAAI,GAAG;EAA+B,CAAC,KAAK;IAC1G,MAAMC,YAAY,GAAI,mBAAmB,IAA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W,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
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_create","require","_runtime","_state","_utils","_mock","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","StyleSheet","configure","UnistylesState","init","create","absoluteFill","position","left","top","right","bottom","compose","a","b","deepMergeObjects","flatten","styles","hairlineWidth","getSSRUnistyles","UnistylesRuntime"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAkBA,IAAAI,KAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAhBO,MAAMS,UAAU,GAAAJ,OAAA,CAAAI,UAAA,GAAG;EACtBC,SAAS,EAAEC,qBAAc,CAACC,IAAI;EAC9BC,MAAM,EAANA,cAAM;EACNC,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAS,EAAEC,CAAS,KAAK,IAAAC,uBAAgB,EAACF,CAAC,EAAEC,CAAC,CAAC;EACzDE,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAK,IAAAF,uBAAgB,EAAC,GAAGE,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC;AAKM,MAAMC,eAAe,GAAGA,CAAA,KAAMC,yBAAgB,CAACD,eAAe,CAAC,CAAC;AAAAtB,OAAA,CAAAsB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "UnistylesListener", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _listener.UnistylesListener;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var _listener = require("./listener");
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_listener","require"],"sourceRoot":"../../../../src","sources":["web/listener/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA","ignoreList":[]}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.UnistylesListenerBuilder = exports.UnistylesListener = void 0;
|
7
|
+
var _NativePlatform = require("../../specs/NativePlatform");
|
8
|
+
var _runtime = require("../runtime");
|
9
|
+
class UnistylesListenerBuilder {
|
10
|
+
isInitialized = false;
|
11
|
+
listeners = Array.from({
|
12
|
+
length: Object.keys(_NativePlatform.UnistyleDependency).length / 2
|
13
|
+
}, () => new Set());
|
14
|
+
emitChange = dependency => {
|
15
|
+
this.listeners[dependency]?.forEach(listener => listener());
|
16
|
+
};
|
17
|
+
initListeners = () => {
|
18
|
+
if (this.isInitialized) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
this.isInitialized = true;
|
22
|
+
_runtime.UnistylesRuntime.darkMedia?.addEventListener('change', () => this.emitChange(_NativePlatform.UnistyleDependency.ColorScheme));
|
23
|
+
_runtime.UnistylesRuntime.lightMedia?.addEventListener('change', () => this.emitChange(_NativePlatform.UnistyleDependency.ColorScheme));
|
24
|
+
window.addEventListener('orientationchange', () => this.emitChange(_NativePlatform.UnistyleDependency.Orientation));
|
25
|
+
window.addEventListener('resize', () => this.emitChange(_NativePlatform.UnistyleDependency.Dimensions));
|
26
|
+
};
|
27
|
+
addListeners = (dependencies, listener) => {
|
28
|
+
dependencies.forEach(dependency => this.listeners[dependency]?.add(listener));
|
29
|
+
return () => {
|
30
|
+
dependencies.forEach(dependency => this.listeners[dependency]?.delete(listener));
|
31
|
+
};
|
32
|
+
};
|
33
|
+
}
|
34
|
+
exports.UnistylesListenerBuilder = UnistylesListenerBuilder;
|
35
|
+
const UnistylesListener = exports.UnistylesListener = new UnistylesListenerBuilder();
|
36
|
+
//# sourceMappingURL=listener.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_NativePlatform","require","_runtime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","UnistyleDependency","Set","emitChange","dependency","forEach","listener","initListeners","UnistylesRuntime","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","exports","UnistylesListener"],"sourceRoot":"../../../../src","sources":["web/listener/listener.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,wBAAwB,CAAC;EAC1BC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAA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,GAAAA,wBAAA;AAEM,MAAM4B,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,IAAI5B,wBAAwB,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.UnistylesShadowRegistry = exports.StatusBar = exports.NavigationBar = void 0;
|
7
|
+
const StatusBar = exports.StatusBar = {
|
8
|
+
width: 0,
|
9
|
+
height: 0,
|
10
|
+
setStyle: () => {},
|
11
|
+
setHidden: () => {},
|
12
|
+
setBackgroundColor: () => {},
|
13
|
+
equals: () => true,
|
14
|
+
toString: () => 'StatusBar',
|
15
|
+
__type: 'web',
|
16
|
+
name: 'StatusBar'
|
17
|
+
};
|
18
|
+
const NavigationBar = exports.NavigationBar = {
|
19
|
+
width: 0,
|
20
|
+
height: 0,
|
21
|
+
setHidden: () => {},
|
22
|
+
setBackgroundColor: () => {},
|
23
|
+
equals: () => true,
|
24
|
+
toString: () => 'NavigationBar',
|
25
|
+
__type: 'web',
|
26
|
+
name: 'NavigationBar'
|
27
|
+
};
|
28
|
+
const UnistylesShadowRegistry = exports.UnistylesShadowRegistry = {
|
29
|
+
name: 'UnistylesShadowRegistry',
|
30
|
+
__type: 'web',
|
31
|
+
equals: () => true,
|
32
|
+
toString: () => 'UnistylesShadowRegistry',
|
33
|
+
dispose: () => {},
|
34
|
+
add: () => {},
|
35
|
+
remove: () => {}
|
36
|
+
};
|
37
|
+
//# sourceMappingURL=mock.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["StatusBar","exports","width","height","setStyle","setHidden","setBackgroundColor","equals","toString","__type","name","NavigationBar","UnistylesShadowRegistry","dispose","add","remove"],"sourceRoot":"../../../src","sources":["web/mock.ts"],"mappings":";;;;;;AAGO,MAAMA,SAAwB,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACpCE,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,WAAW;EAC3BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAEM,MAAMC,aAAgC,GAAAV,OAAA,CAAAU,aAAA,GAAG;EAC5CT,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTE,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,eAAe;EAC/BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAEM,MAAME,uBAAuB,GAAAX,OAAA,CAAAW,uBAAA,GAAG;EACnCF,IAAI,EAAE,yBAAyB;EAC/BD,MAAM,EAAE,KAAK;EACbF,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,yBAAyB;EACzCK,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,GAAG,EAAEA,CAAA,KAAM,CAAC,CAAC;EACbC,MAAM,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC","ignoreList":[]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.parseMq = exports.isUnistylesMq = void 0;
|
7
|
+
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
8
|
+
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
9
|
+
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
10
|
+
const parseMq = mq => {
|
11
|
+
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
12
|
+
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
13
|
+
return {
|
14
|
+
minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
|
15
|
+
maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
|
16
|
+
minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
|
17
|
+
maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
|
18
|
+
};
|
19
|
+
};
|
20
|
+
exports.parseMq = parseMq;
|
21
|
+
const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
22
|
+
exports.isUnistylesMq = isUnistylesMq;
|
23
|
+
//# sourceMappingURL=mq.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","exports","isUnistylesMq","test"],"sourceRoot":"../../../src","sources":["web/mq.ts"],"mappings":";;;;;;AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAE7D,MAAMC,OAAO,GAAIC,EAAU,IAAiB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHQ,QAAQ,EAAE,CAACP,KAAK,IAAIC,KAAK,KAAK,UAAU,GAAGO,SAAS,GAAGC,MAAM,CAACR,KAAK,CAAC;IACpES,QAAQ,EAAE,CAACV,KAAK,IAAIE,GAAG,KAAK,UAAU,GAAGM,SAAS,GAAGC,MAAM,CAACP,GAAG,CAAC;IAChES,SAAS,EAAE,CAACP,MAAM,IAAIC,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACR,MAAM,IAAIE,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAAAO,OAAA,CAAAf,OAAA,GAAAA,OAAA;AAEM,MAAMgB,aAAa,GAAIf,EAAU,IAAKJ,kBAAkB,CAACoB,IAAI,CAAChB,EAAE,CAAC;AAAAc,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.pseudos = exports.isPseudo = void 0;
|
7
|
+
// TODO: Add complete list of pseudo selectors
|
8
|
+
const pseudos = exports.pseudos = ['_hover', '_css', '_before', '_after'];
|
9
|
+
const isPseudo = selector => pseudos.includes(selector);
|
10
|
+
exports.isPseudo = isPseudo;
|
11
|
+
//# sourceMappingURL=pseudo.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["pseudos","exports","isPseudo","selector","includes"],"sourceRoot":"../../../src","sources":["web/pseudo.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,CACnB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,CACF;AAEH,MAAME,QAAQ,GAAIC,QAAgB,IAAKH,OAAO,CAACI,QAAQ,CAACD,QAAkB,CAAC;AAAAF,OAAA,CAAAC,QAAA,GAAAA,QAAA","ignoreList":[]}
|