lew-ui 1.0.2 → 1.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.
Files changed (73) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +20 -0
  3. package/README.md +16 -0
  4. package/index.html +18 -0
  5. package/package.json +19 -12
  6. package/{components/base → packages/avatar}/LewAvatar.vue +0 -0
  7. package/packages/avatar/index.ts +9 -0
  8. package/{directives → packages/directives}/index.ts +0 -0
  9. package/{directives → packages/directives}/tooltips.ts +0 -0
  10. package/{hooks → packages/hooks}/index.ts +0 -0
  11. package/{hooks → packages/hooks}/useDOMCreate.ts +0 -0
  12. package/packages/index.ts +17 -0
  13. package/prettier.config.js +38 -0
  14. package/public/favicon.ico +0 -0
  15. package/src/App.vue +251 -0
  16. package/src/assets/logo.png +0 -0
  17. package/src/assets/style/hljs.scss +86 -0
  18. package/src/assets/style/main.scss +87 -0
  19. package/src/assets/style/reset.scss +107 -0
  20. package/src/assets/style/var.scss +90 -0
  21. package/src/components/demo/DemoBox.vue +105 -0
  22. package/src/components/directive/lewTooltips.ts +23 -0
  23. package/{components → src/components}/feedback/LewAlert.vue +0 -0
  24. package/{components → src/components}/feedback/LewMessage.vue +0 -0
  25. package/{components → src/components}/feedback/LewModal.vue +1 -1
  26. package/{components → src/components}/form/LewCheckbox.vue +0 -0
  27. package/{components → src/components}/form/LewCheckboxGroup.vue +1 -1
  28. package/{components/form/FormItem.vue → src/components/form/LewFormItem.vue} +0 -0
  29. package/{components → src/components}/form/LewInput.vue +0 -0
  30. package/{components → src/components}/form/LewRadio.vue +0 -0
  31. package/{components → src/components}/form/LewRadioGroup.vue +1 -1
  32. package/{components → src/components}/form/LewSelect.vue +1 -1
  33. package/{components → src/components}/form/LewSwitch.vue +0 -0
  34. package/{components → src/components}/form/LewTabs.vue +0 -0
  35. package/{components → src/components}/form/LewTextarea.vue +0 -0
  36. package/src/components/general/LewAvatar.vue +107 -0
  37. package/{components/base → src/components/general}/LewBadge.vue +0 -0
  38. package/{components/base → src/components/general}/LewButton.vue +0 -0
  39. package/{components/base → src/components/general}/LewTitle.vue +0 -0
  40. package/src/components/hooks/useDOMCreate.ts +13 -0
  41. package/src/components/index.ts +37 -0
  42. package/src/components/layout/LewSiderbar.vue +98 -0
  43. package/src/env.d.ts +11 -0
  44. package/src/main.ts +22 -0
  45. package/src/router/index.ts +59 -0
  46. package/src/views/demo/feedback/LewAlert.vue +194 -0
  47. package/src/views/demo/feedback/LewDialog.vue +20 -0
  48. package/src/views/demo/feedback/LewMessage.vue +20 -0
  49. package/src/views/demo/feedback/LewModal.vue +127 -0
  50. package/src/views/demo/feedback/LewPopover.vue +20 -0
  51. package/src/views/demo/feedback/LewResult.vue +20 -0
  52. package/src/views/demo/feedback/LewTooltip.vue +164 -0
  53. package/src/views/demo/form/LewCascader.vue +24 -0
  54. package/src/views/demo/form/LewCheckbox.vue +158 -0
  55. package/src/views/demo/form/LewForm.vue +232 -0
  56. package/src/views/demo/form/LewInput.vue +55 -0
  57. package/src/views/demo/form/LewInputTag.vue +25 -0
  58. package/src/views/demo/form/LewRadio.vue +104 -0
  59. package/src/views/demo/form/LewSelect.vue +83 -0
  60. package/src/views/demo/form/LewSwitch.vue +61 -0
  61. package/src/views/demo/form/LewTabs.vue +75 -0
  62. package/src/views/demo/form/LewTextarea.vue +56 -0
  63. package/src/views/demo/general/LewAvatar copy.vue +58 -0
  64. package/src/views/demo/general/LewAvatar.vue +79 -0
  65. package/src/views/demo/general/LewBadge.vue +98 -0
  66. package/src/views/demo/general/LewButton.vue +66 -0
  67. package/src/views/demo/general/LewTitle.vue +47 -0
  68. package/tsconfig.json +18 -0
  69. package/tsconfig.node.json +8 -0
  70. package/vite.config.ts +16 -0
  71. package/vscode.setting.json +26 -0
  72. package/components/index.ts +0 -35
  73. package/index.ts +0 -3
