@opentiny/tiny-robot 0.3.0-alpha.0 → 0.3.0-alpha.10

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,603 +1,637 @@
1
- import { getCurrentScope as se, onScopeDispose as ue, onMounted as oe, nextTick as ce, watch as A, isRef as ae, getCurrentInstance as B, toValue as b, hasInjectionContext as ie, inject as fe, ref as de, readonly as ve, shallowRef as y, computed as I, reactive as K, unref as me, watchEffect as he } from "vue";
2
- function H(e) {
3
- return se() ? (ue(e), !0) : !1;
4
- }
5
- function Z() {
6
- const e = /* @__PURE__ */ new Set(), t = (s) => {
7
- e.delete(s);
1
+ import { n as w, $ as I, y as H, S as z, Q as R, Z as _, h as W, e as U, t as L, P as Q, d as F, i as Z, j as $, k as q, l as G, a as Y, c as j, o as K, q as X, f as J, b as ee } from "./index7.js";
2
+ import * as N from "vue";
3
+ import { withDirectives as te, createVNode as M, vShow as ne } from "vue";
4
+ const k = (e) => e.stopPropagation(), V = ({ state: e, props: t, vm: n, slots: r }) => {
5
+ let p = e.referenceElm || t.reference || n.$refs.reference && n.$refs.reference.$el || n.$refs.reference;
6
+ return !p && r.reference && r.reference()[0] && (e.referenceElm = r.reference()[0].elm || r.reference()[0].el, p = e.referenceElm), p;
7
+ }, re = (e) => {
8
+ if (!e || !e.nodeType) return;
9
+ let t = (p) => parseInt(window.getComputedStyle(p).zIndex, 10) || 0, n = t(e), r;
10
+ do {
11
+ if (e = e.parentNode, e && e instanceof ShadowRoot && e.host && (e = e.host), e)
12
+ r = t(e);
13
+ else
14
+ break;
15
+ n = r > n ? r : n;
16
+ } while (e !== document.body);
17
+ return n + 1 + "";
18
+ }, oe = (e) => {
19
+ const {
20
+ parent: t,
21
+ emit: n,
22
+ nextTick: r,
23
+ onBeforeUnmount: p,
24
+ onDeactivated: c,
25
+ props: o,
26
+ watch: y,
27
+ reactive: f,
28
+ vm: i,
29
+ slots: m,
30
+ toRefs: h,
31
+ popperVmRef: g
32
+ } = e, a = f({
33
+ popperJS: null,
34
+ appended: !1,
35
+ // arrow 是否添加
36
+ popperElm: null,
37
+ showPopper: o.manual ? !!o.modelValue : !1,
38
+ referenceElm: null,
39
+ currentPlacement: ""
40
+ }), s = (l) => {
41
+ if (a.appended)
42
+ return;
43
+ a.appended = !0;
44
+ const u = document.createElement("div");
45
+ u.setAttribute("x-arrow", ""), u.className = "popper__arrow", l.appendChild(u);
46
+ }, b = (l) => {
47
+ const { followReferenceHide: u = !0 } = (o == null ? void 0 : o.popperOptions) || {}, { _popper: v, _reference: d } = l;
48
+ u && H(d) && (v.style.display = "none");
49
+ }, P = (l) => o.zIndex === "relative" ? re(l) : I.nextZIndex(), B = (l) => {
50
+ if (z || (a.currentPlacement = a.currentPlacement || o.placement, !/^(top|bottom|left|right)(-start|-end)?$/g.test(a.currentPlacement)))
51
+ return;
52
+ const u = o.popperOptions || { gpuAcceleration: !1 };
53
+ a.popperElm = a.popperElm || o.popper || i.$refs.popper || g.popper || l;
54
+ const v = a.popperElm;
55
+ let d = V({ state: a, props: o, vm: i, slots: m });
56
+ !v || !d || d.nodeType !== Node.ELEMENT_NODE || (o.visibleArrow && s(v), o.appendToBody || o.popperAppendToBody ? document.body.appendChild(a.popperElm) : (t && t.$el && t.$el.appendChild(a.popperElm), u.forceAbsolute = !0), u.placement = a.currentPlacement, u.offset = o.offset || 0, u.arrowOffset = o.arrowOffset || 0, u.adjustArrow = o.adjustArrow || !1, u.appendToBody = o.appendToBody || o.popperAppendToBody, a.popperJS = new R(d, v, u), n("created", a), typeof u.onUpdate == "function" && a.popperJS.onUpdate(u.onUpdate), a.popperJS._popper.style.zIndex = P(a.popperJS._reference), b(a.popperJS), _(a.popperElm, "click", k));
57
+ }, S = (l) => {
58
+ l && l !== !0 && (a.popperElm = l);
59
+ const u = a.popperJS;
60
+ u ? (u._reference = V({ state: a, props: o, vm: i, slots: m }), u.update(), u._popper && l !== !0 && (u._popper.style.zIndex = P(u._reference), b(a.popperJS))) : B(l && l !== !0 ? l : void 0);
61
+ }, E = (l) => {
62
+ !a.popperJS || a.showPopper && !l || (a.popperJS.destroy(), a.popperJS = null);
63
+ }, x = (l) => {
64
+ l && a.popperElm && a.popperElm.parentNode === document.body && (w(a.popperElm, "click", k), a.popperElm.remove());
8
65
  };
9
- return {
10
- on: (s) => {
11
- e.add(s);
12
- const a = () => t(s);
13
- return H(a), {
14
- off: a
15
- };
16
- },
17
- off: t,
18
- trigger: (...s) => Promise.all(Array.from(e).map((a) => a(...s))),
19
- clear: () => {
20
- e.clear();
66
+ return y(
67
+ () => a.showPopper,
68
+ (l) => {
69
+ o.disabled || (l && r(S), o.trigger === "manual" && n("update:modelValue", l));
21
70
  }
22
- };
23
- }
24
- const N = /* @__PURE__ */ new WeakMap(), pe = (...e) => {
25
- var t;
26
- const n = e[0], i = (t = B()) == null ? void 0 : t.proxy;
27
- if (i == null && !ie())
28
- throw new Error("injectLocal must be called in setup");
29
- return i && N.has(i) && n in N.get(i) ? N.get(i)[n] : fe(...e);
30
- }, $ = typeof window < "u" && typeof document < "u";
31
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
32
- const we = (e) => e != null, ge = Object.prototype.toString, be = (e) => ge.call(e) === "[object Object]", O = () => {
33
- }, ye = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Se = /* @__PURE__ */ Te();
34
- function Te() {
35
- var e, t;
36
- return $ && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
37
- }
38
- function G(e, t) {
39
- function n(...i) {
40
- return new Promise((f, s) => {
41
- Promise.resolve(e(() => t.apply(this, i), { fn: t, thisArg: this, args: i })).then(f).catch(s);
71
+ ), y(
72
+ () => o.placement,
73
+ (l) => {
74
+ var u;
75
+ a.currentPlacement = l, (u = a.popperJS) == null || u.setOptions({ placement: l }), !o.disabled && (l && r(S), o.trigger === "manual" && n("update:modelValue", l));
76
+ }
77
+ ), p(() => {
78
+ r(() => {
79
+ E(!0), (o.appendToBody || o.popperAppendToBody) && x("remove");
42
80
  });
81
+ }), c(() => {
82
+ E(!0), (o.appendToBody || o.popperAppendToBody) && x("remove");
83
+ }), { updatePopper: S, destroyPopper: x, doDestroy: E, ...h(a) };
84
+ }, ae = ({ api: e, state: t, props: n }) => (r) => {
85
+ const c = r && r.type === "mouseenter" ? 200 : 0;
86
+ if (n.visible === "auto") {
87
+ const { clientWidth: o, scrollWidth: y } = t.referenceElm;
88
+ if (y <= o)
89
+ return;
43
90
  }
44
- return n;
45
- }
46
- const Ee = (e) => e();
47
- function re(e, t = {}) {
48
- let n, i, f = O;
49
- const s = (l) => {
50
- clearTimeout(l), f(), f = O;
51
- };
52
- let a;
53
- return (l) => {
54
- const u = b(e), d = b(t.maxWait);
55
- return n && s(n), u <= 0 || d !== void 0 && d <= 0 ? (i && (s(i), i = null), Promise.resolve(l())) : new Promise((r, v) => {
56
- f = t.rejectOnCancel ? v : r, a = l, d && !i && (i = setTimeout(() => {
57
- n && s(n), i = null, r(a());
58
- }, d)), n = setTimeout(() => {
59
- i && s(i), i = null, r(l());
60
- }, u);
61
- });
62
- };
63
- }
64
- function Oe(...e) {
65
- let t = 0, n, i = !0, f = O, s, a, o, l, u;
66
- !ae(e[0]) && typeof e[0] == "object" ? { delay: a, trailing: o = !0, leading: l = !0, rejectOnCancel: u = !1 } = e[0] : [a, o = !0, l = !0, u = !1] = e;
67
- const d = () => {
68
- n && (clearTimeout(n), n = void 0, f(), f = O);
69
- };
70
- return (v) => {
71
- const h = b(a), g = Date.now() - t, S = () => s = v();
72
- return d(), h <= 0 ? (t = Date.now(), S()) : (g > h && (l || !i) ? (t = Date.now(), S()) : o && (s = new Promise((c, m) => {
73
- f = u ? m : c, n = setTimeout(() => {
74
- t = Date.now(), i = !0, c(S()), d();
75
- }, Math.max(0, h - g));
76
- })), !l && !n && (n = setTimeout(() => i = !0, h)), i = !1, s);
77
- };
78
- }
79
- function ee(e) {
80
- return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
81
- }
82
- function C(e) {
83
- return Array.isArray(e) ? e : [e];
84
- }
85
- function xe(e) {
86
- return B();
87
- }
88
- function We(e, t = 200, n = {}) {
89
- return G(
90
- re(t, n),
91
- e
92
- );
93
- }
94
- function Me(e, t = 200, n = !1, i = !0, f = !1) {
95
- return G(
96
- Oe(t, n, i, f),
97
- e
98
- );
99
- }
100
- function Ie(e, t, n = {}) {
101
- const {
102
- eventFilter: i = Ee,
103
- ...f
104
- } = n;
105
- return A(
106
- e,
107
- G(
108
- i,
109
- t
110
- ),
111
- f
112
- );
113
- }
114
- function V(e, t = !0, n) {
115
- xe() ? oe(e, n) : t ? e() : ce(e);
116
- }
117
- function He(e, t, n = {}) {
118
- const {
119
- debounce: i = 0,
120
- maxWait: f = void 0,
121
- ...s
122
- } = n;
123
- return Ie(
124
- e,
125
- t,
126
- {
127
- ...s,
128
- eventFilter: re(i, { maxWait: f })
91
+ e.setExpectedState(!0), e.handleShowPopper(c);
92
+ }, pe = (e) => () => {
93
+ e.setExpectedState(!1), e.debounceClose();
94
+ }, le = ({ api: e, state: t }) => () => {
95
+ t.focusing = !0, e.show();
96
+ }, ue = ({ api: e, state: t }) => () => {
97
+ t.focusing = !1, e.hide();
98
+ }, se = ({ api: e, state: t }) => () => {
99
+ t.focusing = !1, e.show();
100
+ }, ie = ({ props: e, state: t }) => (n) => {
101
+ !t.expectedState || e.manual || (clearTimeout(t.timeout), t.timeout = window.setTimeout(() => {
102
+ t.showPopper = !0;
103
+ }, e.openDelay || n), e.hideAfter > 0 && (t.timeoutPending = window.setTimeout(() => {
104
+ t.showPopper = !1;
105
+ }, e.hideAfter)));
106
+ }, de = ({ api: e, props: t, state: n }) => () => {
107
+ t.enterable && n.expectedState || t.manual || (clearTimeout(n.timeout), n.timeoutPending && clearTimeout(n.timeoutPending), n.showPopper = !1, t.disabled && e.doDestroy());
108
+ }, fe = ({ props: e, api: t, state: n, popperVmRef: r }) => (p) => {
109
+ if (e.manual)
110
+ return;
111
+ const c = n.referenceElm, o = r.popper;
112
+ !o || !c || o.contains(p.target) || c.contains(p.target) || n.showPopper && (t.setExpectedState(!1), t.debounceClose());
113
+ }, ce = ({ state: e }) => (t) => {
114
+ e.expectedState === !1 && clearTimeout(e.timeoutPending), e.expectedState = t;
115
+ }, me = ({ state: e, api: t, vm: n }) => () => {
116
+ const r = e.referenceElm;
117
+ e.showPopper = !1, r && r.nodeType === 1 && (w(document, "click", t.handleDocumentClick), w(r, "mouseenter", t.show), w(r, "mouseleave", t.hide), w(r, "focus", t.focusHandler), w(r, "blur", t.handleBlur), w(r, "click", t.removeFocusing)), n.popperVM && (typeof n.popperVM.$destroy == "function" && n.popperVM.$destroy(), n.popperVM = null);
118
+ }, ye = ({ api: e, props: t }) => W(t.closeDelay, () => {
119
+ e.handleClosePopper();
120
+ }), be = (e) => (t) => {
121
+ t ? U(e.referenceElm, "focusing") : L(e.referenceElm, "focusing");
122
+ }, he = ({ slots: e, api: t }) => () => {
123
+ if (!e.default || !e.default().length) {
124
+ t.handleFocus();
125
+ return;
126
+ }
127
+ let n = e.default()[0];
128
+ n = n.elm || n.el, n && n.focus ? n.focus() : t.handleFocus();
129
+ }, ge = ({ api: e, state: t, vm: n }) => (r) => {
130
+ let p = null;
131
+ n.$el.nodeType === 8 ? p = r : n.$el.nodeType === 1 && (p = n.$el), !(!p || p.nodeType === 8 || t.referenceElm) && (t.referenceElm = p, p.setAttribute("aria-describedby", t.tooltipId), p.setAttribute("tabindex", t.tabindex.toString()), _(document, "click", e.handleDocumentClick), _(p, "mouseenter", e.show), _(p, "mouseleave", e.hide), _(p, "focus", e.focusHandler), _(p, "blur", e.handleBlur), _(p, "click", e.removeFocusing));
132
+ }, ve = ({ state: e, popperVmRef: t }) => (n) => {
133
+ for (let r of n)
134
+ r.type === "attributes" && r.attributeName === "x-placement" && (e.xPlacement = t.popper.getAttribute("x-placement") || "bottom");
135
+ }, we = ({ vm: e, nextTick: t, popperVmRef: n }) => (r) => {
136
+ t(() => e.bindEvent(r));
137
+ let p = e.popperVM;
138
+ e.$refs.popper ? n.popper = e.$refs.popper : n.popper = p.$el, t(() => {
139
+ e.modelValue && e.updatePopper();
140
+ });
141
+ }, _e = [
142
+ "state",
143
+ "bindEvent",
144
+ "hide",
145
+ "show",
146
+ "doDestroy",
147
+ "handleFocus",
148
+ "debounceClose",
149
+ "handleShowPopper",
150
+ "handleClosePopper",
151
+ "setExpectedState",
152
+ "updatePopper",
153
+ "focusHandler"
154
+ ], Pe = ({ reactive: e, showPopper: t, popperElm: n, referenceElm: r, props: p, inject: c, popperJS: o, currentPlacement: y }) => e({
155
+ popperJS: o,
156
+ showPopper: t,
157
+ popperElm: n,
158
+ referenceElm: r,
159
+ currentPlacement: y,
160
+ timeout: null,
161
+ focusing: !1,
162
+ expectedState: void 0,
163
+ tooltipId: Q("tiny-tooltip-", 4),
164
+ tabindex: p.tabindex,
165
+ xPlacement: "bottom",
166
+ showContent: c("showContent", null),
167
+ tipsMaxWidth: c("tips-max-width", null)
168
+ }), Se = (e, {
169
+ watch: t,
170
+ toRefs: n,
171
+ reactive: r,
172
+ onBeforeUnmount: p,
173
+ onDeactivated: c,
174
+ onMounted: o,
175
+ onUnmounted: y,
176
+ inject: f
177
+ }, { vm: i, emit: m, slots: h, nextTick: g, parent: a }) => {
178
+ const s = {}, b = {}, P = { emit: m, props: e, nextTick: g, toRefs: n, reactive: r, parent: a.$parent, vm: i, popperVmRef: b };
179
+ Object.assign(P, { slots: h, onBeforeUnmount: p, onDeactivated: c, watch: t });
180
+ const { showPopper: B, updatePopper: S, popperElm: E, referenceElm: x, doDestroy: l, popperJS: u, currentPlacement: v } = oe(
181
+ P
182
+ ), d = Pe({
183
+ reactive: r,
184
+ showPopper: B,
185
+ popperElm: E,
186
+ referenceElm: x,
187
+ props: e,
188
+ inject: f,
189
+ popperJS: u,
190
+ currentPlacement: v
191
+ });
192
+ return Object.assign(s, {
193
+ state: d,
194
+ doDestroy: l,
195
+ updatePopper: S,
196
+ show: ae({ api: s, state: d, props: e }),
197
+ hide: pe(s),
198
+ destroyed: me({ state: d, api: s, vm: i }),
199
+ bindPopper: we({ vm: i, nextTick: g, popperVmRef: b }),
200
+ watchFocusing: be(d),
201
+ removeFocusing: se({ api: s, state: d }),
202
+ handleBlur: ue({ api: s, state: d }),
203
+ handleFocus: le({ api: s, state: d }),
204
+ debounceClose: ye({ api: s, props: e }),
205
+ setExpectedState: ce({ state: d }),
206
+ handleShowPopper: ie({ props: e, state: d }),
207
+ handleClosePopper: de({ api: s, props: e, state: d }),
208
+ bindEvent: ge({ api: s, state: d, vm: i }),
209
+ focusHandler: he({ slots: h, api: s }),
210
+ handleDocumentClick: fe({ props: e, api: s, state: d, popperVmRef: b }),
211
+ observeCallback: ve({ state: d, popperVmRef: b })
212
+ }), t(() => d.focusing, s.watchFocusing), t(
213
+ () => e.modelValue,
214
+ (T) => g(() => e.manual && (d.showPopper = T))
215
+ ), o(() => {
216
+ if (s.bindPopper(), e.genArrowByHtml) {
217
+ const T = { attributes: !0, childList: !1, subtree: !1 };
218
+ s.observer = new MutationObserver(s.observeCallback), s.observer.observe(b.popper, T);
129
219
  }
130
- );
131
- }
132
- function Fe(e, t, n) {
133
- return A(
134
- e,
135
- t,
136
- {
137
- ...n,
138
- immediate: !0
220
+ }), i.$on("tooltip-update", s.bindPopper), y(() => {
221
+ s.destroyed(), s.observer && s.observer.disconnect(), i.$off("tooltip-update");
222
+ }), s;
223
+ };
224
+ function O() {
225
+ return O = Object.assign ? Object.assign.bind() : function(e) {
226
+ for (var t = 1; t < arguments.length; t++) {
227
+ var n = arguments[t];
228
+ for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
139
229
  }
140
- );
141
- }
142
- const F = $ ? window : void 0, Pe = $ ? window.document : void 0;
143
- function T(e) {
144
- var t;
145
- const n = b(e);
146
- return (t = n == null ? void 0 : n.$el) != null ? t : n;
230
+ return e;
231
+ }, O.apply(null, arguments);
147
232
  }
148
- function x(...e) {
149
- const t = [], n = () => {
150
- t.forEach((o) => o()), t.length = 0;
151
- }, i = (o, l, u, d) => (o.addEventListener(l, u, d), () => o.removeEventListener(l, u, d)), f = I(() => {
152
- const o = C(b(e[0])).filter((l) => l != null);
153
- return o.every((l) => typeof l != "string") ? o : void 0;
154
- }), s = Fe(
155
- () => {
156
- var o, l;
157
- return [
158
- (l = (o = f.value) == null ? void 0 : o.map((u) => T(u))) != null ? l : [F].filter((u) => u != null),
159
- C(b(f.value ? e[1] : e[0])),
160
- C(me(f.value ? e[2] : e[1])),
161
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
162
- b(f.value ? e[3] : e[2])
163
- ];
233
+ var A = /* @__PURE__ */ F({
234
+ name: j + "Tooltip",
235
+ componentName: "Tooltip",
236
+ props: O({}, J, {
237
+ visible: {
238
+ type: String,
239
+ default: function() {
240
+ return "always";
241
+ },
242
+ validator: function(t) {
243
+ return ["always", "auto"].includes(t);
244
+ }
164
245
  },
165
- ([o, l, u, d]) => {
166
- if (n(), !(o != null && o.length) || !(l != null && l.length) || !(u != null && u.length))
167
- return;
168
- const r = be(d) ? { ...d } : d;
169
- t.push(
170
- ...o.flatMap(
171
- (v) => l.flatMap(
172
- (h) => u.map((g) => i(v, h, g, r))
173
- )
174
- )
175
- );
246
+ adjustArrow: {
247
+ type: Boolean,
248
+ default: function() {
249
+ return !1;
250
+ }
176
251
  },
177
- { flush: "post" }
178
- ), a = () => {
179
- s(), n();
180
- };
181
- return H(n), a;
182
- }
183
- let te = !1;
184
- function Ve(e, t, n = {}) {
185
- const { window: i = F, ignore: f = [], capture: s = !0, detectIframe: a = !1, controls: o = !1 } = n;
186
- if (!i)
187
- return o ? { stop: O, cancel: O, trigger: O } : O;
188
- if (Se && !te) {
189
- te = !0;
190
- const c = { passive: !0 };
191
- Array.from(i.document.body.children).forEach((m) => x(m, "click", O, c)), x(i.document.documentElement, "click", O, c);
192
- }
193
- let l = !0;
194
- const u = (c) => b(f).some((m) => {
195
- if (typeof m == "string")
196
- return Array.from(i.document.querySelectorAll(m)).some((p) => p === c.target || c.composedPath().includes(p));
197
- {
198
- const p = T(m);
199
- return p && (c.target === p || c.composedPath().includes(p));
200
- }
201
- });
202
- function d(c) {
203
- const m = b(c);
204
- return m && m.$.subTree.shapeFlag === 16;
205
- }
206
- function r(c, m) {
207
- const p = b(c), _ = p.$.subTree && p.$.subTree.children;
208
- return _ == null || !Array.isArray(_) ? !1 : _.some((L) => L.el === m.target || m.composedPath().includes(L.el));
209
- }
210
- const v = (c) => {
211
- const m = T(e);
212
- if (c.target != null && !(!(m instanceof Element) && d(e) && r(e, c)) && !(!m || m === c.target || c.composedPath().includes(m))) {
213
- if ("detail" in c && c.detail === 0 && (l = !u(c)), !l) {
214
- l = !0;
215
- return;
252
+ appendToBody: {
253
+ type: Boolean,
254
+ default: function() {
255
+ return !0;
216
256
  }
217
- t(c);
218
- }
219
- };
220
- let h = !1;
221
- const g = [
222
- x(i, "click", (c) => {
223
- h || (h = !0, setTimeout(() => {
224
- h = !1;
225
- }, 0), v(c));
226
- }, { passive: !0, capture: s }),
227
- x(i, "pointerdown", (c) => {
228
- const m = T(e);
229
- l = !u(c) && !!(m && !c.composedPath().includes(m));
230
- }, { passive: !0 }),
231
- a && x(i, "blur", (c) => {
232
- setTimeout(() => {
233
- var m;
234
- const p = T(e);
235
- ((m = i.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(p != null && p.contains(i.document.activeElement)) && t(c);
236
- }, 0);
237
- }, { passive: !0 })
238
- ].filter(Boolean), S = () => g.forEach((c) => c());
239
- return o ? {
240
- stop: S,
241
- cancel: () => {
242
- l = !1;
243
257
  },
244
- trigger: (c) => {
245
- l = !0, v(c), l = !1;
246
- }
247
- } : S;
248
- }
249
- function Re() {
250
- const e = y(!1), t = B();
251
- return t && oe(() => {
252
- e.value = !0;
253
- }, t), e;
254
- }
255
- function Y(e) {
256
- const t = Re();
257
- return I(() => (t.value, !!e()));
258
- }
259
- function Ae(e, t, n = {}) {
260
- const { window: i = F, ...f } = n;
261
- let s;
262
- const a = Y(() => i && "MutationObserver" in i), o = () => {
263
- s && (s.disconnect(), s = void 0);
264
- }, l = I(() => {
265
- const v = b(e), h = C(v).map(T).filter(we);
266
- return new Set(h);
267
- }), u = A(
268
- () => l.value,
269
- (v) => {
270
- o(), a.value && v.size && (s = new MutationObserver(t), v.forEach((h) => s.observe(h, f)));
258
+ arrowOffset: {
259
+ type: Number,
260
+ default: function() {
261
+ return 0;
262
+ }
271
263
  },
272
- { immediate: !0, flush: "post" }
273
- ), d = () => s == null ? void 0 : s.takeRecords(), r = () => {
274
- u(), o();
275
- };
276
- return H(r), {
277
- isSupported: a,
278
- stop: r,
279
- takeRecords: d
280
- };
281
- }
282
- const _e = Symbol("vueuse-ssr-width");
283
- function De() {
284
- const e = ie() ? pe(_e, null) : null;
285
- return typeof e == "number" ? e : void 0;
286
- }
287
- function ke(e, t = {}) {
288
- const { window: n = F, ssrWidth: i = De() } = t, f = Y(() => n && "matchMedia" in n && typeof n.matchMedia == "function"), s = y(typeof i == "number"), a = y(), o = y(!1), l = (u) => {
289
- o.value = u.matches;
290
- };
291
- return he(() => {
292
- if (s.value) {
293
- s.value = !f.value;
294
- const u = b(e).split(",");
295
- o.value = u.some((d) => {
296
- const r = d.includes("not all"), v = d.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), h = d.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
297
- let g = !!(v || h);
298
- return v && g && (g = i >= ee(v[1])), h && g && (g = i <= ee(h[1])), r ? !g : g;
299
- });
300
- return;
301
- }
302
- f.value && (a.value = n.matchMedia(b(e)), o.value = a.value.matches);
303
- }), x(a, "change", l, { passive: !0 }), I(() => o.value);
304
- }
305
- function le(e, t, n = {}) {
306
- const { window: i = F, ...f } = n;
307
- let s;
308
- const a = Y(() => i && "ResizeObserver" in i), o = () => {
309
- s && (s.disconnect(), s = void 0);
310
- }, l = I(() => {
311
- const r = b(e);
312
- return Array.isArray(r) ? r.map((v) => T(v)) : [T(r)];
313
- }), u = A(
314
- l,
315
- (r) => {
316
- if (o(), a.value && i) {
317
- s = new ResizeObserver(t);
318
- for (const v of r)
319
- v && s.observe(v, f);
264
+ boundariesPadding: {
265
+ type: Number,
266
+ default: function() {
267
+ return 5;
320
268
  }
321
269
  },
322
- { immediate: !0, flush: "post" }
323
- ), d = () => {
324
- o(), u();
325
- };
326
- return H(d), {
327
- isSupported: a,
328
- stop: d
329
- };
330
- }
331
- function ze(e, t = {}) {
332
- const {
333
- reset: n = !0,
334
- windowResize: i = !0,
335
- windowScroll: f = !0,
336
- immediate: s = !0,
337
- updateTiming: a = "sync"
338
- } = t, o = y(0), l = y(0), u = y(0), d = y(0), r = y(0), v = y(0), h = y(0), g = y(0);
339
- function S() {
340
- const m = T(e);
341
- if (!m) {
342
- n && (o.value = 0, l.value = 0, u.value = 0, d.value = 0, r.value = 0, v.value = 0, h.value = 0, g.value = 0);
343
- return;
270
+ closeDelay: {
271
+ type: Number,
272
+ default: function() {
273
+ return 300;
274
+ }
275
+ },
276
+ content: {
277
+ type: [String, Object]
278
+ },
279
+ disabled: {
280
+ type: Boolean
281
+ },
282
+ effect: {
283
+ type: String,
284
+ default: function() {
285
+ return "dark";
286
+ }
287
+ },
288
+ enterable: {
289
+ type: Boolean,
290
+ default: function() {
291
+ return !0;
292
+ }
293
+ },
294
+ hideAfter: {
295
+ type: Number,
296
+ default: function() {
297
+ return 0;
298
+ }
299
+ },
300
+ manual: {
301
+ type: Boolean
302
+ },
303
+ modelValue: {
304
+ type: Boolean
305
+ },
306
+ offset: {
307
+ default: function() {
308
+ return 0;
309
+ }
310
+ },
311
+ openDelay: {
312
+ type: Number,
313
+ default: function() {
314
+ return 0;
315
+ }
316
+ },
317
+ placement: {
318
+ type: String,
319
+ default: function() {
320
+ return "bottom";
321
+ }
322
+ },
323
+ popper: {},
324
+ popperClass: {
325
+ type: String
326
+ },
327
+ popperOptions: {
328
+ default: function() {
329
+ return {
330
+ gpuAcceleration: !1,
331
+ boundariesPadding: 10
332
+ };
333
+ }
334
+ },
335
+ pre: {
336
+ type: Boolean
337
+ },
338
+ reference: {},
339
+ renderContent: {
340
+ type: Function
341
+ },
342
+ tabindex: {
343
+ type: Number,
344
+ default: function() {
345
+ return 0;
346
+ }
347
+ },
348
+ transition: {
349
+ type: String,
350
+ default: function() {
351
+ return "tiny-fade-in-linear";
352
+ }
353
+ },
354
+ type: {
355
+ type: String,
356
+ validator: function(t) {
357
+ return !!~["normal", "warning", "error", "info", "success"].indexOf(t);
358
+ }
359
+ },
360
+ visibleArrow: {
361
+ type: Boolean,
362
+ default: function() {
363
+ return !0;
364
+ }
365
+ },
366
+ zIndex: {
367
+ type: String,
368
+ default: function() {
369
+ return "next";
370
+ }
371
+ },
372
+ contentMaxHeight: {
373
+ type: String
344
374
  }
345
- const p = m.getBoundingClientRect();
346
- o.value = p.height, l.value = p.bottom, u.value = p.left, d.value = p.right, r.value = p.top, v.value = p.width, h.value = p.x, g.value = p.y;
347
- }
348
- function c() {
349
- a === "sync" ? S() : a === "next-frame" && requestAnimationFrame(() => S());
350
- }
351
- return le(e, c), A(() => T(e), (m) => !m && c()), Ae(e, c, {
352
- attributeFilter: ["style", "class"]
353
- }), f && x("scroll", c, { capture: !0, passive: !0 }), i && x("resize", c, { passive: !0 }), V(() => {
354
- s && c();
355
- }), {
356
- height: o,
357
- bottom: l,
358
- left: u,
359
- right: d,
360
- top: r,
361
- width: v,
362
- x: h,
363
- y: g,
364
- update: c
365
- };
366
- }
367
- function Ne(e, t = { width: 0, height: 0 }, n = {}) {
368
- const { window: i = F, box: f = "content-box" } = n, s = I(() => {
369
- var r, v;
370
- return (v = (r = T(e)) == null ? void 0 : r.namespaceURI) == null ? void 0 : v.includes("svg");
371
- }), a = y(t.width), o = y(t.height), { stop: l } = le(
372
- e,
373
- ([r]) => {
374
- const v = f === "border-box" ? r.borderBoxSize : f === "content-box" ? r.contentBoxSize : r.devicePixelContentBoxSize;
375
- if (i && s.value) {
376
- const h = T(e);
377
- if (h) {
378
- const g = h.getBoundingClientRect();
379
- a.value = g.width, o.value = g.height;
375
+ }),
376
+ setup: function(t, n) {
377
+ return Y({
378
+ props: t,
379
+ context: n,
380
+ renderless: Se,
381
+ api: _e
382
+ });
383
+ },
384
+ render: function() {
385
+ var t = this, n = function(f) {
386
+ var i = f.slots.content && f.slots.content();
387
+ if (i && (!N.Comment || i[0].type !== N.Comment))
388
+ return i;
389
+ var m;
390
+ return f.renderContent ? m = f.renderContent($, f.content) : f.pre ? m = f.content ? $("pre", f.content) : null : m = f.content, m;
391
+ };
392
+ if (!Object.prototype.hasOwnProperty.call(this, "popperVM")) {
393
+ var r = {
394
+ value: null
395
+ };
396
+ this.d({
397
+ popperVM: {
398
+ get: function() {
399
+ return r.value || (r.value = Z({
400
+ el: document.createElement("div"),
401
+ propsData: null,
402
+ component: {
403
+ render: function() {
404
+ var i = n(t), m = typeof i == "string", h = {
405
+ attrs: {
406
+ name: t.transition
407
+ },
408
+ on: {
409
+ "after-leave": t.doDestroy
410
+ }
411
+ }, g = "is-" + (t.type || t.effect || "dark"), a = function() {
412
+ return t.setExpectedState(!0);
413
+ }, s = function() {
414
+ t.setExpectedState(!1), t.debounceClose();
415
+ };
416
+ return t.$nextTick(function() {
417
+ !t.disabled && t.state.showPopper && i && t.updatePopper();
418
+ }), $("transition", h, [te(M("div", {
419
+ ref: "popper",
420
+ id: t.state.tooltipId,
421
+ class: ["tiny-tooltip", "tiny-tooltip__popper", g, t.popperClass, {
422
+ "tiny-tooltip__show-tips": t.state.showContent
423
+ }],
424
+ style: "max-width:" + t.state.tipsMaxWidth + "px",
425
+ role: "tooltip",
426
+ "aria-hidden": t.disabled || !t.state.showPopper ? "true" : "false",
427
+ onMouseenter: function() {
428
+ return a();
429
+ },
430
+ onMouseleave: function() {
431
+ return s();
432
+ }
433
+ }, [m ? M("div", {
434
+ class: "tiny-tooltip__content-wrapper",
435
+ style: "max-height:" + t.contentMaxHeight + ";"
436
+ }, [i]) : i]), [[ne, !t.disabled && t.state.showPopper && i]])]);
437
+ }
438
+ }
439
+ })), r.value;
440
+ },
441
+ set: function(f) {
442
+ return r.value = f;
443
+ }
380
444
  }
381
- } else if (v) {
382
- const h = C(v);
383
- a.value = h.reduce((g, { inlineSize: S }) => g + S, 0), o.value = h.reduce((g, { blockSize: S }) => g + S, 0);
384
- } else
385
- a.value = r.contentRect.width, o.value = r.contentRect.height;
386
- },
387
- n
388
- );
389
- V(() => {
390
- const r = T(e);
391
- r && (a.value = "offsetWidth" in r ? r.offsetWidth : t.width, o.value = "offsetHeight" in r ? r.offsetHeight : t.height);
392
- });
393
- const u = A(
394
- () => T(e),
395
- (r) => {
396
- a.value = r ? t.width : 0, o.value = r ? t.height : 0;
445
+ });
397
446
  }
398
- );
399
- function d() {
400
- l(), u();
447
+ var p = function() {
448
+ var f = t.slots.default && t.slots.default();
449
+ if (!Array.isArray(f)) return null;
450
+ for (var i = null, m = 0; m < f.length; m++) {
451
+ var h = K(f[m]);
452
+ if (!X(h)) {
453
+ i = h;
454
+ break;
455
+ }
456
+ }
457
+ return i;
458
+ }, c = p();
459
+ if (!c) return null;
460
+ var o = c.data || c.props || (c.props = {});
461
+ return o.class = q("tiny-tooltip " + G(o.class)), c;
401
462
  }
402
- return {
403
- width: a,
404
- height: o,
405
- stop: d
406
- };
407
- }
408
- const Ce = {
409
- multiple: !0,
410
- accept: "*",
411
- reset: !1,
412
- directory: !1
413
- };
414
- function Le(e) {
415
- if (!e)
416
- return null;
417
- if (e instanceof FileList)
463
+ });
464
+ function D() {
465
+ return D = Object.assign ? Object.assign.bind() : function(e) {
466
+ for (var t = 1; t < arguments.length; t++) {
467
+ var n = arguments[t];
468
+ for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
469
+ }
418
470
  return e;
419
- const t = new DataTransfer();
420
- for (const n of e)
421
- t.items.add(n);
422
- return t.files;
423
- }
424
- function Be(e = {}) {
425
- const {
426
- document: t = Pe
427
- } = e, n = de(Le(e.initialFiles)), { on: i, trigger: f } = Z(), { on: s, trigger: a } = Z();
428
- let o;
429
- t && (o = t.createElement("input"), o.type = "file", o.onchange = (d) => {
430
- const r = d.target;
431
- n.value = r.files, f(n.value);
432
- }, o.oncancel = () => {
433
- a();
434
- });
435
- const l = () => {
436
- n.value = null, o && o.value && (o.value = "", f(null));
437
- }, u = (d) => {
438
- if (!o)
439
- return;
440
- const r = {
441
- ...Ce,
442
- ...e,
443
- ...d
444
- };
445
- o.multiple = r.multiple, o.accept = r.accept, o.webkitdirectory = r.directory, ye(r, "capture") && (o.capture = r.capture), r.reset && l(), o.click();
446
- };
447
- return {
448
- files: ve(n),
449
- open: u,
450
- reset: l,
451
- onCancel: s,
452
- onChange: i
453
- };
471
+ }, D.apply(null, arguments);
454
472
  }
455
- const ne = 1;
456
- function $e(e, t = {}) {
457
- const {
458
- throttle: n = 0,
459
- idle: i = 200,
460
- onStop: f = O,
461
- onScroll: s = O,
462
- offset: a = {
463
- left: 0,
464
- right: 0,
465
- top: 0,
466
- bottom: 0
473
+ var Ee = function(t) {
474
+ var n, r = typeof process == "object" ? (n = process.env) == null ? void 0 : n.TINY_MODE : null;
475
+ return A;
476
+ }, xe = D({}, J, {
477
+ visible: {
478
+ type: String,
479
+ default: function() {
480
+ return "always";
467
481
  },
468
- eventListenerOptions: o = {
469
- capture: !1,
470
- passive: !0
471
- },
472
- behavior: l = "auto",
473
- window: u = F,
474
- onError: d = (w) => {
475
- console.error(w);
482
+ validator: function(t) {
483
+ return ["always", "auto"].includes(t);
476
484
  }
477
- } = t, r = y(0), v = y(0), h = I({
478
- get() {
479
- return r.value;
480
- },
481
- set(w) {
482
- S(w, void 0);
485
+ },
486
+ adjustArrow: {
487
+ type: Boolean,
488
+ default: function() {
489
+ return !1;
483
490
  }
484
- }), g = I({
485
- get() {
486
- return v.value;
487
- },
488
- set(w) {
489
- S(void 0, w);
491
+ },
492
+ appendToBody: {
493
+ type: Boolean,
494
+ default: function() {
495
+ return !0;
490
496
  }
491
- });
492
- function S(w, P) {
493
- var E, D, k, j;
494
- if (!u)
495
- return;
496
- const W = b(e);
497
- if (!W)
498
- return;
499
- (k = W instanceof Document ? u.document.body : W) == null || k.scrollTo({
500
- top: (E = b(P)) != null ? E : g.value,
501
- left: (D = b(w)) != null ? D : h.value,
502
- behavior: b(l)
503
- });
504
- const M = ((j = W == null ? void 0 : W.document) == null ? void 0 : j.documentElement) || (W == null ? void 0 : W.documentElement) || W;
505
- h != null && (r.value = M.scrollLeft), g != null && (v.value = M.scrollTop);
506
- }
507
- const c = y(!1), m = K({
508
- left: !0,
509
- right: !1,
510
- top: !0,
511
- bottom: !1
512
- }), p = K({
513
- left: !1,
514
- right: !1,
515
- top: !1,
516
- bottom: !1
517
- }), _ = (w) => {
518
- c.value && (c.value = !1, p.left = !1, p.right = !1, p.top = !1, p.bottom = !1, f(w));
519
- }, L = We(_, n + i), z = (w) => {
520
- var P;
521
- if (!u)
522
- return;
523
- const E = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || T(w), { display: D, flexDirection: k, direction: j } = getComputedStyle(E), W = j === "rtl" ? -1 : 1, M = E.scrollLeft;
524
- p.left = M < r.value, p.right = M > r.value;
525
- const U = Math.abs(M * W) <= (a.left || 0), X = Math.abs(M * W) + E.clientWidth >= E.scrollWidth - (a.right || 0) - ne;
526
- D === "flex" && k === "row-reverse" ? (m.left = X, m.right = U) : (m.left = U, m.right = X), r.value = M;
527
- let R = E.scrollTop;
528
- w === u.document && !R && (R = u.document.body.scrollTop), p.top = R < v.value, p.bottom = R > v.value;
529
- const q = Math.abs(R) <= (a.top || 0), J = Math.abs(R) + E.clientHeight >= E.scrollHeight - (a.bottom || 0) - ne;
530
- D === "flex" && k === "column-reverse" ? (m.top = J, m.bottom = q) : (m.top = q, m.bottom = J), v.value = R;
531
- }, Q = (w) => {
532
- var P;
533
- if (!u)
534
- return;
535
- const E = (P = w.target.documentElement) != null ? P : w.target;
536
- z(E), c.value = !0, L(w), s(w);
537
- };
538
- return x(
539
- e,
540
- "scroll",
541
- n ? Me(Q, n, !0, !1) : Q,
542
- o
543
- ), V(() => {
544
- try {
545
- const w = b(e);
546
- if (!w)
547
- return;
548
- z(w);
549
- } catch (w) {
550
- d(w);
497
+ },
498
+ arrowOffset: {
499
+ type: Number,
500
+ default: function() {
501
+ return 0;
551
502
  }
552
- }), x(
553
- e,
554
- "scrollend",
555
- _,
556
- o
557
- ), {
558
- x: h,
559
- y: g,
560
- isScrolling: c,
561
- arrivedState: m,
562
- directions: p,
563
- measure() {
564
- const w = b(e);
565
- u && w && z(w);
503
+ },
504
+ content: {
505
+ type: [String, Object]
506
+ },
507
+ disabled: {
508
+ type: Boolean
509
+ },
510
+ enterable: {
511
+ type: Boolean,
512
+ default: function() {
513
+ return !0;
514
+ }
515
+ },
516
+ hideAfter: {
517
+ type: Number,
518
+ default: function() {
519
+ return 0;
520
+ }
521
+ },
522
+ manual: {
523
+ type: Boolean
524
+ },
525
+ modelValue: {
526
+ type: Boolean
527
+ },
528
+ offset: {
529
+ default: function() {
530
+ return 0;
531
+ }
532
+ },
533
+ effect: {
534
+ type: String,
535
+ default: function() {
536
+ return "";
537
+ }
538
+ },
539
+ openDelay: {
540
+ type: Number,
541
+ default: function() {
542
+ return 0;
543
+ }
544
+ },
545
+ closeDelay: {
546
+ type: Number,
547
+ default: function() {
548
+ return 100;
549
+ }
550
+ },
551
+ placement: {
552
+ type: String,
553
+ default: function() {
554
+ return "bottom";
555
+ }
556
+ },
557
+ popper: {},
558
+ popperClass: {
559
+ type: String
560
+ },
561
+ popperOptions: {
562
+ default: function() {
563
+ return {};
564
+ }
565
+ },
566
+ pre: {
567
+ type: Boolean
568
+ },
569
+ reference: {},
570
+ renderContent: {
571
+ type: Function
572
+ },
573
+ tabindex: {
574
+ type: Number,
575
+ default: function() {
576
+ return 0;
577
+ }
578
+ },
579
+ transition: {
580
+ type: String,
581
+ default: function() {
582
+ return "tiny-fade-in-linear";
583
+ }
584
+ },
585
+ type: {
586
+ type: String,
587
+ validator: function(t) {
588
+ return !!~["normal", "warning", "error", "info", "success"].indexOf(t);
589
+ }
590
+ },
591
+ visibleArrow: {
592
+ type: Boolean,
593
+ default: function() {
594
+ return !0;
595
+ }
596
+ },
597
+ genArrowByHtml: {
598
+ type: Boolean,
599
+ default: function() {
600
+ return !0;
601
+ }
602
+ },
603
+ zIndex: {
604
+ type: String,
605
+ default: function() {
606
+ return "next";
607
+ }
608
+ },
609
+ contentMaxHeight: {
610
+ type: String,
611
+ default: function() {
612
+ return "80vh";
566
613
  }
567
- };
568
- }
569
- function Ge(e = {}) {
570
- const {
571
- window: t = F,
572
- initialWidth: n = Number.POSITIVE_INFINITY,
573
- initialHeight: i = Number.POSITIVE_INFINITY,
574
- listenOrientation: f = !0,
575
- includeScrollbar: s = !0,
576
- type: a = "inner"
577
- } = e, o = y(n), l = y(i), u = () => {
578
- if (t)
579
- if (a === "outer")
580
- o.value = t.outerWidth, l.value = t.outerHeight;
581
- else if (a === "visual" && t.visualViewport) {
582
- const { width: r, height: v, scale: h } = t.visualViewport;
583
- o.value = Math.round(r * h), l.value = Math.round(v * h);
584
- } else s ? (o.value = t.innerWidth, l.value = t.innerHeight) : (o.value = t.document.documentElement.clientWidth, l.value = t.document.documentElement.clientHeight);
585
- };
586
- u(), V(u);
587
- const d = { passive: !0 };
588
- if (x("resize", u, d), t && a === "visual" && t.visualViewport && x(t.visualViewport, "resize", u, d), f) {
589
- const r = ke("(orientation: portrait)");
590
- A(r, () => u());
591
614
  }
592
- return { width: o, height: l };
593
- }
615
+ }), C = F({
616
+ name: j + "Tooltip",
617
+ componentName: "Tooltip",
618
+ props: xe,
619
+ setup: function(t, n) {
620
+ return ee({
621
+ props: t,
622
+ context: n,
623
+ template: Ee
624
+ });
625
+ }
626
+ }), Ce = "3.undefined";
627
+ C.model = {
628
+ prop: "modelValue",
629
+ event: "update:modelValue"
630
+ };
631
+ C.install = function(e) {
632
+ e.component(C.name, C);
633
+ };
634
+ C.version = Ce;
594
635
  export {
595
- $e as a,
596
- Ge as b,
597
- Ne as c,
598
- ze as d,
599
- ke as e,
600
- Ve as o,
601
- Be as u,
602
- He as w
636
+ C as T
603
637
  };