cdui-js 1.0.11 → 1.0.13
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/css/all.css +1 -0
- package/css/build.ts +12 -0
- package/css/canlendar.css +94 -0
- package/css/css.md +276 -0
- package/demo/App.tsx +31 -0
- package/demo/main.ts +7 -0
- package/demo/pages/Canlendar.tsx +12 -0
- package/demo/pages/ComboBox.tsx +10 -0
- package/demo/pages/Form.tsx +32 -0
- package/demo/test.js +45 -0
- package/icons/build.ts +24 -0
- package/index.html +79 -0
- package/package.json +7 -4
- package/src/components/Canlendar.tsx +226 -0
- package/src/components/Carousel.tsx +1 -1
- package/src/components/ComboBox.tsx +2 -3
- package/src/components/Form.tsx +859 -0
- package/src/components/Icon.tsx +1 -1
- package/src/components/Pulldown.tsx +1 -1
- package/src/http.ts +51 -51
- package/src/i18n/index.ts +21 -0
- package/src/i18n/languages/en.json +21 -0
- package/src/i18n/languages/zh-CN.json +14 -0
- package/src/i18n/languages/zh-TW.json +14 -0
- package/src/index.ts +0 -16
- package/src/reactive.ts +18 -0
- package/vite.config.ts +53 -0
package/css/all.css
CHANGED
package/css/build.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
import { buildCSS } from 'cdui-js/build/css';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const ruleFile = path.join(__dirname, 'css.md');
|
|
10
|
+
const cssFile = path.join(__dirname, '../src/css/atomic.css');
|
|
11
|
+
|
|
12
|
+
buildCSS(ruleFile, cssFile);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.canlendar {
|
|
2
|
+
max-width: 380px;
|
|
3
|
+
height: 320px;
|
|
4
|
+
border: 1px solid #e4e4e4;
|
|
5
|
+
border-radius: 12px;
|
|
6
|
+
padding: 16px;
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
user-select: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.canlendar-header,
|
|
12
|
+
.canlendar-weeks {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
height: 36px;
|
|
16
|
+
line-height: 36px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.canlendar-month {
|
|
20
|
+
flex: auto;
|
|
21
|
+
padding-left: 12px;
|
|
22
|
+
font-weight: bold;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.canlendar-switch {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
width: 40px;
|
|
29
|
+
height: 100%;
|
|
30
|
+
padding: 0 11px;
|
|
31
|
+
stroke: #1b212d;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.canlendar-switch:last-child {
|
|
36
|
+
transform: rotateZ(180deg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.canlendar-weeks > span {
|
|
40
|
+
flex: auto;
|
|
41
|
+
text-align: center;
|
|
42
|
+
vertical-align: middle;
|
|
43
|
+
color: #888f97;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.canlendar-body {
|
|
47
|
+
height: calc(100% - 72px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.canlendar-date {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
width: 14.28%;
|
|
55
|
+
height: 16.66%;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.canlendar-date.disabled {
|
|
60
|
+
color: #e4e4e4;
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.canlendar-date.prev-month,
|
|
65
|
+
.canlendar-date.next-month {
|
|
66
|
+
color: #888f97;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.canlendar-date.today,
|
|
70
|
+
.canlendar-date.selected {
|
|
71
|
+
position: relative;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.canlendar-date.today::before,
|
|
75
|
+
.canlendar-date.selected::before {
|
|
76
|
+
position: absolute;
|
|
77
|
+
content: '';
|
|
78
|
+
width: 40px;
|
|
79
|
+
height: 40px;
|
|
80
|
+
border-radius: 40px;
|
|
81
|
+
z-index: -1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.canlendar-date.today::before {
|
|
85
|
+
background: #f5f5f5;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.canlendar-date.selected {
|
|
89
|
+
color: white;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.canlendar-date.selected::before {
|
|
93
|
+
background: #ff4000;
|
|
94
|
+
}
|
package/css/css.md
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
> 说明
|
|
2
|
+
> 颜色色阶:D (Dark 加暗) L(Light 加亮)XL(再加亮)XD(再加暗)依此类推
|
|
3
|
+
> 距离大小:L(放大)S(缩小)XL(再加大)XS(再缩小)依此类推
|
|
4
|
+
> 以 margin、border、padding 开头的样式,会自动在其后生成 l、r、t、b 及 x、y 六个组合,如:margin-l(margin-left),margin-x(margin-left + margin-right),border-l(border-left),border-y-color(border-top-color + border-bottom-color)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# margin 外边距
|
|
8
|
+
|
|
9
|
+
.margin-XXS: 8px;
|
|
10
|
+
.margin-XS: 10px;
|
|
11
|
+
.margin-S: 12px;
|
|
12
|
+
.margin: 16px;
|
|
13
|
+
.margin-L: 20px;
|
|
14
|
+
.margin-XL: 40px;
|
|
15
|
+
.margin-XXL: 60px;
|
|
16
|
+
|
|
17
|
+
+ .le-800
|
|
18
|
+
|
|
19
|
+
.margin-XXS: 6px;
|
|
20
|
+
.margin-XS: 8px;
|
|
21
|
+
.margin-S: 10px;
|
|
22
|
+
.margin: 14px;
|
|
23
|
+
.margin-L: 16px;
|
|
24
|
+
.margin-XL: 30px;
|
|
25
|
+
.margin-XXL: 40px;
|
|
26
|
+
|
|
27
|
+
+ .le-480
|
|
28
|
+
|
|
29
|
+
.margin-XXS: 4px;
|
|
30
|
+
.margin-XS: 8px;
|
|
31
|
+
.margin-S: 12px;
|
|
32
|
+
.margin: 16px;
|
|
33
|
+
.margin-L: 20px;
|
|
34
|
+
.margin-XL: 32px;
|
|
35
|
+
.margin-XXL: 40px;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# padding 内边距
|
|
39
|
+
|
|
40
|
+
.padding-XXS: 4px;
|
|
41
|
+
.padding-XS: 6px;
|
|
42
|
+
.padding-S: 8px;
|
|
43
|
+
.padding: 10px;
|
|
44
|
+
.padding-L: 14px;
|
|
45
|
+
.padding-XL: 24px;
|
|
46
|
+
.padding-XXL: 40px;
|
|
47
|
+
|
|
48
|
+
+ .le-480
|
|
49
|
+
|
|
50
|
+
.padding-XXS: 4px;
|
|
51
|
+
.padding-XS: 6px;
|
|
52
|
+
.padding-S: 8px;
|
|
53
|
+
.padding: 12px;
|
|
54
|
+
.padding-L: 16px;
|
|
55
|
+
.padding-XL: 24px;
|
|
56
|
+
.padding-XXL: 40px;
|
|
57
|
+
|
|
58
|
+
# border 边框
|
|
59
|
+
|
|
60
|
+
.border: 1px;
|
|
61
|
+
.border-bold: 2px;
|
|
62
|
+
.border-bolder: 4px;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# border-color 边框颜色
|
|
66
|
+
|
|
67
|
+
.border-c-XXL: #;
|
|
68
|
+
.border-c-XL: #;
|
|
69
|
+
.border-c-L: #F5F5F5;
|
|
70
|
+
.border-c: #E4E4E4;
|
|
71
|
+
.border-c-D: #;
|
|
72
|
+
.border-c-XD: #;
|
|
73
|
+
.border-c-XXD: #;
|
|
74
|
+
|
|
75
|
+
.border-c-primary: #FF4000;
|
|
76
|
+
.border-c-secondary: #FFD1C3;
|
|
77
|
+
.border-c-error: #FF4E4E;
|
|
78
|
+
.border-c-warn: #;
|
|
79
|
+
.border-c-info: #;
|
|
80
|
+
.border-c-disabled: #FF4E4E;
|
|
81
|
+
|
|
82
|
+
.border-c-active: #ffffff;
|
|
83
|
+
.border-c-primary-active: #ffffff;
|
|
84
|
+
|
|
85
|
+
.border-c-focus: #ffffff;
|
|
86
|
+
.border-c-primary-focus: #ffffff;
|
|
87
|
+
|
|
88
|
+
.border-c-hover: #ffffff;
|
|
89
|
+
.border-c-primary-hover: #ffffff;
|
|
90
|
+
|
|
91
|
+
.border-c-selected: #ffffff;
|
|
92
|
+
.border-c-primary-selected: #ffffff;
|
|
93
|
+
|
|
94
|
+
+ .dark
|
|
95
|
+
.border-c-primary: #000000
|
|
96
|
+
|
|
97
|
+
# border-style 边框样式
|
|
98
|
+
|
|
99
|
+
.border-s-dashed: dashed;
|
|
100
|
+
.border-s-dotted: dotted;
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# border-radius 圆角边框
|
|
104
|
+
|
|
105
|
+
.round-XXS: ;
|
|
106
|
+
.round-XS: 6px;
|
|
107
|
+
.round-S: 10px;
|
|
108
|
+
.round: 12px;
|
|
109
|
+
.round-L: 14px;
|
|
110
|
+
.round-XL: 20px;
|
|
111
|
+
.round-XXL: ;
|
|
112
|
+
|
|
113
|
+
+ .le-480
|
|
114
|
+
|
|
115
|
+
.round-XXS: 2px;
|
|
116
|
+
.round-XS: 4px;
|
|
117
|
+
.round-S: 6px;
|
|
118
|
+
.round: 8px;
|
|
119
|
+
.round-L: 10px;
|
|
120
|
+
.round-XL: 12px;
|
|
121
|
+
.round-XXL: 40px;
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# background-color 背景颜色
|
|
125
|
+
|
|
126
|
+
.bg-c-XXL: #;
|
|
127
|
+
.bg-c-XL: #ffffff;
|
|
128
|
+
.bg-c-L: #ffffff;
|
|
129
|
+
.bg-c: #ffffff;
|
|
130
|
+
.bg-c-D: #F7F8FA;
|
|
131
|
+
.bg-c-XD: #F5F5F5;
|
|
132
|
+
.bg-c-XXD: #F5F5F5;
|
|
133
|
+
|
|
134
|
+
.bg-c-primary: #FFF3EF;
|
|
135
|
+
.bg-c-secondary: #FFEDED;
|
|
136
|
+
.bg-c-error: #;
|
|
137
|
+
.bg-c-warn: #;
|
|
138
|
+
.bg-c-info: #;
|
|
139
|
+
.bg-c-disabled: #;
|
|
140
|
+
|
|
141
|
+
.bg-c-active: #ffffff;
|
|
142
|
+
.bg-c-primary-active: #ffffff;
|
|
143
|
+
|
|
144
|
+
.bg-c-focus: #ffffff;
|
|
145
|
+
.bg-c-primary-focus: #ffffff;
|
|
146
|
+
|
|
147
|
+
.bg-c-hover: #;
|
|
148
|
+
.bg-c-primary-hover: #69F469;
|
|
149
|
+
|
|
150
|
+
.bg-c-selected: #ffffff;
|
|
151
|
+
.bg-c-primary-selected: #ffffff;
|
|
152
|
+
|
|
153
|
+
+ .dark
|
|
154
|
+
.bg-c: #101113;
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# color 字体颜色
|
|
158
|
+
|
|
159
|
+
.color-XXL: #ffffff;
|
|
160
|
+
.color-XL: #C2C3CB;
|
|
161
|
+
.color-L: #A2A7AD;
|
|
162
|
+
.color: #888F97;
|
|
163
|
+
.color-D: #1B212D;
|
|
164
|
+
.color-XD: #1B212D;
|
|
165
|
+
.color-XXD: #1B212D;
|
|
166
|
+
|
|
167
|
+
.color-primary: #FF4000;
|
|
168
|
+
.color-secondary: #FFD1C3;
|
|
169
|
+
.color-error: #FF4E4E;
|
|
170
|
+
.color-warn: #;
|
|
171
|
+
.color-info: #;
|
|
172
|
+
.color-disabled: #02C58D;
|
|
173
|
+
|
|
174
|
+
.color-active: #ffffff;
|
|
175
|
+
.color-primary-active: #FF4000;
|
|
176
|
+
|
|
177
|
+
.color-focus: #ffffff;
|
|
178
|
+
.color-primary-focus: #FF4000;
|
|
179
|
+
|
|
180
|
+
.color-hover: #ffffff;
|
|
181
|
+
.color-primary-hover: #FF4000;
|
|
182
|
+
|
|
183
|
+
.color-selected: #ffffff;
|
|
184
|
+
.color-primary-selected: #FF4000;
|
|
185
|
+
|
|
186
|
+
+ .dark
|
|
187
|
+
|
|
188
|
+
.color-D: #ffffff;
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
# font-size 字体大小
|
|
192
|
+
|
|
193
|
+
.font-s-XXS: 12px;
|
|
194
|
+
.font-s-XS: 12px;
|
|
195
|
+
.font-s-S: 14px;
|
|
196
|
+
.font-s: 16px;
|
|
197
|
+
.font-s-L: 20px;
|
|
198
|
+
.font-s-XL: 22px;
|
|
199
|
+
.font-s-XXL: 32px;
|
|
200
|
+
|
|
201
|
+
+ .le-480
|
|
202
|
+
|
|
203
|
+
.font-s-XXS: 10px;
|
|
204
|
+
.font-s-XS: 12px;
|
|
205
|
+
.font-s-S: 14px;
|
|
206
|
+
.font-s: 16px;
|
|
207
|
+
.font-s-L: 20px;
|
|
208
|
+
.font-s-XL: 24px;
|
|
209
|
+
.font-s-XXL: 28px;
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# font-weight 字体粗细
|
|
213
|
+
|
|
214
|
+
.font-lighter: lighter;
|
|
215
|
+
.font-bold: bold;
|
|
216
|
+
.font-bolder: bolder;
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
# icon-color 图标颜色
|
|
220
|
+
|
|
221
|
+
.icon-c-XXL: #;
|
|
222
|
+
.icon-c-XL: #;
|
|
223
|
+
.icon-c-L: #ffffff;
|
|
224
|
+
.icon-c: #A2A7AD;
|
|
225
|
+
.icon-c-D: #1B212D;
|
|
226
|
+
.icon-c-XD: #;
|
|
227
|
+
.icon-c-XXD: #;
|
|
228
|
+
|
|
229
|
+
.icon-c-primary: #FF4000;
|
|
230
|
+
.icon-c-secondary: #2BA8F7;
|
|
231
|
+
.icon-c-error: #FF4E4E;
|
|
232
|
+
.icon-c-warn: #;
|
|
233
|
+
.icon-c-info: #;
|
|
234
|
+
.icon-c-disabled: #FF4E4E;
|
|
235
|
+
|
|
236
|
+
.icon-c-active: #ffffff;
|
|
237
|
+
.icon-c-primary-active: #ffffff;
|
|
238
|
+
|
|
239
|
+
.icon-c-hover: #ffffff;
|
|
240
|
+
.icon-c-primary-hover: #FF4000;
|
|
241
|
+
|
|
242
|
+
.icon-c-selected: #ffffff;
|
|
243
|
+
.icon-c-primary-selected: #FF4000;
|
|
244
|
+
|
|
245
|
+
+ .dark
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
# icon-size 图标大小
|
|
249
|
+
|
|
250
|
+
.icon-s-XXS: 12px;
|
|
251
|
+
.icon-s-XS: 14px;
|
|
252
|
+
.icon-s-S: 16px;
|
|
253
|
+
.icon-s: 18px;
|
|
254
|
+
.icon-s-L: 20px;
|
|
255
|
+
.icon-s-XL: 24px;
|
|
256
|
+
.icon-s-XXL: 32px;
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
# button 按钮
|
|
260
|
+
|
|
261
|
+
.button { background-color: #21282D; color: #ffffff; border-radius: 14px; outline: none; border: none; min-width: 60px; padding: 4px 8px; }
|
|
262
|
+
.button:active { background-color: #1D252B; }
|
|
263
|
+
.button:focus { background-color: #1D252B; border: 2px solid #FFFFFF; }
|
|
264
|
+
.button:hover { background-color: #2D363B; }
|
|
265
|
+
.button:disabled { color: #8693B6; }
|
|
266
|
+
|
|
267
|
+
.button-primary { background-color: #FF4000; color: #ffffff; border-radius: 12px; outline: none; border: none; min-width: 60px; padding: 4px 8px; }
|
|
268
|
+
.button-primary:active { background-color: #FF7A51; }
|
|
269
|
+
.button-primary:focus { background-color: #FF7A51; }
|
|
270
|
+
.button-primary:hover { background-color: #FF7A51; }
|
|
271
|
+
.button-primary:disabled { background-color:#FFD1C3; }
|
|
272
|
+
|
|
273
|
+
# link 链接
|
|
274
|
+
|
|
275
|
+
.link {}
|
|
276
|
+
.link-primary {};
|
package/demo/App.tsx
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { reactive } from '../src/reactive';
|
|
2
|
+
import { CanlendarPage } from './pages/Canlendar';
|
|
3
|
+
import { ComboBoxPage } from './pages/ComboBox';
|
|
4
|
+
import { FormPage } from './pages/Form';
|
|
5
|
+
|
|
6
|
+
const Test = (props: { value: number; text: string }) => {
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<span>{props.value}</span>
|
|
10
|
+
<span>{props.text}</span>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const App = () => {
|
|
16
|
+
const state = reactive({
|
|
17
|
+
value: 111,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const a = { text: '222' };
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div>
|
|
24
|
+
<CanlendarPage></CanlendarPage>
|
|
25
|
+
<ComboBoxPage></ComboBoxPage>
|
|
26
|
+
<FormPage></FormPage>
|
|
27
|
+
<Test value={state.value} text={'222' + a.text}></Test>
|
|
28
|
+
<button onclick={() => (state.value = Math.random())}></button>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
package/demo/main.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { reactive } from '../../src/reactive';
|
|
2
|
+
import { For } from '../../src/components/For';
|
|
3
|
+
import { Form, FormItem } from '../../src/components/Form';
|
|
4
|
+
|
|
5
|
+
export const FormPage = () => {
|
|
6
|
+
const state = reactive({
|
|
7
|
+
align: 'right' as 'right' | 'left',
|
|
8
|
+
width: '100px',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Form data={{}} rules={{}} align={state.align} labelWidth={state.width}>
|
|
13
|
+
<FormItem field="a" label="111">
|
|
14
|
+
<input></input>
|
|
15
|
+
</FormItem>
|
|
16
|
+
<FormItem
|
|
17
|
+
field="b"
|
|
18
|
+
label={
|
|
19
|
+
<>
|
|
20
|
+
<span>123</span>
|
|
21
|
+
<span>456</span>
|
|
22
|
+
</>
|
|
23
|
+
}
|
|
24
|
+
>
|
|
25
|
+
<input></input>
|
|
26
|
+
</FormItem>
|
|
27
|
+
<button type="button" onclick={() => (state.align = state.align === 'left' ? 'right' : 'left')}>
|
|
28
|
+
align
|
|
29
|
+
</button>
|
|
30
|
+
</Form>
|
|
31
|
+
);
|
|
32
|
+
};
|
package/demo/test.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
const Form = ({ a, b, c }, context) => {
|
|
3
|
+
return <div></div>
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const FormPage1 = () => {
|
|
8
|
+
const state = reactive({
|
|
9
|
+
align: 'right',
|
|
10
|
+
width: '100px',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
createEffect(() => {
|
|
14
|
+
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
watch(() => state.align, align => {
|
|
18
|
+
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return Form(
|
|
22
|
+
{
|
|
23
|
+
data: {},
|
|
24
|
+
rules: {},
|
|
25
|
+
align: () => state.align,
|
|
26
|
+
labelWidth: () => state.width,
|
|
27
|
+
},
|
|
28
|
+
(context) => [
|
|
29
|
+
FormItem(
|
|
30
|
+
{
|
|
31
|
+
field: 'a',
|
|
32
|
+
label: '111',
|
|
33
|
+
},
|
|
34
|
+
(context) => [],
|
|
35
|
+
),
|
|
36
|
+
FormItem(
|
|
37
|
+
{
|
|
38
|
+
field: 'b',
|
|
39
|
+
label: () => [_tmpl$3(), _tmpl$4()],
|
|
40
|
+
},
|
|
41
|
+
(context) => [],
|
|
42
|
+
),
|
|
43
|
+
],
|
|
44
|
+
);
|
|
45
|
+
};
|
package/icons/build.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
import { loadIconFile, loadIconsDirectory, saveIconsModule, saveIconsToHtml } from 'cdui-js/build/icons';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const icons = [
|
|
10
|
+
// 加载 cdui-js/icons 下的图标
|
|
11
|
+
loadIconsDirectory(path.join(__dirname, '../../../node_modules/cdui-js/icons'), 'both'),
|
|
12
|
+
|
|
13
|
+
loadIconFile(path.join(__dirname, 'logo.svg')),
|
|
14
|
+
loadIconsDirectory(path.join(__dirname, 'common/both')),
|
|
15
|
+
loadIconsDirectory(path.join(__dirname, 'common/stroke'), 'stroke'),
|
|
16
|
+
loadIconsDirectory(path.join(__dirname, 'header'), 'stroke'),
|
|
17
|
+
|
|
18
|
+
loadIconsDirectory(path.join(__dirname, 'menu'), 'both'),
|
|
19
|
+
loadIconsDirectory(path.join(__dirname, 'menu/color')),
|
|
20
|
+
|
|
21
|
+
loadIconsDirectory(path.join(__dirname, 'my'), 'both'),
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
saveIconsToHtml(path.join(__dirname, '../index.html'), icons.join('\n'));
|
package/index.html
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<title>stock</title>
|
|
6
|
+
<meta name="description" content="stock" />
|
|
7
|
+
<meta charset="UTF-8" />
|
|
8
|
+
<meta name="renderer" content="webkit" />
|
|
9
|
+
<meta name="force-rendering" content="webkit" />
|
|
10
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
11
|
+
<meta name="viewport"
|
|
12
|
+
content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1, user-scalable=no" />
|
|
13
|
+
<link rel="icon" type="image/svg" href="favicon.svg?v=1" />
|
|
14
|
+
<!-- ssr-head -->
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
window.addEventListener(
|
|
20
|
+
'resize',
|
|
21
|
+
(function (window, navigator) {
|
|
22
|
+
function update() {
|
|
23
|
+
var ua = navigator.ua;
|
|
24
|
+
var body = document.body;
|
|
25
|
+
var limits = [1920, 1280, 1024, 800, 640, 480];
|
|
26
|
+
var length = limits.length;
|
|
27
|
+
var width = window.innerWidth;
|
|
28
|
+
var classList = ['pc'];
|
|
29
|
+
|
|
30
|
+
if (/Mobile|iPhone/i.test(ua)) {
|
|
31
|
+
classList.push('mobile');
|
|
32
|
+
} else if (/iPad|Tablet|Android/i.test(ua) || (navigator.maxTouchPoints > 1 && !/Windows|Linux/.test(ua))) {
|
|
33
|
+
classList.push('tablet');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
classList.push(window.innerHeight < width ? 'landscape' : 'portrait');
|
|
37
|
+
|
|
38
|
+
for (var i = 0; i < length; i++) {
|
|
39
|
+
var limit = limits[i];
|
|
40
|
+
|
|
41
|
+
if (width <= limit) {
|
|
42
|
+
if (width < limit) {
|
|
43
|
+
classList.push('lt-' + limit);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
classList.push('le-' + limit);
|
|
47
|
+
} else if (width >= limit) {
|
|
48
|
+
classList.push('ge-' + limit);
|
|
49
|
+
|
|
50
|
+
if (width > limit) {
|
|
51
|
+
classList.push('gt-' + limit);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 计算侧边框展开或收拢
|
|
57
|
+
classList.push('sidebar-' + (width > 1280 ? 'expanded' : 'collapsed'));
|
|
58
|
+
classList = classList.join(' ');
|
|
59
|
+
|
|
60
|
+
if (body.className !== classList) {
|
|
61
|
+
body.className = classList;
|
|
62
|
+
(window.onlayoutchange || function () { })();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 触发内容区大小变化事件
|
|
66
|
+
window.dispatchEvent(new Event('content-resize'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
update();
|
|
70
|
+
|
|
71
|
+
return update;
|
|
72
|
+
})(window, navigator)
|
|
73
|
+
);
|
|
74
|
+
</script>
|
|
75
|
+
<!-- ssr-body -->
|
|
76
|
+
<script type="module" src="./demo/main.ts"></script>
|
|
77
|
+
</body>
|
|
78
|
+
|
|
79
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cdui-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cdui-js": "./cli/bin.js"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "vite --config vite.config.ts"
|
|
11
|
+
},
|
|
10
12
|
"dependencies": {
|
|
11
13
|
"chalk": "^5.6.2",
|
|
12
14
|
"commander": "^14.0.3",
|
|
13
|
-
"download-git-repo": "^
|
|
15
|
+
"download-git-repo": "^0.0.2",
|
|
14
16
|
"fs-extra": "^11.3.3",
|
|
15
17
|
"inquirer": "^13.3.0",
|
|
16
18
|
"solid-js": "^1.9.10",
|
|
@@ -18,6 +20,7 @@
|
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
22
|
"@types/node": "^25.3.3",
|
|
21
|
-
"typescript": "~5.6.2"
|
|
23
|
+
"typescript": "~5.6.2",
|
|
24
|
+
"vite": "^8.0.0"
|
|
22
25
|
}
|
|
23
26
|
}
|