@opentiny/tiny-robot 0.4.0 → 0.4.1-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/index2.js CHANGED
@@ -1,19 +1,28 @@
1
- import { inject as A, defineComponent as h, computed as d, openBlock as i, createBlock as b, unref as o, withCtx as x, createElementVNode as f, normalizeClass as v, renderSlot as B, resolveDynamicComponent as D, normalizeStyle as E, createElementBlock as p, createVNode as m, toDisplayString as w, createCommentVNode as k, Transition as I } from "vue";
2
- import { _ as S } from "./_plugin-vue_export-helper.js";
3
- import { IconSend as P, IconStop as N, IconClear as F } from "@opentiny/tiny-robot-svgs";
4
- import { TinyTooltip as T } from "@opentiny/vue";
5
- const R = Symbol("sender-context");
6
- function g() {
7
- const a = A(R);
8
- if (!a)
1
+ import { inject as R, isVNode as V, h as F, defineComponent as y, computed as l, openBlock as i, createBlock as f, unref as o, withCtx as S, createElementVNode as k, normalizeStyle as I, normalizeClass as v, renderSlot as B, resolveDynamicComponent as P, createElementBlock as b, createVNode as x, toDisplayString as T, createCommentVNode as h, useSlots as W, Transition as $ } from "vue";
2
+ import { _ as w } from "./_plugin-vue_export-helper.js";
3
+ import { IconSend as N, IconStop as j, IconClose as U } from "@opentiny/tiny-robot-svgs";
4
+ import { TinyTooltip as D } from "@opentiny/vue";
5
+ import { t as G } from "./utils.js";
6
+ const K = Symbol("sender-context");
7
+ function C() {
8
+ const t = R(K);
9
+ if (!t)
9
10
  throw new Error("useSenderContext must be used within Sender component");
10
- return a;
11
+ return t;
11
12
  }
12
- function $(a) {
13
- if (a)
14
- return typeof a == "string" ? () => a : a;
13
+ const A = "tr-sender-tooltip-inner";
14
+ function E(t) {
15
+ return t ? typeof t == "string" ? t.split(/\s+/).includes(A) : Array.isArray(t) ? t.some(E) : typeof t == "object" ? !!t[A] : !1 : !1;
15
16
  }
16
- const L = ["disabled"], V = ["disabled"], W = /* @__PURE__ */ h({
17
+ function z(t) {
18
+ var e;
19
+ return V(t) && E((e = t.props) == null ? void 0 : e.class) ? t : F("div", { class: A }, t);
20
+ }
21
+ function O(t) {
22
+ if (t)
23
+ return typeof t == "string" ? () => z(t) : () => z(t());
24
+ }
25
+ const M = ["disabled"], X = ["disabled"], Y = /* @__PURE__ */ y({
17
26
  __name: "index",
18
27
  props: {
19
28
  icon: {},
@@ -23,177 +32,194 @@ const L = ["disabled"], V = ["disabled"], W = /* @__PURE__ */ h({
23
32
  tooltipPlacement: { default: "top" },
24
33
  size: {}
25
34
  },
26
- setup(a) {
27
- const t = a, s = d(() => $(t.tooltip)), l = d(() => t.size ? { fontSize: typeof t.size == "number" ? `${t.size}px` : t.size } : {});
28
- return (r, c) => t.tooltip ? (i(), b(o(T), {
35
+ setup(t) {
36
+ const e = t, n = {
37
+ normal: "32px",
38
+ small: "28px"
39
+ }, a = l(() => O(e.tooltip)), d = (s) => s === "small" ? {
40
+ "--tr-action-button-size": n.small
41
+ } : s === "normal" ? {
42
+ "--tr-action-button-size": n.normal
43
+ } : {
44
+ "--tr-action-button-size": G(s)
45
+ }, c = l(() => e.size ? d(e.size) : {});
46
+ return (s, u) => e.tooltip ? (i(), f(o(D), {
29
47
  key: 0,
30
- "render-content": s.value,
31
- placement: t.tooltipPlacement,
48
+ "render-content": a.value,
49
+ placement: e.tooltipPlacement,
32
50
  effect: "light",
33
51
  "visible-arrow": !1,
34
52
  "popper-class": "tr-action-button-tooltip-popper"
35
53
  }, {
36
- default: x(() => [
37
- f("button", {
38
- class: v(["tr-action-button", { active: t.active }]),
39
- disabled: t.disabled,
40
- onFocusCapture: c[0] || (c[0] = (u) => u.stopPropagation())
54
+ default: S(() => [
55
+ k("button", {
56
+ class: v(["tr-action-button", { active: e.active }]),
57
+ style: I(c.value),
58
+ disabled: e.disabled,
59
+ onFocusCapture: u[0] || (u[0] = (r) => r.stopPropagation())
41
60
  }, [
42
- B(r.$slots, "icon", {}, () => [
43
- (i(), b(D(t.icon), {
44
- style: E(l.value)
45
- }, null, 8, ["style"]))
61
+ B(s.$slots, "icon", {}, () => [
62
+ (i(), f(P(e.icon)))
46
63
  ], !0)
47
- ], 42, L)
64
+ ], 46, M)
48
65
  ]),
49
66
  _: 3
50
- }, 8, ["render-content", "placement"])) : (i(), p("button", {
67
+ }, 8, ["render-content", "placement"])) : (i(), b("button", {
51
68
  key: 1,
52
- class: v(["tr-action-button", { active: t.active }]),
53
- disabled: t.disabled
69
+ class: v(["tr-action-button", { active: e.active }]),
70
+ style: I(c.value),
71
+ disabled: e.disabled
54
72
  }, [
55
- B(r.$slots, "icon", {}, () => [
56
- (i(), b(D(t.icon), {
57
- style: E(l.value)
58
- }, null, 8, ["style"]))
73
+ B(s.$slots, "icon", {}, () => [
74
+ (i(), f(P(e.icon)))
59
75
  ], !0)
60
- ], 10, V));
76
+ ], 14, X));
61
77
  }
62
- }), O = /* @__PURE__ */ S(W, [["__scopeId", "data-v-01ebbab5"]]), j = {
78
+ }), Z = /* @__PURE__ */ w(Y, [["__scopeId", "data-v-875619e6"]]), q = {
63
79
  key: 0,
64
80
  class: "tr-sender-submit-button__cancel-text"
65
- }, K = /* @__PURE__ */ h({
81
+ }, H = /* @__PURE__ */ y({
66
82
  __name: "index",
67
- setup(a) {
68
- const { canSubmit: t, loading: s, defaultActions: l, submit: r, cancel: c, stopText: u } = g(), _ = d(() => {
69
- var e, n;
70
- return (n = (e = l.value) == null ? void 0 : e.submit) != null && n.disabled ? !0 : !t.value && !s.value;
71
- }), y = d(() => {
72
- var e, n;
73
- return $((n = (e = l.value) == null ? void 0 : e.submit) == null ? void 0 : n.tooltip);
74
- }), z = d(() => {
75
- var e, n;
76
- return ((n = (e = l.value) == null ? void 0 : e.submit) == null ? void 0 : n.tooltipPlacement) ?? "top";
77
- }), C = () => {
78
- _.value || (s.value ? c() : r());
83
+ setup(t) {
84
+ const { canSubmit: e, loading: n, defaultActions: a, submit: d, cancel: c, stopText: s } = C(), u = l(() => {
85
+ var _, m;
86
+ return (m = (_ = a.value) == null ? void 0 : _.submit) != null && m.disabled ? !0 : !e.value && !n.value;
87
+ }), r = l(() => {
88
+ var _, m;
89
+ return O((m = (_ = a.value) == null ? void 0 : _.submit) == null ? void 0 : m.tooltip);
90
+ }), p = l(() => {
91
+ var _, m;
92
+ return ((m = (_ = a.value) == null ? void 0 : _.submit) == null ? void 0 : m.tooltipPlacement) ?? "top";
93
+ }), g = () => {
94
+ u.value || (n.value ? c() : d());
79
95
  };
80
- return (e, n) => y.value && !o(s) ? (i(), b(o(T), {
96
+ return (_, m) => r.value && !o(n) ? (i(), f(o(D), {
81
97
  key: 0,
82
- "render-content": y.value,
83
- placement: z.value,
98
+ "render-content": r.value,
99
+ placement: p.value,
84
100
  effect: "light",
85
101
  "visible-arrow": !1,
86
102
  "popper-class": "tr-submit-button-tooltip-popper"
87
103
  }, {
88
- default: x(() => [
89
- f("div", {
104
+ default: S(() => [
105
+ k("div", {
90
106
  class: v([
91
107
  "tr-sender-submit-button",
92
108
  {
93
- "is-disabled": _.value,
94
- "is-loading": o(s)
109
+ "is-disabled": u.value,
110
+ "is-loading": o(n)
95
111
  }
96
112
  ]),
97
- onClick: C
113
+ onClick: g
98
114
  }, [
99
- m(o(P), { class: "tr-sender-submit-button__icon" })
115
+ x(o(N), { class: "tr-sender-submit-button__icon" })
100
116
  ], 2)
101
117
  ]),
102
118
  _: 1
103
- }, 8, ["render-content", "placement"])) : (i(), p("div", {
119
+ }, 8, ["render-content", "placement"])) : (i(), b("div", {
104
120
  key: 1,
105
121
  class: v([
106
122
  "tr-sender-submit-button",
107
123
  {
108
- "is-disabled": _.value,
109
- "is-loading": o(s)
124
+ "is-disabled": u.value,
125
+ "is-loading": o(n)
110
126
  }
111
127
  ]),
112
- onClick: C
128
+ onClick: g
113
129
  }, [
114
- o(s) ? (i(), p("div", {
130
+ o(n) ? (i(), b("div", {
115
131
  key: 1,
116
- class: v(["tr-sender-submit-button__cancel", { "icon-only": !o(u) }])
132
+ class: v(["tr-sender-submit-button__cancel", { "icon-only": !o(s) }])
117
133
  }, [
118
- m(o(N), { class: "tr-sender-submit-button__cancel-icon" }),
119
- o(u) ? (i(), p("span", j, w(o(u)), 1)) : k("", !0)
120
- ], 2)) : (i(), b(o(P), {
134
+ x(o(j), { class: "tr-sender-submit-button__cancel-icon" }),
135
+ o(s) ? (i(), b("span", q, T(o(s)), 1)) : h("", !0)
136
+ ], 2)) : (i(), f(o(N), {
121
137
  key: 0,
122
138
  class: "tr-sender-submit-button__icon"
123
139
  }))
124
140
  ], 2));
125
141
  }
126
- }), X = /* @__PURE__ */ S(K, [["__scopeId", "data-v-4b48493a"]]), Y = /* @__PURE__ */ h({
142
+ }), J = /* @__PURE__ */ w(H, [["__scopeId", "data-v-a58e69fe"]]), L = () => {
143
+ const { hasContent: t, clearable: e, loading: n, defaultActions: a } = C(), d = l(() => {
144
+ var r, p;
145
+ return ((p = (r = a.value) == null ? void 0 : r.clear) == null ? void 0 : p.disabled) !== void 0 ? a.value.clear.disabled : !1;
146
+ }), c = l(() => {
147
+ var r, p;
148
+ return (p = (r = a.value) == null ? void 0 : r.clear) == null ? void 0 : p.tooltip;
149
+ }), s = l(() => {
150
+ var r, p;
151
+ return ((p = (r = a.value) == null ? void 0 : r.clear) == null ? void 0 : p.tooltipPlacement) ?? "top";
152
+ }), u = l(() => e.value && t.value && !n.value && !d.value);
153
+ return {
154
+ isDisabled: d,
155
+ tooltip: c,
156
+ tooltipPlacement: s,
157
+ show: u
158
+ };
159
+ }, Q = /* @__PURE__ */ y({
127
160
  __name: "index",
128
- setup(a) {
129
- const { hasContent: t, clearable: s, clear: l, loading: r, defaultActions: c } = g(), u = d(() => {
130
- var e, n;
131
- return ((n = (e = c.value) == null ? void 0 : e.clear) == null ? void 0 : n.disabled) !== void 0 ? c.value.clear.disabled : !1;
132
- }), _ = d(() => {
133
- var e, n;
134
- return $((n = (e = c.value) == null ? void 0 : e.clear) == null ? void 0 : n.tooltip);
135
- }), y = d(() => {
136
- var e, n;
137
- return ((n = (e = c.value) == null ? void 0 : e.clear) == null ? void 0 : n.tooltipPlacement) ?? "top";
138
- }), z = d(() => s.value && t.value && !r.value && !u.value), C = () => {
139
- u.value || l();
161
+ setup(t) {
162
+ const { clear: e } = C(), { isDisabled: n, tooltip: a, tooltipPlacement: d, show: c } = L(), s = () => {
163
+ n.value || e();
140
164
  };
141
- return (e, n) => z.value ? (i(), b(O, {
165
+ return (u, r) => o(c) ? (i(), f(Z, {
142
166
  key: 0,
143
- icon: o(F),
144
- disabled: u.value,
145
- tooltip: _.value,
146
- "tooltip-placement": y.value,
147
- onClick: C
148
- }, null, 8, ["icon", "disabled", "tooltip", "tooltip-placement"])) : k("", !0);
167
+ icon: o(U),
168
+ disabled: o(n),
169
+ tooltip: o(a),
170
+ "tooltip-placement": o(d),
171
+ onClick: s
172
+ }, null, 8, ["icon", "disabled", "tooltip", "tooltip-placement"])) : h("", !0);
149
173
  }
150
- }), q = {
174
+ }), tt = {
151
175
  key: 0,
152
176
  class: "tr-sender-word-counter"
153
- }, G = /* @__PURE__ */ h({
177
+ }, et = /* @__PURE__ */ y({
154
178
  __name: "index",
155
- setup(a) {
156
- const { characterCount: t, maxLength: s, isOverLimit: l, showWordLimit: r } = g(), c = d(() => r.value && s.value !== void 0);
157
- return (u, _) => c.value ? (i(), p("span", q, [
158
- f("span", {
159
- class: v({ "is-over-limit": o(l) })
160
- }, w(o(t)), 3),
161
- f("span", null, "/" + w(o(s)), 1)
162
- ])) : k("", !0);
179
+ setup(t) {
180
+ const { characterCount: e, maxLength: n, isOverLimit: a, showWordLimit: d } = C(), c = l(() => d.value && n.value !== void 0);
181
+ return (s, u) => c.value ? (i(), b("span", tt, [
182
+ k("span", {
183
+ class: v({ "is-over-limit": o(a) })
184
+ }, T(o(e)), 3),
185
+ k("span", null, "/" + T(o(n)), 1)
186
+ ])) : h("", !0);
163
187
  }
164
- }), nt = /* @__PURE__ */ S(G, [["__scopeId", "data-v-206396cd"]]), H = { class: "tr-default-action-buttons" }, J = {
188
+ }), ut = /* @__PURE__ */ w(et, [["__scopeId", "data-v-206396cd"]]), ot = {
189
+ key: 0,
190
+ class: "tr-default-action-buttons"
191
+ }, nt = {
165
192
  key: 0,
166
193
  class: "tr-action-buttons-group"
167
- }, M = { class: "tr-submit-wrapper" }, Q = /* @__PURE__ */ h({
194
+ }, st = /* @__PURE__ */ y({
168
195
  __name: "index",
169
- setup(a) {
170
- const { hasContent: t, loading: s } = g();
171
- return (l, r) => (i(), p("div", H, [
172
- m(I, { name: "tr-slide-right" }, {
173
- default: x(() => [
174
- o(t) || o(s) ? (i(), p("div", J, [
175
- m(I, { name: "tr-slide-right" }, {
176
- default: x(() => [
177
- m(Y)
196
+ setup(t) {
197
+ const e = W(), { hasContent: n, loading: a } = C(), { show: d } = L(), c = l(() => !!e.prepend), s = l(() => n.value || a.value), u = l(() => c.value || d.value), r = l(() => c.value || s.value);
198
+ return (p, g) => (i(), f($, { name: "tr-slide-right" }, {
199
+ default: S(() => [
200
+ r.value ? (i(), b("div", ot, [
201
+ u.value ? (i(), b("div", nt, [
202
+ B(p.$slots, "prepend", {}, void 0, !0),
203
+ x($, { name: "tr-slide-right" }, {
204
+ default: S(() => [
205
+ x(Q)
178
206
  ]),
179
207
  _: 1
180
- }),
181
- f("div", M, [
182
- m(X)
183
- ])
184
- ])) : k("", !0)
185
- ]),
186
- _: 1
187
- })
188
- ]));
208
+ })
209
+ ])) : h("", !0),
210
+ s.value ? (i(), f(J, { key: 1 })) : h("", !0)
211
+ ])) : h("", !0)
212
+ ]),
213
+ _: 3
214
+ }));
189
215
  }
190
- }), ot = /* @__PURE__ */ S(Q, [["__scopeId", "data-v-209924d7"]]);
216
+ }), dt = /* @__PURE__ */ w(st, [["__scopeId", "data-v-e9441989"]]);
191
217
  export {
192
- O as A,
193
- ot as D,
194
- X as S,
195
- nt as W,
196
- Y as _,
197
- R as a,
198
- g as u
218
+ Z as A,
219
+ dt as D,
220
+ K as S,
221
+ ut as W,
222
+ Q as _,
223
+ J as a,
224
+ C as u
199
225
  };
package/dist/index3.js CHANGED
@@ -4,7 +4,7 @@ var C = (i, o, e) => D(i, typeof o != "symbol" ? o + "" : o, e);
4
4
  import { defineComponent as B, toRefs as H, computed as R, watch as F, openBlock as S, createBlock as x, unref as p, ref as V, reactive as A, onUnmounted as P, createElementBlock as j, Fragment as U, normalizeClass as W, createSlots as L, withCtx as y, renderSlot as z, resolveDynamicComponent as M, createCommentVNode as N } from "vue";
5
5
  import { e as O } from "./index4.js";
6
6
  import { u as I, A as b } from "./index2.js";
7
- import { IconUpload as T, IconVoice as _, IconRecordingWave as q } from "@opentiny/tiny-robot-svgs";
7
+ import { IconImageUpload as T, IconVoice as _, IconRecordingWave as q } from "@opentiny/tiny-robot-svgs";
8
8
  import { _ as G } from "./_plugin-vue_export-helper.js";
9
9
  const te = /* @__PURE__ */ B({
10
10
  __name: "index",