ranui 0.1.8 → 0.1.10-alpha.1
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/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
- package/dist/arrow-down-C9jBUUt3.js +30 -0
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/button.js +7 -0
- package/dist/checkbox.js +7 -0
- package/dist/colorpicker.js +13 -0
- package/dist/{colz-746223ab.js → colz-CRDozfZA.js} +1 -5
- package/dist/components/button/index.d.ts +38 -1
- package/dist/components/checkbox/index.d.ts +27 -0
- package/dist/components/colorpicker/index.d.ts +122 -0
- package/dist/components/content/index.d.ts +15 -0
- package/dist/components/input/index.d.ts +208 -1
- package/dist/components/message/index.d.ts +2 -0
- package/dist/components/option/index.d.ts +2 -1
- package/dist/components/player/index.d.ts +207 -493
- package/dist/components/popover/index.d.ts +39 -0
- package/dist/components/preview/docx.d.ts +1 -1
- package/dist/components/preview/index.d.ts +2 -0
- package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
- package/dist/components/progress/index.d.ts +11 -5
- package/dist/components/radar/index.d.ts +1 -1
- package/dist/components/scratch/index.d.ts +23 -0
- package/dist/components/select/index.d.ts +18 -6
- package/dist/components/tab/index.d.ts +5 -0
- package/dist/components/tabpane/index.d.ts +5 -0
- package/dist/content.js +6 -0
- package/dist/docx-ajDUtnbM.js +3665 -0
- package/dist/global-DOfcrQ2N.js +4 -0
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/index-0fvHQjmN.js +298 -0
- package/dist/{index-f6d6982d.js → index-BLepXisd.js} +101 -84
- package/dist/{index-b2be6bef.js → index-BOoNI-Al.js} +904 -1078
- package/dist/index-BPBRPxND.js +195 -0
- package/dist/{index-b90299ca.js → index-BpOERe9M.js} +1 -1
- package/dist/index-Bv6Z6rIe.js +498 -0
- package/dist/index-ByJ7zZdQ.js +65641 -0
- package/dist/{index-5975bbc0.js → index-C1x9Popy.js} +1 -1
- package/dist/index-CCNK5H8T.js +103 -0
- package/dist/{index-a1a53af6.js → index-CD09p_mF.js} +7 -31
- package/dist/index-CFnsLnrb.js +496 -0
- package/dist/{index-a43b144f.js → index-CJZp9lE4.js} +29 -50
- package/dist/{index-57492b9b.js → index-CSnBqUsQ.js} +48 -1
- package/dist/index-CWWI8SHO.js +206 -0
- package/dist/{index-7b8840f9.js → index-CZlEoE62.js} +220 -1010
- package/dist/index-CbyMC6Yz.js +59 -0
- package/dist/index-CiBVH-oH.js +258 -0
- package/dist/{index-0e7229ea.js → index-DUMmFdJ7.js} +9 -21
- package/dist/{index-aea75a9f.js → index-Du-Biu-I.js} +1 -1
- package/dist/index-EnzWG8R0.js +521 -0
- package/dist/index-F2RO3OU4.js +501 -0
- package/dist/{index-7f513a14.js → index-GavQwMDL.js} +11 -29
- package/dist/{index-48653b79.js → index-suip9eAw.js} +2 -2
- package/dist/index.d.ts +18 -14
- package/dist/index.js +23 -19
- package/dist/info-circle-fill-CFeVMdci.js +4 -0
- package/dist/input.js +6 -0
- package/dist/inputShadowless.js +6 -0
- package/dist/jszip.min-Ca6PjkYs.js +2674 -0
- package/dist/message.js +5 -0
- package/dist/modal.js +4 -0
- package/dist/{components/option/index.js → option.js} +3 -6
- package/dist/{pdf-bdb7818a.js → pdf-B2a6ll8f.js} +1 -1
- package/dist/player.js +8 -0
- package/dist/popover.js +6 -0
- package/dist/preview.js +7 -0
- package/dist/progress.js +7 -0
- package/dist/radar.js +6 -0
- package/dist/select.js +10 -0
- package/dist/selectShadowless.js +10 -0
- package/dist/{umd/components/image → shadowless/icon}/index.d.ts +1 -0
- package/dist/shadowless/input/index.d.ts +210 -0
- package/dist/{umd/components → shadowless}/select/index.d.ts +19 -11
- package/dist/shadowless/shadowless/index.js +14 -0
- package/dist/shadowless.d.ts +3 -0
- package/dist/skeleton.js +4 -0
- package/dist/sprite-CH2zLtZy.js +141 -0
- package/dist/style.css +1 -1
- package/dist/tab.js +6 -0
- package/dist/tabpane.js +4 -0
- package/dist/tsconfig.json +29 -0
- package/dist/umd/index.umd.cjs +21 -32
- package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
- package/dist/umd/shadowless/style.css +1 -0
- package/dist/umd/style.css +1 -1
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/index.d.ts +9 -1
- package/dist/utils-BMBEcoPj.js +356 -0
- package/dist/vite.config.d.ts +1 -0
- package/package.json +61 -39
- package/readme.md +14 -14
- package/typings.d.ts +101 -0
- package/dist/components/button/index.js +0 -7
- package/dist/components/icon/index.js +0 -6
- package/dist/components/image/index.js +0 -4
- package/dist/components/input/index.js +0 -5
- package/dist/components/message/index.js +0 -4
- package/dist/components/modal/index.js +0 -4
- package/dist/components/player/index.js +0 -11
- package/dist/components/preview/index.js +0 -8
- package/dist/components/progress/index.js +0 -8
- package/dist/components/radar/index.js +0 -7
- package/dist/components/select/index.js +0 -11
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/tab/index.js +0 -7
- package/dist/components/tabpane/index.js +0 -4
- package/dist/docx-c5d02d8c.js +0 -21
- package/dist/index-183517e7.js +0 -265
- package/dist/index-4d873a42.js +0 -195
- package/dist/index-a216f328.js +0 -662
- package/dist/index-d2d69b06.js +0 -225
- package/dist/index-ecaed5cc.js +0 -439
- package/dist/info-circle-fill-90ec9aa9.js +0 -14
- package/dist/umd/build/config.d.ts +0 -3
- package/dist/umd/build/config.umd.d.ts +0 -2
- package/dist/umd/components/button/index.d.ts +0 -2
- package/dist/umd/components/form/index.d.ts +0 -2
- package/dist/umd/components/icon/index.d.ts +0 -2
- package/dist/umd/components/input/index.d.ts +0 -2
- package/dist/umd/components/message/index.d.ts +0 -14
- package/dist/umd/components/modal/index.d.ts +0 -2
- package/dist/umd/components/option/index.d.ts +0 -2
- package/dist/umd/components/player/index.d.ts +0 -524
- package/dist/umd/components/preview/colz.d.ts +0 -72
- package/dist/umd/components/preview/docx.d.ts +0 -8
- package/dist/umd/components/preview/excel/excel.d.ts +0 -2
- package/dist/umd/components/preview/excel/index.d.ts +0 -1
- package/dist/umd/components/preview/excel/media.d.ts +0 -37
- package/dist/umd/components/preview/index.d.ts +0 -6
- package/dist/umd/components/preview/pdf.d.ts +0 -1
- package/dist/umd/components/preview/pptx/index.d.ts +0 -16
- package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
- package/dist/umd/components/progress/index.d.ts +0 -36
- package/dist/umd/components/radar/index.d.ts +0 -2
- package/dist/umd/components/skeleton/index.d.ts +0 -2
- package/dist/umd/components/tab/index.d.ts +0 -403
- package/dist/umd/components/tabpane/index.d.ts +0 -347
- package/dist/umd/index.d.ts +0 -14
- package/dist/umd/playwright.config.d.ts +0 -9
- package/dist/umd/plugins/auto-import-file.d.ts +0 -0
- package/dist/umd/plugins/load-style.d.ts +0 -6
- package/dist/umd/plugins/load-svg.d.ts +0 -9
- package/dist/umd/tests/button.spec.d.ts +0 -1
- package/dist/umd/utils/image.d.ts +0 -32
- package/dist/umd/utils/index.d.ts +0 -64
- package/dist/umd/utils/math.d.ts +0 -26
- package/dist/umd/utils/tween.d.ts +0 -21
- package/dist/umd/vite.config.d.ts +0 -6
- package/dist/vendor-f71e6f68.js +0 -92126
- /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
- /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
- /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
- /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
- /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
- /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
- /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
- /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
- /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
- /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
- /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
- /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
- /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
- /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
- /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
- /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
- /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
- /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
- /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
- /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
- /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
- /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
- /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
- /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const hsv2hsl: (h: number, s: number, v: number) => {
|
|
2
|
+
h: number;
|
|
3
|
+
s: number;
|
|
4
|
+
l: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const hex2alpha: (aa: string) => number;
|
|
7
|
+
export declare const hex2hsl: (hex: string) => {
|
|
8
|
+
h: number;
|
|
9
|
+
s: number;
|
|
10
|
+
l: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const hex2hsv: (hex: string) => {
|
|
13
|
+
h: number;
|
|
14
|
+
s: number;
|
|
15
|
+
v: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const hex2rgb: (hex: string) => {
|
|
18
|
+
r: number;
|
|
19
|
+
g: number;
|
|
20
|
+
b: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const rgb2hsv: (r: number, g: number, b: number) => {
|
|
23
|
+
h: number;
|
|
24
|
+
s: number;
|
|
25
|
+
v: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const hsl2hsv: (h: number, s: number, l: number) => {
|
|
28
|
+
h: number;
|
|
29
|
+
s: number;
|
|
30
|
+
v: number;
|
|
31
|
+
};
|
|
32
|
+
export declare const hsl2rgb: (h: number, s: number, l: number) => {
|
|
33
|
+
r: number;
|
|
34
|
+
g: number;
|
|
35
|
+
b: number;
|
|
36
|
+
};
|
|
37
|
+
export declare const hsv2rgb: (h: number, s: number, v: number) => {
|
|
38
|
+
r: number;
|
|
39
|
+
g: number;
|
|
40
|
+
b: number;
|
|
41
|
+
};
|
|
42
|
+
export declare const rgb2hex: (r: number, g: number, b: number) => string;
|
|
43
|
+
export declare const rgba: (r: number, g: number, b: number, a: number) => string;
|
|
44
|
+
export declare const rgba2hex: (r: number, g: number, b: number, a: number) => string;
|
|
45
|
+
export declare const rgba2rgb: (r: number, g: number, b: number, a: number) => {
|
|
46
|
+
r: number;
|
|
47
|
+
g: number;
|
|
48
|
+
b: number;
|
|
49
|
+
};
|
|
50
|
+
export declare const HEX_COLOR_REGEX: RegExp;
|
|
51
|
+
export declare const RGB_REGEX: RegExp;
|
|
52
|
+
export declare const RGBA_REGEX: RegExp;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const loadScript: (src: string) => Promise<{
|
|
|
21
21
|
export interface CustomErrorType {
|
|
22
22
|
new (m: string): void;
|
|
23
23
|
}
|
|
24
|
-
export declare function createCustomError(msg
|
|
24
|
+
export declare function createCustomError(msg?: string): CustomErrorType;
|
|
25
25
|
export declare const vod: {
|
|
26
26
|
FD: {
|
|
27
27
|
label: string;
|
|
@@ -62,3 +62,11 @@ export declare const vod: {
|
|
|
62
62
|
label: string;
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
+
export declare const HTMLElementSSR: () => {
|
|
66
|
+
new (): HTMLElement;
|
|
67
|
+
prototype: HTMLElement;
|
|
68
|
+
} | null;
|
|
69
|
+
export declare const createSignal: <T = unknown>(value: T, options?: {
|
|
70
|
+
subscriber?: Function[] | undefined;
|
|
71
|
+
equals?: boolean | ((prev: T | undefined, next: T) => boolean) | undefined;
|
|
72
|
+
} | undefined) => [() => T, (newValue: T) => void];
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
const noop = () => {
|
|
8
|
+
};
|
|
9
|
+
function formatDuration(time) {
|
|
10
|
+
return time < 10 ? `0${time}` : time;
|
|
11
|
+
}
|
|
12
|
+
function timestampToTime(timestamp) {
|
|
13
|
+
let date = /* @__PURE__ */ new Date();
|
|
14
|
+
if (timestamp) {
|
|
15
|
+
date = new Date(timestamp);
|
|
16
|
+
}
|
|
17
|
+
date.format = (format = "YYYY-MM-DD HH:mm:ss") => {
|
|
18
|
+
const year = date.getFullYear();
|
|
19
|
+
const month = formatDuration(date.getMonth() + 1);
|
|
20
|
+
const day = formatDuration(date.getDate());
|
|
21
|
+
const hour = formatDuration(date.getHours());
|
|
22
|
+
const minute = formatDuration(date.getMinutes());
|
|
23
|
+
const second = formatDuration(date.getSeconds());
|
|
24
|
+
return format.replace(/Y+/gi, `${year}`).replace(/M+/g, `${month}`).replace(/D+/gi, `${day}`).replace(/H+/gi, `${hour}`).replace(/m+/g, `${minute}`).replace(/S+/gi, `${second}`);
|
|
25
|
+
};
|
|
26
|
+
return date;
|
|
27
|
+
}
|
|
28
|
+
const timeFormat = (time) => {
|
|
29
|
+
if (time === 0)
|
|
30
|
+
return "00:00";
|
|
31
|
+
if (!time)
|
|
32
|
+
return "";
|
|
33
|
+
const hour = Math.trunc(time / 3600);
|
|
34
|
+
const minute = Math.trunc(time % 3600 / 60);
|
|
35
|
+
const second = formatDuration(Math.trunc(time - hour * 3600 - minute * 60));
|
|
36
|
+
if (hour === 0) {
|
|
37
|
+
return `${formatDuration(minute)}:${second}`;
|
|
38
|
+
}
|
|
39
|
+
return `${formatDuration(hour)}:${formatDuration(minute)}:${second}`;
|
|
40
|
+
};
|
|
41
|
+
const getPixelRatio = (context) => {
|
|
42
|
+
const backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1;
|
|
43
|
+
return (window.devicePixelRatio || 1) / backingStore;
|
|
44
|
+
};
|
|
45
|
+
const currentDevice = () => {
|
|
46
|
+
if (typeof window !== "undefined") {
|
|
47
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
48
|
+
if (/ipad|ipod/.test(ua))
|
|
49
|
+
return "ipad";
|
|
50
|
+
if (/android/.test(ua))
|
|
51
|
+
return "android";
|
|
52
|
+
if (/iphone/.test(ua))
|
|
53
|
+
return "iphone";
|
|
54
|
+
return "pc";
|
|
55
|
+
}
|
|
56
|
+
return "pc";
|
|
57
|
+
};
|
|
58
|
+
const isMobile = () => {
|
|
59
|
+
const ua = window.navigator.userAgent;
|
|
60
|
+
if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(ua)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
};
|
|
65
|
+
const addClassToElement = (element, addClass) => {
|
|
66
|
+
if (typeof document === "undefined")
|
|
67
|
+
return void 0;
|
|
68
|
+
const classList = element.classList;
|
|
69
|
+
if (!classList.contains(addClass)) {
|
|
70
|
+
classList.add(addClass);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const removeClassToElement = (element, removeClass) => {
|
|
74
|
+
if (typeof document === "undefined")
|
|
75
|
+
return void 0;
|
|
76
|
+
const classList = element.classList;
|
|
77
|
+
if (classList.contains(removeClass)) {
|
|
78
|
+
classList.remove(removeClass);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const createDocumentFragment = (list) => {
|
|
82
|
+
if (typeof document === "undefined")
|
|
83
|
+
return void 0;
|
|
84
|
+
const Fragment = document.createDocumentFragment();
|
|
85
|
+
list.forEach((item) => Fragment.appendChild(item));
|
|
86
|
+
return Fragment;
|
|
87
|
+
};
|
|
88
|
+
const generateThrottle = () => {
|
|
89
|
+
let timer;
|
|
90
|
+
return function(fn, wait = 300) {
|
|
91
|
+
return function(...args) {
|
|
92
|
+
if (timer) {
|
|
93
|
+
clearTimeout(timer);
|
|
94
|
+
timer = void 0;
|
|
95
|
+
}
|
|
96
|
+
const context = this;
|
|
97
|
+
if (!timer) {
|
|
98
|
+
timer = setTimeout(() => {
|
|
99
|
+
fn.apply(context, args);
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
timer = void 0;
|
|
102
|
+
}, wait);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
const codes = /* @__PURE__ */ new Map([
|
|
108
|
+
[100, "Continue"],
|
|
109
|
+
[101, "Switching Protocols"],
|
|
110
|
+
[102, "Processing"],
|
|
111
|
+
[103, "Early Hints"],
|
|
112
|
+
[200, "OK"],
|
|
113
|
+
[201, "Created"],
|
|
114
|
+
[202, "Accepted"],
|
|
115
|
+
[203, "Non-Authoritative Information"],
|
|
116
|
+
[204, "No Content"],
|
|
117
|
+
[205, "Reset Content"],
|
|
118
|
+
[206, "Partial Content"],
|
|
119
|
+
[207, "Multi-Status"],
|
|
120
|
+
[208, "Already Reported"],
|
|
121
|
+
[226, "IM Used"],
|
|
122
|
+
[300, "Multiple Choices"],
|
|
123
|
+
[301, "Moved Permanently"],
|
|
124
|
+
[302, "Found"],
|
|
125
|
+
[303, "See Other"],
|
|
126
|
+
[304, "Not Modified"],
|
|
127
|
+
[305, "Use Proxy"],
|
|
128
|
+
[307, "Temporary Redirect"],
|
|
129
|
+
[308, "Permanent Redirect"],
|
|
130
|
+
[400, "Bad Request"],
|
|
131
|
+
[401, "Unauthorized"],
|
|
132
|
+
[402, "Payment Required"],
|
|
133
|
+
[403, "Forbidden"],
|
|
134
|
+
[404, "Not Found"],
|
|
135
|
+
[405, "Method Not Allowed"],
|
|
136
|
+
[406, "Not Acceptable"],
|
|
137
|
+
[407, "Proxy Authentication Required"],
|
|
138
|
+
[408, "Request Timeout"],
|
|
139
|
+
[409, "Conflict"],
|
|
140
|
+
[410, "Gone"],
|
|
141
|
+
[411, "Length Required"],
|
|
142
|
+
[412, "Precondition Failed"],
|
|
143
|
+
[413, "Payload Too Large"],
|
|
144
|
+
[414, "URI Too Long"],
|
|
145
|
+
[415, "Unsupported Media Type"],
|
|
146
|
+
[416, "Range Not Satisfiable"],
|
|
147
|
+
[417, "Expectation Failed"],
|
|
148
|
+
[418, "I'm a Teapot"],
|
|
149
|
+
[421, "Misdirected Request"],
|
|
150
|
+
[422, "Unprocessable Entity"],
|
|
151
|
+
[423, "Locked"],
|
|
152
|
+
[424, "Failed Dependency"],
|
|
153
|
+
[425, "Too Early"],
|
|
154
|
+
[426, "Upgrade Required"],
|
|
155
|
+
[428, "Precondition Required"],
|
|
156
|
+
[429, "Too Many Requests"],
|
|
157
|
+
[431, "Request Header Fields Too Large"],
|
|
158
|
+
[451, "Unavailable For Legal Reasons"],
|
|
159
|
+
[500, "Internal Server Error"],
|
|
160
|
+
[501, "Not Implemented"],
|
|
161
|
+
[502, "Bad Gateway"],
|
|
162
|
+
[503, "Service Unavailable"],
|
|
163
|
+
[504, "Gateway Timeout"],
|
|
164
|
+
[505, "HTTP Version Not Supported"],
|
|
165
|
+
[506, "Variant Also Negotiates"],
|
|
166
|
+
[507, "Insufficient Storage"],
|
|
167
|
+
[508, "Loop Detected"],
|
|
168
|
+
[509, "Bandwidth Limit Exceeded"],
|
|
169
|
+
[510, "Not Extended"],
|
|
170
|
+
[511, "Network Authentication Required"]
|
|
171
|
+
]);
|
|
172
|
+
({
|
|
173
|
+
// status code to message map
|
|
174
|
+
message: codes,
|
|
175
|
+
// status message (lower-case) to code map
|
|
176
|
+
code: createMessageToStatusCodeMap(codes),
|
|
177
|
+
// array of status codes
|
|
178
|
+
codes: createStatusCodeList(codes),
|
|
179
|
+
// status codes for redirects
|
|
180
|
+
redirect: {
|
|
181
|
+
300: true,
|
|
182
|
+
301: true,
|
|
183
|
+
302: true,
|
|
184
|
+
303: true,
|
|
185
|
+
305: true,
|
|
186
|
+
307: true,
|
|
187
|
+
308: true
|
|
188
|
+
},
|
|
189
|
+
// status codes for empty bodies
|
|
190
|
+
empty: {
|
|
191
|
+
204: true,
|
|
192
|
+
205: true,
|
|
193
|
+
304: true
|
|
194
|
+
},
|
|
195
|
+
// status codes for when you should retry the request
|
|
196
|
+
retry: {
|
|
197
|
+
502: true,
|
|
198
|
+
503: true,
|
|
199
|
+
504: true
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
function createMessageToStatusCodeMap(codes2) {
|
|
203
|
+
const map = /* @__PURE__ */ new Map();
|
|
204
|
+
for (const [status2, message] of codes2) {
|
|
205
|
+
map.set(message.toLowerCase(), status2);
|
|
206
|
+
}
|
|
207
|
+
return map;
|
|
208
|
+
}
|
|
209
|
+
function createStatusCodeList(codes2) {
|
|
210
|
+
const codeList = [];
|
|
211
|
+
for (const [status2, _] of codes2) {
|
|
212
|
+
codeList.push(status2);
|
|
213
|
+
}
|
|
214
|
+
return codeList;
|
|
215
|
+
}
|
|
216
|
+
const perToNum = (str = "") => {
|
|
217
|
+
if (str.length === 0)
|
|
218
|
+
return 0;
|
|
219
|
+
if (str.endsWith("%")) {
|
|
220
|
+
const value = Number(str.replace("%", ""));
|
|
221
|
+
return value > 1 ? value / 100 : value;
|
|
222
|
+
} else {
|
|
223
|
+
return Number(str);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const range = (num, min = 0, max = 1) => {
|
|
227
|
+
return Math.min(max, Math.max(min, num));
|
|
228
|
+
};
|
|
229
|
+
const _Mathjs = class _Mathjs2 {
|
|
230
|
+
constructor() {
|
|
231
|
+
__publicField(this, "getDecimalLength", (n2) => {
|
|
232
|
+
const [_, decimal] = n2.toString().split(".");
|
|
233
|
+
return decimal ? decimal.length : 0;
|
|
234
|
+
});
|
|
235
|
+
__publicField(this, "amend", (n2, precision = 15) => parseFloat(Number(n2).toPrecision(precision)));
|
|
236
|
+
__publicField(this, "power", (a2, b2) => Math.pow(10, Math.max(this.getDecimalLength(a2), this.getDecimalLength(b2))));
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
__publicField(_Mathjs, "handleMethod", (l2, r2) => {
|
|
240
|
+
const mathjs2 = new _Mathjs();
|
|
241
|
+
const { power, amend } = mathjs2;
|
|
242
|
+
const pow = power(l2, r2);
|
|
243
|
+
const a2 = amend(l2 * pow);
|
|
244
|
+
const b2 = amend(r2 * pow);
|
|
245
|
+
return (type) => {
|
|
246
|
+
switch (type) {
|
|
247
|
+
case "+":
|
|
248
|
+
return (a2 + b2) / pow;
|
|
249
|
+
case "-":
|
|
250
|
+
return (a2 - b2) / pow;
|
|
251
|
+
case "*":
|
|
252
|
+
return a2 * b2 / (pow * pow);
|
|
253
|
+
case "/":
|
|
254
|
+
return a2 / b2;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
});
|
|
258
|
+
__publicField(_Mathjs, "add", (a2, b2) => {
|
|
259
|
+
return _Mathjs.handleMethod(a2, b2)("+");
|
|
260
|
+
});
|
|
261
|
+
__publicField(_Mathjs, "divide", (a2, b2) => {
|
|
262
|
+
return _Mathjs.handleMethod(a2, b2)("/");
|
|
263
|
+
});
|
|
264
|
+
__publicField(_Mathjs, "multiply", (a2, b2) => {
|
|
265
|
+
return _Mathjs.handleMethod(a2, b2)("*");
|
|
266
|
+
});
|
|
267
|
+
__publicField(_Mathjs, "subtract", (a2, b2) => {
|
|
268
|
+
return _Mathjs.handleMethod(a2, b2)("-");
|
|
269
|
+
});
|
|
270
|
+
const NEW_LISTENER = "NEW_LISTENER";
|
|
271
|
+
class SyncHook {
|
|
272
|
+
constructor() {
|
|
273
|
+
__publicField(this, "_events");
|
|
274
|
+
__publicField(this, "tap", (eventName, eventItem) => {
|
|
275
|
+
if (this._events[eventName] && eventName !== Symbol.for(NEW_LISTENER)) {
|
|
276
|
+
this.call(Symbol.for(NEW_LISTENER), eventName);
|
|
277
|
+
}
|
|
278
|
+
const callbacks = this._events[eventName] || [];
|
|
279
|
+
if (typeof eventItem === "function") {
|
|
280
|
+
callbacks.push({
|
|
281
|
+
name: eventName,
|
|
282
|
+
callback: eventItem
|
|
283
|
+
});
|
|
284
|
+
} else {
|
|
285
|
+
callbacks.push(eventItem);
|
|
286
|
+
}
|
|
287
|
+
this._events[eventName] = callbacks;
|
|
288
|
+
});
|
|
289
|
+
__publicField(this, "call", (eventName, ...args) => {
|
|
290
|
+
const callbacks = this._events[eventName] || [];
|
|
291
|
+
callbacks.forEach((item) => {
|
|
292
|
+
const { callback } = item;
|
|
293
|
+
callback(...args);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
__publicField(this, "callSync", async (eventName, ...args) => {
|
|
297
|
+
const callbacks = this._events[eventName] || [];
|
|
298
|
+
for (const item of callbacks) {
|
|
299
|
+
const { callback } = item;
|
|
300
|
+
await callback(...args);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
__publicField(this, "once", (eventName, eventItem) => {
|
|
304
|
+
let one;
|
|
305
|
+
if (typeof eventItem === "function") {
|
|
306
|
+
one = {
|
|
307
|
+
name: eventName,
|
|
308
|
+
callback: (...args) => {
|
|
309
|
+
eventItem(...args);
|
|
310
|
+
this.off(eventName, one);
|
|
311
|
+
},
|
|
312
|
+
initialCallback: eventItem
|
|
313
|
+
};
|
|
314
|
+
} else {
|
|
315
|
+
const { callback } = eventItem;
|
|
316
|
+
one = {
|
|
317
|
+
name: eventName,
|
|
318
|
+
callback: (...args) => {
|
|
319
|
+
callback(...args);
|
|
320
|
+
this.off(eventName, one);
|
|
321
|
+
},
|
|
322
|
+
initialCallback: callback
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
this.tap(eventName, one);
|
|
326
|
+
});
|
|
327
|
+
__publicField(this, "off", (eventName, eventItem) => {
|
|
328
|
+
const callbacks = this._events[eventName] || [];
|
|
329
|
+
const newCallbacks = callbacks.filter((item) => {
|
|
330
|
+
if (typeof eventItem === "function") {
|
|
331
|
+
return item.callback !== eventItem && item.initialCallback !== eventItem;
|
|
332
|
+
} else {
|
|
333
|
+
const { callback } = eventItem;
|
|
334
|
+
return item.callback !== callback && item.initialCallback !== callback;
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
this._events[eventName] = newCallbacks;
|
|
338
|
+
});
|
|
339
|
+
this._events = {};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
export {
|
|
343
|
+
SyncHook as S,
|
|
344
|
+
addClassToElement as a,
|
|
345
|
+
createDocumentFragment as b,
|
|
346
|
+
currentDevice as c,
|
|
347
|
+
generateThrottle as d,
|
|
348
|
+
range as e,
|
|
349
|
+
timestampToTime as f,
|
|
350
|
+
getPixelRatio as g,
|
|
351
|
+
isMobile as i,
|
|
352
|
+
noop as n,
|
|
353
|
+
perToNum as p,
|
|
354
|
+
removeClassToElement as r,
|
|
355
|
+
timeFormat as t
|
|
356
|
+
};
|
package/dist/vite.config.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BuildOptions, UserConfig } from 'vite';
|
|
2
2
|
export declare const umd: BuildOptions;
|
|
3
|
+
export declare const umdShadowless: BuildOptions;
|
|
3
4
|
export declare const es: BuildOptions;
|
|
4
5
|
export declare const viteConfig: UserConfig;
|
|
5
6
|
declare const _default: UserConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ranui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10-alpha.1",
|
|
4
4
|
"description": "UI Component library based on `Web Component`",
|
|
5
5
|
"main": "dist/umd/index.umd.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -9,16 +9,32 @@
|
|
|
9
9
|
"homepage": "https://chaxus.github.io/ran/src/ranui/",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/chaxus/ran
|
|
12
|
+
"url": "git+https://github.com/chaxus/ran",
|
|
13
|
+
"directory": "packages/ranui"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/chaxus/ran/issues"
|
|
13
17
|
},
|
|
14
18
|
"author": "chaxus",
|
|
15
19
|
"license": "MIT",
|
|
16
|
-
"files": [
|
|
17
|
-
"dist/*"
|
|
18
|
-
],
|
|
19
20
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
21
|
+
"node": ">=12.20.0"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "vite",
|
|
25
|
+
"build": "sh ./bin/build.sh",
|
|
26
|
+
"build:es": "vite build -c ./build/config.es.ts",
|
|
27
|
+
"build:umd": "vite build -c ./build/config.umd.ts",
|
|
28
|
+
"prepublish": "npm run build",
|
|
29
|
+
"test": "sh ./bin/test.sh",
|
|
30
|
+
"test:report": "playwright show-report",
|
|
31
|
+
"test:ui": "playwright test --ui",
|
|
32
|
+
"test:update": "playwright test --update-snapshots"
|
|
21
33
|
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"typings.d.ts"
|
|
37
|
+
],
|
|
22
38
|
"keywords": [
|
|
23
39
|
"ran",
|
|
24
40
|
"component",
|
|
@@ -37,6 +53,11 @@
|
|
|
37
53
|
"import": "./dist/index.js",
|
|
38
54
|
"require": "./dist/umd/index.umd.cjs"
|
|
39
55
|
},
|
|
56
|
+
"./shadowless": {
|
|
57
|
+
"types": "./dist/index.d.ts",
|
|
58
|
+
"import": "./dist/shadowless/shadowless/index.js",
|
|
59
|
+
"require": "./dist/umd/shadowless/shadowless.umd.cjs"
|
|
60
|
+
},
|
|
40
61
|
"./button": {
|
|
41
62
|
"types": "./dist/components/button/index.d.ts",
|
|
42
63
|
"import": "./dist/components/button/index.js",
|
|
@@ -112,6 +133,21 @@
|
|
|
112
133
|
"import": "./dist/components/player/index.js",
|
|
113
134
|
"require": "./dist/umd/index.umd.cjs"
|
|
114
135
|
},
|
|
136
|
+
"./popover": {
|
|
137
|
+
"types": "./dist/components/popover/index.d.ts",
|
|
138
|
+
"import": "./dist/components/popover/index.js",
|
|
139
|
+
"require": "./dist/umd/index.umd.cjs"
|
|
140
|
+
},
|
|
141
|
+
"./content": {
|
|
142
|
+
"types": "./dist/components/content/index.d.ts",
|
|
143
|
+
"import": "./dist/components/content/index.js",
|
|
144
|
+
"require": "./dist/umd/index.umd.cjs"
|
|
145
|
+
},
|
|
146
|
+
"./colorpicker": {
|
|
147
|
+
"types": "./dist/components/colorpicker/index.d.ts",
|
|
148
|
+
"import": "./dist/components/colorpicker/index.js",
|
|
149
|
+
"require": "./dist/umd/index.umd.cjs"
|
|
150
|
+
},
|
|
115
151
|
"./style": {
|
|
116
152
|
"types": "./dist/index.d.ts",
|
|
117
153
|
"import": "./dist/style.css",
|
|
@@ -119,42 +155,28 @@
|
|
|
119
155
|
}
|
|
120
156
|
},
|
|
121
157
|
"devDependencies": {
|
|
122
|
-
"@babel/core": "^7.
|
|
123
|
-
"@babel/preset-env": "^7.
|
|
124
|
-
"@babel/preset-typescript": "^7.
|
|
125
|
-
"@playwright/test": "^1.
|
|
126
|
-
"@types/imagemin-svgo": "^10.0.
|
|
127
|
-
"@types/lodash": "^4.
|
|
128
|
-
"@types/tinycolor2": "^1.4.
|
|
129
|
-
"@vheemstra/vite-plugin-imagemin": "^1.
|
|
158
|
+
"@babel/core": "^7.24.3",
|
|
159
|
+
"@babel/preset-env": "^7.24.3",
|
|
160
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
161
|
+
"@playwright/test": "^1.42.1",
|
|
162
|
+
"@types/imagemin-svgo": "^10.0.5",
|
|
163
|
+
"@types/lodash": "^4.17.0",
|
|
164
|
+
"@types/tinycolor2": "^1.4.6",
|
|
165
|
+
"@vheemstra/vite-plugin-imagemin": "^1.2.1",
|
|
130
166
|
"imagemin-svgo": "^10.0.1",
|
|
131
|
-
"less": "^4.
|
|
132
|
-
"prettier": "^2.8.
|
|
133
|
-
"rollup-plugin-visualizer": "^5.
|
|
134
|
-
"svgo": "^3.
|
|
135
|
-
"tsx": "^3.
|
|
136
|
-
"vite": "^
|
|
137
|
-
"vite-plugin-dts": "^3.6.3"
|
|
167
|
+
"less": "^4.2.0",
|
|
168
|
+
"prettier": "^2.8.8",
|
|
169
|
+
"rollup-plugin-visualizer": "^5.12.0",
|
|
170
|
+
"svgo": "^3.2.0",
|
|
171
|
+
"tsx": "^3.14.0",
|
|
172
|
+
"vite": "^5.2.6"
|
|
138
173
|
},
|
|
139
174
|
"dependencies": {
|
|
140
|
-
"dayjs": "^1.11.
|
|
141
|
-
"
|
|
142
|
-
"exceljs": "^4.3.0",
|
|
175
|
+
"dayjs": "^1.11.10",
|
|
176
|
+
"exceljs": "^4.4.0",
|
|
143
177
|
"jszip": "^3.10.1",
|
|
144
178
|
"lodash": "^4.17.21",
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"ranuts": "0.1.0-alpha.10"
|
|
148
|
-
},
|
|
149
|
-
"scripts": {
|
|
150
|
-
"dev": "vite",
|
|
151
|
-
"build": "sh ./bin/build.sh",
|
|
152
|
-
"build:es": "vite build -c ./build/config.es.ts",
|
|
153
|
-
"build:umd": "vite build -c ./build/config.umd.ts",
|
|
154
|
-
"prepublish": "npm run build",
|
|
155
|
-
"test": "sh ./bin/test.sh",
|
|
156
|
-
"test:report": "playwright show-report",
|
|
157
|
-
"test:ui": "playwright test --ui",
|
|
158
|
-
"test:update": "playwright test --update-snapshots"
|
|
179
|
+
"ranuts": "workspace:0.1.0-alpha.11",
|
|
180
|
+
"tinycolor2": "^1.6.0"
|
|
159
181
|
}
|
|
160
|
-
}
|
|
182
|
+
}
|
package/readme.md
CHANGED
|
@@ -7,14 +7,18 @@ UI Component library based on `Web Component`
|
|
|
7
7
|
<a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/github/actions/workflow/status/chaxus/ran/ci.yml" alt="Build Status"></a>
|
|
8
8
|
<a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/npm/v/ranui.svg" alt="npm-v"></a>
|
|
9
9
|
<a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/npm/dt/ranui.svg" alt="npm-d"></a>
|
|
10
|
-
<a href="https://github.com/chaxus/ran"><img src="https://img.badgesize.io/https:/unpkg.com/ranui/dist/umd/
|
|
10
|
+
<a href="https://github.com/chaxus/ran"><img src="https://img.badgesize.io/https:/unpkg.com/ranui/dist/umd/shadowless/shadowless.umd.cjs?label=brotli&compression=brotli" alt="brotli"></a>
|
|
11
11
|
<a href="https://github.com/chaxus/ran"><img src="https://img.shields.io/badge/module%20formats-umd%2C%20esm-green.svg" alt="module formats: umd, esm"></a>
|
|
12
12
|
|
|
13
13
|
## Feature
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
1. **High Cross-Framework Compatibility**: Our solution seamlessly adapts to a wide array of leading front-end frameworks, including `React`, `Vue`, `Preact`, `SolidJS`, `Svelte`, and more. It also integrates smoothly with any project built on `JavaScript` and adhering to `W3C` standards. No matter your choice of technology stack, we guarantee consistent and reliable support.
|
|
16
|
+
2. **Pure Native Experience**: Our solution eliminates the need for dependencies on front-end frameworks like `npm`, `React`/`Vue`, or complex build tools such as `webpack`/`vite`. It truly embodies the essence of Web technology. You can get started effortlessly, just like manipulating native `div` tags, immediately experiencing the purity and intuitiveness of the technology. This design not only simplifies project structure but also reduces the cost of learning and usage, enabling every developer to appreciate the native charm of Web technology.
|
|
17
|
+
3. **Ultimate Modular Design**: Utilizing the principle of minimal modularization, we carefully dismantle large and complex systems or applications into extremely small, functionally independent, and easily reusable component units. This approach significantly enhances code maintainability, scalability, and reusability.
|
|
18
|
+
4. **Fully Open-Source for Free Learning**: Our project fully adheres to the `MIT` open-source license, granting unrestricted access to all source code. This means you are free to access, learn from, reference, and even modify our code, whether for personal development or commercial applications. We firmly believe that open-source is a vital pathway for technological advancement and innovation.
|
|
19
|
+
5. **Interactive and Comprehensive Documentation**: We provide detailed and highly interactive documentation, where all component examples are live and interactive. This allows you to directly experience the component functionality while reading, deepening your understanding and enabling quick hands-on learning. This design is aimed at providing you with the most intuitive and efficient learning experience possible.
|
|
20
|
+
6. **Type-Checking Support**: Our development environment is fully built on `TypeScript`, equipped with comprehensive declaration files and type definitions, ensuring smooth integration for both `JavaScript` and `TypeScript` projects. With powerful type-checking capabilities, we significantly enhance code readability, maintainability, and project robustness, bringing unprecedented convenience and peace of mind to development work.
|
|
21
|
+
7. **Enhanced Durability and Stability**: Our solution offers exceptional stability, eliminating concerns about disruptive updates encountered during version upgrades, such as `React` from version `15` to `16` (with `fiber`) or `Vue` from version `2` to `3` (with `hooks`). We ensure that your components won't be forced into unnecessary updates or redevelopments, thus avoiding potential project interruptions and additional workloads. This translates into a continuous and hassle-free project operation.
|
|
18
22
|
|
|
19
23
|
## Install
|
|
20
24
|
|
|
@@ -28,6 +32,10 @@ npm install ranui --save
|
|
|
28
32
|
|
|
29
33
|
[See components and use examples](https://chaxus.github.io/ran/src/ranui/)
|
|
30
34
|
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
<https://github.com/chaxus/ran/blob/main/packages/ranui/index.html>
|
|
38
|
+
|
|
31
39
|
## Import
|
|
32
40
|
|
|
33
41
|
Support for on-demand import, which can reduce the size of loaded js
|
|
@@ -188,16 +196,8 @@ interface RPreview {
|
|
|
188
196
|
|
|
189
197
|
declare namespace JSX {
|
|
190
198
|
interface IntrinsicElements {
|
|
191
|
-
'r-preview': React.DetailedHTMLProps<
|
|
192
|
-
|
|
193
|
-
HTMLDivElement
|
|
194
|
-
> &
|
|
195
|
-
RPreview;
|
|
196
|
-
'r-button': React.DetailedHTMLProps<
|
|
197
|
-
React.HTMLAttributes<HTMLDivElement>,
|
|
198
|
-
HTMLDivElement
|
|
199
|
-
> &
|
|
200
|
-
RButton;
|
|
199
|
+
'r-preview': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & RPreview;
|
|
200
|
+
'r-button': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & RButton;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
```
|