@antdv-next/x 0.0.4 → 0.2.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/LICENSE +21 -0
- package/dist/_utils/vue.d.ts +2 -0
- package/dist/_utils/vue.js +16 -0
- package/dist/actions/Actions.js +4 -3
- package/dist/actions/ActionsAudio.js +1 -1
- package/dist/actions/ActionsCopy.js +5 -5
- package/dist/actions/ActionsFeedback.js +1 -1
- package/dist/actions/ActionsItem.js +1 -1
- package/dist/attachments/PlaceholderUploader.d.ts +16 -0
- package/dist/attachments/PlaceholderUploader.js +31 -5
- package/dist/attachments/index.d.ts +8 -1
- package/dist/attachments/index.js +8 -2
- package/dist/bubble/Bubble.js +6 -9
- package/dist/bubble/BubbleList.js +5 -5
- package/dist/bubble/Divider.js +2 -2
- package/dist/bubble/System.js +1 -1
- package/dist/code-highlighter/CodeHighlighter.js +3 -14
- package/dist/code-highlighter/shiki.d.ts +4 -0
- package/dist/code-highlighter/shiki.js +73 -0
- package/dist/conversations/Creation.js +1 -1
- package/dist/conversations/GroupTitle.d.ts +22 -2
- package/dist/conversations/GroupTitle.js +25 -3
- package/dist/conversations/Item.d.ts +1 -1
- package/dist/conversations/Item.js +1 -4
- package/dist/conversations/index.d.ts +10 -1
- package/dist/conversations/index.js +13 -1
- package/dist/conversations/interface.d.ts +7 -0
- package/dist/file-card/FileCard.js +2 -2
- package/dist/file-card/List.js +2 -2
- package/dist/file-card/components/File.d.ts +6 -6
- package/dist/file-card/components/File.js +2 -2
- package/dist/index.esm.js +287 -158
- package/dist/index.js +0 -25
- package/dist/index.umd.js +292 -162
- package/dist/mermaid/Mermaid.d.ts +6 -1
- package/dist/mermaid/Mermaid.js +27 -6
- package/dist/mermaid/index.d.ts +1 -1
- package/dist/mermaid/loader.d.ts +6 -0
- package/dist/mermaid/loader.js +33 -0
- package/dist/mermaid/mermaid-core.d.js +0 -0
- package/dist/package.js +1 -1
- package/dist/prompts/Prompts.js +7 -8
- package/dist/sender/Sender.js +1 -1
- package/dist/sender/SenderHeader.js +1 -1
- package/dist/sender/SenderSwitch.js +1 -1
- package/dist/sources/Sources.js +2 -5
- package/dist/sources/components/CarouselCard.js +1 -4
- package/dist/suggestion/Suggestion.js +2 -5
- package/dist/think/Think.js +1 -1
- package/dist/thought-chain/Item.js +4 -7
- package/dist/thought-chain/Node.js +1 -4
- package/dist/thought-chain/ThoughtChain.js +1 -1
- package/dist/welcome/index.js +1 -1
- package/dist/x-provider/index.js +1 -1
- package/global.d.ts +61 -18
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Antdv Next
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Comment, Fragment, isVNode } from "vue";
|
|
2
|
+
//#region components/_utils/vue.ts
|
|
3
|
+
function isEmptyNode(node) {
|
|
4
|
+
if (node === null || node === void 0 || typeof node === "boolean") return true;
|
|
5
|
+
if (Array.isArray(node)) return node.every(isEmptyNode);
|
|
6
|
+
if (isVNode(node)) {
|
|
7
|
+
if (node.type === Comment) return true;
|
|
8
|
+
if (node.type === Fragment && Array.isArray(node.children)) return node.children.every((child) => isEmptyNode(child));
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function hasRenderableNode(node) {
|
|
13
|
+
return !isEmptyNode(node);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { hasRenderableNode, isEmptyNode };
|
package/dist/actions/Actions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import useXComponentConfig from "../_utils/hooks/use-x-component-config.js";
|
|
2
|
+
import { isEmptyNode } from "../_utils/vue.js";
|
|
2
3
|
import Item from "./Item.js";
|
|
3
4
|
import style_default from "./style/index.js";
|
|
4
5
|
import { Transition, computed, createVNode, defineComponent, isVNode, mergeProps, ref, useAttrs, useSlots } from "vue";
|
|
@@ -20,7 +21,7 @@ function getMotionTransitionProps(motionName) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
var XActions = /* @__PURE__ */ defineComponent({
|
|
23
|
-
name: "
|
|
24
|
+
name: "AxActions",
|
|
24
25
|
inheritAttrs: false,
|
|
25
26
|
props: {
|
|
26
27
|
items: {
|
|
@@ -130,8 +131,8 @@ var XActions = /* @__PURE__ */ defineComponent({
|
|
|
130
131
|
});
|
|
131
132
|
const mergedItem = {
|
|
132
133
|
...item,
|
|
133
|
-
icon: slottedIcon
|
|
134
|
-
actionRender: slotActionNode !== void 0 ? slotActionNode : item.actionRender
|
|
134
|
+
icon: slottedIcon !== void 0 && !isEmptyNode(slottedIcon) ? slottedIcon : item.icon,
|
|
135
|
+
actionRender: slotActionNode !== void 0 && !isEmptyNode(slotActionNode) ? slotActionNode : item.actionRender
|
|
135
136
|
};
|
|
136
137
|
return createVNode(Item, {
|
|
137
138
|
"key": item.key ?? idx,
|
|
@@ -3,7 +3,7 @@ import { createVNode, defineComponent, mergeProps } from "vue";
|
|
|
3
3
|
import { MutedOutlined, SoundOutlined } from "@antdv-next/icons";
|
|
4
4
|
//#region components/actions/ActionsAudio.tsx
|
|
5
5
|
var XActionsAudio = /* @__PURE__ */ defineComponent({
|
|
6
|
-
name: "
|
|
6
|
+
name: "AxActionsAudio",
|
|
7
7
|
props: {
|
|
8
8
|
status: {
|
|
9
9
|
type: String,
|
|
@@ -7,7 +7,7 @@ var normalizeCopyIcons = (icon) => {
|
|
|
7
7
|
return [icon, icon];
|
|
8
8
|
};
|
|
9
9
|
var XActionsCopy = /* @__PURE__ */ defineComponent({
|
|
10
|
-
name: "
|
|
10
|
+
name: "AxActionsCopy",
|
|
11
11
|
inheritAttrs: false,
|
|
12
12
|
props: {
|
|
13
13
|
text: {
|
|
@@ -66,14 +66,14 @@ var XActionsCopy = /* @__PURE__ */ defineComponent({
|
|
|
66
66
|
const { class: _class, style: _style, ...rest } = attrs;
|
|
67
67
|
return rest;
|
|
68
68
|
});
|
|
69
|
-
const
|
|
69
|
+
const iconSlot = computed(() => slots.icon);
|
|
70
70
|
const mergedCopyIcons = computed(() => {
|
|
71
71
|
const [defaultOriginNode, copiedOriginNode] = normalizeCopyIcons(props.icon);
|
|
72
|
-
if (!
|
|
73
|
-
return [
|
|
72
|
+
if (!iconSlot.value) return props.icon;
|
|
73
|
+
return [iconSlot.value({
|
|
74
74
|
originNode: defaultOriginNode,
|
|
75
75
|
status: "default"
|
|
76
|
-
}),
|
|
76
|
+
}), iconSlot.value({
|
|
77
77
|
originNode: copiedOriginNode,
|
|
78
78
|
status: "copied"
|
|
79
79
|
})];
|
|
@@ -10,7 +10,7 @@ var FEEDBACK_VALUE = /* @__PURE__ */ function(FEEDBACK_VALUE) {
|
|
|
10
10
|
return FEEDBACK_VALUE;
|
|
11
11
|
}(FEEDBACK_VALUE || {});
|
|
12
12
|
var XActionsFeedback = /* @__PURE__ */ defineComponent({
|
|
13
|
-
name: "
|
|
13
|
+
name: "AxActionsFeedback",
|
|
14
14
|
inheritAttrs: false,
|
|
15
15
|
props: {
|
|
16
16
|
value: {
|
|
@@ -11,7 +11,7 @@ var ACTIONS_ITEM_STATUS = /* @__PURE__ */ function(ACTIONS_ITEM_STATUS) {
|
|
|
11
11
|
return ACTIONS_ITEM_STATUS;
|
|
12
12
|
}({});
|
|
13
13
|
var XActionsItem = /* @__PURE__ */ defineComponent({
|
|
14
|
-
name: "
|
|
14
|
+
name: "AxActionsItem",
|
|
15
15
|
inheritAttrs: false,
|
|
16
16
|
props: {
|
|
17
17
|
status: {
|
|
@@ -6,8 +6,16 @@ export interface PlaceholderConfig {
|
|
|
6
6
|
description?: VNodeChild;
|
|
7
7
|
}
|
|
8
8
|
export type PlaceholderType = PlaceholderConfig | VNodeChild;
|
|
9
|
+
export interface PlaceholderSlotInfo {
|
|
10
|
+
type: "inline" | "drop";
|
|
11
|
+
originNode?: VNodeChild;
|
|
12
|
+
}
|
|
13
|
+
export interface PlaceholderFieldSlotInfo extends PlaceholderSlotInfo {
|
|
14
|
+
originNode?: VNodeChild;
|
|
15
|
+
}
|
|
9
16
|
export interface PlaceholderProps {
|
|
10
17
|
prefixCls: string;
|
|
18
|
+
type: "inline" | "drop";
|
|
11
19
|
placeholder?: PlaceholderType;
|
|
12
20
|
upload?: UploadProps;
|
|
13
21
|
class?: ClassValue;
|
|
@@ -18,6 +26,10 @@ declare const PlaceholderUploader: import('vue').DefineComponent<import('vue').E
|
|
|
18
26
|
type: StringConstructor;
|
|
19
27
|
required: true;
|
|
20
28
|
};
|
|
29
|
+
type: {
|
|
30
|
+
type: PropType<PlaceholderProps["type"]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
21
33
|
placeholder: {
|
|
22
34
|
type: PropType<PlaceholderType>;
|
|
23
35
|
default: undefined;
|
|
@@ -39,6 +51,10 @@ declare const PlaceholderUploader: import('vue').DefineComponent<import('vue').E
|
|
|
39
51
|
type: StringConstructor;
|
|
40
52
|
required: true;
|
|
41
53
|
};
|
|
54
|
+
type: {
|
|
55
|
+
type: PropType<PlaceholderProps["type"]>;
|
|
56
|
+
required: true;
|
|
57
|
+
};
|
|
42
58
|
placeholder: {
|
|
43
59
|
type: PropType<PlaceholderType>;
|
|
44
60
|
default: undefined;
|
|
@@ -13,6 +13,10 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
13
13
|
type: String,
|
|
14
14
|
required: true
|
|
15
15
|
},
|
|
16
|
+
type: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
16
20
|
placeholder: {
|
|
17
21
|
type: [
|
|
18
22
|
String,
|
|
@@ -60,6 +64,28 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
60
64
|
if (!isConfig.value) return {};
|
|
61
65
|
return props.placeholder;
|
|
62
66
|
});
|
|
67
|
+
const renderConfigNode = () => {
|
|
68
|
+
const iconOriginNode = placeholderConfig.value.icon;
|
|
69
|
+
const titleOriginNode = placeholderConfig.value.title;
|
|
70
|
+
const descriptionOriginNode = placeholderConfig.value.description;
|
|
71
|
+
const iconNode = slots.placeholderIcon?.({
|
|
72
|
+
type: props.type,
|
|
73
|
+
originNode: iconOriginNode
|
|
74
|
+
}) ?? iconOriginNode;
|
|
75
|
+
const titleNode = slots.placeholderTitle?.({
|
|
76
|
+
type: props.type,
|
|
77
|
+
originNode: titleOriginNode
|
|
78
|
+
}) ?? titleOriginNode;
|
|
79
|
+
const descriptionNode = slots.placeholderDescription?.({
|
|
80
|
+
type: props.type,
|
|
81
|
+
originNode: descriptionOriginNode
|
|
82
|
+
}) ?? descriptionOriginNode;
|
|
83
|
+
return createVNode("div", { "class": `${placeholderCls.value}-inner` }, [
|
|
84
|
+
createVNode("span", { "class": `${placeholderCls.value}-icon` }, [iconNode]),
|
|
85
|
+
createVNode("span", { "class": `${placeholderCls.value}-title` }, [titleNode]),
|
|
86
|
+
createVNode("span", { "class": `${placeholderCls.value}-description` }, [descriptionNode])
|
|
87
|
+
]);
|
|
88
|
+
};
|
|
63
89
|
const onDragEnter = () => {
|
|
64
90
|
dragIn.value = true;
|
|
65
91
|
};
|
|
@@ -70,11 +96,11 @@ var PlaceholderUploader = /* @__PURE__ */ defineComponent({
|
|
|
70
96
|
dragIn.value = false;
|
|
71
97
|
};
|
|
72
98
|
return () => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
const originNode = isConfig.value ? renderConfigNode() : slots.default?.() || props.placeholder;
|
|
100
|
+
const node = slots.placeholder?.({
|
|
101
|
+
type: props.type,
|
|
102
|
+
originNode
|
|
103
|
+
}) ?? originNode;
|
|
78
104
|
return createVNode("div", {
|
|
79
105
|
"class": [
|
|
80
106
|
placeholderCls.value,
|
|
@@ -3,7 +3,7 @@ import { ClassValue, CSSProperties, DefineComponent, StyleValue, VNodeChild } fr
|
|
|
3
3
|
import { FileCardProps } from '../file-card';
|
|
4
4
|
import { SemanticType as FileCardSemanticType } from '../file-card/FileCard';
|
|
5
5
|
import { SemanticType as FileCardListSemanticType } from '../file-card/List';
|
|
6
|
-
import { PlaceholderType } from './PlaceholderUploader';
|
|
6
|
+
import { PlaceholderFieldSlotInfo, PlaceholderSlotInfo, PlaceholderType } from './PlaceholderUploader';
|
|
7
7
|
export type SemanticType = "root" | "list" | "placeholder" | "upload";
|
|
8
8
|
export interface Attachment<T = any> extends UploadFile<T>, Omit<FileCardProps, "size" | "byte" | "type"> {
|
|
9
9
|
description?: VNodeChild;
|
|
@@ -38,6 +38,12 @@ export interface AttachmentsProps<T = any> {
|
|
|
38
38
|
withCredentials?: boolean;
|
|
39
39
|
openFileDialogOnClick?: boolean;
|
|
40
40
|
}
|
|
41
|
+
export interface AttachmentsSlots {
|
|
42
|
+
placeholder?: (info: PlaceholderSlotInfo) => VNodeChild;
|
|
43
|
+
placeholderIcon?: (info: PlaceholderFieldSlotInfo) => VNodeChild;
|
|
44
|
+
placeholderTitle?: (info: PlaceholderFieldSlotInfo) => VNodeChild;
|
|
45
|
+
placeholderDescription?: (info: PlaceholderFieldSlotInfo) => VNodeChild;
|
|
46
|
+
}
|
|
41
47
|
export interface AttachmentsRef {
|
|
42
48
|
nativeElement?: HTMLDivElement | null;
|
|
43
49
|
fileNativeElement?: HTMLInputElement | null;
|
|
@@ -49,3 +55,4 @@ export interface AttachmentsRef {
|
|
|
49
55
|
}
|
|
50
56
|
declare const _default: DefineComponent<AttachmentsProps>;
|
|
51
57
|
export default _default;
|
|
58
|
+
export type { PlaceholderConfig, PlaceholderFieldSlotInfo, PlaceholderSlotInfo, PlaceholderType, } from './PlaceholderUploader';
|
|
@@ -12,7 +12,7 @@ function _isSlot(s) {
|
|
|
12
12
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
13
|
}
|
|
14
14
|
var XAttachments = /* @__PURE__ */ defineComponent({
|
|
15
|
-
name: "
|
|
15
|
+
name: "AxAttachments",
|
|
16
16
|
inheritAttrs: false,
|
|
17
17
|
props: {
|
|
18
18
|
prefixCls: {
|
|
@@ -211,12 +211,18 @@ var XAttachments = /* @__PURE__ */ defineComponent({
|
|
|
211
211
|
const getPlaceholderNode = (type, options) => {
|
|
212
212
|
const placeholderContent = typeof props.placeholder === "function" ? props.placeholder(type) : props.placeholder;
|
|
213
213
|
return createVNode(PlaceholderUploader, {
|
|
214
|
+
"type": type,
|
|
214
215
|
"placeholder": placeholderContent,
|
|
215
216
|
"upload": uploadProps.value,
|
|
216
217
|
"prefixCls": props.prefixCls,
|
|
217
218
|
"class": mergedClasses.value.placeholder,
|
|
218
219
|
"style": [mergedStyles.value.placeholder, options?.style]
|
|
219
|
-
},
|
|
220
|
+
}, {
|
|
221
|
+
placeholder: slots.placeholder,
|
|
222
|
+
placeholderIcon: slots.placeholderIcon,
|
|
223
|
+
placeholderTitle: slots.placeholderTitle,
|
|
224
|
+
placeholderDescription: slots.placeholderDescription
|
|
225
|
+
});
|
|
220
226
|
};
|
|
221
227
|
const renderWithChildren = () => {
|
|
222
228
|
let _slot;
|
package/dist/bubble/Bubble.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import useXComponentConfig from "../_utils/hooks/use-x-component-config.js";
|
|
2
|
+
import { hasRenderableNode } from "../_utils/vue.js";
|
|
2
3
|
import { EditableContent } from "./EditableContent.js";
|
|
3
4
|
import loading_default from "./loading.js";
|
|
4
5
|
import style_default from "./style/index.js";
|
|
@@ -9,12 +10,8 @@ function renderBubbleSlot(slot, content, info) {
|
|
|
9
10
|
if (!slot) return null;
|
|
10
11
|
return typeof slot === "function" ? slot(content, info) : slot;
|
|
11
12
|
}
|
|
12
|
-
function hasRenderableNode(node) {
|
|
13
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
14
|
-
return node !== null && node !== void 0 && node !== false;
|
|
15
|
-
}
|
|
16
13
|
var XBubble = /* @__PURE__ */ defineComponent({
|
|
17
|
-
name: "
|
|
14
|
+
name: "AxBubble",
|
|
18
15
|
inheritAttrs: false,
|
|
19
16
|
props: {
|
|
20
17
|
prefixCls: {
|
|
@@ -176,8 +173,8 @@ var XBubble = /* @__PURE__ */ defineComponent({
|
|
|
176
173
|
return rest;
|
|
177
174
|
});
|
|
178
175
|
const memoedContent = computed(() => {
|
|
179
|
-
if (slots.
|
|
180
|
-
const slotNode = slots.
|
|
176
|
+
if (slots.content) {
|
|
177
|
+
const slotNode = slots.content({
|
|
181
178
|
content: props.content,
|
|
182
179
|
info: props.info
|
|
183
180
|
});
|
|
@@ -272,8 +269,8 @@ var XBubble = /* @__PURE__ */ defineComponent({
|
|
|
272
269
|
};
|
|
273
270
|
const renderContent = () => {
|
|
274
271
|
if (props.loading) {
|
|
275
|
-
if (slots.
|
|
276
|
-
const slotNode = slots.
|
|
272
|
+
if (slots.loading) {
|
|
273
|
+
const slotNode = slots.loading({
|
|
277
274
|
content: props.content,
|
|
278
275
|
info: props.info
|
|
279
276
|
});
|
|
@@ -22,7 +22,7 @@ var bubbleSlotNames = [
|
|
|
22
22
|
"extra"
|
|
23
23
|
];
|
|
24
24
|
var XBubbleList = /* @__PURE__ */ defineComponent({
|
|
25
|
-
name: "
|
|
25
|
+
name: "AxBubbleList",
|
|
26
26
|
inheritAttrs: false,
|
|
27
27
|
props: {
|
|
28
28
|
prefixCls: {
|
|
@@ -240,10 +240,10 @@ var XBubbleList = /* @__PURE__ */ defineComponent({
|
|
|
240
240
|
role
|
|
241
241
|
});
|
|
242
242
|
};
|
|
243
|
-
if (slots.contentRender) bubbleSlots.
|
|
244
|
-
else if (contentRender) bubbleSlots.
|
|
245
|
-
if (slots.loadingRender) bubbleSlots.
|
|
246
|
-
else if (loadingRender) bubbleSlots.
|
|
243
|
+
if (slots.contentRender) bubbleSlots.content = bindListSlot("contentRender");
|
|
244
|
+
else if (contentRender) bubbleSlots.content = ({ content, info: bubbleInfo }) => contentRender(content, bubbleInfo);
|
|
245
|
+
if (slots.loadingRender) bubbleSlots.loading = bindListSlot("loadingRender");
|
|
246
|
+
else if (loadingRender) bubbleSlots.loading = ({ content, info: bubbleInfo }) => loadingRender(content, bubbleInfo);
|
|
247
247
|
for (const name of bubbleSlotNames) {
|
|
248
248
|
if (name === "contentRender" || name === "loadingRender") continue;
|
|
249
249
|
const slot = bindListSlot(name);
|
package/dist/bubble/Divider.js
CHANGED
|
@@ -6,7 +6,7 @@ function _isSlot(s) {
|
|
|
6
6
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
7
7
|
}
|
|
8
8
|
var XBubbleDivider = /* @__PURE__ */ defineComponent({
|
|
9
|
-
name: "
|
|
9
|
+
name: "AxBubbleDivider",
|
|
10
10
|
props: {
|
|
11
11
|
prefixCls: {
|
|
12
12
|
type: String,
|
|
@@ -68,7 +68,7 @@ var XBubbleDivider = /* @__PURE__ */ defineComponent({
|
|
|
68
68
|
"class": [`${props.prefixCls}-divider`, props.class],
|
|
69
69
|
"styles": props.styles,
|
|
70
70
|
"classes": props.classes
|
|
71
|
-
}), {
|
|
71
|
+
}), { content: ({ content }) => createVNode(Divider, props.dividerProps, _isSlot(content) ? content : { default: () => [content] }) });
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
//#endregion
|
package/dist/bubble/System.js
CHANGED
|
@@ -2,7 +2,7 @@ import { XBubble } from "./Bubble.js";
|
|
|
2
2
|
import { createVNode, defineComponent, mergeProps, ref } from "vue";
|
|
3
3
|
//#region components/bubble/System.tsx
|
|
4
4
|
var XBubbleSystem = /* @__PURE__ */ defineComponent({
|
|
5
|
-
name: "
|
|
5
|
+
name: "AxBubbleSystem",
|
|
6
6
|
props: {
|
|
7
7
|
prefixCls: {
|
|
8
8
|
type: String,
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
+
import { codeToHtml } from "./shiki.js";
|
|
1
2
|
import style_default from "./style/index.js";
|
|
2
3
|
import { computed, createVNode, defineComponent, mergeProps, ref, shallowRef, useAttrs, watch } from "vue";
|
|
3
4
|
import { Button, Tooltip } from "antdv-next";
|
|
4
5
|
import { CheckOutlined, CopyOutlined, MoonOutlined, SunOutlined } from "@antdv-next/icons";
|
|
5
6
|
//#region components/code-highlighter/CodeHighlighter.tsx
|
|
6
|
-
var shikiHighlighter = null;
|
|
7
|
-
var shikiPromise = null;
|
|
8
|
-
async function initShiki() {
|
|
9
|
-
if (shikiHighlighter) return;
|
|
10
|
-
if (shikiPromise) return shikiPromise;
|
|
11
|
-
shikiPromise = (async () => {
|
|
12
|
-
shikiHighlighter = (await import("shiki")).codeToHtml;
|
|
13
|
-
})();
|
|
14
|
-
return shikiPromise;
|
|
15
|
-
}
|
|
16
7
|
var XCodeHighlighter = /* @__PURE__ */ defineComponent({
|
|
17
|
-
name: "
|
|
8
|
+
name: "AxCodeHighlighter",
|
|
18
9
|
inheritAttrs: false,
|
|
19
10
|
props: {
|
|
20
11
|
prefixCls: {
|
|
@@ -95,9 +86,7 @@ var XCodeHighlighter = /* @__PURE__ */ defineComponent({
|
|
|
95
86
|
const highlightedHtml = shallowRef("");
|
|
96
87
|
const highlightCode = async () => {
|
|
97
88
|
try {
|
|
98
|
-
await
|
|
99
|
-
if (!shikiHighlighter) return;
|
|
100
|
-
highlightedHtml.value = await shikiHighlighter(props.content, {
|
|
89
|
+
highlightedHtml.value = await codeToHtml(props.content, {
|
|
101
90
|
lang: props.language,
|
|
102
91
|
theme: props.theme === "dark" ? "vitesse-dark" : "vitesse-light"
|
|
103
92
|
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createHighlighterCore } from "shiki/core";
|
|
2
|
+
import darkTheme from "shiki/dist/themes/vitesse-dark.mjs";
|
|
3
|
+
import lightTheme from "shiki/dist/themes/vitesse-light.mjs";
|
|
4
|
+
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
5
|
+
//#region components/code-highlighter/shiki.ts
|
|
6
|
+
var SUPPORTED_LANG_ALIASES = {
|
|
7
|
+
ts: "typescript",
|
|
8
|
+
js: "javascript",
|
|
9
|
+
py: "python",
|
|
10
|
+
md: "markdown",
|
|
11
|
+
yml: "yaml",
|
|
12
|
+
shell: "bash",
|
|
13
|
+
zsh: "bash",
|
|
14
|
+
sh: "bash",
|
|
15
|
+
vue: "vue"
|
|
16
|
+
};
|
|
17
|
+
var LANG_LOADERS = {
|
|
18
|
+
javascript: () => import("shiki/dist/langs/javascript.mjs"),
|
|
19
|
+
typescript: () => import("shiki/dist/langs/typescript.mjs"),
|
|
20
|
+
jsx: () => import("shiki/dist/langs/jsx.mjs"),
|
|
21
|
+
tsx: () => import("shiki/dist/langs/tsx.mjs"),
|
|
22
|
+
json: () => import("shiki/dist/langs/json.mjs"),
|
|
23
|
+
bash: () => import("shiki/dist/langs/bash.mjs"),
|
|
24
|
+
markdown: () => import("shiki/dist/langs/markdown.mjs"),
|
|
25
|
+
html: () => import("shiki/dist/langs/html.mjs"),
|
|
26
|
+
css: () => import("shiki/dist/langs/css.mjs"),
|
|
27
|
+
vue: () => import("shiki/dist/langs/vue.mjs"),
|
|
28
|
+
"vue-html": () => import("shiki/dist/langs/vue-html.mjs"),
|
|
29
|
+
python: () => import("shiki/dist/langs/python.mjs"),
|
|
30
|
+
mermaid: () => import("shiki/dist/langs/mermaid.mjs"),
|
|
31
|
+
yaml: () => import("shiki/dist/langs/yaml.mjs"),
|
|
32
|
+
diff: () => import("shiki/dist/langs/diff.mjs")
|
|
33
|
+
};
|
|
34
|
+
var highlighter = null;
|
|
35
|
+
var highlighterPromise = null;
|
|
36
|
+
var loadedLangs = /* @__PURE__ */ new Set();
|
|
37
|
+
function normalizeLanguage(language) {
|
|
38
|
+
const input = (language || "text").toLowerCase();
|
|
39
|
+
return SUPPORTED_LANG_ALIASES[input] || input;
|
|
40
|
+
}
|
|
41
|
+
function escapeHtml(str) {
|
|
42
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
43
|
+
}
|
|
44
|
+
async function getHighlighter() {
|
|
45
|
+
if (highlighter) return highlighter;
|
|
46
|
+
if (!highlighterPromise) highlighterPromise = createHighlighterCore({
|
|
47
|
+
themes: [lightTheme, darkTheme],
|
|
48
|
+
langs: [],
|
|
49
|
+
engine: createJavaScriptRegexEngine()
|
|
50
|
+
});
|
|
51
|
+
highlighter = await highlighterPromise;
|
|
52
|
+
return highlighter;
|
|
53
|
+
}
|
|
54
|
+
async function loadLang(lang) {
|
|
55
|
+
const loader = LANG_LOADERS[lang];
|
|
56
|
+
if (!loader) return false;
|
|
57
|
+
if (loadedLangs.has(lang)) return true;
|
|
58
|
+
const instance = await getHighlighter();
|
|
59
|
+
const mod = await loader();
|
|
60
|
+
await instance.loadLanguage(mod.default);
|
|
61
|
+
loadedLangs.add(lang);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
async function codeToHtml(code, options = {}) {
|
|
65
|
+
const lang = normalizeLanguage(options.lang);
|
|
66
|
+
if (!await loadLang(lang)) return `<pre><code>${escapeHtml(code)}</code></pre>`;
|
|
67
|
+
return (await getHighlighter()).codeToHtml(code, {
|
|
68
|
+
lang,
|
|
69
|
+
theme: options.theme || "vitesse-light"
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { codeToHtml };
|
|
@@ -2,7 +2,7 @@ import useCreation from "./hooks/useCreation.js";
|
|
|
2
2
|
import { computed, createVNode, defineComponent } from "vue";
|
|
3
3
|
//#region components/conversations/Creation.tsx
|
|
4
4
|
var Creation = /* @__PURE__ */ defineComponent({
|
|
5
|
-
name: "
|
|
5
|
+
name: "AxConversationsCreation",
|
|
6
6
|
props: {
|
|
7
7
|
label: {
|
|
8
8
|
type: [
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { PropType, TransitionProps } from 'vue';
|
|
2
|
-
import { GroupInfoType } from './interface';
|
|
1
|
+
import { PropType, TransitionProps, VNodeChild } from 'vue';
|
|
2
|
+
import { GroupInfoType, GroupLabelRenderInfo, GroupLabelRender } from './interface';
|
|
3
3
|
export interface GroupTitleProps {
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
groupInfo: GroupInfoType;
|
|
6
|
+
groupLabelRender?: GroupLabelRender;
|
|
7
|
+
groupLabelRenderSlot?: (info: GroupLabelRenderInfo) => VNodeChild;
|
|
6
8
|
classes?: any;
|
|
7
9
|
enableCollapse?: boolean;
|
|
8
10
|
expandedKeys?: string[];
|
|
@@ -18,6 +20,14 @@ declare const GroupTitle: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
18
20
|
type: PropType<GroupInfoType>;
|
|
19
21
|
required: true;
|
|
20
22
|
};
|
|
23
|
+
groupLabelRender: {
|
|
24
|
+
type: PropType<GroupTitleProps["groupLabelRender"]>;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
groupLabelRenderSlot: {
|
|
28
|
+
type: PropType<GroupTitleProps["groupLabelRenderSlot"]>;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
21
31
|
classes: {
|
|
22
32
|
type: PropType<GroupTitleProps["classes"]>;
|
|
23
33
|
default: undefined;
|
|
@@ -47,6 +57,14 @@ declare const GroupTitle: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
47
57
|
type: PropType<GroupInfoType>;
|
|
48
58
|
required: true;
|
|
49
59
|
};
|
|
60
|
+
groupLabelRender: {
|
|
61
|
+
type: PropType<GroupTitleProps["groupLabelRender"]>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
groupLabelRenderSlot: {
|
|
65
|
+
type: PropType<GroupTitleProps["groupLabelRenderSlot"]>;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
50
68
|
classes: {
|
|
51
69
|
type: PropType<GroupTitleProps["classes"]>;
|
|
52
70
|
default: undefined;
|
|
@@ -71,6 +89,8 @@ declare const GroupTitle: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
71
89
|
prefixCls: string;
|
|
72
90
|
classes: any;
|
|
73
91
|
expandedKeys: string[];
|
|
92
|
+
groupLabelRender: GroupLabelRender;
|
|
93
|
+
groupLabelRenderSlot: ((info: GroupLabelRenderInfo) => VNodeChild) | undefined;
|
|
74
94
|
onItemExpand: ((curKey: string) => void) | undefined;
|
|
75
95
|
enableCollapse: boolean;
|
|
76
96
|
collapseTransition: TransitionProps;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasRenderableNode } from "../_utils/vue.js";
|
|
1
2
|
import { Transition, computed, createVNode, defineComponent } from "vue";
|
|
2
3
|
import { RightOutlined } from "@antdv-next/icons";
|
|
3
4
|
//#region components/conversations/GroupTitle.tsx
|
|
@@ -12,6 +13,20 @@ var GroupTitle = /* @__PURE__ */ defineComponent({
|
|
|
12
13
|
type: Object,
|
|
13
14
|
required: true
|
|
14
15
|
},
|
|
16
|
+
groupLabelRender: {
|
|
17
|
+
type: [
|
|
18
|
+
String,
|
|
19
|
+
Number,
|
|
20
|
+
Object,
|
|
21
|
+
Array,
|
|
22
|
+
Function
|
|
23
|
+
],
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
groupLabelRenderSlot: {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: void 0
|
|
29
|
+
},
|
|
15
30
|
classes: {
|
|
16
31
|
type: [
|
|
17
32
|
String,
|
|
@@ -47,15 +62,22 @@ var GroupTitle = /* @__PURE__ */ defineComponent({
|
|
|
47
62
|
});
|
|
48
63
|
const labelNode = computed(() => {
|
|
49
64
|
const { label, name } = props.groupInfo;
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
const originNode = typeof label === "function" ? label(name, { groupInfo: props.groupInfo }) : label || name;
|
|
66
|
+
const renderInfo = {
|
|
67
|
+
group: name,
|
|
68
|
+
groupInfo: props.groupInfo,
|
|
69
|
+
originNode
|
|
70
|
+
};
|
|
71
|
+
if (props.groupLabelRenderSlot) return props.groupLabelRenderSlot(renderInfo);
|
|
72
|
+
if (props.groupLabelRender !== void 0) return typeof props.groupLabelRender === "function" ? props.groupLabelRender(name, renderInfo) : props.groupLabelRender;
|
|
73
|
+
return originNode;
|
|
52
74
|
});
|
|
53
75
|
return () => createVNode("li", { "class": props.classes }, [createVNode("div", {
|
|
54
76
|
"class": [`${props.prefixCls}-group-title`, { [`${props.prefixCls}-group-title-collapsible`]: mergeCollapsible.value }],
|
|
55
77
|
"onClick": () => {
|
|
56
78
|
if (mergeCollapsible.value) props.onItemExpand?.(props.groupInfo.name);
|
|
57
79
|
}
|
|
58
|
-
}, [labelNode.value && createVNode("div", { "class": `${props.prefixCls}-group-label` }, [labelNode.value]), mergeCollapsible.value && createVNode("div", { "class": [`${props.prefixCls}-group-collapse-trigger`, `${props.prefixCls}-group-collapse-trigger-${groupOpen.value ? "open" : "close"}`] }, [createVNode(RightOutlined, null, null)])]), createVNode(Transition, props.collapseTransition ?? {}, { default: () => [mergeCollapsible.value ? groupOpen.value ? createVNode("div", null, [slots.default?.()]) : null : createVNode("div", null, [slots.default?.()])] })]);
|
|
80
|
+
}, [hasRenderableNode(labelNode.value) && createVNode("div", { "class": `${props.prefixCls}-group-label` }, [labelNode.value]), mergeCollapsible.value && createVNode("div", { "class": [`${props.prefixCls}-group-collapse-trigger`, `${props.prefixCls}-group-collapse-trigger-${groupOpen.value ? "open" : "close"}`] }, [createVNode(RightOutlined, null, null)])]), createVNode(Transition, props.collapseTransition ?? {}, { default: () => [mergeCollapsible.value ? groupOpen.value ? createVNode("div", null, [slots.default?.()]) : null : createVNode("div", null, [slots.default?.()])] })]);
|
|
59
81
|
}
|
|
60
82
|
});
|
|
61
83
|
//#endregion
|
|
@@ -132,8 +132,8 @@ declare const ConversationsItem: import('vue').DefineComponent<import('vue').Ext
|
|
|
132
132
|
onClick: ((value: ConversationItemType["key"], item?: import('./interface').ItemType) => void) | undefined;
|
|
133
133
|
labelRender: import('./interface').ConversationItemRender;
|
|
134
134
|
iconRender: import('./interface').ConversationItemRender;
|
|
135
|
-
iconRenderSlot: ((info: ConversationItemRenderInfo) => VNodeChild) | undefined;
|
|
136
135
|
index: number;
|
|
137
136
|
labelRenderSlot: ((info: ConversationItemRenderInfo) => VNodeChild) | undefined;
|
|
137
|
+
iconRenderSlot: ((info: ConversationItemRenderInfo) => VNodeChild) | undefined;
|
|
138
138
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
139
139
|
export default ConversationsItem;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasRenderableNode } from "../_utils/vue.js";
|
|
1
2
|
import { computed, createVNode, defineComponent, isVNode } from "vue";
|
|
2
3
|
import { Dropdown, Typography } from "antdv-next";
|
|
3
4
|
import { EllipsisOutlined } from "@antdv-next/icons";
|
|
@@ -8,10 +9,6 @@ function _isSlot(s) {
|
|
|
8
9
|
var stopPropagation = (event) => {
|
|
9
10
|
event.stopPropagation();
|
|
10
11
|
};
|
|
11
|
-
var hasRenderableNode = (node) => {
|
|
12
|
-
if (Array.isArray(node)) return node.some((item) => item !== null && item !== void 0 && item !== false);
|
|
13
|
-
return node !== null && node !== void 0 && node !== false;
|
|
14
|
-
};
|
|
15
12
|
var renderWithPriority = (render, slotRender, info) => {
|
|
16
13
|
if (slotRender) return slotRender(info);
|
|
17
14
|
if (render !== void 0) return typeof render === "function" ? render(info.item, info) : render;
|