@glodon-aiot/agent-cli-ui 3.0.6 → 3.0.7-beta.0
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/Dialog/AgentChat/index.mjs +371 -353
- package/dist/es/_virtual/lib.mjs +4 -0
- package/dist/es/_virtual/ua-parser.min.mjs +4 -0
- package/dist/es/components/Markdown/ATag/index.mjs +47 -0
- package/dist/es/components/Markdown/Image/index.mjs +56 -22
- package/dist/es/components/Markdown/Video/index.mjs +22 -0
- package/dist/es/components/Markdown/index.mjs +41 -37
- package/dist/es/index.mjs +15 -15
- package/dist/es/node_modules/@react-spring/animated/dist/react-spring-animated.esm.mjs +201 -0
- package/dist/es/node_modules/@react-spring/core/dist/react-spring-core.esm.mjs +1087 -0
- package/dist/es/node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.mjs +104 -0
- package/dist/es/node_modules/@react-spring/shared/dist/react-spring-shared.esm.mjs +568 -0
- package/dist/es/node_modules/@react-spring/web/dist/react-spring-web.esm.mjs +158 -0
- package/dist/es/node_modules/@use-gesture/core/dist/actions-fe213e88.esm.mjs +847 -0
- package/dist/es/node_modules/@use-gesture/core/dist/maths-0ab39ae9.esm.mjs +35 -0
- package/dist/es/node_modules/@use-gesture/core/dist/use-gesture-core.esm.mjs +226 -0
- package/dist/es/node_modules/@use-gesture/react/dist/use-gesture-react.esm.mjs +33 -0
- package/dist/es/node_modules/ahooks/es/useRafState/index.mjs +16 -0
- package/dist/es/node_modules/ahooks/es/useSize/index.mjs +34 -0
- package/dist/es/node_modules/ahooks/es/useUnmountedRef/index.mjs +13 -0
- package/dist/es/node_modules/ahooks/es/utils/useIsomorphicLayoutEffectWithTarget.mjs +8 -0
- package/dist/es/node_modules/ahooks/es/utils/useLayoutEffectWithTarget.mjs +7 -0
- package/dist/es/node_modules/antd-mobile/es/components/config-provider/config-provider.mjs +20 -0
- package/dist/es/node_modules/antd-mobile/es/components/image-viewer/image-viewer.css.mjs +4 -0
- package/dist/es/node_modules/antd-mobile/es/components/image-viewer/image-viewer.mjs +76 -0
- package/dist/es/node_modules/antd-mobile/es/components/image-viewer/index.mjs +14 -0
- package/dist/es/node_modules/antd-mobile/es/components/image-viewer/methods.mjs +34 -0
- package/dist/es/node_modules/antd-mobile/es/components/image-viewer/slide.mjs +172 -0
- package/dist/es/node_modules/antd-mobile/es/components/image-viewer/slides.mjs +81 -0
- package/dist/es/node_modules/antd-mobile/es/components/mask/index.mjs +5 -0
- package/dist/es/node_modules/antd-mobile/es/components/mask/mask.css.mjs +4 -0
- package/dist/es/node_modules/antd-mobile/es/components/mask/mask.mjs +84 -0
- package/dist/es/node_modules/antd-mobile/es/components/safe-area/index.mjs +5 -0
- package/dist/es/node_modules/antd-mobile/es/components/safe-area/safe-area.css.mjs +4 -0
- package/dist/es/node_modules/antd-mobile/es/components/safe-area/safe-area.mjs +9 -0
- package/dist/es/node_modules/antd-mobile/es/global/global.css.mjs +4 -0
- package/dist/es/node_modules/antd-mobile/es/global/index.mjs +4 -0
- package/dist/es/node_modules/antd-mobile/es/locales/zh-CN.mjs +141 -0
- package/dist/es/node_modules/antd-mobile/es/utils/attach-properties-to-component.mjs +9 -0
- package/dist/es/node_modules/antd-mobile/es/utils/bound.mjs +7 -0
- package/dist/es/node_modules/antd-mobile/es/utils/can-use-dom.mjs +4 -0
- package/dist/es/node_modules/antd-mobile/es/utils/convert-px.mjs +9 -0
- package/dist/es/node_modules/antd-mobile/es/utils/get-container.mjs +6 -0
- package/dist/es/node_modules/antd-mobile/es/utils/get-scroll-parent.mjs +22 -0
- package/dist/es/node_modules/antd-mobile/es/utils/matrix.mjs +11 -0
- package/dist/es/node_modules/antd-mobile/es/utils/native-props.mjs +12 -0
- package/dist/es/node_modules/antd-mobile/es/utils/render-imperatively.mjs +46 -0
- package/dist/es/node_modules/antd-mobile/es/utils/render-to-body.mjs +12 -0
- package/dist/es/node_modules/antd-mobile/es/utils/render-to-container.mjs +13 -0
- package/dist/es/node_modules/antd-mobile/es/utils/render.mjs +52 -0
- package/dist/es/node_modules/antd-mobile/es/utils/rubberband.mjs +11 -0
- package/dist/es/node_modules/antd-mobile/es/utils/should-render.mjs +10 -0
- package/dist/es/node_modules/antd-mobile/es/utils/supports-passive.mjs +15 -0
- package/dist/es/node_modules/antd-mobile/es/utils/use-drag-and-pinch.mjs +6 -0
- package/dist/es/node_modules/antd-mobile/es/utils/use-initialized.mjs +8 -0
- package/dist/es/node_modules/antd-mobile/es/utils/use-lock-scroll.mjs +54 -0
- package/dist/es/node_modules/antd-mobile/es/utils/use-touch.mjs +32 -0
- package/dist/es/node_modules/antd-mobile/es/utils/with-default-props.mjs +11 -0
- package/dist/es/node_modules/antd-mobile/es/utils/with-stop-propagation.mjs +19 -0
- package/dist/es/node_modules/react/cjs/react-jsx-runtime.production.min.mjs +11 -11
- package/dist/es/node_modules/react-device-detect/dist/lib.mjs +723 -0
- package/dist/es/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.mjs +294 -0
- package/dist/es/node_modules/tslib/tslib.es6.mjs +56 -7
- package/dist/es/node_modules/ua-parser-js/dist/ua-parser.min.mjs +120 -0
- package/dist/es/utils/index.mjs +37 -22
- package/dist/lib/index.js +50 -48
- package/dist/src/components/Markdown/ATag/index.d.ts +3 -0
- package/dist/src/components/Markdown/Video/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function M(r, u, e) {
|
|
2
|
+
return Math.max(u, Math.min(r, e));
|
|
3
|
+
}
|
|
4
|
+
const y = {
|
|
5
|
+
toVector(r, u) {
|
|
6
|
+
return r === void 0 && (r = u), Array.isArray(r) ? r : [r, r];
|
|
7
|
+
},
|
|
8
|
+
add(r, u) {
|
|
9
|
+
return [r[0] + u[0], r[1] + u[1]];
|
|
10
|
+
},
|
|
11
|
+
sub(r, u) {
|
|
12
|
+
return [r[0] - u[0], r[1] - u[1]];
|
|
13
|
+
},
|
|
14
|
+
addTo(r, u) {
|
|
15
|
+
r[0] += u[0], r[1] += u[1];
|
|
16
|
+
},
|
|
17
|
+
subTo(r, u) {
|
|
18
|
+
r[0] -= u[0], r[1] -= u[1];
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function b(r, u, e) {
|
|
22
|
+
return u === 0 || Math.abs(u) === 1 / 0 ? Math.pow(r, e * 5) : r * u * e / (u + e * r);
|
|
23
|
+
}
|
|
24
|
+
function t(r, u, e, f = 0.15) {
|
|
25
|
+
return f === 0 ? M(r, u, e) : r < u ? -b(u - r, e - u, f) + u : r > e ? +b(r - e, e - u, f) + e : r;
|
|
26
|
+
}
|
|
27
|
+
function A(r, [u, e], [f, a]) {
|
|
28
|
+
const [[d, c], [h, n]] = r;
|
|
29
|
+
return [t(u, d, c, f), t(e, h, n, a)];
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
y as V,
|
|
33
|
+
A as c,
|
|
34
|
+
t as r
|
|
35
|
+
};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { a as f, i as E, b as y, E as m, _ as p, c as O, p as P, d as I, C as b, t as T, S as j } from "./actions-fe213e88.esm.mjs";
|
|
2
|
+
function M(e, t) {
|
|
3
|
+
if (e == null)
|
|
4
|
+
return {};
|
|
5
|
+
var s = {}, n = Object.keys(e), r, i;
|
|
6
|
+
for (i = 0; i < n.length; i++)
|
|
7
|
+
r = n[i], !(t.indexOf(r) >= 0) && (s[r] = e[r]);
|
|
8
|
+
return s;
|
|
9
|
+
}
|
|
10
|
+
function k(e, t) {
|
|
11
|
+
if (e == null)
|
|
12
|
+
return {};
|
|
13
|
+
var s = M(e, t), n, r;
|
|
14
|
+
if (Object.getOwnPropertySymbols) {
|
|
15
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
16
|
+
for (r = 0; r < i.length; r++)
|
|
17
|
+
n = i[r], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (s[n] = e[n]);
|
|
18
|
+
}
|
|
19
|
+
return s;
|
|
20
|
+
}
|
|
21
|
+
const H = {
|
|
22
|
+
target(e) {
|
|
23
|
+
if (e)
|
|
24
|
+
return () => "current" in e ? e.current : e;
|
|
25
|
+
},
|
|
26
|
+
enabled(e = !0) {
|
|
27
|
+
return e;
|
|
28
|
+
},
|
|
29
|
+
window(e = j.isBrowser ? window : void 0) {
|
|
30
|
+
return e;
|
|
31
|
+
},
|
|
32
|
+
eventOptions({
|
|
33
|
+
passive: e = !0,
|
|
34
|
+
capture: t = !1
|
|
35
|
+
} = {}) {
|
|
36
|
+
return {
|
|
37
|
+
passive: e,
|
|
38
|
+
capture: t
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
transform(e) {
|
|
42
|
+
return e;
|
|
43
|
+
}
|
|
44
|
+
}, R = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
45
|
+
function g(e = {}, t) {
|
|
46
|
+
const s = {};
|
|
47
|
+
for (const [n, r] of Object.entries(t))
|
|
48
|
+
switch (typeof r) {
|
|
49
|
+
case "function":
|
|
50
|
+
s[n] = r.call(s, e[n], n, e);
|
|
51
|
+
break;
|
|
52
|
+
case "object":
|
|
53
|
+
s[n] = g(e[n], r);
|
|
54
|
+
break;
|
|
55
|
+
case "boolean":
|
|
56
|
+
r && (s[n] = e[n]);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
return s;
|
|
60
|
+
}
|
|
61
|
+
function W(e, t, s = {}) {
|
|
62
|
+
const n = e, {
|
|
63
|
+
target: r,
|
|
64
|
+
eventOptions: i,
|
|
65
|
+
window: o,
|
|
66
|
+
enabled: c,
|
|
67
|
+
transform: u
|
|
68
|
+
} = n, a = k(n, R);
|
|
69
|
+
if (s.shared = g({
|
|
70
|
+
target: r,
|
|
71
|
+
eventOptions: i,
|
|
72
|
+
window: o,
|
|
73
|
+
enabled: c,
|
|
74
|
+
transform: u
|
|
75
|
+
}, H), t) {
|
|
76
|
+
const h = b.get(t);
|
|
77
|
+
s[t] = g(p({
|
|
78
|
+
shared: s.shared
|
|
79
|
+
}, a), h);
|
|
80
|
+
} else
|
|
81
|
+
for (const h in a) {
|
|
82
|
+
const v = b.get(h);
|
|
83
|
+
v && (s[h] = g(p({
|
|
84
|
+
shared: s.shared
|
|
85
|
+
}, a[h]), v));
|
|
86
|
+
}
|
|
87
|
+
return s;
|
|
88
|
+
}
|
|
89
|
+
class _ {
|
|
90
|
+
constructor(t, s) {
|
|
91
|
+
f(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = s;
|
|
92
|
+
}
|
|
93
|
+
add(t, s, n, r, i) {
|
|
94
|
+
const o = this._listeners, c = T(s, n), u = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, a = p(p({}, u), i);
|
|
95
|
+
t.addEventListener(c, r, a);
|
|
96
|
+
const h = () => {
|
|
97
|
+
t.removeEventListener(c, r, a), o.delete(h);
|
|
98
|
+
};
|
|
99
|
+
return o.add(h), h;
|
|
100
|
+
}
|
|
101
|
+
clean() {
|
|
102
|
+
this._listeners.forEach((t) => t()), this._listeners.clear();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class x {
|
|
106
|
+
constructor() {
|
|
107
|
+
f(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
108
|
+
}
|
|
109
|
+
add(t, s, n = 140, ...r) {
|
|
110
|
+
this.remove(t), this._timeouts.set(t, window.setTimeout(s, n, ...r));
|
|
111
|
+
}
|
|
112
|
+
remove(t) {
|
|
113
|
+
const s = this._timeouts.get(t);
|
|
114
|
+
s && window.clearTimeout(s);
|
|
115
|
+
}
|
|
116
|
+
clean() {
|
|
117
|
+
this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class F {
|
|
121
|
+
constructor(t) {
|
|
122
|
+
f(this, "gestures", /* @__PURE__ */ new Set()), f(this, "_targetEventStore", new _(this)), f(this, "gestureEventStores", {}), f(this, "gestureTimeoutStores", {}), f(this, "handlers", {}), f(this, "config", {}), f(this, "pointerIds", /* @__PURE__ */ new Set()), f(this, "touchIds", /* @__PURE__ */ new Set()), f(this, "state", {
|
|
123
|
+
shared: {
|
|
124
|
+
shiftKey: !1,
|
|
125
|
+
metaKey: !1,
|
|
126
|
+
ctrlKey: !1,
|
|
127
|
+
altKey: !1
|
|
128
|
+
}
|
|
129
|
+
}), D(this, t);
|
|
130
|
+
}
|
|
131
|
+
setEventIds(t) {
|
|
132
|
+
if (E(t))
|
|
133
|
+
return this.touchIds = new Set(y(t)), this.touchIds;
|
|
134
|
+
if ("pointerId" in t)
|
|
135
|
+
return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
|
|
136
|
+
}
|
|
137
|
+
applyHandlers(t, s) {
|
|
138
|
+
this.handlers = t, this.nativeHandlers = s;
|
|
139
|
+
}
|
|
140
|
+
applyConfig(t, s) {
|
|
141
|
+
this.config = W(t, s, this.config);
|
|
142
|
+
}
|
|
143
|
+
clean() {
|
|
144
|
+
this._targetEventStore.clean();
|
|
145
|
+
for (const t of this.gestures)
|
|
146
|
+
this.gestureEventStores[t].clean(), this.gestureTimeoutStores[t].clean();
|
|
147
|
+
}
|
|
148
|
+
effect() {
|
|
149
|
+
return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
|
|
150
|
+
}
|
|
151
|
+
bind(...t) {
|
|
152
|
+
const s = this.config.shared, n = {};
|
|
153
|
+
let r;
|
|
154
|
+
if (!(s.target && (r = s.target(), !r))) {
|
|
155
|
+
if (s.enabled) {
|
|
156
|
+
for (const o of this.gestures) {
|
|
157
|
+
const c = this.config[o], u = S(n, c.eventOptions, !!r);
|
|
158
|
+
if (c.enabled) {
|
|
159
|
+
const a = m.get(o);
|
|
160
|
+
new a(this, t, o).bind(u);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const i = S(n, s.eventOptions, !!r);
|
|
164
|
+
for (const o in this.nativeHandlers)
|
|
165
|
+
i(o, "", (c) => this.nativeHandlers[o](p(p({}, this.state.shared), {}, {
|
|
166
|
+
event: c,
|
|
167
|
+
args: t
|
|
168
|
+
})), void 0, !0);
|
|
169
|
+
}
|
|
170
|
+
for (const i in n)
|
|
171
|
+
n[i] = O(...n[i]);
|
|
172
|
+
if (!r)
|
|
173
|
+
return n;
|
|
174
|
+
for (const i in n) {
|
|
175
|
+
const {
|
|
176
|
+
device: o,
|
|
177
|
+
capture: c,
|
|
178
|
+
passive: u
|
|
179
|
+
} = P(i);
|
|
180
|
+
this._targetEventStore.add(r, o, "", n[i], {
|
|
181
|
+
capture: c,
|
|
182
|
+
passive: u
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function d(e, t) {
|
|
189
|
+
e.gestures.add(t), e.gestureEventStores[t] = new _(e, t), e.gestureTimeoutStores[t] = new x();
|
|
190
|
+
}
|
|
191
|
+
function D(e, t) {
|
|
192
|
+
t.drag && d(e, "drag"), t.wheel && d(e, "wheel"), t.scroll && d(e, "scroll"), t.move && d(e, "move"), t.pinch && d(e, "pinch"), t.hover && d(e, "hover");
|
|
193
|
+
}
|
|
194
|
+
const S = (e, t, s) => (n, r, i, o = {}, c = !1) => {
|
|
195
|
+
var u, a;
|
|
196
|
+
const h = (u = o.capture) !== null && u !== void 0 ? u : t.capture, v = (a = o.passive) !== null && a !== void 0 ? a : t.passive;
|
|
197
|
+
let w = c ? n : I(n, r, h);
|
|
198
|
+
s && v && (w += "Passive"), e[w] = e[w] || [], e[w].push(i);
|
|
199
|
+
}, G = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
|
|
200
|
+
function L(e) {
|
|
201
|
+
const t = {}, s = {}, n = /* @__PURE__ */ new Set();
|
|
202
|
+
for (let r in e)
|
|
203
|
+
G.test(r) ? (n.add(RegExp.lastMatch), s[r] = e[r]) : t[r] = e[r];
|
|
204
|
+
return [s, t, n];
|
|
205
|
+
}
|
|
206
|
+
function l(e, t, s, n, r, i) {
|
|
207
|
+
if (!e.has(s) || !m.has(n))
|
|
208
|
+
return;
|
|
209
|
+
const o = s + "Start", c = s + "End", u = (a) => {
|
|
210
|
+
let h;
|
|
211
|
+
return a.first && o in t && t[o](a), s in t && (h = t[s](a)), a.last && c in t && t[c](a), h;
|
|
212
|
+
};
|
|
213
|
+
r[n] = u, i[n] = i[n] || {};
|
|
214
|
+
}
|
|
215
|
+
function K(e, t) {
|
|
216
|
+
const [s, n, r] = L(e), i = {};
|
|
217
|
+
return l(r, s, "onDrag", "drag", i, t), l(r, s, "onWheel", "wheel", i, t), l(r, s, "onScroll", "scroll", i, t), l(r, s, "onPinch", "pinch", i, t), l(r, s, "onMove", "move", i, t), l(r, s, "onHover", "hover", i, t), {
|
|
218
|
+
handlers: i,
|
|
219
|
+
config: t,
|
|
220
|
+
nativeHandlers: n
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export {
|
|
224
|
+
F as Controller,
|
|
225
|
+
K as parseMergedHandlers
|
|
226
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import i from "react";
|
|
2
|
+
import { Controller as c, parseMergedHandlers as d } from "../../core/dist/use-gesture-core.esm.mjs";
|
|
3
|
+
import { r as a, e as p } from "../../core/dist/actions-fe213e88.esm.mjs";
|
|
4
|
+
import { C as A, E as H, f as R } from "../../core/dist/actions-fe213e88.esm.mjs";
|
|
5
|
+
function f(r, n = {}, t, o) {
|
|
6
|
+
const e = i.useMemo(() => new c(r), []);
|
|
7
|
+
if (e.applyHandlers(r, o), e.applyConfig(n, t), i.useEffect(e.effect.bind(e)), i.useEffect(() => e.clean.bind(e), []), n.target === void 0)
|
|
8
|
+
return e.bind.bind(e);
|
|
9
|
+
}
|
|
10
|
+
function E(r, n) {
|
|
11
|
+
return a(p), f({
|
|
12
|
+
drag: r
|
|
13
|
+
}, n || {}, "drag");
|
|
14
|
+
}
|
|
15
|
+
function b(r) {
|
|
16
|
+
return r.forEach(a), function(t, o) {
|
|
17
|
+
const {
|
|
18
|
+
handlers: e,
|
|
19
|
+
nativeHandlers: s,
|
|
20
|
+
config: u
|
|
21
|
+
} = d(t, o || {});
|
|
22
|
+
return f(e, u, void 0, s);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
A as ConfigResolverMap,
|
|
27
|
+
H as EngineMap,
|
|
28
|
+
b as createUseGesture,
|
|
29
|
+
p as dragAction,
|
|
30
|
+
R as pinchAction,
|
|
31
|
+
a as registerAction,
|
|
32
|
+
E as useDrag
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __read as i } from "../../../tslib/tslib.es6.mjs";
|
|
2
|
+
import { useRef as m, useState as c, useCallback as f } from "react";
|
|
3
|
+
import s from "../useUnmount/index.mjs";
|
|
4
|
+
function v(a) {
|
|
5
|
+
var t = m(0), e = i(c(a), 2), r = e[0], n = e[1], u = f(function(o) {
|
|
6
|
+
cancelAnimationFrame(t.current), t.current = requestAnimationFrame(function() {
|
|
7
|
+
n(o);
|
|
8
|
+
});
|
|
9
|
+
}, []);
|
|
10
|
+
return s(function() {
|
|
11
|
+
cancelAnimationFrame(t.current);
|
|
12
|
+
}), [r, u];
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
v as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __read as d } from "../../../tslib/tslib.es6.mjs";
|
|
2
|
+
import s from "../../../resize-observer-polyfill/dist/ResizeObserver.es.mjs";
|
|
3
|
+
import l from "../useRafState/index.mjs";
|
|
4
|
+
import { getTargetElement as o } from "../utils/domTarget.mjs";
|
|
5
|
+
import g from "../utils/useIsomorphicLayoutEffectWithTarget.mjs";
|
|
6
|
+
function E(e) {
|
|
7
|
+
var i = d(l(function() {
|
|
8
|
+
var t = o(e);
|
|
9
|
+
return t ? {
|
|
10
|
+
width: t.clientWidth,
|
|
11
|
+
height: t.clientHeight
|
|
12
|
+
} : void 0;
|
|
13
|
+
}), 2), f = i[0], a = i[1];
|
|
14
|
+
return g(function() {
|
|
15
|
+
var t = o(e);
|
|
16
|
+
if (t) {
|
|
17
|
+
var r = new s(function(c) {
|
|
18
|
+
c.forEach(function(u) {
|
|
19
|
+
var n = u.target, h = n.clientWidth, m = n.clientHeight;
|
|
20
|
+
a({
|
|
21
|
+
width: h,
|
|
22
|
+
height: m
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return r.observe(t), function() {
|
|
27
|
+
r.disconnect();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}, [], e), f;
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
E as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e, { useContext as n } from "react";
|
|
2
|
+
import o from "../../locales/zh-CN.mjs";
|
|
3
|
+
const r = {
|
|
4
|
+
current: {
|
|
5
|
+
locale: o
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
function u() {
|
|
9
|
+
return r.current;
|
|
10
|
+
}
|
|
11
|
+
const f = e.createContext(null);
|
|
12
|
+
function l() {
|
|
13
|
+
var t;
|
|
14
|
+
return (t = n(f)) !== null && t !== void 0 ? t : u();
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
r as defaultConfigRef,
|
|
18
|
+
u as getDefaultConfig,
|
|
19
|
+
l as useConfig
|
|
20
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import a, { forwardRef as _, useState as y, useRef as I, useImperativeHandle as S, useCallback as h } from "react";
|
|
2
|
+
import { mergeProps as f } from "../../utils/with-default-props.mjs";
|
|
3
|
+
import { renderToContainer as p } from "../../utils/render-to-container.mjs";
|
|
4
|
+
import "../mask/mask.css.mjs";
|
|
5
|
+
import { Mask as g } from "../mask/mask.mjs";
|
|
6
|
+
import "../safe-area/safe-area.css.mjs";
|
|
7
|
+
import { SafeArea as C } from "../safe-area/safe-area.mjs";
|
|
8
|
+
import { Slide as k } from "./slide.mjs";
|
|
9
|
+
import { Slides as T } from "./slides.mjs";
|
|
10
|
+
import b from "../../../../classnames/index.mjs";
|
|
11
|
+
const m = "adm-image-viewer", x = {
|
|
12
|
+
maxZoom: 3,
|
|
13
|
+
getContainer: null,
|
|
14
|
+
visible: !1
|
|
15
|
+
}, A = (d) => {
|
|
16
|
+
var i, t, l;
|
|
17
|
+
const o = f(x, d), e = a.createElement(g, {
|
|
18
|
+
visible: o.visible,
|
|
19
|
+
disableBodyScroll: !1,
|
|
20
|
+
opacity: "thick",
|
|
21
|
+
afterClose: o.afterClose,
|
|
22
|
+
destroyOnClose: !0,
|
|
23
|
+
className: (i = o == null ? void 0 : o.classNames) === null || i === void 0 ? void 0 : i.mask
|
|
24
|
+
}, a.createElement("div", {
|
|
25
|
+
className: b(`${m}-content`, (t = o == null ? void 0 : o.classNames) === null || t === void 0 ? void 0 : t.body)
|
|
26
|
+
}, o.image && a.createElement(k, {
|
|
27
|
+
image: o.image,
|
|
28
|
+
onTap: o.onClose,
|
|
29
|
+
maxZoom: o.maxZoom
|
|
30
|
+
})), o.image && a.createElement("div", {
|
|
31
|
+
className: `${m}-footer`
|
|
32
|
+
}, (l = o.renderFooter) === null || l === void 0 ? void 0 : l.call(o, o.image), a.createElement(C, {
|
|
33
|
+
position: "bottom"
|
|
34
|
+
})));
|
|
35
|
+
return p(o.getContainer, e);
|
|
36
|
+
}, Z = Object.assign(Object.assign({}, x), {
|
|
37
|
+
defaultIndex: 0
|
|
38
|
+
}), D = _((d, i) => {
|
|
39
|
+
var t, l, o;
|
|
40
|
+
const e = f(Z, d), [r, v] = y(e.defaultIndex), u = I(null);
|
|
41
|
+
S(i, () => ({
|
|
42
|
+
swipeTo: (s, n) => {
|
|
43
|
+
var c;
|
|
44
|
+
v(s), (c = u.current) === null || c === void 0 || c.swipeTo(s, n);
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
const N = h((s) => {
|
|
48
|
+
var n;
|
|
49
|
+
s !== r && (v(s), (n = e.onIndexChange) === null || n === void 0 || n.call(e, s));
|
|
50
|
+
}, [e.onIndexChange, r]), E = a.createElement(g, {
|
|
51
|
+
visible: e.visible,
|
|
52
|
+
disableBodyScroll: !1,
|
|
53
|
+
opacity: "thick",
|
|
54
|
+
afterClose: e.afterClose,
|
|
55
|
+
destroyOnClose: !0,
|
|
56
|
+
className: (t = e == null ? void 0 : e.classNames) === null || t === void 0 ? void 0 : t.mask
|
|
57
|
+
}, a.createElement("div", {
|
|
58
|
+
className: b(`${m}-content`, (l = e == null ? void 0 : e.classNames) === null || l === void 0 ? void 0 : l.body)
|
|
59
|
+
}, e.images && a.createElement(T, {
|
|
60
|
+
ref: u,
|
|
61
|
+
defaultIndex: r,
|
|
62
|
+
onIndexChange: N,
|
|
63
|
+
images: e.images,
|
|
64
|
+
onTap: e.onClose,
|
|
65
|
+
maxZoom: e.maxZoom
|
|
66
|
+
})), e.images && a.createElement("div", {
|
|
67
|
+
className: `${m}-footer`
|
|
68
|
+
}, (o = e.renderFooter) === null || o === void 0 ? void 0 : o.call(e, e.images[r], r), a.createElement(C, {
|
|
69
|
+
position: "bottom"
|
|
70
|
+
})));
|
|
71
|
+
return p(e.getContainer, E);
|
|
72
|
+
});
|
|
73
|
+
export {
|
|
74
|
+
A as ImageViewer,
|
|
75
|
+
D as MultiImageViewer
|
|
76
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./image-viewer.css.mjs";
|
|
2
|
+
import { attachPropertiesToComponent as e } from "../../utils/attach-properties-to-component.mjs";
|
|
3
|
+
import { ImageViewer as r, MultiImageViewer as o } from "./image-viewer.mjs";
|
|
4
|
+
import { showImageViewer as i, clearImageViewer as m, showMultiImageViewer as t } from "./methods.mjs";
|
|
5
|
+
const a = e(o, {
|
|
6
|
+
show: t
|
|
7
|
+
}), I = e(r, {
|
|
8
|
+
Multi: a,
|
|
9
|
+
show: i,
|
|
10
|
+
clear: m
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
I as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import l from "react";
|
|
2
|
+
import { ImageViewer as i, MultiImageViewer as c } from "./image-viewer.mjs";
|
|
3
|
+
import { renderImperatively as n } from "../../utils/render-imperatively.mjs";
|
|
4
|
+
const r = /* @__PURE__ */ new Set();
|
|
5
|
+
function s(e) {
|
|
6
|
+
o();
|
|
7
|
+
const t = n(l.createElement(i, Object.assign({}, e, {
|
|
8
|
+
afterClose: () => {
|
|
9
|
+
var a;
|
|
10
|
+
r.delete(t), (a = e.afterClose) === null || a === void 0 || a.call(e);
|
|
11
|
+
}
|
|
12
|
+
})));
|
|
13
|
+
return r.add(t), t;
|
|
14
|
+
}
|
|
15
|
+
function u(e) {
|
|
16
|
+
o();
|
|
17
|
+
const t = n(l.createElement(c, Object.assign({}, e, {
|
|
18
|
+
afterClose: () => {
|
|
19
|
+
var a;
|
|
20
|
+
r.delete(t), (a = e.afterClose) === null || a === void 0 || a.call(e);
|
|
21
|
+
}
|
|
22
|
+
})));
|
|
23
|
+
return r.add(t), t;
|
|
24
|
+
}
|
|
25
|
+
function o() {
|
|
26
|
+
r.forEach((e) => {
|
|
27
|
+
e.close();
|
|
28
|
+
}), r.clear();
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
o as clearImageViewer,
|
|
32
|
+
s as showImageViewer,
|
|
33
|
+
u as showMultiImageViewer
|
|
34
|
+
};
|