@opentiny/tiny-robot 0.2.0-alpha.7 → 0.2.0-alpha.9

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,536 +1,307 @@
1
- import { onMounted as te, nextTick as re, watch as _, getCurrentScope as se, onScopeDispose as ue, isRef as ce, getCurrentInstance as B, toValue as g, hasInjectionContext as ne, inject as ae, shallowRef as S, computed as I, reactive as J, unref as de, watchEffect as fe } from "vue";
2
- function N(e) {
3
- return se() ? (ue(e), !0) : !1;
4
- }
5
- const H = /* @__PURE__ */ new WeakMap(), ve = (...e) => {
6
- var t;
7
- const o = e[0], n = (t = B()) == null ? void 0 : t.proxy;
8
- if (n == null && !ne())
9
- throw new Error("injectLocal must be called in setup");
10
- return n && H.has(n) && o in H.get(n) ? H.get(n)[o] : ae(...e);
11
- }, oe = typeof window < "u" && typeof document < "u";
12
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
13
- const he = (e) => e != null, me = Object.prototype.toString, pe = (e) => me.call(e) === "[object Object]", x = () => {
14
- }, we = /* @__PURE__ */ be();
15
- function be() {
16
- var e, t;
17
- return oe && ((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));
18
- }
19
- function $(e, t) {
20
- function o(...n) {
21
- return new Promise((v, c) => {
22
- Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(v).catch(c);
23
- });
24
- }
25
- return o;
26
- }
27
- const ge = (e) => e();
28
- function ie(e, t = {}) {
29
- let o, n, v = x;
30
- const c = (l) => {
31
- clearTimeout(l), v(), v = x;
32
- };
33
- let d;
34
- return (l) => {
35
- const s = g(e), h = g(t.maxWait);
36
- return o && c(o), s <= 0 || h !== void 0 && h <= 0 ? (n && (c(n), n = null), Promise.resolve(l())) : new Promise((r, a) => {
37
- v = t.rejectOnCancel ? a : r, d = l, h && !n && (n = setTimeout(() => {
38
- o && c(o), n = null, r(d());
39
- }, h)), o = setTimeout(() => {
40
- n && c(n), n = null, r(l());
41
- }, s);
42
- });
43
- };
44
- }
45
- function Se(...e) {
46
- let t = 0, o, n = !0, v = x, c, d, i, l, s;
47
- !ce(e[0]) && typeof e[0] == "object" ? { delay: d, trailing: i = !0, leading: l = !0, rejectOnCancel: s = !1 } = e[0] : [d, i = !0, l = !0, s = !1] = e;
48
- const h = () => {
49
- o && (clearTimeout(o), o = void 0, v(), v = x);
50
- };
51
- return (a) => {
52
- const m = g(d), b = Date.now() - t, y = () => c = a();
53
- return h(), m <= 0 ? (t = Date.now(), y()) : (b > m && (l || !n) ? (t = Date.now(), y()) : i && (c = new Promise((u, f) => {
54
- v = s ? f : u, o = setTimeout(() => {
55
- t = Date.now(), n = !0, u(y()), h();
56
- }, Math.max(0, m - b));
57
- })), !l && !o && (o = setTimeout(() => n = !0, m)), n = !1, c);
58
- };
59
- }
60
- function K(e) {
61
- return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
62
- }
63
- function D(e) {
64
- return Array.isArray(e) ? e : [e];
65
- }
66
- function ye(e) {
67
- return B();
68
- }
69
- function Ee(e, t = 200, o = {}) {
70
- return $(
71
- ie(t, o),
72
- e
73
- );
74
- }
75
- function Te(e, t = 200, o = !1, n = !0, v = !1) {
76
- return $(
77
- Se(t, o, n, v),
78
- e
79
- );
80
- }
81
- function xe(e, t, o = {}) {
82
- const {
83
- eventFilter: n = ge,
84
- ...v
85
- } = o;
86
- return _(
87
- e,
88
- $(
89
- n,
90
- t
91
- ),
92
- v
93
- );
94
- }
95
- function V(e, t = !0, o) {
96
- ye() ? te(e, o) : t ? e() : re(e);
97
- }
98
- function _e(e, t, o = {}) {
99
- const {
100
- debounce: n = 0,
101
- maxWait: v = void 0,
102
- ...c
103
- } = o;
104
- return xe(
105
- e,
106
- t,
107
- {
108
- ...c,
109
- eventFilter: ie(n, { maxWait: v })
110
- }
111
- );
112
- }
113
- function We(e, t, o) {
114
- return _(
115
- e,
116
- t,
117
- {
118
- ...o,
119
- immediate: !0
120
- }
121
- );
122
- }
123
- const R = oe ? window : void 0;
124
- function E(e) {
125
- var t;
126
- const o = g(e);
127
- return (t = o == null ? void 0 : o.$el) != null ? t : o;
128
- }
129
- function W(...e) {
130
- const t = [], o = () => {
131
- t.forEach((i) => i()), t.length = 0;
132
- }, n = (i, l, s, h) => (i.addEventListener(l, s, h), () => i.removeEventListener(l, s, h)), v = I(() => {
133
- const i = D(g(e[0])).filter((l) => l != null);
134
- return i.every((l) => typeof l != "string") ? i : void 0;
135
- }), c = We(
136
- () => {
137
- var i, l;
138
- return [
139
- (l = (i = v.value) == null ? void 0 : i.map((s) => E(s))) != null ? l : [R].filter((s) => s != null),
140
- D(g(v.value ? e[1] : e[0])),
141
- D(de(v.value ? e[2] : e[1])),
142
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
143
- g(v.value ? e[3] : e[2])
144
- ];
145
- },
146
- ([i, l, s, h]) => {
147
- if (o(), !(i != null && i.length) || !(l != null && l.length) || !(s != null && s.length))
148
- return;
149
- const r = pe(h) ? { ...h } : h;
150
- t.push(
151
- ...i.flatMap(
152
- (a) => l.flatMap(
153
- (m) => s.map((b) => n(a, m, b, r))
154
- )
155
- )
156
- );
157
- },
158
- { flush: "post" }
159
- ), d = () => {
160
- c(), o();
161
- };
162
- return N(o), d;
163
- }
164
- let Z = !1;
165
- function Fe(e, t, o = {}) {
166
- const { window: n = R, ignore: v = [], capture: c = !0, detectIframe: d = !1, controls: i = !1 } = o;
167
- if (!n)
168
- return i ? { stop: x, cancel: x, trigger: x } : x;
169
- if (we && !Z) {
170
- Z = !0;
171
- const u = { passive: !0 };
172
- Array.from(n.document.body.children).forEach((f) => W(f, "click", x, u)), W(n.document.documentElement, "click", x, u);
173
- }
174
- let l = !0;
175
- const s = (u) => g(v).some((f) => {
176
- if (typeof f == "string")
177
- return Array.from(n.document.querySelectorAll(f)).some((p) => p === u.target || u.composedPath().includes(p));
178
- {
179
- const p = E(f);
180
- return p && (u.target === p || u.composedPath().includes(p));
181
- }
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
+ )
182
24
  });
