ono-react-element 0.0.24 → 0.0.26

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 (184) hide show
  1. package/dist/es/AutoSliderList-CedBSQM5.js +1 -0
  2. package/dist/es/Button-CWrnOZH2.js +1 -0
  3. package/dist/es/ContextMenu-BW91eI6D.js +1 -0
  4. package/dist/es/MenuButton-M93IpBnN.js +1 -0
  5. package/dist/es/{Message-AC7MOJ5X.js → Message-C-4NUqae.js} +1 -1
  6. package/dist/es/Modal-C58i1Qbd.js +1 -0
  7. package/dist/es/Switch-BEPzl8aC.js +1 -0
  8. package/dist/es/TemplateDialog-VNTyP_2u.js +1 -0
  9. package/dist/es/VirtualList-CoQKjvuB.js +1 -0
  10. package/dist/es/Waterfall-DNvOPDGJ.js +1 -0
  11. package/dist/es/addCommasToNumber.ts-Bc5ZX_HW.js +1 -0
  12. package/dist/es/addEventWithOriginHandler.ts-CBP4faL-.js +1 -0
  13. package/dist/es/adjustColor.ts-Bcmtt429.js +1 -0
  14. package/dist/es/adjustingColors.ts-CpC0GUUO.js +1 -0
  15. package/dist/es/async2syncUtils.ts-DkF1iSK4.js +1 -0
  16. package/dist/es/base64ToBlob.ts-TfYiqeZD.js +1 -0
  17. package/dist/es/base64ToFile.ts-DMMwTaBr.js +1 -0
  18. package/dist/es/blobToBase64.ts-CPZTWtAM.js +1 -0
  19. package/dist/es/blobToFile.ts-BXmUv6W-.js +1 -0
  20. package/dist/es/browserUtils.ts-DSM1TN_g.js +1 -0
  21. package/dist/es/calculateAspectRatio.ts-DLTMZ6rT.js +1 -0
  22. package/dist/es/checkDeviceIsMobile.ts-D_9fa1Z1.js +1 -0
  23. package/dist/es/checkStatusCode.ts-CeS5vbbx.js +1 -0
  24. package/dist/es/copy2Clipboard.ts-D-Ux5BRc.js +1 -0
  25. package/dist/es/dayOfYear.ts-DdscYtyU.js +1 -0
  26. package/dist/es/debounce.ts-DtQl9QX-.js +1 -0
  27. package/dist/es/deepCopy.ts-DZSM2TJ5.js +1 -0
  28. package/dist/es/downloadFile.ts-1nf2IAw4.js +1 -0
  29. package/dist/es/ellipsisString.ts-CEHck07f.js +1 -0
  30. package/dist/es/fileToBase64.ts-Dx4eMf1P.js +1 -0
  31. package/dist/es/fileToBlob.ts-t5-IVXI8.js +1 -0
  32. package/dist/es/formatColor.ts-BpkK5FYe.js +1 -0
  33. package/dist/es/formatFileSize.ts-DmkABYUs.js +1 -0
  34. package/dist/es/formatSecond.ts-CI2ihnKf.js +1 -0
  35. package/dist/es/gcd.ts-BCWGat6T.js +1 -0
  36. package/dist/es/getAllTheNumbers.ts-DaNxVd8a.js +1 -0
  37. package/dist/es/getColorType.ts-B-_g2UQs.js +1 -0
  38. package/dist/es/getContrastColor.ts-5KaKa1G7.js +1 -0
  39. package/dist/es/getElementCenterPosition.ts-CpWYej6j.js +1 -0
  40. package/dist/es/getFileName.ts-BeGee0uD.js +1 -0
  41. package/dist/es/getFileSuffix.ts-BNoXbi6l.js +1 -0
  42. package/dist/es/getImageSIze.ts-BKCUZEmG.js +1 -0
  43. package/dist/es/getPointDistance.ts-oQIzWYT7.js +1 -0
  44. package/dist/es/getURLSearchParams.ts-CdkTE_NB.js +1 -0
  45. package/dist/es/grayColor.ts-bqVfONY0.js +1 -0
  46. package/dist/es/hex2hsl.ts-BLU_9tQG.js +1 -0
  47. package/dist/es/hex2hsv.ts-CNUNM2bM.js +1 -0
  48. package/dist/es/hex2rgb.ts-BQpml6Tb.js +1 -0
  49. package/dist/es/hex3To6.ts-BNOY-YJ2.js +1 -0
  50. package/dist/es/hsl2hex.ts-D9xS0UDg.js +1 -0
  51. package/dist/es/hsl2rgb.ts-B6-BIsnP.js +1 -0
  52. package/dist/es/hsv2hex.ts-BNkK519v.js +1 -0
  53. package/dist/es/hsv2rgb.ts-Bvoa3lA1.js +1 -0
  54. package/dist/es/index.js +1 -1
  55. package/dist/es/intersectionObserverUtils.ts-BdWvnE4X.js +1 -0
  56. package/dist/es/isPureNumber.ts-UvzCfFTt.js +1 -0
  57. package/dist/es/isValidColor.ts-CpkuoTf9.js +1 -0
  58. package/dist/es/mediaAutoplayPolicies.ts-h8T8o7DV.js +1 -0
  59. package/dist/es/parseQuery.ts-rxlqkZEE.js +1 -0
  60. package/dist/es/passwordStrength.ts-BSVicol-.js +1 -0
  61. package/dist/es/pick.ts-CVf1DuK1.js +1 -0
  62. package/dist/es/platformUtils.ts-BkXvuNq4.js +1 -0
  63. package/dist/es/printStr.ts-DMJqar33.js +1 -0
  64. package/dist/es/pureNumber.ts-LjeTI9RC.js +1 -0
  65. package/dist/es/quickSort.ts-CTYjJtIg.js +1 -0
  66. package/dist/es/rafTimeout.ts-atBwwlgC.js +1 -0
  67. package/dist/es/randomColor.ts-Cf-bUfCt.js +1 -0
  68. package/dist/es/randomString.ts-DpWnx0Kc.js +1 -0
  69. package/dist/es/removeTag.ts-K8ovHu9Z.js +1 -0
  70. package/dist/es/rgb2hex.ts-Dkw9FDV4.js +1 -0
  71. package/dist/es/rgb2hsl.ts-BPiSggZg.js +1 -0
  72. package/dist/es/rgb2hsv.ts-CxNRFDKF.js +1 -0
  73. package/dist/es/rgb2rgba.ts-Dx8-1nZt.js +1 -0
  74. package/dist/es/safeCapitalizeWord.ts-CBBsQk5s.js +1 -0
  75. package/dist/es/singleton.ts-BxAjTJl8.js +1 -0
  76. package/dist/es/throttle.ts-D_EqcNzV.js +1 -0
  77. package/dist/es/urlToBase64.ts-t7glJoIV.js +1 -0
  78. package/dist/es/urlToBlob.ts-DDhIhkMn.js +1 -0
  79. package/dist/es/urlToFile.ts-Dp1k4tJm.js +1 -0
  80. package/dist/index.css +1 -1
  81. package/dist/style/Checkbox.css +1 -1
  82. package/dist/style/Modal.css +1 -1
  83. package/dist/style/Radio.css +1 -1
  84. package/dist/style/Select.css +1 -1
  85. package/dist/style/SvgImg.css +1 -1
  86. package/dist/style/Switch.css +1 -1
  87. package/dist/style/TemplateDialog.css +1 -1
  88. package/dist/style/Tooltip.css +1 -1
  89. package/dist/style/Waterfall.css +1 -1
  90. package/dist/style/index.css +1 -1
  91. package/dist/types/components/MenuButton/MenuButton.d.ts +1 -1
  92. package/dist/types/components/MenuButton/types.d.ts +3 -3
  93. package/dist/types/index.d.ts +69 -4
  94. package/dist/types/utils/async2syncUtils.d.ts +5 -0
  95. package/dist/types/utils/browserUtils.d.ts +10 -0
  96. package/dist/types/utils/color/adjustColor.d.ts +1 -0
  97. package/dist/types/utils/color/adjustingColors.d.ts +8 -0
  98. package/dist/types/utils/color/formatColor.d.ts +3 -0
  99. package/dist/types/utils/color/getColorType.d.ts +1 -0
  100. package/dist/types/utils/color/getContrastColor.d.ts +1 -0
  101. package/dist/types/utils/color/hex2hsl.d.ts +1 -0
  102. package/dist/types/utils/color/hex2hsv.d.ts +1 -0
  103. package/dist/types/utils/color/hex2rgb.d.ts +1 -0
  104. package/dist/types/utils/color/hex3To6.d.ts +1 -0
  105. package/dist/types/utils/color/hsl2hex.d.ts +1 -0
  106. package/dist/types/utils/color/hsl2rgb.d.ts +1 -0
  107. package/dist/types/utils/color/hsv2hex.d.ts +1 -0
  108. package/dist/types/utils/color/hsv2rgb.d.ts +1 -0
  109. package/dist/types/utils/color/isValidColor.d.ts +1 -0
  110. package/dist/types/utils/color/randomColor.d.ts +1 -0
  111. package/dist/types/utils/color/rgb2hex.d.ts +1 -0
  112. package/dist/types/utils/color/rgb2hsl.d.ts +1 -0
  113. package/dist/types/utils/color/rgb2hsv.d.ts +1 -0
  114. package/dist/types/utils/color/rgb2rgba.d.ts +1 -0
  115. package/dist/types/utils/color/systemDropper.d.ts +1 -0
  116. package/dist/types/utils/common/addCommasToNumber.d.ts +1 -0
  117. package/dist/types/utils/common/addEventWithOriginHandler.d.ts +1 -0
  118. package/dist/types/utils/common/calculateAspectRatio.d.ts +1 -0
  119. package/dist/types/utils/common/checkDeviceIsMobile.d.ts +1 -0
  120. package/dist/types/utils/common/checkStatusCode.d.ts +4 -0
  121. package/dist/types/utils/common/copy2Clipboard.d.ts +1 -0
  122. package/dist/types/utils/common/dayOfYear.d.ts +1 -0
  123. package/dist/types/utils/common/debounce.d.ts +7 -0
  124. package/dist/types/utils/common/deepCopy.d.ts +1 -0
  125. package/dist/types/utils/common/ellipsisString.d.ts +1 -0
  126. package/dist/types/utils/common/formatFileSize.d.ts +4 -0
  127. package/dist/types/utils/common/formatSecond.d.ts +1 -0
  128. package/dist/types/utils/common/gcd.d.ts +1 -0
  129. package/dist/types/utils/common/getAllTheNumbers.d.ts +1 -0
  130. package/dist/types/utils/common/getElementCenterPosition.d.ts +4 -0
  131. package/dist/types/utils/common/getImageSIze.d.ts +4 -0
  132. package/dist/types/utils/common/getPointDistance.d.ts +1 -0
  133. package/dist/types/utils/common/getURLSearchParams.d.ts +1 -0
  134. package/dist/types/utils/common/grayColor.d.ts +1 -0
  135. package/dist/types/utils/common/isPureNumber.d.ts +1 -0
  136. package/dist/types/utils/common/mediaAutoplayPolicies.d.ts +1 -0
  137. package/dist/types/utils/common/parseQuery.d.ts +1 -0
  138. package/dist/types/utils/common/passwordStrength.d.ts +1 -0
  139. package/dist/types/utils/common/pick.d.ts +3 -0
  140. package/dist/types/utils/common/printStr.d.ts +11 -0
  141. package/dist/types/utils/common/pureNumber.d.ts +1 -0
  142. package/dist/types/utils/common/quickSort.d.ts +1 -0
  143. package/dist/types/utils/common/rafTimeout.d.ts +1 -0
  144. package/dist/types/utils/common/randomString.d.ts +1 -0
  145. package/dist/types/utils/common/removeTag.d.ts +1 -0
  146. package/dist/types/utils/common/safeCapitalizeWord.d.ts +1 -0
  147. package/dist/types/utils/common/singleton.d.ts +1 -0
  148. package/dist/types/utils/common/throttle.d.ts +13 -0
  149. package/dist/types/utils/file/base64ToBlob.d.ts +1 -0
  150. package/dist/types/utils/file/base64ToFile.d.ts +1 -0
  151. package/dist/types/utils/file/blobToBase64.d.ts +1 -0
  152. package/dist/types/utils/file/blobToFile.d.ts +1 -0
  153. package/dist/types/utils/file/downloadFile.d.ts +6 -0
  154. package/dist/types/utils/file/fileToBase64.d.ts +1 -0
  155. package/dist/types/utils/file/fileToBlob.d.ts +1 -0
  156. package/dist/types/utils/file/getFileName.d.ts +1 -0
  157. package/dist/types/utils/file/getFileSuffix.d.ts +1 -0
  158. package/dist/types/utils/file/urlToBase64.d.ts +1 -0
  159. package/dist/types/utils/file/urlToBlob.d.ts +1 -0
  160. package/dist/types/utils/file/urlToFile.d.ts +1 -0
  161. package/dist/types/utils/intersectionObserverUtils.d.ts +15 -0
  162. package/dist/types/utils/platformUtils.d.ts +13 -0
  163. package/dist/umd/index.css +1 -1
  164. package/dist/umd/index.css.br +0 -0
  165. package/dist/umd/index.css.gz +0 -0
  166. package/dist/umd/index.umd.cjs +1 -1
  167. package/dist/umd/index.umd.cjs.br +0 -0
  168. package/dist/umd/index.umd.cjs.gz +0 -0
  169. package/package.json +1 -1
  170. package/dist/es/AutoSliderList-DD7w6KlD.js +0 -1
  171. package/dist/es/Button-DXWGWvF-.js +0 -1
  172. package/dist/es/ContextMenu-BL414VF5.js +0 -1
  173. package/dist/es/MenuButton-C22ekETH.js +0 -1
  174. package/dist/es/Modal-e1dQi2y3.js +0 -1
  175. package/dist/es/Switch-DoiR9_x4.js +0 -1
  176. package/dist/es/TemplateDialog-D4D6YS2U.js +0 -1
  177. package/dist/es/VirtualList-YXDe-9GK.js +0 -1
  178. package/dist/es/Waterfall-D8AExUDu.js +0 -1
  179. package/dist/es/colorUtils.ts-Cxx4mvOB.js +0 -1
  180. package/dist/es/common.ts-OTJMJPHg.js +0 -1
  181. package/dist/es/fileFormatConversion.ts-3AQHtta9.js +0 -1
  182. package/dist/types/utils/colorUtils.d.ts +0 -33
  183. package/dist/types/utils/common.d.ts +0 -138
  184. package/dist/types/utils/fileFormatConversion.d.ts +0 -10
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ono-react-element",
3
3
  "private": false,
