@opentiny/tiny-robot 0.2.0-alpha.6 → 0.2.0-alpha.8

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