deepsea-components 2.8.5 → 3.0.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.
Files changed (108) hide show
  1. package/dist/cjs/components/AutoFit.d.ts +25 -0
  2. package/dist/cjs/components/AutoFit.js +99 -0
  3. package/dist/cjs/components/AutoFit.js.map +7 -0
  4. package/dist/cjs/components/AutoScroll.js.map +2 -2
  5. package/dist/cjs/components/AutoSizeTextarea.d.ts +5 -0
  6. package/dist/cjs/components/AutoSizeTextarea.js +51 -0
  7. package/dist/cjs/components/AutoSizeTextarea.js.map +7 -0
  8. package/dist/cjs/components/CircleText.d.ts +25 -0
  9. package/dist/cjs/components/CircleText.js +48 -0
  10. package/dist/cjs/components/CircleText.js.map +7 -0
  11. package/dist/cjs/components/Flow.d.ts +57 -0
  12. package/dist/cjs/components/Flow.js +119 -0
  13. package/dist/cjs/components/Flow.js.map +7 -0
  14. package/dist/cjs/components/HlsPlayer.d.ts +6 -0
  15. package/dist/cjs/components/HlsPlayer.js +64 -0
  16. package/dist/cjs/components/HlsPlayer.js.map +7 -0
  17. package/dist/cjs/components/InputFile.d.ts +64 -0
  18. package/dist/cjs/components/InputFile.js +143 -0
  19. package/dist/cjs/components/InputFile.js.map +7 -0
  20. package/dist/cjs/components/LoopSwiper.d.ts +9 -0
  21. package/dist/cjs/components/LoopSwiper.js +116 -0
  22. package/dist/cjs/components/LoopSwiper.js.map +7 -0
  23. package/dist/cjs/components/Ring.d.ts +7 -0
  24. package/dist/cjs/components/Ring.js +37 -0
  25. package/dist/cjs/components/Ring.js.map +7 -0
  26. package/dist/cjs/components/Scroll.js.map +2 -2
  27. package/dist/cjs/components/SectionRing.d.ts +8 -0
  28. package/dist/cjs/components/SectionRing.js +50 -0
  29. package/dist/cjs/components/SectionRing.js.map +7 -0
  30. package/dist/cjs/components/Skeleton.d.ts +3 -0
  31. package/dist/cjs/components/Skeleton.js +61 -0
  32. package/dist/cjs/components/Skeleton.js.map +7 -0
  33. package/dist/cjs/components/TransitionBox.d.ts +10 -0
  34. package/dist/cjs/components/TransitionBox.js +45 -0
  35. package/dist/cjs/components/TransitionBox.js.map +7 -0
  36. package/dist/cjs/components/TransitionNum.d.ts +16 -0
  37. package/dist/cjs/components/TransitionNum.js +62 -0
  38. package/dist/cjs/components/TransitionNum.js.map +7 -0
  39. package/dist/cjs/components/Trapezium.d.ts +9 -0
  40. package/dist/cjs/components/Trapezium.js +44 -0
  41. package/dist/cjs/components/Trapezium.js.map +7 -0
  42. package/dist/cjs/index.d.ts +14 -265
  43. package/dist/cjs/index.js +28 -505
  44. package/dist/cjs/index.js.map +3 -3
  45. package/dist/esm/components/AutoFit.d.ts +25 -0
  46. package/dist/esm/components/AutoFit.js +87 -0
  47. package/dist/esm/components/AutoFit.js.map +1 -0
  48. package/dist/esm/components/AutoScroll.js.map +1 -1
  49. package/dist/esm/components/AutoSizeTextarea.d.ts +5 -0
  50. package/dist/esm/components/AutoSizeTextarea.js +45 -0
  51. package/dist/esm/components/AutoSizeTextarea.js.map +1 -0
  52. package/dist/esm/components/CircleText.d.ts +25 -0
  53. package/dist/esm/components/CircleText.js +49 -0
  54. package/dist/esm/components/CircleText.js.map +1 -0
  55. package/dist/esm/components/Flow.d.ts +57 -0
  56. package/dist/esm/components/Flow.js +130 -0
  57. package/dist/esm/components/Flow.js.map +1 -0
  58. package/dist/esm/components/HlsPlayer.d.ts +6 -0
  59. package/dist/esm/components/HlsPlayer.js +39 -0
  60. package/dist/esm/components/HlsPlayer.js.map +1 -0
  61. package/dist/esm/components/InputFile.d.ts +64 -0
  62. package/dist/esm/components/InputFile.js +167 -0
  63. package/dist/esm/components/InputFile.js.map +1 -0
  64. package/dist/esm/components/LoopSwiper.d.ts +9 -0
  65. package/dist/esm/components/LoopSwiper.js +122 -0
  66. package/dist/esm/components/LoopSwiper.js.map +1 -0
  67. package/dist/esm/components/Ring.d.ts +7 -0
  68. package/dist/esm/components/Ring.js +26 -0
  69. package/dist/esm/components/Ring.js.map +1 -0
  70. package/dist/esm/components/Scroll.js.map +1 -1
  71. package/dist/esm/components/SectionRing.d.ts +8 -0
  72. package/dist/esm/components/SectionRing.js +31 -0
  73. package/dist/esm/components/SectionRing.js.map +1 -0
  74. package/dist/esm/components/Skeleton.d.ts +3 -0
  75. package/dist/esm/components/Skeleton.js +36 -0
  76. package/dist/esm/components/Skeleton.js.map +1 -0
  77. package/dist/esm/components/TransitionBox.d.ts +10 -0
  78. package/dist/esm/components/TransitionBox.js +50 -0
  79. package/dist/esm/components/TransitionBox.js.map +1 -0
  80. package/dist/esm/components/TransitionNum.d.ts +16 -0
  81. package/dist/esm/components/TransitionNum.js +65 -0
  82. package/dist/esm/components/TransitionNum.js.map +1 -0
  83. package/dist/esm/components/Trapezium.d.ts +9 -0
  84. package/dist/esm/components/Trapezium.js +35 -0
  85. package/dist/esm/components/Trapezium.js.map +1 -0
  86. package/dist/esm/index.d.ts +14 -265
  87. package/dist/esm/index.js +14 -843
  88. package/dist/esm/index.js.map +1 -1
  89. package/package.json +4 -3
  90. package/src/components/AutoFit.tsx +95 -0
  91. package/src/components/AutoScroll.tsx +1 -0
  92. package/src/components/AutoSizeTextarea.tsx +31 -0
  93. package/src/components/CircleText.tsx +56 -0
  94. package/src/components/Flow.tsx +154 -0
  95. package/src/components/HlsPlayer.tsx +38 -0
  96. package/src/components/InputFile.tsx +193 -0
  97. package/src/components/LoopSwiper.tsx +101 -0
  98. package/src/components/Ring.tsx +19 -0
  99. package/src/components/Scroll.tsx +1 -0
  100. package/src/components/SectionRing.tsx +36 -0
  101. package/src/components/Skeleton.tsx +39 -0
  102. package/src/components/TransitionBox.tsx +36 -0
  103. package/src/components/TransitionNum.tsx +54 -0
  104. package/src/components/Trapezium.tsx +35 -0
  105. package/src/index.tsx +14 -862
  106. package/dist/cjs/skeleton.css +0 -18
  107. package/dist/esm/skeleton.css +0 -18
  108. package/src/skeleton.css +0 -18
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/TransitionBox.tsx
21
+ var TransitionBox_exports = {};
22
+ __export(TransitionBox_exports, {
23
+ TransitionBox: () => TransitionBox
24
+ });
25
+ module.exports = __toCommonJS(TransitionBox_exports);
26
+ var import_ahooks = require("ahooks");
27
+ var import_react = require("react");
28
+ var TransitionBox = (0, import_react.forwardRef)((props, ref) => {
29
+ const { style, containerClassName, containerStyle, children, vertical = true, horizontal = true, time = 3e3, ...rest } = props;
30
+ const container = (0, import_react.useRef)(null);
31
+ const size = (0, import_ahooks.useSize)(container);
32
+ const width = size?.width ?? 0;
33
+ const height = size?.height ?? 0;
34
+ const [count, setCount] = (0, import_react.useState)(0);
35
+ (0, import_react.useEffect)(() => {
36
+ setCount((count2) => Math.min(count2 + 1, 3));
37
+ }, [width, height]);
38
+ const outerStyle = { transitionProperty: count === 3 ? [horizontal && "width", vertical && "height"].filter(Boolean).join(", ") : void 0, transitionDuration: count === 3 ? `${time}ms` : void 0, width, height, overflow: "hidden", position: "relative", ...style };
39
+ return /* @__PURE__ */ React.createElement("div", { ref, style: outerStyle, ...rest }, /* @__PURE__ */ React.createElement("div", { className: containerClassName, style: { position: "absolute", ...containerStyle }, ref: container }, children));
40
+ });
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ TransitionBox
44
+ });
45
+ //# sourceMappingURL=TransitionBox.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/TransitionBox.tsx"],
4
+ "sourcesContent": ["\"use client\"\r\n\r\nimport { useSize } from \"ahooks\"\r\nimport { CSSProperties, FC, forwardRef, HTMLAttributes, useEffect, useRef, useState } from \"react\"\r\n\r\nexport interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {\r\n containerClassName?: string\r\n containerStyle?: CSSProperties\r\n vertical?: boolean\r\n horizontal?: boolean\r\n time?: number\r\n}\r\n\r\n/** 尺寸渐变的组件 */\r\nexport const TransitionBox: FC<TransitionBoxProps> = forwardRef<HTMLDivElement, TransitionBoxProps>((props, ref) => {\r\n const { style, containerClassName, containerStyle, children, vertical = true, horizontal = true, time = 3000, ...rest } = props\r\n const container = useRef<HTMLDivElement>(null)\r\n const size = useSize(container)\r\n const width = size?.width ?? 0\r\n const height = size?.height ?? 0\r\n const [count, setCount] = useState(0)\r\n\r\n useEffect(() => {\r\n setCount(count => Math.min(count + 1, 3))\r\n }, [width, height])\r\n\r\n const outerStyle: CSSProperties = { transitionProperty: count === 3 ? [horizontal && \"width\", vertical && \"height\"].filter(Boolean).join(\", \") : undefined, transitionDuration: count === 3 ? `${time}ms` : undefined, width, height, overflow: \"hidden\", position: \"relative\", ...style }\r\n\r\n return (\r\n <div ref={ref} style={outerStyle} {...rest}>\r\n <div className={containerClassName} style={{ position: \"absolute\", ...containerStyle }} ref={container}>\r\n {children}\r\n </div>\r\n </div>\r\n )\r\n})\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAwB;AACxB,mBAA2F;AAWpF,IAAM,oBAAwC,yBAA+C,CAAC,OAAO,QAAQ;AAChH,QAAM,EAAE,OAAO,oBAAoB,gBAAgB,UAAU,WAAW,MAAM,aAAa,MAAM,OAAO,KAAM,GAAG,KAAK,IAAI;AAC1H,QAAM,gBAAY,qBAAuB,IAAI;AAC7C,QAAM,WAAO,uBAAQ,SAAS;AAC9B,QAAM,QAAQ,MAAM,SAAS;AAC7B,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,CAAC;AAEpC,8BAAU,MAAM;AACZ,aAAS,CAAAA,WAAS,KAAK,IAAIA,SAAQ,GAAG,CAAC,CAAC;AAAA,EAC5C,GAAG,CAAC,OAAO,MAAM,CAAC;AAElB,QAAM,aAA4B,EAAE,oBAAoB,UAAU,IAAI,CAAC,cAAc,SAAS,YAAY,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI,IAAI,QAAW,oBAAoB,UAAU,IAAI,GAAG,WAAW,QAAW,OAAO,QAAQ,UAAU,UAAU,UAAU,YAAY,GAAG,MAAM;AAEzR,SACI,oCAAC,SAAI,KAAU,OAAO,YAAa,GAAG,QAClC,oCAAC,SAAI,WAAW,oBAAoB,OAAO,EAAE,UAAU,YAAY,GAAG,eAAe,GAAG,KAAK,aACxF,QACL,CACJ;AAER,CAAC;",
6
+ "names": ["count"]
7
+ }
@@ -0,0 +1,16 @@
1
+ import { ForwardedRef, HTMLAttributes } from "react";
2
+ export interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
3
+ /** 当前数字 */
4
+ children: number;
5
+ /** 变换周期,单位帧 */
6
+ period: number;
7
+ /** 数字转换为字符串的方法 */
8
+ numToStr?: (num: number) => string;
9
+ /** 实例 */
10
+ ins?: ForwardedRef<TransitionNumIns>;
11
+ }
12
+ export interface TransitionNumIns {
13
+ get(): number;
14
+ }
15
+ /** 渐变数字组件 */
16
+ export declare const TransitionNum: import("react").ForwardRefExoticComponent<TransitionNumProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/TransitionNum.tsx
21
+ var TransitionNum_exports = {};
22
+ __export(TransitionNum_exports, {
23
+ TransitionNum: () => TransitionNum
24
+ });
25
+ module.exports = __toCommonJS(TransitionNum_exports);
26
+ var import_deepsea_tools = require("deepsea-tools");
27
+ var import_react = require("react");
28
+ var TransitionNum = (0, import_react.forwardRef)((props, ref) => {
29
+ const { children: num, period, numToStr, ins, ...rest } = props;
30
+ if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) {
31
+ throw new RangeError("目标数字必须是整数,周期必须是正整数");
32
+ }
33
+ const ele = (0, import_react.useRef)(null);
34
+ const cache = (0, import_react.useRef)({ num, period, numToStr, show: num });
35
+ cache.current = { ...cache.current, num, period, numToStr };
36
+ (0, import_react.useImperativeHandle)(ref, () => ele.current, []);
37
+ (0, import_react.useImperativeHandle)(ins, () => ({ get: () => cache.current.show }), []);
38
+ (0, import_react.useEffect)(() => {
39
+ const { num: num2, period: period2, show, numToStr: numToStr2 } = cache.current;
40
+ ele.current.innerText = (numToStr2 || String)(show);
41
+ if (num2 === show)
42
+ return;
43
+ const div = ele.current;
44
+ const speed = (num2 - show) / period2;
45
+ const cancel = (0, import_deepsea_tools.setFrameInterval)(() => {
46
+ const { num: num3, numToStr: numToStr3 } = cache.current;
47
+ cache.current.show += speed;
48
+ if (speed > 0 && cache.current.show > num3 || speed < 0 && cache.current.show < num3) {
49
+ cancel();
50
+ cache.current.show = num3;
51
+ }
52
+ div.innerText = (numToStr3 || String)(speed > 0 ? Math.floor(cache.current.show) : Math.ceil(cache.current.show));
53
+ }, 1);
54
+ return cancel;
55
+ }, [num]);
56
+ return /* @__PURE__ */ React.createElement("div", { ref: ele, ...rest });
57
+ });
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ TransitionNum
61
+ });
62
+ //# sourceMappingURL=TransitionNum.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/TransitionNum.tsx"],
4
+ "sourcesContent": ["\"use client\"\r\n\r\nimport { setFrameInterval } from \"deepsea-tools\"\r\nimport { ForwardedRef, HTMLAttributes, forwardRef, useEffect, useImperativeHandle, useRef } from \"react\"\r\n\r\nexport interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\r\n /** 当前数字 */\r\n children: number\r\n /** 变换周期,单位帧 */\r\n period: number\r\n /** 数字转换为字符串的方法 */\r\n numToStr?: (num: number) => string\r\n /** 实例 */\r\n ins?: ForwardedRef<TransitionNumIns>\r\n}\r\n\r\nexport interface TransitionNumIns {\r\n get(): number\r\n}\r\n\r\n/** 渐变数字组件 */\r\nexport const TransitionNum = forwardRef<HTMLDivElement, TransitionNumProps>((props, ref) => {\r\n const { children: num, period, numToStr, ins, ...rest } = props\r\n if (!Number.isInteger(num) || !Number.isInteger(period) || period <= 0) {\r\n throw new RangeError(\"目标数字必须是整数,周期必须是正整数\")\r\n }\r\n const ele = useRef<HTMLDivElement>(null)\r\n const cache = useRef({ num, period, numToStr, show: num })\r\n cache.current = { ...cache.current, num, period, numToStr }\r\n\r\n useImperativeHandle(ref, () => ele.current!, [])\r\n useImperativeHandle(ins, () => ({ get: () => cache.current.show }), [])\r\n\r\n useEffect(() => {\r\n const { num, period, show, numToStr } = cache.current\r\n ele.current!.innerText = (numToStr || String)(show)\r\n if (num === show) return\r\n const div = ele.current!\r\n const speed = (num - show) / period\r\n const cancel = setFrameInterval(() => {\r\n const { num, numToStr } = cache.current\r\n cache.current.show += speed\r\n if ((speed > 0 && cache.current.show > num) || (speed < 0 && cache.current.show < num)) {\r\n cancel()\r\n cache.current.show = num\r\n }\r\n div.innerText = (numToStr || String)(speed > 0 ? Math.floor(cache.current.show) : Math.ceil(cache.current.show))\r\n }, 1)\r\n\r\n return cancel\r\n }, [num])\r\n\r\n return <div ref={ele} {...rest} />\r\n})\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAAiC;AACjC,mBAAiG;AAkB1F,IAAM,oBAAgB,yBAA+C,CAAC,OAAO,QAAQ;AACxF,QAAM,EAAE,UAAU,KAAK,QAAQ,UAAU,KAAK,GAAG,KAAK,IAAI;AAC1D,MAAI,CAAC,OAAO,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,MAAM,KAAK,UAAU,GAAG;AACpE,UAAM,IAAI,WAAW,oBAAoB;AAAA,EAC7C;AACA,QAAM,UAAM,qBAAuB,IAAI;AACvC,QAAM,YAAQ,qBAAO,EAAE,KAAK,QAAQ,UAAU,MAAM,IAAI,CAAC;AACzD,QAAM,UAAU,EAAE,GAAG,MAAM,SAAS,KAAK,QAAQ,SAAS;AAE1D,wCAAoB,KAAK,MAAM,IAAI,SAAU,CAAC,CAAC;AAC/C,wCAAoB,KAAK,OAAO,EAAE,KAAK,MAAM,MAAM,QAAQ,KAAK,IAAI,CAAC,CAAC;AAEtE,8BAAU,MAAM;AACZ,UAAM,EAAE,KAAAA,MAAK,QAAAC,SAAQ,MAAM,UAAAC,UAAS,IAAI,MAAM;AAC9C,QAAI,QAAS,aAAaA,aAAY,QAAQ,IAAI;AAClD,QAAIF,SAAQ;AAAM;AAClB,UAAM,MAAM,IAAI;AAChB,UAAM,SAASA,OAAM,QAAQC;AAC7B,UAAM,aAAS,uCAAiB,MAAM;AAClC,YAAM,EAAE,KAAAD,MAAK,UAAAE,UAAS,IAAI,MAAM;AAChC,YAAM,QAAQ,QAAQ;AACtB,UAAK,QAAQ,KAAK,MAAM,QAAQ,OAAOF,QAAS,QAAQ,KAAK,MAAM,QAAQ,OAAOA,MAAM;AACpF,eAAO;AACP,cAAM,QAAQ,OAAOA;AAAA,MACzB;AACA,UAAI,aAAaE,aAAY,QAAQ,QAAQ,IAAI,KAAK,MAAM,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,MAAM,QAAQ,IAAI,CAAC;AAAA,IACnH,GAAG,CAAC;AAEJ,WAAO;AAAA,EACX,GAAG,CAAC,GAAG,CAAC;AAER,SAAO,oCAAC,SAAI,KAAK,KAAM,GAAG,MAAM;AACpC,CAAC;",
6
+ "names": ["num", "period", "numToStr"]
7
+ }
@@ -0,0 +1,9 @@
1
+ import { HTMLAttributes } from "react";
2
+ export interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {
3
+ top: number;
4
+ bottom: number;
5
+ height: number;
6
+ borderRadius: number;
7
+ }
8
+ /** 梯形组件 */
9
+ export declare const Trapezium: import("react").ForwardRefExoticComponent<TrapeziumProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Trapezium.tsx
21
+ var Trapezium_exports = {};
22
+ __export(Trapezium_exports, {
23
+ Trapezium: () => Trapezium
24
+ });
25
+ module.exports = __toCommonJS(Trapezium_exports);
26
+ var import_react = require("react");
27
+ var Trapezium = (0, import_react.forwardRef)((props, ref) => {
28
+ const { top, bottom, height, borderRadius, style, ...rest } = props;
29
+ const diff = (bottom - top) / 2;
30
+ const a = Math.atan(height / diff) / 2;
31
+ const b = borderRadius / Math.tan(a);
32
+ const c = b * Math.cos(a * 2);
33
+ const d = b * Math.sin(a * 2);
34
+ const e = Math.PI / 2 - a;
35
+ const f = borderRadius / Math.tan(e);
36
+ const g = f * Math.cos(a * 2);
37
+ const h = f * Math.sin(a * 2);
38
+ return /* @__PURE__ */ React.createElement("div", { ref, style: { width: bottom, height, clipPath: `path("M ${diff + f} ${0} A ${borderRadius} ${borderRadius} 0 0 0 ${diff - g} ${h} L ${c} ${height - d} A ${borderRadius} ${borderRadius} 0 0 0 ${b} ${height} L ${bottom - b} ${height} A ${borderRadius} ${borderRadius} 0 0 0 ${bottom - c} ${height - d} L ${top + diff + g} ${h} A ${borderRadius} ${borderRadius} 0 0 0 ${top + diff - f} ${0} Z")`, ...style }, ...rest });
39
+ });
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ Trapezium
43
+ });
44
+ //# sourceMappingURL=Trapezium.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/Trapezium.tsx"],
4
+ "sourcesContent": ["\"use client\"\r\n\r\nimport { HTMLAttributes, forwardRef } from \"react\"\r\n\r\nexport interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {\r\n top: number\r\n bottom: number\r\n height: number\r\n borderRadius: number\r\n}\r\n\r\n/** 梯形组件 */\r\nexport const Trapezium = forwardRef<HTMLDivElement, TrapeziumProps>((props, ref) => {\r\n const { top, bottom, height, borderRadius, style, ...rest } = props\r\n\r\n const diff = (bottom - top) / 2\r\n\r\n const a = Math.atan(height / diff) / 2\r\n\r\n const b = borderRadius / Math.tan(a)\r\n\r\n const c = b * Math.cos(a * 2)\r\n\r\n const d = b * Math.sin(a * 2)\r\n\r\n const e = Math.PI / 2 - a\r\n\r\n const f = borderRadius / Math.tan(e)\r\n\r\n const g = f * Math.cos(a * 2)\r\n\r\n const h = f * Math.sin(a * 2)\r\n\r\n return <div ref={ref} style={{ width: bottom, height, clipPath: `path(\"M ${diff + f} ${0} A ${borderRadius} ${borderRadius} 0 0 0 ${diff - g} ${h} L ${c} ${height - d} A ${borderRadius} ${borderRadius} 0 0 0 ${b} ${height} L ${bottom - b} ${height} A ${borderRadius} ${borderRadius} 0 0 0 ${bottom - c} ${height - d} L ${top + diff + g} ${h} A ${borderRadius} ${borderRadius} 0 0 0 ${top + diff - f} ${0} Z\")`, ...style }} {...rest} />\r\n})\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2C;AAUpC,IAAM,gBAAY,yBAA2C,CAAC,OAAO,QAAQ;AAChF,QAAM,EAAE,KAAK,QAAQ,QAAQ,cAAc,OAAO,GAAG,KAAK,IAAI;AAE9D,QAAM,QAAQ,SAAS,OAAO;AAE9B,QAAM,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI;AAErC,QAAM,IAAI,eAAe,KAAK,IAAI,CAAC;AAEnC,QAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC;AAE5B,QAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC;AAE5B,QAAM,IAAI,KAAK,KAAK,IAAI;AAExB,QAAM,IAAI,eAAe,KAAK,IAAI,CAAC;AAEnC,QAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC;AAE5B,QAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC;AAE5B,SAAO,oCAAC,SAAI,KAAU,OAAO,EAAE,OAAO,QAAQ,QAAQ,UAAU,WAAW,OAAO,KAAK,QAAQ,gBAAgB,sBAAsB,OAAO,KAAK,OAAO,KAAK,SAAS,OAAO,gBAAgB,sBAAsB,KAAK,YAAY,SAAS,KAAK,YAAY,gBAAgB,sBAAsB,SAAS,KAAK,SAAS,OAAO,MAAM,OAAO,KAAK,OAAO,gBAAgB,sBAAsB,MAAM,OAAO,KAAK,SAAS,GAAG,MAAM,GAAI,GAAG,MAAM;AACtb,CAAC;",
6
+ "names": []
7
+ }
@@ -1,266 +1,15 @@
1
- import { ButtonHTMLAttributes, CSSProperties, FC, HTMLAttributes, InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from "react";
2
- export * from "./components/Scroll";
1
+ export * from "./components/AutoFit";
3
2
  export * from "./components/AutoScroll";
4
- export interface InputFileDataTypes {
5
- base64: string;
6
- text: string;
7
- arrayBuffer: ArrayBuffer;
8
- binary: string;
9
- file: File;
10
- }
11
- export type InputFileDataType = keyof InputFileDataTypes;
12
- export interface InputFileData<T> {
13
- result: T;
14
- file: File;
15
- }
16
- export type InputFileProps = ({
17
- multiple?: false;
18
- type: "base64" | "text" | "binary";
19
- onChange?: (data: InputFileData<string>) => void;
20
- } | {
21
- multiple?: false;
22
- type: "arrayBuffer";
23
- onChange?: (data: InputFileData<ArrayBuffer>) => void;
24
- } | {
25
- multiple?: false;
26
- type?: "file";
27
- onChange?: (data: InputFileData<File>) => void;
28
- } | {
29
- multiple: true;
30
- type: "base64" | "text" | "binary";
31
- onChange?: (data: InputFileData<string>[]) => void;
32
- } | {
33
- multiple: true;
34
- type: "arrayBuffer";
35
- onChange?: (data: InputFileData<ArrayBuffer>[]) => void;
36
- } | {
37
- multiple: true;
38
- type?: "file";
39
- onChange?: (data: InputFileData<File>[]) => void;
40
- }) & Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "multiple" | "type"> & {
41
- /** 是否在捕获文件后清除 input 上的文件,默认为 false,主要区别在于如果不清除,连续两次选择同样的文件不会触发 onChange 事件,如果用于 form 表单,请设置为 flase */
42
- clearAfterChange?: boolean;
43
- };
44
- export declare function getFileData<T extends InputFileDataType>(file: File, type: T): Promise<InputFileDataTypes[T]>;
45
- /** 专用于读取文件的组件 */
46
- export declare const InputFile: import("react").ForwardRefExoticComponent<InputFileProps & import("react").RefAttributes<HTMLInputElement>>;
47
- export interface ImportExcelProps extends Omit<InputFileProps, "multiple" | "onChange" | "accept" | "type"> {
48
- onChange?: (data: Record<string, string>[]) => void;
49
- }
50
- export type InputFileButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
51
- input: InputFileProps;
52
- };
53
- /** 专用于读取文件的 button 组件 */
54
- export declare const InputFileButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
55
- input: InputFileProps;
56
- } & import("react").RefAttributes<HTMLButtonElement>>;
57
- /** 专门用于读取 excel 的组件 */
58
- export declare const ImportExcel: import("react").ForwardRefExoticComponent<ImportExcelProps & import("react").RefAttributes<HTMLInputElement>>;
59
- /** 手动导出 excel */
60
- export declare function exportExcel(data: Record<string, string>[], name: string): void;
61
- export interface ExportExcelProps extends ButtonHTMLAttributes<HTMLButtonElement> {
62
- data: Record<string, string>[];
63
- fileName: string;
64
- }
65
- /** 导出 excel 的 button 组件 */
66
- export declare const ExportExcel: import("react").ForwardRefExoticComponent<ExportExcelProps & import("react").RefAttributes<HTMLButtonElement>>;
67
- export interface TransitionBoxProps extends HTMLAttributes<HTMLDivElement> {
68
- containerClassName?: string;
69
- containerStyle?: CSSProperties;
70
- vertical?: boolean;
71
- horizontal?: boolean;
72
- time?: number;
73
- }
74
- /** 尺寸渐变的组件 */
75
- export declare const TransitionBox: FC<TransitionBoxProps>;
76
- export interface SeaRadarTarget {
77
- /** 半径 */
78
- radius: number;
79
- /** 弧度 */
80
- angle: number;
81
- /** 元素 */
82
- element: ReactNode;
83
- }
84
- export interface SeaRadarProps {
85
- /** 最小圆的半径 */
86
- unitRadius?: number;
87
- /** 一共的全数 */
88
- circleCount?: number;
89
- /** 角度分成多少份 */
90
- directionCount?: number;
91
- /** 圈的宽度 */
92
- circleWidth?: number;
93
- /** 圈的颜色 */
94
- circleColor: string;
95
- /** 角度的宽度 */
96
- directionWidth?: number;
97
- /** 角度颜色 */
98
- directionColor: string;
99
- /** 背景色 */
100
- backgroundColor: string;
101
- /** 扫描的颜色 */
102
- scanColor: string;
103
- /** 扫描的弧度 */
104
- scanAngle?: number;
105
- /** 扫描一周的时间,单位秒 */
106
- period?: number;
107
- /** 目标列表 */
108
- targets?: SeaRadarTarget[];
109
- /** 展示圈 */
110
- showCircle?: boolean;
111
- /** 展示方位 */
112
- showDirection?: boolean;
113
- /** 展示刻度线 */
114
- showGraduationLine?: boolean;
115
- /** 展示刻度文字 */
116
- showGraduationText?: boolean;
117
- }
118
- /** 雷达组件 */
119
- export declare const SeaRadar: FC<SeaRadarProps>;
120
- export interface RingProps extends HTMLAttributes<HTMLDivElement> {
121
- outerWidth: number;
122
- innerWidth: number;
123
- }
124
- /** 忘了什么组件 */
125
- export declare const Ring: FC<RingProps>;
126
- export interface FlowSizeData {
127
- /** 容器宽度 */
128
- width: number;
129
- /** 容器高度 */
130
- height: number;
131
- /** 元素宽度 */
132
- itemWidth: number;
133
- /** 元素高度 */
134
- itemHeight: number;
135
- /** 列间距 */
136
- columnGap: number;
137
- /** 列数 */
138
- columnCount: number;
139
- /** 行间距 */
140
- rowGap: number;
141
- /** 行数 */
142
- rowCount: number;
143
- /** 元素格数 */
144
- itemCount: number;
145
- /** 最大行数 */
146
- maxRows: number | null;
147
- /** 是否有元素被隐藏 */
148
- overflow: boolean;
149
- }
150
- export interface FlowProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
151
- /** 元素宽度 */
152
- itemWidth: number;
153
- /** 元素高度 */
154
- itemHeight: number;
155
- /** 列间距 */
156
- columnGap?: number | null | (number | null)[];
157
- /** 行间距 */
158
- rowGap?: number;
159
- /** 最大行数 */
160
- maxRows?: number | null;
161
- /** 源数据 */
162
- data: T[];
163
- /** 渲染 */
164
- render: (item: T, index: number, hidden: boolean) => ReactNode;
165
- /** key释放器,默认为 index */
166
- keyExactor?: (item: T, index: number) => string | number;
167
- /** 容器类名 */
168
- containerClassName?: string;
169
- /** 容器样式 */
170
- containerStyle?: CSSProperties;
171
- /** 节流时间,单位毫秒,默认200ms,传入 null 不节流 */
172
- throttle?: number | null;
173
- /** 动画时间,单位毫秒,默认400ms,传入 null 不展示动画 */
174
- transitionDuration?: number | null;
175
- /** 变化的回调函数 */
176
- onSizeChange?: (sizeData: FlowSizeData) => void;
177
- }
178
- export declare function getGapRange(gap?: undefined | number | null | (number | null)[]): [number, number | null];
179
- export declare function getGapCountAndSize(width: number, itemWidth: number, minGap: number, maxGap: number | null): [number, number];
180
- /** 自适应浮动组件 */
181
- export declare function Flow<T>(props: FlowProps<T>): import("react/jsx-runtime").JSX.Element;
182
- export interface TrapeziumProps extends HTMLAttributes<HTMLDivElement> {
183
- top: number;
184
- bottom: number;
185
- height: number;
186
- borderRadius: number;
187
- }
188
- /** 梯形组件 */
189
- export declare const Trapezium: import("react").ForwardRefExoticComponent<TrapeziumProps & import("react").RefAttributes<HTMLDivElement>>;
190
- export interface LoopSwiperProps extends HTMLAttributes<HTMLDivElement> {
191
- direction?: "horizontal" | "vertical";
192
- reverse?: boolean;
193
- period: number;
194
- gap?: CSSProperties["gap"];
195
- }
196
- /** 循环播放组件 */
197
- export declare const LoopSwiper: import("react").ForwardRefExoticComponent<LoopSwiperProps & import("react").RefAttributes<HTMLDivElement>>;
198
- export interface SectionRingProps extends HTMLAttributes<HTMLDivElement> {
199
- outerRadius: number;
200
- innerRadius: number;
201
- count: number;
202
- angel: number;
203
- }
204
- export declare const SectionRing: FC<SectionRingProps>;
205
- export interface TransitionNumProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
206
- /** 当前数字 */
207
- children: number;
208
- /** 变换周期,单位帧 */
209
- period: number;
210
- /** 数字转换为字符串的方法 */
211
- numToStr?: (num: number) => string;
212
- }
213
- export interface TransitionNumIns {
214
- get(): number;
215
- }
216
- /** 渐变数字组件 */
217
- export declare const TransitionNum: import("react").ForwardRefExoticComponent<TransitionNumProps & import("react").RefAttributes<TransitionNumIns>>;
218
- export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
219
- /** 每一个方块的宽度 */
220
- width: number;
221
- /** 每一个方块的高度 */
222
- height: number;
223
- /** 圆弧的半径,不包含方块的高度 */
224
- radius: number;
225
- /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
226
- startAngel?: number;
227
- /** 每一个方块之间间隔的弧度 */
228
- gapAngel?: number;
229
- /** 文字对齐的方式,默认居中 */
230
- align?: "left" | "center" | "right";
231
- /** 文字朝向圆心还是外侧,默认外侧 */
232
- direction?: "inner" | "outer";
233
- /** 是否反转文字顺序 */
234
- reverse?: boolean;
235
- /** 分割文字的方法 */
236
- separator?: string | RegExp | ((text: string) => string[]);
237
- /** 显示的文字 */
238
- children: string;
239
- }
240
- /** 环形文字 */
241
- export declare const CircleText: FC<CircleTextProps>;
242
- export declare const AutoSizeTextArea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
243
- export interface AutoFitProps extends HTMLAttributes<HTMLDivElement> {
244
- /** 设计稿宽度,默认 1920 */
245
- width?: number;
246
- /** 设计稿高度,默认 1080 */
247
- height?: number;
248
- /**
249
- * 在哪些方向进行缩放,默认缩放所有方向
250
- * 1. 水平方向是指,宽度按照设计稿进行占满,高度反向缩放
251
- * 2. 垂直方向是指,高度按照设计稿进行占满,宽度反向缩放
252
- * 3. 默认是水平和垂直方向都进行缩放,类似于 background-size: contain 的效果
253
- */
254
- direction?: "horizontal" | "vertical" | "both";
255
- }
256
- /**
257
- * 自适应缩放组件
258
- *
259
- * 注意:
260
- * 1. 父元素必须设置非 static 定位方式
261
- * 2. 父元素只能有且仅有一个子元素,那就是 AutoFit
262
- * 3. 不要设置 AutoFit 的 position、left、top、transform、width、height 属性
263
- * 4. 在第一次完成缩放前,无论 props 是什么,返回的都是 <div style={{ display: "none" }} />
264
- * 5. 元素的属性、事件、资源并不是立即加载的,会有一帧的延迟,在第一次完成缩放后才会显示
265
- */
266
- export declare const AutoFit: import("react").ForwardRefExoticComponent<AutoFitProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ export * from "./components/AutoSizeTextarea";
4
+ export * from "./components/CircleText";
5
+ export * from "./components/Flow";
6
+ export * from "./components/HlsPlayer";
7
+ export * from "./components/InputFile";
8
+ export * from "./components/LoopSwiper";
9
+ export * from "./components/Ring";
10
+ export * from "./components/Scroll";
11
+ export * from "./components/SectionRing";
12
+ export * from "./components/Skeleton";
13
+ export * from "./components/TransitionBox";
14
+ export * from "./components/TransitionNum";
15
+ export * from "./components/Trapezium";