@opentiny/tiny-robot 0.1.0-alpha.0 → 0.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bubble-item → bubble}/components/actions/copy.vue.d.ts +3 -3
- package/dist/{bubble-item → bubble}/components/actions/refresh.vue.d.ts +1 -1
- package/dist/bubble/index.d.ts +12 -0
- package/dist/bubble/index.type.d.ts +53 -0
- package/dist/bubble/useScroll.d.ts +4 -0
- package/dist/container/index.d.ts +7 -0
- package/dist/container/index.type.d.ts +16 -0
- package/dist/container/index.vue.d.ts +26 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.js +31 -20
- package/dist/node_modules/.pnpm/@opentiny_utils@1.0.0/node_modules/@opentiny/utils/dist/opentiny-utils.es.js +832 -0
- package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +959 -1496
- package/dist/node_modules/.pnpm/{@opentiny_vue-button@3.22.0 → @opentiny_vue-button@3.21.0}/node_modules/@opentiny/vue-button/lib/index.js +21 -21
- package/dist/node_modules/.pnpm/{@opentiny_vue-button@3.22.0 → @opentiny_vue-button@3.21.0}/node_modules/@opentiny/vue-button/lib/pc.js +3 -3
- package/dist/node_modules/.pnpm/@opentiny_vue-common@3.21.0/node_modules/@opentiny/vue-common/lib/index.js +727 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +144 -675
- package/dist/node_modules/.pnpm/{@opentiny_vue-dialog-box@3.22.0 → @opentiny_vue-dialog-box@3.21.0}/node_modules/@opentiny/vue-dialog-box/lib/index.js +9 -9
- package/dist/node_modules/.pnpm/{@opentiny_vue-dialog-box@3.22.0 → @opentiny_vue-dialog-box@3.21.0}/node_modules/@opentiny/vue-dialog-box/lib/pc.js +5 -5
- package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/close.js +29 -0
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/eyeclose.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/eyeopen.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/finish.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/fullscreen.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/loading-shadow.js +21 -22
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/minscreen.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-column-after.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-column-before.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-row-after.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-row-before.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-align-center.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-align-left.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-align-right.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-bold.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-code-block.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-code-view.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-color.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-delete-column.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-delete-row.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-delete-table.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-font-size.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-format-clear.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h1.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h2.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h3.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h4.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h5.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h6.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-heading.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-high-light.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-image.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-italic.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-line-height.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-link-unlink.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-link.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-list-ordered.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-list-unordered.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-merge-cells-vertical.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-merge-cells.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-node-delete.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-paragraph.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-quote-text.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-redo.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-split-cells-horizontal.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-split-cells-vertical.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-strike-through.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-subscript.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-superscript.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-table.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-task-list.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-underline.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-undo.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/sub-script.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/warn.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-input@3.22.0 → @opentiny_vue-input@3.21.0}/node_modules/@opentiny/vue-input/lib/index.js +3 -3
- package/dist/node_modules/.pnpm/{@opentiny_vue-input@3.22.0 → @opentiny_vue-input@3.21.0}/node_modules/@opentiny/vue-input/lib/pc.js +36 -36
- package/dist/node_modules/.pnpm/{@opentiny_vue-locale@3.22.0 → @opentiny_vue-locale@3.21.0}/node_modules/@opentiny/vue-locale/lib/index.js +63 -63
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/button/index.js +1 -1
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/browser.js +36 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/clickoutside.js +47 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/debounce.js +7 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/dom.js +45 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popper.js +320 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popup-manager.js +118 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/throttle.js +23 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useEventListener.js +9 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useInstanceSlots.js +14 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useRelation.js +54 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popper.js +84 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popup.js +73 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/event.js +13 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/function.js +5 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/index.js +11 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/object.js +84 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/string.js +28 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/type.js +28 -0
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/dialog-box/index.js +136 -0
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/dialog-box/vue.js +33 -34
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/input/index.js +22 -22
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/input/vue.js +9 -9
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tall-storage/index.js +1 -1
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tall-storage/vue.js +5 -5
- package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tooltip/index.js +41 -40
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tooltip/vue.js +90 -0
- package/dist/node_modules/.pnpm/{@opentiny_vue-tooltip@3.22.0 → @opentiny_vue-tooltip@3.21.0}/node_modules/@opentiny/vue-tooltip/lib/index.js +3 -6
- package/dist/node_modules/.pnpm/{@opentiny_vue-tooltip@3.22.0 → @opentiny_vue-tooltip@3.21.0}/node_modules/@opentiny/vue-tooltip/lib/pc.js +2 -2
- package/dist/packages/components/src/{bubble-list → bubble}/bubble-list.vue.js +2 -2
- package/dist/packages/components/src/bubble/bubble-list.vue2.js +37 -0
- package/dist/packages/components/src/bubble/bubble.vue.js +7 -0
- package/dist/packages/components/src/bubble/bubble.vue2.js +118 -0
- package/dist/packages/components/src/bubble/components/actions/copy.vue.js +7 -0
- package/dist/packages/components/src/bubble/components/actions/copy.vue2.js +35 -0
- package/dist/packages/components/src/bubble/components/actions/refresh.vue.js +7 -0
- package/dist/packages/components/src/bubble/components/actions/refresh.vue2.js +16 -0
- package/dist/packages/components/src/bubble/index.js +18 -0
- package/dist/packages/components/src/bubble/useScroll.js +13 -0
- package/dist/packages/components/src/container/index.js +9 -0
- package/dist/packages/components/src/container/index.vue.js +7 -0
- package/dist/packages/components/src/container/index.vue2.js +55 -0
- package/dist/packages/components/src/conversations/index.js +1 -1
- package/dist/packages/components/src/prompts/index.js +18 -0
- package/dist/packages/components/src/prompts/prompt.vue.js +7 -0
- package/dist/packages/components/src/prompts/prompt.vue2.js +37 -0
- package/dist/packages/components/src/prompts/prompts.vue.js +7 -0
- package/dist/packages/components/src/prompts/prompts.vue2.js +36 -0
- package/dist/packages/components/src/question/components/CommonQuestions.vue.js +89 -0
- package/dist/packages/components/src/question/components/CommonQuestions.vue2.js +4 -0
- package/dist/packages/components/src/question/components/HotQuestions.vue.js +140 -0
- package/dist/packages/components/src/question/components/HotQuestions.vue2.js +4 -0
- package/dist/packages/components/src/question/composables/useQuestions.js +48 -0
- package/dist/packages/components/src/question/index.js +9 -0
- package/dist/packages/components/src/question/index.vue.js +113 -0
- package/dist/packages/components/src/question/index.vue2.js +4 -0
- package/dist/packages/components/src/sender/components/ActionButtons.vue.js +105 -123
- package/dist/packages/components/src/sender/composables/useInputHandler.js +26 -22
- package/dist/packages/components/src/sender/composables/useKeyboardHandler.js +11 -11
- package/dist/packages/components/src/sender/composables/useSpeechHandler.js +9 -9
- package/dist/packages/components/src/sender/index.vue.js +67 -66
- package/dist/packages/components/src/welcome/index.vue.js +5 -7
- package/dist/packages/components/src/welcome/index.vue2.js +32 -0
- package/dist/packages/svgs/dist/tiny-robot-svgs.js +223 -0
- package/dist/prompts/index.d.ts +12 -0
- package/dist/prompts/index.type.d.ts +55 -0
- package/dist/prompts/prompt.vue.d.ts +3 -0
- package/dist/prompts/prompts.vue.d.ts +20 -0
- package/dist/question/components/CommonQuestions.vue.d.ts +32 -0
- package/dist/question/components/HotQuestions.vue.d.ts +89 -0
- package/dist/question/composables/useQuestions.d.ts +17 -0
- package/dist/question/index.d.ts +7 -0
- package/dist/question/index.type.d.ts +74 -0
- package/dist/question/index.vue.d.ts +46 -0
- package/dist/sender/components/ActionButtons.vue.d.ts +6 -4
- package/dist/sender/composables/useSpeechHandler.d.ts +0 -6
- package/dist/sender/index.type.d.ts +1 -1
- package/dist/sender/index.vue.d.ts +3 -4
- package/dist/style.css +1 -1
- package/dist/welcome/index.type.d.ts +10 -0
- package/dist/welcome/index.vue.d.ts +17 -1
- package/package.json +6 -5
- package/src/bubble/bubble-list.vue +42 -0
- package/src/bubble/bubble.vue +247 -0
- package/src/bubble/components/actions/copy.vue +54 -0
- package/src/bubble/components/actions/refresh.vue +31 -0
- package/src/bubble/index.ts +23 -0
- package/src/bubble/index.type.ts +63 -0
- package/src/bubble/useScroll.ts +14 -0
- package/src/container/index.ts +12 -0
- package/src/container/index.type.ts +17 -0
- package/src/container/index.vue +135 -0
- package/src/conversations/index.ts +1 -1
- package/src/index.ts +26 -12
- package/src/prompts/index.ts +25 -0
- package/src/prompts/index.type.ts +59 -0
- package/src/prompts/prompt.vue +115 -0
- package/src/prompts/prompts.vue +50 -0
- package/src/question/components/CommonQuestions.vue +146 -0
- package/src/question/components/HotQuestions.vue +148 -0
- package/src/question/composables/useQuestions.ts +106 -0
- package/src/question/index.less +448 -0
- package/src/question/index.ts +12 -0
- package/src/question/index.type.ts +86 -0
- package/src/question/index.vue +140 -0
- package/src/question/vars.less +135 -0
- package/src/sender/components/ActionButtons.vue +42 -39
- package/src/sender/composables/useInputHandler.ts +15 -10
- package/src/sender/composables/useKeyboardHandler.ts +6 -4
- package/src/sender/composables/useSpeechHandler.ts +5 -11
- package/src/sender/index.less +3 -5
- package/src/sender/index.type.ts +1 -1
- package/src/sender/index.vue +3 -2
- package/src/welcome/index.type.ts +12 -0
- package/src/welcome/index.vue +68 -2
- package/.vscode/extensions.json +0 -3
- package/dist/bubble-item/components/icons/ai.vue.d.ts +0 -2
- package/dist/bubble-item/components/icons/index.d.ts +0 -2
- package/dist/bubble-item/components/icons/user.vue.d.ts +0 -2
- package/dist/bubble-item/index.d.ts +0 -7
- package/dist/bubble-list/index.d.ts +0 -8
- package/dist/bubble-list/index.type.d.ts +0 -55
- package/dist/node_modules/.pnpm/@opentiny_vue-directive@3.22.0/node_modules/@opentiny/vue-directive/index.js +0 -57
- package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +0 -85
- package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popup.js +0 -69
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/dialog-box/index.js +0 -135
- package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +0 -90
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +0 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +0 -15
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +0 -54
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +0 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +0 -22
- package/dist/packages/components/src/bubble-item/bubble-item.vue.js +0 -7
- package/dist/packages/components/src/bubble-item/bubble-item.vue2.js +0 -111
- package/dist/packages/components/src/bubble-item/components/actions/copy.vue.js +0 -46
- package/dist/packages/components/src/bubble-item/components/actions/copy.vue2.js +0 -4
- package/dist/packages/components/src/bubble-item/components/actions/refresh.vue.js +0 -12
- package/dist/packages/components/src/bubble-item/components/icons/ai.vue.js +0 -45
- package/dist/packages/components/src/bubble-item/components/icons/user.vue.js +0 -63
- package/dist/packages/components/src/bubble-item/index.js +0 -9
- package/dist/packages/components/src/bubble-list/bubble-list.vue2.js +0 -52
- package/dist/packages/components/src/bubble-list/index.js +0 -9
- package/src/bubble-item/bubble-item.vue +0 -264
- package/src/bubble-item/components/actions/copy.vue +0 -47
- package/src/bubble-item/components/actions/refresh.vue +0 -27
- package/src/bubble-item/components/icons/ai.vue +0 -30
- package/src/bubble-item/components/icons/index.ts +0 -2
- package/src/bubble-item/components/icons/user.vue +0 -78
- package/src/bubble-item/index.ts +0 -12
- package/src/bubble-list/bubble-list.vue +0 -53
- package/src/bubble-list/index.ts +0 -14
- package/src/bubble-list/index.type.ts +0 -65
- package/src/sender/global.d.ts +0 -44
- /package/dist/{bubble-list → bubble}/bubble-list.vue.d.ts +0 -0
- /package/dist/{bubble-item → bubble}/components/actions/index.d.ts +0 -0
- /package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/button/vue.js +0 -0
- /package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/chunk-G2ADBYYC.js +0 -0
- /package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tall-storage/vue-storage-box.js +0 -0
- /package/src/{bubble-item → bubble}/components/actions/index.ts +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { IconCancelFullScreen, IconClose, IconFullScreen } from '@opentiny/tiny-robot-svgs'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { ContainerProps, ContainerSlots } from './index.type'
|
|
5
|
+
|
|
6
|
+
const show = defineModel<ContainerProps['show']>('show', { required: true })
|
|
7
|
+
const fullscreen = defineModel<ContainerProps['fullscreen']>('fullscreen')
|
|
8
|
+
|
|
9
|
+
defineSlots<ContainerSlots>()
|
|
10
|
+
|
|
11
|
+
const IconFullScreenSwitcher = computed(() => (fullscreen.value ? IconCancelFullScreen : IconFullScreen))
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="tr-container">
|
|
16
|
+
<div class="tr-container__dragging-bar-wrapper">
|
|
17
|
+
<div class="tr-container__dragging-bar"></div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="tr-container__header">
|
|
20
|
+
<slot name="title">
|
|
21
|
+
<h3 class="tr-container__title">OpenTiny NEXT</h3>
|
|
22
|
+
</slot>
|
|
23
|
+
<div class="tr-container__header-operations">
|
|
24
|
+
<slot name="operations"></slot>
|
|
25
|
+
<button class="icon-btn" @click="$emit('update:fullscreen', !fullscreen)">
|
|
26
|
+
<IconFullScreenSwitcher />
|
|
27
|
+
</button>
|
|
28
|
+
<button class="icon-btn" @click="$emit('update:show', false)">
|
|
29
|
+
<IconClose />
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="tr-container__body">
|
|
34
|
+
<slot></slot>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="tr-container__footer">
|
|
37
|
+
<slot name="footer"></slot>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<style lang="less" scoped>
|
|
43
|
+
.tr-container {
|
|
44
|
+
--tr-container-width: 480px;
|
|
45
|
+
|
|
46
|
+
background-color: rgb(248, 248, 248);
|
|
47
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
48
|
+
position: fixed;
|
|
49
|
+
top: 0;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
left: v-bind('fullscreen? "0" : "unset"');
|
|
53
|
+
width: v-bind('fullscreen? "unset" : "var(--tr-container-width)"');
|
|
54
|
+
z-index: v-bind('show? "100":"-1"');
|
|
55
|
+
opacity: v-bind('show? "1":"0"');
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
|
|
59
|
+
.tr-container__dragging-bar-wrapper {
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
padding: 6px;
|
|
66
|
+
|
|
67
|
+
// TODO 拖拽条的逻辑
|
|
68
|
+
.tr-container__dragging-bar {
|
|
69
|
+
width: 40px;
|
|
70
|
+
height: 4px;
|
|
71
|
+
background-color: rgb(217, 217, 217);
|
|
72
|
+
border-radius: 999px;
|
|
73
|
+
cursor: grab;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.tr-container__header {
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
padding: 4px 24px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.tr-container__title {
|
|
87
|
+
margin: 0;
|
|
88
|
+
padding: 0;
|
|
89
|
+
color: rgb(25, 25, 25);
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
font-size: 14px;
|
|
92
|
+
line-height: 22px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.tr-container__header-operations {
|
|
96
|
+
display: flex;
|
|
97
|
+
gap: 8px;
|
|
98
|
+
|
|
99
|
+
button.icon-btn {
|
|
100
|
+
width: 28px;
|
|
101
|
+
height: 28px;
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
border: none;
|
|
106
|
+
border-radius: 8px;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
padding: 0;
|
|
109
|
+
transition: background-color 0.3s;
|
|
110
|
+
|
|
111
|
+
&:hover {
|
|
112
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:active {
|
|
116
|
+
background-color: rgba(0, 0, 0, 0.15);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
svg {
|
|
120
|
+
width: 20px;
|
|
121
|
+
height: 20px;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.tr-container__body {
|
|
127
|
+
flex: 1;
|
|
128
|
+
overflow-y: auto;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tr-container__footer {
|
|
132
|
+
flex-shrink: 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
import { App } from 'vue'
|
|
2
|
-
import
|
|
2
|
+
import { Bubble, BubbleList } from './bubble'
|
|
3
|
+
import Container from './container'
|
|
3
4
|
import Conversations from './conversations'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
5
|
+
import { Prompt, Prompts } from './prompts'
|
|
6
|
+
import Question from './question'
|
|
6
7
|
import Sender from './sender'
|
|
8
|
+
import Welcome from './welcome'
|
|
7
9
|
|
|
8
|
-
export * from './bubble
|
|
10
|
+
export * from './bubble/index.type'
|
|
11
|
+
export * from './prompts/index.type'
|
|
12
|
+
export * from './sender/index.type'
|
|
13
|
+
export * from './welcome/index.type'
|
|
9
14
|
|
|
10
|
-
const components = [
|
|
15
|
+
const components = [Bubble, BubbleList, Container, Conversations, Prompt, Prompts, Question, Sender, Welcome]
|
|
11
16
|
|
|
12
17
|
export default {
|
|
13
18
|
install<T>(app: App<T>) {
|
|
14
19
|
components.forEach((component) => {
|
|
15
|
-
const name = component.name
|
|
20
|
+
const name = component.name!.replace(/^Tiny/, '').replace(/^Tr/, '')
|
|
16
21
|
app.component(`Tr${name}`, component)
|
|
17
|
-
app.component(`Tiny${name}`, component)
|
|
18
22
|
})
|
|
19
23
|
},
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
BubbleItem as TinyBubbleItem,
|
|
27
|
+
Bubble,
|
|
28
|
+
Bubble as TrBubble,
|
|
29
|
+
BubbleList,
|
|
27
30
|
BubbleList as TrBubbleList,
|
|
28
|
-
|
|
31
|
+
Container,
|
|
32
|
+
Container as TrContainer,
|
|
33
|
+
Conversations,
|
|
34
|
+
Conversations as TrConversations,
|
|
35
|
+
Prompt,
|
|
36
|
+
Prompt as TrPrompt,
|
|
37
|
+
Prompts,
|
|
38
|
+
Prompts as TrPrompts,
|
|
39
|
+
Sender,
|
|
29
40
|
Sender as TrSender,
|
|
41
|
+
Welcome,
|
|
42
|
+
Welcome as TrWelcome,
|
|
43
|
+
Question,
|
|
30
44
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import PromptComp from './prompt.vue'
|
|
3
|
+
import PromptsComp from './prompts.vue'
|
|
4
|
+
|
|
5
|
+
// TrPrompt
|
|
6
|
+
PromptComp.name = 'TrPrompt'
|
|
7
|
+
|
|
8
|
+
const installPrompt = function <T>(app: App<T>) {
|
|
9
|
+
app.component(PromptComp.name!, PromptComp)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
PromptComp.install = installPrompt
|
|
13
|
+
|
|
14
|
+
export const Prompt = PromptComp as typeof PromptComp & { install: typeof installPrompt }
|
|
15
|
+
|
|
16
|
+
// TrPrompts
|
|
17
|
+
PromptsComp.name = 'TrPrompts'
|
|
18
|
+
|
|
19
|
+
const installPrompts = function <T>(app: App<T>) {
|
|
20
|
+
app.component(PromptsComp.name!, PromptsComp)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
PromptsComp.install = installPrompts
|
|
24
|
+
|
|
25
|
+
export const Prompts = PromptsComp as typeof PromptsComp & { install: typeof installPrompts }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CSSProperties, VNode } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface PromptProps {
|
|
4
|
+
/**
|
|
5
|
+
* 提示标签,显示提示的主要内容
|
|
6
|
+
*/
|
|
7
|
+
label: string
|
|
8
|
+
/**
|
|
9
|
+
* 唯一标识用于区分每个提示项,用于 Prompts 列表。如果不传此参数,则使用 index 作为 key
|
|
10
|
+
*/
|
|
11
|
+
id?: string
|
|
12
|
+
/**
|
|
13
|
+
* 提示描述,提供额外的信息
|
|
14
|
+
*/
|
|
15
|
+
description?: string
|
|
16
|
+
/**
|
|
17
|
+
* 提示图标,显示在提示项的左侧
|
|
18
|
+
*/
|
|
19
|
+
icon?: VNode
|
|
20
|
+
/**
|
|
21
|
+
* 是否禁用。默认 false
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean
|
|
24
|
+
/**
|
|
25
|
+
* 提示徽章,显示在提示项的右上角
|
|
26
|
+
*/
|
|
27
|
+
badge?: string | VNode
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PromptsProps {
|
|
31
|
+
/**
|
|
32
|
+
* 包含多个提示项的列表
|
|
33
|
+
*/
|
|
34
|
+
items: PromptProps[]
|
|
35
|
+
/**
|
|
36
|
+
* 自定义样式,用于各个提示项的不同部分
|
|
37
|
+
*/
|
|
38
|
+
itemStyle?: string | CSSProperties
|
|
39
|
+
/**
|
|
40
|
+
* 自定义类名,用于各个提示项的不同部分
|
|
41
|
+
*/
|
|
42
|
+
itemClass?: string | string[]
|
|
43
|
+
/**
|
|
44
|
+
* 提示列表是否垂直排列。默认 false
|
|
45
|
+
*/
|
|
46
|
+
vertical?: boolean
|
|
47
|
+
/**
|
|
48
|
+
* 提示列表是否折行。默认 false
|
|
49
|
+
*/
|
|
50
|
+
wrap?: boolean
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface PromptsEvents {
|
|
54
|
+
(e: 'item-click', ev: MouseEvent, item: PromptProps): void
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface PromptsSlots {
|
|
58
|
+
footer?: () => unknown
|
|
59
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, defineComponent, VNode } from 'vue'
|
|
3
|
+
import { PromptProps } from './index.type'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<PromptProps>()
|
|
6
|
+
|
|
7
|
+
const vnodeToComponent = (vnode?: VNode | string) => {
|
|
8
|
+
if (!vnode) {
|
|
9
|
+
return null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return defineComponent(() => {
|
|
13
|
+
return () => vnode
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const iconComp = computed(() => {
|
|
18
|
+
return vnodeToComponent(props.icon)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const badgeComp = computed(() => {
|
|
22
|
+
return vnodeToComponent(props.badge)
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div :class="['tr-prompt', { disabled: props.disabled }]">
|
|
28
|
+
<div class="tr-prompt__icon">
|
|
29
|
+
<component :is="iconComp"></component>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="tr-prompt__content">
|
|
32
|
+
<h6 class="tr-prompt__content-label">{{ props.label }}</h6>
|
|
33
|
+
<p v-if="props.description" class="tr-prompt__content-description">{{ props.description }}</p>
|
|
34
|
+
</div>
|
|
35
|
+
<div :class="['tr-prompt__badge', { label: typeof props.badge === 'string' }]">
|
|
36
|
+
<component :is="badgeComp"></component>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<style lang="less" scoped>
|
|
42
|
+
.tr-prompt {
|
|
43
|
+
--tr-prompt-bg-color: white;
|
|
44
|
+
--tr-prompt-hover-color: rgba(0, 0, 0, 0.04);
|
|
45
|
+
--tr-prompt-active-color: rgba(0, 0, 0, 0.15);
|
|
46
|
+
--tr-prompt-disabled-color: rgba(0, 0, 0, 0.04);
|
|
47
|
+
--tr-prompt-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
|
48
|
+
--tr-prompt-text: rgb(25, 25, 25);
|
|
49
|
+
--tr-prompt-text-muted: rgb(89, 89, 89);
|
|
50
|
+
|
|
51
|
+
flex: none;
|
|
52
|
+
display: flex;
|
|
53
|
+
gap: 12px;
|
|
54
|
+
border-radius: 16px;
|
|
55
|
+
box-shadow: var(--tr-prompt-box-shadow);
|
|
56
|
+
padding: 16px 24px;
|
|
57
|
+
position: relative;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: background 0.3s;
|
|
60
|
+
background-color: var(--tr-prompt-bg-color);
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background-color: var(--tr-prompt-hover-color);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.disabled {
|
|
67
|
+
cursor: default;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
background-color: var(--tr-prompt-disabled-color);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:active {
|
|
73
|
+
background-color: var(--tr-prompt-active-color);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.tr-prompt__content {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: 4px;
|
|
81
|
+
align-items: start;
|
|
82
|
+
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
line-height: 24px;
|
|
85
|
+
color: var(--tr-prompt-text);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.tr-prompt__content-label {
|
|
89
|
+
margin: 0;
|
|
90
|
+
padding: 0;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tr-prompt__content-description {
|
|
95
|
+
margin: 0;
|
|
96
|
+
padding: 0;
|
|
97
|
+
color: var(--tr-prompt-text-muted);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.tr-prompt__badge {
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 0;
|
|
103
|
+
right: 0;
|
|
104
|
+
padding: 0 12px;
|
|
105
|
+
border-top-right-radius: 16px;
|
|
106
|
+
border-bottom-left-radius: 16px;
|
|
107
|
+
background-color: rgb(255, 234, 232);
|
|
108
|
+
|
|
109
|
+
&.label {
|
|
110
|
+
color: rgb(242, 48, 48);
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
line-height: 22px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { toRaw } from 'vue'
|
|
3
|
+
import { PromptProps, PromptsEvents, PromptsProps, PromptsSlots } from './index.type'
|
|
4
|
+
import Prompt from './prompt.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<PromptsProps>()
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits<PromptsEvents>()
|
|
9
|
+
|
|
10
|
+
defineSlots<PromptsSlots>()
|
|
11
|
+
|
|
12
|
+
const handleClick = (ev: MouseEvent, item: PromptProps) => {
|
|
13
|
+
emit('item-click', ev, toRaw(item))
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class="tr-prompts">
|
|
19
|
+
<div :class="['tr-prompts__list-container', { wrap: props.wrap, vertical: props.vertical }]">
|
|
20
|
+
<Prompt
|
|
21
|
+
v-for="(item, index) in props.items"
|
|
22
|
+
:key="item.id || index"
|
|
23
|
+
v-bind="item"
|
|
24
|
+
:style="props.itemStyle"
|
|
25
|
+
:class="props.itemClass"
|
|
26
|
+
@click="handleClick($event, item)"
|
|
27
|
+
></Prompt>
|
|
28
|
+
</div>
|
|
29
|
+
<slot name="footer"></slot>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style lang="less" scoped>
|
|
34
|
+
.tr-prompts {
|
|
35
|
+
.tr-prompts__list-container {
|
|
36
|
+
display: flex;
|
|
37
|
+
gap: 16px;
|
|
38
|
+
overflow-x: auto;
|
|
39
|
+
|
|
40
|
+
&.wrap {
|
|
41
|
+
flex-wrap: wrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.vertical {
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: flex-start;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch, onMounted, onBeforeUnmount, nextTick, PropType } from 'vue'
|
|
3
|
+
import type { Question } from '../index.type'
|
|
4
|
+
import { IconEdit } from '@opentiny/tiny-robot-svgs'
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
questions: {
|
|
8
|
+
type: Array as PropType<Question[]>,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
isExpanded: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits(['question-click', 'show-expand-button'])
|
|
18
|
+
|
|
19
|
+
const commonQuestionsRef = ref<HTMLElement | null>(null)
|
|
20
|
+
const showExpandButton = ref(false)
|
|
21
|
+
const isExpandedRef = ref(false)
|
|
22
|
+
const visibleQuestions = ref<Question[]>([])
|
|
23
|
+
const hiddenQuestions = ref<Question[]>([])
|
|
24
|
+
|
|
25
|
+
watch(
|
|
26
|
+
() => props.isExpanded,
|
|
27
|
+
(val) => {
|
|
28
|
+
isExpandedRef.value = val
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
// 检查是否需要显示展开/收起按钮并计算能够容纳的最大胶囊数
|
|
33
|
+
const checkOverflow = async () => {
|
|
34
|
+
await nextTick()
|
|
35
|
+
if (commonQuestionsRef.value) {
|
|
36
|
+
const container = commonQuestionsRef.value
|
|
37
|
+
const containerWidth = container.clientWidth
|
|
38
|
+
|
|
39
|
+
// 重置胶囊分组
|
|
40
|
+
visibleQuestions.value = []
|
|
41
|
+
hiddenQuestions.value = []
|
|
42
|
+
|
|
43
|
+
if (props.questions.length === 0) {
|
|
44
|
+
showExpandButton.value = false
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 计算一行可以容纳多少个胶囊
|
|
49
|
+
let accumulatedWidth = 0
|
|
50
|
+
const margin = 8 // 胶囊之间的间距
|
|
51
|
+
|
|
52
|
+
// 克隆一个胶囊元素来测量其基本尺寸
|
|
53
|
+
const tempItem = document.createElement('div')
|
|
54
|
+
tempItem.className = 'tr-common-questions_item'
|
|
55
|
+
tempItem.style.visibility = 'hidden'
|
|
56
|
+
tempItem.style.position = 'absolute'
|
|
57
|
+
container.appendChild(tempItem)
|
|
58
|
+
|
|
59
|
+
// 计算每个胶囊的宽度并确定一行能容纳多少个
|
|
60
|
+
for (let i = 0; i < props.questions.length; i++) {
|
|
61
|
+
const question = props.questions[i]
|
|
62
|
+
|
|
63
|
+
// 设置临时元素内容来测量其宽度
|
|
64
|
+
tempItem.textContent = question.text
|
|
65
|
+
const itemWidth = tempItem.offsetWidth + margin
|
|
66
|
+
|
|
67
|
+
// 检查是否还能容纳下一个胶囊
|
|
68
|
+
if (accumulatedWidth + itemWidth <= containerWidth) {
|
|
69
|
+
accumulatedWidth += itemWidth
|
|
70
|
+
visibleQuestions.value.push(question)
|
|
71
|
+
} else {
|
|
72
|
+
hiddenQuestions.value.push(question)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 移除临时元素
|
|
77
|
+
container.removeChild(tempItem)
|
|
78
|
+
|
|
79
|
+
// 如果有隐藏的胶囊,显示展开按钮
|
|
80
|
+
showExpandButton.value = hiddenQuestions.value.length > 0
|
|
81
|
+
// 初始状态设为未展开
|
|
82
|
+
isExpandedRef.value = false
|
|
83
|
+
|
|
84
|
+
emit('show-expand-button', showExpandButton.value)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 处理问题点击
|
|
89
|
+
const handleQuestionClick = (question: Question) => {
|
|
90
|
+
emit('question-click', question)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// 监听 props 变化
|
|
94
|
+
watch(
|
|
95
|
+
() => props.questions,
|
|
96
|
+
() => {
|
|
97
|
+
// 当问题列表变化时重新计算
|
|
98
|
+
checkOverflow()
|
|
99
|
+
},
|
|
100
|
+
{ deep: true },
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
// 处理窗口大小变化
|
|
104
|
+
const handleResize = () => {
|
|
105
|
+
checkOverflow()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 组件挂载时添加窗口大小变化监听
|
|
109
|
+
onMounted(() => {
|
|
110
|
+
checkOverflow()
|
|
111
|
+
window.addEventListener('resize', handleResize)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// 组件卸载时移除监听器
|
|
115
|
+
onBeforeUnmount(() => {
|
|
116
|
+
window.removeEventListener('resize', handleResize)
|
|
117
|
+
})
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<div class="tr-common-questions" ref="commonQuestionsRef" :class="{ expanded: isExpandedRef }">
|
|
122
|
+
<!-- 渲染可见的胶囊 -->
|
|
123
|
+
<div
|
|
124
|
+
v-for="(question, index) in visibleQuestions"
|
|
125
|
+
:key="`visible-${question.id}-${index}`"
|
|
126
|
+
class="tr-common-questions_item"
|
|
127
|
+
@click="handleQuestionClick(question)"
|
|
128
|
+
>
|
|
129
|
+
<div style="display: flex; align-items: center"><IconEdit /></div>
|
|
130
|
+
{{ question.text }}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<!-- 渲染被隐藏的胶囊(展开时显示) -->
|
|
134
|
+
<div v-if="isExpandedRef">
|
|
135
|
+
<div
|
|
136
|
+
v-for="(question, index) in hiddenQuestions"
|
|
137
|
+
:key="`hidden-${question.id}-${index}`"
|
|
138
|
+
class="tr-common-questions_item"
|
|
139
|
+
@click="handleQuestionClick(question)"
|
|
140
|
+
>
|
|
141
|
+
<IconEdit />
|
|
142
|
+
{{ question.text }}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</template>
|