@astral/ui 4.71.3 → 4.71.4

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.
@@ -15,4 +15,10 @@ export type ThemeProviderProps = {
15
15
  */
16
16
  withScopedStyles?: boolean;
17
17
  };
18
+ /**
19
+ * Содержит:
20
+ * - Provider для доступа к theme
21
+ * - Установка глобальных стилей
22
+ * - ErrorBoundary для отлова ошибок рендера, включая ошибки загрузка js chunk
23
+ */
18
24
  export declare const ThemeProvider: (props: PropsWithChildren<ThemeProviderProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
3
3
  import { ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
4
+ import { ErrorBoundary } from '../ErrorBoundary';
4
5
  import { GlobalStyles } from '../GlobalStyles';
6
+ /**
7
+ * Содержит:
8
+ * - Provider для доступа к theme
9
+ * - Установка глобальных стилей
10
+ * - ErrorBoundary для отлова ошибок рендера, включая ошибки загрузка js chunk
11
+ */
5
12
  export const ThemeProvider = (props) => {
6
13
  const { children, theme, withScopedStyles = false } = props;
7
- return (_jsx(MuiThemeProvider, { theme: theme, children: _jsx(EmotionThemeProvider, { theme: theme, children: _jsx(GlobalStyles, { withScopedStyles: withScopedStyles, children: children }) }) }));
14
+ return (_jsx(ErrorBoundary, { children: _jsx(MuiThemeProvider, { theme: theme, children: _jsx(EmotionThemeProvider, { theme: theme, children: _jsx(GlobalStyles, { withScopedStyles: withScopedStyles, children: children }) }) }) }));
8
15
  };
@@ -15,4 +15,10 @@ export type ThemeProviderProps = {
15
15
  */
16
16
  withScopedStyles?: boolean;
17
17
  };
18
+ /**
19
+ * Содержит:
20
+ * - Provider для доступа к theme
21
+ * - Установка глобальных стилей
22
+ * - ErrorBoundary для отлова ошибок рендера, включая ошибки загрузка js chunk
23
+ */
18
24
  export declare const ThemeProvider: (props: PropsWithChildren<ThemeProviderProps>) => import("react/jsx-runtime").JSX.Element;
@@ -4,9 +4,16 @@ exports.ThemeProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("@emotion/react");
6
6
  const styles_1 = require("@mui/material/styles");
7
+ const ErrorBoundary_1 = require("../ErrorBoundary");
7
8
  const GlobalStyles_1 = require("../GlobalStyles");
9
+ /**
10
+ * Содержит:
11
+ * - Provider для доступа к theme
12
+ * - Установка глобальных стилей
13
+ * - ErrorBoundary для отлова ошибок рендера, включая ошибки загрузка js chunk
14
+ */
8
15
  const ThemeProvider = (props) => {
9
16
  const { children, theme, withScopedStyles = false } = props;
10
- return ((0, jsx_runtime_1.jsx)(styles_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(react_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(GlobalStyles_1.GlobalStyles, { withScopedStyles: withScopedStyles, children: children }) }) }));
17
+ return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(styles_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(react_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(GlobalStyles_1.GlobalStyles, { withScopedStyles: withScopedStyles, children: children }) }) }) }));
11
18
  };
12
19
  exports.ThemeProvider = ThemeProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.71.3",
