@blocklet/launcher-layout 2.3.19 → 2.3.21
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 +55 -34
- package/lib/content.js +67 -20
- package/lib/context/step.js +19 -28
- package/lib/header.js +224 -91
- package/lib/index.js +198 -101
- package/lib/info-list.js +45 -0
- package/lib/launch-result-message.js +116 -55
- package/lib/locale.js +1 -8
- package/lib/markdown-body.js +52 -0
- package/lib/nav.js +300 -51
- package/lib/page-header.js +51 -38
- package/lib/theme-provider.js +24 -32
- package/lib/wizard/server-eula.js +60 -41
- package/lib/wizard/wizard-desc.js +187 -96
- package/package.json +19 -31
- package/es/assets/blocklet-default-logo.png +0 -0
- package/es/compact-layout.js +0 -114
- package/es/content.js +0 -72
- package/es/context/step.js +0 -137
- package/es/header.js +0 -337
- package/es/index.js +0 -307
- package/es/launch-result-message.js +0 -144
- package/es/locale.js +0 -13
- package/es/nav.js +0 -405
- package/es/page-header.js +0 -66
- package/es/theme-provider.js +0 -41
- package/es/wizard/server-eula.js +0 -96
- package/es/wizard/wizard-desc.js +0 -238
package/lib/compact-layout.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
children,
|
|
17
|
-
bottom,
|
|
18
|
-
onBottomFix
|
|
19
|
-
} = _ref;
|
|
20
|
-
const mainCon = (0, _react.useRef)(null);
|
|
21
|
-
const childsCon = (0, _react.useRef)(null);
|
|
22
|
-
const compactCon = (0, _react.useRef)(null);
|
|
23
|
-
const isFix = (0, _react.useRef)(null);
|
|
24
|
-
const [scrollMode, setScrollMode] = (0, _react.useState)(false);
|
|
25
|
-
(0, _react.useEffect)(() => {
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
function CompactLayout({
|
|
6
|
+
children,
|
|
7
|
+
bottom,
|
|
8
|
+
onBottomFix
|
|
9
|
+
}) {
|
|
10
|
+
const mainCon = useRef(null);
|
|
11
|
+
const childsCon = useRef(null);
|
|
12
|
+
const compactCon = useRef(null);
|
|
13
|
+
const isFix = useRef(null);
|
|
14
|
+
const [scrollMode, setScrollMode] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
26
16
|
let inTimer;
|
|
27
17
|
const fixSize = () => {
|
|
28
18
|
if (inTimer) {
|
|
@@ -66,28 +56,59 @@ function CompactLayout(_ref) {
|
|
|
66
56
|
}
|
|
67
57
|
};
|
|
68
58
|
}, [onBottomFix]);
|
|
69
|
-
return /*#__PURE__*/(
|
|
59
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
70
60
|
ref: mainCon,
|
|
71
|
-
className:
|
|
72
|
-
children: [/*#__PURE__*/(
|
|
61
|
+
className: `${scrollMode ? 'scroll-mode' : ''}`,
|
|
62
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
73
63
|
className: "compact-context",
|
|
74
64
|
ref: childsCon,
|
|
75
65
|
children: children
|
|
76
|
-
}), /*#__PURE__*/(
|
|
66
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
77
67
|
className: "fix-container",
|
|
78
68
|
ref: compactCon,
|
|
79
69
|
children: bottom
|
|
80
70
|
})]
|
|
81
71
|
});
|
|
82
72
|
}
|
|
83
|
-
const Container =
|
|
73
|
+
const Container = styled.div`
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
width: 100%;
|
|
77
|
+
height: 100%;
|
|
78
|
+
animation: fadein ease 0.5s;
|
|
79
|
+
|
|
80
|
+
.fix-container {
|
|
81
|
+
margin-top: auto;
|
|
82
|
+
width: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.scroll-mode {
|
|
86
|
+
.compact-context {
|
|
87
|
+
flex: 1;
|
|
88
|
+
overflow-y: auto;
|
|
89
|
+
}
|
|
90
|
+
.fix-container {
|
|
91
|
+
margin-top: auto;
|
|
92
|
+
flex-shrink: 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@keyframes fadein {
|
|
97
|
+
0% {
|
|
98
|
+
opacity: 0;
|
|
99
|
+
}
|
|
100
|
+
100% {
|
|
101
|
+
opacity: 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
84
105
|
CompactLayout.propTypes = {
|
|
85
|
-
children:
|
|
86
|
-
bottom:
|
|
87
|
-
onBottomFix:
|
|
106
|
+
children: PropTypes.any,
|
|
107
|
+
bottom: PropTypes.element.isRequired,
|
|
108
|
+
onBottomFix: PropTypes.func
|
|
88
109
|
};
|
|
89
110
|
CompactLayout.defaultProps = {
|
|
90
111
|
children: [],
|
|
91
112
|
onBottomFix: () => {}
|
|
92
113
|
};
|
|
93
|
-
|
|
114
|
+
export default CompactLayout;
|
package/lib/content.js
CHANGED
|
@@ -1,25 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
var _templateObject;
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
|
-
function Content(_ref) {
|
|
14
|
-
let {
|
|
15
|
-
children
|
|
16
|
-
} = _ref;
|
|
17
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
function Content({
|
|
5
|
+
children
|
|
6
|
+
}) {
|
|
7
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
18
8
|
children: children
|
|
19
9
|
});
|
|
20
10
|
}
|
|
21
11
|
Content.propTypes = {
|
|
22
|
-
children:
|
|
12
|
+
children: PropTypes.any.isRequired
|
|
23
13
|
};
|
|
24
|
-
|
|
25
|
-
const Container =
|
|
14
|
+
export default Content;
|
|
15
|
+
const Container = styled.div`
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
height: 100%;
|
|
19
|
+
width: 100%;
|
|
20
|
+
|
|
21
|
+
.center {
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.page-title {
|
|
27
|
+
text-align: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.toolbar {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
align-items: center;
|
|
34
|
+
|
|
35
|
+
.toolbar_title {
|
|
36
|
+
color: ${props => props.theme.palette.grey['900']};
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.page-footer {
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
align-items: center;
|
|
45
|
+
|
|
46
|
+
width: 100%;
|
|
47
|
+
background: ${props => props.theme.palette.common.white};
|
|
48
|
+
|
|
49
|
+
.create-button {
|
|
50
|
+
margin-right: 32px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
& > button,
|
|
54
|
+
.button {
|
|
55
|
+
margin: 0 8px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
59
|
+
padding: 24px;
|
|
60
|
+
& > button,
|
|
61
|
+
.button {
|
|
62
|
+
margin: 0 12px;
|
|
63
|
+
min-width: 200px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
68
|
+
margin-top: auto;
|
|
69
|
+
padding: 16px;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
package/lib/context/step.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.StepProvider = StepProvider;
|
|
7
|
-
exports.useStepContext = useStepContext;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const StepContext = /*#__PURE__*/(0, _react.createContext)();
|
|
1
|
+
import { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const StepContext = /*#__PURE__*/createContext();
|
|
13
5
|
const {
|
|
14
6
|
Provider
|
|
15
7
|
} = StepContext;
|
|
16
|
-
const matchPath =
|
|
17
|
-
let currentPathname = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.location.pathname.replace(/\/$/, '/');
|
|
8
|
+
const matchPath = (path, exact, currentPathname = window.location.pathname.replace(/\/$/, '/')) => {
|
|
18
9
|
if (!path) {
|
|
19
10
|
return false;
|
|
20
11
|
}
|
|
@@ -23,13 +14,12 @@ const matchPath = function matchPath(path, exact) {
|
|
|
23
14
|
}
|
|
24
15
|
return new RegExp(path).test(currentPathname);
|
|
25
16
|
};
|
|
26
|
-
function StepProvider(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const [activeStepKey, setActiveStepKey] = (0, _react.useState)('');
|
|
17
|
+
function StepProvider({
|
|
18
|
+
children,
|
|
19
|
+
steps,
|
|
20
|
+
mode
|
|
21
|
+
}) {
|
|
22
|
+
const [activeStepKey, setActiveStepKey] = useState('');
|
|
33
23
|
if (!activeStepKey && steps.length) {
|
|
34
24
|
setActiveStepKey(steps[0].key);
|
|
35
25
|
}
|
|
@@ -91,7 +81,7 @@ function StepProvider(_ref) {
|
|
|
91
81
|
}
|
|
92
82
|
}
|
|
93
83
|
const activeStep = totalSteps.findIndex(e => e.key === activeStepKey);
|
|
94
|
-
|
|
84
|
+
useEffect(() => {
|
|
95
85
|
if (mode === 'history') {
|
|
96
86
|
let stepKey = '';
|
|
97
87
|
steps.some(step => {
|
|
@@ -128,19 +118,20 @@ function StepProvider(_ref) {
|
|
|
128
118
|
return mode === 'memory' && activeStep !== 0 && nodeIndex < activeStep;
|
|
129
119
|
}
|
|
130
120
|
};
|
|
131
|
-
return /*#__PURE__*/(
|
|
121
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
132
122
|
value: value,
|
|
133
123
|
children: children
|
|
134
124
|
});
|
|
135
125
|
}
|
|
136
126
|
function useStepContext() {
|
|
137
|
-
return
|
|
127
|
+
return useContext(StepContext);
|
|
138
128
|
}
|
|
139
129
|
StepProvider.propTypes = {
|
|
140
|
-
children:
|
|
141
|
-
steps:
|
|
142
|
-
mode:
|
|
130
|
+
children: PropTypes.any.isRequired,
|
|
131
|
+
steps: PropTypes.array.isRequired,
|
|
132
|
+
mode: PropTypes.string
|
|
143
133
|
};
|
|
144
134
|
StepProvider.defaultProps = {
|
|
145
135
|
mode: 'history'
|
|
146
|
-
};
|
|
136
|
+
};
|
|
137
|
+
export { StepProvider, useStepContext };
|