package/.eslintignore ADDED
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ index.html
4
+ prettier.config.js
5
+ .eslintrc.js
package/.eslintrc.js ADDED
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ parser: 'vue-eslint-parser',
3
+ parserOptions: {
4
+ parser: '@typescript-eslint/parser',
5
+ ecmaVersion: 2020,
6
+ sourceType: 'module',
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
11
+ extends: [
12
+ 'plugin:vue/vue3-recommended',
13
+ 'plugin:@typescript-eslint/recommended',
14
+ 'prettier',
15
+ 'plugin:prettier/recommended',
16
+ ],
17
+ rules: {
18
+ // override/add rules settings here, such as:
19
+ },
20
+ };
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Vue 3 + TypeScript + Vite
2
+
3
+ This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
8
+
9
+ ## Type Support For `.vue` Imports in TS
10
+
11
+ Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
12
+
13
+ 1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
14
+ 2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
15
+
16
+ You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
package/index.html ADDED
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <link rel="icon" href="/favicon.ico" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <link href="https://cdn.bootcss.com/highlight.js/11.5.1/styles/atom-one-dark.min.css" rel="stylesheet" />
9
+ <script src="https://cdn.bootcss.com/highlight.js/11.5.1/highlight.min.js"></script>
10
+ <title>Lew Design</title>
11
+ </head>
12
+
13
+ <body>
14
+ <div id="app"></div>
15
+ <script type="module" src="/src/main.ts"></script>
16
+ </body>
17
+
18
+ </html>
package/package.json CHANGED
@@ -1,25 +1,32 @@
1
1
  {
2
2
  "name": "lew-ui",
3
- "version": "1.0.2",
4
- "description": "A Component Library for Vue 3",
5
- "keywords": [
6
- "component library",
7
- "ui framework",
8
- "ui",
9
- "vue3",
10
- "mini"
11
- ],
12
- "homepage": "https://lew.kamtao.com",
13
- "main": "lib/index.js",
3
+ "version": "1.0.3",
4
+ "description": "A Component Library for Vue3.js.",
5
+ "main": "./dist/lew.umd.min.js",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vue-tsc --noEmit && vite build",
9
+ "preview": "vite preview",
10
+ "eslint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
11
+ "prettier": "prettier --write"
12
+ },
14
13
  "dependencies": {
15
14
  "tippy.js": "^6.3.7",
16
- "vue": "^3.2.25"
15
+ "vue": "^3.2.25",
16
+ "vue-router": "^4.0.13"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^17.0.35",
20
+ "@typescript-eslint/eslint-plugin": "^5.26.0",
21
+ "@typescript-eslint/parser": "^5.26.0",
20
22
  "@vicons/fluent": "^0.12.0",
21
23
  "@vicons/utils": "^0.1.4",
22
24
  "@vitejs/plugin-vue": "^2.3.3",
25
+ "eslint": "^8.16.0",
26
+ "eslint-config-prettier": "^8.5.0",
27
+ "eslint-plugin-prettier": "^4.0.0",
28
+ "eslint-plugin-vue": "^9.0.1",
29
+ "prettier": "^2.6.2",
23
30
  "sass": "^1.52.1",
24
31
  "typescript": "^4.5.4",
25
32
  "vite": "^2.9.9",
@@ -0,0 +1,9 @@
1
+ import { App } from 'vue';
2
+ import LewAvatar from './LewAvatar.vue'; // 导入组件
3
+
4
+ LewAvatar.install = (app: App) => {
5
+ // 组件install属性
6
+ app.component(LewAvatar.name, LewAvatar); // 定义组件-vue3的写法
7
+ };
8
+
9
+ export default LewAvatar;
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,17 @@
1
+ import { App } from 'vue';
2
+ import LewButton from './avatar/';
3
+
4
+ const components = [LewButton];
5
+
6
+ const install = (app: App) => {
7
+ components.forEach((item) => {
8
+ app.component(item.name, item);
9
+ });
10
+ };
11
+
12
+ export default {
13
+ // 全局导出
14
+ version: '1.0.1',
15
+ install,
16
+ LewButton,
17
+ };
@@ -0,0 +1,38 @@
1
+ module.exports = {
2
+ // 一行最多 80 字符
3
+ printWidth: 80,
4
+ // 使用 4 个空格缩进
5
+ tabWidth: 4,
6
+ // 不使用 tab 缩进,而使用空格
7
+ useTabs: false,
8
+
9
+ // 行尾需要有分号
10
+ semi: true,
11
+ // 使用单引号代替双引号
12
+ singleQuote: true,
13
+ // 对象的 key 仅在必要时用引号
14
+ quoteProps: 'as-needed',
15
+ // jsx 不使用单引号,而使用双引号
16
+ jsxSingleQuote: false,
17
+ // 末尾使用逗号
18
+ trailingComma: 'all',
19
+ // 大括号内的首尾需要空格 { foo: bar }
20
+ bracketSpacing: true,
21
+ // jsx 标签的反尖括号需要换行
22
+ jsxBracketSameLine: false,
23
+ // 箭头函数,只有一个参数的时候,也需要括号
24
+ arrowParens: 'always',
25
+ // 每个文件格式化的范围是文件的全部内容
26
+ rangeStart: 0,
27
+ rangeEnd: Infinity,
28
+ // 不需要写文件开头的 @prettier
29
+ requirePragma: false,
30
+ // 不需要自动在文件开头插入 @prettier
31
+ insertPragma: false,
32
+ // 使用默认的折行标准
33
+ proseWrap: 'preserve',
34
+ // 根据显示样式决定 html 要不要折行
35
+ htmlWhitespaceSensitivity: 'css',
36
+ // 换行符使用 lf
37
+ endOfLine: 'auto',
38
+ };
Binary file
package/src/App.vue ADDED
@@ -0,0 +1,251 @@
1
+ <script setup lang="ts">
2
+ import TheSiderbar from './components/layout/LewSiderbar.vue';
3
+ import { ref } from 'vue';
4
+ import { useRouter } from 'vue-router';
5
+
6
+ const router = useRouter();
7
+
8
+ type Item = {
9
+ name: string;
10
+ path: string;
11
+ label: string;
12
+ type: string;
13
+ };
14
+
15
+ type Group = {
16
+ title: string;
17
+ items: Item[];
18
+ };
19
+
20
+ let group = ref<Group[]>([]);
21
+ group.value = [
22
+ {
23
+ title: '通用',
24
+ items: [
25
+ {
26
+ name: 'Avatar',
27
+ path: '/Avatar',
28
+ label: '',
29
+ type: 'success',
30
+ },
31
+ {
32
+ name: 'Button',
33
+ path: '/Button',
34
+ label: '',
35
+ type: 'success',
36
+ },
37
+ {
38
+ name: 'Badge',
39
+ path: '/Badge',
40
+ label: '',
41
+ type: 'success',
42
+ },
43
+ {
44
+ name: 'Title',
45
+ path: '/Title',
46
+ label: '',
47
+ type: 'success',
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ title: '表单',
53
+ items: [
54
+ {
55
+ name: 'Form',
56
+ path: '/Form',
57
+ label: '',
58
+ type: 'success',
59
+ },
60
+ {
61
+ name: 'Input',
62
+ path: '/Input',
63
+ label: '',
64
+ type: 'success',
65
+ },
66
+
67
+ {
68
+ name: 'Textarea',
69
+ path: '/Textarea',
70
+ label: '',
71
+ type: 'success',
72
+ },
73
+ {
74
+ name: 'Checkbox',
75
+ path: '/Checkbox',
76
+ label: '',
77
+ type: 'success',
78
+ },
79
+ {
80
+ name: 'Radio',
81
+ path: '/Radio',
82
+ label: '',
83
+ type: 'success',
84
+ },
85
+ {
86
+ name: 'Tabs',
87
+ path: '/Tabs',
88
+ label: '',
89
+ type: 'success',
90
+ },
91
+ {
92
+ name: 'Select',
93
+ path: '/Select',
94
+ label: '',
95
+ type: 'success',
96
+ },
97
+ // {
98
+ // name: 'Cascader',
99
+ // path: '/Cascader',
100
+ // label: '',
101
+ // type: 'danger',
102
+ // },
103
+ {
104
+ name: 'Switch',
105
+ path: '/Switch',
106
+ label: '',
107
+ type: 'success',
108
+ },
109
+ // {
110
+ // name: 'InputTag',
111
+ // path: '/InputTag',
112
+ // label: '',
113
+ // type: 'danger',
114
+ // },
115
+ ],
116
+ },
117
+ {
118
+ title: '反馈',
119
+ items: [
120
+ {
121
+ name: 'Alert',
122
+ path: '/Alert',
123
+ label: '',
124
+ type: 'success',
125
+ },
126
+
127
+ {
128
+ name: 'Dialog',
129
+ path: '/Dialog',
130
+ label: '',
131
+ type: 'danger',
132
+ },
133
+ {
134
+ name: 'Message',
135
+ path: '/Message',
136
+ label: '',
137
+ type: 'danger',
138
+ },
139
+ {
140
+ name: 'Modal',
141
+ path: '/Modal',
142
+ label: '',
143
+ type: 'success',
144
+ },
145
+ {
146
+ name: 'Popover',
147
+ path: '/Popover',
148
+ label: '',
149
+ type: 'danger',
150
+ },
151
+ {
152
+ name: 'Tooltip',
153
+ path: '/Tooltip',
154
+ label: '',
155
+ type: 'success',
156
+ },
157
+ {
158
+ name: 'Result',
159
+ path: '/Result',
160
+ label: '',
161
+ type: 'danger',
162
+ },
163
+ ],
164
+ },
165
+ ];
166
+
167
+ const toPath = (path: string) => {
168
+ router.push(path);
169
+ };
170
+ </script>
171
+
172
+ <template>
173
+ <div class="wrapper">
174
+ <div class="Header">
175
+ <div class="logo">Lew Design</div>
176
+ <div class="menu">
177
+ <div @click="toPath(`/`)">组件库</div>
178
+ <a target="_blank" href="https://github.com/lewkamtao/Lew-UI"
179
+ >Github</a
180
+ >
181
+ </div>
182
+ </div>
183
+ <div class="container">
184
+ <div class="sider">
185
+ <TheSiderbar :group="group" />
186
+ </div>
187
+ <div class="app-main btf-scrollbar">
188
+ <router-view></router-view>
189
+ </div>
190
+ </div>
191
+ </div>
192
+ </template>
193
+
194
+ <style lang="scss" scoped>
195
+ .wrapper {
196
+ max-width: 1280px;
197
+ margin: 0 auto;
198
+ overflow: hidden;
199
+ background: var(--body-bgcolor);
200
+ border-left: 1px #eee solid;
201
+ border-right: 1px #eee solid;
202
+
203
+ .container {
204
+ height: calc(100vh - 60px);
205
+ display: flex;
206
+ }
207
+ .sider {
208
+ position: fixed;
209
+ height: calc(100vh - 60px);
210
+ }
211
+ .app-main {
212
+ margin-left: 250px;
213
+ width: calc(100% - 250px);
214
+ height: calc(100vh - 60px);
215
+ overflow-y: scroll;
216
+ box-sizing: border-box;
217
+ padding: 50px;
218
+ background-color: rgb(242, 242, 242);
219
+ }
220
+
221
+ .Header {
222
+ display: flex;
223
+ align-items: center;
224
+ justify-content: space-between;
225
+ padding: 0px 30px;
226
+ width: 100%;
227
+ height: 60px;
228
+ box-sizing: border-box;
229
+ border-bottom: 1px #eee solid;
230
+ background: var(--body-bgcolor);
231
+ .logo {
232
+ font-size: 20px;
233
+ font-weight: bold;
234
+ }
235
+ .menu {
236
+ a,
237
+ div {
238
+ display: inline-block;
239
+ margin: 10px;
240
+ padding: 10px;
241
+ opacity: 0.6;
242
+ cursor: pointer;
243
+ }
244
+ a:hover,
245
+ div:hover {
246
+ opacity: 1;
247
+ }
248
+ }
249
+ }
250
+ }
251
+ </style>
Binary file
@@ -0,0 +1,86 @@
1
+ /*
2
+ Atom One Light by Daniel Gamage
3
+ Original One Light Syntax theme from https://github.com/atom/one-light-syntax
4
+ */
5
+
6
+ .hljs {
7
+ color: #b3b3b3;
8
+ background: #333;
9
+ padding: 35px !important;
10
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
11
+ letter-spacing: 0.5px;
12
+ }
13
+
14
+ .hljs-tag {
15
+ line-height: 22px;
16
+ }
17
+
18
+ .hljs-comment,
19
+ .hljs-quote {
20
+ color: #84b081;
21
+ font-style: italic;
22
+ }
23
+
24
+ .hljs-doctag,
25
+ .hljs-keyword,
26
+ .hljs-formula {
27
+ color: #a626a4;
28
+ }
29
+
30
+ .hljs-section,
31
+ .hljs-name,
32
+ .hljs-selector-tag,
33
+ .hljs-deletion,
34
+ .hljs-subst {
35
+ color: rgb(78, 207, 176);
36
+ }
37
+
38
+ .hljs-literal {
39
+ color: #0184bb;
40
+ }
41
+
42
+ .hljs-string,
43
+ .hljs-regexp,
44
+ .hljs-addition,
45
+ .hljs-attribute,
46
+ .hljs-meta .hljs-string {
47
+ color: #ef8a7f;
48
+ }
49
+
50
+ .hljs-attr,
51
+ .hljs-variable,
52
+ .hljs-template-variable,
53
+ .hljs-type,
54
+ .hljs-selector-class,
55
+ .hljs-selector-attr,
56
+ .hljs-selector-pseudo,
57
+ .hljs-number {
58
+ color: #00c3ff;
59
+ }
60
+
61
+ .hljs-symbol,
62
+ .hljs-bullet,
63
+ .hljs-link,
64
+ .hljs-meta,
65
+ .hljs-selector-id,
66
+ .hljs-title {
67
+ color: #4078f2;
68
+ }
69
+
70
+ .hljs-built_in,
71
+ .hljs-title .class_,
72
+ .hljs-class .hljs-title {
73
+ color: #c18401;
74
+ }
75
+
76
+ .hljs-emphasis {
77
+ font-style: italic;
78
+ }
79
+
80
+ .hljs-strong {
81
+ font-weight: bold;
82
+ }
83
+
84
+ .hljs-link {
85
+ text-decoration: underline;
86
+ }
@@ -0,0 +1,87 @@
1
+ body {
2
+ color: var(--text-color);
3
+ background-color: rgb(214, 214, 214);
4
+ overflow: hidden;
5
+ }
6
+
7
+ #alert-box {
8
+ position: fixed;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
12
+ flex-direction: column;
13
+ z-index: 99;
14
+ left: 50%;
15
+ transform: translateX(-50%);
16
+ top: 20px;
17
+ transition: all 0.1s;
18
+ .alert {
19
+ width: auto;
20
+ display: flex;
21
+ flex-shrink: 0;
22
+ align-items: center;
23
+ justify-content: flex-start;
24
+ height: 40px;
25
+ line-height: 40px;
26
+ padding: 15px 25px;
27
+ transition: all 0.2s;
28
+ opacity: 0;
29
+ margin-top: 0px;
30
+ transform: translateY(-5px);
31
+ white-space: nowrap;
32
+ box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.05);
33
+ font-size: 14px;
34
+ border-radius: 7px;
35
+ box-sizing: border-box;
36
+ border: var(--border-width) rgb(230, 230, 230) solid;
37
+ margin-bottom: 10px;
38
+ }
39
+ .alert-danger {
40
+ background-color: #fceded;
41
+ color: rgb(141, 47, 47);
42
+ }
43
+ .alert-success {
44
+ background-color: rgb(245, 253, 248);
45
+ color: rgb(52, 71, 46);
46
+ }
47
+ .alert-warning {
48
+ background-color: rgb(255, 253, 247);
49
+ color: rgb(206, 131, 69);
50
+ }
51
+ .icon {
52
+ width: 20px;
53
+ height: 20px;
54
+ margin-right: 10px;
55
+ }
56
+ .alert-show {
57
+ opacity: 1;
58
+ transform: translateY(0px);
59
+ box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.1);
60
+ }
61
+ .alert-hidden {
62
+ opacity: 0;
63
+ margin-top: -60px;
64
+ }
65
+ }
66
+
67
+ .btf-scrollbar::-webkit-scrollbar {
68
+ background-color: rgb(126, 126, 126, 0);
69
+ width: 5px;
70
+ height: 5px;
71
+ }
72
+
73
+ .btf-scrollbar::-webkit-scrollbar-thumb:hover {
74
+ background-color: rgb(126, 126, 126);
75
+ }
76
+
77
+ .btf-scrollbar::-webkit-scrollbar-thumb {
78
+ background-color: rgb(209 213 219 / 0);
79
+ opacity: 0;
80
+ border-radius: 5px;
81
+ }
82
+
83
+ .btf-scrollbar:hover::-webkit-scrollbar-thumb {
84
+ background-color: rgb(209 213 219 / 0.3);
85
+ opacity: 1;
86
+ border-radius: 5px;
87
+ }