@linker-design-plus/chat-next 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export { default as HChatItem } from './src/component/chat-item.vue';
2
+ export { default as HChatSender } from './src/component/chat-sender.vue';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=e.defineComponent({name:"HChatItem",props:{message:{type:Object,required:!0}},setup(t,{emit:n}){return{}}});const d=(t,n)=>{const s=t.__vccOpts||t;for(const[r,a]of n)s[r]=a;return s},c={class:"content-wrapper"};function p(t,n,s,r,a,l){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-chat-item",t.message.role])},[e.createElementVNode("div",{class:e.normalizeClass(["avatar",t.message.role])},e.toDisplayString(t.message.role==="ai"?"AI":"U"),3),e.createElementVNode("div",c,[e.createElementVNode("div",{class:e.normalizeClass(["content-bubble",t.message.role])},e.toDisplayString(t.message.content),3)])],2)}const u=d(i,[["render",p],["__scopeId","data-v-c3a11237"]]),m=e.defineComponent({name:"HChatSender",emits:["send"],setup(t,{emit:n}){const s=e.ref("");return{inputValue:s,handleSend:()=>{const a=s.value.trim();a&&(n("send",a),s.value="")}}}});const _={class:"h-chat-sender"},h={class:"input-wrapper"},v={class:"sender-actions"},f=["disabled"];function S(t,n,s,r,a,l){return e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",h,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":n[0]||(n[0]=o=>t.inputValue=o),class:"chat-input",placeholder:"输入消息...",onKeydown:n[1]||(n[1]=e.withKeys(e.withModifiers((...o)=>t.handleSend&&t.handleSend(...o),["prevent"]),["enter"]))},null,544),[[e.vModelText,t.inputValue]]),e.createElementVNode("div",v,[e.createElementVNode("button",{class:"send-btn",disabled:!t.inputValue.trim(),onClick:n[2]||(n[2]=(...o)=>t.handleSend&&t.handleSend(...o))}," 发送 ",8,f)])])])}const g=d(m,[["render",S],["__scopeId","data-v-32259dcd"]]);exports.HChatItem=u;exports.HChatSender=g;
package/dist/index.mjs ADDED
@@ -0,0 +1,74 @@
1
+ import { defineComponent as l, openBlock as c, createElementBlock as p, normalizeClass as r, createElementVNode as s, toDisplayString as i, ref as m, withDirectives as h, withKeys as v, withModifiers as f, vModelText as S } from "vue";
2
+ const $ = l({
3
+ name: "HChatItem",
4
+ props: {
5
+ message: {
6
+ type: Object,
7
+ required: !0
8
+ }
9
+ },
10
+ setup(e, { emit: t }) {
11
+ return {};
12
+ }
13
+ });
14
+ const u = (e, t) => {
15
+ const n = e.__vccOpts || e;
16
+ for (const [d, a] of t)
17
+ n[d] = a;
18
+ return n;
19
+ }, g = { class: "content-wrapper" };
20
+ function y(e, t, n, d, a, _) {
21
+ return c(), p("div", {
22
+ class: r(["h-chat-item", e.message.role])
23
+ }, [
24
+ s("div", {
25
+ class: r(["avatar", e.message.role])
26
+ }, i(e.message.role === "ai" ? "AI" : "U"), 3),
27
+ s("div", g, [
28
+ s("div", {
29
+ class: r(["content-bubble", e.message.role])
30
+ }, i(e.message.content), 3)
31
+ ])
32
+ ], 2);
33
+ }
34
+ const H = /* @__PURE__ */ u($, [["render", y], ["__scopeId", "data-v-c3a11237"]]), b = l({
35
+ name: "HChatSender",
36
+ emits: ["send"],
37
+ setup(e, { emit: t }) {
38
+ const n = m("");
39
+ return {
40
+ inputValue: n,
41
+ handleSend: () => {
42
+ const a = n.value.trim();
43
+ a && (t("send", a), n.value = "");
44
+ }
45
+ };
46
+ }
47
+ });
48
+ const C = { class: "h-chat-sender" }, I = { class: "input-wrapper" }, w = { class: "sender-actions" }, V = ["disabled"];
49
+ function k(e, t, n, d, a, _) {
50
+ return c(), p("div", C, [
51
+ s("div", I, [
52
+ h(s("textarea", {
53
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => e.inputValue = o),
54
+ class: "chat-input",
55
+ placeholder: "输入消息...",
56
+ onKeydown: t[1] || (t[1] = v(f((...o) => e.handleSend && e.handleSend(...o), ["prevent"]), ["enter"]))
57
+ }, null, 544), [
58
+ [S, e.inputValue]
59
+ ]),
60
+ s("div", w, [
61
+ s("button", {
62
+ class: "send-btn",
63
+ disabled: !e.inputValue.trim(),
64
+ onClick: t[2] || (t[2] = (...o) => e.handleSend && e.handleSend(...o))
65
+ }, " 发送 ", 8, V)
66
+ ])
67
+ ])
68
+ ]);
69
+ }
70
+ const B = /* @__PURE__ */ u(b, [["render", k], ["__scopeId", "data-v-32259dcd"]]);
71
+ export {
72
+ H as HChatItem,
73
+ B as HChatSender
74
+ };
@@ -0,0 +1,20 @@
1
+ import { PropType } from 'vue';
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
4
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
+ message: {
6
+ type: PropType<{
7
+ role: string;
8
+ content: string;
9
+ }>;
10
+ required: true;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ message: {
14
+ type: PropType<{
15
+ role: string;
16
+ content: string;
17
+ }>;
18
+ required: true;
19
+ };
20
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,8 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ inputValue: import("vue").Ref<string, string>;
5
+ handleSend: () => void;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "send"[], "send", import("vue").PublicProps, Readonly<{}> & Readonly<{
7
+ onSend?: ((...args: any[]) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .h-chat-item[data-v-c3a11237]{display:flex;margin-bottom:16px;align-items:flex-start;width:100%}.h-chat-item.user[data-v-c3a11237]{flex-direction:row-reverse}.avatar[data-v-c3a11237]{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;flex-shrink:0}.avatar.ai[data-v-c3a11237]{background-color:#165dff;margin-right:12px}.avatar.user[data-v-c3a11237]{background-color:#00b42a;margin-left:12px}.content-wrapper[data-v-c3a11237]{max-width:70%}.content-bubble[data-v-c3a11237]{padding:12px 16px;border-radius:8px;line-height:1.5;word-break:break-word}.content-bubble.ai[data-v-c3a11237]{background-color:#fff;border:1px solid #e5e6eb;color:#1d2129;border-top-left-radius:2px}.content-bubble.user[data-v-c3a11237]{background-color:#165dff;color:#fff;border-top-right-radius:2px}.h-chat-sender[data-v-32259dcd]{width:100%}.input-wrapper[data-v-32259dcd]{position:relative;display:flex;flex-direction:column;background-color:#f7f8fa;border:1px solid #e5e6eb;border-radius:8px;transition:all .2s}.input-wrapper[data-v-32259dcd]:focus-within{border-color:#165dff;box-shadow:0 0 0 2px #165dff33}.chat-input[data-v-32259dcd]{width:100%;min-height:80px;padding:12px 16px;border:none;background:transparent;resize:none;outline:none;font-family:inherit;font-size:14px;line-height:1.5;color:#1d2129}.chat-input[data-v-32259dcd]::placeholder{color:#86909c}.sender-actions[data-v-32259dcd]{display:flex;justify-content:flex-end;padding:8px 12px}.send-btn[data-v-32259dcd]{padding:6px 16px;border:none;border-radius:4px;background-color:#165dff;color:#fff;cursor:pointer;font-size:14px;font-weight:500;transition:all .2s}.send-btn[data-v-32259dcd]:hover{background-color:#4080ff}.send-btn[data-v-32259dcd]:disabled{background-color:#94bfff;cursor:not-allowed}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linker-design-plus/chat-next",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "AI Chat component for linker design",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -16,6 +16,10 @@
16
16
  "files": [
17
17
  "dist"
18
18
  ],
19
+ "publishConfig": {
20
+ "registry": "https://registry.npmjs.org/",
21
+ "access": "public"
22
+ },
19
23
  "keywords": [
20
24
  "vue",
21
25
  "chat",
@@ -29,11 +33,12 @@
29
33
  },
30
34
  "devDependencies": {
31
35
  "@vitejs/plugin-vue": "^4.4.0",
32
- "typescript": "^5.2.0",
36
+ "typescript": "^5.9.3",
33
37
  "vite": "^4.5.0",
34
- "vue-tsc": "^1.8.22"
38
+ "vue-tsc": "^3.2.5"
35
39
  },
36
40
  "scripts": {
37
- "build": "vite build && vue-tsc --emitDeclarationOnly"
41
+ "build": "pnpm clean && vite build && vue-tsc --emitDeclarationOnly",
42
+ "clean": "rm -rf ./dist"
38
43
  }
39
44
  }