@opentiny/tiny-robot 0.2.0-alpha.2 → 0.2.0-alpha.4

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 (414) hide show
  1. package/dist/_plugin-vue_export-helper.js +9 -0
  2. package/dist/action-group/index.js +142 -0
  3. package/dist/bubble/index.js +3211 -0
  4. package/dist/{node_modules/.pnpm/@opentiny_vue-icon@3.22.0/node_modules/@opentiny/vue-icon/lib/close.js → close.js} +9 -9
  5. package/dist/container/index.js +60 -0
  6. package/dist/conversations/index.js +14 -0
  7. package/dist/feedback/index.js +192 -0
  8. package/dist/history/index.js +228 -0
  9. package/dist/icon-button/index.js +31 -0
  10. package/dist/index.d.ts +2200 -26
  11. package/dist/index.js +35 -43
  12. package/dist/index2.js +376 -0
  13. package/dist/index3.js +3895 -0
  14. package/dist/index4.js +637 -0
  15. package/dist/index5.js +3237 -0
  16. package/dist/index6.js +4623 -0
  17. package/dist/prompts/index.js +83 -0
  18. package/dist/question/index.js +429 -0
  19. package/dist/sender/index.js +772 -0
  20. package/dist/style.css +1 -1
  21. package/dist/suggestion/index.js +497 -0
  22. package/dist/{packages/svgs/dist/tiny-robot-svgs.js → tiny-robot-svgs.js} +107 -107
  23. package/dist/welcome/index.js +38 -0
  24. package/package.json +7 -3
  25. package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
  26. package/dist/action-group/ActionGroup.vue.d.ts +0 -26
  27. package/dist/action-group/ActionGroupItem.vue.d.ts +0 -18
  28. package/dist/action-group/index.d.ts +0 -12
  29. package/dist/action-group/index.type.d.ts +0 -17
  30. package/dist/bubble/BubbleList.vue.d.ts +0 -5
  31. package/dist/bubble/index.d.ts +0 -12
  32. package/dist/bubble/index.type.d.ts +0 -51
  33. package/dist/container/index.d.ts +0 -7
  34. package/dist/container/index.type.d.ts +0 -16
  35. package/dist/container/index.vue.d.ts +0 -26
  36. package/dist/conversations/index.d.ts +0 -7
  37. package/dist/conversations/index.vue.d.ts +0 -2
  38. package/dist/feedback/components/SourceList.vue.d.ts +0 -11
  39. package/dist/feedback/components/index.d.ts +0 -1
  40. package/dist/feedback/index.d.ts +0 -7
  41. package/dist/feedback/index.type.d.ts +0 -25
  42. package/dist/feedback/index.vue.d.ts +0 -13
  43. package/dist/history/components/index.d.ts +0 -2
  44. package/dist/history/components/item-tag.vue.d.ts +0 -5
  45. package/dist/history/components/search-empty.vue.d.ts +0 -7
  46. package/dist/history/composables/index.d.ts +0 -1
  47. package/dist/history/composables/useEditItemTitle.d.ts +0 -12
  48. package/dist/history/index.d.ts +0 -6
  49. package/dist/history/index.type.d.ts +0 -43
  50. package/dist/history/index.vue.d.ts +0 -2
  51. package/dist/icon-button/index.d.ts +0 -7
  52. package/dist/icon-button/index.type.d.ts +0 -6
  53. package/dist/icon-button/index.vue.d.ts +0 -6
  54. package/dist/node_modules/.pnpm/@opentiny_utils@1.0.0/node_modules/@opentiny/utils/dist/opentiny-utils.es.js +0 -832
  55. package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +0 -2116
  56. package/dist/node_modules/.pnpm/@opentiny_vue-button@3.21.0/node_modules/@opentiny/vue-button/lib/index.js +0 -113
  57. package/dist/node_modules/.pnpm/@opentiny_vue-button@3.21.0/node_modules/@opentiny/vue-button/lib/pc.js +0 -93
  58. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.21.0/node_modules/@opentiny/vue-common/lib/index.js +0 -727
  59. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +0 -710
  60. package/dist/node_modules/.pnpm/@opentiny_vue-dialog-box@3.21.0/node_modules/@opentiny/vue-dialog-box/lib/index.js +0 -198
  61. package/dist/node_modules/.pnpm/@opentiny_vue-dialog-box@3.21.0/node_modules/@opentiny/vue-dialog-box/lib/pc.js +0 -204
  62. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/useEventListener.js +0 -10
  63. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/useInstanceSlots.js +0 -14
  64. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/useRelation.js +0 -54
  65. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +0 -85
  66. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/close.js +0 -29
  67. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/eyeclose.js +0 -42
  68. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/eyeopen.js +0 -43
  69. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/finish.js +0 -34
  70. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/fullscreen.js +0 -30
  71. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/loading-shadow.js +0 -77
  72. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/minscreen.js +0 -30
  73. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-add-column-after.js +0 -24
  74. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-add-column-before.js +0 -24
  75. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-add-row-after.js +0 -24
  76. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-add-row-before.js +0 -24
  77. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-align-center.js +0 -24
  78. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-align-left.js +0 -24
  79. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-align-right.js +0 -24
  80. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-bold.js +0 -24
  81. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-code-block.js +0 -24
  82. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-code-view.js +0 -24
  83. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-color.js +0 -24
  84. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-delete-column.js +0 -24
  85. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-delete-row.js +0 -24
  86. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-delete-table.js +0 -24
  87. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-font-size.js +0 -24
  88. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-format-clear.js +0 -24
  89. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-h1.js +0 -24
  90. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-h2.js +0 -24
  91. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-h3.js +0 -24
  92. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-h4.js +0 -24
  93. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-h5.js +0 -24
  94. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-h6.js +0 -24
  95. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-heading.js +0 -24
  96. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-high-light.js +0 -24
  97. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-image.js +0 -24
  98. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-italic.js +0 -24
  99. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-line-height.js +0 -24
  100. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-link-unlink.js +0 -24
  101. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-link.js +0 -24
  102. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-list-ordered.js +0 -24
  103. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-list-unordered.js +0 -24
  104. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-merge-cells-vertical.js +0 -24
  105. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-merge-cells.js +0 -24
  106. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-node-delete.js +0 -24
  107. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-paragraph.js +0 -24
  108. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-quote-text.js +0 -24
  109. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-redo.js +0 -24
  110. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-split-cells-horizontal.js +0 -24
  111. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-split-cells-vertical.js +0 -24
  112. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-strike-through.js +0 -24
  113. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-subscript.js +0 -24
  114. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-superscript.js +0 -24
  115. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-table.js +0 -24
  116. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-task-list.js +0 -24
  117. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-underline.js +0 -24
  118. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/rich-text-undo.js +0 -24
  119. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/sub-script.js +0 -29
  120. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/warn.js +0 -26
  121. package/dist/node_modules/.pnpm/@opentiny_vue-input@3.21.0/node_modules/@opentiny/vue-input/lib/index.js +0 -196
  122. package/dist/node_modules/.pnpm/@opentiny_vue-input@3.21.0/node_modules/@opentiny/vue-input/lib/pc.js +0 -568
  123. package/dist/node_modules/.pnpm/@opentiny_vue-locale@3.21.0/node_modules/@opentiny/vue-locale/lib/index.js +0 -1783
  124. package/dist/node_modules/.pnpm/@opentiny_vue-locale@3.22.0/node_modules/@opentiny/vue-locale/lib/index.js +0 -1783
  125. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/button/index.js +0 -13
  126. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/button/vue.js +0 -34
  127. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/chunk-G2ADBYYC.js +0 -12
  128. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/browser.js +0 -36
  129. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/clickoutside.js +0 -47
  130. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/debounce.js +0 -7
  131. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/dom.js +0 -45
  132. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popper.js +0 -320
  133. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popup-manager.js +0 -118
  134. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/throttle.js +0 -23
  135. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useEventListener.js +0 -9
  136. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useInstanceSlots.js +0 -14
  137. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useRelation.js +0 -54
  138. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popper.js +0 -84
  139. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popup.js +0 -73
  140. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/event.js +0 -13
  141. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/function.js +0 -5
  142. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/index.js +0 -11
  143. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/object.js +0 -84
  144. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/string.js +0 -28
  145. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/type.js +0 -28
  146. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/dialog-box/index.js +0 -136
  147. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/dialog-box/vue.js +0 -148
  148. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/input/index.js +0 -228
  149. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/input/vue.js +0 -263
  150. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tall-storage/index.js +0 -63
  151. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tall-storage/vue-storage-box.js +0 -16
  152. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tall-storage/vue.js +0 -23
  153. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tooltip/index.js +0 -78
  154. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tooltip/vue.js +0 -90
  155. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/index.js +0 -77
  156. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +0 -90
  157. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.21.0/node_modules/@opentiny/vue-tooltip/lib/index.js +0 -173
  158. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.21.0/node_modules/@opentiny/vue-tooltip/lib/pc.js +0 -248
  159. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/index.js +0 -176
  160. package/dist/node_modules/.pnpm/@opentiny_vue-tooltip@3.22.0/node_modules/@opentiny/vue-tooltip/lib/pc.js +0 -248
  161. package/dist/node_modules/.pnpm/@vueuse_core@13.1.0_vue@3.5.13/node_modules/@vueuse/core/index.js +0 -310
  162. package/dist/node_modules/.pnpm/@vueuse_shared@13.1.0_vue@3.5.13/node_modules/@vueuse/shared/index.js +0 -110
  163. package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode.js +0 -277
  164. package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/decode_codepoint.js +0 -46
  165. package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -7
  166. package/dist/node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -7
  167. package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/index.js +0 -187
  168. package/dist/node_modules/.pnpm/linkify-it@5.0.0/node_modules/linkify-it/lib/re.js +0 -19
  169. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/common/html_blocks.js +0 -67
  170. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/common/html_re.js +0 -5
  171. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/common/utils.js +0 -164
  172. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/helpers/index.js +0 -8
  173. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/helpers/parse_link_destination.js +0 -44
  174. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/helpers/parse_link_label.js +0 -21
  175. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/helpers/parse_link_title.js +0 -37
  176. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/index.js +0 -112
  177. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/parser_block.js +0 -63
  178. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/parser_core.js +0 -34
  179. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/parser_inline.js +0 -96
  180. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/presets/commonmark.js +0 -78
  181. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/presets/default.js +0 -40
  182. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/presets/zero.js +0 -59
  183. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/renderer.js +0 -127
  184. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/ruler.js +0 -95
  185. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/blockquote.js +0 -59
  186. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/code.js +0 -23
  187. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/fence.js +0 -30
  188. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/heading.js +0 -28
  189. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/hr.js +0 -27
  190. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/html_block.js +0 -37
  191. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/lheading.js +0 -43
  192. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/list.js +0 -110
  193. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/paragraph.js +0 -25
  194. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/reference.js +0 -95
  195. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/state_block.js +0 -84
  196. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_block/table.js +0 -99
  197. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/block.js +0 -7
  198. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/inline.js +0 -10
  199. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/linkify.js +0 -57
  200. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/normalize.js +0 -9
  201. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/replacements.js +0 -31
  202. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/smartquotes.js +0 -80
  203. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/state_core.js +0 -8
  204. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_core/text_join.js +0 -16
  205. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/autolink.js +0 -46
  206. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/backticks.js +0 -31
  207. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/balance_pairs.js +0 -34
  208. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/emphasis.js +0 -57
  209. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/entity.js +0 -33
  210. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/escape.js +0 -32
  211. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/fragments_join.js +0 -10
  212. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/html_inline.js +0 -32
  213. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/image.js +0 -48
  214. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/link.js +0 -40
  215. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/linkify.js +0 -28
  216. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/newline.js +0 -23
  217. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/state_inline.js +0 -27
  218. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/strikethrough.js +0 -54
  219. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/rules_inline/text.js +0 -39
  220. package/dist/node_modules/.pnpm/markdown-it@14.1.0/node_modules/markdown-it/lib/token.js +0 -31
  221. package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/index.js +0 -10
  222. package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/decode.js +0 -61
  223. package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/encode.js +0 -48
  224. package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/format.js +0 -7
  225. package/dist/node_modules/.pnpm/mdurl@2.0.0/node_modules/mdurl/lib/parse.js +0 -74
  226. package/dist/node_modules/.pnpm/punycode.js@2.3.1/node_modules/punycode.js/punycode.es6.js +0 -139
  227. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cc/regex.js +0 -4
  228. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Cf/regex.js +0 -4
  229. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/P/regex.js +0 -4
  230. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/S/regex.js +0 -4
  231. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/categories/Z/regex.js +0 -4
  232. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/index.js +0 -14
  233. package/dist/node_modules/.pnpm/uc.micro@2.1.0/node_modules/uc.micro/properties/Any/regex.js +0 -4
  234. package/dist/packages/components/src/action-group/ActionGroup.vue.js +0 -7
  235. package/dist/packages/components/src/action-group/ActionGroup.vue2.js +0 -121
  236. package/dist/packages/components/src/action-group/ActionGroupItem.vue.js +0 -14
  237. package/dist/packages/components/src/action-group/ActionGroupItem.vue2.js +0 -4
  238. package/dist/packages/components/src/action-group/index.js +0 -17
  239. package/dist/packages/components/src/assets/icons/accessory.svg.js +0 -4
  240. package/dist/packages/components/src/assets/icons/loading-speech.svg.js +0 -4
  241. package/dist/packages/components/src/assets/icons/loading.svg.js +0 -4
  242. package/dist/packages/components/src/assets/icons/send.svg.js +0 -4
  243. package/dist/packages/components/src/assets/icons/voice.svg.js +0 -4
  244. package/dist/packages/components/src/bubble/Bubble.vue.js +0 -7
  245. package/dist/packages/components/src/bubble/Bubble.vue2.js +0 -76
  246. package/dist/packages/components/src/bubble/BubbleList.vue.js +0 -7
  247. package/dist/packages/components/src/bubble/BubbleList.vue2.js +0 -50
  248. package/dist/packages/components/src/bubble/index.js +0 -18
  249. package/dist/packages/components/src/container/index.js +0 -9
  250. package/dist/packages/components/src/container/index.vue.js +0 -7
  251. package/dist/packages/components/src/container/index.vue2.js +0 -55
  252. package/dist/packages/components/src/conversations/index.js +0 -9
  253. package/dist/packages/components/src/conversations/index.vue.js +0 -9
  254. package/dist/packages/components/src/feedback/components/SourceList.vue.js +0 -7
  255. package/dist/packages/components/src/feedback/components/SourceList.vue2.js +0 -52
  256. package/dist/packages/components/src/feedback/index.js +0 -9
  257. package/dist/packages/components/src/feedback/index.vue.js +0 -7
  258. package/dist/packages/components/src/feedback/index.vue2.js +0 -143
  259. package/dist/packages/components/src/history/components/item-tag.vue.js +0 -7
  260. package/dist/packages/components/src/history/components/item-tag.vue2.js +0 -21
  261. package/dist/packages/components/src/history/components/search-empty.vue.js +0 -7
  262. package/dist/packages/components/src/history/components/search-empty.vue2.js +0 -20
  263. package/dist/packages/components/src/history/composables/useEditItemTitle.js +0 -43
  264. package/dist/packages/components/src/history/index.js +0 -11
  265. package/dist/packages/components/src/history/index.vue.js +0 -7
  266. package/dist/packages/components/src/history/index.vue2.js +0 -130
  267. package/dist/packages/components/src/icon-button/index.js +0 -9
  268. package/dist/packages/components/src/icon-button/index.vue.js +0 -7
  269. package/dist/packages/components/src/icon-button/index.vue2.js +0 -22
  270. package/dist/packages/components/src/prompts/index.js +0 -18
  271. package/dist/packages/components/src/prompts/prompt.vue.js +0 -7
  272. package/dist/packages/components/src/prompts/prompt.vue2.js +0 -39
  273. package/dist/packages/components/src/prompts/prompts.vue.js +0 -7
  274. package/dist/packages/components/src/prompts/prompts.vue2.js +0 -36
  275. package/dist/packages/components/src/question/components/CommonQuestions.vue.js +0 -89
  276. package/dist/packages/components/src/question/components/CommonQuestions.vue2.js +0 -4
  277. package/dist/packages/components/src/question/components/HotQuestions.vue.js +0 -140
  278. package/dist/packages/components/src/question/components/HotQuestions.vue2.js +0 -4
  279. package/dist/packages/components/src/question/composables/useQuestions.js +0 -48
  280. package/dist/packages/components/src/question/index.js +0 -9
  281. package/dist/packages/components/src/question/index.vue.js +0 -113
  282. package/dist/packages/components/src/question/index.vue2.js +0 -4
  283. package/dist/packages/components/src/sender/components/ActionButtons.vue.js +0 -143
  284. package/dist/packages/components/src/sender/components/ActionButtons.vue2.js +0 -4
  285. package/dist/packages/components/src/sender/components/TemplateEditor.vue.js +0 -7
  286. package/dist/packages/components/src/sender/components/TemplateEditor.vue2.js +0 -175
  287. package/dist/packages/components/src/sender/composables/useInputHandler.js +0 -38
  288. package/dist/packages/components/src/sender/composables/useKeyboardHandler.js +0 -31
  289. package/dist/packages/components/src/sender/composables/useSpeechHandler.js +0 -67
  290. package/dist/packages/components/src/sender/index.js +0 -9
  291. package/dist/packages/components/src/sender/index.vue.js +0 -255
  292. package/dist/packages/components/src/sender/index.vue2.js +0 -4
  293. package/dist/packages/components/src/suggestion/components/CategoryNav.vue.js +0 -38
  294. package/dist/packages/components/src/suggestion/components/CategoryNav.vue2.js +0 -4
  295. package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue.js +0 -107
  296. package/dist/packages/components/src/suggestion/components/SuggestionCapsule.vue2.js +0 -4
  297. package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue.js +0 -123
  298. package/dist/packages/components/src/suggestion/components/SuggestionPanel.vue2.js +0 -4
  299. package/dist/packages/components/src/suggestion/composables/useKeyboardNavigation.js +0 -45
  300. package/dist/packages/components/src/suggestion/composables/useTriggerDetection.js +0 -17
  301. package/dist/packages/components/src/suggestion/index.js +0 -9
  302. package/dist/packages/components/src/suggestion/index.vue.js +0 -179
  303. package/dist/packages/components/src/suggestion/index.vue2.js +0 -4
  304. package/dist/packages/components/src/suggestion/utils/dom.js +0 -18
  305. package/dist/packages/components/src/welcome/index.js +0 -9
  306. package/dist/packages/components/src/welcome/index.vue.js +0 -7
  307. package/dist/packages/components/src/welcome/index.vue2.js +0 -32
  308. package/dist/prompts/index.d.ts +0 -12
  309. package/dist/prompts/index.type.d.ts +0 -55
  310. package/dist/prompts/prompt.vue.d.ts +0 -3
  311. package/dist/prompts/prompts.vue.d.ts +0 -20
  312. package/dist/question/components/CommonQuestions.vue.d.ts +0 -32
  313. package/dist/question/components/HotQuestions.vue.d.ts +0 -89
  314. package/dist/question/composables/useQuestions.d.ts +0 -17
  315. package/dist/question/index.d.ts +0 -7
  316. package/dist/question/index.type.d.ts +0 -74
  317. package/dist/question/index.vue.d.ts +0 -46
  318. package/dist/sender/components/ActionButtons.vue.d.ts +0 -25
  319. package/dist/sender/components/TemplateEditor.vue.d.ts +0 -18
  320. package/dist/sender/composables/useInputHandler.d.ts +0 -17
  321. package/dist/sender/composables/useKeyboardHandler.d.ts +0 -18
  322. package/dist/sender/composables/useSpeechHandler.d.ts +0 -8
  323. package/dist/sender/index.d.ts +0 -7
  324. package/dist/sender/index.type.d.ts +0 -137
  325. package/dist/sender/index.vue.d.ts +0 -1012
  326. package/dist/suggestion/components/CategoryNav.vue.d.ts +0 -45
  327. package/dist/suggestion/components/SuggestionCapsule.vue.d.ts +0 -32
  328. package/dist/suggestion/components/SuggestionPanel.vue.d.ts +0 -84
  329. package/dist/suggestion/composables/useKeyboardNavigation.d.ts +0 -18
  330. package/dist/suggestion/composables/useSuggestionFilter.d.ts +0 -10
  331. package/dist/suggestion/composables/useTriggerDetection.d.ts +0 -11
  332. package/dist/suggestion/index.d.ts +0 -7
  333. package/dist/suggestion/index.type.d.ts +0 -94
  334. package/dist/suggestion/index.vue.d.ts +0 -343
  335. package/dist/suggestion/utils/dom.d.ts +0 -20
  336. package/dist/welcome/index.d.ts +0 -7
  337. package/dist/welcome/index.type.d.ts +0 -10
  338. package/dist/welcome/index.vue.d.ts +0 -18
  339. package/src/action-group/ActionGroup.vue +0 -247
  340. package/src/action-group/ActionGroupItem.vue +0 -9
  341. package/src/action-group/index.ts +0 -25
  342. package/src/action-group/index.type.ts +0 -21
  343. package/src/assets/icons/accessory.svg +0 -12
  344. package/src/assets/icons/loading-speech.svg +0 -16
  345. package/src/assets/icons/loading.svg +0 -17
  346. package/src/assets/icons/send.svg +0 -21
  347. package/src/assets/icons/voice.svg +0 -22
  348. package/src/bubble/Bubble.vue +0 -153
  349. package/src/bubble/BubbleList.vue +0 -55
  350. package/src/bubble/index.ts +0 -23
  351. package/src/bubble/index.type.ts +0 -49
  352. package/src/container/index.ts +0 -12
  353. package/src/container/index.type.ts +0 -17
  354. package/src/container/index.vue +0 -109
  355. package/src/conversations/index.ts +0 -12
  356. package/src/conversations/index.vue +0 -3
  357. package/src/feedback/components/SourceList.vue +0 -112
  358. package/src/feedback/components/index.ts +0 -1
  359. package/src/feedback/index.ts +0 -12
  360. package/src/feedback/index.type.ts +0 -27
  361. package/src/feedback/index.vue +0 -166
  362. package/src/history/components/index.ts +0 -2
  363. package/src/history/components/item-tag.vue +0 -49
  364. package/src/history/components/search-empty.vue +0 -38
  365. package/src/history/composables/index.ts +0 -1
  366. package/src/history/composables/useEditItemTitle.ts +0 -75
  367. package/src/history/index.ts +0 -12
  368. package/src/history/index.type.ts +0 -50
  369. package/src/history/index.vue +0 -292
  370. package/src/icon-button/index.ts +0 -12
  371. package/src/icon-button/index.type.ts +0 -7
  372. package/src/icon-button/index.vue +0 -58
  373. package/src/index.ts +0 -76
  374. package/src/prompts/index.ts +0 -25
  375. package/src/prompts/index.type.ts +0 -59
  376. package/src/prompts/prompt.vue +0 -101
  377. package/src/prompts/prompts.vue +0 -50
  378. package/src/question/components/CommonQuestions.vue +0 -146
  379. package/src/question/components/HotQuestions.vue +0 -148
  380. package/src/question/composables/useQuestions.ts +0 -106
  381. package/src/question/index.less +0 -447
  382. package/src/question/index.ts +0 -12
  383. package/src/question/index.type.ts +0 -86
  384. package/src/question/index.vue +0 -140
  385. package/src/question/vars.less +0 -135
  386. package/src/sender/components/ActionButtons.vue +0 -168
  387. package/src/sender/components/TemplateEditor.vue +0 -465
  388. package/src/sender/composables/useInputHandler.ts +0 -74
  389. package/src/sender/composables/useKeyboardHandler.ts +0 -101
  390. package/src/sender/composables/useSpeechHandler.ts +0 -122
  391. package/src/sender/index.less +0 -352
  392. package/src/sender/index.ts +0 -12
  393. package/src/sender/index.type.ts +0 -162
  394. package/src/sender/index.vue +0 -338
  395. package/src/sender/vars.less +0 -84
  396. package/src/suggestion/components/CategoryNav.vue +0 -38
  397. package/src/suggestion/components/SuggestionCapsule.vue +0 -183
  398. package/src/suggestion/components/SuggestionPanel.vue +0 -147
  399. package/src/suggestion/composables/useKeyboardNavigation.ts +0 -101
  400. package/src/suggestion/composables/useSuggestionFilter.ts +0 -34
  401. package/src/suggestion/composables/useTriggerDetection.ts +0 -46
  402. package/src/suggestion/index.less +0 -497
  403. package/src/suggestion/index.ts +0 -12
  404. package/src/suggestion/index.type.ts +0 -101
  405. package/src/suggestion/index.vue +0 -338
  406. package/src/suggestion/utils/dom.ts +0 -66
  407. package/src/suggestion/vars.less +0 -141
  408. package/src/vite-env.d.ts +0 -1
  409. package/src/welcome/index.ts +0 -12
  410. package/src/welcome/index.type.ts +0 -12
  411. package/src/welcome/index.vue +0 -69
  412. package/tsconfig.json +0 -37
  413. package/tsconfig.node.json +0 -10
  414. package/vite.config.ts +0 -53
