@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.
@@ -1,41 +1,24 @@
1
- import { createContext, useEffect, useState, useContext } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
4
- import { ThemeProvider as UxThemeProvider, create } from '@arcblock/ux/lib/Theme';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const defaultTheme = create({});
7
- const ThemeContext = /*#__PURE__*/createContext({});
8
- export default function ThemeProvider({
9
- children,
10
- theme: _theme
11
- } = {}) {
12
- const [theme, setTheme] = useState(defaultTheme);
13
- useEffect(() => {
14
- if (_theme && typeof _theme === 'object') setTheme(_theme);
15
- }, [_theme]);
16
- if (theme) {
17
- return /*#__PURE__*/_jsx(ThemeContext.Provider, {
18
- value: theme,
19
- children: /*#__PURE__*/_jsx(ThemeContext.Consumer, {
20
- children: themeValue => {
21
- return /*#__PURE__*/_jsx(UxThemeProvider, {
22
- theme: themeValue,
23
- children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
24
- theme: themeValue,
25
- children: children
26
- })
27
- });
28
- }
29
- })
30
- });
31
- }
32
- return children;
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as u, useState as f, useEffect as c, use as h } from "react";
3
+ import n from "prop-types";
4
+ import { ThemeProvider as d } from "@emotion/react";
5
+ import { create as p, ThemeProvider as T } from "@arcblock/ux/lib/Theme";
6
+ const a = p({}), t = u({});
7
+ function v({ children: o, theme: e } = {}) {
8
+ const [i, s] = f(a);
9
+ return c(() => {
10
+ e && typeof e == "object" && s(e);
11
+ }, [e]), i ? /* @__PURE__ */ r(t, { value: i, children: /* @__PURE__ */ r(t.Consumer, { children: (m) => /* @__PURE__ */ r(T, { theme: m, children: /* @__PURE__ */ r(d, { theme: m, children: o }) }) }) }) : o;
33
12
  }
