@blocklet/launcher-layout 2.13.69 → 3.0.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/lib/compact-layout.js +27 -78
- package/lib/content.js +16 -18
- package/lib/context/step.js +61 -126
- package/lib/header.js +107 -203
- package/lib/index.js +153 -219
- package/lib/info-list.js +54 -41
- package/lib/launch-result-message.js +39 -63
- package/lib/locale.js +9 -8
- package/lib/markdown-body.js +15 -19
- package/lib/nav.js +138 -190
- package/lib/page-header.js +22 -38
- package/lib/small-circle-progress.js +38 -45
- package/lib/theme-provider.js +21 -38
- package/lib/wizard/hotkey-submit.js +19 -35
- package/lib/wizard/server-eula.js +50 -65
- package/lib/wizard/wizard-desc.js +147 -240
- package/package.json +14 -24
- package/lib/LaunchResultMessage/demo/default.js +0 -82
- package/lib/LaunchResultMessage/result-message.stories.js +0 -27
- package/lib/Layout/demo/child-progress-in-memory-mode.js +0 -70
- package/lib/Layout/demo/child-progress.js +0 -54
- package/lib/Layout/demo/constants.js +0 -76
- package/lib/Layout/demo/default.js +0 -54
- package/lib/Layout/demo/extra-nav.js +0 -108
- package/lib/Layout/demo/logo-url.js +0 -31
- package/lib/Layout/demo/longest-steps-for-launch.js +0 -95
- package/lib/Layout/demo/memory-mode.js +0 -49
- package/lib/Layout/demo/old-code-compatible.js +0 -36
- package/lib/Layout/demo/optional-step.js +0 -61
- package/lib/Layout/demo/show-child.js +0 -93
- package/lib/Layout/demo/static-demo-data.json +0 -85
- package/lib/Layout/layout.stories.js +0 -28
package/lib/header.js
CHANGED
|
@@ -1,184 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
logoUrl: logoUrl
|
|
46
|
-
})]
|
|
47
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
48
|
-
className: "header-title",
|
|
49
|
-
children: [isMobile && subTitle && /*#__PURE__*/_jsx("div", {
|
|
50
|
-
className: "header-title-sub",
|
|
51
|
-
children: subTitle
|
|
52
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
53
|
-
className: "app-name-content",
|
|
54
|
-
children: [!isMobile && /*#__PURE__*/_jsx("div", {
|
|
55
|
-
className: "launching-context",
|
|
56
|
-
children: subTitle || getLaunchingText(locale)
|
|
57
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
58
|
-
className: `header-title-name ${appNameSize === 'middle' || appNameSize === 'small' ? 'middle-size' : ''}`,
|
|
59
|
-
ref: appNameRef,
|
|
60
|
-
children: /*#__PURE__*/_jsx(AppTitle, {
|
|
61
|
-
logoUrl: logoUrl,
|
|
62
|
-
isMobile: isMobile,
|
|
63
|
-
blockletMeta: blockletMeta,
|
|
64
|
-
blockletSize: blockletSize,
|
|
65
|
-
loading: loading
|
|
66
|
-
})
|
|
67
|
-
})]
|
|
68
|
-
})]
|
|
69
|
-
})]
|
|
70
|
-
});
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import v from "@arcblock/ux/lib/Img";
|
|
3
|
+
import f from "@emotion/styled";
|
|
4
|
+
import { useMediaQuery as b, Skeleton as p } from "@mui/material";
|
|
5
|
+
import $ from "is-empty";
|
|
6
|
+
import o from "prop-types";
|
|
7
|
+
import { useRef as k, useState as N, useEffect as j } from "react";
|
|
8
|
+
import A from "url-join";
|
|
9
|
+
import S from "./assets/blocklet-default-logo.png";
|
|
10
|
+
import { getLaunchingText as z } from "./locale.js";
|
|
11
|
+
const g = (e) => (e == null ? void 0 : e.title) || (e == null ? void 0 : e.name) || "";
|
|
12
|
+
function T({ blockletMeta: e = {}, subTitle: n = "", logoUrl: i = "", locale: m = "", navLogo: d = "", loading: a = !1 }) {
|
|
13
|
+
const r = b((y) => y.breakpoints.down("md")), c = r ? 18 : 48, h = k(null), [s, x] = N("");
|
|
14
|
+
return j(() => {
|
|
15
|
+
h.current && h.current.offsetHeight > 34 && (s === "" ? x("middle") : s === "middle" && x("small"));
|
|
16
|
+
}, [s]), /* @__PURE__ */ l(R, { className: s === "small" ? "center-mode" : "", children: [
|
|
17
|
+
r ? /* @__PURE__ */ t("div", { className: "app-icon", children: d }) : /* @__PURE__ */ l("div", { className: "app-icon", children: [
|
|
18
|
+
a && /* @__PURE__ */ t(I, { blockletSize: c, isMobile: r }),
|
|
19
|
+
!a && /* @__PURE__ */ t(u, { blockletSize: c, logoUrl: i })
|
|
20
|
+
] }),
|
|
21
|
+
/* @__PURE__ */ l("div", { className: "header-title", children: [
|
|
22
|
+
r && n && /* @__PURE__ */ t("div", { className: "header-title-sub", children: n }),
|
|
23
|
+
/* @__PURE__ */ l("div", { className: "app-name-content", children: [
|
|
24
|
+
!r && /* @__PURE__ */ t("div", { className: "launching-context", children: n || z(m) }),
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: `header-title-name ${s === "middle" || s === "small" ? "middle-size" : ""}`,
|
|
29
|
+
ref: h,
|
|
30
|
+
children: /* @__PURE__ */ t(
|
|
31
|
+
w,
|
|
32
|
+
{
|
|
33
|
+
logoUrl: i,
|
|
34
|
+
isMobile: r,
|
|
35
|
+
blockletMeta: e,
|
|
36
|
+
blockletSize: c,
|
|
37
|
+
loading: a
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] })
|
|
43
|
+
] })
|
|
44
|
+
] });
|
|
71
45
|
}
|
|
72
|
-
|
|
73
|
-
blockletMeta:
|
|
74
|
-
subTitle:
|
|
75
|
-
logoUrl:
|
|
76
|
-
locale:
|
|
77
|
-
navLogo:
|
|
78
|
-
loading:
|
|
79
|
-
};
|
|
80
|
-
AppHeader.defaultProps = {
|
|
81
|
-
subTitle: '',
|
|
82
|
-
logoUrl: '',
|
|
83
|
-
locale: '',
|
|
84
|
-
navLogo: '',
|
|
85
|
-
loading: false,
|
|
86
|
-
blockletMeta: {}
|
|
46
|
+
T.propTypes = {
|
|
47
|
+
blockletMeta: o.object,
|
|
48
|
+
subTitle: o.any,
|
|
49
|
+
logoUrl: o.string,
|
|
50
|
+
locale: o.string,
|
|
51
|
+
navLogo: o.any,
|
|
52
|
+
loading: o.bool
|
|
87
53
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function AppIconSkeleton({
|
|
91
|
-
blockletSize,
|
|
92
|
-
isMobile
|
|
93
|
-
}) {
|
|
94
|
-
if (isMobile) {
|
|
95
|
-
return /*#__PURE__*/_jsx(Skeleton, {
|
|
96
|
-
variant: "rectangular",
|
|
97
|
-
width: 100,
|
|
98
|
-
height: 16,
|
|
99
|
-
alt: "icon",
|
|
100
|
-
style: {
|
|
101
|
-
marginTop: 4
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return /*#__PURE__*/_jsx(Skeleton, {
|
|
106
|
-
variant: "rectangular",
|
|
107
|
-
width: blockletSize,
|
|
108
|
-
height: blockletSize
|
|
109
|
-
});
|
|
54
|
+
function I({ blockletSize: e, isMobile: n }) {
|
|
55
|
+
return n ? /* @__PURE__ */ t(p, { variant: "rectangular", width: 100, height: 16, alt: "icon", style: { marginTop: 4 } }) : /* @__PURE__ */ t(p, { variant: "rectangular", width: e, height: e });
|
|
110
56
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
style: {
|
|
125
|
-
verticalAlign: 'text-bottom'
|
|
126
|
-
}
|
|
127
|
-
}, `layout-app-icon-${logoUrl}`);
|
|
57
|
+
function u({ logoUrl: e, blockletSize: n }) {
|
|
58
|
+
return /* @__PURE__ */ t(
|
|
59
|
+
v,
|
|
60
|
+
{
|
|
61
|
+
width: n,
|
|
62
|
+
height: n,
|
|
63
|
+
src: e,
|
|
64
|
+
alt: "blocklet icon",
|
|
65
|
+
fallback: S,
|
|
66
|
+
style: { verticalAlign: "text-bottom" }
|
|
67
|
+
},
|
|
68
|
+
`layout-app-icon-${e}`
|
|
69
|
+
);
|
|
128
70
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
alt: "icon",
|
|
145
|
-
style: {
|
|
146
|
-
marginTop: 4
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
if (isEmpty(blockletMeta)) {
|
|
151
|
-
return /*#__PURE__*/_jsx(Skeleton, {
|
|
152
|
-
variant: "rectangular",
|
|
153
|
-
animation: false,
|
|
154
|
-
width: 100,
|
|
155
|
-
height: 16,
|
|
156
|
-
alt: "icon",
|
|
157
|
-
style: {
|
|
158
|
-
marginTop: 4
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (isMobile) {
|
|
163
|
-
return /*#__PURE__*/_jsxs(MobileTitleStyle, {
|
|
164
|
-
children: [/*#__PURE__*/_jsx(AppIcon, {
|
|
165
|
-
blockletSize: blockletSize,
|
|
166
|
-
logoUrl: logoUrl
|
|
167
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
168
|
-
className: "ellipsis-title",
|
|
169
|
-
children: getBlockletDisplayName(blockletMeta)
|
|
170
|
-
})]
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
return /*#__PURE__*/_jsx(AppLink, {
|
|
174
|
-
className: "app-link",
|
|
175
|
-
target: "_blank",
|
|
176
|
-
href: joinUrl(blockletMeta?.registryUrl || '', `/blocklets/${blockletMeta?.did}`),
|
|
177
|
-
title: name,
|
|
178
|
-
children: name
|
|
179
|
-
});
|
|
71
|
+
function w({ isMobile: e, logoUrl: n, blockletMeta: i = {}, blockletSize: m, loading: d }) {
|
|
72
|
+
const a = g(i);
|
|
73
|
+
return d ? /* @__PURE__ */ t(p, { variant: "rectangular", width: 100, height: 16, alt: "icon", style: { marginTop: 4 } }) : $(i) ? /* @__PURE__ */ t(p, { variant: "rectangular", animation: !1, width: 100, height: 16, alt: "icon", style: { marginTop: 4 } }) : e ? /* @__PURE__ */ l(L, { children: [
|
|
74
|
+
/* @__PURE__ */ t(u, { blockletSize: m, logoUrl: n }),
|
|
75
|
+
/* @__PURE__ */ t("span", { className: "ellipsis-title", children: g(i) })
|
|
76
|
+
] }) : /* @__PURE__ */ t(
|
|
77
|
+
E,
|
|
78
|
+
{
|
|
79
|
+
className: "app-link",
|
|
80
|
+
target: "_blank",
|
|
81
|
+
href: A((i == null ? void 0 : i.registryUrl) || "", `/blocklets/${i == null ? void 0 : i.did}`),
|
|
82
|
+
title: a,
|
|
83
|
+
children: a
|
|
84
|
+
}
|
|
85
|
+
);
|
|
180
86
|
}
|
|
181
|
-
const
|
|
87
|
+
const L = f.div`
|
|
182
88
|
.ellipsis-title {
|
|
183
89
|
flex: 1;
|
|
184
90
|
position: absolute;
|
|
@@ -190,21 +96,17 @@ const MobileTitleStyle = styled.div`
|
|
|
190
96
|
overflow: hidden;
|
|
191
97
|
text-overflow: ellipsis;
|
|
192
98
|
|
|
193
|
-
${
|
|
99
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
194
100
|
left: 26px;
|
|
195
101
|
width: calc(100% - 26px);
|
|
196
102
|
}
|
|
197
103
|
}
|
|
198
104
|
`;
|
|
199
|
-
|
|
200
|
-
blockletMeta:
|
|
105
|
+
w.propTypes = {
|
|
106
|
+
blockletMeta: o.object
|
|
201
107
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
};
|
|
205
|
-
export default AppHeader;
|
|
206
|
-
const AppLink = styled.a`
|
|
207
|
-
color: ${props => props.theme.palette.text.primary};
|
|
108
|
+
const E = f.a`
|
|
109
|
+
color: ${(e) => e.theme.palette.text.primary};
|
|
208
110
|
text-decoration: none;
|
|
209
111
|
overflow: hidden;
|
|
210
112
|
text-overflow: ellipsis;
|
|
@@ -228,23 +130,22 @@ const AppLink = styled.a`
|
|
|
228
130
|
font-weight: 700;
|
|
229
131
|
-webkit-font-smoothing: antialiased;
|
|
230
132
|
|
|
231
|
-
${
|
|
133
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
232
134
|
display: block;
|
|
233
135
|
max-width: calc(100vw - 150px);
|
|
234
136
|
white-space: nowrap;
|
|
235
137
|
overflow: hidden;
|
|
236
138
|
text-overflow: ellipsis;
|
|
237
139
|
}
|
|
238
|
-
|
|
239
|
-
const Container = styled.div`
|
|
140
|
+
`, R = f.div`
|
|
240
141
|
display: flex;
|
|
241
142
|
justify-content: flex-start;
|
|
242
143
|
align-items: flex-start;
|
|
243
144
|
width: 100%;
|
|
244
|
-
${
|
|
145
|
+
${(e) => e.theme.breakpoints.up("md")} {
|
|
245
146
|
min-height: 70px;
|
|
246
147
|
}
|
|
247
|
-
${
|
|
148
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
248
149
|
align-items: center;
|
|
249
150
|
}
|
|
250
151
|
.app-name-content {
|
|
@@ -252,11 +153,11 @@ const Container = styled.div`
|
|
|
252
153
|
display: flex;
|
|
253
154
|
align-items: center;
|
|
254
155
|
justify-content: center;
|
|
255
|
-
${
|
|
156
|
+
${(e) => e.theme.breakpoints.up("md")} {
|
|
256
157
|
align-items: flex-start;
|
|
257
158
|
flex-direction: column;
|
|
258
159
|
}
|
|
259
|
-
${
|
|
160
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
260
161
|
justify-content: flex-start;
|
|
261
162
|
height: 22px;
|
|
262
163
|
}
|
|
@@ -265,11 +166,11 @@ const Container = styled.div`
|
|
|
265
166
|
flex-shrink: 0;
|
|
266
167
|
font-size: 14px;
|
|
267
168
|
font-weight: 600;
|
|
268
|
-
color: ${
|
|
269
|
-
${
|
|
169
|
+
color: ${(e) => e.theme.palette.text.secondary};
|
|
170
|
+
${(e) => e.theme.breakpoints.up("md")} {
|
|
270
171
|
margin-bottom: 4px;
|
|
271
172
|
}
|
|
272
|
-
${
|
|
173
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
273
174
|
font-size: 14px;
|
|
274
175
|
line-height: 15px;
|
|
275
176
|
&:after {
|
|
@@ -283,7 +184,7 @@ const Container = styled.div`
|
|
|
283
184
|
&.center-mode {
|
|
284
185
|
align-items: flex-start;
|
|
285
186
|
.launching-context {
|
|
286
|
-
${
|
|
187
|
+
${(e) => e.theme.breakpoints.up("sm")} {
|
|
287
188
|
margin-bottom: 0;
|
|
288
189
|
}
|
|
289
190
|
}
|
|
@@ -304,7 +205,7 @@ const Container = styled.div`
|
|
|
304
205
|
justify-content: space-around;
|
|
305
206
|
align-items: flex-start;
|
|
306
207
|
margin-left: 24px;
|
|
307
|
-
${
|
|
208
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
308
209
|
margin-left: 16px;
|
|
309
210
|
}
|
|
310
211
|
.header-title-name {
|
|
@@ -314,16 +215,16 @@ const Container = styled.div`
|
|
|
314
215
|
align-items: center;
|
|
315
216
|
flex: 1;
|
|
316
217
|
height: 100%;
|
|
317
|
-
color: ${
|
|
218
|
+
color: ${(e) => e.theme.palette.text.primary};
|
|
318
219
|
font-weight: 700;
|
|
319
|
-
${
|
|
220
|
+
${(e) => e.theme.breakpoints.up("sm")} {
|
|
320
221
|
font-size: 18px;
|
|
321
222
|
|
|
322
223
|
&.middle-size {
|
|
323
224
|
font-size: 16px;
|
|
324
225
|
}
|
|
325
226
|
}
|
|
326
|
-
${
|
|
227
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
327
228
|
display: block;
|
|
328
229
|
max-width: calc(100vw - 100px);
|
|
329
230
|
font-size: 16px;
|
|
@@ -334,15 +235,18 @@ const Container = styled.div`
|
|
|
334
235
|
}
|
|
335
236
|
|
|
336
237
|
.header-title-sub {
|
|
337
|
-
color: ${
|
|
238
|
+
color: ${(e) => e.theme.palette.grey[700]};
|
|
338
239
|
font-size: 12px;
|
|
339
240
|
line-height: 16px;
|
|
340
241
|
|
|
341
|
-
${
|
|
242
|
+
${(e) => e.theme.breakpoints.down("md")} {
|
|
342
243
|
white-space: nowrap;
|
|
343
244
|
overflow: hidden;
|
|
344
245
|
text-overflow: ellipsis;
|
|
345
246
|
}
|
|
346
247
|
}
|
|
347
248
|
}
|
|
348
|
-
`;
|
|
249
|
+
`;
|
|
250
|
+
export {
|
|
251
|
+
T as default
|
|
252
|
+
};
|