china-diff 1.0.1
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/.gitattributes +1 -0
- package/.prettierignore +2 -0
- package/.prettierrc +5 -0
- package/README.md +1 -0
- package/build/css.ts +293 -0
- package/build/icons.ts +108 -0
- package/css/all.css +8 -0
- package/css/atomic/align.css +35 -0
- package/css/atomic/all.css +13 -0
- package/css/atomic/cursor.css +7 -0
- package/css/atomic/display.css +11 -0
- package/css/atomic/flex.css +124 -0
- package/css/atomic/grid.css +0 -0
- package/css/atomic/hidden.css +37 -0
- package/css/atomic/other.css +23 -0
- package/css/atomic/overflow.css +47 -0
- package/css/atomic/position.css +58 -0
- package/css/base.css +16 -0
- package/css/carousel.css +46 -0
- package/css/combobox.css +58 -0
- package/css/icon.css +7 -0
- package/icons/backward.svg +3 -0
- package/icons/close.svg +3 -0
- package/icons/dropdown.svg +3 -0
- package/icons/forward.svg +3 -0
- package/icons/toggle.svg +3 -0
- package/index.ts +1 -0
- package/jsx-runtime.d.ts +1 -0
- package/package.json +13 -0
- package/src/animate-scroll-to.ts +65 -0
- package/src/components/Carousel.tsx +299 -0
- package/src/components/CollapsiblePanel.tsx +139 -0
- package/src/components/ComboBox.tsx +163 -0
- package/src/components/Dialog.tsx +36 -0
- package/src/components/For.tsx +26 -0
- package/src/components/Icon.tsx +39 -0
- package/src/components/If.tsx +14 -0
- package/src/components/KeepAlive.tsx +26 -0
- package/src/components/Pulldown.tsx +157 -0
- package/src/components/Switch.tsx +49 -0
- package/src/dom.ts +137 -0
- package/src/http.ts +282 -0
- package/src/index.ts +68 -0
- package/src/jsx.ts +2 -0
- package/src/language.ts +34 -0
- package/src/layout.ts +89 -0
- package/src/location.ts +133 -0
- package/src/message.ts +290 -0
- package/src/reactive.ts +211 -0
- package/src/template.ts +23 -0
- package/tsconfig.json +16 -0
- package/vite-plugin.js +4 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/build/css.ts
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
export interface Rule {
|
|
4
|
+
match: string;
|
|
5
|
+
build(outputs: string[], selector: string, value: string): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const rules: Rule[] = [
|
|
9
|
+
{
|
|
10
|
+
match: '.margin',
|
|
11
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
12
|
+
outputs.push(`${selector} { margin: ${value} }`);
|
|
13
|
+
outputs.push(`${selector.replace('margin', 'margin-t')} { margin-top: ${value}; }`);
|
|
14
|
+
outputs.push(`${selector.replace('margin', 'margin-r')} { margin-right: ${value}; }`);
|
|
15
|
+
outputs.push(`${selector.replace('margin', 'margin-b')} { margin-bottom: ${value}; }`);
|
|
16
|
+
outputs.push(`${selector.replace('margin', 'margin-l')} { margin-left: ${value}; }`);
|
|
17
|
+
outputs.push(`${selector.replace('margin', 'margin-x')} { margin-left: ${value}; margin-right: ${value}; }`);
|
|
18
|
+
outputs.push(`${selector.replace('margin', 'margin-y')} { margin-top: ${value}; margin-bottom: ${value}; }\n`);
|
|
19
|
+
|
|
20
|
+
outputs.push(`${selector.replace('margin', '-margin-t')} { margin-top: -${value}; }`);
|
|
21
|
+
outputs.push(`${selector.replace('margin', '-margin-r')} { margin-right: -${value}; }`);
|
|
22
|
+
outputs.push(`${selector.replace('margin', '-margin-b')} { margin-bottom: -${value}; }`);
|
|
23
|
+
outputs.push(`${selector.replace('margin', '-margin-l')} { margin-left: -${value}; }`);
|
|
24
|
+
|
|
25
|
+
outputs.push(`${selector.replace('margin', 'padding-m')} { padding: ${value}; }`);
|
|
26
|
+
outputs.push(`${selector.replace('margin', 'padding-m-t')} { padding-top: ${value}; }`);
|
|
27
|
+
outputs.push(`${selector.replace('margin', 'padding-m-r')} { padding-right: ${value}; }`);
|
|
28
|
+
outputs.push(`${selector.replace('margin', 'padding-m-b')} { padding-bottom: ${value}; }`);
|
|
29
|
+
outputs.push(`${selector.replace('margin', 'padding-m-l')} { padding-left: ${value}; }`);
|
|
30
|
+
outputs.push(`${selector.replace('margin', 'padding-m-x')} { padding-left: ${value}; padding-right: ${value}; }`);
|
|
31
|
+
outputs.push(
|
|
32
|
+
`${selector.replace('margin', 'padding-m-y')} { padding-top: ${value}; padding-bottom: ${value}; }\n`,
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
match: '.border-c',
|
|
38
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
39
|
+
if (selector === '.border-c') {
|
|
40
|
+
outputs.push(`.border { border-color: ${value} }`);
|
|
41
|
+
outputs.push(`.border-t { border-top-color: ${value} }`);
|
|
42
|
+
outputs.push(`.border-r { border-right-color: ${value} }`);
|
|
43
|
+
outputs.push(`.border-b { border-bottom-color: ${value} }`);
|
|
44
|
+
outputs.push(`.border-l { border-left-color: ${value} }`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
outputs.push(`${selector} { border-color: ${value} }`);
|
|
48
|
+
outputs.push(`${selector.replace('border-c', 'border-t-c')} { border-top-color: ${value}; }`);
|
|
49
|
+
outputs.push(`${selector.replace('border-c', 'border-r-c')} { border-right-color: ${value}; }`);
|
|
50
|
+
outputs.push(`${selector.replace('border-c', 'border-b-c')} { border-bottom-color: ${value}; }`);
|
|
51
|
+
outputs.push(`${selector.replace('border-c', 'border-l-c')} { border-left-color: ${value}; }`);
|
|
52
|
+
outputs.push(
|
|
53
|
+
`${selector.replace('border-c', 'border-x-c')} { border-left-color: ${value}; border-right-color: ${value}; }`,
|
|
54
|
+
);
|
|
55
|
+
outputs.push(
|
|
56
|
+
`${selector.replace('border-c', 'border-y-c')} { border-top-color: ${value}; border-bottom-color: ${value}; }`,
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
match: '.border-s',
|
|
62
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
63
|
+
outputs.push(`${selector} { border-style: ${value} }`);
|
|
64
|
+
outputs.push(`${selector.replace('border-s', 'border-t-s')} { border-top-style: ${value}; }`);
|
|
65
|
+
outputs.push(`${selector.replace('border-s', 'border-r-s')} { border-right-style: ${value}; }`);
|
|
66
|
+
outputs.push(`${selector.replace('border-s', 'border-b-s')} { border-bottom-style: ${value}; }`);
|
|
67
|
+
outputs.push(`${selector.replace('border-s', 'border-l-s')} { border-left-style: ${value}; }`);
|
|
68
|
+
outputs.push(
|
|
69
|
+
`${selector.replace('border-s', 'border-x-s')} { border-left-style: ${value}; border-right-style: ${value}; }`,
|
|
70
|
+
);
|
|
71
|
+
outputs.push(
|
|
72
|
+
`${selector.replace('border-s', 'border-y-s')} { border-top-style: ${value}; border-bottom-style: ${value}; }`,
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
match: '.border',
|
|
78
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
79
|
+
outputs.push(`${selector} { border-width: ${value}; border-style: solid; }`);
|
|
80
|
+
outputs.push(
|
|
81
|
+
`${selector.replace('border', 'border-t')} { border-top-width: ${value}; border-top-style: solid; }`,
|
|
82
|
+
);
|
|
83
|
+
outputs.push(
|
|
84
|
+
`${selector.replace('border', 'border-r')} { border-right-width: ${value}; border-right-style: solid; }`,
|
|
85
|
+
);
|
|
86
|
+
outputs.push(
|
|
87
|
+
`${selector.replace('border', 'border-b')} { border-bottom-width: ${value}; border-bottom-style: solid; }`,
|
|
88
|
+
);
|
|
89
|
+
outputs.push(
|
|
90
|
+
`${selector.replace('border', 'border-l')} { border-left-width: ${value}; border-left-style: solid; }`,
|
|
91
|
+
);
|
|
92
|
+
outputs.push(
|
|
93
|
+
`${selector.replace('border', 'border-x')} { border-left-width: ${value}; border-right-width: ${value}; border-left-style: solid; border-right-style: solid; }`,
|
|
94
|
+
);
|
|
95
|
+
outputs.push(
|
|
96
|
+
`${selector.replace('border', 'border-y')} { border-top-width: ${value}; border-bottom-width: ${value}; border-top-style: solid; border-bottom-style: solid; }`,
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
match: '.round',
|
|
102
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
103
|
+
outputs.push(`${selector} { border-radius: ${value} }`);
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
match: '.padding',
|
|
108
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
109
|
+
outputs.push(`${selector} { padding: ${value} }`);
|
|
110
|
+
outputs.push(`${selector.replace('padding', 'padding-t')} { padding-top: ${value}; }`);
|
|
111
|
+
outputs.push(`${selector.replace('padding', 'padding-r')} { padding-right: ${value}; }`);
|
|
112
|
+
outputs.push(`${selector.replace('padding', 'padding-b')} { padding-bottom: ${value}; }`);
|
|
113
|
+
outputs.push(`${selector.replace('padding', 'padding-l')} { padding-left: ${value}; }`);
|
|
114
|
+
outputs.push(`${selector.replace('padding', 'padding-x')} { padding-left: ${value}; padding-right: ${value}; }`);
|
|
115
|
+
outputs.push(
|
|
116
|
+
`${selector.replace('padding', 'padding-y')} { padding-top: ${value}; padding-bottom: ${value}; }\n`,
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
match: '.bg-c',
|
|
122
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
123
|
+
outputs.push(`${selector} { background-color: ${value} }`);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
match: '.color',
|
|
128
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
129
|
+
outputs.push(`${selector} { color: ${value} }`);
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
match: '.font-s',
|
|
134
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
135
|
+
outputs.push(`${selector} { font-size: ${value} }`);
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
match: '.font',
|
|
140
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
141
|
+
outputs.push(`${selector} { font-weight: ${value} }`);
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
match: '.icon-c',
|
|
146
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
147
|
+
if (selector === '.icon-c') {
|
|
148
|
+
outputs.unshift(`body { stroke: ${value}; fill: ${value}; }\n.icon { stroke: inherit; fill: inherit; }\n`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
outputs.push(`${selector} { stroke: ${value}; fill: ${value}; }`);
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
match: '.icon-s',
|
|
156
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
157
|
+
if (selector === '.icon-s') {
|
|
158
|
+
outputs.unshift(`.icon { width: ${value}; height: ${value}; }\n`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
outputs.push(`${selector} .icon { width: ${value}; height: ${value}; }`);
|
|
162
|
+
outputs.push(`${selector}.icon { width: ${value}; height: ${value}; }`);
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
match: '.button',
|
|
167
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
168
|
+
outputs.push(`${selector} { ${value} }`);
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
match: '.link',
|
|
173
|
+
build: (outputs: string[], selector: string, value: string) => {
|
|
174
|
+
if (selector === '.link') {
|
|
175
|
+
outputs.push(`a, .link { ${value} }`);
|
|
176
|
+
} else {
|
|
177
|
+
outputs.push(`${selector} { ${value} }`);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
const findRule = (name: string) => {
|
|
184
|
+
for (let i = 0, l = rules.length; i < l; i++) {
|
|
185
|
+
if (name.startsWith(rules[i].match)) {
|
|
186
|
+
return rules[i];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const parse = (rule: Rule, outputs: string[], selectorPrefix: string, name: string, value: string) => {
|
|
192
|
+
if (name.endsWith('-hover')) {
|
|
193
|
+
rule.build(outputs, selectorPrefix + name + ':hover', value);
|
|
194
|
+
rule.build(outputs, selectorPrefix + '.hover:hover ' + name, value);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (name.endsWith('-active')) {
|
|
199
|
+
rule.build(outputs, selectorPrefix + name + ':active', value);
|
|
200
|
+
rule.build(outputs, selectorPrefix + '.active:active ' + name, value);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (name.endsWith('-focus')) {
|
|
205
|
+
rule.build(outputs, selectorPrefix + name + ':focus', value);
|
|
206
|
+
rule.build(outputs, selectorPrefix + '.focus:focus ' + name, value);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (name.endsWith('-selected')) {
|
|
211
|
+
rule.build(outputs, selectorPrefix + name + '.selected', value);
|
|
212
|
+
rule.build(outputs, selectorPrefix + '.selected ' + name, value);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
rule.build(outputs, selectorPrefix + name, value);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 解析 CSS 规范生成原子样式
|
|
221
|
+
*
|
|
222
|
+
* @param cssRuleFile CSS 规范文件路径(markdown规范文档)
|
|
223
|
+
* @param cssFile 写 css 文件路径
|
|
224
|
+
*/
|
|
225
|
+
export const buildCSS = (cssRuleFile: string, cssFile?: string) => {
|
|
226
|
+
let css = fs.readFileSync(cssRuleFile, 'utf8');
|
|
227
|
+
let lines = css.split(/\r?\n\s*/);
|
|
228
|
+
let selectorPrefix = '';
|
|
229
|
+
let outputs = [];
|
|
230
|
+
|
|
231
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
232
|
+
let line = lines[i].trim();
|
|
233
|
+
|
|
234
|
+
switch (line[0] || '') {
|
|
235
|
+
case '.':
|
|
236
|
+
let index = line.indexOf('{');
|
|
237
|
+
let name, value, rule: Rule;
|
|
238
|
+
|
|
239
|
+
// 样式组
|
|
240
|
+
if (index > 0 && (name = line.slice(0, index).trim()) && (rule = findRule(name))) {
|
|
241
|
+
value = line.slice(index + 1);
|
|
242
|
+
|
|
243
|
+
if ((value = value.replace(/}\s*\;*\s*/, '').trim())) {
|
|
244
|
+
rule.build(outputs, selectorPrefix + name, value);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// 单样式值
|
|
251
|
+
if ((index = line.indexOf(':')) > 0 && (name = line.slice(0, index).trim()) && (rule = findRule(name))) {
|
|
252
|
+
value = line
|
|
253
|
+
.slice(index + 1)
|
|
254
|
+
.replace(/;\s*/g, '')
|
|
255
|
+
.trim();
|
|
256
|
+
|
|
257
|
+
if (value && value !== '#') {
|
|
258
|
+
parse(rule, outputs, selectorPrefix, name, value);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
console.error('不合法的格式:' + lines[i]);
|
|
265
|
+
break;
|
|
266
|
+
|
|
267
|
+
case '+': // 上级选择器
|
|
268
|
+
selectorPrefix = line.slice(1).trim() + ' ';
|
|
269
|
+
outputs.push('\n');
|
|
270
|
+
break;
|
|
271
|
+
|
|
272
|
+
case '#': // 新的分组
|
|
273
|
+
selectorPrefix = '';
|
|
274
|
+
outputs.push('\n');
|
|
275
|
+
break;
|
|
276
|
+
|
|
277
|
+
case '>':
|
|
278
|
+
case '':
|
|
279
|
+
break;
|
|
280
|
+
|
|
281
|
+
default:
|
|
282
|
+
console.error('不合法的格式:' + lines[i]);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
css = outputs.join('\n');
|
|
287
|
+
|
|
288
|
+
if (cssFile) {
|
|
289
|
+
fs.writeFileSync(cssFile, css, 'utf8');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return css;
|
|
293
|
+
};
|
package/build/icons.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 从指定 svg 文件读取 symbol 内容
|
|
6
|
+
*
|
|
7
|
+
* @param svgFile 指定 svg 文件
|
|
8
|
+
* @param removeColor 去色标记 fill: 去填充色 stroke:去描边色 both:都去
|
|
9
|
+
*/
|
|
10
|
+
export const readIconFile = (svgFile: string, removeColor?: 'fill' | 'stroke' | 'both'): string => {
|
|
11
|
+
let name = path.basename(svgFile).replace('.svg', '');
|
|
12
|
+
let svg = fs.readFileSync(svgFile, 'utf8');
|
|
13
|
+
let index = svg.indexOf(' viewBox="');
|
|
14
|
+
let viewBox = svg.slice(index, (index = svg.indexOf('"', index + 12) + 1));
|
|
15
|
+
let content = svg.slice(svg.indexOf('>', index) + 1, svg.lastIndexOf('</svg>'));
|
|
16
|
+
let hasStroke = content.indexOf(' stroke="') > 0;
|
|
17
|
+
let hasFill = content.indexOf(' fill="') > 0;
|
|
18
|
+
|
|
19
|
+
// 没有描边
|
|
20
|
+
if (!hasStroke) {
|
|
21
|
+
// 强制禁止外部修改描边
|
|
22
|
+
viewBox += ' stroke="none"';
|
|
23
|
+
} else if (!hasFill) {
|
|
24
|
+
// 没有填充则强制禁止外部修改填充
|
|
25
|
+
viewBox += ' fill="none"';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (removeColor) {
|
|
29
|
+
// 去填充色
|
|
30
|
+
if (hasFill && removeColor !== 'stroke') {
|
|
31
|
+
content = content.replace(/ fill=\"[^"]+\"/g, '');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 去描边色
|
|
35
|
+
if (hasStroke && removeColor !== 'fill') {
|
|
36
|
+
content = content.replace(/ stroke=\"[^"]+\"/g, '');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return `<symbol id="icon-${name}"${viewBox}>${content}</symbol>`;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 从指定图标目录读取 svg symbol 内容
|
|
45
|
+
*
|
|
46
|
+
* @param svgDirectory 指定 svg 目录
|
|
47
|
+
* @param removeColor 去色标记 fill: 去填充色 stroke:去描边色 both:都去
|
|
48
|
+
*/
|
|
49
|
+
export const readIconsDirectory = (svgDirectory: string, removeColor?: 'fill' | 'stroke' | 'both'): string => {
|
|
50
|
+
const outputs = [];
|
|
51
|
+
const files = fs.readdirSync(svgDirectory);
|
|
52
|
+
|
|
53
|
+
for (let i = 0, l = files.length; i < l; i++) {
|
|
54
|
+
let file = path.join(svgDirectory, files[i]);
|
|
55
|
+
|
|
56
|
+
if (path.extname(file) === '.svg') {
|
|
57
|
+
outputs.push(readIconFile(file, removeColor));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return outputs.join('\n');
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 把图标 symbol 内容写入 html 文件
|
|
66
|
+
*
|
|
67
|
+
* @param htmlFile html 文件路径
|
|
68
|
+
* @param symbols 图标 symbol 集合
|
|
69
|
+
*/
|
|
70
|
+
export const writeIconsToHtml = (htmlFile: string, symbols: string) => {
|
|
71
|
+
let html = fs.readFileSync(htmlFile, 'utf8');
|
|
72
|
+
let index = html.indexOf('<svg id="ICONS" ');
|
|
73
|
+
|
|
74
|
+
if (index > 0) {
|
|
75
|
+
let start = html.indexOf('>', index) + 1;
|
|
76
|
+
let end = html.indexOf('</svg>', start);
|
|
77
|
+
|
|
78
|
+
html = html.slice(0, start) + '\n' + symbols + '\n' + html.slice(end);
|
|
79
|
+
} else {
|
|
80
|
+
let start = html.indexOf('>', html.indexOf('<body')) + 1;
|
|
81
|
+
|
|
82
|
+
html =
|
|
83
|
+
html.slice(0, start) +
|
|
84
|
+
'\n<svg id="ICONS" aria-hidden="true" style="position: absolute; width: 0px; height: 0px; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">' +
|
|
85
|
+
symbols +
|
|
86
|
+
'\n</svg>' +
|
|
87
|
+
html.slice(start);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
fs.writeFileSync(htmlFile, html, 'utf8');
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 写 svg 图标到模块文件
|
|
95
|
+
*
|
|
96
|
+
* @param moduleFile 模块文件名
|
|
97
|
+
* @param symbols svg 图标内容
|
|
98
|
+
*/
|
|
99
|
+
export const writeIconsModule = (moduleFile: string, symbols: string) => {
|
|
100
|
+
fs.writeFileSync(
|
|
101
|
+
moduleFile,
|
|
102
|
+
`import { loadSvgIcons } from 'china-diff';
|
|
103
|
+
|
|
104
|
+
loadSvgIcons(\`${symbols}\`);
|
|
105
|
+
`,
|
|
106
|
+
'utf8',
|
|
107
|
+
);
|
|
108
|
+
};
|
package/css/all.css
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.text-align-start {
|
|
2
|
+
text-align: start;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.text-align-center {
|
|
6
|
+
text-align: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.text-align-right {
|
|
10
|
+
text-align: right;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.vertical-align-top {
|
|
14
|
+
vertical-align: top;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.vertical-align-middle {
|
|
18
|
+
vertical-align: middle;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vertical-align-right {
|
|
22
|
+
vertical-align: right;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vertical-align-baseline {
|
|
26
|
+
vertical-align: baseline;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.vertical-align-text-top {
|
|
30
|
+
vertical-align: text-top;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.vertical-align-text-bottom {
|
|
34
|
+
vertical-align: text-bottom;
|
|
35
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
.flex {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.flex-row {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.flex-column {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.flex-row-reverse {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row-reverse;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.flex-column-reverse {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column-reverse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.inline-flex {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.flex-wrap {
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.flex-wrap-reverse {
|
|
34
|
+
flex-wrap: wrap-reverse;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.flex-nowrap {
|
|
38
|
+
flex-wrap: nowrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.flex-auto {
|
|
42
|
+
flex: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.flex-none {
|
|
46
|
+
flex: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.justify-normal {
|
|
50
|
+
justify-content: normal;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.justify-start {
|
|
54
|
+
justify-items: flex-start;
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.justify-end {
|
|
59
|
+
justify-items: flex-end;
|
|
60
|
+
justify-content: flex-end;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.justify-center {
|
|
64
|
+
justify-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.justify-space-between {
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.justify-space-around {
|
|
73
|
+
justify-content: space-around;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.justify-space-evenly {
|
|
77
|
+
justify-content: space-evenly;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.justify-stretch {
|
|
81
|
+
justify-items: stretch;
|
|
82
|
+
justify-content: stretch;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.align-normal {
|
|
86
|
+
align-items: normal;
|
|
87
|
+
align-content: normal;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.align-center {
|
|
91
|
+
align-items: center;
|
|
92
|
+
align-content: center;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.align-start {
|
|
96
|
+
align-items: flex-start;
|
|
97
|
+
align-content: flex-start;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.align-end {
|
|
101
|
+
align-items: flex-end;
|
|
102
|
+
align-content: flex-end;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.align-space-between {
|
|
106
|
+
align-content: space-between;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.align-space-around {
|
|
110
|
+
align-content: space-around;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.align-space-evenly {
|
|
114
|
+
align-content: space-evenly;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.align-baseline {
|
|
118
|
+
align-content: baseline;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.align-stretch {
|
|
122
|
+
align-items: stretch;
|
|
123
|
+
align-content: stretch;
|
|
124
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.hidden {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.hover:hover .hidden-hover,
|
|
6
|
+
.hidden-hover:hover {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.active:active .hidden-active,
|
|
11
|
+
.hidden-active:active {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.selected .hidden-selected,
|
|
16
|
+
.hidden-selected.selected {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.no-hidden {
|
|
21
|
+
display: unset;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.hover:hover .no-hidden-hover,
|
|
25
|
+
.no-hidden-hover:hover {
|
|
26
|
+
display: unset;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.active:active .no-hidden-active,
|
|
30
|
+
.no-hidden-active:active {
|
|
31
|
+
display: unset;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.selected .no-hidden-selected,
|
|
35
|
+
.no-hidden-selected.selected {
|
|
36
|
+
display: unset;
|
|
37
|
+
}
|