ranui 0.1.10-alpha.2 → 0.1.10-alpha.22

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.
Files changed (149) hide show
  1. package/README.zh-CN.md +192 -0
  2. package/dist/{_commonjs-dynamic-modules-DLbDWi6a.js → _commonjs-dynamic-modules-HhqG7SJg.js} +2 -2
  3. package/dist/assets/image/failImage.d.ts +2 -0
  4. package/dist/build/config.d.ts +3 -0
  5. package/dist/build/config.es.d.ts +2 -0
  6. package/dist/build/config.sha.d.ts +2 -0
  7. package/dist/build/config.umd.d.ts +2 -0
  8. package/dist/button.js +3 -3
  9. package/dist/checkbox.js +3 -3
  10. package/dist/colorpicker.js +7 -9
  11. package/dist/{colz-CRDozfZA.js → colz-DJZvo_8B.js} +3 -8
  12. package/dist/components/button/index.d.ts +38 -0
  13. package/dist/components/checkbox/index.d.ts +31 -0
  14. package/dist/components/colorpicker/index.d.ts +120 -0
  15. package/dist/components/dropdown/index.d.ts +34 -0
  16. package/dist/components/form/index.d.ts +2 -0
  17. package/dist/components/icon/index.d.ts +2 -0
  18. package/dist/components/image/index.d.ts +2 -0
  19. package/dist/components/input/index.d.ts +210 -0
  20. package/dist/components/loading/index.d.ts +76 -0
  21. package/dist/components/math/index.d.ts +16 -0
  22. package/dist/components/message/index.d.ts +17 -0
  23. package/dist/components/modal/index.d.ts +2 -0
  24. package/dist/components/player/index.d.ts +250 -0
  25. package/dist/components/popover/content/index.d.ts +16 -0
  26. package/dist/components/popover/index.d.ts +91 -0
  27. package/dist/components/preview/colz.d.ts +72 -0
  28. package/dist/components/preview/constant.d.ts +5 -0
  29. package/dist/components/preview/docx.d.ts +8 -0
  30. package/dist/components/preview/excel/excel.d.ts +2 -0
  31. package/dist/components/preview/excel/index.d.ts +2 -0
  32. package/dist/components/preview/excel/media.d.ts +37 -0
  33. package/dist/components/preview/index.d.ts +3 -0
  34. package/dist/components/preview/pdf.d.ts +34 -0
  35. package/dist/components/preview/pptx/index.d.ts +19 -0
  36. package/dist/components/preview/pptx/process_pptx.d.ts +22 -0
  37. package/dist/components/preview/pptx/t_xml.d.ts +1 -0
  38. package/dist/components/preview/pptx/worker.d.ts +1 -0
  39. package/dist/components/preview/types.d.ts +10 -0
  40. package/dist/components/progress/index.d.ts +41 -0
  41. package/dist/components/radar/index.d.ts +2 -0
  42. package/dist/components/scratch/index.d.ts +21 -0
  43. package/dist/components/select/dropdown-item/index.d.ts +23 -0
  44. package/dist/components/select/index.d.ts +114 -0
  45. package/dist/components/select/option/index.d.ts +2 -0
  46. package/dist/components/skeleton/index.d.ts +2 -0
  47. package/dist/components/tab/index.d.ts +424 -0
  48. package/dist/components/tabpane/index.d.ts +368 -0
  49. package/dist/{docx-CChZ5Ycr.js → docx-D5t6JtVt.js} +332 -291
  50. package/dist/icon.js +3 -3
  51. package/dist/iconShadowless.js +3 -3
  52. package/dist/image.js +1 -1
  53. package/dist/{index-B2yRe66F.js → index-7MlTN57l.js} +11 -19
  54. package/dist/{index-Du-Biu-I.js → index-BEm1a2pr.js} +2 -5
  55. package/dist/{index-BpOERe9M.js → index-Bb55l8nf.js} +1 -10
  56. package/dist/index-Bc9aILQK.js +710 -0
  57. package/dist/index-BmnyRPna.js +550 -0
  58. package/dist/{index-DRWOSfdF.js → index-BpQdR7OI.js} +25 -35
  59. package/dist/index-C1GmV3sK.js +66910 -0
  60. package/dist/{index-DytfjwBV.js → index-CCeFXABq.js} +12 -16
  61. package/dist/{index-Cbp6LrE5.js → index-CNfwWf6v.js} +9 -16
  62. package/dist/{index-ByBbFhvo.js → index-CRwHr_Ni.js} +4619 -2661
  63. package/dist/{index-BHmWrPCW.js → index-CVkJ_Xlh.js} +1149 -2207
  64. package/dist/index-CaDng6Eh.js +156 -0
  65. package/dist/{index-DRi1ylHx.js → index-CfBxNU7C.js} +17 -24
  66. package/dist/{index-DqtzBqPN.js → index-D6jtmsDd.js} +12 -23
  67. package/dist/index-D7zBysHY.js +70 -0
  68. package/dist/{index-C1x9Popy.js → index-DAxs7Dd2.js} +5 -12
  69. package/dist/{index-CSnBqUsQ.js → index-DC5EA657.js} +2 -6
  70. package/dist/index-DWvhcjaL.js +656 -0
  71. package/dist/{index-BF8tJ6rR.js → index-DeWbkpnF.js} +12 -23
  72. package/dist/index-DpC9OSc5.js +140 -0
  73. package/dist/{index-B4bfIbdI.js → index-choegwoI.js} +17 -25
  74. package/dist/{index-CFnsLnrb.js → index-n4EhE9Y5.js} +42 -48
  75. package/dist/index-y4nNx1Bs.js +103 -0
  76. package/dist/index.d.ts +275 -0
  77. package/dist/index.js +31 -39
  78. package/dist/info-circle-fill-DjI8gXS3.js +14 -0
  79. package/dist/input.js +3 -2
  80. package/dist/inputShadowless.js +2 -2
  81. package/dist/jszip.min--o3_SgQz.js +2904 -0
  82. package/dist/katex-es-B7keY1LJ.js +14629 -0
  83. package/dist/loading-scene-BMc2wqKm.js +4 -0
  84. package/dist/loading.js +4 -2
  85. package/dist/math.js +7 -0
  86. package/dist/message.js +3 -2
  87. package/dist/more-DUNz_fmw.js +42 -0
  88. package/dist/{pdf-DpNqCylD.js → pdf-Cx0VWKFo.js} +2 -5
  89. package/dist/player.js +4 -4
  90. package/dist/playwright.config.d.ts +9 -0
  91. package/dist/plugins/auto-import-file.d.ts +0 -0
  92. package/dist/plugins/load-style.d.ts +6 -0
  93. package/dist/plugins/load-svg.d.ts +9 -0
  94. package/dist/plus-DD2f41KU.js +404 -0
  95. package/dist/popover.js +7 -4
  96. package/dist/preview.js +272 -5
  97. package/dist/progress.js +3 -3
  98. package/dist/radar.js +3 -3
  99. package/dist/ranui.css +1 -0
  100. package/dist/search-BWdfjyP8.js +4 -0
  101. package/dist/select.js +6 -6
  102. package/dist/selectShadowless.js +558 -8
  103. package/dist/shadowless/icon/index.d.ts +3 -0
  104. package/dist/shadowless/input/index.d.ts +210 -0
  105. package/dist/shadowless/select/index.d.ts +108 -0
  106. package/dist/shadowless/select/option/index.d.ts +2 -0
  107. package/dist/shadowless.d.ts +3 -0
  108. package/dist/shadowless.js +8 -0
  109. package/dist/skeleton.js +1 -1
  110. package/dist/sort-DWqiUONr.js +4 -0
  111. package/dist/tab.js +3 -3
  112. package/dist/tabpane.js +1 -1
  113. package/dist/tests/button.spec.d.ts +1 -0
  114. package/dist/tsconfig.json +5 -3
  115. package/dist/typings.d.ts +257 -0
  116. package/dist/umd/index.css +1 -0
  117. package/dist/umd/index.umd.cjs +1 -60
  118. package/dist/umd/shadowless/shadowless.css +1 -0
  119. package/dist/umd/shadowless/shadowless.umd.cjs +1 -1
  120. package/dist/utils/color.d.ts +52 -0
  121. package/dist/utils/image.d.ts +39 -0
  122. package/dist/utils/index.d.ts +72 -0
  123. package/dist/utils/math.d.ts +26 -0
  124. package/dist/utils/tween.d.ts +21 -0
  125. package/dist/vite.config.d.ts +7 -0
  126. package/dist/without-content-CdJw7vHM.js +4 -0
  127. package/package.json +100 -73
  128. package/readme.md +36 -56
  129. package/typings.d.ts +168 -12
  130. package/dist/arrow-down-D4qr4m33.js +0 -30
  131. package/dist/content.js +0 -6
  132. package/dist/global-DOOKQmNv.js +0 -4
  133. package/dist/index-01Qfd9QI.js +0 -207
  134. package/dist/index-C-p_Wpit.js +0 -103
  135. package/dist/index-C6wPL-2Y.js +0 -298
  136. package/dist/index-CWWI8SHO.js +0 -206
  137. package/dist/index-CbyMC6Yz.js +0 -59
  138. package/dist/index-Cr9AYoGT.js +0 -498
  139. package/dist/index-DLB8VOy7.js +0 -281
  140. package/dist/index-Dapt713u.js +0 -65624
  141. package/dist/index-DsIUhdNt.js +0 -533
  142. package/dist/info-circle-fill-CFeVMdci.js +0 -4
  143. package/dist/jszip.min-DD9Dc6z4.js +0 -2674
  144. package/dist/option.js +0 -92
  145. package/dist/shadowless/shadowless/index.js +0 -14
  146. package/dist/style.css +0 -1
  147. package/dist/umd/shadowless/style.css +0 -1
  148. package/dist/umd/style.css +0 -1
  149. package/dist/utils-74Icp-PI.js +0 -541
