@blocklet/launcher-layout 3.0.9 → 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/header.js +33 -33
- package/lib/nav.js +32 -33
- package/package.json +3 -3
package/lib/header.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import b from "@arcblock/ux/lib/Img";
|
|
3
3
|
import f from "@emotion/styled";
|
|
4
|
-
import { useMediaQuery as
|
|
5
|
-
import
|
|
4
|
+
import { useMediaQuery as v, Skeleton as p } from "@mui/material";
|
|
5
|
+
import k from "is-empty";
|
|
6
6
|
import o from "prop-types";
|
|
7
|
-
import { useRef as
|
|
7
|
+
import { useRef as $, useState as N, useEffect as j } from "react";
|
|
8
8
|
import A from "url-join";
|
|
9
9
|
import S from "./assets/blocklet-default-logo.png";
|
|
10
10
|
import { getLaunchingText as z } from "./locale.js";
|
|
11
|
-
const g = (e) =>
|
|
12
|
-
function T({ blockletMeta: e = {}, subTitle:
|
|
13
|
-
const
|
|
11
|
+
const g = (e) => e?.title || e?.name || "";
|
|
12
|
+
function T({ blockletMeta: e = {}, subTitle: i = "", logoUrl: n = "", locale: m = "", navLogo: c = "", loading: a = !1 }) {
|
|
13
|
+
const l = v((y) => y.breakpoints.down("md")), d = l ? 18 : 48, h = $(null), [r, x] = N("");
|
|
14
14
|
return j(() => {
|
|
15
|
-
h.current && h.current.offsetHeight > 34 && (
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
a && /* @__PURE__ */ t(I, { blockletSize:
|
|
19
|
-
!a && /* @__PURE__ */ t(u, { blockletSize:
|
|
15
|
+
h.current && h.current.offsetHeight > 34 && (r === "" ? x("middle") : r === "middle" && x("small"));
|
|
16
|
+
}, [r]), /* @__PURE__ */ s(R, { className: r === "small" ? "center-mode" : "", children: [
|
|
17
|
+
l ? /* @__PURE__ */ t("div", { className: "app-icon", children: c }) : /* @__PURE__ */ s("div", { className: "app-icon", children: [
|
|
18
|
+
a && /* @__PURE__ */ t(I, { blockletSize: d, isMobile: l }),
|
|
19
|
+
!a && /* @__PURE__ */ t(u, { blockletSize: d, logoUrl: n })
|
|
20
20
|
] }),
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
!
|
|
21
|
+
/* @__PURE__ */ s("div", { className: "header-title", children: [
|
|
22
|
+
l && i && /* @__PURE__ */ t("div", { className: "header-title-sub", children: i }),
|
|
23
|
+
/* @__PURE__ */ s("div", { className: "app-name-content", children: [
|
|
24
|
+
!l && /* @__PURE__ */ t("div", { className: "launching-context", children: i || z(m) }),
|
|
25
25
|
/* @__PURE__ */ t(
|
|
26
26
|
"div",
|
|
27
27
|
{
|
|
28
|
-
className: `header-title-name ${
|
|
28
|
+
className: `header-title-name ${r === "middle" || r === "small" ? "middle-size" : ""}`,
|
|
29
29
|
ref: h,
|
|
30
30
|
children: /* @__PURE__ */ t(
|
|
31
31
|
w,
|
|
32
32
|
{
|
|
33
|
-
logoUrl:
|
|
34
|
-
isMobile:
|
|
33
|
+
logoUrl: n,
|
|
34
|
+
isMobile: l,
|
|
35
35
|
blockletMeta: e,
|
|
36
|
-
blockletSize:
|
|
36
|
+
blockletSize: d,
|
|
37
37
|
loading: a
|
|
38
38
|
}
|
|
39
39
|
)
|
|
@@ -51,15 +51,15 @@ T.propTypes = {
|
|
|
51
51
|
navLogo: o.any,
|
|
52
52
|
loading: o.bool
|
|
53
53
|
};
|
|
54
|
-
function I({ blockletSize: e, isMobile:
|
|
55
|
-
return
|
|
54
|
+
function I({ blockletSize: e, isMobile: i }) {
|
|
55
|
+
return i ? /* @__PURE__ */ t(p, { variant: "rectangular", width: 100, height: 16, alt: "icon", style: { marginTop: 4 } }) : /* @__PURE__ */ t(p, { variant: "rectangular", width: e, height: e });
|
|
56
56
|
}
|
|
57
|
-
function u({ logoUrl: e, blockletSize:
|
|
57
|
+
function u({ logoUrl: e, blockletSize: i }) {
|
|
58
58
|
return /* @__PURE__ */ t(
|
|
59
|
-
|
|
59
|
+
b,
|
|
60
60
|
{
|
|
61
|
-
width:
|
|
62
|
-
height:
|
|
61
|
+
width: i,
|
|
62
|
+
height: i,
|
|
63
63
|
src: e,
|
|
64
64
|
alt: "blocklet icon",
|
|
65
65
|
fallback: S,
|
|
@@ -68,17 +68,17 @@ function u({ logoUrl: e, blockletSize: n }) {
|
|
|
68
68
|
`layout-app-icon-${e}`
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
function w({ isMobile: e, logoUrl:
|
|
72
|
-
const a = g(
|
|
73
|
-
return
|
|
74
|
-
/* @__PURE__ */ t(u, { blockletSize: m, logoUrl:
|
|
75
|
-
/* @__PURE__ */ t("span", { className: "ellipsis-title", children: g(
|
|
71
|
+
function w({ isMobile: e, logoUrl: i, blockletMeta: n = {}, blockletSize: m, loading: c }) {
|
|
72
|
+
const a = g(n);
|
|
73
|
+
return c ? /* @__PURE__ */ t(p, { variant: "rectangular", width: 100, height: 16, alt: "icon", style: { marginTop: 4 } }) : k(n) ? /* @__PURE__ */ t(p, { variant: "rectangular", animation: !1, width: 100, height: 16, alt: "icon", style: { marginTop: 4 } }) : e ? /* @__PURE__ */ s(L, { children: [
|
|
74
|
+
/* @__PURE__ */ t(u, { blockletSize: m, logoUrl: i }),
|
|
75
|
+
/* @__PURE__ */ t("span", { className: "ellipsis-title", children: g(n) })
|
|
76
76
|
] }) : /* @__PURE__ */ t(
|
|
77
77
|
E,
|
|
78
78
|
{
|
|
79
79
|
className: "app-link",
|
|
80
80
|
target: "_blank",
|
|
81
|
-
href: A(
|
|
81
|
+
href: A(n?.registryUrl || "", `/blocklets/${n?.did}`),
|
|
82
82
|
title: a,
|
|
83
83
|
children: a
|
|
84
84
|
}
|
package/lib/nav.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Check as
|
|
4
|
-
import { Box as
|
|
2
|
+
import b from "@emotion/styled";
|
|
3
|
+
import { Check as T } from "@mui/icons-material";
|
|
4
|
+
import { Box as g, Skeleton as j, Tooltip as B, Button as m, Typography as A } from "@mui/material";
|
|
5
5
|
import s from "prop-types";
|
|
6
|
-
import { useStepContext as
|
|
7
|
-
import
|
|
8
|
-
function
|
|
6
|
+
import { useStepContext as P } from "./context/step.js";
|
|
7
|
+
import I from "./header.js";
|
|
8
|
+
function M({
|
|
9
9
|
blockletMeta: e,
|
|
10
|
-
logoUrl:
|
|
11
|
-
locale:
|
|
12
|
-
useOfSkeleton:
|
|
13
|
-
subTitle:
|
|
10
|
+
logoUrl: k = "",
|
|
11
|
+
locale: x = "",
|
|
12
|
+
useOfSkeleton: f = !1,
|
|
13
|
+
subTitle: u = "",
|
|
14
14
|
loading: d = !1,
|
|
15
15
|
extraNav: t = null,
|
|
16
|
-
sx:
|
|
16
|
+
sx: y
|
|
17
17
|
}) {
|
|
18
|
-
|
|
19
|
-
const { steps: $, activeStep: S, setActiveStepByKey: C, setActiveStepByIndex: z, getStepStatus: h, canBackToStep: T } = M(), c = y ? d : !1, j = (i, p) => {
|
|
18
|
+
const { steps: w, activeStep: v, setActiveStepByKey: $, setActiveStepByIndex: S, getStepStatus: h, canBackToStep: C } = P(), c = f ? d : !1, z = (i, p) => {
|
|
20
19
|
const n = ["step-block"], a = h(i.key);
|
|
21
20
|
switch (a) {
|
|
22
21
|
case "current":
|
|
@@ -37,14 +36,14 @@ function _({
|
|
|
37
36
|
n.push("always-step-child");
|
|
38
37
|
break;
|
|
39
38
|
}
|
|
40
|
-
return i.optional === !0 &&
|
|
39
|
+
return i.optional === !0 && v < p && n.push("step-optional"), n.join(" ");
|
|
41
40
|
};
|
|
42
|
-
return /* @__PURE__ */ l(
|
|
43
|
-
/* @__PURE__ */ o(
|
|
44
|
-
/* @__PURE__ */ o(
|
|
45
|
-
const n = !c &&
|
|
46
|
-
return /* @__PURE__ */ l("div", { className:
|
|
47
|
-
/* @__PURE__ */ o("div", { className: "step-icon", children: /* @__PURE__ */ o(
|
|
41
|
+
return /* @__PURE__ */ l(N, { sx: y, children: [
|
|
42
|
+
/* @__PURE__ */ o(I, { blockletMeta: e, loading: d, logoUrl: k, locale: x, subTitle: u }),
|
|
43
|
+
/* @__PURE__ */ o(_, { className: `${c ? "hide-child-step-desc" : ""}`, children: w.map((i, p) => {
|
|
44
|
+
const n = !c && C(p);
|
|
45
|
+
return /* @__PURE__ */ l("div", { className: z(i, p), children: [
|
|
46
|
+
/* @__PURE__ */ o("div", { className: "step-icon", children: /* @__PURE__ */ o(T, { style: { fontSize: 16 } }) }),
|
|
48
47
|
/* @__PURE__ */ o("div", { className: "step-line" }),
|
|
49
48
|
/* @__PURE__ */ l("div", { className: "step-content", title: i.name, children: [
|
|
50
49
|
/* @__PURE__ */ o(
|
|
@@ -54,13 +53,13 @@ function _({
|
|
|
54
53
|
onClick: () => {
|
|
55
54
|
if (n) {
|
|
56
55
|
if (i.key) {
|
|
57
|
-
|
|
56
|
+
$(i.key);
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
S(p);
|
|
61
60
|
}
|
|
62
61
|
},
|
|
63
|
-
children: c ? /* @__PURE__ */ o(
|
|
62
|
+
children: c ? /* @__PURE__ */ o(j, { variant: "text", width: 100 }) : i.name
|
|
64
63
|
}
|
|
65
64
|
),
|
|
66
65
|
i.description && /* @__PURE__ */ o("div", { className: "step-desc", children: i.description }),
|
|
@@ -80,10 +79,10 @@ function _({
|
|
|
80
79
|
] }, i.key);
|
|
81
80
|
}) }),
|
|
82
81
|
t && /* @__PURE__ */ l("div", { className: "extra-nav", children: [
|
|
83
|
-
t.tooltipText ? /* @__PURE__ */ o(
|
|
84
|
-
|
|
82
|
+
t.tooltipText ? /* @__PURE__ */ o(B, { title: t.tooltipText, children: /* @__PURE__ */ o(
|
|
83
|
+
m,
|
|
85
84
|
{
|
|
86
|
-
variant:
|
|
85
|
+
variant: t.buttonProps?.variant || "text",
|
|
87
86
|
onClick: () => {
|
|
88
87
|
t.link && window.open(t.link, "_blank");
|
|
89
88
|
},
|
|
@@ -94,9 +93,9 @@ function _({
|
|
|
94
93
|
children: t.text
|
|
95
94
|
}
|
|
96
95
|
) }) : /* @__PURE__ */ o(
|
|
97
|
-
|
|
96
|
+
m,
|
|
98
97
|
{
|
|
99
|
-
variant:
|
|
98
|
+
variant: t.buttonProps?.variant || "text",
|
|
100
99
|
onClick: () => {
|
|
101
100
|
t.link && window.open(t.link, "_blank");
|
|
102
101
|
},
|
|
@@ -108,7 +107,7 @@ function _({
|
|
|
108
107
|
}
|
|
109
108
|
),
|
|
110
109
|
t.description && /* @__PURE__ */ o(
|
|
111
|
-
|
|
110
|
+
A,
|
|
112
111
|
{
|
|
113
112
|
variant: "caption",
|
|
114
113
|
sx: { color: "text.secondary", mt: 0.5 },
|
|
@@ -120,7 +119,7 @@ function _({
|
|
|
120
119
|
] })
|
|
121
120
|
] });
|
|
122
121
|
}
|
|
123
|
-
const
|
|
122
|
+
const N = b(g)`
|
|
124
123
|
overflow-y: auto;
|
|
125
124
|
display: flex;
|
|
126
125
|
flex-direction: column;
|
|
@@ -168,7 +167,7 @@ const q = k(x)`
|
|
|
168
167
|
.extra-nav-button {
|
|
169
168
|
cursor: pointer;
|
|
170
169
|
}
|
|
171
|
-
`,
|
|
170
|
+
`, _ = b(g)`
|
|
172
171
|
display: flex;
|
|
173
172
|
flex-direction: column;
|
|
174
173
|
margin-top: 60px;
|
|
@@ -372,7 +371,7 @@ const q = k(x)`
|
|
|
372
371
|
}
|
|
373
372
|
}
|
|
374
373
|
`;
|
|
375
|
-
|
|
374
|
+
M.propTypes = {
|
|
376
375
|
blockletMeta: s.object.isRequired,
|
|
377
376
|
logoUrl: s.string,
|
|
378
377
|
locale: s.string,
|
|
@@ -383,5 +382,5 @@ _.propTypes = {
|
|
|
383
382
|
sx: s.any
|
|
384
383
|
};
|
|
385
384
|
export {
|
|
386
|
-
|
|
385
|
+
M as default
|
|
387
386
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-layout",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Common ux components of launcher",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react": "^19.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@arcblock/icons": "3.0.
|
|
46
|
+
"@arcblock/icons": "3.0.10",
|
|
47
47
|
"@blocklet/meta": "^1.16.44",
|
|
48
48
|
"@emotion/react": "^11.14.0",
|
|
49
49
|
"@emotion/styled": "^11.14.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"rehype-react": "^7.2.0",
|
|
56
56
|
"url-join": "^4.0.1"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "8e4b3b4f9cc52c8f1f1d270ab03a3c566073617a"
|
|
59
59
|
}
|