jk-vue-comps 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jk-vue-comps",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "jk-vue-comps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,13 +0,0 @@
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
- };
@@ -1,157 +0,0 @@
1
- import { nextTick as p, createVNode as h } from "vue";
2
- import { isString as u, isHtmlStr as l, isObject as f, isNumber as c, is as w, isArray as N, isBoolean as S, isClient as b, isDate as x, isDef as O, isEdgeBrowser as $, isElement as P, isEmail as T, isEmpty as v, isFunction as y, isInMobileBrowser as E, isIp as B, isMap as I, isNull as L, isNullAndUnDef as U, isNullOrUnDef as D, isPromise as q, isPromiseLink as F, isRegExp as M, isServer as R, isUnDef as k, isUrl as W, isValidPhoneNumber as _, isWindow as j, isZhLang as z } from "../utils/is.js";
3
- import { BigNumber as H, DOWN as V, UP as A, add as G, divide as Z, formatRate as C, helper as J, isBigNum as K, isBool as Q, isEqualTo as X, isGreaterThan as Y, isGreaterThanOrEqualTo as ee, isInt as ie, isLessThan as te, isLessThanOrEqualTo as re, isNanValue as ne, isNum as se, multiply as oe, power as ue, subtract as ae, toBigNum as le, toDecimalPlaces as fe, toInt as ce, toLocaleString as me, toNum as ge, toString as de, unFormatRate as pe } from "../utils/math.js";
4
- import { propTypes as he } from "../utils/vuePropTypes.js";
5
- import { timeZoneOptions as we } from "../utils/timeZone.js";
6
- import { withInstall as Ne } from "../utils/withInstall.js";
7
- function a(i) {
8
- try {
9
- return new Function(`'use strict'; return (${i});`)();
10
- } catch {
11
- return null;
12
- }
13
- }
14
- function m(i, r = "float", t = 6) {
15
- let e = String(i);
16
- if (e = e.replace(/(^\s*)|(\s*$)/g, ""), e !== "") {
17
- const s = e.indexOf("0") === 0 && e.length > 1 && e.indexOf(".") !== 1, n = r === "int" ? /[^\d]/g : /[^\d.]/g;
18
- if (e = e.replace(n, ""), s)
19
- return "0";
20
- if (r === "int")
21
- e = e.indexOf("0") === 0 && e.length > 1 ? e.substring(0, e.length - 1) : e;
22
- else {
23
- const o = a(`/\\.{${t},}/g`), d = a(`/^(\\d?)+(\\.\\d{0,${t}})?$/`);
24
- e.indexOf(".") === 0 ? (e = "", e = e.replace(/[^$#$]/g, "0."), e = e.replace(o, ".")) : d.test(e) || (e = e.substring(0, e.length - 1));
25
- }
26
- }
27
- return e;
28
- }
29
- function Se(i, r, t, e = "int", s = 6) {
30
- return (n) => {
31
- p().then(() => {
32
- var o;
33
- i[r] = m((o = n == null ? void 0 : n.target) == null ? void 0 : o.value, e, s), t == null || t();
34
- });
35
- };
36
- }
37
- function be(i) {
38
- return !u(i) || !l(i) ? i : h("div", { innerHTML: i });
39
- }
40
- function xe() {
41
- return window ? `${window.location.protocol}//${window.location.hostname}` : "";
42
- }
43
- function Oe() {
44
- const i = new URLSearchParams(window.location.search);
45
- if (!i.size)
46
- return;
47
- const r = {};
48
- for (const [t, e] of i.entries())
49
- r[t] = e;
50
- return r;
51
- }
52
- function $e(i) {
53
- return u(i) ? i.replace(/\s+/g, "") : "";
54
- }
55
- function g(i = {}, r = {}) {
56
- let t;
57
- for (t in r)
58
- i[t] = f(i[t]) ? g(i[t], r[t]) : i[t] = r[t];
59
- return i;
60
- }
61
- function Pe(i, r = 6, t = {
62
- showPrefix: !0,
63
- showSuffix: !0,
64
- middleStr: "****"
65
- }) {
66
- if (!u(i) && !c(i))
67
- return i;
68
- const e = String(i), s = (e == null ? void 0 : e.length) ?? 0;
69
- if (!e || !s || r <= 0)
70
- return e;
71
- const n = t.showPrefix ? e.substring(0, r) : "", o = t.showSuffix ? e.substring(s - r) : "";
72
- return `${n}${t.middleStr}${o}`;
73
- }
74
- const Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
75
- __proto__: null,
76
- BigNumber: H,
77
- DOWN: V,
78
- UP: A,
79
- add: G,
80
- deepMerge: g,
81
- desensitization: Pe,
82
- divide: Z,
83
- evalPro: a,
84
- filterInputNum: m,
85
- formatRate: C,
86
- generateFilterInputNumFn: Se,
87
- getRouterParams: Oe,
88
- getWebsiteUrl: xe,
89
- helper: J,
90
- is: w,
91
- isArray: N,
92
- isBigNum: K,
93
- isBool: Q,
94
- isBoolean: S,
95
- isClient: b,
96
- isDate: x,
97
- isDef: O,
98
- isEdgeBrowser: $,
99
- isElement: P,
100
- isEmail: T,
101
- isEmpty: v,
102
- isEqualTo: X,
103
- isFunction: y,
104
- isGreaterThan: Y,
105
- isGreaterThanOrEqualTo: ee,
106
- isHtmlStr: l,
107
- isInMobileBrowser: E,
108
- isInt: ie,
109
- isIp: B,
110
- isLessThan: te,
111
- isLessThanOrEqualTo: re,
112
- isMap: I,
113
- isNanValue: ne,
114
- isNull: L,
115
- isNullAndUnDef: U,
116
- isNullOrUnDef: D,
117
- isNum: se,
118
- isNumber: c,
119
- isObject: f,
120
- isPromise: q,
121
- isPromiseLink: F,
122
- isRegExp: M,
123
- isServer: R,
124
- isString: u,
125
- isUnDef: k,
126
- isUrl: W,
127
- isValidPhoneNumber: _,
128
- isWindow: j,
129
- isZhLang: z,
130
- multiply: oe,
131
- power: ue,
132
- propTypes: he,
133
- removeWhitespace: $e,
134
- renderHtmlStr: be,
135
- subtract: ae,
136
- timeZoneOptions: we,
137
- toBigNum: le,
138
- toDecimalPlaces: fe,
139
- toInt: ce,
140
- toLocaleString: me,
141
- toNum: ge,
142
- toString: de,
143
- unFormatRate: pe,
144
- withInstall: Ne
145
- }, Symbol.toStringTag, { value: "Module" }));
146
- export {
147
- xe as a,
148
- Oe as b,
149
- $e as c,
150
- g as d,
151
- a as e,
152
- m as f,
153
- Se as g,
154
- Pe as h,
155
- be as r,
156
- Le as u
157
- };
@@ -1,95 +0,0 @@
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;
@@ -1,71 +0,0 @@
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
- };
@@ -1,96 +0,0 @@
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;
@@ -1,91 +0,0 @@
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-aaoImdl9.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
- };
@@ -1,2 +0,0 @@
1
- export * from './GoogleAuth';
2
- export * from './TelegramAuth';
@@ -1,9 +0,0 @@
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
- };