maz-ui 3.28.9 → 3.29.1
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/components/MazAvatar.d.ts +11 -0
- package/components/MazAvatar.mjs +1 -1
- package/components/MazBadge.d.ts +3 -3
- package/components/MazBadge.mjs +1 -1
- package/components/MazInputCode.d.ts +153 -0
- package/components/MazInputCode.mjs +189 -0
- package/components/MazInputTags.mjs +1 -1
- package/components/MazPullToRefresh.d.ts +88 -0
- package/components/MazPullToRefresh.mjs +185 -0
- package/components/assets/MazAccordion.css +1 -1
- package/components/assets/MazAvatar.css +1 -1
- package/components/assets/MazBadge.css +1 -1
- package/components/assets/MazInputCode.css +1 -0
- package/components/assets/MazInputTags.css +1 -1
- package/components/assets/MazPullToRefresh.css +1 -0
- package/components/chunks/MazAvatar-0JzIvOc4.mjs +134 -0
- package/components/chunks/{MazInputTags-kDTfYnsu.mjs → MazInputTags-NVpcRBJU.mjs} +2 -2
- package/components/chunks/{MazLazyImg-65QIsZ1B.mjs → MazLazyImg-evGMN9Pe.mjs} +2 -2
- package/components/chunks/{MazSpinner-T1N9rRjX.mjs → MazSpinner-4_WO_1Z6.mjs} +1 -1
- package/components/chunks/{MazSpinner-W3TVtT8l.mjs → MazSpinner-J65FS2NQ.mjs} +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.mjs +2 -0
- package/css/main.css +1 -1
- package/modules/chunks/{MazBtn-OU9ti0GG.mjs → MazBtn-23G6MO1u.mjs} +2 -2
- package/modules/chunks/{MazBtn-5jYVOHi5.cjs → MazBtn-BVge7L6B.cjs} +1 -1
- package/modules/chunks/{MazIcon-mIVA-wm3.mjs → MazIcon-3ecUGYyh.mjs} +1 -1
- package/modules/chunks/{MazIcon-O-Sd2-b9.cjs → MazIcon-tK6rWxmD.cjs} +1 -1
- package/modules/chunks/{MazSpinner-Me_ta933.mjs → MazSpinner-CKpey7-9.mjs} +1 -1
- package/modules/chunks/{MazSpinner-ElCcZG5D.cjs → MazSpinner-Yp72xl7m.cjs} +1 -1
- package/modules/chunks/index-t7LFFnFX.cjs +124 -0
- package/modules/chunks/{index-AC4Cl2MH.mjs → index-w7bAz52b.mjs} +395 -347
- package/modules/index.cjs +1 -1
- package/modules/index.mjs +24 -22
- package/nuxt/index.d.mts +10 -0
- package/nuxt/index.d.ts +10 -0
- package/nuxt/index.json +1 -1
- package/nuxt/index.mjs +14 -0
- package/package.json +1 -1
- package/tailwindcss/tailwind.config.ts +3 -1
- package/tailwindcss/utils/colors.ts +2 -1
- package/tailwindcss/variables/breakpoints.ts +14 -0
- package/tailwindcss/variables/utilities.ts +3 -1
- package/tailwindcss/variables/z-indexes.ts +2 -1
- package/types/components/MazAvatar.vue.d.ts +11 -0
- package/types/components/MazBadge.vue.d.ts +3 -3
- package/types/components/MazInputCode.vue.d.ts +153 -0
- package/types/components/MazPullToRefresh.vue.d.ts +88 -0
- package/types/components/index.d.ts +2 -0
- package/types/modules/composables/index.d.ts +2 -0
- package/types/modules/composables/use-breakpoints.d.ts +38 -0
- package/types/modules/composables/use-window-size.d.ts +32 -0
- package/types/modules/helpers/is-standalone-mode.d.ts +1 -0
- package/types/tailwindcss/tailwind.config.d.ts +2 -0
- package/types/tailwindcss/variables/breakpoints.d.ts +1 -0
- package/components/chunks/MazAvatar-HJMP2asX.mjs +0 -127
- package/modules/chunks/index-f0w7PwtX.cjs +0 -124
|
@@ -71,6 +71,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
71
71
|
type: NumberConstructor;
|
|
72
72
|
default: undefined;
|
|
73
73
|
};
|
|
74
|
+
roundedSize: {
|
|
75
|
+
type: PropType<"sm" | "md" | "lg" | "xl" | "none" | "full">;
|
|
76
|
+
default: string;
|
|
77
|
+
validator: (value: string) => boolean;
|
|
78
|
+
};
|
|
74
79
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
75
80
|
click: (...args: any[]) => void;
|
|
76
81
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -143,6 +148,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
143
148
|
type: NumberConstructor;
|
|
144
149
|
default: undefined;
|
|
145
150
|
};
|
|
151
|
+
roundedSize: {
|
|
152
|
+
type: PropType<"sm" | "md" | "lg" | "xl" | "none" | "full">;
|
|
153
|
+
default: string;
|
|
154
|
+
validator: (value: string) => boolean;
|
|
155
|
+
};
|
|
146
156
|
}>> & {
|
|
147
157
|
onClick?: ((...args: any[]) => any) | undefined;
|
|
148
158
|
}, {
|
|
@@ -163,6 +173,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
163
173
|
buttonColor: Color;
|
|
164
174
|
noClickableIcon: boolean;
|
|
165
175
|
letterCount: number;
|
|
176
|
+
roundedSize: "sm" | "md" | "lg" | "xl" | "none" | "full";
|
|
166
177
|
}, {}>, {
|
|
167
178
|
"round-text"?(_: {}): any;
|
|
168
179
|
icon?(_: {}): any;
|
package/components/MazAvatar.mjs
CHANGED
package/components/MazBadge.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
24
24
|
default: boolean;
|
|
25
25
|
};
|
|
26
26
|
roundedSize: {
|
|
27
|
-
type:
|
|
27
|
+
type: PropType<"sm" | "md" | "lg" | "xl" | "none" | "full">;
|
|
28
28
|
default: string;
|
|
29
29
|
validator: (value: string) => boolean;
|
|
30
30
|
};
|
|
@@ -51,7 +51,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
51
51
|
default: boolean;
|
|
52
52
|
};
|
|
53
53
|
roundedSize: {
|
|
54
|
-
type:
|
|
54
|
+
type: PropType<"sm" | "md" | "lg" | "xl" | "none" | "full">;
|
|
55
55
|
default: string;
|
|
56
56
|
validator: (value: string) => boolean;
|
|
57
57
|
};
|
|
@@ -60,8 +60,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
60
60
|
color: BadgeColor;
|
|
61
61
|
outline: boolean;
|
|
62
62
|
pastel: boolean;
|
|
63
|
+
roundedSize: "sm" | "md" | "lg" | "xl" | "none" | "full";
|
|
63
64
|
nowrap: boolean;
|
|
64
|
-
roundedSize: string;
|
|
65
65
|
}, {}>, {
|
|
66
66
|
default?(_: {}): any;
|
|
67
67
|
}>;
|
package/components/MazBadge.mjs
CHANGED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { Color } from './types';
|
|
3
|
+
export type { Color } from './types';
|
|
4
|
+
declare const _default: import("vue").DefineComponent<{
|
|
5
|
+
style: {
|
|
6
|
+
type: PropType<import("vue").StyleValue>;
|
|
7
|
+
default: undefined;
|
|
8
|
+
};
|
|
9
|
+
class: {
|
|
10
|
+
type: PropType<any>;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
/** Is v-model */
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: PropType<string | number>;
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
/** Choose the length of the code */
|
|
19
|
+
codeLength: {
|
|
20
|
+
type: NumberConstructor;
|
|
21
|
+
default: number;
|
|
22
|
+
};
|
|
23
|
+
/** Is the returned type (number works only when accept-alpha is not enable) */
|
|
24
|
+
type: {
|
|
25
|
+
type: PropType<"number" | "text">;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
/** Turn it to true to accept alpha charac */
|
|
29
|
+
acceptAlpha: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
33
|
+
/** make inputs required */
|
|
34
|
+
required: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** make inputs required */
|
|
39
|
+
disabled: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** When is `true` the input has the error style (danger color) */
|
|
44
|
+
error: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
/** When is `true` the input has the success style (success color) */
|
|
49
|
+
success: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
/** When is `true` the input has the warning style (warning color) */
|
|
54
|
+
warning: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** Predefined size of component */
|
|
59
|
+
size: {
|
|
60
|
+
type: PropType<"sm" | "md" | "lg">;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
/** Color of component */
|
|
64
|
+
color: {
|
|
65
|
+
type: PropType<Color>;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
69
|
+
"update:model-value": (...args: any[]) => void;
|
|
70
|
+
completed: (...args: any[]) => void;
|
|
71
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
72
|
+
style: {
|
|
73
|
+
type: PropType<import("vue").StyleValue>;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
class: {
|
|
77
|
+
type: PropType<any>;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
80
|
+
/** Is v-model */
|
|
81
|
+
modelValue: {
|
|
82
|
+
type: PropType<string | number>;
|
|
83
|
+
default: undefined;
|
|
84
|
+
};
|
|
85
|
+
/** Choose the length of the code */
|
|
86
|
+
codeLength: {
|
|
87
|
+
type: NumberConstructor;
|
|
88
|
+
default: number;
|
|
89
|
+
};
|
|
90
|
+
/** Is the returned type (number works only when accept-alpha is not enable) */
|
|
91
|
+
type: {
|
|
92
|
+
type: PropType<"number" | "text">;
|
|
93
|
+
default: string;
|
|
94
|
+
};
|
|
95
|
+
/** Turn it to true to accept alpha charac */
|
|
96
|
+
acceptAlpha: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
/** make inputs required */
|
|
101
|
+
required: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: boolean;
|
|
104
|
+
};
|
|
105
|
+
/** make inputs required */
|
|
106
|
+
disabled: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: boolean;
|
|
109
|
+
};
|
|
110
|
+
/** When is `true` the input has the error style (danger color) */
|
|
111
|
+
error: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
115
|
+
/** When is `true` the input has the success style (success color) */
|
|
116
|
+
success: {
|
|
117
|
+
type: BooleanConstructor;
|
|
118
|
+
default: boolean;
|
|
119
|
+
};
|
|
120
|
+
/** When is `true` the input has the warning style (warning color) */
|
|
121
|
+
warning: {
|
|
122
|
+
type: BooleanConstructor;
|
|
123
|
+
default: boolean;
|
|
124
|
+
};
|
|
125
|
+
/** Predefined size of component */
|
|
126
|
+
size: {
|
|
127
|
+
type: PropType<"sm" | "md" | "lg">;
|
|
128
|
+
default: string;
|
|
129
|
+
};
|
|
130
|
+
/** Color of component */
|
|
131
|
+
color: {
|
|
132
|
+
type: PropType<Color>;
|
|
133
|
+
default: string;
|
|
134
|
+
};
|
|
135
|
+
}>> & {
|
|
136
|
+
"onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
|
|
137
|
+
onCompleted?: ((...args: any[]) => any) | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
success: boolean;
|
|
140
|
+
warning: boolean;
|
|
141
|
+
size: "sm" | "md" | "lg";
|
|
142
|
+
color: Color;
|
|
143
|
+
type: "number" | "text";
|
|
144
|
+
style: import("vue").StyleValue;
|
|
145
|
+
class: any;
|
|
146
|
+
disabled: boolean;
|
|
147
|
+
required: boolean;
|
|
148
|
+
error: boolean;
|
|
149
|
+
modelValue: string | number;
|
|
150
|
+
codeLength: number;
|
|
151
|
+
acceptAlpha: boolean;
|
|
152
|
+
}, {}>;
|
|
153
|
+
export default _default;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import "./assets/MazInputCode.css";
|
|
2
|
+
import { defineComponent as N, useCssVars as C, ref as b, watch as k, computed as m, openBlock as g, createElementBlock as v, normalizeClass as V, normalizeStyle as M, Fragment as P, renderList as j, createCommentVNode as q, createElementVNode as O, mergeProps as $ } from "vue";
|
|
3
|
+
const D = ["disabled"], E = ["inputmode", "pattern", "required", "value", "onInput", "onKeydown"], F = /* @__PURE__ */ N({
|
|
4
|
+
inheritAttrs: !1,
|
|
5
|
+
__name: "MazInputCode",
|
|
6
|
+
props: {
|
|
7
|
+
style: {
|
|
8
|
+
type: [String, Array, Object],
|
|
9
|
+
default: void 0
|
|
10
|
+
},
|
|
11
|
+
class: {
|
|
12
|
+
type: [String, Array, Object],
|
|
13
|
+
default: void 0
|
|
14
|
+
},
|
|
15
|
+
/** Is v-model */
|
|
16
|
+
modelValue: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
/** Choose the length of the code */
|
|
21
|
+
codeLength: { type: Number, default: 4 },
|
|
22
|
+
/** Is the returned type (number works only when accept-alpha is not enable) */
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "text"
|
|
26
|
+
},
|
|
27
|
+
/** Turn it to true to accept alpha charac */
|
|
28
|
+
acceptAlpha: { type: Boolean, default: !1 },
|
|
29
|
+
/** make inputs required */
|
|
30
|
+
required: { type: Boolean, default: !1 },
|
|
31
|
+
/** make inputs required */
|
|
32
|
+
disabled: { type: Boolean, default: !1 },
|
|
33
|
+
/** When is `true` the input has the error style (danger color) */
|
|
34
|
+
error: { type: Boolean, default: !1 },
|
|
35
|
+
/** When is `true` the input has the success style (success color) */
|
|
36
|
+
success: { type: Boolean, default: !1 },
|
|
37
|
+
/** When is `true` the input has the warning style (warning color) */
|
|
38
|
+
warning: { type: Boolean, default: !1 },
|
|
39
|
+
/** Predefined size of component */
|
|
40
|
+
size: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "md"
|
|
43
|
+
},
|
|
44
|
+
/** Color of component */
|
|
45
|
+
color: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "primary"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
emits: [
|
|
51
|
+
/**
|
|
52
|
+
* update the model
|
|
53
|
+
*/
|
|
54
|
+
"update:model-value",
|
|
55
|
+
/**
|
|
56
|
+
* Emitted when all inputs are set.
|
|
57
|
+
*/
|
|
58
|
+
"completed"
|
|
59
|
+
],
|
|
60
|
+
setup(l, { emit: d }) {
|
|
61
|
+
C((t) => ({
|
|
62
|
+
"6bdbc0e0": L.value
|
|
63
|
+
}));
|
|
64
|
+
const a = l, c = d, i = b([]), r = b(/* @__PURE__ */ new Map());
|
|
65
|
+
k(
|
|
66
|
+
() => a.modelValue,
|
|
67
|
+
(t, e) => {
|
|
68
|
+
t !== e && (r.value = x());
|
|
69
|
+
},
|
|
70
|
+
{ immediate: !0 }
|
|
71
|
+
);
|
|
72
|
+
const f = m({
|
|
73
|
+
get: () => r.value,
|
|
74
|
+
set: (t) => {
|
|
75
|
+
const e = I(t);
|
|
76
|
+
c("update:model-value", e), (e == null ? void 0 : e.toString().length) === a.codeLength && c("completed");
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
function x(t = a.modelValue) {
|
|
80
|
+
const e = /* @__PURE__ */ new Map();
|
|
81
|
+
for (const n of Array.from({ length: a.codeLength }, (o, u) => u))
|
|
82
|
+
if (t === void 0)
|
|
83
|
+
e.set(n + 1, void 0);
|
|
84
|
+
else {
|
|
85
|
+
const o = [...t.toString()];
|
|
86
|
+
e.set(n + 1, o[n]);
|
|
87
|
+
}
|
|
88
|
+
return e;
|
|
89
|
+
}
|
|
90
|
+
function z(t, e) {
|
|
91
|
+
var o;
|
|
92
|
+
const n = y((o = t.target) == null ? void 0 : o.value);
|
|
93
|
+
f.value = r.value.set(e, n), n && p(e);
|
|
94
|
+
}
|
|
95
|
+
function I(t) {
|
|
96
|
+
const e = [...t.values()].join("");
|
|
97
|
+
return a.type === "text" ? e : e && !Number.isNaN(Number(e)) ? Number(e) : void 0;
|
|
98
|
+
}
|
|
99
|
+
function y(t) {
|
|
100
|
+
var e;
|
|
101
|
+
return (e = a.acceptAlpha ? t.match(/^[\w.]$/i) : t.match(/\d+/g)) == null ? void 0 : e.toString();
|
|
102
|
+
}
|
|
103
|
+
function S(t, e) {
|
|
104
|
+
const n = r.value.get(e);
|
|
105
|
+
if (t.key === "Backspace" && !n) {
|
|
106
|
+
const o = e - 1 < 0 ? 0 : e - 1;
|
|
107
|
+
f.value = r.value.set(o, void 0), p(o - 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function w(t) {
|
|
111
|
+
var o;
|
|
112
|
+
const e = (o = t.clipboardData) == null ? void 0 : o.getData("text");
|
|
113
|
+
if (!e)
|
|
114
|
+
return;
|
|
115
|
+
const n = Array.from({ length: a.codeLength }, (u, s) => ({
|
|
116
|
+
index: s + 1,
|
|
117
|
+
value: [...e.toString()][s] ?? void 0
|
|
118
|
+
}));
|
|
119
|
+
for (const { index: u, value: s } of n) {
|
|
120
|
+
const h = s ? y(s) : void 0;
|
|
121
|
+
h && r.value.set(u, h);
|
|
122
|
+
}
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
const u = A(), s = u >= a.codeLength ? a.codeLength - 1 : u;
|
|
125
|
+
p(s, !1);
|
|
126
|
+
}, 0);
|
|
127
|
+
}
|
|
128
|
+
function A() {
|
|
129
|
+
return [...r.value.values()].filter(Boolean).length;
|
|
130
|
+
}
|
|
131
|
+
function p(t, e = !0) {
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
const n = i.value[t];
|
|
134
|
+
t + 1 > a.codeLength || !n || (n.focus(), e && n.select());
|
|
135
|
+
}, 0);
|
|
136
|
+
}
|
|
137
|
+
const B = m(() => a.error ? "!maz-border-danger" : a.success ? "!maz-border-success" : a.warning ? "!maz-border-warning" : ""), L = m(() => `var(--maz-color-${a.color})`);
|
|
138
|
+
return (t, e) => (g(), v("fieldset", {
|
|
139
|
+
class: V(["m-input-code", [l.size ? `--${l.size}` : void 0]]),
|
|
140
|
+
disabled: l.disabled,
|
|
141
|
+
style: M(l.style)
|
|
142
|
+
}, [
|
|
143
|
+
(g(!0), v(
|
|
144
|
+
P,
|
|
145
|
+
null,
|
|
146
|
+
j(l.codeLength, (n) => (g(), v(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
key: n,
|
|
150
|
+
class: V(["input-wrapper", B.value])
|
|
151
|
+
},
|
|
152
|
+
[
|
|
153
|
+
q(" eslint-disable-next-line vuejs-accessibility/form-control-has-label "),
|
|
154
|
+
O("input", $({
|
|
155
|
+
ref_for: !0,
|
|
156
|
+
ref: (o) => {
|
|
157
|
+
i.value[n - 1] = o;
|
|
158
|
+
},
|
|
159
|
+
type: "text",
|
|
160
|
+
minlength: "1",
|
|
161
|
+
maxlength: "1",
|
|
162
|
+
inputmode: l.acceptAlpha ? "text" : "numeric",
|
|
163
|
+
pattern: l.acceptAlpha ? "[a-zA-Z0-9]{1}" : "[0-9]{1}",
|
|
164
|
+
autocomplete: "do-not-autofill",
|
|
165
|
+
required: l.required
|
|
166
|
+
}, t.$attrs, {
|
|
167
|
+
value: f.value.get(n),
|
|
168
|
+
onInput: (o) => z(o, n),
|
|
169
|
+
onKeydown: (o) => S(o, n),
|
|
170
|
+
onPaste: w
|
|
171
|
+
}), null, 16, E)
|
|
172
|
+
],
|
|
173
|
+
2
|
|
174
|
+
/* CLASS */
|
|
175
|
+
))),
|
|
176
|
+
128
|
|
177
|
+
/* KEYED_FRAGMENT */
|
|
178
|
+
))
|
|
179
|
+
], 14, D));
|
|
180
|
+
}
|
|
181
|
+
}), K = (l, d) => {
|
|
182
|
+
const a = l.__vccOpts || l;
|
|
183
|
+
for (const [c, i] of d)
|
|
184
|
+
a[c] = i;
|
|
185
|
+
return a;
|
|
186
|
+
}, W = /* @__PURE__ */ K(F, [["__scopeId", "data-v-4e98f6f7"]]);
|
|
187
|
+
export {
|
|
188
|
+
W as default
|
|
189
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Color } from './types';
|
|
2
|
+
export type { Color } from './types';
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
distance?: number | undefined;
|
|
5
|
+
offset?: number | undefined;
|
|
6
|
+
action?: (() => unknown) | undefined;
|
|
7
|
+
containerSelector?: string | undefined;
|
|
8
|
+
headerClass?: string | undefined;
|
|
9
|
+
spinnerColor?: Color | undefined;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
standaloneMode?: boolean | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
distance: number;
|
|
14
|
+
offset: number;
|
|
15
|
+
action: undefined;
|
|
16
|
+
containerSelector: undefined;
|
|
17
|
+
headerClass: undefined;
|
|
18
|
+
spinnerColor: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
standaloneMode: boolean;
|
|
21
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
+
error: (...args: any[]) => void;
|
|
23
|
+
loaded: (...args: any[]) => void;
|
|
24
|
+
start: (...args: any[]) => void;
|
|
25
|
+
finish: (...args: any[]) => void;
|
|
26
|
+
response: (...args: any[]) => void;
|
|
27
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
28
|
+
distance?: number | undefined;
|
|
29
|
+
offset?: number | undefined;
|
|
30
|
+
action?: (() => unknown) | undefined;
|
|
31
|
+
containerSelector?: string | undefined;
|
|
32
|
+
headerClass?: string | undefined;
|
|
33
|
+
spinnerColor?: Color | undefined;
|
|
34
|
+
disabled?: boolean | undefined;
|
|
35
|
+
standaloneMode?: boolean | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
distance: number;
|
|
38
|
+
offset: number;
|
|
39
|
+
action: undefined;
|
|
40
|
+
containerSelector: undefined;
|
|
41
|
+
headerClass: undefined;
|
|
42
|
+
spinnerColor: string;
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
standaloneMode: boolean;
|
|
45
|
+
}>>> & {
|
|
46
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
47
|
+
onLoaded?: ((...args: any[]) => any) | undefined;
|
|
48
|
+
onStart?: ((...args: any[]) => any) | undefined;
|
|
49
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
50
|
+
onResponse?: ((...args: any[]) => any) | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
disabled: boolean;
|
|
53
|
+
action: () => unknown;
|
|
54
|
+
offset: number;
|
|
55
|
+
distance: number;
|
|
56
|
+
containerSelector: string;
|
|
57
|
+
headerClass: string;
|
|
58
|
+
spinnerColor: Color;
|
|
59
|
+
standaloneMode: boolean;
|
|
60
|
+
}, {}>, {
|
|
61
|
+
"pull-before"?(_: {}): any;
|
|
62
|
+
"pull-ready"?(_: {}): any;
|
|
63
|
+
"pull-loading"?(_: {}): any;
|
|
64
|
+
default?(_: {}): any;
|
|
65
|
+
}>;
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
68
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
69
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
70
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
71
|
+
} : {
|
|
72
|
+
type: import('vue').PropType<T[K]>;
|
|
73
|
+
required: true;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
type __VLS_WithDefaults<P, D> = {
|
|
77
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
78
|
+
default: D[K];
|
|
79
|
+
}> : P[K];
|
|
80
|
+
};
|
|
81
|
+
type __VLS_Prettify<T> = {
|
|
82
|
+
[K in keyof T]: T[K];
|
|
83
|
+
} & {};
|
|
84
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
85
|
+
new (): {
|
|
86
|
+
$slots: S;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import "./assets/MazPullToRefresh.css";
|
|
2
|
+
import { defineComponent as P, computed as p, ref as _, watch as R, onUnmounted as x, resolveComponent as V, openBlock as c, createElementBlock as v, normalizeClass as M, normalizeStyle as Y, renderSlot as f, createCommentVNode as y, createElementVNode as b, createVNode as $, pushScopeId as N, popScopeId as A } from "vue";
|
|
3
|
+
function L() {
|
|
4
|
+
return typeof document < "u";
|
|
5
|
+
}
|
|
6
|
+
function H() {
|
|
7
|
+
if (!L())
|
|
8
|
+
return !1;
|
|
9
|
+
const o = navigator, d = window.matchMedia("(display-mode: standalone)").matches;
|
|
10
|
+
return o.standalone || d;
|
|
11
|
+
}
|
|
12
|
+
const k = (o) => (N("data-v-a874f56d"), o = o(), A(), o), q = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "header-text"
|
|
15
|
+
}, D = /* @__PURE__ */ k(() => /* @__PURE__ */ b(
|
|
16
|
+
"span",
|
|
17
|
+
null,
|
|
18
|
+
"Pull to refresh",
|
|
19
|
+
-1
|
|
20
|
+
/* HOISTED */
|
|
21
|
+
)), F = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "header-text"
|
|
24
|
+
}, O = /* @__PURE__ */ k(() => /* @__PURE__ */ b(
|
|
25
|
+
"span",
|
|
26
|
+
null,
|
|
27
|
+
" Release to refresh ",
|
|
28
|
+
-1
|
|
29
|
+
/* HOISTED */
|
|
30
|
+
)), U = {
|
|
31
|
+
key: 2,
|
|
32
|
+
class: "header-text"
|
|
33
|
+
}, j = { class: "maz-flex maz-flex-col maz-flex-center" }, G = /* @__PURE__ */ P({
|
|
34
|
+
__name: "MazPullToRefresh",
|
|
35
|
+
props: {
|
|
36
|
+
distance: { default: 100 },
|
|
37
|
+
offset: { default: 0 },
|
|
38
|
+
action: { type: Function, default: void 0 },
|
|
39
|
+
containerSelector: { default: void 0 },
|
|
40
|
+
headerClass: { default: void 0 },
|
|
41
|
+
spinnerColor: { default: "theme" },
|
|
42
|
+
disabled: { type: Boolean, default: !1 },
|
|
43
|
+
standaloneMode: { type: Boolean, default: !1 }
|
|
44
|
+
},
|
|
45
|
+
emits: ["loaded", "start", "error", "finish", "response"],
|
|
46
|
+
setup(o, { emit: d }) {
|
|
47
|
+
const a = o, r = d, l = p(
|
|
48
|
+
() => a.disabled || a.action === void 0 || a.standaloneMode && L() && !H()
|
|
49
|
+
), m = _({
|
|
50
|
+
top: 0,
|
|
51
|
+
bottom: 0
|
|
52
|
+
}), t = _({
|
|
53
|
+
from: -1,
|
|
54
|
+
to: -1,
|
|
55
|
+
distance: 0,
|
|
56
|
+
available: !1,
|
|
57
|
+
state: "end"
|
|
58
|
+
}), i = _(!1), s = p(() => {
|
|
59
|
+
if (typeof document > "u" || l.value)
|
|
60
|
+
return;
|
|
61
|
+
const e = a.containerSelector ? document.querySelector(a.containerSelector) : document.body;
|
|
62
|
+
if (!e)
|
|
63
|
+
throw new Error("MazPullToRefresh - container not found");
|
|
64
|
+
return e;
|
|
65
|
+
}), h = p(() => t.value.state !== "move" && t.value.state !== "end" || l.value ? 0 : t.value.distance > a.distance ? a.distance : t.value.distance);
|
|
66
|
+
function T(e) {
|
|
67
|
+
const { top: n, height: u } = e.getBoundingClientRect();
|
|
68
|
+
m.value = {
|
|
69
|
+
top: n,
|
|
70
|
+
bottom: window.innerHeight - (u + n + a.offset)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function g(e) {
|
|
74
|
+
i.value = e;
|
|
75
|
+
}
|
|
76
|
+
function w(e) {
|
|
77
|
+
if (i.value || m.value.top < 0 && m.value.bottom < 0 || l.value)
|
|
78
|
+
return;
|
|
79
|
+
const n = e.touches.item(0);
|
|
80
|
+
n && (t.value.state = "start", t.value.from = n.pageY);
|
|
81
|
+
}
|
|
82
|
+
function S(e) {
|
|
83
|
+
if (i.value || t.value.from < 0 || window.scrollY > 0 || l.value)
|
|
84
|
+
return;
|
|
85
|
+
const n = e.touches.item(0);
|
|
86
|
+
if (!n)
|
|
87
|
+
return;
|
|
88
|
+
t.value.to = n.pageY;
|
|
89
|
+
const u = t.value.to - t.value.from;
|
|
90
|
+
t.value.distance = u > 0 ? u : 0, t.value.available = t.value.distance >= a.distance, t.value.state = "move";
|
|
91
|
+
}
|
|
92
|
+
function E() {
|
|
93
|
+
i.value || l.value || (h.value === a.distance && t.value.state === "move" && window.scrollY <= 0 ? B() : z());
|
|
94
|
+
}
|
|
95
|
+
function z() {
|
|
96
|
+
t.value = {
|
|
97
|
+
from: -1,
|
|
98
|
+
to: -1,
|
|
99
|
+
distance: 0,
|
|
100
|
+
available: !1,
|
|
101
|
+
state: "end"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
async function B() {
|
|
105
|
+
var e;
|
|
106
|
+
try {
|
|
107
|
+
g(!0), r("start");
|
|
108
|
+
const n = await ((e = a.action) == null ? void 0 : e.call(a));
|
|
109
|
+
r("loaded"), r("response", n);
|
|
110
|
+
} catch (n) {
|
|
111
|
+
throw r("error", n), n;
|
|
112
|
+
} finally {
|
|
113
|
+
z(), g(!1), r("finish");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
R(
|
|
117
|
+
() => l.value,
|
|
118
|
+
(e) => {
|
|
119
|
+
e === !0 ? C() : I();
|
|
120
|
+
},
|
|
121
|
+
{ immediate: !0 }
|
|
122
|
+
);
|
|
123
|
+
function I() {
|
|
124
|
+
!s.value || l.value || document === void 0 || (s.value.addEventListener("touchstart", w), s.value.addEventListener("touchmove", S), s.value.addEventListener("touchend", E), T(s.value));
|
|
125
|
+
}
|
|
126
|
+
function C() {
|
|
127
|
+
!s.value || document === void 0 || (s.value.removeEventListener("touchstart", w), s.value.removeEventListener("touchmove", S), s.value.removeEventListener("touchend", E));
|
|
128
|
+
}
|
|
129
|
+
return x(() => {
|
|
130
|
+
C();
|
|
131
|
+
}), (e, n) => {
|
|
132
|
+
const u = V("MazSpinner");
|
|
133
|
+
return c(), v(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
class: M(["m-pull-to-refresh", { "--available": t.value.available || h.value > 10 }])
|
|
137
|
+
},
|
|
138
|
+
[
|
|
139
|
+
l.value ? y("v-if", !0) : (c(), v(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
key: 0,
|
|
143
|
+
class: M(["loading-header", e.headerClass]),
|
|
144
|
+
style: Y({ height: h.value + "px" })
|
|
145
|
+
},
|
|
146
|
+
[
|
|
147
|
+
t.value.available ? t.value.available && !i.value ? (c(), v("div", F, [
|
|
148
|
+
f(e.$slots, "pull-ready", {}, () => [
|
|
149
|
+
O
|
|
150
|
+
], !0)
|
|
151
|
+
])) : y("v-if", !0) : (c(), v("div", q, [
|
|
152
|
+
f(e.$slots, "pull-before", {}, () => [
|
|
153
|
+
D
|
|
154
|
+
], !0)
|
|
155
|
+
])),
|
|
156
|
+
i.value ? (c(), v("div", U, [
|
|
157
|
+
f(e.$slots, "pull-loading", {}, () => [
|
|
158
|
+
b("div", j, [
|
|
159
|
+
$(u, {
|
|
160
|
+
color: e.spinnerColor,
|
|
161
|
+
size: "2.5em"
|
|
162
|
+
}, null, 8, ["color"])
|
|
163
|
+
])
|
|
164
|
+
], !0)
|
|
165
|
+
])) : y("v-if", !0)
|
|
166
|
+
],
|
|
167
|
+
6
|
|
168
|
+
/* CLASS, STYLE */
|
|
169
|
+
)),
|
|
170
|
+
f(e.$slots, "default", {}, void 0, !0)
|
|
171
|
+
],
|
|
172
|
+
2
|
|
173
|
+
/* CLASS */
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}), J = (o, d) => {
|
|
178
|
+
const a = o.__vccOpts || o;
|
|
179
|
+
for (const [r, l] of d)
|
|
180
|
+
a[r] = l;
|
|
181
|
+
return a;
|
|
182
|
+
}, W = /* @__PURE__ */ J(G, [["__scopeId", "data-v-a874f56d"]]);
|
|
183
|
+
export {
|
|
184
|
+
W as default
|
|
185
|
+
};
|