@antdv-next/x 1.2.3-beta.1 → 1.2.3
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 +93 -35
- package/dist/mermaid/Mermaid.js +19 -4
- 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 +1714 -1656
- 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.3
|
|
69
|
+
var version = "1.2.3";
|
|
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
|
}
|
|
@@ -7401,7 +7401,7 @@
|
|
|
7401
7401
|
}
|
|
7402
7402
|
function handleZoomIn() {
|
|
7403
7403
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
7404
|
-
scale.value =
|
|
7404
|
+
scale.value = scale.value + .2;
|
|
7405
7405
|
}
|
|
7406
7406
|
function handleZoomOut() {
|
|
7407
7407
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
@@ -7426,11 +7426,26 @@
|
|
|
7426
7426
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
7427
7427
|
const svgElement = graphRef.value?.querySelector("svg");
|
|
7428
7428
|
if (!svgElement) return;
|
|
7429
|
-
const
|
|
7429
|
+
const exportSvg = svgElement.cloneNode(true);
|
|
7430
|
+
exportSvg.style.removeProperty("transform");
|
|
7431
|
+
exportSvg.style.removeProperty("transform-origin");
|
|
7432
|
+
exportSvg.style.removeProperty("transition");
|
|
7433
|
+
exportSvg.style.removeProperty("cursor");
|
|
7434
|
+
const viewBox = svgElement.viewBox.baseVal;
|
|
7435
|
+
let width = viewBox.width || svgElement.width.baseVal.value;
|
|
7436
|
+
let height = viewBox.height || svgElement.height.baseVal.value;
|
|
7437
|
+
if (!width || !height) {
|
|
7438
|
+
const bounds = svgElement.getBoundingClientRect();
|
|
7439
|
+
width ||= bounds.width / scale.value;
|
|
7440
|
+
height ||= bounds.height / scale.value;
|
|
7441
|
+
}
|
|
7442
|
+
if (!width || !height) return;
|
|
7443
|
+
exportSvg.setAttribute("width", `${width}`);
|
|
7444
|
+
exportSvg.setAttribute("height", `${height}`);
|
|
7445
|
+
const svgString = new XMLSerializer().serializeToString(exportSvg);
|
|
7430
7446
|
const canvas = document.createElement("canvas");
|
|
7431
7447
|
const ctx = canvas.getContext("2d");
|
|
7432
7448
|
if (!ctx) return;
|
|
7433
|
-
const { width, height } = svgElement.getBoundingClientRect();
|
|
7434
7449
|
const dpr = globalThis.window?.devicePixelRatio || 1;
|
|
7435
7450
|
canvas.width = width * dpr;
|
|
7436
7451
|
canvas.height = height * dpr;
|
|
@@ -7552,7 +7567,7 @@
|
|
|
7552
7567
|
if (now - lastTime < 16) return;
|
|
7553
7568
|
lastTime = now;
|
|
7554
7569
|
const delta = event.deltaY > 0 ? -.1 : .1;
|
|
7555
|
-
scale.value = Math.max(.5,
|
|
7570
|
+
scale.value = Math.max(.5, scale.value + delta);
|
|
7556
7571
|
};
|
|
7557
7572
|
graphEl.addEventListener("wheel", wheelHandler, { passive: false });
|
|
7558
7573
|
onCleanup(() => {
|
|
@@ -8032,6 +8047,9 @@
|
|
|
8032
8047
|
});
|
|
8033
8048
|
//#endregion
|
|
8034
8049
|
//#region components/sender/components/ActionButton.tsx
|
|
8050
|
+
function _isSlot$6(s) {
|
|
8051
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8052
|
+
}
|
|
8035
8053
|
var ActionButtonContextKey = Symbol("action-button-context");
|
|
8036
8054
|
function useActionButtonContext() {
|
|
8037
8055
|
return (0, vue.inject)(ActionButtonContextKey, (0, vue.computed)(() => ({ prefixCls: "" })));
|
|
@@ -8072,7 +8090,7 @@
|
|
|
8072
8090
|
default: void 0
|
|
8073
8091
|
}
|
|
8074
8092
|
},
|
|
8075
|
-
setup(props, { attrs }) {
|
|
8093
|
+
setup(props, { attrs, slots }) {
|
|
8076
8094
|
const context = useActionButtonContext();
|
|
8077
8095
|
const mergedDisabled = (0, vue.computed)(() => {
|
|
8078
8096
|
if (props.disabled !== void 0) return props.disabled;
|
|
@@ -8101,17 +8119,20 @@
|
|
|
8101
8119
|
if (typeof handler === "function") handler();
|
|
8102
8120
|
attrs.onClick?.(e);
|
|
8103
8121
|
}
|
|
8104
|
-
}),
|
|
8122
|
+
}), _isSlot$6(slots) ? slots : { default: () => [slots] });
|
|
8105
8123
|
};
|
|
8106
8124
|
}
|
|
8107
8125
|
});
|
|
8108
8126
|
//#endregion
|
|
8109
8127
|
//#region components/sender/components/ClearButton.tsx
|
|
8128
|
+
function _isSlot$5(s) {
|
|
8129
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8130
|
+
}
|
|
8110
8131
|
var ClearButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8111
8132
|
name: "ClearButton",
|
|
8112
8133
|
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" }),
|
|
8134
|
+
setup(_, { attrs, slots }) {
|
|
8135
|
+
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
8136
|
}
|
|
8116
8137
|
});
|
|
8117
8138
|
//#endregion
|
|
@@ -8170,10 +8191,13 @@
|
|
|
8170
8191
|
});
|
|
8171
8192
|
//#endregion
|
|
8172
8193
|
//#region components/sender/components/LoadingButton/index.tsx
|
|
8194
|
+
function _isSlot$4(s) {
|
|
8195
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8196
|
+
}
|
|
8173
8197
|
var LoadingButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8174
8198
|
name: "LoadingButton",
|
|
8175
8199
|
inheritAttrs: false,
|
|
8176
|
-
setup(_, { attrs }) {
|
|
8200
|
+
setup(_, { attrs, slots }) {
|
|
8177
8201
|
const context = useActionButtonContext();
|
|
8178
8202
|
return () => {
|
|
8179
8203
|
const { prefixCls } = context.value;
|
|
@@ -8185,21 +8209,24 @@
|
|
|
8185
8209
|
}, attrs, {
|
|
8186
8210
|
"class": (0, _v_c_util.classNames)([attrs.class, `${prefixCls}-loading-button`]),
|
|
8187
8211
|
"action": "onCancel"
|
|
8188
|
-
}),
|
|
8212
|
+
}), _isSlot$4(slots) ? slots : { default: () => [slots] });
|
|
8189
8213
|
};
|
|
8190
8214
|
}
|
|
8191
8215
|
});
|
|
8192
8216
|
//#endregion
|
|
8193
8217
|
//#region components/sender/components/SendButton.tsx
|
|
8218
|
+
function _isSlot$3(s) {
|
|
8219
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
8220
|
+
}
|
|
8194
8221
|
var SendButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8195
8222
|
name: "SendButton",
|
|
8196
8223
|
inheritAttrs: false,
|
|
8197
|
-
setup(_, { attrs }) {
|
|
8224
|
+
setup(_, { attrs, slots }) {
|
|
8198
8225
|
return () => (0, vue.createVNode)(ActionButton, (0, vue.mergeProps)({
|
|
8199
8226
|
"icon": (0, vue.createVNode)(_antdv_next_icons.ArrowUpOutlined, null, null),
|
|
8200
8227
|
"type": "primary",
|
|
8201
8228
|
"shape": "circle"
|
|
8202
|
-
}, attrs, { "action": "onSend" }),
|
|
8229
|
+
}, attrs, { "action": "onSend" }), _isSlot$3(slots) ? slots : { default: () => [slots] });
|
|
8203
8230
|
}
|
|
8204
8231
|
});
|
|
8205
8232
|
//#endregion
|
|
@@ -20162,7 +20189,7 @@
|
|
|
20162
20189
|
}
|
|
20163
20190
|
//#endregion
|
|
20164
20191
|
//#region components/sender/components/Skill.tsx
|
|
20165
|
-
function _isSlot$
|
|
20192
|
+
function _isSlot$2(s) {
|
|
20166
20193
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
20167
20194
|
}
|
|
20168
20195
|
var Skill_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -20231,7 +20258,7 @@
|
|
|
20231
20258
|
});
|
|
20232
20259
|
return () => {
|
|
20233
20260
|
const mergeTitle = props.skill.title ?? props.skill.value;
|
|
20234
|
-
const titleNode = props.skill.toolTip ? (0, vue.createVNode)(antdv_next.Tooltip, props.skill.toolTip, _isSlot$
|
|
20261
|
+
const titleNode = props.skill.toolTip ? (0, vue.createVNode)(antdv_next.Tooltip, props.skill.toolTip, _isSlot$2(mergeTitle) ? mergeTitle : { default: () => [mergeTitle] }) : mergeTitle;
|
|
20235
20262
|
return (0, vue.createVNode)("div", {
|
|
20236
20263
|
"class": `${componentCls.value}-wrapper`,
|
|
20237
20264
|
"contenteditable": false
|
|
@@ -20499,10 +20526,10 @@
|
|
|
20499
20526
|
(type === "copy" ? senderCtx.value.onCopy : senderCtx.value.onCut)?.(event, info);
|
|
20500
20527
|
if (event.defaultPrevented) return true;
|
|
20501
20528
|
if (type === "copy" && !slice && !payloadText) return false;
|
|
20529
|
+
if (type === "cut" && isLocked()) return true;
|
|
20502
20530
|
try {
|
|
20503
20531
|
event.clipboardData?.setData("text/plain", payloadText);
|
|
20504
20532
|
} catch {}
|
|
20505
|
-
if (type === "cut" && isLocked()) return true;
|
|
20506
20533
|
if (type === "cut" && slice) {
|
|
20507
20534
|
flushDom();
|
|
20508
20535
|
syncSelectionFromDom();
|
|
@@ -20648,7 +20675,8 @@
|
|
|
20648
20675
|
skill: void 0
|
|
20649
20676
|
};
|
|
20650
20677
|
senderCtx.value.onPaste?.(event, info);
|
|
20651
|
-
if (!event.defaultPrevented)
|
|
20678
|
+
if (!event.defaultPrevented) if (isLocked()) event.preventDefault();
|
|
20679
|
+
else routePasteEvent(event);
|
|
20652
20680
|
},
|
|
20653
20681
|
"onCopy": (event) => {
|
|
20654
20682
|
routeControlCopyOrCut(event, "copy");
|
|
@@ -20980,10 +21008,37 @@
|
|
|
20980
21008
|
if (pos !== null) {
|
|
20981
21009
|
const contentNode = editorView.state.doc.nodeAt(pos);
|
|
20982
21010
|
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
21011
|
const contentFrom = pos + 1;
|
|
20986
21012
|
const contentTo = pos + contentNode.nodeSize - 1;
|
|
21013
|
+
const domNodeSize = (node) => {
|
|
21014
|
+
if (node.nodeType === Node.TEXT_NODE) return node.textContent?.length ?? 0;
|
|
21015
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "BR") return 1;
|
|
21016
|
+
let size = 0;
|
|
21017
|
+
node.childNodes.forEach((child) => {
|
|
21018
|
+
size += domNodeSize(child);
|
|
21019
|
+
});
|
|
21020
|
+
return size;
|
|
21021
|
+
};
|
|
21022
|
+
const contentOffsetAt = (container, offset) => {
|
|
21023
|
+
let current = container;
|
|
21024
|
+
let result = container.nodeType === Node.TEXT_NODE ? offset : Array.from(container.childNodes).slice(0, offset).reduce((sum, child) => sum + domNodeSize(child), 0);
|
|
21025
|
+
while (current && current !== startContent) {
|
|
21026
|
+
const parent = current.parentNode;
|
|
21027
|
+
if (!parent) return null;
|
|
21028
|
+
let sibling = current.previousSibling;
|
|
21029
|
+
while (sibling) {
|
|
21030
|
+
result += domNodeSize(sibling);
|
|
21031
|
+
sibling = sibling.previousSibling;
|
|
21032
|
+
}
|
|
21033
|
+
current = parent;
|
|
21034
|
+
}
|
|
21035
|
+
return current === startContent ? result : null;
|
|
21036
|
+
};
|
|
21037
|
+
const startOffset = contentOffsetAt(nativeRange.startContainer, nativeRange.startOffset);
|
|
21038
|
+
const endOffset = contentOffsetAt(nativeRange.endContainer, nativeRange.endOffset);
|
|
21039
|
+
if (startOffset === null || endOffset === null) return false;
|
|
21040
|
+
const from = contentFrom + startOffset;
|
|
21041
|
+
const to = contentFrom + endOffset;
|
|
20987
21042
|
if (contentFrom <= from && from <= to && to <= contentTo) {
|
|
20988
21043
|
event.preventDefault();
|
|
20989
21044
|
const transaction = editorView.state.tr.delete(from, to);
|
|
@@ -21429,10 +21484,13 @@
|
|
|
21429
21484
|
});
|
|
21430
21485
|
//#endregion
|
|
21431
21486
|
//#region components/sender/components/SpeechButton/index.tsx
|
|
21487
|
+
function _isSlot$1(s) {
|
|
21488
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
21489
|
+
}
|
|
21432
21490
|
var SpeechButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
21433
21491
|
name: "SpeechButton",
|
|
21434
21492
|
inheritAttrs: false,
|
|
21435
|
-
setup(_, { attrs }) {
|
|
21493
|
+
setup(_, { attrs, slots }) {
|
|
21436
21494
|
const context = useActionButtonContext();
|
|
21437
21495
|
const mergedDisabled = (0, vue.computed)(() => {
|
|
21438
21496
|
return attrs.disabled ?? context.value.disabled ?? context.value.onSpeechDisabled;
|
|
@@ -21447,7 +21505,7 @@
|
|
|
21447
21505
|
"icon": icon.value,
|
|
21448
21506
|
"variant": "text",
|
|
21449
21507
|
"color": "primary"
|
|
21450
|
-
}, attrs, { "action": "onSpeech" }),
|
|
21508
|
+
}, attrs, { "action": "onSpeech" }), _isSlot$1(slots) ? slots : { default: () => [slots] });
|
|
21451
21509
|
}
|
|
21452
21510
|
});
|
|
21453
21511
|
//#endregion
|
package/dist/mermaid/Mermaid.js
CHANGED
|
@@ -229,7 +229,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
229
229
|
}
|
|
230
230
|
function handleZoomIn() {
|
|
231
231
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
232
|
-
scale.value =
|
|
232
|
+
scale.value = scale.value + .2;
|
|
233
233
|
}
|
|
234
234
|
function handleZoomOut() {
|
|
235
235
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
@@ -254,11 +254,26 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
254
254
|
if (mergedRenderType.value !== RenderType.Image) return;
|
|
255
255
|
const svgElement = graphRef.value?.querySelector("svg");
|
|
256
256
|
if (!svgElement) return;
|
|
257
|
-
const
|
|
257
|
+
const exportSvg = svgElement.cloneNode(true);
|
|
258
|
+
exportSvg.style.removeProperty("transform");
|
|
259
|
+
exportSvg.style.removeProperty("transform-origin");
|
|
260
|
+
exportSvg.style.removeProperty("transition");
|
|
261
|
+
exportSvg.style.removeProperty("cursor");
|
|
262
|
+
const viewBox = svgElement.viewBox.baseVal;
|
|
263
|
+
let width = viewBox.width || svgElement.width.baseVal.value;
|
|
264
|
+
let height = viewBox.height || svgElement.height.baseVal.value;
|
|
265
|
+
if (!width || !height) {
|
|
266
|
+
const bounds = svgElement.getBoundingClientRect();
|
|
267
|
+
width ||= bounds.width / scale.value;
|
|
268
|
+
height ||= bounds.height / scale.value;
|
|
269
|
+
}
|
|
270
|
+
if (!width || !height) return;
|
|
271
|
+
exportSvg.setAttribute("width", `${width}`);
|
|
272
|
+
exportSvg.setAttribute("height", `${height}`);
|
|
273
|
+
const svgString = new XMLSerializer().serializeToString(exportSvg);
|
|
258
274
|
const canvas = document.createElement("canvas");
|
|
259
275
|
const ctx = canvas.getContext("2d");
|
|
260
276
|
if (!ctx) return;
|
|
261
|
-
const { width, height } = svgElement.getBoundingClientRect();
|
|
262
277
|
const dpr = globalThis.window?.devicePixelRatio || 1;
|
|
263
278
|
canvas.width = width * dpr;
|
|
264
279
|
canvas.height = height * dpr;
|
|
@@ -380,7 +395,7 @@ var XMermaid = /* @__PURE__ */ defineComponent({
|
|
|
380
395
|
if (now - lastTime < 16) return;
|
|
381
396
|
lastTime = now;
|
|
382
397
|
const delta = event.deltaY > 0 ? -.1 : .1;
|
|
383
|
-
scale.value = Math.max(.5,
|
|
398
|
+
scale.value = Math.max(.5, scale.value + delta);
|
|
384
399
|
};
|
|
385
400
|
graphEl.addEventListener("wheel", wheelHandler, { passive: false });
|
|
386
401
|
onCleanup(() => {
|
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
|
|
@@ -265,10 +265,10 @@ var SlotTextAreaProseMirror_default = /* @__PURE__ */ defineComponent({
|
|
|
265
265
|
(type === "copy" ? senderCtx.value.onCopy : senderCtx.value.onCut)?.(event, info);
|
|
266
266
|
if (event.defaultPrevented) return true;
|
|
267
267
|
if (type === "copy" && !slice && !payloadText) return false;
|
|
268
|
+
if (type === "cut" && isLocked()) return true;
|
|
268
269
|
try {
|
|
269
270
|
event.clipboardData?.setData("text/plain", payloadText);
|
|
270
271
|
} catch {}
|
|
271
|
-
if (type === "cut" && isLocked()) return true;
|
|
272
272
|
if (type === "cut" && slice) {
|
|
273
273
|
flushDom();
|
|
274
274
|
syncSelectionFromDom();
|
|
@@ -414,7 +414,8 @@ var SlotTextAreaProseMirror_default = /* @__PURE__ */ defineComponent({
|
|
|
414
414
|
skill: void 0
|
|
415
415
|
};
|
|
416
416
|
senderCtx.value.onPaste?.(event, info);
|
|
417
|
-
if (!event.defaultPrevented)
|
|
417
|
+
if (!event.defaultPrevented) if (isLocked()) event.preventDefault();
|
|
418
|
+
else routePasteEvent(event);
|
|
418
419
|
},
|
|
419
420
|
"onCopy": (event) => {
|
|
420
421
|
routeControlCopyOrCut(event, "copy");
|
|
@@ -746,10 +747,37 @@ var SlotTextAreaProseMirror_default = /* @__PURE__ */ defineComponent({
|
|
|
746
747
|
if (pos !== null) {
|
|
747
748
|
const contentNode = editorView.state.doc.nodeAt(pos);
|
|
748
749
|
if (contentNode && contentNode.type === senderSchema.nodes.contentSlot) try {
|
|
749
|
-
const from = editorView.posAtDOM(nativeRange.startContainer, nativeRange.startOffset);
|
|
750
|
-
const to = editorView.posAtDOM(nativeRange.endContainer, nativeRange.endOffset);
|
|
751
750
|
const contentFrom = pos + 1;
|
|
752
751
|
const contentTo = pos + contentNode.nodeSize - 1;
|
|
752
|
+
const domNodeSize = (node) => {
|
|
753
|
+
if (node.nodeType === Node.TEXT_NODE) return node.textContent?.length ?? 0;
|
|
754
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "BR") return 1;
|
|
755
|
+
let size = 0;
|
|
756
|
+
node.childNodes.forEach((child) => {
|
|
757
|
+
size += domNodeSize(child);
|
|
758
|
+
});
|
|
759
|
+
return size;
|
|
760
|
+
};
|
|
761
|
+
const contentOffsetAt = (container, offset) => {
|
|
762
|
+
let current = container;
|
|
763
|
+
let result = container.nodeType === Node.TEXT_NODE ? offset : Array.from(container.childNodes).slice(0, offset).reduce((sum, child) => sum + domNodeSize(child), 0);
|
|
764
|
+
while (current && current !== startContent) {
|
|
765
|
+
const parent = current.parentNode;
|
|
766
|
+
if (!parent) return null;
|
|
767
|
+
let sibling = current.previousSibling;
|
|
768
|
+
while (sibling) {
|
|
769
|
+
result += domNodeSize(sibling);
|
|
770
|
+
sibling = sibling.previousSibling;
|
|
771
|
+
}
|
|
772
|
+
current = parent;
|
|
773
|
+
}
|
|
774
|
+
return current === startContent ? result : null;
|
|
775
|
+
};
|
|
776
|
+
const startOffset = contentOffsetAt(nativeRange.startContainer, nativeRange.startOffset);
|
|
777
|
+
const endOffset = contentOffsetAt(nativeRange.endContainer, nativeRange.endOffset);
|
|
778
|
+
if (startOffset === null || endOffset === null) return false;
|
|
779
|
+
const from = contentFrom + startOffset;
|
|
780
|
+
const to = contentFrom + endOffset;
|
|
753
781
|
if (contentFrom <= from && from <= to && to <= contentTo) {
|
|
754
782
|
event.preventDefault();
|
|
755
783
|
const transaction = editorView.state.tr.delete(from, to);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import ActionButton, { useActionButtonContext } from "../ActionButton.js";
|
|
2
2
|
import RecordingIcon_default from "./RecordingIcon.js";
|
|
3
|
-
import { computed, createVNode, defineComponent, mergeProps } from "vue";
|
|
3
|
+
import { computed, createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
4
4
|
import { AudioMutedOutlined, AudioOutlined } from "@antdv-next/icons";
|
|
5
5
|
//#region components/sender/components/SpeechButton/index.tsx
|
|
6
|
+
function _isSlot(s) {
|
|
7
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
8
|
+
}
|
|
6
9
|
var SpeechButton_default = /* @__PURE__ */ defineComponent({
|
|
7
10
|
name: "SpeechButton",
|
|
8
11
|
inheritAttrs: false,
|
|
9
|
-
setup(_, { attrs }) {
|
|
12
|
+
setup(_, { attrs, slots }) {
|
|
10
13
|
const context = useActionButtonContext();
|
|
11
14
|
const mergedDisabled = computed(() => {
|
|
12
15
|
return attrs.disabled ?? context.value.disabled ?? context.value.onSpeechDisabled;
|
|
@@ -21,7 +24,7 @@ var SpeechButton_default = /* @__PURE__ */ defineComponent({
|
|
|
21
24
|
"icon": icon.value,
|
|
22
25
|
"variant": "text",
|
|
23
26
|
"color": "primary"
|
|
24
|
-
}, attrs, { "action": "onSpeech" }),
|
|
27
|
+
}, attrs, { "action": "onSpeech" }), _isSlot(slots) ? slots : { default: () => [slots] });
|
|
25
28
|
}
|
|
26
29
|
});
|
|
27
30
|
//#endregion
|