ono-react-element 0.0.15 → 0.0.17

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 (77) hide show
  1. package/dist/es/AutoSliderList-eb1CVc8b.js +1 -0
  2. package/dist/es/AvatarCrop-DrA-SARP.js +1 -65
  3. package/dist/es/Button-BsWI818a.js +1 -0
  4. package/dist/es/Card3D-DMvCSUhe.js +1 -18
  5. package/dist/es/Checkbox-daBabj14.js +1 -19
  6. package/dist/es/InjunctiveBox-DUNoNHCO.js +1 -11
  7. package/dist/es/Input-DLOeg2pz.js +1 -80
  8. package/dist/es/List-UAKCMuGC.js +1 -19
  9. package/dist/es/MenuButton-DHkU5Bq7.js +1 -17
  10. package/dist/es/Message-BGDILiLc.js +1 -105
  11. package/dist/es/Modal-BsI-8rap.js +1 -0
  12. package/dist/es/Pagination-m71H2tfS.js +1 -17
  13. package/dist/es/PortalRenderer-CDAzQJgm.js +1 -19
  14. package/dist/es/Radio-D_GKVoOC.js +1 -25
  15. package/dist/es/ScrollableTabs--449B73p.js +1 -0
  16. package/dist/es/Select-B11NvK-I.js +1 -0
  17. package/dist/es/SvgImg-CZwq2D7J.js +1 -14
  18. package/dist/es/Switch-BBHMaxoZ.js +1 -0
  19. package/dist/es/TemplateDialog-PQxjmAJa.js +1 -0
  20. package/dist/es/Toast-CQEsbqUJ.js +1 -42
  21. package/dist/es/Tooltip-CgttMIcX.js +1 -0
  22. package/dist/es/VirtualList-CdhqyHFQ.js +1 -0
  23. package/dist/es/Waterfall-CY3QkL5m.js +1 -0
  24. package/dist/es/colorUtils.ts-DYuRvCXZ.js +1 -145
  25. package/dist/es/common.ts-vX9A6Rye.js +1 -0
  26. package/dist/es/dependencies-CbQbPZZ-.js +1 -15524
  27. package/dist/es/event-CtX9rswE.js +1 -0
  28. package/dist/es/fileFormatConversion.ts-tUlewYon.js +1 -38
  29. package/dist/es/formatTimeUtils.ts-CkdWJ_Sl.js +1 -32
  30. package/dist/es/index.js +1 -115
  31. package/dist/es/useClickOutSide.tsx-CMvd2uTW.js +1 -15
  32. package/dist/es/useCountdown.tsx-Btzj-keH.js +1 -16
  33. package/dist/es/useEventListener.tsx-BBGVcI5T.js +1 -12
  34. package/dist/es/useGetElementSize.tsx-Dtshth0Y.js +1 -22
  35. package/dist/es/useKeyPress.tsx-Db44HXXz.js +1 -18
  36. package/dist/es/useMouseClick.tsx-C7uAH4n4.js +1 -12
  37. package/dist/es/useTheme.tsx-C5b7BRYz.js +1 -24
  38. package/dist/es/useThemePro.tsx-DQuSI8J7.js +1 -20
  39. package/dist/es/viewTransitionUtils.ts-CHa9uBpi.js +1 -19
  40. package/dist/index.css +1 -1
  41. package/dist/style/Button.css +1 -1
  42. package/dist/style/Modal.css +1 -1
  43. package/dist/style/ScrollableTabs.css +1 -0
  44. package/dist/style/Select.css +1 -1
  45. package/dist/types/components/Button/Button.d.ts +1 -1
  46. package/dist/types/components/Button/types.d.ts +1 -0
  47. package/dist/types/components/Modal/types.d.ts +0 -1
  48. package/dist/types/components/ScrollableTabs/ScrollableTab.d.ts +2 -0
  49. package/dist/types/components/ScrollableTabs/ScrollableTabs.d.ts +2 -0
  50. package/dist/types/components/ScrollableTabs/index.d.ts +1 -0
  51. package/dist/types/components/ScrollableTabs/types.d.ts +17 -0
  52. package/dist/types/components/Select/Option.d.ts +1 -1
  53. package/dist/types/components/Select/Select.d.ts +1 -1
  54. package/dist/types/components/Select/types.d.ts +12 -12
  55. package/dist/types/components/index.d.ts +1 -0
  56. package/dist/types/event/createEventEmitter.d.ts +2 -0
  57. package/dist/types/event/eventEmitter.d.ts +7 -0
  58. package/dist/types/event/index.d.ts +1 -0
  59. package/dist/types/index.d.ts +4 -3
  60. package/dist/types/utils/common.d.ts +22 -0
  61. package/dist/umd/index.css +1 -1
  62. package/dist/umd/index.css.br +0 -0
  63. package/dist/umd/index.css.gz +0 -0
  64. package/dist/umd/index.umd.cjs +1 -16587
  65. package/dist/umd/index.umd.cjs.br +0 -0
  66. package/dist/umd/index.umd.cjs.gz +0 -0
  67. package/package.json +1 -1
  68. package/dist/es/AutoSliderList-w9mw0JCN.js +0 -30
  69. package/dist/es/Button-C89izu2m.js +0 -26
  70. package/dist/es/Modal-BIFxRjSt.js +0 -32
  71. package/dist/es/Select-DAU6TuBu.js +0 -23
  72. package/dist/es/Switch-CRJejHP9.js +0 -34
  73. package/dist/es/TemplateDialog-dD8BcnbA.js +0 -45
  74. package/dist/es/Tooltip-j2AKREfX.js +0 -29
  75. package/dist/es/VirtualList-w16-kBkT.js +0 -65
  76. package/dist/es/Waterfall-CFVkuuCO.js +0 -55
  77. package/dist/es/common.ts-DQOEx8k3.js +0 -126
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.15",
4
+ "version": "0.0.17",
5
5
  "description": "Component library by React + Typescript",
