ranui 0.1.10-alpha.2 → 0.1.10-alpha.4
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/{utils-74Icp-PI.js → arrow-down-Beig7FXI.js} +139 -28
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/build/config.d.ts +3 -0
- package/dist/build/config.es.d.ts +2 -0
- package/dist/build/config.sha.d.ts +2 -0
- package/dist/build/config.umd.d.ts +2 -0
- package/dist/button.js +3 -3
- package/dist/checkbox.js +3 -3
- package/dist/colorpicker.js +7 -9
- package/dist/{colz-CRDozfZA.js → colz-DJZvo_8B.js} +3 -8
- package/dist/components/button/index.d.ts +39 -0
- package/dist/components/checkbox/index.d.ts +27 -0
- package/dist/components/colorpicker/index.d.ts +120 -0
- package/dist/components/dropdown/index.d.ts +28 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/icon/index.d.ts +2 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/input/index.d.ts +209 -0
- package/dist/components/loading/index.d.ts +77 -0
- package/dist/components/math/index.d.ts +17 -0
- package/dist/components/message/index.d.ts +16 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/player/index.d.ts +238 -0
- package/dist/components/popover/content/index.d.ts +16 -0
- package/dist/components/popover/index.d.ts +59 -0
- package/dist/components/preview/colz.d.ts +72 -0
- package/dist/components/preview/constant.d.ts +5 -0
- package/dist/components/preview/docx.d.ts +8 -0
- package/dist/components/preview/excel/excel.d.ts +2 -0
- package/dist/components/preview/excel/index.d.ts +2 -0
- package/dist/components/preview/excel/media.d.ts +37 -0
- package/dist/components/preview/index.d.ts +3 -0
- package/dist/components/preview/pdf.d.ts +2 -0
- package/dist/components/preview/pptx/index.d.ts +19 -0
- package/dist/components/preview/pptx/process_pptx.d.ts +23 -0
- package/dist/components/preview/pptx/t_xml.d.ts +1 -0
- package/dist/components/preview/pptx/worker.d.ts +1 -0
- package/dist/components/preview/types.d.ts +10 -0
- package/dist/components/progress/index.d.ts +41 -0
- package/dist/components/radar/index.d.ts +2 -0
- package/dist/components/scratch/index.d.ts +23 -0
- package/dist/components/select/dropdown-item/index.d.ts +23 -0
- package/dist/components/select/index.d.ts +115 -0
- package/dist/components/select/option/index.d.ts +2 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/tab/index.d.ts +410 -0
- package/dist/components/tabpane/index.d.ts +354 -0
- package/dist/{docx-CChZ5Ycr.js → docx-CHkPTdGU.js} +1 -1
- package/dist/drop-4j4abxje.js +36 -0
- package/dist/icon.js +3 -3
- package/dist/iconShadowless.js +3 -3
- package/dist/image.js +1 -1
- package/dist/{index-BpOERe9M.js → index-BZR0HaP2.js} +1 -4
- package/dist/{index-B2yRe66F.js → index-BafnazTJ.js} +9 -17
- package/dist/{index-Dapt713u.js → index-Bl6-5Hp8.js} +2438 -4361
- package/dist/{index-ByBbFhvo.js → index-BqWbyjm2.js} +1165 -1831
- package/dist/{index-DqtzBqPN.js → index-C0Xh8vJ3.js} +12 -23
- package/dist/{index-DRi1ylHx.js → index-C1rSQlmc.js} +16 -23
- package/dist/{index-Cbp6LrE5.js → index-C4Sv0T51.js} +6 -12
- package/dist/index-CCxIoCAT.js +657 -0
- package/dist/{index-BHmWrPCW.js → index-CGEx9VOA.js} +866 -1662
- package/dist/{index-C-p_Wpit.js → index-CILRcFIV.js} +3 -6
- package/dist/index-COa4RzeW.js +105 -0
- package/dist/{index-B4bfIbdI.js → index-CWNtaUwu.js} +17 -25
- package/dist/{index-DytfjwBV.js → index-CjSKJE6S.js} +11 -15
- package/dist/{index-C6wPL-2Y.js → index-Ck9TOxFh.js} +22 -41
- package/dist/{index-BF8tJ6rR.js → index-CryFK9u4.js} +11 -21
- package/dist/{index-C1x9Popy.js → index-DAxs7Dd2.js} +5 -12
- package/dist/index-DBecKjmY.js +279 -0
- package/dist/{index-CSnBqUsQ.js → index-DC5EA657.js} +2 -6
- package/dist/index-DEcHDJ1m.js +306 -0
- package/dist/index-DL-1C2RQ.js +496 -0
- package/dist/index-DN-kAx-A.js +72 -0
- package/dist/{index-DRWOSfdF.js → index-DUF6lQQS.js} +15 -28
- package/dist/{index-Du-Biu-I.js → index-KS2nvVcO.js} +1 -4
- package/dist/{index-CFnsLnrb.js → index-WfFw4LJT.js} +42 -48
- package/dist/index.d.ts +231 -0
- package/dist/index.js +20 -26
- package/dist/input.js +2 -2
- package/dist/inputShadowless.js +2 -2
- package/dist/{jszip.min-DD9Dc6z4.js → jszip.min-Dhs3nUkD.js} +699 -1027
- package/dist/katex-es-B5r5vt3m.js +14628 -0
- package/dist/loading-scene-BMc2wqKm.js +4 -0
- package/dist/loading.js +4 -2
- package/dist/math.js +7 -0
- package/dist/message.js +3 -2
- package/dist/{pdf-DpNqCylD.js → pdf-Cx0VWKFo.js} +2 -5
- package/dist/player.js +4 -4
- package/dist/playwright.config.d.ts +9 -0
- package/dist/plugins/auto-import-file.d.ts +0 -0
- package/dist/plugins/load-style.d.ts +6 -0
- package/dist/plugins/load-svg.d.ts +9 -0
- package/dist/popover.js +4 -2
- package/dist/preview.js +4 -4
- package/dist/progress.js +3 -3
- package/dist/radar.js +3 -3
- package/dist/select.js +6 -6
- package/dist/selectShadowless.js +562 -8
- package/dist/shadowless/icon/index.d.ts +3 -0
- package/dist/shadowless/input/index.d.ts +210 -0
- package/dist/shadowless/select/index.d.ts +109 -0
- package/dist/shadowless/select/option/index.d.ts +2 -0
- package/dist/shadowless/shadowless/index.js +3 -9
- package/dist/shadowless.d.ts +3 -0
- package/dist/skeleton.js +1 -1
- package/dist/style.css +1 -1
- package/dist/tab.js +3 -3
- package/dist/tabpane.js +1 -1
- package/dist/tests/button.spec.d.ts +1 -0
- package/dist/tsconfig.json +3 -2
- package/dist/typings.d.ts +211 -0
- package/dist/umd/index.umd.cjs +9 -9
- package/dist/umd/shadowless/shadowless.umd.cjs +1 -1
- package/dist/umd/shadowless/style.css +1 -1
- package/dist/umd/style.css +1 -1
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/image.d.ts +32 -0
- package/dist/utils/index.d.ts +72 -0
- package/dist/utils/math.d.ts +26 -0
- package/dist/utils/tween.d.ts +21 -0
- package/dist/vite.config.d.ts +7 -0
- package/package.json +47 -38
- package/readme.md +7 -48
- package/typings.d.ts +113 -2
- package/dist/arrow-down-D4qr4m33.js +0 -30
- package/dist/content.js +0 -6
- package/dist/global-DOOKQmNv.js +0 -4
- package/dist/index-01Qfd9QI.js +0 -207
- package/dist/index-CWWI8SHO.js +0 -206
- package/dist/index-CbyMC6Yz.js +0 -59
- package/dist/index-Cr9AYoGT.js +0 -498
- package/dist/index-DLB8VOy7.js +0 -281
- package/dist/index-DsIUhdNt.js +0 -533
- package/dist/option.js +0 -92
|
@@ -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;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type ImgType = HTMLImageElement | HTMLCanvasElement;
|
|
2
|
+
/**
|
|
3
|
+
* 根据路径获取图片对象
|
|
4
|
+
* @param { string } src 图片路径
|
|
5
|
+
* @returns { Promise<HTMLImageElement> } 图片标签
|
|
6
|
+
*/
|
|
7
|
+
export declare const getImage: (src: string) => Promise<ImgType>;
|
|
8
|
+
/**
|
|
9
|
+
* 切割圆角
|
|
10
|
+
* @param img 将要裁剪的图片对象
|
|
11
|
+
* @param radius 裁剪的圆角半径
|
|
12
|
+
* @returns 返回一个离屏 canvas 用于渲染
|
|
13
|
+
*/
|
|
14
|
+
export declare const cutRound: (img: ImgType, radius: number) => ImgType;
|
|
15
|
+
/**
|
|
16
|
+
* 透明度
|
|
17
|
+
* @param img 将要处理的图片对象
|
|
18
|
+
* @param opacity 透明度
|
|
19
|
+
* @returns 返回一个离屏 canvas 用于渲染
|
|
20
|
+
*/
|
|
21
|
+
export declare const opacity: (img: ImgType, opacity: number) => ImgType;
|
|
22
|
+
/**
|
|
23
|
+
* 高斯模糊
|
|
24
|
+
* @param img 将要处理的图片对象
|
|
25
|
+
* @param radius 模糊半径
|
|
26
|
+
* @returns 返回一个离屏 canvas 用于渲染
|
|
27
|
+
*/
|
|
28
|
+
export declare const blur: (img: ImgType, radius: number) => ImgType;
|
|
29
|
+
export declare const getBase64Image: (imageFile: File) => Promise<{
|
|
30
|
+
base64: string | ArrayBuffer | null;
|
|
31
|
+
}>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const falseList: (string | boolean | null | undefined)[];
|
|
2
|
+
/**
|
|
3
|
+
* @description: 判断这个元素上是否有 disabled 属性
|
|
4
|
+
* @param {Element} element
|
|
5
|
+
* @return {*}
|
|
6
|
+
*/
|
|
7
|
+
export declare const isDisabled: (element: Element) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @description: 查询指定元素的子级元素,删除他们的某一个指定 class
|
|
10
|
+
* @param {Element} parent
|
|
11
|
+
* @param {string} deleteClass
|
|
12
|
+
*/
|
|
13
|
+
export declare const removeClassToElementChild: (parent: Element, deleteClass: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* @description: 创建 icon 的文档示例
|
|
16
|
+
*/
|
|
17
|
+
export declare const createIconList: () => void;
|
|
18
|
+
export declare const loadScript: (src: string) => Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
export interface CustomErrorType {
|
|
22
|
+
new (m: string): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function createCustomError(msg?: string): CustomErrorType;
|
|
25
|
+
export declare const vod: {
|
|
26
|
+
FD: {
|
|
27
|
+
label: string;
|
|
28
|
+
};
|
|
29
|
+
LD: {
|
|
30
|
+
bandWidth: {
|
|
31
|
+
h264: number;
|
|
32
|
+
h265: number;
|
|
33
|
+
};
|
|
34
|
+
label: string;
|
|
35
|
+
};
|
|
36
|
+
SD: {
|
|
37
|
+
bandWidth: {
|
|
38
|
+
h264: number;
|
|
39
|
+
h265: number;
|
|
40
|
+
};
|
|
41
|
+
label: string;
|
|
42
|
+
};
|
|
43
|
+
HD: {
|
|
44
|
+
bandWidth: {
|
|
45
|
+
h264: number;
|
|
46
|
+
h265: number;
|
|
47
|
+
};
|
|
48
|
+
label: string;
|
|
49
|
+
};
|
|
50
|
+
'2K': {
|
|
51
|
+
bandWidth: {
|
|
52
|
+
h264: number;
|
|
53
|
+
h265: number;
|
|
54
|
+
};
|
|
55
|
+
label: string;
|
|
56
|
+
};
|
|
57
|
+
'4K': {
|
|
58
|
+
bandWidth: {
|
|
59
|
+
h264: number;
|
|
60
|
+
h265: number;
|
|
61
|
+
};
|
|
62
|
+
label: string;
|
|
63
|
+
};
|
|
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[];
|
|
71
|
+
equals?: boolean | ((prev: T | undefined, next: T) => boolean);
|
|
72
|
+
}) => [() => T, (newValue: T) => void];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 转换为运算角度
|
|
3
|
+
* @param { number } deg 数学角度
|
|
4
|
+
* @return { number } 运算角度
|
|
5
|
+
*/
|
|
6
|
+
export declare const getAngle: (deg: number) => number;
|
|
7
|
+
/**
|
|
8
|
+
* 根据角度计算圆上的点
|
|
9
|
+
* @param { number } deg 运算角度
|
|
10
|
+
* @param { number } r 半径
|
|
11
|
+
* @return { Array<number> } 坐标[x, y]
|
|
12
|
+
*/
|
|
13
|
+
export declare const getArcPointerByDeg: (deg: number, r: number) => [number, number];
|
|
14
|
+
/**
|
|
15
|
+
* 根据点计算切线方程
|
|
16
|
+
* @param { number } x 横坐标
|
|
17
|
+
* @param { number } y 纵坐标
|
|
18
|
+
* @return { Array<number> } [斜率, 常数]
|
|
19
|
+
*/
|
|
20
|
+
export declare const getTangentByPointer: (x: number, y: number) => Array<number>;
|
|
21
|
+
export declare const fanShapedByArc: (ctx: CanvasRenderingContext2D, minRadius: number, maxRadius: number, start: number, end: number, gutter: number) => void;
|
|
22
|
+
export declare const roundRectByArc: (ctx: CanvasRenderingContext2D, ...[x, y, w, h, r]: number[]) => void;
|
|
23
|
+
/**
|
|
24
|
+
* 创建线性渐变色
|
|
25
|
+
*/
|
|
26
|
+
export declare const getLinearGradient: (ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, background: string) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 缓动函数
|
|
3
|
+
* t: current time(当前时间)
|
|
4
|
+
* b: beginning value(初始值)
|
|
5
|
+
* c: change in value(变化量)
|
|
6
|
+
* d: duration(持续时间)
|
|
7
|
+
*
|
|
8
|
+
* 感谢张鑫旭大佬 https://github.com/zhangxinxu/Tween
|
|
9
|
+
*/
|
|
10
|
+
interface SpeedType {
|
|
11
|
+
easeIn: (...arr: number[]) => number;
|
|
12
|
+
easeOut: (...arr: number[]) => number;
|
|
13
|
+
}
|
|
14
|
+
export declare const quad: SpeedType;
|
|
15
|
+
export declare const cubic: SpeedType;
|
|
16
|
+
export declare const quart: SpeedType;
|
|
17
|
+
export declare const quint: SpeedType;
|
|
18
|
+
export declare const sine: SpeedType;
|
|
19
|
+
export declare const expo: SpeedType;
|
|
20
|
+
export declare const circ: SpeedType;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BuildOptions, UserConfig } from 'vite';
|
|
2
|
+
export declare const umd: BuildOptions;
|
|
3
|
+
export declare const umdShadowless: BuildOptions;
|
|
4
|
+
export declare const es: BuildOptions;
|
|
5
|
+
export declare const viteConfig: UserConfig;
|
|
6
|
+
declare const _default: UserConfig;
|
|
7
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ranui",
|
|
3
|
-
"version": "0.1.10-alpha.
|
|
3
|
+
"version": "0.1.10-alpha.4",
|
|
4
4
|
"description": "UI Component library based on `Web Component`",
|
|
5
5
|
"main": "dist/umd/index.umd.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,7 +18,18 @@
|
|
|
18
18
|
"author": "chaxus",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": "^18.0.0 || >=20.0.0"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "vite --host",
|
|
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"
|
|
22
33
|
},
|
|
23
34
|
"files": [
|
|
24
35
|
"dist",
|
|
@@ -48,100 +59,105 @@
|
|
|
48
59
|
"require": "./dist/umd/shadowless/shadowless.umd.cjs"
|
|
49
60
|
},
|
|
50
61
|
"./button": {
|
|
51
|
-
"types": "./dist/
|
|
62
|
+
"types": "./dist/index.d.ts",
|
|
52
63
|
"import": "./dist/components/button/index.js",
|
|
53
64
|
"require": "./dist/umd/index.umd.cjs"
|
|
54
65
|
},
|
|
55
66
|
"./icon": {
|
|
56
|
-
"types": "./dist/
|
|
67
|
+
"types": "./dist/index.d.ts",
|
|
57
68
|
"import": "./dist/components/icon/index.js",
|
|
58
69
|
"require": "./dist/umd/index.umd.cjs"
|
|
59
70
|
},
|
|
60
71
|
"./image": {
|
|
61
|
-
"types": "./dist/
|
|
72
|
+
"types": "./dist/index.d.ts",
|
|
62
73
|
"import": "./dist/components/image/index.js",
|
|
63
74
|
"require": "./dist/umd/index.umd.cjs"
|
|
64
75
|
},
|
|
65
76
|
"./input": {
|
|
66
|
-
"types": "./dist/
|
|
77
|
+
"types": "./dist/index.d.ts",
|
|
67
78
|
"import": "./dist/components/input/index.js",
|
|
68
79
|
"require": "./dist/umd/index.umd.cjs"
|
|
69
80
|
},
|
|
70
81
|
"./message": {
|
|
71
|
-
"types": "./dist/
|
|
82
|
+
"types": "./dist/index.d.ts",
|
|
72
83
|
"import": "./dist/components/message/index.js",
|
|
73
84
|
"require": "./dist/umd/index.umd.cjs"
|
|
74
85
|
},
|
|
75
86
|
"./preview": {
|
|
76
|
-
"types": "./dist/
|
|
87
|
+
"types": "./dist/index.d.ts",
|
|
77
88
|
"import": "./dist/components/preview/index.js",
|
|
78
89
|
"require": "./dist/umd/index.umd.cjs"
|
|
79
90
|
},
|
|
80
91
|
"./skeleton": {
|
|
81
|
-
"types": "./dist/
|
|
92
|
+
"types": "./dist/index.d.ts",
|
|
82
93
|
"import": "./dist/components/skeleton/index.js",
|
|
83
94
|
"require": "./dist/umd/index.umd.cjs"
|
|
84
95
|
},
|
|
85
96
|
"./tab": {
|
|
86
|
-
"types": "./dist/
|
|
97
|
+
"types": "./dist/index.d.ts",
|
|
87
98
|
"import": "./dist/components/tab/index.js",
|
|
88
99
|
"require": "./dist/umd/index.umd.cjs"
|
|
89
100
|
},
|
|
90
101
|
"./tabpane": {
|
|
91
|
-
"types": "./dist/
|
|
102
|
+
"types": "./dist/index.d.ts",
|
|
92
103
|
"import": "./dist/components/tabpane/index.js",
|
|
93
104
|
"require": "./dist/umd/index.umd.cjs"
|
|
94
105
|
},
|
|
95
106
|
"./radar": {
|
|
96
|
-
"types": "./dist/
|
|
107
|
+
"types": "./dist/index.d.ts",
|
|
97
108
|
"import": "./dist/components/radar/index.js",
|
|
98
109
|
"require": "./dist/umd/index.umd.cjs"
|
|
99
110
|
},
|
|
100
111
|
"./modal": {
|
|
101
|
-
"types": "./dist/
|
|
112
|
+
"types": "./dist/index.d.ts",
|
|
102
113
|
"import": "./dist/components/modal/index.js",
|
|
103
114
|
"require": "./dist/umd/index.umd.cjs"
|
|
104
115
|
},
|
|
105
116
|
"./select": {
|
|
106
|
-
"types": "./dist/
|
|
117
|
+
"types": "./dist/index.d.ts",
|
|
107
118
|
"import": "./dist/components/select/index.js",
|
|
108
119
|
"require": "./dist/umd/index.umd.cjs"
|
|
109
120
|
},
|
|
110
|
-
"./option": {
|
|
111
|
-
"types": "./dist/components/option/index.d.ts",
|
|
112
|
-
"import": "./dist/components/option/index.js",
|
|
113
|
-
"require": "./dist/umd/index.umd.cjs"
|
|
114
|
-
},
|
|
115
121
|
"./progress": {
|
|
116
|
-
"types": "./dist/
|
|
122
|
+
"types": "./dist/index.d.ts",
|
|
117
123
|
"import": "./dist/components/progress/index.js",
|
|
118
124
|
"require": "./dist/umd/index.umd.cjs"
|
|
119
125
|
},
|
|
120
126
|
"./player": {
|
|
121
|
-
"types": "./dist/
|
|
127
|
+
"types": "./dist/index.d.ts",
|
|
122
128
|
"import": "./dist/components/player/index.js",
|
|
123
129
|
"require": "./dist/umd/index.umd.cjs"
|
|
124
130
|
},
|
|
125
131
|
"./popover": {
|
|
126
|
-
"types": "./dist/
|
|
132
|
+
"types": "./dist/index.d.ts",
|
|
127
133
|
"import": "./dist/components/popover/index.js",
|
|
128
134
|
"require": "./dist/umd/index.umd.cjs"
|
|
129
135
|
},
|
|
130
136
|
"./content": {
|
|
131
|
-
"types": "./dist/
|
|
137
|
+
"types": "./dist/index.d.ts",
|
|
132
138
|
"import": "./dist/components/content/index.js",
|
|
133
139
|
"require": "./dist/umd/index.umd.cjs"
|
|
134
140
|
},
|
|
135
141
|
"./loading": {
|
|
136
|
-
"types": "./dist/
|
|
142
|
+
"types": "./dist/index.d.ts",
|
|
137
143
|
"import": "./dist/components/loading/index.js",
|
|
138
144
|
"require": "./dist/umd/index.umd.cjs"
|
|
139
145
|
},
|
|
140
146
|
"./colorpicker": {
|
|
141
|
-
"types": "./dist/
|
|
147
|
+
"types": "./dist/index.d.ts",
|
|
142
148
|
"import": "./dist/components/colorpicker/index.js",
|
|
143
149
|
"require": "./dist/umd/index.umd.cjs"
|
|
144
150
|
},
|
|
151
|
+
"./math": {
|
|
152
|
+
"types": "./dist/index.d.ts",
|
|
153
|
+
"import": "./dist/components/math/index.js",
|
|
154
|
+
"require": "./dist/umd/index.umd.cjs"
|
|
155
|
+
},
|
|
156
|
+
"./checkbox": {
|
|
157
|
+
"types": "./dist/index.d.ts",
|
|
158
|
+
"import": "./dist/components/checkbox/index.js",
|
|
159
|
+
"require": "./dist/umd/index.umd.cjs"
|
|
160
|
+
},
|
|
145
161
|
"./style": {
|
|
146
162
|
"types": "./dist/index.d.ts",
|
|
147
163
|
"import": "./dist/style.css",
|
|
@@ -155,14 +171,18 @@
|
|
|
155
171
|
"@playwright/test": "^1.44.0",
|
|
156
172
|
"@types/imagemin-svgo": "^10.0.5",
|
|
157
173
|
"@types/lodash": "^4.17.1",
|
|
174
|
+
"@types/react": "^18.3.1",
|
|
158
175
|
"@types/tinycolor2": "^1.4.6",
|
|
159
176
|
"@vheemstra/vite-plugin-imagemin": "^1.2.1",
|
|
160
177
|
"imagemin-svgo": "^10.0.1",
|
|
161
178
|
"less": "^4.2.0",
|
|
162
179
|
"prettier": "^2.8.8",
|
|
180
|
+
"react": "^18.3.1",
|
|
181
|
+
"react-dom": "^18.3.1",
|
|
163
182
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
164
183
|
"svgo": "^3.3.0",
|
|
165
184
|
"tsx": "^3.14.0",
|
|
185
|
+
"typescript": "^5.4.5",
|
|
166
186
|
"vite": "^5.2.11"
|
|
167
187
|
},
|
|
168
188
|
"dependencies": {
|
|
@@ -170,18 +190,7 @@
|
|
|
170
190
|
"exceljs": "^4.4.0",
|
|
171
191
|
"jszip": "^3.10.1",
|
|
172
192
|
"lodash": "^4.17.21",
|
|
173
|
-
"ranuts": "
|
|
193
|
+
"ranuts": "workspace:^",
|
|
174
194
|
"tinycolor2": "^1.6.0"
|
|
175
|
-
},
|
|
176
|
-
"scripts": {
|
|
177
|
-
"dev": "vite",
|
|
178
|
-
"build": "sh ./bin/build.sh",
|
|
179
|
-
"build:es": "vite build -c ./build/config.es.ts",
|
|
180
|
-
"build:umd": "vite build -c ./build/config.umd.ts",
|
|
181
|
-
"prepublish": "npm run build",
|
|
182
|
-
"test": "sh ./bin/test.sh",
|
|
183
|
-
"test:report": "playwright show-report",
|
|
184
|
-
"test:ui": "playwright test --ui",
|
|
185
|
-
"test:update": "playwright test --update-snapshots"
|
|
186
195
|
}
|
|
187
|
-
}
|
|
196
|
+
}
|
package/readme.md
CHANGED
|
@@ -12,13 +12,13 @@ UI Component library based on `Web Component`
|
|
|
12
12
|
|
|
13
13
|
## Feature
|
|
14
14
|
|
|
15
|
-
1. **
|
|
16
|
-
2. **Pure Native Experience**:
|
|
17
|
-
3. **
|
|
18
|
-
4. **
|
|
19
|
-
5. **Interactive
|
|
20
|
-
6. **Type-Checking
|
|
21
|
-
7. **
|
|
15
|
+
1. **Cross-Framework Compatibility**: Works seamlessly with React, Vue, Preact, SolidJS, Svelte, and more. Integrates with any JavaScript project following W3C standards.
|
|
16
|
+
2. **Pure Native Experience**: No need for npm, React/Vue, or build tools. Easy to start, like using native div tags, simplifying structure and reducing learning costs.
|
|
17
|
+
3. **Modular Design**: Breaks systems into small, reusable components for enhanced maintainability and scalability.
|
|
18
|
+
4. **Open-Source**: Licensed under MIT, providing free access to all source code for personal or commercial use.
|
|
19
|
+
5. **Interactive Documentation**: Offers detailed, interactive documentation with live examples for efficient learning.
|
|
20
|
+
6. **Type-Checking**: Built on TypeScript with full type support, ensuring robust and maintainable code.
|
|
21
|
+
7. **Stability and Durability**: Provides exceptional stability, avoiding disruptive updates and ensuring continuous project operation.
|
|
22
22
|
|
|
23
23
|
## Install
|
|
24
24
|
|
|
@@ -101,12 +101,6 @@ document.body.appendChild(Button);
|
|
|
101
101
|
|
|
102
102
|
### jsx
|
|
103
103
|
|
|
104
|
-
Since `react` has composite events, for more convenient use, `ranui` is encapsulated through `react` high-level components to form [@ranui/react](https://www.npmjs.com/package/@ranui/react).
|
|
105
|
-
|
|
106
|
-
In react, it is recommended to use [@ranui/react](https://www.npmjs.com/package/@ranui/react).
|
|
107
|
-
|
|
108
|
-
However, `ranui` can still be used in any `js` or `ts` framework.
|
|
109
|
-
|
|
110
104
|
```jsx
|
|
111
105
|
import 'ranui';
|
|
112
106
|
|
|
@@ -132,12 +126,6 @@ import 'ranui';
|
|
|
132
126
|
|
|
133
127
|
### tsx
|
|
134
128
|
|
|
135
|
-
Since `react` has composite events, for more convenient use, [ranui](https://www.npmjs.com/package/ranui) is encapsulated through `react` high-level components, so there is [@ranui/react](https://www.npmjs.com/package/@ranui/react).
|
|
136
|
-
|
|
137
|
-
In `react`, using [@ranui/react](https://www.npmjs.com/package/@ranui/react) is silky and fully integrated into the `react` ecosystem after being wrapped in higher-order functions.
|
|
138
|
-
|
|
139
|
-
However, [ranui](https://www.npmjs.com/package/ranui) can still be used in any `js` or `ts`.
|
|
140
|
-
|
|
141
129
|
```tsx
|
|
142
130
|
// react 18
|
|
143
131
|
import type { SyntheticEvent } from 'react';
|
|
@@ -173,35 +161,6 @@ const FilePreview = () => {
|
|
|
173
161
|
};
|
|
174
162
|
```
|
|
175
163
|
|
|
176
|
-
`jsx` defines the types of all `HTML-native` components in `TypeScript`.
|
|
177
|
-
|
|
178
|
-
The `web component` type is not in the `jsx` definition.
|
|
179
|
-
|
|
180
|
-
You need to add it manually.
|
|
181
|
-
|
|
182
|
-
Otherwise you'll have type problems, but it actually works.
|
|
183
|
-
|
|
184
|
-
```ts
|
|
185
|
-
// typings.d.ts
|
|
186
|
-
interface RButton {
|
|
187
|
-
type?: string;
|
|
188
|
-
onClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
interface RPreview {
|
|
192
|
-
src?: string | Blob | ArrayBuffer;
|
|
193
|
-
onClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
194
|
-
ref?: React.MutableRefObject<HTMLDivElement | null>;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
declare namespace JSX {
|
|
198
|
-
interface IntrinsicElements {
|
|
199
|
-
'r-preview': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & RPreview;
|
|
200
|
-
'r-button': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & RButton;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
```
|
|
204
|
-
|
|
205
164
|
## Contributors
|
|
206
165
|
|
|
207
166
|
<a href="https://github.com/chaxus/ran/graphs/contributors">
|
package/typings.d.ts
CHANGED
|
@@ -5,10 +5,9 @@ declare module '*.svg';
|
|
|
5
5
|
declare module 'docx-preview';
|
|
6
6
|
declare module 'exceljs/*';
|
|
7
7
|
declare module '@/assets/*';
|
|
8
|
+
declare module '@/public/*';
|
|
8
9
|
declare module '@/components/*';
|
|
9
10
|
declare module '@/plugins/*';
|
|
10
|
-
declare module '@/utils/*';
|
|
11
|
-
declare module 'ranuts/*';
|
|
12
11
|
|
|
13
12
|
declare namespace Ran {
|
|
14
13
|
interface Prompt {
|
|
@@ -86,9 +85,19 @@ declare interface Document {
|
|
|
86
85
|
webkitExitFullscreen: () => Promise<void>;
|
|
87
86
|
}
|
|
88
87
|
|
|
88
|
+
interface MathJax {
|
|
89
|
+
texReset: () => void;
|
|
90
|
+
getMetricsFor: (x: HTMLElement) => object;
|
|
91
|
+
tex2chtmlPromise: (x: string, y: object) => Promise<Element>;
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
declare interface Window {
|
|
90
95
|
ranui: Partial<Ranui>;
|
|
91
96
|
message: Partial<Ran.Message>;
|
|
97
|
+
MathJax: MathJax;
|
|
98
|
+
katex: {
|
|
99
|
+
render: (x: string, y: HTMLElement, z: object) => void;
|
|
100
|
+
};
|
|
92
101
|
pdfjsLib: {
|
|
93
102
|
GlobalWorkerOptions: {
|
|
94
103
|
workerSrc: string;
|
|
@@ -99,3 +108,105 @@ declare interface Window {
|
|
|
99
108
|
};
|
|
100
109
|
Hls: HLS;
|
|
101
110
|
}
|
|
111
|
+
declare module 'react' {
|
|
112
|
+
namespace JSX {
|
|
113
|
+
interface IntrinsicElements {
|
|
114
|
+
'r-loading': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
115
|
+
name: NAME_AMP;
|
|
116
|
+
};
|
|
117
|
+
'r-math': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
118
|
+
latex: string;
|
|
119
|
+
};
|
|
120
|
+
'r-button': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
121
|
+
sheet: string;
|
|
122
|
+
disabled: boolean | string;
|
|
123
|
+
iconSize: string;
|
|
124
|
+
icon: string;
|
|
125
|
+
effect: boolean | string;
|
|
126
|
+
};
|
|
127
|
+
'r-checkbox': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
128
|
+
disabled: boolean | string;
|
|
129
|
+
checked: boolean | string;
|
|
130
|
+
};
|
|
131
|
+
'r-img': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
132
|
+
fallback: string;
|
|
133
|
+
src: string;
|
|
134
|
+
};
|
|
135
|
+
'r-input': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
136
|
+
value: string;
|
|
137
|
+
placeholder: string;
|
|
138
|
+
label: string;
|
|
139
|
+
status: string;
|
|
140
|
+
name: string;
|
|
141
|
+
icon: string;
|
|
142
|
+
prefix: string;
|
|
143
|
+
suffix: string;
|
|
144
|
+
type: string;
|
|
145
|
+
required: boolean | string;
|
|
146
|
+
disabled: boolean | string;
|
|
147
|
+
min: number | string;
|
|
148
|
+
max: number | string;
|
|
149
|
+
step: number | string;
|
|
150
|
+
};
|
|
151
|
+
'r-player': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
152
|
+
src: string;
|
|
153
|
+
debug: boolean | string;
|
|
154
|
+
volume: number | string;
|
|
155
|
+
currentTime: number | string;
|
|
156
|
+
playbackRate: number | string;
|
|
157
|
+
};
|
|
158
|
+
'r-popover': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
159
|
+
placement: string;
|
|
160
|
+
trigger: string;
|
|
161
|
+
getPopupContainerId: string;
|
|
162
|
+
arrow: boolean | string;
|
|
163
|
+
};
|
|
164
|
+
'r-preview': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
165
|
+
src: string;
|
|
166
|
+
closeable: boolean | string;
|
|
167
|
+
};
|
|
168
|
+
'r-progress': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
169
|
+
percent: number | string;
|
|
170
|
+
total: number | string;
|
|
171
|
+
type: string;
|
|
172
|
+
animation: string;
|
|
173
|
+
dot: boolean | string;
|
|
174
|
+
};
|
|
175
|
+
'r-radar': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
176
|
+
abilitys: string;
|
|
177
|
+
colorPolygon?: string;
|
|
178
|
+
colorLine?: string;
|
|
179
|
+
fillColor?: string;
|
|
180
|
+
strokeColor?: string;
|
|
181
|
+
};
|
|
182
|
+
'r-select': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
183
|
+
value: string;
|
|
184
|
+
defaultValue?: string;
|
|
185
|
+
showSearch?: boolean | string;
|
|
186
|
+
type?: string;
|
|
187
|
+
placement?: string;
|
|
188
|
+
sheet?: string;
|
|
189
|
+
getPopupContainerId?: string;
|
|
190
|
+
dropdownclass?: string;
|
|
191
|
+
trigger?: string;
|
|
192
|
+
trigger?: string;
|
|
193
|
+
disabled?: boolean | string;
|
|
194
|
+
};
|
|
195
|
+
'r-skeleton': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {};
|
|
196
|
+
'r-tab': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
197
|
+
label: string;
|
|
198
|
+
icon: string;
|
|
199
|
+
iconSize: string;
|
|
200
|
+
key: string;
|
|
201
|
+
disabled: boolean | string;
|
|
202
|
+
effect: boolean | string;
|
|
203
|
+
};
|
|
204
|
+
'r-tabs': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
205
|
+
align: string;
|
|
206
|
+
type: string;
|
|
207
|
+
active: string;
|
|
208
|
+
effect: string;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const str2Xml = (xmlStr, format = "text/xml") => {
|
|
2
|
-
if (window.DOMParser)
|
|
3
|
-
return new window.DOMParser().parseFromString(xmlStr, format).documentElement;
|
|
4
|
-
if (typeof window.ActiveXObject !== "undefined") {
|
|
5
|
-
const xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
|
|
6
|
-
xmlDoc.async = "false";
|
|
7
|
-
xmlDoc.loadXML(xmlStr);
|
|
8
|
-
return xmlDoc;
|
|
9
|
-
}
|
|
10
|
-
return void 0;
|
|
11
|
-
};
|
|
12
|
-
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
13
|
-
const v = glob[path];
|
|
14
|
-
if (v) {
|
|
15
|
-
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
16
|
-
}
|
|
17
|
-
return new Promise((_, reject) => {
|
|
18
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : ""))));
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
const arrowDown = { "success": true, "_identification": true, "data": '<svg viewBox="0 0 1024 1024" width="200" height="200" version="1.1"\n fill="currentColor" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path>\n</svg>' };
|
|
22
|
-
const arrowDown$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23
|
-
__proto__: null,
|
|
24
|
-
default: arrowDown
|
|
25
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
26
|
-
export {
|
|
27
|
-
__variableDynamicImportRuntimeHelper as _,
|
|
28
|
-
arrowDown$1 as a,
|
|
29
|
-
str2Xml as s
|
|
30
|
-
};
|