@iftc/yete 0.0.1-alpha.3 → 0.0.1-alpha.5
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/function/md2html.js +6 -0
- package/index.js +743 -3
- package/libs/yete-ui/Button.js +156 -0
- package/libs/yete-ui/Text.js +17 -0
- package/libs/yete-ui/yete.json +7 -1
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -12,6 +12,49 @@ class YeteError extends Error {
|
|
|
12
12
|
this.name = 'YeteError';
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* 检查浏览器兼容性
|
|
17
|
+
* @throws {YeteError} 如果不兼容或无法判断则抛出错误
|
|
18
|
+
*/
|
|
19
|
+
(function checkBrowserCompatibility() {
|
|
20
|
+
const ua = navigator.userAgent;
|
|
21
|
+
let browser = null;
|
|
22
|
+
let version = 0;
|
|
23
|
+
if (/Edg\/(\d+)/.test(ua)) {
|
|
24
|
+
browser = 'Edge';
|
|
25
|
+
version = parseInt(ua.match(/Edg\/(\d+)/)[1], 10);
|
|
26
|
+
} else if (/Chrome\/(\d+)/.test(ua) && !/Chromium/.test(ua)) {
|
|
27
|
+
browser = 'Chrome';
|
|
28
|
+
version = parseInt(ua.match(/Chrome\/(\d+)/)[1], 10);
|
|
29
|
+
} else if (/Firefox\/(\d+)/.test(ua)) {
|
|
30
|
+
browser = 'Firefox';
|
|
31
|
+
version = parseInt(ua.match(/Firefox\/(\d+)/)[1], 10);
|
|
32
|
+
} else if (/Version\/(\d+)/.test(ua) && /Safari/.test(ua)) {
|
|
33
|
+
browser = 'Safari';
|
|
34
|
+
version = parseInt(ua.match(/Version\/(\d+)/)[1], 10);
|
|
35
|
+
}
|
|
36
|
+
console.log(browser, version);
|
|
37
|
+
const minVersions = {
|
|
38
|
+
'Chrome': 87,
|
|
39
|
+
'Firefox': 140,
|
|
40
|
+
'Safari': 18.4,
|
|
41
|
+
'Edge': 87
|
|
42
|
+
};
|
|
43
|
+
let isCompatible = false;
|
|
44
|
+
if (browser && minVersions[browser] !== undefined) {
|
|
45
|
+
if (version >= minVersions[browser]) {
|
|
46
|
+
isCompatible = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!isCompatible) {
|
|
50
|
+
const msg = browser
|
|
51
|
+
? `您的浏览器版本过低 (${browser} ${version}),请使用 Chrome 71+, Firefox 69+, Safari 12.1+ 或 Edge 79+。`
|
|
52
|
+
: `无法识别您的浏览器环境,请使用现代浏览器 (Chrome, Firefox, Safari, Edge)。`;
|
|
53
|
+
|
|
54
|
+
alert(msg);
|
|
55
|
+
console.error(new YeteError('Browser incompatible'));
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
15
58
|
/**
|
|
16
59
|
* 页面基类
|
|
17
60
|
* @example
|
|
@@ -67,6 +110,10 @@ let isStarted = false;
|
|
|
67
110
|
let custom404Page = null;
|
|
68
111
|
let custom502Page = null;
|
|
69
112
|
|
|
113
|
+
let searchParams = new URLSearchParams("");
|
|
114
|
+
|
|
115
|
+
const hostname = location.hostname;
|
|
116
|
+
|
|
70
117
|
/**
|
|
71
118
|
* 导出的对象
|
|
72
119
|
*/
|
|
@@ -230,7 +277,7 @@ const obj = {
|
|
|
230
277
|
}
|
|
231
278
|
document.body.innerHTML = "<center><h1>404 Not Found</h1><p>Power By Yete</p></center>";
|
|
232
279
|
obj.emit('page-change', new obj.YeteEvent("page-change", { path, isNotFound: true }));
|
|
233
|
-
|
|
280
|
+
console.error(new YeteError("The page not found."));
|
|
234
281
|
}
|
|
235
282
|
},
|
|
236
283
|
/**
|
|
@@ -365,8 +412,693 @@ const obj = {
|
|
|
365
412
|
throw new YeteError("The page not found.");
|
|
366
413
|
}
|
|
367
414
|
},
|
|
415
|
+
/**
|
|
416
|
+
* HTTP 请求
|
|
417
|
+
* @description HTTP 请求封装,提供更便捷的方式进行 HTTP 请求
|
|
418
|
+
* @example
|
|
419
|
+
* const res = await HTTP.GET("https://example.com");
|
|
420
|
+
* const data = await res.json();
|
|
421
|
+
*/
|
|
422
|
+
HTTP: class {
|
|
423
|
+
constructor() { }
|
|
424
|
+
/**
|
|
425
|
+
* GET 请求
|
|
426
|
+
* @param {String} url
|
|
427
|
+
* @param {Object} headers
|
|
428
|
+
* @returns {Promise<Response>}
|
|
429
|
+
* @example
|
|
430
|
+
* const res = await HTTP.GET("https://example.com");
|
|
431
|
+
* const data = await res.json();
|
|
432
|
+
*/
|
|
433
|
+
static async GET(url, headers = {}) {
|
|
434
|
+
return await fetch(url, { headers });
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* POST 请求
|
|
438
|
+
* @param {String} url
|
|
439
|
+
* @param {Object} body
|
|
440
|
+
* @param {Object} headers
|
|
441
|
+
* @returns {Promise<Response>}
|
|
442
|
+
* @example
|
|
443
|
+
* const res = await HTTP.POST("https://example.com", { name: "Yete" });
|
|
444
|
+
* const data = await res.json();
|
|
445
|
+
*/
|
|
446
|
+
static async POST(url, body, headers = {}) {
|
|
447
|
+
return await fetch(url, { method: "POST", body, headers });
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* PUT 请求
|
|
451
|
+
* @param {String} url
|
|
452
|
+
* @param {Object} body
|
|
453
|
+
* @param {Object} headers
|
|
454
|
+
* @returns {Promise<Response>}
|
|
455
|
+
* @example
|
|
456
|
+
* const res = await HTTP.PUT("https://example.com", { name: "Yete" });
|
|
457
|
+
* const data = await res.json();
|
|
458
|
+
*/
|
|
459
|
+
static async PUT(url, body, headers = {}) {
|
|
460
|
+
return await fetch(url, { method: "PUT", body, headers });
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* DELETE 请求
|
|
464
|
+
* @param {String} url
|
|
465
|
+
* @param {Object} headers
|
|
466
|
+
* @returns {Promise<Response>}
|
|
467
|
+
* @example
|
|
468
|
+
* const res = await HTTP.DELETE("https://example.com");
|
|
469
|
+
* const data = await res.json();
|
|
470
|
+
*/
|
|
471
|
+
static async DELETE(url, headers = {}) {
|
|
472
|
+
return await fetch(url, { method: "DELETE", headers });
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* PATCH 请求
|
|
476
|
+
* @param {String} url
|
|
477
|
+
* @param {Object} body
|
|
478
|
+
* @param {Object} headers
|
|
479
|
+
* @returns {Promise<Response>}
|
|
480
|
+
* @example
|
|
481
|
+
* const res = await HTTP.PATCH("https://example.com", { name: "Yete" });
|
|
482
|
+
* const data = await res.json();
|
|
483
|
+
*/
|
|
484
|
+
static async PATCH(url, body, headers = {}) {
|
|
485
|
+
return await fetch(url, { method: "PATCH", body, headers });
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* HEAD 请求
|
|
489
|
+
* @param {String} url
|
|
490
|
+
* @param {Object} headers
|
|
491
|
+
* @returns {Promise<Response>}
|
|
492
|
+
* @example
|
|
493
|
+
* const res = await HTTP.HEAD("https://example.com");
|
|
494
|
+
* const data = await res.json();
|
|
495
|
+
*/
|
|
496
|
+
static async HEAD(url, headers = {}) {
|
|
497
|
+
return await fetch(url, { method: "HEAD", headers });
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* OPTIONS 请求
|
|
501
|
+
* @param {String} url
|
|
502
|
+
* @param {Object} headers
|
|
503
|
+
* @returns {Promise<Response>}
|
|
504
|
+
* @example
|
|
505
|
+
* const res = await HTTP.OPTIONS("https://example.com");
|
|
506
|
+
* const data = await res.json();
|
|
507
|
+
*/
|
|
508
|
+
static async OPTIONS(url, headers = {}) {
|
|
509
|
+
return await fetch(url, { method: "OPTIONS", headers });
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* TRACE 请求
|
|
513
|
+
* @param {String} url
|
|
514
|
+
* @param {Object} headers
|
|
515
|
+
* @returns {Promise<Response>}
|
|
516
|
+
* @example
|
|
517
|
+
* const res = await HTTP.TRACE("https://example.com");
|
|
518
|
+
* const data = await res.json();
|
|
519
|
+
*/
|
|
520
|
+
static async TRACE(url, headers = {}) {
|
|
521
|
+
return await fetch(url, { method: "TRACE", headers });
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* CONNECT 请求
|
|
525
|
+
* @param {String} url
|
|
526
|
+
* @param {Object} headers
|
|
527
|
+
* @returns {Promise<Response>}
|
|
528
|
+
* @example
|
|
529
|
+
* const res = await HTTP.CONNECT("https://example.com");
|
|
530
|
+
* const data = await res.json();
|
|
531
|
+
*/
|
|
532
|
+
static async CONNECT(url, headers = {}) {
|
|
533
|
+
return await fetch(url, { method: "CONNECT", headers });
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* 读取流
|
|
537
|
+
* @param {Response} response
|
|
538
|
+
* @param {Function} callback
|
|
539
|
+
* @returns {Promise<void>}
|
|
540
|
+
* @example
|
|
541
|
+
* await HTTP.readStream(res, ({ chunk, done }) => { console.log(done, chunk); });
|
|
542
|
+
*/
|
|
543
|
+
static async readStream(response, callback = ({ chunk, done }) => { console.log(done, chunk); }) {
|
|
544
|
+
if (!response.ok) {
|
|
545
|
+
throw new YeteError("Response is not ok.");
|
|
546
|
+
}
|
|
547
|
+
if (!response.body) {
|
|
548
|
+
throw new YeteError("Response body is not available.");
|
|
549
|
+
}
|
|
550
|
+
const reader = response.body.getReader();
|
|
551
|
+
const decoder = new TextDecoder('utf-8');
|
|
552
|
+
try {
|
|
553
|
+
while (true) {
|
|
554
|
+
const { done, value } = await reader.read();
|
|
555
|
+
if (done) {
|
|
556
|
+
const finalChunk = decoder.decode();
|
|
557
|
+
callback({ chunk: finalChunk || null, done: true });
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
561
|
+
callback({ chunk, done: false });
|
|
562
|
+
}
|
|
563
|
+
} catch (error) {
|
|
564
|
+
throw new YeteError(`Stream reading failed: ${error.message}`);
|
|
565
|
+
} finally {
|
|
566
|
+
reader.releaseLock();
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* 读取响应体
|
|
571
|
+
* @param {Response} response
|
|
572
|
+
* @param {String} type
|
|
573
|
+
* @returns {Promise<any>}
|
|
574
|
+
* @example
|
|
575
|
+
* const data = await HTTP.readBody(res);
|
|
576
|
+
*/
|
|
577
|
+
static async readBody(response, type = "text") {
|
|
578
|
+
if (!response.ok) {
|
|
579
|
+
throw new YeteError("Response is not ok.");
|
|
580
|
+
}
|
|
581
|
+
if (!response.body) {
|
|
582
|
+
throw new YeteError("Response body is not available.");
|
|
583
|
+
}
|
|
584
|
+
switch (type) {
|
|
585
|
+
case "text":
|
|
586
|
+
return await response.text();
|
|
587
|
+
case "json":
|
|
588
|
+
return await response.json();
|
|
589
|
+
case "blob":
|
|
590
|
+
return await response.blob();
|
|
591
|
+
case "arrayBuffer":
|
|
592
|
+
return await response.arrayBuffer();
|
|
593
|
+
case "formData":
|
|
594
|
+
return await response.formData();
|
|
595
|
+
default:
|
|
596
|
+
throw new YeteError("Invalid type.");
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* 读取响应头
|
|
601
|
+
* @param {Response} response
|
|
602
|
+
* @returns {Promise<Headers>}
|
|
603
|
+
* @example
|
|
604
|
+
* const headers = await HTTP.readHeaders(res);
|
|
605
|
+
*/
|
|
606
|
+
static async readHeaders(response) {
|
|
607
|
+
return response.headers;
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
/**
|
|
611
|
+
* 获取 URL 参数
|
|
612
|
+
* @example
|
|
613
|
+
* const params = searchParams;
|
|
614
|
+
*/
|
|
615
|
+
searchParams: function () {
|
|
616
|
+
return searchParams;
|
|
617
|
+
},
|
|
618
|
+
/**
|
|
619
|
+
* 加载 UI
|
|
620
|
+
* @description 可通过 URL 或 XML 字符串加载 UI
|
|
621
|
+
* @param {String} str
|
|
622
|
+
* @returns {Promise<HTMLElement>}
|
|
623
|
+
* @example
|
|
624
|
+
* await loadUI("https://example.com/ui.xml");
|
|
625
|
+
* await loadUI(`<Yete><Text>Hello World</Text></Yete>`);
|
|
626
|
+
*/
|
|
627
|
+
loadUI: async function (str) {
|
|
628
|
+
let isURL = false;
|
|
629
|
+
try {
|
|
630
|
+
new URL(str);
|
|
631
|
+
isURL = true;
|
|
632
|
+
} catch { }
|
|
633
|
+
if (isURL) {
|
|
634
|
+
const res = await fetch(str);
|
|
635
|
+
const text = await res.text();
|
|
636
|
+
return loadUI(text);
|
|
637
|
+
} else {
|
|
638
|
+
return loadUI(str);
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
/**
|
|
642
|
+
* 认证管理类
|
|
643
|
+
* @description 提供用户认证、令牌管理、授权验证等功能
|
|
644
|
+
*/
|
|
645
|
+
Auth: class {
|
|
646
|
+
/**
|
|
647
|
+
* 构造函数
|
|
648
|
+
* @param {Object} options 配置选项
|
|
649
|
+
* @property {String} apiBaseUrl API 基础地址
|
|
650
|
+
* @property {String} tokenKey localStorage 中存储 token 的键名
|
|
651
|
+
*/
|
|
652
|
+
constructor(options = {}) {
|
|
653
|
+
this.apiBaseUrl = options.apiBaseUrl || 'https://iftc.koyeb.app/api/auth';
|
|
654
|
+
this.tokenKey = options.tokenKey || 'auth_token';
|
|
655
|
+
this.checkInterval = options.checkInterval || 2000;
|
|
656
|
+
this.onAuthSuccess = options.onAuthSuccess || null;
|
|
657
|
+
this.onAuthFail = options.onAuthFail || null;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* 获取存储的 auth_token
|
|
662
|
+
* @returns {String|null}
|
|
663
|
+
* @example
|
|
664
|
+
* const token = auth.getAuthToken();
|
|
665
|
+
*/
|
|
666
|
+
getAuthToken() {
|
|
667
|
+
return localStorage.getItem(this.tokenKey);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* 设置存储的 auth_token
|
|
672
|
+
* @param {String} token
|
|
673
|
+
* @example
|
|
674
|
+
* auth.setAuthToken('your_token_here');
|
|
675
|
+
*/
|
|
676
|
+
setAuthToken(token) {
|
|
677
|
+
localStorage.setItem(this.tokenKey, token);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* 清除存储的 auth_token
|
|
682
|
+
* @example
|
|
683
|
+
* auth.clearAuthToken();
|
|
684
|
+
*/
|
|
685
|
+
clearAuthToken() {
|
|
686
|
+
localStorage.removeItem(this.tokenKey);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* 检查是否已授权
|
|
691
|
+
* @returns {Promise<Boolean>}
|
|
692
|
+
* @example
|
|
693
|
+
* if (auth.isAuthorized()) { ... }
|
|
694
|
+
*/
|
|
695
|
+
async isAuthorized() {
|
|
696
|
+
return !!await cookieStore.get("ID");
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* 获取授权链接
|
|
701
|
+
* @param {String} redirectUrl 回调地址
|
|
702
|
+
* @returns {String}
|
|
703
|
+
* @example
|
|
704
|
+
* const url = auth.getAuthUrl(location.href);
|
|
705
|
+
*/
|
|
706
|
+
getAuthUrl(redirectUrl) {
|
|
707
|
+
return `${this.apiBaseUrl}/token?redirect=${encodeURIComponent(redirectUrl)}`;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* 发起授权请求
|
|
712
|
+
* @description 跳转到授权页面
|
|
713
|
+
* @param {String} redirectUrl 回调地址
|
|
714
|
+
* @example
|
|
715
|
+
* auth.requestAuth(location.href);
|
|
716
|
+
*/
|
|
717
|
+
async requestAuth(redirectUrl) {
|
|
718
|
+
const url = this.getAuthUrl(redirectUrl);
|
|
719
|
+
const response = await fetch(url);
|
|
720
|
+
const json = await response.json();
|
|
721
|
+
|
|
722
|
+
if (json.code !== 200) {
|
|
723
|
+
throw new YeteError(json.msg || '获取授权令牌失败');
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
this.setAuthToken(json.data.token);
|
|
727
|
+
location.href = json.data.url;
|
|
728
|
+
return json;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* 验证 auth_token 有效性
|
|
733
|
+
* @param {String} token 可选,不传则使用存储的 auth_token
|
|
734
|
+
* @returns {Promise<Boolean>}
|
|
735
|
+
* @example
|
|
736
|
+
* const isValid = await auth.verify();
|
|
737
|
+
*/
|
|
738
|
+
async verify(token = null) {
|
|
739
|
+
const targetToken = token || this.getAuthToken();
|
|
740
|
+
|
|
741
|
+
if (!targetToken) {
|
|
742
|
+
throw new YeteError('未找到授权令牌');
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
const response = await fetch(`${this.apiBaseUrl}/verify?token=${targetToken}`);
|
|
746
|
+
const json = await response.json();
|
|
747
|
+
|
|
748
|
+
if (json.code === 200) {
|
|
749
|
+
await this.setCookie('ID', json.data.id, 365);
|
|
750
|
+
localStorage.setItem("ID", json.data.id);
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* 设置 cookie
|
|
758
|
+
* @param {String} name 键名
|
|
759
|
+
* @param {String} value 键值
|
|
760
|
+
* @param {Number} days 过期天数
|
|
761
|
+
*/
|
|
762
|
+
async setCookie(name, value, days = 1) {
|
|
763
|
+
const expires = new Date();
|
|
764
|
+
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
|
|
765
|
+
|
|
766
|
+
try {
|
|
767
|
+
console.log(location.hostname);
|
|
768
|
+
await cookieStore.set({
|
|
769
|
+
name,
|
|
770
|
+
value,
|
|
771
|
+
expires: expires.toISOString(),
|
|
772
|
+
path: '/',
|
|
773
|
+
domain: hostname,
|
|
774
|
+
secure: true
|
|
775
|
+
});
|
|
776
|
+
} catch (error) {
|
|
777
|
+
console.warn('cookieStore not supported, falling back to document.cookie');
|
|
778
|
+
document.cookie = `${name}=${value}; expires=${expires.toUTCString()}; path=/`;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* 获取 cookie
|
|
784
|
+
* @param {String} name 键名
|
|
785
|
+
* @returns {String|null}
|
|
786
|
+
*/
|
|
787
|
+
async getCookie(name) {
|
|
788
|
+
try {
|
|
789
|
+
const cookies = await cookieStore.get(name);
|
|
790
|
+
return cookies ? cookies.value : null;
|
|
791
|
+
} catch (error) {
|
|
792
|
+
// 如果 cookieStore 不支持,降级到 document.cookie
|
|
793
|
+
console.warn('cookieStore not supported, falling back to document.cookie');
|
|
794
|
+
return this.getCookieFromDocument(name);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* 从 document.cookie 获取 cookie(备用方案)
|
|
800
|
+
* @param {String} name 键名
|
|
801
|
+
* @returns {String|null}
|
|
802
|
+
*/
|
|
803
|
+
getCookieFromDocument(name) {
|
|
804
|
+
const nameEQ = name + "=";
|
|
805
|
+
const ca = document.cookie.split(';');
|
|
806
|
+
for (let i = 0; i < ca.length; i++) {
|
|
807
|
+
let c = ca[i];
|
|
808
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
809
|
+
if (c.indexOf(nameEQ) === 0) {
|
|
810
|
+
return c.substring(nameEQ.length, c.length);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return null;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* 获取用户 ID
|
|
818
|
+
* @returns {String|null}
|
|
819
|
+
*/
|
|
820
|
+
getUserId() {
|
|
821
|
+
return localStorage.getItem("ID");
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* 检查授权状态并等待授权完成
|
|
826
|
+
* @param {Function} callback 授权成功后的回调
|
|
827
|
+
* @param {Number} timeout 超时时间(毫秒)
|
|
828
|
+
* @returns {Promise<Object>}
|
|
829
|
+
* @example
|
|
830
|
+
* await auth.waitForAuth((userInfo) => {
|
|
831
|
+
* console.log('用户 ID:', userInfo.id);
|
|
832
|
+
* });
|
|
833
|
+
*/
|
|
834
|
+
async waitForAuth(callback, timeout = 60000) {
|
|
835
|
+
const url = new URL(location.href);
|
|
836
|
+
const authParam = url.searchParams.get('auth');
|
|
837
|
+
|
|
838
|
+
if (!authParam) {
|
|
839
|
+
throw new YeteError('缺少 auth 参数');
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return new Promise((resolve, reject) => {
|
|
843
|
+
const startTime = Date.now();
|
|
844
|
+
const intervalId = setInterval(async () => {
|
|
845
|
+
// 检查超时
|
|
846
|
+
if (Date.now() - startTime > timeout) {
|
|
847
|
+
clearInterval(intervalId);
|
|
848
|
+
reject(new YeteError('授权超时'));
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
try {
|
|
853
|
+
const json = await this.verify();
|
|
854
|
+
if (json.code === 200) {
|
|
855
|
+
clearInterval(intervalId);
|
|
856
|
+
if (callback) callback(json.data);
|
|
857
|
+
if (this.onAuthSuccess) this.onAuthSuccess(json.data);
|
|
858
|
+
resolve(json);
|
|
859
|
+
}
|
|
860
|
+
} catch (error) {
|
|
861
|
+
console.error('验证失败:', error);
|
|
862
|
+
}
|
|
863
|
+
}, this.checkInterval);
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* 处理授权回调
|
|
869
|
+
* @description 在授权回调页面调用此方法
|
|
870
|
+
* @param {Function} successCallback 授权成功回调
|
|
871
|
+
* @param {Function} failCallback 授权失败回调
|
|
872
|
+
* @example
|
|
873
|
+
* auth.handleAuthCallback((userInfo) => {
|
|
874
|
+
* document.write('授权成功,用户 ID: ' + userInfo.id);
|
|
875
|
+
* });
|
|
876
|
+
*/
|
|
877
|
+
async handleAuthCallback(successCallback, failCallback) {
|
|
878
|
+
const url = new URL(location.href);
|
|
879
|
+
const authParam = url.searchParams.get('auth');
|
|
880
|
+
|
|
881
|
+
if (!authParam) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
try {
|
|
886
|
+
const result = await this.waitForAuth(successCallback);
|
|
887
|
+
if (successCallback) {
|
|
888
|
+
successCallback(result.data);
|
|
889
|
+
}
|
|
890
|
+
} catch (error) {
|
|
891
|
+
console.error('授权失败:', error);
|
|
892
|
+
if (failCallback) {
|
|
893
|
+
failCallback(error);
|
|
894
|
+
}
|
|
895
|
+
if (this.onAuthFail) {
|
|
896
|
+
this.onAuthFail(error);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* 获取用户信息
|
|
903
|
+
* @returns {Promise<Object>}
|
|
904
|
+
* @example
|
|
905
|
+
* const userInfo = await auth.getUserInfo();
|
|
906
|
+
*/
|
|
907
|
+
async getUserInfo() {
|
|
908
|
+
const res = await fetch(`${this.apiBaseUrl}/api/user/details?ID=${this.getUserId()}`);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* 登出
|
|
913
|
+
* @example
|
|
914
|
+
* auth.logout();
|
|
915
|
+
*/
|
|
916
|
+
logout() {
|
|
917
|
+
this.clearAuthToken();
|
|
918
|
+
location.reload();
|
|
919
|
+
}
|
|
920
|
+
},
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* 生成哈希值
|
|
925
|
+
* @description 与Java的用法一致
|
|
926
|
+
* @returns {Number}
|
|
927
|
+
* @example
|
|
928
|
+
* const hash = 'hello world'.hashCode();
|
|
929
|
+
*/
|
|
930
|
+
String.prototype.hashCode = function () {
|
|
931
|
+
let hash = 0;
|
|
932
|
+
for (let i = 0; i < this.length; i++) {
|
|
933
|
+
const char = this.charCodeAt(i);
|
|
934
|
+
hash = (hash << 5) - hash + char;
|
|
935
|
+
hash |= 0;
|
|
936
|
+
}
|
|
937
|
+
return hash;
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* 响应事件监听
|
|
942
|
+
*/
|
|
943
|
+
Response.prototype.events = {};
|
|
944
|
+
/**
|
|
945
|
+
* 是否正在监听响应事件
|
|
946
|
+
*/
|
|
947
|
+
Response.prototype.listening = false;
|
|
948
|
+
/**
|
|
949
|
+
* 添加响应事件监听
|
|
950
|
+
* @param {string} eventName 事件名
|
|
951
|
+
* @param {function} callback 回调函数
|
|
952
|
+
* @example
|
|
953
|
+
* response.on('eventName', function() {})
|
|
954
|
+
*/
|
|
955
|
+
Response.prototype.on = function (eventName, callback) {
|
|
956
|
+
if (!this.events[eventName]) {
|
|
957
|
+
this.events[eventName] = [];
|
|
958
|
+
}
|
|
959
|
+
this.events[eventName].push(callback);
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* 触发事件
|
|
963
|
+
* @param {string} eventName 事件名
|
|
964
|
+
* @param {...any} args 参数
|
|
965
|
+
* @example
|
|
966
|
+
* response.emit('eventName', '参数1', '参数2', ...);
|
|
967
|
+
*/
|
|
968
|
+
Response.prototype.emit = function (eventName, ...args) {
|
|
969
|
+
if (this.events[eventName]) {
|
|
970
|
+
this.events[eventName].forEach(callback => callback(...args));
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* 移除事件监听
|
|
975
|
+
* @param {string} eventName 事件名
|
|
976
|
+
* @param {Function} callback 回调函数
|
|
977
|
+
* @example
|
|
978
|
+
* response.off('eventName', callback);
|
|
979
|
+
*/
|
|
980
|
+
Response.prototype.off = function (eventName, callback) {
|
|
981
|
+
if (this.events[eventName]) {
|
|
982
|
+
this.events[eventName] = this.events[eventName].filter(cb => cb !== callback);
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
/**
|
|
986
|
+
* 开始同步监听(开启后将无法使用异步)
|
|
987
|
+
* @returns {Promise<void>}
|
|
988
|
+
* @example
|
|
989
|
+
* response.listen();
|
|
990
|
+
*/
|
|
991
|
+
Response.prototype.listen = async function () {
|
|
992
|
+
if (this.listening) {
|
|
993
|
+
throw new YeteError('已开启同步监听,请勿重复开启');
|
|
994
|
+
}
|
|
995
|
+
const res = this;
|
|
996
|
+
const headers = res.headers;
|
|
997
|
+
this.listening = true;
|
|
998
|
+
const contentType = headers.get('Content-Type');
|
|
999
|
+
if (contentType && contentType.includes('application/json')) {
|
|
1000
|
+
const json = await res.json();
|
|
1001
|
+
res.emit('res', {
|
|
1002
|
+
type: 'json',
|
|
1003
|
+
data: json,
|
|
1004
|
+
});
|
|
1005
|
+
} else if (contentType && contentType.includes('text/html')) {
|
|
1006
|
+
const text = await res.text();
|
|
1007
|
+
const doc = new DOMParser().parseFromString(text, "text/html");
|
|
1008
|
+
res.emit('res', {
|
|
1009
|
+
type: 'html',
|
|
1010
|
+
data: doc,
|
|
1011
|
+
});
|
|
1012
|
+
} else if (contentType && contentType.includes('text/plain')) {
|
|
1013
|
+
const text = await res.text();
|
|
1014
|
+
res.emit('res', {
|
|
1015
|
+
type: 'text',
|
|
1016
|
+
data: text,
|
|
1017
|
+
})
|
|
1018
|
+
} else if (contentType && contentType.includes('text/xml')) {
|
|
1019
|
+
const text = await res.text();
|
|
1020
|
+
const xmlDoc = new DOMParser().parseFromString(text, "text/xml");
|
|
1021
|
+
res.emit('res', {
|
|
1022
|
+
type: 'xml',
|
|
1023
|
+
data: xmlDoc,
|
|
1024
|
+
});
|
|
1025
|
+
} else if (contentType && contentType.includes('text/event-stream')) {
|
|
1026
|
+
obj.HTTP.readStream(res, ({ chunk, done }) => {
|
|
1027
|
+
res.emit('res', {
|
|
1028
|
+
type: 'stream',
|
|
1029
|
+
data: chunk,
|
|
1030
|
+
done: done,
|
|
1031
|
+
});
|
|
1032
|
+
});
|
|
1033
|
+
} else {
|
|
1034
|
+
const blob = await res.blob();
|
|
1035
|
+
res.emit('res', {
|
|
1036
|
+
type: 'blob',
|
|
1037
|
+
data: blob,
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
368
1040
|
};
|
|
369
1041
|
|
|
1042
|
+
/**
|
|
1043
|
+
* 加载 UI
|
|
1044
|
+
* @param {String} xmlstring
|
|
1045
|
+
* @returns {HTMLElement}
|
|
1046
|
+
*/
|
|
1047
|
+
function loadUI(xmlstring) {
|
|
1048
|
+
const parser = new DOMParser();
|
|
1049
|
+
try {
|
|
1050
|
+
const xmlDoc = parser.parseFromString(xmlstring, "text/xml");
|
|
1051
|
+
const root = xmlDoc.documentElement;
|
|
1052
|
+
if (root.tagName === "Yete") {
|
|
1053
|
+
let html = "<div yete-root>";
|
|
1054
|
+
const rootNodes = root.childNodes;
|
|
1055
|
+
for (let i = 0; i < rootNodes.length; i++) {
|
|
1056
|
+
const node = rootNodes[i];
|
|
1057
|
+
html += parseNode(node);
|
|
1058
|
+
}
|
|
1059
|
+
html += "</div>";
|
|
1060
|
+
return new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
1061
|
+
} else {
|
|
1062
|
+
throw new YeteError("Invalid XML string.");
|
|
1063
|
+
}
|
|
1064
|
+
} catch (error) {
|
|
1065
|
+
throw new YeteError(`Failed to LoadUI : ${error.message}`);
|
|
1066
|
+
}
|
|
1067
|
+
function parseNode(node) {
|
|
1068
|
+
const tagName = node.tagName;
|
|
1069
|
+
if (node.nodeName === "#text") {
|
|
1070
|
+
return node.textContent;
|
|
1071
|
+
}
|
|
1072
|
+
if (node instanceof NodeList) {
|
|
1073
|
+
let html = "";
|
|
1074
|
+
for (let i = 0; i < node.length; i++) {
|
|
1075
|
+
html += parseNode(node[i]);
|
|
1076
|
+
}
|
|
1077
|
+
return html;
|
|
1078
|
+
}
|
|
1079
|
+
if (UIElements[tagName]) {
|
|
1080
|
+
const htmlTagName = UIElements[tagName].html;
|
|
1081
|
+
let attrs = "";
|
|
1082
|
+
for (const i in UIElements[tagName].attr) {
|
|
1083
|
+
const attr = UIElements[tagName].attr[i];
|
|
1084
|
+
console.log(node.hasAttribute(attr), attr);
|
|
1085
|
+
if (node.hasAttribute(attr)) {
|
|
1086
|
+
const value = node.getAttribute(attr);
|
|
1087
|
+
console.log(attr, value);
|
|
1088
|
+
if (value == "true") {
|
|
1089
|
+
attrs += ` ${attr == "id" ? `${"yete-id"}` : attr}`;
|
|
1090
|
+
} else {
|
|
1091
|
+
attrs += ` ${attr == "id" ? `${"yete-id"}` : attr}="${value}"`;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return `<${htmlTagName} ${attrs} style="${UIElements[tagName].style || ""}">${parseNode(node.childNodes)}</${htmlTagName}>`;
|
|
1096
|
+
} else {
|
|
1097
|
+
throw new YeteError(`Invalid tag name: ${tagName}`);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
370
1102
|
/**
|
|
371
1103
|
* 添加事件监听器
|
|
372
1104
|
* @param {String} type
|
|
@@ -392,6 +1124,7 @@ obj.off = obj.removeEventListener;
|
|
|
392
1124
|
*/
|
|
393
1125
|
obj.emit = obj.dispatchEvent;
|
|
394
1126
|
|
|
1127
|
+
|
|
395
1128
|
window.addEventListener("error", function (event) {
|
|
396
1129
|
const { message, filename, lineno, colno, error } = event;
|
|
397
1130
|
if (custom502Page) {
|
|
@@ -409,13 +1142,20 @@ window.addEventListener("error", function (event) {
|
|
|
409
1142
|
if (errorErrorEl) errorErrorEl.innerText = error;
|
|
410
1143
|
obj.emit('page-change', new obj.YeteEvent("page-change", { path, isError: true }));
|
|
411
1144
|
} else {
|
|
412
|
-
document.body.innerHTML = `<center><h1>Have an error: "${message}" in "${filename}" at ${lineno}:${colno}</h1><p>
|
|
1145
|
+
document.body.innerHTML = `<center><h1>Have an error: "${message}" in "${filename}" at ${lineno}:${colno}</h1><p>Power by Yete.</p></center>`;
|
|
413
1146
|
obj.emit('page-change', new obj.YeteEvent("page-change", { path, isError: true }));
|
|
414
1147
|
}
|
|
415
1148
|
});
|
|
416
1149
|
|
|
417
1150
|
window.addEventListener('hashchange', () => {
|
|
418
|
-
const
|
|
1151
|
+
const fullpath = location.hash.slice(1) || '/';
|
|
1152
|
+
console.log("[Yete]", "Full path", fullpath);
|
|
1153
|
+
const SearchParams = fullpath.split("?").slice(1).join("?") || '';
|
|
1154
|
+
const path = fullpath.split("?")[0];
|
|
1155
|
+
const query = new URLSearchParams(SearchParams);
|
|
1156
|
+
searchParams = query;
|
|
1157
|
+
console.log("[Yete]", "Query", query);
|
|
1158
|
+
console.log("[Yete]", "Navigate to", path);
|
|
419
1159
|
obj.toPage(path);
|
|
420
1160
|
});
|
|
421
1161
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
class Button extends HTMLElement {
|
|
2
|
+
static get observedAttributes() {
|
|
3
|
+
return ['variant', 'size', 'disabled', 'loading', 'icon', 'icon-position'];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.attachShadow({ mode: "open" });
|
|
9
|
+
this._rippleElement = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
this._render();
|
|
14
|
+
this._addEventListeners();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
+
if (oldValue !== newValue) {
|
|
19
|
+
this._render();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_render() {
|
|
24
|
+
const variant = this.getAttribute('variant') || 'contained';
|
|
25
|
+
const size = this.getAttribute('size') || 'medium';
|
|
26
|
+
const disabled = this.hasAttribute('disabled');
|
|
27
|
+
const loading = this.hasAttribute('loading');
|
|
28
|
+
const icon = this.getAttribute('icon');
|
|
29
|
+
const iconPosition = this.getAttribute('icon-position') || 'start';
|
|
30
|
+
|
|
31
|
+
this.shadowRoot.innerHTML = `
|
|
32
|
+
<style>
|
|
33
|
+
:host {
|
|
34
|
+
display: inline-block;
|
|
35
|
+
user-select: none;
|
|
36
|
+
}
|
|
37
|
+
.button {
|
|
38
|
+
font-family: Roboto, sans-serif;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
letter-spacing: 0.089em;
|
|
42
|
+
border-radius: 20px; /* Android风格圆角 */
|
|
43
|
+
border: none;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
position: relative;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
transition: all 0.2s ease;
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
gap: 8px;
|
|
52
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); /* Android阴影 */
|
|
53
|
+
min-height: 36px;
|
|
54
|
+
padding: 8px 16px;
|
|
55
|
+
}
|
|
56
|
+
.button:hover {
|
|
57
|
+
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
|
|
58
|
+
}
|
|
59
|
+
.button:active {
|
|
60
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
|
61
|
+
transform: translateY(1px);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.button:disabled {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
opacity: 0.6;
|
|
67
|
+
}
|
|
68
|
+
/* 变体样式 */
|
|
69
|
+
.button.contained {
|
|
70
|
+
background: #1976d2; /* Android蓝色 */
|
|
71
|
+
color: white;
|
|
72
|
+
}
|
|
73
|
+
.button.contained:hover {
|
|
74
|
+
background: #1565c0;
|
|
75
|
+
}
|
|
76
|
+
.button.contained:active {
|
|
77
|
+
background: #0d47a1;
|
|
78
|
+
}
|
|
79
|
+
.button.outlined {
|
|
80
|
+
background: transparent;
|
|
81
|
+
color: #1976d2;
|
|
82
|
+
border: 1px solid #1976d2;
|
|
83
|
+
}
|
|
84
|
+
.button.outlined:hover {
|
|
85
|
+
background: rgba(25, 118, 210, 0.04);
|
|
86
|
+
}
|
|
87
|
+
.button.text {
|
|
88
|
+
background: transparent;
|
|
89
|
+
color: #1976d2;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
}
|
|
92
|
+
.button.text:hover {
|
|
93
|
+
background: rgba(25, 118, 210, 0.04);
|
|
94
|
+
}
|
|
95
|
+
/* 尺寸样式 */
|
|
96
|
+
.button.small { padding: 6px 12px; min-height: 32px; font-size: 12px; }
|
|
97
|
+
.button.medium { padding: 8px 16px; min-height: 36px; font-size: 14px; }
|
|
98
|
+
.button.large { padding: 10px 20px; min-height: 44px; font-size: 16px; }
|
|
99
|
+
/* 波纹效果 */
|
|
100
|
+
.ripple {
|
|
101
|
+
position: absolute;
|
|
102
|
+
border-radius: 50%;
|
|
103
|
+
background: rgba(255, 255, 255, 0.5);
|
|
104
|
+
transform: scale(0);
|
|
105
|
+
animation: ripple-animation 0.6s linear;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
@keyframes ripple-animation {
|
|
109
|
+
to { transform: scale(4); opacity: 0; }
|
|
110
|
+
}
|
|
111
|
+
/* 加载状态 */
|
|
112
|
+
.spinner {
|
|
113
|
+
width: 18px;
|
|
114
|
+
height: 18px;
|
|
115
|
+
border: 2px solid currentColor;
|
|
116
|
+
border-top-color: transparent;
|
|
117
|
+
border-radius: 50%;
|
|
118
|
+
animation: spin 0.8s linear infinite;
|
|
119
|
+
}
|
|
120
|
+
@keyframes spin {
|
|
121
|
+
to { transform: rotate(360deg); }
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
124
|
+
<button class="button ${variant} ${size}" ?disabled="${disabled}">
|
|
125
|
+
${loading ? '<span class="spinner"></span>' : ''}
|
|
126
|
+
${!loading && icon && iconPosition === 'start' ? `<span class="icon">${icon}</span>` : ''}
|
|
127
|
+
<slot></slot>
|
|
128
|
+
${!loading && icon && iconPosition === 'end' ? `<span class="icon">${icon}</span>` : ''}
|
|
129
|
+
</button>
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
_addEventListeners() {
|
|
134
|
+
const button = this.shadowRoot.querySelector('.button');
|
|
135
|
+
button?.addEventListener('click', (e) => this._handleRipple(e));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
_handleRipple(event) {
|
|
139
|
+
if (this.hasAttribute('disabled')) return;
|
|
140
|
+
|
|
141
|
+
const button = event.currentTarget;
|
|
142
|
+
const rect = button.getBoundingClientRect();
|
|
143
|
+
const size = Math.max(rect.width, rect.height);
|
|
144
|
+
|
|
145
|
+
this._rippleElement = document.createElement('span');
|
|
146
|
+
this._rippleElement.classList.add('ripple');
|
|
147
|
+
this._rippleElement.style.width = this._rippleElement.style.height = `${size}px`;
|
|
148
|
+
this._rippleElement.style.left = `${event.clientX - rect.left - size / 2}px`;
|
|
149
|
+
this._rippleElement.style.top = `${event.clientY - rect.top - size / 2}px`;
|
|
150
|
+
|
|
151
|
+
button.appendChild(this._rippleElement);
|
|
152
|
+
setTimeout(() => this._rippleElement?.remove(), 600);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
customElements.define("yete-button", Button);
|
package/libs/yete-ui/Text.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
class Text extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
this.attachShadow({ mode: 'open' });
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
this.shadowRoot.innerHTML = `
|
|
9
|
+
<style>
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
color: var(--text-color, #757575);
|
|
13
|
+
user-select: none;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
<slot></slot>
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
2
19
|
}
|
|
3
20
|
|
|
4
21
|
customElements.define('yete-text', Text);
|
package/libs/yete-ui/yete.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iftc/yete",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"IFTC",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"dexie": "^4.3.0",
|
|
19
|
-
"esbuild": "^0.27.3"
|
|
19
|
+
"esbuild": "^0.27.3",
|
|
20
|
+
"marked": "^17.0.5"
|
|
20
21
|
}
|
|
21
22
|
}
|