snail.view 2.0.2 → 2.0.3

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.
@@ -33,60 +33,17 @@ function useCSS() {
33
33
  }
34
34
  function buildStyle(options) {
35
35
  const style = Object.create(null);
36
- if (!!!options) {
37
- return style;
38
- }
39
- {
40
- options.color != void 0 && (style.color = options.color);
41
- options.backgroundColor != void 0 && (style.backgroundColor = options.backgroundColor);
42
- options.textAlign != void 0 && (style.textAlign = options.textAlign);
43
- options.verticalAlign != void 0 && (style.verticalAlign = options.verticalAlign);
44
- options.justifyContent != void 0 && (style.justifyContent = options.justifyContent);
45
- options.alignItems != void 0 && (style.alignItems = options.alignItems);
46
- options.flex != void 0 && (style.flex = options.flex);
47
- options.flexBasis != void 0 && (style.flexBasis = options.flexBasis);
48
- options.flexGrow > 0 != void 0 && (style.flexGrow = String(options.flexGrow));
49
- options.flexShrink > 0 != void 0 && (style.flexShrink = String(options.flexShrink));
50
- options.order > 0 != void 0 && (style.order = String(options.order));
51
- options.alignSelf != void 0 && (style.alignSelf = options.alignSelf);
52
- options.left != void 0 && (style.left = options.left);
53
- options.right != void 0 && (style.right = options.right);
54
- options.top != void 0 && (style.top = options.top);
55
- options.bottom != void 0 && (style.bottom = options.bottom);
56
- options.overflow != void 0 && (style.overflow = options.overflow);
57
- options.overflowX != void 0 && (style.overflowX = options.overflowX);
58
- options.overflowY != void 0 && (style.overflowY = options.overflowY);
59
- }
60
- {
61
- options.width != void 0 && (style.width = options.width);
62
- options.minWidth != void 0 && (style.minWidth = options.minWidth);
63
- options.maxWidth != void 0 && (style.maxWidth = options.maxWidth);
64
- options.height != void 0 && (style.height = options.height);
65
- options.minHeight != void 0 && (style.minHeight = options.minHeight);
66
- options.maxHeight != void 0 && (style.maxHeight = options.maxHeight);
67
- options.margin != void 0 && (style.margin = options.margin);
68
- options.marginTop != void 0 && (style.marginTop = options.marginTop);
69
- options.marginRight != void 0 && (style.marginRight = options.marginRight);
70
- options.marginBottom != void 0 && (style.marginBottom = options.marginBottom);
71
- options.marginLeft != void 0 && (style.marginLeft = options.marginLeft);
72
- options.borderRadius != void 0 && (style.borderRadius = options.borderRadius);
73
- options.border != void 0 && (style.border = options.border);
74
- options.borderTop != void 0 && (style.borderTop = options.borderTop);
75
- options.borderRight != void 0 && (style.borderRight = options.borderRight);
76
- options.borderBottom != void 0 && (style.borderBottom = options.borderBottom);
77
- options.borderLeft != void 0 && (style.borderLeft = options.borderLeft);
78
- options.padding != void 0 && (style.padding = options.padding);
79
- options.paddingTop != void 0 && (style.paddingTop = options.paddingTop);
80
- options.paddingRight != void 0 && (style.paddingRight = options.paddingRight);
81
- options.paddingBottom != void 0 && (style.paddingBottom = options.paddingBottom);
82
- options.paddingLeft != void 0 && (style.paddingLeft = options.paddingLeft);
83
- }
84
- {
85
- options.transition != void 0 && (style.transition = options.transition);
86
- options.transitionProperty != void 0 && (style.transitionProperty = options.transitionProperty);
87
- options.transitionDuration != void 0 && (style.transitionDuration = options.transitionDuration);
88
- options.transitionDelay != void 0 && (style.transitionDelay = options.transitionDelay);
89
- options.transitionTimingFunction != void 0 && (style.transitionTimingFunction = options.transitionTimingFunction);
36
+ if (!!options) {
37
+ const tmpFunc = key => options[key] != void 0 && (style[key] = String(options[key]));
38
+ ["color", "backgroundColor", "textAlign", "textAlign", "verticalAlign"].forEach(tmpFunc);
39
+ ["justifyContent", "alignItems", "flex", "flexBasis", "flexGrow", "flexShrink", "order", "alignSelf"].forEach(tmpFunc);
40
+ ["left", "right", "top", "bottom"].forEach(tmpFunc);
41
+ ["overflow", "overflowX", "overflowY"].forEach(tmpFunc);
42
+ ["width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight"].forEach(tmpFunc);
43
+ ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"].forEach(tmpFunc);
44
+ ["borderRadius", "border", "borderTop", "borderRight", "borderBottom", "borderLeft"].forEach(tmpFunc);
45
+ ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"].forEach(tmpFunc);
46
+ ["transition", "transitionProperty", "transitionDuration", "transitionDelay", "transitionTimingFunction"].forEach(tmpFunc);
90
47
  }
91
48
  return style;
92
49
  }
@@ -37,60 +37,17 @@
37
37
  }
