@arcblock/ux 3.0.8 → 3.0.10
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/lib/Address/did-address.js +47 -49
- package/lib/Address/responsive-did-address.js +53 -57
- package/lib/Avatar/index.js +16 -16
- package/lib/BlockletV2/blocklet.js +64 -64
- package/lib/BlockletV2/components/tooltip-icon.js +26 -27
- package/lib/CardSelector/index.js +1 -2
- package/lib/ClickToCopy/hook.js +10 -11
- package/lib/ClickToCopy/index.js +16 -16
- package/lib/Config/theme-mode-toggle.js +7 -8
- package/lib/DID/index.js +131 -133
- package/lib/DIDConnect/app-info-item.js +18 -18
- package/lib/DIDConnect/auth-apps/index.js +83 -84
- package/lib/DIDConnect/did-connect-container.js +89 -90
- package/lib/DIDConnect/did-connect-footer.js +25 -25
- package/lib/DIDConnect/landing-page.js +17 -17
- package/lib/DIDConnect/powered-by.js +11 -11
- package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
- package/lib/DIDConnect/with-container.js +66 -68
- package/lib/Dialog/use-confirm.js +40 -43
- package/lib/Earth/index.js +21 -22
- package/lib/Footer/index.js +15 -16
- package/lib/Header/responsive-header.js +23 -24
- package/lib/Layout/dashboard/index.js +63 -72
- package/lib/Layout/dashboard/sidebar.js +20 -21
- package/lib/Layout/dashboard-legacy/index.js +52 -52
- package/lib/Locale/context.js +36 -37
- package/lib/Locale/selector.js +40 -42
- package/lib/NFTDisplay/index.js +114 -118
- package/lib/NFTDisplay/render-svg.js +12 -12
- package/lib/NavMenu/nav-menu.js +159 -161
- package/lib/NavMenu/sub-container.js +25 -26
- package/lib/PageScroller/index.js +28 -32
- package/lib/Passport/passport.js +11 -11
- package/lib/PhoneInput/country-select.js +38 -38
- package/lib/PhoneInput/index.js +65 -66
- package/lib/Screenshot/index.js +26 -27
- package/lib/SessionBlocklet/index.js +87 -93
- package/lib/SessionPermission/index.js +5 -9
- package/lib/SessionUser/components/did-space.js +24 -25
- package/lib/SessionUser/components/logged-in.js +122 -127
- package/lib/SessionUser/components/quick-login-item.js +41 -42
- package/lib/SessionUser/components/session-user-item.js +35 -36
- package/lib/SessionUser/components/session-user-switch.js +81 -85
- package/lib/SessionUser/components/un-login.js +41 -41
- package/lib/SessionUser/components/user-info.js +43 -47
- package/lib/SessionUser/index.js +1 -1
- package/lib/SessionUser/libs/utils.js +24 -30
- package/lib/SharedBridge/index.js +35 -35
- package/lib/Theme/index.js +16 -16
- package/lib/Theme/theme.js +42 -43
- package/lib/Toast/index.js +24 -25
- package/lib/Typography/index.js +42 -42
- package/lib/UserCard/Content/basic.js +91 -93
- package/lib/UserCard/Content/shorten-label.js +9 -9
- package/lib/UserCard/components.js +15 -15
- package/lib/Util/deprecate.js +1 -1
- package/lib/Util/federated.js +28 -32
- package/lib/Util/iframe.js +9 -10
- package/lib/Util/index.js +134 -135
- package/lib/Util/security.js +9 -10
- package/lib/Util/wallet.js +6 -9
- package/lib/VerificationCode/index.js +26 -28
- package/lib/hooks/use-blocklet-logo.js +11 -14
- package/lib/ux.css +1 -1
- package/lib/withTracker/index.js +13 -14
- package/package.json +9 -10
package/lib/Passport/passport.js
CHANGED
@@ -6,24 +6,24 @@ import u from "../NFTDisplay/index.js";
|
|
6
6
|
import { useLocaleContext as y } from "../Locale/context.js";
|
7
7
|
function b({
|
8
8
|
passport: e,
|
9
|
-
user:
|
9
|
+
user: a,
|
10
10
|
color: n,
|
11
11
|
width: t = 150,
|
12
|
-
icon:
|
13
|
-
createPassportSvg:
|
12
|
+
icon: s = null,
|
13
|
+
createPassportSvg: o,
|
14
14
|
// inherit props
|
15
15
|
children: d,
|
16
|
-
...
|
16
|
+
...m
|
17
17
|
}) {
|
18
18
|
const { t: c } = y();
|
19
19
|
return /* @__PURE__ */ r(
|
20
20
|
i,
|
21
21
|
{
|
22
|
-
...
|
22
|
+
...m,
|
23
23
|
sx: {
|
24
24
|
display: "flex",
|
25
25
|
alignItems: "center",
|
26
|
-
...
|
26
|
+
...m?.sx
|
27
27
|
},
|
28
28
|
children: [
|
29
29
|
!!e.display && /* @__PURE__ */ l(i, { className: "passport-item__display", sx: { width: t }, children: /* @__PURE__ */ l(
|
@@ -39,13 +39,13 @@ function b({
|
|
39
39
|
{
|
40
40
|
className: "passport-item__display",
|
41
41
|
dangerouslySetInnerHTML: {
|
42
|
-
__html:
|
42
|
+
__html: o({
|
43
43
|
title: e.scope === "kyc" ? e.name : e.title,
|
44
44
|
issuer: e.issuer && e.issuer.name,
|
45
45
|
issuerDid: e.issuer && e.issuer.id,
|
46
|
-
ownerName:
|
47
|
-
ownerDid:
|
48
|
-
ownerAvatarUrl:
|
46
|
+
ownerName: a.fullName,
|
47
|
+
ownerDid: a.did,
|
48
|
+
ownerAvatarUrl: a.avatar,
|
49
49
|
revoked: e.revoked,
|
50
50
|
scope: e.scope,
|
51
51
|
role: e.role,
|
@@ -92,7 +92,7 @@ function b({
|
|
92
92
|
}
|
93
93
|
},
|
94
94
|
children: [
|
95
|
-
|
95
|
+
s,
|
96
96
|
e.revoked && /* @__PURE__ */ l(x, {})
|
97
97
|
]
|
98
98
|
}
|
@@ -1,30 +1,30 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { useState as O, useMemo as
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { useState as O, useMemo as g } from "react";
|
3
3
|
import { Box as C, Typography as a, Select as z, TextField as j, MenuItem as k } from "@mui/material";
|
4
|
-
import { defaultCountries as
|
5
|
-
import
|
6
|
-
import { mergeSx as
|
7
|
-
function
|
8
|
-
ref:
|
9
|
-
value:
|
10
|
-
onChange:
|
4
|
+
import { defaultCountries as s, parseCountry as d, FlagEmoji as y } from "react-international-phone";
|
5
|
+
import D from "@arcblock/icons/lib/ArrowDown";
|
6
|
+
import { mergeSx as P } from "../Util/style.js";
|
7
|
+
function F({
|
8
|
+
ref: x = void 0,
|
9
|
+
value: r,
|
10
|
+
onChange: w = void 0,
|
11
11
|
sx: I = {},
|
12
12
|
selectCountryProps: M = void 0,
|
13
|
-
preview:
|
13
|
+
preview: u = !1,
|
14
14
|
valueField: v = "iso2",
|
15
|
-
...
|
15
|
+
...c
|
16
16
|
}) {
|
17
|
-
const { hideFlag:
|
18
|
-
const e =
|
19
|
-
return
|
20
|
-
}, [
|
21
|
-
if (!n) return
|
17
|
+
const { hideFlag: p = !0, hideDialCode: h = !1 } = M || {}, [n, S] = O(""), m = g(() => {
|
18
|
+
const e = s.find((o) => o[1] === r);
|
19
|
+
return r && e ? d(e) : { name: "", iso2: "", dialCode: "" };
|
20
|
+
}, [r]), b = g(() => {
|
21
|
+
if (!n) return s;
|
22
22
|
const e = n.toLowerCase();
|
23
|
-
return
|
24
|
-
const
|
25
|
-
return
|
23
|
+
return s.filter((o) => {
|
24
|
+
const l = d(o);
|
25
|
+
return l.name.toLowerCase().includes(e) || l.iso2.toLowerCase().includes(e) || l.dialCode.includes(e);
|
26
26
|
});
|
27
|
-
}, [n]),
|
27
|
+
}, [n]), f = /* @__PURE__ */ i(
|
28
28
|
C,
|
29
29
|
{
|
30
30
|
sx: {
|
@@ -32,27 +32,27 @@ function L({
|
|
32
32
|
alignItems: "center",
|
33
33
|
flexWrap: "nowrap",
|
34
34
|
gap: 0.5,
|
35
|
-
cursor:
|
35
|
+
cursor: u ? "default" : "pointer"
|
36
36
|
},
|
37
37
|
children: [
|
38
|
-
|
39
|
-
/* @__PURE__ */ t(a, { component: "span", sx: { lineHeight: 1.5 }, children:
|
38
|
+
p ? null : /* @__PURE__ */ t(y, { iso2: r, style: { display: "flex", width: 24, color: "inherit" } }),
|
39
|
+
/* @__PURE__ */ t(a, { component: "span", sx: { lineHeight: 1.5 }, children: h ? m?.name : `+${m?.dialCode}` })
|
40
40
|
]
|
41
41
|
}
|
42
42
|
);
|
43
|
-
return
|
43
|
+
return u ? f : /* @__PURE__ */ i(
|
44
44
|
z,
|
45
45
|
{
|
46
|
-
...
|
47
|
-
ref:
|
46
|
+
...c,
|
47
|
+
ref: x,
|
48
48
|
MenuProps: {
|
49
49
|
style: { maxHeight: 400, top: 2, zIndex: 9999 },
|
50
50
|
// 默认 zIndex 为 1300, 但是在 SwipeableDrawer 中需要设置为 9999
|
51
51
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
52
52
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
53
|
-
...
|
53
|
+
...c.MenuProps ?? {}
|
54
54
|
},
|
55
|
-
sx:
|
55
|
+
sx: P(
|
56
56
|
{
|
57
57
|
'&.Mui-focused:has(div[aria-expanded="false"])': { fieldset: { display: "block" } },
|
58
58
|
".MuiSelect-select": { padding: 1, paddingRight: "24px !important" },
|
@@ -69,10 +69,10 @@ function L({
|
|
69
69
|
},
|
70
70
|
I
|
71
71
|
),
|
72
|
-
value:
|
73
|
-
onChange: (e) =>
|
74
|
-
IconComponent: (e) => /* @__PURE__ */ t(
|
75
|
-
renderValue: () =>
|
72
|
+
value: r,
|
73
|
+
onChange: (e) => w?.(e.target.value),
|
74
|
+
IconComponent: (e) => /* @__PURE__ */ t(D, { ...e, width: 20, height: 20 }),
|
75
|
+
renderValue: () => f,
|
76
76
|
children: [
|
77
77
|
/* @__PURE__ */ t(C, { sx: { p: 1, position: "sticky", top: 0, bgcolor: "background.paper", zIndex: 1 }, children: /* @__PURE__ */ t(
|
78
78
|
j,
|
@@ -87,9 +87,9 @@ function L({
|
|
87
87
|
}
|
88
88
|
) }),
|
89
89
|
b.map((e) => {
|
90
|
-
const o =
|
91
|
-
return /* @__PURE__ */
|
92
|
-
|
90
|
+
const o = d(e);
|
91
|
+
return /* @__PURE__ */ i(k, { value: o[v], children: [
|
92
|
+
p ? null : /* @__PURE__ */ t(y, { iso2: o.iso2, style: { marginRight: 8, width: 24 } }),
|
93
93
|
/* @__PURE__ */ t(
|
94
94
|
a,
|
95
95
|
{
|
@@ -99,7 +99,7 @@ function L({
|
|
99
99
|
children: o.name
|
100
100
|
}
|
101
101
|
),
|
102
|
-
|
102
|
+
h ? null : /* @__PURE__ */ i(a, { color: "gray", children: [
|
103
103
|
"(+",
|
104
104
|
o.dialCode,
|
105
105
|
")"
|
@@ -110,7 +110,7 @@ function L({
|
|
110
110
|
}
|
111
111
|
);
|
112
112
|
}
|
113
|
-
const
|
113
|
+
const q = F;
|
114
114
|
export {
|
115
|
-
|
115
|
+
q as default
|
116
116
|
};
|
package/lib/PhoneInput/index.js
CHANGED
@@ -1,55 +1,54 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { useMemo as
|
3
|
-
import { Box as
|
4
|
-
import { parsePhoneNumber as
|
5
|
-
import { defaultCountries as
|
6
|
-
import
|
1
|
+
import { jsxs as D, jsx as y } from "react/jsx-runtime";
|
2
|
+
import { useMemo as g, useState as F, useCallback as k } from "react";
|
3
|
+
import { Box as $, Typography as A, TextField as L } from "@mui/material";
|
4
|
+
import { parsePhoneNumber as b } from "awesome-phonenumber";
|
5
|
+
import { defaultCountries as d, parseCountry as f, usePhoneInput as R } from "react-international-phone";
|
6
|
+
import I from "./country-select.js";
|
7
7
|
import { mergeSx as q } from "../Util/style.js";
|
8
|
-
function
|
9
|
-
var c, h;
|
8
|
+
function x(e, t, n = "") {
|
10
9
|
if (!e) return !1;
|
11
|
-
const r = e.replace(/[\s\-()]+/g, ""), u = n ||
|
12
|
-
if (
|
10
|
+
const r = e.replace(/[\s\-()]+/g, ""), u = n || w(t);
|
11
|
+
if (m(u) === m(r))
|
13
12
|
return !0;
|
14
|
-
const a =
|
15
|
-
return a.valid && (a.type === "mobile" || a.type === "fixed-line-or-mobile") &&
|
13
|
+
const a = b(e, { regionCode: t }), l = a.number?.input.replace(/[\s\-()]+/g, "");
|
14
|
+
return a.valid && (a.type === "mobile" || a.type === "fixed-line-or-mobile") && l === a.number?.e164;
|
16
15
|
}
|
17
|
-
function
|
16
|
+
function P(e, t) {
|
18
17
|
return e ? e.replace(new RegExp(`^\\+${t}`), "") : "";
|
19
18
|
}
|
20
|
-
function
|
19
|
+
function V(e, t) {
|
21
20
|
return e ? e.startsWith("+") ? e : `+${t}${e}` : `+${t}`;
|
22
21
|
}
|
23
|
-
function
|
22
|
+
function m(e) {
|
24
23
|
return e.replace(/^\+/, "");
|
25
24
|
}
|
26
|
-
function
|
27
|
-
const n =
|
25
|
+
function v(e, t) {
|
26
|
+
const n = d.find((r) => f(r).iso2 === e);
|
28
27
|
if (n)
|
29
|
-
return
|
28
|
+
return f(n)[t];
|
30
29
|
}
|
31
|
-
function
|
32
|
-
return
|
30
|
+
function w(e) {
|
31
|
+
return v(e, "dialCode") || "";
|
33
32
|
}
|
34
33
|
function U(e) {
|
35
|
-
return
|
34
|
+
return v(e, "name") || "";
|
36
35
|
}
|
37
36
|
function X(e) {
|
38
37
|
try {
|
39
38
|
if (!e) return;
|
40
39
|
if (e.startsWith("+")) {
|
41
|
-
const t =
|
40
|
+
const t = b(e);
|
42
41
|
if (t.valid)
|
43
42
|
return t.regionCode.toLowerCase();
|
44
|
-
for (const n of
|
45
|
-
const r =
|
46
|
-
if (e.startsWith(`+${r.dialCode}`) &&
|
43
|
+
for (const n of d) {
|
44
|
+
const r = f(n);
|
45
|
+
if (e.startsWith(`+${r.dialCode}`) && x(e, r.dialCode, r.iso2))
|
47
46
|
return r.iso2;
|
48
47
|
}
|
49
48
|
} else
|
50
|
-
for (const t of
|
51
|
-
const n =
|
52
|
-
if (
|
49
|
+
for (const t of d) {
|
50
|
+
const n = f(t), r = `+${n.dialCode}${e}`;
|
51
|
+
if (x(r, n.dialCode, n.iso2))
|
53
52
|
return n.iso2;
|
54
53
|
}
|
55
54
|
return;
|
@@ -64,56 +63,56 @@ function Y({
|
|
64
63
|
countryDisplayOptions: r = {},
|
65
64
|
preview: u = !1,
|
66
65
|
allowDial: a = !0,
|
67
|
-
...
|
66
|
+
...l
|
68
67
|
}) {
|
69
|
-
const
|
68
|
+
const p = g(() => {
|
70
69
|
const o = /* @__PURE__ */ new Map();
|
71
|
-
return
|
72
|
-
const s =
|
70
|
+
return d.forEach((i) => {
|
71
|
+
const s = f(i);
|
73
72
|
o.set(s.iso2, s);
|
74
73
|
}), o;
|
75
|
-
}, []), [
|
74
|
+
}, []), [B, M] = F(e), E = k(
|
76
75
|
(o) => {
|
77
76
|
if (!u && t) {
|
78
77
|
const i = {
|
79
78
|
...e,
|
80
79
|
...o
|
81
|
-
}, s =
|
82
|
-
s && (i.phone =
|
80
|
+
}, s = p.get(i.country);
|
81
|
+
s && (i.phone = V(i.phone, m(s.dialCode))), t(i);
|
83
82
|
}
|
84
83
|
},
|
85
|
-
[t, u, e,
|
86
|
-
),
|
87
|
-
const o =
|
88
|
-
return o ?
|
89
|
-
}, [e.country,
|
84
|
+
[t, u, e, p]
|
85
|
+
), h = g(() => {
|
86
|
+
const o = p.get(e.country);
|
87
|
+
return o ? m(o.dialCode) : "";
|
88
|
+
}, [e.country, p]), { phone: c, country: C, handlePhoneValueChange: S, setCountry: T } = R({
|
90
89
|
defaultCountry: e.country,
|
91
|
-
value:
|
92
|
-
countries:
|
90
|
+
value: P(e.phone, h),
|
91
|
+
countries: d,
|
93
92
|
disableDialCodeAndPrefix: !0,
|
94
93
|
onChange: (o) => {
|
95
94
|
const i = {
|
96
95
|
...o,
|
97
|
-
phone:
|
96
|
+
phone: B.country !== o.country && !o.phone ? P(e.phone, h) : o.phone
|
98
97
|
};
|
99
98
|
M(i), E(i);
|
100
99
|
}
|
101
|
-
}),
|
102
|
-
() =>
|
103
|
-
[
|
100
|
+
}), W = g(
|
101
|
+
() => c || P(e.phone, h),
|
102
|
+
[c, e.phone, h]
|
104
103
|
), j = (o) => {
|
105
104
|
u || T(o);
|
106
105
|
};
|
107
106
|
if (u) {
|
108
|
-
const o =
|
109
|
-
return /* @__PURE__ */
|
110
|
-
|
107
|
+
const o = V(c, w(C)), i = c && x(o, C), s = a && i;
|
108
|
+
return /* @__PURE__ */ D(
|
109
|
+
$,
|
111
110
|
{
|
112
111
|
component: s ? "a" : "div",
|
113
|
-
href: s ? `tel:${
|
112
|
+
href: s ? `tel:${c}` : void 0,
|
114
113
|
...s ? {
|
115
|
-
"aria-label": `Call ${
|
116
|
-
title: `Call ${
|
114
|
+
"aria-label": `Call ${c}`,
|
115
|
+
title: `Call ${c}`,
|
117
116
|
rel: "nofollow",
|
118
117
|
itemProp: "telephone"
|
119
118
|
} : {},
|
@@ -128,14 +127,14 @@ function Y({
|
|
128
127
|
}
|
129
128
|
},
|
130
129
|
children: [
|
131
|
-
/* @__PURE__ */
|
132
|
-
/* @__PURE__ */
|
130
|
+
/* @__PURE__ */ y(I, { value: C, preview: u }),
|
131
|
+
/* @__PURE__ */ y(A, { sx: { ml: 0.5 }, children: W })
|
133
132
|
]
|
134
133
|
}
|
135
134
|
);
|
136
135
|
}
|
137
|
-
return /* @__PURE__ */
|
138
|
-
|
136
|
+
return /* @__PURE__ */ D(
|
137
|
+
$,
|
139
138
|
{
|
140
139
|
sx: {
|
141
140
|
display: "flex",
|
@@ -143,20 +142,20 @@ function Y({
|
|
143
142
|
gap: 0.5
|
144
143
|
},
|
145
144
|
children: [
|
146
|
-
/* @__PURE__ */
|
147
|
-
|
145
|
+
/* @__PURE__ */ y(
|
146
|
+
I,
|
148
147
|
{
|
149
|
-
value:
|
148
|
+
value: C,
|
150
149
|
onChange: j,
|
151
150
|
preview: !1,
|
152
151
|
selectCountryProps: r
|
153
152
|
}
|
154
153
|
),
|
155
|
-
/* @__PURE__ */
|
154
|
+
/* @__PURE__ */ y(
|
156
155
|
L,
|
157
156
|
{
|
158
|
-
...
|
159
|
-
value:
|
157
|
+
...l,
|
158
|
+
value: W,
|
160
159
|
onChange: S,
|
161
160
|
placeholder: n,
|
162
161
|
className: "phone-input",
|
@@ -166,11 +165,11 @@ function Y({
|
|
166
165
|
padding: 1
|
167
166
|
}
|
168
167
|
},
|
169
|
-
|
168
|
+
l.sx
|
170
169
|
// 这里传入的可能是一个数组或一个对象
|
171
170
|
),
|
172
171
|
slotProps: {
|
173
|
-
input:
|
172
|
+
input: l.InputProps ?? {}
|
174
173
|
}
|
175
174
|
}
|
176
175
|
)
|
@@ -182,6 +181,6 @@ export {
|
|
182
181
|
Y as default,
|
183
182
|
X as detectCountryFromPhone,
|
184
183
|
U as getCountryNameByCountry,
|
185
|
-
|
186
|
-
|
184
|
+
w as getDialCodeByCountry,
|
185
|
+
x as validatePhoneNumber
|
187
186
|
};
|
package/lib/Screenshot/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { jsx as s, jsxs as
|
2
|
-
import { useRef as
|
1
|
+
import { jsx as s, jsxs as x } from "react/jsx-runtime";
|
2
|
+
import { useRef as N, useState as f, useEffect as k, Children as v, cloneElement as S, createElement as $ } from "react";
|
3
3
|
import a from "lodash/isUndefined";
|
4
|
-
import { mergeProps as
|
5
|
-
import { styled as
|
6
|
-
import
|
4
|
+
import { mergeProps as z } from "../Util/index.js";
|
5
|
+
import { styled as g } from "../Theme/index.js";
|
6
|
+
import C from "./BaseScreenshot/index.js";
|
7
7
|
/* empty css */
|
8
8
|
const u = {
|
9
9
|
"iphone-x": {
|
@@ -71,34 +71,33 @@ const u = {
|
|
71
71
|
width: 200,
|
72
72
|
scale: 1
|
73
73
|
}
|
74
|
-
},
|
74
|
+
}, j = {
|
75
75
|
img: ["alt", "title", "src", "srcSet", "sizes", "loading", "key", "children"],
|
76
76
|
video: ["alt", "title", "muted", "autoplay", "loop", "key", "children"]
|
77
|
-
},
|
78
|
-
|
77
|
+
}, E = (t) => [
|
78
|
+
$(
|
79
79
|
t.type,
|
80
|
-
|
80
|
+
j[t.type].reduce((e, i) => (e[i] = t.props[i], e), {})
|
81
81
|
)
|
82
|
-
],
|
82
|
+
], b = (t, e = !0) => {
|
83
83
|
for (let i = 0; i < t.length; i++) {
|
84
84
|
const r = t[i];
|
85
85
|
if (["img", "video"].includes(r.type))
|
86
|
-
return
|
86
|
+
return E(r);
|
87
87
|
if (r.props && r.props.children) {
|
88
|
-
const n =
|
88
|
+
const n = v.toArray(r.props.children), o = b(n, !1);
|
89
89
|
if (o)
|
90
90
|
return o;
|
91
91
|
}
|
92
92
|
}
|
93
93
|
return e ? t : null;
|
94
94
|
};
|
95
|
-
function
|
96
|
-
var f;
|
95
|
+
function w(t) {
|
97
96
|
const e = Object.assign({}, t);
|
98
97
|
a(e.type) && (e.type = "iphone-x"), a(e.className) && (e.className = ""), a(e.style) && (e.style = {}), a(e.width) && (e.width = 0), a(e.height) && (e.height = 0);
|
99
|
-
const i =
|
100
|
-
return /* @__PURE__ */
|
101
|
-
|
98
|
+
const i = z(e, w, ["style", "width", "height"]), { type: r, children: n, style: o, className: c, width: p, height: m, ...l } = i, { zIndex: h = 0, borderRadius: d = 0 } = u[r] || {};
|
99
|
+
return /* @__PURE__ */ x(
|
100
|
+
O,
|
102
101
|
{
|
103
102
|
...l,
|
104
103
|
type: r,
|
@@ -107,7 +106,7 @@ function y(t) {
|
|
107
106
|
contentRadius: d,
|
108
107
|
contentZIndex: h,
|
109
108
|
children: [
|
110
|
-
/* @__PURE__ */ s("div", { className: "device-frame", children: /* @__PURE__ */ s("div", { className: "device-content", children: (
|
109
|
+
/* @__PURE__ */ s("div", { className: "device-frame", children: /* @__PURE__ */ s("div", { className: "device-content", children: b(v.toArray(n))?.map((y, R) => S(y, { key: R })) }) }),
|
111
110
|
/* @__PURE__ */ s("div", { className: "device-stripe" }),
|
112
111
|
/* @__PURE__ */ s("div", { className: "device-header" }),
|
113
112
|
/* @__PURE__ */ s("div", { className: "device-sensors" }),
|
@@ -117,7 +116,7 @@ function y(t) {
|
|
117
116
|
}
|
118
117
|
);
|
119
118
|
}
|
120
|
-
const
|
119
|
+
const O = g("div")`
|
121
120
|
@media (max-width: ${(t) => u[t.type].width}px) {
|
122
121
|
transform-origin: 0 0;
|
123
122
|
transform: scale(${(t) => u[t.type].scale});
|
@@ -136,9 +135,9 @@ const H = b("div")`
|
|
136
135
|
height: 100.1%;
|
137
136
|
}
|
138
137
|
`;
|
139
|
-
function
|
140
|
-
const e =
|
141
|
-
return
|
138
|
+
function H({ ...t }) {
|
139
|
+
const e = N(null), [i, r] = f(), [n, o] = f(null);
|
140
|
+
return k(() => {
|
142
141
|
let c = null;
|
143
142
|
const p = () => {
|
144
143
|
const { clientWidth: m } = e.current, { clientWidth: l, clientHeight: h } = e.current.children[0], d = m / l;
|
@@ -147,18 +146,18 @@ function P({ ...t }) {
|
|
147
146
|
return e.current && (c = new ResizeObserver(p), c.observe(e.current)), () => {
|
148
147
|
c && c.disconnect();
|
149
148
|
};
|
150
|
-
}, [e.current]), /* @__PURE__ */ s(
|
149
|
+
}, [e.current]), /* @__PURE__ */ s(P, { ref: e, style: { height: i }, children: /* @__PURE__ */ s(w, { ...t, style: { transform: n ? `scale(${n})` : void 0 } }) });
|
151
150
|
}
|
152
|
-
const
|
151
|
+
const P = g("div")`
|
153
152
|
div[type] {
|
154
153
|
transform: scale(1);
|
155
154
|
transform-origin: 0 0;
|
156
155
|
}
|
157
156
|
`;
|
158
|
-
function
|
157
|
+
function Z({ type: t, src: e = "", children: i, sx: r = {}, ...n }) {
|
159
158
|
const o = t.toLowerCase();
|
160
|
-
return ["phone", "macbook"].includes(o) ? /* @__PURE__ */ s(
|
159
|
+
return ["phone", "macbook"].includes(o) ? /* @__PURE__ */ s(C, { type: o, sx: r, ...n, children: i || (e ? /* @__PURE__ */ s("img", { src: e, alt: "screenshot" }) : null) }) : /* @__PURE__ */ s(H, { type: t, sx: { ...r, margin: "auto" }, ...n, children: i || (e ? /* @__PURE__ */ s("img", { src: e, alt: "screenshot" }) : null) });
|
161
160
|
}
|
162
161
|
export {
|
163
|
-
|
162
|
+
Z as default
|
164
163
|
};
|