@yh-ui/components 0.1.10 → 0.1.12
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/ai-action-group/__tests__/ai-action-group.ssr.test.cjs +55 -0
- package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.d.ts +1 -0
- package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.mjs +39 -0
- package/dist/ai-action-group/__tests__/ai-action-group.test.cjs +149 -0
- package/dist/ai-action-group/__tests__/ai-action-group.test.d.ts +1 -0
- package/dist/ai-action-group/__tests__/ai-action-group.test.mjs +104 -0
- package/dist/ai-action-group/index.cjs +26 -0
- package/dist/ai-action-group/index.d.ts +3 -0
- package/dist/ai-action-group/index.mjs +5 -0
- package/dist/ai-action-group/src/ai-action-group.cjs +50 -0
- package/dist/ai-action-group/src/ai-action-group.css +517 -0
- package/dist/ai-action-group/src/ai-action-group.d.ts +55 -0
- package/dist/ai-action-group/src/ai-action-group.d.vue.ts +40 -0
- package/dist/ai-action-group/src/ai-action-group.mjs +44 -0
- package/dist/ai-action-group/src/ai-action-group.vue +602 -0
- package/dist/ai-action-group/src/ai-action-group.vue.d.ts +40 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.cjs +61 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.d.ts +1 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.mjs +65 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.cjs +70 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.d.ts +1 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.mjs +64 -0
- package/dist/ai-agent-card/index.cjs +26 -0
- package/dist/ai-agent-card/index.d.ts +3 -0
- package/dist/ai-agent-card/index.mjs +5 -0
- package/dist/ai-agent-card/src/ai-agent-card.cjs +74 -0
- package/dist/ai-agent-card/src/ai-agent-card.css +859 -0
- package/dist/ai-agent-card/src/ai-agent-card.d.ts +122 -0
- package/dist/ai-agent-card/src/ai-agent-card.d.vue.ts +62 -0
- package/dist/ai-agent-card/src/ai-agent-card.mjs +68 -0
- package/dist/ai-agent-card/src/ai-agent-card.vue +1029 -0
- package/dist/ai-agent-card/src/ai-agent-card.vue.d.ts +62 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.cjs +73 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.d.ts +1 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.mjs +68 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.cjs +128 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.d.ts +1 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.mjs +109 -0
- package/dist/ai-artifacts/index.cjs +26 -0
- package/dist/ai-artifacts/index.d.ts +3 -0
- package/dist/ai-artifacts/index.mjs +5 -0
- package/dist/ai-artifacts/src/ai-artifacts.cjs +55 -0
- package/dist/ai-artifacts/src/ai-artifacts.css +633 -0
- package/dist/ai-artifacts/src/ai-artifacts.d.ts +93 -0
- package/dist/ai-artifacts/src/ai-artifacts.d.vue.ts +33 -0
- package/dist/ai-artifacts/src/ai-artifacts.mjs +49 -0
- package/dist/ai-artifacts/src/ai-artifacts.vue +803 -0
- package/dist/ai-artifacts/src/ai-artifacts.vue.d.ts +33 -0
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.cjs +87 -0
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.d.ts +1 -0
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.mjs +58 -0
- package/dist/ai-bubble/__tests__/ai-bubble.test.cjs +227 -0
- package/dist/ai-bubble/__tests__/ai-bubble.test.d.ts +1 -0
- package/dist/ai-bubble/__tests__/ai-bubble.test.mjs +123 -0
- package/dist/ai-bubble/index.cjs +26 -0
- package/dist/ai-bubble/index.d.ts +3 -0
- package/dist/ai-bubble/index.mjs +5 -0
- package/dist/ai-bubble/src/ai-bubble.cjs +86 -0
- package/dist/ai-bubble/src/ai-bubble.css +932 -0
- package/dist/ai-bubble/src/ai-bubble.d.ts +126 -0
- package/dist/ai-bubble/src/ai-bubble.d.vue.ts +110 -0
- package/dist/ai-bubble/src/ai-bubble.mjs +80 -0
- package/dist/ai-bubble/src/ai-bubble.vue +1300 -0
- package/dist/ai-bubble/src/ai-bubble.vue.d.ts +110 -0
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.cjs +82 -0
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.d.ts +1 -0
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.mjs +69 -0
- package/dist/ai-chat/__tests__/ai-chat.test.cjs +169 -0
- package/dist/ai-chat/__tests__/ai-chat.test.d.ts +1 -0
- package/dist/ai-chat/__tests__/ai-chat.test.mjs +121 -0
- package/dist/ai-chat/index.cjs +26 -0
- package/dist/ai-chat/index.d.ts +3 -0
- package/dist/ai-chat/index.mjs +5 -0
- package/dist/ai-chat/src/ai-chat.cjs +41 -0
- package/dist/ai-chat/src/ai-chat.css +503 -0
- package/dist/ai-chat/src/ai-chat.d.ts +57 -0
- package/dist/ai-chat/src/ai-chat.d.vue.ts +43 -0
- package/dist/ai-chat/src/ai-chat.mjs +35 -0
- package/dist/ai-chat/src/ai-chat.vue +606 -0
- package/dist/ai-chat/src/ai-chat.vue.d.ts +43 -0
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.cjs +66 -0
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.d.ts +1 -0
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.mjs +48 -0
- package/dist/ai-code-block/__tests__/ai-code-block.test.cjs +174 -0
- package/dist/ai-code-block/__tests__/ai-code-block.test.d.ts +1 -0
- package/dist/ai-code-block/__tests__/ai-code-block.test.mjs +108 -0
- package/dist/ai-code-block/index.cjs +26 -0
- package/dist/ai-code-block/index.d.ts +3 -0
- package/dist/ai-code-block/index.mjs +5 -0
- package/dist/ai-code-block/src/ai-code-block.cjs +79 -0
- package/dist/ai-code-block/src/ai-code-block.css +589 -0
- package/dist/ai-code-block/src/ai-code-block.d.ts +76 -0
- package/dist/ai-code-block/src/ai-code-block.d.vue.ts +63 -0
- package/dist/ai-code-block/src/ai-code-block.mjs +73 -0
- package/dist/ai-code-block/src/ai-code-block.vue +706 -0
- package/dist/ai-code-block/src/ai-code-block.vue.d.ts +63 -0
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.cjs +50 -0
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.d.ts +1 -0
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.mjs +42 -0
- package/dist/ai-conversations/__tests__/ai-conversations.test.cjs +67 -0
- package/dist/ai-conversations/__tests__/ai-conversations.test.d.ts +1 -0
- package/dist/ai-conversations/__tests__/ai-conversations.test.mjs +51 -0
- package/dist/ai-conversations/index.cjs +26 -0
- package/dist/ai-conversations/index.d.ts +3 -0
- package/dist/ai-conversations/index.mjs +5 -0
- package/dist/ai-conversations/src/ai-conversations.cjs +69 -0
- package/dist/ai-conversations/src/ai-conversations.css +679 -0
- package/dist/ai-conversations/src/ai-conversations.d.ts +67 -0
- package/dist/ai-conversations/src/ai-conversations.d.vue.ts +52 -0
- package/dist/ai-conversations/src/ai-conversations.mjs +63 -0
- package/dist/ai-conversations/src/ai-conversations.vue +949 -0
- package/dist/ai-conversations/src/ai-conversations.vue.d.ts +52 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.cjs +62 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.d.ts +1 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.mjs +50 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.cjs +315 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.d.ts +1 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.mjs +226 -0
- package/dist/ai-editor-sender/index.cjs +26 -0
- package/dist/ai-editor-sender/index.d.ts +3 -0
- package/dist/ai-editor-sender/index.mjs +5 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.cjs +66 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.css +566 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.d.ts +70 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.d.vue.ts +70 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.mjs +60 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.vue +713 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.vue.d.ts +70 -0
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.cjs +49 -0
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.d.ts +1 -0
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.mjs +41 -0
- package/dist/ai-prompts/__tests__/ai-prompts.test.cjs +54 -0
- package/dist/ai-prompts/__tests__/ai-prompts.test.d.ts +1 -0
- package/dist/ai-prompts/__tests__/ai-prompts.test.mjs +38 -0
- package/dist/ai-prompts/index.cjs +26 -0
- package/dist/ai-prompts/index.d.ts +3 -0
- package/dist/ai-prompts/index.mjs +5 -0
- package/dist/ai-prompts/src/ai-prompts.cjs +42 -0
- package/dist/ai-prompts/src/ai-prompts.css +572 -0
- package/dist/ai-prompts/src/ai-prompts.d.ts +45 -0
- package/dist/ai-prompts/src/ai-prompts.d.vue.ts +44 -0
- package/dist/ai-prompts/src/ai-prompts.mjs +36 -0
- package/dist/ai-prompts/src/ai-prompts.vue +646 -0
- package/dist/ai-prompts/src/ai-prompts.vue.d.ts +44 -0
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.cjs +33 -0
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.d.ts +1 -0
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.mjs +34 -0
- package/dist/ai-provider/__tests__/ai-provider.test.cjs +38 -0
- package/dist/ai-provider/__tests__/ai-provider.test.d.ts +1 -0
- package/dist/ai-provider/__tests__/ai-provider.test.mjs +33 -0
- package/dist/ai-provider/index.cjs +38 -0
- package/dist/ai-provider/index.d.ts +4 -0
- package/dist/ai-provider/index.mjs +6 -0
- package/dist/ai-provider/src/ai-provider.cjs +7 -0
- package/dist/ai-provider/src/ai-provider.d.ts +88 -0
- package/dist/ai-provider/src/ai-provider.d.vue.ts +48 -0
- package/dist/ai-provider/src/ai-provider.mjs +1 -0
- package/dist/ai-provider/src/ai-provider.vue +24 -0
- package/dist/ai-provider/src/ai-provider.vue.d.ts +48 -0
- package/dist/ai-provider/src/use-ai-provider.cjs +11 -0
- package/dist/ai-provider/src/use-ai-provider.d.ts +10 -0
- package/dist/ai-provider/src/use-ai-provider.mjs +5 -0
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.cjs +46 -0
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.d.ts +1 -0
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.mjs +37 -0
- package/dist/ai-sender/__tests__/ai-sender.test.cjs +388 -0
- package/dist/ai-sender/__tests__/ai-sender.test.d.ts +1 -0
- package/dist/ai-sender/__tests__/ai-sender.test.mjs +248 -0
- package/dist/ai-sender/index.cjs +26 -0
- package/dist/ai-sender/index.d.ts +3 -0
- package/dist/ai-sender/index.mjs +5 -0
- package/dist/ai-sender/src/ai-sender.cjs +91 -0
- package/dist/ai-sender/src/ai-sender.css +754 -0
- package/dist/ai-sender/src/ai-sender.d.ts +140 -0
- package/dist/ai-sender/src/ai-sender.d.vue.ts +69 -0
- package/dist/ai-sender/src/ai-sender.mjs +85 -0
- package/dist/ai-sender/src/ai-sender.vue +1032 -0
- package/dist/ai-sender/src/ai-sender.vue.d.ts +69 -0
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.cjs +72 -0
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.d.ts +1 -0
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.mjs +82 -0
- package/dist/ai-sources/__tests__/ai-sources.test.cjs +93 -0
- package/dist/ai-sources/__tests__/ai-sources.test.d.ts +1 -0
- package/dist/ai-sources/__tests__/ai-sources.test.mjs +89 -0
- package/dist/ai-sources/index.cjs +26 -0
- package/dist/ai-sources/index.d.ts +3 -0
- package/dist/ai-sources/index.mjs +5 -0
- package/dist/ai-sources/src/ai-sources.cjs +59 -0
- package/dist/ai-sources/src/ai-sources.css +830 -0
- package/dist/ai-sources/src/ai-sources.d.ts +79 -0
- package/dist/ai-sources/src/ai-sources.d.vue.ts +45 -0
- package/dist/ai-sources/src/ai-sources.mjs +53 -0
- package/dist/ai-sources/src/ai-sources.vue +1109 -0
- package/dist/ai-sources/src/ai-sources.vue.d.ts +45 -0
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.cjs +56 -0
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.d.ts +1 -0
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.mjs +42 -0
- package/dist/ai-thinking/__tests__/ai-thinking.test.cjs +151 -0
- package/dist/ai-thinking/__tests__/ai-thinking.test.d.ts +1 -0
- package/dist/ai-thinking/__tests__/ai-thinking.test.mjs +96 -0
- package/dist/ai-thinking/index.cjs +26 -0
- package/dist/ai-thinking/index.d.ts +3 -0
- package/dist/ai-thinking/index.mjs +5 -0
- package/dist/ai-thinking/src/ai-thinking.cjs +44 -0
- package/dist/ai-thinking/src/ai-thinking.css +543 -0
- package/dist/ai-thinking/src/ai-thinking.d.ts +42 -0
- package/dist/ai-thinking/src/ai-thinking.d.vue.ts +33 -0
- package/dist/ai-thinking/src/ai-thinking.mjs +38 -0
- package/dist/ai-thinking/src/ai-thinking.vue +631 -0
- package/dist/ai-thinking/src/ai-thinking.vue.d.ts +33 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.cjs +83 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.d.ts +1 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.mjs +52 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.cjs +204 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.d.ts +1 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.mjs +134 -0
- package/dist/ai-thought-chain/index.cjs +26 -0
- package/dist/ai-thought-chain/index.d.ts +3 -0
- package/dist/ai-thought-chain/index.mjs +5 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.cjs +68 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.css +668 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.d.ts +82 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.d.vue.ts +83 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.mjs +62 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.vue +813 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.vue.d.ts +83 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.cjs +32 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.d.ts +1 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.mjs +25 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.cjs +113 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.d.ts +1 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.mjs +93 -0
- package/dist/ai-voice-trigger/index.cjs +26 -0
- package/dist/ai-voice-trigger/index.d.ts +3 -0
- package/dist/ai-voice-trigger/index.mjs +5 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.cjs +35 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.css +603 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.d.ts +37 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.d.vue.ts +29 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.mjs +29 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.vue +708 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.vue.d.ts +29 -0
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.cjs +57 -0
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.d.ts +1 -0
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.mjs +39 -0
- package/dist/ai-welcome/__tests__/ai-welcome.test.cjs +169 -0
- package/dist/ai-welcome/__tests__/ai-welcome.test.d.ts +1 -0
- package/dist/ai-welcome/__tests__/ai-welcome.test.mjs +113 -0
- package/dist/ai-welcome/index.cjs +26 -0
- package/dist/ai-welcome/index.d.ts +3 -0
- package/dist/ai-welcome/index.mjs +5 -0
- package/dist/ai-welcome/src/ai-welcome.cjs +56 -0
- package/dist/ai-welcome/src/ai-welcome.css +591 -0
- package/dist/ai-welcome/src/ai-welcome.d.ts +59 -0
- package/dist/ai-welcome/src/ai-welcome.d.vue.ts +51 -0
- package/dist/ai-welcome/src/ai-welcome.mjs +50 -0
- package/dist/ai-welcome/src/ai-welcome.vue +655 -0
- package/dist/ai-welcome/src/ai-welcome.vue.d.ts +51 -0
- package/dist/alert/src/alert.d.vue.ts +5 -5
- package/dist/alert/src/alert.vue.d.ts +5 -5
- package/dist/autocomplete/src/autocomplete.d.vue.ts +2 -2
- package/dist/autocomplete/src/autocomplete.vue.d.ts +2 -2
- package/dist/avatar/index.d.ts +39 -1
- package/dist/back-top/src/back-top.d.vue.ts +1 -1
- package/dist/back-top/src/back-top.vue.d.ts +1 -1
- package/dist/button/index.d.ts +3 -3
- package/dist/button/src/button.css +3 -3
- package/dist/button/src/button.d.vue.ts +1 -1
- package/dist/button/src/button.vue +3 -3
- package/dist/button/src/button.vue.d.ts +1 -1
- package/dist/calendar/src/calendar.d.vue.ts +2 -2
- package/dist/calendar/src/calendar.vue.d.ts +2 -2
- package/dist/cascader/src/cascader-panel.d.vue.ts +2 -2
- package/dist/cascader/src/cascader-panel.vue.d.ts +2 -2
- package/dist/checkbox/index.d.ts +3 -3
- package/dist/checkbox/src/checkbox-group.d.vue.ts +1 -1
- package/dist/checkbox/src/checkbox-group.vue +13 -1
- package/dist/checkbox/src/checkbox-group.vue.d.ts +1 -1
- package/dist/checkbox/src/checkbox.d.ts +12 -0
- package/dist/col/src/col.d.vue.ts +4 -4
- package/dist/col/src/col.vue.d.ts +4 -4
- package/dist/color-picker/src/color-picker.d.vue.ts +1 -1
- package/dist/color-picker/src/color-picker.vue.d.ts +1 -1
- package/dist/component.d.ts +63 -0
- package/dist/date-picker/src/date-picker.d.vue.ts +4 -4
- package/dist/date-picker/src/date-picker.vue.d.ts +4 -4
- package/dist/descriptions/src/description-item.d.vue.ts +1 -1
- package/dist/descriptions/src/description-item.vue.d.ts +1 -1
- package/dist/dialog/src/dialog.d.vue.ts +6 -6
- package/dist/dialog/src/dialog.vue.d.ts +6 -6
- package/dist/drawer/src/drawer.d.vue.ts +3 -3
- package/dist/drawer/src/drawer.vue.d.ts +3 -3
- package/dist/dropdown/src/dropdown-item.d.vue.ts +1 -1
- package/dist/dropdown/src/dropdown-item.vue.d.ts +1 -1
- package/dist/dropdown/src/dropdown.d.vue.ts +8 -8
- package/dist/dropdown/src/dropdown.vue.d.ts +8 -8
- package/dist/form/__tests__/form-schema.test.cjs +477 -24
- package/dist/form/__tests__/form-schema.test.mjs +277 -57
- package/dist/form/index.cjs +12 -0
- package/dist/form/index.d.ts +1 -2
- package/dist/form/index.mjs +1 -0
- package/dist/form/src/form-item.d.vue.ts +2 -1
- package/dist/form/src/form-item.vue +3 -1
- package/dist/form/src/form-item.vue.d.ts +2 -1
- package/dist/form/src/form-schema.cjs +2 -1
- package/dist/form/src/form-schema.d.ts +124 -19
- package/dist/form/src/form-schema.d.vue.ts +69 -19
- package/dist/form/src/form-schema.mjs +2 -1
- package/dist/form/src/form-schema.vue +522 -160
- package/dist/form/src/form-schema.vue.d.ts +69 -19
- package/dist/form/src/form.cjs +7 -0
- package/dist/form/src/form.d.ts +20 -0
- package/dist/form/src/form.d.vue.ts +10 -1
- package/dist/form/src/form.mjs +7 -0
- package/dist/form/src/form.vue +22 -10
- package/dist/form/src/form.vue.d.ts +10 -1
- package/dist/grid/src/grid.d.vue.ts +1 -1
- package/dist/grid/src/grid.vue.d.ts +1 -1
- package/dist/icon/src/icons/index.cjs +122 -2
- package/dist/icon/src/icons/index.d.ts +24 -0
- package/dist/icon/src/icons/index.mjs +145 -1
- package/dist/image/index.d.ts +356 -2
- package/dist/image/src/image-viewer.d.vue.ts +3 -3
- package/dist/image/src/image-viewer.vue.d.ts +3 -3
- package/dist/image/src/image.d.vue.ts +4 -4
- package/dist/image/src/image.vue.d.ts +4 -4
- package/dist/index.cjs +193 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +49 -1
- package/dist/input/index.d.ts +18 -18
- package/dist/input/src/input.d.vue.ts +6 -6
- package/dist/input/src/input.vue.d.ts +6 -6
- package/dist/input-tag/src/input-tag.d.vue.ts +2 -2
- package/dist/input-tag/src/input-tag.vue.d.ts +2 -2
- package/dist/mention/src/mention.d.vue.ts +8 -8
- package/dist/mention/src/mention.vue.d.ts +8 -8
- package/dist/menu/src/menu.d.vue.ts +4 -4
- package/dist/menu/src/menu.vue.d.ts +4 -4
- package/dist/message/src/message.d.vue.ts +1 -1
- package/dist/message/src/message.vue.d.ts +1 -1
- package/dist/popconfirm/src/popconfirm.d.vue.ts +5 -5
- package/dist/popconfirm/src/popconfirm.vue.d.ts +5 -5
- package/dist/popover/src/popover.d.vue.ts +4 -4
- package/dist/popover/src/popover.vue.d.ts +4 -4
- package/dist/progress/src/progress.d.vue.ts +1 -1
- package/dist/progress/src/progress.vue.d.ts +1 -1
- package/dist/radio/src/radio-group.d.vue.ts +1 -1
- package/dist/radio/src/radio-group.vue +25 -4
- package/dist/radio/src/radio-group.vue.d.ts +1 -1
- package/dist/radio/src/radio.d.ts +12 -0
- package/dist/rate/src/rate.d.vue.ts +1 -1
- package/dist/rate/src/rate.vue.d.ts +1 -1
- package/dist/select/src/select.d.vue.ts +1 -1
- package/dist/select/src/select.vue.d.ts +1 -1
- package/dist/skeleton/src/skeleton.d.vue.ts +1 -1
- package/dist/skeleton/src/skeleton.vue.d.ts +1 -1
- package/dist/slider/src/slider.d.vue.ts +1 -1
- package/dist/slider/src/slider.vue.d.ts +1 -1
- package/dist/steps/src/step.d.vue.ts +1 -1
- package/dist/steps/src/step.vue.d.ts +1 -1
- package/dist/switch/src/switch.d.vue.ts +2 -2
- package/dist/switch/src/switch.vue.d.ts +2 -2
- package/dist/table/__tests__/table.perf.test.cjs +2 -2
- package/dist/table/__tests__/table.perf.test.mjs +2 -2
- package/dist/table/__tests__/table.test.cjs +18 -0
- package/dist/table/__tests__/table.test.mjs +18 -0
- package/dist/table/__tests__/use-table-import.test.cjs +6 -0
- package/dist/table/__tests__/use-table-import.test.mjs +8 -1
- package/dist/table/src/table-column.d.vue.ts +1 -1
- package/dist/table/src/table-column.vue.d.ts +1 -1
- package/dist/table/src/table.d.vue.ts +1 -1
- package/dist/table/src/table.vue.d.ts +1 -1
- package/dist/tabs/src/tab-pane.d.vue.ts +1 -1
- package/dist/tabs/src/tab-pane.vue.d.ts +1 -1
- package/dist/tabs/src/tabs.d.vue.ts +2 -2
- package/dist/tabs/src/tabs.vue.d.ts +2 -2
- package/dist/tooltip/index.d.ts +7 -7
- package/dist/tooltip/src/tooltip.d.vue.ts +7 -7
- package/dist/tooltip/src/tooltip.vue.d.ts +7 -7
- package/dist/tree/src/tree.d.vue.ts +1 -1
- package/dist/tree/src/tree.vue.d.ts +1 -1
- package/dist/tree-select/src/tree-select.d.vue.ts +3 -3
- package/dist/tree-select/src/tree-select.vue.d.ts +3 -3
- package/dist/upload/src/upload.d.vue.ts +1 -1
- package/dist/upload/src/upload.vue.d.ts +1 -1
- package/package.json +8 -5
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _serverRenderer = require("@vue/server-renderer");
|
|
5
|
+
var _vue = require("vue");
|
|
6
|
+
_vitest.vi.mock("highlight.js", () => ({
|
|
7
|
+
default: {
|
|
8
|
+
getLanguage: lang => lang === "typescript",
|
|
9
|
+
highlight: _vitest.vi.fn(() => ({
|
|
10
|
+
value: "highlighted"
|
|
11
|
+
})),
|
|
12
|
+
highlightAuto: _vitest.vi.fn(() => ({
|
|
13
|
+
value: "auto"
|
|
14
|
+
}))
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
_vitest.vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
18
|
+
const {
|
|
19
|
+
default: AiCodeBlock
|
|
20
|
+
} = await Promise.resolve().then(() => require("../src/ai-code-block.vue"));
|
|
21
|
+
(0, _vitest.describe)("YhAiCodeBlock SSR", () => {
|
|
22
|
+
(0, _vitest.it)("should render to string on server", async () => {
|
|
23
|
+
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeBlock, {
|
|
24
|
+
code: "const x = 1",
|
|
25
|
+
language: "typescript"
|
|
26
|
+
}));
|
|
27
|
+
(0, _vitest.expect)(html).toContain("yh-ai-code-block");
|
|
28
|
+
});
|
|
29
|
+
(0, _vitest.it)("should render filename in header on server", async () => {
|
|
30
|
+
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeBlock, {
|
|
31
|
+
code: "const x = 1",
|
|
32
|
+
filename: "utils.ts"
|
|
33
|
+
}));
|
|
34
|
+
(0, _vitest.expect)(html).toContain("utils.ts");
|
|
35
|
+
(0, _vitest.expect)(html).toContain("yh-ai-code-block__lang");
|
|
36
|
+
});
|
|
37
|
+
(0, _vitest.it)("should render language in header when no filename on server", async () => {
|
|
38
|
+
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeBlock, {
|
|
39
|
+
code: "const x = 1",
|
|
40
|
+
language: "typescript"
|
|
41
|
+
}));
|
|
42
|
+
(0, _vitest.expect)(html).toContain("typescript");
|
|
43
|
+
});
|
|
44
|
+
(0, _vitest.it)("should render language class in code element on server", async () => {
|
|
45
|
+
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeBlock, {
|
|
46
|
+
code: "const x = 1",
|
|
47
|
+
language: "typescript"
|
|
48
|
+
}));
|
|
49
|
+
(0, _vitest.expect)(html).toContain("language-typescript");
|
|
50
|
+
});
|
|
51
|
+
(0, _vitest.it)("should render code body on server", async () => {
|
|
52
|
+
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeBlock, {
|
|
53
|
+
code: "sample code",
|
|
54
|
+
language: "text",
|
|
55
|
+
highlight: false
|
|
56
|
+
}));
|
|
57
|
+
(0, _vitest.expect)(html).toContain("sample code");
|
|
58
|
+
(0, _vitest.expect)(html).toContain("yh-ai-code-block__body");
|
|
59
|
+
});
|
|
60
|
+
(0, _vitest.it)("should render copy button on server", async () => {
|
|
61
|
+
const html = await (0, _serverRenderer.renderToString)((0, _vue.h)(AiCodeBlock, {
|
|
62
|
+
code: "code"
|
|
63
|
+
}));
|
|
64
|
+
(0, _vitest.expect)(html).toContain("yh-ai-code-block__actions");
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import { renderToString } from "@vue/server-renderer";
|
|
3
|
+
import { h } from "vue";
|
|
4
|
+
vi.mock("highlight.js", () => ({
|
|
5
|
+
default: {
|
|
6
|
+
getLanguage: (lang) => lang === "typescript",
|
|
7
|
+
highlight: vi.fn(() => ({ value: "highlighted" })),
|
|
8
|
+
highlightAuto: vi.fn(() => ({ value: "auto" }))
|
|
9
|
+
}
|
|
10
|
+
}));
|
|
11
|
+
vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
12
|
+
const { default: AiCodeBlock } = await import("../src/ai-code-block.vue");
|
|
13
|
+
describe("YhAiCodeBlock SSR", () => {
|
|
14
|
+
it("should render to string on server", async () => {
|
|
15
|
+
const html = await renderToString(
|
|
16
|
+
h(AiCodeBlock, { code: "const x = 1", language: "typescript" })
|
|
17
|
+
);
|
|
18
|
+
expect(html).toContain("yh-ai-code-block");
|
|
19
|
+
});
|
|
20
|
+
it("should render filename in header on server", async () => {
|
|
21
|
+
const html = await renderToString(h(AiCodeBlock, { code: "const x = 1", filename: "utils.ts" }));
|
|
22
|
+
expect(html).toContain("utils.ts");
|
|
23
|
+
expect(html).toContain("yh-ai-code-block__lang");
|
|
24
|
+
});
|
|
25
|
+
it("should render language in header when no filename on server", async () => {
|
|
26
|
+
const html = await renderToString(
|
|
27
|
+
h(AiCodeBlock, { code: "const x = 1", language: "typescript" })
|
|
28
|
+
);
|
|
29
|
+
expect(html).toContain("typescript");
|
|
30
|
+
});
|
|
31
|
+
it("should render language class in code element on server", async () => {
|
|
32
|
+
const html = await renderToString(
|
|
33
|
+
h(AiCodeBlock, { code: "const x = 1", language: "typescript" })
|
|
34
|
+
);
|
|
35
|
+
expect(html).toContain("language-typescript");
|
|
36
|
+
});
|
|
37
|
+
it("should render code body on server", async () => {
|
|
38
|
+
const html = await renderToString(
|
|
39
|
+
h(AiCodeBlock, { code: "sample code", language: "text", highlight: false })
|
|
40
|
+
);
|
|
41
|
+
expect(html).toContain("sample code");
|
|
42
|
+
expect(html).toContain("yh-ai-code-block__body");
|
|
43
|
+
});
|
|
44
|
+
it("should render copy button on server", async () => {
|
|
45
|
+
const html = await renderToString(h(AiCodeBlock, { code: "code" }));
|
|
46
|
+
expect(html).toContain("yh-ai-code-block__actions");
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _testUtils = require("@vue/test-utils");
|
|
5
|
+
_vitest.vi.mock("highlight.js", () => ({
|
|
6
|
+
default: {
|
|
7
|
+
getLanguage: lang => lang === "typescript" || lang === "javascript" || lang === "python",
|
|
8
|
+
highlight: _vitest.vi.fn((_code, _opts) => ({
|
|
9
|
+
value: '<span class="hljs-keyword">const</span>'
|
|
10
|
+
})),
|
|
11
|
+
highlightAuto: _vitest.vi.fn(() => ({
|
|
12
|
+
value: "<span>auto</span>"
|
|
13
|
+
}))
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
16
|
+
_vitest.vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
17
|
+
const {
|
|
18
|
+
default: AiCodeBlock
|
|
19
|
+
} = await Promise.resolve().then(() => require("../src/ai-code-block.vue"));
|
|
20
|
+
(0, _vitest.describe)("YhAiCodeBlock", () => {
|
|
21
|
+
(0, _vitest.beforeEach)(() => {
|
|
22
|
+
const mockClipboard = {
|
|
23
|
+
writeText: _vitest.vi.fn().mockResolvedValue(void 0)
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(navigator, "clipboard", {
|
|
26
|
+
value: mockClipboard,
|
|
27
|
+
writable: true,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
(0, _vitest.it)("should render with base class", () => {
|
|
32
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
33
|
+
props: {
|
|
34
|
+
code: "const x = 1"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block").exists()).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
(0, _vitest.it)("should render header and body", () => {
|
|
40
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
41
|
+
props: {
|
|
42
|
+
code: "const x = 1"
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__header").exists()).toBe(true);
|
|
46
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__body").exists()).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
(0, _vitest.it)("should show filename in lang label when filename provided", () => {
|
|
49
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
50
|
+
props: {
|
|
51
|
+
code: "const x = 1",
|
|
52
|
+
language: "typescript",
|
|
53
|
+
filename: "utils.ts"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__lang").text()).toBe("utils.ts");
|
|
57
|
+
});
|
|
58
|
+
(0, _vitest.it)("should show language in lang label when filename not provided", () => {
|
|
59
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
60
|
+
props: {
|
|
61
|
+
code: "const x = 1",
|
|
62
|
+
language: "typescript"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__lang").text()).toBe("typescript");
|
|
66
|
+
});
|
|
67
|
+
(0, _vitest.it)("should show text as default language", () => {
|
|
68
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
69
|
+
props: {
|
|
70
|
+
code: "plain text"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__lang").text()).toBe("text");
|
|
74
|
+
});
|
|
75
|
+
(0, _vitest.it)("should render code element with language class", () => {
|
|
76
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
77
|
+
props: {
|
|
78
|
+
code: "const x = 1",
|
|
79
|
+
language: "typescript"
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const code = wrapper.find("code");
|
|
83
|
+
(0, _vitest.expect)(code.classes()).toContain("language-typescript");
|
|
84
|
+
});
|
|
85
|
+
(0, _vitest.it)("should render code content", () => {
|
|
86
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
87
|
+
props: {
|
|
88
|
+
code: "hello world",
|
|
89
|
+
language: "text",
|
|
90
|
+
highlight: false
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
(0, _vitest.expect)(wrapper.html()).toContain("hello world");
|
|
94
|
+
});
|
|
95
|
+
(0, _vitest.it)("should apply hljs class to code element", () => {
|
|
96
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
97
|
+
props: {
|
|
98
|
+
code: "const x = 1"
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
(0, _vitest.expect)(wrapper.find("code").classes()).toContain("hljs");
|
|
102
|
+
});
|
|
103
|
+
(0, _vitest.it)("should render highlighted code when highlight=true and language recognized", () => {
|
|
104
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
105
|
+
props: {
|
|
106
|
+
code: "const x = 1",
|
|
107
|
+
language: "typescript",
|
|
108
|
+
highlight: true
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
(0, _vitest.expect)(wrapper.find("code").html()).toContain("hljs-keyword");
|
|
112
|
+
});
|
|
113
|
+
(0, _vitest.it)("should render raw code when highlight=false", () => {
|
|
114
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
115
|
+
props: {
|
|
116
|
+
code: "raw code here",
|
|
117
|
+
language: "typescript",
|
|
118
|
+
highlight: false
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
(0, _vitest.expect)(wrapper.find("code").html()).toContain("raw code here");
|
|
122
|
+
});
|
|
123
|
+
(0, _vitest.it)("should show copy button", () => {
|
|
124
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
125
|
+
props: {
|
|
126
|
+
code: "const x = 1"
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
(0, _vitest.expect)(wrapper.find(".yh-ai-code-block__actions .yh-button").exists()).toBe(true);
|
|
130
|
+
});
|
|
131
|
+
(0, _vitest.it)("should emit copy event and call clipboard on copy click", async () => {
|
|
132
|
+
const code = "const x = 1";
|
|
133
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
134
|
+
props: {
|
|
135
|
+
code
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
139
|
+
(0, _vitest.expect)(navigator.clipboard.writeText).toHaveBeenCalledWith(code);
|
|
140
|
+
(0, _vitest.expect)(wrapper.emitted("copy")).toBeTruthy();
|
|
141
|
+
(0, _vitest.expect)(wrapper.emitted("copy")[0][0]).toBe(code);
|
|
142
|
+
});
|
|
143
|
+
(0, _vitest.it)("should NOT emit copy when code is empty", async () => {
|
|
144
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
145
|
+
props: {
|
|
146
|
+
code: ""
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
150
|
+
(0, _vitest.expect)(wrapper.emitted("copy")).toBeFalsy();
|
|
151
|
+
});
|
|
152
|
+
(0, _vitest.it)("should render default slot instead of code when slot provided", () => {
|
|
153
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
154
|
+
props: {
|
|
155
|
+
code: "ignored code"
|
|
156
|
+
},
|
|
157
|
+
slots: {
|
|
158
|
+
default: '<em class="custom-code">custom</em>'
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
(0, _vitest.expect)(wrapper.find(".custom-code").exists()).toBe(true);
|
|
162
|
+
});
|
|
163
|
+
(0, _vitest.it)("should render actions slot", () => {
|
|
164
|
+
const wrapper = (0, _testUtils.mount)(AiCodeBlock, {
|
|
165
|
+
props: {
|
|
166
|
+
code: "code"
|
|
167
|
+
},
|
|
168
|
+
slots: {
|
|
169
|
+
actions: '<button class="extra-action">Run</button>'
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
(0, _vitest.expect)(wrapper.find(".extra-action").exists()).toBe(true);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import { mount } from "@vue/test-utils";
|
|
3
|
+
vi.mock("highlight.js", () => ({
|
|
4
|
+
default: {
|
|
5
|
+
getLanguage: (lang) => lang === "typescript" || lang === "javascript" || lang === "python",
|
|
6
|
+
highlight: vi.fn((_code, _opts) => ({
|
|
7
|
+
value: '<span class="hljs-keyword">const</span>'
|
|
8
|
+
})),
|
|
9
|
+
highlightAuto: vi.fn(() => ({ value: "<span>auto</span>" }))
|
|
10
|
+
}
|
|
11
|
+
}));
|
|
12
|
+
vi.mock("highlight.js/styles/atom-one-dark.css", () => ({}));
|
|
13
|
+
const { default: AiCodeBlock } = await import("../src/ai-code-block.vue");
|
|
14
|
+
describe("YhAiCodeBlock", () => {
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
const mockClipboard = { writeText: vi.fn().mockResolvedValue(void 0) };
|
|
17
|
+
Object.defineProperty(navigator, "clipboard", {
|
|
18
|
+
value: mockClipboard,
|
|
19
|
+
writable: true,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it("should render with base class", () => {
|
|
24
|
+
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
25
|
+
expect(wrapper.find(".yh-ai-code-block").exists()).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it("should render header and body", () => {
|
|
28
|
+
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
29
|
+
expect(wrapper.find(".yh-ai-code-block__header").exists()).toBe(true);
|
|
30
|
+
expect(wrapper.find(".yh-ai-code-block__body").exists()).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
it("should show filename in lang label when filename provided", () => {
|
|
33
|
+
const wrapper = mount(AiCodeBlock, {
|
|
34
|
+
props: { code: "const x = 1", language: "typescript", filename: "utils.ts" }
|
|
35
|
+
});
|
|
36
|
+
expect(wrapper.find(".yh-ai-code-block__lang").text()).toBe("utils.ts");
|
|
37
|
+
});
|
|
38
|
+
it("should show language in lang label when filename not provided", () => {
|
|
39
|
+
const wrapper = mount(AiCodeBlock, {
|
|
40
|
+
props: { code: "const x = 1", language: "typescript" }
|
|
41
|
+
});
|
|
42
|
+
expect(wrapper.find(".yh-ai-code-block__lang").text()).toBe("typescript");
|
|
43
|
+
});
|
|
44
|
+
it("should show text as default language", () => {
|
|
45
|
+
const wrapper = mount(AiCodeBlock, { props: { code: "plain text" } });
|
|
46
|
+
expect(wrapper.find(".yh-ai-code-block__lang").text()).toBe("text");
|
|
47
|
+
});
|
|
48
|
+
it("should render code element with language class", () => {
|
|
49
|
+
const wrapper = mount(AiCodeBlock, {
|
|
50
|
+
props: { code: "const x = 1", language: "typescript" }
|
|
51
|
+
});
|
|
52
|
+
const code = wrapper.find("code");
|
|
53
|
+
expect(code.classes()).toContain("language-typescript");
|
|
54
|
+
});
|
|
55
|
+
it("should render code content", () => {
|
|
56
|
+
const wrapper = mount(AiCodeBlock, {
|
|
57
|
+
props: { code: "hello world", language: "text", highlight: false }
|
|
58
|
+
});
|
|
59
|
+
expect(wrapper.html()).toContain("hello world");
|
|
60
|
+
});
|
|
61
|
+
it("should apply hljs class to code element", () => {
|
|
62
|
+
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
63
|
+
expect(wrapper.find("code").classes()).toContain("hljs");
|
|
64
|
+
});
|
|
65
|
+
it("should render highlighted code when highlight=true and language recognized", () => {
|
|
66
|
+
const wrapper = mount(AiCodeBlock, {
|
|
67
|
+
props: { code: "const x = 1", language: "typescript", highlight: true }
|
|
68
|
+
});
|
|
69
|
+
expect(wrapper.find("code").html()).toContain("hljs-keyword");
|
|
70
|
+
});
|
|
71
|
+
it("should render raw code when highlight=false", () => {
|
|
72
|
+
const wrapper = mount(AiCodeBlock, {
|
|
73
|
+
props: { code: "raw code here", language: "typescript", highlight: false }
|
|
74
|
+
});
|
|
75
|
+
expect(wrapper.find("code").html()).toContain("raw code here");
|
|
76
|
+
});
|
|
77
|
+
it("should show copy button", () => {
|
|
78
|
+
const wrapper = mount(AiCodeBlock, { props: { code: "const x = 1" } });
|
|
79
|
+
expect(wrapper.find(".yh-ai-code-block__actions .yh-button").exists()).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
it("should emit copy event and call clipboard on copy click", async () => {
|
|
82
|
+
const code = "const x = 1";
|
|
83
|
+
const wrapper = mount(AiCodeBlock, { props: { code } });
|
|
84
|
+
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
85
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(code);
|
|
86
|
+
expect(wrapper.emitted("copy")).toBeTruthy();
|
|
87
|
+
expect(wrapper.emitted("copy")[0][0]).toBe(code);
|
|
88
|
+
});
|
|
89
|
+
it("should NOT emit copy when code is empty", async () => {
|
|
90
|
+
const wrapper = mount(AiCodeBlock, { props: { code: "" } });
|
|
91
|
+
await wrapper.find(".yh-ai-code-block__actions .yh-button").trigger("click");
|
|
92
|
+
expect(wrapper.emitted("copy")).toBeFalsy();
|
|
93
|
+
});
|
|
94
|
+
it("should render default slot instead of code when slot provided", () => {
|
|
95
|
+
const wrapper = mount(AiCodeBlock, {
|
|
96
|
+
props: { code: "ignored code" },
|
|
97
|
+
slots: { default: '<em class="custom-code">custom</em>' }
|
|
98
|
+
});
|
|
99
|
+
expect(wrapper.find(".custom-code").exists()).toBe(true);
|
|
100
|
+
});
|
|
101
|
+
it("should render actions slot", () => {
|
|
102
|
+
const wrapper = mount(AiCodeBlock, {
|
|
103
|
+
props: { code: "code" },
|
|
104
|
+
slots: { actions: '<button class="extra-action">Run</button>' }
|
|
105
|
+
});
|
|
106
|
+
expect(wrapper.find(".extra-action").exists()).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
YhAiCodeBlock: true
|
|
8
|
+
};
|
|
9
|
+
module.exports = exports.YhAiCodeBlock = void 0;
|
|
10
|
+
var _utils = require("@yh-ui/utils");
|
|
11
|
+
var _aiCodeBlock = _interopRequireDefault(require("./src/ai-code-block.vue"));
|
|
12
|
+
var _aiCodeBlock2 = require("./src/ai-code-block.cjs");
|
|
13
|
+
Object.keys(_aiCodeBlock2).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _aiCodeBlock2[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _aiCodeBlock2[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
const YhAiCodeBlock = exports.YhAiCodeBlock = (0, _utils.withInstall)(_aiCodeBlock.default);
|
|
26
|
+
module.exports = YhAiCodeBlock;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.aiCodeBlockProps = exports.aiCodeBlockEmits = void 0;
|
|
7
|
+
const aiCodeBlockProps = exports.aiCodeBlockProps = {
|
|
8
|
+
/**
|
|
9
|
+
* @description 代码语言
|
|
10
|
+
*/
|
|
11
|
+
language: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "text"
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* @description 代码内容
|
|
17
|
+
*/
|
|
18
|
+
code: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* @description 文件名称
|
|
24
|
+
*/
|
|
25
|
+
filename: String,
|
|
26
|
+
/**
|
|
27
|
+
* @description 是否显示行号
|
|
28
|
+
*/
|
|
29
|
+
showLineNumbers: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* @description 高亮行号列表
|
|
35
|
+
*/
|
|
36
|
+
highlightLines: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => []
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* @description 是否可折叠
|
|
42
|
+
*/
|
|
43
|
+
collapsible: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* @description 默认是否折叠
|
|
49
|
+
*/
|
|
50
|
+
defaultCollapsed: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* @description 是否显示运行按钮
|
|
56
|
+
*/
|
|
57
|
+
showRun: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* @description 是否高亮语法
|
|
63
|
+
*/
|
|
64
|
+
highlight: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* @description 主题覆盖变量
|
|
70
|
+
*/
|
|
71
|
+
themeOverrides: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: void 0
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const aiCodeBlockEmits = exports.aiCodeBlockEmits = {
|
|
77
|
+
copy: code => typeof code === "string",
|
|
78
|
+
run: code => typeof code === "string"
|
|
79
|
+
};
|