@antdv-next/x 1.2.3-beta.1 → 1.2.4
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/index.umd.js +123 -45
- package/dist/mermaid/Mermaid.js +49 -14
- package/dist/package.js +1 -1
- package/dist/sender/components/ActionButton.js +6 -3
- package/dist/sender/components/ClearButton.js +6 -3
- package/dist/sender/components/LoadingButton/index.js +6 -3
- package/dist/sender/components/SendButton.js +6 -3
- package/dist/sender/components/SlotTextAreaProseMirror.js +32 -4
- package/dist/sender/components/SpeechButton/index.js +6 -3
- package/es/antdv-next-x.esm.js +1792 -1721
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
shiki_dist_themes_vitesse_dark_mjs = __toESM(shiki_dist_themes_vitesse_dark_mjs, 1);
|
|
67
67
|
shiki_dist_themes_vitesse_light_mjs = __toESM(shiki_dist_themes_vitesse_light_mjs, 1);
|
|
68
68
|
//#region package.json
|
|
69
|
-
var version = "1.2.
|
|
69
|
+
var version = "1.2.4";
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region components/x-provider/context.ts
|
|
72
72
|
var XProviderContextKey = Symbol("antdv-next-x-provider-context");
|
|
@@ -559,7 +559,7 @@
|
|
|
559
559
|
}, prepareComponentToken$14);
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region components/actions/Actions.tsx
|
|
562
|
-
function _isSlot$
|
|
562
|
+
function _isSlot$12(s) {
|
|
563
563
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
564
564
|
}
|
|
565
565
|
function getMotionTransitionProps(motionName) {
|
|
@@ -719,7 +719,7 @@
|
|
|
719
719
|
attrs.style,
|
|
720
720
|
props.style
|
|
721
721
|
]
|
|
722
|
-
}), [transitionProps.value ? (0, vue.createVNode)(vue.Transition, transitionProps.value, _isSlot$
|
|
722
|
+
}), [transitionProps.value ? (0, vue.createVNode)(vue.Transition, transitionProps.value, _isSlot$12(_slot = renderList()) ? _slot : { default: () => [_slot] }) : renderList()]);
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
725
|
});
|
|
@@ -2235,7 +2235,7 @@
|
|
|
2235
2235
|
});
|
|
2236
2236
|
//#endregion
|
|
2237
2237
|
//#region components/file-card/List.tsx
|
|
2238
|
-
function _isSlot$
|
|
2238
|
+
function _isSlot$11(s) {
|
|
2239
2239
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
2240
2240
|
}
|
|
2241
2241
|
var XFileCardList = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -2403,7 +2403,7 @@
|
|
|
2403
2403
|
"style": [props.style, splitStyles.value.root],
|
|
2404
2404
|
"onScroll": checkPing
|
|
2405
2405
|
}, [
|
|
2406
|
-
(0, vue.createVNode)(vue.TransitionGroup, { "name": `${compCls.value}-motion` }, _isSlot$
|
|
2406
|
+
(0, vue.createVNode)(vue.TransitionGroup, { "name": `${compCls.value}-motion` }, _isSlot$11(_slot = list.value.map((item, itemIndex) => {
|
|
2407
2407
|
const { __key, ...fileItem } = item;
|
|
2408
2408
|
const cardSlots = {
|
|
2409
2409
|
description: slots.description ? (slotInfo) => slots.description?.({
|
|
@@ -2730,7 +2730,7 @@
|
|
|
2730
2730
|
});
|
|
2731
2731
|
//#endregion
|
|
2732
2732
|
//#region components/attachments/PlaceholderUploader.tsx
|
|
2733
|
-
function _isSlot$
|
|
2733
|
+
function _isSlot$10(s) {
|
|
2734
2734
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
2735
2735
|
}
|
|
2736
2736
|
var PlaceholderUploader = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -2851,7 +2851,7 @@
|
|
|
2851
2851
|
border: 0,
|
|
2852
2852
|
background: "transparent"
|
|
2853
2853
|
}
|
|
2854
|
-
}), _isSlot$
|
|
2854
|
+
}), _isSlot$10(node) ? node : { default: () => [node] })]);
|
|
2855
2855
|
};
|
|
2856
2856
|
}
|
|
2857
2857
|
});
|
|
@@ -2968,7 +2968,7 @@
|
|
|
2968
2968
|
}, prepareComponentToken$12);
|
|
2969
2969
|
//#endregion
|
|
2970
2970
|
//#region components/attachments/index.tsx
|
|
2971
|
-
function _isSlot$
|
|
2971
|
+
function _isSlot$9(s) {
|
|
2972
2972
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
2973
2973
|
}
|
|
2974
2974
|
var XAttachments = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -3195,7 +3195,7 @@
|
|
|
3195
3195
|
props.rootClass,
|
|
3196
3196
|
mergedClasses.value.root
|
|
3197
3197
|
]
|
|
3198
|
-
}, _isSlot$
|
|
3198
|
+
}, _isSlot$9(_slot = getPlaceholderNode("drop")) ? _slot : { default: () => [_slot] })]);
|
|
3199
3199
|
};
|
|
3200
3200
|
const renderNormalMode = () => {
|
|
3201
3201
|
let _slot2;
|
|
@@ -3234,7 +3234,7 @@
|
|
|
3234
3234
|
"getDropContainer": props.getDropContainer || (() => containerRef.value),
|
|
3235
3235
|
"prefixCls": props.prefixCls,
|
|
3236
3236
|
"class": [hashId.value, cssVarCls.value]
|
|
3237
|
-
}, _isSlot$
|
|
3237
|
+
}, _isSlot$9(_slot2 = getPlaceholderNode("drop")) ? _slot2 : { default: () => [_slot2] })
|
|
3238
3238
|
]);
|
|
3239
3239
|
};
|
|
3240
3240
|
return () => slots.default ? renderWithChildren() : renderNormalMode();
|
|
@@ -4255,7 +4255,7 @@
|
|
|
4255
4255
|
});
|
|
4256
4256
|
//#endregion
|
|
4257
4257
|
//#region components/bubble/Divider.tsx
|
|
4258
|
-
function _isSlot$
|
|
4258
|
+
function _isSlot$8(s) {
|
|
4259
4259
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
4260
4260
|
}
|
|
4261
4261
|
var XBubbleDivider = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -4321,7 +4321,7 @@
|
|
|
4321
4321
|
"class": [`${props.prefixCls}-divider`, props.class],
|
|
4322
4322
|
"styles": props.styles,
|
|
4323
4323
|
"classes": props.classes
|
|
4324
|
-
}), { content: ({ content }) => (0, vue.createVNode)(antdv_next.Divider, props.dividerProps, _isSlot$
|
|
4324
|
+
}), { content: ({ content }) => (0, vue.createVNode)(antdv_next.Divider, props.dividerProps, _isSlot$8(content) ? content : { default: () => [content] }) });
|
|
4325
4325
|
}
|
|
4326
4326
|
});
|
|
4327
4327
|
//#endregion
|
|
@@ -5812,7 +5812,7 @@
|
|
|
5812
5812
|
}
|
|
5813
5813
|
//#endregion
|
|
5814
5814
|
//#region components/conversations/Item.tsx
|
|
5815
|
-
function _isSlot$
|
|
5815
|
+
function _isSlot$7(s) {
|
|
5816
5816
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
5817
5817
|
}
|
|
5818
5818
|
var stopPropagation = (event) => {
|
|
@@ -5949,14 +5949,14 @@
|
|
|
5949
5949
|
}
|
|
5950
5950
|
}, [
|
|
5951
5951
|
hasRenderableNode(iconNode) && (0, vue.createVNode)("div", { "class": `${props.prefixCls}-icon` }, [iconNode]),
|
|
5952
|
-
(0, vue.createVNode)(antdv_next.Typography.Text, { "class": `${props.prefixCls}-label` }, _isSlot$
|
|
5952
|
+
(0, vue.createVNode)(antdv_next.Typography.Text, { "class": `${props.prefixCls}-label` }, _isSlot$7(labelNode) ? labelNode : { default: () => [labelNode] }),
|
|
5953
5953
|
!disabled && props.menu && (0, vue.createVNode)("div", { "onClick": stopPropagation }, [(0, vue.createVNode)(antdv_next.Dropdown, {
|
|
5954
5954
|
"menu": menuProps.value,
|
|
5955
5955
|
"placement": props.direction === "rtl" ? "bottomLeft" : "bottomRight",
|
|
5956
5956
|
"trigger": ["click"],
|
|
5957
5957
|
"disabled": disabled,
|
|
5958
5958
|
"getPopupContainer": menuProps.value?.getPopupContainer
|
|
5959
|
-
}, _isSlot$
|
|
5959
|
+
}, _isSlot$7(_slot = renderMenuTrigger(props.info)) ? _slot : { default: () => [_slot] })])
|
|
5960
5960
|
]);
|
|
5961
5961
|
};
|
|
5962
5962
|
}
|
|
@@ -7321,6 +7321,10 @@
|
|
|
7321
7321
|
const mergedRenderType = (0, vue.computed)(() => {
|
|
7322
7322
|
return props.renderType ?? internalRenderType.value;
|
|
7323
7323
|
});
|
|
7324
|
+
const latestRenderRef = (0, vue.ref)({
|
|
7325
|
+
content: props.content,
|
|
7326
|
+
renderType: mergedRenderType.value
|
|
7327
|
+
});
|
|
7324
7328
|
const mergedActions = (0, vue.computed)(() => {
|
|
7325
7329
|
return {
|
|
7326
7330
|
enableZoom: props.actions?.enableZoom ?? true,
|
|
@@ -7350,23 +7354,29 @@
|
|
|
7350
7354
|
svgEl.style.transition = isDragging.value ? "none" : "transform 0.1s ease-out";
|
|
7351
7355
|
svgEl.style.cursor = isDragging.value ? "grabbing" : "grab";
|
|
7352
7356
|
}
|
|
7357
|
+
let renderRequestId = 0;
|
|
7358
|
+
let latestCommittedRequestId = 0;
|
|
7353
7359
|
const renderDiagram = throttle(async () => {
|
|
7354
|
-
|
|
7355
|
-
if (graphRef.value) graphRef.value.innerHTML = "";
|
|
7356
|
-
return;
|
|
7357
|
-
}
|
|
7358
|
-
if (!props.content?.trim()) return;
|
|
7360
|
+
const { content, renderType } = latestRenderRef.value;
|
|
7359
7361
|
const graphEl = graphRef.value;
|
|
7360
|
-
if (!graphEl) return;
|
|
7362
|
+
if (!graphEl || renderType === RenderType.Code || !content?.trim()) return;
|
|
7363
|
+
const requestId = ++renderRequestId;
|
|
7361
7364
|
try {
|
|
7362
|
-
if (await parseMermaid(
|
|
7363
|
-
const { svg } = await renderMermaid(`${renderBaseId}-${idSeed++}-${
|
|
7365
|
+
if (await parseMermaid(content, { suppressErrors: true }) === false) throw new Error("Invalid Mermaid syntax");
|
|
7366
|
+
const { svg } = await renderMermaid(`${renderBaseId}-${idSeed++}-${content.length || 0}`, content);
|
|
7367
|
+
if (requestId <= latestCommittedRequestId) return;
|
|
7364
7368
|
graphEl.innerHTML = svg;
|
|
7369
|
+
latestCommittedRequestId = requestId;
|
|
7365
7370
|
applySvgTransform();
|
|
7366
7371
|
} catch (error) {
|
|
7372
|
+
if (requestId !== renderRequestId || latestRenderRef.value.content !== content || latestRenderRef.value.renderType !== renderType) return;
|
|
7367
7373
|
warning(false, "Mermaid", `Render failed: ${String(error)}`);
|
|
7368
7374
|
}
|
|
7369
7375
|
}, 100);
|
|
7376
|
+
const invalidateRender = () => {
|
|
7377
|
+
latestCommittedRequestId = ++renderRequestId;
|
|
7378
|
+
renderDiagram.cancel();
|
|
7379
|
+
};
|
|
7370
7380
|
function switchRenderType(nextType) {
|
|
7371
7381
|
if (props.renderType === void 0) internalRenderType.value = nextType;
|
|
7372
7382
|
emit("update:renderType", nextType);
|
|
@@ -7401,7 +7411,7 @@
|
|
|
7401
7411
|
}
|
|
7402
7412
|
function handleZoomIn() {
|
|
7403
7413
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
7404
|
-
scale.value =
|
|
7414
|
+
scale.value = scale.value + .2;
|
|
7405
7415
|
}
|
|
7406
7416
|
function handleZoomOut() {
|
|
7407
7417
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
@@ -7426,11 +7436,26 @@
|
|
|
7426
7436
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
7427
7437
|
const svgElement = graphRef.value?.querySelector("svg");
|
|
7428
7438
|
if (!svgElement) return;
|
|
7429
|
-
const
|
|
7439
|
+
const exportSvg = svgElement.cloneNode(true);
|
|
7440
|
+
exportSvg.style.removeProperty("transform");
|
|
7441
|
+
exportSvg.style.removeProperty("transform-origin");
|
|
7442
|
+
exportSvg.style.removeProperty("transition");
|
|
7443
|
+
exportSvg.style.removeProperty("cursor");
|
|
7444
|
+
const viewBox = svgElement.viewBox.baseVal;
|
|
7445
|
+
let width = viewBox.width || svgElement.width.baseVal.value;
|
|
7446
|
+
let height = viewBox.height || svgElement.height.baseVal.value;
|
|
7447
|
+
if (!width || !height) {
|
|
7448
|
+
const bounds = svgElement.getBoundingClientRect();
|
|
7449
|
+
width ||= bounds.width / scale.value;
|
|
7450
|
+
height ||= bounds.height / scale.value;
|
|
7451
|
+
}
|
|
7452
|
+
if (!width || !height) return;
|
|
7453
|
+
exportSvg.setAttribute("width", `${width}`);
|
|
7454
|
+
exportSvg.setAttribute("height", `${height}`);
|
|
7455
|
+
const svgString = new XMLSerializer().serializeToString(exportSvg);
|
|
7430
7456
|
const canvas = document.createElement("canvas");
|
|
7431
7457
|
const ctx = canvas.getContext("2d");
|
|
7432
7458
|
if (!ctx) return;
|
|
7433
|
-
const { width, height } = svgElement.getBoundingClientRect();
|
|
7434
7459
|
const dpr = globalThis.window?.devicePixelRatio || 1;
|
|
7435
7460
|
canvas.width = width * dpr;
|
|
7436
7461
|
canvas.height = height * dpr;
|
|
@@ -7530,7 +7555,17 @@
|
|
|
7530
7555
|
mergedRenderType,
|
|
7531
7556
|
() => graphRef.value
|
|
7532
7557
|
], () => {
|
|
7533
|
-
|
|
7558
|
+
latestRenderRef.value = {
|
|
7559
|
+
content: props.content,
|
|
7560
|
+
renderType: mergedRenderType.value
|
|
7561
|
+
};
|
|
7562
|
+
const graphEl = graphRef.value;
|
|
7563
|
+
if (mergedRenderType.value === RenderType.Code || !props.content?.trim()) {
|
|
7564
|
+
invalidateRender();
|
|
7565
|
+
if (graphEl) graphEl.innerHTML = "";
|
|
7566
|
+
return;
|
|
7567
|
+
}
|
|
7568
|
+
if (!graphEl) return;
|
|
7534
7569
|
renderDiagram();
|
|
7535
7570
|
}, {
|
|
7536
7571
|
immediate: true,
|
|
@@ -7552,7 +7587,7 @@
|
|
|
7552
7587
|
if (now - lastTime < 16) return;
|
|
7553
7588
|
lastTime = now;
|
|
7554
7589
|
const delta = event.deltaY > 0 ? -.1 : .1;
|
|
7555
|
-
scale.value = Math.max(.5,
|
|
7590
|
+
scale.value = Math.max(.5, scale.value + delta);
|
|
7556
7591
|
};
|
|
7557
7592
|
graphEl.addEventListener("wheel", wheelHandler, { passive: false });
|
|
7558
7593
|
onCleanup(() => {
|
|
@@ -7568,7 +7603,7 @@
|
|
|
7568
7603
|
applySvgTransform();
|
|
7569
7604
|
}, { deep: true });
|
|
7570
7605
|
(0, vue.onBeforeUnmount)(() => {
|
|
7571
|
-
|
|
7606
|
+
invalidateRender();
|
|
7572
7607
|
});
|
|
7573
7608
|
expose({ get nativeElement() {
|
|
7574
7609
|
return rootRef.value;
|
|
@@ -8032,6 +8067,9 @@
|
|
|
8032
8067
|
});
|
|
8033
8068
|
//#endregion
|
|
8034
8069
|
//#region components/sender/components/ActionButton.tsx
|
|
8070
|
+
function _isSlot$6(s) {
|
|
8071
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8072
|
+
}
|
|
8035
8073
|
var ActionButtonContextKey = Symbol("action-button-context");
|
|
8036
8074
|
function useActionButtonContext() {
|
|
8037
8075
|
return (0, vue.inject)(ActionButtonContextKey, (0, vue.computed)(() => ({ prefixCls: "" })));
|
|
@@ -8072,7 +8110,7 @@
|
|
|
8072
8110
|
default: void 0
|
|
8073
8111
|
}
|
|
8074
8112
|
},
|
|
8075
|
-
setup(props, { attrs }) {
|
|
8113
|
+
setup(props, { attrs, slots }) {
|
|
8076
8114
|
const context = useActionButtonContext();
|
|
8077
8115
|
const mergedDisabled = (0, vue.computed)(() => {
|
|
8078
8116
|
if (props.disabled !== void 0) return props.disabled;
|
|
@@ -8101,17 +8139,20 @@
|
|
|
8101
8139
|
if (typeof handler === "function") handler();
|
|
8102
8140
|
attrs.onClick?.(e);
|
|
8103
8141
|
}
|
|
8104
|
-
}),
|
|
8142
|
+
}), _isSlot$6(slots) ? slots : { default: () => [slots] });
|
|
8105
8143
|
};
|
|
8106
8144
|
}
|
|
8107
8145
|
});
|
|
8108
8146
|
//#endregion
|
|
8109
8147
|
//#region components/sender/components/ClearButton.tsx
|
|
8148
|
+
function _isSlot$5(s) {
|
|
8149
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8150
|
+
}
|
|
8110
8151
|
var ClearButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8111
8152
|
name: "ClearButton",
|
|
8112
8153
|
inheritAttrs: false,
|
|
8113
|
-
setup(_, { attrs }) {
|
|
8114
|
-
return () => (0, vue.createVNode)(ActionButton, (0, vue.mergeProps)({ "icon": (0, vue.createVNode)(_antdv_next_icons.ClearOutlined, null, null) }, attrs, { "action": "onClear" }),
|
|
8154
|
+
setup(_, { attrs, slots }) {
|
|
8155
|
+
return () => (0, vue.createVNode)(ActionButton, (0, vue.mergeProps)({ "icon": (0, vue.createVNode)(_antdv_next_icons.ClearOutlined, null, null) }, attrs, { "action": "onClear" }), _isSlot$5(slots) ? slots : { default: () => [slots] });
|
|
8115
8156
|
}
|
|
8116
8157
|
});
|
|
8117
8158
|
//#endregion
|
|
@@ -8170,10 +8211,13 @@
|
|
|
8170
8211
|
});
|
|
8171
8212
|
//#endregion
|
|
8172
8213
|
//#region components/sender/components/LoadingButton/index.tsx
|
|
8214
|
+
function _isSlot$4(s) {
|
|
8215
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8216
|
+
}
|
|
8173
8217
|
var LoadingButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8174
8218
|
name: "LoadingButton",
|
|
8175
8219
|
inheritAttrs: false,
|
|
8176
|
-
setup(_, { attrs }) {
|
|
8220
|
+
setup(_, { attrs, slots }) {
|
|
8177
8221
|
const context = useActionButtonContext();
|
|
8178
8222
|
return () => {
|
|
8179
8223
|
const { prefixCls } = context.value;
|
|
@@ -8185,21 +8229,24 @@
|
|
|
8185
8229
|
}, attrs, {
|
|
8186
8230
|
"class": (0, _v_c_util.classNames)([attrs.class, `${prefixCls}-loading-button`]),
|
|
8187
8231
|
"action": "onCancel"
|
|
8188
|
-
}),
|
|
8232
|
+
}), _isSlot$4(slots) ? slots : { default: () => [slots] });
|
|
8189
8233
|
};
|
|
8190
8234
|
}
|
|
8191
8235
|
});
|
|
8192
8236
|
//#endregion
|
|
8193
8237
|
//#region components/sender/components/SendButton.tsx
|
|
8238
|
+
function _isSlot$3(s) {
|
|
8239
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8240
|
+
}
|
|
8194
8241
|
var SendButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8195
8242
|
name: "SendButton",
|
|
8196
8243
|
inheritAttrs: false,
|
|
8197
|
-
setup(_, { attrs }) {
|
|
8244
|
+
setup(_, { attrs, slots }) {
|
|
8198
8245
|
return () => (0, vue.createVNode)(ActionButton, (0, vue.mergeProps)({
|
|
8199
8246
|
"icon": (0, vue.createVNode)(_antdv_next_icons.ArrowUpOutlined, null, null),
|
|
8200
8247
|
"type": "primary",
|
|
8201
8248
|
"shape": "circle"
|
|
8202
|
-
}, attrs, { "action": "onSend" }),
|
|
8249
|
+
}, attrs, { "action": "onSend" }), _isSlot$3(slots) ? slots : { default: () => [slots] });
|
|
8203
8250
|
}
|
|
8204
8251
|
});
|
|
8205
8252
|
//#endregion
|
|
@@ -20162,7 +20209,7 @@
|
|
|
20162
20209
|
}
|
|
20163
20210
|
//#endregion
|
|
20164
20211
|
//#region components/sender/components/Skill.tsx
|
|
20165
|
-
function _isSlot$
|
|
20212
|
+
function _isSlot$2(s) {
|
|
20166
20213
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
20167
20214
|
}
|
|
20168
20215
|
var Skill_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -20231,7 +20278,7 @@
|
|
|
20231
20278
|
});
|
|
20232
20279
|
return () => {
|
|
20233
20280
|
const mergeTitle = props.skill.title ?? props.skill.value;
|
|
20234
|
-
const titleNode = props.skill.toolTip ? (0, vue.createVNode)(antdv_next.Tooltip, props.skill.toolTip, _isSlot$
|
|
20281
|
+
const titleNode = props.skill.toolTip ? (0, vue.createVNode)(antdv_next.Tooltip, props.skill.toolTip, _isSlot$2(mergeTitle) ? mergeTitle : { default: () => [mergeTitle] }) : mergeTitle;
|
|
20235
20282
|
return (0, vue.createVNode)("div", {
|
|
20236
20283
|
"class": `${componentCls.value}-wrapper`,
|
|
20237
20284
|
"contenteditable": false
|
|
@@ -20499,10 +20546,10 @@
|
|
|
20499
20546
|
(type === "copy" ? senderCtx.value.onCopy : senderCtx.value.onCut)?.(event, info);
|
|
20500
20547
|
if (event.defaultPrevented) return true;
|
|
20501
20548
|
if (type === "copy" && !slice && !payloadText) return false;
|
|
20549
|
+
if (type === "cut" && isLocked()) return true;
|
|
20502
20550
|
try {
|
|
20503
20551
|
event.clipboardData?.setData("text/plain", payloadText);
|
|
20504
20552
|
} catch {}
|
|
20505
|
-
if (type === "cut" && isLocked()) return true;
|
|
20506
20553
|
if (type === "cut" && slice) {
|
|
20507
20554
|
flushDom();
|
|
20508
20555
|
syncSelectionFromDom();
|
|
@@ -20648,7 +20695,8 @@
|
|
|
20648
20695
|
skill: void 0
|
|
20649
20696
|
};
|
|
20650
20697
|
senderCtx.value.onPaste?.(event, info);
|
|
20651
|
-
if (!event.defaultPrevented)
|
|
20698
|
+
if (!event.defaultPrevented) if (isLocked()) event.preventDefault();
|
|
20699
|
+
else routePasteEvent(event);
|
|
20652
20700
|
},
|
|
20653
20701
|
"onCopy": (event) => {
|
|
20654
20702
|
routeControlCopyOrCut(event, "copy");
|
|
@@ -20980,10 +21028,37 @@
|
|
|
20980
21028
|
if (pos !== null) {
|
|
20981
21029
|
const contentNode = editorView.state.doc.nodeAt(pos);
|
|
20982
21030
|
if (contentNode && contentNode.type === senderSchema.nodes.contentSlot) try {
|
|
20983
|
-
const from = editorView.posAtDOM(nativeRange.startContainer, nativeRange.startOffset);
|
|
20984
|
-
const to = editorView.posAtDOM(nativeRange.endContainer, nativeRange.endOffset);
|
|
20985
21031
|
const contentFrom = pos + 1;
|
|
20986
21032
|
const contentTo = pos + contentNode.nodeSize - 1;
|
|
21033
|
+
const domNodeSize = (node) => {
|
|
21034
|
+
if (node.nodeType === Node.TEXT_NODE) return node.textContent?.length ?? 0;
|
|
21035
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "BR") return 1;
|
|
21036
|
+
let size = 0;
|
|
21037
|
+
node.childNodes.forEach((child) => {
|
|
21038
|
+
size += domNodeSize(child);
|
|
21039
|
+
});
|
|
21040
|
+
return size;
|
|
21041
|
+
};
|
|
21042
|
+
const contentOffsetAt = (container, offset) => {
|
|
21043
|
+
let current = container;
|
|
21044
|
+
let result = container.nodeType === Node.TEXT_NODE ? offset : Array.from(container.childNodes).slice(0, offset).reduce((sum, child) => sum + domNodeSize(child), 0);
|
|
21045
|
+
while (current && current !== startContent) {
|
|
21046
|
+
const parent = current.parentNode;
|
|
21047
|
+
if (!parent) return null;
|
|
21048
|
+
let sibling = current.previousSibling;
|
|
21049
|
+
while (sibling) {
|
|
21050
|
+
result += domNodeSize(sibling);
|
|
21051
|
+
sibling = sibling.previousSibling;
|
|
21052
|
+
}
|
|
21053
|
+
current = parent;
|
|
21054
|
+
}
|
|
21055
|
+
return current === startContent ? result : null;
|
|
21056
|
+
};
|
|
21057
|
+
const startOffset = contentOffsetAt(nativeRange.startContainer, nativeRange.startOffset);
|
|
21058
|
+
const endOffset = contentOffsetAt(nativeRange.endContainer, nativeRange.endOffset);
|
|
21059
|
+
if (startOffset === null || endOffset === null) return false;
|
|
21060
|
+
const from = contentFrom + startOffset;
|
|
21061
|
+
const to = contentFrom + endOffset;
|
|
20987
21062
|
if (contentFrom <= from && from <= to && to <= contentTo) {
|
|
20988
21063
|
event.preventDefault();
|
|
20989
21064
|
const transaction = editorView.state.tr.delete(from, to);
|
|
@@ -21429,10 +21504,13 @@
|
|
|
21429
21504
|
});
|
|
21430
21505
|
//#endregion
|
|
21431
21506
|
//#region components/sender/components/SpeechButton/index.tsx
|
|
21507
|
+
function _isSlot$1(s) {
|
|
21508
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
21509
|
+
}
|
|
21432
21510
|
var SpeechButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
21433
21511
|
name: "SpeechButton",
|
|
21434
21512
|
inheritAttrs: false,
|
|
21435
|
-
setup(_, { attrs }) {
|
|
21513
|
+
setup(_, { attrs, slots }) {
|
|
21436
21514
|
const context = useActionButtonContext();
|
|
21437
21515
|
const mergedDisabled = (0, vue.computed)(() => {
|
|
21438
21516
|
return attrs.disabled ?? context.value.disabled ?? context.value.onSpeechDisabled;
|
|
@@ -21447,7 +21525,7 @@
|
|
|
21447
21525
|
"icon": icon.value,
|
|
21448
21526
|
"variant": "text",
|
|
21449
21527
|
"color": "primary"
|
|
21450
|
-
}, attrs, { "action": "onSpeech" }),
|
|
21528
|
+
}, attrs, { "action": "onSpeech" }), _isSlot$1(slots) ? slots : { default: () => [slots] });
|
|
21451
21529
|
}
|
|
21452
21530
|
});
|
|
21453
21531
|
//#endregion
|
package/dist/mermaid/Mermaid.js
CHANGED
|
@@ -149,6 +149,10 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
149
149
|
const mergedRenderType = computed(() => {
|
|
150
150
|
return props.renderType ?? internalRenderType.value;
|
|
151
151
|
});
|
|
152
|
+
const latestRenderRef = ref({
|
|
153
|
+
content: props.content,
|
|
154
|
+
renderType: mergedRenderType.value
|
|
155
|
+
});
|
|
152
156
|
const mergedActions = computed(() => {
|
|
153
157
|
return {
|
|
154
158
|
enableZoom: props.actions?.enableZoom ?? true,
|
|
@@ -178,23 +182,29 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
178
182
|
svgEl.style.transition = isDragging.value ? "none" : "transform 0.1s ease-out";
|
|
179
183
|
svgEl.style.cursor = isDragging.value ? "grabbing" : "grab";
|
|
180
184
|
}
|
|
185
|
+
let renderRequestId = 0;
|
|
186
|
+
let latestCommittedRequestId = 0;
|
|
181
187
|
const renderDiagram = throttle(async () => {
|
|
182
|
-
|
|
183
|
-
if (graphRef.value) graphRef.value.innerHTML = "";
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (!props.content?.trim()) return;
|
|
188
|
+
const { content, renderType } = latestRenderRef.value;
|
|
187
189
|
const graphEl = graphRef.value;
|
|
188
|
-
if (!graphEl) return;
|
|
190
|
+
if (!graphEl || renderType === RenderType.Code || !content?.trim()) return;
|
|
191
|
+
const requestId = ++renderRequestId;
|
|
189
192
|
try {
|
|
190
|
-
if (await parseMermaid(
|
|
191
|
-
const { svg } = await renderMermaid(`${renderBaseId}-${idSeed++}-${
|
|
193
|
+
if (await parseMermaid(content, { suppressErrors: true }) === false) throw new Error("Invalid Mermaid syntax");
|
|
194
|
+
const { svg } = await renderMermaid(`${renderBaseId}-${idSeed++}-${content.length || 0}`, content);
|
|
195
|
+
if (requestId <= latestCommittedRequestId) return;
|
|
192
196
|
graphEl.innerHTML = svg;
|
|
197
|
+
latestCommittedRequestId = requestId;
|
|
193
198
|
applySvgTransform();
|
|
194
199
|
} catch (error) {
|
|
200
|
+
if (requestId !== renderRequestId || latestRenderRef.value.content !== content || latestRenderRef.value.renderType !== renderType) return;
|
|
195
201
|
warning(false, "Mermaid", `Render failed: ${String(error)}`);
|
|
196
202
|
}
|
|
197
203
|
}, 100);
|
|
204
|
+
const invalidateRender = () => {
|
|
205
|
+
latestCommittedRequestId = ++renderRequestId;
|
|
206
|
+
renderDiagram.cancel();
|
|
207
|
+
};
|
|
198
208
|
function switchRenderType(nextType) {
|
|
199
209
|
if (props.renderType === void 0) internalRenderType.value = nextType;
|
|
200
210
|
emit("update:renderType", nextType);
|
|
@@ -229,7 +239,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
229
239
|
}
|
|
230
240
|
function handleZoomIn() {
|
|
231
241
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
232
|
-
scale.value =
|
|
242
|
+
scale.value = scale.value + .2;
|
|
233
243
|
}
|
|
234
244
|
function handleZoomOut() {
|
|
235
245
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
@@ -254,11 +264,26 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
254
264
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
255
265
|
const svgElement = graphRef.value?.querySelector("svg");
|
|
256
266
|
if (!svgElement) return;
|
|
257
|
-
const
|
|
267
|
+
const exportSvg = svgElement.cloneNode(true);
|
|
268
|
+
exportSvg.style.removeProperty("transform");
|
|
269
|
+
exportSvg.style.removeProperty("transform-origin");
|
|
270
|
+
exportSvg.style.removeProperty("transition");
|
|
271
|
+
exportSvg.style.removeProperty("cursor");
|
|
272
|
+
const viewBox = svgElement.viewBox.baseVal;
|
|
273
|
+
let width = viewBox.width || svgElement.width.baseVal.value;
|
|
274
|
+
let height = viewBox.height || svgElement.height.baseVal.value;
|
|
275
|
+
if (!width || !height) {
|
|
276
|
+
const bounds = svgElement.getBoundingClientRect();
|
|
277
|
+
width ||= bounds.width / scale.value;
|
|
278
|
+
height ||= bounds.height / scale.value;
|
|
279
|
+
}
|
|
280
|
+
if (!width || !height) return;
|
|
281
|
+
exportSvg.setAttribute("width", `${width}`);
|
|
282
|
+
exportSvg.setAttribute("height", `${height}`);
|
|
283
|
+
const svgString = new XMLSerializer().serializeToString(exportSvg);
|
|
258
284
|
const canvas = document.createElement("canvas");
|
|
259
285
|
const ctx = canvas.getContext("2d");
|
|
260
286
|
if (!ctx) return;
|
|
261
|
-
const { width, height } = svgElement.getBoundingClientRect();
|
|
262
287
|
const dpr = globalThis.window?.devicePixelRatio || 1;
|
|
263
288
|
canvas.width = width * dpr;
|
|
264
289
|
canvas.height = height * dpr;
|
|
@@ -358,7 +383,17 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
358
383
|
mergedRenderType,
|
|
359
384
|
() => graphRef.value
|
|
360
385
|
], () => {
|
|
361
|
-
|
|
386
|
+
latestRenderRef.value = {
|
|
387
|
+
content: props.content,
|
|
388
|
+
renderType: mergedRenderType.value
|
|
389
|
+
};
|
|
390
|
+
const graphEl = graphRef.value;
|
|
391
|
+
if (mergedRenderType.value === RenderType.Code || !props.content?.trim()) {
|
|
392
|
+
invalidateRender();
|
|
393
|
+
if (graphEl) graphEl.innerHTML = "";
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (!graphEl) return;
|
|
362
397
|
renderDiagram();
|
|
363
398
|
}, {
|
|
364
399
|
immediate: true,
|
|
@@ -380,7 +415,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
380
415
|
if (now - lastTime < 16) return;
|
|
381
416
|
lastTime = now;
|
|
382
417
|
const delta = event.deltaY > 0 ? -.1 : .1;
|
|
383
|
-
scale.value = Math.max(.5,
|
|
418
|
+
scale.value = Math.max(.5, scale.value + delta);
|
|
384
419
|
};
|
|
385
420
|
graphEl.addEventListener("wheel", wheelHandler, { passive: false });
|
|
386
421
|
onCleanup(() => {
|
|
@@ -396,7 +431,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
396
431
|
applySvgTransform();
|
|
397
432
|
}, { deep: true });
|
|
398
433
|
onBeforeUnmount(() => {
|
|
399
|
-
|
|
434
|
+
invalidateRender();
|
|
400
435
|
});
|
|
401
436
|
expose({ get nativeElement() {
|
|
402
437
|
return rootRef.value;
|
package/dist/package.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { computed, createVNode, defineComponent, inject, mergeProps, provide } from "vue";
|
|
1
|
+
import { computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide } from "vue";
|
|
2
2
|
import { Button } from "antdv-next";
|
|
3
3
|
//#region components/sender/components/ActionButton.tsx
|
|
4
|
+
function _isSlot(s) {
|
|
5
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
6
|
+
}
|
|
4
7
|
var ActionButtonContextKey = Symbol("action-button-context");
|
|
5
8
|
function useActionButtonContext() {
|
|
6
9
|
return inject(ActionButtonContextKey, computed(() => ({ prefixCls: "" })));
|
|
@@ -41,7 +44,7 @@ var ActionButton = /* @__PURE__ */ defineComponent({
|
|
|
41
44
|
default: void 0
|
|
42
45
|
}
|
|
43
46
|
},
|
|
44
|
-
setup(props, { attrs }) {
|
|
47
|
+
setup(props, { attrs, slots }) {
|
|
45
48
|
const context = useActionButtonContext();
|
|
46
49
|
const mergedDisabled = computed(() => {
|
|
47
50
|
if (props.disabled !== void 0) return props.disabled;
|
|
@@ -70,7 +73,7 @@ var ActionButton = /* @__PURE__ */ defineComponent({
|
|
|
70
73
|
if (typeof handler === "function") handler();
|
|
71
74
|
attrs.onClick?.(e);
|
|
72
75
|
}
|
|
73
|
-
}),
|
|
76
|
+
}), _isSlot(slots) ? slots : { default: () => [slots] });
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
79
|
});
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import ActionButton from "./ActionButton.js";
|
|
2
|
-
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
import { createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
3
3
|
import { ClearOutlined } from "@antdv-next/icons";
|
|
4
4
|
//#region components/sender/components/ClearButton.tsx
|
|
5
|
+
function _isSlot(s) {
|
|
6
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
7
|
+
}
|
|
5
8
|
var ClearButton_default = /* @__PURE__ */ defineComponent({
|
|
6
9
|
name: "ClearButton",
|
|
7
10
|
inheritAttrs: false,
|
|
8
|
-
setup(_, { attrs }) {
|
|
9
|
-
return () => createVNode(ActionButton, mergeProps({ "icon": createVNode(ClearOutlined, null, null) }, attrs, { "action": "onClear" }),
|
|
11
|
+
setup(_, { attrs, slots }) {
|
|
12
|
+
return () => createVNode(ActionButton, mergeProps({ "icon": createVNode(ClearOutlined, null, null) }, attrs, { "action": "onClear" }), _isSlot(slots) ? slots : { default: () => [slots] });
|
|
10
13
|
}
|
|
11
14
|
});
|
|
12
15
|
//#endregion
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import ActionButton, { useActionButtonContext } from "../ActionButton.js";
|
|
2
2
|
import StopLoading_default from "./StopLoading.js";
|
|
3
3
|
import { classNames } from "@v-c/util";
|
|
4
|
-
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
4
|
+
import { createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
5
5
|
//#region components/sender/components/LoadingButton/index.tsx
|
|
6
|
+
function _isSlot(s) {
|
|
7
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
8
|
+
}
|
|
6
9
|
var LoadingButton_default = /* @__PURE__ */ defineComponent({
|
|
7
10
|
name: "LoadingButton",
|
|
8
11
|
inheritAttrs: false,
|
|
9
|
-
setup(_, { attrs }) {
|
|
12
|
+
setup(_, { attrs, slots }) {
|
|
10
13
|
const context = useActionButtonContext();
|
|
11
14
|
return () => {
|
|
12
15
|
const { prefixCls } = context.value;
|
|
@@ -18,7 +21,7 @@ var LoadingButton_default = /* @__PURE__ */ defineComponent({
|
|
|
18
21
|
}, attrs, {
|
|
19
22
|
"class": classNames([attrs.class, `${prefixCls}-loading-button`]),
|
|
20
23
|
"action": "onCancel"
|
|
21
|
-
}),
|
|
24
|
+
}), _isSlot(slots) ? slots : { default: () => [slots] });
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
});
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import ActionButton from "./ActionButton.js";
|
|
2
|
-
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
import { createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
3
3
|
import { ArrowUpOutlined } from "@antdv-next/icons";
|
|
4
4
|
//#region components/sender/components/SendButton.tsx
|
|
5
|
+
function _isSlot(s) {
|
|
6
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
7
|
+
}
|
|
5
8
|
var SendButton_default = /* @__PURE__ */ defineComponent({
|
|
6
9
|
name: "SendButton",
|
|
7
10
|
inheritAttrs: false,
|
|
8
|
-
setup(_, { attrs }) {
|
|
11
|
+
setup(_, { attrs, slots }) {
|
|
9
12
|
return () => createVNode(ActionButton, mergeProps({
|
|
10
13
|
"icon": createVNode(ArrowUpOutlined, null, null),
|
|
11
14
|
"type": "primary",
|
|
12
15
|
"shape": "circle"
|
|
13
|
-
}, attrs, { "action": "onSend" }),
|
|
16
|
+
}, attrs, { "action": "onSend" }), _isSlot(slots) ? slots : { default: () => [slots] });
|
|
14
17
|
}
|
|
15
18
|
});
|
|
16
19
|
//#endregion
|