@htyf-mp/taro-rn-style-transformer 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +174 -0
  2. package/dist/config/rn-stylelint.json +4 -0
  3. package/dist/index.d.ts +8 -0
  4. package/dist/index.js +86 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/transforms/StyleSheet/ColorPropType.d.ts +10 -0
  7. package/dist/transforms/StyleSheet/ColorPropType.js +76 -0
  8. package/dist/transforms/StyleSheet/ColorPropType.js.map +1 -0
  9. package/dist/transforms/StyleSheet/ImageResizeMode.d.ts +6 -0
  10. package/dist/transforms/StyleSheet/ImageResizeMode.js +54 -0
  11. package/dist/transforms/StyleSheet/ImageResizeMode.js.map +1 -0
  12. package/dist/transforms/StyleSheet/ImageStylePropTypes.d.ts +106 -0
  13. package/dist/transforms/StyleSheet/ImageStylePropTypes.js +81 -0
  14. package/dist/transforms/StyleSheet/ImageStylePropTypes.js.map +1 -0
  15. package/dist/transforms/StyleSheet/LayoutPropTypes.d.ts +399 -0
  16. package/dist/transforms/StyleSheet/LayoutPropTypes.js +566 -0
  17. package/dist/transforms/StyleSheet/LayoutPropTypes.js.map +1 -0
  18. package/dist/transforms/StyleSheet/ShadowPropTypesIOS.d.ts +32 -0
  19. package/dist/transforms/StyleSheet/ShadowPropTypesIOS.js +86 -0
  20. package/dist/transforms/StyleSheet/ShadowPropTypesIOS.js.map +1 -0
  21. package/dist/transforms/StyleSheet/StyleSheetValidation.d.ts +15 -0
  22. package/dist/transforms/StyleSheet/StyleSheetValidation.js +71 -0
  23. package/dist/transforms/StyleSheet/StyleSheetValidation.js.map +1 -0
  24. package/dist/transforms/StyleSheet/TextStylePropTypes.d.ts +154 -0
  25. package/dist/transforms/StyleSheet/TextStylePropTypes.js +127 -0
  26. package/dist/transforms/StyleSheet/TextStylePropTypes.js.map +1 -0
  27. package/dist/transforms/StyleSheet/TransformPropTypes.d.ts +45 -0
  28. package/dist/transforms/StyleSheet/TransformPropTypes.js +129 -0
  29. package/dist/transforms/StyleSheet/TransformPropTypes.js.map +1 -0
  30. package/dist/transforms/StyleSheet/ViewStylePropTypes.d.ts +126 -0
  31. package/dist/transforms/StyleSheet/ViewStylePropTypes.js +72 -0
  32. package/dist/transforms/StyleSheet/ViewStylePropTypes.js.map +1 -0
  33. package/dist/transforms/StyleSheet/deprecatedPropType.d.ts +13 -0
  34. package/dist/transforms/StyleSheet/deprecatedPropType.js +32 -0
  35. package/dist/transforms/StyleSheet/deprecatedPropType.js.map +1 -0
  36. package/dist/transforms/StyleSheet/index.d.ts +2 -0
  37. package/dist/transforms/StyleSheet/index.js +9 -0
  38. package/dist/transforms/StyleSheet/index.js.map +1 -0
  39. package/dist/transforms/StyleSheet/normalizeColor.d.ts +10 -0
  40. package/dist/transforms/StyleSheet/normalizeColor.js +341 -0
  41. package/dist/transforms/StyleSheet/normalizeColor.js.map +1 -0
  42. package/dist/transforms/index.d.ts +56 -0
  43. package/dist/transforms/index.js +221 -0
  44. package/dist/transforms/index.js.map +1 -0
  45. package/dist/transforms/less.d.ts +2 -0
  46. package/dist/transforms/less.js +70 -0
  47. package/dist/transforms/less.js.map +1 -0
  48. package/dist/transforms/postcss.d.ts +13 -0
  49. package/dist/transforms/postcss.js +135 -0
  50. package/dist/transforms/postcss.js.map +1 -0
  51. package/dist/transforms/sass.d.ts +2 -0
  52. package/dist/transforms/sass.js +162 -0
  53. package/dist/transforms/sass.js.map +1 -0
  54. package/dist/transforms/stylus.d.ts +3 -0
  55. package/dist/transforms/stylus.js +110 -0
  56. package/dist/transforms/stylus.js.map +1 -0
  57. package/dist/types/index.d.ts +205 -0
  58. package/dist/types/index.js +6 -0
  59. package/dist/types/index.js.map +1 -0
  60. package/dist/utils/index.d.ts +21 -0
  61. package/dist/utils/index.js +240 -0
  62. package/dist/utils/index.js.map +1 -0
  63. package/dist/utils/lessImport.d.ts +5 -0
  64. package/dist/utils/lessImport.js +45 -0
  65. package/dist/utils/lessImport.js.map +1 -0
  66. package/dist/utils/reporterSkip.d.ts +7 -0
  67. package/dist/utils/reporterSkip.js +27 -0
  68. package/dist/utils/reporterSkip.js.map +1 -0
  69. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,174 @@
