@opentiny/tiny-robot 0.3.0-alpha.1 → 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/index3.js CHANGED
@@ -1,307 +1,688 @@
1
- import { A as B, s as C, d as k, a as _, p as $, b as A, c as O, f as D } from "./index6.js";
2
- import { createElementBlock as w, openBlock as f, createElementVNode as r, resolveComponent as I, mergeProps as j, createBlock as h, createCommentVNode as T, renderSlot as E, resolveDynamicComponent as L, normalizeClass as M, toDisplayString as U } from "vue";
3
- const z = ({ emit: e, props: t, state: n, designConfig: o }) => (u) => {
4
- var s, l;
5
- const i = B.filterUrl(t.href), d = 1e3;
6
- let a = d;
7
- t.resetTime !== d ? a = t.resetTime : a = (l = (s = o == null ? void 0 : o.props) == null ? void 0 : s.resetTime) != null ? l : t.resetTime, i ? location.href = i : t.nativeType === "button" && a > 0 && (n.disabled = !0, n.timer = window.setTimeout(() => {
8
- n.disabled = !1;
9
- }, a)), e("click", u);
10
- }, F = (e) => () => clearTimeout(e.timer), N = ["state", "handleClick"], G = (e, { computed: t, onBeforeUnmount: n, reactive: o, watch: u, inject: s }, { emit: l, parent: i, designConfig: d }) => {
11
- i.tinyForm = i.tinyForm || s("form", null);
12
- const a = o({
13
- timer: 0,
14
- disabled: e.disabled,
15
- plain: t(() => e.plain || (i.buttonGroup || {}).plain),
16
- round: t(() => {
17
- var c, y, g;
18
- return (g = (y = e.round) != null ? y : (c = d == null ? void 0 : d.props) == null ? void 0 : c.round) != null ? g : !1;
19
- }),
20
- formDisabled: t(() => (i.tinyForm || {}).disabled),
21
- buttonDisabled: t(
22
- () => e.disabled || a.disabled || (i.buttonGroup || {}).disabled || a.formDisabled
23
- )
24
- });
25
- u(
26
- () => e.disabled,
27
- (c) => {
28
- a.disabled = c;
1
+ import { onMounted as ie, nextTick as ve, watch as L, getCurrentScope as me, onScopeDispose as pe, isRef as he, getCurrentInstance as B, toValue as b, hasInjectionContext as se, inject as we, shallowRef as y, computed as I, reactive as ee, unref as ge, watchEffect as le, ref as be, readonly as ye } from "vue";
2
+ function H(e) {
3
+ return me() ? (pe(e), !0) : !1;
4
+ }
5
+ function te() {
6
+ const e = /* @__PURE__ */ new Set(), t = (u) => {
7
+ e.delete(u);
8
+ };
9
+ return {
10
+ on: (u) => {
11
+ e.add(u);
12
+ const l = () => t(u);
13
+ return H(l), {
14
+ off: l
15
+ };
29
16
  },
30
- { immediate: !0 }
17
+ off: t,
18
+ trigger: (...u) => Promise.all(Array.from(e).map((l) => l(...u))),
19
+ clear: () => {
20
+ e.clear();
21
+ }
22
+ };
23
+ }
24
+ const N = /* @__PURE__ */ new WeakMap(), Se = (...e) => {
25
+ var t;
26
+ const o = e[0], r = (t = B()) == null ? void 0 : t.proxy;
27
+ if (r == null && !se())
28
+ throw new Error("injectLocal must be called in setup");
29
+ return r && N.has(r) && o in N.get(r) ? N.get(r)[o] : we(...e);
30
+ }, $ = typeof window < "u" && typeof document < "u";
31
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
32
+ const Ee = (e) => e != null, Te = Object.prototype.toString, Oe = (e) => Te.call(e) === "[object Object]", O = () => {
33
+ }, We = (e, t) => Object.prototype.hasOwnProperty.call(e, t), xe = /* @__PURE__ */ Me();
34
+ function Me() {
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 o(...r) {
40
+ return new Promise((f, u) => {
41
+ Promise.resolve(e(() => t.apply(this, r), { fn: t, thisArg: this, args: r })).then(f).catch(u);
42
+ });
43
+ }
44
+ return o;
45
+ }
46
+ const Re = (e) => e();
47
+ function ue(e, t = {}) {
48
+ let o, r, f = O;
49
+ const u = (i) => {
50
+ clearTimeout(i), f(), f = O;
51
+ };
52
+ let l;
53
+ return (i) => {
54
+ const a = b(e), c = b(t.maxWait);
55
+ return o && u(o), a <= 0 || c !== void 0 && c <= 0 ? (r && (u(r), r = void 0), Promise.resolve(i())) : new Promise((s, v) => {
56
+ f = t.rejectOnCancel ? v : s, l = i, c && !r && (r = setTimeout(() => {
57
+ o && u(o), r = void 0, s(l());
58
+ }, c)), o = setTimeout(() => {
59
+ r && u(r), r = void 0, s(i());
60
+ }, a);
61
+ });
62
+ };
63
+ }
64
+ function ce(...e) {
65
+ let t = 0, o, r = !0, f = O, u, l, n, i, a;
66
+ !he(e[0]) && typeof e[0] == "object" ? { delay: l, trailing: n = !0, leading: i = !0, rejectOnCancel: a = !1 } = e[0] : [l, n = !0, i = !0, a = !1] = e;
67
+ const c = () => {
68
+ o && (clearTimeout(o), o = void 0, f(), f = O);
69
+ };
70
+ return (v) => {
71
+ const m = b(l), p = Date.now() - t, E = () => u = v();
72
+ return c(), m <= 0 ? (t = Date.now(), E()) : (p > m && (i || !r) ? (t = Date.now(), E()) : n && (u = new Promise((d, h) => {
73
+ f = a ? h : d, o = setTimeout(() => {
74
+ t = Date.now(), r = !0, d(E()), c();
75
+ }, Math.max(0, m - p));
76
+ })), !i && !o && (o = setTimeout(() => r = !0, m)), r = !1, u);
77
+ };
78
+ }
79
+ function ne(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 Fe(e) {
86
+ return B();
87
+ }
88
+ function Ie(e, t = 200, o = {}) {
89
+ return G(
90
+ ue(t, o),
91
+ e
92
+ );
93
+ }
94
+ function Pe(e, t = 200, o = !1, r = !0, f = !1) {
95
+ return G(
96
+ ce(t, o, r, f),
97
+ e
98
+ );
99
+ }
100
+ function ae(e, t, o = {}) {
101
+ const {
102
+ eventFilter: r = Re,
103
+ ...f
104
+ } = o;
105
+ return L(
106
+ e,
107
+ G(
108
+ r,
109
+ t
110
+ ),
111
+ f
112
+ );
113
+ }
114
+ function z(e, t = !0, o) {
115
+ Fe() ? ie(e, o) : t ? e() : ve(e);
116
+ }
117
+ function Ne(e, t, o = {}) {
118
+ const {
119
+ debounce: r = 0,
120
+ maxWait: f = void 0,
121
+ ...u
122
+ } = o;
123
+ return ae(
124
+ e,
125
+ t,
126
+ {
127
+ ...u,
128
+ eventFilter: ue(r, { maxWait: f })
129
+ }
130
+ );
131
+ }
132
+ function _e(e, t, o) {
133
+ return L(
134
+ e,
135
+ t,
136
+ {
137
+ ...o,
138
+ immediate: !0
139
+ }
140
+ );
141
+ }
142
+ function Be(e, t, o = {}) {
143
+ const {
144
+ throttle: r = 0,
145
+ trailing: f = !0,
146
+ leading: u = !0,
147
+ ...l
148
+ } = o;
149
+ return ae(
150
+ e,
151
+ t,
152
+ {
153
+ ...l,
154
+ eventFilter: ce(r, f, u)
155
+ }
31
156
  );
32
- const b = {
33
- state: a,
34
- clearTimer: F(a),
35
- handleClick: z({ emit: l, props: e, state: a, designConfig: d })
157
+ }
158
+ const F = $ ? window : void 0, Ae = $ ? window.document : void 0;
159
+ function S(e) {
160
+ var t;
161
+ const o = b(e);
162
+ return (t = o == null ? void 0 : o.$el) != null ? t : o;
163
+ }
164
+ function M(...e) {
165
+ const t = [], o = () => {
166
+ t.forEach((n) => n()), t.length = 0;
167
+ }, r = (n, i, a, c) => (n.addEventListener(i, a, c), () => n.removeEventListener(i, a, c)), f = I(() => {
168
+ const n = C(b(e[0])).filter((i) => i != null);
169
+ return n.every((i) => typeof i != "string") ? n : void 0;
170
+ }), u = _e(
171
+ () => {
172
+ var n, i;
173
+ return [
174
+ (i = (n = f.value) == null ? void 0 : n.map((a) => S(a))) != null ? i : [F].filter((a) => a != null),
175
+ C(b(f.value ? e[1] : e[0])),
176
+ C(ge(f.value ? e[2] : e[1])),
177
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
178
+ b(f.value ? e[3] : e[2])
179
+ ];
180
+ },
181
+ ([n, i, a, c]) => {
182
+ if (o(), !(n != null && n.length) || !(i != null && i.length) || !(a != null && a.length))
183
+ return;
184
+ const s = Oe(c) ? { ...c } : c;
185
+ t.push(
186
+ ...n.flatMap(
187
+ (v) => i.flatMap(
188
+ (m) => a.map((p) => r(v, m, p, s))
189
+ )
190
+ )
191
+ );
192
+ },
193
+ { flush: "post" }
194
+ ), l = () => {
195
+ u(), o();
36
196
  };
37
- return n(b.clearTimer), b;
38
- };
39
- var H = {
40
- xmlns: "http://www.w3.org/2000/svg",
41
- viewBox: "0 0 32 32"
42
- }, V = /* @__PURE__ */ r(
43
- "defs",
44
- {
45
- fill: "none"
46
- },
47
- [/* @__PURE__ */ r("linearGradient", {
48
- id: "loading-shadow_svg__a",
49
- x1: "-1285.88",
50
- y1: "25.63",
51
- x2: "-1286.89",
52
- y2: "25.13",
53
- gradientTransform: "matrix(29.6 0 0 29.6 38096.4 -732.8)",
54
- gradientUnits: "userSpaceOnUse"
55
- }, [/* @__PURE__ */ r("stop", {
56
- offset: "0",
57
- "stop-color": "#191919",
58
- "stop-opacity": "0"
59
- }), /* @__PURE__ */ r("stop", {
60
- offset: "1",
61
- "stop-color": "#191919"
62
- })])],
63
- -1
64
- /* HOISTED */
65
- ), P = /* @__PURE__ */ r(
66
- "mask",
67
- {
68
- fill: "none",
69
- id: "loading-shadow_svg__b",
70
- "mask-type": "alpha",
71
- maskUnits: "userSpaceOnUse",
72
- x: "0",
73
- y: "0"
74
- },
75
- [/* @__PURE__ */ r("path", {
76
- fill: "url(#loading-shadow_svg__a)",
77
- d: "M16 1.2c1 0 1.8.8 1.8 1.8S17 4.8 16 4.8C9.8 4.8 4.8 9.8 4.8 16s5 11.2 11.2 11.2 11.2-5 11.2-11.2c0-1 .8-1.8 1.8-1.8s1.8.8 1.8 1.8c0 8.2-6.6 14.8-14.8 14.8S1.2 24.2 1.2 16 7.8 1.2 16 1.2Z"
78
- }, [/* @__PURE__ */ r("animateTransform", {
79
- attributeName: "transform",
80
- attributeType: "XML",
81
- type: "rotate",
82
- from: "0 16 16",
83
- to: "360 16 16",
84
- dur: "1s",
85
- repeatCount: "indefinite"
86
- })])],
87
- -1
88
- /* HOISTED */
89
- ), Z = /* @__PURE__ */ r(
90
- "g",
91
- {
92
- mask: "url(#loading-shadow_svg__b)"
93
- },
94
- [/* @__PURE__ */ r("path", {
95
- d: "M-.1 32H32V-.11H-.1V32Z",
96
- "fill-rule": "evenodd"
97
- })],
98
- -1
99
- /* HOISTED */
100
- ), R = [V, P, Z];
101
- function X(e, t) {
102
- return f(), w("svg", H, [].concat(R));
103
- }
104
- var Y = {
105
- render: X
106
- }, q = function() {
107
- return C({
108
- name: "IconLoadingShadow",
109
- component: Y
110
- })();
111
- };
112
- function J(e, t) {
113
- var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
114
- if (n) return (n = n.call(e)).next.bind(n);
115
- if (Array.isArray(e) || (n = K(e)) || t) {
116
- n && (e = n);
117
- var o = 0;
118
- return function() {
119
- return o >= e.length ? { done: !0 } : { done: !1, value: e[o++] };
120
- };
197
+ return H(o), l;
198
+ }
199
+ let oe = !1;
200
+ function $e(e, t, o = {}) {
201
+ const { window: r = F, ignore: f = [], capture: u = !0, detectIframe: l = !1, controls: n = !1 } = o;
202
+ if (!r)
203
+ return n ? { stop: O, cancel: O, trigger: O } : O;
204
+ if (xe && !oe) {
205
+ oe = !0;
206
+ const d = { passive: !0 };
207
+ Array.from(r.document.body.children).forEach((h) => h.addEventListener("click", O, d)), r.document.documentElement.addEventListener("click", O, d);
121
208
  }
122
- throw new TypeError(`Invalid attempt to iterate non-iterable instance.
123
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
124
- }
125
- function K(e, t) {
126
- if (e) {
127
- if (typeof e == "string") return S(e, t);
128
- var n = {}.toString.call(e).slice(8, -1);
129
- return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? S(e, t) : void 0;
209
+ let i = !0;
210
+ const a = (d) => b(f).some((h) => {
211
+ if (typeof h == "string")
212
+ return Array.from(r.document.querySelectorAll(h)).some((g) => g === d.target || d.composedPath().includes(g));
213
+ {
214
+ const g = S(h);
215
+ return g && (d.target === g || d.composedPath().includes(g));
216
+ }
217
+ });
218
+ function c(d) {
219
+ const h = b(d);
220
+ return h && h.$.subTree.shapeFlag === 16;
130
221
  }
222
+ function s(d, h) {
223
+ const g = b(d), T = g.$.subTree && g.$.subTree.children;
224
+ return T == null || !Array.isArray(T) ? !1 : T.some((W) => W.el === h.target || h.composedPath().includes(W.el));
225
+ }
226
+ const v = (d) => {
227
+ const h = S(e);
228
+ if (d.target != null && !(!(h instanceof Element) && c(e) && s(e, d)) && !(!h || h === d.target || d.composedPath().includes(h))) {
229
+ if ("detail" in d && d.detail === 0 && (i = !a(d)), !i) {
230
+ i = !0;
231
+ return;
232
+ }
233
+ t(d);
234
+ }
235
+ };
236
+ let m = !1;
237
+ const p = [
238
+ M(r, "click", (d) => {
239
+ m || (m = !0, setTimeout(() => {
240
+ m = !1;
241
+ }, 0), v(d));
242
+ }, { passive: !0, capture: u }),
243
+ M(r, "pointerdown", (d) => {
244
+ const h = S(e);
245
+ i = !a(d) && !!(h && !d.composedPath().includes(h));
246
+ }, { passive: !0 }),
247
+ l && M(r, "blur", (d) => {
248
+ setTimeout(() => {
249
+ var h;
250
+ const g = S(e);
251
+ ((h = r.document.activeElement) == null ? void 0 : h.tagName) === "IFRAME" && !(g != null && g.contains(r.document.activeElement)) && t(d);
252
+ }, 0);
253
+ }, { passive: !0 })
254
+ ].filter(Boolean), E = () => p.forEach((d) => d());
255
+ return n ? {
256
+ stop: E,
257
+ cancel: () => {
258
+ i = !1;
259
+ },
260
+ trigger: (d) => {
261
+ i = !0, v(d), i = !1;
262
+ }
263
+ } : E;
131
264
  }
132
- function S(e, t) {
133
- (t == null || t > e.length) && (t = e.length);
134
- for (var n = 0, o = Array(t); n < t; n++) o[n] = e[n];
135
- return o;
265
+ function Le() {
266
+ const e = y(!1), t = B();
267
+ return t && ie(() => {
268
+ e.value = !0;
269
+ }, t), e;
136
270
  }
137
- var Q = function(t, n) {
138
- for (var o = t.__vccOpts || t, u = J(n), s; !(s = u()).done; ) {
139
- var l = s.value, i = l[0], d = l[1];
140
- o[i] = d;
271
+ function U(e) {
272
+ const t = Le();
273
+ return I(() => (t.value, !!e()));
274
+ }
275
+ function Y(e, t, o = {}) {
276
+ const { window: r = F, ...f } = o;
277
+ let u;
278
+ const l = U(() => r && "MutationObserver" in r), n = () => {
279
+ u && (u.disconnect(), u = void 0);
280
+ }, i = I(() => {
281
+ const v = b(e), m = C(v).map(S).filter(Ee);
282
+ return new Set(m);
283
+ }), a = L(
284
+ () => i.value,
285
+ (v) => {
286
+ n(), l.value && v.size && (u = new MutationObserver(t), v.forEach((m) => u.observe(m, f)));
287
+ },
288
+ { immediate: !0, flush: "post" }
289
+ ), c = () => u == null ? void 0 : u.takeRecords(), s = () => {
290
+ a(), n();
291
+ };
292
+ return H(s), {
293
+ isSupported: l,
294
+ stop: s,
295
+ takeRecords: c
296
+ };
297
+ }
298
+ function De(e, t, o = {}) {
299
+ const {
300
+ window: r = F,
301
+ document: f = r == null ? void 0 : r.document,
302
+ flush: u = "sync"
303
+ } = o;
304
+ if (!r || !f)
305
+ return O;
306
+ let l;
307
+ const n = (c) => {
308
+ l == null || l(), l = c;
309
+ }, i = le(() => {
310
+ const c = S(e);
311
+ if (c) {
312
+ const { stop: s } = Y(
313
+ f,
314
+ (v) => {
315
+ v.map((p) => [...p.removedNodes]).flat().some((p) => p === c || p.contains(c)) && t(v);
316
+ },
317
+ {
318
+ window: r,
319
+ childList: !0,
320
+ subtree: !0
321
+ }
322
+ );
323
+ n(s);
324
+ }
325
+ }, { flush: u }), a = () => {
326
+ i(), n();
327
+ };
328
+ return H(a), a;
329
+ }
330
+ const ke = Symbol("vueuse-ssr-width");
331
+ function Ce() {
332
+ const e = se() ? Se(ke, null) : null;
333
+ return typeof e == "number" ? e : void 0;
334
+ }
335
+ function He(e, t = {}) {
336
+ const { window: o = F, ssrWidth: r = Ce() } = t, f = U(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), u = y(typeof r == "number"), l = y(), n = y(!1), i = (a) => {
337
+ n.value = a.matches;
338
+ };
339
+ return le(() => {
340
+ if (u.value) {
341
+ u.value = !f.value;
342
+ const a = b(e).split(",");
343
+ n.value = a.some((c) => {
344
+ const s = c.includes("not all"), v = c.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = c.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
345
+ let p = !!(v || m);
346
+ return v && p && (p = r >= ne(v[1])), m && p && (p = r <= ne(m[1])), s ? !p : p;
347
+ });
348
+ return;
349
+ }
350
+ f.value && (l.value = o.matchMedia(b(e)), n.value = l.value.matches);
351
+ }), M(l, "change", i, { passive: !0 }), I(() => n.value);
352
+ }
353
+ function fe(e, t, o = {}) {
354
+ const { window: r = F, ...f } = o;
355
+ let u;
356
+ const l = U(() => r && "ResizeObserver" in r), n = () => {
357
+ u && (u.disconnect(), u = void 0);
358
+ }, i = I(() => {
359
+ const s = b(e);
360
+ return Array.isArray(s) ? s.map((v) => S(v)) : [S(s)];
361
+ }), a = L(
362
+ i,
363
+ (s) => {
364
+ if (n(), l.value && r) {
365
+ u = new ResizeObserver(t);
366
+ for (const v of s)
367
+ v && u.observe(v, f);
368
+ }
369
+ },
370
+ { immediate: !0, flush: "post" }
371
+ ), c = () => {
372
+ n(), a();
373
+ };
374
+ return H(c), {
375
+ isSupported: l,
376
+ stop: c
377
+ };
378
+ }
379
+ function Ge(e, t = {}) {
380
+ const {
381
+ reset: o = !0,
382
+ windowResize: r = !0,
383
+ windowScroll: f = !0,
384
+ immediate: u = !0,
385
+ updateTiming: l = "sync"
386
+ } = t, n = y(0), i = y(0), a = y(0), c = y(0), s = y(0), v = y(0), m = y(0), p = y(0);
387
+ function E() {
388
+ const h = S(e);
389
+ if (!h) {
390
+ o && (n.value = 0, i.value = 0, a.value = 0, c.value = 0, s.value = 0, v.value = 0, m.value = 0, p.value = 0);
391
+ return;
392
+ }
393
+ const g = h.getBoundingClientRect();
394
+ n.value = g.height, i.value = g.bottom, a.value = g.left, c.value = g.right, s.value = g.top, v.value = g.width, m.value = g.x, p.value = g.y;
141
395
  }
142
- return o;
143
- }, W = k({
144
- emits: ["click"],
145
- props: [].concat($, ["type", "text", "size", "icon", "resetTime", "nativeType", "loading", "disabled", "plain", "autofocus", "round", "circle", "tabindex", "customClass", "ghost"]),
146
- components: {
147
- IconLoading: q()
148
- },
149
- setup: function(t, n) {
150
- return _({
151
- props: t,
152
- context: n,
153
- renderless: G,
154
- api: N
155
- });
396
+ function d() {
397
+ l === "sync" ? E() : l === "next-frame" && requestAnimationFrame(() => E());
156
398
  }
157
- }), x = ["disabled", "autofocus", "type", "tabindex"];
158
- function ee(e, t, n, o, u, s) {
159
- var l = I("icon-loading");
160
- return f(), w("button", j({
161
- class: ["tiny-button", [e.type ? "tiny-button--" + e.type : "", e.size ? "tiny-button--" + e.size : "", {
162
- "is-disabled": e.state.buttonDisabled,
163
- "is-loading": e.loading,
164
- "is-plain": e.state.plain,
165
- "is-ghost": e.ghost,
166
- "is-round": e.state.round,
167
- "is-circle": e.circle,
168
- "is-icon": e.icon && !e.loading && (e.text || e.slots.default),
169
- "is-only-icon": e.icon && !e.loading && !(e.text || e.slots.default)
170
- }]],
171
- onClick: t[0] || (t[0] = function() {
172
- return e.handleClick && e.handleClick.apply(e, arguments);
173
- }),
174
- disabled: e.state.buttonDisabled || e.loading,
175
- autofocus: e.autofocus,
176
- type: e.nativeType,
177
- tabindex: e.tabindex
178
- }, e.a(e.$attrs, ["class", "style", "title", "id"], !0)), [e.loading ? (f(), h(l, {
179
- key: 0,
180
- class: "tiny-icon-loading tiny-svg-size"
181
- })) : T("v-if", !0), e.icon && !e.loading ? (f(), h(L(e.icon), {
182
- key: 1,
183
- class: M({
184
- "is-text": e.text || e.slots.default
185
- })
186
- }, null, 8, ["class"])) : T("v-if", !0), E(e.$slots, "default", {}, function() {
187
- return [r(
188
- "span",
189
- null,
190
- U(e.text),
191
- 1
192
- /* TEXT */
193
- )];
194
- })], 16, x);
195
- }
196
- var m = /* @__PURE__ */ Q(W, [["render", ee]]);
197
- function v() {
198
- return v = Object.assign ? Object.assign.bind() : function(e) {
199
- for (var t = 1; t < arguments.length; t++) {
200
- var n = arguments[t];
201
- for (var o in n) ({}).hasOwnProperty.call(n, o) && (e[o] = n[o]);
399
+ return fe(e, d), L(() => S(e), (h) => !h && d()), Y(e, d, {
400
+ attributeFilter: ["style", "class"]
401
+ }), f && M("scroll", d, { capture: !0, passive: !0 }), r && M("resize", d, { passive: !0 }), z(() => {
402
+ u && d();
403
+ }), {
404
+ height: n,
405
+ bottom: i,
406
+ left: a,
407
+ right: c,
408
+ top: s,
409
+ width: v,
410
+ x: m,
411
+ y: p,
412
+ update: d
413
+ };
414
+ }
415
+ function Ue(e, t = {}) {
416
+ const {
417
+ delayEnter: o = 0,
418
+ delayLeave: r = 0,
419
+ triggerOnRemoval: f = !1,
420
+ window: u = F
421
+ } = t, l = y(!1);
422
+ let n;
423
+ const i = (a) => {
424
+ const c = a ? o : r;
425
+ n && (clearTimeout(n), n = void 0), c ? n = setTimeout(() => l.value = a, c) : l.value = a;
426
+ };
427
+ return u && (M(e, "mouseenter", () => i(!0), { passive: !0 }), M(e, "mouseleave", () => i(!1), { passive: !0 }), f && De(
428
+ I(() => S(e)),
429
+ () => i(!1)
430
+ )), l;
431
+ }
432
+ function Ye(e, t = { width: 0, height: 0 }, o = {}) {
433
+ const { window: r = F, box: f = "content-box" } = o, u = I(() => {
434
+ var s, v;
435
+ return (v = (s = S(e)) == null ? void 0 : s.namespaceURI) == null ? void 0 : v.includes("svg");
436
+ }), l = y(t.width), n = y(t.height), { stop: i } = fe(
437
+ e,
438
+ ([s]) => {
439
+ const v = f === "border-box" ? s.borderBoxSize : f === "content-box" ? s.contentBoxSize : s.devicePixelContentBoxSize;
440
+ if (r && u.value) {
441
+ const m = S(e);
442
+ if (m) {
443
+ const p = m.getBoundingClientRect();
444
+ l.value = p.width, n.value = p.height;
445
+ }
446
+ } else if (v) {
447
+ const m = C(v);
448
+ l.value = m.reduce((p, { inlineSize: E }) => p + E, 0), n.value = m.reduce((p, { blockSize: E }) => p + E, 0);
449
+ } else
450
+ l.value = s.contentRect.width, n.value = s.contentRect.height;
451
+ },
452
+ o
453
+ );
454
+ z(() => {
455
+ const s = S(e);
456
+ s && (l.value = "offsetWidth" in s ? s.offsetWidth : t.width, n.value = "offsetHeight" in s ? s.offsetHeight : t.height);
457
+ });
458
+ const a = L(
459
+ () => S(e),
460
+ (s) => {
461
+ l.value = s ? t.width : 0, n.value = s ? t.height : 0;
202
462
  }
463
+ );
464
+ function c() {
465
+ i(), a();
466
+ }
467
+ return {
468
+ width: l,
469
+ height: n,
470
+ stop: c
471
+ };
472
+ }
473
+ const je = {
474
+ multiple: !0,
475
+ accept: "*",
476
+ reset: !1,
477
+ directory: !1
478
+ };
479
+ function Ve(e) {
480
+ if (!e)
481
+ return null;
482
+ if (e instanceof FileList)
203
483
  return e;
204
- }, v.apply(null, arguments);
205
- }
206
- var te = function(t) {
207
- var n, o = typeof process == "object" ? (n = process.env) == null ? void 0 : n.TINY_MODE : null;
208
- return m;
209
- }, ne = v({}, D, {
210
- /** 展示按钮不同的状态,设置为text则展示为文本按钮。可取值为:'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text' */
211
- type: {
212
- type: String,
213
- default: "default"
214
- },
215
- /** 设置原生的tabindex属性 */
216
- tabindex: {
217
- type: String,
218
- default: "0"
219
- },
220
- /** 按钮左侧展示的图标,接收为Icon组件 */
221
- icon: {
222
- type: [Object, String],
223
- default: ""
224
- },
225
- /** 按钮显示的文本 */
226
- text: {
227
- type: String,
228
- default: ""
229
- },
230
- /** 设置按钮禁用时间,防止重复提交,单位毫秒 */
231
- resetTime: {
232
- type: Number,
233
- default: 1e3
234
- },
235
- /** 对应按钮原生 type 属性 */
236
- nativeType: {
237
- type: String,
238
- default: "button"
239
- },
240
- /** 当配置href后,点击按钮则更新 location.href 进行页面跳转 */
241
- href: {
242
- type: String,
243
- default: ""
244
- },
245
- /** 定义按钮尺寸 */
246
- size: {
247
- type: String,
248
- default: "",
249
- validator: function(t) {
250
- return ["large", "medium", "small", "mini", ""].includes(t);
484
+ const t = new DataTransfer();
485
+ for (const o of e)
486
+ t.items.add(o);
487
+ return t.files;
488
+ }
489
+ function Qe(e = {}) {
490
+ const {
491
+ document: t = Ae
492
+ } = e, o = be(Ve(e.initialFiles)), { on: r, trigger: f } = te(), { on: u, trigger: l } = te();
493
+ let n;
494
+ t && (n = S(e.input) || t.createElement("input"), n.type = "file", n.onchange = (c) => {
495
+ const s = c.target;
496
+ o.value = s.files, f(o.value);
497
+ }, n.oncancel = () => {
498
+ l();
499
+ });
500
+ const i = () => {
501
+ o.value = null, n && n.value && (n.value = "", f(null));
502
+ }, a = (c) => {
503
+ if (!n)
504
+ return;
505
+ const s = {
506
+ ...je,
507
+ ...e,
508
+ ...c
509
+ };
510
+ n.multiple = s.multiple, n.accept = s.accept, n.webkitdirectory = s.directory, We(s, "capture") && (n.capture = s.capture), s.reset && i(), n.click();
511
+ };
512
+ return {
513
+ files: ye(o),
514
+ open: a,
515
+ reset: i,
516
+ onCancel: u,
517
+ onChange: r
518
+ };
519
+ }
520
+ const re = 1;
521
+ function Xe(e, t = {}) {
522
+ const {
523
+ throttle: o = 0,
524
+ idle: r = 200,
525
+ onStop: f = O,
526
+ onScroll: u = O,
527
+ offset: l = {
528
+ left: 0,
529
+ right: 0,
530
+ top: 0,
531
+ bottom: 0
532
+ },
533
+ observe: n = {
534
+ mutation: !1
535
+ },
536
+ eventListenerOptions: i = {
537
+ capture: !1,
538
+ passive: !0
539
+ },
540
+ behavior: a = "auto",
541
+ window: c = F,
542
+ onError: s = (w) => {
543
+ console.error(w);
251
544
  }
252
- },
253
- /** 是否圆角按钮 */
254
- round: {
255
- type: Boolean,
256
- default: void 0
257
- },
258
- /** 是否朴素按钮 */
259
- plain: Boolean,
260
- /** 是否圆形按钮 */
261
- circle: Boolean,
262
- /** 是否加载中状态 */
263
- loading: Boolean,
264
- /** 是否被禁用按钮 */
265
- disabled: Boolean,
266
- /** 是否默认聚焦 */
267
- autofocus: Boolean,
268
- /** 自定义类名, 仅 mobile-first 模板时有效 */
269
- customClass: {
270
- type: String,
271
- default: ""
272
- },
273
- /** 设置通栏按钮,宽度充满水平方向, 仅 mobile-first 模板时有效 */
274
- banner: {
275
- type: Boolean,
276
- default: !1
277
- },
278
- /** 是否幽灵按钮 */
279
- ghost: Boolean,
280
- /** 点击事件 */
281
- onClick: {
282
- type: Function
283
- }
284
- }), p = k({
285
- name: O + "Button",
286
- inject: {
287
- buttonGroup: {
288
- default: ""
545
+ } = t, v = typeof n == "boolean" ? {
546
+ mutation: n
547
+ } : n, m = y(0), p = y(0), E = I({
548
+ get() {
549
+ return m.value;
550
+ },
551
+ set(w) {
552
+ h(w, void 0);
553
+ }
554
+ }), d = I({
555
+ get() {
556
+ return p.value;
557
+ },
558
+ set(w) {
559
+ h(void 0, w);
289
560
  }
290
- },
291
- props: ne,
292
- slots: Object,
293
- setup: function(t, n) {
294
- return A({
295
- props: t,
296
- context: n,
297
- template: te
561
+ });
562
+ function h(w, _) {
563
+ var x, D, k, V;
564
+ if (!c)
565
+ return;
566
+ const R = b(e);
567
+ if (!R)
568
+ return;
569
+ (k = R instanceof Document ? c.document.body : R) == null || k.scrollTo({
570
+ top: (x = b(_)) != null ? x : d.value,
571
+ left: (D = b(w)) != null ? D : E.value,
572
+ behavior: b(a)
298
573
  });
574
+ const P = ((V = R == null ? void 0 : R.document) == null ? void 0 : V.documentElement) || (R == null ? void 0 : R.documentElement) || R;
575
+ E != null && (m.value = P.scrollLeft), d != null && (p.value = P.scrollTop);
299
576
  }
300
- }), oe = "3.undefined";
301
- p.install = function(e) {
302
- e.component(p.name, p);
303
- };
304
- p.version = oe;
577
+ const g = y(!1), T = ee({
578
+ left: !0,
579
+ right: !1,
580
+ top: !0,
581
+ bottom: !1
582
+ }), W = ee({
583
+ left: !1,
584
+ right: !1,
585
+ top: !1,
586
+ bottom: !1
587
+ }), Q = (w) => {
588
+ g.value && (g.value = !1, W.left = !1, W.right = !1, W.top = !1, W.bottom = !1, f(w));
589
+ }, de = Ie(Q, o + r), j = (w) => {
590
+ var _;
591
+ if (!c)
592
+ return;
593
+ const x = ((_ = w == null ? void 0 : w.document) == null ? void 0 : _.documentElement) || (w == null ? void 0 : w.documentElement) || S(w), { display: D, flexDirection: k, direction: V } = getComputedStyle(x), R = V === "rtl" ? -1 : 1, P = x.scrollLeft;
594
+ W.left = P < m.value, W.right = P > m.value;
595
+ const q = Math.abs(P * R) <= (l.left || 0), J = Math.abs(P * R) + x.clientWidth >= x.scrollWidth - (l.right || 0) - re;
596
+ D === "flex" && k === "row-reverse" ? (T.left = J, T.right = q) : (T.left = q, T.right = J), m.value = P;
597
+ let A = x.scrollTop;
598
+ w === c.document && !A && (A = c.document.body.scrollTop), W.top = A < p.value, W.bottom = A > p.value;
599
+ const K = Math.abs(A) <= (l.top || 0), Z = Math.abs(A) + x.clientHeight >= x.scrollHeight - (l.bottom || 0) - re;
600
+ D === "flex" && k === "column-reverse" ? (T.top = Z, T.bottom = K) : (T.top = K, T.bottom = Z), p.value = A;
601
+ }, X = (w) => {
602
+ var _;
603
+ if (!c)
604
+ return;
605
+ const x = (_ = w.target.documentElement) != null ? _ : w.target;
606
+ j(x), g.value = !0, de(w), u(w);
607
+ };
608
+ return M(
609
+ e,
610
+ "scroll",
611
+ o ? Pe(X, o, !0, !1) : X,
612
+ i
613
+ ), z(() => {
614
+ try {
615
+ const w = b(e);
616
+ if (!w)
617
+ return;
618
+ j(w);
619
+ } catch (w) {
620
+ s(w);
621
+ }
622
+ }), v != null && v.mutation && e != null && e !== c && e !== document && Y(
623
+ e,
624
+ () => {
625
+ const w = b(e);
626
+ w && j(w);
627
+ },
628
+ {
629
+ attributes: !0,
630
+ childList: !0,
631
+ subtree: !0
632
+ }
633
+ ), M(
634
+ e,
635
+ "scrollend",
636
+ Q,
637
+ i
638
+ ), {
639
+ x: E,
640
+ y: d,
641
+ isScrolling: g,
642
+ arrivedState: T,
643
+ directions: W,
644
+ measure() {
645
+ const w = b(e);
646
+ c && w && j(w);
647
+ }
648
+ };
649
+ }
650
+ function qe(e = {}) {
651
+ const {
652
+ window: t = F,
653
+ initialWidth: o = Number.POSITIVE_INFINITY,
654
+ initialHeight: r = Number.POSITIVE_INFINITY,
655
+ listenOrientation: f = !0,
656
+ includeScrollbar: u = !0,
657
+ type: l = "inner"
658
+ } = e, n = y(o), i = y(r), a = () => {
659
+ if (t)
660
+ if (l === "outer")
661
+ n.value = t.outerWidth, i.value = t.outerHeight;
662
+ else if (l === "visual" && t.visualViewport) {
663
+ const { width: s, height: v, scale: m } = t.visualViewport;
664
+ n.value = Math.round(s * m), i.value = Math.round(v * m);
665
+ } else u ? (n.value = t.innerWidth, i.value = t.innerHeight) : (n.value = t.document.documentElement.clientWidth, i.value = t.document.documentElement.clientHeight);
666
+ };
667
+ a(), z(a);
668
+ const c = { passive: !0 };
669
+ if (M("resize", a, c), t && l === "visual" && t.visualViewport && M(t.visualViewport, "resize", a, c), f) {
670
+ const s = He("(orientation: portrait)");
671
+ L(s, () => a());
672
+ }
673
+ return { width: n, height: i };
674
+ }
305
675
  export {
306
- p as B
676
+ Ge as a,
677
+ Ue as b,
678
+ qe as c,
679
+ Qe as d,
680
+ Ye as e,
681
+ S as f,
682
+ M as g,
683
+ He as h,
684
+ Be as i,
685
+ $e as o,
686
+ Xe as u,
687
+ Ne as w
307
688
  };