@opentiny/tiny-robot 0.2.12 → 0.2.14
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/base-popper/index.js +89 -74
- package/dist/dropdown-menu/index.js +24 -22
- package/dist/index.d.ts +159 -715
- package/dist/index.js +33 -41
- package/dist/sender/index.js +674 -676
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,18 +1,42 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { d as
|
|
3
|
-
import { t as
|
|
4
|
-
import { _ as
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { computed as u, Fragment as R, ref as N, watch as k, defineComponent as j, useSlots as G, createElementBlock as E, openBlock as y, createVNode as I, renderList as F, unref as b, createBlock as S, resolveDynamicComponent as U, mergeProps as B, isVNode as W, Transition as Z, normalizeProps as q, guardReactiveProps as J, withCtx as K, createCommentVNode as Q, Teleport as X, createElementVNode as Y, renderSlot as ee } from "vue";
|
|
2
|
+
import { d as te, e as oe, b as re } from "../index2.js";
|
|
3
|
+
import { t as m } from "../utils.js";
|
|
4
|
+
import { _ as ne } from "../_plugin-vue_export-helper.js";
|
|
5
|
+
function se(f, g) {
|
|
6
|
+
const t = u(() => {
|
|
7
|
+
const e = (f == null ? void 0 : f()) || [], a = e.find((d) => d.type === R);
|
|
8
|
+
return a && Array.isArray(a.children) ? a.children : e;
|
|
9
|
+
}), p = u(() => g ? t.value.length : 1), v = u(() => t.value.slice(0, p.value)), c = N([]), s = (e) => e && typeof e == "object" && "$el" in e || e instanceof HTMLElement || e instanceof SVGElement ? e : (console.warn("el must be an HTMLElement or SVGElement or Vue component instance. el:", e), null), x = (e) => {
|
|
10
|
+
c.value[0] = s(e);
|
|
11
|
+
}, A = (e, a) => {
|
|
12
|
+
c.value[a] = s(e);
|
|
13
|
+
};
|
|
14
|
+
return k(
|
|
15
|
+
p,
|
|
16
|
+
(e) => {
|
|
17
|
+
c.value.length = e;
|
|
18
|
+
},
|
|
19
|
+
{ flush: "post" }
|
|
20
|
+
), {
|
|
21
|
+
vnodes: v,
|
|
22
|
+
ref: u(() => c.value.at(0)),
|
|
23
|
+
refs: c,
|
|
24
|
+
setRef: x,
|
|
25
|
+
setRefs: A
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function ae(f, g) {
|
|
29
|
+
return u(() => {
|
|
30
|
+
var s;
|
|
31
|
+
const t = te(f), p = (s = t == null ? void 0 : t.getRootNode) == null ? void 0 : s.call(t);
|
|
32
|
+
return p instanceof ShadowRoot ? p : document.body;
|
|
10
33
|
});
|
|
11
34
|
}
|
|
12
|
-
const
|
|
35
|
+
const le = /* @__PURE__ */ j({
|
|
13
36
|
inheritAttrs: !1,
|
|
14
37
|
__name: "index",
|
|
15
38
|
props: {
|
|
39
|
+
appendTo: {},
|
|
16
40
|
offset: {},
|
|
17
41
|
placement: { default: "top-center" },
|
|
18
42
|
preventOverflow: { type: Boolean },
|
|
@@ -21,87 +45,78 @@ const ce = /* @__PURE__ */ j({
|
|
|
21
45
|
transitionProps: {},
|
|
22
46
|
triggerEvents: {}
|
|
23
47
|
},
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
{ flush: "post" }
|
|
38
|
-
);
|
|
39
|
-
function N(e = {}, t) {
|
|
40
|
-
const r = {};
|
|
41
|
-
for (const [n, s] of Object.entries(e))
|
|
42
|
-
/^on[A-Z]/.test(n) && typeof s == "function" && (r[n] = (...f) => s(...f, t));
|
|
43
|
-
return r;
|
|
48
|
+
setup(f, { expose: g }) {
|
|
49
|
+
const t = f, p = G(), {
|
|
50
|
+
vnodes: v,
|
|
51
|
+
refs: c,
|
|
52
|
+
ref: s,
|
|
53
|
+
setRefs: x
|
|
54
|
+
} = se(p.trigger, t.renderAllTriggers);
|
|
55
|
+
function A(o = {}, l) {
|
|
56
|
+
const n = {};
|
|
57
|
+
for (const [r, i] of Object.entries(o))
|
|
58
|
+
/^on[A-Z]/.test(r) && typeof i == "function" && (n[r] = (...h) => i(...h, l));
|
|
59
|
+
return n;
|
|
44
60
|
}
|
|
45
|
-
const
|
|
46
|
-
() =>
|
|
47
|
-
),
|
|
48
|
-
var
|
|
49
|
-
return typeof
|
|
50
|
-
mainAxis: ((
|
|
51
|
-
crossAxis: ((
|
|
61
|
+
const e = u(
|
|
62
|
+
() => v.value.map((o, l) => A(t.triggerEvents, l))
|
|
63
|
+
), a = N(null), d = u(() => {
|
|
64
|
+
var o, l;
|
|
65
|
+
return typeof t.offset == "number" ? { mainAxis: t.offset, crossAxis: 0 } : {
|
|
66
|
+
mainAxis: ((o = t.offset) == null ? void 0 : o.mainAxis) ?? 0,
|
|
67
|
+
crossAxis: ((l = t.offset) == null ? void 0 : l.crossAxis) ?? 0
|
|
52
68
|
};
|
|
53
|
-
}), { top:
|
|
54
|
-
const { placement:
|
|
55
|
-
if (!
|
|
56
|
-
|
|
69
|
+
}), { top: $, bottom: P, left: T, right: O, width: C, update: H } = oe(s), { width: _, height: w } = re(a, void 0, { box: "border-box" }), M = u(() => {
|
|
70
|
+
const { placement: o, preventOverflow: l } = t, n = {}, r = (i, h) => {
|
|
71
|
+
if (!l) {
|
|
72
|
+
n[i] = h;
|
|
57
73
|
return;
|
|
58
74
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
75
|
+
const V = i === "top" || i === "bottom", D = V ? "100dvh" : "100dvw", L = m(V ? w.value : _.value);
|
|
76
|
+
n[i] = `clamp(0px, ${h}, calc(${D} - ${L}))`;
|
|
61
77
|
};
|
|
62
|
-
return
|
|
78
|
+
return o.includes("top") && r("top", m($.value - w.value - d.value.mainAxis)), o.includes("bottom") && r("bottom", `calc(100% - ${m(P.value + w.value + d.value.mainAxis)})`), o.includes("left") && r("left", m(T.value + d.value.crossAxis)), o.includes("right") && r("right", `calc(100% - ${m(O.value + d.value.crossAxis)})`), o.includes("center") && r("left", m(T.value + C.value / 2 - _.value / 2 + d.value.crossAxis)), n;
|
|
63
79
|
});
|
|
64
|
-
|
|
65
|
-
() =>
|
|
66
|
-
(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
80
|
+
k(
|
|
81
|
+
() => t.show,
|
|
82
|
+
(o) => {
|
|
83
|
+
o && H();
|
|
84
|
+
},
|
|
85
|
+
{ flush: "post" }
|
|
71
86
|
);
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
-
triggerRef:
|
|
75
|
-
triggerRefs:
|
|
76
|
-
popperRef:
|
|
77
|
-
}), (
|
|
78
|
-
(
|
|
79
|
-
key:
|
|
87
|
+
const z = ae(s);
|
|
88
|
+
return g({
|
|
89
|
+
triggerRef: s,
|
|
90
|
+
triggerRefs: c,
|
|
91
|
+
popperRef: a
|
|
92
|
+
}), (o, l) => (y(), E(R, null, [
|
|
93
|
+
(y(!0), E(R, null, F(b(v), (n, r) => (y(), S(U(n), B({
|
|
94
|
+
key: W(n) ? n.key : r,
|
|
80
95
|
ref_for: !0,
|
|
81
|
-
ref: (
|
|
82
|
-
}, { ref_for: !0 },
|
|
83
|
-
|
|
84
|
-
default:
|
|
85
|
-
|
|
96
|
+
ref: (i) => b(x)(i, r)
|
|
97
|
+
}, { ref_for: !0 }, e.value[r]), null, 16))), 128)),
|
|
98
|
+
I(Z, q(J(o.transitionProps)), {
|
|
99
|
+
default: K(() => [
|
|
100
|
+
o.show ? (y(), S(X, {
|
|
86
101
|
key: 0,
|
|
87
|
-
to:
|
|
102
|
+
to: t.appendTo || b(z)
|
|
88
103
|
}, [
|
|
89
|
-
|
|
104
|
+
Y("div", B({
|
|
90
105
|
class: "tr-base-popper",
|
|
91
106
|
ref_key: "popperRef",
|
|
92
|
-
ref:
|
|
93
|
-
style:
|
|
94
|
-
},
|
|
95
|
-
|
|
107
|
+
ref: a,
|
|
108
|
+
style: M.value
|
|
109
|
+
}, o.$attrs), [
|
|
110
|
+
ee(o.$slots, "content", {}, void 0, !0)
|
|
96
111
|
], 16)
|
|
97
|
-
], 8, ["to"])) :
|
|
112
|
+
], 8, ["to"])) : Q("", !0)
|
|
98
113
|
]),
|
|
99
114
|
_: 3
|
|
100
115
|
}, 16)
|
|
101
116
|
], 64));
|
|
102
117
|
}
|
|
103
|
-
}),
|
|
104
|
-
|
|
118
|
+
}), ie = /* @__PURE__ */ ne(le, [["__scopeId", "data-v-335d147d"]]);
|
|
119
|
+
ie.name = "TrBasePopper";
|
|
105
120
|
export {
|
|
106
|
-
|
|
121
|
+
ie as default
|
|
107
122
|
};
|
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
import { defineComponent as C, ref as g, computed as n, watch as R, createBlock as E, openBlock as a, unref as x, withCtx as v, createElementVNode as B, createElementBlock as _, Fragment as
|
|
2
|
-
import { o as
|
|
1
|
+
import { defineComponent as C, ref as g, computed as n, watch as R, createBlock as E, openBlock as a, unref as x, withCtx as v, createElementVNode as B, createElementBlock as _, Fragment as T, renderList as D, toDisplayString as M, renderSlot as H } from "vue";
|
|
2
|
+
import { o as L, c as k, d as P } from "../index2.js";
|
|
3
3
|
import b from "../base-popper/index.js";
|
|
4
4
|
import { _ as I } from "../_plugin-vue_export-helper.js";
|
|
5
5
|
const S = { class: "tr-dropdown-menu__list" }, $ = ["onClick"], F = /* @__PURE__ */ C({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
|
+
appendTo: {},
|
|
8
9
|
items: {},
|
|
9
10
|
show: { type: Boolean },
|
|
10
11
|
trigger: { default: "click" }
|
|
11
12
|
},
|
|
12
13
|
emits: ["item-click", "click-outside"],
|
|
13
14
|
setup(l, { emit: w }) {
|
|
14
|
-
const t = l, c = w,
|
|
15
|
-
get: () => t.trigger === "manual" ? t.show :
|
|
15
|
+
const t = l, c = w, p = g(!1), r = n({
|
|
16
|
+
get: () => t.trigger === "manual" ? t.show : p.value,
|
|
16
17
|
set: (e) => {
|
|
17
|
-
t.trigger !== "manual" && (
|
|
18
|
+
t.trigger !== "manual" && (p.value = e);
|
|
18
19
|
}
|
|
19
|
-
}), i = g(null),
|
|
20
|
+
}), i = g(null), u = n(() => {
|
|
20
21
|
var e;
|
|
21
22
|
return (e = i.value) == null ? void 0 : e.triggerRef;
|
|
22
|
-
}),
|
|
23
|
+
}), d = n(() => {
|
|
23
24
|
var e;
|
|
24
25
|
return (e = i.value) == null ? void 0 : e.popperRef;
|
|
25
26
|
});
|
|
26
27
|
if (t.trigger === "click" || t.trigger === "manual")
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
L(
|
|
29
|
+
d,
|
|
29
30
|
(e) => {
|
|
30
31
|
c("click-outside", e), r.value = !1;
|
|
31
32
|
},
|
|
32
|
-
{ ignore: [
|
|
33
|
+
{ ignore: [u] }
|
|
33
34
|
);
|
|
34
35
|
else if (t.trigger === "hover") {
|
|
35
36
|
const e = k(
|
|
36
|
-
n(() =>
|
|
37
|
+
n(() => P(u.value)),
|
|
37
38
|
{ delayEnter: 100, delayLeave: 300 }
|
|
38
|
-
),
|
|
39
|
+
), m = k(d, { delayEnter: 100, delayLeave: 300 });
|
|
39
40
|
R(
|
|
40
|
-
() => [e.value,
|
|
41
|
-
([o,
|
|
42
|
-
r.value = o ||
|
|
41
|
+
() => [e.value, m.value],
|
|
42
|
+
([o, f]) => {
|
|
43
|
+
r.value = o || f;
|
|
43
44
|
}
|
|
44
45
|
);
|
|
45
46
|
}
|
|
@@ -48,33 +49,34 @@ const S = { class: "tr-dropdown-menu__list" }, $ = ["onClick"], F = /* @__PURE__
|
|
|
48
49
|
}, y = (e) => {
|
|
49
50
|
r.value = !1, c("item-click", e);
|
|
50
51
|
};
|
|
51
|
-
return (e,
|
|
52
|
+
return (e, m) => (a(), E(x(b), {
|
|
52
53
|
show: r.value,
|
|
53
54
|
class: "tr-dropdown-menu",
|
|
54
55
|
ref_key: "basePopperRef",
|
|
55
56
|
ref: i,
|
|
56
57
|
placement: "top-left",
|
|
58
|
+
"append-to": t.appendTo,
|
|
57
59
|
offset: 8,
|
|
58
60
|
"transition-props": { name: "tr-dropdown-menu" },
|
|
59
61
|
"prevent-overflow": !0,
|
|
60
62
|
"trigger-events": { onClick: h }
|
|
61
63
|
}, {
|
|
62
64
|
trigger: v(() => [
|
|
63
|
-
|
|
65
|
+
H(e.$slots, "trigger", {}, void 0, !0)
|
|
64
66
|
]),
|
|
65
67
|
content: v(() => [
|
|
66
68
|
B("ul", S, [
|
|
67
|
-
(a(!0), _(
|
|
69
|
+
(a(!0), _(T, null, D(t.items, (o) => (a(), _("li", {
|
|
68
70
|
class: "tr-dropdown-menu__list-item",
|
|
69
71
|
key: o.id,
|
|
70
|
-
onClick: (
|
|
71
|
-
},
|
|
72
|
+
onClick: (f) => y(o)
|
|
73
|
+
}, M(o.text), 9, $))), 128))
|
|
72
74
|
])
|
|
73
75
|
]),
|
|
74
76
|
_: 3
|
|
75
|
-
}, 8, ["show", "trigger-events"]));
|
|
77
|
+
}, 8, ["show", "append-to", "trigger-events"]));
|
|
76
78
|
}
|
|
77
|
-
}), s = /* @__PURE__ */ I(F, [["__scopeId", "data-v-
|
|
79
|
+
}), s = /* @__PURE__ */ I(F, [["__scopeId", "data-v-ea33ed82"]]);
|
|
78
80
|
s.name = "TrDropdownMenu";
|
|
79
81
|
const N = function(l) {
|
|
80
82
|
l.component(s.name, s);
|