@semcore/core 17.0.0-prerelease.20-prerelease.20 → 17.0.0-prerelease.22
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/LastInteractionType.js +22 -36
- package/lib/LastInteractionType.js.map +1 -1
- package/lib/LastInteractionType.mjs +19 -33
- package/lib/LastInteractionType.mjs.map +1 -1
- package/lib/core-types/Component.js +25 -41
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +18 -38
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/symbols.js +9 -9
- package/lib/core-types/symbols.js.map +1 -1
- package/lib/core-types/symbols.mjs +9 -9
- package/lib/core-types/symbols.mjs.map +1 -1
- package/lib/coreFactory.js +143 -205
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +118 -164
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/decorators/propsObserver.js +36 -64
- package/lib/decorators/propsObserver.js.map +1 -1
- package/lib/decorators/propsObserver.mjs +33 -61
- package/lib/decorators/propsObserver.mjs.map +1 -1
- package/lib/decorators/reactive.js +17 -17
- package/lib/decorators/reactive.js.map +1 -1
- package/lib/decorators/reactive.mjs +15 -15
- package/lib/decorators/reactive.mjs.map +1 -1
- package/lib/enhancement/Children.js +51 -59
- package/lib/enhancement/Children.js.map +1 -1
- package/lib/enhancement/Children.mjs +47 -41
- package/lib/enhancement/Children.mjs.map +1 -1
- package/lib/enhancement/Root.js +36 -37
- package/lib/enhancement/Root.js.map +1 -1
- package/lib/enhancement/Root.mjs +28 -18
- package/lib/enhancement/Root.mjs.map +1 -1
- package/lib/enhancement/dataName.js +7 -8
- package/lib/enhancement/dataName.js.map +1 -1
- package/lib/enhancement/dataName.mjs +5 -5
- package/lib/enhancement/dataName.mjs.map +1 -1
- package/lib/enhancement/enhance.js +6 -9
- package/lib/enhancement/enhance.js.map +1 -1
- package/lib/enhancement/enhance.mjs +5 -7
- package/lib/enhancement/enhance.mjs.map +1 -1
- package/lib/enhancement/functionDefaultProps.js +6 -6
- package/lib/enhancement/functionDefaultProps.js.map +1 -1
- package/lib/enhancement/functionDefaultProps.mjs +4 -4
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
- package/lib/enhancement/i18n.js +13 -13
- package/lib/enhancement/i18n.js.map +1 -1
- package/lib/enhancement/i18n.mjs +10 -9
- package/lib/enhancement/i18n.mjs.map +1 -1
- package/lib/enhancement/inheritedName.js +7 -8
- package/lib/enhancement/inheritedName.js.map +1 -1
- package/lib/enhancement/inheritedName.mjs +5 -5
- package/lib/enhancement/inheritedName.mjs.map +1 -1
- package/lib/enhancement/staticChildren.js +47 -56
- package/lib/enhancement/staticChildren.js.map +1 -1
- package/lib/enhancement/staticChildren.mjs +43 -48
- package/lib/enhancement/staticChildren.mjs.map +1 -1
- package/lib/enhancement/style.js +29 -27
- package/lib/enhancement/style.js.map +1 -1
- package/lib/enhancement/style.mjs +26 -20
- package/lib/enhancement/style.mjs.map +1 -1
- package/lib/enhancement/uncontrolledProps.js +46 -65
- package/lib/enhancement/uncontrolledProps.js.map +1 -1
- package/lib/enhancement/uncontrolledProps.mjs +43 -52
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
- package/lib/esm/LastInteractionType.mjs +19 -33
- package/lib/esm/core-types/Component.mjs +18 -38
- package/lib/esm/core-types/symbols.mjs +9 -9
- package/lib/esm/coreFactory.mjs +118 -164
- package/lib/esm/enhancement/Children.mjs +47 -41
- package/lib/esm/enhancement/Root.mjs +28 -18
- package/lib/esm/enhancement/dataName.mjs +5 -5
- package/lib/esm/enhancement/enhance.mjs +5 -7
- package/lib/esm/enhancement/functionDefaultProps.mjs +4 -4
- package/lib/esm/enhancement/i18n.mjs +10 -9
- package/lib/esm/enhancement/inheritedName.mjs +5 -5
- package/lib/esm/enhancement/staticChildren.mjs +43 -48
- package/lib/esm/enhancement/style.mjs +26 -20
- package/lib/esm/enhancement/uncontrolledProps.mjs +43 -52
- package/lib/esm/register.mjs +12 -20
- package/lib/esm/styled/reshadow-core.mjs +98 -111
- package/lib/esm/styled/sstyled.mjs +31 -41
- package/lib/esm/utils/assignProps.mjs +32 -36
- package/lib/esm/utils/enhances/WithI18n.mjs +15 -17
- package/lib/esm/utils/enhances/i18nEnhance.mjs +47 -61
- package/lib/esm/utils/logger.mjs +13 -21
- package/lib/esm/utils/pick.mjs +4 -4
- package/lib/esm/utils/ref.mjs +27 -43
- package/lib/esm/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/index.js +17 -17
- package/lib/register.js +17 -24
- package/lib/register.js.map +1 -1
- package/lib/register.mjs +12 -20
- package/lib/register.mjs.map +1 -1
- package/lib/styled/index.js +4 -4
- package/lib/styled/reshadow-core.js +102 -104
- package/lib/styled/reshadow-core.js.map +1 -1
- package/lib/styled/reshadow-core.mjs +98 -111
- package/lib/styled/reshadow-core.mjs.map +1 -1
- package/lib/styled/sstyled.js +31 -53
- package/lib/styled/sstyled.js.map +1 -1
- package/lib/styled/sstyled.mjs +31 -41
- package/lib/styled/sstyled.mjs.map +1 -1
- package/lib/theme/processor.js +150 -222
- package/lib/theme/processor.js.map +1 -1
- package/lib/theme/processor.mjs +148 -221
- package/lib/theme/processor.mjs.map +1 -1
- package/lib/theme/themes/dark.js +2 -2
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/default.js +2 -2
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/highlights-dark.js +2 -2
- package/lib/theme/themes/highlights-dark.js.map +1 -1
- package/lib/theme/themes/highlights-light.js +2 -2
- package/lib/theme/themes/highlights-light.js.map +1 -1
- package/lib/theme/themes/light.js +2 -2
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/theme/utils.js +140 -215
- package/lib/theme/utils.js.map +1 -1
- package/lib/theme/utils.mjs +135 -214
- package/lib/theme/utils.mjs.map +1 -1
- package/lib/utils/CSSinJS.js +8 -10
- package/lib/utils/CSSinJS.js.map +1 -1
- package/lib/utils/CSSinJS.mjs +6 -7
- package/lib/utils/CSSinJS.mjs.map +1 -1
- package/lib/utils/ThemeProvider.js +44 -51
- package/lib/utils/ThemeProvider.js.map +1 -1
- package/lib/utils/ThemeProvider.mjs +36 -47
- package/lib/utils/ThemeProvider.mjs.map +1 -1
- package/lib/utils/addonText.js +4 -7
- package/lib/utils/addonText.js.map +1 -1
- package/lib/utils/addonText.mjs +2 -5
- package/lib/utils/addonText.mjs.map +1 -1
- package/lib/utils/addonTextChildren.js +15 -21
- package/lib/utils/addonTextChildren.js.map +1 -1
- package/lib/utils/addonTextChildren.mjs +7 -13
- package/lib/utils/addonTextChildren.mjs.map +1 -1
- package/lib/utils/ariaProps.js +7 -5
- package/lib/utils/ariaProps.js.map +1 -1
- package/lib/utils/ariaProps.mjs +7 -5
- package/lib/utils/ariaProps.mjs.map +1 -1
- package/lib/utils/assignProps.js +33 -37
- package/lib/utils/assignProps.js.map +1 -1
- package/lib/utils/assignProps.mjs +32 -36
- package/lib/utils/assignProps.mjs.map +1 -1
- package/lib/utils/canUseDOM.js +1 -1
- package/lib/utils/capitalizeFirstLetter.js +1 -1
- package/lib/utils/color.js +72 -95
- package/lib/utils/color.js.map +1 -1
- package/lib/utils/color.mjs +71 -94
- package/lib/utils/color.mjs.map +1 -1
- package/lib/utils/compose.js +3 -12
- package/lib/utils/compose.js.map +1 -1
- package/lib/utils/compose.mjs +2 -11
- package/lib/utils/compose.mjs.map +1 -1
- package/lib/utils/createUUID.js +5 -5
- package/lib/utils/createUUID.js.map +1 -1
- package/lib/utils/createUUID.mjs +4 -4
- package/lib/utils/createUUID.mjs.map +1 -1
- package/lib/utils/cssToIntDefault.js +3 -4
- package/lib/utils/cssToIntDefault.js.map +1 -1
- package/lib/utils/cssToIntDefault.mjs +2 -3
- package/lib/utils/cssToIntDefault.mjs.map +1 -1
- package/lib/utils/enhances/WithCSS.js +10 -8
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +7 -6
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.js +19 -19
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +15 -17
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/a11yEnhance.js +34 -39
- package/lib/utils/enhances/a11yEnhance.js.map +1 -1
- package/lib/utils/enhances/a11yEnhance.mjs +32 -36
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.js +55 -63
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +50 -58
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/contextEnhance.js +12 -11
- package/lib/utils/enhances/contextEnhance.js.map +1 -1
- package/lib/utils/enhances/contextEnhance.mjs +9 -8
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
- package/lib/utils/enhances/i18nEnhance.js +51 -67
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs +47 -61
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.js +12 -10
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -1
- package/lib/utils/enhances/resolveColorEnhance.mjs +8 -6
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
- package/lib/utils/eventEmitter.js +30 -57
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs +26 -55
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/findComponent.js +35 -42
- package/lib/utils/findComponent.js.map +1 -1
- package/lib/utils/findComponent.mjs +26 -33
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/fire.js +7 -13
- package/lib/utils/fire.js.map +1 -1
- package/lib/utils/fire.mjs +5 -11
- package/lib/utils/fire.mjs.map +1 -1
- package/lib/utils/focus-lock/focusBorders.js +28 -32
- package/lib/utils/focus-lock/focusBorders.js.map +1 -1
- package/lib/utils/focus-lock/focusBorders.mjs +26 -32
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.js +4 -6
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -1
- package/lib/utils/focus-lock/getFocusableIn.mjs +3 -6
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.js +5 -6
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -1
- package/lib/utils/focus-lock/isFocusInside.mjs +4 -6
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusable.js +9 -12
- package/lib/utils/focus-lock/isFocusable.js.map +1 -1
- package/lib/utils/focus-lock/isFocusable.mjs +8 -11
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
- package/lib/utils/focus-lock/setFocus.js +21 -27
- package/lib/utils/focus-lock/setFocus.js.map +1 -1
- package/lib/utils/focus-lock/setFocus.mjs +19 -25
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
- package/lib/utils/getAccessibleName.js +10 -22
- package/lib/utils/getAccessibleName.js.map +1 -1
- package/lib/utils/getAccessibleName.mjs +10 -21
- package/lib/utils/getAccessibleName.mjs.map +1 -1
- package/lib/utils/getDisplayName.js +1 -1
- package/lib/utils/getEventTarget.js +13 -32
- package/lib/utils/getEventTarget.js.map +1 -1
- package/lib/utils/getEventTarget.mjs +12 -31
- package/lib/utils/getEventTarget.mjs.map +1 -1
- package/lib/utils/getOriginChildren.js +4 -4
- package/lib/utils/getOriginChildren.js.map +1 -1
- package/lib/utils/getRandomInt.js +1 -1
- package/lib/utils/getValue.js +4 -6
- package/lib/utils/getValue.js.map +1 -1
- package/lib/utils/getValue.mjs +3 -5
- package/lib/utils/getValue.mjs.map +1 -1
- package/lib/utils/hasLabels.js +16 -27
- package/lib/utils/hasLabels.js.map +1 -1
- package/lib/utils/hasLabels.mjs +14 -24
- package/lib/utils/hasLabels.mjs.map +1 -1
- package/lib/utils/hasParent.js +3 -2
- package/lib/utils/hasParent.js.map +1 -1
- package/lib/utils/hasParent.mjs +2 -3
- package/lib/utils/hasParent.mjs.map +1 -1
- package/lib/utils/ifChildren.js +6 -4
- package/lib/utils/ifChildren.js.map +1 -1
- package/lib/utils/ifChildren.mjs +4 -2
- package/lib/utils/ifChildren.mjs.map +1 -1
- package/lib/utils/injectStyle.js +11 -13
- package/lib/utils/injectStyle.js.map +1 -1
- package/lib/utils/injectStyle.mjs +9 -10
- package/lib/utils/injectStyle.mjs.map +1 -1
- package/lib/utils/inputProps.js +5 -5
- package/lib/utils/inputProps.js.map +1 -1
- package/lib/utils/inputProps.mjs +4 -4
- package/lib/utils/inputProps.mjs.map +1 -1
- package/lib/utils/isInteractiveElement.js +7 -9
- package/lib/utils/isInteractiveElement.js.map +1 -1
- package/lib/utils/isInteractiveElement.mjs +7 -9
- package/lib/utils/isInteractiveElement.mjs.map +1 -1
- package/lib/utils/isNode.js +4 -5
- package/lib/utils/isNode.js.map +1 -1
- package/lib/utils/isNode.mjs +1 -2
- package/lib/utils/isNode.mjs.map +1 -1
- package/lib/utils/isPromise.js +1 -1
- package/lib/utils/isRetina.js +7 -2
- package/lib/utils/isRetina.js.map +1 -1
- package/lib/utils/isRetina.mjs +6 -1
- package/lib/utils/isRetina.mjs.map +1 -1
- package/lib/utils/logger.js +18 -25
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logger.mjs +13 -21
- package/lib/utils/logger.mjs.map +1 -1
- package/lib/utils/numericChecker.js +11 -18
- package/lib/utils/numericChecker.js.map +1 -1
- package/lib/utils/numericChecker.mjs +10 -17
- package/lib/utils/numericChecker.mjs.map +1 -1
- package/lib/utils/ownerDocument.js +2 -2
- package/lib/utils/ownerDocument.js.map +1 -1
- package/lib/utils/ownerDocument.mjs +1 -1
- package/lib/utils/ownerDocument.mjs.map +1 -1
- package/lib/utils/pick.js +5 -5
- package/lib/utils/pick.js.map +1 -1
- package/lib/utils/pick.mjs +4 -4
- package/lib/utils/pick.mjs.map +1 -1
- package/lib/utils/propsForElement.js +10 -12
- package/lib/utils/propsForElement.js.map +1 -1
- package/lib/utils/propsForElement.mjs +8 -10
- package/lib/utils/propsForElement.mjs.map +1 -1
- package/lib/utils/rafTrottle.js +9 -14
- package/lib/utils/rafTrottle.js.map +1 -1
- package/lib/utils/rafTrottle.mjs +7 -12
- package/lib/utils/rafTrottle.mjs.map +1 -1
- package/lib/utils/reactToText.js +5 -8
- package/lib/utils/reactToText.js.map +1 -1
- package/lib/utils/reactToText.mjs +3 -6
- package/lib/utils/reactToText.mjs.map +1 -1
- package/lib/utils/ref.js +29 -47
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +27 -43
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/setRef.js +2 -2
- package/lib/utils/setRef.js.map +1 -1
- package/lib/utils/syncScroll.js +24 -24
- package/lib/utils/syncScroll.js.map +1 -1
- package/lib/utils/syncScroll.mjs +21 -21
- package/lib/utils/syncScroll.mjs.map +1 -1
- package/lib/utils/uncontroll.js +8 -18
- package/lib/utils/uncontroll.js.map +1 -1
- package/lib/utils/uncontroll.mjs +8 -17
- package/lib/utils/uncontroll.mjs.map +1 -1
- package/lib/utils/uniqueID.js +22 -27
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +18 -25
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/useColorResolver.js +20 -21
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +16 -18
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useEnhancedEffect.js +4 -4
- package/lib/utils/use/useEnhancedEffect.js.map +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs +1 -1
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
- package/lib/utils/use/useEventCallback.js +5 -10
- package/lib/utils/use/useEventCallback.js.map +1 -1
- package/lib/utils/use/useEventCallback.mjs +3 -8
- package/lib/utils/use/useEventCallback.mjs.map +1 -1
- package/lib/utils/use/useEventListener.js +11 -15
- package/lib/utils/use/useEventListener.js.map +1 -1
- package/lib/utils/use/useEventListener.mjs +7 -11
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/useFocusLock.js +80 -94
- package/lib/utils/use/useFocusLock.js.map +1 -1
- package/lib/utils/use/useFocusLock.mjs +71 -88
- package/lib/utils/use/useFocusLock.mjs.map +1 -1
- package/lib/utils/use/usePreventScroll.js +26 -28
- package/lib/utils/use/usePreventScroll.js.map +1 -1
- package/lib/utils/use/usePreventScroll.mjs +21 -23
- package/lib/utils/use/usePreventScroll.mjs.map +1 -1
- package/lib/utils/use/useScrollBarWidth.js +8 -14
- package/lib/utils/use/useScrollBarWidth.js.map +1 -1
- package/lib/utils/use/useScrollBarWidth.mjs +8 -13
- package/lib/utils/use/useScrollBarWidth.mjs.map +1 -1
- package/lib/utils/useCssVariable.js +32 -37
- package/lib/utils/useCssVariable.js.map +1 -1
- package/lib/utils/useCssVariable.mjs +27 -34
- package/lib/utils/useCssVariable.mjs.map +1 -1
- package/lib/utils/zIndexStacking.js +28 -24
- package/lib/utils/zIndexStacking.js.map +1 -1
- package/lib/utils/zIndexStacking.mjs +23 -22
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +1 -1
package/lib/esm/coreFactory.mjs
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _superPropGet from "@babel/runtime/helpers/esm/superPropGet";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
10
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
11
3
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
12
4
|
import React from "react";
|
|
13
5
|
import { Component } from "./core-types/Component.mjs";
|
|
@@ -25,19 +17,18 @@ import Enhancement$2 from "./enhancement/uncontrolledProps.mjs";
|
|
|
25
17
|
import assignProps$1 from "./utils/assignProps.mjs";
|
|
26
18
|
import { useForkRef } from "./utils/ref.mjs";
|
|
27
19
|
import useEnhancedEffect from "./utils/use/useEnhancedEffect.mjs";
|
|
28
|
-
var _excluded = ["forwardRef"], _excluded2 = ["forwardRef", "__WRAPPER_PROPS_BIND__"], _excluded3 = ["ref"];
|
|
29
20
|
function isEmptyObject(obj) {
|
|
30
21
|
return Object.getOwnPropertyNames(obj).length === 0 && Object.getOwnPropertySymbols && // For IE 11
|
|
31
22
|
Object.getOwnPropertySymbols(obj).length === 0 && Object.getPrototypeOf(obj) === Object.prototype;
|
|
32
23
|
}
|
|
33
24
|
function createGetField(enhancements, Component2, isFunction) {
|
|
34
25
|
return function getField(key) {
|
|
35
|
-
return enhancements.filter(
|
|
26
|
+
return enhancements.filter((enhancement) => {
|
|
36
27
|
if (!enhancement.condition) {
|
|
37
28
|
return true;
|
|
38
29
|
}
|
|
39
30
|
return enhancement.condition(Component2, isFunction);
|
|
40
|
-
}).reduce(
|
|
31
|
+
}).reduce((acc, item) => {
|
|
41
32
|
if (item[key]) {
|
|
42
33
|
acc.push(item[key]);
|
|
43
34
|
}
|
|
@@ -46,174 +37,142 @@ function createGetField(enhancements, Component2, isFunction) {
|
|
|
46
37
|
};
|
|
47
38
|
}
|
|
48
39
|
function createForwardWrapper(Component2, wrapperProps, statics, isFunction) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
function WrapperForwardRefWithBind(
|
|
54
|
-
|
|
40
|
+
const RootComponent = Component2[ROOT_COMPONENT];
|
|
41
|
+
const getterMethodName = getterMethodNameByDisplayName(Component2 == null ? void 0 : Component2.displayName);
|
|
42
|
+
const getterMethod = (RootComponent == null ? void 0 : RootComponent.prototype) ? RootComponent.prototype[getterMethodName] : void 0;
|
|
43
|
+
const useGetterIndex = (getterMethod == null ? void 0 : getterMethod.length) >= 2;
|
|
44
|
+
function WrapperForwardRefWithBind({
|
|
45
|
+
forwardRef = null,
|
|
46
|
+
...other
|
|
47
|
+
}, ref) {
|
|
55
48
|
return /* @__PURE__ */ React.createElement(BindingWrapper, _extends({}, other, {
|
|
56
49
|
forwardRef: useForkRef(ref, forwardRef)
|
|
57
50
|
}));
|
|
58
51
|
}
|
|
59
|
-
function WrapperForwardRef(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
function WrapperForwardRef({
|
|
53
|
+
forwardRef = null,
|
|
54
|
+
__WRAPPER_PROPS_BIND__,
|
|
55
|
+
...other
|
|
56
|
+
}, ref) {
|
|
57
|
+
const {
|
|
58
|
+
ref: enhancementRef = null,
|
|
59
|
+
...props
|
|
60
|
+
} = (__WRAPPER_PROPS_BIND__ || wrapperProps).reduce((acc, enhancement) => enhancement(acc, WrapperComponent, isFunction), other);
|
|
64
61
|
return /* @__PURE__ */ React.createElement(Component2, _extends({}, props, {
|
|
65
62
|
forwardRef: useForkRef(enhancementRef, ref, forwardRef)
|
|
66
63
|
}));
|
|
67
64
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
-
args[_key] = arguments[_key];
|
|
74
|
-
}
|
|
75
|
-
_this = _callSuper(this, BindingWrapper2, [].concat(args));
|
|
76
|
-
_defineProperty(_this, "index", -1);
|
|
77
|
-
return _this;
|
|
65
|
+
class BindingWrapper extends React.Component {
|
|
66
|
+
constructor(...args) {
|
|
67
|
+
super(...args);
|
|
68
|
+
_defineProperty(this, "index", -1);
|
|
78
69
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return fn.bind(_this2);
|
|
87
|
-
})
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
}]);
|
|
91
|
-
})(React.Component);
|
|
92
|
-
var WrapperComponent = /* @__PURE__ */ React.forwardRef(useGetterIndex ? WrapperForwardRefWithBind : WrapperForwardRef);
|
|
70
|
+
render() {
|
|
71
|
+
return /* @__PURE__ */ React.createElement(WrapperForwardRef, _extends({}, this.props, {
|
|
72
|
+
__WRAPPER_PROPS_BIND__: wrapperProps.map((fn) => fn.bind(this))
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const WrapperComponent = /* @__PURE__ */ React.forwardRef(useGetterIndex ? WrapperForwardRefWithBind : WrapperForwardRef);
|
|
93
77
|
hoistNonReactStatics(WrapperComponent, Component2);
|
|
94
78
|
WrapperComponent.displayName = Component2.displayName;
|
|
95
79
|
WrapperComponent.defaultProps = Component2.defaultProps;
|
|
96
|
-
statics.forEach(
|
|
97
|
-
return Object.assign(WrapperComponent, enhancement(WrapperComponent, Component2, isFunction));
|
|
98
|
-
});
|
|
80
|
+
statics.forEach((enhancement) => Object.assign(WrapperComponent, enhancement(WrapperComponent, Component2, isFunction)));
|
|
99
81
|
return WrapperComponent;
|
|
100
82
|
}
|
|
101
83
|
function wrapClass(OriginComponent, enhancements, Context) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_defineProperty(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
inits.forEach(function(enhancement) {
|
|
118
|
-
return enhancement.call(_this3, props2, WrapperComponent, false);
|
|
119
|
-
});
|
|
120
|
-
_this3[CORE_INIT] = true;
|
|
121
|
-
return _this3;
|
|
84
|
+
const getField = createGetField(enhancements, OriginComponent, false);
|
|
85
|
+
const inits = getField("init");
|
|
86
|
+
const props = getField("asProps");
|
|
87
|
+
const renders = getField("render");
|
|
88
|
+
const statics = getField("static");
|
|
89
|
+
const wrapperProps = getField("wrapperProps");
|
|
90
|
+
const contexts = getField("context");
|
|
91
|
+
class Component2 extends OriginComponent {
|
|
92
|
+
constructor(props2, context) {
|
|
93
|
+
super(props2, context);
|
|
94
|
+
_defineProperty(this, CORE_AS_PROPS, null);
|
|
95
|
+
_defineProperty(this, CORE_INSTANCE, WrapperComponent);
|
|
96
|
+
_defineProperty(this, CORE_INIT, false);
|
|
97
|
+
inits.forEach((enhancement) => enhancement.call(this, props2, WrapperComponent, false));
|
|
98
|
+
this[CORE_INIT] = true;
|
|
122
99
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
get: function get() {
|
|
127
|
-
var _this4 = this;
|
|
128
|
-
if (!this[CORE_INIT]) {
|
|
129
|
-
throw new Error("Can not call asProps in constructor");
|
|
130
|
-
}
|
|
131
|
-
if (!this[CORE_AS_PROPS]) {
|
|
132
|
-
this[CORE_AS_PROPS] = props.reduce(function(acc, enhancement) {
|
|
133
|
-
return enhancement.call(_this4, acc, WrapperComponent, false);
|
|
134
|
-
}, this.props);
|
|
135
|
-
}
|
|
136
|
-
return this[CORE_AS_PROPS];
|
|
100
|
+
get asProps() {
|
|
101
|
+
if (!this[CORE_INIT]) {
|
|
102
|
+
throw new Error("Can not call asProps in constructor");
|
|
137
103
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
value: function setContext() {
|
|
141
|
-
var _this5 = this;
|
|
142
|
-
var contextProps = _superPropGet(Component3, "setContext", this, 1) ? _superPropGet(Component3, "setContext", this, 3)([]) : {};
|
|
143
|
-
return contexts.reduce(function(acc, enhancement) {
|
|
144
|
-
return enhancement.call(_this5, acc, WrapperComponent, false);
|
|
145
|
-
}, contextProps);
|
|
104
|
+
if (!this[CORE_AS_PROPS]) {
|
|
105
|
+
this[CORE_AS_PROPS] = props.reduce((acc, enhancement) => enhancement.call(this, acc, WrapperComponent, false), this.props);
|
|
146
106
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
107
|
+
return this[CORE_AS_PROPS];
|
|
108
|
+
}
|
|
109
|
+
setContext() {
|
|
110
|
+
const contextProps = super.setContext ? super.setContext() : {};
|
|
111
|
+
return contexts.reduce((acc, enhancement) => enhancement.call(this, acc, WrapperComponent, false), contextProps);
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
this[CORE_AS_PROPS] = null;
|
|
115
|
+
if (!super.render) {
|
|
116
|
+
throw new Error("Component `render` method is not defined");
|
|
117
|
+
}
|
|
118
|
+
const asProps = this.asProps;
|
|
119
|
+
const ctx = this.setContext();
|
|
120
|
+
const render = renders.reduce((acc, enhancement) => enhancement.call(this, acc, asProps, WrapperComponent, false), super.render());
|
|
121
|
+
if (!WrapperComponent[STATIC_COMPONENT] && !isEmptyObject(ctx)) {
|
|
122
|
+
return /* @__PURE__ */ React.createElement(Context.Provider, {
|
|
123
|
+
value: {
|
|
124
|
+
...asProps,
|
|
125
|
+
...ctx
|
|
126
|
+
}
|
|
127
|
+
}, render);
|
|
128
|
+
} else {
|
|
129
|
+
return render;
|
|
167
130
|
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const WrapperComponent = createForwardWrapper(Component2, wrapperProps, statics, false);
|
|
171
134
|
return WrapperComponent;
|
|
172
135
|
}
|
|
173
136
|
function wrapFunction(OriginComponent, enhancements, Context) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
useEnhancedEffect(
|
|
137
|
+
const getField = createGetField(enhancements, OriginComponent, true);
|
|
138
|
+
const inits = getField("init");
|
|
139
|
+
const props = getField("asProps");
|
|
140
|
+
const renders = getField("render");
|
|
141
|
+
const statics = getField("static");
|
|
142
|
+
const wrapperProps = getField("wrapperProps");
|
|
143
|
+
const contexts = getField("context");
|
|
144
|
+
const Component2 = /* @__PURE__ */ React.memo(function FunctionMemoComponent(other) {
|
|
145
|
+
const selfRef = React.useRef({});
|
|
146
|
+
const firstRender = React.useRef(true);
|
|
147
|
+
useEnhancedEffect(() => {
|
|
185
148
|
firstRender.current = false;
|
|
186
149
|
}, []);
|
|
187
150
|
if (firstRender.current) {
|
|
188
|
-
inits.forEach(
|
|
189
|
-
return enhancement.call(selfRef.current, other, WrapperComponent, true);
|
|
190
|
-
});
|
|
151
|
+
inits.forEach((enhancement) => enhancement.call(selfRef.current, other, WrapperComponent, true));
|
|
191
152
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var ctx = contexts.reduce(function(acc, enhancement) {
|
|
196
|
-
return enhancement.call(selfRef.current, acc, WrapperComponent, true);
|
|
197
|
-
}, {});
|
|
198
|
-
var render = renders.reduce(function(acc, enhancement) {
|
|
199
|
-
return enhancement.call(selfRef.current, acc, asProps, WrapperComponent, true);
|
|
200
|
-
}, /* @__PURE__ */ React.createElement(OriginComponent, asProps));
|
|
153
|
+
const asProps = props.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, WrapperComponent, true), other);
|
|
154
|
+
const ctx = contexts.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, WrapperComponent, true), {});
|
|
155
|
+
const render = renders.reduce((acc, enhancement) => enhancement.call(selfRef.current, acc, asProps, WrapperComponent, true), /* @__PURE__ */ React.createElement(OriginComponent, asProps));
|
|
201
156
|
if (!WrapperComponent[STATIC_COMPONENT] && !isEmptyObject(ctx)) {
|
|
202
157
|
return /* @__PURE__ */ React.createElement(Context.Provider, {
|
|
203
|
-
value:
|
|
158
|
+
value: {
|
|
159
|
+
...asProps,
|
|
160
|
+
...ctx
|
|
161
|
+
}
|
|
204
162
|
}, render);
|
|
205
163
|
} else {
|
|
206
164
|
return render;
|
|
207
165
|
}
|
|
208
166
|
});
|
|
209
167
|
Object.assign(Component2, OriginComponent);
|
|
210
|
-
|
|
168
|
+
const WrapperComponent = createForwardWrapper(Component2, wrapperProps, statics, true);
|
|
211
169
|
return WrapperComponent;
|
|
212
170
|
}
|
|
213
171
|
function wrapCore(OriginComponent, enhancements, Context) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
172
|
+
const Component2 = function({
|
|
173
|
+
Root
|
|
174
|
+
}) {
|
|
175
|
+
const defaultProps = OriginComponent.defaultProps || {};
|
|
217
176
|
return /* @__PURE__ */ React.createElement(Root, _extends({}, defaultProps, {
|
|
218
177
|
render: OriginComponent
|
|
219
178
|
}));
|
|
@@ -240,15 +199,17 @@ function createComposeComponent(OriginComponent, Context, enhancements) {
|
|
|
240
199
|
function assignProps(p1, p2) {
|
|
241
200
|
return assignProps$1(p2, p1);
|
|
242
201
|
}
|
|
243
|
-
function createComponent(OriginComponent) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
202
|
+
function createComponent(OriginComponent, childComponents = {}, options = {}) {
|
|
203
|
+
const {
|
|
204
|
+
context = /* @__PURE__ */ React.createContext({}),
|
|
205
|
+
parent = [],
|
|
206
|
+
enhancements = []
|
|
207
|
+
} = options;
|
|
208
|
+
let parents = Array.isArray(parent) ? parent : [parent];
|
|
248
209
|
if (parents.length) {
|
|
249
|
-
|
|
210
|
+
const wholeFamily = parents.reduce((acc, parent2) => {
|
|
250
211
|
if (parent2[PARENT_COMPONENTS]) {
|
|
251
|
-
acc = [
|
|
212
|
+
acc = [...parent2[PARENT_COMPONENTS], ...acc];
|
|
252
213
|
}
|
|
253
214
|
return acc;
|
|
254
215
|
}, parents);
|
|
@@ -258,9 +219,9 @@ function createComponent(OriginComponent) {
|
|
|
258
219
|
if (OriginComponent[CORE_COMPONENT]) {
|
|
259
220
|
parents.push(OriginComponent);
|
|
260
221
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
222
|
+
const Component2 = createComposeComponent(OriginComponent, context, [
|
|
223
|
+
// @ts-ignore
|
|
224
|
+
...enhancements.map((f) => f(context, parents, createComponent, childComponents)),
|
|
264
225
|
i18nAppLocaleEnhance(),
|
|
265
226
|
Enhancement(context, parents),
|
|
266
227
|
// root must be under the children
|
|
@@ -280,28 +241,21 @@ function createComponent(OriginComponent) {
|
|
|
280
241
|
// enhanceEnhancement must be under the functionDefaultPropsEnhancement
|
|
281
242
|
Enhancement$7(),
|
|
282
243
|
Enhancement$8(childComponents, context)
|
|
283
|
-
])
|
|
244
|
+
]);
|
|
284
245
|
Component2[CONTEXT_COMPONENT] = context;
|
|
285
246
|
Component2._______childrenComponents = childComponents;
|
|
286
|
-
Component2[CREATE_COMPONENT] = function() {
|
|
287
|
-
var _OriginComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : OriginComponent;
|
|
288
|
-
var _childComponents = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : childComponents;
|
|
289
|
-
var _options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : options;
|
|
247
|
+
Component2[CREATE_COMPONENT] = function(_OriginComponent = OriginComponent, _childComponents = childComponents, _options = options) {
|
|
290
248
|
return createComponent(_OriginComponent, _childComponents, _options);
|
|
291
249
|
};
|
|
292
|
-
Component2.newInstance = function() {
|
|
293
|
-
var _OriginComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : OriginComponent;
|
|
294
|
-
var _childComponents = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : childComponents;
|
|
295
|
-
var _options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : options;
|
|
250
|
+
Component2.newInstance = function(_OriginComponent = OriginComponent, _childComponents = childComponents, _options = options) {
|
|
296
251
|
return createComponent(_OriginComponent, _childComponents, _options);
|
|
297
252
|
};
|
|
298
253
|
Component2[CORE_COMPONENT] = true;
|
|
299
254
|
return Component2;
|
|
300
255
|
}
|
|
301
256
|
function createBaseComponent(OriginComponent) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
Component2.displayName = (_OriginComponent$disp = OriginComponent.displayName) !== null && _OriginComponent$disp !== void 0 ? _OriginComponent$disp : "";
|
|
257
|
+
const Component2 = /* @__PURE__ */ React.forwardRef(OriginComponent);
|
|
258
|
+
Component2.displayName = OriginComponent.displayName ?? "";
|
|
305
259
|
Component2.defaultProps = {
|
|
306
260
|
"data-ui-name": OriginComponent.displayName
|
|
307
261
|
};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
1
|
import React from "react";
|
|
6
2
|
import { CHILDREN_COMPONENT, CONTEXT_COMPONENT } from "../core-types/symbols.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var GETTER_REG = /^get[\w]+Props$/;
|
|
3
|
+
const CHILDREN_SELF = Symbol("CHILDREN_SELF");
|
|
4
|
+
const GETTER_REG = /^get[\w]+Props$/;
|
|
10
5
|
function splitPropsAndGetters(props) {
|
|
11
|
-
return Object.entries(props).reduce(
|
|
12
|
-
var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
|
|
6
|
+
return Object.entries(props).reduce((acc, [key, value]) => {
|
|
13
7
|
if (GETTER_REG.exec(key) === null) {
|
|
14
8
|
acc.props[key] = value;
|
|
15
9
|
} else {
|
|
@@ -27,67 +21,79 @@ function getterToArray(getter) {
|
|
|
27
21
|
}
|
|
28
22
|
return getter;
|
|
29
23
|
}
|
|
30
|
-
function mergeObjects() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
function mergeObjects(a = {}, b = {}) {
|
|
25
|
+
const core = {
|
|
26
|
+
...a,
|
|
27
|
+
...b
|
|
28
|
+
};
|
|
29
|
+
return Object.keys(core).reduce((acc, key) => {
|
|
35
30
|
a[key] = getterToArray(a[key]);
|
|
36
31
|
b[key] = getterToArray(b[key]);
|
|
37
|
-
acc[key] = [
|
|
32
|
+
acc[key] = [...a[key], ...b[key]];
|
|
38
33
|
return acc;
|
|
39
34
|
}, {});
|
|
40
35
|
}
|
|
41
36
|
function assignGettersChain(getters) {
|
|
42
|
-
return function() {
|
|
43
|
-
|
|
44
|
-
return getters.reduce(function(acc, getter) {
|
|
37
|
+
return function(props = {}) {
|
|
38
|
+
return getters.reduce((acc, getter) => {
|
|
45
39
|
return getter(acc);
|
|
46
40
|
}, props);
|
|
47
41
|
};
|
|
48
42
|
}
|
|
49
43
|
function createChildren(Context, contexts) {
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
const Children = function() {
|
|
45
|
+
const children = Children.origin;
|
|
52
46
|
if (typeof children === "function") {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
const {
|
|
48
|
+
handlers = {},
|
|
49
|
+
getters = {},
|
|
50
|
+
...props
|
|
51
|
+
} = [...contexts, Context].reduce((acc, ctx) => {
|
|
52
|
+
const {
|
|
53
|
+
handlers: handlers2,
|
|
54
|
+
...propsAndGetters
|
|
55
|
+
} = React.useContext(ctx);
|
|
56
|
+
const {
|
|
57
|
+
props: props2,
|
|
58
|
+
getters: getters2
|
|
59
|
+
} = splitPropsAndGetters(propsAndGetters);
|
|
60
|
+
return Object.assign({}, acc, {
|
|
57
61
|
handlers: Object.assign({}, acc.handlers, handlers2),
|
|
58
|
-
getters: mergeObjects(acc.getters, getters2)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
getters: mergeObjects(acc.getters, getters2),
|
|
63
|
+
...props2
|
|
64
|
+
});
|
|
65
|
+
}, Children.props);
|
|
66
|
+
const mergedGetters = Object.entries(getters).reduce((acc, [key, value]) => {
|
|
63
67
|
acc[key] = assignGettersChain(value);
|
|
64
68
|
return acc;
|
|
65
69
|
}, {});
|
|
66
|
-
return children(
|
|
70
|
+
return children({
|
|
71
|
+
...props,
|
|
72
|
+
...mergedGetters
|
|
73
|
+
}, handlers);
|
|
67
74
|
} else if (children === void 0) {
|
|
68
75
|
return null;
|
|
69
76
|
}
|
|
70
77
|
return children;
|
|
71
78
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
79
|
+
Children.origin = null;
|
|
80
|
+
Children.props = {};
|
|
81
|
+
Children[CHILDREN_COMPONENT] = true;
|
|
82
|
+
return Children;
|
|
76
83
|
}
|
|
77
84
|
function Enhancement(Context, parent) {
|
|
78
85
|
return {
|
|
79
|
-
init: function
|
|
80
|
-
|
|
81
|
-
return component[CONTEXT_COMPONENT];
|
|
82
|
-
}).filter(Boolean);
|
|
86
|
+
init: function() {
|
|
87
|
+
const contexts = (Array.isArray(parent) ? parent : [parent]).map((component) => component[CONTEXT_COMPONENT]).filter(Boolean);
|
|
83
88
|
this[CHILDREN_SELF] = createChildren(Context, contexts);
|
|
84
89
|
},
|
|
85
|
-
asProps: function
|
|
90
|
+
asProps: function(props) {
|
|
86
91
|
this[CHILDREN_SELF].origin = props.children;
|
|
87
92
|
this[CHILDREN_SELF].props = props;
|
|
88
|
-
return
|
|
93
|
+
return {
|
|
94
|
+
...props,
|
|
89
95
|
Children: this[CHILDREN_SELF]
|
|
90
|
-
}
|
|
96
|
+
};
|
|
91
97
|
}
|
|
92
98
|
};
|
|
93
99
|
}
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
1
|
import React from "react";
|
|
5
2
|
import assignProps from "../utils/assignProps.mjs";
|
|
6
3
|
import { useForkRef } from "../utils/ref.mjs";
|
|
7
|
-
var _excluded = ["render"], _excluded2 = ["Root", "styles", "children", "Children", "forwardRef"];
|
|
8
4
|
function createRootRender() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const Root = /* @__PURE__ */ React.forwardRef(function({
|
|
6
|
+
render: Tag,
|
|
7
|
+
...source
|
|
8
|
+
}, ref) {
|
|
9
|
+
const {
|
|
10
|
+
Root: _Root,
|
|
11
|
+
styles: _styles,
|
|
12
|
+
children: _children,
|
|
13
|
+
Children,
|
|
14
|
+
forwardRef = null,
|
|
15
|
+
...props
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
} = Root.props;
|
|
18
|
+
const clearProps = Object.entries(props).reduce((props2, [name, value]) => {
|
|
14
19
|
if (value !== void 0) {
|
|
15
20
|
props2[name] = value;
|
|
16
21
|
}
|
|
17
22
|
return props2;
|
|
18
23
|
}, {});
|
|
19
|
-
|
|
24
|
+
const child = {};
|
|
20
25
|
if (typeof Children.origin !== "undefined") {
|
|
21
26
|
child.children = /* @__PURE__ */ React.createElement(Children, null);
|
|
22
27
|
}
|
|
23
|
-
|
|
28
|
+
const other = assignProps({
|
|
29
|
+
...clearProps,
|
|
24
30
|
ref: useForkRef(forwardRef, ref)
|
|
25
|
-
}
|
|
31
|
+
}, {
|
|
32
|
+
...child,
|
|
33
|
+
...source
|
|
34
|
+
});
|
|
26
35
|
if (!Tag) {
|
|
27
36
|
throw new Error("`render` prop of Root is not provided");
|
|
28
37
|
}
|
|
@@ -34,20 +43,21 @@ function createRootRender() {
|
|
|
34
43
|
}
|
|
35
44
|
function Enhancement() {
|
|
36
45
|
return {
|
|
37
|
-
init: function
|
|
46
|
+
init: function() {
|
|
38
47
|
this.Root = createRootRender();
|
|
39
48
|
},
|
|
40
|
-
asProps: function
|
|
49
|
+
asProps: function(props, _WrapperComponent, isFunction) {
|
|
41
50
|
if (isFunction) {
|
|
42
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
...props,
|
|
43
53
|
Root: this.Root
|
|
44
|
-
}
|
|
54
|
+
};
|
|
45
55
|
}
|
|
46
56
|
return props;
|
|
47
57
|
},
|
|
48
|
-
render: function
|
|
58
|
+
render: function(render, props) {
|
|
49
59
|
this.Root.props = props;
|
|
50
|
-
return
|
|
60
|
+
return render;
|
|
51
61
|
}
|
|
52
62
|
};
|
|
53
63
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
function Enhancement() {
|
|
3
2
|
return {
|
|
4
|
-
wrapperProps: function
|
|
5
|
-
return
|
|
6
|
-
"data-ui-name": WrapperComponent.displayName
|
|
7
|
-
|
|
3
|
+
wrapperProps: function(props, WrapperComponent) {
|
|
4
|
+
return {
|
|
5
|
+
"data-ui-name": WrapperComponent.displayName,
|
|
6
|
+
...props
|
|
7
|
+
};
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
function Enhancement() {
|
|
2
2
|
return {
|
|
3
|
-
condition: function
|
|
4
|
-
var
|
|
5
|
-
return Boolean((
|
|
3
|
+
condition: function(Component) {
|
|
4
|
+
var _a;
|
|
5
|
+
return Boolean((_a = Component.enhance) == null ? void 0 : _a.length);
|
|
6
6
|
},
|
|
7
|
-
wrapperProps: function
|
|
8
|
-
return WrapperComponent.enhance.reduce(
|
|
9
|
-
return enhance(acc);
|
|
10
|
-
}, props);
|
|
7
|
+
wrapperProps: function(props, WrapperComponent) {
|
|
8
|
+
return WrapperComponent.enhance.reduce((acc, enhance) => enhance(acc), props);
|
|
11
9
|
}
|
|
12
10
|
};
|
|
13
11
|
}
|