jk-vue-comps 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/index-BXoUaF-m.js +13 -0
- package/dist/chunks/index-ChgNR2U8.js +171 -0
- package/dist/chunks/index-DyiqKziC.js +13 -0
- package/dist/components/GoogleAuth.d.ts +95 -0
- package/dist/components/GoogleAuth.js +71 -0
- package/dist/components/TelegramAuth.d.ts +96 -0
- package/dist/components/TelegramAuth.js +91 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +9 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useCopyToClipboard.d.ts +8 -0
- package/dist/hooks/useCopyToClipboard.js +26 -0
- package/dist/hooks/useFormKeypressEnter.d.ts +2 -0
- package/dist/hooks/useFormKeypressEnter.js +10 -0
- package/dist/hooks/useMemo.d.ts +2 -0
- package/dist/hooks/useMemo.js +10 -0
- package/dist/index.d.ts +271 -0
- package/dist/index.js +105 -0
- package/dist/utils/index.d.ts +54 -0
- package/dist/utils/index.js +80 -0
- package/dist/utils/is.d.ts +59 -0
- package/dist/utils/is.js +120 -0
- package/dist/utils/math.d.ts +107 -0
- package/dist/utils/math.js +821 -0
- package/dist/utils/timeZone.d.ts +9 -0
- package/dist/utils/timeZone.js +839 -0
- package/dist/utils/vuePropTypes.d.ts +65 -0
- package/dist/utils/vuePropTypes.js +29 -0
- package/dist/utils/withInstall.d.ts +3 -0
- package/dist/utils/withInstall.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { copyTextToClipboard as o, useCopyToClipboard as e } from "../hooks/useCopyToClipboard.js";
|
|
2
|
+
import { useFormKeypressEnter as r } from "../hooks/useFormKeypressEnter.js";
|
|
3
|
+
import { useMemo as t } from "../hooks/useMemo.js";
|
|
4
|
+
const i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
|
+
__proto__: null,
|
|
6
|
+
copyTextToClipboard: o,
|
|
7
|
+
useCopyToClipboard: e,
|
|
8
|
+
useFormKeypressEnter: r,
|
|
9
|
+
useMemo: t
|
|
10
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
11
|
+
export {
|
|
12
|
+
i as H
|
|
13
|
+
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { nextTick as N, createVNode as S } from "vue";
|
|
2
|
+
import { isString as l, isHtmlStr as p, isObject as f, isNumber as m, is as $, isArray as b, isBoolean as O, isClient as v, isDate as T, isDef as U, isEdgeBrowser as x, isElement as y, isEmail as P, isEmpty as E, isFunction as B, isInMobileBrowser as I, isIp as L, isMap as D, isNull as k, isNullAndUnDef as q, isNullOrUnDef as F, isPromise as M, isPromiseLink as R, isRegExp as _, isServer as W, isUnDef as j, isUrl as z, isValidPhoneNumber as H, isWindow as V, isZhLang as A } from "../utils/is.js";
|
|
3
|
+
import { isNanValue as g, toNum as d, BigNumber as C, DOWN as G, UP as Z, add as J, divide as K, formatRate as Q, helper as X, isBigNum as Y, isBool as ee, isEqualTo as te, isGreaterThan as ie, isGreaterThanOrEqualTo as ne, isInt as re, isLessThan as oe, isLessThanOrEqualTo as se, isNum as ue, multiply as ae, power as le, subtract as ce, toBigNum as fe, toDecimalPlaces as pe, toInt as me, toLocaleString as ge, toString as de, unFormatRate as he } from "../utils/math.js";
|
|
4
|
+
import { propTypes as we } from "../utils/vuePropTypes.js";
|
|
5
|
+
import { timeZoneOptions as Ne } from "../utils/timeZone.js";
|
|
6
|
+
import { withInstall as Se } from "../utils/withInstall.js";
|
|
7
|
+
function c(e) {
|
|
8
|
+
try {
|
|
9
|
+
return new Function(`'use strict'; return (${e});`)();
|
|
10
|
+
} catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function h(e, i = "float", n = 6) {
|
|
15
|
+
let t = String(e);
|
|
16
|
+
if (t = t.replace(/(^\s*)|(\s*$)/g, ""), t !== "") {
|
|
17
|
+
const s = t.indexOf("0") === 0 && t.length > 1 && t.indexOf(".") !== 1, r = i === "int" ? /[^\d]/g : /[^\d.]/g;
|
|
18
|
+
if (t = t.replace(r, ""), s)
|
|
19
|
+
return "0";
|
|
20
|
+
if (i === "int")
|
|
21
|
+
t = t.indexOf("0") === 0 && t.length > 1 ? t.substring(0, t.length - 1) : t;
|
|
22
|
+
else {
|
|
23
|
+
const o = c(`/\\.{${n},}/g`), u = c(`/^(\\d?)+(\\.\\d{0,${n}})?$/`);
|
|
24
|
+
t.indexOf(".") === 0 ? (t = "", t = t.replace(/[^$#$]/g, "0."), t = t.replace(o, ".")) : u.test(t) || (t = t.substring(0, t.length - 1));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
function $e(e, i, n, t = "int", s = 6) {
|
|
30
|
+
return (r) => {
|
|
31
|
+
N().then(() => {
|
|
32
|
+
var o;
|
|
33
|
+
e[i] = h((o = r == null ? void 0 : r.target) == null ? void 0 : o.value, t, s), n == null || n();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function be(e) {
|
|
38
|
+
return !l(e) || !p(e) ? e : S("div", { innerHTML: e });
|
|
39
|
+
}
|
|
40
|
+
function Oe() {
|
|
41
|
+
return window ? `${window.location.protocol}//${window.location.hostname}` : "";
|
|
42
|
+
}
|
|
43
|
+
function ve() {
|
|
44
|
+
const e = new URLSearchParams(window.location.search);
|
|
45
|
+
if (!e.size)
|
|
46
|
+
return;
|
|
47
|
+
const i = {};
|
|
48
|
+
for (const [n, t] of e.entries())
|
|
49
|
+
i[n] = t;
|
|
50
|
+
return i;
|
|
51
|
+
}
|
|
52
|
+
function Te(e) {
|
|
53
|
+
return l(e) ? e.replace(/\s+/g, "") : "";
|
|
54
|
+
}
|
|
55
|
+
function w(e = {}, i = {}) {
|
|
56
|
+
let n;
|
|
57
|
+
for (n in i)
|
|
58
|
+
e[n] = f(e[n]) ? w(e[n], i[n]) : e[n] = i[n];
|
|
59
|
+
return e;
|
|
60
|
+
}
|
|
61
|
+
function Ue(e, i = 6, { showPrefix: n = !0, showSuffix: t = !0, middleStr: s = "****" } = {}) {
|
|
62
|
+
if (!l(e) && !m(e))
|
|
63
|
+
return e;
|
|
64
|
+
const r = String(e), o = (r == null ? void 0 : r.length) ?? 0;
|
|
65
|
+
if (!r || !o || i <= 0)
|
|
66
|
+
return r;
|
|
67
|
+
const u = n ? r.substring(0, i) : "", a = t ? r.substring(o - i) : "";
|
|
68
|
+
return `${u}${s}${a}`;
|
|
69
|
+
}
|
|
70
|
+
function xe(e, i = "px") {
|
|
71
|
+
if (!(e === null || e === "" || e === void 0))
|
|
72
|
+
return g(e) ? String(e) : `${d(e)}${i}`;
|
|
73
|
+
}
|
|
74
|
+
function ye(e) {
|
|
75
|
+
return e ? f(e) ? e : e.split(";").reduce((i, n) => {
|
|
76
|
+
const [t, s] = n.trim().split(":");
|
|
77
|
+
if (t) {
|
|
78
|
+
const o = t.trim().replace(/-(\w)/g, (u, a) => a ? a.toUpperCase() : "");
|
|
79
|
+
i[o] = s.trim();
|
|
80
|
+
}
|
|
81
|
+
return i;
|
|
82
|
+
}, {}) : {};
|
|
83
|
+
}
|
|
84
|
+
const ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
85
|
+
__proto__: null,
|
|
86
|
+
BigNumber: C,
|
|
87
|
+
DOWN: G,
|
|
88
|
+
UP: Z,
|
|
89
|
+
add: J,
|
|
90
|
+
deepMerge: w,
|
|
91
|
+
desensitization: Ue,
|
|
92
|
+
divide: K,
|
|
93
|
+
evalPro: c,
|
|
94
|
+
filterInputNum: h,
|
|
95
|
+
formatRate: Q,
|
|
96
|
+
generateFilterInputNumFn: $e,
|
|
97
|
+
getRouterParams: ve,
|
|
98
|
+
getWebsiteUrl: Oe,
|
|
99
|
+
helper: X,
|
|
100
|
+
is: $,
|
|
101
|
+
isArray: b,
|
|
102
|
+
isBigNum: Y,
|
|
103
|
+
isBool: ee,
|
|
104
|
+
isBoolean: O,
|
|
105
|
+
isClient: v,
|
|
106
|
+
isDate: T,
|
|
107
|
+
isDef: U,
|
|
108
|
+
isEdgeBrowser: x,
|
|
109
|
+
isElement: y,
|
|
110
|
+
isEmail: P,
|
|
111
|
+
isEmpty: E,
|
|
112
|
+
isEqualTo: te,
|
|
113
|
+
isFunction: B,
|
|
114
|
+
isGreaterThan: ie,
|
|
115
|
+
isGreaterThanOrEqualTo: ne,
|
|
116
|
+
isHtmlStr: p,
|
|
117
|
+
isInMobileBrowser: I,
|
|
118
|
+
isInt: re,
|
|
119
|
+
isIp: L,
|
|
120
|
+
isLessThan: oe,
|
|
121
|
+
isLessThanOrEqualTo: se,
|
|
122
|
+
isMap: D,
|
|
123
|
+
isNanValue: g,
|
|
124
|
+
isNull: k,
|
|
125
|
+
isNullAndUnDef: q,
|
|
126
|
+
isNullOrUnDef: F,
|
|
127
|
+
isNum: ue,
|
|
128
|
+
isNumber: m,
|
|
129
|
+
isObject: f,
|
|
130
|
+
isPromise: M,
|
|
131
|
+
isPromiseLink: R,
|
|
132
|
+
isRegExp: _,
|
|
133
|
+
isServer: W,
|
|
134
|
+
isString: l,
|
|
135
|
+
isUnDef: j,
|
|
136
|
+
isUrl: z,
|
|
137
|
+
isValidPhoneNumber: H,
|
|
138
|
+
isWindow: V,
|
|
139
|
+
isZhLang: A,
|
|
140
|
+
multiply: ae,
|
|
141
|
+
power: le,
|
|
142
|
+
propTypes: we,
|
|
143
|
+
removeWhitespace: Te,
|
|
144
|
+
renderHtmlStr: be,
|
|
145
|
+
subtract: ce,
|
|
146
|
+
timeZoneOptions: Ne,
|
|
147
|
+
toBigNum: fe,
|
|
148
|
+
toDecimalPlaces: pe,
|
|
149
|
+
toInt: me,
|
|
150
|
+
toLocaleString: ge,
|
|
151
|
+
toNum: d,
|
|
152
|
+
toString: de,
|
|
153
|
+
toStyleObject: ye,
|
|
154
|
+
toStyleUnit: xe,
|
|
155
|
+
unFormatRate: he,
|
|
156
|
+
withInstall: Se
|
|
157
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
158
|
+
export {
|
|
159
|
+
ke as U,
|
|
160
|
+
Oe as a,
|
|
161
|
+
ve as b,
|
|
162
|
+
Te as c,
|
|
163
|
+
w as d,
|
|
164
|
+
c as e,
|
|
165
|
+
h as f,
|
|
166
|
+
$e as g,
|
|
167
|
+
Ue as h,
|
|
168
|
+
ye as i,
|
|
169
|
+
be as r,
|
|
170
|
+
xe as t
|
|
171
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GoogleAuth as e, toGoogleAuth as o } from "../components/GoogleAuth.js";
|
|
2
|
+
import { TelegramAuth as t, getTelegramAuthUrlParams as r, toTelegramAuth as l } from "../components/TelegramAuth.js";
|
|
3
|
+
const g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4
|
+
__proto__: null,
|
|
5
|
+
GoogleAuth: e,
|
|
6
|
+
TelegramAuth: t,
|
|
7
|
+
getTelegramAuthUrlParams: r,
|
|
8
|
+
toGoogleAuth: o,
|
|
9
|
+
toTelegramAuth: l
|
|
10
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
11
|
+
export {
|
|
12
|
+
g as C
|
|
13
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type SlotsType } from 'vue';
|
|
2
|
+
/** 跳转谷歌身份检查 */
|
|
3
|
+
export declare function toGoogleAuth(clientId: string, redirectUri: string): void;
|
|
4
|
+
/** 谷歌身份检查 */
|
|
5
|
+
export declare const GoogleAuth: {
|
|
6
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
}>> & {
|
|
14
|
+
onCallback?: ((_data: {
|
|
15
|
+
code: string;
|
|
16
|
+
}) => any) | undefined;
|
|
17
|
+
onRejectCallback?: ((_data: any) => any) | undefined;
|
|
18
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
callback: (_data: {
|
|
20
|
+
code: string;
|
|
21
|
+
}) => true;
|
|
22
|
+
rejectCallback: (_data: any) => true;
|
|
23
|
+
}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
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
|
+
clientId: string;
|
|
37
|
+
redirectUri: string;
|
|
38
|
+
}, true, {}, SlotsType<{
|
|
39
|
+
default: {
|
|
40
|
+
startCheck: () => void;
|
|
41
|
+
};
|
|
42
|
+
}>, {
|
|
43
|
+
P: {};
|
|
44
|
+
B: {};
|
|
45
|
+
D: {};
|
|
46
|
+
C: {};
|
|
47
|
+
M: {};
|
|
48
|
+
Defaults: {};
|
|
49
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
50
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
51
|
+
default: string;
|
|
52
|
+
};
|
|
53
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
}>> & {
|
|
57
|
+
onCallback?: ((_data: {
|
|
58
|
+
code: string;
|
|
59
|
+
}) => any) | undefined;
|
|
60
|
+
onRejectCallback?: ((_data: any) => any) | undefined;
|
|
61
|
+
}, () => JSX.Element, {}, {}, {}, {
|
|
62
|
+
clientId: string;
|
|
63
|
+
redirectUri: string;
|
|
64
|
+
}>;
|
|
65
|
+
__isFragment?: undefined;
|
|
66
|
+
__isTeleport?: undefined;
|
|
67
|
+
__isSuspense?: undefined;
|
|
68
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
clientId: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
70
|
+
default: string;
|
|
71
|
+
};
|
|
72
|
+
redirectUri: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
73
|
+
default: string;
|
|
74
|
+
};
|
|
75
|
+
}>> & {
|
|
76
|
+
onCallback?: ((_data: {
|
|
77
|
+
code: string;
|
|
78
|
+
}) => any) | undefined;
|
|
79
|
+
onRejectCallback?: ((_data: any) => any) | undefined;
|
|
80
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
81
|
+
callback: (_data: {
|
|
82
|
+
code: string;
|
|
83
|
+
}) => true;
|
|
84
|
+
rejectCallback: (_data: any) => true;
|
|
85
|
+
}, string, {
|
|
86
|
+
clientId: string;
|
|
87
|
+
redirectUri: string;
|
|
88
|
+
}, {}, string, SlotsType<{
|
|
89
|
+
default: {
|
|
90
|
+
startCheck: () => void;
|
|
91
|
+
};
|
|
92
|
+
}>> & (import("vue").VNodeProps & (import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & ({
|
|
93
|
+
readonly toGoogleAuth: typeof toGoogleAuth;
|
|
94
|
+
} & import("vue").Plugin)));
|
|
95
|
+
export default GoogleAuth;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineComponent as g, ref as p, onMounted as h, createVNode as C } from "vue";
|
|
2
|
+
import { propTypes as f } from "../utils/vuePropTypes.js";
|
|
3
|
+
import { isEdgeBrowser as w, isInMobileBrowser as _ } from "../utils/is.js";
|
|
4
|
+
import "../utils/math.js";
|
|
5
|
+
import { withInstall as b } from "../utils/withInstall.js";
|
|
6
|
+
function v(o, r) {
|
|
7
|
+
if (!o || !r)
|
|
8
|
+
return;
|
|
9
|
+
const c = encodeURIComponent(r), s = encodeURIComponent("email profile"), i = encodeURIComponent(o), n = `https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=${c}&scope=${s}&client_id=${i}`;
|
|
10
|
+
w() ? window.open(n, "_self") : window.location.href = n;
|
|
11
|
+
}
|
|
12
|
+
const I = /* @__PURE__ */ g({
|
|
13
|
+
name: "GoogleAuth",
|
|
14
|
+
toGoogleAuth: v,
|
|
15
|
+
props: {
|
|
16
|
+
clientId: f.string,
|
|
17
|
+
redirectUri: f.string
|
|
18
|
+
},
|
|
19
|
+
emits: {
|
|
20
|
+
callback: (o) => !0,
|
|
21
|
+
rejectCallback: (o) => !0
|
|
22
|
+
},
|
|
23
|
+
slots: Object,
|
|
24
|
+
setup(o, {
|
|
25
|
+
emit: r,
|
|
26
|
+
slots: c,
|
|
27
|
+
expose: s
|
|
28
|
+
}) {
|
|
29
|
+
const i = p(null), n = p(!0), u = () => {
|
|
30
|
+
var e, t, l;
|
|
31
|
+
return (l = (t = (e = window == null ? void 0 : window.google) == null ? void 0 : e.accounts) == null ? void 0 : t.oauth2) == null ? void 0 : l.initCodeClient;
|
|
32
|
+
};
|
|
33
|
+
function d() {
|
|
34
|
+
var e, t, l;
|
|
35
|
+
(l = (t = (e = u()) == null ? void 0 : e({
|
|
36
|
+
client_id: o.clientId,
|
|
37
|
+
scope: "email profile",
|
|
38
|
+
redirect_uri: o.redirectUri,
|
|
39
|
+
ux_mode: _() ? "redirect" : "popup",
|
|
40
|
+
callback(a) {
|
|
41
|
+
a.error ? r("rejectCallback", a) : r("callback", a);
|
|
42
|
+
}
|
|
43
|
+
})) == null ? void 0 : t.requestCode) == null || l.call(t);
|
|
44
|
+
}
|
|
45
|
+
function m() {
|
|
46
|
+
if (!(window != null && window.document) || u() || !i.value) {
|
|
47
|
+
u() && (n.value = !1);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const e = document.createElement("script");
|
|
51
|
+
e.async = !0, e.defer = !0, e.src = "https://accounts.google.com/gsi/client", i.value.appendChild(e), e.onload = () => {
|
|
52
|
+
u() && (n.value = !1);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return h(m), s({
|
|
56
|
+
startCheck: d
|
|
57
|
+
}), () => {
|
|
58
|
+
var e;
|
|
59
|
+
return C("div", {
|
|
60
|
+
ref: i
|
|
61
|
+
}, [!n.value && ((e = c.default) == null ? void 0 : e.call(c, {
|
|
62
|
+
startCheck: d
|
|
63
|
+
}))]);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}), j = b(I);
|
|
67
|
+
export {
|
|
68
|
+
j as GoogleAuth,
|
|
69
|
+
j as default,
|
|
70
|
+
v as toGoogleAuth
|
|
71
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type SlotsType } from 'vue';
|
|
2
|
+
/** tg用户信息 */
|
|
3
|
+
export type TgUserData = {
|
|
4
|
+
auth_date: number;
|
|
5
|
+
first_name: string;
|
|
6
|
+
hash: string;
|
|
7
|
+
id: number;
|
|
8
|
+
last_name: string;
|
|
9
|
+
photo_url: string;
|
|
10
|
+
username: string;
|
|
11
|
+
};
|
|
12
|
+
/** 跳转Telegram身份检查 */
|
|
13
|
+
export declare function toTelegramAuth(botId: number, toPath: string): void;
|
|
14
|
+
/** 获取路由中的Telegram身份检查回调参数 */
|
|
15
|
+
export declare function getTelegramAuthUrlParams(): TgUserData | null;
|
|
16
|
+
/** Telegram身份检查 */
|
|
17
|
+
export declare const TelegramAuth: {
|
|
18
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").ValidatorFunction<number>> & {
|
|
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>> & {
|
|
33
|
+
default: number;
|
|
34
|
+
};
|
|
35
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
}>> & {
|
|
39
|
+
onCallback?: ((_user: TgUserData) => any) | undefined;
|
|
40
|
+
onRejectCallback?: (() => any) | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
botId: number;
|
|
43
|
+
toPath: string;
|
|
44
|
+
}, true, {}, SlotsType<{
|
|
45
|
+
default: {
|
|
46
|
+
startCheck: () => void;
|
|
47
|
+
};
|
|
48
|
+
}>, {
|
|
49
|
+
P: {};
|
|
50
|
+
B: {};
|
|
51
|
+
D: {};
|
|
52
|
+
C: {};
|
|
53
|
+
M: {};
|
|
54
|
+
Defaults: {};
|
|
55
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
56
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").ValidatorFunction<number>> & {
|
|
57
|
+
default: number;
|
|
58
|
+
};
|
|
59
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
}>> & {
|
|
63
|
+
onCallback?: ((_user: TgUserData) => any) | undefined;
|
|
64
|
+
onRejectCallback?: (() => any) | undefined;
|
|
65
|
+
}, () => JSX.Element, {}, {}, {}, {
|
|
66
|
+
botId: number;
|
|
67
|
+
toPath: string;
|
|
68
|
+
}>;
|
|
69
|
+
__isFragment?: undefined;
|
|
70
|
+
__isTeleport?: undefined;
|
|
71
|
+
__isSuspense?: undefined;
|
|
72
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
73
|
+
botId: import("vue-types").VueTypeValidableDef<number, import("node_modules/vue-types/dist/types").ValidatorFunction<number>> & {
|
|
74
|
+
default: number;
|
|
75
|
+
};
|
|
76
|
+
toPath: import("vue-types").VueTypeValidableDef<string, import("node_modules/vue-types/dist/types").ValidatorFunction<string>> & {
|
|
77
|
+
default: string;
|
|
78
|
+
};
|
|
79
|
+
}>> & {
|
|
80
|
+
onCallback?: ((_user: TgUserData) => any) | undefined;
|
|
81
|
+
onRejectCallback?: (() => any) | undefined;
|
|
82
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
83
|
+
callback: (_user: TgUserData) => true;
|
|
84
|
+
rejectCallback: () => true;
|
|
85
|
+
}, string, {
|
|
86
|
+
botId: number;
|
|
87
|
+
toPath: string;
|
|
88
|
+
}, {}, string, SlotsType<{
|
|
89
|
+
default: {
|
|
90
|
+
startCheck: () => void;
|
|
91
|
+
};
|
|
92
|
+
}>> & (import("vue").VNodeProps & (import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & ({
|
|
93
|
+
readonly toTelegramAuth: typeof toTelegramAuth;
|
|
94
|
+
readonly getTelegramAuthUrlParams: typeof getTelegramAuthUrlParams;
|
|
95
|
+
} & import("vue").Plugin)));
|
|
96
|
+
export default TelegramAuth;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineComponent as h, ref as g, onMounted as w, createVNode as b } from "vue";
|
|
2
|
+
import { propTypes as m } from "../utils/vuePropTypes.js";
|
|
3
|
+
import { a as _ } from "../chunks/index-ChgNR2U8.js";
|
|
4
|
+
import { withInstall as A } from "../utils/withInstall.js";
|
|
5
|
+
import { isEdgeBrowser as C, isInMobileBrowser as p } from "../utils/is.js";
|
|
6
|
+
function d(r, o) {
|
|
7
|
+
if (!r || !o)
|
|
8
|
+
return;
|
|
9
|
+
const t = encodeURIComponent(_()), n = encodeURIComponent(o), a = `https://oauth.telegram.org/auth?bot_id=${r}&origin=${t}&embed=1&request_access=write&return_to=${t}${n}`;
|
|
10
|
+
C() ? window.open(a, "_self") : window.location.href = a;
|
|
11
|
+
}
|
|
12
|
+
function T() {
|
|
13
|
+
const r = /[#\?\&]tgAuthResult=([A-Za-z0-9\-_=]*)$/;
|
|
14
|
+
try {
|
|
15
|
+
const o = window.location.hash.toString(), t = o.match(r);
|
|
16
|
+
if (!t)
|
|
17
|
+
return null;
|
|
18
|
+
window.location.hash = o.replace(r, "");
|
|
19
|
+
let n = t[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
20
|
+
const a = n.length % 4;
|
|
21
|
+
return a > 1 && (n += new Array(5 - a).join("=")), n ? JSON.parse(window.atob(n)) : null;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const j = /* @__PURE__ */ h({
|
|
27
|
+
name: "TelegramAuth",
|
|
28
|
+
toTelegramAuth: d,
|
|
29
|
+
getTelegramAuthUrlParams: T,
|
|
30
|
+
props: {
|
|
31
|
+
botId: m.number,
|
|
32
|
+
toPath: m.string
|
|
33
|
+
},
|
|
34
|
+
emits: {
|
|
35
|
+
callback: (r) => !0,
|
|
36
|
+
rejectCallback: () => !0
|
|
37
|
+
},
|
|
38
|
+
slots: Object,
|
|
39
|
+
setup(r, {
|
|
40
|
+
emit: o,
|
|
41
|
+
slots: t,
|
|
42
|
+
expose: n
|
|
43
|
+
}) {
|
|
44
|
+
const a = g(null), l = () => {
|
|
45
|
+
var e, c;
|
|
46
|
+
return (c = (e = window == null ? void 0 : window.Telegram) == null ? void 0 : e.Login) == null ? void 0 : c.auth;
|
|
47
|
+
};
|
|
48
|
+
function s() {
|
|
49
|
+
const {
|
|
50
|
+
botId: e,
|
|
51
|
+
toPath: c
|
|
52
|
+
} = r;
|
|
53
|
+
if (!e)
|
|
54
|
+
return;
|
|
55
|
+
const i = l();
|
|
56
|
+
if (p() || !i) {
|
|
57
|
+
d(e, c);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
i == null || i({
|
|
61
|
+
bot_id: e,
|
|
62
|
+
request_access: !0
|
|
63
|
+
}, (u) => {
|
|
64
|
+
u ? o("callback", u) : o("rejectCallback");
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function f() {
|
|
68
|
+
var c;
|
|
69
|
+
if (!(window != null && window.document) || l() || p())
|
|
70
|
+
return;
|
|
71
|
+
const e = document.createElement("script");
|
|
72
|
+
e.async = !0, e.defer = !0, e.src = "https://telegram.org/js/telegram-widget.js", (c = a.value) == null || c.appendChild(e);
|
|
73
|
+
}
|
|
74
|
+
return w(f), n({
|
|
75
|
+
startCheck: s
|
|
76
|
+
}), () => {
|
|
77
|
+
var e;
|
|
78
|
+
return b("div", {
|
|
79
|
+
ref: a
|
|
80
|
+
}, [(e = t.default) == null ? void 0 : e.call(t, {
|
|
81
|
+
startCheck: s
|
|
82
|
+
})]);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}), R = A(j);
|
|
86
|
+
export {
|
|
87
|
+
R as TelegramAuth,
|
|
88
|
+
R as default,
|
|
89
|
+
T as getTelegramAuthUrlParams,
|
|
90
|
+
d as toTelegramAuth
|
|
91
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GoogleAuth as t, toGoogleAuth as r } from "./GoogleAuth.js";
|
|
2
|
+
import { TelegramAuth as l, getTelegramAuthUrlParams as m, toTelegramAuth as a } from "./TelegramAuth.js";
|
|
3
|
+
export {
|
|
4
|
+
t as GoogleAuth,
|
|
5
|
+
l as TelegramAuth,
|
|
6
|
+
m as getTelegramAuthUrlParams,
|
|
7
|
+
r as toGoogleAuth,
|
|
8
|
+
a as toTelegramAuth
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { copyTextToClipboard as r, useCopyToClipboard as p } from "./useCopyToClipboard.js";
|
|
2
|
+
import { useFormKeypressEnter as s } from "./useFormKeypressEnter.js";
|
|
3
|
+
import { useMemo as x } from "./useMemo.js";
|
|
4
|
+
export {
|
|
5
|
+
r as copyTextToClipboard,
|
|
6
|
+
p as useCopyToClipboard,
|
|
7
|
+
s as useFormKeypressEnter,
|
|
8
|
+
x as useMemo
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function useCopyToClipboard(initial?: string): {
|
|
2
|
+
clipboardRef: import("vue").Ref<string>;
|
|
3
|
+
isSuccessRef: import("vue").Ref<boolean>;
|
|
4
|
+
copiedRef: import("vue").Ref<boolean>;
|
|
5
|
+
};
|
|
6
|
+
export declare function copyTextToClipboard(input: string, { target }?: {
|
|
7
|
+
target?: HTMLElement;
|
|
8
|
+
}): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ref as l, watch as i } from "vue";
|
|
2
|
+
import { isDef as u } from "../utils/is.js";
|
|
3
|
+
function p(o) {
|
|
4
|
+
const c = l(o || ""), e = l(!1), n = l(!1);
|
|
5
|
+
return i(c, (t) => {
|
|
6
|
+
u(t) && (n.value = !0, e.value = f(t));
|
|
7
|
+
}, { immediate: !!o, flush: "sync" }), { clipboardRef: c, isSuccessRef: e, copiedRef: n };
|
|
8
|
+
}
|
|
9
|
+
function f(o, { target: c = document.body } = {}) {
|
|
10
|
+
const e = document.createElement("textarea"), n = document.activeElement;
|
|
11
|
+
e.value = o, e.setAttribute("readonly", ""), e.style.contain = "strict", e.style.position = "absolute", e.style.left = "-9999px", e.style.fontSize = "12pt";
|
|
12
|
+
const t = document.getSelection();
|
|
13
|
+
let s;
|
|
14
|
+
t && t.rangeCount > 0 && (s = t.getRangeAt(0)), c.append(e), e.select(), e.selectionStart = 0, e.selectionEnd = o.length;
|
|
15
|
+
let r = !1;
|
|
16
|
+
try {
|
|
17
|
+
r = document.execCommand("copy");
|
|
18
|
+
} catch (a) {
|
|
19
|
+
throw new Error(a);
|
|
20
|
+
}
|
|
21
|
+
return e.remove(), s && t && (t.removeAllRanges(), t.addRange(s)), n && n.focus(), r;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
f as copyTextToClipboard,
|
|
25
|
+
p as useCopyToClipboard
|
|
26
|
+
};
|