@antdv-next/x 0.0.4 → 0.1.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/dist/actions/Actions.js +1 -1
- package/dist/actions/ActionsAudio.js +1 -1
- package/dist/actions/ActionsCopy.js +1 -1
- package/dist/actions/ActionsFeedback.js +1 -1
- package/dist/actions/ActionsItem.js +1 -1
- package/dist/attachments/index.js +1 -1
- package/dist/bubble/Bubble.js +1 -1
- package/dist/bubble/BubbleList.js +1 -1
- package/dist/bubble/Divider.js +1 -1
- 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 +72 -0
- package/dist/conversations/Creation.js +1 -1
- package/dist/conversations/index.js +1 -1
- package/dist/file-card/FileCard.js +1 -1
- package/dist/file-card/List.js +1 -1
- package/dist/index.esm.js +140 -75
- package/dist/index.js +0 -25
- package/dist/index.umd.js +146 -80
- package/dist/mermaid/Mermaid.d.ts +1 -1
- package/dist/mermaid/Mermaid.js +5 -5
- 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 +6 -4
- 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 +1 -1
- package/dist/suggestion/Suggestion.js +1 -1
- package/dist/think/Think.js +1 -1
- package/dist/thought-chain/Item.js +1 -1
- 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 +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("antdv-next/dist/config-provider/context"), require("antdv-next"), require("@antdv-next/icons"), require("@antdv-next/cssinjs"), require("@antdv-next/cssinjs/cssinjs-utils"), require("@ant-design/fast-color"), require("antdv-next/dist/theme/useToken"), require("@vueuse/core"), require("
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("antdv-next/dist/config-provider/context"), require("antdv-next"), require("@antdv-next/icons"), require("@antdv-next/cssinjs"), require("@antdv-next/cssinjs/cssinjs-utils"), require("@ant-design/fast-color"), require("antdv-next/dist/theme/useToken"), require("@vueuse/core"), require("shiki/core"), require("shiki/dist/themes/vitesse-dark.mjs"), require("shiki/dist/themes/vitesse-light.mjs"), require("shiki/engine/javascript"), require("@v-c/util")) : typeof define === "function" && define.amd ? define([
|
|
3
3
|
"exports",
|
|
4
4
|
"vue",
|
|
5
5
|
"antdv-next/dist/config-provider/context",
|
|
@@ -10,10 +10,13 @@
|
|
|
10
10
|
"@ant-design/fast-color",
|
|
11
11
|
"antdv-next/dist/theme/useToken",
|
|
12
12
|
"@vueuse/core",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
"shiki/core",
|
|
14
|
+
"shiki/dist/themes/vitesse-dark.mjs",
|
|
15
|
+
"shiki/dist/themes/vitesse-light.mjs",
|
|
16
|
+
"shiki/engine/javascript",
|
|
17
|
+
"@v-c/util"
|
|
18
|
+
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.AntdComponents = {}, global.Vue, global.antdv_next_dist_config_provider_context, global.antd, global.AntdIcons, global._antdv_next_cssinjs, global._antdv_next_cssinjs_cssinjs_utils, global._ant_design_fast_color, global.antdv_next_dist_theme_useToken, global._vueuse_core, global.shiki_core, global.shiki_dist_themes_vitesse_dark_mjs, global.shiki_dist_themes_vitesse_light_mjs, global.shiki_engine_javascript, global._v_c_util));
|
|
19
|
+
})(this, function(exports, vue, antdv_next_dist_config_provider_context, antdv_next, _antdv_next_icons, _antdv_next_cssinjs, _antdv_next_cssinjs_cssinjs_utils, _ant_design_fast_color, antdv_next_dist_theme_useToken, _vueuse_core, shiki_core, shiki_dist_themes_vitesse_dark_mjs, shiki_dist_themes_vitesse_light_mjs, shiki_engine_javascript, _v_c_util) {
|
|
17
20
|
Object.defineProperties(exports, {
|
|
18
21
|
__esModule: { value: true },
|
|
19
22
|
[Symbol.toStringTag]: { value: "Module" }
|
|
@@ -42,9 +45,10 @@
|
|
|
42
45
|
//#endregion
|
|
43
46
|
_antdv_next_icons = __toESM(_antdv_next_icons);
|
|
44
47
|
antdv_next_dist_theme_useToken = __toESM(antdv_next_dist_theme_useToken);
|
|
45
|
-
|
|
48
|
+
shiki_dist_themes_vitesse_dark_mjs = __toESM(shiki_dist_themes_vitesse_dark_mjs);
|
|
49
|
+
shiki_dist_themes_vitesse_light_mjs = __toESM(shiki_dist_themes_vitesse_light_mjs);
|
|
46
50
|
//#region package.json
|
|
47
|
-
var version = "0.0
|
|
51
|
+
var version = "0.1.0";
|
|
48
52
|
//#endregion
|
|
49
53
|
//#region components/x-provider/context.ts
|
|
50
54
|
var XProviderContextKey = Symbol("antdv-next-x-provider-context");
|
|
@@ -539,7 +543,7 @@
|
|
|
539
543
|
};
|
|
540
544
|
}
|
|
541
545
|
var XActions = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
542
|
-
name: "
|
|
546
|
+
name: "AxActions",
|
|
543
547
|
inheritAttrs: false,
|
|
544
548
|
props: {
|
|
545
549
|
items: {
|
|
@@ -697,7 +701,7 @@
|
|
|
697
701
|
return ACTIONS_ITEM_STATUS;
|
|
698
702
|
}({});
|
|
699
703
|
var XActionsItem = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
700
|
-
name: "
|
|
704
|
+
name: "AxActionsItem",
|
|
701
705
|
inheritAttrs: false,
|
|
702
706
|
props: {
|
|
703
707
|
status: {
|
|
@@ -807,7 +811,7 @@
|
|
|
807
811
|
//#endregion
|
|
808
812
|
//#region components/actions/ActionsAudio.tsx
|
|
809
813
|
var XActionsAudio = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
810
|
-
name: "
|
|
814
|
+
name: "AxActionsAudio",
|
|
811
815
|
props: {
|
|
812
816
|
status: {
|
|
813
817
|
type: String,
|
|
@@ -881,7 +885,7 @@
|
|
|
881
885
|
return [icon, icon];
|
|
882
886
|
};
|
|
883
887
|
var XActionsCopy = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
884
|
-
name: "
|
|
888
|
+
name: "AxActionsCopy",
|
|
885
889
|
inheritAttrs: false,
|
|
886
890
|
props: {
|
|
887
891
|
text: {
|
|
@@ -986,7 +990,7 @@
|
|
|
986
990
|
return FEEDBACK_VALUE;
|
|
987
991
|
}(FEEDBACK_VALUE || {});
|
|
988
992
|
var XActionsFeedback = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
989
|
-
name: "
|
|
993
|
+
name: "AxActionsFeedback",
|
|
990
994
|
inheritAttrs: false,
|
|
991
995
|
props: {
|
|
992
996
|
value: {
|
|
@@ -1964,7 +1968,7 @@
|
|
|
1964
1968
|
key: "default"
|
|
1965
1969
|
};
|
|
1966
1970
|
var XFileCard = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
1967
|
-
name: "
|
|
1971
|
+
name: "AxFileCard",
|
|
1968
1972
|
inheritAttrs: false,
|
|
1969
1973
|
props: {
|
|
1970
1974
|
prefixCls: {
|
|
@@ -2203,7 +2207,7 @@
|
|
|
2203
2207
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
2204
2208
|
}
|
|
2205
2209
|
var XFileCardList = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2206
|
-
name: "
|
|
2210
|
+
name: "AxFileCardList",
|
|
2207
2211
|
props: {
|
|
2208
2212
|
prefixCls: {
|
|
2209
2213
|
type: String,
|
|
@@ -2910,7 +2914,7 @@
|
|
|
2910
2914
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
2911
2915
|
}
|
|
2912
2916
|
var XAttachments = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2913
|
-
name: "
|
|
2917
|
+
name: "AxAttachments",
|
|
2914
2918
|
inheritAttrs: false,
|
|
2915
2919
|
props: {
|
|
2916
2920
|
prefixCls: {
|
|
@@ -3854,7 +3858,7 @@
|
|
|
3854
3858
|
return node !== null && node !== void 0 && node !== false;
|
|
3855
3859
|
}
|
|
3856
3860
|
var XBubble = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
3857
|
-
name: "
|
|
3861
|
+
name: "AxBubble",
|
|
3858
3862
|
inheritAttrs: false,
|
|
3859
3863
|
props: {
|
|
3860
3864
|
prefixCls: {
|
|
@@ -4195,7 +4199,7 @@
|
|
|
4195
4199
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
4196
4200
|
}
|
|
4197
4201
|
var XBubbleDivider = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4198
|
-
name: "
|
|
4202
|
+
name: "AxBubbleDivider",
|
|
4199
4203
|
props: {
|
|
4200
4204
|
prefixCls: {
|
|
4201
4205
|
type: String,
|
|
@@ -4385,7 +4389,7 @@
|
|
|
4385
4389
|
//#endregion
|
|
4386
4390
|
//#region components/bubble/System.tsx
|
|
4387
4391
|
var XBubbleSystem = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4388
|
-
name: "
|
|
4392
|
+
name: "AxBubbleSystem",
|
|
4389
4393
|
props: {
|
|
4390
4394
|
prefixCls: {
|
|
4391
4395
|
type: String,
|
|
@@ -4474,7 +4478,7 @@
|
|
|
4474
4478
|
"extra"
|
|
4475
4479
|
];
|
|
4476
4480
|
var XBubbleList = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4477
|
-
name: "
|
|
4481
|
+
name: "AxBubbleList",
|
|
4478
4482
|
inheritAttrs: false,
|
|
4479
4483
|
props: {
|
|
4480
4484
|
prefixCls: {
|
|
@@ -4712,6 +4716,73 @@
|
|
|
4712
4716
|
BubbleWithSub.System = XBubbleSystem;
|
|
4713
4717
|
BubbleWithSub.Divider = XBubbleDivider;
|
|
4714
4718
|
//#endregion
|
|
4719
|
+
//#region components/code-highlighter/shiki.ts
|
|
4720
|
+
var SUPPORTED_LANG_ALIASES = {
|
|
4721
|
+
ts: "typescript",
|
|
4722
|
+
js: "javascript",
|
|
4723
|
+
py: "python",
|
|
4724
|
+
md: "markdown",
|
|
4725
|
+
yml: "yaml",
|
|
4726
|
+
shell: "bash",
|
|
4727
|
+
zsh: "bash",
|
|
4728
|
+
sh: "bash",
|
|
4729
|
+
vue: "vue"
|
|
4730
|
+
};
|
|
4731
|
+
var LANG_LOADERS = {
|
|
4732
|
+
javascript: () => import("shiki/dist/langs/javascript.mjs"),
|
|
4733
|
+
typescript: () => import("shiki/dist/langs/typescript.mjs"),
|
|
4734
|
+
jsx: () => import("shiki/dist/langs/jsx.mjs"),
|
|
4735
|
+
tsx: () => import("shiki/dist/langs/tsx.mjs"),
|
|
4736
|
+
json: () => import("shiki/dist/langs/json.mjs"),
|
|
4737
|
+
bash: () => import("shiki/dist/langs/bash.mjs"),
|
|
4738
|
+
markdown: () => import("shiki/dist/langs/markdown.mjs"),
|
|
4739
|
+
html: () => import("shiki/dist/langs/html.mjs"),
|
|
4740
|
+
css: () => import("shiki/dist/langs/css.mjs"),
|
|
4741
|
+
vue: () => import("shiki/dist/langs/vue.mjs"),
|
|
4742
|
+
"vue-html": () => import("shiki/dist/langs/vue-html.mjs"),
|
|
4743
|
+
python: () => import("shiki/dist/langs/python.mjs"),
|
|
4744
|
+
mermaid: () => import("shiki/dist/langs/mermaid.mjs"),
|
|
4745
|
+
yaml: () => import("shiki/dist/langs/yaml.mjs"),
|
|
4746
|
+
diff: () => import("shiki/dist/langs/diff.mjs")
|
|
4747
|
+
};
|
|
4748
|
+
var highlighter = null;
|
|
4749
|
+
var highlighterPromise = null;
|
|
4750
|
+
var loadedLangs = /* @__PURE__ */ new Set();
|
|
4751
|
+
function normalizeLanguage(language) {
|
|
4752
|
+
const input = (language || "text").toLowerCase();
|
|
4753
|
+
return SUPPORTED_LANG_ALIASES[input] || input;
|
|
4754
|
+
}
|
|
4755
|
+
function escapeHtml(str) {
|
|
4756
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
4757
|
+
}
|
|
4758
|
+
async function getHighlighter() {
|
|
4759
|
+
if (highlighter) return highlighter;
|
|
4760
|
+
if (!highlighterPromise) highlighterPromise = (0, shiki_core.createHighlighterCore)({
|
|
4761
|
+
themes: [shiki_dist_themes_vitesse_light_mjs.default, shiki_dist_themes_vitesse_dark_mjs.default],
|
|
4762
|
+
langs: [],
|
|
4763
|
+
engine: (0, shiki_engine_javascript.createJavaScriptRegexEngine)()
|
|
4764
|
+
});
|
|
4765
|
+
highlighter = await highlighterPromise;
|
|
4766
|
+
return highlighter;
|
|
4767
|
+
}
|
|
4768
|
+
async function loadLang(lang) {
|
|
4769
|
+
const loader = LANG_LOADERS[lang];
|
|
4770
|
+
if (!loader || loadedLangs.has(lang)) return false;
|
|
4771
|
+
const instance = await getHighlighter();
|
|
4772
|
+
const mod = await loader();
|
|
4773
|
+
await instance.loadLanguage(mod.default);
|
|
4774
|
+
loadedLangs.add(lang);
|
|
4775
|
+
return true;
|
|
4776
|
+
}
|
|
4777
|
+
async function codeToHtml(code, options = {}) {
|
|
4778
|
+
const lang = normalizeLanguage(options.lang);
|
|
4779
|
+
if (!await loadLang(lang)) return `<pre><code>${escapeHtml(code)}</code></pre>`;
|
|
4780
|
+
return (await getHighlighter()).codeToHtml(code, {
|
|
4781
|
+
lang,
|
|
4782
|
+
theme: options.theme || "vitesse-light"
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4785
|
+
//#endregion
|
|
4715
4786
|
//#region components/code-highlighter/style/index.ts
|
|
4716
4787
|
var genCodeHighlighterStyle = (token) => {
|
|
4717
4788
|
const { componentCls } = token;
|
|
@@ -4822,21 +4893,9 @@
|
|
|
4822
4893
|
return [genCodeHighlighterStyle((0, _antdv_next_cssinjs_cssinjs_utils.mergeToken)(token, {}))];
|
|
4823
4894
|
}, prepareComponentToken$9);
|
|
4824
4895
|
//#endregion
|
|
4825
|
-
//#region components/code-highlighter/CodeHighlighter.tsx
|
|
4826
|
-
var shikiHighlighter = null;
|
|
4827
|
-
var shikiPromise = null;
|
|
4828
|
-
async function initShiki() {
|
|
4829
|
-
if (shikiHighlighter) return;
|
|
4830
|
-
if (shikiPromise) return shikiPromise;
|
|
4831
|
-
shikiPromise = (async () => {
|
|
4832
|
-
shikiHighlighter = (await import("shiki")).codeToHtml;
|
|
4833
|
-
})();
|
|
4834
|
-
return shikiPromise;
|
|
4835
|
-
}
|
|
4836
|
-
//#endregion
|
|
4837
4896
|
//#region components/code-highlighter/index.tsx
|
|
4838
4897
|
var code_highlighter_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4839
|
-
name: "
|
|
4898
|
+
name: "AxCodeHighlighter",
|
|
4840
4899
|
inheritAttrs: false,
|
|
4841
4900
|
props: {
|
|
4842
4901
|
prefixCls: {
|
|
@@ -4917,9 +4976,7 @@
|
|
|
4917
4976
|
const highlightedHtml = (0, vue.shallowRef)("");
|
|
4918
4977
|
const highlightCode = async () => {
|
|
4919
4978
|
try {
|
|
4920
|
-
await
|
|
4921
|
-
if (!shikiHighlighter) return;
|
|
4922
|
-
highlightedHtml.value = await shikiHighlighter(props.content, {
|
|
4979
|
+
highlightedHtml.value = await codeToHtml(props.content, {
|
|
4923
4980
|
lang: props.language,
|
|
4924
4981
|
theme: props.theme === "dark" ? "vitesse-dark" : "vitesse-light"
|
|
4925
4982
|
});
|
|
@@ -5362,7 +5419,7 @@
|
|
|
5362
5419
|
//#endregion
|
|
5363
5420
|
//#region components/conversations/Creation.tsx
|
|
5364
5421
|
var Creation = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5365
|
-
name: "
|
|
5422
|
+
name: "AxConversationsCreation",
|
|
5366
5423
|
props: {
|
|
5367
5424
|
label: {
|
|
5368
5425
|
type: [
|
|
@@ -5901,7 +5958,7 @@
|
|
|
5901
5958
|
return tagName === "input" || tagName === "textarea" || tagName === "select";
|
|
5902
5959
|
}
|
|
5903
5960
|
var ConversationsWithSub = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5904
|
-
name: "
|
|
5961
|
+
name: "AxConversations",
|
|
5905
5962
|
inheritAttrs: false,
|
|
5906
5963
|
props: {
|
|
5907
5964
|
items: {
|
|
@@ -6138,6 +6195,38 @@
|
|
|
6138
6195
|
}
|
|
6139
6196
|
};
|
|
6140
6197
|
//#endregion
|
|
6198
|
+
//#region components/mermaid/loader.ts
|
|
6199
|
+
var mermaidInstance = null;
|
|
6200
|
+
var mermaidPromise = null;
|
|
6201
|
+
var pendingInitializeConfig = null;
|
|
6202
|
+
async function loadMermaid() {
|
|
6203
|
+
if (mermaidInstance) return mermaidInstance;
|
|
6204
|
+
if (!mermaidPromise) mermaidPromise = import("mermaid/dist/mermaid.core.mjs").then((mod) => mod.default).then((instance) => {
|
|
6205
|
+
mermaidInstance = instance;
|
|
6206
|
+
if (pendingInitializeConfig) {
|
|
6207
|
+
instance.initialize(pendingInitializeConfig);
|
|
6208
|
+
pendingInitializeConfig = null;
|
|
6209
|
+
}
|
|
6210
|
+
return instance;
|
|
6211
|
+
});
|
|
6212
|
+
return mermaidPromise;
|
|
6213
|
+
}
|
|
6214
|
+
function initializeMermaid(config) {
|
|
6215
|
+
pendingInitializeConfig = config;
|
|
6216
|
+
if (mermaidInstance) {
|
|
6217
|
+
mermaidInstance.initialize(config);
|
|
6218
|
+
pendingInitializeConfig = null;
|
|
6219
|
+
return;
|
|
6220
|
+
}
|
|
6221
|
+
loadMermaid();
|
|
6222
|
+
}
|
|
6223
|
+
async function parseMermaid(content, options) {
|
|
6224
|
+
return (await loadMermaid()).parse(content, options);
|
|
6225
|
+
}
|
|
6226
|
+
async function renderMermaid(id, content, container) {
|
|
6227
|
+
return (await loadMermaid()).render(id, content, container);
|
|
6228
|
+
}
|
|
6229
|
+
//#endregion
|
|
6141
6230
|
//#region components/mermaid/style/index.ts
|
|
6142
6231
|
var genMermaidStyle = (token) => {
|
|
6143
6232
|
const { componentCls } = token;
|
|
@@ -6244,7 +6333,7 @@
|
|
|
6244
6333
|
//#endregion
|
|
6245
6334
|
//#region components/mermaid/index.tsx
|
|
6246
6335
|
var mermaid_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
6247
|
-
name: "
|
|
6336
|
+
name: "AxMermaid",
|
|
6248
6337
|
inheritAttrs: false,
|
|
6249
6338
|
props: {
|
|
6250
6339
|
content: {
|
|
@@ -6375,8 +6464,8 @@
|
|
|
6375
6464
|
const graphEl = graphRef.value;
|
|
6376
6465
|
if (!graphEl) return;
|
|
6377
6466
|
try {
|
|
6378
|
-
if (await
|
|
6379
|
-
const { svg } = await
|
|
6467
|
+
if (await parseMermaid(props.content, { suppressErrors: true }) === false) throw new Error("Invalid Mermaid syntax");
|
|
6468
|
+
const { svg } = await renderMermaid(`${renderBaseId}-${idSeed++}-${props.content.length || 0}`, props.content);
|
|
6380
6469
|
graphEl.innerHTML = svg;
|
|
6381
6470
|
applySvgTransform();
|
|
6382
6471
|
} catch (error) {
|
|
@@ -6509,7 +6598,7 @@
|
|
|
6509
6598
|
if (next !== void 0) internalRenderType.value = next;
|
|
6510
6599
|
});
|
|
6511
6600
|
(0, vue.watch)(() => props.config, (nextConfig) => {
|
|
6512
|
-
|
|
6601
|
+
initializeMermaid({
|
|
6513
6602
|
startOnLoad: false,
|
|
6514
6603
|
securityLevel: "strict",
|
|
6515
6604
|
theme: "default",
|
|
@@ -6831,7 +6920,7 @@
|
|
|
6831
6920
|
//#endregion
|
|
6832
6921
|
//#region components/prompts/index.tsx
|
|
6833
6922
|
var prompts_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
6834
|
-
name: "
|
|
6923
|
+
name: "AxPrompts",
|
|
6835
6924
|
inheritAttrs: false,
|
|
6836
6925
|
props: {
|
|
6837
6926
|
items: {
|
|
@@ -6951,8 +7040,10 @@
|
|
|
6951
7040
|
};
|
|
6952
7041
|
});
|
|
6953
7042
|
const triggerItemClick = (item, nested) => {
|
|
6954
|
-
if (
|
|
6955
|
-
|
|
7043
|
+
if (item.disabled || !nested && hasChildren(item)) return;
|
|
7044
|
+
const info = { data: item };
|
|
7045
|
+
props.onItemClick?.(info);
|
|
7046
|
+
emit("itemClick", info);
|
|
6956
7047
|
};
|
|
6957
7048
|
const renderTitle = () => {
|
|
6958
7049
|
if (slots.title) return slots.title({ originNode: props.title });
|
|
@@ -6997,7 +7088,7 @@
|
|
|
6997
7088
|
}
|
|
6998
7089
|
],
|
|
6999
7090
|
"style": [nested ? mergedStyles.value.subItem : mergedStyles.value.item, item.style],
|
|
7000
|
-
"onClick": () => triggerItemClick(item,
|
|
7091
|
+
"onClick": () => triggerItemClick(item, nested)
|
|
7001
7092
|
}), [hasRenderableNode$5(iconNode) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-icon` }, [iconNode]), (0, vue.createVNode)("div", {
|
|
7002
7093
|
"class": [`${props.prefixCls}-content`, mergedClasses.value.itemContent],
|
|
7003
7094
|
"style": mergedStyles.value.itemContent
|
|
@@ -8637,7 +8728,7 @@
|
|
|
8637
8728
|
SpeechButton: SpeechButton_default
|
|
8638
8729
|
};
|
|
8639
8730
|
var Sender_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8640
|
-
name: "
|
|
8731
|
+
name: "AxSender",
|
|
8641
8732
|
inheritAttrs: false,
|
|
8642
8733
|
props: {
|
|
8643
8734
|
prefixCls: {
|
|
@@ -8978,7 +9069,7 @@
|
|
|
8978
9069
|
//#endregion
|
|
8979
9070
|
//#region components/sender/SenderHeader.tsx
|
|
8980
9071
|
var SenderHeader_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8981
|
-
name: "
|
|
9072
|
+
name: "AxSenderHeader",
|
|
8982
9073
|
props: {
|
|
8983
9074
|
open: {
|
|
8984
9075
|
type: Boolean,
|
|
@@ -9082,7 +9173,7 @@
|
|
|
9082
9173
|
//#endregion
|
|
9083
9174
|
//#region components/sender/SenderSwitch.tsx
|
|
9084
9175
|
var SenderSwitch_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
9085
|
-
name: "
|
|
9176
|
+
name: "AxSenderSwitch",
|
|
9086
9177
|
inheritAttrs: false,
|
|
9087
9178
|
props: {
|
|
9088
9179
|
prefixCls: {
|
|
@@ -9453,7 +9544,7 @@
|
|
|
9453
9544
|
//#endregion
|
|
9454
9545
|
//#region components/sources/index.tsx
|
|
9455
9546
|
var sources_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
9456
|
-
name: "
|
|
9547
|
+
name: "AxSources",
|
|
9457
9548
|
inheritAttrs: false,
|
|
9458
9549
|
props: {
|
|
9459
9550
|
prefixCls: {
|
|
@@ -9761,7 +9852,7 @@
|
|
|
9761
9852
|
//#endregion
|
|
9762
9853
|
//#region components/suggestion/index.tsx
|
|
9763
9854
|
var suggestion_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
9764
|
-
name: "
|
|
9855
|
+
name: "AxSuggestion",
|
|
9765
9856
|
inheritAttrs: false,
|
|
9766
9857
|
props: {
|
|
9767
9858
|
prefixCls: {
|
|
@@ -10039,7 +10130,7 @@
|
|
|
10039
10130
|
//#endregion
|
|
10040
10131
|
//#region components/think/index.tsx
|
|
10041
10132
|
var think_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10042
|
-
name: "
|
|
10133
|
+
name: "AxThink",
|
|
10043
10134
|
inheritAttrs: false,
|
|
10044
10135
|
props: {
|
|
10045
10136
|
prefixCls: {
|
|
@@ -10449,7 +10540,7 @@
|
|
|
10449
10540
|
return node !== null && node !== void 0 && node !== false;
|
|
10450
10541
|
}
|
|
10451
10542
|
var XThoughtChainItem = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10452
|
-
name: "
|
|
10543
|
+
name: "AxThoughtChainItem",
|
|
10453
10544
|
props: {
|
|
10454
10545
|
prefixCls: {
|
|
10455
10546
|
type: String,
|
|
@@ -10779,7 +10870,7 @@
|
|
|
10779
10870
|
//#endregion
|
|
10780
10871
|
//#region components/thought-chain/index.tsx
|
|
10781
10872
|
var ThoughtChainWithSub = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
10782
|
-
name: "
|
|
10873
|
+
name: "AxThoughtChain",
|
|
10783
10874
|
inheritAttrs: false,
|
|
10784
10875
|
props: {
|
|
10785
10876
|
prefixCls: {
|
|
@@ -10997,7 +11088,7 @@
|
|
|
10997
11088
|
return Array.isArray(value) ? value.length > 0 : value !== null && value !== void 0;
|
|
10998
11089
|
}
|
|
10999
11090
|
var XWelcome = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
11000
|
-
name: "
|
|
11091
|
+
name: "AxWelcome",
|
|
11001
11092
|
inheritAttrs: false,
|
|
11002
11093
|
props: {
|
|
11003
11094
|
prefixCls: {
|
|
@@ -11162,7 +11253,7 @@
|
|
|
11162
11253
|
//#endregion
|
|
11163
11254
|
//#region components/x-provider/index.tsx
|
|
11164
11255
|
var XProvider = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
11165
|
-
name: "
|
|
11256
|
+
name: "AxProvider",
|
|
11166
11257
|
inheritAttrs: false,
|
|
11167
11258
|
props: {
|
|
11168
11259
|
attachments: {
|
|
@@ -11267,36 +11358,11 @@
|
|
|
11267
11358
|
ThoughtChainWithSub,
|
|
11268
11359
|
XThoughtChainItem
|
|
11269
11360
|
];
|
|
11270
|
-
var componentAliases = new Map([
|
|
11271
|
-
["XBubble", ["ABubble"]],
|
|
11272
|
-
["XBubbleList", ["ABubbleList"]],
|
|
11273
|
-
["XBubbleSystem", ["ABubbleSystem"]],
|
|
11274
|
-
["XBubbleDivider", ["ABubbleDivider"]],
|
|
11275
|
-
["XActions", ["AActions"]],
|
|
11276
|
-
["XActionsAudio", ["AActionsAudio"]],
|
|
11277
|
-
["XActionsCopy", ["AActionsCopy"]],
|
|
11278
|
-
["XActionsFeedback", ["AActionsFeedback"]],
|
|
11279
|
-
["XActionsItem", ["AActionsItem"]],
|
|
11280
|
-
["XFileCard", ["AFileCard"]],
|
|
11281
|
-
["XFileCardList", ["AFileCardList"]],
|
|
11282
|
-
["XMermaid", ["AMermaid"]],
|
|
11283
|
-
["XAttachments", ["AAttachments"]],
|
|
11284
|
-
["XSender", ["ASender"]],
|
|
11285
|
-
["XSenderHeader", ["ASenderHeader"]],
|
|
11286
|
-
["XSenderSwitch", ["ASenderSwitch"]],
|
|
11287
|
-
["XSuggestion", ["ASuggestion"]],
|
|
11288
|
-
["XThink", ["AThink"]],
|
|
11289
|
-
["XThoughtChain", ["AThoughtChain"]],
|
|
11290
|
-
["XThoughtChainItem", ["AThoughtChainItem"]]
|
|
11291
|
-
]);
|
|
11292
11361
|
var components_default = {
|
|
11293
11362
|
install(app) {
|
|
11294
11363
|
components.forEach((component) => {
|
|
11295
11364
|
if (!component.name) return;
|
|
11296
11365
|
app.component(component.name, component);
|
|
11297
|
-
componentAliases.get(component.name)?.forEach((alias) => {
|
|
11298
|
-
app.component(alias, component);
|
|
11299
|
-
});
|
|
11300
11366
|
});
|
|
11301
11367
|
},
|
|
11302
11368
|
version
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSProperties, PropType, StyleValue, VNodeChild, HTMLAttributes } from 'vue';
|
|
2
1
|
import { MermaidConfig } from 'mermaid';
|
|
2
|
+
import { CSSProperties, PropType, StyleValue, VNodeChild, HTMLAttributes } from 'vue';
|
|
3
3
|
import { ItemType } from '../actions';
|
|
4
4
|
import { CodeHighlighterProps } from '../code-highlighter';
|
|
5
5
|
export type MermaidSemanticType = "root" | "header" | "graph" | "code";
|
package/dist/mermaid/Mermaid.js
CHANGED
|
@@ -4,12 +4,12 @@ import ActionsWithSub from "../actions/index.js";
|
|
|
4
4
|
import localeValues from "../locale/en_US.js";
|
|
5
5
|
import useLocale from "../locale/useLocale.js";
|
|
6
6
|
import code_highlighter_default from "../code-highlighter/index.js";
|
|
7
|
+
import { initializeMermaid, parseMermaid, renderMermaid } from "./loader.js";
|
|
7
8
|
import style_default from "./style/index.js";
|
|
8
9
|
import { computed, createVNode, defineComponent, mergeProps, onBeforeUnmount, ref, useAttrs, watch } from "vue";
|
|
9
10
|
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
10
11
|
import { Button, Segmented, Tooltip } from "antdv-next";
|
|
11
12
|
import { DownloadOutlined, ZoomInOutlined, ZoomOutOutlined } from "@antdv-next/icons";
|
|
12
|
-
import mermaid from "mermaid";
|
|
13
13
|
//#region components/mermaid/Mermaid.tsx
|
|
14
14
|
var RenderType = /* @__PURE__ */ function(RenderType) {
|
|
15
15
|
RenderType["Code"] = "code";
|
|
@@ -55,7 +55,7 @@ function throttle(fn, wait) {
|
|
|
55
55
|
return throttled;
|
|
56
56
|
}
|
|
57
57
|
var XMermaid = /* @__PURE__ */ defineComponent({
|
|
58
|
-
name: "
|
|
58
|
+
name: "AxMermaid",
|
|
59
59
|
inheritAttrs: false,
|
|
60
60
|
props: {
|
|
61
61
|
content: {
|
|
@@ -186,8 +186,8 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
186
186
|
const graphEl = graphRef.value;
|
|
187
187
|
if (!graphEl) return;
|
|
188
188
|
try {
|
|
189
|
-
if (await
|
|
190
|
-
const { svg } = await
|
|
189
|
+
if (await parseMermaid(props.content, { suppressErrors: true }) === false) throw new Error("Invalid Mermaid syntax");
|
|
190
|
+
const { svg } = await renderMermaid(`${renderBaseId}-${idSeed++}-${props.content.length || 0}`, props.content);
|
|
191
191
|
graphEl.innerHTML = svg;
|
|
192
192
|
applySvgTransform();
|
|
193
193
|
} catch (error) {
|
|
@@ -320,7 +320,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
320
320
|
if (next !== void 0) internalRenderType.value = next;
|
|
321
321
|
});
|
|
322
322
|
watch(() => props.config, (nextConfig) => {
|
|
323
|
-
|
|
323
|
+
initializeMermaid({
|
|
324
324
|
startOnLoad: false,
|
|
325
325
|
securityLevel: "strict",
|
|
326
326
|
theme: "default",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MermaidConfig } from 'mermaid';
|
|
2
|
+
type MermaidInstance = (typeof import("mermaid/dist/mermaid.core.mjs"))["default"];
|
|
3
|
+
export declare function initializeMermaid(config: MermaidConfig): void;
|
|
4
|
+
export declare function parseMermaid(content: string, options?: Parameters<MermaidInstance["parse"]>[1]): Promise<false | import('mermaid').ParseResult>;
|
|
5
|
+
export declare function renderMermaid(id: string, content: string, container?: Element): Promise<import('mermaid').RenderResult>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region components/mermaid/loader.ts
|
|
2
|
+
var mermaidInstance = null;
|
|
3
|
+
var mermaidPromise = null;
|
|
4
|
+
var pendingInitializeConfig = null;
|
|
5
|
+
async function loadMermaid() {
|
|
6
|
+
if (mermaidInstance) return mermaidInstance;
|
|
7
|
+
if (!mermaidPromise) mermaidPromise = import("mermaid/dist/mermaid.core.mjs").then((mod) => mod.default).then((instance) => {
|
|
8
|
+
mermaidInstance = instance;
|
|
9
|
+
if (pendingInitializeConfig) {
|
|
10
|
+
instance.initialize(pendingInitializeConfig);
|
|
11
|
+
pendingInitializeConfig = null;
|
|
12
|
+
}
|
|
13
|
+
return instance;
|
|
14
|
+
});
|
|
15
|
+
return mermaidPromise;
|
|
16
|
+
}
|
|
17
|
+
function initializeMermaid(config) {
|
|
18
|
+
pendingInitializeConfig = config;
|
|
19
|
+
if (mermaidInstance) {
|
|
20
|
+
mermaidInstance.initialize(config);
|
|
21
|
+
pendingInitializeConfig = null;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
loadMermaid();
|
|
25
|
+
}
|
|
26
|
+
async function parseMermaid(content, options) {
|
|
27
|
+
return (await loadMermaid()).parse(content, options);
|
|
28
|
+
}
|
|
29
|
+
async function renderMermaid(id, content, container) {
|
|
30
|
+
return (await loadMermaid()).render(id, content, container);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { initializeMermaid, parseMermaid, renderMermaid };
|
|
File without changes
|
package/dist/package.js
CHANGED
package/dist/prompts/Prompts.js
CHANGED
|
@@ -24,7 +24,7 @@ function hasRenderableNode(node) {
|
|
|
24
24
|
return node !== null && node !== void 0 && node !== false;
|
|
25
25
|
}
|
|
26
26
|
var XPrompts = /* @__PURE__ */ defineComponent({
|
|
27
|
-
name: "
|
|
27
|
+
name: "AxPrompts",
|
|
28
28
|
inheritAttrs: false,
|
|
29
29
|
props: {
|
|
30
30
|
items: {
|
|
@@ -144,8 +144,10 @@ var XPrompts = /* @__PURE__ */ defineComponent({
|
|
|
144
144
|
};
|
|
145
145
|
});
|
|
146
146
|
const triggerItemClick = (item, nested) => {
|
|
147
|
-
if (
|
|
148
|
-
|
|
147
|
+
if (item.disabled || !nested && hasChildren(item)) return;
|
|
148
|
+
const info = { data: item };
|
|
149
|
+
props.onItemClick?.(info);
|
|
150
|
+
emit("itemClick", info);
|
|
149
151
|
};
|
|
150
152
|
const renderTitle = () => {
|
|
151
153
|
if (slots.title) return slots.title({ originNode: props.title });
|
|
@@ -190,7 +192,7 @@ var XPrompts = /* @__PURE__ */ defineComponent({
|
|
|
190
192
|
}
|
|
191
193
|
],
|
|
192
194
|
"style": [nested ? mergedStyles.value.subItem : mergedStyles.value.item, item.style],
|
|
193
|
-
"onClick": () => triggerItemClick(item,
|
|
195
|
+
"onClick": () => triggerItemClick(item, nested)
|
|
194
196
|
}), [hasRenderableNode(iconNode) && createVNode("div", { "class": `${props.prefixCls}-icon` }, [iconNode]), createVNode("div", {
|
|
195
197
|
"class": [`${props.prefixCls}-content`, mergedClasses.value.itemContent],
|
|
196
198
|
"style": mergedStyles.value.itemContent
|
package/dist/sender/Sender.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Button } from "antdv-next";
|
|
|
5
5
|
import { CloseOutlined } from "@antdv-next/icons";
|
|
6
6
|
//#region components/sender/SenderHeader.tsx
|
|
7
7
|
var SenderHeader_default = /* @__PURE__ */ defineComponent({
|
|
8
|
-
name: "
|
|
8
|
+
name: "AxSenderHeader",
|
|
9
9
|
props: {
|
|
10
10
|
open: {
|
|
11
11
|
type: Boolean,
|
|
@@ -5,7 +5,7 @@ import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
|
5
5
|
import { Button } from "antdv-next";
|
|
6
6
|
//#region components/sender/SenderSwitch.tsx
|
|
7
7
|
var SenderSwitch_default = /* @__PURE__ */ defineComponent({
|
|
8
|
-
name: "
|
|
8
|
+
name: "AxSenderSwitch",
|
|
9
9
|
inheritAttrs: false,
|
|
10
10
|
props: {
|
|
11
11
|
prefixCls: {
|
package/dist/sources/Sources.js
CHANGED