@@ -1,465 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref, nextTick, watch, onMounted } from 'vue'
3
- import { TemplatePart, TemplateEditorProps, TemplateEditorEmits, TemplateEditorExpose } from '../index.type'
4
-
5
- // 使用类型定义props
6
- const props = defineProps<TemplateEditorProps>()
7
-
8
- // 使用类型定义emits
9
- const emit = defineEmits<TemplateEditorEmits>()
10
-
11
- // 编辑器DOM引用
12
- const editorRef = ref<HTMLElement | null>(null)
13
-
14
- // 可编辑元素引用集合
15
- const editableRefs = ref<Record<number, HTMLElement>>({})
16
-
17
- // 当前激活的输入块索引
18
- const activeFieldIndex = ref<number>(-1)
19
-
20
- // 是否有内容标志
21
- const hasContent = ref(false)
22
-
23
- // 标记是否是用户手动编辑
24
- const isUserEditing = ref(false)
25
-
26
- // 标记是否是内部更新,避免循环更新
27
- const isInternalUpdate = ref(false)
28
-
29
- // 使用ref代替computed属性,作为组件的主要状态来源
30
- const editableParts = ref<TemplatePart[]>([])
31
-
32
- // 解析模板,将其分解为普通文本和可编辑字段
33
- const parseTemplate = (template: string): TemplatePart[] => {
34
- const parts: TemplatePart[] = []
35
- let currentIndex = 0
36
- let fieldIndex = 0
37
-
38
- // 正则表达式匹配 [xxx] 格式
39
- const regex = /\[(.*?)\]/g
40
- let match
41
-
42
- while ((match = regex.exec(template)) !== null) {
43
- // 添加匹配前的普通文本
44
- if (match.index > currentIndex) {
45
- parts.push({
46
- content: template.substring(currentIndex, match.index),
47
- isField: false,
48
- })
49
- }
50
-
51
- // 添加匹配的字段,将placeholder作为默认内容
52
- parts.push({
53
- content: match[1], // 使用占位符作为默认内容
54
- placeholder: match[1],
55
- isField: true,
56
- fieldIndex: fieldIndex++,
57
- })
58
-
59
- currentIndex = match.index + match[0].length
60
- }
61
-
62
- // 添加剩余的普通文本
63
- if (currentIndex < template.length) {
64
- parts.push({
65
- content: template.substring(currentIndex),
66
- isField: false,
67
- })
68
- }
69
-
70
- return parts
71
- }
72
-
73
- // 初始化editableParts
74
- const initializeEditableParts = (): void => {
75
- editableParts.value = parseTemplate(props.template)
76
- if (props.value) {
77
- updatePartsFromValue(props.value)
78
- }
79
- }
80
-
81
- // 从value更新各个部分的内容
82
- const updatePartsFromValue = (value: string): void => {
83
- if (!value || isInternalUpdate.value) return
84
-
85
- // 仅在值确实不同时才更新,避免不必要的处理
86
- const currentValue = generateValue()
87
- if (currentValue === value) return
88
-
89
- // 创建一个临时的解析结果用于比较
90
- const templateStructure = parseTemplate(props.template)
91
-
92
- // 计算模板的静态部分(非字段部分)
93
- const staticParts: string[] = []
94
-
95
- templateStructure.forEach((part) => {
96
- if (!part.isField) {
97
- staticParts.push(part.content)
98
- } else {
99
- // 用一个占位符标记字段位置
100
- staticParts.push(`__FIELD_${part.fieldIndex}__`)
101
- }
102
- })
103
-
104
- // 使用静态部分作为分隔符,尝试提取字段值
105
- let remainingValue = value
106
- let currentFieldIndex = 0
107
-
108
- // 遍历editableParts,找到字段并更新
109
- for (let i = 0; i < editableParts.value.length; i++) {
110
- const part = editableParts.value[i]
111
-
112
- if (!part.isField) continue
113
-
114
- // 尝试找到当前字段前的静态部分
115
- const prevStaticPart = staticParts[currentFieldIndex]
116
- currentFieldIndex++
117
-
118
- // 下一个静态部分(如果有)
119
- const nextStaticPart = staticParts[currentFieldIndex] || ''
120
-
121
- if (prevStaticPart && remainingValue.startsWith(prevStaticPart)) {
122
- // 移除前导静态部分
123
- remainingValue = remainingValue.substring(prevStaticPart.length)
124
-
125
- // 如果有下一个静态部分,提取中间的字段值
126
- if (nextStaticPart && remainingValue.includes(nextStaticPart)) {
127
- const fieldEndIndex = remainingValue.indexOf(nextStaticPart)
128
- const fieldValue = remainingValue.substring(0, fieldEndIndex)
129
-
130
- // 更新字段内容
131
- if (fieldValue) {
132
- editableParts.value[i].content = fieldValue
133
-
134
- // 如果当前字段是激活状态,更新DOM内容,但不改变光标位置
135
- if (activeFieldIndex.value === i && editableRefs.value[i]) {
136
- // 使用MutationObserver来禁用临时
137
- isUserEditing.value = true
138
- // 不要直接设置textContent,避免干扰用户输入
139
- }
140
- }
141
-
142
- // 移除已处理的部分
143
- remainingValue = remainingValue.substring(fieldEndIndex)
144
- } else if (!nextStaticPart && remainingValue) {
145
- // 如果是最后一个字段,则剩余的全部是它的值
146
- editableParts.value[i].content = remainingValue
147
- remainingValue = ''
148
- }
149
- }
150
- }
151
-
152
- // 更新内容状态
153
- checkHasContent(value)
154
- }
155
-
156
- // 生成完整的文本值
157
- const generateValue = (): string => {
158
- return editableParts.value.map((part) => part.content).join('')
159
- }
160
-
161
- // 更新值并触发事件
162
- const updateValue = (): void => {
163
- isInternalUpdate.value = true
164
- const newValue = generateValue()
165
- emit('update:value', newValue)
166
- emit('input', newValue)
167
- checkHasContent(newValue)
168
-
169
- // 延迟重置标志,防止循环更新
170
- setTimeout(() => {
171
- isInternalUpdate.value = false
172
- }, 0)
173
- }
174
-
175
- // 检查是否有内容
176
- const checkHasContent = (value?: string): void => {
177
- const contentValue = value || generateValue()
178
- const newHasContent = contentValue.trim().length > 0
179
-
180
- if (hasContent.value !== newHasContent) {
181
- hasContent.value = newHasContent
182
- emit('content-status', newHasContent)
183
- }
184
- }
185
-
186
- // 注册可编辑元素引用
187
- const registerEditableRef = (el: HTMLSpanElement | null, index: number): void => {
188
- if (el) {
189
- // 保存引用
190
- editableRefs.value[index] = el
191
-
192
- // 设置初始内容 (只在初始时设置,后续由用户输入控制)
193
- if (!el.textContent) {
194
- el.textContent = editableParts.value[index].content
195
- }
196
-
197
- // 使用MutationObserver监听内容变化,但避免循环更新
198
- const observer = new MutationObserver(() => {
199
- if (activeFieldIndex.value === index && !isUserEditing.value) {
200
- isUserEditing.value = true
201
-
202
- // 延迟更新模型,避免与Vue渲染循环冲突
203
- setTimeout(() => {
204
- editableParts.value[index].content = el.textContent !== null ? el.textContent : ''
205
- isUserEditing.value = false
206
- }, 0)
207
- }
208
- })
209
-
210
- observer.observe(el, {
211
- characterData: true,
212
- childList: true,
213
- subtree: true,
214
- })
215
- }
216
- }
217
-
218
- // 处理内容输入事件
219
- const handleContentInput = (event: Event, index: number): void => {
220
- isUserEditing.value = true
221
-
222
- // 获取当前输入内容
223
- const target = event.target as HTMLElement
224
- const content = target.textContent !== null ? target.textContent : ''
225
-
226
- // 更新模型,但不触发DOM更新
227
- if (editableParts.value[index].content !== content) {
228
- editableParts.value[index].content = content
229
- updateValue()
230
- }
231
-
232
- // 通过延时重置标志,防止与MutationObserver冲突
233
- setTimeout(() => {
234
- isUserEditing.value = false
235
- }, 10)
236
- }
237
-
238
- // 将光标放到元素内容末尾
239
- const placeCaretAtEnd = (el: HTMLElement): void => {
240
- if (document.createRange) {
241
- const range = document.createRange()
242
- range.selectNodeContents(el)
243
- // false表示光标放到末尾
244
- range.collapse(false)
245
-
246
- const selection = window.getSelection()
247
- if (selection) {
248
- selection.removeAllRanges()
249
- selection.addRange(range)
250
- }
251
- }
252
- }
253
-
254
- // 激活输入块
255
- const activateField = (index: number): void => {
256
- // 如果点击的就是当前激活的字段,不做任何处理
257
- if (activeFieldIndex.value === index) {
258
- return
259
- }
260
-
261
- // 如果当前已有激活的字段,先保存它的值
262
- if (activeFieldIndex.value !== -1) {
263
- const currentIndex = activeFieldIndex.value
264
- const el = editableRefs.value[currentIndex]
265
- if (el) {
266
- editableParts.value[currentIndex].content = el.textContent !== null ? el.textContent : ''
267
- updateValue()
268
- }
269
- }
270
-
271
- // 设置激活状态
272
- activeFieldIndex.value = index
273
- emit('field-active', true, index)
274
-
275
- // 确保DOM更新后再聚焦
276
- nextTick(() => {
277
- const el = editableRefs.value[index]
278
- if (el) {
279
- // 先获取焦点
280
- el.focus()
281
-
282
- // 确保元素有内容以便放置光标
283
- if (!el.textContent && editableParts.value[index].content) {
284
- el.textContent = editableParts.value[index].content
285
- }
286
-
287
- // 将光标放到末尾
288
- placeCaretAtEnd(el)
289
- }
290
- })
291
- }
292
-
293
- // 取消激活输入块
294
- const deactivateField = (): void => {
295
- const currentIndex = activeFieldIndex.value
296
- if (currentIndex >= 0) {
297
- // 更新当前编辑的内容
298
- const el = editableRefs.value[currentIndex]
299
- if (el) {
300
- // 使用实际内容,不回退到占位符
301
- const content = el.textContent !== null ? el.textContent : ''
302
- editableParts.value[currentIndex].content = content
303
- }
304
-
305
- emit('field-active', false, currentIndex)
306
- }
307
-
308
- updateValue()
309
- activeFieldIndex.value = -1
310
- }
311
-
312
- // 处理输入框键盘事件
313
- const handleInputKeyDown = (event: KeyboardEvent): void => {
314
- // 只处理Enter键
315
- if (event.key === 'Enter') {
316
- event.preventDefault()
317
- deactivateField()
318
- }
319
- }
320
-
321
- // 监听值变化
322
- watch(
323
- () => props.value,
324
- (newValue) => {
325
- // 如果外部值为空字符串,重置为默认placeholder值
326
- if (newValue === '') {
327
- resetToDefaultValues()
328
- } else if (newValue && !isInternalUpdate.value) {
329
- // 如果新值不为空,并且不是内部更新触发的,更新各部分内容
330
- updatePartsFromValue(newValue)
331
- }
332
- },
333
- )
334
-
335
- // 监听模板变化
336
- watch(
337
- () => props.template,
338
- () => {
339
- // 当模板变化时,重新初始化
340
- initializeEditableParts()
341
- // 检查内容状态
342
- nextTick(() => {
343
- checkHasContent()
344
- })
345
- },
346
- { immediate: true },
347
- )
348
-
349
- // 重置所有字段内容为默认值
350
- const resetToDefaultValues = (): void => {
351
- editableParts.value.forEach((part) => {
352
- if (part.isField) {
353
- part.content = part.placeholder || ''
354
- }
355
- })
356
- // 更新值
357
- updateValue()
358
- }
359
-
360
- // 重置所有字段内容
361
- const resetFields = (): void => {
362
- resetToDefaultValues()
363
- }
364
-
365
- // 组件挂载时
366
- onMounted(() => {
367
- // 初始化内容状态
368
- checkHasContent()
369
- })
370
-
371
- // 导出方法供父组件调用
372
- defineExpose<TemplateEditorExpose>({
373
- activateFirstField: () => {
374
- for (let i = 0; i < editableParts.value.length; i++) {
375
- if (editableParts.value[i].isField) {
376
- activateField(i)
377
- break
378
- }
379
- }
380
- },
381
- resetFields,
382
- })
383
- </script>
384
-
385
- <template>
386
- <div class="template-editor">
387
- <div class="template-content" ref="editorRef">
388
- <template v-for="(part, index) in editableParts" :key="index">
389
- <!-- 普通文本部分 -->
390
- <span v-if="!part.isField">{{ part.content }}</span>
391
-
392
- <!-- 可编辑的输入块部分 -->
393
- <span
394
- v-else
395
- class="template-field"
396
- :class="{ 'template-field-active': activeFieldIndex === index }"
397
- @click="activateField(index)"
398
- >
399
- <!-- 编辑状态显示 -->
400
- <span
401
- v-if="activeFieldIndex === index"
402
- :ref="(el) => registerEditableRef(el as HTMLSpanElement, index)"
403
- class="template-editable"
404
- contenteditable="true"
405
- @input="handleContentInput($event, index)"
406
- @blur="deactivateField()"
407
- @keydown="handleInputKeyDown($event)"
408
- @click.stop
409
- ></span>
410
- <!-- 非编辑状态显示 -->
411
- <span v-else class="template-placeholder">{{ part.content }}</span>
412
- </span>
413
- </template>
414
- </div>
415
- </div>
416
- </template>
417
-
418
- <style lang="less" scoped>
419
- .template-editor {
420
- width: 100%;
421
- min-height: 26px;
422
- line-height: 26px;
423
- }
424
-
425
- .template-content {
426
- display: inline;
427
- word-break: break-word;
428
- }
429
-
430
- .template-field {
431
- display: inline-block;
432
- height: 26px;
433
- min-width: fit-content;
434
- border-radius: 4px;
435
- background: rgba(0, 0, 0, 0.05);
436
- padding: 0 10px;
437
- margin: 0 2px;
438
- vertical-align: middle;
439
- cursor: text;
440
- transition: all 0.2s ease;
441
-
442
- &-active {
443
- background-color: #ffffff;
444
- border: 1px solid rgba(194, 194, 194);
445
- border-radius: 4px;
446
- }
447
-
448
- .template-placeholder {
449
- color: #333;
450
- user-select: none;
451
- }
452
- }
453
-
454
- .template-editable {
455
- display: inline-block;
456
- min-width: 1px; // 防止编辑框过窄
457
- outline: none;
458
- white-space: nowrap;
459
- color: #333;
460
-
461
- &:focus {
462
- outline: none;
463
- }
464
- }
465
- </style>
@@ -1,74 +0,0 @@
1
- import { ref, watch } from 'vue'
2
- import type { SenderProps, SenderEmits } from '../index.type'
3
-
4
- /**
5
- * 输入框值处理 Hook
6
- * 对输入框的值进行集中处理
7
- *
8
- * @param props 组件属性
9
- * @param emit 组件方法
10
- */
11
- export function useInputHandler(props: SenderProps, emit: SenderEmits) {
12
- const inputValue = ref(props.modelValue || props.defaultValue || '')
13
- const inputWrapper = ref<HTMLElement | null>(null)
14
-
15
- // 同步外部值变化
16
- watch(
17
- () => props.modelValue,
18
- (val) => {
19
- if (val !== undefined && val !== inputValue.value) {
20
- inputValue.value = val
21
- }
22
- },
23
- )
24
-
25
- // 监听内部值变化,触发update:modelValue事件
26
- watch(
27
- () => inputValue.value,
28
- (val) => {
29
- emit('update:modelValue', val)
30
- },
31
- )
32
-
33
- // 双向绑定处理
34
- const handleChange = (value: string) => {
35
- inputValue.value = value
36
- emit('update:modelValue', value)
37
- }
38
-
39
- // 提交处理
40
- const handleSubmit = (event?: Event) => {
41
- event?.preventDefault()
42
-
43
- const submitValue = inputValue.value
44
-
45
- if (!props.disabled && !props.loading && submitValue.trim()) {
46
- emit('submit', submitValue)
47
- }
48
- }
49
-
50
- // 清空输入
51
- const handleClear = () => {
52
- inputValue.value = ''
53
- emit('update:modelValue', '')
54
- emit('clear')
55
- }
56
-
57
- // 输入法状态
58
- const isComposing = ref(false)
59
-
60
- // 清除输入
61
- const clearInput = () => {
62
- handleClear()
63
- }
64
-
65
- return {
66
- inputValue,
67
- inputWrapper,
68
- isComposing,
69
- handleChange,
70
- handleSubmit,
71
- handleClear,
72
- clearInput,
73
- }
74
- }
@@ -1,101 +0,0 @@
1
- import { Ref } from 'vue'
2
- import type { SenderProps, SenderEmits, SpeechState, SubmitTrigger } from '../index.type'
3
-
4
- /**
5
- * 键盘处理Hook
6
- * 集中管理组件的键盘相关操作
7
- *
8
- * @param props - 组件属性
9
- * @param emit - 组件方法
10
- * @param inputValue - 输入值
11
- * @param isComposing - 是否处于输入法组合状态(即编辑态)
12
- * @param speechState - 语音识别状态
13
- * @param showSuggestions - 是否显示建议列表
14
- * @param toggleSpeech - 切换语音识别函数
15
- */
16
- export function useKeyboardHandler(
17
- props: SenderProps,
18
- emit: SenderEmits,
19
- inputValue: Ref<string>,
20
- isComposing: Ref<boolean>,
21
- speechState: SpeechState,
22
- showSuggestions: Ref<boolean>,
23
- toggleSpeech: () => void,
24
- ) {
25
- /**
26
- * 验证提交条件
27
- */
28
- const validateSubmission = (value: string) => {
29
- return !props.disabled && !props.loading && value.trim().length > 0
30
- }
31
-
32
- /**
33
- * 触发提交
34
- */
35
- const triggerSubmit = () => {
36
- if (!validateSubmission(inputValue.value)) return
37
- emit('submit', inputValue.value.trim())
38
- }
39
-
40
- /**
41
- * 检查是否为指定的提交快捷键
42
- * @param event 键盘事件
43
- * @param submitType 提交类型
44
- * @returns 是否触发提交
45
- *
46
- * 提交行为说明:
47
- * - 当 submitType 为 enter 时:按 Enter 键提交
48
- * - 当 submitType 为 ctrlEnter 时:按 Ctrl+Enter 提交,单独按 Enter 换行
49
- * - 当 submitType 为 shiftEnter 时:按 Shift+Enter 提交,单独按 Enter 换行
50
- */
51
- const checkSubmitShortcut = (event: KeyboardEvent, submitType: SubmitTrigger): boolean => {
52
- const isEnter = event.key === 'Enter'
53
- if (!isEnter) return false
54
-
55
- switch (submitType) {
56
- case 'enter':
57
- return !event.shiftKey && !event.ctrlKey && !event.metaKey
58
- case 'ctrlEnter':
59
- return (event.ctrlKey || event.metaKey) && !event.shiftKey
60
- case 'shiftEnter':
61
- return event.shiftKey && !event.ctrlKey && !event.metaKey
62
- default:
63
- return false
64
- }
65
- }
66
-
67
- /**
68
- * 处理键盘按下事件
69
- */
70
- const handleKeyPress = (event: KeyboardEvent) => {
71
- if (isComposing.value) return // 阻止输入法状态下的提交
72
-
73
- // 处理Esc键 - 关闭建议列表或停止语音录制
74
- if (event.key === 'Escape') {
75
- if (showSuggestions.value) {
76
- showSuggestions.value = false
77
- event.preventDefault()
78
- } else if (speechState.isRecording) {
79
- toggleSpeech()
80
- event.preventDefault()
81
- }
82
-
83
- emit('escape-press')
84
- return
85
- }
86
-
87
- // 检查是否匹配当前的提交快捷键
88
- const shouldSubmit = checkSubmitShortcut(event, props.submitType as SubmitTrigger)
89
-
90
- // 只有当满足提交条件且输入框有内容时才提交
91
- if (shouldSubmit && validateSubmission(inputValue.value)) {
92
- event.preventDefault()
93
- triggerSubmit()
94
- }
95
- }
96
-
97
- return {
98
- handleKeyPress,
99
- triggerSubmit,
100
- }
101
- }