@kevisual/kv-login 0.1.1 → 0.1.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/app.d.ts +60 -1
- package/dist/app.js +54 -70
- package/package.json +8 -10
- package/readme.md +3 -18
- package/src/main.ts +4 -1
- package/src/modules/login-handle.ts +268 -0
- package/src/modules/mitt.ts +134 -0
- package/src/modules/query.ts +10 -0
- package/src/modules/wx/load-js.ts +21 -0
- package/src/modules/wx/tencent-captcha.ts +70 -0
- package/src/modules/wx/ws-login.ts +61 -0
- package/src/modules/wx-mp/qr.ts +57 -0
- package/src/pages/kv-login.ts +577 -0
- package/src/pages/kv-message.ts +351 -0
package/dist/app.d.ts
CHANGED
|
@@ -1,4 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
interface EventData<T = any> {
|
|
2
|
+
type: string;
|
|
3
|
+
data: T;
|
|
4
|
+
}
|
|
5
|
+
type EventHandler<T = any> = (event: EventData<T>) => void;
|
|
6
|
+
declare class EventEmitter {
|
|
7
|
+
private events;
|
|
8
|
+
/**
|
|
9
|
+
* 监听事件
|
|
10
|
+
* @param type 事件类型
|
|
11
|
+
* @param handler 事件处理函数
|
|
12
|
+
*/
|
|
13
|
+
on<T = any>(type: string, handler: EventHandler<T>): void;
|
|
14
|
+
/**
|
|
15
|
+
* 移除事件监听器
|
|
16
|
+
* @param type 事件类型
|
|
17
|
+
* @param handler 事件处理函数 (可选,如果不提供则移除该类型的所有监听器)
|
|
18
|
+
*/
|
|
19
|
+
off<T = any>(type: string, handler?: EventHandler<T>): void;
|
|
20
|
+
/**
|
|
21
|
+
* 触发事件
|
|
22
|
+
* @param event 事件对象,包含 type 和 data
|
|
23
|
+
*/
|
|
24
|
+
emit<T = any>(event: EventData<T>): void;
|
|
25
|
+
/**
|
|
26
|
+
* 触发事件(简化版本,直接传递type和data)
|
|
27
|
+
* @param type 事件类型
|
|
28
|
+
* @param data 事件数据
|
|
29
|
+
*/
|
|
30
|
+
emitSimple<T = any>(type: string, data: T): void;
|
|
31
|
+
/**
|
|
32
|
+
* 清空所有事件监听器
|
|
33
|
+
*/
|
|
34
|
+
clear(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 获取指定类型的监听器数量
|
|
37
|
+
* @param type 事件类型
|
|
38
|
+
* @returns 监听器数量
|
|
39
|
+
*/
|
|
40
|
+
listenerCount(type: string): number;
|
|
41
|
+
/**
|
|
42
|
+
* 获取所有事件类型
|
|
43
|
+
* @returns 事件类型数组
|
|
44
|
+
*/
|
|
45
|
+
eventNames(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* 检查是否有指定类型的监听器
|
|
48
|
+
* @param type 事件类型
|
|
49
|
+
* @returns 是否有监听器
|
|
50
|
+
*/
|
|
51
|
+
hasListeners(type: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 只监听一次事件
|
|
54
|
+
* @param type 事件类型
|
|
55
|
+
* @param handler 事件处理函数
|
|
56
|
+
*/
|
|
57
|
+
once<T = any>(type: string, handler: EventHandler<T>): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const loginEmitter: EventEmitter;
|
|
2
61
|
|
|
3
62
|
interface KvMessageOptions {
|
|
4
63
|
type?: 'success' | 'error' | 'loading';
|
package/dist/app.js
CHANGED
|
@@ -16,14 +16,14 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
18
|
|
|
19
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
|
|
19
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/can-promise.js
|
|
20
20
|
var require_can_promise = __commonJS((exports, module) => {
|
|
21
21
|
module.exports = function() {
|
|
22
22
|
return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
|
|
26
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js
|
|
27
27
|
var require_utils = __commonJS((exports) => {
|
|
28
28
|
var toSJISFunction;
|
|
29
29
|
var CODEWORDS_COUNT = [
|
|
@@ -101,7 +101,7 @@ var require_utils = __commonJS((exports) => {
|
|
|
101
101
|
};
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
|
|
104
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-level.js
|
|
105
105
|
var require_error_correction_level = __commonJS((exports) => {
|
|
106
106
|
exports.L = { bit: 1 };
|
|
107
107
|
exports.M = { bit: 0 };
|
|
@@ -144,7 +144,7 @@ var require_error_correction_level = __commonJS((exports) => {
|
|
|
144
144
|
};
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
|
|
147
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-buffer.js
|
|
148
148
|
var require_bit_buffer = __commonJS((exports, module) => {
|
|
149
149
|
function BitBuffer() {
|
|
150
150
|
this.buffer = [];
|
|
@@ -177,7 +177,7 @@ var require_bit_buffer = __commonJS((exports, module) => {
|
|
|
177
177
|
module.exports = BitBuffer;
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
|
|
180
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/bit-matrix.js
|
|
181
181
|
var require_bit_matrix = __commonJS((exports, module) => {
|
|
182
182
|
function BitMatrix(size) {
|
|
183
183
|
if (!size || size < 1) {
|
|
@@ -205,7 +205,7 @@ var require_bit_matrix = __commonJS((exports, module) => {
|
|
|
205
205
|
module.exports = BitMatrix;
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
|
|
208
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alignment-pattern.js
|
|
209
209
|
var require_alignment_pattern = __commonJS((exports) => {
|
|
210
210
|
var getSymbolSize = require_utils().getSymbolSize;
|
|
211
211
|
exports.getRowColCoords = function getRowColCoords(version) {
|
|
@@ -237,7 +237,7 @@ var require_alignment_pattern = __commonJS((exports) => {
|
|
|
237
237
|
};
|
|
238
238
|
});
|
|
239
239
|
|
|
240
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
|
|
240
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/finder-pattern.js
|
|
241
241
|
var require_finder_pattern = __commonJS((exports) => {
|
|
242
242
|
var getSymbolSize = require_utils().getSymbolSize;
|
|
243
243
|
var FINDER_PATTERN_SIZE = 7;
|
|
@@ -251,7 +251,7 @@ var require_finder_pattern = __commonJS((exports) => {
|
|
|
251
251
|
};
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
|
|
254
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mask-pattern.js
|
|
255
255
|
var require_mask_pattern = __commonJS((exports) => {
|
|
256
256
|
exports.Patterns = {
|
|
257
257
|
PATTERN000: 0,
|
|
@@ -400,7 +400,7 @@ var require_mask_pattern = __commonJS((exports) => {
|
|
|
400
400
|
};
|
|
401
401
|
});
|
|
402
402
|
|
|
403
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
|
|
403
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/error-correction-code.js
|
|
404
404
|
var require_error_correction_code = __commonJS((exports) => {
|
|
405
405
|
var ECLevel = require_error_correction_level();
|
|
406
406
|
var EC_BLOCKS_TABLE = [
|
|
@@ -757,7 +757,7 @@ var require_error_correction_code = __commonJS((exports) => {
|
|
|
757
757
|
};
|
|
758
758
|
});
|
|
759
759
|
|
|
760
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
|
|
760
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/galois-field.js
|
|
761
761
|
var require_galois_field = __commonJS((exports) => {
|
|
762
762
|
var EXP_TABLE = new Uint8Array(512);
|
|
763
763
|
var LOG_TABLE = new Uint8Array(256);
|
|
@@ -790,7 +790,7 @@ var require_galois_field = __commonJS((exports) => {
|
|
|
790
790
|
};
|
|
791
791
|
});
|
|
792
792
|
|
|
793
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
|
|
793
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/polynomial.js
|
|
794
794
|
var require_polynomial = __commonJS((exports) => {
|
|
795
795
|
var GF = require_galois_field();
|
|
796
796
|
exports.mul = function mul(p1, p2) {
|
|
@@ -825,7 +825,7 @@ var require_polynomial = __commonJS((exports) => {
|
|
|
825
825
|
};
|
|
826
826
|
});
|
|
827
827
|
|
|
828
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
828
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/reed-solomon-encoder.js
|
|
829
829
|
var require_reed_solomon_encoder = __commonJS((exports, module) => {
|
|
830
830
|
var Polynomial = require_polynomial();
|
|
831
831
|
function ReedSolomonEncoder(degree) {
|
|
@@ -856,14 +856,14 @@ var require_reed_solomon_encoder = __commonJS((exports, module) => {
|
|
|
856
856
|
module.exports = ReedSolomonEncoder;
|
|
857
857
|
});
|
|
858
858
|
|
|
859
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
|
|
859
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version-check.js
|
|
860
860
|
var require_version_check = __commonJS((exports) => {
|
|
861
861
|
exports.isValid = function isValid(version) {
|
|
862
862
|
return !isNaN(version) && version >= 1 && version <= 40;
|
|
863
863
|
};
|
|
864
864
|
});
|
|
865
865
|
|
|
866
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
|
|
866
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/regex.js
|
|
867
867
|
var require_regex = __commonJS((exports) => {
|
|
868
868
|
var numeric = "[0-9]+";
|
|
869
869
|
var alphanumeric = "[A-Z $%*+\\-./:]+";
|
|
@@ -890,7 +890,7 @@ var require_regex = __commonJS((exports) => {
|
|
|
890
890
|
};
|
|
891
891
|
});
|
|
892
892
|
|
|
893
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
|
|
893
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/mode.js
|
|
894
894
|
var require_mode = __commonJS((exports) => {
|
|
895
895
|
var VersionCheck = require_version_check();
|
|
896
896
|
var Regex = require_regex();
|
|
@@ -977,7 +977,7 @@ var require_mode = __commonJS((exports) => {
|
|
|
977
977
|
};
|
|
978
978
|
});
|
|
979
979
|
|
|
980
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
|
|
980
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/version.js
|
|
981
981
|
var require_version = __commonJS((exports) => {
|
|
982
982
|
var Utils = require_utils();
|
|
983
983
|
var ECCode = require_error_correction_code();
|
|
@@ -1072,7 +1072,7 @@ var require_version = __commonJS((exports) => {
|
|
|
1072
1072
|
};
|
|
1073
1073
|
});
|
|
1074
1074
|
|
|
1075
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
|
|
1075
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/format-info.js
|
|
1076
1076
|
var require_format_info = __commonJS((exports) => {
|
|
1077
1077
|
var Utils = require_utils();
|
|
1078
1078
|
var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;
|
|
@@ -1088,7 +1088,7 @@ var require_format_info = __commonJS((exports) => {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
});
|
|
1090
1090
|
|
|
1091
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
|
|
1091
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/numeric-data.js
|
|
1092
1092
|
var require_numeric_data = __commonJS((exports, module) => {
|
|
1093
1093
|
var Mode = require_mode();
|
|
1094
1094
|
function NumericData(data) {
|
|
@@ -1121,7 +1121,7 @@ var require_numeric_data = __commonJS((exports, module) => {
|
|
|
1121
1121
|
module.exports = NumericData;
|
|
1122
1122
|
});
|
|
1123
1123
|
|
|
1124
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
1124
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/alphanumeric-data.js
|
|
1125
1125
|
var require_alphanumeric_data = __commonJS((exports, module) => {
|
|
1126
1126
|
var Mode = require_mode();
|
|
1127
1127
|
var ALPHA_NUM_CHARS = [
|
|
@@ -1198,7 +1198,7 @@ var require_alphanumeric_data = __commonJS((exports, module) => {
|
|
|
1198
1198
|
module.exports = AlphanumericData;
|
|
1199
1199
|
});
|
|
1200
1200
|
|
|
1201
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
|
|
1201
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/byte-data.js
|
|
1202
1202
|
var require_byte_data = __commonJS((exports, module) => {
|
|
1203
1203
|
var Mode = require_mode();
|
|
1204
1204
|
function ByteData(data) {
|
|
@@ -1226,7 +1226,7 @@ var require_byte_data = __commonJS((exports, module) => {
|
|
|
1226
1226
|
module.exports = ByteData;
|
|
1227
1227
|
});
|
|
1228
1228
|
|
|
1229
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
|
|
1229
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/kanji-data.js
|
|
1230
1230
|
var require_kanji_data = __commonJS((exports, module) => {
|
|
1231
1231
|
var Mode = require_mode();
|
|
1232
1232
|
var Utils = require_utils();
|
|
@@ -1262,7 +1262,7 @@ var require_kanji_data = __commonJS((exports, module) => {
|
|
|
1262
1262
|
module.exports = KanjiData;
|
|
1263
1263
|
});
|
|
1264
1264
|
|
|
1265
|
-
// node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
|
|
1265
|
+
// ../../node_modules/.pnpm/dijkstrajs@1.0.3/node_modules/dijkstrajs/dijkstra.js
|
|
1266
1266
|
var require_dijkstra = __commonJS((exports, module) => {
|
|
1267
1267
|
var dijkstra = {
|
|
1268
1268
|
single_source_shortest_paths: function(graph, s, d2) {
|
|
@@ -1347,7 +1347,7 @@ var require_dijkstra = __commonJS((exports, module) => {
|
|
|
1347
1347
|
}
|
|
1348
1348
|
});
|
|
1349
1349
|
|
|
1350
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
|
|
1350
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/segments.js
|
|
1351
1351
|
var require_segments = __commonJS((exports) => {
|
|
1352
1352
|
var Mode = require_mode();
|
|
1353
1353
|
var NumericData = require_numeric_data();
|
|
@@ -1531,7 +1531,7 @@ var require_segments = __commonJS((exports) => {
|
|
|
1531
1531
|
};
|
|
1532
1532
|
});
|
|
1533
1533
|
|
|
1534
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
|
|
1534
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/qrcode.js
|
|
1535
1535
|
var require_qrcode = __commonJS((exports) => {
|
|
1536
1536
|
var Utils = require_utils();
|
|
1537
1537
|
var ECLevel = require_error_correction_level();
|
|
@@ -1791,7 +1791,7 @@ var require_qrcode = __commonJS((exports) => {
|
|
|
1791
1791
|
};
|
|
1792
1792
|
});
|
|
1793
1793
|
|
|
1794
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js
|
|
1794
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js
|
|
1795
1795
|
var require_utils2 = __commonJS((exports) => {
|
|
1796
1796
|
function hex2rgba(hex) {
|
|
1797
1797
|
if (typeof hex === "number") {
|
|
@@ -1872,7 +1872,7 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
1872
1872
|
};
|
|
1873
1873
|
});
|
|
1874
1874
|
|
|
1875
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js
|
|
1875
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/canvas.js
|
|
1876
1876
|
var require_canvas = __commonJS((exports) => {
|
|
1877
1877
|
var Utils = require_utils2();
|
|
1878
1878
|
function clearCanvas(ctx, canvas, size) {
|
|
@@ -1925,7 +1925,7 @@ var require_canvas = __commonJS((exports) => {
|
|
|
1925
1925
|
};
|
|
1926
1926
|
});
|
|
1927
1927
|
|
|
1928
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js
|
|
1928
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg-tag.js
|
|
1929
1929
|
var require_svg_tag = __commonJS((exports) => {
|
|
1930
1930
|
var Utils = require_utils2();
|
|
1931
1931
|
function getColorAttrib(color, attrib) {
|
|
@@ -1984,7 +1984,7 @@ var require_svg_tag = __commonJS((exports) => {
|
|
|
1984
1984
|
};
|
|
1985
1985
|
});
|
|
1986
1986
|
|
|
1987
|
-
// node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js
|
|
1987
|
+
// ../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/browser.js
|
|
1988
1988
|
var require_browser = __commonJS((exports) => {
|
|
1989
1989
|
var canPromise = require_can_promise();
|
|
1990
1990
|
var QRCode = require_qrcode();
|
|
@@ -2052,7 +2052,7 @@ var require_browser = __commonJS((exports) => {
|
|
|
2052
2052
|
});
|
|
2053
2053
|
});
|
|
2054
2054
|
|
|
2055
|
-
// node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/development/lit-html.js
|
|
2055
|
+
// ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/development/lit-html.js
|
|
2056
2056
|
var DEV_MODE = true;
|
|
2057
2057
|
var ENABLE_EXTRA_SECURITY_HOOKS = true;
|
|
2058
2058
|
var ENABLE_SHADYDOM_NOPATCH = true;
|
|
@@ -2901,7 +2901,7 @@ if (ENABLE_EXTRA_SECURITY_HOOKS) {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
}
|
|
2903
2903
|
|
|
2904
|
-
// node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/development/directive.js
|
|
2904
|
+
// ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/development/directive.js
|
|
2905
2905
|
var PartType = {
|
|
2906
2906
|
ATTRIBUTE: 1,
|
|
2907
2907
|
CHILD: 2,
|
|
@@ -2933,7 +2933,7 @@ class Directive {
|
|
|
2933
2933
|
}
|
|
2934
2934
|
}
|
|
2935
2935
|
|
|
2936
|
-
// node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/development/directives/unsafe-html.js
|
|
2936
|
+
// ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/development/directives/unsafe-html.js
|
|
2937
2937
|
var HTML_RESULT2 = 1;
|
|
2938
2938
|
|
|
2939
2939
|
class UnsafeHTMLDirective extends Directive {
|
|
@@ -2972,23 +2972,19 @@ UnsafeHTMLDirective.directiveName = "unsafeHTML";
|
|
|
2972
2972
|
UnsafeHTMLDirective.resultType = HTML_RESULT2;
|
|
2973
2973
|
var unsafeHTML = directive(UnsafeHTMLDirective);
|
|
2974
2974
|
|
|
2975
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
2975
|
+
// ../../node_modules/.pnpm/@kevisual+query@0.0.29_ws@8.18.0_zod@3.25.76/node_modules/@kevisual/query/dist/query-browser.js
|
|
2976
2976
|
var isTextForContentType = (contentType) => {
|
|
2977
2977
|
if (!contentType)
|
|
2978
2978
|
return false;
|
|
2979
|
-
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"
|
|
2979
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"];
|
|
2980
2980
|
return textTypes.some((type) => contentType.includes(type));
|
|
2981
2981
|
};
|
|
2982
2982
|
var adapter = async (opts = {}, overloadOpts) => {
|
|
2983
2983
|
const controller = new AbortController;
|
|
2984
2984
|
const signal = controller.signal;
|
|
2985
|
+
const isBlob = opts.isBlob || false;
|
|
2986
|
+
const isText = opts.isText || false;
|
|
2985
2987
|
const isPostFile = opts.isPostFile || false;
|
|
2986
|
-
let responseType = opts.responseType || "json";
|
|
2987
|
-
if (opts.isBlob) {
|
|
2988
|
-
responseType = "blob";
|
|
2989
|
-
} else if (opts.isText) {
|
|
2990
|
-
responseType = "text";
|
|
2991
|
-
}
|
|
2992
2988
|
const timeout = opts.timeout || 60000 * 3;
|
|
2993
2989
|
const timer = setTimeout(() => {
|
|
2994
2990
|
controller.abort();
|
|
@@ -3006,9 +3002,6 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
3006
3002
|
const isGet = method === "GET";
|
|
3007
3003
|
if (isGet) {
|
|
3008
3004
|
url.search = new URLSearchParams(opts.body).toString();
|
|
3009
|
-
} else {
|
|
3010
|
-
const params = opts.params || {};
|
|
3011
|
-
url.search = new URLSearchParams(params).toString();
|
|
3012
3005
|
}
|
|
3013
3006
|
let body = undefined;
|
|
3014
3007
|
if (isGet) {
|
|
@@ -3030,10 +3023,9 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
3030
3023
|
headers
|
|
3031
3024
|
}).then(async (response) => {
|
|
3032
3025
|
const contentType = response.headers.get("Content-Type");
|
|
3033
|
-
if (
|
|
3026
|
+
if (isBlob) {
|
|
3034
3027
|
return await response.blob();
|
|
3035
3028
|
}
|
|
3036
|
-
const isText = responseType === "text";
|
|
3037
3029
|
const isJson = contentType && contentType.includes("application/json");
|
|
3038
3030
|
if (isJson && !isText) {
|
|
3039
3031
|
return await response.json();
|
|
@@ -3058,6 +3050,15 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
3058
3050
|
clearTimeout(timer);
|
|
3059
3051
|
});
|
|
3060
3052
|
};
|
|
3053
|
+
var setBaseResponse = (res) => {
|
|
3054
|
+
res.success = res.code === 200;
|
|
3055
|
+
res.showError = (fn) => {
|
|
3056
|
+
if (!res.success && !res.noMsg) {
|
|
3057
|
+
fn?.();
|
|
3058
|
+
}
|
|
3059
|
+
};
|
|
3060
|
+
return res;
|
|
3061
|
+
};
|
|
3061
3062
|
var wrapperError = ({ code, message }) => {
|
|
3062
3063
|
const result = {
|
|
3063
3064
|
code: code || 500,
|
|
@@ -3146,6 +3147,7 @@ class Query {
|
|
|
3146
3147
|
}
|
|
3147
3148
|
return _adapter(req).then(async (res) => {
|
|
3148
3149
|
try {
|
|
3150
|
+
setBaseResponse(res);
|
|
3149
3151
|
if (_afterResponse) {
|
|
3150
3152
|
return await _afterResponse(res, {
|
|
3151
3153
|
req,
|
|
@@ -3185,13 +3187,7 @@ class Query {
|
|
|
3185
3187
|
..._options?.headers || {}
|
|
3186
3188
|
}
|
|
3187
3189
|
});
|
|
3188
|
-
|
|
3189
|
-
return {
|
|
3190
|
-
code: 200,
|
|
3191
|
-
data: res
|
|
3192
|
-
};
|
|
3193
|
-
}
|
|
3194
|
-
return res;
|
|
3190
|
+
return setBaseResponse(res);
|
|
3195
3191
|
}
|
|
3196
3192
|
}
|
|
3197
3193
|
|
|
@@ -3220,8 +3216,8 @@ class BaseQuery {
|
|
|
3220
3216
|
}
|
|
3221
3217
|
}
|
|
3222
3218
|
|
|
3223
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
3224
|
-
var
|
|
3219
|
+
// ../../node_modules/.pnpm/@kevisual+query@0.0.29_ws@8.18.0_zod@3.25.76/node_modules/@kevisual/query/dist/query.js
|
|
3220
|
+
var setBaseResponse2 = (res) => {
|
|
3225
3221
|
res.success = res.code === 200;
|
|
3226
3222
|
res.showError = (fn) => {
|
|
3227
3223
|
if (!res.success && !res.noMsg) {
|
|
@@ -3231,7 +3227,7 @@ var setBaseResponse = (res) => {
|
|
|
3231
3227
|
return res;
|
|
3232
3228
|
};
|
|
3233
3229
|
|
|
3234
|
-
// node_modules/.pnpm/@kevisual+cache@0.0.3/node_modules/@kevisual/cache/dist/cache.js
|
|
3230
|
+
// ../../node_modules/.pnpm/@kevisual+cache@0.0.3/node_modules/@kevisual/cache/dist/cache.js
|
|
3235
3231
|
function promisifyRequest(request) {
|
|
3236
3232
|
return new Promise((resolve, reject) => {
|
|
3237
3233
|
request.oncomplete = request.onsuccess = () => resolve(request.result);
|
|
@@ -3411,7 +3407,7 @@ class MyCache extends CacheWorkspace {
|
|
|
3411
3407
|
}
|
|
3412
3408
|
}
|
|
3413
3409
|
|
|
3414
|
-
// node_modules/.pnpm/@kevisual+query-login@0.0.7_@kevisual+query@0.0.
|
|
3410
|
+
// ../../node_modules/.pnpm/@kevisual+query-login@0.0.7_@kevisual+query@0.0.29_ws@8.18.0_zod@3.25.76_/node_modules/@kevisual/query-login/dist/query-login-browser.js
|
|
3415
3411
|
var LoginCacheStore = class {
|
|
3416
3412
|
cache;
|
|
3417
3413
|
name;
|
|
@@ -3618,7 +3614,7 @@ var QueryLogin = class extends BaseQuery {
|
|
|
3618
3614
|
}
|
|
3619
3615
|
return this.post({ key: "refreshToken", data }, {
|
|
3620
3616
|
afterResponse: async (response, ctx) => {
|
|
3621
|
-
|
|
3617
|
+
setBaseResponse2(response);
|
|
3622
3618
|
return response;
|
|
3623
3619
|
}
|
|
3624
3620
|
});
|
|
@@ -3643,7 +3639,7 @@ var QueryLogin = class extends BaseQuery {
|
|
|
3643
3639
|
body,
|
|
3644
3640
|
headers: { ...headers, Authorization: `Bearer ${accessToken}` }
|
|
3645
3641
|
});
|
|
3646
|
-
|
|
3642
|
+
setBaseResponse2(res2);
|
|
3647
3643
|
return res2;
|
|
3648
3644
|
}
|
|
3649
3645
|
} else {
|
|
@@ -4480,7 +4476,7 @@ var useCreateLoginQRCode = (el) => {
|
|
|
4480
4476
|
return { createQrcode, clear: clear2 };
|
|
4481
4477
|
};
|
|
4482
4478
|
|
|
4483
|
-
// node_modules/.pnpm/@kevisual+context@0.0.4/node_modules/@kevisual/context/dist/app.js
|
|
4479
|
+
// ../../node_modules/.pnpm/@kevisual+context@0.0.4/node_modules/@kevisual/context/dist/app.js
|
|
4484
4480
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
4485
4481
|
function getDefaultExportFromCjs(x) {
|
|
4486
4482
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -5102,7 +5098,6 @@ class KvLogin extends HTMLElement {
|
|
|
5102
5098
|
if (loginMethods.length > 0) {
|
|
5103
5099
|
this.loginMethods = getLoginMethod(loginMethods);
|
|
5104
5100
|
this.selectedMethod = loginMethods[0];
|
|
5105
|
-
this.setLoginMethods(this.loginMethods);
|
|
5106
5101
|
return;
|
|
5107
5102
|
}
|
|
5108
5103
|
}
|
|
@@ -5320,20 +5315,9 @@ class KvLogin extends HTMLElement {
|
|
|
5320
5315
|
return this.renderPasswordForm();
|
|
5321
5316
|
}
|
|
5322
5317
|
}
|
|
5323
|
-
createWeixinEl() {
|
|
5324
|
-
const id = "weixinLogin";
|
|
5325
|
-
let el = this.querySelector("#" + id);
|
|
5326
|
-
if (el)
|
|
5327
|
-
return el;
|
|
5328
|
-
const weixinEl = document.createElement("div");
|
|
5329
|
-
weixinEl.id = "weixinLogin";
|
|
5330
|
-
this.appendChild(weixinEl);
|
|
5331
|
-
return weixinEl;
|
|
5332
|
-
}
|
|
5333
5318
|
render() {
|
|
5334
5319
|
if (!this.shadowRoot)
|
|
5335
5320
|
return;
|
|
5336
|
-
this.createWeixinEl();
|
|
5337
5321
|
const renderIcon = (icon) => {
|
|
5338
5322
|
if (typeof icon === "string" && !icons[icon]) {
|
|
5339
5323
|
return html`<span class="method-icon-emoji">${icon}</span>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/kv-login",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
"pub": "ev deploy ./dist -k kv-login-test -v 0.0.6 -u -y yes"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|
|
15
|
+
"files": [
|
|
16
|
+
"types",
|
|
17
|
+
"src",
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
15
20
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
|
16
21
|
"license": "MIT",
|
|
17
|
-
"packageManager": "pnpm@10.
|
|
22
|
+
"packageManager": "pnpm@10.24.0",
|
|
18
23
|
"publishConfig": {
|
|
19
24
|
"access": "public"
|
|
20
25
|
},
|
|
21
26
|
"type": "module",
|
|
22
|
-
"files": [
|
|
23
|
-
"types",
|
|
24
|
-
"dist"
|
|
25
|
-
],
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@kevisual/context": "^0.0.4",
|
|
28
|
-
"@kevisual/query": "^0.0.32",
|
|
29
29
|
"@kevisual/query-login": "^0.0.7",
|
|
30
30
|
"lit-html": "^3.3.1",
|
|
31
31
|
"qrcode": "^1.5.4"
|
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
},
|
|
37
37
|
"types": "./types/index.d.ts",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/bun": "^1.3.
|
|
40
|
-
"@types/qrcode": "^1.5.6",
|
|
41
|
-
"vite": "^7.3.0"
|
|
39
|
+
"@types/bun": "^1.3.3"
|
|
42
40
|
}
|
|
43
41
|
}
|
package/readme.md
CHANGED
|
@@ -4,24 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
黑白
|
|
6
6
|
|
|
7
|
-
```html
|
|
8
|
-
<kv-login>
|
|
9
|
-
</kv-login>
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 网页
|
|
13
7
|
|
|
14
8
|
```html
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
"imports": {
|
|
18
|
-
"@kevisual/kv-login": "https://esm.kevisual.cn/@kevisual/kv-login"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
<script type="module">
|
|
23
|
-
import '@kevisual/kv-login';
|
|
24
|
-
</script>
|
|
25
|
-
<kv-login method="password,wechat,wechat-mp">
|
|
9
|
+
<kv-login>
|
|
10
|
+
<div id="weixinLogin"></div>
|
|
26
11
|
</kv-login>
|
|
27
|
-
```
|
|
12
|
+
```
|
package/src/main.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { checkPluginLogin, clearCode } from './modules/login-handle';
|
|
1
2
|
import './pages/kv-login'
|
|
2
3
|
import './pages/kv-message'
|
|
3
4
|
|
|
4
|
-
export { loginEmitter } from './pages/kv-login'
|
|
5
|
+
export { loginEmitter } from './pages/kv-login'
|
|
6
|
+
|
|
7
|
+
export { checkPluginLogin, clearCode }
|