@manohub/ui 0.8.1 → 0.9.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 +1 -1
- package/dist/components/button/index.d.ts +8 -8
- package/dist/components/code-block/index.d.ts +776 -0
- package/dist/components/code-block/index.js +328 -0
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/dialog/index.js +5 -5
- package/dist/components/notice/index.d.ts +1 -1
- package/dist/components/notice/index.js +4 -4
- package/dist/components/notification/index.d.ts +1 -1
- package/dist/components/notification/index.js +5 -5
- package/dist/components/tag/index.d.ts +1 -1
- package/dist/components/toast/index.d.ts +4 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -4
- package/dist/services/dialog.d.ts +1 -1
- package/dist/styles/components/code-block.css +216 -0
- package/dist/styles/components/code-block.tokens.css +40 -0
- package/dist/styles/components/dialog.css +3 -3
- package/dist/styles/index.css +2 -4
- package/dist/styles/reset.css +4 -0
- package/package.json +2 -2
- package/dist/components/code/index.d.ts +0 -134
- package/dist/components/code/index.js +0 -117
- package/dist/components/code-editor/index.d.ts +0 -163
- package/dist/components/code-editor/index.js +0 -98
- package/dist/styles/components/code-editor.css +0 -91
- package/dist/styles/components/code-editor.tokens.css +0 -24
- package/dist/styles/components/code.css +0 -153
- package/dist/styles/components/code.tokens.css +0 -29
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { defineComponent, createVNode, mergeProps, ref, computed, onBeforeUnmount } from "vue";
|
|
2
|
+
import { Icon } from "@manohub/icon";
|
|
3
|
+
const CodeView = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "CodeView",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
code: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: ""
|
|
10
|
+
},
|
|
11
|
+
inline: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
plain: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
language: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
copyable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
maxHeight: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
wrap: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
onCopy: {
|
|
36
|
+
type: Function,
|
|
37
|
+
default: void 0
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
slots: Object,
|
|
41
|
+
setup(props, {
|
|
42
|
+
slots,
|
|
43
|
+
attrs
|
|
44
|
+
}) {
|
|
45
|
+
const copied = ref(false);
|
|
46
|
+
let timer;
|
|
47
|
+
onBeforeUnmount(() => {
|
|
48
|
+
if (timer) clearTimeout(timer);
|
|
49
|
+
});
|
|
50
|
+
const copy = async () => {
|
|
51
|
+
const text = props.code;
|
|
52
|
+
let ok = false;
|
|
53
|
+
try {
|
|
54
|
+
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
|
|
55
|
+
await navigator.clipboard.writeText(text);
|
|
56
|
+
ok = true;
|
|
57
|
+
}
|
|
58
|
+
} catch {
|
|
59
|
+
ok = false;
|
|
60
|
+
}
|
|
61
|
+
if (!ok) {
|
|
62
|
+
console.warn("[ui] CodeBlock.View:当前环境无法写入剪贴板,复制未生效");
|
|
63
|
+
}
|
|
64
|
+
copied.value = ok;
|
|
65
|
+
if (ok) {
|
|
66
|
+
if (timer) clearTimeout(timer);
|
|
67
|
+
timer = setTimeout(() => copied.value = false, 1500);
|
|
68
|
+
}
|
|
69
|
+
props.onCopy?.(ok);
|
|
70
|
+
};
|
|
71
|
+
return () => {
|
|
72
|
+
const extra = attrs.class;
|
|
73
|
+
const style = attrs.style;
|
|
74
|
+
const content = slots.default ? slots.default() : props.code;
|
|
75
|
+
if (props.inline) {
|
|
76
|
+
return createVNode("code", {
|
|
77
|
+
"class": ["mh-code-block", "mh-code-block--inline", props.plain ? "mh-code-block--plain" : "", extra].filter(Boolean).join(" "),
|
|
78
|
+
"style": style
|
|
79
|
+
}, [content]);
|
|
80
|
+
}
|
|
81
|
+
const copyLabel = copied.value ? "已复制" : "复制代码";
|
|
82
|
+
const limited = props.maxHeight === void 0 ? void 0 : {
|
|
83
|
+
maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight,
|
|
84
|
+
overflow: "auto"
|
|
85
|
+
};
|
|
86
|
+
return createVNode("div", {
|
|
87
|
+
"class": ["mh-code-block", props.wrap ? "mh-code-block--wrap" : "", extra].filter(Boolean).join(" "),
|
|
88
|
+
"style": style
|
|
89
|
+
}, [createVNode("pre", {
|
|
90
|
+
"class": "mh-code-block__view",
|
|
91
|
+
"style": limited
|
|
92
|
+
}, [content]), props.language ? createVNode("span", {
|
|
93
|
+
"class": "mh-code-block__lang"
|
|
94
|
+
}, [props.language]) : null, props.copyable ? createVNode("button", {
|
|
95
|
+
"type": "button",
|
|
96
|
+
"class": ["mh-button", "mh-button--icon", "mh-code-block__copy", copied.value ? "is-copied" : ""].filter(Boolean).join(" "),
|
|
97
|
+
"data-state": copied.value ? "copied" : "idle",
|
|
98
|
+
"aria-label": copyLabel,
|
|
99
|
+
"title": copyLabel,
|
|
100
|
+
"onClick": copy
|
|
101
|
+
}, [createVNode(Icon, {
|
|
102
|
+
"name": copied.value ? "check" : "copy",
|
|
103
|
+
"class": "mh-button__icon"
|
|
104
|
+
}, null)]) : null]);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const CodeEditor = /* @__PURE__ */ defineComponent({
|
|
109
|
+
name: "CodeEditor",
|
|
110
|
+
inheritAttrs: false,
|
|
111
|
+
props: {
|
|
112
|
+
modelValue: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: void 0
|
|
115
|
+
},
|
|
116
|
+
defaultValue: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: ""
|
|
119
|
+
},
|
|
120
|
+
placeholder: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: void 0
|
|
123
|
+
},
|
|
124
|
+
rows: {
|
|
125
|
+
type: Number,
|
|
126
|
+
default: void 0
|
|
127
|
+
},
|
|
128
|
+
autoSize: {
|
|
129
|
+
type: [Boolean, Object],
|
|
130
|
+
default: true
|
|
131
|
+
},
|
|
132
|
+
maxHeight: {
|
|
133
|
+
type: [String, Number],
|
|
134
|
+
default: void 0
|
|
135
|
+
},
|
|
136
|
+
readonly: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: false
|
|
139
|
+
},
|
|
140
|
+
disabled: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false
|
|
143
|
+
},
|
|
144
|
+
language: {
|
|
145
|
+
type: String,
|
|
146
|
+
default: ""
|
|
147
|
+
},
|
|
148
|
+
onChange: {
|
|
149
|
+
type: Function,
|
|
150
|
+
default: void 0
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
emits: {
|
|
154
|
+
"update:modelValue": (v) => true
|
|
155
|
+
},
|
|
156
|
+
setup(props, {
|
|
157
|
+
emit,
|
|
158
|
+
attrs
|
|
159
|
+
}) {
|
|
160
|
+
const inner = ref(props.defaultValue);
|
|
161
|
+
const current = computed(() => props.modelValue ?? inner.value);
|
|
162
|
+
const visibleRows = computed(() => {
|
|
163
|
+
if (props.autoSize === false) return props.rows ?? 4;
|
|
164
|
+
const option = typeof props.autoSize === "object" ? props.autoSize : {};
|
|
165
|
+
const min = option.minRows ?? 3;
|
|
166
|
+
const max = option.maxRows ?? 12;
|
|
167
|
+
const lines = (current.value ?? "").split("\n").length;
|
|
168
|
+
return Math.min(Math.max(lines, min), max);
|
|
169
|
+
});
|
|
170
|
+
const areaStyle = computed(() => props.maxHeight === void 0 ? void 0 : {
|
|
171
|
+
maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight,
|
|
172
|
+
overflow: "auto"
|
|
173
|
+
});
|
|
174
|
+
const onInput = (event) => {
|
|
175
|
+
const el = event.target;
|
|
176
|
+
const value = el.value;
|
|
177
|
+
if (props.modelValue === void 0) inner.value = value;
|
|
178
|
+
emit("update:modelValue", value);
|
|
179
|
+
props.onChange?.(value);
|
|
180
|
+
if (props.modelValue !== void 0 && props.modelValue !== value) el.value = props.modelValue;
|
|
181
|
+
};
|
|
182
|
+
return () => createVNode("div", {
|
|
183
|
+
"class": ["mh-code-block", "mh-code-block--editable", attrs.class].filter(Boolean).join(" "),
|
|
184
|
+
"style": attrs.style
|
|
185
|
+
}, [createVNode("textarea", {
|
|
186
|
+
"class": "mh-code-block__editor",
|
|
187
|
+
"rows": visibleRows.value,
|
|
188
|
+
"value": current.value,
|
|
189
|
+
"placeholder": props.placeholder,
|
|
190
|
+
"readonly": props.readonly,
|
|
191
|
+
"disabled": props.disabled,
|
|
192
|
+
"style": areaStyle.value,
|
|
193
|
+
"spellcheck": false,
|
|
194
|
+
"autocapitalize": "off",
|
|
195
|
+
"autocomplete": "off",
|
|
196
|
+
"onInput": onInput
|
|
197
|
+
}, null), props.language ? createVNode("span", {
|
|
198
|
+
"class": "mh-code-block__lang"
|
|
199
|
+
}, [props.language]) : null]);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const CodeBlockBase = /* @__PURE__ */ defineComponent({
|
|
203
|
+
name: "CodeBlock",
|
|
204
|
+
inheritAttrs: false,
|
|
205
|
+
props: {
|
|
206
|
+
editable: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: false
|
|
209
|
+
},
|
|
210
|
+
/* —— 只读档(`editable` 为假时生效) —— */
|
|
211
|
+
code: {
|
|
212
|
+
type: String,
|
|
213
|
+
default: ""
|
|
214
|
+
},
|
|
215
|
+
inline: {
|
|
216
|
+
type: Boolean,
|
|
217
|
+
default: false
|
|
218
|
+
},
|
|
219
|
+
plain: {
|
|
220
|
+
type: Boolean,
|
|
221
|
+
default: false
|
|
222
|
+
},
|
|
223
|
+
copyable: {
|
|
224
|
+
type: Boolean,
|
|
225
|
+
default: false
|
|
226
|
+
},
|
|
227
|
+
wrap: {
|
|
228
|
+
type: Boolean,
|
|
229
|
+
default: false
|
|
230
|
+
},
|
|
231
|
+
onCopy: {
|
|
232
|
+
type: Function,
|
|
233
|
+
default: void 0
|
|
234
|
+
},
|
|
235
|
+
/* —— 编辑档(`editable` 为真时生效) —— */
|
|
236
|
+
modelValue: {
|
|
237
|
+
type: String,
|
|
238
|
+
default: void 0
|
|
239
|
+
},
|
|
240
|
+
defaultValue: {
|
|
241
|
+
type: String,
|
|
242
|
+
default: ""
|
|
243
|
+
},
|
|
244
|
+
placeholder: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: void 0
|
|
247
|
+
},
|
|
248
|
+
rows: {
|
|
249
|
+
type: Number,
|
|
250
|
+
default: void 0
|
|
251
|
+
},
|
|
252
|
+
autoSize: {
|
|
253
|
+
type: [Boolean, Object],
|
|
254
|
+
default: true
|
|
255
|
+
},
|
|
256
|
+
readonly: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: false
|
|
259
|
+
},
|
|
260
|
+
disabled: {
|
|
261
|
+
type: Boolean,
|
|
262
|
+
default: false
|
|
263
|
+
},
|
|
264
|
+
onChange: {
|
|
265
|
+
type: Function,
|
|
266
|
+
default: void 0
|
|
267
|
+
},
|
|
268
|
+
/* —— 两档共用 —— */
|
|
269
|
+
language: {
|
|
270
|
+
type: String,
|
|
271
|
+
default: ""
|
|
272
|
+
},
|
|
273
|
+
maxHeight: {
|
|
274
|
+
type: [String, Number],
|
|
275
|
+
default: void 0
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
emits: {
|
|
279
|
+
"update:modelValue": (v) => true
|
|
280
|
+
},
|
|
281
|
+
slots: Object,
|
|
282
|
+
setup(props, {
|
|
283
|
+
emit,
|
|
284
|
+
slots,
|
|
285
|
+
attrs
|
|
286
|
+
}) {
|
|
287
|
+
return () => {
|
|
288
|
+
const shared = {
|
|
289
|
+
language: props.language,
|
|
290
|
+
maxHeight: props.maxHeight,
|
|
291
|
+
class: attrs.class,
|
|
292
|
+
style: attrs.style
|
|
293
|
+
};
|
|
294
|
+
if (props.editable) {
|
|
295
|
+
return createVNode(CodeEditor, mergeProps(shared, {
|
|
296
|
+
"modelValue": props.modelValue,
|
|
297
|
+
"defaultValue": props.defaultValue,
|
|
298
|
+
"placeholder": props.placeholder,
|
|
299
|
+
"rows": props.rows,
|
|
300
|
+
"autoSize": props.autoSize,
|
|
301
|
+
"readonly": props.readonly,
|
|
302
|
+
"disabled": props.disabled,
|
|
303
|
+
"onChange": props.onChange,
|
|
304
|
+
"onUpdate:modelValue": (v) => emit("update:modelValue", v)
|
|
305
|
+
}), null);
|
|
306
|
+
}
|
|
307
|
+
return createVNode(CodeView, mergeProps(shared, {
|
|
308
|
+
"code": props.code,
|
|
309
|
+
"inline": props.inline,
|
|
310
|
+
"plain": props.plain,
|
|
311
|
+
"copyable": props.copyable,
|
|
312
|
+
"wrap": props.wrap,
|
|
313
|
+
"onCopy": props.onCopy
|
|
314
|
+
}), {
|
|
315
|
+
default: () => [slots.default?.()]
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const CodeBlock = Object.assign(CodeBlockBase, {
|
|
321
|
+
View: CodeView,
|
|
322
|
+
Editor: CodeEditor
|
|
323
|
+
});
|
|
324
|
+
export {
|
|
325
|
+
CodeBlock,
|
|
326
|
+
CodeEditor,
|
|
327
|
+
CodeView
|
|
328
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
2
|
export type DialogWidth = 'md' | 'lg';
|
|
3
|
-
/**
|
|
3
|
+
/** 语义档:决定标题左侧图标的图形与颜色(缺省不渲染图标) */
|
|
4
4
|
export type DialogTone = 'info' | 'success' | 'warning' | 'error';
|
|
5
5
|
/**
|
|
6
6
|
* 对话框(**自绘**;模态语义与遮罩全由原生 `<dialog>` 给)。
|
|
@@ -50,7 +50,7 @@ export declare const Dialog: import("vue").DefineComponent<import("vue").Extract
|
|
|
50
50
|
/**
|
|
51
51
|
* 语义档(缺省不渲染图标):`warning` / `error` 用于「这一步有风险」的确认 ——
|
|
52
52
|
* 服务层的 `confirm()` / `alert()` 就是靠它把「删除确认」与「保存成功」区分开的。
|
|
53
|
-
*
|
|
53
|
+
* 它**只加一个带圈语义图标与配色**,不改标题文案、不动底栏按钮的语义(危险色仍由 `okDanger` 定)。
|
|
54
54
|
*/
|
|
55
55
|
tone: {
|
|
56
56
|
type: PropType<DialogTone>;
|
|
@@ -157,7 +157,7 @@ export declare const Dialog: import("vue").DefineComponent<import("vue").Extract
|
|
|
157
157
|
/**
|
|
158
158
|
* 语义档(缺省不渲染图标):`warning` / `error` 用于「这一步有风险」的确认 ——
|
|
159
159
|
* 服务层的 `confirm()` / `alert()` 就是靠它把「删除确认」与「保存成功」区分开的。
|
|
160
|
-
*
|
|
160
|
+
* 它**只加一个带圈语义图标与配色**,不改标题文案、不动底栏按钮的语义(危险色仍由 `okDanger` 定)。
|
|
161
161
|
*/
|
|
162
162
|
tone: {
|
|
163
163
|
type: PropType<DialogTone>;
|
|
@@ -2,10 +2,10 @@ import { defineComponent, ref, watch, onMounted, onBeforeUnmount, computed, crea
|
|
|
2
2
|
import { Icon } from "@manohub/icon";
|
|
3
3
|
import { Button } from "../button/index.js";
|
|
4
4
|
const TONE_ICON = {
|
|
5
|
-
info: "info",
|
|
6
|
-
success: "check",
|
|
7
|
-
warning: "alert",
|
|
8
|
-
error: "close"
|
|
5
|
+
info: "info-circle",
|
|
6
|
+
success: "check-circle",
|
|
7
|
+
warning: "alert-circle",
|
|
8
|
+
error: "close-circle"
|
|
9
9
|
};
|
|
10
10
|
const Dialog = /* @__PURE__ */ defineComponent({
|
|
11
11
|
name: "Dialog",
|
|
@@ -24,7 +24,7 @@ const Dialog = /* @__PURE__ */ defineComponent({
|
|
|
24
24
|
/**
|
|
25
25
|
* 语义档(缺省不渲染图标):`warning` / `error` 用于「这一步有风险」的确认 ——
|
|
26
26
|
* 服务层的 `confirm()` / `alert()` 就是靠它把「删除确认」与「保存成功」区分开的。
|
|
27
|
-
*
|
|
27
|
+
* 它**只加一个带圈语义图标与配色**,不改标题文案、不动底栏按钮的语义(危险色仍由 `okDanger` 定)。
|
|
28
28
|
*/
|
|
29
29
|
tone: {
|
|
30
30
|
type: String,
|
|
@@ -136,7 +136,7 @@ export declare const Notice: import("vue").DefineComponent<import("vue").Extract
|
|
|
136
136
|
default: undefined;
|
|
137
137
|
};
|
|
138
138
|
}>> & Readonly<{}>, {
|
|
139
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
139
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
140
140
|
onClose: () => void;
|
|
141
141
|
message: string;
|
|
142
142
|
closable: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent, createVNode, Fragment, createTextVNode } from "vue";
|
|
2
2
|
import { Icon } from "@manohub/icon";
|
|
3
3
|
const TONE_ICON = {
|
|
4
|
-
info: "info",
|
|
5
|
-
success: "check",
|
|
6
|
-
warning: "alert",
|
|
7
|
-
error: "close"
|
|
4
|
+
info: "info-circle",
|
|
5
|
+
success: "check-circle",
|
|
6
|
+
warning: "alert-circle",
|
|
7
|
+
error: "close-circle"
|
|
8
8
|
};
|
|
9
9
|
const Notice = /* @__PURE__ */ defineComponent({
|
|
10
10
|
name: "Notice",
|
|
@@ -102,7 +102,7 @@ export declare const Notification: import("vue").DefineComponent<import("vue").E
|
|
|
102
102
|
default: undefined;
|
|
103
103
|
};
|
|
104
104
|
}>> & Readonly<{}>, {
|
|
105
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
105
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
106
106
|
title: string;
|
|
107
107
|
onClose: () => void;
|
|
108
108
|
closable: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent, onMounted, onBeforeUnmount, createVNode } from "vue";
|
|
2
2
|
import { Icon } from "@manohub/icon";
|
|
3
3
|
const TONE_ICON = {
|
|
4
|
-
info: "info",
|
|
5
|
-
success: "check",
|
|
6
|
-
warning: "alert",
|
|
7
|
-
error: "close",
|
|
8
|
-
submit: "check"
|
|
4
|
+
info: "info-circle",
|
|
5
|
+
success: "check-circle",
|
|
6
|
+
warning: "alert-circle",
|
|
7
|
+
error: "close-circle",
|
|
8
|
+
submit: "check-circle"
|
|
9
9
|
};
|
|
10
10
|
const Notification = /* @__PURE__ */ defineComponent({
|
|
11
11
|
name: "Notification",
|
|
@@ -185,7 +185,7 @@ export declare const Tag: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
185
185
|
}>> & Readonly<{}>, {
|
|
186
186
|
color: string;
|
|
187
187
|
size: ControlSize;
|
|
188
|
-
icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
188
|
+
icon: "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
189
189
|
disabled: boolean;
|
|
190
190
|
name: string;
|
|
191
191
|
value: string | number;
|
|
@@ -99,7 +99,7 @@ export declare const Toast: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
99
99
|
onClose?: (() => any) | undefined;
|
|
100
100
|
}>, {
|
|
101
101
|
text: string;
|
|
102
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
102
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
103
103
|
closable: boolean;
|
|
104
104
|
tone: ToastTone;
|
|
105
105
|
action: string;
|
|
@@ -151,7 +151,7 @@ export declare const ToastCompound: {
|
|
|
151
151
|
close: () => true;
|
|
152
152
|
}, import("vue").PublicProps, {
|
|
153
153
|
text: string;
|
|
154
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
154
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
155
155
|
closable: boolean;
|
|
156
156
|
tone: ToastTone;
|
|
157
157
|
action: string;
|
|
@@ -205,7 +205,7 @@ export declare const ToastCompound: {
|
|
|
205
205
|
onClose?: (() => any) | undefined;
|
|
206
206
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
207
207
|
text: string;
|
|
208
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
208
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
209
209
|
closable: boolean;
|
|
210
210
|
tone: ToastTone;
|
|
211
211
|
action: string;
|
|
@@ -256,7 +256,7 @@ export declare const ToastCompound: {
|
|
|
256
256
|
close: () => true;
|
|
257
257
|
}, string, {
|
|
258
258
|
text: string;
|
|
259
|
-
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
259
|
+
icon: boolean | "search" | "link" | "filter" | "copy" | "help" | "table" | "menu" | "delete" | "image" | "close" | "key" | "page-title" | "loading" | "info" | "alert" | "chevron-left" | "chevron-right" | "chevron-down" | "chevron-up" | "check" | "user" | "download" | "back" | "folder" | "folder-open" | "file" | "file-code" | "file-json" | "file-text" | "terminal" | "shield" | "tool" | "plus" | "notification" | "settings" | "logout" | "home" | "workbench" | "apps" | "favorite" | "favorite-filled" | "drag-handle" | "edit" | "refresh" | "upload" | "save" | "more" | "preview" | "external-link" | "minus" | "plus-circle" | "close-circle" | "info-circle" | "check-circle" | "alert-circle" | "list" | "calendar" | "clock" | "lock" | "unlock" | "users" | "archive" | "package" | "plug" | "branch" | "tag" | "ai" | "shield-check" | "shield-alert" | "history";
|
|
260
260
|
closable: boolean;
|
|
261
261
|
tone: ToastTone;
|
|
262
262
|
action: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -50,8 +50,7 @@ export { Pagination, type PaginationPageItem } from './components/pagination';
|
|
|
50
50
|
export { TabBar, type TabBarOption, type TabBarValue } from './components/tabbar';
|
|
51
51
|
export { Steps, type CanJump, type StepsItem, type StepsVariant, type StepsCompound, type StepsCompoundType, } from './components/steps';
|
|
52
52
|
export { Toast, type ToastTone, type ToastCompound, type ToastCompoundType, } from './components/toast';
|
|
53
|
-
export {
|
|
54
|
-
export { CodeEditor, type CodeEditorProps, type CodeEditorAutoSize, } from './components/code-editor';
|
|
53
|
+
export { CodeBlock, type CodeBlockProps, type CodeEditorAutoSize, type CodeBlockCompound, type CodeBlockCompoundType, } from './components/code-block';
|
|
55
54
|
export { Upload, formatFileSize, type UploadFile, type UploadCompound, type UploadCompoundType, } from './components/upload';
|
|
56
55
|
export { QueryState, type QueryStateKind, type QueryStateProps } from './components/query-state';
|
|
57
56
|
export { Loading, type LoadingOverlay, type LoadingProps } from './components/loading';
|
package/dist/index.js
CHANGED
|
@@ -33,8 +33,7 @@ import { Pagination } from "./components/pagination/index.js";
|
|
|
33
33
|
import { TabBar } from "./components/tabbar/index.js";
|
|
34
34
|
import { Steps } from "./components/steps/index.js";
|
|
35
35
|
import { Toast } from "./components/toast/index.js";
|
|
36
|
-
import {
|
|
37
|
-
import { CodeEditor } from "./components/code-editor/index.js";
|
|
36
|
+
import { CodeBlock } from "./components/code-block/index.js";
|
|
38
37
|
import { Upload, formatFileSize } from "./components/upload/index.js";
|
|
39
38
|
import { QueryState } from "./components/query-state/index.js";
|
|
40
39
|
import { Loading } from "./components/loading/index.js";
|
|
@@ -51,8 +50,7 @@ export {
|
|
|
51
50
|
Capsule,
|
|
52
51
|
Card,
|
|
53
52
|
Checkbox,
|
|
54
|
-
|
|
55
|
-
CodeEditor,
|
|
53
|
+
CodeBlock,
|
|
56
54
|
Collapse,
|
|
57
55
|
Dialog,
|
|
58
56
|
Divider,
|
|
@@ -5,7 +5,7 @@ export interface ConfirmOptions {
|
|
|
5
5
|
/** 正文(纯文本;复杂内容请直接用 `Dialog` 组件) */
|
|
6
6
|
detail?: string;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* 语义档(决定标题左侧的带圈语义图标与配色):`info` / `success` / `warning` / `error`。
|
|
9
9
|
*
|
|
10
10
|
* 不传则无图标。**危险操作用 `error`** —— 它同时把确定按钮染成危险色
|
|
11
11
|
* (除非显式给了 `okDanger`),这样「删除确认」与「保存成功」不再长得一样。
|