@opentiny/tiny-robot 0.1.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.
@@ -12,7 +12,7 @@ export interface BubbleProps {
12
12
  * 气泡内容
13
13
  */
14
14
  content?: string;
15
- id?: string;
15
+ id?: string | number | symbol;
16
16
  /**
17
17
  * 气泡位置
18
18
  */
@@ -0,0 +1,7 @@
1
+ import { App } from 'vue';
2
+ import { default as Container } from './index.vue';
3
+ declare const install: <T>(app: App<T>) => void;
4
+ declare const _default: typeof Container & {
5
+ install: typeof install;
6
+ };
7
+ export default _default;
@@ -0,0 +1,16 @@
1
+ export interface ContainerProps {
2
+ /**
3
+ * model:show
4
+ */
5
+ show: boolean;
6
+ /**
7
+ * model:fullscreen
8
+ */
9
+ fullscreen?: boolean;
10
+ }
11
+ export interface ContainerSlots {
12
+ default: () => unknown;
13
+ title: () => unknown;
14
+ operations: () => unknown;
15
+ footer: () => unknown;
16
+ }
@@ -0,0 +1,26 @@
1
+ import { ContainerProps, ContainerSlots } from './index.type';
2
+ type __VLS_PublicProps = {
3
+ 'show': ContainerProps['show'];
4
+ 'fullscreen'?: ContainerProps['fullscreen'];
5
+ };
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: Readonly<ContainerSlots> & ContainerSlots;
9
+ refs: {};
10
+ rootEl: HTMLDivElement;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
+ "update:show": (value: boolean) => any;
15
+ "update:fullscreen": (value: boolean | undefined) => any;
16
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:show"?: ((value: boolean) => any) | undefined;
18
+ "onUpdate:fullscreen"?: ((value: boolean | undefined) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
+ export default _default;
22
+ type __VLS_WithTemplateSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { App } from 'vue';
2
2
  import { Bubble, BubbleList } from './bubble';
3
+ import { default as Container } from './container';
3
4
  import { default as Conversations } from './conversations';
4
5
  import { Prompt, Prompts } from './prompts';
6
+ import { default as Question } from './question';
5
7
  import { default as Sender } from './sender';
6
8
  import { default as Welcome } from './welcome';
7
- import { default as Question } from './question';
8
9
  export * from './bubble/index.type';
9
10
  export * from './prompts/index.type';
10
11
  export * from './sender/index.type';
@@ -13,4 +14,4 @@ declare const _default: {
13
14
  install<T>(app: App<T>): void;
14
15
  };
15
16
  export default _default;
16
- export { Bubble, Bubble as TrBubble, BubbleList, BubbleList as TrBubbleList, Conversations, Conversations as TrConversations, Prompt, Prompt as TrPrompt, Prompts, Prompts as TrPrompts, Sender, Sender as TrSender, Welcome, Welcome as TrWelcome, Question, };
17
+ export { Bubble, Bubble as TrBubble, BubbleList, BubbleList as TrBubbleList, Container, Container as TrContainer, Conversations, Conversations as TrConversations, Prompt, Prompt as TrPrompt, Prompts, Prompts as TrPrompts, Sender, Sender as TrSender, Welcome, Welcome as TrWelcome, Question, };
package/dist/index.js CHANGED
@@ -1,14 +1,16 @@
1
- import { Bubble as s, BubbleList as t } from "./packages/components/src/bubble/index.js";
1
+ import { Bubble as t, BubbleList as e } from "./packages/components/src/bubble/index.js";
2
+ import "./packages/components/src/container/index.js";
2
3
  import "./packages/components/src/conversations/index.js";
3
- import { Prompt as e, Prompts as a } from "./packages/components/src/prompts/index.js";
4
+ import { Prompt as s, Prompts as a } from "./packages/components/src/prompts/index.js";
5
+ import "./packages/components/src/question/index.js";
4
6
  import "./packages/components/src/sender/index.js";
5
7
  import "./packages/components/src/welcome/index.js";
6
- import "./packages/components/src/question/index.js";
7
- import i from "./packages/components/src/conversations/index.vue.js";
8
- import n from "./packages/components/src/sender/index.vue.js";
9
- import p from "./packages/components/src/welcome/index.vue.js";
10
- import c from "./packages/components/src/question/index.vue.js";
11
- const l = [s, t, i, e, a, n, p, c], C = {
8
+ import i from "./packages/components/src/container/index.vue.js";
9
+ import n from "./packages/components/src/conversations/index.vue.js";
10
+ import p from "./packages/components/src/question/index.vue.js";
11
+ import c from "./packages/components/src/sender/index.vue.js";
12
+ import f from "./packages/components/src/welcome/index.vue.js";
13
+ const l = [t, e, i, n, s, a, p, c, f], W = {
12
14
  install(o) {
13
15
  l.forEach((r) => {
14
16
  const m = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
@@ -17,20 +19,22 @@ const l = [s, t, i, e, a, n, p, c], C = {
17
19
  }
18
20
  };
19
21
  export {
20
- s as Bubble,
21
- t as BubbleList,
22
- i as Conversations,
23
- e as Prompt,
22
+ t as Bubble,
23
+ e as BubbleList,
24
+ i as Container,
25
+ n as Conversations,
26
+ s as Prompt,
24
27
  a as Prompts,
25
- c as Question,
26
- n as Sender,
27
- s as TrBubble,
28
- t as TrBubbleList,
29
- i as TrConversations,
30
- e as TrPrompt,
28
+ p as Question,
29
+ c as Sender,
30
+ t as TrBubble,
31
+ e as TrBubbleList,
32
+ i as TrContainer,
33
+ n as TrConversations,
34
+ s as TrPrompt,
31
35
  a as TrPrompts,
32
- n as TrSender,
33
- p as TrWelcome,
34
- p as Welcome,
35
- C as default
36
+ c as TrSender,
37
+ f as TrWelcome,
38
+ f as Welcome,
39
+ W as default
36
40
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./bubble-list.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b99c6c76"]]);
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5d3d74c8"]]);
5
5
  export {
6
- c as default
6
+ s as default
7
7
  };
@@ -1,38 +1,37 @@
1
- import { defineComponent as f, ref as b, computed as d, watch as _, createElementBlock as u, openBlock as l, Fragment as B, renderList as g, createBlock as k, mergeProps as C } from "vue";
2
- import h from "./bubble.vue.js";
3
- import { useElementScroll as y } from "./useScroll.js";
4
- const E = /* @__PURE__ */ f({
1
+ import { defineComponent as i, ref as p, computed as b, watch as d, createElementBlock as n, openBlock as r, Fragment as _, renderList as B, createBlock as g, mergeProps as C } from "vue";
2
+ import k from "./bubble.vue.js";
3
+ import { useElementScroll as h } from "./useScroll.js";
4
+ const x = /* @__PURE__ */ i({
5
5
  __name: "bubble-list",
6
6
  props: {
7
7
  items: {},
8
8
  roles: {},
9
9
  autoScroll: { type: Boolean }
10
10
  },
11
- setup(a) {
12
- const t = a, n = b(), { scrollToBottom: m } = y(n), i = d(() => t.items.at(-1));
13
- _([() => t.items.length, () => {
11
+ setup(s) {
12
+ const t = s, l = p(), { scrollToBottom: c } = h(l), u = b(() => t.items.at(-1));
13
+ d([() => t.items.length, () => {
14
14
  var e;
15
- return (e = i.value) == null ? void 0 : e.content;
15
+ return (e = u.value) == null ? void 0 : e.content;
16
16
  }], () => {
17
- t.autoScroll && m();
17
+ t.autoScroll && c();
18
18
  });
19
- const p = (e) => {
20
- var c;
21
- const s = e.role ? ((c = t.roles) == null ? void 0 : c[e.role]) || {} : {}, { id: o, ...r } = e;
22
- return { ...s, ...r };
19
+ const a = (e) => {
20
+ var o;
21
+ return { ...e.role ? ((o = t.roles) == null ? void 0 : o[e.role]) || {} : {}, ...e };
23
22
  };
24
- return (e, s) => (l(), u("div", {
23
+ return (e, m) => (r(), n("div", {
25
24
  class: "tr-bubble-list",
26
25
  ref_key: "scrollContainer",
27
- ref: n
26
+ ref: l
28
27
  }, [
29
- (l(!0), u(B, null, g(t.items, (o, r) => (l(), k(h, C({
30
- key: o.id || r,
28
+ (r(!0), n(_, null, B(t.items, (o, f) => (r(), g(k, C({
29
+ key: o.id || f,
31
30
  ref_for: !0
32
- }, p(o)), null, 16))), 128))
31
+ }, a(o)), null, 16))), 128))
33
32
  ], 512));
34
33
  }
35
34
  });
36
35
  export {
37
- E as default
36
+ x as default
38
37
  };
@@ -0,0 +1,9 @@
1
+ import n from "./index.vue.js";
2
+ n.name = "TrContainer";
3
+ const o = function(t) {
4
+ t.component(n.name, n);
5
+ };
6
+ n.install = o;
7
+ export {
8
+ n as default
9
+ };
@@ -0,0 +1,7 @@
1
+ import o from "./index.vue2.js";
2
+ /* empty css */
3
+ import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6a7e1263"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,55 @@
1
+ import { defineComponent as f, useCssVars as v, useModel as i, computed as p, createElementBlock as _, openBlock as m, createElementVNode as e, renderSlot as n, createVNode as a, unref as c } from "vue";
2
+ import { IconCancelFullScreen as b, IconFullScreen as h, IconClose as w } from "../../../svgs/dist/tiny-robot-svgs.js";
3
+ const $ = { class: "tr-container" }, g = { class: "tr-container__header" }, C = { class: "tr-container__header-operations" }, S = { class: "tr-container__body" }, k = { class: "tr-container__footer" }, I = /* @__PURE__ */ f({
4
+ __name: "index",
5
+ props: {
6
+ show: { type: Boolean, required: !0 },
7
+ showModifiers: {},
8
+ fullscreen: { type: Boolean },
9
+ fullscreenModifiers: {}
10
+ },
11
+ emits: ["update:show", "update:fullscreen"],
12
+ setup(r) {
13
+ v((o) => ({
14
+ "4f670360": s.value ? "0" : "unset",
15
+ "01550f1a": s.value ? "unset" : "var(--tr-container-width)",
16
+ "9b01cee4": l.value ? "100" : "-1",
17
+ "46b87c3c": l.value ? "1" : "0"
18
+ }));
19
+ const l = i(r, "show"), s = i(r, "fullscreen"), u = p(() => s.value ? b : h);
20
+ return (o, t) => (m(), _("div", $, [
21
+ t[3] || (t[3] = e("div", { class: "tr-container__dragging-bar-wrapper" }, [
22
+ e("div", { class: "tr-container__dragging-bar" })
23
+ ], -1)),
24
+ e("div", g, [
25
+ n(o.$slots, "title", {}, () => [
26
+ t[2] || (t[2] = e("h3", { class: "tr-container__title" }, "OpenTiny NEXT", -1))
27
+ ], !0),
28
+ e("div", C, [
29
+ n(o.$slots, "operations", {}, void 0, !0),
30
+ e("button", {
31
+ class: "icon-btn",
32
+ onClick: t[0] || (t[0] = (d) => o.$emit("update:fullscreen", !s.value))
33
+ }, [
34
+ a(c(u))
35
+ ]),
36
+ e("button", {
37
+ class: "icon-btn",
38
+ onClick: t[1] || (t[1] = (d) => o.$emit("update:show", !1))
39
+ }, [
40
+ a(c(w))
41
+ ])
42
+ ])
43
+ ]),
44
+ e("div", S, [
45
+ n(o.$slots, "default", {}, void 0, !0)
46
+ ]),
47
+ e("div", k, [
48
+ n(o.$slots, "footer", {}, void 0, !0)
49
+ ])
50
+ ]));
51
+ }
52
+ });
53
+ export {
54
+ I as default
55
+ };
@@ -1,4 +1,4 @@
1
- import { defineComponent as S, ref as k, computed as _, watch as x, createElementBlock as i, createCommentVNode as h, openBlock as l, createElementVNode as s, withModifiers as M, normalizeStyle as N, createVNode as v, unref as c, Fragment as C, renderList as q, normalizeClass as Q, renderSlot as u, toDisplayString as f, createTextVNode as V } from "vue";
1
+ import { defineComponent as S, ref as k, computed as _, watch as x, createElementBlock as i, createCommentVNode as h, openBlock as l, createElementVNode as s, withModifiers as M, normalizeStyle as N, createVNode as v, unref as r, Fragment as C, renderList as q, normalizeClass as Q, renderSlot as u, toDisplayString as f, createTextVNode as V } from "vue";
2
2
  import T from "../../../../../node_modules/.pnpm/@opentiny_vue-icon@3.22.0/node_modules/@opentiny/vue-icon/lib/close.js";
3
3
  import z from "../../../../../node_modules/.pnpm/@opentiny_vue-button@3.21.0/node_modules/@opentiny/vue-button/lib/index.js";
4
4
  import { IconHotQuestion as A, IconTypeAll as E } from "../../../../svgs/dist/tiny-robot-svgs.js";
@@ -37,7 +37,7 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
37
37
  },
38
38
  emits: ["update:visible", "close", "select-category", "question-click"],
39
39
  setup(n, { emit: b }) {
40
- const B = T(), a = n, r = b, d = k(""), p = _(() => {
40
+ const w = T(), a = n, c = b, d = k(""), p = _(() => {
41
41
  if (!d.value && a.categories.length > 0)
42
42
  return a.categories[0].questions || [];
43
43
  const e = a.categories.find((t) => t.id === d.value);
@@ -51,14 +51,14 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
51
51
  { immediate: !0 }
52
52
  );
53
53
  const y = () => {
54
- r("update:visible", !1), r("close");
55
- }, $ = (e) => {
56
- d.value = e, r(
54
+ c("update:visible", !1), c("close");
55
+ }, B = (e) => {
56
+ d.value = e, c(
57
57
  "select-category",
58
58
  a.categories.find((t) => t.id === e)
59
59
  );
60
- }, w = (e) => {
61
- r("question-click", e);
60
+ }, $ = (e) => {
61
+ c("question-click", e);
62
62
  }, O = (e) => {
63
63
  a.closeOnClickOutside && !e.composedPath().includes(g.value) && y();
64
64
  }, g = k(null);
@@ -78,7 +78,7 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
78
78
  s("div", H, [
79
79
  s("div", I, [
80
80
  s("div", null, [
81
- v(c(A))
81
+ v(r(A))
82
82
  ]),
83
83
  t[1] || (t[1] = s("div", { class: "tr-question-header-title" }, "热门问题", -1))
84
84
  ]),
@@ -86,8 +86,8 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
86
86
  class: "tr-question-close-btn",
87
87
  onClick: y
88
88
  }, [
89
- v(c(z), {
90
- icon: c(B),
89
+ v(r(z), {
90
+ icon: r(w),
91
91
  type: "text"
92
92
  }, null, 8, ["icon"])
93
93
  ])
@@ -96,11 +96,11 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
96
96
  (l(!0), i(C, null, q(n.categories, (o) => (l(), i("div", {
97
97
  key: o.id,
98
98
  class: Q(["tr-question-categories-item", { active: d.value === o.id }]),
99
- onClick: (m) => $(o.id)
99
+ onClick: (m) => B(o.id)
100
100
  }, [
101
101
  u(e.$slots, "category-label", { category: o }, () => [
102
102
  s("div", D, [
103
- v(c(E))
103
+ v(r(E))
104
104
  ]),
105
105
  s("span", null, f(o.label), 1)
106
106
  ])
@@ -115,7 +115,7 @@ const H = { class: "tr-question-header" }, I = { style: { display: "flex", "alig
115
115
  (l(!0), i(C, null, q(p.value, (o, m) => (l(), i("li", {
116
116
  key: o.id,
117
117
  class: "tr-question-list-item",
118
- onClick: (J) => w(o)
118
+ onClick: (J) => $(o)
119
119
  }, [
120
120
  u(e.$slots, "question-item", {
121
121
  question: o,
@@ -1,4 +1,4 @@
1
- import { defineComponent as N, computed as O, ref as w, watch as T, onMounted as D, createElementBlock as q, openBlock as i, normalizeClass as M, createElementVNode as l, createVNode as a, createCommentVNode as U, unref as n, withCtx as d, renderSlot as r, createTextVNode as W, toDisplayString as p, createBlock as B } from "vue";
1
+ import { defineComponent as N, computed as O, ref as E, watch as T, onMounted as D, createElementBlock as b, openBlock as i, normalizeClass as M, createElementVNode as l, createVNode as a, createCommentVNode as U, unref as n, withCtx as d, renderSlot as r, createTextVNode as W, toDisplayString as p, createBlock as q } from "vue";
2
2
  import { useQuestions as z } from "./composables/useQuestions.js";
3
3
  import F from "./components/CommonQuestions.vue.js";
4
4
  import H from "./components/HotQuestions.vue.js";
@@ -16,10 +16,10 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
16
16
  loading: { type: Boolean, default: !1 }
17
17
  },
18
18
  emits: ["question-click", "select-category"],
19
- setup(b, { expose: $, emit: Q }) {
20
- const u = b, g = () => {
19
+ setup(B, { expose: $, emit: Q }) {
20
+ const u = B, g = () => {
21
21
  s.value = !s.value;
22
- }, f = Q, v = O(() => u.categories), s = w(u.initialExpanded), { modalVisible: m, currentTheme: x, setActiveCategory: h, openModal: c, closeModal: k, setTheme: S, refreshData: A } = z(v);
22
+ }, f = Q, v = O(() => u.categories), s = E(u.initialExpanded), { modalVisible: m, currentTheme: x, setActiveCategory: h, openModal: c, closeModal: k, setTheme: S, refreshData: A } = z(v);
23
23
  T(
24
24
  () => u.theme,
25
25
  (e) => {
@@ -28,9 +28,9 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
28
28
  );
29
29
  const y = (e) => {
30
30
  k(), f("question-click", e);
31
- }, I = (e) => {
31
+ }, V = (e) => {
32
32
  e && (h(e.id), f("select-category", e));
33
- }, C = w(!1), V = (e) => {
33
+ }, C = E(!1), I = (e) => {
34
34
  C.value = e;
35
35
  };
36
36
  return D(() => {
@@ -41,7 +41,7 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
41
41
  toggleFloating: g,
42
42
  setActiveCategory: h,
43
43
  refreshData: A
44
- }), (e, t) => (i(), q("div", {
44
+ }), (e, t) => (i(), b("div", {
45
45
  class: M(["tr-question-container", [`theme-${e.theme}`]]),
46
46
  "data-theme": e.theme
47
47
  }, [
@@ -61,7 +61,7 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
61
61
  "onUpdate:visible": t[1] || (t[1] = (o) => m.value = o),
62
62
  onClose: t[2] || (t[2] = (o) => m.value = !1),
63
63
  onQuestionClick: y,
64
- onSelectCategory: I
64
+ onSelectCategory: V
65
65
  }, {
66
66
  "category-label": d(({ category: o }) => [
67
67
  r(e.$slots, "category-label", { category: o }, () => [
@@ -71,12 +71,12 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
71
71
  l("span", null, p(o.label), 1)
72
72
  ])
73
73
  ]),
74
- "question-item": d(({ question: o, index: E }) => [
74
+ "question-item": d(({ question: o, index: w }) => [
75
75
  r(e.$slots, "question-item", {
76
76
  question: o,
77
- index: E
77
+ index: w
78
78
  }, () => [
79
- l("span", null, p(E + 1) + ".", 1),
79
+ l("span", null, p(w + 1) + ".", 1),
80
80
  W(" " + p(o.text), 1)
81
81
  ])
82
82
  ]),
@@ -95,15 +95,15 @@ const L = ["data-theme"], P = { class: "category-icon" }, te = /* @__PURE__ */ N
95
95
  a(F, {
96
96
  isExpanded: s.value,
97
97
  questions: e.commonQuestions,
98
- onShowExpandButton: V,
98
+ onShowExpandButton: I,
99
99
  onQuestionClick: y
100
100
  }, null, 8, ["isExpanded", "questions"]),
101
- C.value ? (i(), q("div", {
101
+ C.value ? (i(), b("div", {
102
102
  key: 0,
103
103
  class: "tr-question-wrap-trigger",
104
104
  onClick: g
105
105
  }, [
106
- s.value ? (i(), B(n(K), { key: 1 })) : (i(), B(n(J), { key: 0 }))
106
+ s.value ? (i(), q(n(K), { key: 1 })) : (i(), q(n(J), { key: 0 }))
107
107
  ])) : U("", !0)
108
108
  ], 10, L));
109
109
  }