@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,22 @@
|
|
|
1
|
+
import { defineComponent as i, useCssVars as u, computed as n, createElementBlock as p, openBlock as c, createBlock as l, resolveDynamicComponent as m } from "vue";
|
|
2
|
+
const f = { class: "tr-icon-button" }, x = /* @__PURE__ */ i({
|
|
3
|
+
__name: "index",
|
|
4
|
+
props: {
|
|
5
|
+
icon: {},
|
|
6
|
+
size: { default: "24px" },
|
|
7
|
+
svgSize: { default: "16px" }
|
|
8
|
+
},
|
|
9
|
+
setup(s) {
|
|
10
|
+
u((e) => ({
|
|
11
|
+
"2d9cffb8": r.value,
|
|
12
|
+
"0c8b8982": a.value
|
|
13
|
+
}));
|
|
14
|
+
const t = s, o = (e) => isNaN(Number(e)) ? e : `${e}px`, r = n(() => o(t.size)), a = n(() => o(t.svgSize));
|
|
15
|
+
return (e, _) => (c(), p("button", f, [
|
|
16
|
+
(c(), l(m(t.icon)))
|
|
17
|
+
]));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
x as default
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./prompt.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-e04bfae3"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as i, createElementBlock as s, openBlock as t, normalizeClass as r, createElementVNode as o, createBlock as a, resolveDynamicComponent as c, createCommentVNode as d, toDisplayString as n, Fragment as l, createTextVNode as _ } from "vue";
|
|
2
|
+
const m = { class: "tr-prompt__icon" }, b = { class: "tr-prompt__content" }, g = { class: "tr-prompt__content-label" }, y = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "tr-prompt__content-description"
|
|
5
|
-
},
|
|
5
|
+
}, u = /* @__PURE__ */ i({
|
|
6
6
|
__name: "prompt",
|
|
7
7
|
props: {
|
|
8
8
|
label: {},
|
|
@@ -12,26 +12,28 @@ const g = { class: "tr-prompt__icon" }, v = { class: "tr-prompt__content" }, C =
|
|
|
12
12
|
disabled: { type: Boolean },
|
|
13
13
|
badge: {}
|
|
14
14
|
},
|
|
15
|
-
setup(
|
|
16
|
-
const e =
|
|
17
|
-
return (
|
|
18
|
-
class:
|
|
15
|
+
setup(p) {
|
|
16
|
+
const e = p;
|
|
17
|
+
return (f, h) => (t(), s("div", {
|
|
18
|
+
class: r(["tr-prompt", { disabled: e.disabled }])
|
|
19
19
|
}, [
|
|
20
|
-
o("div",
|
|
21
|
-
(t(),
|
|
20
|
+
o("div", m, [
|
|
21
|
+
(t(), a(c(e.icon)))
|
|
22
22
|
]),
|
|
23
|
-
o("div",
|
|
24
|
-
o("h6",
|
|
25
|
-
e.description ? (t(),
|
|
23
|
+
o("div", b, [
|
|
24
|
+
o("h6", g, n(e.label), 1),
|
|
25
|
+
e.description ? (t(), s("p", y, n(e.description), 1)) : d("", !0)
|
|
26
26
|
]),
|
|
27
27
|
o("div", {
|
|
28
|
-
class:
|
|
28
|
+
class: r(["tr-prompt__badge", { label: typeof e.badge == "string" }])
|
|
29
29
|
}, [
|
|
30
|
-
(t(),
|
|
30
|
+
typeof e.badge == "string" ? (t(), s(l, { key: 0 }, [
|
|
31
|
+
_(n(e.badge), 1)
|
|
32
|
+
], 64)) : (t(), a(c(e.badge), { key: 1 }))
|
|
31
33
|
], 2)
|
|
32
34
|
], 2));
|
|
33
35
|
}
|
|
34
36
|
});
|
|
35
37
|
export {
|
|
36
|
-
|
|
38
|
+
u as default
|
|
37
39
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { IconHotQuestion as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as O, ref as k, computed as Q, watch as S, createElementBlock as i, createCommentVNode as h, openBlock as l, createElementVNode as s, withModifiers as _, normalizeStyle as M, createVNode as v, unref as r, Fragment as C, renderList as q, normalizeClass as N, renderSlot as u, toDisplayString as f, createTextVNode as V } from "vue";
|
|
2
|
+
import z from "../../../../../node_modules/.pnpm/@opentiny_vue-icon@3.22.0/node_modules/@opentiny/vue-icon/lib/close.js";
|
|
3
|
+
import I from "../../../../../node_modules/.pnpm/@opentiny_vue-button@3.21.0/node_modules/@opentiny/vue-button/lib/index.js";
|
|
4
|
+
import { IconHotQuestion as T, IconTypeAll as A } from "../../../../svgs/dist/tiny-robot-svgs.js";
|
|
5
|
+
const E = { class: "tr-question-header" }, H = { style: { display: "flex", "align-items": "center", gap: "12px", "font-size": "36px" } }, R = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "tr-question-categories"
|
|
8
8
|
}, W = ["onClick"], D = { class: "category-icon" }, F = { class: "tr-question-content" }, L = {
|
|
@@ -11,7 +11,7 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
|
|
|
11
11
|
}, P = { key: 1 }, j = ["onClick"], G = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "tr-question-empty"
|
|
14
|
-
}, Z = /* @__PURE__ */
|
|
14
|
+
}, Z = /* @__PURE__ */ O({
|
|
15
15
|
__name: "HotQuestions",
|
|
16
16
|
props: {
|
|
17
17
|
visible: {
|
|
@@ -37,13 +37,13 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
|
|
|
37
37
|
},
|
|
38
38
|
emits: ["update:visible", "close", "select-category", "question-click"],
|
|
39
39
|
setup(n, { emit: b }) {
|
|
40
|
-
const
|
|
40
|
+
const B = z(), a = n, c = b, d = k(""), p = Q(() => {
|
|
41
41
|
if (!d.value && a.categories.length > 0)
|
|
42
42
|
return a.categories[0].questions || [];
|
|
43
43
|
const e = a.categories.find((t) => t.id === d.value);
|
|
44
44
|
return e ? e.questions : [];
|
|
45
45
|
});
|
|
46
|
-
|
|
46
|
+
S(
|
|
47
47
|
() => a.categories,
|
|
48
48
|
(e) => {
|
|
49
49
|
e.length > 0 && !d.value && (d.value = e[0].id);
|
|
@@ -52,33 +52,33 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
|
|
|
52
52
|
);
|
|
53
53
|
const y = () => {
|
|
54
54
|
c("update:visible", !1), c("close");
|
|
55
|
-
},
|
|
55
|
+
}, $ = (e) => {
|
|
56
56
|
d.value = e, c(
|
|
57
57
|
"select-category",
|
|
58
58
|
a.categories.find((t) => t.id === e)
|
|
59
59
|
);
|
|
60
|
-
},
|
|
60
|
+
}, w = (e) => {
|
|
61
61
|
c("question-click", e);
|
|
62
|
-
},
|
|
62
|
+
}, x = (e) => {
|
|
63
63
|
a.closeOnClickOutside && !e.composedPath().includes(g.value) && y();
|
|
64
64
|
}, g = k(null);
|
|
65
65
|
return (e, t) => n.visible ? (l(), i("div", {
|
|
66
66
|
key: 0,
|
|
67
67
|
class: "tr-question-modal-backdrop",
|
|
68
|
-
onMousedown:
|
|
68
|
+
onMousedown: x
|
|
69
69
|
}, [
|
|
70
70
|
s("div", {
|
|
71
71
|
ref_key: "modalRef",
|
|
72
72
|
ref: g,
|
|
73
73
|
class: "tr-question-panel",
|
|
74
|
-
style:
|
|
75
|
-
onMousedown: t[0] || (t[0] =
|
|
74
|
+
style: M({ width: n.modalWidth }),
|
|
75
|
+
onMousedown: t[0] || (t[0] = _(() => {
|
|
76
76
|
}, ["stop"]))
|
|
77
77
|
}, [
|
|
78
|
-
s("div",
|
|
79
|
-
s("div",
|
|
78
|
+
s("div", E, [
|
|
79
|
+
s("div", H, [
|
|
80
80
|
s("div", null, [
|
|
81
|
-
v(r(
|
|
81
|
+
v(r(T))
|
|
82
82
|
]),
|
|
83
83
|
t[1] || (t[1] = s("div", { class: "tr-question-header-title" }, "热门问题", -1))
|
|
84
84
|
]),
|
|
@@ -86,8 +86,8 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
|
|
|
86
86
|
class: "tr-question-close-btn",
|
|
87
87
|
onClick: y
|
|
88
88
|
}, [
|
|
89
|
-
v(r(
|
|
90
|
-
icon: r(
|
|
89
|
+
v(r(I), {
|
|
90
|
+
icon: r(B),
|
|
91
91
|
type: "text"
|
|
92
92
|
}, null, 8, ["icon"])
|
|
93
93
|
])
|
|
@@ -95,12 +95,12 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
|
|
|
95
95
|
n.categories.length > 0 ? (l(), i("div", R, [
|
|
96
96
|
(l(!0), i(C, null, q(n.categories, (o) => (l(), i("div", {
|
|
97
97
|
key: o.id,
|
|
98
|
-
class:
|
|
99
|
-
onClick: (m) =>
|
|
98
|
+
class: N(["tr-question-categories-item", { active: d.value === o.id }]),
|
|
99
|
+
onClick: (m) => $(o.id)
|
|
100
100
|
}, [
|
|
101
101
|
u(e.$slots, "category-label", { category: o }, () => [
|
|
102
102
|
s("div", D, [
|
|
103
|
-
v(r(
|
|
103
|
+
v(r(A))
|
|
104
104
|
]),
|
|
105
105
|
s("span", null, f(o.label), 1)
|
|
106
106
|
])
|
|
@@ -115,7 +115,7 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
|
|
|
115
115
|
(l(!0), i(C, null, q(p.value, (o, m) => (l(), i("li", {
|
|
116
116
|
key: o.id,
|
|
117
117
|
class: "tr-question-list-item",
|
|
118
|
-
onClick: (J) =>
|
|
118
|
+
onClick: (J) => w(o)
|
|
119
119
|
}, [
|
|
120
120
|
u(e.$slots, "question-item", {
|
|
121
121
|
question: o,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as D, computed as N, ref as w, watch as O, onMounted as T, createElementBlock as q, openBlock as i, normalizeClass as M, createElementVNode as l, createVNode as a, createCommentVNode as U, unref as n, withCtx as d, renderSlot as r, createTextVNode as W, toDisplayString as p, createBlock as B } from "vue";
|
|
2
2
|
import { useQuestions as z } from "./composables/useQuestions.js";
|
|
3
3
|
import F from "./components/CommonQuestions.vue.js";
|
|
4
4
|
import H from "./components/HotQuestions.vue.js";
|
|
5
5
|
import { IconHotQuestion as j, IconTypeAll as G, IconArrowUp as J, IconArrowDown as K } from "../../../svgs/dist/tiny-robot-svgs.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */
|
|
7
|
+
const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ D({
|
|
8
8
|
__name: "index",
|
|
9
9
|
props: {
|
|
10
10
|
categories: { default: () => [] },
|
|
@@ -16,11 +16,11 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
|
|
|
16
16
|
loading: { type: Boolean, default: !1 }
|
|
17
17
|
},
|
|
18
18
|
emits: ["question-click", "select-category"],
|
|
19
|
-
setup(
|
|
20
|
-
const u =
|
|
19
|
+
setup(b, { expose: Q, emit: $ }) {
|
|
20
|
+
const u = b, g = () => {
|
|
21
21
|
s.value = !s.value;
|
|
22
|
-
}, f =
|
|
23
|
-
|
|
22
|
+
}, f = $, v = N(() => u.categories), s = w(u.initialExpanded), { modalVisible: m, currentTheme: x, setActiveCategory: h, openModal: c, closeModal: k, setTheme: S, refreshData: A } = z(v);
|
|
23
|
+
O(
|
|
24
24
|
() => u.theme,
|
|
25
25
|
(e) => {
|
|
26
26
|
S(e);
|
|
@@ -28,20 +28,20 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
|
|
|
28
28
|
);
|
|
29
29
|
const y = (e) => {
|
|
30
30
|
k(), f("question-click", e);
|
|
31
|
-
},
|
|
31
|
+
}, I = (e) => {
|
|
32
32
|
e && (h(e.id), f("select-category", e));
|
|
33
|
-
}, C =
|
|
33
|
+
}, C = w(!1), V = (e) => {
|
|
34
34
|
C.value = e;
|
|
35
35
|
};
|
|
36
|
-
return
|
|
36
|
+
return T(() => {
|
|
37
37
|
document.documentElement.setAttribute("data-theme", x.value);
|
|
38
|
-
}),
|
|
38
|
+
}), Q({
|
|
39
39
|
openModal: c,
|
|
40
40
|
closeModal: k,
|
|
41
41
|
toggleFloating: g,
|
|
42
42
|
setActiveCategory: h,
|
|
43
43
|
refreshData: A
|
|
44
|
-
}), (e, t) => (i(),
|
|
44
|
+
}), (e, t) => (i(), q("div", {
|
|
45
45
|
class: M(["tr-question-container", [`theme-${e.theme}`]]),
|
|
46
46
|
"data-theme": e.theme
|
|
47
47
|
}, [
|
|
@@ -61,7 +61,7 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
|
|
|
61
61
|
"onUpdate:visible": t[1] || (t[1] = (o) => m.value = o),
|
|
62
62
|
onClose: t[2] || (t[2] = (o) => m.value = !1),
|
|
63
63
|
onQuestionClick: y,
|
|
64
|
-
onSelectCategory:
|
|
64
|
+
onSelectCategory: I
|
|
65
65
|
}, {
|
|
66
66
|
"category-label": d(({ category: o }) => [
|
|
67
67
|
r(e.$slots, "category-label", { category: o }, () => [
|
|
@@ -71,12 +71,12 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
|
|
|
71
71
|
l("span", null, p(o.label), 1)
|
|
72
72
|
])
|
|
73
73
|
]),
|
|
74
|
-
"question-item": d(({ question: o, index:
|
|
74
|
+
"question-item": d(({ question: o, index: E }) => [
|
|
75
75
|
r(e.$slots, "question-item", {
|
|
76
76
|
question: o,
|
|
77
|
-
index:
|
|
77
|
+
index: E
|
|
78
78
|
}, () => [
|
|
79
|
-
l("span", null, p(
|
|
79
|
+
l("span", null, p(E + 1) + ".", 1),
|
|
80
80
|
W(" " + p(o.text), 1)
|
|
81
81
|
])
|
|
82
82
|
]),
|
|
@@ -95,15 +95,15 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
|
|
|
95
95
|
a(F, {
|
|
96
96
|
isExpanded: s.value,
|
|
97
97
|
questions: e.commonQuestions,
|
|
98
|
-
onShowExpandButton:
|
|
98
|
+
onShowExpandButton: V,
|
|
99
99
|
onQuestionClick: y
|
|
100
100
|
}, null, 8, ["isExpanded", "questions"]),
|
|
101
|
-
C.value ? (i(),
|
|
101
|
+
C.value ? (i(), q("div", {
|
|
102
102
|
key: 0,
|
|
103
103
|
class: "tr-question-wrap-trigger",
|
|
104
104
|
onClick: g
|
|
105
105
|
}, [
|
|
106
|
-
s.value ? (i(),
|
|
106
|
+
s.value ? (i(), B(n(K), { key: 1 })) : (i(), B(n(J), { key: 0 }))
|
|
107
107
|
])) : U("", !0)
|
|
108
108
|
], 10, L));
|
|
109
109
|
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { defineComponent as U, ref as c, watch as T, nextTick as D, onMounted as j, createElementBlock as r, openBlock as f, createElementVNode as W, Fragment as P, renderList as q, toDisplayString as S, normalizeClass as G, withModifiers as J } from "vue";
|
|
2
|
+
const Q = { class: "template-editor" }, X = { key: 0 }, Y = ["onClick"], Z = ["onInput"], ee = {
|
|
3
|
+
key: 1,
|
|
4
|
+
class: "template-placeholder"
|
|
5
|
+
}, le = /* @__PURE__ */ U({
|
|
6
|
+
__name: "TemplateEditor",
|
|
7
|
+
props: {
|
|
8
|
+
template: {},
|
|
9
|
+
value: {}
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:value", "input", "content-status", "field-active"],
|
|
12
|
+
setup(B, { expose: L, emit: M }) {
|
|
13
|
+
const d = B, p = M, $ = c(null), m = c({}), u = c(-1), _ = c(!1), v = c(!1), g = c(!1), s = c([]), k = (e) => {
|
|
14
|
+
const t = [];
|
|
15
|
+
let n = 0, a = 0;
|
|
16
|
+
const l = /\[(.*?)\]/g;
|
|
17
|
+
let o;
|
|
18
|
+
for (; (o = l.exec(e)) !== null; )
|
|
19
|
+
o.index > n && t.push({
|
|
20
|
+
content: e.substring(n, o.index),
|
|
21
|
+
isField: !1
|
|
22
|
+
}), t.push({
|
|
23
|
+
content: o[1],
|
|
24
|
+
// 使用占位符作为默认内容
|
|
25
|
+
placeholder: o[1],
|
|
26
|
+
isField: !0,
|
|
27
|
+
fieldIndex: a++
|
|
28
|
+
}), n = o.index + o[0].length;
|
|
29
|
+
return n < e.length && t.push({
|
|
30
|
+
content: e.substring(n),
|
|
31
|
+
isField: !1
|
|
32
|
+
}), t;
|
|
33
|
+
}, z = () => {
|
|
34
|
+
s.value = k(d.template), d.value && I(d.value);
|
|
35
|
+
}, I = (e) => {
|
|
36
|
+
if (!e || g.value || F() === e) return;
|
|
37
|
+
const n = k(d.template), a = [];
|
|
38
|
+
n.forEach((i) => {
|
|
39
|
+
i.isField ? a.push(`__FIELD_${i.fieldIndex}__`) : a.push(i.content);
|
|
40
|
+
});
|
|
41
|
+
let l = e, o = 0;
|
|
42
|
+
for (let i = 0; i < s.value.length; i++) {
|
|
43
|
+
if (!s.value[i].isField) continue;
|
|
44
|
+
const b = a[o];
|
|
45
|
+
o++;
|
|
46
|
+
const x = a[o] || "";
|
|
47
|
+
if (b && l.startsWith(b))
|
|
48
|
+
if (l = l.substring(b.length), x && l.includes(x)) {
|
|
49
|
+
const w = l.indexOf(x), R = l.substring(0, w);
|
|
50
|
+
R && (s.value[i].content = R, u.value === i && m.value[i] && (v.value = !0)), l = l.substring(w);
|
|
51
|
+
} else !x && l && (s.value[i].content = l, l = "");
|
|
52
|
+
}
|
|
53
|
+
C(e);
|
|
54
|
+
}, F = () => s.value.map((e) => e.content).join(""), h = () => {
|
|
55
|
+
g.value = !0;
|
|
56
|
+
const e = F();
|
|
57
|
+
p("update:value", e), p("input", e), C(e), setTimeout(() => {
|
|
58
|
+
g.value = !1;
|
|
59
|
+
}, 0);
|
|
60
|
+
}, C = (e) => {
|
|
61
|
+
const n = (e || F()).trim().length > 0;
|
|
62
|
+
_.value !== n && (_.value = n, p("content-status", n));
|
|
63
|
+
}, A = (e, t) => {
|
|
64
|
+
e && (m.value[t] = e, e.textContent || (e.textContent = s.value[t].content), new MutationObserver(() => {
|
|
65
|
+
u.value === t && !v.value && (v.value = !0, setTimeout(() => {
|
|
66
|
+
s.value[t].content = e.textContent !== null ? e.textContent : "", v.value = !1;
|
|
67
|
+
}, 0));
|
|
68
|
+
}).observe(e, {
|
|
69
|
+
characterData: !0,
|
|
70
|
+
childList: !0,
|
|
71
|
+
subtree: !0
|
|
72
|
+
}));
|
|
73
|
+
}, H = (e, t) => {
|
|
74
|
+
v.value = !0;
|
|
75
|
+
const n = e.target, a = n.textContent !== null ? n.textContent : "";
|
|
76
|
+
s.value[t].content !== a && (s.value[t].content = a, h()), setTimeout(() => {
|
|
77
|
+
v.value = !1;
|
|
78
|
+
}, 10);
|
|
79
|
+
}, K = (e) => {
|
|
80
|
+
if (document.createRange) {
|
|
81
|
+
const t = document.createRange();
|
|
82
|
+
t.selectNodeContents(e), t.collapse(!1);
|
|
83
|
+
const n = window.getSelection();
|
|
84
|
+
n && (n.removeAllRanges(), n.addRange(t));
|
|
85
|
+
}
|
|
86
|
+
}, E = (e) => {
|
|
87
|
+
if (u.value !== e) {
|
|
88
|
+
if (u.value !== -1) {
|
|
89
|
+
const t = u.value, n = m.value[t];
|
|
90
|
+
n && (s.value[t].content = n.textContent !== null ? n.textContent : "", h());
|
|
91
|
+
}
|
|
92
|
+
u.value = e, p("field-active", !0, e), D(() => {
|
|
93
|
+
const t = m.value[e];
|
|
94
|
+
t && (t.focus(), !t.textContent && s.value[e].content && (t.textContent = s.value[e].content), K(t));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, y = () => {
|
|
98
|
+
const e = u.value;
|
|
99
|
+
if (e >= 0) {
|
|
100
|
+
const t = m.value[e];
|
|
101
|
+
if (t) {
|
|
102
|
+
const n = t.textContent !== null ? t.textContent : "";
|
|
103
|
+
s.value[e].content = n;
|
|
104
|
+
}
|
|
105
|
+
p("field-active", !1, e);
|
|
106
|
+
}
|
|
107
|
+
h(), u.value = -1;
|
|
108
|
+
}, N = (e) => {
|
|
109
|
+
e.key === "Enter" && (e.preventDefault(), y());
|
|
110
|
+
};
|
|
111
|
+
T(
|
|
112
|
+
() => d.value,
|
|
113
|
+
(e) => {
|
|
114
|
+
e === "" ? V() : e && !g.value && I(e);
|
|
115
|
+
}
|
|
116
|
+
), T(
|
|
117
|
+
() => d.template,
|
|
118
|
+
() => {
|
|
119
|
+
z(), D(() => {
|
|
120
|
+
C();
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
{ immediate: !0 }
|
|
124
|
+
);
|
|
125
|
+
const V = () => {
|
|
126
|
+
s.value.forEach((e) => {
|
|
127
|
+
e.isField && (e.content = e.placeholder || "");
|
|
128
|
+
}), h();
|
|
129
|
+
}, O = () => {
|
|
130
|
+
V();
|
|
131
|
+
};
|
|
132
|
+
return j(() => {
|
|
133
|
+
C();
|
|
134
|
+
}), L({
|
|
135
|
+
activateFirstField: () => {
|
|
136
|
+
for (let e = 0; e < s.value.length; e++)
|
|
137
|
+
if (s.value[e].isField) {
|
|
138
|
+
E(e);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
resetFields: O
|
|
143
|
+
}), (e, t) => (f(), r("div", Q, [
|
|
144
|
+
W("div", {
|
|
145
|
+
class: "template-content",
|
|
146
|
+
ref_key: "editorRef",
|
|
147
|
+
ref: $
|
|
148
|
+
}, [
|
|
149
|
+
(f(!0), r(P, null, q(s.value, (n, a) => (f(), r(P, { key: a }, [
|
|
150
|
+
n.isField ? (f(), r("span", {
|
|
151
|
+
key: 1,
|
|
152
|
+
class: G(["template-field", { "template-field-active": u.value === a }]),
|
|
153
|
+
onClick: (l) => E(a)
|
|
154
|
+
}, [
|
|
155
|
+
u.value === a ? (f(), r("span", {
|
|
156
|
+
key: 0,
|
|
157
|
+
ref_for: !0,
|
|
158
|
+
ref: (l) => A(l, a),
|
|
159
|
+
class: "template-editable",
|
|
160
|
+
contenteditable: "true",
|
|
161
|
+
onInput: (l) => H(l, a),
|
|
162
|
+
onBlur: t[0] || (t[0] = (l) => y()),
|
|
163
|
+
onKeydown: t[1] || (t[1] = (l) => N(l)),
|
|
164
|
+
onClick: t[2] || (t[2] = J(() => {
|
|
165
|
+
}, ["stop"]))
|
|
166
|
+
}, null, 40, Z)) : (f(), r("span", ee, S(n.content), 1))
|
|
167
|
+
], 10, Y)) : (f(), r("span", X, S(n.content), 1))
|
|
168
|
+
], 64))), 128))
|
|
169
|
+
], 512)
|
|
170
|
+
]));
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
export {
|
|
174
|
+
le as default
|
|
175
|
+
};
|