1
+ ## @htyf-mp/taro-rn-style-transformer
2
+
3
+ 用于处理 rn 样式配置,生成需要的样式
4
+
5
+ ### rn.postcss
6
+
7
+ `object`
8
+
9
+ `postcss` 相关配置,其他样式语言预处理后经过此配置。
10
+
11
+ ```js
12
+ module.exports = {
13
+ // ...
14
+ rn: {
15
+ // ...
16
+ postcss: {
17
+ // postcss 配置,参考 https://github.com/postcss/postcss#options
18
+ options: {
19
+ /* ... */
20
+ },
21
+ // 默认true,控制是否对 css value 进行 scalePx2dp 转换,pxtransform配置 enable 才生效
22
+ scalable: boolean,
23
+ pxtransform: {
24
+ enable: boolean, // 默认true
25
+ config: {
26
+ /* ... */
27
+ }, // 插件 pxtransform 配置项,参考尺寸章节
28
+ },
29
+ // 跟其他端 css module 配置保持统一
30
+ cssModules: {
31
+ enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
32
+ },
33
+ // postcss-css-variables 配置,样式变量编译相关
34
+ 'postcss-css-variables': {
35
+ enable: boolean, // 默认 true
36
+ config: {
37
+ /* ... */
38
+ }, // 插件 postcss-css-variables 配置项,参考 https://github.com/MadLittleMods/postcss-css-variables?tab=readme-ov-file#options
39
+ },
40
+ },
41
+ },
42
+ }
43
+ ```
44
+
45
+ ### rn.sass
46
+
47
+ `object`
48
+
49
+ `sass` 相关配置。`options` 配置项参考[官方文档](https://github.com/sass/node-sass#options)。
50
+
51
+ ```js
52
+ module.exports = {
53
+ // ...
54
+ rn: {
55
+ // ...
56
+ sass: {
57
+ options: {
58
+ /* ... */
59
+ },
60
+ // 加入到脚本注入的每个 sass 文件头部,在 config.sass 之前
61
+ additionalData: '', // {String|Function}
62
+ },
63
+ },
64
+ }
65
+ ```
66
+
67
+ ### rn.less
68
+
69
+ `object`
70
+
71
+ `less` 相关配置。`options` 配置项参考 [官方文档](http://lesscss.org/usage/#less-options)。
72
+
73
+ ```js
74
+ module.exports = {
75
+ // ...
76
+ rn: {
77
+ // ...
78
+ less: {
79
+ options: {
80
+ /* ... */
81
+ },
82
+ additionalData: '', // {String|Function}
83
+ },
84
+ },
85
+ }
86
+ ```
87
+
88
+ ### rn.stylus
89
+
90
+ `object`
91
+
92
+ `stylus` 相关配置。`options` 配置项如下。
93
+
94
+ ```js
95
+ module.exports = {
96
+ // ...
97
+ rn: {
98
+ // ...
99
+ stylus: {
100
+ options: {
101
+ /**
102
+ * Specify Stylus plugins to use.
103
+ *
104
+ * @type {(string|Function)[]}
105
+ * @default []
106
+ */
107
+ use: ['nib'],
108
+
109
+ /**
110
+ * Add path(s) to the import lookup paths.
111
+ *
112
+ * @type {string[]}
113
+ * @default []
114
+ */
115
+ include: [path.join(__dirname, 'src/styl/config')],
116
+
117
+ /**
118
+ * Import the specified Stylus files/paths.
119
+ *
120
+ * @type {string[]}
121
+ * @default []
122
+ */
123
+ import: ['nib', path.join(__dirname, 'src/styl/mixins')],
124
+
125
+ /**
126
+ * Define Stylus variables or functions.
127
+ *
128
+ * @type {Array|Object}
129
+ * @default {}
130
+ */
131
+ // Array is the recommended syntax: [key, value, raw]
132
+ define: [
133
+ ['$development', process.env.NODE_ENV === 'development'],
134
+ ['rawVar', 42, true],
135
+ ],
136
+ // Object is deprecated syntax (there is no possibility to specify "raw')
137
+ // define: {
138
+ // $development: process.env.NODE_ENV === 'development',
139
+ // rawVar: 42,
140
+ // },
141
+
142
+ /**
143
+ * Include regular CSS on @import.
144
+ *
145
+ * @type {boolean}
146
+ * @default false
147
+ */
148
+ includeCSS: false,
149
+
150
+ /**
151
+ * Emits comments in the generated CSS indicating the corresponding Stylus line.
152
+ *
153
+ * @see https://stylus-lang.com/docs/executable.html
154
+ *
155
+ * @type {boolean}
156
+ * @default false
157
+ */
158
+ lineNumbers: true,
159
+
160
+ /**
161
+ * Move @import and @charset to the top.
162
+ *
163
+ * @see https://stylus-lang.com/docs/executable.html
164
+ *
165
+ * @type {boolean}
166
+ * @default false
167
+ */
168
+ hoistAtrules: true,
169
+ },
170
+ additionalData: '', // {String|Function}
171
+ },
172
+ },
173
+ }
174
+ ```
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "stylelint-config-taro-rn",
3
+ "rules": {}
4
+ }
@@ -0,0 +1,8 @@
1
+ import { TransformOptions } from './types';
2
+ export declare function transform(src: string, filename: string, options: TransformOptions): Promise<any>;
3
+ export declare function rollupTransform(options: TransformOptions): {
4
+ name: string;
5
+ transform(src: string, filename: string): Promise<{
6
+ code: string;
7
+ } | undefined>;
8
+ };
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.transform = transform;
40
+ exports.rollupTransform = rollupTransform;
41
+ const path = __importStar(require("node:path"));
42
+ const transforms_1 = __importDefault(require("./transforms"));
43
+ const RN_CSS_EXT = ['.css', '.scss', '.sass', '.less', '.styl', '.stylus'];
44
+ const upstreamTransformer = require('@react-native/metro-babel-transformer');
45
+ const getSingleStyleTransform = styleTransformIns();
46
+ function styleTransformIns() {
47
+ let styleTransform = null;
48
+ return function (config) {
49
+ // 初始化 config
50
+ if (!styleTransform) {
51
+ styleTransform = new transforms_1.default(config);
52
+ }
53
+ return styleTransform;
54
+ };
55
+ }
56
+ async function transform(src, filename, options) {
57
+ if (typeof src === 'object') {
58
+ // handle RN >= 0.46
59
+ ({ src, filename, options } = src);
60
+ }
61
+ const ext = path.extname(filename);
62
+ if (RN_CSS_EXT.includes(ext)) {
63
+ const styleTransform = getSingleStyleTransform(options.config || {});
64
+ const styles = await styleTransform.transform(src, filename, options);
65
+ return upstreamTransformer.transform({
66
+ src: styles,
67
+ filename,
68
+ options
69
+ });
70
+ }
71
+ return upstreamTransformer.transform({ src, filename, options });
72
+ }
73
+ function rollupTransform(options) {
74
+ return {
75
+ name: 'rn-style-transformer', // this name will show up in warnings and errors
76
+ async transform(src, filename) {
77
+ const ext = path.extname(filename);
78
+ if (RN_CSS_EXT.includes(ext)) {
79
+ const styleTransform = getSingleStyleTransform(options.config || {});
80
+ const code = await styleTransform.transform(src, filename, options);
81
+ return { code };
82
+ }
83
+ }
84
+ };
85
+ }
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;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,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,yBAAiC,OAAyB;IACxD,OAAO;QACL,IAAI,EAAE,sBAAsB,EAAE,gDAAgD;QAC9E,KAAK,CAAC,SAAS,CAAE,GAAW,EAAE,QAAgB;YAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YAClC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,cAAc,GAAG,uBAAuB,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;gBACpE,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;gBACnE,OAAO,EAAE,IAAI,EAAE,CAAA;YACjB,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+ declare const ColorPropType: (props: any, propName: any, componentName: any, location: any, propFullName: any) => Error | undefined;
10
+ export default ColorPropType;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+ 'use strict';
10
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ const normalizeColor_1 = __importDefault(require("./normalizeColor"));
15
+ const colorPropType = function (
16
+ // @ts-ignore
17
+ isRequired,
18
+ // @ts-ignore
19
+ props,
20
+ // @ts-ignore
21
+ propName,
22
+ // @ts-ignore
23
+ componentName,
24
+ // @ts-ignore
25
+ location,
26
+ // @ts-ignore
27
+ propFullName) {
28
+ const color = props[propName];
29
+ if (color === undefined || color === null) {
30
+ if (isRequired) {
31
+ return new Error('Required ' +
32
+ location +
33
+ ' `' +
34
+ (propFullName || propName) +
35
+ '` was not specified in `' +
36
+ componentName +
37
+ '`.');
38
+ }
39
+ return;
40
+ }
41
+ if (typeof color === 'number') {
42
+ // Developers should not use a number, but we are using the prop type
43
+ // both for user provided colors and for transformed ones. This isn't ideal
44
+ // and should be fixed but will do for now...
45
+ return;
46
+ }
47
+ if ((0, normalizeColor_1.default)(color) === null) {
48
+ return new Error('Invalid ' +
49
+ location +
50
+ ' `' +
51
+ (propFullName || propName) +
52
+ '` supplied to `' +
53
+ componentName +
54
+ '`: ' +
55
+ color +
56
+ '\n' +
57
+ `Valid color formats are
58
+ - '#f0f' (#rgb)
59
+ - '#f0fc' (#rgba)
60
+ - '#ff00ff' (#rrggbb)
61
+ - '#ff00ff00' (#rrggbbaa)
62
+ - 'rgb(255, 255, 255)'
63
+ - 'rgba(255, 255, 255, 1.0)'
64
+ - 'hsl(360, 100%, 100%)'
65
+ - 'hsla(360, 100%, 100%, 1.0)'
66
+ - 'transparent'
67
+ - 'red'
68
+ - 0xff00ff00 (0xrrggbbaa)
69
+ `);
70
+ }
71
+ };
72
+ const ColorPropType = colorPropType.bind(null, false /* isRequired */);
73
+ // @ts-ignore
74
+ ColorPropType.isRequired = colorPropType.bind(null, true /* isRequired */);
75
+ exports.default = ColorPropType;
76
+ //# sourceMappingURL=ColorPropType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorPropType.js","sourceRoot":"","sources":["../../../src/transforms/StyleSheet/ColorPropType.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,CAAA;;;;;AAEZ,sEAA6C;AAC7C,MAAM,aAAa,GAAG;AACpB,aAAa;AACb,UAAU;AACV,aAAa;AACb,KAAK;AACL,aAAa;AACb,QAAQ;AACR,aAAa;AACb,aAAa;AACb,aAAa;AACb,QAAQ;AACR,aAAa;AACb,YAAY;IAEZ,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC7B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,IAAI,KAAK,CACd,WAAW;gBACT,QAAQ;gBACR,IAAI;gBACJ,CAAC,YAAY,IAAI,QAAQ,CAAC;gBAC1B,0BAA0B;gBAC1B,aAAa;gBACb,IAAI,CACP,CAAA;QACH,CAAC;QACD,OAAM;IACR,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,qEAAqE;QACrE,2EAA2E;QAC3E,6CAA6C;QAC7C,OAAM;IACR,CAAC;IAED,IAAI,IAAA,wBAAc,EAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QACnC,OAAO,IAAI,KAAK,CACd,UAAU;YACR,QAAQ;YACR,IAAI;YACJ,CAAC,YAAY,IAAI,QAAQ,CAAC;YAC1B,iBAAiB;YACjB,aAAa;YACb,KAAK;YACL,KAAK;YACL,IAAI;YACJ;;;;;;;;;;;;CAYP,CACI,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;AACtE,aAAa;AACb,aAAa,CAAC,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;kBAE3D,aAAa"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ImageResizeMode - Enum for different image resizing modes, set via
3
+ * `resizeMode` style property on `<Image>` components.
4
+ */
5
+ declare const ImageResizeMode: any;
6
+ export default ImageResizeMode;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /**
7
+ * Copyright (c) 2015-present, Facebook, Inc.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ *
12
+ *
13
+ * @format
14
+ */
15
+ /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
16
+ * found when Flow v0.54 was deployed. To see the error delete this comment and
17
+ * run Flow. */
18
+ // @ts-ignore
19
+ const keyMirror_1 = __importDefault(require("fbjs/lib/keyMirror"));
20
+ /**
21
+ * ImageResizeMode - Enum for different image resizing modes, set via
22
+ * `resizeMode` style property on `<Image>` components.
23
+ */
24
+ const ImageResizeMode = (0, keyMirror_1.default)({
25
+ /**
26
+ * contain - The image will be resized such that it will be completely
27
+ * visible, contained within the frame of the View.
28
+ */
29
+ contain: null,
30
+ /**
31
+ * cover - The image will be resized such that the entire area of the view
32
+ * is covered by the image, potentially clipping parts of the image.
33
+ */
34
+ cover: null,
35
+ /**
36
+ * stretch - The image will be stretched to fill the entire frame of the
37
+ * view without clipping. This may change the aspect ratio of the image,
38
+ * distorting it.
39
+ */
40
+ stretch: null,
41
+ /**
42
+ * center - The image will be scaled down such that it is completely visible,
43
+ * if bigger than the area of the view.
44
+ * The image will not be scaled up.
45
+ */
46
+ center: null,
47
+ /**
48
+ * repeat - The image will be repeated to cover the frame of the View. The
49
+ * image will keep it's size and aspect ratio.
50
+ */
51
+ repeat: null
52
+ });
53
+ exports.default = ImageResizeMode;
54
+ //# sourceMappingURL=ImageResizeMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageResizeMode.js","sourceRoot":"","sources":["../../../src/transforms/StyleSheet/ImageResizeMode.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;GAQG;AACH;;eAEe;AACf,aAAa;AACb,mEAA0C;AAE1C;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAA,mBAAS,EAAC;IAChC;;;OAGG;IACH,OAAO,EAAE,IAAI;IACb;;;OAGG;IACH,KAAK,EAAE,IAAI;IACX;;;;OAIG;IACH,OAAO,EAAE,IAAI;IACb;;;;OAIG;IACH,MAAM,EAAE,IAAI;IAEZ;;;OAGG;IACH,MAAM,EAAE,IAAI;CACb,CAAC,CAAA;kBAEa,eAAe"}
@@ -0,0 +1,106 @@
1
+ declare const ImageStylePropTypes: {
2
+ display: any;
3
+ width: any;
4
+ height: any;
5
+ start: any;
6
+ end: any;
7
+ top: any;
8
+ left: any;
9
+ right: any;
10
+ bottom: any;
11
+ minWidth: any;
12
+ maxWidth: any;
13
+ minHeight: any;
14
+ maxHeight: any;
15
+ margin: any;
16
+ marginVertical: any;
17
+ marginHorizontal: any;
18
+ marginTop: any;
19
+ marginBottom: any;
20
+ marginLeft: any;
21
+ marginRight: any;
22
+ marginStart: any;
23
+ marginEnd: any;
24
+ padding: any;
25
+ paddingVertical: any;
26
+ paddingHorizontal: any;
27
+ paddingTop: any;
28
+ paddingBottom: any;
29
+ paddingLeft: any;
30
+ paddingRight: any;
31
+ paddingStart: any;
32
+ paddingEnd: any;
33
+ borderTopWidth: any;
34
+ borderStartWidth: any;
35
+ borderEndWidth: any;
36
+ borderRightWidth: any;
37
+ borderBottomWidth: any;
38
+ borderLeftWidth: any;
39
+ position: any;
40
+ flexDirection: any;
41
+ flexWrap: any;
42
+ justifyContent: any;
43
+ alignItems: any;
44
+ alignSelf: any;
45
+ alignContent: any;
46
+ flex: any;
47
+ flexGrow: any;
48
+ flexShrink: any;
49
+ flexBasis: any;
50
+ aspectRatio: any;
51
+ zIndex: any;
52
+ direction: any;
53
+ rowGap: any;
54
+ columnGap: any;
55
+ gap: any;
56
+ shadowColor: (props: any, propName: any, componentName: any, location: any, propFullName: any) => Error | undefined;
57
+ shadowOffset: any;
58
+ shadowOpacity: any;
59
+ shadowRadius: any;
60
+ transform: any;
61
+ transformOrigin: any;
62
+ transformMatrix: (props: any, propName: any, _componentName: any) => Error | undefined;
63
+ decomposedMatrix: (props: any, propName: any, _componentName: any) => Error | undefined;
64
+ scaleX: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
65
+ scaleY: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
66
+ rotation: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
67
+ translateX: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
68
+ translateY: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
69
+ resizeMode: any;
70
+ backfaceVisibility: any;
71
+ backgroundColor: (props: any, propName: any, componentName: any, location: any, propFullName: any) => Error | undefined;
72
+ borderColor: (props: any, propName: any, componentName: any, location: any, propFullName: any) => Error | undefined;
73
+ borderWidth: any;
74
+ borderRadius: any;
75
+ cursor: any;
76
+ overflow: any;
77
+ objectFit: any;
78
+ /**
79
+ * Changes the color of all the non-transparent pixels to the tintColor.
80
+ */
81
+ tintColor: (props: any, propName: any, componentName: any, location: any, propFullName: any) => Error | undefined;
82
+ opacity: any;
83
+ /**
84
+ * When the image has rounded corners, specifying an overlayColor will
85
+ * cause the remaining space in the corners to be filled with a solid color.
86
+ * This is useful in cases which are not supported by the Android
87
+ * implementation of rounded corners:
88
+ * - Certain resize modes, such as 'contain'
89
+ * - Animated GIFs
90
+ *
91
+ * A typical way to use this prop is with images displayed on a solid
92
+ * background and setting the `overlayColor` to the same color
93
+ * as the background.
94
+ *
95
+ * For details of how this works under the hood, see
96
+ * http://frescolib.org/docs/rounded-corners-and-circles.html
97
+ *
98
+ * @platform android
99
+ */
100
+ overlayColor: any;
101
+ borderTopLeftRadius: any;
102
+ borderTopRightRadius: any;
103
+ borderBottomLeftRadius: any;
104
+ borderBottomRightRadius: any;
105
+ };
106
+ export default ImageStylePropTypes;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ * @format
9
+ */
10
+ 'use strict';
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ // @ts-ignore
49
+ const ReactPropTypes = __importStar(require("prop-types"));
50
+ const ColorPropType_1 = __importDefault(require("./ColorPropType"));
51
+ const ImageResizeMode_1 = __importDefault(require("./ImageResizeMode"));
52
+ const LayoutPropTypes_1 = __importDefault(require("./LayoutPropTypes"));
53
+ const ShadowPropTypesIOS_1 = __importDefault(require("./ShadowPropTypesIOS"));
54
+ const TransformPropTypes_1 = __importDefault(require("./TransformPropTypes"));
55
+ const ImageStylePropTypes = Object.assign(Object.assign(Object.assign(Object.assign({}, LayoutPropTypes_1.default), ShadowPropTypesIOS_1.default), TransformPropTypes_1.default), { resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode_1.default)), backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']), backgroundColor: ColorPropType_1.default, borderColor: ColorPropType_1.default, borderWidth: ReactPropTypes.number, borderRadius: ReactPropTypes.number, cursor: ReactPropTypes.oneOf(['auto', 'pointer']), overflow: ReactPropTypes.oneOf(['visible', 'hidden']), objectFit: ReactPropTypes.oneOf(['cover', 'contain', 'fill', 'scale-down']),
56
+ /**
57
+ * Changes the color of all the non-transparent pixels to the tintColor.
58
+ */
59
+ tintColor: ColorPropType_1.default, opacity: ReactPropTypes.number,
60
+ /**
61
+ * When the image has rounded corners, specifying an overlayColor will
62
+ * cause the remaining space in the corners to be filled with a solid color.
63
+ * This is useful in cases which are not supported by the Android
64
+ * implementation of rounded corners:
65
+ * - Certain resize modes, such as 'contain'
66
+ * - Animated GIFs
67
+ *
68
+ * A typical way to use this prop is with images displayed on a solid
69
+ * background and setting the `overlayColor` to the same color
70
+ * as the background.
71
+ *
72
+ * For details of how this works under the hood, see
73
+ * http://frescolib.org/docs/rounded-corners-and-circles.html
74
+ *
75
+ * @platform android
76
+ */
77
+ overlayColor: ReactPropTypes.string,
78
+ // Android-Specific styles
79
+ borderTopLeftRadius: ReactPropTypes.number, borderTopRightRadius: ReactPropTypes.number, borderBottomLeftRadius: ReactPropTypes.number, borderBottomRightRadius: ReactPropTypes.number });
80
+ exports.default = ImageStylePropTypes;
81
+ //# sourceMappingURL=ImageStylePropTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageStylePropTypes.js","sourceRoot":"","sources":["../../../src/transforms/StyleSheet/ImageStylePropTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ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