cbvirtua 1.0.10 → 1.0.11

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 (61) hide show
  1. package/package.json +1 -1
  2. package/vant/style/README.md +79 -0
  3. package/vant/style/README.zh-CN.md +79 -0
  4. package/vant/style/animation.less +139 -0
  5. package/vant/style/base.less +10 -0
  6. package/vant/style/clearfix.less +5 -0
  7. package/vant/style/demo/index.vue +110 -0
  8. package/vant/style/ellipsis.less +13 -0
  9. package/vant/style/hairline.less +47 -0
  10. package/vant/style/mixins/clearfix.less +7 -0
  11. package/vant/style/mixins/ellipsis.less +15 -0
  12. package/vant/style/mixins/hairline.less +39 -0
  13. package/vant/style/normalize.less +38 -0
  14. package/vant/style/reset.less +171 -0
  15. package/vant/style/var.less +901 -0
  16. package/vant/tab/README.md +307 -0
  17. package/vant/tab/README.zh-CN.md +342 -0
  18. package/vant/tab/demo/index.vue +193 -0
  19. package/vant/tab/index.js +95 -0
  20. package/vant/tab/index.less +17 -0
  21. package/vant/tab/test/__snapshots__/demo.spec.js.snap +349 -0
  22. package/vant/tab/test/__snapshots__/index.spec.js.snap +352 -0
  23. package/vant/tab/test/__snapshots__/insert.spec.js.snap +63 -0
  24. package/vant/tab/test/demo.spec.js +4 -0
  25. package/vant/tab/test/index.spec.js +435 -0
  26. package/vant/tab/test/insert.spec.js +75 -0
  27. package/vant/tabs/Content.js +79 -0
  28. package/vant/tabs/Title.js +91 -0
  29. package/vant/tabs/index.js +453 -0
  30. package/vant/tabs/index.less +153 -0
  31. package/vant/tabs/utils.ts +53 -0
  32. package/vant/utils/constant.ts +11 -0
  33. package/vant/utils/create/bem.ts +45 -0
  34. package/vant/utils/create/component.ts +86 -0
  35. package/vant/utils/create/i18n.ts +16 -0
  36. package/vant/utils/create/index.ts +14 -0
  37. package/vant/utils/deep-assign.ts +27 -0
  38. package/vant/utils/deep-clone.ts +23 -0
  39. package/vant/utils/dom/event.ts +56 -0
  40. package/vant/utils/dom/node.ts +7 -0
  41. package/vant/utils/dom/raf.ts +40 -0
  42. package/vant/utils/dom/reset-scroll.ts +16 -0
  43. package/vant/utils/dom/scroll.ts +81 -0
  44. package/vant/utils/dom/style.ts +11 -0
  45. package/vant/utils/format/number.ts +52 -0
  46. package/vant/utils/format/string.ts +15 -0
  47. package/vant/utils/format/unit.ts +61 -0
  48. package/vant/utils/functional.ts +73 -0
  49. package/vant/utils/index.ts +79 -0
  50. package/vant/utils/interceptor.ts +27 -0
  51. package/vant/utils/router.ts +54 -0
  52. package/vant/utils/test/bem.spec.js +39 -0
  53. package/vant/utils/test/index.spec.js +152 -0
  54. package/vant/utils/test/interceptor.spec.js +50 -0
  55. package/vant/utils/types.ts +40 -0
  56. package/vant/utils/validate/date.ts +8 -0
  57. package/vant/utils/validate/email.ts +5 -0
  58. package/vant/utils/validate/mobile.ts +6 -0
  59. package/vant/utils/validate/number.ts +12 -0
  60. package/vant/utils/validate/system.ts +13 -0
  61. package/vant/utils/vnodes.ts +33 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbvirtua",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,79 @@