@@ -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,39 @@
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 radius 模糊半径
25
+ * @param sigma
26
+ * @returns 返回一个权重和为1的矩阵
27
+ */
28
+ export declare const getMatrix: (radius: number, sigma?: number) => number[];
29
+ /**
30
+ * 高斯模糊
31
+ * @param img 将要处理的图片对象
32
+ * @param radius 模糊半径
33
+ * @returns 返回一个离屏 canvas 用于渲染
34
+ */
35
+ export declare const blur: (img: ImgType) => ImgType;
36
+ export declare const getBase64Image: (imageFile: File) => Promise<{
37
+ base64: string | ArrayBuffer | null;
38
+ }>;
39
+ 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, 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;
@@ -0,0 +1,4 @@
1
+ const withoutContent = { "success": true, "_identification": true, "data": '<svg t="1742629778506" class="icon" viewBox="0 0 1366 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="31273" width="200" height="200"><path d="M1230.155 778.399V472.604l133.84-51.746-94.113-140.41 83.29 13.815 0.676-4.006 6.486-9.634L1204.75 176.19l-2.05 2.985 1.283-3.578L735.283 1.087 734 4.496l-1.197-3.494-550.626 182.523-0.338-0.598-2.303 1.619-0.43-0.083-0.597 0.85L0 311.57l7.076 9.972L8.78 325.8l97.353-40.064-70.926 98.38 140.747 78.94 0.168 312.863h3.838l-1.873 3.415 438.699 244.578 0.083-0.084v0.168l15.428-0.084v0.084l0.253-0.084h0.262v-0.084l597.428-245.262-0.085-0.168z m89.34-505.88l-61.802-10.223-38.106-56.866 99.908 67.09zM742.443 20.782l438.438 163.252-438.438 164.28V20.78z m451.654 175.355l145.522 217.047-605.703 234.1-100.084-241.176 560.265-209.97zM63.934 285.822l85.848-60.698-25.997 36.143-59.851 24.555z m-5.28 93.177L134.1 274.315l1.873-0.768-0.514-1.196 48.852-67.856 428.377 201.357-75.7 241.515L58.653 379zM192.07 768.85l-0.175-296.76 354.386 198.803 68.625-218.92 1.788 553.697L192.07 768.85z m8.184-574.587L726.5 19.843v334.433l-103.323 38.79-422.924-198.803z m1013.96 573.56L632.727 1006.52l-1.795-565.798 94.204 227.107 489.078-189v288.994z" fill="currentColor" p-id="31274"></path></svg>' };
2
+ export {
3
+ withoutContent as default
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranui",
3
- "version": "0.1.10-alpha.2",
3
+ "version": "0.1.10-alpha.22",
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,19 @@
18
18
  "author": "chaxus",
19
19
  "license": "MIT",
20
20
  "engines": {
21
- "node": ">=12.20.0"
21
+ "node": ">=23.10.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",
33
+ "tsc": "tsc --noEmit"
22
34
  },
23
35
  "files": [
24
36
  "dist",
@@ -34,7 +46,8 @@
34
46
  "web components",
35
47
  "webComponents",
36
48
  "ranui",
37
- "@ranui/react"
49
+ "@ranui/react",
50
+ "lib"
38
51
  ],
39
52
  "exports": {
40
53
  ".": {
@@ -44,144 +57,158 @@
44
57
  },
45
58
  "./shadowless": {
46
59
  "types": "./dist/index.d.ts",
47
- "import": "./dist/shadowless/shadowless/index.js",
60
+ "import": "./dist/shadowless.js",
48
61
  "require": "./dist/umd/shadowless/shadowless.umd.cjs"
49
62
  },
50
63
  "./button": {
51
- "types": "./dist/components/button/index.d.ts",
52
- "import": "./dist/components/button/index.js",
64
+ "types": "./dist/index.d.ts",
65
+ "import": "./dist/button.js",
53
66
  "require": "./dist/umd/index.umd.cjs"
54
67
  },
55
68
  "./icon": {
56
- "types": "./dist/components/icon/index.d.ts",
57
- "import": "./dist/components/icon/index.js",
69
+ "types": "./dist/index.d.ts",
70
+ "import": "./dist/icon.js",
58
71
  "require": "./dist/umd/index.umd.cjs"
59
72
  },
60
73
  "./image": {
61
- "types": "./dist/components/image/index.d.ts",
62
- "import": "./dist/components/image/index.js",
74
+ "types": "./dist/index.d.ts",
75
+ "import": "./dist/image.js",
63
76
  "require": "./dist/umd/index.umd.cjs"
64
77
  },
65
78
  "./input": {
66
- "types": "./dist/components/input/index.d.ts",
67
- "import": "./dist/components/input/index.js",
79
+ "types": "./dist/index.d.ts",
80
+ "import": "./dist/input.js",
68
81
  "require": "./dist/umd/index.umd.cjs"
69
82
  },
70
83
  "./message": {
71
- "types": "./dist/components/message/index.d.ts",
72
- "import": "./dist/components/message/index.js",
84
+ "types": "./dist/index.d.ts",
85
+ "import": "./dist/message.js",
73
86
  "require": "./dist/umd/index.umd.cjs"
74
87
  },
75
88
  "./preview": {
76
- "types": "./dist/components/preview/index.d.ts",
77
- "import": "./dist/components/preview/index.js",
89
+ "types": "./dist/index.d.ts",
90
+ "import": "./dist/preview.js",
78
91
  "require": "./dist/umd/index.umd.cjs"
79
92
  },
80
93
  "./skeleton": {
81
- "types": "./dist/components/skeleton/index.d.ts",
82
- "import": "./dist/components/skeleton/index.js",
94
+ "types": "./dist/index.d.ts",
95
+ "import": "./dist/skeleton.js",
83
96
  "require": "./dist/umd/index.umd.cjs"
84
97
  },
85
98
  "./tab": {
86
- "types": "./dist/components/tab/index.d.ts",
87
- "import": "./dist/components/tab/index.js",
99
+ "types": "./dist/index.d.ts",
100
+ "import": "./dist/tab.js",
88
101
  "require": "./dist/umd/index.umd.cjs"
89
102
  },
90
103
  "./tabpane": {
91
- "types": "./dist/components/tabpane/index.d.ts",
92
- "import": "./dist/components/tabpane/index.js",
104
+ "types": "./dist/index.d.ts",
105
+ "import": "./dist/tabpane.js",
93
106
  "require": "./dist/umd/index.umd.cjs"
94
107
  },
95
108
  "./radar": {
96
- "types": "./dist/components/radar/index.d.ts",
97
- "import": "./dist/components/radar/index.js",
109
+ "types": "./dist/index.d.ts",
110
+ "import": "./dist/radar.js",
98
111
  "require": "./dist/umd/index.umd.cjs"
99
112
  },
100
113
  "./modal": {
101
- "types": "./dist/components/modal/index.d.ts",
102
- "import": "./dist/components/modal/index.js",
114
+ "types": "./dist/index.d.ts",
115
+ "import": "./dist/modal.js",
103
116
  "require": "./dist/umd/index.umd.cjs"
104
117
  },
105
118
  "./select": {
106
- "types": "./dist/components/select/index.d.ts",
107
- "import": "./dist/components/select/index.js",
108
- "require": "./dist/umd/index.umd.cjs"
109
- },
110
- "./option": {
111
- "types": "./dist/components/option/index.d.ts",
112
- "import": "./dist/components/option/index.js",
119
+ "types": "./dist/index.d.ts",
120
+ "import": "./dist/select.js",
113
121
  "require": "./dist/umd/index.umd.cjs"
114
122
  },
115
123
  "./progress": {
116
- "types": "./dist/components/progress/index.d.ts",
117
- "import": "./dist/components/progress/index.js",
124
+ "types": "./dist/index.d.ts",
125
+ "import": "./dist/progress.js",
118
126
  "require": "./dist/umd/index.umd.cjs"
119
127
  },
120
128
  "./player": {
121
- "types": "./dist/components/player/index.d.ts",
122
- "import": "./dist/components/player/index.js",
129
+ "types": "./dist/index.d.ts",
130
+ "import": "./dist/player.js",
123
131
  "require": "./dist/umd/index.umd.cjs"
124
132
  },
125
133
  "./popover": {
126
- "types": "./dist/components/popover/index.d.ts",
127
- "import": "./dist/components/popover/index.js",
134
+ "types": "./dist/index.d.ts",
135
+ "import": "./dist/popover.js",
128
136
  "require": "./dist/umd/index.umd.cjs"
129
137
  },
130
138
  "./content": {
131
- "types": "./dist/components/content/index.d.ts",
132
- "import": "./dist/components/content/index.js",
139
+ "types": "./dist/index.d.ts",
140
+ "import": "./dist/content.js",
133
141
  "require": "./dist/umd/index.umd.cjs"
134
142
  },
135
143
  "./loading": {
136
- "types": "./dist/components/loading/index.d.ts",
137
- "import": "./dist/components/loading/index.js",
144
+ "types": "./dist/index.d.ts",
145
+ "import": "./dist/loading.js",
138
146
  "require": "./dist/umd/index.umd.cjs"
139
147
  },
140
148
  "./colorpicker": {
141
- "types": "./dist/components/colorpicker/index.d.ts",
142
- "import": "./dist/components/colorpicker/index.js",
149
+ "types": "./dist/index.d.ts",
150
+ "import": "./dist/colorpicker.js",
151
+ "require": "./dist/umd/index.umd.cjs"
152
+ },
153
+ "./math": {
154
+ "types": "./dist/index.d.ts",
155
+ "import": "./dist/math.js",
156
+ "require": "./dist/umd/index.umd.cjs"
157
+ },
158
+ "./checkbox": {
159
+ "types": "./dist/index.d.ts",
160
+ "import": "./dist/checkbox.js",
143
161
  "require": "./dist/umd/index.umd.cjs"
144
162
  },
145
163
  "./style": {
146
164
  "types": "./dist/index.d.ts",
147
- "import": "./dist/style.css",
165
+ "import": "./dist/ranui.css",
148
166
  "require": "./dist/umd/index.umd.cjs"
167
+ },
168
+ "./type": {
169
+ "types": "./dist/index.d.ts",
170
+ "import": "./dist/index.js",
171
+ "require": "./dist/index.js"
172
+ },
173
+ "./typings": {
174
+ "types": "./dist/typings.d.ts",
175
+ "import": "./dist/typings.d.ts",
176
+ "require": "./dist/index.js"
177
+ },
178
+ "./dist/*": {
179
+ "types": "./dist/*",
180
+ "import": "./dist/*",
181
+ "require": "./dist/*"
149
182
  }
150
183
  },
151
184
  "devDependencies": {
152
- "@babel/core": "^7.24.5",
153
- "@babel/preset-env": "^7.24.5",
154
- "@babel/preset-typescript": "^7.24.1",
155
- "@playwright/test": "^1.44.0",
185
+ "@babel/core": "^7.26.10",
186
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.26.6",
187
+ "@babel/preset-env": "^7.26.9",
188
+ "@babel/preset-typescript": "^7.27.0",
189
+ "@playwright/test": "^1.51.1",
190
+ "@rollup/plugin-babel": "^6.0.4",
156
191
  "@types/imagemin-svgo": "^10.0.5",
157
- "@types/lodash": "^4.17.1",
192
+ "@types/lodash": "^4.17.16",
193
+ "@types/lodash-es": "^4.17.12",
194
+ "@types/react": "^19.1.0",
158
195
  "@types/tinycolor2": "^1.4.6",
159
- "@vheemstra/vite-plugin-imagemin": "^1.2.1",
160
- "imagemin-svgo": "^10.0.1",
161
- "less": "^4.2.0",
162
- "prettier": "^2.8.8",
163
- "rollup-plugin-visualizer": "^5.12.0",
164
- "svgo": "^3.3.0",
165
- "tsx": "^3.14.0",
166
- "vite": "^5.2.11"
196
+ "imagemin-svgo": "^11.0.1",
197
+ "less": "^4.2.2",
198
+ "prettier": "^3.5.3",
199
+ "rollup-plugin-visualizer": "^5.14.0",
200
+ "svgo": "^3.3.2",
201
+ "tsx": "^4.19.3",
202
+ "typescript": "^5.8.2",
203
+ "vite": "^6.3.0"
167
204
  },
168
205
  "dependencies": {
169
- "dayjs": "^1.11.11",
206
+ "dayjs": "^1.11.13",
170
207
  "exceljs": "^4.4.0",
171
208
  "jszip": "^3.10.1",
172
209
  "lodash": "^4.17.21",
173
- "ranuts": "0.1.0-alpha.11",
210
+ "lodash-es": "^4.17.21",
211
+ "ranuts": "workspace:^",
174
212
  "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
213
  }
187
- }
214
+ }
package/readme.md CHANGED
@@ -10,32 +10,30 @@ UI Component library based on `Web Component`
10
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
+ **English** | [中文](./README.zh-CN.md)
14
+
13
15
  ## Feature