3
+ "version": "4.71.4",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {
@@ -1,12 +0,0 @@
1
- /**
2
- * Кнопка для вызова ошибки type = Default
3
- */
4
- export declare const BuggyButton: () => import("react/jsx-runtime").JSX.Element;
5
- /**
6
- * Кнопка для вызова ошибки чанков ErrorChunkError c type = OutdatedRelease
7
- */
8
- export declare const ChunkLoadErrorButton: () => import("react/jsx-runtime").JSX.Element;
9
- /**
10
- * Кнопка для вызова ошибки чанков Failed to fetch dynamically imported module c type = OutdatedRelease
11
- */
12
- export declare const FailedFetchModuleButton: () => import("react/jsx-runtime").JSX.Element;
@@ -1,50 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Button } from '../Button';
4
- /**
5
- * Кастомная ошибка подгрузки чанков при релизах
6
- */
7
- class OutdatedReleaseError extends Error {
8
- constructor(message = '') {
9
- super(message);
10
- this.name = 'ChunkLoadError';
11
- }
12
- }
13
- /**
14
- * Компонент, который выбрасывает ошибку при рендере
15
- */
16
- const ThrowError = ({ error, children, }) => {
17
- throw error;
18
- // biome-ignore lint/correctness/noUnreachable: Необходимо для теста
19
- return _jsx(_Fragment, { children: children });
20
- };
21
- /**
22
- * Кнопка для вызова ошибки type = Default
23
- */
24
- export const BuggyButton = () => {
25
- const [count, setCount] = useState(0);
26
- const onClick = () => {
27
- setCount(count + 1);
28
- };
29
- return (_jsxs(_Fragment, { children: [count === 2 && (_jsx(ThrowError, { error: new Error('Кнопка сломалась на 2 клике') })), _jsx(Button, { onClick: onClick, children: "\u0421\u043B\u043E\u043C\u0430\u044E\u0441\u044C \u043D\u0430 2 \u043A\u043B\u0438\u043A\u0435" })] }));
30
- };
31
- /**
32
- * Кнопка для вызова ошибки чанков ErrorChunkError c type = OutdatedRelease
33
- */
34
- export const ChunkLoadErrorButton = () => {
35
- const [isClicked, setIsClicked] = useState(false);
36
- const onClick = () => {
37
- setIsClicked(true);
38
- };
39
- return (_jsxs(_Fragment, { children: [isClicked && (_jsx(ThrowError, { error: new OutdatedReleaseError('Ошибка загрузки приложения') })), _jsx(Button, { onClick: onClick, children: "\u0412\u044B\u0437\u043E\u0432\u0443 \u043E\u0448\u0438\u0431\u043A\u0443 \u0440\u0435\u043B\u0438\u0437\u0430" })] }));
40
- };
41
- /**
42
- * Кнопка для вызова ошибки чанков Failed to fetch dynamically imported module c type = OutdatedRelease
43
- */
44
- export const FailedFetchModuleButton = () => {
45
- const [isClicked, setIsClicked] = useState(false);
46
- const onClick = () => {
47
- setIsClicked(true);
48
- };
49
- return (_jsxs(_Fragment, { children: [isClicked && (_jsx(ThrowError, { error: new Error('Failed to fetch dynamically imported module') })), _jsx(Button, { onClick: onClick, children: "\u0412\u044B\u0437\u043E\u0432\u0443 \u043E\u0448\u0438\u0431\u043A\u0443 \u0440\u0435\u043B\u0438\u0437\u0430" })] }));
50
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * Кнопка для вызова ошибки type = Default
3
- */
4
- export declare const BuggyButton: () => import("react/jsx-runtime").JSX.Element;
5
- /**
6
- * Кнопка для вызова ошибки чанков ErrorChunkError c type = OutdatedRelease
7
- */
8
- export declare const ChunkLoadErrorButton: () => import("react/jsx-runtime").JSX.Element;
9
- /**
10
- * Кнопка для вызова ошибки чанков Failed to fetch dynamically imported module c type = OutdatedRelease
11
- */
12
- export declare const FailedFetchModuleButton: () => import("react/jsx-runtime").JSX.Element;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FailedFetchModuleButton = exports.ChunkLoadErrorButton = exports.BuggyButton = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const Button_1 = require("../Button");
7
- /**
8
- * Кастомная ошибка подгрузки чанков при релизах
9
- */
10
- class OutdatedReleaseError extends Error {
11
- constructor(message = '') {
12
- super(message);
13
- this.name = 'ChunkLoadError';
14
- }
15
- }
16
- /**
17
- * Компонент, который выбрасывает ошибку при рендере
18
- */
19
- const ThrowError = ({ error, children, }) => {
20
- throw error;
21
- // biome-ignore lint/correctness/noUnreachable: Необходимо для теста
22
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
23
- };
24
- /**
25
- * Кнопка для вызова ошибки type = Default
26
- */
27
- const BuggyButton = () => {
28
- const [count, setCount] = (0, react_1.useState)(0);
29
- const onClick = () => {
30
- setCount(count + 1);
31
- };
32
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [count === 2 && ((0, jsx_runtime_1.jsx)(ThrowError, { error: new Error('Кнопка сломалась на 2 клике') })), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onClick, children: "\u0421\u043B\u043E\u043C\u0430\u044E\u0441\u044C \u043D\u0430 2 \u043A\u043B\u0438\u043A\u0435" })] }));
33
- };
34
- exports.BuggyButton = BuggyButton;
35
- /**
36
- * Кнопка для вызова ошибки чанков ErrorChunkError c type = OutdatedRelease
37
- */
38
- const ChunkLoadErrorButton = () => {
39
- const [isClicked, setIsClicked] = (0, react_1.useState)(false);
40
- const onClick = () => {
41
- setIsClicked(true);
42
- };
43
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isClicked && ((0, jsx_runtime_1.jsx)(ThrowError, { error: new OutdatedReleaseError('Ошибка загрузки приложения') })), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onClick, children: "\u0412\u044B\u0437\u043E\u0432\u0443 \u043E\u0448\u0438\u0431\u043A\u0443 \u0440\u0435\u043B\u0438\u0437\u0430" })] }));
44
- };
45
- exports.ChunkLoadErrorButton = ChunkLoadErrorButton;
46
- /**
47
- * Кнопка для вызова ошибки чанков Failed to fetch dynamically imported module c type = OutdatedRelease
48
- */
49
- const FailedFetchModuleButton = () => {
50
- const [isClicked, setIsClicked] = (0, react_1.useState)(false);
51
- const onClick = () => {
52
- setIsClicked(true);
53
- };
54
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isClicked && ((0, jsx_runtime_1.jsx)(ThrowError, { error: new Error('Failed to fetch dynamically imported module') })), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onClick, children: "\u0412\u044B\u0437\u043E\u0432\u0443 \u043E\u0448\u0438\u0431\u043A\u0443 \u0440\u0435\u043B\u0438\u0437\u0430" })] }));
55
- };
56
- exports.FailedFetchModuleButton = FailedFetchModuleButton;