@dcloudio/uni-nvue-styler 0.0.1-nvue3.3030820220125001

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 (59) hide show
  1. package/dist/expand/background.d.ts +2 -0
  2. package/dist/expand/background.js +15 -0
  3. package/dist/expand/border.d.ts +2 -0
  4. package/dist/expand/border.js +21 -0
  5. package/dist/expand/borderColor.d.ts +2 -0
  6. package/dist/expand/borderColor.js +26 -0
  7. package/dist/expand/borderRadius.d.ts +2 -0
  8. package/dist/expand/borderRadius.js +28 -0
  9. package/dist/expand/borderStyle.d.ts +1 -0
  10. package/dist/expand/borderStyle.js +5 -0
  11. package/dist/expand/borderWidth.d.ts +1 -0
  12. package/dist/expand/borderWidth.js +5 -0
  13. package/dist/expand/flexFlow.d.ts +2 -0
  14. package/dist/expand/flexFlow.js +23 -0
  15. package/dist/expand/font.d.ts +2 -0
  16. package/dist/expand/font.js +37 -0
  17. package/dist/expand/index.d.ts +2 -0
  18. package/dist/expand/index.js +50 -0
  19. package/dist/expand/margin.d.ts +3 -0
  20. package/dist/expand/margin.js +29 -0
  21. package/dist/expand/padding.d.ts +1 -0
  22. package/dist/expand/padding.js +5 -0
  23. package/dist/expand/transition.d.ts +2 -0
  24. package/dist/expand/transition.js +23 -0
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +11 -0
  27. package/dist/normalize/color.d.ts +2 -0
  28. package/dist/normalize/color.js +217 -0
  29. package/dist/normalize/enum.d.ts +2 -0
  30. package/dist/normalize/enum.js +37 -0
  31. package/dist/normalize/flexWrap.d.ts +2 -0
  32. package/dist/normalize/flexWrap.js +43 -0
  33. package/dist/normalize/index.d.ts +12 -0
  34. package/dist/normalize/index.js +116 -0
  35. package/dist/normalize/integer.d.ts +2 -0
  36. package/dist/normalize/integer.js +21 -0
  37. package/dist/normalize/length.d.ts +2 -0
  38. package/dist/normalize/length.js +42 -0
  39. package/dist/normalize/map.d.ts +2 -0
  40. package/dist/normalize/map.js +141 -0
  41. package/dist/normalize/number.d.ts +2 -0
  42. package/dist/normalize/number.js +22 -0
  43. package/dist/normalize/shorthandLength.d.ts +2 -0
  44. package/dist/normalize/shorthandLength.js +32 -0
  45. package/dist/normalize/transform.d.ts +2 -0
  46. package/dist/normalize/transform.js +7 -0
  47. package/dist/normalize/transitionInterval.d.ts +2 -0
  48. package/dist/normalize/transitionInterval.js +34 -0
  49. package/dist/normalize/transitionProperty.d.ts +2 -0
  50. package/dist/normalize/transitionProperty.js +26 -0
  51. package/dist/normalize/transitionTimingFunction.d.ts +2 -0
  52. package/dist/normalize/transitionTimingFunction.js +36 -0
  53. package/dist/objectifier.d.ts +2 -0
  54. package/dist/objectifier.js +69 -0
  55. package/dist/parse.d.ts +10 -0
  56. package/dist/parse.js +32 -0
  57. package/dist/utils.d.ts +24 -0
  58. package/dist/utils.js +49 -0
  59. package/package.json +23 -0
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformBackground: TransformDecl;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBackground = void 0;
4
+ const utils_1 = require("../utils");
5
+ const transformBackground = (decl) => {
6
+ const { value, important, raws, source } = decl;
7
+ if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) {
8
+ return [(0, utils_1.createDecl)('background-color', value, important, raws, source)];
9
+ }
10
+ else if (/^linear-gradient(.+)$/.test(value)) {
11
+ return [(0, utils_1.createDecl)('background-image', value, important, raws, source)];
12
+ }
13
+ return [decl];
14
+ };
15
+ exports.transformBackground = transformBackground;
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformBorder: TransformDecl;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBorder = void 0;
4
+ const utils_1 = require("../utils");
5
+ const transformBorder = (decl) => {
6
+ const { prop, value, important, raws, source } = decl;
7
+ const splitResult = value.replace(/\s*,\s*/g, ',').split(/\s+/);
8
+ const result = [/^[\d\.]+\S*$/, /^(solid|dashed|dotted)$/, /\S+/].map((item) => {
9
+ const index = splitResult.findIndex((str) => item.test(str));
10
+ return index < 0 ? null : splitResult.splice(index, 1)[0];
11
+ });
12
+ if (splitResult.length) {
13
+ return [decl];
14
+ }
15
+ return [
16
+ (0, utils_1.createDecl)(prop + '-width', (result[0] || '0').trim(), important, raws, source),
17
+ (0, utils_1.createDecl)(prop + '-style', (result[1] || 'solid').trim(), important, raws, source),
18
+ (0, utils_1.createDecl)(prop + '-color', (result[2] || '#000000').trim(), important, raws, source),
19
+ ];
20
+ };
21
+ exports.transformBorder = transformBorder;
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformBorderColor: TransformDecl;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBorderColor = void 0;
4
+ const utils_1 = require("../utils");
5
+ const transformBorderColor = (decl) => {
6
+ const { prop, value, important, raws, source } = decl;
7
+ const property = prop.split('-')[1];
8
+ const splitResult = value.replace(/\s*,\s*/g, ',').split(/\s+/);
9
+ switch (splitResult.length) {
10
+ case 1:
11
+ return [decl];
12
+ case 2:
13
+ splitResult.push(splitResult[0], splitResult[1]);
14
+ break;
15
+ case 3:
16
+ splitResult.push(splitResult[1]);
17
+ break;
18
+ }
19
+ return [
20
+ (0, utils_1.createDecl)('border-top-' + property, splitResult[0], important, raws, source),
21
+ (0, utils_1.createDecl)('border-right-' + property, splitResult[1], important, raws, source),
22
+ (0, utils_1.createDecl)('border-bottom-' + property, splitResult[2], important, raws, source),
23
+ (0, utils_1.createDecl)('border-left-' + property, splitResult[3], important, raws, source),
24
+ ];
25
+ };
26
+ exports.transformBorderColor = transformBorderColor;
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformBorderRadius: TransformDecl;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBorderRadius = void 0;
4
+ const utils_1 = require("../utils");
5
+ const transformBorderRadius = (decl) => {
6
+ const { value, important, raws, source } = decl;
7
+ const splitResult = value.split(/\s+/);
8
+ if (value.includes('/')) {
9
+ return [decl];
10
+ }
11
+ switch (splitResult.length) {
12
+ case 1:
13
+ return [decl];
14
+ case 2:
15
+ splitResult.push(splitResult[0], splitResult[1]);
16
+ break;
17
+ case 3:
18
+ splitResult.push(splitResult[1]);
19
+ break;
20
+ }
21
+ return [
22
+ (0, utils_1.createDecl)('border-top-left-radius', splitResult[0], important, raws, source),
23
+ (0, utils_1.createDecl)('border-top-right-radius', splitResult[1], important, raws, source),
24
+ (0, utils_1.createDecl)('border-bottom-right-radius', splitResult[2], important, raws, source),
25
+ (0, utils_1.createDecl)('border-bottom-left-radius', splitResult[3], important, raws, source),
26
+ ];
27
+ };
28
+ exports.transformBorderRadius = transformBorderRadius;
@@ -0,0 +1 @@
1
+ export declare const transformBorderStyle: import("../utils").TransformDecl;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBorderStyle = void 0;
4
+ const borderColor_1 = require("./borderColor");
5
+ exports.transformBorderStyle = borderColor_1.transformBorderColor;
@@ -0,0 +1 @@
1
+ export declare const transformBorderWidth: import("../utils").TransformDecl;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBorderWidth = void 0;
4
+ const borderColor_1 = require("./borderColor");
5
+ exports.transformBorderWidth = borderColor_1.transformBorderColor;
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformFlexFlow: TransformDecl;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformFlexFlow = void 0;
4
+ const utils_1 = require("../utils");
5
+ const transformFlexFlow = (decl) => {
6
+ const { value, important, raws, source } = decl;
7
+ const splitResult = value.split(/\s+/);
8
+ const result = [
9
+ /^(column|column-reverse|row|row-reverse)$/,
10
+ /^(nowrap|wrap|wrap-reverse)$/,
11
+ ].map((item) => {
12
+ const index = splitResult.findIndex((str) => item.test(str));
13
+ return index < 0 ? null : splitResult.splice(index, 1)[0];
14
+ });
15
+ if (splitResult.length) {
16
+ return [decl];
17
+ }
18
+ return [
19
+ (0, utils_1.createDecl)('flex-direction', result[0] || 'column', important, raws, source),
20
+ (0, utils_1.createDecl)('flex-wrap', result[1] || 'nowrap', important, raws, source),
21
+ ];
22
+ };
23
+ exports.transformFlexFlow = transformFlexFlow;
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformFont: TransformDecl;
@@ -0,0 +1,37 @@
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
+ exports.transformFont = void 0;
7
+ const parse_css_font_1 = __importDefault(require("parse-css-font"));
8
+ const utils_1 = require("../utils");
9
+ const transformFont = (decl) => {
10
+ const { value, important, raws, source } = decl;
11
+ const result = [];
12
+ const font = (0, parse_css_font_1.default)(value);
13
+ if (font.system) {
14
+ return result;
15
+ }
16
+ const { style, weight, size, lineHeight, family } = font;
17
+ if (style) {
18
+ result.push((0, utils_1.createDecl)('font-style', style, important, raws, source));
19
+ }
20
+ if (weight) {
21
+ result.push((0, utils_1.createDecl)('font-weight', weight, important, raws, source));
22
+ }
23
+ if (size) {
24
+ result.push((0, utils_1.createDecl)('font-size', size, important, raws, source));
25
+ }
26
+ if (lineHeight) {
27
+ result.push((0, utils_1.createDecl)('line-height', lineHeight, important, raws, source));
28
+ }
29
+ if (family) {
30
+ result.push((0, utils_1.createDecl)('font-family', serialize(family), important, raws, source));
31
+ }
32
+ return result;
33
+ };
34
+ exports.transformFont = transformFont;
35
+ function serialize(family) {
36
+ return family.map((f) => (f.includes(' ') ? `"${f}"` : f)).join(', ');
37
+ }
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'postcss';
2
+ export declare const expand: Plugin;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expand = void 0;
4
+ const background_1 = require("./background");
5
+ const border_1 = require("./border");
6
+ const borderColor_1 = require("./borderColor");
7
+ const borderRadius_1 = require("./borderRadius");
8
+ const borderStyle_1 = require("./borderStyle");
9
+ const borderWidth_1 = require("./borderWidth");
10
+ const flexFlow_1 = require("./flexFlow");
11
+ const font_1 = require("./font");
12
+ const margin_1 = require("./margin");
13
+ const padding_1 = require("./padding");
14
+ const transition_1 = require("./transition");
15
+ const DeclTransforms = {
16
+ transition: transition_1.transformTransition,
17
+ margin: margin_1.transformMargin,
18
+ padding: padding_1.transformPadding,
19
+ border: border_1.transformBorder,
20
+ 'border-top': border_1.transformBorder,
21
+ 'border-right': border_1.transformBorder,
22
+ 'border-bottom': border_1.transformBorder,
23
+ 'border-left': border_1.transformBorder,
24
+ 'border-style': borderStyle_1.transformBorderStyle,
25
+ 'border-width': borderWidth_1.transformBorderWidth,
26
+ 'border-color': borderColor_1.transformBorderColor,
27
+ 'border-radius': borderRadius_1.transformBorderRadius,
28
+ 'flex-flow': flexFlow_1.transformFlexFlow,
29
+ font: font_1.transformFont,
30
+ background: background_1.transformBackground,
31
+ };
32
+ const expanded = Symbol('expanded');
33
+ exports.expand = {
34
+ postcssPlugin: 'nvue:expand',
35
+ Declaration(decl) {
36
+ if (decl[expanded]) {
37
+ return;
38
+ }
39
+ const transform = DeclTransforms[decl.prop];
40
+ if (transform) {
41
+ const res = transform(decl);
42
+ const isSame = res.length === 1 && res[0] === decl;
43
+ if (!isSame) {
44
+ decl.replaceWith(res);
45
+ }
46
+ }
47
+ ;
48
+ decl[expanded] = true;
49
+ },
50
+ };
@@ -0,0 +1,3 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const createTransformBox: (type: 'margin' | 'padding') => TransformDecl;
3
+ export declare const transformMargin: TransformDecl;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformMargin = exports.createTransformBox = void 0;
4
+ const utils_1 = require("../utils");
5
+ const createTransformBox = (type) => {
6
+ return (decl) => {
7
+ const { value, important, raws, source } = decl;
8
+ const splitResult = value.split(/\s+/);
9
+ switch (splitResult.length) {
10
+ case 1:
11
+ splitResult.push(splitResult[0], splitResult[0], splitResult[0]);
12
+ break;
13
+ case 2:
14
+ splitResult.push(splitResult[0], splitResult[1]);
15
+ break;
16
+ case 3:
17
+ splitResult.push(splitResult[1]);
18
+ break;
19
+ }
20
+ return [
21
+ (0, utils_1.createDecl)(`${type}-top`, splitResult[0], important, raws, source),
22
+ (0, utils_1.createDecl)(`${type}-right`, splitResult[1], important, raws, source),
23
+ (0, utils_1.createDecl)(`${type}-bottom`, splitResult[2], important, raws, source),
24
+ (0, utils_1.createDecl)(`${type}-left`, splitResult[3], important, raws, source),
25
+ ];
26
+ };
27
+ };
28
+ exports.createTransformBox = createTransformBox;
29
+ exports.transformMargin = (0, exports.createTransformBox)('margin');
@@ -0,0 +1 @@
1
+ export declare const transformPadding: import("../utils").TransformDecl;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformPadding = void 0;
4
+ const margin_1 = require("./margin");
5
+ exports.transformPadding = (0, margin_1.createTransformBox)('padding');
@@ -0,0 +1,2 @@
1
+ import { TransformDecl } from '../utils';
2
+ export declare const transformTransition: TransformDecl;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformTransition = void 0;
4
+ const utils_1 = require("../utils");
5
+ const transformTransition = (decl) => {
6
+ const CHUNK_REGEXP = /^(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?\s*(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?$/;
7
+ const { value, important, raws, source } = decl;
8
+ const result = [];
9
+ const match = value.match(CHUNK_REGEXP);
10
+ if (!match) {
11
+ return result;
12
+ }
13
+ match[1] &&
14
+ result.push((0, utils_1.createDecl)('transition-property', match[1], important, raws, source));
15
+ match[2] &&
16
+ result.push((0, utils_1.createDecl)('transition-duration', match[2], important, raws, source));
17
+ match[3] &&
18
+ result.push((0, utils_1.createDecl)('transition-timing-function', match[3], important, raws, source));
19
+ match[4] &&
20
+ result.push((0, utils_1.createDecl)('transition-delay', match[4], important, raws, source));
21
+ return result;
22
+ };
23
+ exports.transformTransition = transformTransition;
@@ -0,0 +1,4 @@
1
+ export { expand } from './expand';
2
+ export { normalize } from './normalize';
3
+ export { objectifier } from './objectifier';
4
+ export { parse } from './parse';
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parse = exports.objectifier = exports.normalize = exports.expand = void 0;
4
+ var expand_1 = require("./expand");
5
+ Object.defineProperty(exports, "expand", { enumerable: true, get: function () { return expand_1.expand; } });
6
+ var normalize_1 = require("./normalize");
7
+ Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return normalize_1.normalize; } });
8
+ var objectifier_1 = require("./objectifier");
9
+ Object.defineProperty(exports, "objectifier", { enumerable: true, get: function () { return objectifier_1.objectifier; } });
10
+ var parse_1 = require("./parse");
11
+ Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
@@ -0,0 +1,2 @@
1
+ import { Normalize } from '../utils';
2
+ export declare const normalizeColor: Normalize;
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeColor = void 0;
4
+ const utils_1 = require("../utils");
5
+ const normalizeColor = (v) => {
6
+ v = (v || '').toString();
7
+ if (v.match(/^#[0-9a-fA-F]{6}$/)) {
8
+ return { value: v };
9
+ }
10
+ if (v.match(/^#[0-9a-fA-F]{3}$/)) {
11
+ return {
12
+ value: '#' + v[1] + v[1] + v[2] + v[2] + v[3] + v[3],
13
+ reason: function reason(k, v, result) {
14
+ return ('NOTE: property value `' + v + '` is autofixed to `' + result + '`');
15
+ },
16
+ };
17
+ }
18
+ if (EXTENDED_COLOR_KEYWORDS[v]) {
19
+ return {
20
+ value: EXTENDED_COLOR_KEYWORDS[v],
21
+ reason: function reason(k, v, result) {
22
+ return ('NOTE: property value `' + v + '` is autofixed to `' + result + '`');
23
+ },
24
+ };
25
+ }
26
+ let arrColor, r, g, b, a;
27
+ const RGB_REGEXP = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/gi;
28
+ const RGBA_REGEXP = /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/gi;
29
+ if ((arrColor = RGB_REGEXP.exec(v))) {
30
+ r = parseInt(arrColor[1]);
31
+ g = parseInt(arrColor[2]);
32
+ b = parseInt(arrColor[3]);
33
+ if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255) {
34
+ return { value: 'rgb(' + [r, g, b].join(',') + ')' };
35
+ }
36
+ }
37
+ if ((arrColor = RGBA_REGEXP.exec(v))) {
38
+ r = parseInt(arrColor[1]);
39
+ g = parseInt(arrColor[2]);
40
+ b = parseInt(arrColor[3]);
41
+ a = parseFloat(arrColor[4]);
42
+ if (r >= 0 &&
43
+ r <= 255 &&
44
+ g >= 0 &&
45
+ g <= 255 &&
46
+ b >= 0 &&
47
+ b <= 255 &&
48
+ a >= 0 &&
49
+ a <= 1) {
50
+ return { value: 'rgba(' + [r, g, b, a].join(',') + ')' };
51
+ }
52
+ }
53
+ if (v === 'transparent') {
54
+ return { value: 'rgba(0,0,0,0)' };
55
+ }
56
+ return {
57
+ value: null,
58
+ reason(k, v, result) {
59
+ return ('ERROR: property value `' +
60
+ v +
61
+ '` is not valid for `' +
62
+ (0, utils_1.hyphenate)(k) +
63
+ '`');
64
+ },
65
+ };
66
+ };
67
+ exports.normalizeColor = normalizeColor;
68
+ // http://www.w3.org/TR/css3-color/#svg-color
69
+ const EXTENDED_COLOR_KEYWORDS = {
70
+ aliceblue: '#F0F8FF',
71
+ antiquewhite: '#FAEBD7',
72
+ aqua: '#00FFFF',
73
+ aquamarine: '#7FFFD4',
74
+ azure: '#F0FFFF',
75
+ beige: '#F5F5DC',
76
+ bisque: '#FFE4C4',
77
+ black: '#000000',
78
+ blanchedalmond: '#FFEBCD',
79
+ blue: '#0000FF',
80
+ blueviolet: '#8A2BE2',
81
+ brown: '#A52A2A',
82
+ burlywood: '#DEB887',
83
+ cadetblue: '#5F9EA0',
84
+ chartreuse: '#7FFF00',
85
+ chocolate: '#D2691E',
86
+ coral: '#FF7F50',
87
+ cornflowerblue: '#6495ED',
88
+ cornsilk: '#FFF8DC',
89
+ crimson: '#DC143C',
90
+ cyan: '#00FFFF',
91
+ darkblue: '#00008B',
92
+ darkcyan: '#008B8B',
93
+ darkgoldenrod: '#B8860B',
94
+ darkgray: '#A9A9A9',
95
+ darkgreen: '#006400',
96
+ darkgrey: '#A9A9A9',
97
+ darkkhaki: '#BDB76B',
98
+ darkmagenta: '#8B008B',
99
+ darkolivegreen: '#556B2F',
100
+ darkorange: '#FF8C00',
101
+ darkorchid: '#9932CC',
102
+ darkred: '#8B0000',
103
+ darksalmon: '#E9967A',
104
+ darkseagreen: '#8FBC8F',
105
+ darkslateblue: '#483D8B',
106
+ darkslategray: '#2F4F4F',
107
+ darkslategrey: '#2F4F4F',
108
+ darkturquoise: '#00CED1',
109
+ darkviolet: '#9400D3',
110
+ deeppink: '#FF1493',
111
+ deepskyblue: '#00BFFF',
112
+ dimgray: '#696969',
113
+ dimgrey: '#696969',
114
+ dodgerblue: '#1E90FF',
115
+ firebrick: '#B22222',
116
+ floralwhite: '#FFFAF0',
117
+ forestgreen: '#228B22',
118
+ fuchsia: '#FF00FF',
119
+ gainsboro: '#DCDCDC',
120
+ ghostwhite: '#F8F8FF',
121
+ gold: '#FFD700',
122
+ goldenrod: '#DAA520',
123
+ gray: '#808080',
124
+ green: '#008000',
125
+ greenyellow: '#ADFF2F',
126
+ grey: '#808080',
127
+ honeydew: '#F0FFF0',
128
+ hotpink: '#FF69B4',
129
+ indianred: '#CD5C5C',
130
+ indigo: '#4B0082',
131
+ ivory: '#FFFFF0',
132
+ khaki: '#F0E68C',
133
+ lavender: '#E6E6FA',
134
+ lavenderblush: '#FFF0F5',
135
+ lawngreen: '#7CFC00',
136
+ lemonchiffon: '#FFFACD',
137
+ lightblue: '#ADD8E6',
138
+ lightcoral: '#F08080',
139
+ lightcyan: '#E0FFFF',
140
+ lightgoldenrodyellow: '#FAFAD2',
141
+ lightgray: '#D3D3D3',
142
+ lightgreen: '#90EE90',
143
+ lightgrey: '#D3D3D3',
144
+ lightpink: '#FFB6C1',
145
+ lightsalmon: '#FFA07A',
146
+ lightseagreen: '#20B2AA',
147
+ lightskyblue: '#87CEFA',
148
+ lightslategray: '#778899',
149
+ lightslategrey: '#778899',
150
+ lightsteelblue: '#B0C4DE',
151
+ lightyellow: '#FFFFE0',
152
+ lime: '#00FF00',
153
+ limegreen: '#32CD32',
154
+ linen: '#FAF0E6',
155
+ magenta: '#FF00FF',
156
+ maroon: '#800000',
157
+ mediumaquamarine: '#66CDAA',
158
+ mediumblue: '#0000CD',
159
+ mediumorchid: '#BA55D3',
160
+ mediumpurple: '#9370DB',
161
+ mediumseagreen: '#3CB371',
162
+ mediumslateblue: '#7B68EE',
163
+ mediumspringgreen: '#00FA9A',
164
+ mediumturquoise: '#48D1CC',
165
+ mediumvioletred: '#C71585',
166
+ midnightblue: '#191970',
167
+ mintcream: '#F5FFFA',
168
+ mistyrose: '#FFE4E1',
169
+ moccasin: '#FFE4B5',
170
+ navajowhite: '#FFDEAD',
171
+ navy: '#000080',
172
+ oldlace: '#FDF5E6',
173
+ olive: '#808000',
174
+ olivedrab: '#6B8E23',
175
+ orange: '#FFA500',
176
+ orangered: '#FF4500',
177
+ orchid: '#DA70D6',
178
+ palegoldenrod: '#EEE8AA',
179
+ palegreen: '#98FB98',
180
+ paleturquoise: '#AFEEEE',
181
+ palevioletred: '#DB7093',
182
+ papayawhip: '#FFEFD5',
183
+ peachpuff: '#FFDAB9',
184
+ peru: '#CD853F',
185
+ pink: '#FFC0CB',
186
+ plum: '#DDA0DD',
187
+ powderblue: '#B0E0E6',
188
+ purple: '#800080',
189
+ red: '#FF0000',
190
+ rosybrown: '#BC8F8F',
191
+ royalblue: '#4169E1',
192
+ saddlebrown: '#8B4513',
193
+ salmon: '#FA8072',
194
+ sandybrown: '#F4A460',
195
+ seagreen: '#2E8B57',
196
+ seashell: '#FFF5EE',
197
+ sienna: '#A0522D',
198
+ silver: '#C0C0C0',
199
+ skyblue: '#87CEEB',
200
+ slateblue: '#6A5ACD',
201
+ slategray: '#708090',
202
+ slategrey: '#708090',
203
+ snow: '#FFFAFA',
204
+ springgreen: '#00FF7F',
205
+ steelblue: '#4682B4',
206
+ tan: '#D2B48C',
207
+ teal: '#008080',
208
+ thistle: '#D8BFD8',
209
+ tomato: '#FF6347',
210
+ turquoise: '#40E0D0',
211
+ violet: '#EE82EE',
212
+ wheat: '#F5DEB3',
213
+ white: '#FFFFFF',
214
+ whitesmoke: '#F5F5F5',
215
+ yellow: '#FFFF00',
216
+ yellowgreen: '#9ACD32',
217
+ };
@@ -0,0 +1,2 @@
1
+ import { Normalize } from '../utils';
2
+ export declare function createEnumNormalize(items: Array<string | number>): Normalize;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEnumNormalize = void 0;
4
+ const utils_1 = require("../utils");
5
+ function createEnumNormalize(items) {
6
+ return (v) => {
7
+ const index = items.indexOf(v);
8
+ if (index > 0) {
9
+ return { value: v };
10
+ }
11
+ if (index === 0) {
12
+ return {
13
+ value: v,
14
+ reason: function reason(k, v, result) {
15
+ return ('NOTE: property value `' +
16
+ v +
17
+ '` is the DEFAULT value for `' +
18
+ (0, utils_1.hyphenate)(k) +
19
+ '` (could be removed)');
20
+ },
21
+ };
22
+ }
23
+ return {
24
+ value: null,
25
+ reason: function reason(k, v, result) {
26
+ return ('ERROR: property value `' +
27
+ v +
28
+ '` is not supported for `' +
29
+ (0, utils_1.hyphenate)(k) +
30
+ '` (supported values are: `' +
31
+ items.join('`|`') +
32
+ '`)');
33
+ },
34
+ };
35
+ };
36
+ }
37
+ exports.createEnumNormalize = createEnumNormalize;
@@ -0,0 +1,2 @@
1
+ import { Normalize } from '../utils';
2
+ export declare const normalizeFlexWrap: Normalize;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeFlexWrap = void 0;
4
+ const utils_1 = require("../utils");
5
+ const normalizeFlexWrap = (v) => {
6
+ const values = ['nowrap', 'wrap', 'wrap-reverse'];
7
+ const index = values.indexOf(v);
8
+ if (index > 0) {
9
+ return {
10
+ value: v,
11
+ reason(k, v, result) {
12
+ return ('NOTE: the ' +
13
+ (0, utils_1.hyphenate)(k) +
14
+ ' property may have compatibility problem on native');
15
+ },
16
+ };
17
+ }
18
+ if (index === 0) {
19
+ return {
20
+ value: v,
21
+ reason: function reason(k, v, result) {
22
+ return ('NOTE: property value `' +
23
+ v +
24
+ '` is the DEFAULT value for `' +
25
+ (0, utils_1.hyphenate)(k) +
26
+ '` (could be removed)');
27
+ },
28
+ };
29
+ }
30
+ return {
31
+ value: null,
32
+ reason(k, v, result) {
33
+ return ('ERROR: property value `' +
34
+ v +
35
+ '` is not supported for `' +
36
+ (0, utils_1.hyphenate)(k) +
37
+ '` (supported values are: `' +
38
+ values.join('`|`') +
39
+ '`)');
40
+ },
41
+ };
42
+ };
43
+ exports.normalizeFlexWrap = normalizeFlexWrap;