183
- function h(u) {
184
- const f = g(u);
185
- return f && f.$.subTree.shapeFlag === 16;
186
- }
187
- function r(u, f) {
188
- const p = g(u), F = p.$.subTree && p.$.subTree.children;
189
- return F == null || !Array.isArray(F) ? !1 : F.some((L) => L.el === f.target || f.composedPath().includes(L.el));
190
- }
191
- const a = (u) => {
192
- const f = E(e);
193
- if (u.target != null && !(!(f instanceof Element) && h(e) && r(e, u)) && !(!f || f === u.target || u.composedPath().includes(f))) {
194
- if ("detail" in u && u.detail === 0 && (l = !s(u)), !l) {
195
- l = !0;
196
- return;
197
- }
198
- t(u);
199
- }
200
- };
201
- let m = !1;
202
- const b = [
203
- W(n, "click", (u) => {
204
- m || (m = !0, setTimeout(() => {
205
- m = !1;
206
- }, 0), a(u));
207
- }, { passive: !0, capture: c }),
208
- W(n, "pointerdown", (u) => {
209
- const f = E(e);
210
- l = !s(u) && !!(f && !u.composedPath().includes(f));
211
- }, { passive: !0 }),
212
- d && W(n, "blur", (u) => {
213
- setTimeout(() => {
214
- var f;
215
- const p = E(e);
216
- ((f = n.document.activeElement) == null ? void 0 : f.tagName) === "IFRAME" && !(p != null && p.contains(n.document.activeElement)) && t(u);
217
- }, 0);
218
- }, { passive: !0 })
219
- ].filter(Boolean), y = () => b.forEach((u) => u());
220
- return i ? {
221
- stop: y,
222
- cancel: () => {
223
- l = !1;
25
+ u(
26
+ () => e.disabled,
27
+ (c) => {
28
+ a.disabled = c;
224
29
  },
225
- trigger: (u) => {
226
- l = !0, a(u), l = !1;
227
- }
228
- } : y;
229
- }
230
- function Me() {
231
- const e = S(!1), t = B();
232
- return t && te(() => {
233
- e.value = !0;
234
- }, t), e;
235
- }
236
- function G(e) {
237
- const t = Me();
238
- return I(() => (t.value, !!e()));
239
- }
240
- function Oe(e, t, o = {}) {
241
- const { window: n = R, ...v } = o;
242
- let c;
243
- const d = G(() => n && "MutationObserver" in n), i = () => {
244
- c && (c.disconnect(), c = void 0);
245
- }, l = I(() => {
246
- const a = g(e), m = D(a).map(E).filter(he);
247
- return new Set(m);
248
- }), s = _(
249
- () => l.value,
250
- (a) => {
251
- i(), d.value && a.size && (c = new MutationObserver(t), a.forEach((m) => c.observe(m, v)));
252
- },
253
- { immediate: !0, flush: "post" }
254
- ), h = () => c == null ? void 0 : c.takeRecords(), r = () => {
255
- s(), i();
256
- };
257
- return N(r), {
258
- isSupported: d,
259
- stop: r,
260
- takeRecords: h
30
+ { immediate: !0 }
31
+ );
32
+ const b = {
33
+ state: a,
34
+ clearTimer: F(a),
35
+ handleClick: z({ emit: l, props: e, state: a, designConfig: d })
261
36
  };
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));
262
103
  }
