@opentiny/tiny-robot 0.2.1 → 0.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-group/index.js +5 -5
- package/dist/attachments/index.js +602 -0
- package/dist/bubble/index.js +1 -1
- package/dist/container/index.js +10 -10
- package/dist/dropdown-menu/index.js +8 -8
- package/dist/feedback/index.js +20 -20
- package/dist/flow-layout-buttons/index.js +27 -27
- package/dist/history/index.js +46 -46
- package/dist/index.d.ts +231 -98
- package/dist/index.js +50 -46
- package/dist/index2.js +397 -330
- package/dist/question/index.js +64 -64
- package/dist/sender/index.js +906 -844
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +62 -62
- package/dist/suggestion-pills/index.js +80 -77
- package/dist/suggestion-popover/index.js +2 -2
- package/dist/tiny-robot-svgs.js +500 -174
- package/package.json +3 -3
package/dist/question/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as m, computed as
|
|
2
|
-
import {
|
|
1
|
+
import { ref as m, computed as A, watch as D, defineComponent as j, onMounted as Z, onBeforeUnmount as ne, createElementBlock as d, openBlock as i, normalizeClass as V, createElementVNode as t, withDirectives as le, Fragment as L, renderList as R, createVNode as B, unref as q, toDisplayString as S, vShow as ie, nextTick as ae, createCommentVNode as U, withModifiers as ce, normalizeStyle as ue, renderSlot as T, createTextVNode as ee, createBlock as K, withCtx as N } from "vue";
|
|
2
|
+
import { Q as X, o as te, s as se, H as de, B as re } from "../tiny-robot-svgs.js";
|
|
3
3
|
import { i as me } from "../close.js";
|
|
4
4
|
import { B as ve } from "../index3.js";
|
|
5
5
|
function he(v = m([])) {
|
|
6
|
-
const w = m(""), y = m(!1), a = m(!1), r = m("light"), k =
|
|
6
|
+
const w = m(""), y = m(!1), a = m(!1), r = m("light"), k = A(() => {
|
|
7
7
|
if (!w.value && v.value.length > 0)
|
|
8
8
|
return v.value[0].questions;
|
|
9
9
|
const s = v.value.find((l) => l.id === w.value);
|
|
@@ -46,7 +46,7 @@ function he(v = m([])) {
|
|
|
46
46
|
toggleBodyScroll: b
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-questions_expanded-wrapper" }, ge = { class: "tr-common-questions_expanded-area" }, ye = ["onClick"], ke = { class: "tr-common-questions_item_icon" }, _e = { class: "tr-common-questions_item_text" }, Ce = { class: "tr-common-questions_container" }, qe = ["onClick"], $e = { class: "tr-common-questions_item_icon" }, we = { class: "tr-common-questions_item_text" }, xe = /* @__PURE__ */
|
|
49
|
+
const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-questions_expanded-wrapper" }, ge = { class: "tr-common-questions_expanded-area" }, ye = ["onClick"], ke = { class: "tr-common-questions_item_icon" }, _e = { class: "tr-common-questions_item_text" }, Ce = { class: "tr-common-questions_container" }, qe = ["onClick"], $e = { class: "tr-common-questions_item_icon" }, we = { class: "tr-common-questions_item_text" }, xe = /* @__PURE__ */ j({
|
|
50
50
|
__name: "CommonQuestions",
|
|
51
51
|
props: {
|
|
52
52
|
questions: {
|
|
@@ -60,7 +60,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
60
60
|
},
|
|
61
61
|
emits: ["question-click", "toggle-expand", "hover-change"],
|
|
62
62
|
setup(v, { emit: w }) {
|
|
63
|
-
const y = v, a = w, r = m(null), k = m(!1), x = m(!1), p = m(!1), _ = m([]), c = m([]), b = m(0), f = m(null), o =
|
|
63
|
+
const y = v, a = w, r = m(null), k = m(!1), x = m(!1), p = m(!1), _ = m([]), c = m([]), b = m(0), f = m(null), o = A(() => c.value.length > 0), u = A(() => {
|
|
64
64
|
if (b.value <= 0 || c.value.length === 0) return [];
|
|
65
65
|
const e = [], h = [...c.value];
|
|
66
66
|
for (; h.length > 0; )
|
|
@@ -70,31 +70,31 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
70
70
|
if (h.length === 0) return 0;
|
|
71
71
|
const E = e.clientWidth, W = 8, g = document.createElement("div");
|
|
72
72
|
g.className = "tr-common-questions_item", g.style.visibility = "hidden", g.style.position = "absolute", e.appendChild(g);
|
|
73
|
-
let
|
|
73
|
+
let O = 0;
|
|
74
74
|
const z = Math.min(3, h.length);
|
|
75
|
-
for (let
|
|
76
|
-
g.innerHTML = `<span class="icon-placeholder"></span>${h[
|
|
77
|
-
const
|
|
78
|
-
|
|
75
|
+
for (let H = 0; H < z; H++) {
|
|
76
|
+
g.innerHTML = `<span class="icon-placeholder"></span>${h[H].text}`;
|
|
77
|
+
const G = g.offsetWidth + W + 24;
|
|
78
|
+
O += G;
|
|
79
79
|
}
|
|
80
|
-
const M =
|
|
80
|
+
const M = O / z;
|
|
81
81
|
return e.removeChild(g), {
|
|
82
82
|
maxItemsCount: Math.max(1, Math.floor((E - $) / M))
|
|
83
83
|
};
|
|
84
84
|
}, l = (e, h, $, E = 40) => {
|
|
85
|
-
const g = [],
|
|
85
|
+
const g = [], O = [];
|
|
86
86
|
let z = 0;
|
|
87
87
|
if (h.length === 0)
|
|
88
|
-
return { visible: g, hidden:
|
|
88
|
+
return { visible: g, hidden: O };
|
|
89
89
|
const M = document.createElement("div");
|
|
90
90
|
M.className = "tr-common-questions_item", M.style.visibility = "hidden", M.style.position = "absolute", e.appendChild(M);
|
|
91
|
-
for (let
|
|
92
|
-
const I = h[
|
|
91
|
+
for (let H = 0; H < h.length; H++) {
|
|
92
|
+
const I = h[H];
|
|
93
93
|
M.innerHTML = `<span class="icon-placeholder"></span>${I.text}`;
|
|
94
|
-
const
|
|
95
|
-
z +
|
|
94
|
+
const J = M.offsetWidth + 8 + 24, oe = $ - E;
|
|
95
|
+
z + J <= oe ? (z += J, g.push(I)) : O.push(I);
|
|
96
96
|
}
|
|
97
|
-
return e.removeChild(M), { visible: g, hidden:
|
|
97
|
+
return e.removeChild(M), { visible: g, hidden: O };
|
|
98
98
|
};
|
|
99
99
|
D(
|
|
100
100
|
() => y.isExpanded,
|
|
@@ -116,7 +116,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
116
116
|
}
|
|
117
117
|
}, P = () => {
|
|
118
118
|
f.value && (clearTimeout(f.value), f.value = null), k.value = !0, a("hover-change", !0);
|
|
119
|
-
},
|
|
119
|
+
}, Y = () => {
|
|
120
120
|
f.value = setTimeout(() => {
|
|
121
121
|
k.value = !1, a("hover-change", !1), f.value = null;
|
|
122
122
|
}, 500);
|
|
@@ -142,7 +142,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
142
142
|
ref_key: "commonQuestionsRef",
|
|
143
143
|
ref: r,
|
|
144
144
|
onMouseenter: P,
|
|
145
|
-
onMouseleave:
|
|
145
|
+
onMouseleave: Y
|
|
146
146
|
}, [
|
|
147
147
|
t("div", pe, [
|
|
148
148
|
t("div", fe, [
|
|
@@ -154,12 +154,12 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
154
154
|
(i(!0), d(L, null, R($, (W, g) => (i(), d("div", {
|
|
155
155
|
key: `hidden-${W.id}-${g}`,
|
|
156
156
|
class: "tr-common-questions_item",
|
|
157
|
-
onClick: (
|
|
157
|
+
onClick: (O) => n(W)
|
|
158
158
|
}, [
|
|
159
159
|
t("div", ke, [
|
|
160
|
-
|
|
160
|
+
B(q(X))
|
|
161
161
|
]),
|
|
162
|
-
t("div", _e,
|
|
162
|
+
t("div", _e, S(W.text), 1)
|
|
163
163
|
], 8, ye))), 128))
|
|
164
164
|
]))), 128))
|
|
165
165
|
], 512), [
|
|
@@ -173,9 +173,9 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
173
173
|
onClick: (W) => n($)
|
|
174
174
|
}, [
|
|
175
175
|
t("div", $e, [
|
|
176
|
-
|
|
176
|
+
B(q(X))
|
|
177
177
|
]),
|
|
178
|
-
t("div", we,
|
|
178
|
+
t("div", we, S($.text), 1)
|
|
179
179
|
], 10, qe))), 128))
|
|
180
180
|
])
|
|
181
181
|
])
|
|
@@ -184,13 +184,13 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
184
184
|
}), be = { class: "tr-question-header" }, Ee = { style: { display: "flex", "align-items": "center", gap: "12px", "font-size": "36px" } }, Qe = {
|
|
185
185
|
key: 0,
|
|
186
186
|
class: "tr-question-categories"
|
|
187
|
-
}, We = ["onClick"], Me = { class: "category-icon" },
|
|
187
|
+
}, We = ["onClick"], Me = { class: "category-icon" }, Be = { class: "tr-question-content" }, Te = {
|
|
188
188
|
key: 0,
|
|
189
189
|
class: "tr-question-loading"
|
|
190
|
-
},
|
|
190
|
+
}, Se = { key: 1 }, Oe = ["onClick"], He = {
|
|
191
191
|
key: 2,
|
|
192
192
|
class: "tr-question-empty"
|
|
193
|
-
}, ze = /* @__PURE__ */
|
|
193
|
+
}, ze = /* @__PURE__ */ j({
|
|
194
194
|
__name: "HotQuestions",
|
|
195
195
|
props: {
|
|
196
196
|
visible: {
|
|
@@ -216,7 +216,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
216
216
|
},
|
|
217
217
|
emits: ["update:visible", "close", "select-category", "question-click"],
|
|
218
218
|
setup(v, { emit: w }) {
|
|
219
|
-
const y = me(), a = v, r = w, k = m(""), x =
|
|
219
|
+
const y = me(), a = v, r = w, k = m(""), x = A(() => {
|
|
220
220
|
if (!k.value && a.categories.length > 0)
|
|
221
221
|
return a.categories[0].questions || [];
|
|
222
222
|
const o = a.categories.find((u) => u.id === k.value);
|
|
@@ -257,7 +257,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
257
257
|
t("div", be, [
|
|
258
258
|
t("div", Ee, [
|
|
259
259
|
t("div", null, [
|
|
260
|
-
|
|
260
|
+
B(q(te), { style: { color: "#1476ff", "font-size": "24px" } })
|
|
261
261
|
]),
|
|
262
262
|
u[1] || (u[1] = t("div", { class: "tr-question-header-title" }, "热门问题", -1))
|
|
263
263
|
]),
|
|
@@ -265,7 +265,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
265
265
|
class: "tr-question-close-btn",
|
|
266
266
|
onClick: p
|
|
267
267
|
}, [
|
|
268
|
-
|
|
268
|
+
B(q(ve), {
|
|
269
269
|
icon: q(y),
|
|
270
270
|
type: "text"
|
|
271
271
|
}, null, 8, ["icon"])
|
|
@@ -277,43 +277,43 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
277
277
|
class: V(["tr-question-categories-item", { active: k.value === s.id }]),
|
|
278
278
|
onClick: (l) => _(s.id)
|
|
279
279
|
}, [
|
|
280
|
-
|
|
280
|
+
T(o.$slots, "category-label", { category: s }, () => [
|
|
281
281
|
t("div", Me, [
|
|
282
|
-
|
|
282
|
+
B(q(se))
|
|
283
283
|
]),
|
|
284
|
-
t("span", null,
|
|
284
|
+
t("span", null, S(s.label), 1)
|
|
285
285
|
])
|
|
286
286
|
], 10, We))), 128))
|
|
287
|
-
])) :
|
|
288
|
-
t("div",
|
|
289
|
-
v.loading ? (i(), d("div",
|
|
290
|
-
|
|
287
|
+
])) : U("", !0),
|
|
288
|
+
t("div", Be, [
|
|
289
|
+
v.loading ? (i(), d("div", Te, [
|
|
290
|
+
T(o.$slots, "loading-indicator", {}, () => [
|
|
291
291
|
u[2] || (u[2] = t("div", { class: "tr-question-loading-spinner" }, null, -1))
|
|
292
292
|
])
|
|
293
|
-
])) : x.value.length > 0 ? (i(), d("ul",
|
|
293
|
+
])) : x.value.length > 0 ? (i(), d("ul", Se, [
|
|
294
294
|
(i(!0), d(L, null, R(x.value, (s, l) => (i(), d("li", {
|
|
295
295
|
key: s.id,
|
|
296
296
|
class: "tr-question-list-item",
|
|
297
297
|
onClick: (Q) => c(s)
|
|
298
298
|
}, [
|
|
299
|
-
|
|
299
|
+
T(o.$slots, "question-item", {
|
|
300
300
|
question: s,
|
|
301
301
|
index: l
|
|
302
302
|
}, () => [
|
|
303
|
-
t("span", null,
|
|
304
|
-
ee(" " +
|
|
303
|
+
t("span", null, S(l + 1) + ".", 1),
|
|
304
|
+
ee(" " + S(s.text), 1)
|
|
305
305
|
])
|
|
306
|
-
], 8,
|
|
307
|
-
])) : (i(), d("div",
|
|
308
|
-
|
|
306
|
+
], 8, Oe))), 128))
|
|
307
|
+
])) : (i(), d("div", He, [
|
|
308
|
+
T(o.$slots, "empty-state", {}, () => [
|
|
309
309
|
u[3] || (u[3] = t("p", null, "暂无相关问题", -1))
|
|
310
310
|
])
|
|
311
311
|
]))
|
|
312
312
|
])
|
|
313
313
|
], 36)
|
|
314
|
-
], 32)) :
|
|
314
|
+
], 32)) : U("", !0);
|
|
315
315
|
}
|
|
316
|
-
}), Le = ["data-theme"], Re = { class: "tr-question__header" },
|
|
316
|
+
}), Le = ["data-theme"], Re = { class: "tr-question__header" }, Ae = { class: "category-icon" }, F = /* @__PURE__ */ j({
|
|
317
317
|
__name: "index",
|
|
318
318
|
props: {
|
|
319
319
|
categories: { default: () => [] },
|
|
@@ -328,7 +328,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
328
328
|
setup(v, { expose: w, emit: y }) {
|
|
329
329
|
const a = v, r = () => {
|
|
330
330
|
p.value = !p.value;
|
|
331
|
-
}, k = y, x =
|
|
331
|
+
}, k = y, x = A(() => a.categories), p = m(a.initialExpanded), _ = m(!1), { modalVisible: c, currentTheme: b, setActiveCategory: f, openModal: o, closeModal: u, setTheme: s, refreshData: l } = he(x);
|
|
332
332
|
D(
|
|
333
333
|
() => a.theme,
|
|
334
334
|
(n) => {
|
|
@@ -339,7 +339,7 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
339
339
|
u(), k("question-click", n);
|
|
340
340
|
}, P = (n) => {
|
|
341
341
|
_.value = n;
|
|
342
|
-
},
|
|
342
|
+
}, Y = (n) => {
|
|
343
343
|
n && (f(n.id), k("select-category", n));
|
|
344
344
|
};
|
|
345
345
|
return Z(() => {
|
|
@@ -360,9 +360,9 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
360
360
|
onClick: C[0] || (C[0] = //@ts-ignore
|
|
361
361
|
(...e) => q(o) && q(o)(...e))
|
|
362
362
|
}, [
|
|
363
|
-
|
|
363
|
+
B(q(te), { style: { color: "#1476ff" } })
|
|
364
364
|
]),
|
|
365
|
-
|
|
365
|
+
B(xe, {
|
|
366
366
|
questions: n.commonQuestions,
|
|
367
367
|
isExpanded: p.value,
|
|
368
368
|
onQuestionClick: Q,
|
|
@@ -373,10 +373,10 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
373
373
|
class: "tr-question__expand-button",
|
|
374
374
|
onClick: r
|
|
375
375
|
}, [
|
|
376
|
-
p.value ? (i(),
|
|
377
|
-
])) :
|
|
376
|
+
p.value ? (i(), K(q(re), { key: 1 })) : (i(), K(q(de), { key: 0 }))
|
|
377
|
+
])) : U("", !0)
|
|
378
378
|
]),
|
|
379
|
-
|
|
379
|
+
B(ze, {
|
|
380
380
|
visible: q(c),
|
|
381
381
|
categories: x.value,
|
|
382
382
|
"modal-width": n.modalWidth,
|
|
@@ -385,32 +385,32 @@ const pe = { class: "tr-common-questions_content" }, fe = { class: "tr-common-qu
|
|
|
385
385
|
"onUpdate:visible": C[1] || (C[1] = (e) => c.value = e),
|
|
386
386
|
onClose: C[2] || (C[2] = (e) => c.value = !1),
|
|
387
387
|
onQuestionClick: Q,
|
|
388
|
-
onSelectCategory:
|
|
388
|
+
onSelectCategory: Y
|
|
389
389
|
}, {
|
|
390
390
|
"category-label": N(({ category: e }) => [
|
|
391
|
-
|
|
392
|
-
t("div",
|
|
393
|
-
|
|
391
|
+
T(n.$slots, "category-label", { category: e }, () => [
|
|
392
|
+
t("div", Ae, [
|
|
393
|
+
B(q(se))
|
|
394
394
|
]),
|
|
395
|
-
t("span", null,
|
|
395
|
+
t("span", null, S(e.label), 1)
|
|
396
396
|
])
|
|
397
397
|
]),
|
|
398
398
|
"question-item": N(({ question: e, index: h }) => [
|
|
399
|
-
|
|
399
|
+
T(n.$slots, "question-item", {
|
|
400
400
|
question: e,
|
|
401
401
|
index: h
|
|
402
402
|
}, () => [
|
|
403
|
-
t("span", null,
|
|
404
|
-
ee(" " +
|
|
403
|
+
t("span", null, S(h + 1) + ".", 1),
|
|
404
|
+
ee(" " + S(e.text), 1)
|
|
405
405
|
])
|
|
406
406
|
]),
|
|
407
407
|
"loading-indicator": N(() => [
|
|
408
|
-
|
|
408
|
+
T(n.$slots, "loading-indicator", {}, () => [
|
|
409
409
|
C[3] || (C[3] = t("div", { class: "tr-question-loading-spinner" }, null, -1))
|
|
410
410
|
])
|
|
411
411
|
]),
|
|
412
412
|
"empty-state": N(() => [
|
|
413
|
-
|
|
413
|
+
T(n.$slots, "empty-state", {}, () => [
|
|
414
414
|
C[4] || (C[4] = t("p", null, "暂无相关问题", -1))
|
|
415
415
|
])
|
|
416
416
|
]),
|