@opentiny/tiny-robot 0.3.0-alpha.14 → 0.3.0-alpha.16

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