@varlet/cli 1.21.0 → 1.21.1-alpha.64

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 (133) hide show
  1. package/README.en-US.md +11 -0
  2. package/README.md +11 -0
  3. package/generators/sfc/package.json +3 -2
  4. package/generators/sfc/varlet.config.js +5 -0
  5. package/generators/tsx/package.json +3 -2
  6. package/generators/tsx/varlet.config.js +5 -0
  7. package/lib/commands/build.js +19 -15
  8. package/lib/commands/dev.d.ts +3 -2
  9. package/lib/commands/dev.js +23 -34
  10. package/lib/commands/jest.d.ts +3 -3
  11. package/lib/commands/preview.d.ts +1 -0
  12. package/lib/commands/preview.js +65 -0
  13. package/lib/compiler/compileModule.js +7 -14
  14. package/lib/compiler/compileSFC.js +7 -2
  15. package/lib/compiler/compileSiteEntry.d.ts +1 -4
  16. package/lib/compiler/compileSiteEntry.js +10 -20
  17. package/lib/compiler/compileStyle.js +1 -60
  18. package/lib/config/babel.config.js +0 -9
  19. package/lib/config/jest.config.js +1 -1
  20. package/lib/config/jest.lib.mock.d.ts +0 -0
  21. package/lib/config/jest.lib.mock.js +2 -0
  22. package/lib/config/varlet.config.d.ts +1 -1
  23. package/lib/config/vite.config.d.ts +4 -0
  24. package/lib/config/vite.config.js +128 -0
  25. package/lib/index.js +7 -2
  26. package/lib/shared/constant.d.ts +2 -8
  27. package/lib/shared/constant.js +3 -9
  28. package/lib/site/components/app-bar/index.d.ts +3 -0
  29. package/lib/site/components/app-bar/index.js +12 -0
  30. package/lib/site/components/app-bar/props.d.ts +21 -0
  31. package/lib/site/components/app-bar/props.js +28 -0
  32. package/lib/site/components/button/index.d.ts +3 -0
  33. package/lib/site/components/button/index.js +12 -0
  34. package/lib/site/components/button/props.d.ts +62 -0
  35. package/lib/site/components/button/props.js +69 -0
  36. package/lib/site/components/cell/index.d.ts +3 -0
  37. package/lib/site/components/cell/index.js +12 -0
  38. package/lib/site/components/cell/props.d.ts +27 -0
  39. package/lib/site/components/cell/props.js +30 -0
  40. package/lib/site/components/context/index.d.ts +15 -0
  41. package/lib/site/components/context/index.js +11 -0
  42. package/lib/site/components/context/lock.d.ts +10 -0
  43. package/lib/site/components/context/lock.js +94 -0
  44. package/lib/site/components/context/zIndex.d.ts +4 -0
  45. package/lib/site/components/context/zIndex.js +19 -0
  46. package/lib/site/components/icon/index.d.ts +3 -0
  47. package/lib/site/components/icon/index.js +12 -0
  48. package/lib/site/components/icon/props.d.ts +23 -0
  49. package/lib/site/components/icon/props.js +25 -0
  50. package/lib/site/components/loading/index.d.ts +3 -0
  51. package/lib/site/components/loading/index.js +12 -0
  52. package/lib/site/components/loading/props.d.ts +26 -0
  53. package/lib/site/components/loading/props.js +34 -0
  54. package/lib/site/components/menu/index.d.ts +3 -0
  55. package/lib/site/components/menu/index.js +12 -0
  56. package/lib/site/components/menu/props.d.ts +40 -0
  57. package/lib/site/components/menu/props.js +43 -0
  58. package/lib/site/components/progress/index.d.ts +3 -0
  59. package/lib/site/components/progress/index.js +12 -0
  60. package/lib/site/components/progress/props.d.ts +43 -0
  61. package/lib/site/components/progress/props.js +57 -0
  62. package/lib/site/components/ripple/index.d.ts +8 -0
  63. package/lib/site/components/ripple/index.js +125 -0
  64. package/lib/site/components/utils/components.d.ts +53 -0
  65. package/lib/site/components/utils/components.js +279 -0
  66. package/lib/site/components/utils/elements.d.ts +30 -0
  67. package/lib/site/components/utils/elements.js +240 -0
  68. package/lib/site/components/utils/shared.d.ts +36 -0
  69. package/lib/site/components/utils/shared.js +181 -0
  70. package/lib/site/mobile/main.d.ts +3 -0
  71. package/lib/site/mobile/main.js +93 -0
  72. package/lib/site/pc/main.d.ts +3 -0
  73. package/lib/site/pc/main.js +69 -0
  74. package/lib/site/useProgress.d.ts +4 -0
  75. package/lib/site/useProgress.js +58 -0
  76. package/lib/site/utils.d.ts +24 -0
  77. package/lib/site/utils.js +133 -0
  78. package/package.json +16 -30
  79. package/site/.DS_Store +0 -0
  80. package/site/components/app-bar/AppBar.vue +45 -0
  81. package/site/components/app-bar/appBar.less +66 -0
  82. package/site/components/app-bar/index.ts +10 -0
  83. package/site/components/app-bar/props.ts +25 -0
  84. package/site/components/button/Button.vue +84 -0
  85. package/site/components/button/button.less +183 -0
  86. package/site/components/button/index.ts +10 -0
  87. package/site/components/button/props.ts +70 -0
  88. package/site/components/cell/Cell.vue +42 -0
  89. package/site/components/cell/cell.less +74 -0
  90. package/site/components/cell/index.ts +10 -0
  91. package/site/components/cell/props.ts +27 -0
  92. package/site/components/context/index.ts +17 -0
  93. package/site/components/context/lock.ts +103 -0
  94. package/site/components/context/zIndex.ts +20 -0
  95. package/site/components/icon/Icon.vue +68 -0
  96. package/site/components/icon/icon.less +25 -0
  97. package/site/components/icon/index.ts +10 -0
  98. package/site/components/icon/props.ts +24 -0
  99. package/site/components/loading/Loading.vue +55 -0
  100. package/site/components/loading/index.ts +10 -0
  101. package/site/components/loading/loading.less +420 -0
  102. package/site/components/loading/props.ts +37 -0
  103. package/site/components/menu/Menu.vue +113 -0
  104. package/site/components/menu/index.ts +10 -0
  105. package/site/components/menu/menu.less +27 -0
  106. package/site/components/menu/props.ts +43 -0
  107. package/site/components/progress/Progress.vue +108 -0
  108. package/site/components/progress/index.ts +10 -0
  109. package/site/components/progress/progress.less +98 -0
  110. package/site/components/progress/props.ts +55 -0
  111. package/site/components/ripple/index.ts +167 -0
  112. package/site/components/ripple/ripple.less +17 -0
  113. package/site/components/styles/common.less +64 -0
  114. package/site/components/styles/elevation.less +126 -0
  115. package/site/components/styles/var.less +27 -0
  116. package/site/components/utils/components.ts +53 -0
  117. package/site/components/utils/elements.ts +83 -0
  118. package/site/components/utils/shared.ts +27 -0
  119. package/site/{pc/index.html → index.html} +6 -4
  120. package/site/mobile/App.vue +20 -18
  121. package/site/mobile/components/AppHome.vue +6 -8
  122. package/site/mobile/main.ts +17 -2
  123. package/site/{mobile/mobile.html → mobile.html} +6 -5
  124. package/site/pc/App.vue +16 -11
  125. package/site/pc/components/AppHeader.vue +15 -13
  126. package/site/pc/components/AppMobile.vue +3 -3
  127. package/site/pc/components/AppSidebar.vue +17 -23
  128. package/site/pc/main.ts +10 -2
  129. package/site/useProgress.ts +11 -9
  130. package/site/utils.ts +14 -3
  131. package/varlet.default.config.js +3 -2
  132. package/generators/sfc/yarn.lock +0 -11231
  133. package/generators/tsx/yarn.lock +0 -11231
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div
3
+ class="var-site-app-bar"
4
+ :class="{ 'var-site-elevation--3': elevation }"
5
+ :style="{
6
+ background: color,
7
+ color: textColor,
8
+ }"
9
+ >
10
+ <div class="var-site-app-bar__left" v-if="$slots.left">
11
+ <slot name="left" />
12
+ </div>
13
+
14
+ <div
15
+ class="var-site-app-bar__title"
16
+ :class="`var-site-app-bar__title-${titlePosition}`"
17
+ :style="{
18
+ paddingLeft: $slots.left && titlePosition !== 'center' ? '30px' : '10px',
19
+ paddingRight: $slots.right && titlePosition !== 'center' ? '30px' : '10px',
20
+ }"
21
+ >
22
+ <slot>{{ title }}</slot>
23
+ </div>
24
+
25
+ <div class="var-site-app-bar__right" v-if="$slots.right">
26
+ <slot name="right" />
27
+ </div>
28
+ </div>
29
+ </template>
30
+
31
+ <script lang="ts">
32
+ import { defineComponent } from 'vue'
33
+ import { props } from './props'
34
+
35
+ export default defineComponent({
36
+ name: 'VarSiteAppBar',
37
+ props,
38
+ })
39
+ </script>
40
+
41
+ <style lang="less">
42
+ @import '../styles/common';
43
+ @import '../styles/elevation';
44
+ @import './appBar';
45
+ </style>
@@ -0,0 +1,66 @@
1
+ @site-app-bar-color: var(--site-color-primary);
2
+ @site-app-bar-text-color: #fff;
3
+ @site-app-bar-height: 50px;
4
+ @site-app-bar-padding: 0 10px;
5
+ @site-app-bar-title-line-height: 50px;
6
+
7
+ :root {
8
+ --site-app-bar-color: @site-app-bar-color;
9
+ --site-app-bar-text-color: #fff;
10
+ --site-app-bar-height: @site-app-bar-height;
11
+ --site-app-bar-padding: @site-app-bar-padding;
12
+ --site-app-bar-title-line-height: @site-app-bar-title-line-height;
13
+ }
14
+
15
+ .var-site-app-bar {
16
+ position: relative;
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ height: var(--site-app-bar-height);
21
+ padding: var(--site-app-bar-padding);
22
+ background: var(--site-app-bar-color);
23
+ color: var(--site-app-bar-text-color);
24
+
25
+ &__title {
26
+ flex: 1;
27
+ white-space: nowrap;
28
+ text-overflow: ellipsis;
29
+ overflow: hidden;
30
+ line-height: var(--site-app-bar-title-line-height);
31
+ display: flex;
32
+ }
33
+
34
+ &__title-center {
35
+ justify-content: center;
36
+ }
37
+
38
+ &__title-left {
39
+ justify-content: flex-start;
40
+ }
41
+
42
+ &__title-right {
43
+ justify-content: flex-end;
44
+ }
45
+
46
+ &__left,
47
+ &__right {
48
+ display: flex;
49
+ justify-content: flex-start;
50
+ align-items: center;
51
+ height: 100%;
52
+ z-index: 2;
53
+ }
54
+
55
+ &__left {
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ }
60
+
61
+ &__right {
62
+ position: absolute;
63
+ top: 0;
64
+ right: 0;
65
+ }
66
+ }
@@ -0,0 +1,10 @@
1
+ import type { App } from 'vue'
2
+ import AppBar from './AppBar.vue'
3
+
4
+ AppBar.install = function (app: App) {
5
+ app.component(AppBar.name, AppBar)
6
+ }
7
+
8
+ export const _AppBarComponent = AppBar
9
+
10
+ export default AppBar
@@ -0,0 +1,25 @@
1
+ export function positionValidator(position: string): boolean {
2
+ const validPositions = ['left', 'center', 'right']
3
+ return validPositions.includes(position)
4
+ }
5
+
6
+ export const props = {
7
+ color: {
8
+ type: String,
9
+ },
10
+ textColor: {
11
+ type: String,
12
+ },
13
+ title: {
14
+ type: String,
15
+ },
16
+ titlePosition: {
17
+ type: String,
18
+ default: 'left',
19
+ validator: positionValidator,
20
+ },
21
+ elevation: {
22
+ type: Boolean,
23
+ default: true,
24
+ },
25
+ }
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <button
3
+ v-ripple="{ disabled: disabled || !ripple }"
4
+ class="var-site-button var-site--box"
5
+ :class="[
6
+ `var-site-button--${size}`,
7
+ block ? 'var-site--flex var-site-button--block' : 'var-site--inline-flex',
8
+ disabled ? 'var-site-button--disabled' : null,
9
+ text ? `var-site-button--text-${type}` : `var-site-button--${type}`,
10
+ text ? 'var-site-button--text' : 'var-elevation--1',
11
+ text && disabled ? 'var-site-button--text-disabled' : null,
12
+ round ? 'var-site-button--round' : null,
13
+ outline ? 'var-site-button--outline' : null,
14
+ ]"
15
+ :style="{
16
+ color: textColor,
17
+ background: color,
18
+ }"
19
+ :disabled="disabled"
20
+ @click="handleClick"
21
+ @touchstart="handleTouchstart"
22
+ >
23
+ <var-site-loading
24
+ class="var-site-button__loading"
25
+ :type="loadingType"
26
+ :size="loadingSize"
27
+ :radius="loadingRadius"
28
+ v-if="loading"
29
+ />
30
+ <div class="var-site-button__content" :class="[loading ? 'var-site-button--hidden' : null]">
31
+ <slot />
32
+ </div>
33
+ </button>
34
+ </template>
35
+
36
+ <script lang="ts">
37
+ import Ripple from '../ripple'
38
+ import Loading from '../loading'
39
+ import { defineComponent } from 'vue'
40
+ import { props } from './props'
41
+
42
+ export default defineComponent({
43
+ name: 'VarSiteButton',
44
+ components: {
45
+ [Loading.name]: Loading,
46
+ },
47
+ directives: { Ripple },
48
+ props,
49
+ setup(props) {
50
+ const handleClick = (e: Event) => {
51
+ const { loading, disabled, onClick } = props
52
+
53
+ if (loading || disabled) {
54
+ return
55
+ }
56
+
57
+ onClick?.(e)
58
+ }
59
+
60
+ const handleTouchstart = (e: Event) => {
61
+ const { loading, disabled, onTouchstart } = props
62
+
63
+ if (loading || disabled) {
64
+ return
65
+ }
66
+
67
+ onTouchstart?.(e)
68
+ }
69
+
70
+ return {
71
+ handleClick,
72
+ handleTouchstart,
73
+ }
74
+ },
75
+ })
76
+ </script>
77
+
78
+ <style lang="less">
79
+ @import '../styles/common';
80
+ @import '../styles/elevation';
81
+ @import '../ripple/ripple';
82
+ @import '../loading/loading';
83
+ @import './button';
84
+ </style>
@@ -0,0 +1,183 @@
1
+ @site-button-default-color: #f5f5f5;
2
+ @site-button-primary-color: var(--site-color-primary);
3
+ @site-button-danger-color: var(--site-color-danger);
4
+ @site-button-success-color: var(--site-color-success);
5
+ @site-button-warning-color: var(--site-color-warning);
6
+ @site-button-info-color: var(--site-color-info);
7
+ @site-button-disabled-color: var(--site-color-disabled);
8
+ @site-button-disabled-text-color: #bdbdbd;
9
+ @site-button-border-radius: 4px;
10
+ @site-button-mini-padding: 0 9px;
11
+ @site-button-small-padding: 0 11px;
12
+ @site-button-normal-padding: 0 15px;
13
+ @site-button-large-padding: 0 22px;
14
+ @site-button-round-padding: 6px;
15
+ @site-button-mini-height: 20px;
16
+ @site-button-small-height: 28px;
17
+ @site-button-normal-height: 36px;
18
+ @site-button-large-height: 44px;
19
+
20
+ :root {
21
+ --site-button-default-color: @site-button-default-color;
22
+ --site-button-primary-color: @site-button-primary-color;
23
+ --site-button-danger-color: @site-button-danger-color;
24
+ --site-button-success-color: @site-button-success-color;
25
+ --site-button-warning-color: @site-button-warning-color;
26
+ --site-button-info-color: @site-button-info-color;
27
+ --site-button-disabled-color: @site-button-disabled-color;
28
+ --site-button-disabled-text-color: @site-button-disabled-text-color;
29
+ --site-button-border-radius: @site-button-border-radius;
30
+ --site-button-mini-padding: @site-button-mini-padding;
31
+ --site-button-small-padding: @site-button-small-padding;
32
+ --site-button-normal-padding: @site-button-normal-padding;
33
+ --site-button-large-padding: @site-button-large-padding;
34
+ --site-button-round-padding: @site-button-round-padding;
35
+ --site-button-mini-height: @site-button-mini-height;
36
+ --site-button-small-height: @site-button-small-height;
37
+ --site-button-normal-height: @site-button-normal-height;
38
+ --site-button-large-height: @site-button-large-height;
39
+ }
40
+
41
+ .var-site-button {
42
+ position: relative;
43
+ justify-content: center;
44
+ align-items: center;
45
+ outline: none;
46
+ border: none;
47
+ line-height: 1.2;
48
+ border-radius: var(--site-button-border-radius);
49
+ user-select: none;
50
+ cursor: pointer;
51
+ font-family: inherit;
52
+ transition: box-shadow 0.2s;
53
+ will-change: box-shadow;
54
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
55
+ white-space: nowrap;
56
+
57
+ &:active {
58
+ box-shadow: 0 3px 5px -1px var(--site-shadow-key-umbra-opacity), 0 5px 8px 0 var(--site-shadow-key-penumbra-opacity),
59
+ 0 1px 14px 0 var(--site-shadow-key-ambient-opacity);
60
+ }
61
+
62
+ &__loading {
63
+ position: absolute;
64
+ top: 50%;
65
+ left: 50%;
66
+ transform: translate(-50%, -50%);
67
+ }
68
+
69
+ &--default {
70
+ color: inherit;
71
+ background-color: var(--site-button-default-color);
72
+ }
73
+
74
+ &--primary {
75
+ color: #fff;
76
+ background-color: var(--site-button-primary-color);
77
+ }
78
+
79
+ &--info {
80
+ color: #fff;
81
+ background-color: var(--site-button-info-color);
82
+ }
83
+
84
+ &--success {
85
+ color: #fff;
86
+ background-color: var(--site-button-success-color);
87
+ }
88
+
89
+ &--warning {
90
+ color: #fff;
91
+ background-color: var(--site-button-warning-color);
92
+ }
93
+
94
+ &--danger {
95
+ color: #fff;
96
+ background-color: var(--site-button-danger-color);
97
+ }
98
+
99
+ &--disabled {
100
+ background-color: var(--site-button-disabled-color);
101
+ color: var(--site-button-disabled-text-color);
102
+ cursor: not-allowed;
103
+ box-shadow: none !important;
104
+ }
105
+
106
+ &--block {
107
+ width: 100%;
108
+ }
109
+
110
+ &--text {
111
+ background-color: transparent;
112
+
113
+ &:active {
114
+ box-shadow: none;
115
+ }
116
+ }
117
+
118
+ &--text-default {
119
+ color: inherit;
120
+ }
121
+
122
+ &--text-primary {
123
+ color: var(--site-button-primary-color);
124
+ }
125
+
126
+ &--text-info {
127
+ color: var(--site-button-info-color);
128
+ }
129
+
130
+ &--text-success {
131
+ color: var(--site-button-success-color);
132
+ }
133
+
134
+ &--text-warning {
135
+ color: var(--site-button-warning-color);
136
+ }
137
+
138
+ &--text-danger {
139
+ color: var(--site-button-danger-color);
140
+ }
141
+
142
+ &--text-disabled {
143
+ color: var(--site-button-disabled-text-color);
144
+ }
145
+
146
+ &--normal {
147
+ height: var(--site-button-normal-height);
148
+ padding: var(--site-button-normal-padding);
149
+ font-size: var(--site-font-size-md);
150
+ }
151
+
152
+ &--large {
153
+ height: var(--site-button-large-height);
154
+ padding: var(--site-button-large-padding);
155
+ font-size: var(--site-font-size-lg);
156
+ }
157
+
158
+ &--small {
159
+ height: var(--site-button-small-height);
160
+ padding: var(--site-button-small-padding);
161
+ font-size: var(--site-font-size-sm);
162
+ }
163
+
164
+ &--mini {
165
+ height: var(--site-button-mini-height);
166
+ padding: var(--site-button-mini-padding);
167
+ font-size: var(--site-font-size-xs);
168
+ }
169
+
170
+ &--round {
171
+ padding: var(--site-button-round-padding);
172
+ border-radius: 50%;
173
+ height: auto;
174
+ }
175
+
176
+ &--outline {
177
+ border: thin solid currentColor;
178
+ }
179
+
180
+ &--hidden {
181
+ opacity: 0;
182
+ }
183
+ }
@@ -0,0 +1,10 @@
1
+ import type { App } from 'vue'
2
+ import Button from './Button.vue'
3
+
4
+ Button.install = function (app: App) {
5
+ app.component(Button.name, Button)
6
+ }
7
+
8
+ export const _ButtonComponent = Button
9
+
10
+ export default Button
@@ -0,0 +1,70 @@
1
+ import { props as loadingProps } from '../loading/props'
2
+ import { pickProps } from '../utils/components'
3
+ import type { PropType } from 'vue'
4
+
5
+ function typeValidator(type: string): boolean {
6
+ return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type)
7
+ }
8
+
9
+ function sizeValidator(size: string): boolean {
10
+ return ['normal', 'mini', 'small', 'large'].includes(size)
11
+ }
12
+
13
+ export const props = {
14
+ type: {
15
+ type: String as PropType<'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger'>,
16
+ default: 'default',
17
+ validator: typeValidator,
18
+ },
19
+ size: {
20
+ type: String as PropType<'normal' | 'mini' | 'small' | 'large'>,
21
+ default: 'normal',
22
+ validator: sizeValidator,
23
+ },
24
+ loading: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ round: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ block: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+ text: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ outline: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+ disabled: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ ripple: {
49
+ type: Boolean,
50
+ default: true,
51
+ },
52
+ color: {
53
+ type: String,
54
+ },
55
+ textColor: {
56
+ type: String,
57
+ },
58
+ loadingRadius: {
59
+ type: [Number, String],
60
+ default: 12,
61
+ },
62
+ loadingType: pickProps(loadingProps, 'type'),
63
+ loadingSize: pickProps(loadingProps, 'size'),
64
+ onClick: {
65
+ type: Function as PropType<(e: Event) => void>,
66
+ },
67
+ onTouchstart: {
68
+ type: Function as PropType<(e: Event) => void>,
69
+ },
70
+ }
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="var-site-cell" :class="[border ? 'var-site-cell--border' : null]">
3
+ <div class="var-site-cell__icon" :class="[iconClass ? iconClass : null]" v-if="$slots.icon || icon">
4
+ <slot name="icon">
5
+ <var-site-icon class="var-site--flex" :name="icon" />
6
+ </slot>
7
+ </div>
8
+ <div class="var-site-cell__content">
9
+ <div class="var-site-cell__title" :class="[titleClass ? titleClass : null]">
10
+ <slot>{{ title }}</slot>
11
+ </div>
12
+ <div class="var-site-cell__desc" :class="[descClass ? descClass : null]" v-if="$slots.desc || desc">
13
+ <slot name="desc">
14
+ {{ desc }}
15
+ </slot>
16
+ </div>
17
+ </div>
18
+ <div class="var-site-cell__extra" :class="[extraClass ? extraClass : null]" v-if="$slots.extra">
19
+ <slot name="extra" />
20
+ </div>
21
+ </div>
22
+ </template>
23
+
24
+ <script lang="ts">
25
+ import { defineComponent } from 'vue'
26
+ import { props } from './props'
27
+ import Icon from '../icon'
28
+
29
+ export default defineComponent({
30
+ name: 'VarSiteCell',
31
+ components: {
32
+ [Icon.name]: Icon,
33
+ },
34
+ props,
35
+ })
36
+ </script>
37
+
38
+ <style lang="less">
39
+ @import '../styles/common';
40
+ @import '../icon/icon';
41
+ @import './cell';
42
+ </style>
@@ -0,0 +1,74 @@
1
+ @site-cell-font-size: var(--site-font-size-md);
2
+ @site-cell-desc-font-size: var(--site-font-size-sm);
3
+ @site-cell-desc-color: rgba(0, 0, 0, 0.6);
4
+ @site-cell-padding: 10px 12px;
5
+ @site-cell-min-height: 40px;
6
+ @site-cell-border-color: #bcc2cb;
7
+ @site-cell-border-left: 12px;
8
+ @site-cell-border-right: 12px;
9
+ @site-cell-icon-right: 8px;
10
+ @site-cell-extra-left: 8px;
11
+
12
+ :root {
13
+ --site-cell-font-size: @site-cell-font-size;
14
+ --site-cell-desc-font-size: @site-cell-desc-font-size;
15
+ --site-cell-desc-color: @site-cell-desc-color;
16
+ --site-cell-padding: @site-cell-padding;
17
+ --site-cell-min-height: @site-cell-min-height;
18
+ --site-cell-border-color: @site-cell-border-color;
19
+ --site-cell-border-left: @site-cell-border-left;
20
+ --site-cell-border-right: @site-cell-border-right;
21
+ --site-cell-icon-right: @site-cell-icon-right;
22
+ --site-cell-extra-left: @site-cell-extra-left;
23
+ }
24
+
25
+ .var-site-cell {
26
+ align-items: center;
27
+ display: flex;
28
+ min-height: var(--site-cell-min-height);
29
+ outline: none;
30
+ padding: var(--site-cell-padding);
31
+ position: relative;
32
+ box-sizing: border-box;
33
+ font-size: var(--site-cell-font-size);
34
+
35
+ &--border {
36
+ &::after {
37
+ position: absolute;
38
+ box-sizing: border-box;
39
+ content: ' ';
40
+ pointer-events: none;
41
+ right: var(--site-cell-border-right);
42
+ bottom: 0;
43
+ left: var(--site-cell-border-left);
44
+ border-bottom: 1px solid var(--site-cell-border-color);
45
+ transform: scaleY(0.5);
46
+ }
47
+ }
48
+
49
+ &__icon {
50
+ margin-right: var(--site-cell-icon-right);
51
+ flex: 0;
52
+ }
53
+
54
+ &__content {
55
+ flex: 1;
56
+ overflow: hidden;
57
+ }
58
+
59
+ &__title {
60
+ overflow: hidden;
61
+ text-overflow: ellipsis;
62
+ white-space: nowrap;
63
+ }
64
+
65
+ &__desc {
66
+ font-size: var(--site-cell-desc-font-size);
67
+ color: var(--site-cell-desc-color);
68
+ }
69
+
70
+ &__extra {
71
+ flex: 0;
72
+ margin-left: var(--site-cell-extra-left);
73
+ }
74
+ }
@@ -0,0 +1,10 @@
1
+ import type { App } from 'vue'
2
+ import Cell from './Cell.vue'
3
+
4
+ Cell.install = function (app: App) {
5
+ app.component(Cell.name, Cell)
6
+ }
7
+
8
+ export const _CellComponent = Cell
9
+
10
+ export default Cell
@@ -0,0 +1,27 @@
1
+ export const props = {
2
+ title: {
3
+ type: [Number, String],
4
+ },
5
+ icon: {
6
+ type: String,
7
+ },
8
+ desc: {
9
+ type: String,
10
+ },
11
+ border: {
12
+ type: Boolean,
13
+ default: false,
14
+ },
15
+ iconClass: {
16
+ type: String,
17
+ },
18
+ titleClass: {
19
+ type: String,
20
+ },
21
+ descClass: {
22
+ type: String,
23
+ },
24
+ extraClass: {
25
+ type: String,
26
+ },
27
+ }
@@ -0,0 +1,17 @@
1
+ import { reactive } from 'vue'
2
+
3
+ interface Context {
4
+ locks: Record<any, number>
5
+ zIndex: number
6
+ touchmoveForbid: boolean
7
+ }
8
+
9
+ const context: Context = {
10
+ locks: {},
11
+ zIndex: 2000,
12
+ touchmoveForbid: true,
13
+ }
14
+
15
+ export const _ContextComponent = reactive<Context>(context)
16
+
17
+ export default reactive<Context>(context)