@opentiny/tiny-robot 0.2.0-alpha.0 → 0.2.0-alpha.2
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/action-group/ActionGroup.vue.d.ts +26 -0
- package/dist/action-group/ActionGroupItem.vue.d.ts +18 -0
- package/dist/action-group/index.d.ts +12 -0
- package/dist/action-group/index.type.d.ts +17 -0
- package/dist/bubble/index.d.ts +2 -2
- package/dist/bubble/index.type.d.ts +16 -18
- package/dist/feedback/components/SourceList.vue.d.ts +11 -0
- package/dist/feedback/components/index.d.ts +1 -0
- package/dist/feedback/index.d.ts +7 -0
- package/dist/feedback/index.type.d.ts +25 -0
- package/dist/feedback/index.vue.d.ts +13 -0
- package/dist/history/components/index.d.ts +2 -0
- package/dist/history/components/item-tag.vue.d.ts +5 -0
- package/dist/history/components/search-empty.vue.d.ts +7 -0
- package/dist/history/composables/index.d.ts +1 -0
- package/dist/history/composables/useEditItemTitle.d.ts +12 -0
- package/dist/history/index.d.ts +6 -0
- package/dist/history/index.type.d.ts +43 -0
- package/dist/history/index.vue.d.ts +2 -0
- package/dist/icon-button/index.d.ts +7 -0
- package/dist/icon-button/index.type.d.ts +6 -0
- package/dist/icon-button/index.vue.d.ts +6 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +57 -27
- package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +1335 -884
- package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +660 -144
- package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +85 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-locale@3.22.0/node_modules/@opentiny/vue-locale/lib/index.js +1783 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/index.js +77 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +90 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/index.js +176 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/pc.js +248 -0
- package/dist/node_modules/.pnpm/@vueuse_core@13.1.0_vue@3.5.13/node_modules/@vueuse/core/index.js +310 -0
- package/dist/node_modules/.pnpm/@vueuse_shared@13.1.0_vue@3.5.13/node_modules/@vueuse/shared/index.js +110 -0
- package/dist/packages/components/src/action-group/ActionGroup.vue.js +7 -0
- package/dist/packages/components/src/action-group/ActionGroup.vue2.js +121 -0
- package/dist/packages/components/src/action-group/ActionGroupItem.vue.js +14 -0
- package/dist/packages/components/src/action-group/ActionGroupItem.vue2.js +4 -0
- package/dist/packages/components/src/action-group/index.js +17 -0
- package/dist/packages/components/src/bubble/Bubble.vue.js +7 -0
- package/dist/packages/components/src/bubble/Bubble.vue2.js +76 -0
- package/dist/packages/components/src/bubble/BubbleList.vue.js +7 -0
- package/dist/packages/components/src/bubble/BubbleList.vue2.js +50 -0
- package/dist/packages/components/src/bubble/index.js +2 -2
- package/dist/packages/components/src/container/index.vue.js +2 -2
- package/dist/packages/components/src/container/index.vue2.js +36 -36
- package/dist/packages/components/src/feedback/components/SourceList.vue.js +7 -0
- package/dist/packages/components/src/feedback/components/SourceList.vue2.js +52 -0
- package/dist/packages/components/src/feedback/index.js +9 -0
- package/dist/packages/components/src/feedback/index.vue.js +7 -0
- package/dist/packages/components/src/feedback/index.vue2.js +143 -0
- package/dist/packages/components/src/history/components/item-tag.vue.js +7 -0
- package/dist/packages/components/src/history/components/item-tag.vue2.js +21 -0
- package/dist/packages/components/src/history/components/search-empty.vue.js +7 -0
- package/dist/packages/components/src/history/components/search-empty.vue2.js +20 -0
- package/dist/packages/components/src/history/composables/useEditItemTitle.js +43 -0
- package/dist/packages/components/src/history/index.js +11 -0
- package/dist/packages/components/src/history/index.vue.js +7 -0
- package/dist/packages/components/src/history/index.vue2.js +130 -0
- package/dist/packages/components/src/icon-button/index.js +9 -0
- package/dist/packages/components/src/icon-button/index.vue.js +7 -0
- package/dist/packages/components/src/icon-button/index.vue2.js +22 -0
- package/dist/packages/components/src/prompts/prompt.vue.js +2 -2
- package/dist/packages/components/src/prompts/prompt.vue2.js +17 -15
- package/dist/packages/components/src/question/components/HotQuestions.vue.js +23 -23
- package/dist/packages/components/src/question/index.vue.js +18 -18
- package/dist/packages/components/src/sender/components/TemplateEditor.vue.js +7 -0
- package/dist/packages/components/src/sender/components/TemplateEditor.vue2.js +175 -0
- package/dist/packages/components/src/sender/index.vue.js +149 -128
- package/dist/packages/components/src/suggestion/components/CategoryNav.vue.js +38 -0
- package/dist/packages/components/src/suggestion/components/CategoryNav.vue2.js +4 -0
- package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue.js +107 -0
- package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue2.js +4 -0
- package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue.js +123 -0
- package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue2.js +4 -0
- package/dist/packages/components/src/suggestion/composables/useKeyboardNavigation.js +45 -0
- package/dist/packages/components/src/suggestion/composables/useTriggerDetection.js +17 -0
- package/dist/packages/components/src/suggestion/index.js +9 -0
- package/dist/packages/components/src/suggestion/index.vue.js +179 -0
- package/dist/packages/components/src/suggestion/index.vue2.js +4 -0
- package/dist/packages/components/src/suggestion/utils/dom.js +18 -0
- package/dist/packages/svgs/dist/tiny-robot-svgs.js +306 -90
- package/dist/question/components/HotQuestions.vue.d.ts +2 -2
- package/dist/sender/components/TemplateEditor.vue.d.ts +18 -0
- package/dist/sender/index.type.d.ts +47 -0
- package/dist/sender/index.vue.d.ts +70 -5
- package/dist/style.css +1 -1
- package/dist/suggestion/components/CategoryNav.vue.d.ts +45 -0
- package/dist/suggestion/components/SuggestionCapsule.vue.d.ts +32 -0
- package/dist/suggestion/components/SuggestionPanel.vue.d.ts +84 -0
- package/dist/suggestion/composables/useKeyboardNavigation.d.ts +18 -0
- package/dist/suggestion/composables/useSuggestionFilter.d.ts +10 -0
- package/dist/suggestion/composables/useTriggerDetection.d.ts +11 -0
- package/dist/suggestion/index.d.ts +7 -0
- package/dist/suggestion/index.type.d.ts +94 -0
- package/dist/suggestion/index.vue.d.ts +343 -0
- package/dist/suggestion/utils/dom.d.ts +20 -0
- package/package.json +4 -3
- package/src/action-group/ActionGroup.vue +247 -0
- package/src/action-group/ActionGroupItem.vue +9 -0
- package/src/action-group/index.ts +25 -0
- package/src/action-group/index.type.ts +21 -0
- package/src/bubble/Bubble.vue +153 -0
- package/src/bubble/BubbleList.vue +55 -0
- package/src/bubble/index.ts +2 -2
- package/src/bubble/index.type.ts +7 -21
- package/src/container/index.vue +10 -36
- package/src/feedback/components/SourceList.vue +112 -0
- package/src/feedback/components/index.ts +1 -0
- package/src/feedback/index.ts +12 -0
- package/src/feedback/index.type.ts +27 -0
- package/src/feedback/index.vue +166 -0
- package/src/history/components/index.ts +2 -0
- package/src/history/components/item-tag.vue +49 -0
- package/src/history/components/search-empty.vue +38 -0
- package/src/history/composables/index.ts +1 -0
- package/src/history/composables/useEditItemTitle.ts +75 -0
- package/src/history/index.ts +12 -0
- package/src/history/index.type.ts +50 -0
- package/src/history/index.vue +292 -0
- package/src/icon-button/index.ts +12 -0
- package/src/icon-button/index.type.ts +7 -0
- package/src/icon-button/index.vue +58 -0
- package/src/index.ts +33 -1
- package/src/prompts/prompt.vue +7 -21
- package/src/question/components/HotQuestions.vue +1 -1
- package/src/question/index.less +9 -10
- package/src/sender/components/TemplateEditor.vue +465 -0
- package/src/sender/index.less +17 -7
- package/src/sender/index.type.ts +51 -0
- package/src/sender/index.vue +56 -8
- package/src/sender/vars.less +3 -3
- package/src/suggestion/components/CategoryNav.vue +38 -0
- package/src/suggestion/components/SuggestionCapsule.vue +183 -0
- package/src/suggestion/components/SuggestionPanel.vue +147 -0
- package/src/suggestion/composables/useKeyboardNavigation.ts +101 -0
- package/src/suggestion/composables/useSuggestionFilter.ts +34 -0
- package/src/suggestion/composables/useTriggerDetection.ts +46 -0
- package/src/suggestion/index.less +497 -0
- package/src/suggestion/index.ts +12 -0
- package/src/suggestion/index.type.ts +101 -0
- package/src/suggestion/index.vue +338 -0
- package/src/suggestion/utils/dom.ts +66 -0
- package/src/suggestion/vars.less +141 -0
- package/dist/bubble/components/actions/copy.vue.d.ts +0 -10
- package/dist/bubble/components/actions/index.d.ts +0 -2
- package/dist/bubble/components/actions/refresh.vue.d.ts +0 -2
- package/dist/bubble/useScroll.d.ts +0 -4
- package/dist/packages/components/src/bubble/bubble-list.vue.js +0 -7
- package/dist/packages/components/src/bubble/bubble-list.vue2.js +0 -37
- package/dist/packages/components/src/bubble/bubble.vue.js +0 -7
- package/dist/packages/components/src/bubble/bubble.vue2.js +0 -118
- package/dist/packages/components/src/bubble/components/actions/copy.vue.js +0 -7
- package/dist/packages/components/src/bubble/components/actions/copy.vue2.js +0 -35
- package/dist/packages/components/src/bubble/components/actions/refresh.vue.js +0 -7
- package/dist/packages/components/src/bubble/components/actions/refresh.vue2.js +0 -16
- package/dist/packages/components/src/bubble/useScroll.js +0 -13
- package/src/bubble/bubble-list.vue +0 -42
- package/src/bubble/bubble.vue +0 -247
- package/src/bubble/components/actions/copy.vue +0 -54
- package/src/bubble/components/actions/index.ts +0 -2
- package/src/bubble/components/actions/refresh.vue +0 -31
- package/src/bubble/useScroll.ts +0 -14
- /package/dist/bubble/{bubble-list.vue.d.ts → BubbleList.vue.d.ts} +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ref as v, watch as g } from "vue";
|
|
2
|
+
function i(l, a = {}) {
|
|
3
|
+
const t = v(a.initialIndex || -1);
|
|
4
|
+
g(l, (e) => {
|
|
5
|
+
e.length > 0 && t.value === -1 ? t.value = 0 : e.length === 0 ? t.value = -1 : t.value >= e.length && (t.value = e.length - 1);
|
|
6
|
+
});
|
|
7
|
+
const o = (e) => {
|
|
8
|
+
var n, u;
|
|
9
|
+
if (l.value.length !== 0)
|
|
10
|
+
switch (e.key) {
|
|
11
|
+
case "ArrowUp":
|
|
12
|
+
e.preventDefault(), t.value = (t.value - 1 + l.value.length) % l.value.length, r();
|
|
13
|
+
break;
|
|
14
|
+
case "ArrowDown":
|
|
15
|
+
e.preventDefault(), t.value = (t.value + 1) % l.value.length, r();
|
|
16
|
+
break;
|
|
17
|
+
case "Enter":
|
|
18
|
+
case "Tab":
|
|
19
|
+
e.preventDefault(), t.value >= 0 && t.value < l.value.length && ((n = a.onSelect) == null || n.call(a, l.value[t.value]));
|
|
20
|
+
break;
|
|
21
|
+
case "Escape":
|
|
22
|
+
e.preventDefault(), (u = a.onClose) == null || u.call(a);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}, r = () => {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
const e = document.querySelector(`.tr-suggestion-list-item:nth-child(${t.value + 1})`), n = e == null ? void 0 : e.closest(".tr-suggestion-content");
|
|
28
|
+
if (e && n) {
|
|
29
|
+
const u = n.getBoundingClientRect(), c = e.getBoundingClientRect();
|
|
30
|
+
c.bottom > u.bottom ? n.scrollTop += c.bottom - u.bottom : c.top < u.top && (n.scrollTop -= u.top - c.top);
|
|
31
|
+
}
|
|
32
|
+
}, 0);
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
activeIndex: t,
|
|
36
|
+
handleKeyDown: o,
|
|
37
|
+
scrollToActive: r,
|
|
38
|
+
setActiveIndex: (e) => {
|
|
39
|
+
e >= -1 && e < l.value.length && (t.value = e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
i as useKeyboardNavigation
|
|
45
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const c = (i) => {
|
|
2
|
+
const n = (t) => i.triggerKeys.includes(t);
|
|
3
|
+
return {
|
|
4
|
+
isTriggerKey: n,
|
|
5
|
+
detectTrigger: (t, e) => {
|
|
6
|
+
const r = t.target.selectionStart || 0;
|
|
7
|
+
return r > 0 && n(e[r - 1]) && (r === 1 || e[r - 2] === " " || e[r - 2] === `
|
|
8
|
+
`) ? {
|
|
9
|
+
text: e[r - 1],
|
|
10
|
+
position: r - 1
|
|
11
|
+
} : null;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
c as useTriggerDetection
|
|
17
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { defineComponent as q, ref as l, computed as N, watch as w, onMounted as F, onBeforeUnmount as G, resolveComponent as J, createElementBlock as T, openBlock as f, normalizeClass as W, createElementVNode as y, renderSlot as a, createBlock as O, createCommentVNode as K, createVNode as h, unref as k, withCtx as u } from "vue";
|
|
2
|
+
import X from "./components/SuggestionCapsule.vue.js";
|
|
3
|
+
import Y from "./components/SuggestionPanel.vue.js";
|
|
4
|
+
import { useTriggerDetection as Z } from "./composables/useTriggerDetection.js";
|
|
5
|
+
import { IconHotQuestion as R, IconArrowUp as ee, IconArrowDown as te } from "../../../svgs/dist/tiny-robot-svgs.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const ne = { class: "tr-suggestion__header" }, ue = /* @__PURE__ */ q({
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: {
|
|
10
|
+
triggerKeys: { default: () => ["/"] },
|
|
11
|
+
items: { default: () => [] },
|
|
12
|
+
categories: { default: () => [] },
|
|
13
|
+
open: { type: Boolean, default: void 0 },
|
|
14
|
+
className: {},
|
|
15
|
+
theme: { default: "light" },
|
|
16
|
+
loading: { type: Boolean, default: !1 },
|
|
17
|
+
closeOnOutsideClick: { type: Boolean, default: !0 },
|
|
18
|
+
title: { default: "快捷指令" },
|
|
19
|
+
maxVisibleItems: { default: 5 },
|
|
20
|
+
defaultExpanded: { type: Boolean, default: !1 }
|
|
21
|
+
},
|
|
22
|
+
emits: ["update:open", "select", "close", "trigger", "category-select", "suggestion-select", "update:expanded", "fill-template"],
|
|
23
|
+
setup(z, { expose: A, emit: L }) {
|
|
24
|
+
const t = z, n = L, m = l(!1), C = l([]), I = l({
|
|
25
|
+
text: "",
|
|
26
|
+
position: 0
|
|
27
|
+
}), c = l(t.defaultExpanded), B = l(!1), S = () => {
|
|
28
|
+
c.value = !c.value, n("update:expanded", c.value);
|
|
29
|
+
}, Q = (e) => {
|
|
30
|
+
B.value = e;
|
|
31
|
+
}, d = l(""), s = l(-1), x = l(null), E = l(null), i = N(() => t.open !== void 0 ? t.open : m.value), $ = N(() => {
|
|
32
|
+
if (t.categories.length === 0 || !d.value)
|
|
33
|
+
return C.value;
|
|
34
|
+
const e = t.categories.find((o) => o.id === d.value);
|
|
35
|
+
return e ? e.items : [];
|
|
36
|
+
});
|
|
37
|
+
w(i, (e) => {
|
|
38
|
+
e ? s.value = $.value.length > 0 ? 0 : -1 : s.value = -1;
|
|
39
|
+
}), w($, (e) => {
|
|
40
|
+
e.length > 0 && s.value === -1 ? s.value = 0 : e.length === 0 ? s.value = -1 : s.value >= e.length && (s.value = e.length - 1);
|
|
41
|
+
}), w(
|
|
42
|
+
() => t.categories,
|
|
43
|
+
(e) => {
|
|
44
|
+
e.length > 0 && !d.value && (d.value = e[0].id);
|
|
45
|
+
},
|
|
46
|
+
{ immediate: !0 }
|
|
47
|
+
);
|
|
48
|
+
const b = () => {
|
|
49
|
+
C.value = [...t.items];
|
|
50
|
+
}, { detectTrigger: U } = Z(t), j = (e) => {
|
|
51
|
+
n("suggestion-select", e), n("select", e.value, {
|
|
52
|
+
text: "",
|
|
53
|
+
position: 0
|
|
54
|
+
}), e.template && n("fill-template", e.template);
|
|
55
|
+
}, v = (e) => {
|
|
56
|
+
e === !1 ? g() : (typeof e == "object" && e !== null && (I.value = {
|
|
57
|
+
text: e.text || "",
|
|
58
|
+
position: e.position || 0
|
|
59
|
+
}), b(), m.value = !0, n("update:open", !0));
|
|
60
|
+
}, _ = (e, o) => {
|
|
61
|
+
const p = U(e, o);
|
|
62
|
+
return p ? (I.value = p, v(p), !0) : i.value && o === "" ? (v(!1), !0) : !1;
|
|
63
|
+
}, D = (e) => {
|
|
64
|
+
if (i.value && E.value) {
|
|
65
|
+
E.value.handleKeyDown(e);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}, g = () => {
|
|
69
|
+
t.open === void 0 && (m.value = !1), n("update:open", !1), n("close");
|
|
70
|
+
}, H = (e) => {
|
|
71
|
+
d.value = e.id, s.value = 0, n("category-select", e);
|
|
72
|
+
}, M = (e, o) => {
|
|
73
|
+
n("select", e.text, o), e.template && n("fill-template", e.template), g();
|
|
74
|
+
}, V = (e) => {
|
|
75
|
+
t.closeOnOutsideClick && i.value && x.value && !x.value.contains(e.target) && g();
|
|
76
|
+
}, P = () => {
|
|
77
|
+
i.value ? g() : (b(), m.value = !0, n("update:open", !0));
|
|
78
|
+
};
|
|
79
|
+
return F(() => {
|
|
80
|
+
t.closeOnOutsideClick && document.addEventListener("click", V);
|
|
81
|
+
}), G(() => {
|
|
82
|
+
t.closeOnOutsideClick && document.removeEventListener("click", V);
|
|
83
|
+
}), A({
|
|
84
|
+
trigger: v,
|
|
85
|
+
keyDown: D,
|
|
86
|
+
input: _,
|
|
87
|
+
toggleExpand: S
|
|
88
|
+
}), (e, o) => {
|
|
89
|
+
const p = J("IconEdit");
|
|
90
|
+
return f(), T("div", {
|
|
91
|
+
ref_key: "rootRef",
|
|
92
|
+
ref: x,
|
|
93
|
+
class: W(["tr-suggestion", e.className, { "tr-suggestion--dark": e.theme === "dark" }])
|
|
94
|
+
}, [
|
|
95
|
+
y("div", ne, [
|
|
96
|
+
y("div", {
|
|
97
|
+
class: "tr-suggestion__trigger",
|
|
98
|
+
onClick: P
|
|
99
|
+
}, [
|
|
100
|
+
h(k(R))
|
|
101
|
+
]),
|
|
102
|
+
h(X, {
|
|
103
|
+
suggestions: e.items,
|
|
104
|
+
isExpanded: c.value,
|
|
105
|
+
onSuggestionClick: j,
|
|
106
|
+
onShowExpandButton: Q
|
|
107
|
+
}, {
|
|
108
|
+
"suggestion-icon": u((r) => [
|
|
109
|
+
a(e.$slots, "capsule-icon", {
|
|
110
|
+
suggestion: r.suggestion
|
|
111
|
+
}, () => [
|
|
112
|
+
h(p)
|
|
113
|
+
])
|
|
114
|
+
]),
|
|
115
|
+
_: 3
|
|
116
|
+
}, 8, ["suggestions", "isExpanded"]),
|
|
117
|
+
B.value ? (f(), T("div", {
|
|
118
|
+
key: 0,
|
|
119
|
+
class: "tr-suggestion__expand-button",
|
|
120
|
+
onClick: S
|
|
121
|
+
}, [
|
|
122
|
+
c.value ? (f(), O(k(te), { key: 1 })) : (f(), O(k(ee), { key: 0 }))
|
|
123
|
+
])) : K("", !0)
|
|
124
|
+
]),
|
|
125
|
+
a(e.$slots, "trigger", {
|
|
126
|
+
onTrigger: v,
|
|
127
|
+
onKeyDown: D,
|
|
128
|
+
onInput: _
|
|
129
|
+
}),
|
|
130
|
+
i.value ? (f(), O(Y, {
|
|
131
|
+
key: 0,
|
|
132
|
+
ref_key: "panelRef",
|
|
133
|
+
ref: E,
|
|
134
|
+
class: "tr-suggestion-panel placement-top",
|
|
135
|
+
items: C.value,
|
|
136
|
+
categories: e.categories,
|
|
137
|
+
loading: e.loading,
|
|
138
|
+
title: e.title,
|
|
139
|
+
maxVisibleItems: e.maxVisibleItems,
|
|
140
|
+
triggerContext: I.value,
|
|
141
|
+
onClose: g,
|
|
142
|
+
onSelect: M,
|
|
143
|
+
onCategorySelect: H
|
|
144
|
+
}, {
|
|
145
|
+
"title-icon": u(() => [
|
|
146
|
+
a(e.$slots, "title-icon", {}, () => [
|
|
147
|
+
h(k(R), { style: { "font-size": "36px" } })
|
|
148
|
+
])
|
|
149
|
+
]),
|
|
150
|
+
"category-label": u((r) => [
|
|
151
|
+
a(e.$slots, "category-label", {
|
|
152
|
+
category: r.category
|
|
153
|
+
})
|
|
154
|
+
]),
|
|
155
|
+
item: u((r) => [
|
|
156
|
+
a(e.$slots, "item", {
|
|
157
|
+
item: r.item,
|
|
158
|
+
active: r.active
|
|
159
|
+
})
|
|
160
|
+
]),
|
|
161
|
+
"loading-indicator": u(() => [
|
|
162
|
+
a(e.$slots, "loading-indicator", {}, () => [
|
|
163
|
+
o[0] || (o[0] = y("div", { class: "tr-suggestion__loading-spinner" }, null, -1))
|
|
164
|
+
])
|
|
165
|
+
]),
|
|
166
|
+
empty: u(() => [
|
|
167
|
+
a(e.$slots, "empty", {}, () => [
|
|
168
|
+
o[1] || (o[1] = y("p", null, "无匹配结果", -1))
|
|
169
|
+
])
|
|
170
|
+
]),
|
|
171
|
+
_: 3
|
|
172
|
+
}, 8, ["items", "categories", "loading", "title", "maxVisibleItems", "triggerContext"])) : K("", !0)
|
|
173
|
+
], 2);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
export {
|
|
178
|
+
ue as default
|
|
179
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function d(n, e = "") {
|
|
2
|
+
const t = document.createElement("div");
|
|
3
|
+
e && (t.className = e), t.style.visibility = "hidden", t.style.position = "absolute", t.style.whiteSpace = "nowrap", t.textContent = n, document.body.appendChild(t);
|
|
4
|
+
const i = t.offsetWidth;
|
|
5
|
+
return document.body.removeChild(t), i;
|
|
6
|
+
}
|
|
7
|
+
const o = /* @__PURE__ */ new Map();
|
|
8
|
+
function c(n, e = "") {
|
|
9
|
+
const t = `${n}::${e}`;
|
|
10
|
+
if (o.has(t))
|
|
11
|
+
return o.get(t);
|
|
12
|
+
const i = d(n, e);
|
|
13
|
+
return o.set(t, i), i;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
c as getCachedTextWidth,
|
|
17
|
+
d as measureTextWidth
|
|
18
|
+
};
|