34
- ThemeProvider.propTypes = {
35
- children: PropTypes.any.isRequired,
36
- theme: PropTypes.object.isRequired
13
+ v.propTypes = {
14
+ children: n.any.isRequired,
15
+ theme: n.object.isRequired
37
16
  };
38
- function useThemeContext() {
39
- return useContext(ThemeContext);
17
+ function j() {
18
+ return h(t);
40
19
  }
41
- export { ThemeProvider, useThemeContext };
20
+ export {
21
+ v as ThemeProvider,
22
+ v as default,
23
+ j as useThemeContext
24
+ };
@@ -1,39 +1,23 @@
1
- import { useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- /**
5
- * This component should be used only once in each page,
6
- * otherwise all registered events will be triggered when the user presses the Meta(Ctrl)+Enter key combination,
7
- * which may not be consistent with the actual business logic.
8
- */
9
- export default function SubmitHotKey({
10
- disabled,
11
- children,
12
- onConfirm
13
- }) {
14
- useEffect(() => {
15
- if (disabled) {
16
- return () => {};
17
- }
18
- const listener = event => {
19
- if (event.code === 'Enter' && (event.metaKey === true || event.ctrlKey === true)) {
20
- event.preventDefault();
21
- event.stopPropagation();
22
- onConfirm();
23
- }
1
+ import { useEffect as u } from "react";
2
+ import r from "prop-types";
3
+ function s({ disabled: t = !1, children: i, onConfirm: o }) {
4
+ return u(() => {
5
+ if (t)
6
+ return () => {
7
+ };
8
+ const n = (e) => {
9
+ e.code === "Enter" && (e.metaKey === !0 || e.ctrlKey === !0) && (e.preventDefault(), e.stopPropagation(), o());
24
10
  };
25
- document.addEventListener('keydown', listener);
26
- return () => {
27
- document.removeEventListener('keydown', listener);
11
+ return document.addEventListener("keydown", n), () => {
12
+ document.removeEventListener("keydown", n);
28
13
  };
29
- }, [disabled, onConfirm]);
30
- return children;
14
+ }, [t, o]), i;
31
15
  }
32
- SubmitHotKey.propTypes = {
33
- disabled: PropTypes.bool,
34
- children: PropTypes.any.isRequired,
35
- onConfirm: PropTypes.func.isRequired
16
+ s.propTypes = {
17
+ disabled: r.bool,
18
+ children: r.any.isRequired,
19
+ onConfirm: r.func.isRequired
20
+ };
21
+ export {
22
+ s as default
36
23
  };
37
- SubmitHotKey.defaultProps = {
38
- disabled: false
39
- };
@@ -1,91 +1,74 @@
1
- /* eslint-disable react/jsx-wrap-multilines */
2
- import { useState } from 'react';
3
- import styled from '@emotion/styled';
4
- import PropTypes from 'prop-types';
5
- import { CircularProgress } from '@mui/material';
6
- import Button from '@arcblock/ux/lib/Button';
7
- import Dialog from '@arcblock/ux/lib/Dialog';
8
- import SubmitHotKey from './hotkey-submit';
9
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
- function ServerEula({
11
- onContinue,
12
- nextDisabled,
13
- launching,
14
- texts,
15
- description
1
+ import { jsxs as o, Fragment as l, jsx as t } from "react/jsx-runtime";
2
+ import { useState as c } from "react";
3
+ import u from "@emotion/styled";
4
+ import n from "prop-types";
5
+ import { CircularProgress as h } from "@mui/material";
6
+ import f from "@arcblock/ux/lib/Button";
7
+ import x from "@arcblock/ux/lib/Dialog";
8
+ import g from "./hotkey-submit.js";
9
+ function b({
10
+ onContinue: e,
11
+ nextDisabled: r = !1,
12
+ launching: s = !1,
13
+ texts: i = {
14
+ listenName: "",
15
+ launchingText: "",
16
+ buttonNext: ""
17
+ },
18
+ description: m = ""
16
19
  }) {
17
- const [open, setOpen] = useState(false);
18
- const handleOpen = () => setOpen(x => !x);
19
- return /*#__PURE__*/_jsxs(_Fragment, {
20
- children: [/*#__PURE__*/_jsx(Div, {
21
- children: /*#__PURE__*/_jsxs(SubmitHotKey, {
22
- disabled: nextDisabled,
23
- onConfirm: onContinue,
24
- children: [/*#__PURE__*/_jsx("div", {
25
- className: "eula-trigger",
26
- onClick: handleOpen,
27
- children: texts.listenName
28
- }), /*#__PURE__*/_jsx(Button, {
29
- disabled: nextDisabled,
20
+ const [p, a] = c(!1);
21
+ return /* @__PURE__ */ o(l, { children: [
22
+ /* @__PURE__ */ t(y, { children: /* @__PURE__ */ o(g, { disabled: r, onConfirm: e, children: [
23
+ /* @__PURE__ */ t("div", { className: "eula-trigger", onClick: () => a((d) => !d), children: i.listenName }),
24
+ /* @__PURE__ */ t(
25
+ f,
26
+ {
27
+ disabled: r,
30
28
  color: "primary",
31
29
  variant: "contained",
32
30
  className: "next-button",
33
- onClick: onContinue,
34
- children: launching ? /*#__PURE__*/_jsxs(_Fragment, {
35
- children: [/*#__PURE__*/_jsx(CircularProgress, {
36
- size: 14
37
- }), texts.launchingText]
38
- }) : texts.buttonNext
39
- })]
40
- })
41
- }), /*#__PURE__*/_jsx(Dialog, {
42
- open: open,
43
- title: texts.listenName,
44
- onClose: () => setOpen(false),
45
- children: description
46
- })]
47
- });
31
+ onClick: e,
32
+ children: s ? /* @__PURE__ */ o(l, { children: [
33
+ /* @__PURE__ */ t(h, { size: 14 }),
34
+ i.launchingText
35
+ ] }) : i.buttonNext
36
+ }
37
+ )
38
+ ] }) }),
39
+ /* @__PURE__ */ t(x, { open: p, title: i.listenName, onClose: () => a(!1), children: m })
40
+ ] });
48
41
  }
49
- ServerEula.propTypes = {
50
- onContinue: PropTypes.func.isRequired,
51
- nextDisabled: PropTypes.bool,
52
- launching: PropTypes.bool,
53
- description: PropTypes.any,
54
- texts: PropTypes.object
42
+ b.propTypes = {
43
+ onContinue: n.func.isRequired,
44
+ nextDisabled: n.bool,
45
+ launching: n.bool,
46
+ description: n.any,
47
+ texts: n.object
55
48
  };
56
- ServerEula.defaultProps = {
57
- nextDisabled: false,
58
- launching: false,
59
- description: '',
60
- texts: {
61
- listenName: '',
62
- launchingText: '',
63
- buttonNext: ''
64
- }
65
- };
66
- const Div = styled.div`
49
+ const y = u.div`
67
50
  margin: 0 auto;
68
51
  display: flex;
69
52
  justify-content: space-between;
70
53
  align-items: center;
71
54
 
72
- @media (max-width: ${props => props.theme.breakpoints.values.sm}px) {
55
+ @media (max-width: ${(e) => e.theme.breakpoints.values.sm}px) {
73
56
  flex-direction: column;
74
57
  }
75
58
 
76
59
  .eula-trigger {
77
60
  cursor: pointer;
78
61
  text-decoration: underline;
79
- ${props => props.theme.breakpoints.up('md')} {
62
+ ${(e) => e.theme.breakpoints.up("md")} {
80
63
  padding-right: 24px;
81
64
  }
82
- ${props => props.theme.breakpoints.down('md')} {
65
+ ${(e) => e.theme.breakpoints.down("md")} {
83
66
  padding: 16px;
84
67
  }
85
68
  font-size: 14px;
86
69
  white-space: nowrap;
87
70
  &:hover {
88
- color: ${props => props.theme.palette.primary.main};
71
+ color: ${(e) => e.theme.palette.primary.main};
89
72
  }
90
73
  }
91
74
 
@@ -93,4 +76,6 @@ const Div = styled.div`
93
76
  min-width: 200px;
94
77
  }
95
78
  `;
96
- export default ServerEula;
79
+ export {
80
+ b as default
81
+ };