1
+ # Built-in Style
2
+
3
+ ### Intro
4
+
5
+ Vant contains some common styles that can be used directly by the className.
6
+
7
+ ### Text ellipsis
8
+
9
+ When the text content length exceeds the maximum container width, the excess text is automatically omitted.
10
+
11
+ ```html
12
+ <div class="van-ellipsis">
13
+ This is a paragraph that displays up to one line of text, and the rest of the
14
+ text will be omitted.
15
+ </div>
16
+
17
+ <div class="van-multi-ellipsis--l2">
18
+ This is a paragraph that displays up to two lines of text, and the rest of the
19
+ text will be omitted.
20
+ </div>
21
+
22
+ <div class="van-multi-ellipsis--l3">
23
+ This is a paragraph that displays up to three lines of text, and the rest of
24
+ the text will be omitted.
25
+ </div>
26
+ ```
27
+
28
+ ### Hairline
29
+
30
+ Add 1px border under the Retina screen for the element, based on a pseudo element.
31
+
32
+ ```html
33
+ <!-- border top -->
34
+ <div class="van-hairline--top"></div>
35
+
36
+ <!-- border bottom -->
37
+ <div class="van-hairline--bottom"></div>
38
+
39
+ <!-- border left -->
40
+ <div class="van-hairline--left"></div>
41
+
42
+ <!-- border right -->
43
+ <div class="van-hairline--right"></div>
44
+
45
+ <!-- border top & bottom -->
46
+ <div class="van-hairline--top-bottom"></div>
47
+
48
+ <!-- full border -->
49
+ <div class="van-hairline--surround"></div>
50
+ ```
51
+
52
+ ### Animation
53
+
54
+ ```html
55
+ <!-- fade in -->
56
+ <transition name="van-fade">
57
+ <div v-show="visible">Fade</div>
58
+ </transition>
59
+
60
+ <!-- slide up -->
61
+ <transition name="van-slide-up">
62
+ <div v-show="visible">Slide Up</div>
63
+ </transition>
64
+
65
+ <!-- slide down -->
66
+ <transition name="van-slide-down">
67
+ <div v-show="visible">Slide Down</div>
68
+ </transition>
69
+
70
+ <!-- slide left -->
71
+ <transition name="van-slide-left">
72
+ <div v-show="visible">Slide Left</div>
73
+ </transition>
74
+
75
+ <!-- slide right -->
76
+ <transition name="van-slide-right">
77
+ <div v-show="visible">Slide Right</div>
78
+ </transition>
79
+ ```
@@ -0,0 +1,79 @@
1
+ # 内置样式
2
+
3
+ ### 介绍
4
+
5
+ Vant 中默认包含了一些常用样式,可以直接通过 className 的方式使用。
6
+
7
+ ### 文字省略
8
+
9
+ 当文本内容长度超过容器最大宽度时,自动省略多余的文本。
10
+
11
+ ```html
12
+ <!-- 最多显示一行 -->
13
+ <div class="van-ellipsis">这是一段最多显示一行的文字,多余的内容会被省略</div>
14
+
15
+ <!-- 最多显示两行 -->
16
+ <div class="van-multi-ellipsis--l2">
17
+ 这是一段最多显示两行的文字,多余的内容会被省略
18
+ </div>
19
+
20
+ <!-- 最多显示三行 -->
21
+ <div class="van-multi-ellipsis--l3">
22
+ 这是一段最多显示三行的文字,多余的内容会被省略
23
+ </div>
24
+ ```
25
+
26
+ ### 1px 边框
27
+
28
+ 为元素添加 Retina 屏幕下的 1px 边框(即 hairline),基于伪类 transform 实现。
29
+
30
+ ```html
31
+ <!-- 上边框 -->
32
+ <div class="van-hairline--top"></div>
33
+
34
+ <!-- 下边框 -->
35
+ <div class="van-hairline--bottom"></div>
36
+
37
+ <!-- 左边框 -->
38
+ <div class="van-hairline--left"></div>
39
+
40
+ <!-- 右边框 -->
41
+ <div class="van-hairline--right"></div>
42
+
43
+ <!-- 上下边框 -->
44
+ <div class="van-hairline--top-bottom"></div>
45
+
46
+ <!-- 全边框 -->
47
+ <div class="van-hairline--surround"></div>
48
+ ```
49
+
50
+ ### 动画
51
+
52
+ 可以通过 `transition` 组件使用内置的动画
53
+
54
+ ```html
55
+ <!-- 淡入 -->
56
+ <transition name="van-fade">
57
+ <div v-show="visible">Fade</div>
58
+ </transition>
59
+
60
+ <!-- 上滑进入 -->
61
+ <transition name="van-slide-up">
62
+ <div v-show="visible">Slide Up</div>
63
+ </transition>
64
+
65
+ <!-- 下滑进入 -->
66
+ <transition name="van-slide-down">
67
+ <div v-show="visible">Slide Down</div>
68
+ </transition>
69
+
70
+ <!-- 左滑进入 -->
71
+ <transition name="van-slide-left">
72
+ <div v-show="visible">Slide Left</div>
73
+ </transition>
74
+
75
+ <!-- 右滑进入 -->
76
+ <transition name="van-slide-right">
77
+ <div v-show="visible">Slide Right</div>
78
+ </transition>
79
+ ```
@@ -0,0 +1,139 @@
1
+ @import './var';
2
+
3
+ @keyframes van-slide-up-enter {
4
+ from {
5
+ transform: translate3d(0, 100%, 0);
6
+ }
7
+ }
8
+
9
+ @keyframes van-slide-up-leave {
10
+ to {
11
+ transform: translate3d(0, 100%, 0);
12
+ }
13
+ }
14
+
15
+ @keyframes van-slide-down-enter {
16
+ from {
17
+ transform: translate3d(0, -100%, 0);
18
+ }
19
+ }
20
+
21
+ @keyframes van-slide-down-leave {
22
+ to {
23
+ transform: translate3d(0, -100%, 0);
24
+ }
25
+ }
26
+
27
+ @keyframes van-slide-left-enter {
28
+ from {
29
+ transform: translate3d(-100%, 0, 0);
30
+ }
31
+ }
32
+
33
+ @keyframes van-slide-left-leave {
34
+ to {
35
+ transform: translate3d(-100%, 0, 0);
36
+ }
37
+ }
38
+
39
+ @keyframes van-slide-right-enter {
40
+ from {
41
+ transform: translate3d(100%, 0, 0);
42
+ }
43
+ }
44
+
45
+ @keyframes van-slide-right-leave {
46
+ to {
47
+ transform: translate3d(100%, 0, 0);
48
+ }
49
+ }
50
+
51
+ @keyframes van-fade-in {
52
+ from {
53
+ opacity: 0;
54
+ }
55
+
56
+ to {
57
+ opacity: 1;
58
+ }
59
+ }
60
+
61
+ @keyframes van-fade-out {
62
+ from {
63
+ opacity: 1;
64
+ }
65
+
66
+ to {
67
+ opacity: 0;
68
+ }
69
+ }
70
+
71
+ @keyframes van-rotate {
72
+ from {
73
+ transform: rotate(0deg);
74
+ }
75
+
76
+ to {
77
+ transform: rotate(360deg);
78
+ }
79
+ }
80
+
81
+ .van-fade {
82
+ &-enter-active {
83
+ animation: @animation-duration-base van-fade-in both
84
+ @animation-timing-function-enter;
85
+ }
86
+
87
+ &-leave-active {
88
+ animation: @animation-duration-base van-fade-out both
89
+ @animation-timing-function-leave;
90
+ }
91
+ }
92
+
93
+ .van-slide-up {
94
+ &-enter-active {
95
+ animation: van-slide-up-enter @animation-duration-base both
96
+ @animation-timing-function-enter;
97
+ }
98
+
99
+ &-leave-active {
100
+ animation: van-slide-up-leave @animation-duration-base both
101
+ @animation-timing-function-leave;
102
+ }
103
+ }
104
+
105
+ .van-slide-down {
106
+ &-enter-active {
107
+ animation: van-slide-down-enter @animation-duration-base both
108
+ @animation-timing-function-enter;
109
+ }
110
+
111
+ &-leave-active {
112
+ animation: van-slide-down-leave @animation-duration-base both
113
+ @animation-timing-function-leave;
114
+ }
115
+ }
116
+
117
+ .van-slide-left {
118
+ &-enter-active {
119
+ animation: van-slide-left-enter @animation-duration-base both
120
+ @animation-timing-function-enter;
121
+ }
122
+
123
+ &-leave-active {
124
+ animation: van-slide-left-leave @animation-duration-base both
125
+ @animation-timing-function-leave;
126
+ }
127
+ }
128
+
129
+ .van-slide-right {
130
+ &-enter-active {
131
+ animation: van-slide-right-enter @animation-duration-base both
132
+ @animation-timing-function-enter;
133
+ }
134
+
135
+ &-leave-active {
136
+ animation: van-slide-right-leave @animation-duration-base both
137
+ @animation-timing-function-leave;
138
+ }
139
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Entry of basic styles
3
+ */
4
+
5
+ @import './var';
6
+ @import './normalize';
7
+ @import './ellipsis';
8
+ @import './clearfix';
9
+ @import './hairline';
10
+ @import './animation';
@@ -0,0 +1,5 @@
1
+ @import './mixins/clearfix';
2
+
3
+ .van-clearfix {
4
+ .clearfix();
5
+ }
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <demo-section>
3
+ <demo-block :title="t('ellipsis')">
4
+ <div class="van-ellipsis">{{ t('text1') }}</div>
5
+ <div class="van-multi-ellipsis--l2">{{ t('text2') }}</div>
6
+ </demo-block>
7
+
8
+ <demo-block card :title="t('hairline')">
9
+ <div class="van-hairline--top" />
10
+ </demo-block>
11
+
12
+ <demo-block card :title="t('animation')">
13
+ <van-cell is-link title="Fade" @click="animate('van-fade')" />
14
+ <van-cell is-link title="Slide Up" @click="animate('van-slide-up')" />
15
+ <van-cell is-link title="Slide Down" @click="animate('van-slide-down')" />
16
+ <van-cell is-link title="Slide Left" @click="animate('van-slide-left')" />
17
+ <van-cell
18
+ is-link
19
+ title="Slide Right"
20
+ @click="animate('van-slide-right')"
21
+ />
22
+ </demo-block>
23
+
24
+ <transition :name="transitionName">
25
+ <div v-show="show" class="demo-animate-block" />
26
+ </transition>
27
+ </demo-section>
28
+ </template>
29
+
30
+ <script>
31
+ export default {
32
+ i18n: {
33
+ 'zh-CN': {
34
+ hairline: '1px 边框',
35
+ ellipsis: '文字省略',
36
+ animation: '动画',
37
+ toggle: '切换动画',
38
+ text1: '这是一段最多显示一行的文字,后面的内容会省略',
39
+ text2:
40
+ '这是一段最多显示两行的文字,后面的内容会省略。这是一段最多显示两行的文字,后面的内容会省略',
41
+ },
42
+ 'en-US': {
43
+ hairline: 'Hairline',
44
+ ellipsis: 'Text Ellipsis',
45
+ animation: 'Animation',
46
+ toggle: 'Switch animation',
47
+ text1:
48
+ 'This is a paragraph that displays up to one line of text, and the rest of the text will be omitted.',
49
+ text2:
50
+ 'This is a paragraph that displays up to two lines of text, and the rest of the text will be omitted.',
51
+ },
52
+ },
53
+
54
+ data() {
55
+ return {
56
+ show: false,
57
+ transitionName: '',
58
+ };
59
+ },
60
+
61
+ methods: {
62
+ animate(transitionName) {
63
+ this.show = true;
64
+ this.transitionName = transitionName;
65
+
66
+ setTimeout(() => {
67
+ this.show = false;
68
+ }, 500);
69
+ },
70
+ },
71
+ };
72
+ </script>
73
+
74
+ <style lang="less">
75
+ @import '../../style/var';
76
+
77
+ .demo-style {
78
+ .van-ellipsis,
79
+ .van-multi-ellipsis--l2 {
80
+ max-width: 300px;
81
+ margin-left: @padding-md;
82
+ font-size: 14px;
83
+ line-height: 18px;
84
+ }
85
+
86
+ .van-ellipsis {
87
+ margin-bottom: @padding-md;
88
+ }
89
+
90
+ .van-hairline--top {
91
+ height: 30px;
92
+ background-color: @white;
93
+
94
+ &::after {
95
+ top: 5px;
96
+ }
97
+ }
98
+
99
+ .demo-animate-block {
100
+ position: fixed;
101
+ top: 50%;
102
+ left: 50%;
103
+ width: 100px;
104
+ height: 100px;
105
+ margin: -50px 0 0 -50px;
106
+ background-color: @blue;
107
+ border-radius: 8px;
108
+ }
109
+ }
110
+ </style>
@@ -0,0 +1,13 @@
1
+ @import './mixins/ellipsis';
2
+
3
+ .van-ellipsis {
4
+ .ellipsis();
5
+ }
6
+
7
+ .van-multi-ellipsis--l2 {
8
+ .multi-ellipsis(2);
9
+ }
10
+
11
+ .van-multi-ellipsis--l3 {
12
+ .multi-ellipsis(3);
13
+ }
@@ -0,0 +1,47 @@
1
+ @import './var';
2
+ @import './mixins/hairline';
3
+
4
+ [class*='van-hairline'] {
5
+ &::after {
6
+ .hairline();
7
+ }
8
+ }
9
+
10
+ .van-hairline {
11
+ &,
12
+ &--top,
13
+ &--left,
14
+ &--right,
15
+ &--bottom,
16
+ &--surround,
17
+ &--top-bottom {
18
+ position: relative;
19
+ }
20
+
21
+ &--top::after {
22
+ border-top-width: @border-width-base;
23
+ }
24
+
25
+ &--left::after {
26
+ border-left-width: @border-width-base;
27
+ }
28
+
29
+ &--right::after {
30
+ border-right-width: @border-width-base;
31
+ }
32
+
33
+ &--bottom::after {
34
+ border-bottom-width: @border-width-base;
35
+ }
36
+
37
+ &,
38
+ &-unset {
39
+ &--top-bottom::after {
40
+ border-width: @border-width-base 0;
41
+ }
42
+ }
43
+
44
+ &--surround::after {
45
+ border-width: @border-width-base;
46
+ }
47
+ }
@@ -0,0 +1,7 @@
1
+ .clearfix() {
2
+ &::after {
3
+ display: table;
4
+ clear: both;
5
+ content: '';
6
+ }
7
+ }
@@ -0,0 +1,15 @@
1
+ .multi-ellipsis(@lines) {
2
+ display: -webkit-box;
3
+ overflow: hidden;
4
+ text-overflow: ellipsis;
5
+ -webkit-line-clamp: @lines;
6
+
7
+ /* autoprefixer: ignore next */
8
+ -webkit-box-orient: vertical;
9
+ }
10
+
11
+ .ellipsis() {
12
+ overflow: hidden;
13
+ white-space: nowrap;
14
+ text-overflow: ellipsis;
15
+ }
@@ -0,0 +1,39 @@
1
+ @import '../var';
2
+
3
+ .hairline-common() {
4
+ position: absolute;
5
+ box-sizing: border-box;
6
+ content: ' ';
7
+ pointer-events: none;
8
+ }
9
+
10
+ .hairline(@color: @border-color) {
11
+ .hairline-common();
12
+
13
+ top: -50%;
14
+ right: -50%;
15
+ bottom: -50%;
16
+ left: -50%;
17
+ border: 0 solid @color;
18
+ transform: scale(0.5);
19
+ }
20
+
21
+ .hairline-top(@color: @border-color, @left: 0, @right: 0) {
22
+ .hairline-common();
23
+
24
+ top: 0;
25
+ right: @right;
26
+ left: @left;
27
+ border-top: 1px solid @color;
28
+ transform: scaleY(0.5);
29
+ }
30
+
31
+ .hairline-bottom(@color: @border-color, @left: 0, @right: 0) {
32
+ .hairline-common();
33
+
34
+ right: @right;
35
+ bottom: 0;
36
+ left: @left;
37
+ border-bottom: 1px solid @color;
38
+ transform: scaleY(0.5);
39
+ }
@@ -0,0 +1,38 @@
1
+ @import './var';
2
+
3
+ html {
4
+ -webkit-tap-highlight-color: transparent;
5
+ }
6
+
7
+ body {
8
+ margin: 0;
9
+ font-family: @base-font-family;
10
+ }
11
+
12
+ a {
13
+ text-decoration: none;
14
+ }
15
+
16
+ input,
17
+ button,
18
+ textarea {
19
+ color: inherit;
20
+ font: inherit;
21
+ }
22
+
23
+ a,
24
+ input,
25
+ button,
26
+ textarea,
27
+ [class*='van-'] {
28
+ &:focus {
29
+ outline: none;
30
+ }
31
+ }
32
+
33
+ ol,
34
+ ul {
35
+ margin: 0;
36
+ padding: 0;
37
+ list-style: none;
38
+ }