@opentiny/tiny-robot 0.3.0-alpha.2 → 0.3.0-alpha.4
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/action-group/index.js +45 -42
- package/dist/base-popper/index.js +4 -0
- package/dist/bubble/index.js +1359 -2141
- package/dist/close.js +1 -1
- package/dist/container/index.js +4 -4
- package/dist/dropdown-menu/index.js +79 -64
- package/dist/feedback/index.js +43 -43
- package/dist/flow-layout-buttons/index.js +36 -33
- package/dist/history/index.js +43 -43
- package/dist/icon-button/index.js +18 -19
- package/dist/index.d.ts +562 -1945
- package/dist/index.js +43 -58
- package/dist/index2.js +359 -290
- package/dist/index3.js +137 -298
- package/dist/index4.js +269 -591
- package/dist/index5.js +528 -2048
- package/dist/index6.js +2069 -4665
- package/dist/index7.js +4749 -0
- package/dist/question/index.js +55 -55
- package/dist/sender/index.js +994 -1184
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +74 -74
- package/dist/suggestion-pills/index.js +125 -158
- package/dist/suggestion-popover/index.js +246 -219
- package/dist/tiny-robot-svgs.js +158 -211
- package/dist/useSlotRefs.js +36 -0
- package/dist/utils.js +4 -15
- package/package.json +3 -4
- package/dist/loading.js +0 -4
|
@@ -1,201 +1,168 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
const oe = { key: 0 }, ne = /* @__PURE__ */ T({
|
|
1
|
+
import { defineComponent as q, useSlots as J, computed as a, createElementBlock as m, openBlock as r, normalizeClass as y, renderSlot as H, createBlock as x, resolveDynamicComponent as R, createCommentVNode as S, toDisplayString as oe, mergeModels as O, useModel as ne, ref as d, watch as F, nextTick as N, createElementVNode as $, Fragment as D, renderList as z, isVNode as G, createVNode as K, Transition as le, withCtx as se, unref as re } from "vue";
|
|
2
|
+
import { K as ae } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { c as ie, d as j, w as ce, o as ue, e as fe } from "../index2.js";
|
|
4
|
+
import { u as de } from "../useSlotRefs.js";
|
|
5
|
+
import { _ as Q } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
const me = { key: 0 }, pe = /* @__PURE__ */ q({
|
|
8
7
|
__name: "PillButton",
|
|
9
8
|
props: {
|
|
10
9
|
item: {}
|
|
11
10
|
},
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
return !!(
|
|
16
|
-
}),
|
|
17
|
-
var
|
|
18
|
-
return !!(
|
|
19
|
-
}),
|
|
20
|
-
return (
|
|
21
|
-
class:
|
|
11
|
+
setup(i) {
|
|
12
|
+
const h = i, _ = J(), p = a(() => {
|
|
13
|
+
var t;
|
|
14
|
+
return !!(_.icon || (t = h.item) != null && t.icon);
|
|
15
|
+
}), k = a(() => {
|
|
16
|
+
var t;
|
|
17
|
+
return !!(_.default || (t = h.item) != null && t.text);
|
|
18
|
+
}), I = a(() => p.value && !k.value);
|
|
19
|
+
return (t, u) => (r(), m("button", {
|
|
20
|
+
class: y(["tr-suggestion-pills__item", { "only-icon": I.value }])
|
|
22
21
|
}, [
|
|
23
|
-
|
|
24
|
-
var
|
|
22
|
+
H(t.$slots, "icon", {}, () => {
|
|
23
|
+
var c;
|
|
25
24
|
return [
|
|
26
|
-
(
|
|
25
|
+
(r(), x(R((c = t.item) == null ? void 0 : c.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
27
26
|
];
|
|
28
27
|
}, !0),
|
|
29
|
-
|
|
30
|
-
var
|
|
28
|
+
H(t.$slots, "default", {}, () => {
|
|
29
|
+
var c;
|
|
31
30
|
return [
|
|
32
|
-
(
|
|
31
|
+
(c = t.item) != null && c.text ? (r(), m("span", me, oe(t.item.text), 1)) : S("", !0)
|
|
33
32
|
];
|
|
34
33
|
}, !0)
|
|
35
34
|
], 2));
|
|
36
35
|
}
|
|
37
|
-
}),
|
|
38
|
-
__name: "PillButtonWrapper",
|
|
39
|
-
props: {
|
|
40
|
-
item: {},
|
|
41
|
-
style: {}
|
|
42
|
-
},
|
|
43
|
-
emits: ["click"],
|
|
44
|
-
setup(u, { emit: g }) {
|
|
45
|
-
const l = g;
|
|
46
|
-
return (e, r) => {
|
|
47
|
-
var m, o, c, i, p, y;
|
|
48
|
-
return ((m = e.item.action) == null ? void 0 : m.type) === "popover" ? (n(), v(h(te), D({
|
|
49
|
-
key: 0,
|
|
50
|
-
style: e.style
|
|
51
|
-
}, e.item.action.props, {
|
|
52
|
-
onItemClick: (o = e.item.action.events) == null ? void 0 : o.itemClick,
|
|
53
|
-
onGroupClick: (c = e.item.action.events) == null ? void 0 : c.groupClick,
|
|
54
|
-
onClose: (i = e.item.action.events) == null ? void 0 : i.close
|
|
55
|
-
}), q({
|
|
56
|
-
default: B(() => [
|
|
57
|
-
I(d, {
|
|
58
|
-
item: e.item,
|
|
59
|
-
onClick: r[0] || (r[0] = (a) => l("click", a, e.item))
|
|
60
|
-
}, null, 8, ["item"])
|
|
61
|
-
]),
|
|
62
|
-
_: 2
|
|
63
|
-
}, [
|
|
64
|
-
M(e.item.action.slots, (a, C) => ({
|
|
65
|
-
name: C,
|
|
66
|
-
fn: B(() => [
|
|
67
|
-
(n(), v(N(a)))
|
|
68
|
-
])
|
|
69
|
-
}))
|
|
70
|
-
]), 1040, ["style", "onItemClick", "onGroupClick", "onClose"])) : ((p = e.item.action) == null ? void 0 : p.type) === "menu" ? (n(), v(h(ee), D({
|
|
71
|
-
key: 1,
|
|
72
|
-
style: e.style
|
|
73
|
-
}, e.item.action.props, {
|
|
74
|
-
onItemClick: (y = e.item.action.events) == null ? void 0 : y.itemClick
|
|
75
|
-
}), {
|
|
76
|
-
default: B(() => [
|
|
77
|
-
I(d, {
|
|
78
|
-
item: e.item,
|
|
79
|
-
onClick: r[1] || (r[1] = (a) => l("click", a, e.item))
|
|
80
|
-
}, null, 8, ["item"])
|
|
81
|
-
]),
|
|
82
|
-
_: 1
|
|
83
|
-
}, 16, ["style", "onItemClick"])) : (n(), v(d, {
|
|
84
|
-
key: 2,
|
|
85
|
-
item: e.item,
|
|
86
|
-
style: O(e.style),
|
|
87
|
-
onClick: r[2] || (r[2] = (a) => l("click", a, e.item))
|
|
88
|
-
}, null, 8, ["item", "style"]));
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}), le = { class: "tr-suggestion-pills__more-wrapper" }, ie = {
|
|
92
|
-
key: 0,
|
|
93
|
-
class: "tr-suggestion-pills__more"
|
|
94
|
-
}, se = /* @__PURE__ */ T({
|
|
36
|
+
}), g = /* @__PURE__ */ Q(pe, [["__scopeId", "data-v-5c433c31"]]), ve = { class: "tr-suggestion-pills__more-wrapper" }, ge = /* @__PURE__ */ q({
|
|
95
37
|
__name: "index",
|
|
96
|
-
props: /* @__PURE__ */
|
|
97
|
-
items: {},
|
|
38
|
+
props: /* @__PURE__ */ O({
|
|
98
39
|
showAll: { type: Boolean },
|
|
99
|
-
showAllButtonOn: { default: "hover" }
|
|
40
|
+
showAllButtonOn: { default: "hover" },
|
|
41
|
+
overflowMode: { default: "expand" },
|
|
42
|
+
autoScrollOnHover: { type: Boolean }
|
|
100
43
|
}, {
|
|
101
44
|
showAll: { type: Boolean, default: !1 },
|
|
102
45
|
showAllModifiers: {}
|
|
103
46
|
}),
|
|
104
|
-
emits: /* @__PURE__ */
|
|
105
|
-
setup(
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
47
|
+
emits: /* @__PURE__ */ O(["click-outside"], ["update:showAll"]),
|
|
48
|
+
setup(i, { expose: h, emit: _ }) {
|
|
49
|
+
const p = i, k = J(), I = _, { vnodes: t } = de(k.default, !0), u = ne(i, "showAll"), c = d(null), f = d(null), b = d(null), { width: M } = ie(f), A = d(0), B = a(() => p.overflowMode === "expand" && M.value < A.value), v = d(-1), U = a(() => B.value && u.value ? t.value.slice(0, v.value) : t.value), W = a(() => B.value && u.value ? t.value.slice(v.value).map((e, o) => ({
|
|
50
|
+
vnode: e,
|
|
51
|
+
index: o + v.value
|
|
52
|
+
})) : []), C = d([]), T = d([]), E = a(() => C.value.map((e) => j(e)).filter((e) => e instanceof Element)), X = a(() => T.value.map((e) => j(e)).filter((e) => e instanceof Element)), P = () => {
|
|
53
|
+
const e = f.value, o = b.value;
|
|
54
|
+
return Array.from((e == null ? void 0 : e.children) || []).concat(Array.from((o == null ? void 0 : o.children) || []));
|
|
55
|
+
}, V = () => {
|
|
56
|
+
N(() => {
|
|
57
|
+
const e = f.value;
|
|
58
|
+
if (!e)
|
|
113
59
|
return;
|
|
114
|
-
const
|
|
115
|
-
|
|
60
|
+
const o = P(), n = parseFloat(getComputedStyle(e).rowGap) || 0;
|
|
61
|
+
v.value = -1;
|
|
62
|
+
let l = 0;
|
|
63
|
+
for (let s = 0; s < o.length; s++)
|
|
64
|
+
if (l += o[s].offsetWidth, s > 0 && (l += n), l > e.clientWidth) {
|
|
65
|
+
v.value = s;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
116
68
|
});
|
|
117
69
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
70
|
+
F(
|
|
71
|
+
t,
|
|
72
|
+
() => {
|
|
73
|
+
N(() => {
|
|
74
|
+
if (!f.value)
|
|
75
|
+
return;
|
|
76
|
+
const e = P(), o = parseFloat(getComputedStyle(f.value).rowGap) || 0;
|
|
77
|
+
A.value = e.reduce((n, l, s) => n + l.offsetWidth + (s > 0 ? o : 0), 0);
|
|
78
|
+
});
|
|
125
79
|
},
|
|
126
|
-
{
|
|
127
|
-
);
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
80
|
+
{ immediate: !0 }
|
|
81
|
+
), F(t, V), ce(M, V, { debounce: 100 });
|
|
82
|
+
const Y = () => {
|
|
83
|
+
u.value = !u.value;
|
|
84
|
+
};
|
|
85
|
+
ue(c, (e) => {
|
|
86
|
+
u.value && I("click-outside", e);
|
|
87
|
+
});
|
|
88
|
+
const Z = (e) => {
|
|
89
|
+
const o = f.value;
|
|
90
|
+
if (!o)
|
|
131
91
|
return;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
92
|
+
const n = e.offsetLeft, l = n + e.offsetWidth, s = o.scrollLeft, L = o.clientWidth, ee = n < s, te = l > s + L;
|
|
93
|
+
ee ? o.scrollTo({
|
|
94
|
+
left: n,
|
|
95
|
+
behavior: "smooth"
|
|
96
|
+
}) : te && o.scrollTo({
|
|
97
|
+
left: l - L,
|
|
98
|
+
behavior: "smooth"
|
|
99
|
+
});
|
|
136
100
|
};
|
|
137
|
-
return
|
|
138
|
-
e(
|
|
139
|
-
}), (
|
|
101
|
+
return fe(E, "mouseenter", (e) => {
|
|
102
|
+
p.autoScrollOnHover && e.currentTarget && Z(e.currentTarget);
|
|
103
|
+
}), h({
|
|
104
|
+
children: a(() => E.value.concat(X.value))
|
|
105
|
+
}), (e, o) => (r(), m("div", {
|
|
140
106
|
class: "tr-suggestion-pills__wrapper",
|
|
141
107
|
ref_key: "containerWrapperRef",
|
|
142
|
-
ref:
|
|
108
|
+
ref: c
|
|
143
109
|
}, [
|
|
144
|
-
|
|
145
|
-
class: "tr-suggestion-pills__container",
|
|
110
|
+
$("div", {
|
|
111
|
+
class: y(["tr-suggestion-pills__container", { "overflow-scroll": p.overflowMode === "scroll" }]),
|
|
146
112
|
ref_key: "containerRef",
|
|
147
|
-
ref:
|
|
113
|
+
ref: f
|
|
148
114
|
}, [
|
|
149
|
-
|
|
150
|
-
(n
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
key:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
115
|
+
(r(!0), m(D, null, z(U.value, (n, l) => (r(), x(R(n), {
|
|
116
|
+
key: G(n) ? n.key : l,
|
|
117
|
+
ref_for: !0,
|
|
118
|
+
ref_key: "staticMaybeItemRefs",
|
|
119
|
+
ref: C
|
|
120
|
+
}))), 128))
|
|
121
|
+
], 2),
|
|
122
|
+
$("div", ve, [
|
|
123
|
+
K(le, { name: "tr-suggestion-pills__more" }, {
|
|
124
|
+
default: se(() => [
|
|
125
|
+
W.value.length ? (r(), m("div", {
|
|
126
|
+
key: 0,
|
|
127
|
+
class: "tr-suggestion-pills__more",
|
|
128
|
+
ref_key: "floatingItemsRef",
|
|
129
|
+
ref: b
|
|
130
|
+
}, [
|
|
131
|
+
(r(!0), m(D, null, z(W.value, ({ vnode: n, index: l }) => (r(), x(R(n), {
|
|
132
|
+
key: G(n) ? n.key : l,
|
|
133
|
+
ref_for: !0,
|
|
134
|
+
ref_key: "floatingMaybeItemRefs",
|
|
135
|
+
ref: T
|
|
136
|
+
}))), 128))
|
|
137
|
+
], 512)) : S("", !0)
|
|
171
138
|
]),
|
|
172
139
|
_: 1
|
|
173
140
|
})
|
|
174
141
|
]),
|
|
175
|
-
|
|
142
|
+
B.value ? (r(), m("button", {
|
|
176
143
|
key: 0,
|
|
177
|
-
class:
|
|
178
|
-
onClick:
|
|
144
|
+
class: y(["tr-suggestion-pills__expand", { "show-on-hover": p.showAllButtonOn === "hover" }]),
|
|
145
|
+
onClick: Y
|
|
179
146
|
}, [
|
|
180
|
-
|
|
181
|
-
class:
|
|
147
|
+
K(re(ae), {
|
|
148
|
+
class: y(["tr-suggestion-pills__expand-icon", { rotate: u.value }])
|
|
182
149
|
}, null, 8, ["class"])
|
|
183
|
-
], 2)) :
|
|
150
|
+
], 2)) : S("", !0)
|
|
184
151
|
], 512));
|
|
185
152
|
}
|
|
186
|
-
}),
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
153
|
+
}), w = /* @__PURE__ */ Q(ge, [["__scopeId", "data-v-ffbab62d"]]);
|
|
154
|
+
w.name = "TrSuggestionPills";
|
|
155
|
+
const he = function(i) {
|
|
156
|
+
i.component(w.name, w);
|
|
190
157
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
158
|
+
w.install = he;
|
|
159
|
+
g.name = "TrSuggestionPillButton";
|
|
160
|
+
const _e = function(i) {
|
|
161
|
+
i.component(g.name, g);
|
|
195
162
|
};
|
|
196
|
-
|
|
197
|
-
const
|
|
163
|
+
g.install = _e;
|
|
164
|
+
const xe = g;
|
|
198
165
|
export {
|
|
199
|
-
|
|
200
|
-
|
|
166
|
+
xe as SuggestionPillButton,
|
|
167
|
+
w as default
|
|
201
168
|
};
|