jk-vue-comps 0.1.19 → 0.2.2
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/chunks/{index-DbH4ILBY.js → index-CAW2nf5W.js} +35 -36
- package/dist/components/GoogleAuth.d.ts +55 -51
- package/dist/components/GoogleAuth.js +75 -55
- package/dist/components/TelegramAuth.d.ts +49 -49
- package/dist/components/TelegramAuth.js +83 -70
- package/dist/hooks/useCopyToClipboard.d.ts +3 -3
- package/dist/hooks/useFormKeypressEnter.js +5 -5
- package/dist/hooks/useMemo.d.ts +1 -1
- package/dist/index.d.ts +101 -127
- package/dist/index.js +3 -10
- package/dist/utils/index.js +1 -1
- package/dist/utils/is.d.ts +6 -6
- package/dist/utils/is.js +75 -65
- package/dist/utils/math.js +92 -171
- package/dist/utils/vuePropTypes.d.ts +22 -28
- package/dist/utils/vuePropTypes.js +21 -19
- package/package.json +25 -24
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createVNode as N } from "vue";
|
|
2
|
-
import { isString as l, isHtmlStr as p, isObject as
|
|
3
|
-
import {
|
|
2
|
+
import { isString as l, isHtmlStr as p, isObject as c, isNumber as m, is as S, isArray as $, isBoolean as b, isClient as v, isDate as O, isDef as U, isEdgeBrowser as T, isElement as y, isEmail as P, isEmpty as x, isFunction as E, isInMobileBrowser as B, isIp as I, isMap as L, isNull as D, isNullAndUnDef as q, isNullOrUnDef as F, isPromise as M, isPromiseLink as R, isRegExp as _, isServer as k, isUnDef as W, isUrl as j, isValidPhoneNumber as z, isWindow as H, isZhLang as V } from "../utils/is.js";
|
|
3
|
+
import { toNum as g, isNanValue as d, BigNumber as A, DOWN as C, UP as G, add as Z, divide as J, formatRate as K, helper as Q, isBigNum as X, isBool as Y, isEqualTo as ee, isGreaterThan as ie, isGreaterThanOrEqualTo as te, isInt as ne, isLessThan as re, isLessThanOrEqualTo as oe, isNum as se, multiply as ue, power as ae, subtract as le, toBigNum as fe, toDecimalPlaces as ce, toInt as pe, toLocaleString as me, toString as ge, unFormatRate as de } from "../utils/math.js";
|
|
4
4
|
import { propTypes as he } from "../utils/vuePropTypes.js";
|
|
5
5
|
import { timeZoneOptions as we } from "../utils/timeZone.js";
|
|
6
6
|
import { withInstall as Ne } from "../utils/withInstall.js";
|
|
7
|
-
function
|
|
7
|
+
function f(e) {
|
|
8
8
|
try {
|
|
9
9
|
return new Function(`'use strict'; return (${e});`)();
|
|
10
10
|
} catch {
|
|
@@ -14,22 +14,21 @@ function c(e) {
|
|
|
14
14
|
function h(e, t = "float", n = 6) {
|
|
15
15
|
let i = String(e);
|
|
16
16
|
if (i = i.replace(/(^\s*)|(\s*$)/g, ""), i !== "") {
|
|
17
|
-
const
|
|
18
|
-
if (i = i.replace(r, ""),
|
|
17
|
+
const o = i.indexOf("0") === 0 && i.length > 1 && i.indexOf(".") !== 1, r = t === "int" ? /[^\d]/g : /[^\d.]/g;
|
|
18
|
+
if (i = i.replace(r, ""), o)
|
|
19
19
|
return "0";
|
|
20
20
|
if (t === "int")
|
|
21
21
|
i = i.indexOf("0") === 0 && i.length > 1 ? i.substring(0, i.length - 1) : i;
|
|
22
22
|
else {
|
|
23
|
-
const
|
|
24
|
-
i.indexOf(".") === 0 ? (i = "", i = i.replace(/[^$#$]/g, "0."), i = i.replace(
|
|
23
|
+
const s = f(`/\\.{${n},}/g`), u = f(`/^(\\d?)+(\\.\\d{0,${n}})?$/`);
|
|
24
|
+
i.indexOf(".") === 0 ? (i = "", i = i.replace(/[^$#$]/g, "0."), i = i.replace(s, ".")) : u.test(i) || (i = i.substring(0, i.length - 1));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
return i;
|
|
28
28
|
}
|
|
29
|
-
function Se(e, t, n, i = "int",
|
|
29
|
+
function Se(e, t, n, i = "int", o = 6) {
|
|
30
30
|
return (r) => {
|
|
31
|
-
|
|
32
|
-
e[t] = h((o = r == null ? void 0 : r.target) == null ? void 0 : o.value, i, s), n == null || n();
|
|
31
|
+
e[t] = h(r?.target?.value, i, o), n?.();
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
function $e(e) {
|
|
@@ -38,7 +37,7 @@ function $e(e) {
|
|
|
38
37
|
function be() {
|
|
39
38
|
return window ? `${window.location.protocol}//${window.location.hostname}` : "";
|
|
40
39
|
}
|
|
41
|
-
function
|
|
40
|
+
function ve() {
|
|
42
41
|
const e = new URLSearchParams(window.location.search);
|
|
43
42
|
if (!e.size)
|
|
44
43
|
return;
|
|
@@ -47,34 +46,34 @@ function Oe() {
|
|
|
47
46
|
t[n] = i;
|
|
48
47
|
return t;
|
|
49
48
|
}
|
|
50
|
-
function
|
|
49
|
+
function Oe(e) {
|
|
51
50
|
return l(e) ? e.replace(/\s+/g, "") : "";
|
|
52
51
|
}
|
|
53
52
|
function w(e = {}, t = {}) {
|
|
54
53
|
let n;
|
|
55
54
|
for (n in t)
|
|
56
|
-
e[n] =
|
|
55
|
+
e[n] = c(e[n]) ? w(e[n], t[n]) : e[n] = t[n];
|
|
57
56
|
return e;
|
|
58
57
|
}
|
|
59
|
-
function Ue(e, t = 6, { showPrefix: n = !0, showSuffix: i = !0, middleStr:
|
|
58
|
+
function Ue(e, t = 6, { showPrefix: n = !0, showSuffix: i = !0, middleStr: o = "****" } = {}) {
|
|
60
59
|
if (!l(e) && !m(e))
|
|
61
60
|
return e;
|
|
62
|
-
const r = String(e),
|
|
63
|
-
if (!r || !
|
|
61
|
+
const r = String(e), s = r?.length ?? 0;
|
|
62
|
+
if (!r || !s || t <= 0)
|
|
64
63
|
return r;
|
|
65
|
-
const u = n ? r.substring(0, t) : "", a = i ? r.substring(
|
|
66
|
-
return `${u}${
|
|
64
|
+
const u = n ? r.substring(0, t) : "", a = i ? r.substring(s - t) : "";
|
|
65
|
+
return `${u}${o}${a}`;
|
|
67
66
|
}
|
|
68
67
|
function Te(e, t = "px") {
|
|
69
68
|
if (!(e === null || e === "" || e === void 0))
|
|
70
|
-
return
|
|
69
|
+
return d(e) ? String(e) : `${g(e)}${t}`;
|
|
71
70
|
}
|
|
72
71
|
function ye(e) {
|
|
73
|
-
return e ?
|
|
74
|
-
const [i,
|
|
72
|
+
return e ? c(e) ? e : e.split(";").reduce((t, n) => {
|
|
73
|
+
const [i, o] = n.trim().split(":");
|
|
75
74
|
if (i) {
|
|
76
|
-
const
|
|
77
|
-
t[
|
|
75
|
+
const s = i.trim().replace(/-(\w)/g, (u, a) => a ? a.toUpperCase() : "");
|
|
76
|
+
t[s] = o.trim();
|
|
78
77
|
}
|
|
79
78
|
return t;
|
|
80
79
|
}, {}) : {};
|
|
@@ -88,11 +87,11 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
88
87
|
deepMerge: w,
|
|
89
88
|
desensitization: Ue,
|
|
90
89
|
divide: J,
|
|
91
|
-
evalPro:
|
|
90
|
+
evalPro: f,
|
|
92
91
|
filterInputNum: h,
|
|
93
92
|
formatRate: K,
|
|
94
93
|
generateFilterInputNumFn: Se,
|
|
95
|
-
getRouterParams:
|
|
94
|
+
getRouterParams: ve,
|
|
96
95
|
getWebsiteUrl: be,
|
|
97
96
|
helper: Q,
|
|
98
97
|
is: S,
|
|
@@ -100,8 +99,8 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
100
99
|
isBigNum: X,
|
|
101
100
|
isBool: Y,
|
|
102
101
|
isBoolean: b,
|
|
103
|
-
isClient:
|
|
104
|
-
isDate:
|
|
102
|
+
isClient: v,
|
|
103
|
+
isDate: O,
|
|
105
104
|
isDef: U,
|
|
106
105
|
isEdgeBrowser: T,
|
|
107
106
|
isElement: y,
|
|
@@ -118,13 +117,13 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
118
117
|
isLessThan: re,
|
|
119
118
|
isLessThanOrEqualTo: oe,
|
|
120
119
|
isMap: L,
|
|
121
|
-
isNanValue:
|
|
120
|
+
isNanValue: d,
|
|
122
121
|
isNull: D,
|
|
123
122
|
isNullAndUnDef: q,
|
|
124
123
|
isNullOrUnDef: F,
|
|
125
124
|
isNum: se,
|
|
126
125
|
isNumber: m,
|
|
127
|
-
isObject:
|
|
126
|
+
isObject: c,
|
|
128
127
|
isPromise: M,
|
|
129
128
|
isPromiseLink: R,
|
|
130
129
|
isRegExp: _,
|
|
@@ -138,15 +137,15 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
138
137
|
multiply: ue,
|
|
139
138
|
power: ae,
|
|
140
139
|
propTypes: he,
|
|
141
|
-
removeWhitespace:
|
|
140
|
+
removeWhitespace: Oe,
|
|
142
141
|
renderHtmlStr: $e,
|
|
143
142
|
subtract: le,
|
|
144
143
|
timeZoneOptions: we,
|
|
145
|
-
toBigNum:
|
|
146
|
-
toDecimalPlaces:
|
|
144
|
+
toBigNum: fe,
|
|
145
|
+
toDecimalPlaces: ce,
|
|
147
146
|
toInt: pe,
|
|
148
147
|
toLocaleString: me,
|
|
149
|
-
toNum:
|
|
148
|
+
toNum: g,
|
|
150
149
|
toString: ge,
|
|
151
150
|
toStyleObject: ye,
|
|
152
151
|
toStyleUnit: Te,
|
|
@@ -156,10 +155,10 @@ const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
156
155
|
export {
|
|
157
156
|
De as U,
|
|
158
157
|
be as a,
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
ve as b,
|
|
159
|
+
Oe as c,
|
|
161
160
|
w as d,
|
|
162
|
-
|
|
161
|
+
f as e,
|
|
163
162
|
h as f,
|
|
164
163
|
Se as g,
|
|
165
164
|
Ue as h,
|
|
@@ -1,95 +1,99 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SlotsType, ExtractPropTypes } from 'vue';
|
|
2
2
|
/** 跳转谷歌身份检查 */
|
|
3
3
|
export declare function toGoogleAuth(clientId: string, redirectUri: string): void;
|
|
4
|
+
declare const _comp_props: {
|
|
5
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
12
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
13
|
+
onCallback: import("vue-types").VueTypeValidableDef<(data: {
|
|
14
|
+
code: string;
|
|
15
|
+
}) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(data: {
|
|
16
|
+
code: string;
|
|
17
|
+
}) => void>>;
|
|
18
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<(error: any) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(error: any) => void>>;
|
|
19
|
+
};
|
|
20
|
+
export type GoogleAuthProps = ExtractPropTypes<typeof _comp_props>;
|
|
4
21
|
/** 谷歌身份检查 */
|
|
5
22
|
export declare const GoogleAuth: {
|
|
6
|
-
new (...args: any[]): import("vue").
|
|
7
|
-
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
23
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ExtractPropTypes<{
|
|
24
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
8
25
|
default: string;
|
|
9
26
|
};
|
|
10
|
-
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
27
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
11
28
|
default: string;
|
|
12
29
|
};
|
|
13
|
-
|
|
14
|
-
|
|
30
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
31
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
32
|
+
onCallback: import("vue-types").VueTypeValidableDef<(data: {
|
|
15
33
|
code: string;
|
|
16
|
-
}) =>
|
|
17
|
-
onRejectCallback?: ((_data: any) => any) | undefined;
|
|
18
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
-
callback: (_data: {
|
|
34
|
+
}) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(data: {
|
|
20
35
|
code: string;
|
|
21
|
-
}) =>
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
25
|
-
default: string;
|
|
26
|
-
};
|
|
27
|
-
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
28
|
-
default: string;
|
|
29
|
-
};
|
|
30
|
-
}>> & {
|
|
31
|
-
onCallback?: ((_data: {
|
|
32
|
-
code: string;
|
|
33
|
-
}) => any) | undefined;
|
|
34
|
-
onRejectCallback?: ((_data: any) => any) | undefined;
|
|
35
|
-
}, {
|
|
36
|
+
}) => void>>;
|
|
37
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<(error: any) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(error: any) => void>>;
|
|
38
|
+
}>> & Readonly<{}>, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
36
39
|
clientId: string;
|
|
37
40
|
redirectUri: string;
|
|
38
41
|
}, true, {}, SlotsType<{
|
|
39
42
|
default: {
|
|
40
43
|
startCheck: () => void;
|
|
41
44
|
};
|
|
42
|
-
}>, {
|
|
45
|
+
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
43
46
|
P: {};
|
|
44
47
|
B: {};
|
|
45
48
|
D: {};
|
|
46
49
|
C: {};
|
|
47
50
|
M: {};
|
|
48
51
|
Defaults: {};
|
|
49
|
-
}, Readonly<
|
|
50
|
-
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
52
|
+
}, Readonly<ExtractPropTypes<{
|
|
53
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
51
54
|
default: string;
|
|
52
55
|
};
|
|
53
|
-
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
56
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
54
57
|
default: string;
|
|
55
58
|
};
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
60
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
61
|
+
onCallback: import("vue-types").VueTypeValidableDef<(data: {
|
|
62
|
+
code: string;
|
|
63
|
+
}) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(data: {
|
|
58
64
|
code: string;
|
|
59
|
-
}) =>
|
|
60
|
-
onRejectCallback
|
|
61
|
-
}
|
|
65
|
+
}) => void>>;
|
|
66
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<(error: any) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(error: any) => void>>;
|
|
67
|
+
}>> & Readonly<{}>, () => JSX.Element, {}, {}, {}, {
|
|
62
68
|
clientId: string;
|
|
63
69
|
redirectUri: string;
|
|
64
70
|
}>;
|
|
65
|
-
__isFragment?:
|
|
66
|
-
__isTeleport?:
|
|
67
|
-
__isSuspense?:
|
|
68
|
-
} & import("vue").ComponentOptionsBase<Readonly<
|
|
69
|
-
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
71
|
+
__isFragment?: never;
|
|
72
|
+
__isTeleport?: never;
|
|
73
|
+
__isSuspense?: never;
|
|
74
|
+
} & import("vue").ComponentOptionsBase<Readonly<ExtractPropTypes<{
|
|
75
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
70
76
|
default: string;
|
|
71
77
|
};
|
|
72
|
-
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
78
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
73
79
|
default: string;
|
|
74
80
|
};
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
82
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
83
|
+
onCallback: import("vue-types").VueTypeValidableDef<(data: {
|
|
77
84
|
code: string;
|
|
78
|
-
}) =>
|
|
79
|
-
onRejectCallback?: ((_data: any) => any) | undefined;
|
|
80
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
81
|
-
callback: (_data: {
|
|
85
|
+
}) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(data: {
|
|
82
86
|
code: string;
|
|
83
|
-
}) =>
|
|
84
|
-
|
|
85
|
-
}, string, {
|
|
87
|
+
}) => void>>;
|
|
88
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<(error: any) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(error: any) => void>>;
|
|
89
|
+
}>> & Readonly<{}>, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
86
90
|
clientId: string;
|
|
87
91
|
redirectUri: string;
|
|
88
92
|
}, {}, string, SlotsType<{
|
|
89
93
|
default: {
|
|
90
94
|
startCheck: () => void;
|
|
91
95
|
};
|
|
92
|
-
}
|
|
96
|
+
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
93
97
|
readonly toGoogleAuth: typeof toGoogleAuth;
|
|
94
|
-
} & import("vue").Plugin
|
|
98
|
+
} & import("vue").Plugin;
|
|
95
99
|
export default GoogleAuth;
|
|
@@ -1,71 +1,91 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { isEdgeBrowser as w, isInMobileBrowser as _ } from "../utils/is.js";
|
|
1
|
+
import { defineComponent as m, computed as g, onMounted as C, createVNode as h } from "vue";
|
|
2
|
+
import { isInMobileBrowser as u } from "../utils/is.js";
|
|
4
3
|
import "../utils/math.js";
|
|
4
|
+
import { propTypes as r } from "../utils/vuePropTypes.js";
|
|
5
5
|
import { withInstall as b } from "../utils/withInstall.js";
|
|
6
|
-
function
|
|
7
|
-
if (!o || !
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
w() ? window.open(n, "_self") : window.location.href = n;
|
|
6
|
+
function d(o, c) {
|
|
7
|
+
if (!o || !c) return;
|
|
8
|
+
const l = encodeURIComponent(c), s = encodeURIComponent("email profile"), n = encodeURIComponent(o), a = `https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=${l}&scope=${s}&client_id=${n}`;
|
|
9
|
+
window.location.href = a;
|
|
11
10
|
}
|
|
12
|
-
const
|
|
11
|
+
const _ = {
|
|
12
|
+
clientId: r.string,
|
|
13
|
+
redirectUri: r.string,
|
|
14
|
+
defaultLoad: r.bool,
|
|
15
|
+
getPopupContainer: r.funcType(),
|
|
16
|
+
onCallback: r.funcType(),
|
|
17
|
+
onRejectCallback: r.funcType()
|
|
18
|
+
}, w = /* @__PURE__ */ m({
|
|
13
19
|
name: "GoogleAuth",
|
|
14
|
-
toGoogleAuth:
|
|
15
|
-
props:
|
|
16
|
-
clientId: f.string,
|
|
17
|
-
redirectUri: f.string
|
|
18
|
-
},
|
|
19
|
-
emits: {
|
|
20
|
-
callback: (o) => !0,
|
|
21
|
-
rejectCallback: (o) => !0
|
|
22
|
-
},
|
|
20
|
+
toGoogleAuth: d,
|
|
21
|
+
props: _,
|
|
23
22
|
slots: Object,
|
|
24
23
|
setup(o, {
|
|
25
|
-
emit: r,
|
|
26
24
|
slots: c,
|
|
27
|
-
expose:
|
|
25
|
+
expose: l
|
|
28
26
|
}) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
const s = g(() => ({
|
|
28
|
+
id: o.clientId,
|
|
29
|
+
uri: o.redirectUri
|
|
30
|
+
}));
|
|
31
|
+
function n() {
|
|
32
|
+
return window?.google?.accounts?.oauth2?.initCodeClient;
|
|
33
|
+
}
|
|
34
|
+
function a() {
|
|
35
|
+
return o.getPopupContainer?.() || document.body;
|
|
36
|
+
}
|
|
37
|
+
function p() {
|
|
38
|
+
return new Promise((t) => {
|
|
39
|
+
if (!document) {
|
|
40
|
+
t(!1);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (u() || n()) {
|
|
44
|
+
t(!0);
|
|
45
|
+
return;
|
|
42
46
|
}
|
|
43
|
-
|
|
47
|
+
const e = document.createElement("script");
|
|
48
|
+
e.async = !0, e.defer = !0, e.src = "https://accounts.google.com/gsi/client", a()?.appendChild?.(e), e.onload = () => {
|
|
49
|
+
t(!!n());
|
|
50
|
+
}, e.onerror = () => {
|
|
51
|
+
e.remove(), t(!1);
|
|
52
|
+
};
|
|
53
|
+
});
|
|
44
54
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
async function f() {
|
|
56
|
+
const {
|
|
57
|
+
id: t,
|
|
58
|
+
uri: e
|
|
59
|
+
} = s.value;
|
|
60
|
+
if (!u() && !await p()) {
|
|
61
|
+
d(t || "", e || "");
|
|
48
62
|
return;
|
|
49
63
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
64
|
+
if (u() || !n()) {
|
|
65
|
+
d(t || "", e || "");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
n()?.({
|
|
69
|
+
client_id: t,
|
|
70
|
+
scope: "email profile",
|
|
71
|
+
redirect_uri: e,
|
|
72
|
+
ux_mode: u() ? "redirect" : "popup",
|
|
73
|
+
callback(i) {
|
|
74
|
+
i?.error ? o.onRejectCallback?.(i.error) : o.onCallback?.(i);
|
|
75
|
+
}
|
|
76
|
+
})?.requestCode?.();
|
|
54
77
|
}
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
}), (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
startCheck: d
|
|
63
|
-
}))]);
|
|
64
|
-
};
|
|
78
|
+
return C(() => {
|
|
79
|
+
o.defaultLoad && p();
|
|
80
|
+
}), l({
|
|
81
|
+
startCheck: f
|
|
82
|
+
}), () => h("div", null, [c.default?.({
|
|
83
|
+
startCheck: f
|
|
84
|
+
})]);
|
|
65
85
|
}
|
|
66
|
-
}),
|
|
86
|
+
}), T = b(w);
|
|
67
87
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
T as GoogleAuth,
|
|
89
|
+
T as default,
|
|
90
|
+
d as toGoogleAuth
|
|
71
91
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SlotsType, ExtractPropTypes } from 'vue';
|
|
2
|
+
/** 跳转Telegram身份检查 */
|
|
3
|
+
export declare function toTelegramAuth(botId: number, toPath: string): void;
|
|
4
|
+
/** 获取路由中的Telegram身份检查回调参数 */
|
|
5
|
+
export declare function getTelegramAuthUrlParams(): TgUserData | null;
|
|
2
6
|
/** tg用户信息 */
|
|
3
|
-
export
|
|
7
|
+
export interface TgUserData {
|
|
4
8
|
auth_date: number;
|
|
5
9
|
first_name: string;
|
|
6
10
|
hash: string;
|
|
@@ -8,89 +12,85 @@ export type TgUserData = {
|
|
|
8
12
|
last_name: string;
|
|
9
13
|
photo_url: string;
|
|
10
14
|
username: string;
|
|
15
|
+
}
|
|
16
|
+
declare const _comp_props: {
|
|
17
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<number>> & {
|
|
18
|
+
default: number;
|
|
19
|
+
};
|
|
20
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
24
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
25
|
+
onCallback: import("vue-types").VueTypeValidableDef<(user: TgUserData) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(user: TgUserData) => void>>;
|
|
26
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<() => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => void>>;
|
|
11
27
|
};
|
|
12
|
-
|
|
13
|
-
export declare function toTelegramAuth(botId: number, toPath: string): void;
|
|
14
|
-
/** 获取路由中的Telegram身份检查回调参数 */
|
|
15
|
-
export declare function getTelegramAuthUrlParams(): TgUserData | null;
|
|
28
|
+
export type TelegramAuthProps = ExtractPropTypes<typeof _comp_props>;
|
|
16
29
|
/** Telegram身份检查 */
|
|
17
30
|
export declare const TelegramAuth: {
|
|
18
|
-
new (...args: any[]): import("vue").
|
|
19
|
-
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").
|
|
20
|
-
default: number;
|
|
21
|
-
};
|
|
22
|
-
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
23
|
-
default: string;
|
|
24
|
-
};
|
|
25
|
-
}>> & {
|
|
26
|
-
onCallback?: ((_user: TgUserData) => any) | undefined;
|
|
27
|
-
onRejectCallback?: (() => any) | undefined;
|
|
28
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
callback: (_user: TgUserData) => true;
|
|
30
|
-
rejectCallback: () => true;
|
|
31
|
-
}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
-
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").ValidatorFunction<number>> & {
|
|
31
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ExtractPropTypes<{
|
|
32
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<number>> & {
|
|
33
33
|
default: number;
|
|
34
34
|
};
|
|
35
|
-
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
35
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
36
36
|
default: string;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
39
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
40
|
+
onCallback: import("vue-types").VueTypeValidableDef<(user: TgUserData) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(user: TgUserData) => void>>;
|
|
41
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<() => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => void>>;
|
|
42
|
+
}>> & Readonly<{}>, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
42
43
|
botId: number;
|
|
43
44
|
toPath: string;
|
|
44
45
|
}, true, {}, SlotsType<{
|
|
45
46
|
default: {
|
|
46
47
|
startCheck: () => void;
|
|
47
48
|
};
|
|
48
|
-
}>, {
|
|
49
|
+
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
49
50
|
P: {};
|
|
50
51
|
B: {};
|
|
51
52
|
D: {};
|
|
52
53
|
C: {};
|
|
53
54
|
M: {};
|
|
54
55
|
Defaults: {};
|
|
55
|
-
}, Readonly<
|
|
56
|
-
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").
|
|
56
|
+
}, Readonly<ExtractPropTypes<{
|
|
57
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<number>> & {
|
|
57
58
|
default: number;
|
|
58
59
|
};
|
|
59
|
-
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
60
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
60
61
|
default: string;
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
64
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
65
|
+
onCallback: import("vue-types").VueTypeValidableDef<(user: TgUserData) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(user: TgUserData) => void>>;
|
|
66
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<() => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => void>>;
|
|
67
|
+
}>> & Readonly<{}>, () => JSX.Element, {}, {}, {}, {
|
|
66
68
|
botId: number;
|
|
67
69
|
toPath: string;
|
|
68
70
|
}>;
|
|
69
|
-
__isFragment?:
|
|
70
|
-
__isTeleport?:
|
|
71
|
-
__isSuspense?:
|
|
72
|
-
} & import("vue").ComponentOptionsBase<Readonly<
|
|
73
|
-
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").
|
|
71
|
+
__isFragment?: never;
|
|
72
|
+
__isTeleport?: never;
|
|
73
|
+
__isSuspense?: never;
|
|
74
|
+
} & import("vue").ComponentOptionsBase<Readonly<ExtractPropTypes<{
|
|
75
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<number>> & {
|
|
74
76
|
default: number;
|
|
75
77
|
};
|
|
76
|
-
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").
|
|
78
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<string>> & {
|
|
77
79
|
default: string;
|
|
78
80
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
rejectCallback: () => true;
|
|
85
|
-
}, string, {
|
|
81
|
+
defaultLoad: import("vue-types").VueTypeValidableDef<boolean, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<boolean>>;
|
|
82
|
+
getPopupContainer: import("vue-types").VueTypeValidableDef<() => HTMLElement | Element, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => HTMLElement | Element>>;
|
|
83
|
+
onCallback: import("vue-types").VueTypeValidableDef<(user: TgUserData) => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<(user: TgUserData) => void>>;
|
|
84
|
+
onRejectCallback: import("vue-types").VueTypeValidableDef<() => void, import("node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs").b<() => void>>;
|
|
85
|
+
}>> & Readonly<{}>, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
86
86
|
botId: number;
|
|
87
87
|
toPath: string;
|
|
88
88
|
}, {}, string, SlotsType<{
|
|
89
89
|
default: {
|
|
90
90
|
startCheck: () => void;
|
|
91
91
|
};
|
|
92
|
-
}
|
|
92
|
+
}>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
93
93
|
readonly toTelegramAuth: typeof toTelegramAuth;
|
|
94
94
|
readonly getTelegramAuthUrlParams: typeof getTelegramAuthUrlParams;
|
|
95
|
-
} & import("vue").Plugin
|
|
95
|
+
} & import("vue").Plugin;
|
|
96
96
|
export default TelegramAuth;
|