@opentiny/tiny-robot 0.3.0-alpha.3 → 0.3.0-alpha.31
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/index.js +42 -39
- package/dist/attachments/index.js +526 -0
- package/dist/base-popper/index.js +4 -0
- package/dist/bubble/index.js +1613 -1624
- package/dist/container/index.js +44 -40
- package/dist/drag-overlay/index.js +57 -0
- package/dist/dropdown-menu/index.js +151 -64
- package/dist/feedback/index.js +73 -74
- package/dist/flow-layout-buttons/index.js +31 -28
- package/dist/history/index.js +2 -225
- package/dist/icon-button/index.js +18 -19
- package/dist/index.d.ts +1371 -934
- package/dist/index.js +218 -77
- package/dist/index2.js +277 -534
- package/dist/index3.js +693 -290
- package/dist/index4.js +146 -622
- package/dist/mcp-add-form/index.js +212 -0
- package/dist/mcp-server-picker/index.js +556 -0
- package/dist/no-data.js +4 -0
- package/dist/prompts/index.js +36 -39
- package/dist/sender/index.js +1140 -1217
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +131 -155
- package/dist/suggestion-popover/index.js +253 -221
- package/dist/theme-provider/index.js +83 -0
- package/dist/useSlotRefs.js +36 -0
- package/dist/utils.js +8 -13
- package/package.json +4 -9
- package/dist/close.js +0 -29
- package/dist/index5.js +0 -2157
- package/dist/index6.js +0 -4752
- package/dist/question/index.js +0 -429
- package/dist/suggestion/index.js +0 -497
- package/dist/tiny-robot-svgs.js +0 -643
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { _ as
|
|
8
|
-
import { _ as
|
|
9
|
-
|
|
1
|
+
import { defineComponent as z, createElementBlock as g, createCommentVNode as U, openBlock as n, createBlock as k, createElementVNode as v, resolveDynamicComponent as ue, createVNode as M, unref as h, toDisplayString as O, renderSlot as m, mergeModels as V, useModel as A, ref as i, computed as p, watch as W, Transition as ce, withCtx as S, normalizeStyle as J, normalizeClass as D, Fragment as pe, renderList as de, createTextVNode as fe } from "vue";
|
|
2
|
+
import { IconSparkles as ve, IconClose as me } from "@opentiny/tiny-robot-svgs";
|
|
3
|
+
import { a as ge, h as _e, u as he, w as ye, d as we, o as ke } from "../index3.js";
|
|
4
|
+
import { u as Te, c as $e, B as Ce } from "../index4.js";
|
|
5
|
+
import Ie from "../flow-layout-buttons/index.js";
|
|
6
|
+
import qe from "../icon-button/index.js";
|
|
7
|
+
import { _ as T } from "../_plugin-vue_export-helper.js";
|
|
8
|
+
import { _ as Me } from "../loading.js";
|
|
9
|
+
import { _ as Se } from "../no-data.js";
|
|
10
|
+
import { t as G } from "../utils.js";
|
|
11
|
+
const Be = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "tr-question-popover__backdrop"
|
|
14
|
+
}, Re = /* @__PURE__ */ z({
|
|
15
|
+
__name: "Backdrop",
|
|
16
|
+
props: {
|
|
17
|
+
show: { type: Boolean }
|
|
18
|
+
},
|
|
19
|
+
setup(l) {
|
|
20
|
+
return (t, y) => t.show ? (n(), g("div", Be)) : U("", !0);
|
|
21
|
+
}
|
|
22
|
+
}), be = /* @__PURE__ */ T(Re, [["__scopeId", "data-v-50205eaf"]]), Ge = { class: "tr-question__header" }, Oe = {
|
|
10
23
|
key: 1,
|
|
11
24
|
class: "tr-question__header-icon"
|
|
12
|
-
},
|
|
25
|
+
}, xe = { class: "tr-question__header-title" }, ze = /* @__PURE__ */ z({
|
|
13
26
|
__name: "Header",
|
|
14
27
|
props: {
|
|
15
28
|
icon: {},
|
|
16
29
|
title: {}
|
|
17
30
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return (w, r) => (s(), p("div", F0, [
|
|
24
|
-
t.icon ? (s(), F(p0(t.icon), { key: 0 })) : (s(), p("span", $0, [
|
|
25
|
-
$(a(w0), { style: { color: "#1476ff" } })
|
|
31
|
+
setup(l) {
|
|
32
|
+
const t = l;
|
|
33
|
+
return (y, o) => (n(), g("div", Ge, [
|
|
34
|
+
t.icon ? (n(), k(ue(t.icon), { key: 0 })) : (n(), g("span", Oe, [
|
|
35
|
+
M(h(ve), { style: { color: "#1476ff" } })
|
|
26
36
|
])),
|
|
27
|
-
|
|
28
|
-
$(a(M0), {
|
|
29
|
-
class: "tr-question-popover__close",
|
|
30
|
-
icon: a(k0),
|
|
31
|
-
size: "24",
|
|
32
|
-
"svg-size": "20",
|
|
33
|
-
onClick: L
|
|
34
|
-
}, null, 8, ["icon"])
|
|
37
|
+
v("h3", xe, O(t.title), 1)
|
|
35
38
|
]));
|
|
36
39
|
}
|
|
37
|
-
}),
|
|
38
|
-
function
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
}), Ee = /* @__PURE__ */ T(ze, [["__scopeId", "data-v-76bef623"]]), Le = {}, Ne = { class: "tr-question__loading-wrapper" };
|
|
41
|
+
function Pe(l, t) {
|
|
42
|
+
return n(), g("div", Ne, [
|
|
43
|
+
m(l.$slots, "default", {}, () => [
|
|
44
|
+
t[0] || (t[0] = v("img", {
|
|
42
45
|
class: "tr-question__loading",
|
|
43
|
-
src:
|
|
46
|
+
src: Me
|
|
44
47
|
}, null, -1)),
|
|
45
|
-
|
|
48
|
+
t[1] || (t[1] = v("span", { class: "tr-question__loading-text" }, "正在加载", -1))
|
|
46
49
|
], !0)
|
|
47
50
|
]);
|
|
48
51
|
}
|
|
49
|
-
const
|
|
50
|
-
function
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const Ve = /* @__PURE__ */ T(Le, [["render", Pe], ["__scopeId", "data-v-5cdf0688"]]), We = {}, De = { class: "tr-question__no-data-wrapper" };
|
|
53
|
+
function Ue(l, t) {
|
|
54
|
+
return n(), g("div", De, [
|
|
55
|
+
m(l.$slots, "default", {}, () => [
|
|
56
|
+
t[0] || (t[0] = v("img", {
|
|
54
57
|
class: "tr-question__no-data",
|
|
55
|
-
src:
|
|
58
|
+
src: Se
|
|
56
59
|
}, null, -1)),
|
|
57
|
-
|
|
60
|
+
t[1] || (t[1] = v("span", { class: "tr-question__no-data-text" }, "暂时没有内容", -1))
|
|
58
61
|
], !0)
|
|
59
62
|
]);
|
|
60
63
|
}
|
|
61
|
-
const
|
|
64
|
+
const Fe = /* @__PURE__ */ T(We, [["render", Ue], ["__scopeId", "data-v-a33638dd"]]), He = { class: "tr-tooltip-content" }, Qe = /* @__PURE__ */ z({
|
|
62
65
|
__name: "Tooltip",
|
|
63
|
-
props: /* @__PURE__ */
|
|
66
|
+
props: /* @__PURE__ */ V({
|
|
64
67
|
show: { type: Boolean },
|
|
65
68
|
content: {},
|
|
66
69
|
trigger: {},
|
|
@@ -73,219 +76,248 @@ const P0 = /* @__PURE__ */ q(B0, [["render", O0], ["__scopeId", "data-v-b7a7a181
|
|
|
73
76
|
showModifiers: {}
|
|
74
77
|
}),
|
|
75
78
|
emits: ["update:show"],
|
|
76
|
-
setup(
|
|
77
|
-
const
|
|
78
|
-
left:
|
|
79
|
-
top:
|
|
80
|
-
width:
|
|
79
|
+
setup(l) {
|
|
80
|
+
const t = l, y = A(l, "show"), o = i(t.show), $ = p(() => t.trigger), { x: u, y: d, width: _, height: C } = ge($), E = p(() => t.trigger ? {
|
|
81
|
+
left: G(u.value),
|
|
82
|
+
top: t.placement === "top" ? G(d.value) : G(d.value + C.value),
|
|
83
|
+
width: G(_.value)
|
|
81
84
|
} : {});
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
() =>
|
|
85
|
-
(
|
|
86
|
-
const
|
|
87
|
-
|
|
85
|
+
let f;
|
|
86
|
+
W(
|
|
87
|
+
() => y.value,
|
|
88
|
+
(r) => {
|
|
89
|
+
const c = r ? t.delayOpen : t.delayClose;
|
|
90
|
+
f && (clearTimeout(f), f = void 0, r || (o.value = !1)), c ? f = setTimeout(() => o.value = r || !1, c) : o.value = r || !1;
|
|
88
91
|
}
|
|
89
|
-
),
|
|
90
|
-
() =>
|
|
91
|
-
(
|
|
92
|
-
|
|
92
|
+
), W(
|
|
93
|
+
() => t.disabled,
|
|
94
|
+
(r) => {
|
|
95
|
+
r && (f && clearTimeout(f), o.value = !1);
|
|
93
96
|
}
|
|
94
97
|
);
|
|
95
|
-
const
|
|
96
|
-
var
|
|
97
|
-
(
|
|
98
|
+
const w = (r) => {
|
|
99
|
+
var c;
|
|
100
|
+
(c = $.value) != null && c.contains(r.relatedTarget) || (y.value = !1);
|
|
98
101
|
};
|
|
99
|
-
return (
|
|
100
|
-
default:
|
|
101
|
-
|
|
102
|
+
return (r, c) => (n(), k(ce, { name: "tr-tooltip" }, {
|
|
103
|
+
default: S(() => [
|
|
104
|
+
o.value ? (n(), g("div", {
|
|
102
105
|
key: 0,
|
|
103
|
-
class:
|
|
106
|
+
class: D(["tr-tooltip", `placement-${t.placement}`]),
|
|
104
107
|
role: "tooltip",
|
|
105
|
-
style:
|
|
106
|
-
onMouseleave:
|
|
108
|
+
style: J(E.value),
|
|
109
|
+
onMouseleave: w
|
|
107
110
|
}, [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
], 38)) :
|
|
111
|
+
c[0] || (c[0] = v("div", { class: "tr-tooltip-arrow" }, null, -1)),
|
|
112
|
+
v("span", He, O(t.content), 1)
|
|
113
|
+
], 38)) : U("", !0)
|
|
111
114
|
]),
|
|
112
115
|
_: 1
|
|
113
116
|
}));
|
|
114
117
|
}
|
|
115
|
-
}),
|
|
116
|
-
key: 0,
|
|
117
|
-
class: "tr-question-popover__backdrop"
|
|
118
|
-
}, E0 = ["onClick", "onMouseenter", "onMouseleave"], D0 = /* @__PURE__ */ V({
|
|
118
|
+
}), je = /* @__PURE__ */ T(Qe, [["__scopeId", "data-v-72e44084"]]), Ae = ["onClick", "onMouseenter", "onMouseleave"], Je = /* @__PURE__ */ z({
|
|
119
119
|
__name: "index",
|
|
120
|
-
props: /* @__PURE__ */
|
|
120
|
+
props: /* @__PURE__ */ V({
|
|
121
|
+
appendTo: {},
|
|
121
122
|
data: {},
|
|
122
|
-
title: {
|
|
123
|
+
title: {
|
|
124
|
+
default: "热门问题"
|
|
125
|
+
},
|
|
123
126
|
icon: {},
|
|
124
|
-
show: {
|
|
125
|
-
|
|
127
|
+
show: {
|
|
128
|
+
type: Boolean
|
|
129
|
+
},
|
|
130
|
+
trigger: {
|
|
131
|
+
default: "click"
|
|
132
|
+
},
|
|
126
133
|
selectedGroup: {},
|
|
127
|
-
groupShowMoreTrigger: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
134
|
+
groupShowMoreTrigger: {
|
|
135
|
+
default: "hover"
|
|
136
|
+
},
|
|
137
|
+
loading: {
|
|
138
|
+
type: Boolean
|
|
139
|
+
},
|
|
140
|
+
topOffset: {
|
|
141
|
+
default: 8
|
|
142
|
+
}
|
|
132
143
|
}, {
|
|
133
144
|
selectedGroup: {},
|
|
134
145
|
selectedGroupModifiers: {}
|
|
135
146
|
}),
|
|
136
|
-
emits: /* @__PURE__ */
|
|
137
|
-
setup(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"3f4a7a8a": a(y) ? "unset" : "1",
|
|
144
|
-
"1f51979f": a(y) ? "translateY(0)" : "unset"
|
|
145
|
-
}));
|
|
146
|
-
const t = n, f = v0(), L = m(() => f.style), w = c(!1), r = m({
|
|
147
|
-
get: () => t.trigger === "manual" ? t.show : w.value,
|
|
147
|
+
emits: /* @__PURE__ */ V(["item-click", "group-click", "open", "close", "click-outside"], ["update:selectedGroup"]),
|
|
148
|
+
setup(l, {
|
|
149
|
+
expose: t,
|
|
150
|
+
emit: y
|
|
151
|
+
}) {
|
|
152
|
+
const o = l, $ = i(!1), u = p({
|
|
153
|
+
get: () => o.trigger === "manual" ? o.show : $.value,
|
|
148
154
|
set: (e) => {
|
|
149
|
-
|
|
155
|
+
o.trigger !== "manual" && ($.value = e);
|
|
150
156
|
}
|
|
151
|
-
}),
|
|
157
|
+
}), d = y, _ = A(l, "selectedGroup"), C = p(() => {
|
|
152
158
|
var e;
|
|
153
|
-
return typeof ((e =
|
|
159
|
+
return typeof ((e = o.data.at(0)) == null ? void 0 : e.group) == "string";
|
|
154
160
|
});
|
|
155
|
-
!
|
|
156
|
-
const
|
|
161
|
+
!_.value && C.value && o.data.length && (_.value = o.data[0].group);
|
|
162
|
+
const E = p(() => {
|
|
157
163
|
var e;
|
|
158
|
-
return
|
|
159
|
-
}),
|
|
164
|
+
return C.value ? ((e = o.data.find((s) => s.group === _.value)) == null ? void 0 : e.items) || [] : o.data;
|
|
165
|
+
}), f = p(() => C.value ? o.data.map((e) => ({
|
|
160
166
|
...e,
|
|
161
167
|
id: e.group
|
|
162
|
-
})) : []),
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
})) : []), w = i(null), r = p(() => {
|
|
169
|
+
var e;
|
|
170
|
+
return (e = w.value) == null ? void 0 : e.triggerRef;
|
|
171
|
+
}), c = p(() => {
|
|
172
|
+
var e;
|
|
173
|
+
return (e = w.value) == null ? void 0 : e.popperRef;
|
|
174
|
+
}), B = _e("(max-width: 767px)"), F = i(null), L = i(!1), {
|
|
175
|
+
isScrolling: K
|
|
176
|
+
} = he(F);
|
|
177
|
+
ye(K, (e) => {
|
|
178
|
+
L.value = e;
|
|
179
|
+
}, {
|
|
180
|
+
throttle: 100,
|
|
181
|
+
leading: !0,
|
|
182
|
+
trailing: !0
|
|
169
183
|
});
|
|
170
|
-
const
|
|
184
|
+
const R = i([]), X = p(() => R.value.at(0)), Y = (e, s) => {
|
|
185
|
+
R.value[s] = e;
|
|
186
|
+
}, N = i([]), Z = () => {
|
|
187
|
+
N.value = R.value.map((e) => e ? e.scrollWidth > e.clientWidth : !1);
|
|
188
|
+
}, H = i(null), Q = i(null), b = i(!1), j = i(""), {
|
|
189
|
+
width: ee
|
|
190
|
+
} = we(X);
|
|
191
|
+
W(ee, () => {
|
|
192
|
+
Z();
|
|
193
|
+
});
|
|
194
|
+
const te = p(() => B.value ? {
|
|
171
195
|
left: 0,
|
|
172
196
|
right: 0,
|
|
173
|
-
bottom: 0
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
197
|
+
bottom: 0,
|
|
198
|
+
top: "unset",
|
|
199
|
+
minWidth: "100%"
|
|
200
|
+
} : {}), oe = Te(r, o.appendTo);
|
|
201
|
+
$e(() => ({
|
|
202
|
+
to: oe.value
|
|
203
|
+
}), () => M(be, {
|
|
204
|
+
show: u.value && B.value
|
|
205
|
+
}, null));
|
|
206
|
+
const P = () => {
|
|
207
|
+
o.trigger === "click" && (u.value ? d("open") : d("close"));
|
|
208
|
+
};
|
|
209
|
+
ke(c, (e) => {
|
|
210
|
+
d("click-outside", e), u.value = !1, P();
|
|
211
|
+
}, {
|
|
212
|
+
ignore: [r]
|
|
184
213
|
});
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
var
|
|
198
|
-
((
|
|
214
|
+
const se = () => {
|
|
215
|
+
u.value = !u.value, P();
|
|
216
|
+
}, le = () => {
|
|
217
|
+
u.value = !1, d("close");
|
|
218
|
+
}, ne = (e) => {
|
|
219
|
+
d("item-click", e), u.value = !1, P();
|
|
220
|
+
}, re = (e) => {
|
|
221
|
+
const s = o.data.find((a) => a.group === e);
|
|
222
|
+
s && d("group-click", s);
|
|
223
|
+
}, ae = (e, s) => {
|
|
224
|
+
Q.value = R.value[s], b.value = !0, j.value = e.text;
|
|
225
|
+
}, ie = (e) => {
|
|
226
|
+
var s;
|
|
227
|
+
((s = H.value) == null ? void 0 : s.$el).contains(e.relatedTarget) || (b.value = !1);
|
|
199
228
|
};
|
|
200
|
-
return (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
]
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
key: 0,
|
|
238
|
-
class: "tr-question__group",
|
|
239
|
-
items: b.value,
|
|
240
|
-
selected: C.value,
|
|
241
|
-
"onUpdate:selected": l[0] || (l[0] = (v) => C.value = v),
|
|
242
|
-
"lines-limit": 2,
|
|
243
|
-
"show-more-trigger": t.groupShowMoreTrigger,
|
|
244
|
-
onItemClick: u0
|
|
245
|
-
}, null, 8, ["items", "selected", "show-more-trigger"])) : z("", !0),
|
|
246
|
-
g("ul", {
|
|
247
|
-
class: N(["tr-question__list", { scrolling: a(D) }]),
|
|
248
|
-
ref_key: "listRef",
|
|
249
|
-
ref: E
|
|
250
|
-
}, [
|
|
251
|
-
(s(!0), p(P, null, g0(h.value, (v, M) => (s(), p("li", {
|
|
252
|
-
class: "tr-question__list-item",
|
|
253
|
-
key: v.id,
|
|
254
|
-
ref_for: !0,
|
|
255
|
-
ref: (x) => o0(x, M),
|
|
256
|
-
onClick: (x) => i0(v),
|
|
257
|
-
onMouseenter: (x) => O.value[M] && c0(v, M),
|
|
258
|
-
onMouseleave: (x) => O.value[M] && d0(x)
|
|
259
|
-
}, [
|
|
260
|
-
g("span", null, Z(M + 1) + ". ", 1),
|
|
261
|
-
m0(Z(v.text), 1)
|
|
262
|
-
], 40, E0))), 128))
|
|
263
|
-
], 2)
|
|
264
|
-
], 64)),
|
|
265
|
-
$(N0, {
|
|
266
|
-
ref_key: "tooltipRef",
|
|
267
|
-
ref: U,
|
|
268
|
-
show: S.value,
|
|
269
|
-
"onUpdate:show": l[1] || (l[1] = (v) => S.value = v),
|
|
270
|
-
content: A.value,
|
|
271
|
-
trigger: Y.value,
|
|
272
|
-
disabled: a(D),
|
|
273
|
-
placement: "top",
|
|
274
|
-
"delay-open": 300,
|
|
275
|
-
"delay-close": 300
|
|
276
|
-
}, null, 8, ["show", "content", "trigger", "disabled"])
|
|
277
|
-
], 4)) : z("", !0)
|
|
278
|
-
]),
|
|
229
|
+
return t({
|
|
230
|
+
update: () => {
|
|
231
|
+
var e;
|
|
232
|
+
(e = w.value) == null || e.update();
|
|
233
|
+
}
|
|
234
|
+
}), (e, s) => (n(), k(h(Ce), {
|
|
235
|
+
show: u.value,
|
|
236
|
+
class: D(["tr-question-popover", {
|
|
237
|
+
mobile: h(B)
|
|
238
|
+
}]),
|
|
239
|
+
style: J(te.value),
|
|
240
|
+
ref_key: "basePopperRef",
|
|
241
|
+
ref: w,
|
|
242
|
+
placement: "top-left",
|
|
243
|
+
"append-to": o.appendTo,
|
|
244
|
+
offset: o.topOffset,
|
|
245
|
+
"transition-props": {
|
|
246
|
+
name: h(B) ? "tr-question-popover-mobile" : "tr-question-popover"
|
|
247
|
+
},
|
|
248
|
+
"prevent-overflow": !0,
|
|
249
|
+
"trigger-events": {
|
|
250
|
+
onClick: se
|
|
251
|
+
}
|
|
252
|
+
}, {
|
|
253
|
+
trigger: S(() => [m(e.$slots, "trigger", {}, void 0, !0)]),
|
|
254
|
+
content: S(() => [m(e.$slots, "header", {}, () => [M(Ee, {
|
|
255
|
+
icon: o.icon,
|
|
256
|
+
title: o.title
|
|
257
|
+
}, null, 8, ["icon", "title"])], !0), o.loading ? (n(), k(Ve, {
|
|
258
|
+
key: 0
|
|
259
|
+
}, {
|
|
260
|
+
default: S(() => [m(e.$slots, "loading", {}, void 0, !0)]),
|
|
261
|
+
_: 3
|
|
262
|
+
})) : o.data.length === 0 ? (n(), k(Fe, {
|
|
263
|
+
key: 1
|
|
264
|
+
}, {
|
|
265
|
+
default: S(() => [m(e.$slots, "empty", {}, void 0, !0)]),
|
|
279
266
|
_: 3
|
|
280
|
-
})
|
|
281
|
-
|
|
267
|
+
})) : m(e.$slots, "body", {
|
|
268
|
+
key: 2
|
|
269
|
+
}, () => [f.value.length > 0 ? (n(), k(h(Ie), {
|
|
270
|
+
key: 0,
|
|
271
|
+
class: "tr-question__group",
|
|
272
|
+
items: f.value,
|
|
273
|
+
selected: _.value,
|
|
274
|
+
"onUpdate:selected": s[0] || (s[0] = (a) => _.value = a),
|
|
275
|
+
"lines-limit": 2,
|
|
276
|
+
"show-more-trigger": o.groupShowMoreTrigger,
|
|
277
|
+
onItemClick: re
|
|
278
|
+
}, null, 8, ["items", "selected", "show-more-trigger"])) : U("", !0), v("ul", {
|
|
279
|
+
class: D(["tr-question__list", {
|
|
280
|
+
scrolling: L.value
|
|
281
|
+
}]),
|
|
282
|
+
ref_key: "listRef",
|
|
283
|
+
ref: F
|
|
284
|
+
}, [(n(!0), g(pe, null, de(E.value, (a, I) => (n(), g("li", {
|
|
285
|
+
class: "tr-question__list-item",
|
|
286
|
+
key: a.id,
|
|
287
|
+
ref_for: !0,
|
|
288
|
+
ref: (q) => Y(q, I),
|
|
289
|
+
onClick: (q) => ne(a),
|
|
290
|
+
onMouseenter: (q) => N.value[I] && ae(a, I),
|
|
291
|
+
onMouseleave: (q) => N.value[I] && ie(q)
|
|
292
|
+
}, [m(e.$slots, "item", {
|
|
293
|
+
item: a
|
|
294
|
+
}, () => [v("span", null, O(I + 1) + ". ", 1), fe(O(a.text), 1)], !0)], 40, Ae))), 128))], 2)], !0), M(je, {
|
|
295
|
+
ref_key: "tooltipRef",
|
|
296
|
+
ref: H,
|
|
297
|
+
show: b.value,
|
|
298
|
+
"onUpdate:show": s[1] || (s[1] = (a) => b.value = a),
|
|
299
|
+
content: j.value,
|
|
300
|
+
trigger: Q.value,
|
|
301
|
+
disabled: L.value,
|
|
302
|
+
placement: "top",
|
|
303
|
+
"delay-open": 300,
|
|
304
|
+
"delay-close": 300
|
|
305
|
+
}, null, 8, ["show", "content", "trigger", "disabled"]), M(h(qe), {
|
|
306
|
+
class: "tr-question-popover__close",
|
|
307
|
+
icon: h(me),
|
|
308
|
+
size: "32",
|
|
309
|
+
"svg-size": "20",
|
|
310
|
+
onClick: le
|
|
311
|
+
}, null, 8, ["icon"])]),
|
|
312
|
+
_: 3
|
|
313
|
+
}, 8, ["show", "class", "style", "append-to", "offset", "transition-props", "trigger-events"]));
|
|
282
314
|
}
|
|
283
|
-
}),
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
|
|
315
|
+
}), x = /* @__PURE__ */ T(Je, [["__scopeId", "data-v-8cc35579"]]);
|
|
316
|
+
x.name = "TrSuggestionPopover";
|
|
317
|
+
const Ke = function(l) {
|
|
318
|
+
l.component(x.name, x);
|
|
287
319
|
};
|
|
288
|
-
|
|
320
|
+
x.install = Ke;
|
|
289
321
|
export {
|
|
290
|
-
|
|
322
|
+
x as default
|
|
291
323
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineComponent as C, mergeModels as O, useModel as f, ref as S, onUnmounted as D, computed as _, provide as m, watchEffect as w, watch as g, renderSlot as b, inject as u, readonly as v } from "vue";
|
|
2
|
+
const k = "data-tr-theme", A = "data-tr-color-mode", y = Symbol("theme"), E = Symbol("colorMode"), T = Symbol("resolvedColorMode"), p = Symbol("systemColorMode"), i = /* @__PURE__ */ C({
|
|
3
|
+
__name: "index",
|
|
4
|
+
props: /* @__PURE__ */ O({
|
|
5
|
+
colorMode: {},
|
|
6
|
+
targetElement: { default: "html" },
|
|
7
|
+
theme: {},
|
|
8
|
+
storage: {},
|
|
9
|
+
storageKey: { default: "tiny-robot-theme-data" }
|
|
10
|
+
}, {
|
|
11
|
+
theme: { default: "" },
|
|
12
|
+
themeModifiers: {},
|
|
13
|
+
colorMode: {
|
|
14
|
+
default: "auto",
|
|
15
|
+
validator: (o) => ["light", "dark", "auto"].includes(o)
|
|
16
|
+
},
|
|
17
|
+
colorModeModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: ["update:theme", "update:colorMode"],
|
|
20
|
+
setup(o) {
|
|
21
|
+
const t = o, r = () => {
|
|
22
|
+
if (!t.storage) return {};
|
|
23
|
+
let e = {};
|
|
24
|
+
try {
|
|
25
|
+
e = JSON.parse(t.storage.getItem(t.storageKey) || "{}");
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
return e;
|
|
29
|
+
}, d = (e) => {
|
|
30
|
+
if (!t.storage) return;
|
|
31
|
+
const h = { ...r(), ...e };
|
|
32
|
+
t.storage.setItem(t.storageKey, JSON.stringify(h));
|
|
33
|
+
}, n = f(o, "theme"), a = f(o, "colorMode");
|
|
34
|
+
if (t.storage) {
|
|
35
|
+
const e = r();
|
|
36
|
+
typeof e.theme == "string" && (n.value = e.theme), (e.colorMode === "auto" || e.colorMode === "light" || e.colorMode === "dark") && (a.value = e.colorMode);
|
|
37
|
+
}
|
|
38
|
+
const s = S("light");
|
|
39
|
+
if (typeof window < "u") {
|
|
40
|
+
const e = window.matchMedia("(prefers-color-scheme: dark)");
|
|
41
|
+
s.value = e.matches ? "dark" : "light";
|
|
42
|
+
const c = (h) => {
|
|
43
|
+
s.value = h.matches ? "dark" : "light";
|
|
44
|
+
};
|
|
45
|
+
e.addEventListener("change", c), D(() => {
|
|
46
|
+
e.removeEventListener("change", c);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const l = _(() => a.value === "auto" ? s.value : a.value);
|
|
50
|
+
return m(y, n), m(E, a), m(T, l), m(p, s), w(
|
|
51
|
+
() => {
|
|
52
|
+
if (typeof document > "u") return;
|
|
53
|
+
const e = document.querySelector(t.targetElement);
|
|
54
|
+
e && (e.setAttribute(k, n.value), e.setAttribute(A, l.value));
|
|
55
|
+
},
|
|
56
|
+
{ flush: "post" }
|
|
57
|
+
), g(n, (e) => {
|
|
58
|
+
d({ theme: e });
|
|
59
|
+
}), g(a, (e) => {
|
|
60
|
+
d({ colorMode: e });
|
|
61
|
+
}), (e, c) => b(e.$slots, "default");
|
|
62
|
+
}
|
|
63
|
+
}), M = "Theme context not available, cannot set theme data. Consider using ThemeProvider to wrap your app.", N = () => {
|
|
64
|
+
const o = u(y), t = u(E), r = u(T), d = u(p), n = (l) => o ? (o.value = l, !0) : (console.warn(M), !1), a = () => !t || !r ? (console.warn(M), !1) : (t.value = r.value === "light" ? "dark" : "light", !0), s = (l) => t ? (t.value = l, !0) : (console.warn(M), !1);
|
|
65
|
+
return {
|
|
66
|
+
theme: o,
|
|
67
|
+
colorMode: t,
|
|
68
|
+
resolvedColorMode: r ? v(r) : void 0,
|
|
69
|
+
systemColorMode: d ? v(d) : void 0,
|
|
70
|
+
setTheme: n,
|
|
71
|
+
toggleColorMode: a,
|
|
72
|
+
setColorMode: s
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
i.name = "TrThemeProvider";
|
|
76
|
+
const R = function(o) {
|
|
77
|
+
o.component(i.name, i);
|
|
78
|
+
};
|
|
79
|
+
i.install = R;
|
|
80
|
+
export {
|
|
81
|
+
i as default,
|
|
82
|
+
N as useTheme
|
|
83
|
+
};
|