14
16
 
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.
17
+ 1. **Cross-Framework Compatibility**: Works seamlessly with React, Vue, Preact, SolidJS, Svelte, and more. Integrates with any JavaScript project following W3C standards.
18
+ 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.
19
+ 3. **Modular Design**: Breaks systems into small, reusable components for enhanced maintainability and scalability.
20
+ 4. **Open-Source**: Licensed under MIT, providing free access to all source code for personal or commercial use.
21
+ 5. **Interactive Documentation**: Offers detailed, interactive documentation with live examples for efficient learning.
22
+ 6. **Type-Checking**: Built on TypeScript with full type support, ensuring robust and maintainable code.
23
+ 7. **Stability and Durability**: Framework independent (React/vue), avoid disruptive updates, and ensure continuous project operation.
22
24
 
23
25
  ## Install
24
26
 
25
27
  Using npm:
26
28
 
27
29
  ```console
28
- npm install ranui --save
30
+ npm install ranui@latest --save
29
31
  ```
30
32
 
31
- ## Document
33
+ ## Document and Example
32
34
 
33
35
  [See components and use examples](https://chaxus.github.io/ran/src/ranui/)
34
36
 
35
- ## Example
36
-
37
- <https://github.com/chaxus/ran/blob/main/packages/ranui/index.html>
38
-
39
37
  ## Import
40
38
 
41
39
  Support for on-demand import, which can reduce the size of loaded js
@@ -44,21 +42,44 @@ Support for on-demand import, which can reduce the size of loaded js
44
42
  import 'ranui/button';
45
43
  ```
46
44
 
47
- For global components like `preview` and `message`, you need to import global styles
45
+ If there is a `style` problem, you can import the style manually
48
46
 
49
47
  ```js
50
- import 'ranui/preview';
51
48
  import 'ranui/style';
52
49
  ```
53
50
 
51
+ If there is a `type` problem, you can manually import the type
52
+
53
+ ```ts
54
+ import 'ranui/typings';
55
+ // or
56
+ import 'ranui/dist/index.d.ts';
57
+ // or
58
+ import 'ranui/type';
59
+ // or
60
+ import 'ranui/dist/typings';
61
+ ```
62
+
63
+ Not all of them. Just pick one that works
64
+
54
65
  Support global import
55
66
 
67
+ ```ts
68
+ import 'ranui';
69
+ ```
70
+
56
71
  - ES module
57
72
 
58
73
  ```js
59
74
  import 'ranui';
60
75
  ```
61
76
 
77
+ Or
78
+
79
+ ```js
80
+ import 'ranui/button';
81
+ ```
82
+
62
83
  - UMD, IIFE, CJS
63
84
 
64
85
  ```html
@@ -101,12 +122,6 @@ document.body.appendChild(Button);
101
122
 
102
123
  ### jsx
103
124
 
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
125
  ```jsx
111
126
  import 'ranui';
112
127
 
@@ -132,12 +147,6 @@ import 'ranui';
132
147
 
133
148
  ### tsx
134
149
 
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
150
  ```tsx
142
151
  // react 18
143
152
  import type { SyntheticEvent } from 'react';
@@ -173,35 +182,6 @@ const FilePreview = () => {
173
182
  };
174
183
  ```
175
184
 
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
185
  ## Contributors
206
186
 
207
187
  <a href="https://github.com/chaxus/ran/graphs/contributors">