snail.view 1.0.13 → 1.0.15

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.
package/.code-snippets CHANGED
@@ -1,97 +1,125 @@
1
- // 配合snail库进行less混合代码提示使用的代码片段
2
- {
3
- // 引入基础Mixins样式
4
- "@import-mixins-base": {
5
- "prefix": "@import-base-mixins",
6
- "scope": "less",
7
- "description": "引入基础Mixins样式",
8
- "body": [
9
- "// 引入基础Mixins样式",
10
- "@import \"snail.view/dist/styles/base-mixins.less\";"
11
- ]
12
- },
13
- // ***************************************** 👉 文本样式 *****************************************
14
- "text-ellipsis": {
15
- "prefix": ".text-ellipsis",
16
- "scope": "less",
17
- "description": "文本溢出时出省略号",
18
- "body": [
19
- "// 文本溢出时出省略号",
20
- ".text-ellipsis();",
21
- ]
22
- },
23
- // ***************************************** 👉 高宽定位 *****************************************
24
- "wh-fill": {
25
- "prefix": ".wh-fill",
26
- "scope": "less",
27
- "description": "高度、宽度100%填充满",
28
- "body": [
29
- "// width:100%;height:100%",
30
- ".wh-fill();"
31
- ]
32
- },
33
- "wh-fill-hidden": {
34
- "prefix": ".wh-fill-hidden",
35
- "scope": "less",
36
- "description": "高度、宽度100%填充满,隐藏溢出的内容",
37
- "body": [
38
- "// width:100%;height:100%;overflow: hidden",
39
- ".wh-fill-hidden();"
40
- ]
41
- },
42
- "left-right-start": {
43
- "prefix": ".left-right-start",
44
- "scope": "less",
45
- "description": "left:0,top:0;辅助 fixed、absolute定位使用",
46
- "body": [
47
- "// left、right起始位置:left: 0; top: 0",
48
- ".left-right-start();"
49
- ]
50
- },
51
- "left-right-center": {
52
- "prefix": ".left-right-center",
53
- "scope": "less",
54
- "description": "通过left、rigth进行居中展示:left:50% top:50%; transform: translate(-50%, -50%)",
55
- "body": [
56
- "// 通过left、rigth进行居中展示:left:50% top:50%; transform: translate(-50%, -50%)",
57
- ".left-right-center();"
58
- ]
59
- },
60
- // ***************************************** 👉 弹性盒子 *****************************************"
61
- "flex-main-center": {
62
- "prefix": ".flex-main-center",
63
- "scope": "less",
64
- "description": "flex 布局,主轴居中",
65
- "body": [
66
- "// flex 布局:display: flex,justify-content 为center",
67
- ".flex-main-center();"
68
- ]
69
- },
70
- "flex-cross-center": {
71
- "prefix": ".flex-cross-center",
72
- "scope": "less",
73
- "description": "flex 布局,交叉轴居中",
74
- "body": [
75
- "// flex 布局:display: flex,align-items 为center",
76
- ".flex-cross-center();"
77
- ]
78
- },
79
- "flex-center": {
80
- "prefix": ".flex-center",
81
- "scope": "less",
82
- "description": "flex 布局,主轴和交叉轴居中",
83
- "body": [
84
- "// flex 布局:display: flex,align-items、justify-content 都为center",
85
- ".flex-center();"
86
- ]
87
- },
88
- "flex-right": {
89
- "prefix": ".flex-right",
90
- "scope": "less",
91
- "description": "flex 布局,主轴和交叉轴居右",
92
- "body": [
93
- "// flex 布局:display: flex,align-items、justify-content 都为right",
94
- ".flex-right();"
95
- ]
96
- }
1
+ // 配合snail库进行less混合代码提示使用的代码片段
2
+ {
3
+ // 引入基础Mixins样式
4
+ "@import-mixins-base": {
5
+ "prefix": "@import-base-mixins",
6
+ "scope": "less",
7
+ "description": "引入基础Mixins样式",
8
+ "body": [
9
+ "// 引入基础Mixins样式",
10
+ "@import \"snail.view/dist/styles/base-mixins.less\";"
11
+ ]
12
+ },
13
+ // ***************************************** 👉 所有元素 *****************************************
14
+ ".*-box-sizing": {
15
+ "prefix": ".*-box-sizing",
16
+ "scope": "less",
17
+ "description": "所有元素的box-sizing属性设置为border-box",
18
+ "body": [
19
+ "// 所有元素的box-sizing属性设置为border-box",
20
+ ".\\*-box-sizing();",
21
+ ]
22
+ },
23
+ // ***************************************** 👉 文本样式 *****************************************
24
+ "text-ellipsis": {
25
+ "prefix": ".text-ellipsis",
26
+ "scope": "less",
27
+ "description": "文本溢出时出省略号",
28
+ "body": [
29
+ "// 文本溢出时出省略号",
30
+ ".text-ellipsis();",
31
+ ]
32
+ },
33
+ "tip-text": {
34
+ "prefix": ".tip-text",
35
+ "scope": "less",
36
+ "description": "提示文本样式",
37
+ "body": [
38
+ "// 提示文本样式:400 weight,14px size,#8A9099 color",
39
+ ".tip-text();",
40
+ ]
41
+ },
42
+ // ***************************************** 👉 高宽定位 *****************************************
43
+ "wh-fill": {
44
+ "prefix": ".wh-fill",
45
+ "scope": "less",
46
+ "description": "高度、宽度100%填充满",
47
+ "body": [
48
+ "// width:100%;height:100%",
49
+ ".wh-fill();"
50
+ ]
51
+ },
52
+ "wh-fill-hidden": {
53
+ "prefix": ".wh-fill-hidden",
54
+ "scope": "less",
55
+ "description": "高度、宽度100%填充满,隐藏溢出的内容",
56
+ "body": [
57
+ "// width:100%;height:100%;overflow: hidden",
58
+ ".wh-fill-hidden();"
59
+ ]
60
+ },
61
+ "left-right-start": {
62
+ "prefix": ".left-right-start",
63
+ "scope": "less",
64
+ "description": "left:0,top:0;辅助 fixed、absolute定位使用",
65
+ "body": [
66
+ "// left、right起始位置:left: 0; top: 0",
67
+ ".left-right-start();"
68
+ ]
69
+ },
70
+ "left-right-center": {
71
+ "prefix": ".left-right-center",
72
+ "scope": "less",
73
+ "description": "通过left、rigth进行居中展示:left:50% top:50%; transform: translate(-50%, -50%)",
74
+ "body": [
75
+ "// 通过left、rigth进行居中展示:left:50% top:50%; transform: translate(-50%, -50%)",
76
+ ".left-right-center();"
77
+ ]
78
+ },
79
+ // ***************************************** 👉 弹性盒子 *****************************************"
80
+ "flex-main-center": {
81
+ "prefix": ".flex-main-center",
82
+ "scope": "less",
83
+ "description": "flex 布局,主轴居中",
84
+ "body": [
85
+ "// flex 布局:display: flex,justify-content 为center",
86
+ ".flex-main-center();"
87
+ ]
88
+ },
89
+ "flex-cross-center": {
90
+ "prefix": ".flex-cross-center",
91
+ "scope": "less",
92
+ "description": "flex 布局,交叉轴居中",
93
+ "body": [
94
+ "// flex 布局:display: flex,align-items 为center",
95
+ ".flex-cross-center();"
96
+ ]
97
+ },
98
+ "flex-center": {
99
+ "prefix": ".flex-center",
100
+ "scope": "less",
101
+ "description": "flex 布局,主轴和交叉轴居中",
102
+ "body": [
103
+ "// flex 布局:display: flex,align-items、justify-content 都为center",
104
+ ".flex-center();"
105
+ ]
106
+ },
107
+ "flex-right": {
108
+ "prefix": ".flex-right",
109
+ "scope": "less",
110
+ "description": "flex 布局,主轴和交叉轴居右",
111
+ "body": [
112
+ "// flex 布局:display: flex,align-items、justify-content 都为right",
113
+ ".flex-right();"
114
+ ]
115
+ },
116
+ "flex-column": {
117
+ "prefix": ".flex-column",
118
+ "scope": "less",
119
+ "description": "flex布局,列 为主轴",
120
+ "body": [
121
+ "// flex布局,列 为主轴:display: flex,flex-direction: column;",
122
+ ".flex-column();"
123
+ ]
124
+ }
97
125
  }
@@ -54,7 +54,7 @@ type CSSDescriptor = {
54
54
  * - 高度、宽度、对齐、边框、内边距等合集
55
55
  * - 对齐方式、、、
56
56
  */
57
- type AllStyle = BaseStyle & FlexBoxStyle & WidthStyle & HeightStyle & MarginStyle & BorderStyle & PaddingStyle & TransitionStyle;
57
+ type AllStyle = BaseStyle & FlexBoxStyle & WidthStyle & HeightStyle & MarginStyle & BorderStyle & PaddingStyle & PositionStyle & TransitionStyle;
58
58
  /**
59
59
  * 基础样式:对齐方式、颜色属性
60
60
  */
@@ -241,6 +241,27 @@ type PaddingStyle = {
241
241
  */
242
242
  paddingLeft?: string;
243
243
  };
244
+ /**
245
+ * 位置样式
246
+ */
247
+ type PositionStyle = {
248
+ /**
249
+ * x轴 左侧 值
250
+ */
251
+ left?: string;
252
+ /**
253
+ * x轴 右侧 值
254
+ */
255
+ right?: string;
256
+ /**
257
+ * y轴 顶部 值
258
+ */
259
+ top?: string;
260
+ /**
261
+ * y轴 底部 值
262
+ */
263
+ bottom?: string;
264
+ };
244
265
  /**
245
266
  * 过渡效果 样式
246
267
  */
@@ -499,4 +520,4 @@ type ElementSize = {
499
520
  declare function useObserver(): IObserver & IScope;
500
521
 
501
522
  export { configLink, css, link, linkMap, useAnimation, useLink, useObserver };
502
- export type { AllStyle, BaseStyle, BorderStyle, CSS, CSSDescriptor, ElementSize, FlexBoxStyle, HeightStyle, IAnimationManager, ICSSManager, ILinkManager, IObserver, LinkElement, LinkFile, LinkOptions, MarginStyle, PaddingStyle, TransitionEffect, TransitionStyle, WidthStyle };
523
+ export type { AllStyle, BaseStyle, BorderStyle, CSS, CSSDescriptor, ElementSize, FlexBoxStyle, HeightStyle, IAnimationManager, ICSSManager, ILinkManager, IObserver, LinkElement, LinkFile, LinkOptions, MarginStyle, PaddingStyle, PositionStyle, TransitionEffect, TransitionStyle, WidthStyle };
@@ -37,49 +37,53 @@ function useCSS() {
37
37
  return style;
38
38
  }
39
39
  {
40
- options.color && (style.color = options.color);
41
- options.backgroundColor && (style.backgroundColor = options.backgroundColor);
42
- options.textAlign && (style.textAlign = options.textAlign);
43
- options.verticalAlign && (style.verticalAlign = options.verticalAlign);
44
- options.justifyContent && (style.justifyContent = options.justifyContent);
45
- options.alignItems && (style.alignItems = options.alignItems);
46
- options.flex && (style.flex = options.flex);
47
- options.flexBasis && (style.flexBasis = options.flexBasis);
48
- options.flexGrow > 0 && (style.flexGrow = String(options.flexGrow));
49
- options.flexShrink > 0 && (style.flexShrink = String(options.flexShrink));
50
- options.order > 0 && (style.order = String(options.order));
51
- options.alignSelf && (style.alignSelf = options.alignSelf);
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
52
  }
53
53
  {
54
- options.width && (style.width = options.width);
55
- options.minWidth && (style.minWidth = options.minWidth);
56
- options.maxWidth && (style.maxWidth = options.maxWidth);
57
- options.height && (style.height = options.height);
58
- options.minHeight && (style.minHeight = options.minHeight);
59
- options.maxHeight && (style.maxHeight = options.maxHeight);
60
- options.margin && (style.margin = options.margin);
61
- options.marginTop && (style.marginTop = options.marginTop);
62
- options.marginRight && (style.marginRight = options.marginRight);
63
- options.marginBottom && (style.marginBottom = options.marginBottom);
64
- options.marginLeft && (style.marginLeft = options.marginLeft);
65
- options.borderRadius && (style.borderRadius = options.borderRadius);
66
- options.border && (style.border = options.border);
67
- options.borderTop && (style.borderTop = options.borderTop);
68
- options.borderRight && (style.borderRight = options.borderRight);
69
- options.borderBottom && (style.borderBottom = options.borderBottom);
70
- options.borderLeft && (style.borderLeft = options.borderLeft);
71
- options.padding && (style.padding = options.padding);
72
- options.paddingTop && (style.paddingTop = options.paddingTop);
73
- options.paddingRight && (style.paddingRight = options.paddingRight);
74
- options.paddingBottom && (style.paddingBottom = options.paddingBottom);
75
- options.paddingLeft && (style.paddingLeft = options.paddingLeft);
54
+ options.width != void 0 && (style.width = options.width);
55
+ options.minWidth != void 0 && (style.minWidth = options.minWidth);
56
+ options.maxWidth != void 0 && (style.maxWidth = options.maxWidth);
57
+ options.height != void 0 && (style.height = options.height);
58
+ options.minHeight != void 0 && (style.minHeight = options.minHeight);
59
+ options.maxHeight != void 0 && (style.maxHeight = options.maxHeight);
60
+ options.margin != void 0 && (style.margin = options.margin);
61
+ options.marginTop != void 0 && (style.marginTop = options.marginTop);
62
+ options.marginRight != void 0 && (style.marginRight = options.marginRight);
63
+ options.marginBottom != void 0 && (style.marginBottom = options.marginBottom);
64
+ options.marginLeft != void 0 && (style.marginLeft = options.marginLeft);
65
+ options.borderRadius != void 0 && (style.borderRadius = options.borderRadius);
66
+ options.border != void 0 && (style.border = options.border);
67
+ options.borderTop != void 0 && (style.borderTop = options.borderTop);
68
+ options.borderRight != void 0 && (style.borderRight = options.borderRight);
69
+ options.borderBottom != void 0 && (style.borderBottom = options.borderBottom);
70
+ options.borderLeft != void 0 && (style.borderLeft = options.borderLeft);
71
+ options.padding != void 0 && (style.padding = options.padding);
72
+ options.paddingTop != void 0 && (style.paddingTop = options.paddingTop);
73
+ options.paddingRight != void 0 && (style.paddingRight = options.paddingRight);
74
+ options.paddingBottom != void 0 && (style.paddingBottom = options.paddingBottom);
75
+ options.paddingLeft != void 0 && (style.paddingLeft = options.paddingLeft);
76
+ options.left != void 0 && (style.left = options.left);
77
+ options.right != void 0 && (style.right = options.right);
78
+ options.top != void 0 && (style.top = options.top);
79
+ options.bottom != void 0 && (style.bottom = options.bottom);
76
80
  }
77
81
  {
78
- options.transition && (style.transition = options.transition);
79
- options.transitionProperty && (style.transitionProperty = options.transitionProperty);
80
- options.transitionDuration && (style.transitionDuration = options.transitionDuration);
81
- options.transitionDelay && (style.transitionDelay = options.transitionDelay);
82
- options.transitionTimingFunction && (style.transitionTimingFunction = options.transitionTimingFunction);
82
+ options.transition != void 0 && (style.transition = options.transition);
83
+ options.transitionProperty != void 0 && (style.transitionProperty = options.transitionProperty);
84
+ options.transitionDuration != void 0 && (style.transitionDuration = options.transitionDuration);
85
+ options.transitionDelay != void 0 && (style.transitionDelay = options.transitionDelay);
86
+ options.transitionTimingFunction != void 0 && (style.transitionTimingFunction = options.transitionTimingFunction);
83
87
  }
84
88
  return style;
85
89
  }
@@ -41,49 +41,53 @@
41
41
  return style;
42
42
  }
43
43
  {
44
- options.color && (style.color = options.color);
45
- options.backgroundColor && (style.backgroundColor = options.backgroundColor);
46
- options.textAlign && (style.textAlign = options.textAlign);
47
- options.verticalAlign && (style.verticalAlign = options.verticalAlign);
48
- options.justifyContent && (style.justifyContent = options.justifyContent);
49
- options.alignItems && (style.alignItems = options.alignItems);
50
- options.flex && (style.flex = options.flex);
51
- options.flexBasis && (style.flexBasis = options.flexBasis);
52
- options.flexGrow > 0 && (style.flexGrow = String(options.flexGrow));
53
- options.flexShrink > 0 && (style.flexShrink = String(options.flexShrink));
54
- options.order > 0 && (style.order = String(options.order));
55
- options.alignSelf && (style.alignSelf = options.alignSelf);
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
56
  }
57
57
  {
58
- options.width && (style.width = options.width);
59
- options.minWidth && (style.minWidth = options.minWidth);
60
- options.maxWidth && (style.maxWidth = options.maxWidth);
61
- options.height && (style.height = options.height);
62
- options.minHeight && (style.minHeight = options.minHeight);
63
- options.maxHeight && (style.maxHeight = options.maxHeight);
64
- options.margin && (style.margin = options.margin);
65
- options.marginTop && (style.marginTop = options.marginTop);
66
- options.marginRight && (style.marginRight = options.marginRight);
67
- options.marginBottom && (style.marginBottom = options.marginBottom);
68
- options.marginLeft && (style.marginLeft = options.marginLeft);
69
- options.borderRadius && (style.borderRadius = options.borderRadius);
70
- options.border && (style.border = options.border);
71
- options.borderTop && (style.borderTop = options.borderTop);
72
- options.borderRight && (style.borderRight = options.borderRight);
73
- options.borderBottom && (style.borderBottom = options.borderBottom);
74
- options.borderLeft && (style.borderLeft = options.borderLeft);
75
- options.padding && (style.padding = options.padding);
76
- options.paddingTop && (style.paddingTop = options.paddingTop);
77
- options.paddingRight && (style.paddingRight = options.paddingRight);
78
- options.paddingBottom && (style.paddingBottom = options.paddingBottom);
79
- options.paddingLeft && (style.paddingLeft = options.paddingLeft);
58
+ options.width != void 0 && (style.width = options.width);
59
+ options.minWidth != void 0 && (style.minWidth = options.minWidth);
60
+ options.maxWidth != void 0 && (style.maxWidth = options.maxWidth);
61
+ options.height != void 0 && (style.height = options.height);
62
+ options.minHeight != void 0 && (style.minHeight = options.minHeight);
63
+ options.maxHeight != void 0 && (style.maxHeight = options.maxHeight);
64
+ options.margin != void 0 && (style.margin = options.margin);
65
+ options.marginTop != void 0 && (style.marginTop = options.marginTop);
66
+ options.marginRight != void 0 && (style.marginRight = options.marginRight);
67
+ options.marginBottom != void 0 && (style.marginBottom = options.marginBottom);
68
+ options.marginLeft != void 0 && (style.marginLeft = options.marginLeft);
69
+ options.borderRadius != void 0 && (style.borderRadius = options.borderRadius);
70
+ options.border != void 0 && (style.border = options.border);
71
+ options.borderTop != void 0 && (style.borderTop = options.borderTop);
72
+ options.borderRight != void 0 && (style.borderRight = options.borderRight);
73
+ options.borderBottom != void 0 && (style.borderBottom = options.borderBottom);
74
+ options.borderLeft != void 0 && (style.borderLeft = options.borderLeft);
75
+ options.padding != void 0 && (style.padding = options.padding);
76
+ options.paddingTop != void 0 && (style.paddingTop = options.paddingTop);
77
+ options.paddingRight != void 0 && (style.paddingRight = options.paddingRight);
78
+ options.paddingBottom != void 0 && (style.paddingBottom = options.paddingBottom);
79
+ options.paddingLeft != void 0 && (style.paddingLeft = options.paddingLeft);
80
+ options.left != void 0 && (style.left = options.left);
81
+ options.right != void 0 && (style.right = options.right);
82
+ options.top != void 0 && (style.top = options.top);
83
+ options.bottom != void 0 && (style.bottom = options.bottom);
80
84
  }
81
85
  {
82
- options.transition && (style.transition = options.transition);
83
- options.transitionProperty && (style.transitionProperty = options.transitionProperty);
84
- options.transitionDuration && (style.transitionDuration = options.transitionDuration);
85
- options.transitionDelay && (style.transitionDelay = options.transitionDelay);
86
- options.transitionTimingFunction && (style.transitionTimingFunction = options.transitionTimingFunction);
86
+ options.transition != void 0 && (style.transition = options.transition);
87
+ options.transitionProperty != void 0 && (style.transitionProperty = options.transitionProperty);
88
+ options.transitionDuration != void 0 && (style.transitionDuration = options.transitionDuration);
89
+ options.transitionDelay != void 0 && (style.transitionDelay = options.transitionDelay);
90
+ options.transitionTimingFunction != void 0 && (style.transitionTimingFunction = options.transitionTimingFunction);
87
91
  }
88
92
  return style;
89
93
  }
@@ -11,6 +11,13 @@
11
11
  text-overflow: ellipsis;
12
12
  }
13
13
 
14
+ // 提示文本
15
+ .tip-text() {
16
+ font-weight: 400;
17
+ font-size: 14px;
18
+ color: #8A9099;
19
+ }
20
+
14
21
  // ***************************************** 👉 高宽定位 *****************************************
15
22
  // 高度、宽度100%填充满
16
23
  .wh-fill() {
@@ -63,4 +70,10 @@
63
70
  display: flex;
64
71
  align-items: right;
65
72
  justify-content: right;
73
+ }
74
+
75
+ // flex布局,列 为主轴
76
+ .flex-column() {
77
+ display: flex;
78
+ flex-direction: column;
66
79
  }
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": "1.0.13",
6
+ "version": "1.0.15",
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.9"
17
+ "snail.core": ">=2.0.11"
18
18
  },
19
19
  "devDependencies": {
20
20
  "rollup": ">=4.39.0",