advance-semi-theme 1.0.0
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/README.md +214 -0
- package/dist/antd/index.d.ts +159 -0
- package/dist/antd/index.js +1378 -0
- package/dist/antd/plugin.d.ts +34 -0
- package/dist/antd/plugin.js +12 -0
- package/dist/antd/styles/all.css +83 -0
- package/dist/antd/styles/base.css +202 -0
- package/dist/antd/styles/components/affix.css +7 -0
- package/dist/antd/styles/components/ai.css +242 -0
- package/dist/antd/styles/components/alert.css +149 -0
- package/dist/antd/styles/components/anchor.css +40 -0
- package/dist/antd/styles/components/app.css +9 -0
- package/dist/antd/styles/components/autocomplete.css +56 -0
- package/dist/antd/styles/components/avatar.css +37 -0
- package/dist/antd/styles/components/backtop.css +106 -0
- package/dist/antd/styles/components/badge.css +76 -0
- package/dist/antd/styles/components/breadcrumb.css +37 -0
- package/dist/antd/styles/components/button.css +528 -0
- package/dist/antd/styles/components/calendar.css +55 -0
- package/dist/antd/styles/components/card.css +113 -0
- package/dist/antd/styles/components/carousel.css +57 -0
- package/dist/antd/styles/components/cascader.css +99 -0
- package/dist/antd/styles/components/checkableTag.css +26 -0
- package/dist/antd/styles/components/checkbox.css +119 -0
- package/dist/antd/styles/components/collapse.css +74 -0
- package/dist/antd/styles/components/colorpicker.css +94 -0
- package/dist/antd/styles/components/configprovider.css +6 -0
- package/dist/antd/styles/components/datepicker.css +346 -0
- package/dist/antd/styles/components/descriptions.css +63 -0
- package/dist/antd/styles/components/divider.css +34 -0
- package/dist/antd/styles/components/drawer.css +71 -0
- package/dist/antd/styles/components/dropdown.css +94 -0
- package/dist/antd/styles/components/empty.css +40 -0
- package/dist/antd/styles/components/flex.css +19 -0
- package/dist/antd/styles/components/floatbutton.css +65 -0
- package/dist/antd/styles/components/form.css +90 -0
- package/dist/antd/styles/components/grid.css +11 -0
- package/dist/antd/styles/components/icon.css +18 -0
- package/dist/antd/styles/components/image.css +125 -0
- package/dist/antd/styles/components/input.css +459 -0
- package/dist/antd/styles/components/inputnumber.css +102 -0
- package/dist/antd/styles/components/layout.css +63 -0
- package/dist/antd/styles/components/list.css +109 -0
- package/dist/antd/styles/components/mentions.css +84 -0
- package/dist/antd/styles/components/menu.css +190 -0
- package/dist/antd/styles/components/message.css +68 -0
- package/dist/antd/styles/components/modal.css +124 -0
- package/dist/antd/styles/components/notification.css +89 -0
- package/dist/antd/styles/components/pageheader.css +62 -0
- package/dist/antd/styles/components/pagination.css +139 -0
- package/dist/antd/styles/components/popconfirm.css +64 -0
- package/dist/antd/styles/components/popover.css +40 -0
- package/dist/antd/styles/components/progress.css +105 -0
- package/dist/antd/styles/components/qrcode.css +43 -0
- package/dist/antd/styles/components/radio.css +166 -0
- package/dist/antd/styles/components/rate.css +47 -0
- package/dist/antd/styles/components/result.css +63 -0
- package/dist/antd/styles/components/scrollbar.css +22 -0
- package/dist/antd/styles/components/segmented.css +75 -0
- package/dist/antd/styles/components/select.css +282 -0
- package/dist/antd/styles/components/skeleton.css +96 -0
- package/dist/antd/styles/components/slider.css +119 -0
- package/dist/antd/styles/components/space.css +59 -0
- package/dist/antd/styles/components/spin.css +91 -0
- package/dist/antd/styles/components/statistic.css +48 -0
- package/dist/antd/styles/components/steps.css +176 -0
- package/dist/antd/styles/components/switch.css +128 -0
- package/dist/antd/styles/components/table.css +197 -0
- package/dist/antd/styles/components/tabs.css +212 -0
- package/dist/antd/styles/components/tag.css +286 -0
- package/dist/antd/styles/components/textArea.css +40 -0
- package/dist/antd/styles/components/timeline.css +106 -0
- package/dist/antd/styles/components/timepicker.css +105 -0
- package/dist/antd/styles/components/tooltip.css +37 -0
- package/dist/antd/styles/components/tour.css +114 -0
- package/dist/antd/styles/components/transfer.css +232 -0
- package/dist/antd/styles/components/tree.css +143 -0
- package/dist/antd/styles/components/treeselect.css +46 -0
- package/dist/antd/styles/components/typography.css +184 -0
- package/dist/antd/styles/components/upload.css +181 -0
- package/dist/antd/styles/components/watermark.css +16 -0
- package/dist/antd/styles/dark.css +533 -0
- package/dist/antd/styles/index.css +115 -0
- package/dist/antd/styles/overrides.css +147 -0
- package/dist/antd/styles/variables.css +259 -0
- package/dist/chunk-FMQWBDDZ.js +207 -0
- package/dist/chunk-NGAVTDQ2.js +200 -0
- package/dist/chunk-QQOB6AOA.js +213 -0
- package/dist/core/index.d.ts +179 -0
- package/dist/core/index.js +10 -0
- package/dist/core/variables.css +258 -0
- package/dist/element/index.d.ts +3 -0
- package/dist/element/index.js +17 -0
- package/dist/element/plugin.d.ts +34 -0
- package/dist/element/plugin.js +12 -0
- package/dist/element/styles/base.css +277 -0
- package/dist/element/styles/components/affix.css +7 -0
- package/dist/element/styles/components/alert.css +44 -0
- package/dist/element/styles/components/anchor.css +34 -0
- package/dist/element/styles/components/autocomplete.css +61 -0
- package/dist/element/styles/components/avatar.css +31 -0
- package/dist/element/styles/components/backtop.css +22 -0
- package/dist/element/styles/components/badge.css +48 -0
- package/dist/element/styles/components/breadcrumb.css +38 -0
- package/dist/element/styles/components/button.css +193 -0
- package/dist/element/styles/components/calendar.css +58 -0
- package/dist/element/styles/components/card.css +29 -0
- package/dist/element/styles/components/carousel.css +78 -0
- package/dist/element/styles/components/cascader.css +120 -0
- package/dist/element/styles/components/check-tag.css +35 -0
- package/dist/element/styles/components/checkbox.css +39 -0
- package/dist/element/styles/components/collapse.css +58 -0
- package/dist/element/styles/components/color-picker.css +82 -0
- package/dist/element/styles/components/config-provider.css +6 -0
- package/dist/element/styles/components/container.css +26 -0
- package/dist/element/styles/components/datepicker.css +165 -0
- package/dist/element/styles/components/descriptions-item.css +6 -0
- package/dist/element/styles/components/descriptions.css +51 -0
- package/dist/element/styles/components/dialog.css +91 -0
- package/dist/element/styles/components/divider.css +37 -0
- package/dist/element/styles/components/drawer.css +33 -0
- package/dist/element/styles/components/dropdown.css +30 -0
- package/dist/element/styles/components/empty.css +28 -0
- package/dist/element/styles/components/form.css +106 -0
- package/dist/element/styles/components/image.css +59 -0
- package/dist/element/styles/components/infinite-scroll.css +24 -0
- package/dist/element/styles/components/input-number.css +95 -0
- package/dist/element/styles/components/input.css +170 -0
- package/dist/element/styles/components/link.css +73 -0
- package/dist/element/styles/components/loading.css +50 -0
- package/dist/element/styles/components/mention.css +49 -0
- package/dist/element/styles/components/menu.css +140 -0
- package/dist/element/styles/components/message.css +88 -0
- package/dist/element/styles/components/notification.css +81 -0
- package/dist/element/styles/components/page-header.css +41 -0
- package/dist/element/styles/components/pagination.css +135 -0
- package/dist/element/styles/components/popconfirm.css +35 -0
- package/dist/element/styles/components/popover.css +22 -0
- package/dist/element/styles/components/progress.css +28 -0
- package/dist/element/styles/components/radio.css +64 -0
- package/dist/element/styles/components/rate.css +33 -0
- package/dist/element/styles/components/result.css +51 -0
- package/dist/element/styles/components/row.css +11 -0
- package/dist/element/styles/components/scrollbar.css +33 -0
- package/dist/element/styles/components/segmented.css +59 -0
- package/dist/element/styles/components/select.css +226 -0
- package/dist/element/styles/components/skeleton.css +65 -0
- package/dist/element/styles/components/slider.css +93 -0
- package/dist/element/styles/components/space.css +19 -0
- package/dist/element/styles/components/statistic.css +33 -0
- package/dist/element/styles/components/steps.css +122 -0
- package/dist/element/styles/components/switch.css +32 -0
- package/dist/element/styles/components/table.css +144 -0
- package/dist/element/styles/components/tabs.css +125 -0
- package/dist/element/styles/components/tag.css +150 -0
- package/dist/element/styles/components/text.css +50 -0
- package/dist/element/styles/components/time-picker.css +106 -0
- package/dist/element/styles/components/timeline.css +58 -0
- package/dist/element/styles/components/tooltip.css +22 -0
- package/dist/element/styles/components/tour.css +58 -0
- package/dist/element/styles/components/transfer.css +181 -0
- package/dist/element/styles/components/tree-select.css +28 -0
- package/dist/element/styles/components/tree.css +66 -0
- package/dist/element/styles/components/upload.css +96 -0
- package/dist/element/styles/components/virtualized.css +75 -0
- package/dist/element/styles/components/watermark.css +20 -0
- package/dist/element/styles/dark.css +82 -0
- package/dist/element/styles/index.css +107 -0
- package/package.json +78 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// src/element/plugin.ts
|
|
2
|
+
var SUPPORTED_COMPONENTS = [
|
|
3
|
+
"Button",
|
|
4
|
+
"Input",
|
|
5
|
+
"Select",
|
|
6
|
+
"Checkbox",
|
|
7
|
+
"Radio",
|
|
8
|
+
"Switch",
|
|
9
|
+
"Slider",
|
|
10
|
+
"Rate",
|
|
11
|
+
"DatePicker",
|
|
12
|
+
"TimePicker",
|
|
13
|
+
"Upload",
|
|
14
|
+
"Transfer",
|
|
15
|
+
"Tree",
|
|
16
|
+
"TreeSelect",
|
|
17
|
+
"Form",
|
|
18
|
+
"Table",
|
|
19
|
+
"Card",
|
|
20
|
+
"Tag",
|
|
21
|
+
"Tabs",
|
|
22
|
+
"Collapse",
|
|
23
|
+
"Avatar",
|
|
24
|
+
"Badge",
|
|
25
|
+
"Timeline",
|
|
26
|
+
"Dialog",
|
|
27
|
+
// Element Plus 用 Dialog 而不是 Modal
|
|
28
|
+
"Drawer",
|
|
29
|
+
"Message",
|
|
30
|
+
"Notification",
|
|
31
|
+
"Tooltip",
|
|
32
|
+
"Popover",
|
|
33
|
+
"Popconfirm",
|
|
34
|
+
"Progress",
|
|
35
|
+
"Alert",
|
|
36
|
+
"Steps",
|
|
37
|
+
"Pagination",
|
|
38
|
+
"Menu",
|
|
39
|
+
"Dropdown",
|
|
40
|
+
"Breadcrumb",
|
|
41
|
+
"Backtop",
|
|
42
|
+
"Loading",
|
|
43
|
+
// Element Plus 用 Loading 而不是 Spin
|
|
44
|
+
"Skeleton",
|
|
45
|
+
"Empty",
|
|
46
|
+
"Result",
|
|
47
|
+
"Image",
|
|
48
|
+
"Carousel",
|
|
49
|
+
"Calendar",
|
|
50
|
+
"Descriptions",
|
|
51
|
+
"Statistic",
|
|
52
|
+
"Divider",
|
|
53
|
+
"Space",
|
|
54
|
+
"Cascader",
|
|
55
|
+
"Autocomplete",
|
|
56
|
+
"InputNumber",
|
|
57
|
+
"Segmented",
|
|
58
|
+
"ColorPicker",
|
|
59
|
+
"Watermark",
|
|
60
|
+
"Text",
|
|
61
|
+
"Link"
|
|
62
|
+
];
|
|
63
|
+
var componentClassMap = {
|
|
64
|
+
Button: "button",
|
|
65
|
+
Input: "input",
|
|
66
|
+
Select: "select",
|
|
67
|
+
Checkbox: "checkbox",
|
|
68
|
+
Radio: "radio",
|
|
69
|
+
Switch: "switch",
|
|
70
|
+
Slider: "slider",
|
|
71
|
+
Rate: "rate",
|
|
72
|
+
DatePicker: "datepicker",
|
|
73
|
+
TimePicker: "timepicker",
|
|
74
|
+
Upload: "upload",
|
|
75
|
+
Transfer: "transfer",
|
|
76
|
+
Tree: "tree",
|
|
77
|
+
TreeSelect: "treeselect",
|
|
78
|
+
Form: "form",
|
|
79
|
+
Table: "table",
|
|
80
|
+
Card: "card",
|
|
81
|
+
Tag: "tag",
|
|
82
|
+
Tabs: "tabs",
|
|
83
|
+
Collapse: "collapse",
|
|
84
|
+
Avatar: "avatar",
|
|
85
|
+
Badge: "badge",
|
|
86
|
+
Timeline: "timeline",
|
|
87
|
+
Dialog: "dialog",
|
|
88
|
+
Drawer: "drawer",
|
|
89
|
+
Message: "message",
|
|
90
|
+
Notification: "notification",
|
|
91
|
+
Tooltip: "tooltip",
|
|
92
|
+
Popover: "popover",
|
|
93
|
+
Popconfirm: "popconfirm",
|
|
94
|
+
Progress: "progress",
|
|
95
|
+
Alert: "alert",
|
|
96
|
+
Steps: "steps",
|
|
97
|
+
Pagination: "pagination",
|
|
98
|
+
Menu: "menu",
|
|
99
|
+
Dropdown: "dropdown",
|
|
100
|
+
Breadcrumb: "breadcrumb",
|
|
101
|
+
Backtop: "backtop",
|
|
102
|
+
Loading: "loading",
|
|
103
|
+
Skeleton: "skeleton",
|
|
104
|
+
Empty: "empty",
|
|
105
|
+
Result: "result",
|
|
106
|
+
Image: "image",
|
|
107
|
+
Carousel: "carousel",
|
|
108
|
+
Calendar: "calendar",
|
|
109
|
+
Descriptions: "descriptions",
|
|
110
|
+
Statistic: "statistic",
|
|
111
|
+
Divider: "divider",
|
|
112
|
+
Space: "space",
|
|
113
|
+
Cascader: "cascader",
|
|
114
|
+
Autocomplete: "autocomplete",
|
|
115
|
+
InputNumber: "inputnumber",
|
|
116
|
+
Segmented: "segmented",
|
|
117
|
+
ColorPicker: "colorpicker",
|
|
118
|
+
Watermark: "watermark",
|
|
119
|
+
Text: "text",
|
|
120
|
+
Link: "link"
|
|
121
|
+
};
|
|
122
|
+
function createSemiTheme(options = {}) {
|
|
123
|
+
return {
|
|
124
|
+
install(app) {
|
|
125
|
+
const { components, exclude, dark = false, target = "body" } = options;
|
|
126
|
+
const applyTheme = () => {
|
|
127
|
+
const targetEl = document.querySelector(target);
|
|
128
|
+
if (!targetEl) {
|
|
129
|
+
console.warn(`[semi-theme/element] Target element "${target}" not found`);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
targetEl.classList.add("semi");
|
|
133
|
+
document.body.classList.add("semi");
|
|
134
|
+
if (dark) {
|
|
135
|
+
targetEl.classList.add("semi-dark");
|
|
136
|
+
targetEl.setAttribute("data-theme", "dark");
|
|
137
|
+
document.documentElement.classList.add("dark");
|
|
138
|
+
}
|
|
139
|
+
let enabledComponents;
|
|
140
|
+
if (components && components.length > 0) {
|
|
141
|
+
enabledComponents = components;
|
|
142
|
+
} else if (exclude && exclude.length > 0) {
|
|
143
|
+
enabledComponents = SUPPORTED_COMPONENTS.filter((c) => !exclude.includes(c));
|
|
144
|
+
} else {
|
|
145
|
+
enabledComponents = [...SUPPORTED_COMPONENTS];
|
|
146
|
+
}
|
|
147
|
+
if (enabledComponents.length === SUPPORTED_COMPONENTS.length) {
|
|
148
|
+
targetEl.setAttribute("data-semi", "all");
|
|
149
|
+
} else {
|
|
150
|
+
const componentClasses = enabledComponents.map((c) => componentClassMap[c]);
|
|
151
|
+
targetEl.setAttribute("data-semi", componentClasses.join(","));
|
|
152
|
+
enabledComponents.forEach((c) => {
|
|
153
|
+
targetEl.setAttribute(`data-semi-${componentClassMap[c]}`, "");
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
if (typeof document !== "undefined") {
|
|
158
|
+
if (document.readyState === "loading") {
|
|
159
|
+
document.addEventListener("DOMContentLoaded", applyTheme);
|
|
160
|
+
} else {
|
|
161
|
+
applyTheme();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
app.config.globalProperties.$semiTheme = {
|
|
165
|
+
toggle: (component, enabled) => {
|
|
166
|
+
const targetEl = document.querySelector(target);
|
|
167
|
+
if (!targetEl) return;
|
|
168
|
+
const attr = `data-semi-${componentClassMap[component]}`;
|
|
169
|
+
if (enabled) {
|
|
170
|
+
targetEl.setAttribute(attr, "");
|
|
171
|
+
} else {
|
|
172
|
+
targetEl.removeAttribute(attr);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
setDark: (isDark) => {
|
|
176
|
+
const targetEl = document.querySelector(target);
|
|
177
|
+
if (!targetEl) return;
|
|
178
|
+
if (isDark) {
|
|
179
|
+
targetEl.classList.add("semi-dark");
|
|
180
|
+
targetEl.setAttribute("data-theme", "dark");
|
|
181
|
+
document.documentElement.classList.add("dark");
|
|
182
|
+
} else {
|
|
183
|
+
targetEl.classList.remove("semi-dark");
|
|
184
|
+
targetEl.removeAttribute("data-theme");
|
|
185
|
+
document.documentElement.classList.remove("dark");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
var SemiThemePlugin = createSemiTheme();
|
|
193
|
+
var plugin_default = createSemiTheme;
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
SUPPORTED_COMPONENTS,
|
|
197
|
+
createSemiTheme,
|
|
198
|
+
SemiThemePlugin,
|
|
199
|
+
plugin_default
|
|
200
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// src/core/colors.ts
|
|
2
|
+
var semiColors = {
|
|
3
|
+
// Brand Colors - Blue
|
|
4
|
+
blue: {
|
|
5
|
+
0: "#EAF5FF",
|
|
6
|
+
1: "#CBE7FE",
|
|
7
|
+
2: "#98CDFD",
|
|
8
|
+
3: "#65B2FC",
|
|
9
|
+
4: "#3295FB",
|
|
10
|
+
5: "#0064FA",
|
|
11
|
+
6: "#0062D6",
|
|
12
|
+
7: "#004FB3",
|
|
13
|
+
8: "#003D8F",
|
|
14
|
+
9: "#002C6B"
|
|
15
|
+
},
|
|
16
|
+
// Secondary - Light Blue
|
|
17
|
+
lightBlue: {
|
|
18
|
+
0: "#E9F7FD",
|
|
19
|
+
1: "#C9ECFC",
|
|
20
|
+
2: "#95D8F8",
|
|
21
|
+
3: "#62C3F5",
|
|
22
|
+
4: "#30ACF1",
|
|
23
|
+
5: "#0095EE",
|
|
24
|
+
6: "#007BCA",
|
|
25
|
+
7: "#0063A7",
|
|
26
|
+
8: "#004B83",
|
|
27
|
+
9: "#00355F"
|
|
28
|
+
},
|
|
29
|
+
// Success - Green
|
|
30
|
+
green: {
|
|
31
|
+
0: "#ECF7EC",
|
|
32
|
+
1: "#D0F0D1",
|
|
33
|
+
2: "#A4E0A7",
|
|
34
|
+
3: "#7DD182",
|
|
35
|
+
4: "#5AC262",
|
|
36
|
+
5: "#3BB346",
|
|
37
|
+
6: "#30953B",
|
|
38
|
+
7: "#25772F",
|
|
39
|
+
8: "#1B5924",
|
|
40
|
+
9: "#113C18"
|
|
41
|
+
},
|
|
42
|
+
// Danger - Red
|
|
43
|
+
red: {
|
|
44
|
+
0: "#FEF2ED",
|
|
45
|
+
1: "#FEDDD2",
|
|
46
|
+
2: "#FDB7A5",
|
|
47
|
+
3: "#FB9078",
|
|
48
|
+
4: "#FA664C",
|
|
49
|
+
5: "#F93920",
|
|
50
|
+
6: "#D52515",
|
|
51
|
+
7: "#B2140C",
|
|
52
|
+
8: "#8E0805",
|
|
53
|
+
9: "#6A0103"
|
|
54
|
+
},
|
|
55
|
+
// Warning - Orange
|
|
56
|
+
orange: {
|
|
57
|
+
0: "#FFF8EA",
|
|
58
|
+
1: "#FEEECC",
|
|
59
|
+
2: "#FED998",
|
|
60
|
+
3: "#FDC165",
|
|
61
|
+
4: "#FDA633",
|
|
62
|
+
5: "#FC8800",
|
|
63
|
+
6: "#D26700",
|
|
64
|
+
7: "#A84A00",
|
|
65
|
+
8: "#7E3100",
|
|
66
|
+
9: "#541D00"
|
|
67
|
+
},
|
|
68
|
+
// Yellow
|
|
69
|
+
yellow: {
|
|
70
|
+
0: "#FFFDEA",
|
|
71
|
+
1: "#FEFBCB",
|
|
72
|
+
2: "#FDF398",
|
|
73
|
+
3: "#FCE865",
|
|
74
|
+
4: "#FBDA32",
|
|
75
|
+
5: "#FAC800",
|
|
76
|
+
6: "#D0AA00",
|
|
77
|
+
7: "#A78B00",
|
|
78
|
+
8: "#7D6A00",
|
|
79
|
+
9: "#534800"
|
|
80
|
+
},
|
|
81
|
+
// Tertiary - Grey
|
|
82
|
+
grey: {
|
|
83
|
+
0: "#F9F9F9",
|
|
84
|
+
1: "#E6E8EA",
|
|
85
|
+
2: "#C6CACD",
|
|
86
|
+
3: "#A7ABB0",
|
|
87
|
+
4: "#888D92",
|
|
88
|
+
5: "#6B7075",
|
|
89
|
+
6: "#555B61",
|
|
90
|
+
7: "#41464C",
|
|
91
|
+
8: "#2E3238",
|
|
92
|
+
9: "#1C1F23"
|
|
93
|
+
},
|
|
94
|
+
// AI Colors - Purple
|
|
95
|
+
aiPurple: {
|
|
96
|
+
0: "#F8EDFF",
|
|
97
|
+
1: "#F2DAFF",
|
|
98
|
+
2: "#E3B5FF",
|
|
99
|
+
3: "#D191FF",
|
|
100
|
+
4: "#BD6CFF",
|
|
101
|
+
5: "#A647FF",
|
|
102
|
+
6: "#8636DB",
|
|
103
|
+
7: "#6928B8",
|
|
104
|
+
8: "#4E1C94",
|
|
105
|
+
9: "#361270"
|
|
106
|
+
},
|
|
107
|
+
// Cyan
|
|
108
|
+
cyan: {
|
|
109
|
+
5: "#0095EE",
|
|
110
|
+
6: "#007BCA",
|
|
111
|
+
7: "#0063A7"
|
|
112
|
+
},
|
|
113
|
+
// Teal
|
|
114
|
+
teal: {
|
|
115
|
+
5: "#02A783",
|
|
116
|
+
6: "#018B6D",
|
|
117
|
+
7: "#006F56"
|
|
118
|
+
},
|
|
119
|
+
// Pink
|
|
120
|
+
pink: {
|
|
121
|
+
5: "#F5319D",
|
|
122
|
+
6: "#CF2682",
|
|
123
|
+
7: "#A91D69"
|
|
124
|
+
},
|
|
125
|
+
// Indigo
|
|
126
|
+
indigo: {
|
|
127
|
+
5: "#4F46E5",
|
|
128
|
+
6: "#4037C2",
|
|
129
|
+
7: "#322B9E"
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var semiColorsRGB = {
|
|
133
|
+
blue: {
|
|
134
|
+
0: "234, 245, 255",
|
|
135
|
+
5: "0, 100, 250",
|
|
136
|
+
6: "0, 98, 214",
|
|
137
|
+
7: "0, 79, 179"
|
|
138
|
+
},
|
|
139
|
+
green: {
|
|
140
|
+
0: "236, 247, 236",
|
|
141
|
+
5: "59, 179, 70",
|
|
142
|
+
6: "48, 149, 59",
|
|
143
|
+
7: "38, 119, 48"
|
|
144
|
+
},
|
|
145
|
+
red: {
|
|
146
|
+
0: "254, 242, 237",
|
|
147
|
+
5: "249, 57, 32",
|
|
148
|
+
6: "213, 37, 21",
|
|
149
|
+
7: "178, 24, 13"
|
|
150
|
+
},
|
|
151
|
+
orange: {
|
|
152
|
+
0: "255, 248, 234",
|
|
153
|
+
5: "252, 136, 0",
|
|
154
|
+
6: "210, 103, 0",
|
|
155
|
+
7: "168, 72, 0"
|
|
156
|
+
},
|
|
157
|
+
grey: {
|
|
158
|
+
0: "249, 249, 249",
|
|
159
|
+
8: "46, 50, 56",
|
|
160
|
+
9: "28, 31, 35"
|
|
161
|
+
},
|
|
162
|
+
white: "255, 255, 255",
|
|
163
|
+
black: "0, 0, 0"
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/core/index.ts
|
|
167
|
+
function createBasePlugin(options = {}) {
|
|
168
|
+
const { components, exclude, dark = false, target = "body" } = options;
|
|
169
|
+
return {
|
|
170
|
+
setupDom() {
|
|
171
|
+
const targetElement = document.querySelector(target) || document.body;
|
|
172
|
+
targetElement.classList.add("semi");
|
|
173
|
+
if (dark) {
|
|
174
|
+
targetElement.setAttribute("data-theme", "dark");
|
|
175
|
+
}
|
|
176
|
+
if (components && components.length > 0) {
|
|
177
|
+
targetElement.setAttribute("data-semi", components.join(","));
|
|
178
|
+
components.forEach((comp) => {
|
|
179
|
+
targetElement.setAttribute(`data-semi-${comp.toLowerCase()}`, "");
|
|
180
|
+
});
|
|
181
|
+
} else if (exclude && exclude.length > 0) {
|
|
182
|
+
targetElement.setAttribute("data-semi", "all");
|
|
183
|
+
targetElement.setAttribute("data-semi-exclude", exclude.join(","));
|
|
184
|
+
} else {
|
|
185
|
+
targetElement.setAttribute("data-semi", "all");
|
|
186
|
+
}
|
|
187
|
+
return targetElement;
|
|
188
|
+
},
|
|
189
|
+
setDark(isDark) {
|
|
190
|
+
const targetElement = document.querySelector(target) || document.body;
|
|
191
|
+
if (isDark) {
|
|
192
|
+
targetElement.setAttribute("data-theme", "dark");
|
|
193
|
+
} else {
|
|
194
|
+
targetElement.removeAttribute("data-theme");
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
toggle(component, enabled) {
|
|
198
|
+
const targetElement = document.querySelector(target) || document.body;
|
|
199
|
+
const attr = `data-semi-${component.toLowerCase()}`;
|
|
200
|
+
if (enabled) {
|
|
201
|
+
targetElement.setAttribute(attr, "");
|
|
202
|
+
} else {
|
|
203
|
+
targetElement.removeAttribute(attr);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export {
|
|
210
|
+
semiColors,
|
|
211
|
+
semiColorsRGB,
|
|
212
|
+
createBasePlugin
|
|
213
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semi Design Color Palette
|
|
3
|
+
* 共享颜色定义,供 antd 和 element 主题使用
|
|
4
|
+
*/
|
|
5
|
+
declare const semiColors: {
|
|
6
|
+
blue: {
|
|
7
|
+
0: string;
|
|
8
|
+
1: string;
|
|
9
|
+
2: string;
|
|
10
|
+
3: string;
|
|
11
|
+
4: string;
|
|
12
|
+
5: string;
|
|
13
|
+
6: string;
|
|
14
|
+
7: string;
|
|
15
|
+
8: string;
|
|
16
|
+
9: string;
|
|
17
|
+
};
|
|
18
|
+
lightBlue: {
|
|
19
|
+
0: string;
|
|
20
|
+
1: string;
|
|
21
|
+
2: string;
|
|
22
|
+
3: string;
|
|
23
|
+
4: string;
|
|
24
|
+
5: string;
|
|
25
|
+
6: string;
|
|
26
|
+
7: string;
|
|
27
|
+
8: string;
|
|
28
|
+
9: string;
|
|
29
|
+
};
|
|
30
|
+
green: {
|
|
31
|
+
0: string;
|
|
32
|
+
1: string;
|
|
33
|
+
2: string;
|
|
34
|
+
3: string;
|
|
35
|
+
4: string;
|
|
36
|
+
5: string;
|
|
37
|
+
6: string;
|
|
38
|
+
7: string;
|
|
39
|
+
8: string;
|
|
40
|
+
9: string;
|
|
41
|
+
};
|
|
42
|
+
red: {
|
|
43
|
+
0: string;
|
|
44
|
+
1: string;
|
|
45
|
+
2: string;
|
|
46
|
+
3: string;
|
|
47
|
+
4: string;
|
|
48
|
+
5: string;
|
|
49
|
+
6: string;
|
|
50
|
+
7: string;
|
|
51
|
+
8: string;
|
|
52
|
+
9: string;
|
|
53
|
+
};
|
|
54
|
+
orange: {
|
|
55
|
+
0: string;
|
|
56
|
+
1: string;
|
|
57
|
+
2: string;
|
|
58
|
+
3: string;
|
|
59
|
+
4: string;
|
|
60
|
+
5: string;
|
|
61
|
+
6: string;
|
|
62
|
+
7: string;
|
|
63
|
+
8: string;
|
|
64
|
+
9: string;
|
|
65
|
+
};
|
|
66
|
+
yellow: {
|
|
67
|
+
0: string;
|
|
68
|
+
1: string;
|
|
69
|
+
2: string;
|
|
70
|
+
3: string;
|
|
71
|
+
4: string;
|
|
72
|
+
5: string;
|
|
73
|
+
6: string;
|
|
74
|
+
7: string;
|
|
75
|
+
8: string;
|
|
76
|
+
9: string;
|
|
77
|
+
};
|
|
78
|
+
grey: {
|
|
79
|
+
0: string;
|
|
80
|
+
1: string;
|
|
81
|
+
2: string;
|
|
82
|
+
3: string;
|
|
83
|
+
4: string;
|
|
84
|
+
5: string;
|
|
85
|
+
6: string;
|
|
86
|
+
7: string;
|
|
87
|
+
8: string;
|
|
88
|
+
9: string;
|
|
89
|
+
};
|
|
90
|
+
aiPurple: {
|
|
91
|
+
0: string;
|
|
92
|
+
1: string;
|
|
93
|
+
2: string;
|
|
94
|
+
3: string;
|
|
95
|
+
4: string;
|
|
96
|
+
5: string;
|
|
97
|
+
6: string;
|
|
98
|
+
7: string;
|
|
99
|
+
8: string;
|
|
100
|
+
9: string;
|
|
101
|
+
};
|
|
102
|
+
cyan: {
|
|
103
|
+
5: string;
|
|
104
|
+
6: string;
|
|
105
|
+
7: string;
|
|
106
|
+
};
|
|
107
|
+
teal: {
|
|
108
|
+
5: string;
|
|
109
|
+
6: string;
|
|
110
|
+
7: string;
|
|
111
|
+
};
|
|
112
|
+
pink: {
|
|
113
|
+
5: string;
|
|
114
|
+
6: string;
|
|
115
|
+
7: string;
|
|
116
|
+
};
|
|
117
|
+
indigo: {
|
|
118
|
+
5: string;
|
|
119
|
+
6: string;
|
|
120
|
+
7: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
declare const semiColorsRGB: {
|
|
124
|
+
blue: {
|
|
125
|
+
0: string;
|
|
126
|
+
5: string;
|
|
127
|
+
6: string;
|
|
128
|
+
7: string;
|
|
129
|
+
};
|
|
130
|
+
green: {
|
|
131
|
+
0: string;
|
|
132
|
+
5: string;
|
|
133
|
+
6: string;
|
|
134
|
+
7: string;
|
|
135
|
+
};
|
|
136
|
+
red: {
|
|
137
|
+
0: string;
|
|
138
|
+
5: string;
|
|
139
|
+
6: string;
|
|
140
|
+
7: string;
|
|
141
|
+
};
|
|
142
|
+
orange: {
|
|
143
|
+
0: string;
|
|
144
|
+
5: string;
|
|
145
|
+
6: string;
|
|
146
|
+
7: string;
|
|
147
|
+
};
|
|
148
|
+
grey: {
|
|
149
|
+
0: string;
|
|
150
|
+
8: string;
|
|
151
|
+
9: string;
|
|
152
|
+
};
|
|
153
|
+
white: string;
|
|
154
|
+
black: string;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Semi Theme Core
|
|
159
|
+
* 共享核心模块,供 antd 和 element 主题使用
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
type SupportedComponent = 'Button' | 'Input' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'DatePicker' | 'TimePicker' | 'Upload' | 'Form' | 'Rate' | 'Slider' | 'Table' | 'Tag' | 'Badge' | 'Avatar' | 'Card' | 'Collapse' | 'Descriptions' | 'Empty' | 'List' | 'Statistic' | 'Tree' | 'TreeSelect' | 'Menu' | 'Tabs' | 'Breadcrumb' | 'Dropdown' | 'Pagination' | 'Steps' | 'Modal' | 'Dialog' | 'Drawer' | 'Message' | 'Notification' | 'Popconfirm' | 'Popover' | 'Tooltip' | 'Progress' | 'Result' | 'Skeleton' | 'Spin' | 'Loading' | 'Alert' | 'Calendar' | 'Carousel' | 'Image' | 'Timeline' | 'Transfer' | 'Divider' | 'Space' | 'Typography' | 'Anchor' | 'BackTop' | 'Backtop' | 'Watermark' | 'Text' | 'Link' | 'ColorPicker' | 'Autocomplete' | 'InputNumber' | 'Segmented' | 'CheckTag' | 'AutoComplete' | 'Mentions' | 'FloatButton' | 'Tour' | 'Layout' | 'Grid' | 'Affix' | 'Cascader';
|
|
163
|
+
interface SemiThemeOptions {
|
|
164
|
+
/** 指定要应用主题的组件列表 */
|
|
165
|
+
components?: SupportedComponent[];
|
|
166
|
+
/** 排除不应用主题的组件列表 */
|
|
167
|
+
exclude?: SupportedComponent[];
|
|
168
|
+
/** 是否启用深色模式 */
|
|
169
|
+
dark?: boolean;
|
|
170
|
+
/** 挂载目标选择器,默认为 'body' */
|
|
171
|
+
target?: string;
|
|
172
|
+
}
|
|
173
|
+
declare function createBasePlugin(options?: SemiThemeOptions): {
|
|
174
|
+
setupDom(): Element;
|
|
175
|
+
setDark(isDark: boolean): void;
|
|
176
|
+
toggle(component: SupportedComponent, enabled: boolean): void;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export { type SemiThemeOptions, type SupportedComponent, createBasePlugin, semiColors, semiColorsRGB };
|