@rescui/ui-contexts 0.6.3-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.14 → 0.6.3-RUI-297-Add-react-compiler-to-the-packages-build-8aaaed4be.43

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,13 +1,15 @@
1
1
  "use client";
2
- import React, { useMemo } from 'react';
2
+ import { c } from 'react-compiler-runtime';
3
+ import React from 'react';
3
4
  import PropTypes from 'prop-types';
4
- import { useLayeringContext, LayeringContextValue, LayeringContext } from './parts/layering-context.js';
5
+ import { useLayeringContext, LayeringContext, LayeringContextValue } from './parts/layering-context.js';
5
6
 
6
- function LayeringProvider(_ref) {
7
- let {
7
+ function LayeringProvider(t0) {
8
+ const $ = c(12);
9
+ const {
8
10
  baseLayer,
9
11
  children
10
- } = _ref;
12
+ } = t0;
11
13
  const {
12
14
  popupZIndex,
13
15
  dropdownZIndex,
@@ -15,24 +17,89 @@ function LayeringProvider(_ref) {
15
17
  baseZIndex,
16
18
  isInPortal
17
19
  } = useLayeringContext();
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);
20
+ let t1;
21
+
22
+ bb0: switch (baseLayer) {
23
+ case "popup":
24
+ {
25
+ let t2;
26
+
27
+ if ($[0] !== popupZIndex) {
28
+ t2 = new LayeringContextValue(popupZIndex, true);
29
+ $[0] = popupZIndex;
30
+ $[1] = t2;
31
+ } else {
32
+ t2 = $[1];
33
+ }
34
+
35
+ t1 = t2;
36
+ break bb0;
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;
36
103
  }
37
104
 
38
105
  LayeringProvider.propTypes = {
@@ -1,4 +1,6 @@
1
1
  "use client";
2
+ import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
3
+ import { c } from 'react-compiler-runtime';
2
4
  import React, { createContext, useContext } from 'react';
3
5
  const LAYER_STEP = 500;
4
6
 
@@ -39,19 +41,32 @@ class LayeringContextValue {
39
41
  const LayeringContext = /*#__PURE__*/createContext(new LayeringContextValue(0));
40
42
  const LayeringConsumer = LayeringContext.Consumer;
41
43
 
42
- const useLayeringContext = () => useContext(LayeringContext);
44
+ const useLayeringContext = () => {
45
+ return useContext(LayeringContext);
46
+ };
43
47
  /**
44
48
  * @deprecated use `useLayeringContext` hook instead
45
49
  * */
46
50
 
47
51
 
48
52
  const withLayering = WrappedComponent => {
49
- const component = props => /*#__PURE__*/React.createElement(LayeringContext.Consumer, null, layering => /*#__PURE__*/React.createElement(WrappedComponent, { ...layering,
50
- ...props
51
- }));
53
+ const Component = props => {
54
+ const $ = c(2);
55
+ let t0;
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
+ };
52
67
 
53
- component.displayName = `WithLayering(${WrappedComponent.displayName || WrappedComponent.name})`;
54
- return component;
68
+ Component.displayName = `WithLayering(${WrappedComponent.displayName || WrappedComponent.name})`;
69
+ return Component;
55
70
  };
56
71
 
57
72
  export { LayeringConsumer, LayeringContext, LayeringContextValue, useLayeringContext, withLayering };
@@ -1,4 +1,6 @@
1
1
  "use client";
2
+ import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
3
+ import { c } from 'react-compiler-runtime';
2
4
  import React, { createContext, useContext } from 'react';
3
5
  const ThemeContext = /*#__PURE__*/createContext({
4
6
  theme: 'light',
@@ -33,21 +35,45 @@ const useThemeWithUndefined = overwriteValue => {
33
35
  const withTheme = wrappedComponent => {
34
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
37
  const WrappedComponent = wrappedComponent;
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,
38
+ const ComponentWithTheme = /*#__PURE__*/React.forwardRef((t0, ref) => {
39
+ const $ = c(7);
40
+ let restProps;
41
+ let theme;
42
+
43
+ if ($[0] !== t0) {
44
+ ({
45
+ theme,
48
46
  ...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));
49
67
  });
50
- });
68
+ $[3] = ref;
69
+ $[4] = restProps;
70
+ $[5] = theme;
71
+ $[6] = t1;
72
+ } else {
73
+ t1 = $[6];
74
+ }
75
+
76
+ return t1;
51
77
  });
52
78
  ComponentWithTheme.displayName = `WithTheme(${WrappedComponent.displayName || WrappedComponent.name})`;
53
79
  return ComponentWithTheme;
@@ -1,20 +1,45 @@
1
1
  "use client";
2
+ import { c } from 'react-compiler-runtime';
2
3
  import React from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import { ThemeContext } from './parts/theme-context.js';
5
6
 
6
- const ThemeProvider = _ref => {
7
- let {
7
+ const ThemeProvider = t0 => {
8
+ const $ = c(6);
9
+ const {
8
10
  theme,
9
11
  children,
10
- ignoreThemeValueForCSSApi = false
11
- } = _ref;
12
- return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
13
- value: {
12
+ ignoreThemeValueForCSSApi: t1
13
+ } = t0;
14
+ const ignoreThemeValueForCSSApi = t1 === undefined ? false : t1;
15
+ let t2;
16
+
17
+ if ($[0] !== ignoreThemeValueForCSSApi || $[1] !== theme) {
18
+ t2 = {
14
19
  theme,
15
20
  noProvider: ignoreThemeValueForCSSApi
16
- }
17
- }, children);
21
+ };
22
+ $[0] = ignoreThemeValueForCSSApi;
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;
18
43
  };
19
44
 
20
45
  ThemeProvider.propTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/ui-contexts",
3
- "version": "0.6.3-RUI-297-Add-react-compiler-to-the-packages-build-dbbefd7b8.14+dbbefd7b8",
3
+ "version": "0.6.3-RUI-297-Add-react-compiler-to-the-packages-build-8aaaed4be.43+8aaaed4be",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -17,7 +17,8 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@babel/runtime-corejs3": "^7.26.0"
20
+ "@babel/runtime-corejs3": "^7.26.0",
21
+ "react-compiler-runtime": "^1.0.0"
21
22
  },
22
23
  "peerDependencies": {
23
24
  "prop-types": "^15",
@@ -30,5 +31,5 @@
30
31
  "build": "rescui-scripts build"
31
32
  },
32
33
  "nx": {},
33
- "gitHead": "dbbefd7b8e24da18262edf3baffa35039ae01af3"
34
+ "gitHead": "8aaaed4bee650c002b7f195438380b70c31cc5a4"
34
35
  }