6
6
  "type": "module",
7
7
  "main": "./dist/umd/index.umd.cjs",
@@ -1,30 +0,0 @@
1
- import { j as t } from "./dependencies-CbQbPZZ-.js";
2
- import { u as e } from "./useGetElementSize.tsx-Dtshth0Y.js";
3
- import { p as i } from "./common.ts-DQOEx8k3.js";
4
- import { useState as o, useRef as r, useMemo as n, useEffect as s, cloneElement as l } from "react";
5
- var a = ((t2) => (t2.Horizontal = "Horizontal", t2.Vertical = "Vertical", t2))(a || {});
6
- const c = ({ list: c2, style: d, disable: f, children: m, sliderBox: u, className: p, sliderStyle: h, duration: x = 300, sliderClassName: w, currentIndex: y = 0, direction: j = a.Horizontal, sliderTransitionTimingFunction: z = "ease-in-out" }) => {
7
- const [g, H] = o(false), [T, $] = o(0), [v, A] = o({ t: 0, l: 0 }), [C, N] = o({ w: 0, h: 0 }), b = r(null), B = r(null), S = n(() => ["width", "height", "transform"].map((t2) => `${t2} ${x / 1e3}s ${z}`).join(","), [j, x, z]), k = n(() => ({ width: C.w, height: C.h, transition: g ? S : "initial", transform: `translate(${v.l}px, ${v.t}px)` }), [C, v]), { w: D, h: E } = e();
8
- return s(() => {
9
- $(y);
10
- }, [y]), s(() => {
11
- (() => {
12
- if ("number" != typeof T) return;
13
- if (!b.current || !B.current) return;
14
- const t2 = Array.from(b.current.children).slice(1);
15
- t2.forEach((t3) => {
16
- t3.style.position = "relative", t3.style.cursor = f ? "not-allowed" : "pointer", t3.style.zIndex = "1";
17
- });
18
- const e2 = window.getComputedStyle(b.current), o2 = { t: "Horizontal" === j ? i(e2.paddingTop) : t2[T].offsetTop, l: "Horizontal" === j ? t2[T].offsetLeft : i(e2.paddingLeft) };
19
- A(o2), N({ w: t2[T].offsetWidth, h: t2[T].offsetHeight }), setTimeout(() => H(true), x);
20
- })();
21
- }, [T, D, E, f]), t.jsxs("ul", { ref: b, className: ["ono-auto-slider-list-container", p, f ? "ono-auto-slider-list-is-disable" : ""].filter(Boolean).join(" "), style: { flexDirection: "Horizontal" === j ? "row" : "column", ...d }, children: [t.jsx("li", { ref: B, className: ["ono-auto-slider-list-slider", w].filter(Boolean).join(" "), style: { ...h, ...k }, children: u }), c2.map((t2, e2) => l(m({ item: t2, index: e2, isActive: e2 === T }), { onClick: (i2) => {
22
- if (f) return;
23
- const o2 = m({ item: t2, index: e2, isActive: e2 === T }).props.onClick;
24
- o2 && o2(i2), $(e2);
25
- } }))] });
26
- };
27
- export {
28
- c as A,
29
- a as D
30
- };
@@ -1,26 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { useState as n, useRef as t, useEffect as s } from "react";
3
- const i = ({ onClick: i2, children: o, disabled: r, loading: l, plain: a, shape: c = "default", htmlType: d = "button", type: u = "primary", className: p, style: h, icon: f }) => {
4
- const [m, g] = n(false), j = t(null), b = t(null);
5
- return s(() => {
6
- (() => {
7
- if (!b.current) return;
8
- const e2 = b.current;
9
- l ? (g(true), e2.classList.add("ono-loading-start")) : (setTimeout(() => {
10
- g(false);
11
- }, 300), e2.classList.remove("ono-loading-start"), e2.classList.add("ono-loading-end"));
12
- })();
13
- }, [l, b]), s(() => {
14
- (() => {
15
- if (!j.current) return;
16
- const e2 = j.current, n2 = e2.getBoundingClientRect();
17
- e2.style.setProperty("--btn-height", n2.height + "px");
18
- })();
19
- }, [j]), e.jsxs("button", { ref: j, className: [`ono-btn-${u}`, l || m ? "is-loading" : "", l || f ? "is-icon" : "", r ? "is-disabled" : "", "round" === c ? "is-round" : "circle" === c ? "is-circle" : "", a ? "is-plain" : "", p ?? ""].filter(Boolean).join(" "), type: d, disabled: ("function" == typeof r ? r() : r) || !!l, style: h, onClick: i2, children: [(() => {
20
- const n2 = e.jsx("span", { ref: b, className: "ono-btn-icon", children: e.jsx("span", { children: "object" == typeof l ? l.icon : e.jsx("svg", { viewBox: "0 0 1024 1024", focusable: "false", "data-icon": "loading", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", children: e.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" }) }) }) });
21
- return l || m ? n2 : f ? e.jsx("span", { children: f }) : e.jsx(e.Fragment, {});
22
- })(), o] });
23
- };
24
- export {
25
- i as B
26
- };
@@ -1,32 +0,0 @@
1
- import { j as o } from "./dependencies-CbQbPZZ-.js";
2
- import { a as e } from "./colorUtils.ts-DYuRvCXZ.js";
3
- import { useRef as l, useEffect as n } from "react";
4
- import { p as a } from "./PortalRenderer-CDAzQJgm.js";
5
- const t = ({ title: a2 = "This is a modal title", icon: t2, content: r2 = "This is a modal content", okText: s = "confirm", cancelText: i = "cancel", isLoading: c, confirmDisabled: d, cancelDisabled: m, position: x, onConfirm: h = () => {
6
- }, onCancel: b = () => {
7
- }, mask: u = true, maskClosable: f = false, width: j, btnClr: p, footer: C = ({ OkBtn: e2, CancelBtn: l2 }) => o.jsxs(o.Fragment, { children: [o.jsx(l2, {}), o.jsx(e2, {})] }), modalBody: v, destroy: g }) => {
8
- const y = l(null), B = l(null), w = [{ label: "themeColor", value: p || "" }, { label: "themeHoverColor", value: p && e(p, "light", 10) || "" }, { label: "themeActiveColor", value: p && e(p, "dark", 20) || "" }, { label: "themeDisabledClr", value: p && e(p, "light", 20) || "" }], N = () => {
9
- if (x) {
10
- if (!B.current) return;
11
- B.current.classList.remove("ono-modal-enter"), B.current.classList.add("ono-modal-leave"), setTimeout(() => {
12
- g();
13
- }, 300);
14
- } else g();
15
- };
16
- return n(() => (y.current && (u ? y.current.showModal() : y.current.show()), () => {
17
- y.current && y.current.close();
18
- }), [y.current, u]), n(() => {
19
- (() => {
20
- if (!B.current) return;
21
- const o2 = B.current.style;
22
- j && o2.setProperty("--width", j + "px"), x && (o2.setProperty("--left", (x.x / window.innerWidth * 100).toFixed(2) + "%"), o2.setProperty("--top", (x.y / window.innerHeight * 100).toFixed(2) + "%")), p && w.forEach((e2) => o2.setProperty(`--${e2.label}`, e2.value));
23
- })();
24
- }, [B]), o.jsx("dialog", { ref: y, className: "ono-modal", onClick: () => f && N(), children: v ? v(N) : o.jsxs("div", { ref: B, className: ["ono-modal-box", x ? "ono-modal-enter" : ""].join(" "), onClick: (o2) => o2.stopPropagation(), children: [o.jsxs("div", { className: "ono-modal-box-body", children: [t2 ?? 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: a2 }), o.jsx("p", { className: "ono-modal-box-body-contentBar-content", children: r2 })] })] }), C && o.jsx("div", { className: "ono-modal-box-footer", children: C({ OkBtn: () => o.jsxs("button", { className: "ono-modal-box-footer-confirmBtn", disabled: d || c, onClick: () => {
25
- h(), N();
26
- }, children: [c && o.jsx("svg", { className: "ono-modal-box-footer-confirmBtn-loading", viewBox: "0 0 1024 1024", focusable: "false", "data-icon": "loading", fill: "currentColor", "aria-hidden": "true", children: o.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" }) }), s ?? "Confirm"] }), CancelBtn: () => o.jsx("button", { className: "ono-modal-box-footer-cancelBtn", disabled: m || c, onClick: () => {
27
- b(), N();
28
- }, children: i ?? "Cancel" }), handleClose: () => N() }) })] }) });
29
- }, r = (o2) => a(t, o2, "ono-modal");
30
- export {
31
- r as M
32
- };
@@ -1,23 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { useState as o, useEffect as n } from "react";
3
- import { T as a } from "./Tooltip-j2AKREfX.js";
4
- import { O as t } from "./Input-DLOeg2pz.js";
5
- import { L as l } from "./List-UAKCMuGC.js";
6
- const i = ({ label: o2, value: n2, disabled: a2, onChange: t2, optionRender: l2, currentValue: i2 }) => e.jsx("button", { role: "option", "aria-label": o2, disabled: a2, className: "ono-option-item", onClick: () => t2 == null ? void 0 : t2(n2), children: l2 ? l2({ label: o2, value: n2, disabled: a2 }, i2 === o2) : e.jsx("div", { className: ["ono-option-item-content", i2 === o2 ? "ono-option-item-content-active" : "", a2 ? "ono-option-item-content-disabled" : ""].filter(Boolean).join(" "), children: o2 }) }), s = ({ options: s2, defaultValue: c, placeholder: d, inputBorder: m, isShowArrow: p, disabled: u, clearable: h, selectClassName: b, optionsClassName: f, filterable: j, notFoundContent: x, optionRender: v, onClear: C, onChange: g, filterMethod: w }) => {
7
- const [N, L] = o(""), [B, S] = o(""), [V, k] = o(false), [M, y] = o(false), [O, R] = o(""), A = (e2) => {
8
- const o2 = s2.find((o3) => o3.value === e2);
9
- L(o2 ? o2.label : "");
10
- }, F = (e2) => {
11
- g == null ? void 0 : g(e2), R(e2), A(e2);
12
- };
13
- return n(() => {
14
- c && A(c);
15
- }, [c, s2]), e.jsx(a, { sameWidth: true, trigger: "click", placement: "bottom", isShowArrow: p, className: ["ono-option-container", f].filter(Boolean).join(" "), onOpenChange: (e2) => {
16
- y(e2), j && B && !e2 && S("");
17
- }, content: e.jsx(l, { list: j ? w && "function" == typeof w ? w(B, s2) : s2.filter((e2) => e2.label.toLocaleLowerCase().includes(B.toLocaleLowerCase())) : s2, fallback: x ?? e.jsx("div", { className: "ono-option-item", children: e.jsx("div", { className: "ono-option-item-content-no-data", onClick: (e2) => e2.stopPropagation(), children: "No Data" }) }), children: (o2) => e.jsx(i, { ...o2, onChange: F, currentValue: N.toString(), optionRender: v }, o2.value) }), children: e.jsx("div", { className: "ono-select", onMouseEnter: () => k(true), onMouseLeave: () => k(false), children: e.jsx(t, { className: [j ? "" : "ono-select-readonly", b].filter(Boolean).join(" "), border: m, disabled: u, placeholder: j && O ? N.toString() || "" : d, readonly: !j, value: j && M ? B : N.toString(), clearable: V && h, suffix: V && h && N || h && B && j ? e.jsx(e.Fragment, {}) : e.jsx(r, { isVisible: M }), onClear: () => {
18
- C == null ? void 0 : C(), g == null ? void 0 : g(""), R(""), L(""), S("");
19
- }, onChange: (e2) => S(e2.target.value) }) }) });
20
- }, r = ({ isVisible: o2 }) => e.jsx("svg", { className: ["ono-select-arrow-down-icon", o2 ? "ono-select-arrow-down-active" : ""].filter(Boolean).join(" "), viewBox: "64 64 896 896", focusable: "false", "data-icon": "down", fill: "currentColor", "aria-hidden": "true", children: e.jsx("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }) });
21
- export {
22
- s as O
23
- };
@@ -1,34 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { p as n } from "./common.ts-DQOEx8k3.js";
3
- import { useRef as r, useEffect as c } from "react";
4
- const t = ({ id: t2, text: i, style: s, color: l, checked: o, onChange: a, name: d = "", className: h, disabled: u = false }) => {
5
- const m = r(null), f = r(null), v = r(null), p = r(null), j = r(null), x = r(null), w = [{ value: "string" == typeof l ? l : l == null ? void 0 : l.active, name: "checkedClr" }, { value: "string" == typeof l ? void 0 : l == null ? void 0 : l.inactive, name: "uncheckedClr" }];
6
- return c(() => {
7
- (() => {
8
- if (!f.current || !m.current) return;
9
- let e2 = 60, r2 = 32;
10
- if (h || s) {
11
- const c2 = getComputedStyle(f.current);
12
- e2 = n(c2.width), r2 = n(c2.height);
13
- }
14
- [...w, { value: e2, name: "w" }, { value: r2, name: "h" }].forEach(({ value: e3, name: n2 }) => {
15
- e3 && ((e4, n3, r3) => {
16
- const c2 = "number" == typeof e4;
17
- r3.style.setProperty(`--${n3}`, c2 ? `${e4}px` : e4);
18
- })(e3, n2, m.current);
19
- }), requestAnimationFrame(() => {
20
- p.current && (p.current.style.transition = "transform 0.3s");
21
- });
22
- })();
23
- }, [f, m, p, h, s, l, i, j, x]), c(() => {
24
- v.current && (v.current.checked = o);
25
- }, [v, o]), e.jsxs("div", { ref: m, className: ["ono-switch", u ? "ono-switch-is-disabled" : ""].filter(Boolean).join(" "), children: [e.jsx("input", { id: t2, name: d, role: "switch", ref: v, type: "checkbox", checked: o, onChange: (e2) => {
26
- u || (a == null ? void 0 : a(e2.currentTarget.checked, e2));
27
- } }), e.jsx("div", { ref: f, className: ["ono-switch-box", h || ""].filter(Boolean).join(" "), style: s, onClick: () => {
28
- var _a;
29
- return (_a = v.current) == null ? void 0 : _a.click();
30
- }, children: e.jsxs("div", { ref: p, className: "ono-switch-children-bar", children: [(i == null ? void 0 : i.active) && e.jsx("div", { ref: j, className: "ono-switch-children", children: i == null ? void 0 : i.active }), e.jsx("div", { className: "ono-switch-slider" }), (i == null ? void 0 : i.inactive) && e.jsx("div", { ref: x, className: "ono-switch-children", children: i == null ? void 0 : i.inactive })] }) })] });
31
- };
32
- export {
33
- t as S
34
- };
@@ -1,45 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { g as t } from "./common.ts-DQOEx8k3.js";
3
- import { useState as o, useRef as n, useEffect as r, useCallback as s } from "react";
4
- const i = ({ children: i2, animation: a, className: l, duration: c = 300, style: d, maskColor: m = "rgba(0, 0, 0, 0.5)", disableContextMenu: p, maskClickClose: u = true, dialogClose: y }) => {
5
- const [f, k] = o(false), g = n(null), x = () => {
6
- if (g.current) if (k(true), a) {
7
- const e2 = g.current;
8
- e2.classList.remove(`ono-${a.type}-enter`), e2.classList.add(`ono-${a.type}-leave`), setTimeout(y, c);
9
- } else y();
10
- };
11
- r(() => {
12
- (() => {
13
- if (!a || !g.current) return;
14
- const e2 = g.current.parentElement.style, o2 = g.current.style;
15
- switch (e2.setProperty("--duration", c / 1e3 + "s"), a.type) {
16
- case "zoom": {
17
- const { x: e3, y: n2 } = t(a.element), r2 = (e3 / window.innerWidth * 100).toFixed(2) + "%", s2 = (n2 / window.innerHeight * 100).toFixed(2) + "%";
18
- o2.setProperty("--left", r2), o2.setProperty("--top", s2);
19
- break;
20
- }
21
- case "fade": {
22
- const e3 = "left-center" === a.direction ? "--left" : "--top";
23
- o2.setProperty(e3, a.startPosition);
24
- break;
25
- }
26
- }
27
- })();
28
- }, [g, a]);
29
- const C = s(() => {
30
- if (!a) return "";
31
- const e2 = `ono-${a.type}-enter`, t2 = `ono-${a.type}-leave`;
32
- return f ? t2 : e2;
33
- }, [a, f]);
34
- return e.jsx("div", { className: `
35
- ono-dialog-mask
36
- ono-dialog-mask-${f ? "leave" : "enter"}
37
- `, style: { background: m }, onClick: () => u && x(), onContextMenu: (e2) => p && e2.preventDefault(), children: e.jsx("div", { ref: g, className: `
38
- ono-dialog
39
- ${l || ""}
40
- ${C()}
41
- `, style: d, onClick: (e2) => e2.stopPropagation(), children: "function" == typeof i2 ? i2(x) : i2 }) });
42
- };
43
- export {
44
- i as T
45
- };
@@ -1,29 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { u as r } from "./useClickOutSide.tsx-CMvd2uTW.js";
3
- import { createPopper as t } from "@popperjs/core";
4
- import { useState as n, useRef as o, useEffect as c } from "react";
5
- let s = null, l = null;
6
- const i = ({ children: i2, content: p, onOpenChange: u, trigger: a = "hover", placement: m = "top", popperOptions: d = {}, className: f, style: h, isShowArrow: x = true, sameWidth: w, autoAdjustOverflow: j = true }) => {
7
- const [v, y] = n(false), g = o(null), k = o(null), b = (e2) => {
8
- u == null ? void 0 : u(e2), y(e2);
9
- };
10
- return r(k, () => {
11
- "click" !== a && "contextmenu" !== a || b(false);
12
- }, { event: ["click", "contextmenu"], deps: [a, u] }), c(() => {
13
- (() => {
14
- if (!k.current) return;
15
- const e2 = Array.from(k.current.children);
16
- if (e2.length > 1) throw new Error("Tooltip only support one child");
17
- k.current.style.width = e2[0].getBoundingClientRect().width + "px";
18
- })();
19
- }, [k, i2]), c(() => {
20
- k.current && ("hover" === a ? (k.current.onmouseenter = () => b(true), k.current.onmouseleave = () => b(false)) : "click" === a ? k.current.onclick = () => b(!v) : "focus" === a ? (k.current.onfocus = () => b(true), k.current.onblur = () => b(false)) : k.current.oncontextmenu = () => b(!v)), v && k.current && g.current ? l = t(k.current, g.current, { placement: m, modifiers: [{ name: "offset", options: { offset: [0, 6] } }, w ? { name: "sameWidth", enabled: true, phase: "beforeWrite", requires: ["computeStyles"], fn({ state: e2 }) {
21
- e2.styles.popper.width = `${e2.rects.reference.width}px`;
22
- }, effect({ state: e2 }) {
23
- e2.elements.popper.style.width = `${e2.elements.reference.offsetWidth}px`;
24
- } } : {}, j ? { name: "flip", enabled: true } : {}], ...d }) : l && (l.destroy(), l = null, s && s.remove(), s = null);
25
- }, [v, k, g]), e.jsxs(e.Fragment, { children: [v && e.jsxs("div", { ref: g, style: h, className: ["ono-tooltip-popper", f].join(" "), "data-popper-placement": d.placement || m, children: [e.jsx("div", { children: p instanceof Function ? p() : p }), x && e.jsx("div", { className: "ono-tooltip-popper-arrow", "data-popper-arrow": true })] }), e.jsx("div", { ref: k, children: i2 instanceof Function ? i2() : i2 })] });
26
- };
27
- export {
28
- i as T
29
- };
@@ -1,65 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { u as t } from "./useEventListener.tsx-BBGVcI5T.js";
3
- import { memo as r, useState as n, useMemo as i, useRef as l, useEffect as a } from "react";
4
- const s = r(({ containerClassName: r2, dataSource: s2, containerStyle: d2 = {}, onEndCallback: c, refreshSpeed: o = 50, wrapperClassName: h, wrapperStyle: u = {}, estimatedSize: p = 35, updateDataSourceScroll2Top: f, direction: v = "vertical" }) => {
5
- const [g, x] = n({ viewSize: 0, startIndex: 0, listSize: 0, renderCount: 0, prevLen: 0 }), [S, m] = n([]), z = "number" == typeof p ? p : p(), w = i(() => Math.min(s2.length, g.startIndex + g.renderCount), [s2, g]), I = i(() => {
6
- var _a;
7
- return g.startIndex > 0 ? (_a = S[g.startIndex - 1]) == null ? void 0 : _a.end : 0;
8
- }, [g.startIndex, S]), y = i(() => s2.slice(g.startIndex, w).map(({ id: t2, data: r3 }) => e.jsx("li", { "data-virtual-id": t2, style: "vertical" === v ? { width: "100%" } : { height: "100%" }, children: r3 }, t2)), [w, s2, g.startIndex, v]), C = i(() => ({ display: "flex", listStyle: "none", flexDirection: "vertical" === v ? "column" : "row", height: "vertical" === v ? g.listSize - I + "px" : "100%", width: "vertical" === v ? "auto" : g.listSize - I + "px", transform: "vertical" === v ? `translate3d(0, ${I}px, 0)` : `translate3d(${I}px, 0, 0)` }), [g.listSize, I, v]), j = l(null), L = l(null), N = (e2) => x((t2) => ({ ...t2, ...e2 })), b = /* @__PURE__ */ ((e2, t2 = 300) => {
9
- let r3 = 0;
10
- return () => {
11
- const n2 = Date.now();
12
- n2 - r3 >= t2 && (e2(), r3 = n2);
13
- };
14
- })(() => {
15
- const { scrollTop: e2, clientHeight: t2, scrollHeight: r3, scrollLeft: n2, clientWidth: i2, scrollWidth: l2 } = j.current, a2 = "vertical" === v ? r3 - t2 - e2 : l2 - i2 - n2;
16
- N({ startIndex: E(S, "vertical" === v ? e2 : n2) }), ("vertical" === v ? e2 === z / 2 : n2 === z / 2) && N({ startIndex: 0 }), a2 <= 20 && c && c();
17
- }, o), E = (e2, t2) => {
18
- let r3 = 0, n2 = e2.length - 1, i2 = -1;
19
- for (; r3 <= n2; ) {
20
- const l2 = r3 + Math.floor((n2 - r3) / 2), a2 = e2[l2].end;
21
- if (a2 === t2) return l2 + 1;
22
- a2 < t2 ? r3 = l2 + 1 : ((-1 === i2 || i2 > l2) && (i2 = l2), n2 = l2 - 1);
23
- }
24
- return i2;
25
- };
26
- return t("scroll", b, { target: j.current, deps: [S, v] }), a(() => {
27
- (() => {
28
- if (!j.current) return;
29
- const e2 = ("vertical" === v ? j.current.offsetHeight : j.current.offsetWidth) || 0;
30
- N({ viewSize: e2, renderCount: Math.ceil(e2 / z) + 1 });
31
- })();
32
- }, [j, v]), a(() => {
33
- s2.length && L && (() => {
34
- var _a;
35
- const e2 = [], t2 = s2.length - g.prevLen, r3 = t2 > 0 ? S.length : 0, n2 = r3 > 0 ? S[r3 - 1].end : 0;
36
- for (let r4 = 0; r4 < (t2 > 0 ? t2 : s2.length); r4++) {
37
- const i2 = s2[(t2 > 0 ? g.prevLen : 0) + r4];
38
- e2.push({ index: i2.id, size: z, start: n2 ? n2 + r4 * z : i2.id * z, end: n2 ? n2 + (r4 + 1) * z : (i2.id + 1) * z, dSize: 0 });
39
- }
40
- m((r4) => [...t2 > 0 ? r4 : [], ...e2]), N({ prevLen: s2.length }), f && ((_a = j.current) == null ? void 0 : _a.scrollTo(0, 0));
41
- })();
42
- }, [L, s2, f]), a(() => {
43
- (() => {
44
- if (!L.current || 0 === S.length) return;
45
- const e2 = Array.from(L.current.childNodes);
46
- if (!e2.length) return;
47
- e2.forEach((e3) => {
48
- const t3 = e3.getBoundingClientRect(), r4 = +e3.getAttribute("data-virtual-id"), n3 = S[r4], i2 = n3.size - ("vertical" === v ? t3.height : t3.width);
49
- i2 && (n3.size = "vertical" === v ? t3.height : t3.width, n3.end = n3.end - i2, n3.dSize = i2);
50
- });
51
- const t2 = +e2[0].getAttribute("data-virtual-id"), r3 = S.length;
52
- let n2 = S[t2].dSize;
53
- S[t2].dSize = 0;
54
- for (let e3 = t2 + 1; e3 < r3; e3++) {
55
- const t3 = S[e3];
56
- t3.start = S[e3 - 1].end, t3.end = t3.end - n2, t3.dSize && (n2 += t3.dSize, t3.dSize = 0);
57
- }
58
- N({ listSize: S[r3 - 1].end });
59
- })();
60
- }, [L, S, g.startIndex, v]), e.jsx("div", { ref: j, className: r2, style: { width: "100%", height: "100%", overflow: "auto", ...d2 }, children: e.jsx("ul", { ref: L, className: h, style: { ...C, ...u }, children: y }) });
61
- }), d = (e2, t2) => e2.map((e3, r2) => ({ id: r2, data: t2(e3, r2) }));
62
- export {
63
- s as E,
64
- d as c
65
- };
@@ -1,55 +0,0 @@
1
- import { j as e } from "./dependencies-CbQbPZZ-.js";
2
- import { u as t } from "./useEventListener.tsx-BBGVcI5T.js";
3
- import { useState as a, useRef as i, useCallback as n, useEffect as o } from "react";
4
- const r = ({ options: r2, pageSize: s, children: l, request: d, reloadData: c, className: m, style: g, updateData: p, loading: u = true, bottomThreshold: h = 50 }) => {
5
- const [f, x] = a({ page: 1, reloadData: c, loading: false, isFinish: false, gap: "number" == typeof r2 ? 0 : r2.gap, imageWidth: "number" == typeof r2 ? r2 : 0, columns: "number" == typeof r2 ? 0 : r2.columns, imageList: [] }), [y, w] = a([]), [W, b] = a([]), j = i(null), v = i(null), D = i(null), L = (e2) => x((t2) => ({ ...t2, ...e2 })), N = async (e2, t2) => {
6
- const a2 = c && f.reloadData !== c;
7
- if (f.isFinish) return;
8
- L({ loading: true });
9
- const i2 = await d(e2, t2);
10
- E(i2), L({ isFinish: !i2.length, imageList: a2 ? [...i2] : [...f.imageList, ...i2], page: e2 + 1, loading: false });
11
- }, E = (e2) => x((t2) => {
12
- const a2 = c && f.reloadData !== c, i2 = a2 ? [] : [...W], n2 = a2 ? Array(t2.columns).fill(0) : [..."[]" !== JSON.stringify(y) ? y : Array(t2.columns).fill(0)];
13
- return e2.forEach((e3) => {
14
- const a3 = ((e4) => {
15
- let t3 = 0, a4 = 0;
16
- return t3 = e4.indexOf(Math.min(...e4)), a4 = e4[t3], { index: t3, height: a4 };
17
- })(n2), o2 = Math.floor(e3.height * t2.imageWidth / e3.width);
18
- i2.push({ x: a3.index % t2.columns !== 0 ? a3.index * t2.imageWidth + t2.gap * a3.index : a3.index * t2.imageWidth, y: a3.height }), n2[a3.index] += o2 + t2.gap, w(n2);
19
- }), b(i2), t2;
20
- }), F = n(() => {
21
- if (!D.current) return;
22
- const e2 = D.current.clientWidth;
23
- let t2 = 0, a2 = f.page;
24
- if (c && f.reloadData !== c && (x({ page: 1, reloadData: c, loading: false, isFinish: false, gap: "number" == typeof r2 ? 0 : r2.gap, imageWidth: "number" == typeof r2 ? r2 : 0, columns: "number" == typeof r2 ? 0 : r2.columns, imageList: [] }), w([]), b([]), a2 = 1), "number" == typeof r2) {
25
- const a3 = Math.floor(e2 / f.imageWidth);
26
- t2 = a3 - 1;
27
- const i2 = t2 ? (e2 - a3 * f.imageWidth) / t2 : 0;
28
- L({ columns: a3, gap: i2 });
29
- } else {
30
- t2 = f.columns - 1;
31
- const a3 = (e2 - t2 * f.gap) / f.columns;
32
- L({ imageWidth: a3 });
33
- }
34
- N(a2, s);
35
- }, [f, c]), M = () => {
36
- j.current && clearTimeout(j.current), j.current = setTimeout(F, 50);
37
- }, T = /* @__PURE__ */ ((e2, t2 = 50) => {
38
- let a2 = 0;
39
- return () => {
40
- const i2 = Date.now();
41
- i2 - a2 >= t2 && (e2(), a2 = i2);
42
- };
43
- })(() => {
44
- const { scrollTop: e2, clientHeight: t2, scrollHeight: a2 } = v.current;
45
- a2 - t2 - e2 > h || !f.loading && N(f.page, s);
46
- });
47
- return t("scroll", T, { target: v.current, deps: [f.loading, f.page] }), o(() => (F(), window.addEventListener("resize", M), () => {
48
- window.removeEventListener("resize", M);
49
- }), [D, c]), o(() => {
50
- p && N(f.page, s);
51
- }, [p, f.loading, f.page, v.current]), e.jsxs("div", { className: "ono-waterfall-container", children: [e.jsx("div", { ref: v, className: [m, "ono-waterfall-content"].join(" ").trim(), style: g, children: e.jsx("div", { ref: D, className: "ono-waterfall-wrapper", style: { height: Math.max(...y) - f.gap + "px" }, children: f.imageList.map((t2, a2) => e.jsx("div", { className: "ono-waterfall-item", style: { width: `${f.imageWidth}px`, transform: `translate(${W[a2].x}px,${W[a2].y}px)` }, children: l(t2, a2) }, t2.id)) }) }), f.loading && ("function" == typeof u ? u() : u && "boolean" == typeof u ? e.jsx("div", { className: "ono-waterfall-loading", children: "loading..." }) : u)] });
52
- };
53
- export {
54
- r as W
55
- };
@@ -1,126 +0,0 @@
1
- const t = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])[\da-zA-Z]{8,}$/, e = (t2) => t2 <= 11 ? Math.random().toString(36).substring(2, 2 + t2).padEnd(t2, "0") : e(11) + e(t2 - 11), r = ({ el: t2, str: e2 = "hello world", speed: r2 = 100, isExtendStr: n2 = true, onDone: o2 }) => {
2
- let a2 = 0, s2 = null;
3
- t2.textContent && n2 && (a2 = t2.textContent.length, e2 = t2.textContent + e2);
4
- const i2 = () => {
5
- clearTimeout(s2);
6
- const n3 = e2.substring(0, a2 + 1);
7
- t2.textContent = n3, a2++, a2 !== e2.length ? s2 = setTimeout(i2, r2) : o2 && o2();
8
- };
9
- i2();
10
- }, n = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), o = async (t2, e2) => {
11
- const r2 = (t3, e3) => {
12
- const r3 = window.URL.createObjectURL(t3), n2 = document.createElement("a");
13
- n2.href = r3, n2.download = encodeURIComponent(e3), document.body.appendChild(n2), n2.click(), document.body.removeChild(n2), window.URL.revokeObjectURL(r3);
14
- };
15
- try {
16
- if ("string" == typeof t2) {
17
- const n2 = await fetch(t2);
18
- if (!n2.ok) throw new Error(`Network response was not ok: ${n2.statusText}`);
19
- r2(await n2.blob(), e2);
20
- } else r2(t2, e2);
21
- } catch (t3) {
22
- console.error("文件下载失败:", t3 instanceof Error ? t3.message : String(t3));
23
- }
24
- }, a = (t2, e2) => {
25
- t2.toString().startsWith("2") ? e2.onSuccess && e2.onSuccess() : (t2.toString().startsWith("4") || t2.toString().startsWith("5")) && e2.onFail && e2.onFail();
26
- }, s = (t2) => {
27
- const e2 = t2.getBoundingClientRect();
28
- return { x: e2.left + e2.width / 2, y: e2.top + e2.height / 2 };
29
- }, i = (t2, e2, r2) => {
30
- const n2 = new IntersectionObserver(e2, r2);
31
- t2 instanceof HTMLElement ? n2.observe(t2) : t2.forEach((t3) => n2.observe(t3));
32
- }, c = (t2) => {
33
- const e2 = Math.floor(t2 / 3600), r2 = Math.floor(t2 % 3600 / 60), n2 = Math.floor(t2 % 60), o2 = (t3) => t3.toString().padStart(2, "0");
34
- return (e2 > 0 ? `${o2(e2)}:${o2(r2)}:${o2(n2)}` : `${o2(r2)}:${o2(n2)}`) + (t2 < 10 ? ".00" : t2 < 100 ? ".0" : "");
35
- }, l = (t2) => {
36
- if (t2.length < 2) return t2;
37
- const e2 = t2[0], r2 = t2.slice(1).filter((t3) => t3 <= e2), n2 = t2.slice(1).filter((t3) => t3 > e2);
38
- return [...l(r2), e2, ...l(n2)];
39
- }, d = (t2, e2) => {
40
- const r2 = ["B", "KB", "MB", "GB", "TB"], n2 = 1024;
41
- let o2 = r2.indexOf((e2 == null ? void 0 : e2.unit) ?? "B");
42
- if (-1 === o2) throw new Error("Invalid unit");
43
- if (!(e2 == null ? void 0 : e2.unit)) for (; t2 / Math.pow(n2, o2) >= n2; ) o2++;
44
- return `${(t2 / Math.pow(n2, o2)).toFixed((e2 == null ? void 0 : e2.decimalPlaces) ?? 0)} ${r2[o2]}`;
45
- }, u = (t2, e2) => `${Math.floor(t2 / g(t2, e2))}:${Math.floor(e2 / g(t2, e2))}`, g = (t2, e2) => {
46
- for (; 0 !== e2; ) {
47
- const r2 = e2;
48
- e2 = t2 % e2, t2 = r2;
49
- }
50
- return t2;
51
- }, h = (t2, e2, r2) => {
52
- t2.muted = true, t2.play();
53
- const n2 = new AudioContext(), o2 = "running" === n2.state;
54
- n2.close(), o2 ? (t2.muted = false, e2 == null ? void 0 : e2()) : r2 == null ? void 0 : r2();
55
- }, f = (t2) => new URLSearchParams(window.location.search).get(t2), p = (t2) => {
56
- let e2;
57
- const r2 = new Proxy(t2, { construct: (t3, r3) => (e2 || (e2 = Reflect.construct(t3, r3)), e2) });
58
- return r2.prototype.construct = r2, r2;
59
- }, m = (t2) => "string" != typeof t2 || 0 === t2.length ? "" : t2.charAt(0).toUpperCase() + t2.slice(1), w = (t2) => {
60
- if ("object" != typeof t2 || null === t2) return t2;
61
- const e2 = Array.isArray(t2) ? [] : {};
62
- for (const r2 in t2) Object.prototype.hasOwnProperty.call(t2, r2) && (e2[r2] = w(t2[r2]));
63
- return e2;
64
- }, b = (t2) => new Promise((e2) => {
65
- const r2 = new Image();
66
- r2.src = "string" == typeof t2 ? t2 : URL.createObjectURL(t2), r2.onload = () => e2({ width: r2.width, height: r2.height });
67
- }), y = (t2, e2) => {
68
- let r2 = 0;
69
- const n2 = (o2) => {
70
- r2 || (r2 = o2), o2 - r2 >= e2 ? t2() : requestAnimationFrame(n2);
71
- };
72
- requestAnimationFrame(n2);
73
- }, S = (t2, e2, r2) => {
74
- const n2 = t2[e2];
75
- t2[e2] = function(t3) {
76
- n2 && "function" == typeof n2 && n2.call(this, t3), r2.call(this, t3);
77
- };
78
- }, x = (t2) => {
79
- if ("number" != typeof t2 || isNaN(t2)) throw new Error("请输入有效的数字");
80
- const e2 = t2.toString().split(".");
81
- return e2[0] = e2[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), e2.join(".");
82
- }, C = (t2) => parseFloat(t2.replace(/[^0-9.]/g, "")), O = (t2, e2, r2, n2) => Math.sqrt((t2 - r2) ** 2 + (e2 - n2) ** 2), M = (t2) => navigator.clipboard.writeText(t2), E = (t2) => Math.ceil((t2.getTime() - new Date(t2.getFullYear(), 0, 1).getTime()) / 864e5), A = (t2, e2, r2) => 0.2126 * t2 + 0.7152 * e2 + 0.0722 * r2, v = (t2) => {
83
- const e2 = {};
84
- return t2.replace(/([^?=&]+)=([^&]+)/g, (t3, r2, n2) => e2[r2] = n2), e2;
85
- }, I = (t2, ...e2) => Object.fromEntries(Object.entries(t2).filter(([t3]) => e2.includes(t3))), P = (t2) => {
86
- if (!t2) return "";
87
- const e2 = t2.lastIndexOf(".");
88
- return -1 === e2 ? P(t2.substring(t2.lastIndexOf("/") + 1)) : t2.substring(0, e2);
89
- }, R = (t2) => {
90
- if (!t2) return "";
91
- const e2 = t2.lastIndexOf(".");
92
- return t2.substring(e2 + 1);
93
- }, $ = { addCommasToNumber: x, addEventWithOriginHandler: S, calculateAspectRatio: u, checkDeviceIsMobile: n, checkStatusCode: a, copy2Clipboard: M, createIntersectionObserver: i, dayOfYear: E, deepCopy: w, downloadFile: o, formatFileSize: d, formatSecondes: c, getElementCenterPosition: s, getFileName: P, getFileSuffix: R, getImageSIze: b, getPointDistance: O, getURLSearchParams: f, grayColor: A, mediaAutoplayPolicies: h, parseQuery: v, passwordStrength: t, pick: I, printStr: r, pureNumber: C, quickSort: l, rafTimeout: y, randomString: e, safeCapitalizeWord: m, singleton: p };
94
- export {
95
- l as A,
96
- y as B,
97
- e as C,
98
- m as D,
99
- p as E,
100
- x as a,
101
- S as b,
102
- u as c,
103
- n as d,
104
- a as e,
105
- $ as f,
106
- s as g,
107
- M as h,
108
- i,
109
- E as j,
110
- w as k,
111
- o as l,
112
- d as m,
113
- c as n,
114
- P as o,
115
- C as p,
116
- R as q,
117
- b as r,
118
- O as s,
119
- f as t,
120
- A as u,
121
- h as v,
122
- v as w,
123
- t as x,
124
- I as y,
125
- r as z
126
- };