@rescui/ui-contexts 0.6.3-RUI-297-Add-react-compiler-to-the-packages-build-8aaaed4be.43 → 0.6.3-RUI-308-Fix-select-issues-405b9fa40.35
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/layering-provider.js +23 -90
- package/lib/parts/layering-context.js +6 -21
- package/lib/parts/theme-context.js +13 -39
- package/lib/theme-provider.js +8 -33
- package/package.json +4 -5
package/lib/layering-provider.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { useLayeringContext,
|
|
4
|
+
import { useLayeringContext, LayeringContextValue, LayeringContext } from './parts/layering-context.js';
|
|
6
5
|
|
|
7
|
-
function LayeringProvider(
|
|
8
|
-
|
|
9
|
-
const {
|
|
6
|
+
function LayeringProvider(_ref) {
|
|
7
|
+
let {
|
|
10
8
|
baseLayer,
|
|
11
9
|
children
|
|
12
|
-
} =
|
|
10
|
+
} = _ref;
|
|
13
11
|
const {
|
|
14
12
|
popupZIndex,
|
|
15
13
|
dropdownZIndex,
|
|
@@ -17,89 +15,24 @@ function LayeringProvider(t0) {
|
|
|
17
15
|
baseZIndex,
|
|
18
16
|
isInPortal
|
|
19
17
|
} = useLayeringContext();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
case "dropdown":
|
|
40
|
-
{
|
|
41
|
-
let t2;
|
|
42
|
-
|
|
43
|
-
if ($[2] !== dropdownZIndex) {
|
|
44
|
-
t2 = new LayeringContextValue(dropdownZIndex, true);
|
|
45
|
-
$[2] = dropdownZIndex;
|
|
46
|
-
$[3] = t2;
|
|
47
|
-
} else {
|
|
48
|
-
t2 = $[3];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
t1 = t2;
|
|
52
|
-
break bb0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
case "tooltip":
|
|
56
|
-
{
|
|
57
|
-
let t2;
|
|
58
|
-
|
|
59
|
-
if ($[4] !== tooltipZIndex) {
|
|
60
|
-
t2 = new LayeringContextValue(tooltipZIndex, true);
|
|
61
|
-
$[4] = tooltipZIndex;
|
|
62
|
-
$[5] = t2;
|
|
63
|
-
} else {
|
|
64
|
-
t2 = $[5];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
t1 = t2;
|
|
68
|
-
break bb0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
default:
|
|
72
|
-
{
|
|
73
|
-
let t2;
|
|
74
|
-
|
|
75
|
-
if ($[6] !== baseZIndex || $[7] !== isInPortal) {
|
|
76
|
-
t2 = new LayeringContextValue(baseZIndex, isInPortal);
|
|
77
|
-
$[6] = baseZIndex;
|
|
78
|
-
$[7] = isInPortal;
|
|
79
|
-
$[8] = t2;
|
|
80
|
-
} else {
|
|
81
|
-
t2 = $[8];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
t1 = t2;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const contextValue = t1;
|
|
89
|
-
let t2;
|
|
90
|
-
|
|
91
|
-
if ($[9] !== children || $[10] !== contextValue) {
|
|
92
|
-
t2 = /*#__PURE__*/React.createElement(LayeringContext.Provider, {
|
|
93
|
-
value: contextValue
|
|
94
|
-
}, children);
|
|
95
|
-
$[9] = children;
|
|
96
|
-
$[10] = contextValue;
|
|
97
|
-
$[11] = t2;
|
|
98
|
-
} else {
|
|
99
|
-
t2 = $[11];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return t2;
|
|
18
|
+
const contextValue = useMemo(() => {
|
|
19
|
+
switch (baseLayer) {
|
|
20
|
+
case 'popup':
|
|
21
|
+
return new LayeringContextValue(popupZIndex, true);
|
|
22
|
+
|
|
23
|
+
case 'dropdown':
|
|
24
|
+
return new LayeringContextValue(dropdownZIndex, true);
|
|
25
|
+
|
|
26
|
+
case 'tooltip':
|
|
27
|
+
return new LayeringContextValue(tooltipZIndex, true);
|
|
28
|
+
|
|
29
|
+
default:
|
|
30
|
+
return new LayeringContextValue(baseZIndex, isInPortal);
|
|
31
|
+
}
|
|
32
|
+
}, [baseLayer, baseZIndex, dropdownZIndex, isInPortal, popupZIndex, tooltipZIndex]);
|
|
33
|
+
return /*#__PURE__*/React.createElement(LayeringContext.Provider, {
|
|
34
|
+
value: contextValue
|
|
35
|
+
}, children);
|
|
103
36
|
}
|
|
104
37
|
|
|
105
38
|
LayeringProvider.propTypes = {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
3
|
-
import { c } from 'react-compiler-runtime';
|
|
4
2
|
import React, { createContext, useContext } from 'react';
|
|
5
3
|
const LAYER_STEP = 500;
|
|
6
4
|
|
|
@@ -41,32 +39,19 @@ class LayeringContextValue {
|
|
|
41
39
|
const LayeringContext = /*#__PURE__*/createContext(new LayeringContextValue(0));
|
|
42
40
|
const LayeringConsumer = LayeringContext.Consumer;
|
|
43
41
|
|
|
44
|
-
const useLayeringContext = () =>
|
|
45
|
-
return useContext(LayeringContext);
|
|
46
|
-
};
|
|
42
|
+
const useLayeringContext = () => useContext(LayeringContext);
|
|
47
43
|
/**
|
|
48
44
|
* @deprecated use `useLayeringContext` hook instead
|
|
49
45
|
* */
|
|
50
46
|
|
|
51
47
|
|
|
52
48
|
const withLayering = WrappedComponent => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if ($[0] !== props) {
|
|
58
|
-
t0 = /*#__PURE__*/React.createElement(LayeringContext.Consumer, null, layering => /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, layering, props)));
|
|
59
|
-
$[0] = props;
|
|
60
|
-
$[1] = t0;
|
|
61
|
-
} else {
|
|
62
|
-
t0 = $[1];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return t0;
|
|
66
|
-
};
|
|
49
|
+
const component = props => /*#__PURE__*/React.createElement(LayeringContext.Consumer, null, layering => /*#__PURE__*/React.createElement(WrappedComponent, { ...layering,
|
|
50
|
+
...props
|
|
51
|
+
}));
|
|
67
52
|
|
|
68
|
-
|
|
69
|
-
return
|
|
53
|
+
component.displayName = `WithLayering(${WrappedComponent.displayName || WrappedComponent.name})`;
|
|
54
|
+
return component;
|
|
70
55
|
};
|
|
71
56
|
|
|
72
57
|
export { LayeringConsumer, LayeringContext, LayeringContextValue, useLayeringContext, withLayering };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
3
|
-
import { c } from 'react-compiler-runtime';
|
|
4
2
|
import React, { createContext, useContext } from 'react';
|
|
5
3
|
const ThemeContext = /*#__PURE__*/createContext({
|
|
6
4
|
theme: 'light',
|
|
@@ -35,45 +33,21 @@ const useThemeWithUndefined = overwriteValue => {
|
|
|
35
33
|
const withTheme = wrappedComponent => {
|
|
36
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
35
|
const WrappedComponent = wrappedComponent;
|
|
38
|
-
const ComponentWithTheme = /*#__PURE__*/React.forwardRef((
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
theme
|
|
36
|
+
const ComponentWithTheme = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
37
|
+
let {
|
|
38
|
+
theme,
|
|
39
|
+
...restProps
|
|
40
|
+
} = _ref;
|
|
41
|
+
return /*#__PURE__*/React.createElement(ThemeConsumer, null, _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
theme: themeFromContext
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, {
|
|
46
|
+
ref: ref,
|
|
47
|
+
theme: theme || themeFromContext,
|
|
46
48
|
...restProps
|
|
47
|
-
} = t0);
|
|
48
|
-
$[0] = t0;
|
|
49
|
-
$[1] = restProps;
|
|
50
|
-
$[2] = theme;
|
|
51
|
-
} else {
|
|
52
|
-
restProps = $[1];
|
|
53
|
-
theme = $[2];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
let t1;
|
|
57
|
-
|
|
58
|
-
if ($[3] !== ref || $[4] !== restProps || $[5] !== theme) {
|
|
59
|
-
t1 = /*#__PURE__*/React.createElement(ThemeConsumer, null, t2 => {
|
|
60
|
-
const {
|
|
61
|
-
theme: themeFromContext
|
|
62
|
-
} = t2;
|
|
63
|
-
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
64
|
-
ref: ref,
|
|
65
|
-
theme: theme || themeFromContext
|
|
66
|
-
}, restProps));
|
|
67
49
|
});
|
|
68
|
-
|
|
69
|
-
$[4] = restProps;
|
|
70
|
-
$[5] = theme;
|
|
71
|
-
$[6] = t1;
|
|
72
|
-
} else {
|
|
73
|
-
t1 = $[6];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return t1;
|
|
50
|
+
});
|
|
77
51
|
});
|
|
78
52
|
ComponentWithTheme.displayName = `WithTheme(${WrappedComponent.displayName || WrappedComponent.name})`;
|
|
79
53
|
return ComponentWithTheme;
|
package/lib/theme-provider.js
CHANGED
|
@@ -1,45 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { c } from 'react-compiler-runtime';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { ThemeContext } from './parts/theme-context.js';
|
|
6
5
|
|
|
7
|
-
const ThemeProvider =
|
|
8
|
-
|
|
9
|
-
const {
|
|
6
|
+
const ThemeProvider = _ref => {
|
|
7
|
+
let {
|
|
10
8
|
theme,
|
|
11
9
|
children,
|
|
12
|
-
ignoreThemeValueForCSSApi
|
|
13
|
-
} =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if ($[0] !== ignoreThemeValueForCSSApi || $[1] !== theme) {
|
|
18
|
-
t2 = {
|
|
10
|
+
ignoreThemeValueForCSSApi = false
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
13
|
+
value: {
|
|
19
14
|
theme,
|
|
20
15
|
noProvider: ignoreThemeValueForCSSApi
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
$[1] = theme;
|
|
24
|
-
$[2] = t2;
|
|
25
|
-
} else {
|
|
26
|
-
t2 = $[2];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let t3;
|
|
30
|
-
|
|
31
|
-
if ($[3] !== children || $[4] !== t2) {
|
|
32
|
-
t3 = /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
33
|
-
value: t2
|
|
34
|
-
}, children);
|
|
35
|
-
$[3] = children;
|
|
36
|
-
$[4] = t2;
|
|
37
|
-
$[5] = t3;
|
|
38
|
-
} else {
|
|
39
|
-
t3 = $[5];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return t3;
|
|
16
|
+
}
|
|
17
|
+
}, children);
|
|
43
18
|
};
|
|
44
19
|
|
|
45
20
|
ThemeProvider.propTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/ui-contexts",
|
|
3
|
-
"version": "0.6.3-RUI-
|
|
3
|
+
"version": "0.6.3-RUI-308-Fix-select-issues-405b9fa40.35+405b9fa40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -17,12 +17,11 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@babel/runtime-corejs3": "^7.26.0"
|
|
21
|
-
"react-compiler-runtime": "^1.0.0"
|
|
20
|
+
"@babel/runtime-corejs3": "^7.26.0"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
23
|
"prop-types": "^15",
|
|
25
|
-
"react": ">=
|
|
24
|
+
"react": ">=16.8.0 <20"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
27
|
"@rescui/scripts": "0.5.2"
|
|
@@ -31,5 +30,5 @@
|
|
|
31
30
|
"build": "rescui-scripts build"
|
|
32
31
|
},
|
|
33
32
|
"nx": {},
|
|
34
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "405b9fa40886b0ab6709c9185e8214599d2d792e"
|
|
35
34
|
}
|