ono-react-element 0.0.7 → 0.0.8
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-Dy-otnYu.js +30 -0
- package/dist/es/AvatarCrop-DrA-SARP.js +65 -0
- package/dist/es/Button-C89izu2m.js +26 -0
- package/dist/es/Card3D-DMvCSUhe.js +18 -0
- package/dist/es/Checkbox-daBabj14.js +19 -0
- package/dist/es/InjunctiveBox-D0V-K9Pn.js +11 -0
- package/dist/es/Input-Z3uL5-nj.js +80 -0
- package/dist/es/List-UAKCMuGC.js +19 -0
- package/dist/es/MenuButton-DHkU5Bq7.js +17 -0
- package/dist/es/Message-GvTC61N0.js +68 -0
- package/dist/es/Modal-C-c_S_VM.js +32 -0
- package/dist/es/Pagination-m71H2tfS.js +17 -0
- package/dist/es/PortalRenderer-CDAzQJgm.js +19 -0
- package/dist/es/Radio-D_GKVoOC.js +25 -0
- package/dist/es/Select-y-aAIqxg.js +23 -0
- package/dist/es/SvgImg-CZwq2D7J.js +14 -0
- package/dist/es/Switch-CN3M5pXb.js +34 -0
- package/dist/es/TemplateDialog-fX7Ie-xU.js +45 -0
- package/dist/es/Toast-BadlA1yD.js +42 -0
- package/dist/es/Tooltip-C5OFmxWo.js +29 -0
- package/dist/es/VirtualList-BeDq637Z.js +65 -0
- package/dist/es/Waterfall-a_c3urjB.js +55 -0
- package/dist/es/dependencies-CbQbPZZ-.js +15524 -0
- package/dist/es/hooks-Dew3_cmY.js +103 -0
- package/dist/es/index.js +106 -231
- package/dist/es/utils-BxXROOPY.js +394 -0
- package/dist/index.css +1 -1
- package/dist/style/AutoSliderList.css +1 -0
- package/dist/style/AvatarCrop.css +1 -0
- package/dist/style/Button.css +1 -0
- package/dist/style/Card3D.css +1 -0
- package/dist/style/Checkbox.css +1 -0
- package/dist/style/Input.css +1 -0
- package/dist/style/MenuButton.css +1 -0
- package/dist/style/Message.css +1 -0
- package/dist/style/Modal.css +1 -0
- package/dist/style/Pagination.css +1 -0
- package/dist/style/Radio.css +1 -0
- package/dist/style/Select.css +1 -0
- package/dist/style/SvgImg.css +1 -0
- package/dist/style/Switch.css +1 -0
- package/dist/style/TemplateDialog.css +1 -0
- package/dist/style/Toast.css +1 -0
- package/dist/style/Tooltip.css +1 -0
- package/dist/style/Waterfall.css +1 -0
- package/dist/style/index.css +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/printLogo.d.ts +1 -0
- package/dist/types/utils/common.d.ts +36 -20
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.br +0 -0
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +16583 -295
- package/dist/umd/index.umd.cjs.br +0 -0
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +56 -49
- package/dist/es/AutoSliderList-DN4Sec6L.js +0 -106
- package/dist/es/AvatarCrop-DzGw2FVQ.js +0 -225
- package/dist/es/Button-CdxyXFF4.js +0 -72
- package/dist/es/Card3D-sf3zmiHk.js +0 -41
- package/dist/es/Checkbox-BN7rT73n.js +0 -62
- package/dist/es/InjunctiveBox-CGpy0PxH.js +0 -39
- package/dist/es/Input-DoY3kR7J.js +0 -301
- package/dist/es/List-B9mP7VjN.js +0 -35
- package/dist/es/MenuButton-CuOdVlg0.js +0 -62
- package/dist/es/Message-TfweOOpK.js +0 -219
- package/dist/es/Modal-CHgTYu-I.js +0 -154
- package/dist/es/Pagination-BtmtUkVw.js +0 -110
- package/dist/es/PortalRenderer-8Iur-eZp.js +0 -38
- package/dist/es/Radio-BmSpqdK8.js +0 -113
- package/dist/es/SvgImg-Bcmzdjzl.js +0 -38
- package/dist/es/Switch-DwDBR0sG.js +0 -110
- package/dist/es/TemplateDialog-SXrElzoR.js +0 -75
- package/dist/es/Toast-C7ybVNyd.js +0 -174
- package/dist/es/Tooltip-BtzG0TSW.js +0 -94
- package/dist/es/VirtualList-OG7kqLe0.js +0 -160
- package/dist/es/Waterfall-GHdJxww4.js +0 -131
- package/dist/es/dependencies-DWmdjl5u.js +0 -25491
- package/dist/es/hooks-CQN6qu4t.js +0 -159
- package/dist/es/utils-BLV_TQU3.js +0 -585
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,49 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ono-react-element",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "Component library by React + Typescript",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "./dist/umd/index.umd.cjs",
|
|
8
|
-
"module": "./dist/es/index.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./dist/types/index.d.ts",
|
|
16
|
-
"import": "./dist/es/index.js",
|
|
17
|
-
"require": "./dist/umd/index.umd.cjs"
|
|
18
|
-
},
|
|
19
|
-
"./dist/": {
|
|
20
|
-
"import": "./dist/",
|
|
21
|
-
"require": "./dist/"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"sideEffects": [
|
|
25
|
-
"./dist/index.css"
|
|
26
|
-
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "run-
|
|
29
|
-
"build
|
|
30
|
-
"build-umd": "vite build --config vite.umd.config.ts",
|
|
31
|
-
"build-es": "vite build --config vite.es.config.ts",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"release": "release-it"
|
|
35
|
-
},
|
|
36
|
-
"keywords": [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ono-react-element",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.8",
|
|
5
|
+
"description": "Component library by React + Typescript",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/umd/index.umd.cjs",
|
|
8
|
+
"module": "./dist/es/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"import": "./dist/es/index.js",
|
|
17
|
+
"require": "./dist/umd/index.umd.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./dist/": {
|
|
20
|
+
"import": "./dist/",
|
|
21
|
+
"require": "./dist/"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"sideEffects": [
|
|
25
|
+
"./dist/index.css"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "run-p build-umd build-es",
|
|
29
|
+
"build:watch": "run-p build-umd:watch build-es:watch",
|
|
30
|
+
"build-umd": "vite build --config vite.umd.config.ts",
|
|
31
|
+
"build-es": "vite build --config vite.es.config.ts",
|
|
32
|
+
"build-umd:watch": "vite build --watch --config vite.umd.config.ts",
|
|
33
|
+
"build-es:watch": "vite build --watch --config vite.es.config.ts",
|
|
34
|
+
"release": "release-it"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"react",
|
|
38
|
+
"typescript",
|
|
39
|
+
"component"
|
|
40
|
+
],
|
|
41
|
+
"author": "ono",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@popperjs/core": "^2.11.8"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
48
|
+
"terser": "^5.43.1",
|
|
49
|
+
"vite-plugin-compression2": "^2.2.0",
|
|
50
|
+
"vite-plugin-dts": "^4.5.4"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { j as y } from "./dependencies-DWmdjl5u.js";
|
|
2
|
-
import { p as z } from "./utils-BLV_TQU3.js";
|
|
3
|
-
import { useState as a, useRef as H, useMemo as j, useEffect as g, cloneElement as V } from "react";
|
|
4
|
-
import { u as W } from "./hooks-CQN6qu4t.js";
|
|
5
|
-
var x = /* @__PURE__ */ ((s) => (s.Horizontal = "Horizontal", s.Vertical = "Vertical", s))(x || {});
|
|
6
|
-
const q = ({
|
|
7
|
-
list: s,
|
|
8
|
-
style: C,
|
|
9
|
-
disable: n,
|
|
10
|
-
children: m,
|
|
11
|
-
sliderBox: v,
|
|
12
|
-
className: A,
|
|
13
|
-
sliderStyle: E,
|
|
14
|
-
duration: c = 300,
|
|
15
|
-
sliderClassName: $,
|
|
16
|
-
currentIndex: d = 0,
|
|
17
|
-
direction: i = x.Horizontal,
|
|
18
|
-
sliderTransitionTimingFunction: h = "ease-in-out"
|
|
19
|
-
}) => {
|
|
20
|
-
const [I, L] = a(!1), [t, S] = a(0), [f, R] = a({
|
|
21
|
-
t: 0,
|
|
22
|
-
l: 0
|
|
23
|
-
}), [u, k] = a({
|
|
24
|
-
w: 0,
|
|
25
|
-
h: 0
|
|
26
|
-
}), l = H(null), w = H(null), B = j(
|
|
27
|
-
() => ["width", "height", "transform"].map(
|
|
28
|
-
(e) => `${e} ${c / 1e3}s ${h}`
|
|
29
|
-
).join(","),
|
|
30
|
-
[i, c, h]
|
|
31
|
-
), N = j(
|
|
32
|
-
() => ({
|
|
33
|
-
width: u.w,
|
|
34
|
-
height: u.h,
|
|
35
|
-
transition: I ? B : "initial",
|
|
36
|
-
transform: `translate(${f.l}px, ${f.t}px)`
|
|
37
|
-
}),
|
|
38
|
-
[u, f]
|
|
39
|
-
), M = () => {
|
|
40
|
-
if (typeof t != "number" || !l.current || !w.current) return;
|
|
41
|
-
const e = Array.from(l.current.children).slice(
|
|
42
|
-
1
|
|
43
|
-
);
|
|
44
|
-
e.forEach((r) => {
|
|
45
|
-
r.style.position = "relative", r.style.cursor = n ? "not-allowed" : "pointer", r.style.zIndex = "1";
|
|
46
|
-
});
|
|
47
|
-
const o = window.getComputedStyle(l.current), p = {
|
|
48
|
-
t: i === "Horizontal" ? z(o.paddingTop) : e[t].offsetTop,
|
|
49
|
-
l: i === "Horizontal" ? e[t].offsetLeft : z(o.paddingLeft)
|
|
50
|
-
};
|
|
51
|
-
R(p), k({
|
|
52
|
-
w: e[t].offsetWidth,
|
|
53
|
-
h: e[t].offsetHeight
|
|
54
|
-
}), setTimeout(() => L(!0), c);
|
|
55
|
-
}, { w: P, h: T } = W();
|
|
56
|
-
return g(() => {
|
|
57
|
-
S(d);
|
|
58
|
-
}, [d]), g(() => {
|
|
59
|
-
M();
|
|
60
|
-
}, [t, P, T, n]), /* @__PURE__ */ y.jsxs(
|
|
61
|
-
"ul",
|
|
62
|
-
{
|
|
63
|
-
ref: l,
|
|
64
|
-
className: [
|
|
65
|
-
"ono-auto-slider-list-container",
|
|
66
|
-
A,
|
|
67
|
-
n ? "ono-auto-slider-list-is-disable" : ""
|
|
68
|
-
].filter(Boolean).join(" "),
|
|
69
|
-
style: {
|
|
70
|
-
flexDirection: i === "Horizontal" ? "row" : "column",
|
|
71
|
-
...C
|
|
72
|
-
},
|
|
73
|
-
children: [
|
|
74
|
-
/* @__PURE__ */ y.jsx(
|
|
75
|
-
"li",
|
|
76
|
-
{
|
|
77
|
-
ref: w,
|
|
78
|
-
className: ["ono-auto-slider-list-slider", $].filter(Boolean).join(" "),
|
|
79
|
-
style: { ...E, ...N },
|
|
80
|
-
children: v
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
s.map(
|
|
84
|
-
(e, o) => V(
|
|
85
|
-
m({ item: e, index: o, isActive: o === t }),
|
|
86
|
-
{
|
|
87
|
-
onClick: (p) => {
|
|
88
|
-
if (n) return;
|
|
89
|
-
const r = m({
|
|
90
|
-
item: e,
|
|
91
|
-
index: o,
|
|
92
|
-
isActive: o === t
|
|
93
|
-
}).props.onClick;
|
|
94
|
-
r && r(p), S(o);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
)
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
export {
|
|
104
|
-
q as A,
|
|
105
|
-
x as D
|
|
106
|
-
};
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { j as p } from "./dependencies-DWmdjl5u.js";
|
|
2
|
-
import { useState as h, useRef as T, useEffect as q } from "react";
|
|
3
|
-
const K = ({
|
|
4
|
-
imageFile: v,
|
|
5
|
-
cvsW: $ = 520,
|
|
6
|
-
maskBG: B = "rgba(0, 0, 0, 0.5)",
|
|
7
|
-
border: y = "4px solid #fff",
|
|
8
|
-
wheelScale: j = 0.1,
|
|
9
|
-
setCtx: g,
|
|
10
|
-
maskInfo: e,
|
|
11
|
-
setMaskInfo: d,
|
|
12
|
-
imageStartState: D,
|
|
13
|
-
setImageStartState: R,
|
|
14
|
-
imageState: n,
|
|
15
|
-
setImageState: a
|
|
16
|
-
}) => {
|
|
17
|
-
const [x, E] = h(), [z, U] = h({ w: 0, h: 0 }), [c, X] = h({ w: 0, h: 0 }), [L, u] = h({ x: 0, y: 0 }), [C, b] = h(!1), f = T(null), i = T(null), s = (t, r) => {
|
|
18
|
-
r((l) => ({
|
|
19
|
-
...l,
|
|
20
|
-
...t
|
|
21
|
-
}));
|
|
22
|
-
}, O = () => {
|
|
23
|
-
if (!f.current) return;
|
|
24
|
-
const { width: t } = f.current.getBoundingClientRect();
|
|
25
|
-
G(t), U({ w: t, h: t });
|
|
26
|
-
}, N = () => {
|
|
27
|
-
const t = y.split(" ");
|
|
28
|
-
let r = 0;
|
|
29
|
-
return t.forEach((l) => {
|
|
30
|
-
l.includes("px") && (r = Number(l.split("px")[0]));
|
|
31
|
-
}), r;
|
|
32
|
-
}, G = (t) => {
|
|
33
|
-
const r = new Image();
|
|
34
|
-
typeof v == "string" ? r.src = v : r.src = URL.createObjectURL(v), r.onload = () => {
|
|
35
|
-
var P;
|
|
36
|
-
let l = 1, o = r.width, w = r.height;
|
|
37
|
-
o > w ? (l = o / t, o = t, w = w / l, s({ w }, d)) : (l = w / t, w = t, o = o / l, s({ w: o }, d));
|
|
38
|
-
const M = (t - o) / 2, Y = (t - w) / 2;
|
|
39
|
-
s({ w: r.width, h: r.height }, X), E(r), s(
|
|
40
|
-
{
|
|
41
|
-
w: o,
|
|
42
|
-
h: w,
|
|
43
|
-
t: Y,
|
|
44
|
-
l: M
|
|
45
|
-
},
|
|
46
|
-
a
|
|
47
|
-
), R({ w: o, h: w, t: Y, l: M }), M > Y ? s({ l: M }, d) : s({ l: Y }, d), g((P = i.current) == null ? void 0 : P.getContext("2d"));
|
|
48
|
-
};
|
|
49
|
-
}, A = () => {
|
|
50
|
-
b(!1), n.l > e.l && s({ l: e.l }, a), n.t > e.l && s({ t: e.l }, a), -n.l > n.w - e.l - e.w && s(
|
|
51
|
-
{ l: -(n.w - e.l - e.w) },
|
|
52
|
-
a
|
|
53
|
-
), -n.t > n.h - e.l - e.w && s(
|
|
54
|
-
{ t: -(n.h - e.l - e.w) },
|
|
55
|
-
a
|
|
56
|
-
);
|
|
57
|
-
}, H = (t, r) => {
|
|
58
|
-
const l = r === "in" ? t * j : -t * j;
|
|
59
|
-
let o = t + l;
|
|
60
|
-
return o > c.w && (o = c.w), o < D.w && (o = D.w), o;
|
|
61
|
-
}, J = (t) => {
|
|
62
|
-
t.preventDefault(), t.stopPropagation();
|
|
63
|
-
const r = t.deltaY < 0 ? "in" : "out", l = H(n.w, r), o = l / c.w;
|
|
64
|
-
s(
|
|
65
|
-
{
|
|
66
|
-
w: l,
|
|
67
|
-
h: c.h * o
|
|
68
|
-
},
|
|
69
|
-
a
|
|
70
|
-
), A();
|
|
71
|
-
};
|
|
72
|
-
return q(() => {
|
|
73
|
-
O();
|
|
74
|
-
}, [f]), q(() => {
|
|
75
|
-
if (!i.current || !x) return;
|
|
76
|
-
const t = i.current.getContext("2d");
|
|
77
|
-
t && (t.clearRect(
|
|
78
|
-
0,
|
|
79
|
-
0,
|
|
80
|
-
i.current.width,
|
|
81
|
-
i.current.height
|
|
82
|
-
), t.drawImage(
|
|
83
|
-
x,
|
|
84
|
-
n.l,
|
|
85
|
-
n.t,
|
|
86
|
-
n.w,
|
|
87
|
-
n.h
|
|
88
|
-
));
|
|
89
|
-
}, [i, x, n]), /* @__PURE__ */ p.jsxs(
|
|
90
|
-
"div",
|
|
91
|
-
{
|
|
92
|
-
ref: f,
|
|
93
|
-
className: "ono-avatar-canvas",
|
|
94
|
-
style: {
|
|
95
|
-
width: $,
|
|
96
|
-
cursor: C ? "grabbing" : "grab"
|
|
97
|
-
},
|
|
98
|
-
onWheel: J,
|
|
99
|
-
onMouseUp: A,
|
|
100
|
-
onMouseLeave: A,
|
|
101
|
-
children: [
|
|
102
|
-
/* @__PURE__ */ p.jsx(
|
|
103
|
-
"canvas",
|
|
104
|
-
{
|
|
105
|
-
width: z.w,
|
|
106
|
-
height: z.h,
|
|
107
|
-
ref: i,
|
|
108
|
-
onMouseDown: (t) => {
|
|
109
|
-
s({ x: t.clientX, y: t.clientY }, u), b(!0);
|
|
110
|
-
},
|
|
111
|
-
onMouseMove: (t) => {
|
|
112
|
-
if (C) {
|
|
113
|
-
const r = t.clientX - L.x, l = t.clientY - L.y;
|
|
114
|
-
(Math.abs(r) > 10 || Math.abs(l) > 10) && (s(
|
|
115
|
-
{
|
|
116
|
-
t: n.t + l,
|
|
117
|
-
l: n.l + r
|
|
118
|
-
},
|
|
119
|
-
a
|
|
120
|
-
), s({ x: t.clientX, y: t.clientY }, u));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
x && /* @__PURE__ */ p.jsx("div", { className: "ono-avatar-mask", children: /* @__PURE__ */ p.jsx(
|
|
126
|
-
"div",
|
|
127
|
-
{
|
|
128
|
-
style: {
|
|
129
|
-
border: y,
|
|
130
|
-
boxShadow: `${B} 0 0 0 10000px`,
|
|
131
|
-
width: `${e.w + N() * 2}px`,
|
|
132
|
-
height: `${e.w + N() * 2}px`
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
) })
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
}, Z = ({
|
|
140
|
-
imageFile: v,
|
|
141
|
-
cvsW: $ = 520,
|
|
142
|
-
maskBG: B = "rgba(0, 0, 0, 0.5)",
|
|
143
|
-
border: y = "4px solid #fff",
|
|
144
|
-
wheelScale: j = 0.1,
|
|
145
|
-
children: g
|
|
146
|
-
}) => {
|
|
147
|
-
const [e, d] = h({
|
|
148
|
-
w: 0,
|
|
149
|
-
// 图片初始宽度
|
|
150
|
-
h: 0,
|
|
151
|
-
// 图片初始高度
|
|
152
|
-
t: 0,
|
|
153
|
-
// 图片初始离顶部距离
|
|
154
|
-
l: 0
|
|
155
|
-
// 图片初始离左侧距离
|
|
156
|
-
}), [D, R] = h({
|
|
157
|
-
w: 0,
|
|
158
|
-
// 当前图片宽度
|
|
159
|
-
h: 0,
|
|
160
|
-
// 当前图片高度
|
|
161
|
-
t: 0,
|
|
162
|
-
// 圖片當前離頂部距離
|
|
163
|
-
l: 0
|
|
164
|
-
// 圖片當前離左邊距離
|
|
165
|
-
}), [n, a] = h({
|
|
166
|
-
w: 0,
|
|
167
|
-
// 蒙版寬度
|
|
168
|
-
l: 0
|
|
169
|
-
// 蒙版初始离左侧距离
|
|
170
|
-
}), [x, E] = h(), z = (c) => {
|
|
171
|
-
R({
|
|
172
|
-
w: e.w,
|
|
173
|
-
h: e.h,
|
|
174
|
-
t: e.t,
|
|
175
|
-
l: e.l
|
|
176
|
-
}), c == null || c();
|
|
177
|
-
}, U = (c, X) => {
|
|
178
|
-
if (!x) return;
|
|
179
|
-
const L = x.getImageData(
|
|
180
|
-
n.l,
|
|
181
|
-
n.l,
|
|
182
|
-
n.w,
|
|
183
|
-
n.w
|
|
184
|
-
), u = document.createElement("canvas"), C = u.getContext("2d");
|
|
185
|
-
if (u.width = n.w, u.height = n.w, !C) return;
|
|
186
|
-
const {
|
|
187
|
-
imageSaveType: b = "png",
|
|
188
|
-
dataSaveType: f = "base64",
|
|
189
|
-
quality: i = 100
|
|
190
|
-
} = X || {};
|
|
191
|
-
C.putImageData(L, 0, 0, 0, 0, n.w, n.w), f === "base64" ? c(u.toDataURL(`image/${b}`, i / 100)) : f === "blob" && u.toBlob(
|
|
192
|
-
(s) => {
|
|
193
|
-
if (s) return c(s);
|
|
194
|
-
},
|
|
195
|
-
`image/${b}`,
|
|
196
|
-
i / 100
|
|
197
|
-
);
|
|
198
|
-
};
|
|
199
|
-
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
200
|
-
/* @__PURE__ */ p.jsx(
|
|
201
|
-
K,
|
|
202
|
-
{
|
|
203
|
-
imageFile: v,
|
|
204
|
-
cvsW: $,
|
|
205
|
-
maskBG: B,
|
|
206
|
-
border: y,
|
|
207
|
-
wheelScale: j,
|
|
208
|
-
maskInfo: n,
|
|
209
|
-
setMaskInfo: a,
|
|
210
|
-
setCtx: E,
|
|
211
|
-
imageStartState: e,
|
|
212
|
-
setImageStartState: d,
|
|
213
|
-
imageState: D,
|
|
214
|
-
setImageState: R
|
|
215
|
-
}
|
|
216
|
-
),
|
|
217
|
-
g == null ? void 0 : g({
|
|
218
|
-
handleConfirm: U,
|
|
219
|
-
handleReduction: z
|
|
220
|
-
})
|
|
221
|
-
] });
|
|
222
|
-
};
|
|
223
|
-
export {
|
|
224
|
-
Z as A
|
|
225
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { j as n } from "./dependencies-DWmdjl5u.js";
|
|
2
|
-
import { useState as R, useRef as u, useEffect as f } from "react";
|
|
3
|
-
const N = ({
|
|
4
|
-
onClick: d,
|
|
5
|
-
children: m,
|
|
6
|
-
disabled: s,
|
|
7
|
-
loading: e,
|
|
8
|
-
plain: p,
|
|
9
|
-
shape: c = "default",
|
|
10
|
-
htmlType: h = "button",
|
|
11
|
-
type: x = "primary",
|
|
12
|
-
className: j,
|
|
13
|
-
style: g,
|
|
14
|
-
icon: i
|
|
15
|
-
}) => {
|
|
16
|
-
const [a, l] = R(!1), o = u(null), r = u(null), b = () => {
|
|
17
|
-
if (!o.current) return;
|
|
18
|
-
const t = o.current, C = t.getBoundingClientRect();
|
|
19
|
-
t.style.setProperty("--btn-height", C.height + "px");
|
|
20
|
-
}, L = () => {
|
|
21
|
-
if (!r.current) return;
|
|
22
|
-
const t = r.current;
|
|
23
|
-
e ? (l(!0), t.classList.add("ono-loading-start")) : (setTimeout(() => {
|
|
24
|
-
l(!1);
|
|
25
|
-
}, 300), t.classList.remove("ono-loading-start"), t.classList.add("ono-loading-end"));
|
|
26
|
-
}, y = () => [
|
|
27
|
-
`ono-btn-${x}`,
|
|
28
|
-
e || a ? "is-loading" : "",
|
|
29
|
-
e || i ? "is-icon" : "",
|
|
30
|
-
s ? "is-disabled" : "",
|
|
31
|
-
c === "round" ? "is-round" : c === "circle" ? "is-circle" : "",
|
|
32
|
-
p ? "is-plain" : "",
|
|
33
|
-
j ?? ""
|
|
34
|
-
].filter(Boolean).join(" "), B = () => {
|
|
35
|
-
const t = /* @__PURE__ */ n.jsx("span", { ref: r, className: "ono-btn-icon", children: /* @__PURE__ */ n.jsx("span", { children: typeof e == "object" ? e.icon : /* @__PURE__ */ n.jsx(
|
|
36
|
-
"svg",
|
|
37
|
-
{
|
|
38
|
-
viewBox: "0 0 1024 1024",
|
|
39
|
-
focusable: "false",
|
|
40
|
-
"data-icon": "loading",
|
|
41
|
-
width: "1em",
|
|
42
|
-
height: "1em",
|
|
43
|
-
fill: "currentColor",
|
|
44
|
-
"aria-hidden": "true",
|
|
45
|
-
children: /* @__PURE__ */ n.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" })
|
|
46
|
-
}
|
|
47
|
-
) }) });
|
|
48
|
-
return e || a ? t : i ? /* @__PURE__ */ n.jsx("span", { children: i }) : /* @__PURE__ */ n.jsx(n.Fragment, {});
|
|
49
|
-
};
|
|
50
|
-
return f(() => {
|
|
51
|
-
L();
|
|
52
|
-
}, [e, r]), f(() => {
|
|
53
|
-
b();
|
|
54
|
-
}, [o]), /* @__PURE__ */ n.jsxs(
|
|
55
|
-
"button",
|
|
56
|
-
{
|
|
57
|
-
ref: o,
|
|
58
|
-
className: y(),
|
|
59
|
-
type: h,
|
|
60
|
-
disabled: (typeof s == "function" ? s() : s) || !!e,
|
|
61
|
-
style: g,
|
|
62
|
-
onClick: d,
|
|
63
|
-
children: [
|
|
64
|
-
B(),
|
|
65
|
-
m
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
export {
|
|
71
|
-
N as B
|
|
72
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { j as a } from "./dependencies-DWmdjl5u.js";
|
|
2
|
-
import { useState as j, useRef as R, useEffect as l } from "react";
|
|
3
|
-
const $ = ({
|
|
4
|
-
src: r,
|
|
5
|
-
children: s,
|
|
6
|
-
enlarge: y = !1,
|
|
7
|
-
scale: i = 1.1,
|
|
8
|
-
shadow: c,
|
|
9
|
-
xRange: d = [-10, 10],
|
|
10
|
-
yRange: p = [-10, 10],
|
|
11
|
-
borderRadius: v = 20
|
|
12
|
-
}) => {
|
|
13
|
-
const [x, f] = j(!1), e = R(null), u = (t, o, n) => o / n * (t[1] - t[0]) + t[0], m = (t) => {
|
|
14
|
-
const { offsetX: o, offsetY: n } = t.nativeEvent, { offsetWidth: g, offsetHeight: M } = e.current, E = u(d, n, M), P = -u(p, o, g);
|
|
15
|
-
e.current.style.setProperty("--rx", `${E}deg`), e.current.style.setProperty("--ry", `${P}deg`);
|
|
16
|
-
};
|
|
17
|
-
return l(() => {
|
|
18
|
-
e.current && c && e.current.style.setProperty("--sd", c);
|
|
19
|
-
}, [e.current]), l(() => {
|
|
20
|
-
if (!s && !r) throw new Error("请传入children或者src属性");
|
|
21
|
-
}, [s, r]), /* @__PURE__ */ a.jsx(
|
|
22
|
-
"div",
|
|
23
|
-
{
|
|
24
|
-
ref: e,
|
|
25
|
-
className: "ono-card",
|
|
26
|
-
style: {
|
|
27
|
-
borderRadius: v,
|
|
28
|
-
transform: `perspective(500px) scale(${x && y ? i : 1}) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))`
|
|
29
|
-
},
|
|
30
|
-
onMouseEnter: () => f(!0),
|
|
31
|
-
onMouseMove: m,
|
|
32
|
-
onMouseLeave: () => {
|
|
33
|
-
f(!1), e.current.style.setProperty("--rx", "0deg"), e.current.style.setProperty("--ry", "0deg");
|
|
34
|
-
},
|
|
35
|
-
children: s ?? /* @__PURE__ */ a.jsx("img", { src: r, alt: "图片" })
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
$ as C
|
|
41
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { j as C } from "./dependencies-DWmdjl5u.js";
|
|
2
|
-
import { useState as d, useRef as k, useEffect as j } from "react";
|
|
3
|
-
const w = ({
|
|
4
|
-
id: u,
|
|
5
|
-
style: c,
|
|
6
|
-
checked: s,
|
|
7
|
-
onChange: p,
|
|
8
|
-
className: l,
|
|
9
|
-
indeterminate: n = !1,
|
|
10
|
-
checkedColor: i = "#0077cc",
|
|
11
|
-
indeterminateStyle: y = "line",
|
|
12
|
-
indeterminateColor: a = "#0077cc"
|
|
13
|
-
}) => {
|
|
14
|
-
const [f, h] = d(""), e = k(null), x = [
|
|
15
|
-
{
|
|
16
|
-
value: i,
|
|
17
|
-
name: "checkedColor"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
value: a,
|
|
21
|
-
name: "indeterminateColor"
|
|
22
|
-
}
|
|
23
|
-
], b = (t, r, o) => {
|
|
24
|
-
typeof t == "string" ? o.style.setProperty(`--${r}`, t) : o.style.setProperty(`--${r}`, `${t}px`);
|
|
25
|
-
}, m = () => {
|
|
26
|
-
if (!e.current) return;
|
|
27
|
-
const t = getComputedStyle(e.current);
|
|
28
|
-
f || h(t.borderColor), e.current.style.height = t.width, [
|
|
29
|
-
{
|
|
30
|
-
value: t.width,
|
|
31
|
-
name: "w"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: s || n ? i : f,
|
|
35
|
-
name: "border-color"
|
|
36
|
-
},
|
|
37
|
-
...x
|
|
38
|
-
].forEach(({ value: r, name: o }) => {
|
|
39
|
-
r && b(r, o, e.current);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
return j(() => {
|
|
43
|
-
m(), e.current && (e.current.indeterminate = n);
|
|
44
|
-
}, [e, l, c, n]), /* @__PURE__ */ C.jsx(
|
|
45
|
-
"input",
|
|
46
|
-
{
|
|
47
|
-
id: u,
|
|
48
|
-
type: "checkbox",
|
|
49
|
-
ref: e,
|
|
50
|
-
checked: s,
|
|
51
|
-
onChange: p,
|
|
52
|
-
className: [
|
|
53
|
-
l,
|
|
54
|
-
y === "line" ? "ono-checkbox-line" : "ono-checkbox-border"
|
|
55
|
-
].filter(Boolean).join(" "),
|
|
56
|
-
style: c
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
export {
|
|
61
|
-
w as C
|
|
62
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { j as i, R as j } from "./dependencies-DWmdjl5u.js";
|
|
2
|
-
import { a as p } from "./hooks-CQN6qu4t.js";
|
|
3
|
-
let e = null, t;
|
|
4
|
-
const B = ({
|
|
5
|
-
className: n,
|
|
6
|
-
content: r,
|
|
7
|
-
style: u,
|
|
8
|
-
onClick: c,
|
|
9
|
-
onDoubleClick: l,
|
|
10
|
-
onContextMenu: s,
|
|
11
|
-
onMouseDown: m,
|
|
12
|
-
onMouseUp: d,
|
|
13
|
-
onMouseEnter: a,
|
|
14
|
-
onMouseLeave: x,
|
|
15
|
-
onMouseMove: f,
|
|
16
|
-
isClickBoxToClose: v
|
|
17
|
-
}) => (p("click", () => {
|
|
18
|
-
v && e && (e.remove(), e = null);
|
|
19
|
-
}), /* @__PURE__ */ i.jsx(
|
|
20
|
-
"div",
|
|
21
|
-
{
|
|
22
|
-
className: n,
|
|
23
|
-
style: u,
|
|
24
|
-
onClick: c,
|
|
25
|
-
onDoubleClick: l,
|
|
26
|
-
onContextMenu: s,
|
|
27
|
-
onMouseDown: m,
|
|
28
|
-
onMouseUp: d,
|
|
29
|
-
onMouseEnter: a,
|
|
30
|
-
onMouseLeave: x,
|
|
31
|
-
onMouseMove: f,
|
|
32
|
-
children: typeof r == "function" ? r((o) => {
|
|
33
|
-
e && (e.remove(), e = null, o && o());
|
|
34
|
-
}) : r
|
|
35
|
-
}
|
|
36
|
-
)), b = (n) => (R(n.isSingle || !1).render(/* @__PURE__ */ i.jsx(B, { ...n })), e), R = (n) => (n && e && t || (e = document.createElement("div"), document.body.appendChild(e), t = j.createRoot(e)), t);
|
|
37
|
-
export {
|
|
38
|
-
b as i
|
|
39
|
-
};
|