@opentiny/tiny-robot 0.2.0-alpha.0 → 0.2.0-alpha.1

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.
Files changed (136) hide show
  1. package/dist/action-group/ActionGroup.vue.d.ts +26 -0
  2. package/dist/action-group/ActionGroupItem.vue.d.ts +18 -0
  3. package/dist/action-group/index.d.ts +12 -0
  4. package/dist/action-group/index.type.d.ts +16 -0
  5. package/dist/feedback/components/SourceList.vue.d.ts +11 -0
  6. package/dist/feedback/components/index.d.ts +1 -0
  7. package/dist/feedback/index.d.ts +7 -0
  8. package/dist/feedback/index.type.d.ts +25 -0
  9. package/dist/feedback/index.vue.d.ts +13 -0
  10. package/dist/history/components/index.d.ts +2 -0
  11. package/dist/history/components/item-tag.vue.d.ts +5 -0
  12. package/dist/history/components/search-empty.vue.d.ts +7 -0
  13. package/dist/history/composables/index.d.ts +1 -0
  14. package/dist/history/composables/useEditItemTitle.d.ts +12 -0
  15. package/dist/history/index.d.ts +6 -0
  16. package/dist/history/index.type.d.ts +43 -0
  17. package/dist/history/index.vue.d.ts +2 -0
  18. package/dist/icon-button/index.d.ts +7 -0
  19. package/dist/icon-button/index.type.d.ts +7 -0
  20. package/dist/icon-button/index.vue.d.ts +6 -0
  21. package/dist/index.d.ts +10 -1
  22. package/dist/index.js +57 -27
  23. package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +1335 -884
  24. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +660 -144
  25. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +85 -0
  26. package/dist/node_modules/.pnpm/@opentiny_vue-locale@3.22.0/node_modules/@opentiny/vue-locale/lib/index.js +1783 -0
  27. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/index.js +77 -0
  28. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +90 -0
  29. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/index.js +176 -0
  30. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/pc.js +248 -0
  31. package/dist/node_modules/.pnpm/@vueuse_core@13.1.0_vue@3.5.13/node_modules/@vueuse/core/index.js +190 -0
  32. package/dist/node_modules/.pnpm/@vueuse_shared@13.1.0_vue@3.5.13/node_modules/@vueuse/shared/index.js +53 -0
  33. package/dist/packages/components/src/action-group/ActionGroup.vue.js +7 -0
  34. package/dist/packages/components/src/action-group/ActionGroup.vue2.js +97 -0
  35. package/dist/packages/components/src/action-group/ActionGroupItem.vue.js +14 -0
  36. package/dist/packages/components/src/action-group/ActionGroupItem.vue2.js +4 -0
  37. package/dist/packages/components/src/action-group/index.js +17 -0
  38. package/dist/packages/components/src/bubble/bubble.vue.js +2 -2
  39. package/dist/packages/components/src/bubble/bubble.vue2.js +46 -46
  40. package/dist/packages/components/src/container/index.vue.js +1 -1
  41. package/dist/packages/components/src/container/index.vue2.js +17 -17
  42. package/dist/packages/components/src/feedback/components/SourceList.vue.js +7 -0
  43. package/dist/packages/components/src/feedback/components/SourceList.vue2.js +52 -0
  44. package/dist/packages/components/src/feedback/index.js +9 -0
  45. package/dist/packages/components/src/feedback/index.vue.js +7 -0
  46. package/dist/packages/components/src/feedback/index.vue2.js +142 -0
  47. package/dist/packages/components/src/history/components/item-tag.vue.js +7 -0
  48. package/dist/packages/components/src/history/components/item-tag.vue2.js +21 -0
  49. package/dist/packages/components/src/history/components/search-empty.vue.js +7 -0
  50. package/dist/packages/components/src/history/components/search-empty.vue2.js +20 -0
  51. package/dist/packages/components/src/history/composables/useEditItemTitle.js +43 -0
  52. package/dist/packages/components/src/history/index.js +11 -0
  53. package/dist/packages/components/src/history/index.vue.js +7 -0
  54. package/dist/packages/components/src/history/index.vue2.js +130 -0
  55. package/dist/packages/components/src/icon-button/index.js +9 -0
  56. package/dist/packages/components/src/icon-button/index.vue.js +7 -0
  57. package/dist/packages/components/src/icon-button/index.vue2.js +40 -0
  58. package/dist/packages/components/src/prompts/prompt.vue.js +2 -2
  59. package/dist/packages/components/src/prompts/prompt.vue2.js +17 -15
  60. package/dist/packages/components/src/question/components/HotQuestions.vue.js +23 -23
  61. package/dist/packages/components/src/question/index.vue.js +18 -18
  62. package/dist/packages/components/src/sender/components/TemplateEditor.vue.js +7 -0
  63. package/dist/packages/components/src/sender/components/TemplateEditor.vue2.js +121 -0
  64. package/dist/packages/components/src/sender/index.vue.js +149 -128
  65. package/dist/packages/components/src/suggestion/components/CategoryNav.vue.js +38 -0
  66. package/dist/packages/components/src/suggestion/components/CategoryNav.vue2.js +4 -0
  67. package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue.js +107 -0
  68. package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue2.js +4 -0
  69. package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue.js +123 -0
  70. package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue2.js +4 -0
  71. package/dist/packages/components/src/suggestion/composables/useKeyboardNavigation.js +45 -0
  72. package/dist/packages/components/src/suggestion/composables/useTriggerDetection.js +17 -0
  73. package/dist/packages/components/src/suggestion/index.js +9 -0
  74. package/dist/packages/components/src/suggestion/index.vue.js +179 -0
  75. package/dist/packages/components/src/suggestion/index.vue2.js +4 -0
  76. package/dist/packages/components/src/suggestion/utils/dom.js +18 -0
  77. package/dist/packages/svgs/dist/tiny-robot-svgs.js +306 -90
  78. package/dist/question/components/HotQuestions.vue.d.ts +2 -2
  79. package/dist/sender/components/TemplateEditor.vue.d.ts +18 -0
  80. package/dist/sender/index.type.d.ts +47 -0
  81. package/dist/sender/index.vue.d.ts +68 -3
  82. package/dist/style.css +1 -1
  83. package/dist/suggestion/components/CategoryNav.vue.d.ts +45 -0
  84. package/dist/suggestion/components/SuggestionCapsule.vue.d.ts +32 -0
  85. package/dist/suggestion/components/SuggestionPanel.vue.d.ts +84 -0
  86. package/dist/suggestion/composables/useKeyboardNavigation.d.ts +18 -0
  87. package/dist/suggestion/composables/useSuggestionFilter.d.ts +10 -0
  88. package/dist/suggestion/composables/useTriggerDetection.d.ts +11 -0
  89. package/dist/suggestion/index.d.ts +7 -0
  90. package/dist/suggestion/index.type.d.ts +94 -0
  91. package/dist/suggestion/index.vue.d.ts +343 -0
  92. package/dist/suggestion/utils/dom.d.ts +20 -0
  93. package/package.json +4 -3
  94. package/src/action-group/ActionGroup.vue +232 -0
  95. package/src/action-group/ActionGroupItem.vue +9 -0
  96. package/src/action-group/index.ts +25 -0
  97. package/src/action-group/index.type.ts +20 -0
  98. package/src/bubble/bubble.vue +4 -14
  99. package/src/container/index.vue +1 -2
  100. package/src/feedback/components/SourceList.vue +112 -0
  101. package/src/feedback/components/index.ts +1 -0
  102. package/src/feedback/index.ts +12 -0
  103. package/src/feedback/index.type.ts +27 -0
  104. package/src/feedback/index.vue +166 -0
  105. package/src/history/components/index.ts +2 -0
  106. package/src/history/components/item-tag.vue +49 -0
  107. package/src/history/components/search-empty.vue +38 -0
  108. package/src/history/composables/index.ts +1 -0
  109. package/src/history/composables/useEditItemTitle.ts +75 -0
  110. package/src/history/index.ts +12 -0
  111. package/src/history/index.type.ts +50 -0
  112. package/src/history/index.vue +292 -0
  113. package/src/icon-button/index.ts +12 -0
  114. package/src/icon-button/index.type.ts +8 -0
  115. package/src/icon-button/index.vue +52 -0
  116. package/src/index.ts +33 -1
  117. package/src/prompts/prompt.vue +7 -21
  118. package/src/question/components/HotQuestions.vue +1 -1
  119. package/src/question/index.less +9 -10
  120. package/src/sender/components/TemplateEditor.vue +274 -0
  121. package/src/sender/index.less +17 -7
  122. package/src/sender/index.type.ts +51 -0
  123. package/src/sender/index.vue +56 -8
  124. package/src/sender/vars.less +3 -3
  125. package/src/suggestion/components/CategoryNav.vue +38 -0
  126. package/src/suggestion/components/SuggestionCapsule.vue +183 -0
  127. package/src/suggestion/components/SuggestionPanel.vue +147 -0
  128. package/src/suggestion/composables/useKeyboardNavigation.ts +101 -0
  129. package/src/suggestion/composables/useSuggestionFilter.ts +34 -0
  130. package/src/suggestion/composables/useTriggerDetection.ts +46 -0
  131. package/src/suggestion/index.less +497 -0
  132. package/src/suggestion/index.ts +12 -0
  133. package/src/suggestion/index.type.ts +101 -0
  134. package/src/suggestion/index.vue +338 -0
  135. package/src/suggestion/utils/dom.ts +66 -0
  136. package/src/suggestion/vars.less +141 -0