4
- "version": "0.0.24",
4
+ "version": "0.0.26",
5
5
  "description": "Component library by React + Typescript",
6
6
  "type": "module",
7
7
  "main": "./dist/umd/index.umd.cjs",
@@ -1 +0,0 @@
1
- import{j as y}from "./dependencies-B7YNjh_z.js";import{u as V}from "./useGetElementSize.tsx-DML7z5Xp.js";import{p as g}from "./common.ts-OTJMJPHg.js";import{useState as a,useRef as H,useMemo as z,useEffect as T,cloneElement as F}from "react";var $=((r)=>(r.Horizontal="Horizontal",r.Vertical="Vertical",r))($||{});const G=({list:r,style:v,disable:s,children:m,sliderBox:A,className:C,sliderStyle:N,duration:c=300,sliderClassName:b,currentIndex:p=0,direction:n=$.Horizontal,sliderTransitionTimingFunction:h="ease-in-out"})=>{const [B,E]=a(!1),[t,w]=a(0),[d,S]=a({t:0,l:0}),[u,j]=a({w:0,h:0}),l=H(null),x=H(null),k=z(()=>["width","height","transform"].map((e)=>`${e}${c/1e3}s ${h}`).join(","),[n,c,h]),D=z(()=>({width:u.w,height:u.h,transition:B ? k:"initial",transform:`translate(${d.l}px,${d.t}px)`}),[u,d]),{w:I,h:L}=V();return T(()=>{w(p);},[p]),T(()=>{(()=>{if(typeof t!="number"||!l.current||!x.current)return;const e=Array.from(l.current.children).slice(1);e.forEach((o)=>{o.style.position="relative",o.style.cursor=s ? "not-allowed":"pointer",o.style.zIndex="1";});const i=window.getComputedStyle(l.current),f={t:n==="Horizontal" ? g(i.paddingTop):e[t].offsetTop,l:n==="Horizontal" ? e[t].offsetLeft:g(i.paddingLeft)};S(f),j({w:e[t].offsetWidth,h:e[t].offsetHeight}),setTimeout(()=>E(!0),c);})();},[t,I,L,s]),y.jsxs("ul",{ref:l,className:["ono-auto-slider-list-container",C,s ? "ono-auto-slider-list-is-disable":""].filter(Boolean).join(" "),style:{flexDirection:n==="Horizontal" ? "row":"column",...v},children:[y.jsx("li",{ref:x,className:["ono-auto-slider-list-slider",b].filter(Boolean).join(" "),style:{...N,...D},children:A}),r.map((e,i)=>F(m({item:e,index:i,isActive:i===t}),{onClick:(f)=>{if(s)return;const o=m({item:e,index:i,isActive:i===t}).props.onClick;o&&o(f),w(i);}}))]});};export{G as A,$ as D};
@@ -1 +0,0 @@
1
- import{j as t}from "./dependencies-B7YNjh_z.js";import{t as B}from "./common.ts-OTJMJPHg.js";import{forwardRef as w,useState as L,useRef as h,useEffect as c}from "react";const T=w(({onClick:d,children:m,disabled:r,loading:n,plain:y,shape:u="default",htmlType:g="button",type:j="primary",throttleDuration:l,className:x,style:b,icon:a},s)=>{const [f,p]=L(!1),o=h(null),i=h(null),C=d ? B(d,l ? typeof l=="number" ? l:500:0):void 0;return c(()=>{(()=>{if(!i.current)return;const e=i.current;n ?(p(!0),e.classList.add("ono-loading-start")):(setTimeout(()=>{p(!1);},300),e.classList.remove("ono-loading-start"),e.classList.add("ono-loading-end"));})();},[n,i]),c(()=>{(()=>{if(!o.current)return;const e=o.current,v=e.getBoundingClientRect();e.style.setProperty("--btn-height",v.height+"px");})();},[o]),c(()=>{s&&o&&(typeof s=="function" ? s(o.current):s.current=o.current);},[s,o]),t.jsxs("button",{ref:o,className:[`ono-btn-${j}`,n||f ? "ono-is-loading":"",n||a ? "ono-is-icon":"",r ? "ono-btn-is-disabled":"",u==="round" ? "ono-is-round":u==="circle" ? "ono-is-circle":"",y ? "ono-is-plain":"",x ?? ""].filter(Boolean).join(" "),type:g,disabled:(typeof r=="function" ? r():r)||!!n,style:b,onClick:C,children:[(()=>{const e=t.jsx("span",{ref:i,className:"ono-btn-icon",children:t.jsx("span",{children:typeof n=="object" ? n.icon:t.jsx("svg",{viewBox:"0 0 1024 1024",focusable:"false","data-icon":"loading",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})})})});return n||f ? e:a ? t.jsx("span",{children:a}):t.jsx(t.Fragment,{});})(),m]});});export{T as B};
@@ -1 +0,0 @@
1
- import{j as m}from "./dependencies-B7YNjh_z.js";import{u as f}from "./useEventListener.tsx-C8V9Qip6.js";import{p as v}from "./PortalRenderer-izu9LyVc.js";const x=({className:o,content:e,style:n,onClick:t,onDoubleClick:l,onContextMenu:u,onMouseDown:i,onMouseUp:a,onMouseEnter:M,onMouseLeave:r,onMouseMove:p,destroy:s})=>(f("click",s),m.jsx("div",{className:o,style:n,onClick:t,onDoubleClick:l,onContextMenu:u,onMouseDown:i,onMouseUp:a,onMouseEnter:M,onMouseLeave:r,onMouseMove:p,children:typeof e=="function" ? e((c)=>{s(),c&&c();}):e})),k=({e:o,style:e,content:n,className:t})=>{o.preventDefault(),v(x,{className:t,content:n,style:{zIndex:9999,...e,position:"fixed",left:o.clientX,top:o.clientY}},"content-menu-root");};export{k as c};
@@ -1 +0,0 @@
1
- import{j as c}from "./dependencies-B7YNjh_z.js";import{useState as b,useEffect as p}from "react";const j=({active:s,onchange:r,w:t="40px",duration:d=400,clr:m="#f5f5f5",bgc:f="#342A7C"})=>{const [a,h]=b(!1),e=(o,i)=>{let u;const l=o.split("");return l[l.length-1]==="x"&&(u=Number(l.slice(0,-2).join(""))*i+"px"),u;},n={width:e(t,0.6),height:e(t,0.06),left:e(t,a ? 0.11:0.2),borderRadius:e(t,1),background:m,transition:`all ${d/1e3}s`},g=[{...n,width:e(t,a ? 0.8:0.5),height:e(t,a ? 0.05:0.06),transform:a ? "translateY(0)rotate(45deg)":`translateY(-${e(t,0.22)})`},{...n,width:e(t,a ? 0.8:0.3),height:e(t,a ? 0.05:0.06),transform:a ? "translateY(0)rotate(315deg)":`translateY(${e(t,0.22)})`},{...n,left:"auto",transform:a ? `translateX(${e(t,1.1)})`:"translateX(0)"}];return p(()=>{h(!!s);},[s]),c.jsx("button",{className:"ono-menu-button",style:{width:t,height:t,background:f,borderRadius:e(t,0.2)},onClick:()=>requestAnimationFrame(()=>{r==null||r(!a),h(!a);}),children:g.map((o,i)=>c.jsx("span",{style:{...o}},i))});};export{j as M};
@@ -1 +0,0 @@
1
- import{j as o}from "./dependencies-B7YNjh_z.js";import{a as h}from "./colorUtils.ts-Cxx4mvOB.js";import{useState as D,useRef as v,useEffect as y}from "react";import{p as E}from "./PortalRenderer-izu9LyVc.js";import{B as w}from "./Button-DXWGWvF-.js";const F=({title:c="This is a modal title",icon:C,content:g="This is a modal content",okText:k="confirm",cancelText:B="cancel",confirmDisabled:N,cancelDisabled:P,startPosition:t,onConfirm:d,onCancel:m,mask:x=!0,maskClosable:T=!1,width:u,btnClr:n,footer:f=({OkBtn:s,CancelBtn:i})=>o.jsxs(o.Fragment,{children:[o.jsx(i,{}),o.jsx(s,{})]}),modalBody:b,destroy:p})=>{const [s,i]=D(!1),l=v(null),a=v(null),z=[{label:"themeColor",value:n||""},{label:"themeHoverColor",value:n&&h(n,"light",10)||""},{label:"themeActiveColor",value:n&&h(n,"dark",20)||""},{label:"themeDisabledClr",value:n&&h(n,"light",20)||""}],r=()=>{if(t){if(!a.current)return;a.current.classList.remove("ono-modal-enter"),a.current.classList.add("ono-modal-leave"),setTimeout(()=>{p();},300);}else p();};return y(()=>(l.current&&(x ? l.current.showModal():l.current.show()),()=>{l.current&&l.current.close();}),[l.current,x]),y(()=>{(()=>{if(!a.current)return;const e=a.current.style;u&&e.setProperty("--width",u+"px"),t&&(e.setProperty("--left",(t.x/window.innerWidth*100).toFixed(2)+"%"),e.setProperty("--top",(t.y/window.innerHeight*100).toFixed(2)+"%")),n&&z.forEach((j)=>e.setProperty(`--${j.label}`,j.value));})();},[a]),o.jsx("dialog",{ref:l,className:"ono-modal",onClick:()=>T&&r(),children:b ? b(r):o.jsxs("div",{ref:a,className:["ono-modal-box",t ? "ono-modal-enter":""].join(" "),onClick:(e)=>e.stopPropagation(),children:[o.jsxs("div",{className:"ono-modal-box-body",children:[C ?? o.jsx("div",{className:"ono-modal-box-body-icon",children:o.jsx("svg",{color:"#faad14",viewBox:"64 64 896 896",focusable:"false","data-icon":"exclamation-circle",width:"22px",height:"22px",fill:"currentColor","aria-hidden":"true",style:{marginInlineEnd:"12px"},children:o.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"})})}),o.jsxs("div",{className:"ono-modal-box-body-contentBar",children:[o.jsx("h1",{className:"ono-modal-box-body-contentBar-title",children:c}),o.jsx("p",{className:"ono-modal-box-body-contentBar-content",children:g})]})]}),f&&o.jsx("div",{className:"ono-modal-box-footer",children:f({OkBtn:()=>o.jsx(w,{className:"ono-modal-box-footer-confirmBtn",loading:s,disabled:N,onClick:async()=>{i(!0);try{const e=d==null ? void 0:d();e instanceof Promise&&await e;}finally{i(!1),r();}},children:k ?? "Confirm"}),CancelBtn:()=>o.jsx(w,{className:"ono-modal-box-footer-cancelBtn",disabled:P||s,onClick:()=>{m==null||m(),r();},children:B ?? "Cancel"}),handleClose:()=>r()})})]})});},A=(c)=>E(F,c,"ono-modal");export{A as M};
@@ -1 +0,0 @@
1
- import{j as c}from "./dependencies-B7YNjh_z.js";import{p as w}from "./common.ts-OTJMJPHg.js";import{useRef as t,useEffect as y}from "react";const A=({id:k,text:e,style:d,color:n,checked:u,onChange:h,name:g="",className:m,disabled:v=!1})=>{const a=t(null),i=t(null),s=t(null),l=t(null),p=t(null),x=t(null),N=[{value:typeof n=="string" ? n:n==null ? void 0:n.active,name:"checkedClr"},{value:typeof n=="string"||n==null ? void 0:n.inactive,name:"uncheckedClr"}];return y(()=>{(()=>{if(!i.current||!a.current)return;let r=60,j=32;if(m||d){const o=getComputedStyle(i.current);r=w(o.width),j=w(o.height);}[...N,{value:r,name:"w"},{value:j,name:"h"}].forEach(({value:o,name:b})=>{o&&((f,C,B)=>{const E=typeof f=="number";B.style.setProperty(`--${C}`,E ? `${f}px`:f);})(o,b,a.current);}),requestAnimationFrame(()=>{l.current&&(l.current.style.transition="transform 0.3s");});})();},[i,a,l,m,d,n,e,p,x]),y(()=>{s.current&&(s.current.checked=u);},[s,u]),c.jsxs("div",{ref:a,className:["ono-switch",v ? "ono-switch-is-disabled":""].filter(Boolean).join(" "),children:[c.jsx("input",{id:k,name:g,role:"switch",ref:s,type:"checkbox",checked:u,onChange:(r)=>{v||(h==null||h(r.currentTarget.checked,r));}}),c.jsx("div",{ref:i,className:["ono-switch-box",m||""].filter(Boolean).join(" "),style:d,onClick:()=>{var r;return(r=s.current)==null ? void 0:r.click();},children:c.jsxs("div",{ref:l,className:"ono-switch-children-bar",children:[(e==null ? void 0:e.active)&&c.jsx("div",{ref:p,className:"ono-switch-children",children:e==null ? void 0:e.active}),c.jsx("div",{className:"ono-switch-slider"}),(e==null ? void 0:e.inactive)&&c.jsx("div",{ref:x,className:"ono-switch-children",children:e==null ? void 0:e.inactive})]})})]});};export{A as S};
@@ -1 +0,0 @@
1
- import{j as d}from "./dependencies-B7YNjh_z.js";import{g as $}from "./common.ts-OTJMJPHg.js";import{useState as b,useRef as h,useEffect as P,useCallback as w}from "react";const F=({children:s,animation:e,className:u,duration:l=300,style:p,maskColor:f="rgba(0,0,0,0.5)",disableContextMenu:m,maskClickClose:y=!0,dialogClose:a})=>{const [r,k]=b(!1),o=h(null),c=()=>{if(o.current)if(k(!0),e){const t=o.current;t.classList.remove(`ono-${e.type}-enter`),t.classList.add(`ono-${e.type}-leave`),setTimeout(a,l);}else a();};P(()=>{(()=>{if(!e||!o.current)return;const t=o.current.parentElement.style,n=o.current.style;switch(t.setProperty("--duration",l/1e3+"s"),e.type){case "zoom":{const{x:i,y:C}=$(e.element),x=(i/window.innerWidth*100).toFixed(2)+"%",v=(C/window.innerHeight*100).toFixed(2)+"%";n.setProperty("--left",x),n.setProperty("--top",v);break;}case "fade":{const i=e.direction==="left-center" ? "--left":"--top";n.setProperty(i,e.startPosition);break;}}})();},[o,e]);const g=w(()=>{if(!e)return "";const t=`ono-${e.type}-enter`,n=`ono-${e.type}-leave`;return r ? n:t;},[e,r]);return d.jsx("div",{className:` ono-dialog-mask ono-dialog-mask-${r ? "leave":"enter"}`,style:{background:f},onClick:()=>y&&c(),onContextMenu:(t)=>m&&t.preventDefault(),children:d.jsx("div",{ref:o,className:` ono-dialog ${u||""}${g()}`,style:p,onClick:(t)=>t.stopPropagation(),children:typeof s=="function" ? s(c):s})});};export{F as T};
@@ -1 +0,0 @@
1
- import{j as g}from "./dependencies-B7YNjh_z.js";import{u as k}from "./useEventListener.tsx-C8V9Qip6.js";import{t as B}from "./common.ts-OTJMJPHg.js";import{memo as q,useState as b,useMemo as x,useRef as j,useEffect as C}from "react";const O=q(({containerClassName:z,dataSource:d,containerStyle:w={},onEndCallback:p,refreshSpeed:E=50,wrapperClassName:A,wrapperStyle:M={},estimatedSize:I=35,updateDataSourceScroll2Top:L,direction:n="vertical"})=>{const [s,H]=b({viewSize:0,startIndex:0,listSize:0,renderCount:0,prevLen:0}),[l,T]=b([]),h=typeof I=="number" ? I:I(),N=x(()=>Math.min(d.length,s.startIndex+s.renderCount),[d,s]),m=x(()=>{var t;return s.startIndex>0 ?(t=l[s.startIndex-1])==null ? void 0:t.end:0;},[s.startIndex,l]),W=x(()=>d.slice(s.startIndex,N).map(({id:t,data:r})=>g.jsx("li",{"data-virtual-id":t,style:n==="vertical" ?{width:"100%"}:{height:"100%"},children:r},t)),[N,d,s.startIndex,n]),D=x(()=>({display:"flex",listStyle:"none",flexDirection:n==="vertical" ? "column":"row",height:n==="vertical" ? s.listSize-m+"px":"100%",width:n==="vertical" ? "auto":s.listSize-m+"px",transform:n==="vertical" ? `translate3d(0,${m}px,0)`:`translate3d(${m}px,0,0)`}),[s.listSize,m,n]),u=j(null),f=j(null),S=(t)=>H((r)=>({...r,...t})),R=B(()=>{const{scrollTop:t,clientHeight:r,scrollHeight:o,scrollLeft:a,clientWidth:i,scrollWidth:e}=u.current,c=n==="vertical" ? o-r-t:e-i-a;S({startIndex:$(l,n==="vertical" ? t:a)}),(n==="vertical" ? t===h/2:a===h/2)&&S({startIndex:0}),c<=20&&p&&p();},E),$=(t,r)=>{let o=0,a=t.length-1,i=-1;for(;o<=a;){const e=o+Math.floor((a-o)/2),c=t[e].end;if(c===r)return e+1;c<r ? o=e+1:((i===-1||i>e)&&(i=e),a=e-1);}return i;};return k("scroll",R,{target:u.current,deps:[l,n]}),C(()=>{(()=>{if(!u.current)return;const t=(n==="vertical" ? u.current.offsetHeight:u.current.offsetWidth)||0;S({viewSize:t,renderCount:Math.ceil(t/h)+1});})();},[u,n]),C(()=>{d.length&&f&&(()=>{var i;const t=[],r=d.length-s.prevLen,o=r>0 ? l.length:0,a=o>0 ? l[o-1].end:0;for(let e=0;e<(r>0 ? r:d.length);e++){const c=d[(r>0 ? s.prevLen:0)+e];t.push({index:c.id,size:h,start:a ? a+e*h:c.id*h,end:a ? a+(e+1)*h:(c.id+1)*h,dSize:0});}T((e)=>[...r>0 ? e:[],...t]),S({prevLen:d.length}),L&&((i=u.current)==null||i.scrollTo(0,0));})();},[f,d,L]),C(()=>{(()=>{if(!f.current||l.length===0)return;const t=Array.from(f.current.childNodes);if(!t.length)return;t.forEach((i)=>{const e=i.getBoundingClientRect(),c=+i.getAttribute("data-virtual-id"),v=l[c],y=v.size-(n==="vertical" ? e.height:e.width);y&&(v.size=n==="vertical" ? e.height:e.width,v.end=v.end-y,v.dSize=y);});const r=+t[0].getAttribute("data-virtual-id"),o=l.length;let a=l[r].dSize;l[r].dSize=0;for(let i=r+1;i<o;i++){const e=l[i];e.start=l[i-1].end,e.end=e.end-a,e.dSize&&(a+=e.dSize,e.dSize=0);}S({listSize:l[o-1].end});})();},[f,l,s.startIndex,n]),g.jsx("div",{ref:u,className:z,style:{width:"100%",height:"100%",overflow:"auto",...w},children:g.jsx("ul",{ref:f,className:A,style:{...D,...M},children:W})});}),P=(z,d)=>z.map((w,p)=>({id:p,data:d(w,p)}));export{O as E,P as c};
@@ -1 +0,0 @@
1
- import{j as m}from "./dependencies-B7YNjh_z.js";import{u as J}from "./useEventListener.tsx-C8V9Qip6.js";import{t as R}from "./common.ts-OTJMJPHg.js";import{useState as v,useRef as j,useCallback as B,useEffect as z}from "react";const Q=({options:t,pageSize:h,children:S,request:$,reloadData:o,className:A,style:H,updateData:D,loading:s=!0,bottomThreshold:O=50})=>{const [a,u]=v({page:1,reloadData:o,loading:!1,isFinish:!1,gap:typeof t=="number" ? 0:t.gap,imageWidth:typeof t=="number" ? t:0,columns:typeof t=="number" ? 0:t.columns,imageList:[]}),[f,L]=v([]),[x,N]=v([]),y=j(null),g=j(null),c=j(null),p=(i)=>u((e)=>({...e,...i})),w=async(i,e)=>{const r=o&&a.reloadData!==o;if(a.isFinish)return;p({loading:!0});const n=await $(i,e);k(n),p({isFinish:!n.length,imageList:r ? [...n]:[...a.imageList,...n],page:i+1,loading:!1});},k=(i)=>u((e)=>{const r=o&&a.reloadData!==o,n=r ? []:[...x],d=r ? Array(e.columns).fill(0):[...JSON.stringify(f)!=="[]" ? f:Array(e.columns).fill(0)];return i.forEach((M)=>{const l=((W)=>{let b=0,T=0;return b=W.indexOf(Math.min(...W)),T=W[b],{index:b,height:T};})(d),C=Math.floor(M.height*e.imageWidth/M.width);n.push({x:l.index%e.columns!==0 ? l.index*e.imageWidth+e.gap*l.index:l.index*e.imageWidth,y:l.height}),d[l.index]+=C+e.gap,L(d);}),N(n),e;}),E=B(()=>{if(!c.current)return;const i=c.current.clientWidth;let e=0,r=a.page;if(o&&a.reloadData!==o&&(u({page:1,reloadData:o,loading:!1,isFinish:!1,gap:typeof t=="number" ? 0:t.gap,imageWidth:typeof t=="number" ? t:0,columns:typeof t=="number" ? 0:t.columns,imageList:[]}),L([]),N([]),r=1),typeof t=="number"){const n=Math.floor(i/a.imageWidth);e=n-1;const d=e ?(i-n*a.imageWidth)/e:0;p({columns:n,gap:d});}else{e=a.columns-1;const n=(i-e*a.gap)/a.columns;p({imageWidth:n});}w(r,h);},[a,o]),F=()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(E,50);},q=R(()=>{const{scrollTop:i,clientHeight:e,scrollHeight:r}=g.current;r-e-i>O||!a.loading&&w(a.page,h);},50);return J("scroll",q,{target:g.current,deps:[a.loading,a.page]}),z(()=>(E(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F);}),[c,o]),z(()=>{D&&w(a.page,h);},[D,a.loading,a.page,g.current]),m.jsxs("div",{className:"ono-waterfall-container",children:[m.jsx("div",{ref:g,className:[A,"ono-waterfall-content"].join(" ").trim(),style:H,children:m.jsx("div",{ref:c,className:"ono-waterfall-wrapper",style:{height:Math.max(...f)-a.gap+"px"},children:a.imageList.map((i,e)=>m.jsx("div",{className:"ono-waterfall-item",style:{width:`${a.imageWidth}px`,transform:`translate(${x[e].x}px,${x[e].y}px)`},children:S(i,e)},i.id))})}),a.loading&&(typeof s=="function" ? s():s&&typeof s=="boolean" ? m.jsx("div",{className:"ono-waterfall-loading",children:"loading..."}):s)]});};export{Q as W};
@@ -1 +0,0 @@
1
- const g=/\d+/g,$=(n)=>{const a=n.match(g),t=(s)=>Number(s).toString(16).padStart(2,"0"),r=(s)=>s.reduce((i,h)=>i+t(h),"#"),e=(s)=>{const i=s,h=Number(s[s.length-1])!==1 ? Number(s[s.length-1]):100;return i.pop(),r(i)+t(2.56*h);};return a.length===3 ? r(a):a.length===5 ? e([a[0],a[1],a[2],10*Number(a[a.length-1])]):e(a);},p=(n)=>{const a=n.split("#")[1],t=(r)=>[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)];if(a.length===8){const r=parseInt(a.slice(-2),16)/256,e=t(a.slice(0,-2));return e.push(r),"rgba("+e.join(",")+")";}return "rgb("+t(a).join(",")+")";},d=(n)=>{const a=n.match(g),t=Number(a[0])/255,r=Number(a[1])/255,e=Number(a[2])/255,s=Math.min(t,r,e),i=Math.max(t,r,e);let h=0,o=0,l=(i+s)/2;if(i===s)h=o=0;else{const u=i-s;switch(o=l>0.5 ? u/(2-i-s):u/(i+s),i){case t:h=(r-e)/u+(r<e ? 6:0);break;case r:h=(e-t)/u+2;break;case e:h=(t-r)/u+4;}h/=6;}return `hsl(${Math.round(360*h)},${Math.round(100*o)}%,${Math.round(100*l)}%)`;},N=(n)=>{const a=n.match(g),t=Number(a[0])/360,r=Number(a[1])/100,e=Number(a[2])/100;let s,i,h;function o(m,c,b){return b<0&&(b+=1),b>1&&(b-=1),b<0.16666666666666666 ? m+6*(c-m)*b:b<0.5 ? c:b<0.6666666666666666 ? m+(c-m)*(0.6666666666666666-b)*6:m;}let l=e<0.5 ? e*(1+r):e+r-e*r,u=2*e-l;return s=o(u,l,t+0.3333333333333333),i=o(u,l,t),h=o(u,l,t-0.3333333333333333),`rgb(${Math.round(255*s)},${Math.round(255*i)},${Math.round(255*h)})`;},I=(n)=>d(p(n)),S=(n)=>$(N(n)),M=(n)=>{const a=n.match(g);let t=Number(a[0])/255,r=Number(a[1])/255,e=Number(a[2])/255;const s=Math.max(t,r,e),i=Math.min(t,r,e);let h=0,o=0,l=s;const u=s-i;if(o=s===0 ? 0:u/s,s===i)h=0;else{switch(s){case t:h=(r-e)/u+(r<e ? 6:0);break;case r:h=(e-t)/u+2;break;case e:h=(t-r)/u+4;}h/=6;}return `hsv(${360*h},${100*o},${100*l})`;},f=(n)=>{const a=n.match(g);let t,r,e,s,i,h,o,l,u=Number(a[0])/360,m=Number(a[1])/100,c=Number(a[2])/100;if(u&&m===0)t=r=e=c;else switch(u/=60,s=Math.floor(u),i=u-s,h=c*(1-m),o=c*(1-m*i),l=c*(1-m*(1-i)),s){case 0:t=c,r=l,e=h;break;case 1:t=o,r=c,e=h;break;case 2:t=h,r=c,e=l;break;case 3:t=h,r=o,e=c;break;case 4:t=l,r=h,e=c;break;default:t=c,r=h,e=o;}return `rgb(${Math.round(255*t)},${Math.round(255*r)},${Math.round(255*e)})`;},x=(n)=>/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/.test(n)? "hex":/^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/.test(n)? "rgb":"unknown",k=(n,a,t)=>{let r=[];if(n.includes("#"))r=I(n).match(g);else if(n.includes("rgb"))r=d(n).match(g);else{if(!n.includes("hsl"))throw new Error("颜色格式错误");r=n.match(g);}return S(`${r[0]},${r[1]}%,${a==="light" ? Number(r[2])+t>100 ? 100:Number(r[2])+t:Number(r[2])-t<0 ? 0:Number(r[2])-t}%`);},C={randomColor:()=>"#"+Math.random().toString(16).slice(2,8).padEnd(6,"0"),rgb2hex:$,hex2rgb:p,rgb2rgba:(n,a)=>{if(!a)return n;if(n.includes("rgba")){const t=n.split(",");return t.pop(),t.push(a+")"),t.join(",");}if(n.includes("rgb")){const t=n.split(","),r="rgba("+t[0].split("(")[1],e=t[t.length-1].split(")")[0];return [r,t[1],e," "+a+")"].join(",");}},rgb2hsl:d,hsl2rgb:N,hex2hsl:I,hsl2hex:S,rgb2hsv:M,hsv2rgb:f,hex2hsv:(n)=>M(p(n)),hsv2hex:(n)=>$(f(n)),formatColor:(n,a,t="rgba")=>{const r=n.match(g);let e=Number(r[0])/255,s=Number(r[1])/255,i=Number(r[2])/255;return t==="rgba" ? `rgba(${e},${s},${i},${a})`:t==="rgb" ? n:t==="hex" ? $(n):t==="hsl" ? d(`rgba(${e},${s},${i},${a})`):`rgba(${e},${s},${i},${a})`;},getContrastColor:(n)=>{const a=(function(r){if(r.startsWith("#"))return r.length===4&&(r=`#${r.slice(1).repeat(2)}`),[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)];if(r.startsWith("rgb")){const e=r.match(/\d+/g);return [parseInt(e[0]),parseInt(e[1]),parseInt(e[2])];}return null;})(n);return a===null ? null:(299*(t=a)[0]+587*t[1]+114*t[2])/1e3>128 ? "#000":"#fff";var t;},adjustColor:(n,a,t)=>{const r=x(n);if(r==="hex"){const e=n.replace("#",""),s=parseInt(e.slice(0,2),16),i=parseInt(e.slice(2,4),16),h=parseInt(e.slice(4,6),16);if(a==="lighten"){const o=Math.min(255,Math.max(0,s+(255-s)*t/100)),l=Math.min(255,Math.max(0,i+(255-i)*t/100)),u=Math.min(255,Math.max(0,h+(255-h)*t/100));return `#${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}`;}if(a==="darken"){const o=Math.min(255,Math.max(0,s-s*t/100)),l=Math.min(255,Math.max(0,i-i*t/100)),u=Math.min(255,Math.max(0,h-h*t/100));return `#${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}`;}}else if(r==="rgb"){const e=n.match(/\d+/g),s=parseInt(e[0]),i=parseInt(e[1]),h=parseInt(e[2]);if(a==="lighten")return `rgb(${Math.min(255,Math.max(0,s+(255-s)*t/100))},${Math.min(255,Math.max(0,i+(255-i)*t/100))},${Math.min(255,Math.max(0,h+(255-h)*t/100))})`;if(a==="darken")return `rgb(${Math.min(255,Math.max(0,s-s*t/100))},${Math.min(255,Math.max(0,i-i*t/100))},${Math.min(255,Math.max(0,h-h*t/100))})`;}return n;},isValidColor:(n)=>!(!/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/.test(n)&&!/^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/.test(n)),getColorType:x,hex3To6:(n)=>{const a=n.replace("#","").split("");return `#${a[0]+a[0]+a[1]+a[1]+a[2]+a[2]}`;},adjustingColors:k};export{k as a,C as c};
@@ -1 +0,0 @@
1
- const y=(t,e,n=t.length)=>(e<0&&(e=Math.max(0,e+t.length)),n<0&&(n=t.length+n),e>n&&([e,n]=[n,e]),e>=t.length ? t:(e=Math.max(0,Math.min(e,t.length)),(n=Math.max(0,Math.min(n,t.length)))-e>3 ? t.substring(0,e)+"..."+t.substring(n):t)),S=(t)=>/^\d+$/.test(t),x=/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])[\da-zA-Z]{8,}$/,h=(t)=>t<=11 ? Math.random().toString(36).substring(2,2+t).padEnd(t,"0"):h(11)+h(t-11),M=({el:t,str:e="hello world",speed:n=100,isExtendStr:r=!0,onDone:o})=>{let s=0,a=null;t.textContent&&r&&(s=t.textContent.length,e=t.textContent+e);const l=()=>{clearTimeout(a);const i=e.substring(0,s+1);t.textContent=i,s++,s!==e.length ? a=setTimeout(l,n):o&&o();};l();},C=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),O=async(t,e)=>{const n=(r,o)=>{const s=window.URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=encodeURIComponent(o),document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(s);};try{if(typeof t=="string"){const r=await fetch(t);if(!r.ok)throw new Error(`Network response was not ok:${r.statusText}`);n(await r.blob(),e);}else n(t,e);}catch(r){console.error("文件下载失败:",r instanceof Error ? r.message:String(r));}},T=(t,e)=>{t.toString().startsWith("2")? e.onSuccess&&e.onSuccess():(t.toString().startsWith("4")||t.toString().startsWith("5"))&&e.onFail&&e.onFail();},E=(t)=>{const e=t.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2};},A=(t,e,n)=>{const r=new IntersectionObserver(e,n);t instanceof HTMLElement ? r.observe(t):t.forEach((o)=>r.observe(o));},I=(t)=>{const e=Math.floor(t/3600),n=Math.floor(t%3600/60),r=Math.floor(t%60),o=(s)=>s.toString().padStart(2,"0");return(e>0 ? `${o(e)}:${o(n)}:${o(r)}`:`${o(n)}:${o(r)}`)+(t<10 ? ".00":t<100 ? ".0":"");},g=(t)=>{if(t.length<2)return t;const e=t[0],n=t.slice(1).filter((o)=>o<=e),r=t.slice(1).filter((o)=>o>e);return [...g(n),e,...g(r)];},P=(t,e)=>{const n=["B","KB","MB","GB","TB"];let o=n.indexOf((e==null ? void 0:e.unit)?? "B");if(o===-1)throw new Error("Invalid unit");if(!(e!=null&&e.unit))for(;t/Math.pow(1024,o)>=1024;)o++;return `${(t/Math.pow(1024,o)).toFixed((e==null ? void 0:e.decimalPlaces)?? 0)}${n[o]}`;},$=(t,e)=>`${Math.floor(t/p(t,e))}:${Math.floor(e/p(t,e))}`,p=(t,e)=>{for(;e!==0;){const n=e;e=t%e,t=n;}return t;},v=(t,e,n)=>{t.muted=!0,t.play();const r=new AudioContext(),o=r.state==="running";r.close(),o ?(t.muted=!1,e==null||e()):n==null||n();},F=(t)=>new URLSearchParams(window.location.search).get(t),R=(t)=>{let e;const n=new Proxy(t,{construct:(r,o)=>(e||(e=Reflect.construct(r,o)),e)});return n.prototype.construct=n,n;},k=(t)=>typeof t!="string"||t.length===0 ? "":t.charAt(0).toUpperCase()+t.slice(1),w=(t)=>{if(typeof t!="object"||t===null)return t;const e=Array.isArray(t)? []:{};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=w(t[n]));return e;},B=(t)=>new Promise((e)=>{const n=new Image();n.src=typeof t=="string" ? t:URL.createObjectURL(t),n.onload=()=>e({width:n.width,height:n.height});}),U=(t,e)=>{let n=0;const r=(o)=>{n||(n=o),o-n>=e ? t():requestAnimationFrame(r);};requestAnimationFrame(r);},j=(t,e,n)=>{const r=t[e];t[e]=function(o){r&&typeof r=="function"&&r.call(this,o),n.call(this,o);};},L=(t)=>{if(typeof t!="number"||isNaN(t))throw new Error("请输入有效的数字");const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".");},D=(t)=>parseFloat(t.replace(/[^0-9.]/g,"")),N=(t,e,n,r)=>Math.sqrt((t-n)**2+(e-r)**2),z=(t)=>navigator.clipboard.writeText(t),q=(t)=>Math.ceil((t.getTime()-new Date(t.getFullYear(),0,1).getTime())/864e5),W=(t,e,n)=>0.2126*t+0.7152*e+0.0722*n,H=(t)=>{const e={};return t.replace(/([^?=&]+)=([^&]+)/g,(n,r,o)=>e[r]=o),e;},G=(t,...e)=>Object.fromEntries(Object.entries(t).filter(([n])=>e.includes(n))),b=(t)=>{if(!t)return "";const e=t.lastIndexOf(".");return e===-1 ? b(t.substring(t.lastIndexOf("/")+1)):t.substring(0,e);},Y=(t)=>{if(!t)return "";const e=t.lastIndexOf(".");return t.substring(e+1);},Z=(t,e)=>{let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r),n=null;},e);};};function K(t,e,n={}){let r,o=null,s=null,a=0;const l=n.leading!==!1,i=n.trailing!==!1;function f(){s&&(t.apply(r,s),s=null);}function u(){const c=Date.now();c-a>=e ?(i&&s&&f(),o=null):o=setTimeout(u,e-(c-a));}const m=function(...c){const d=Date.now();s=c,r=this,d-a>=e ? o||(a=d,l ? f():i&&(o=setTimeout(u,e))):!o&&i&&(o=setTimeout(u,e-(d-a)));};return m.cancel=function(){o&&(clearTimeout(o),o=null),a=0,s=null;},m;}const Q={addCommasToNumber:L,addEventWithOriginHandler:j,calculateAspectRatio:$,checkDeviceIsMobile:C,checkStatusCode:T,copy2Clipboard:z,createIntersectionObserver:A,dayOfYear:q,deepCopy:w,downloadFile:O,formatFileSize:P,formatSecondes:I,getElementCenterPosition:E,getFileName:b,getFileSuffix:Y,getImageSIze:B,getPointDistance:N,getURLSearchParams:F,grayColor:W,mediaAutoplayPolicies:v,parseQuery:H,passwordStrength:x,pick:G,printStr:M,pureNumber:D,quickSort:g,rafTimeout:U,randomString:h,safeCapitalizeWord:k,singleton:R,throttle:K,debounce:Z,ellipsisString:y,isPureNumber:S};export{H as A,x as B,G as C,M as D,g as E,U as F,h as G,k as H,R as I,L as a,j as b,$ as c,C as d,T as e,Q as f,E as g,z as h,A as i,q as j,Z as k,w as l,O as m,y as n,P as o,D as p,I as q,b as r,Y as s,K as t,B as u,N as v,F as w,W as x,S as y,v as z};
@@ -1 +0,0 @@
1
- const d=(e)=>{const s=e.split(","),n=s[0].match(/:(.*?);/)[1],t=atob(s[1]);let a=t.length;const o=new Uint8Array(a);for(;a--;)o[a]=t.charCodeAt(a);return new Blob([o],{type:n});},y=(e,s)=>{const n=e.split(","),t=n[0].match(/:(.*?);/u)[1],a=atob(n[1]);let o=a.length,i=t.split("/")[1]==="jpeg" ? ".jpg":"."+t.split("/")[1];const r=new Uint8Array(o);for(;o--;)r[o]=a.charCodeAt(o);const c=new Blob([r],{type:t});return new File([c],s+i,{type:t,lastModified:(new Date()).getTime()});},w=(e)=>new Promise((s)=>{const n=new FileReader();n.readAsDataURL(e),n.onload=(t)=>{var i;const a=(i=t.target)==null ? void 0:i.result,o=a.split(",")[1];s(o);};}),p=(e,s="abc.jpg")=>new File([e],s,{type:e.type}),g=(e)=>new Promise((s)=>{const n=new FileReader();n.readAsDataURL(e),n.onload=(t)=>{var a;return s((a=t.target)==null ? void 0:a.result);};}),b=(e)=>e.slice(0,e.size,e.type),l=async(e)=>await(await fetch(e)).blob(),h=async(e)=>p(await l(e)),u=async(e)=>await w(await l(e));export{y as a,d as b,w as c,p as d,b as e,g as f,l as g,h,u};
@@ -1,33 +0,0 @@
1
- export type ColorType = 'rgb' | 'hsl' | 'hex' | 'hsv' | 'rgba';
2
- export declare const reg: RegExp;
3
- export declare const formatColor: (rgb: string, a: number, type?: ColorType) => string;
4
- /**
5
- *
6
- * @param clr 颜色值 16进制 / rgb / hsl
7
- * @param type 类型(light / dark)
8
- * @param percentage 百分比值(0 - 100)
9
- * @returns 颜色值 16进制
10
- */
11
- export declare const adjustingColors: (clr: string, type: "light" | "dark", percentage: number) => string;
12
- declare const _default: {
13
- randomColor: () => string;
14
- rgb2hex: (rgb: string) => string;
15
- hex2rgb: (hex: string) => string;
16
- rgb2rgba: (bg: string, op?: number) => string | undefined;
17
- rgb2hsl: (rgb: string) => string;
18
- hsl2rgb: (hsl: string) => string;
19
- hex2hsl: (hex: string) => string;
20
- hsl2hex: (hsl: string) => string;
21
- rgb2hsv: (rgb: string) => string;
22
- hsv2rgb: (hsv: string) => string;
23
- hex2hsv: (hex: string) => string;
24
- hsv2hex: (hsv: string) => string;
25
- formatColor: (rgb: string, a: number, type?: ColorType) => string;
26
- getContrastColor: (backgroundColor: string) => "#000" | "#fff" | null;
27
- adjustColor: (color: string, type: "lighten" | "darken", percent: number) => string;
28
- isValidColor: (clr: string) => boolean;
29
- getColorType: (clr: string) => "rgb" | "hex" | "unknown";
30
- hex3To6: (hex: string) => string;
31
- adjustingColors: (clr: string, type: "light" | "dark", percentage: number) => string;
32
- };
33
- export default _default;
@@ -1,138 +0,0 @@
1
- export declare const ellipsisString: (s: string, start: number, end?: number) => string;
2
- export declare const isPureNumber: (s: string) => boolean;
3
- export declare const passwordStrength: RegExp;
4
- export declare const randomString: (len: number) => string;
5
- /**
6
- *
7
- * @param { el: HTMLElement, str: string, speed?: number, isExtendStr?: boolean }
8
- */
9
- export declare const printStr: ({ el, str, speed, isExtendStr, onDone }: {
10
- el: HTMLElement;
11
- str: string;
12
- speed?: number;
13
- isExtendStr?: boolean;
14
- onDone?: () => void;
15
- }) => void;
16
- export declare const checkDeviceIsMobile: () => boolean;
17
- /**
18
- * 下载文件工具函数,兼容夸克及其他主流浏览器
19
- * @param file 文件路径(URL)或 Blob 对象
20
- * @param fileName 下载时使用的文件名
21
- */
22
- export declare const downloadFile: (file: string | Blob, fileName: string) => Promise<void>;
23
- export declare const checkStatusCode: (statusCode: number, options: {
24
- onSuccess?: () => void;
25
- onFail?: () => void;
26
- }) => void;
27
- export declare const getElementCenterPosition: (el: HTMLElement) => {
28
- x: number;
29
- y: number;
30
- };
31
- export declare const createIntersectionObserver: (observingEls: HTMLElement | HTMLElement[], callBack: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void, options?: IntersectionObserverInit) => void;
32
- export declare const formatSecondes: (seconds: number) => string;
33
- export declare const quickSort: (arr: number[]) => number[];
34
- export declare const formatFileSize: (size: number, options?: {
35
- unit?: "B" | "KB" | "MB" | "GB" | "TB";
36
- decimalPlaces?: number;
37
- }) => string;
38
- export declare const calculateAspectRatio: (width: number, height: number) => string;
39
- export declare const mediaAutoplayPolicies: (media: HTMLVideoElement | HTMLAudioElement, onSuccess?: () => void, onFail?: () => void) => void;
40
- export declare const getURLSearchParams: (param: string) => string | null;
41
- export declare const singleton: <T extends new (...args: any[]) => any>(className: T) => T;
42
- export declare const safeCapitalizeWord: (str: string) => string;
43
- export declare const deepCopy: <T>(value: T) => T;
44
- export declare const getImageSIze: (image: string | Blob | File) => Promise<{
45
- width: number;
46
- height: number;
47
- }>;
48
- export declare const rafTimeout: (callback: () => void, delay: number) => void;
49
- export declare const addEventWithOriginHandler: (element: HTMLElement, event: "onclick" | "onmousemove", handler: (e: MouseEvent) => void) => void;
50
- export declare const addCommasToNumber: (num: number) => string;
51
- export declare const pureNumber: (str: string) => number;
52
- export declare const getPointDistance: (x1: number, y1: number, x2: number, y2: number) => number;
53
- export declare const copy2Clipboard: (text: string) => Promise<void>;
54
- export declare const dayOfYear: (date: Date) => number;
55
- export declare const grayColor: (r: number, g: number, b: number) => number;
56
- export declare const parseQuery: (url: string) => Record<string, string>;
57
- export declare const pick: (obj: Record<string, any>, ...props: string[]) => {
58
- [k: string]: any;
59
- };
60
- export declare const getFileName: (fileName: string) => string;
61
- export declare const getFileSuffix: (fileName: string) => string;
62
- /**
63
- * 通用防抖函数
64
- * @param func 需要防抖的函数
65
- * @param delay 防抖延迟时间(毫秒)
66
- * @returns 防抖后的函数
67
- */
68
- export declare const debounce: <T extends (...args: any[]) => any>(func: T, delay: number) => ((...args: Parameters<T>) => void);
69
- /**
70
- * 通用节流函数
71
- * @param func 需要节流的函数
72
- * @param delay 节流延迟时间(毫秒)
73
- * @param options 配置选项
74
- * @returns 节流后的函数
75
- */
76
- export declare function throttle<T extends (...args: any[]) => any>(func: T, delay: number, options?: {
77
- leading?: boolean;
78
- trailing?: boolean;
79
- }): T & {
80
- cancel: () => void;
81
- };
82
- declare const _default: {
83
- addCommasToNumber: (num: number) => string;
84
- addEventWithOriginHandler: (element: HTMLElement, event: "onclick" | "onmousemove", handler: (e: MouseEvent) => void) => void;
85
- calculateAspectRatio: (width: number, height: number) => string;
86
- checkDeviceIsMobile: () => boolean;
87
- checkStatusCode: (statusCode: number, options: {
88
- onSuccess?: () => void;
89
- onFail?: () => void;
90
- }) => void;
91
- copy2Clipboard: (text: string) => Promise<void>;
92
- createIntersectionObserver: (observingEls: HTMLElement | HTMLElement[], callBack: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void, options?: IntersectionObserverInit) => void;
93
- dayOfYear: (date: Date) => number;
94
- deepCopy: <T>(value: T) => T;
95
- downloadFile: (file: string | Blob, fileName: string) => Promise<void>;
96
- formatFileSize: (size: number, options?: {
97
- unit?: "B" | "KB" | "MB" | "GB" | "TB";
98
- decimalPlaces?: number;
99
- }) => string;
100
- formatSecondes: (seconds: number) => string;
101
- getElementCenterPosition: (el: HTMLElement) => {
102
- x: number;
103
- y: number;
104
- };
105
- getFileName: (fileName: string) => string;
106
- getFileSuffix: (fileName: string) => string;
107
- getImageSIze: (image: string | Blob | File) => Promise<{
108
- width: number;
109
- height: number;
110
- }>;
111
- getPointDistance: (x1: number, y1: number, x2: number, y2: number) => number;
112
- getURLSearchParams: (param: string) => string | null;
113
- grayColor: (r: number, g: number, b: number) => number;
114
- mediaAutoplayPolicies: (media: HTMLVideoElement | HTMLAudioElement, onSuccess?: () => void, onFail?: () => void) => void;
115
- parseQuery: (url: string) => Record<string, string>;
116
- passwordStrength: RegExp;
117
- pick: (obj: Record<string, any>, ...props: string[]) => {
118
- [k: string]: any;
119
- };
120
- printStr: ({ el, str, speed, isExtendStr, onDone }: {
121
- el: HTMLElement;
122
- str: string;
123
- speed?: number;
124
- isExtendStr?: boolean;
125
- onDone?: () => void;
126
- }) => void;
127
- pureNumber: (str: string) => number;
128
- quickSort: (arr: number[]) => number[];
129
- rafTimeout: (callback: () => void, delay: number) => void;
130
- randomString: (len: number) => string;
131
- safeCapitalizeWord: (str: string) => string;
132
- singleton: <T extends new (...args: any[]) => any>(className: T) => T;
133
- throttle: typeof throttle;
134
- debounce: <T extends (...args: any[]) => any>(func: T, delay: number) => ((...args: Parameters<T>) => void);
135
- ellipsisString: (s: string, start: number, end?: number) => string;
136
- isPureNumber: (s: string) => boolean;
137
- };
138
- export default _default;
@@ -1,10 +0,0 @@
1
- declare const base64ToBlob: (data: string) => Blob;
2
- declare const base64ToFile: (base64: string, filename: string) => File;
3
- declare const blobToBase64: (blob: Blob) => Promise<string>;
4
- declare const blobToFile: (blob: Blob, filename?: string) => File;
5
- declare const fileToBase64: (file: File) => Promise<string>;
6
- declare const fileToBlob: (file: File) => Blob;
7
- declare const urlToBlob: (url: string) => Promise<Blob>;
8
- declare const urlToFile: (url: string) => Promise<File>;
9
- declare const urlToBase64: (url: string) => Promise<string>;
10
- export { base64ToBlob, base64ToFile, blobToBase64, blobToFile, fileToBase64, fileToBlob, urlToBase64, urlToBlob, urlToFile };