@opentiny/tiny-robot 0.2.0-alpha.5 → 0.2.0-alpha.7
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 +69 -67
- package/dist/bubble/index.js +261 -259
- package/dist/dropdown-menu/index.js +33 -30
- package/dist/feedback/index.js +44 -44
- package/dist/flow-layout-buttons/index.js +74 -71
- package/dist/index.d.ts +215 -142
- package/dist/index3.js +233 -202
- package/dist/sender/index.js +898 -712
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +156 -98
- package/dist/suggestion-popover/index.js +68 -65
- package/package.json +3 -3
|
@@ -1,119 +1,177 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { defineComponent as b, useSlots as R, computed as k, createElementBlock as f, openBlock as n, normalizeClass as U, renderSlot as B, createBlock as u, resolveDynamicComponent as G, createCommentVNode as S, toDisplayString as F, unref as _, mergeProps as D, createSlots as H, withCtx as y, createVNode as $, renderList as P, mergeModels as V, useCssVars as j, ref as E, useModel as q, watch as J, createElementVNode as N, Fragment as W, Transition as O, nextTick as Q } from "vue";
|
|
2
|
+
import { K as X, U as Y } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { a as Z, d as x, w as ee } from "../index3.js";
|
|
4
|
+
import te from "../dropdown-menu/index.js";
|
|
5
|
+
import ne from "../suggestion-popover/index.js";
|
|
6
|
+
import { _ as K } from "../_plugin-vue_export-helper.js";
|
|
7
|
+
const oe = { key: 0 }, ie = /* @__PURE__ */ b({
|
|
7
8
|
__name: "PillButton",
|
|
8
9
|
props: {
|
|
9
10
|
item: {}
|
|
10
11
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
var
|
|
14
|
-
return !!(
|
|
15
|
-
}),
|
|
16
|
-
var
|
|
17
|
-
return !!(
|
|
18
|
-
}),
|
|
19
|
-
return (
|
|
20
|
-
class:
|
|
12
|
+
setup(a) {
|
|
13
|
+
const v = a, s = R(), e = k(() => {
|
|
14
|
+
var t;
|
|
15
|
+
return !!(s.icon || (t = v.item) != null && t.icon);
|
|
16
|
+
}), o = k(() => {
|
|
17
|
+
var t;
|
|
18
|
+
return !!(s.default || (t = v.item) != null && t.text);
|
|
19
|
+
}), g = k(() => e.value && !o.value);
|
|
20
|
+
return (t, c) => (n(), f("button", {
|
|
21
|
+
class: U(["tr-suggestion-pills__item", { "only-icon": g.value }])
|
|
21
22
|
}, [
|
|
22
|
-
|
|
23
|
-
var
|
|
23
|
+
B(t.$slots, "icon", {}, () => {
|
|
24
|
+
var i;
|
|
24
25
|
return [
|
|
25
|
-
(n(),
|
|
26
|
+
(n(), u(G((i = t.item) == null ? void 0 : i.icon), { class: "tr-suggestion-pills__item_icon" }))
|
|
26
27
|
];
|
|
27
28
|
}, !0),
|
|
28
|
-
|
|
29
|
-
var
|
|
29
|
+
B(t.$slots, "default", {}, () => {
|
|
30
|
+
var i;
|
|
30
31
|
return [
|
|
31
|
-
(
|
|
32
|
+
(i = t.item) != null && i.text ? (n(), f("span", oe, F(t.item.text), 1)) : S("", !0)
|
|
32
33
|
];
|
|
33
34
|
}, !0)
|
|
34
35
|
], 2));
|
|
35
36
|
}
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
ref: "container"
|
|
39
|
-
}, O = /* @__PURE__ */ D({
|
|
40
|
-
__name: "index",
|
|
37
|
+
}), p = /* @__PURE__ */ K(ie, [["__scopeId", "data-v-bb357728"]]), z = /* @__PURE__ */ b({
|
|
38
|
+
__name: "PillButtonWrapper",
|
|
41
39
|
props: {
|
|
42
|
-
|
|
40
|
+
item: {}
|
|
43
41
|
},
|
|
44
|
-
emits: ["
|
|
45
|
-
setup(
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
emits: ["click"],
|
|
43
|
+
setup(a, { emit: v }) {
|
|
44
|
+
const s = v;
|
|
45
|
+
return (e, o) => {
|
|
46
|
+
var g, t, c, i, m, C;
|
|
47
|
+
return ((g = e.item.action) == null ? void 0 : g.type) === "popover" ? (n(), u(_(ne), D({ key: 0 }, e.item.action.props, {
|
|
48
|
+
onItemClick: (t = e.item.action.events) == null ? void 0 : t.itemClick,
|
|
49
|
+
onGroupClick: (c = e.item.action.events) == null ? void 0 : c.groupClick,
|
|
50
|
+
onClose: (i = e.item.action.events) == null ? void 0 : i.close
|
|
51
|
+
}), H({
|
|
52
|
+
default: y(() => [
|
|
53
|
+
$(p, {
|
|
54
|
+
item: e.item,
|
|
55
|
+
onClick: o[0] || (o[0] = (d) => s("click", e.item))
|
|
56
|
+
}, null, 8, ["item"])
|
|
57
|
+
]),
|
|
58
|
+
_: 2
|
|
59
|
+
}, [
|
|
60
|
+
P(e.item.action.slots, (d, I) => ({
|
|
61
|
+
name: I,
|
|
62
|
+
fn: y(() => [
|
|
63
|
+
(n(), u(G(d)))
|
|
64
|
+
])
|
|
65
|
+
}))
|
|
66
|
+
]), 1040, ["onItemClick", "onGroupClick", "onClose"])) : ((m = e.item.action) == null ? void 0 : m.type) === "menu" ? (n(), u(_(te), D({ key: 1 }, e.item.action.props, {
|
|
67
|
+
onItemClick: (C = e.item.action.events) == null ? void 0 : C.itemClick
|
|
68
|
+
}), {
|
|
69
|
+
default: y(() => [
|
|
70
|
+
$(p, {
|
|
71
|
+
item: e.item,
|
|
72
|
+
onClick: o[1] || (o[1] = (d) => s("click", e.item))
|
|
73
|
+
}, null, 8, ["item"])
|
|
74
|
+
]),
|
|
75
|
+
_: 1
|
|
76
|
+
}, 16, ["onItemClick"])) : (n(), u(p, {
|
|
77
|
+
key: 2,
|
|
78
|
+
item: e.item,
|
|
79
|
+
onClick: o[2] || (o[2] = (d) => s("click", e.item))
|
|
80
|
+
}, null, 8, ["item"]));
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}), se = { class: "tr-suggestion-pills__wrapper" }, le = { class: "tr-suggestion-pills__more-wrapper" }, re = {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "tr-suggestion-pills__more"
|
|
86
|
+
}, ae = /* @__PURE__ */ b({
|
|
87
|
+
__name: "index",
|
|
88
|
+
props: /* @__PURE__ */ V({
|
|
89
|
+
items: {},
|
|
90
|
+
showAll: { type: Boolean }
|
|
91
|
+
}, {
|
|
92
|
+
showAll: { type: Boolean, default: !1 },
|
|
93
|
+
showAllModifiers: {}
|
|
94
|
+
}),
|
|
95
|
+
emits: /* @__PURE__ */ V(["item-click"], ["update:showAll"]),
|
|
96
|
+
setup(a, { emit: v }) {
|
|
97
|
+
j((l) => ({
|
|
98
|
+
"2bdfa5e6": I.value
|
|
48
99
|
}));
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
item
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
],
|
|
102
|
-
|
|
100
|
+
const s = a, e = v, o = E(null), { width: g } = Z(o), { arrivedState: t } = x(o), c = E(-1), i = k(() => c.value !== -1), m = q(a, "showAll"), C = k(() => !i.value || !m.value ? s.items || [] : (s.items || []).slice(0, c.value)), d = k(() => !i.value || !m.value ? [] : (s.items || []).slice(c.value)), I = k(() => t.left ? "linear-gradient(to right, black 90%, transparent)" : "unset"), A = () => {
|
|
101
|
+
Q(() => {
|
|
102
|
+
const l = o.value;
|
|
103
|
+
if (!l)
|
|
104
|
+
return;
|
|
105
|
+
const h = Array.from(l.children);
|
|
106
|
+
c.value = h.findIndex((r) => r.offsetLeft + r.offsetWidth > l.clientWidth);
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
J(() => s.items, A), ee(
|
|
110
|
+
g,
|
|
111
|
+
(l) => {
|
|
112
|
+
l > 0 && A();
|
|
113
|
+
},
|
|
114
|
+
{ debounce: 100 }
|
|
115
|
+
);
|
|
116
|
+
const L = (l, h) => {
|
|
117
|
+
if (i.value && h >= c.value) {
|
|
118
|
+
M();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
e("item-click", l);
|
|
122
|
+
}, M = () => {
|
|
123
|
+
m.value = !m.value;
|
|
124
|
+
};
|
|
125
|
+
return (l, h) => (n(), f("div", se, [
|
|
126
|
+
N("div", {
|
|
127
|
+
class: "tr-suggestion-pills__container",
|
|
128
|
+
ref_key: "containerRef",
|
|
129
|
+
ref: o
|
|
130
|
+
}, [
|
|
131
|
+
B(l.$slots, "default", {}, () => [
|
|
132
|
+
(n(!0), f(W, null, P(C.value, (r, T) => (n(), u(_(z), {
|
|
133
|
+
key: r.id,
|
|
134
|
+
item: r,
|
|
135
|
+
onClick: (me) => L(r, T)
|
|
136
|
+
}, null, 8, ["item", "onClick"]))), 128))
|
|
137
|
+
], !0)
|
|
138
|
+
], 512),
|
|
139
|
+
N("div", le, [
|
|
140
|
+
$(O, { name: "tr-suggestion-pills__more" }, {
|
|
141
|
+
default: y(() => [
|
|
142
|
+
d.value.length ? (n(), f("div", re, [
|
|
143
|
+
(n(!0), f(W, null, P(d.value, (r) => (n(), u(_(z), {
|
|
144
|
+
key: r.id,
|
|
145
|
+
item: r,
|
|
146
|
+
onClick: (T) => e("item-click", r)
|
|
147
|
+
}, null, 8, ["item", "onClick"]))), 128))
|
|
148
|
+
])) : S("", !0)
|
|
149
|
+
]),
|
|
150
|
+
_: 1
|
|
151
|
+
})
|
|
152
|
+
]),
|
|
153
|
+
i.value ? (n(), f("button", {
|
|
154
|
+
key: 0,
|
|
155
|
+
class: "tr-suggestion-pills__expand",
|
|
156
|
+
onClick: M
|
|
157
|
+
}, [
|
|
158
|
+
m.value ? (n(), u(_(Y), { key: 1 })) : (n(), u(_(X), { key: 0 }))
|
|
159
|
+
])) : S("", !0)
|
|
160
|
+
]));
|
|
103
161
|
}
|
|
104
|
-
}),
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
162
|
+
}), w = /* @__PURE__ */ K(ae, [["__scopeId", "data-v-74f54ee4"]]);
|
|
163
|
+
w.name = "TrSuggestionPills";
|
|
164
|
+
const ce = function(a) {
|
|
165
|
+
a.component(w.name, w);
|
|
108
166
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
167
|
+
w.install = ce;
|
|
168
|
+
p.name = "TrSuggestionPillButton";
|
|
169
|
+
const ue = function(a) {
|
|
170
|
+
a.component(p.name, p);
|
|
113
171
|
};
|
|
114
|
-
|
|
115
|
-
const
|
|
172
|
+
p.install = ue;
|
|
173
|
+
const _e = p;
|
|
116
174
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
175
|
+
_e as SuggestionPillButton,
|
|
176
|
+
w as default
|
|
119
177
|
};
|