263
- const Ie = Symbol("vueuse-ssr-width");
264
- function Re() {
265
- const e = ne() ? ve(Ie, null) : null;
266
- return typeof e == "number" ? e : void 0;
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
+ };
121
+ }
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.`);
267
124
  }
268
- function Pe(e, t = {}) {
269
- const { window: o = R, ssrWidth: n = Re() } = t, v = G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), c = S(typeof n == "number"), d = S(), i = S(!1), l = (s) => {
270
- i.value = s.matches;
271
- };
272
- return fe(() => {
273
- if (c.value) {
274
- c.value = !v.value;
275
- const s = g(e).split(",");
276
- i.value = s.some((h) => {
277
- const r = h.includes("not all"), a = h.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = h.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
278
- let b = !!(a || m);
279
- return a && b && (b = n >= K(a[1])), m && b && (b = n <= K(m[1])), r ? !b : b;
280
- });
281
- return;
282
- }
283
- v.value && (d.value = o.matchMedia(g(e)), i.value = d.value.matches);
284
- }), W(d, "change", l, { passive: !0 }), I(() => i.value);
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;
130
+ }
285
131
  }
286
- function le(e, t, o = {}) {
287
- const { window: n = R, ...v } = o;
288
- let c;
289
- const d = G(() => n && "ResizeObserver" in n), i = () => {
290
- c && (c.disconnect(), c = void 0);
291
- }, l = I(() => {
292
- const r = g(e);
293
- return Array.isArray(r) ? r.map((a) => E(a)) : [E(r)];
294
- }), s = _(
295
- l,
296
- (r) => {
297
- if (i(), d.value && n) {
298
- c = new ResizeObserver(t);
299
- for (const a of r)
300
- a && c.observe(a, v);
301
- }
302
- },
303
- { immediate: !0, flush: "post" }
304
- ), h = () => {
305
- i(), s();
306
- };
307
- return N(h), {
308
- isSupported: d,
309
- stop: h
310
- };
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;
311
136
  }
312
- function Ce(e, t = {}) {
313
- const {
314
- reset: o = !0,
315
- windowResize: n = !0,
316
- windowScroll: v = !0,
317
- immediate: c = !0,
318
- updateTiming: d = "sync"
319
- } = t, i = S(0), l = S(0), s = S(0), h = S(0), r = S(0), a = S(0), m = S(0), b = S(0);
320
- function y() {
321
- const f = E(e);
322
- if (!f) {
323
- o && (i.value = 0, l.value = 0, s.value = 0, h.value = 0, r.value = 0, a.value = 0, m.value = 0, b.value = 0);
324
- return;
325
- }
326
- const p = f.getBoundingClientRect();
327
- i.value = p.height, l.value = p.bottom, s.value = p.left, h.value = p.right, r.value = p.top, a.value = p.width, m.value = p.x, b.value = p.y;
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;
328
141
  }
329
- function u() {
330
- d === "sync" ? y() : d === "next-frame" && requestAnimationFrame(() => y());
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
+ });
331
156
  }
332
- return le(e, u), _(() => E(e), (f) => !f && u()), Oe(e, u, {
333
- attributeFilter: ["style", "class"]
334
- }), v && W("scroll", u, { capture: !0, passive: !0 }), n && W("resize", u, { passive: !0 }), V(() => {
335
- c && u();
336
- }), {
337
- height: i,
338
- bottom: l,
339
- left: s,
340
- right: h,
341
- top: r,
342
- width: a,
343
- x: m,
344
- y: b,
345
- update: u
346
- };
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);
347
195
  }
348
- function ke(e, t = { width: 0, height: 0 }, o = {}) {
349
- const { window: n = R, box: v = "content-box" } = o, c = I(() => {
350
- var r, a;
351
- return (a = (r = E(e)) == null ? void 0 : r.namespaceURI) == null ? void 0 : a.includes("svg");
352
- }), d = S(t.width), i = S(t.height), { stop: l } = le(
353
- e,
354
- ([r]) => {
355
- const a = v === "border-box" ? r.borderBoxSize : v === "content-box" ? r.contentBoxSize : r.devicePixelContentBoxSize;
356
- if (n && c.value) {
357
- const m = E(e);
358
- if (m) {
359
- const b = m.getBoundingClientRect();
360
- d.value = b.width, i.value = b.height;
361
- }
362
- } else if (a) {
363
- const m = D(a);
364
- d.value = m.reduce((b, { inlineSize: y }) => b + y, 0), i.value = m.reduce((b, { blockSize: y }) => b + y, 0);
365
- } else
366
- d.value = r.contentRect.width, i.value = r.contentRect.height;
367
- },
368
- o
369
- );
370
- V(() => {
371
- const r = E(e);
372
- r && (d.value = "offsetWidth" in r ? r.offsetWidth : t.width, i.value = "offsetHeight" in r ? r.offsetHeight : t.height);
373
- });
374
- const s = _(
375
- () => E(e),
376
- (r) => {
377
- d.value = r ? t.width : 0, i.value = r ? t.height : 0;
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]);
378
202
  }
379
- );
380
- function h() {
381
- l(), s();
382
- }
383
- return {
384
- width: d,
385
- height: i,
386
- stop: h
387
- };
203
+ return e;
204
+ }, v.apply(null, arguments);
388
205
  }
389
- const ee = 1;
390
- function De(e, t = {}) {
391
- const {
392
- throttle: o = 0,
393
- idle: n = 200,
394
- onStop: v = x,
395
- onScroll: c = x,
396
- offset: d = {
397
- left: 0,
398
- right: 0,
399
- top: 0,
400
- bottom: 0
401
- },
402
- eventListenerOptions: i = {
403
- capture: !1,
404
- passive: !0
405
- },
406
- behavior: l = "auto",
407
- window: s = R,
408
- onError: h = (w) => {
409
- console.error(w);
410
- }
411
- } = t, r = S(0), a = S(0), m = I({
412
- get() {
413
- return r.value;
414
- },
415
- set(w) {
416
- y(w, void 0);
417
- }
418
- }), b = I({
419
- get() {
420
- return a.value;
421
- },
422
- set(w) {
423
- y(void 0, w);
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);
424
251
  }
425
- });
426
- function y(w, P) {
427
- var T, C, k, j;
428
- if (!s)
429
- return;
430
- const M = g(e);
431
- if (!M)
432
- return;
433
- (k = M instanceof Document ? s.document.body : M) == null || k.scrollTo({
434
- top: (T = g(P)) != null ? T : b.value,
435
- left: (C = g(w)) != null ? C : m.value,
436
- behavior: g(l)
437
- });
438
- const O = ((j = M == null ? void 0 : M.document) == null ? void 0 : j.documentElement) || (M == null ? void 0 : M.documentElement) || M;
439
- m != null && (r.value = O.scrollLeft), b != null && (a.value = O.scrollTop);
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
440
283
  }
441
- const u = S(!1), f = J({
442
- left: !0,
443
- right: !1,
444
- top: !0,
445
- bottom: !1
446
- }), p = J({
447
- left: !1,
448
- right: !1,
449
- top: !1,
450
- bottom: !1
451
- }), F = (w) => {
452
- u.value && (u.value = !1, p.left = !1, p.right = !1, p.top = !1, p.bottom = !1, v(w));
453
- }, L = Ee(F, o + n), z = (w) => {
454
- var P;
455
- if (!s)
456
- return;
457
- const T = ((P = w == null ? void 0 : w.document) == null ? void 0 : P.documentElement) || (w == null ? void 0 : w.documentElement) || E(w), { display: C, flexDirection: k, direction: j } = getComputedStyle(T), M = j === "rtl" ? -1 : 1, O = T.scrollLeft;
458
- p.left = O < r.value, p.right = O > r.value;
459
- const Q = Math.abs(O * M) <= (d.left || 0), X = Math.abs(O * M) + T.clientWidth >= T.scrollWidth - (d.right || 0) - ee;
460
- C === "flex" && k === "row-reverse" ? (f.left = X, f.right = Q) : (f.left = Q, f.right = X), r.value = O;
461
- let A = T.scrollTop;
462
- w === s.document && !A && (A = s.document.body.scrollTop), p.top = A < a.value, p.bottom = A > a.value;
463
- const U = Math.abs(A) <= (d.top || 0), q = Math.abs(A) + T.clientHeight >= T.scrollHeight - (d.bottom || 0) - ee;
464
- C === "flex" && k === "column-reverse" ? (f.top = q, f.bottom = U) : (f.top = U, f.bottom = q), a.value = A;
465
- }, Y = (w) => {
466
- var P;
467
- if (!s)
468
- return;
469
- const T = (P = w.target.documentElement) != null ? P : w.target;
470
- z(T), u.value = !0, L(w), c(w);
471
- };
472
- return W(
473
- e,
474
- "scroll",
475
- o ? Te(Y, o, !0, !1) : Y,
476
- i
477
- ), V(() => {
478
- try {
479
- const w = g(e);
480
- if (!w)
481
- return;
482
- z(w);
483
- } catch (w) {
484
- h(w);
284
+ }), p = k({
285
+ name: O + "Button",
286
+ inject: {
287
+ buttonGroup: {
288
+ default: ""
485
289
  }
486
- }), W(
487
- e,
488
- "scrollend",
489
- F,
490
- i
491
- ), {
492
- x: m,
493
- y: b,
494
- isScrolling: u,
495
- arrivedState: f,
496
- directions: p,
497
- measure() {
498
- const w = g(e);
499
- s && w && z(w);
500
- }
501
- };
502
- }
503
- function Le(e = {}) {
504
- const {
505
- window: t = R,
506
- initialWidth: o = Number.POSITIVE_INFINITY,
507
- initialHeight: n = Number.POSITIVE_INFINITY,
508
- listenOrientation: v = !0,
509
- includeScrollbar: c = !0,
510
- type: d = "inner"
511
- } = e, i = S(o), l = S(n), s = () => {
512
- if (t)
513
- if (d === "outer")
514
- i.value = t.outerWidth, l.value = t.outerHeight;
515
- else if (d === "visual" && t.visualViewport) {
516
- const { width: r, height: a, scale: m } = t.visualViewport;
517
- i.value = Math.round(r * m), l.value = Math.round(a * m);
518
- } else c ? (i.value = t.innerWidth, l.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, l.value = t.document.documentElement.clientHeight);
519
- };
520
- s(), V(s);
521
- const h = { passive: !0 };
522
- if (W("resize", s, h), t && d === "visual" && t.visualViewport && W(t.visualViewport, "resize", s, h), v) {
523
- const r = Pe("(orientation: portrait)");
524
- _(r, () => s());
290
+ },
291
+ props: ne,
292
+ slots: Object,
293
+ setup: function(t, n) {
294
+ return A({
295
+ props: t,
296
+ context: n,
297
+ template: te
298
+ });
525
299
  }
526
- return { width: i, height: l };
527
- }
300
+ }), oe = "3.undefined";
301
+ p.install = function(e) {
302
+ e.component(p.name, p);
303
+ };
304
+ p.version = oe;
528
305
  export {
529
- ke as a,
530
- Le as b,
531
- Pe as c,
532
- De as d,
533
- Fe as o,
534
- Ce as u,
535
- _e as w
306
+ p as B
536
307
  };