@@ -1,8 +1,8 @@
1
- import { defineComponent as S, ref as k, computed as _, watch as x, createElementBlock as i, createCommentVNode as h, openBlock as l, createElementVNode as s, withModifiers as M, normalizeStyle as N, createVNode as v, unref as r, Fragment as C, renderList as q, normalizeClass as Q, renderSlot as u, toDisplayString as f, createTextVNode as V } from "vue";
2
- import T from "../../../../../node_modules/.pnpm/@opentiny_vue-icon@3.22.0/node_modules/@opentiny/vue-icon/lib/close.js";
3
- import z from "../../../../../node_modules/.pnpm/@opentiny_vue-button@3.21.0/node_modules/@opentiny/vue-button/lib/index.js";
4
- import { IconHotQuestion as A, IconTypeAll as E } from "../../../../svgs/dist/tiny-robot-svgs.js";
5
- const H = { class: "tr-question-header" }, I = { style: { display: "flex", "align-items": "center", gap: "12px" } }, R = {
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__ */ S({
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 w = T(), a = n, c = b, d = k(""), p = _(() => {
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
- x(
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
- }, B = (e) => {
55
+ }, $ = (e) => {
56
56
  d.value = e, c(
57
57
  "select-category",
58
58
  a.categories.find((t) => t.id === e)
59
59
  );
60
- }, $ = (e) => {
60
+ }, w = (e) => {
61
61
  c("question-click", e);
62
- }, O = (e) => {
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: O
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: N({ width: n.modalWidth }),
75
- onMousedown: t[0] || (t[0] = M(() => {
74
+ style: M({ width: n.modalWidth }),
75
+ onMousedown: t[0] || (t[0] = _(() => {
76
76
  }, ["stop"]))
77
77
  }, [
78
- s("div", H, [
79
- s("div", I, [
78
+ s("div", E, [
79
+ s("div", H, [
80
80
  s("div", null, [
81
- v(r(A))
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(z), {
90
- icon: r(w),
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: Q(["tr-question-categories-item", { active: d.value === o.id }]),
99
- onClick: (m) => B(o.id)
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(E))
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) => $(o)
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 N, computed as O, ref as E, watch as T, onMounted as D, createElementBlock as b, 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 q } from "vue";
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__ */ N({
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(B, { expose: $, emit: Q }) {
20
- const u = B, g = () => {
19
+ setup(b, { expose: Q, emit: $ }) {
20
+ const u = b, g = () => {
21
21
  s.value = !s.value;
22
- }, f = Q, v = O(() => u.categories), s = E(u.initialExpanded), { modalVisible: m, currentTheme: x, setActiveCategory: h, openModal: c, closeModal: k, setTheme: S, refreshData: A } = z(v);
23
- T(
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
- }, V = (e) => {
31
+ }, I = (e) => {
32
32
  e && (h(e.id), f("select-category", e));
33
- }, C = E(!1), I = (e) => {
33
+ }, C = w(!1), V = (e) => {
34
34
  C.value = e;
35
35
  };
36
- return D(() => {
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(), b("div", {
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: V
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: w }) => [
74
+ "question-item": d(({ question: o, index: E }) => [
75
75
  r(e.$slots, "question-item", {
76
76
  question: o,
77
- index: w
77
+ index: E
78
78
  }, () => [
79
- l("span", null, p(w + 1) + ".", 1),
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: I,
98
+ onShowExpandButton: V,
99
99
  onQuestionClick: y
100
100
  }, null, 8, ["isExpanded", "questions"]),
101
- C.value ? (i(), b("div", {
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(), q(n(K), { key: 1 })) : (i(), q(n(J), { key: 0 }))
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,7 @@
1
+ import o from "./TemplateEditor.vue2.js";
2
+ /* empty css */
3
+ import t from "../../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0cf27800"]]);
5
+ export {
6
+ a as default
7
+ };
@@ -0,0 +1,121 @@
1
+ import { defineComponent as E, ref as p, computed as I, watch as T, createElementBlock as o, openBlock as a, createElementVNode as b, Fragment as F, renderList as K, toDisplayString as k, normalizeClass as B, withDirectives as R, withModifiers as M, vModelText as N, nextTick as U } from "vue";
2
+ const $ = { class: "template-editor" }, j = { key: 0 }, z = ["onClick"], L = ["onUpdate:modelValue", "onKeydown"], P = {
3
+ key: 1,
4
+ class: "template-placeholder"
5
+ }, q = /* @__PURE__ */ E({
6
+ __name: "TemplateEditor",
7
+ props: {
8
+ template: {},
9
+ value: {}
10
+ },
11
+ emits: ["update:value", "input", "content-status", "field-active"],
12
+ setup(_, { expose: y, emit: g }) {
13
+ const u = _, v = g, w = p(null), c = p({}), r = p(-1), i = I(() => {
14
+ if (u.value)
15
+ return x();
16
+ const e = [];
17
+ let l = 0, t = 0;
18
+ const s = /\[(.*?)\]/g;
19
+ let n;
20
+ for (; (n = s.exec(u.template)) !== null; )
21
+ n.index > l && e.push({
22
+ content: u.template.substring(l, n.index),
23
+ isField: !1
24
+ }), e.push({
25
+ content: "",
26
+ placeholder: n[1],
27
+ isField: !0,
28
+ fieldIndex: t++
29
+ }), l = n.index + n[0].length;
30
+ return l < u.template.length && e.push({
31
+ content: u.template.substring(l),
32
+ isField: !1
33
+ }), e;
34
+ }), x = () => i.value, V = () => i.value.map((e) => e.content).join(""), d = () => {
35
+ const e = V();
36
+ v("update:value", e), v("input", e);
37
+ }, f = (e) => {
38
+ r.value = e, U(() => {
39
+ var l;
40
+ c.value[e] && ((l = c.value[e]) == null || l.focus());
41
+ });
42
+ }, m = () => {
43
+ d(), r.value = -1;
44
+ }, C = (e, l) => {
45
+ if (e.key === "Tab") {
46
+ e.preventDefault();
47
+ const t = D(l, e.shiftKey);
48
+ t !== -1 && (d(), f(t));
49
+ } else e.key === "Enter" && (e.preventDefault(), m());
50
+ }, D = (e, l = !1) => {
51
+ if (l) {
52
+ for (let t = e - 1; t >= 0; t--)
53
+ if (i.value[t].isField)
54
+ return t;
55
+ for (let t = i.value.length - 1; t > e; t--)
56
+ if (i.value[t].isField)
57
+ return t;
58
+ } else {
59
+ for (let t = e + 1; t < i.value.length; t++)
60
+ if (i.value[t].isField)
61
+ return t;
62
+ for (let t = 0; t < e; t++)
63
+ if (i.value[t].isField)
64
+ return t;
65
+ }
66
+ return -1;
67
+ };
68
+ T(
69
+ () => u.value,
70
+ (e) => {
71
+ e === "" && h();
72
+ }
73
+ );
74
+ const h = () => {
75
+ i.value.forEach((e) => {
76
+ e.isField && (e.content = "");
77
+ }), d();
78
+ };
79
+ return y({
80
+ activateFirstField: () => {
81
+ for (let e = 0; e < i.value.length; e++)
82
+ if (i.value[e].isField) {
83
+ f(e);
84
+ break;
85
+ }
86
+ },
87
+ resetFields: h
88
+ }), (e, l) => (a(), o("div", $, [
89
+ b("div", {
90
+ class: "template-content",
91
+ ref_key: "editorRef",
92
+ ref: w
93
+ }, [
94
+ (a(!0), o(F, null, K(i.value, (t, s) => (a(), o(F, { key: s }, [
95
+ t.isField ? (a(), o("span", {
96
+ key: 1,
97
+ class: B(["template-field", { "template-field-active": r.value === s }]),
98
+ onClick: (n) => f(s)
99
+ }, [
100
+ r.value === s ? R((a(), o("input", {
101
+ key: 0,
102
+ ref_for: !0,
103
+ ref: (n) => c.value[s] = n,
104
+ "onUpdate:modelValue": (n) => t.content = n,
105
+ class: "template-input",
106
+ onBlur: l[0] || (l[0] = (n) => m()),
107
+ onKeydown: (n) => C(n, s),
108
+ onClick: l[1] || (l[1] = M(() => {
109
+ }, ["stop"]))
110
+ }, null, 40, L)), [
111
+ [N, t.content]
112
+ ]) : (a(), o("span", P, k(t.content || t.placeholder), 1))
113
+ ], 10, z)) : (a(), o("span", j, k(t.content), 1))
114
+ ], 64))), 128))
115
+ ], 512)
116
+ ]));
117
+ }
118
+ });
119
+ export {
120
+ q as default
121
+ };