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