ono-react-element 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/AutoSliderList-eb1CVc8b.js +30 -1
- package/dist/es/AvatarCrop-DrA-SARP.js +65 -1
- package/dist/es/Button-BsWI818a.js +29 -1
- package/dist/es/Card3D-DMvCSUhe.js +18 -1
- package/dist/es/Checkbox-daBabj14.js +19 -1
- package/dist/es/InjunctiveBox-DUNoNHCO.js +11 -1
- package/dist/es/Input-DLOeg2pz.js +80 -1
- package/dist/es/List-UAKCMuGC.js +19 -1
- package/dist/es/MenuButton-DHkU5Bq7.js +17 -1
- package/dist/es/Message-BGDILiLc.js +105 -1
- package/dist/es/Modal-BsI-8rap.js +37 -1
- package/dist/es/Pagination-m71H2tfS.js +17 -1
- package/dist/es/PortalRenderer-CDAzQJgm.js +19 -1
- package/dist/es/Radio-D_GKVoOC.js +25 -1
- package/dist/es/ScrollableTabs--449B73p.js +34 -1
- package/dist/es/Select-B11NvK-I.js +34 -1
- package/dist/es/SvgImg-CZwq2D7J.js +14 -1
- package/dist/es/Switch-BBHMaxoZ.js +34 -1
- package/dist/es/TemplateDialog-PQxjmAJa.js +45 -1
- package/dist/es/Toast-CQEsbqUJ.js +42 -1
- package/dist/es/Tooltip-CgttMIcX.js +29 -1
- package/dist/es/VirtualList-CdhqyHFQ.js +60 -1
- package/dist/es/Waterfall-CY3QkL5m.js +50 -1
- package/dist/es/colorUtils.ts-DYuRvCXZ.js +145 -1
- package/dist/es/common.ts-vX9A6Rye.js +154 -1
- package/dist/es/dependencies-CbQbPZZ-.js +15524 -1
- package/dist/es/event-CtX9rswE.js +28 -1
- package/dist/es/fileFormatConversion.ts-tUlewYon.js +38 -1
- package/dist/es/formatTimeUtils.ts-CkdWJ_Sl.js +32 -1
- package/dist/es/index.js +123 -1
- package/dist/es/useClickOutSide.tsx-CMvd2uTW.js +15 -1
- package/dist/es/useCountdown.tsx-Btzj-keH.js +16 -1
- package/dist/es/useEventListener.tsx-BBGVcI5T.js +12 -1
- package/dist/es/useGetElementSize.tsx-Dtshth0Y.js +22 -1
- package/dist/es/useKeyPress.tsx-Db44HXXz.js +18 -1
- package/dist/es/useMouseClick.tsx-C7uAH4n4.js +12 -1
- package/dist/es/useTheme.tsx-C5b7BRYz.js +24 -1
- package/dist/es/useThemePro.tsx-DQuSI8J7.js +20 -1
- package/dist/es/viewTransitionUtils.ts-CHa9uBpi.js +19 -1
- package/package.json +1 -1
|
@@ -1 +1,28 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty;
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
class e {
|
|
5
|
+
constructor(e2) {
|
|
6
|
+
__publicField(this, "events", {});
|
|
7
|
+
e2.forEach((e3) => {
|
|
8
|
+
this.events[e3] = /* @__PURE__ */ new Set();
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
emit(e2, ...t2) {
|
|
12
|
+
if (!this.events[e2]) throw new Error(`Event ${e2} does not exist`);
|
|
13
|
+
this.events[e2].forEach((e3) => {
|
|
14
|
+
e3(...t2);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
on(e2, t2) {
|
|
18
|
+
this.events[e2] || (this.events[e2] = /* @__PURE__ */ new Set()), this.events[e2].add(t2);
|
|
19
|
+
}
|
|
20
|
+
cancel(e2, t2) {
|
|
21
|
+
this.events[e2] && this.events[e2].delete(t2);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let t = null;
|
|
25
|
+
const s = (s2) => (t || (t = new e(s2)), t);
|
|
26
|
+
export {
|
|
27
|
+
s as c
|
|
28
|
+
};
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
const t
|
|
1
|
+
const t = (t2) => {
|
|
2
|
+
const e2 = t2.split(","), a2 = e2[0].match(/:(.*?);/)[1], s2 = atob(e2[1]);
|
|
3
|
+
let n2 = s2.length;
|
|
4
|
+
const o2 = new Uint8Array(n2);
|
|
5
|
+
for (; n2--; ) o2[n2] = s2.charCodeAt(n2);
|
|
6
|
+
return new Blob([o2], { type: a2 });
|
|
7
|
+
}, e = (t2, e2) => {
|
|
8
|
+
const a2 = t2.split(","), s2 = a2[0].match(/:(.*?);/u)[1], n2 = atob(a2[1]);
|
|
9
|
+
let o2 = n2.length, i2 = "jpeg" === s2.split("/")[1] ? ".jpg" : "." + s2.split("/")[1];
|
|
10
|
+
const r2 = new Uint8Array(o2);
|
|
11
|
+
for (; o2--; ) r2[o2] = n2.charCodeAt(o2);
|
|
12
|
+
const l2 = new Blob([r2], { type: s2 });
|
|
13
|
+
return new File([l2], e2 + i2, { type: s2, lastModified: (/* @__PURE__ */ new Date()).getTime() });
|
|
14
|
+
}, a = (t2) => new Promise((e2) => {
|
|
15
|
+
const a2 = new FileReader();
|
|
16
|
+
a2.readAsDataURL(t2), a2.onload = (t3) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const a3 = (_a = t3.target) == null ? void 0 : _a.result, s2 = a3.split(",")[1];
|
|
19
|
+
e2(s2);
|
|
20
|
+
};
|
|
21
|
+
}), s = (t2, e2 = "abc.jpg") => new File([t2], e2, { type: t2.type }), n = (t2) => new Promise((e2) => {
|
|
22
|
+
const a2 = new FileReader();
|
|
23
|
+
a2.readAsDataURL(t2), a2.onload = (t3) => {
|
|
24
|
+
var _a;
|
|
25
|
+
return e2((_a = t3.target) == null ? void 0 : _a.result);
|
|
26
|
+
};
|
|
27
|
+
}), o = (t2) => t2.slice(0, t2.size, t2.type), i = async (t2) => await (await fetch(t2)).blob(), r = async (t2) => s(await i(t2)), l = async (t2) => await a(await i(t2));
|
|
28
|
+
export {
|
|
29
|
+
e as a,
|
|
30
|
+
t as b,
|
|
31
|
+
a as c,
|
|
32
|
+
s as d,
|
|
33
|
+
o as e,
|
|
34
|
+
n as f,
|
|
35
|
+
i as g,
|
|
36
|
+
r as h,
|
|
37
|
+
l as u
|
|
38
|
+
};
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
const t=(t2)=>t2<10 ? `0${t2}
|
|
1
|
+
const t = (t2) => t2 < 10 ? `0${t2}` : `${t2}`, e = (t2) => t2.toString().length > 13 ? new Date(Number(t2.toString().substring(0, 13))) : 13 === t2.toString().length ? new Date(t2) : t2.toString().length < 13 && t2.toString().length > 10 ? new Date(Number((t2.toString() + "000").substring(0, 13))) : 10 === t2.toString().length ? new Date(1e3 * t2) : new Date(Number((t2.toString() + "000000000000").substring(0, 13))), n = (n2, r2 = "YY-MM-DD hh:mm:ss") => {
|
|
2
|
+
const s2 = ["YY", "MM", "DD", "hh", "mm", "ss"], u2 = [], o = e(n2);
|
|
3
|
+
u2.push(o.getFullYear().toString()), u2.push(t(o.getMonth() + 1)), u2.push(t(o.getDate())), u2.push(t(o.getHours())), u2.push(t(o.getMinutes())), u2.push(t(o.getSeconds()));
|
|
4
|
+
for (let t2 in u2) r2 = r2.replace(s2[t2], u2[t2]);
|
|
5
|
+
return r2;
|
|
6
|
+
}, r = (n2, r2 = "YY-MM-DD hh:mm:ss", s2 = "cn") => {
|
|
7
|
+
const u2 = ["YY", "MM", "DD", "hh", "mm", "ss"], o = [], h = e(n2);
|
|
8
|
+
o.push(((t2, e2) => {
|
|
9
|
+
const n3 = { en: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], cn: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"] };
|
|
10
|
+
return t2.split("").map((t3) => n3[e2][Number(t3)]).join("");
|
|
11
|
+
})(h.getFullYear().toString(), s2)), o.push(((t2, e2) => ({ en: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"], cn: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] })[e2][Number(t2) - 1])(t(h.getMonth() + 1), s2)), o.push(((t2, e2) => {
|
|
12
|
+
let n3;
|
|
13
|
+
return "en" === e2 ? n3 = "01" === t2 || "21" === t2 || "31" === t2 ? Number(t2) + "st" : "02" === t2 || "22" === t2 ? Number(t2) + "nd" : "03" === t2 || "23" === t2 ? Number(t2) + "rd" : Number(t2) + "th" : "01" === t2 ? n3 = "一日" : "02" === t2 ? n3 = "二日" : "03" === t2 ? n3 = "三日" : "04" === t2 ? n3 = "四日" : "05" === t2 ? n3 = "五日" : "06" === t2 ? n3 = "六日" : "07" === t2 ? n3 = "七日" : "08" === t2 ? n3 = "八日" : "09" === t2 ? n3 = "九日" : "10" === t2 ? n3 = "十日" : "11" === t2 ? n3 = "十一日" : "12" === t2 ? n3 = "十二日" : "13" === t2 ? n3 = "十三日" : "14" === t2 ? n3 = "十四日" : "15" === t2 ? n3 = "十五日" : "16" === t2 ? n3 = "十六日" : "17" === t2 ? n3 = "十七日" : "18" === t2 ? n3 = "十八日" : "19" === t2 ? n3 = "十九日" : "20" === t2 ? n3 = "二十日" : "21" === t2 ? n3 = "二十一日" : "22" === t2 ? n3 = "二十二日" : "23" === t2 ? n3 = "二十三日" : "24" === t2 ? n3 = "二十四日" : "25" === t2 ? n3 = "二十五日" : "26" === t2 ? n3 = "二十六日" : "27" === t2 ? n3 = "二十七日" : "28" === t2 ? n3 = "二十八日" : "29" === t2 ? n3 = "二十九日" : "30" === t2 ? n3 = "三十日" : "31" === t2 && (n3 = "三十一日"), n3 ?? t2;
|
|
14
|
+
})(t(h.getDate()), s2)), o.push(t(h.getHours())), o.push(t(h.getMinutes())), o.push(t(h.getSeconds()));
|
|
15
|
+
for (let t2 in o) r2 = r2.replace(u2[t2], o[t2]);
|
|
16
|
+
return r2;
|
|
17
|
+
}, s = (e2, n2) => {
|
|
18
|
+
const r2 = ["DD", "hh", "mm", "ss"], s2 = [];
|
|
19
|
+
s2.push(Math.floor(e2 / 86400)), s2.push(t(Math.floor(e2 % 86400 / 3600))), s2.push(t(Math.floor(e2 % 3600 / 60))), s2.push(t(e2 % 60));
|
|
20
|
+
for (let t2 = 0; t2 < r2.length; t2++) n2 = n2.replace(r2[t2], s2[t2].toString());
|
|
21
|
+
return n2;
|
|
22
|
+
}, u = (t2, e2) => {
|
|
23
|
+
const n2 = { year: 31536e3, month: 2592e3, day: 86400, hour: 3600, minute: 60, second: 1 };
|
|
24
|
+
if (!n2[e2]) throw new Error('Invalid type. Please use "day", "hour", "minute", or "second".');
|
|
25
|
+
return Math.floor(t2 / n2[e2]);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
u as c,
|
|
29
|
+
n as f,
|
|
30
|
+
r as l,
|
|
31
|
+
s
|
|
32
|
+
};
|
package/dist/es/index.js
CHANGED
|
@@ -1 +1,123 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { u } from "./useClickOutSide.tsx-CMvd2uTW.js";
|
|
2
|
+
import { u as u2 } from "./useCountdown.tsx-Btzj-keH.js";
|
|
3
|
+
import { u as u3 } from "./useEventListener.tsx-BBGVcI5T.js";
|
|
4
|
+
import { u as u4 } from "./useGetElementSize.tsx-Dtshth0Y.js";
|
|
5
|
+
import { u as u5 } from "./useKeyPress.tsx-Db44HXXz.js";
|
|
6
|
+
import { u as u6 } from "./useMouseClick.tsx-C7uAH4n4.js";
|
|
7
|
+
import { u as u7 } from "./useTheme.tsx-C5b7BRYz.js";
|
|
8
|
+
import { u as u8 } from "./useThemePro.tsx-DQuSI8J7.js";
|
|
9
|
+
import { a, c } from "./colorUtils.ts-DYuRvCXZ.js";
|
|
10
|
+
import { a as a2, b, c as c2, d, e, f, h, i, j, k, l, m, n, o, g, q, r, s, u as u9, v, w, x, y, z, A, B, p, C, D, E, F, G, t } from "./common.ts-vX9A6Rye.js";
|
|
11
|
+
import { b as b2, a as a3, c as c3, d as d2, f as f2, e as e2, u as u10, g as g2, h as h2 } from "./fileFormatConversion.ts-tUlewYon.js";
|
|
12
|
+
import { c as c4, f as f3, l as l2, s as s2 } from "./formatTimeUtils.ts-CkdWJ_Sl.js";
|
|
13
|
+
import { c as c5 } from "./event-CtX9rswE.js";
|
|
14
|
+
import { A as A2, D as D2 } from "./AutoSliderList-eb1CVc8b.js";
|
|
15
|
+
import { A as A3 } from "./AvatarCrop-DrA-SARP.js";
|
|
16
|
+
import { A as A4, L } from "./List-UAKCMuGC.js";
|
|
17
|
+
import { B as B2 } from "./Button-BsWI818a.js";
|
|
18
|
+
import { C as C2 } from "./Card3D-DMvCSUhe.js";
|
|
19
|
+
import { C as C3 } from "./Checkbox-daBabj14.js";
|
|
20
|
+
import { E as E2, c as c6 } from "./VirtualList-CdhqyHFQ.js";
|
|
21
|
+
import { i as i2 } from "./InjunctiveBox-DUNoNHCO.js";
|
|
22
|
+
import { M } from "./MenuButton-DHkU5Bq7.js";
|
|
23
|
+
import { m as m2 } from "./Message-BGDILiLc.js";
|
|
24
|
+
import { M as M2 } from "./Modal-BsI-8rap.js";
|
|
25
|
+
import { O, a as a4 } from "./Input-DLOeg2pz.js";
|
|
26
|
+
import { O as O2 } from "./Select-B11NvK-I.js";
|
|
27
|
+
import { P } from "./Pagination-m71H2tfS.js";
|
|
28
|
+
import { p as p2 } from "./PortalRenderer-CDAzQJgm.js";
|
|
29
|
+
import { R, a as a5 } from "./Radio-D_GKVoOC.js";
|
|
30
|
+
import { S } from "./ScrollableTabs--449B73p.js";
|
|
31
|
+
import { S as S2 } from "./SvgImg-CZwq2D7J.js";
|
|
32
|
+
import { S as S3 } from "./Switch-BBHMaxoZ.js";
|
|
33
|
+
import { T } from "./TemplateDialog-PQxjmAJa.js";
|
|
34
|
+
import { t as t2 } from "./Toast-CQEsbqUJ.js";
|
|
35
|
+
import { T as T2 } from "./Tooltip-CgttMIcX.js";
|
|
36
|
+
import { W } from "./Waterfall-CY3QkL5m.js";
|
|
37
|
+
export {
|
|
38
|
+
A2 as AutoSliderList,
|
|
39
|
+
A3 as AvatarCrop,
|
|
40
|
+
A4 as AwaitList,
|
|
41
|
+
B2 as Button,
|
|
42
|
+
C2 as Card3D,
|
|
43
|
+
C3 as Checkbox,
|
|
44
|
+
D2 as Direction,
|
|
45
|
+
E2 as EstimatedVirtualList,
|
|
46
|
+
L as List,
|
|
47
|
+
M as MenuButton,
|
|
48
|
+
M2 as Modal,
|
|
49
|
+
O as OnoInput,
|
|
50
|
+
O2 as OnoSelect,
|
|
51
|
+
a4 as OnoTextarea,
|
|
52
|
+
P as Pagination,
|
|
53
|
+
R as Radio,
|
|
54
|
+
a5 as RadioGroup,
|
|
55
|
+
S as ScrollableTabs,
|
|
56
|
+
S2 as SvgImg,
|
|
57
|
+
S3 as Switch,
|
|
58
|
+
T as TemplateDialog,
|
|
59
|
+
T2 as Tooltip,
|
|
60
|
+
W as Waterfall,
|
|
61
|
+
a2 as addCommasToNumber,
|
|
62
|
+
b as addEventWithOriginHandler,
|
|
63
|
+
a as adjustingColors,
|
|
64
|
+
b2 as base64ToBlob,
|
|
65
|
+
a3 as base64ToFile,
|
|
66
|
+
c3 as blobToBase64,
|
|
67
|
+
d2 as blobToFile,
|
|
68
|
+
c2 as calculateAspectRatio,
|
|
69
|
+
d as checkDeviceIsMobile,
|
|
70
|
+
e as checkStatusCode,
|
|
71
|
+
c as colorUtils,
|
|
72
|
+
f as common,
|
|
73
|
+
c4 as convertSecondToOtherTime,
|
|
74
|
+
h as copy2Clipboard,
|
|
75
|
+
c6 as createDataSource,
|
|
76
|
+
c5 as createEventEmitter,
|
|
77
|
+
i as createIntersectionObserver,
|
|
78
|
+
j as dayOfYear,
|
|
79
|
+
k as debounce,
|
|
80
|
+
l as deepCopy,
|
|
81
|
+
m as downloadFile,
|
|
82
|
+
f2 as fileToBase64,
|
|
83
|
+
e2 as fileToBlob,
|
|
84
|
+
n as formatFileSize,
|
|
85
|
+
o as formatSecondes,
|
|
86
|
+
f3 as formatTime,
|
|
87
|
+
g as getElementCenterPosition,
|
|
88
|
+
q as getFileName,
|
|
89
|
+
r as getFileSuffix,
|
|
90
|
+
s as getImageSIze,
|
|
91
|
+
u9 as getPointDistance,
|
|
92
|
+
v as getURLSearchParams,
|
|
93
|
+
w as grayColor,
|
|
94
|
+
i2 as injunctiveBox,
|
|
95
|
+
l2 as localFormat,
|
|
96
|
+
x as mediaAutoplayPolicies,
|
|
97
|
+
m2 as message,
|
|
98
|
+
y as parseQuery,
|
|
99
|
+
z as passwordStrength,
|
|
100
|
+
A as pick,
|
|
101
|
+
p2 as portalRenderer,
|
|
102
|
+
B as printStr,
|
|
103
|
+
p as pureNumber,
|
|
104
|
+
C as quickSort,
|
|
105
|
+
D as rafTimeout,
|
|
106
|
+
E as randomString,
|
|
107
|
+
F as safeCapitalizeWord,
|
|
108
|
+
s2 as second2Day,
|
|
109
|
+
G as singleton,
|
|
110
|
+
t as throttle,
|
|
111
|
+
t2 as toast,
|
|
112
|
+
u10 as urlToBase64,
|
|
113
|
+
g2 as urlToBlob,
|
|
114
|
+
h2 as urlToFile,
|
|
115
|
+
u as useClickOutSide,
|
|
116
|
+
u2 as useCountdown,
|
|
117
|
+
u3 as useEventListener,
|
|
118
|
+
u4 as useGetElementSize,
|
|
119
|
+
u5 as useKeyPress,
|
|
120
|
+
u6 as useMouseClick,
|
|
121
|
+
u7 as useTheme,
|
|
122
|
+
u8 as useThemePro
|
|
123
|
+
};
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import{u as e}from "./useEventListener.tsx-BBGVcI5T.js";
|
|
1
|
+
import { u as e } from "./useEventListener.tsx-BBGVcI5T.js";
|
|
2
|
+
const t = (t2, n, r) => e(((e2) => {
|
|
3
|
+
const t3 = "string" == typeof e2 ? [e2] : e2;
|
|
4
|
+
if (new Set(t3).size !== t3.length) throw new Error("there are duplicates in the event type");
|
|
5
|
+
return t3;
|
|
6
|
+
})((r == null ? void 0 : r.event) || "click"), (e2) => {
|
|
7
|
+
if (t2) if (t2 instanceof Array) t2.map((e3) => e3 instanceof HTMLElement ? e3 : e3.current).some((t3) => !!t3 && t3.contains(e2.target)) || n(e2);
|
|
8
|
+
else {
|
|
9
|
+
const r2 = t2 instanceof HTMLElement ? t2 : t2.current;
|
|
10
|
+
r2 && !r2.contains(e2.target) && n(e2);
|
|
11
|
+
}
|
|
12
|
+
}, { deps: [t2, ...(r == null ? void 0 : r.deps) || []] });
|
|
13
|
+
export {
|
|
14
|
+
t as u
|
|
15
|
+
};
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import{useState as r,useRef as e,useCallback as t,useEffect as u}from "react";
|
|
1
|
+
import { useState as r, useRef as e, useCallback as t, useEffect as u } from "react";
|
|
2
|
+
const n = (n2 = 60, c) => {
|
|
3
|
+
const [l, o] = r(n2), [i, m] = r(false), a = e(null), s = t(() => m(true), []), T = t(() => {
|
|
4
|
+
m(false), o(n2), a.current && (clearTimeout(a.current), a.current = null), c == null ? void 0 : c();
|
|
5
|
+
}, [n2, c]);
|
|
6
|
+
return u(() => {
|
|
7
|
+
if (i) return l > 0 ? a.current = setTimeout(() => {
|
|
8
|
+
o((r2) => r2 - 1);
|
|
9
|
+
}, 1e3) : T(), () => {
|
|
10
|
+
a.current && (clearTimeout(a.current), a.current = null);
|
|
11
|
+
};
|
|
12
|
+
}, [i, l, T]), [l, s, T];
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
n as u
|
|
16
|
+
};
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{useEffect as e}from "react";
|
|
1
|
+
import { useEffect as e } from "react";
|
|
2
|
+
const t = (t2, n, r) => {
|
|
3
|
+
const { target: o, deps: i, isDeferred: d } = r || {}, s = (e2) => n(e2);
|
|
4
|
+
return e(() => ("string" == typeof t2 ? !d && (o || window).addEventListener(t2, s) : t2.forEach((e2) => !d && (o || window).addEventListener(e2, s)), () => {
|
|
5
|
+
"string" == typeof t2 ? (o || window).removeEventListener(t2, s) : t2.forEach((e2) => (o || window).removeEventListener(e2, s));
|
|
6
|
+
}), [o, ...i || []]), d ? () => {
|
|
7
|
+
"string" == typeof t2 ? (o || window).addEventListener(t2, s) : t2.forEach((e2) => (o || window).addEventListener(e2, s));
|
|
8
|
+
} : void 0;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
t as u
|
|
12
|
+
};
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
import{useState as e,useEffect as n}from "react";
|
|
1
|
+
import { useState as e, useEffect as n } from "react";
|
|
2
|
+
const o = (o2) => {
|
|
3
|
+
const [t, i] = e({ w: 0, h: 0 }), r = new ResizeObserver((e2) => {
|
|
4
|
+
for (const n2 of e2) i({ w: n2.borderBoxSize[0].inlineSize, h: n2.borderBoxSize[0].blockSize });
|
|
5
|
+
}), s = () => {
|
|
6
|
+
if (o2 && "function" != typeof o2) r.observe(o2 instanceof HTMLElement ? o2 : o2.current);
|
|
7
|
+
else if (o2 && "function" == typeof o2) {
|
|
8
|
+
const e2 = o2();
|
|
9
|
+
r.observe(e2 instanceof HTMLElement ? e2 : e2.current);
|
|
10
|
+
} else i({ w: window.innerWidth, h: window.innerHeight });
|
|
11
|
+
};
|
|
12
|
+
return n(() => (s(), window.addEventListener("resize", s), () => {
|
|
13
|
+
if (window.removeEventListener("resize", s), o2 && "function" != typeof o2) r.unobserve(o2 instanceof HTMLElement ? o2 : o2.current);
|
|
14
|
+
else if (o2 && "function" == typeof o2) {
|
|
15
|
+
const e2 = o2();
|
|
16
|
+
r.unobserve(e2 instanceof HTMLElement ? e2 : e2.current);
|
|
17
|
+
}
|
|
18
|
+
}), [o2]), t;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
o as u
|
|
22
|
+
};
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
import{u as e}from "./useEventListener.tsx-BBGVcI5T.js";
|
|
1
|
+
import { u as e } from "./useEventListener.tsx-BBGVcI5T.js";
|
|
2
|
+
const t = (e2) => e2.toString().toLocaleLowerCase(), s = (s2, n, a) => {
|
|
3
|
+
const l = (l2) => e(l2, (e2) => ((e3, s3, a2) => {
|
|
4
|
+
e3.forEach((e4) => {
|
|
5
|
+
if (e4.includes("+") && e4.length > 1) {
|
|
6
|
+
const t2 = e4.split("+"), a3 = s3.ctrlKey && t2.includes("ctrl"), l3 = s3.shiftKey && t2.includes("shift"), c = s3.altKey && t2.includes("alt"), o = s3.metaKey && t2.includes("meta"), r = (s3.ctrlKey || s3.metaKey) && t2.includes("commandorcontrol");
|
|
7
|
+
2 === t2.length ? (a3 || l3 || c || o || r) && s3.key.toLocaleLowerCase() === t2[t2.length - 1] && n(s3, e4) : 3 === t2.length && (a3 && l3 || a3 && c || a3 && o || a3 && r || l3 && c || l3 && o || l3 && r || c && o || c && r || o && r) && s3.key.toLocaleLowerCase() === t2[t2.length - 1] && n(s3, e4);
|
|
8
|
+
} else if (e4.includes(t(s3.key))) {
|
|
9
|
+
if (a2) e4 === t(s3.key) && n(s3, e4);
|
|
10
|
+
else if (!(s3.ctrlKey || s3.metaKey || s3.shiftKey || s3.altKey)) return n(s3, e4);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
})(s2 instanceof Array ? s2.map((e3) => t(e3)) : [t(s2)], e2, (a == null ? void 0 : a.exactMatch) || false), { deps: [a == null ? void 0 : a.target, ...(a == null ? void 0 : a.deps) || []] });
|
|
14
|
+
(a == null ? void 0 : a.events) instanceof Array ? a.events.forEach((e2) => l(e2)) : l((a == null ? void 0 : a.events) || "keydown");
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
s as u
|
|
18
|
+
};
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{useState as e}from "react";
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import { u as c } from "./useEventListener.tsx-BBGVcI5T.js";
|
|
3
|
+
const n = () => {
|
|
4
|
+
const [n2, t] = e({ clientX: 0, clientY: 0, screenX: 0, screenY: 0, pageX: 0, pageY: 0 });
|
|
5
|
+
return c("click", (e2) => {
|
|
6
|
+
const c2 = e2.clientX, n3 = e2.clientY, r = e2.screenX, s = e2.screenY, a = e2.pageX, i = e2.pageY;
|
|
7
|
+
t({ clientX: c2, clientY: n3, screenX: r, screenY: s, pageX: a, pageY: i });
|
|
8
|
+
}), n2;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
n as u
|
|
12
|
+
};
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
import{useEffect as e}from "react";
|
|
1
|
+
import { useEffect as e } from "react";
|
|
2
|
+
let t = false;
|
|
3
|
+
const a = ({ theme: a2, onDark: r, onLight: c }) => {
|
|
4
|
+
const n = window.matchMedia("(prefers-color-scheme: dark)"), o = () => {
|
|
5
|
+
n.matches ? r() : c();
|
|
6
|
+
};
|
|
7
|
+
e(() => {
|
|
8
|
+
(() => {
|
|
9
|
+
switch (t && (t = false, n.removeEventListener("change", o)), a2) {
|
|
10
|
+
case "light":
|
|
11
|
+
c();
|
|
12
|
+
break;
|
|
13
|
+
case "dark":
|
|
14
|
+
r();
|
|
15
|
+
break;
|
|
16
|
+
default:
|
|
17
|
+
o(), t = true, n.addEventListener("change", o);
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
}, [a2]);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
a as u
|
|
24
|
+
};
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
import{v as e}from "./viewTransitionUtils.ts-CHa9uBpi.js";
|
|
1
|
+
import { v as e } from "./viewTransitionUtils.ts-CHa9uBpi.js";
|
|
2
|
+
import { useState as t, useRef as n } from "react";
|
|
3
|
+
import { u as r } from "./useTheme.tsx-C5b7BRYz.js";
|
|
4
|
+
const m = (m2) => {
|
|
5
|
+
const { initTheme: a = "light", themeRules: s = (e2) => {
|
|
6
|
+
e2 ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
7
|
+
} } = m2 || Object.assign({}), [o, i] = t(a), c = n(null);
|
|
8
|
+
return r({ theme: o, onDark: () => {
|
|
9
|
+
c.current ? e.changeThemeClipPathCircle({ element: c.current, onChangeTheme: () => s(true) }) : s(true);
|
|
10
|
+
}, onLight: () => {
|
|
11
|
+
c.current ? e.changeThemeClipPathCircle({ element: c.current, onChangeTheme: () => s(false) }) : s(false);
|
|
12
|
+
} }), [o, ({ targetTheme: e2, element: t2, onChange: n2 }) => {
|
|
13
|
+
c.current = t2 || null, requestAnimationFrame(() => {
|
|
14
|
+
n2 == null ? void 0 : n2(), i(e2);
|
|
15
|
+
});
|
|
16
|
+
}];
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
m as u
|
|
20
|
+
};
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
const t
|
|
1
|
+
const t = { changeThemeClipPathCircle: (t2) => {
|
|
2
|
+
const e = "ono-view-transition-clip-path-circle", { element: n, duration: i = 300, themeRules: o, onChangeTheme: a } = t2, r = (o == null ? void 0 : o()) || document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
3
|
+
if (!document.startViewTransition) return a("dark" === r ? "light" : "dark");
|
|
4
|
+
const d = document.startViewTransition(() => {
|
|
5
|
+
const t3 = document.documentElement.classList.contains("dark");
|
|
6
|
+
a(t3 ? "light" : "dark");
|
|
7
|
+
}), { top: s, left: c, width: l, height: h } = n.getBoundingClientRect(), m = c + l / 2, u = s + h / 2, w = [`circle(0% at ${m}px ${u}px)`, `circle(${Math.hypot(Math.max(m, window.innerWidth - m), Math.max(u, window.innerHeight - u))}px at ${m}px ${u}px)`];
|
|
8
|
+
((t3, e2) => {
|
|
9
|
+
const n2 = document.createElement("style");
|
|
10
|
+
n2.setAttribute("type", "text/css"), n2.setAttribute("data-style-tag", e2), n2.textContent = "\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n }\n .dark::view-transition-old(root) {\n z-index: 1;\n }\n\n .dark::view-transition-new(root) {\n z-index: 999;\n }\n\n ::view-transition-old(root) {\n z-index: 999;\n }\n\n ::view-transition-new(root) {\n z-index: 1;\n }\n ", document.head.appendChild(n2);
|
|
11
|
+
})(0, e), d.ready.then(() => {
|
|
12
|
+
document.documentElement.animate({ clipPath: "light" === r ? w : w.reverse() }, { duration: i, easing: "ease-in-out", pseudoElement: "light" === r ? "::view-transition-new(root)" : "::view-transition-old(root)" }), setTimeout(() => ((t3) => {
|
|
13
|
+
document.head.querySelectorAll("style").forEach((e2) => e2.getAttribute("data-style-tag") === t3 && e2.remove());
|
|
14
|
+
})(e), i + 100);
|
|
15
|
+
});
|
|
16
|
+
} };
|
|
17
|
+
export {
|
|
18
|
+
t as v
|
|
19
|
+
};
|