38
38
  function buildStyle(options) {
39
39
  const style = Object.create(null);
40
- if (!!!options) {
41
- return style;
42
- }
43
- {
44
- options.color != void 0 && (style.color = options.color);
45
- options.backgroundColor != void 0 && (style.backgroundColor = options.backgroundColor);
46
- options.textAlign != void 0 && (style.textAlign = options.textAlign);
47
- options.verticalAlign != void 0 && (style.verticalAlign = options.verticalAlign);
48
- options.justifyContent != void 0 && (style.justifyContent = options.justifyContent);
49
- options.alignItems != void 0 && (style.alignItems = options.alignItems);
50
- options.flex != void 0 && (style.flex = options.flex);
51
- options.flexBasis != void 0 && (style.flexBasis = options.flexBasis);
52
- options.flexGrow > 0 != void 0 && (style.flexGrow = String(options.flexGrow));
53
- options.flexShrink > 0 != void 0 && (style.flexShrink = String(options.flexShrink));
54
- options.order > 0 != void 0 && (style.order = String(options.order));
55
- options.alignSelf != void 0 && (style.alignSelf = options.alignSelf);
56
- options.left != void 0 && (style.left = options.left);
57
- options.right != void 0 && (style.right = options.right);
58
- options.top != void 0 && (style.top = options.top);
59
- options.bottom != void 0 && (style.bottom = options.bottom);
60
- options.overflow != void 0 && (style.overflow = options.overflow);
61
- options.overflowX != void 0 && (style.overflowX = options.overflowX);
62
- options.overflowY != void 0 && (style.overflowY = options.overflowY);
63
- }
64
- {
65
- options.width != void 0 && (style.width = options.width);
66
- options.minWidth != void 0 && (style.minWidth = options.minWidth);
67
- options.maxWidth != void 0 && (style.maxWidth = options.maxWidth);
68
- options.height != void 0 && (style.height = options.height);
69
- options.minHeight != void 0 && (style.minHeight = options.minHeight);
70
- options.maxHeight != void 0 && (style.maxHeight = options.maxHeight);
71
- options.margin != void 0 && (style.margin = options.margin);
72
- options.marginTop != void 0 && (style.marginTop = options.marginTop);
73
- options.marginRight != void 0 && (style.marginRight = options.marginRight);
74
- options.marginBottom != void 0 && (style.marginBottom = options.marginBottom);
75
- options.marginLeft != void 0 && (style.marginLeft = options.marginLeft);
76
- options.borderRadius != void 0 && (style.borderRadius = options.borderRadius);
77
- options.border != void 0 && (style.border = options.border);
78
- options.borderTop != void 0 && (style.borderTop = options.borderTop);
79
- options.borderRight != void 0 && (style.borderRight = options.borderRight);
80
- options.borderBottom != void 0 && (style.borderBottom = options.borderBottom);
81
- options.borderLeft != void 0 && (style.borderLeft = options.borderLeft);
82
- options.padding != void 0 && (style.padding = options.padding);
83
- options.paddingTop != void 0 && (style.paddingTop = options.paddingTop);
84
- options.paddingRight != void 0 && (style.paddingRight = options.paddingRight);
85
- options.paddingBottom != void 0 && (style.paddingBottom = options.paddingBottom);
86
- options.paddingLeft != void 0 && (style.paddingLeft = options.paddingLeft);
87
- }
88
- {
89
- options.transition != void 0 && (style.transition = options.transition);
90
- options.transitionProperty != void 0 && (style.transitionProperty = options.transitionProperty);
91
- options.transitionDuration != void 0 && (style.transitionDuration = options.transitionDuration);
92
- options.transitionDelay != void 0 && (style.transitionDelay = options.transitionDelay);
93
- options.transitionTimingFunction != void 0 && (style.transitionTimingFunction = options.transitionTimingFunction);
40
+ if (!!options) {
41
+ const tmpFunc = key => options[key] != void 0 && (style[key] = String(options[key]));
42
+ ["color", "backgroundColor", "textAlign", "textAlign", "verticalAlign"].forEach(tmpFunc);
43
+ ["justifyContent", "alignItems", "flex", "flexBasis", "flexGrow", "flexShrink", "order", "alignSelf"].forEach(tmpFunc);
44
+ ["left", "right", "top", "bottom"].forEach(tmpFunc);
45
+ ["overflow", "overflowX", "overflowY"].forEach(tmpFunc);
46
+ ["width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight"].forEach(tmpFunc);
47
+ ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"].forEach(tmpFunc);
48
+ ["borderRadius", "border", "borderTop", "borderRight", "borderBottom", "borderLeft"].forEach(tmpFunc);
49
+ ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"].forEach(tmpFunc);
50
+ ["transition", "transitionProperty", "transitionDuration", "transitionDelay", "transitionTimingFunction"].forEach(tmpFunc);
94
51
  }
95
52
  return style;
96
53
  }
@@ -124,13 +124,14 @@
124
124
  // ***************************************** 👉 文本输入渲染 *****************************************
125
125
  .snail-app {
126
126
 
127
- // input 输入框等,去掉默认的外边框;仅针对输入类型的,后续逐步扩充。checkbox、radio等先忽略
127
+ // 输入框等,去掉默认的外边框;仅针对输入类型的,后续逐步扩充。checkbox、radio等先忽略
128
128
  input[type="search"],
129
129
  input[type="text"],
130
130
  input[type="url"],
131
131
  input[type="email"],
132
132
  input[type="password"],
133
- input[type="number"] {
133
+ input[type="number"],
134
+ textarea {
134
135
  outline: 0 !important;
135
136
  appearance: none !important;
136
137
  // 给个最小宽度,避免走默认导致部分宽度不够时撑开外部容器的情况
@@ -161,7 +162,12 @@
161
162
  }
162
163
  }
163
164
 
164
- // input 选项类:取消边距等
165
+ textarea {
166
+ padding-top: 4px;
167
+ padding-bottom: 4px;
168
+ }
169
+
170
+ // 选项类:取消边距等
165
171
  input[type="radio"],
166
172
  input[type="checkbox"] {
167
173
  margin: 0;
@@ -187,11 +193,8 @@
187
193
  }
188
194
 
189
195
  // 文本提示文字颜色
190
- textarea::placeholder {
191
- color: #8a9099;
192
- }
193
-
194
196
  input::placeholder,
197
+ textarea::placeholder,
195
198
  .placeholder {
196
199
  .ellipsis();
197
200
  color: #8a9099;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "对视图界面做的一些封装。如样式计算助手方法,常用样式less混入、变量等;dom相关助手类",
4
4
  "author": "snail_dev@163.com",
5
5
  "license": "MIT",
6
- "version": "2.0.2",
6
+ "version": "2.0.3",
7
7
  "type": "module",
8
8
  "main": "dist/snail.view.js",
9
9
  "module": "dist/snail.view.js",
@@ -14,7 +14,7 @@
14
14
  "types": "tsc -p ./tsconfig.dts.json --declarationDir ./dist/_types"
15
15
  },
16
16
  "dependencies": {
17
- "snail.core": ">=2.0.17"
17
+ "snail.core": ">=2.0.18"
18
18
  },
19
19
  "devDependencies": {
20
20
  "rollup": ">=4.39.0",