@semcore/core 17.0.0-prerelease.20-prerelease.20 → 17.0.0-prerelease.21
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/utils/getValue.js
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports.default = getValue;
|
|
7
|
+
const pathRegExp = /\[(\d+)]/g;
|
|
8
8
|
function getValue(obj, path, def) {
|
|
9
|
-
|
|
10
|
-
return paths.split('.').filter(Boolean).every(
|
|
11
|
-
return (obj = obj[step]) !== undefined;
|
|
12
|
-
}) ? obj : def;
|
|
9
|
+
const paths = typeof path === 'string' ? path.replace(pathRegExp, '.$1') : path.join('.');
|
|
10
|
+
return paths.split('.').filter(Boolean).every(step => (obj = obj[step]) !== undefined) ? obj : def;
|
|
13
11
|
}
|
|
14
12
|
//# sourceMappingURL=getValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValue.js","names":["pathRegExp","getValue","obj","path","def","paths","replace","join","split","filter","Boolean","every","step","undefined"],"sources":["../../src/utils/getValue.ts"],"sourcesContent":["const pathRegExp = /\\[(\\d+)]/g;\n\nexport default function getValue(obj: any, path: string | string[], def?: any) {\n const paths = typeof path === 'string' ? path.replace(pathRegExp, '.$1') : path.join('.');\n return (\n paths\n .split('.')\n .filter(Boolean)\n\n .every((step: string) => (obj = obj[step]) !== undefined)\n ? obj\n : def\n );\n}\n"],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getValue.js","names":["pathRegExp","getValue","obj","path","def","paths","replace","join","split","filter","Boolean","every","step","undefined"],"sources":["../../src/utils/getValue.ts"],"sourcesContent":["const pathRegExp = /\\[(\\d+)]/g;\n\nexport default function getValue(obj: any, path: string | string[], def?: any) {\n const paths = typeof path === 'string' ? path.replace(pathRegExp, '.$1') : path.join('.');\n return (\n paths\n .split('.')\n .filter(Boolean)\n\n .every((step: string) => (obj = obj[step]) !== undefined)\n ? obj\n : def\n );\n}\n"],"mappings":";;;;;;AAAA,MAAMA,UAAU,GAAG,WAAW;AAEf,SAASC,QAAQA,CAACC,GAAQ,EAAEC,IAAuB,EAAEC,GAAS,EAAE;EAC7E,MAAMC,KAAK,GAAG,OAAOF,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACG,OAAO,CAACN,UAAU,EAAE,KAAK,CAAC,GAAGG,IAAI,CAACI,IAAI,CAAC,GAAG,CAAC;EACzF,OACEF,KAAK,CACFG,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAACC,OAAO,CAAC,CAEfC,KAAK,CAAEC,IAAY,IAAK,CAACV,GAAG,GAAGA,GAAG,CAACU,IAAI,CAAC,MAAMC,SAAS,CAAC,GACvDX,GAAG,GACHE,GAAG;AAEX","ignoreList":[]}
|
package/lib/utils/getValue.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const pathRegExp = /\[(\d+)]/g;
|
|
2
2
|
export default function getValue(obj, path, def) {
|
|
3
|
-
|
|
4
|
-
return paths.split('.').filter(Boolean).every(
|
|
5
|
-
return (obj = obj[step]) !== undefined;
|
|
6
|
-
}) ? obj : def;
|
|
3
|
+
const paths = typeof path === 'string' ? path.replace(pathRegExp, '.$1') : path.join('.');
|
|
4
|
+
return paths.split('.').filter(Boolean).every(step => (obj = obj[step]) !== undefined) ? obj : def;
|
|
7
5
|
}
|
|
8
6
|
//# sourceMappingURL=getValue.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValue.mjs","names":["pathRegExp","getValue","obj","path","def","paths","replace","join","split","filter","Boolean","every","step","undefined"],"sources":["../../src/utils/getValue.ts"],"sourcesContent":["const pathRegExp = /\\[(\\d+)]/g;\n\nexport default function getValue(obj: any, path: string | string[], def?: any) {\n const paths = typeof path === 'string' ? path.replace(pathRegExp, '.$1') : path.join('.');\n return (\n paths\n .split('.')\n .filter(Boolean)\n\n .every((step: string) => (obj = obj[step]) !== undefined)\n ? obj\n : def\n );\n}\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"getValue.mjs","names":["pathRegExp","getValue","obj","path","def","paths","replace","join","split","filter","Boolean","every","step","undefined"],"sources":["../../src/utils/getValue.ts"],"sourcesContent":["const pathRegExp = /\\[(\\d+)]/g;\n\nexport default function getValue(obj: any, path: string | string[], def?: any) {\n const paths = typeof path === 'string' ? path.replace(pathRegExp, '.$1') : path.join('.');\n return (\n paths\n .split('.')\n .filter(Boolean)\n\n .every((step: string) => (obj = obj[step]) !== undefined)\n ? obj\n : def\n );\n}\n"],"mappings":"AAAA,MAAMA,UAAU,GAAG,WAAW;AAE9B,eAAe,SAASC,QAAQA,CAACC,GAAQ,EAAEC,IAAuB,EAAEC,GAAS,EAAE;EAC7E,MAAMC,KAAK,GAAG,OAAOF,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACG,OAAO,CAACN,UAAU,EAAE,KAAK,CAAC,GAAGG,IAAI,CAACI,IAAI,CAAC,GAAG,CAAC;EACzF,OACEF,KAAK,CACFG,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAACC,OAAO,CAAC,CAEfC,KAAK,CAAEC,IAAY,IAAK,CAACV,GAAG,GAAGA,GAAG,CAACU,IAAI,CAAC,MAAMC,SAAS,CAAC,GACvDX,GAAG,GACHE,GAAG;AAEX","ignoreList":[]}
|
package/lib/utils/hasLabels.js
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
if (child !== null && child !== void 0 && child.children) {
|
|
20
|
-
var _children = []; // to exclude need of `[Symbol.iterator]()` in libs. May be replaced with simpler `[...child.children]` some day.
|
|
21
|
-
for (var i = 0; i < child.children.length; i++) _children.push(child.children.item(i));
|
|
22
|
-
var result = _traverseChildren(_children, traversed);
|
|
23
|
-
if (result) return result;
|
|
24
|
-
}
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const traverseChildren = (children, traversed) => {
|
|
8
|
+
for (const child of children) {
|
|
9
|
+
if (traversed.has(child)) continue;
|
|
10
|
+
traversed.add(child);
|
|
11
|
+
if (child.hasAttribute('aria-label')) return true;
|
|
12
|
+
if (child.hasAttribute('aria-labelledby')) return true;
|
|
13
|
+
if (child?.children) {
|
|
14
|
+
const children = []; // to exclude need of `[Symbol.iterator]()` in libs. May be replaced with simpler `[...child.children]` some day.
|
|
15
|
+
for (let i = 0; i < child.children.length; i++) children.push(child.children.item(i));
|
|
16
|
+
const result = traverseChildren(children, traversed);
|
|
17
|
+
if (result) return result;
|
|
25
18
|
}
|
|
26
|
-
} catch (err) {
|
|
27
|
-
_iterator.e(err);
|
|
28
|
-
} finally {
|
|
29
|
-
_iterator.f();
|
|
30
19
|
}
|
|
31
20
|
return false;
|
|
32
21
|
};
|
|
@@ -36,11 +25,11 @@ var _traverseChildren = function traverseChildren(children, traversed) {
|
|
|
36
25
|
* dom node or it's children have text, aria-label attribute or
|
|
37
26
|
* aria-labelledby attribute
|
|
38
27
|
*/
|
|
39
|
-
|
|
28
|
+
const hasLabels = node => {
|
|
40
29
|
if (!node) return false;
|
|
41
30
|
if (node.textContent && node.textContent.length > 0) return true;
|
|
42
|
-
|
|
43
|
-
return
|
|
31
|
+
const traversed = new Set();
|
|
32
|
+
return traverseChildren([node], traversed);
|
|
44
33
|
};
|
|
45
|
-
var _default = exports
|
|
34
|
+
var _default = exports.default = hasLabels;
|
|
46
35
|
//# sourceMappingURL=hasLabels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasLabels.js","names":["traverseChildren","children","traversed","
|
|
1
|
+
{"version":3,"file":"hasLabels.js","names":["traverseChildren","children","traversed","child","has","add","hasAttribute","i","length","push","item","result","hasLabels","node","textContent","Set","_default","exports","default"],"sources":["../../src/utils/hasLabels.ts"],"sourcesContent":["const traverseChildren = (children: Element[], traversed: Set<Element>): boolean => {\n for (const child of children) {\n if (traversed.has(child)) continue;\n traversed.add(child);\n if (child.hasAttribute('aria-label')) return true;\n if (child.hasAttribute('aria-labelledby')) return true;\n if (child?.children) {\n const children: Element[] = []; // to exclude need of `[Symbol.iterator]()` in libs. May be replaced with simpler `[...child.children]` some day.\n for (let i = 0; i < child.children.length; i++) children.push(child.children.item(i)!);\n const result = traverseChildren(children, traversed);\n if (result) return result;\n }\n }\n return false;\n};\n\n/**\n * Traverses over all nested dom nodes and return true only if\n * dom node or it's children have text, aria-label attribute or\n * aria-labelledby attribute\n */\nconst hasLabels = (node: HTMLElement | null) => {\n if (!node) return false;\n if (node.textContent && node.textContent.length > 0) return true;\n\n const traversed = new Set<Element>();\n return traverseChildren([node], traversed);\n};\n\nexport default hasLabels;\n"],"mappings":";;;;;;AAAA,MAAMA,gBAAgB,GAAGA,CAACC,QAAmB,EAAEC,SAAuB,KAAc;EAClF,KAAK,MAAMC,KAAK,IAAIF,QAAQ,EAAE;IAC5B,IAAIC,SAAS,CAACE,GAAG,CAACD,KAAK,CAAC,EAAE;IAC1BD,SAAS,CAACG,GAAG,CAACF,KAAK,CAAC;IACpB,IAAIA,KAAK,CAACG,YAAY,CAAC,YAAY,CAAC,EAAE,OAAO,IAAI;IACjD,IAAIH,KAAK,CAACG,YAAY,CAAC,iBAAiB,CAAC,EAAE,OAAO,IAAI;IACtD,IAAIH,KAAK,EAAEF,QAAQ,EAAE;MACnB,MAAMA,QAAmB,GAAG,EAAE,CAAC,CAAC;MAChC,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACF,QAAQ,CAACO,MAAM,EAAED,CAAC,EAAE,EAAEN,QAAQ,CAACQ,IAAI,CAACN,KAAK,CAACF,QAAQ,CAACS,IAAI,CAACH,CAAC,CAAE,CAAC;MACtF,MAAMI,MAAM,GAAGX,gBAAgB,CAACC,QAAQ,EAAEC,SAAS,CAAC;MACpD,IAAIS,MAAM,EAAE,OAAOA,MAAM;IAC3B;EACF;EACA,OAAO,KAAK;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAIC,IAAwB,IAAK;EAC9C,IAAI,CAACA,IAAI,EAAE,OAAO,KAAK;EACvB,IAAIA,IAAI,CAACC,WAAW,IAAID,IAAI,CAACC,WAAW,CAACN,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI;EAEhE,MAAMN,SAAS,GAAG,IAAIa,GAAG,CAAU,CAAC;EACpC,OAAOf,gBAAgB,CAAC,CAACa,IAAI,CAAC,EAAEX,SAAS,CAAC;AAC5C,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaN,SAAS","ignoreList":[]}
|
package/lib/utils/hasLabels.mjs
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
if (child !== null && child !== void 0 && child.children) {
|
|
13
|
-
var _children = []; // to exclude need of `[Symbol.iterator]()` in libs. May be replaced with simpler `[...child.children]` some day.
|
|
14
|
-
for (var i = 0; i < child.children.length; i++) _children.push(child.children.item(i));
|
|
15
|
-
var result = _traverseChildren(_children, traversed);
|
|
16
|
-
if (result) return result;
|
|
17
|
-
}
|
|
1
|
+
const traverseChildren = (children, traversed) => {
|
|
2
|
+
for (const child of children) {
|
|
3
|
+
if (traversed.has(child)) continue;
|
|
4
|
+
traversed.add(child);
|
|
5
|
+
if (child.hasAttribute('aria-label')) return true;
|
|
6
|
+
if (child.hasAttribute('aria-labelledby')) return true;
|
|
7
|
+
if (child?.children) {
|
|
8
|
+
const children = []; // to exclude need of `[Symbol.iterator]()` in libs. May be replaced with simpler `[...child.children]` some day.
|
|
9
|
+
for (let i = 0; i < child.children.length; i++) children.push(child.children.item(i));
|
|
10
|
+
const result = traverseChildren(children, traversed);
|
|
11
|
+
if (result) return result;
|
|
18
12
|
}
|
|
19
|
-
} catch (err) {
|
|
20
|
-
_iterator.e(err);
|
|
21
|
-
} finally {
|
|
22
|
-
_iterator.f();
|
|
23
13
|
}
|
|
24
14
|
return false;
|
|
25
15
|
};
|
|
@@ -29,11 +19,11 @@ var _traverseChildren = function traverseChildren(children, traversed) {
|
|
|
29
19
|
* dom node or it's children have text, aria-label attribute or
|
|
30
20
|
* aria-labelledby attribute
|
|
31
21
|
*/
|
|
32
|
-
|
|
22
|
+
const hasLabels = node => {
|
|
33
23
|
if (!node) return false;
|
|
34
24
|
if (node.textContent && node.textContent.length > 0) return true;
|
|
35
|
-
|
|
36
|
-
return
|
|
25
|
+
const traversed = new Set();
|
|
26
|
+
return traverseChildren([node], traversed);
|
|
37
27
|
};
|
|
38
28
|
export default hasLabels;
|
|
39
29
|
//# sourceMappingURL=hasLabels.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasLabels.mjs","names":["traverseChildren","children","traversed","
|
|
1
|
+
{"version":3,"file":"hasLabels.mjs","names":["traverseChildren","children","traversed","child","has","add","hasAttribute","i","length","push","item","result","hasLabels","node","textContent","Set"],"sources":["../../src/utils/hasLabels.ts"],"sourcesContent":["const traverseChildren = (children: Element[], traversed: Set<Element>): boolean => {\n for (const child of children) {\n if (traversed.has(child)) continue;\n traversed.add(child);\n if (child.hasAttribute('aria-label')) return true;\n if (child.hasAttribute('aria-labelledby')) return true;\n if (child?.children) {\n const children: Element[] = []; // to exclude need of `[Symbol.iterator]()` in libs. May be replaced with simpler `[...child.children]` some day.\n for (let i = 0; i < child.children.length; i++) children.push(child.children.item(i)!);\n const result = traverseChildren(children, traversed);\n if (result) return result;\n }\n }\n return false;\n};\n\n/**\n * Traverses over all nested dom nodes and return true only if\n * dom node or it's children have text, aria-label attribute or\n * aria-labelledby attribute\n */\nconst hasLabels = (node: HTMLElement | null) => {\n if (!node) return false;\n if (node.textContent && node.textContent.length > 0) return true;\n\n const traversed = new Set<Element>();\n return traverseChildren([node], traversed);\n};\n\nexport default hasLabels;\n"],"mappings":"AAAA,MAAMA,gBAAgB,GAAGA,CAACC,QAAmB,EAAEC,SAAuB,KAAc;EAClF,KAAK,MAAMC,KAAK,IAAIF,QAAQ,EAAE;IAC5B,IAAIC,SAAS,CAACE,GAAG,CAACD,KAAK,CAAC,EAAE;IAC1BD,SAAS,CAACG,GAAG,CAACF,KAAK,CAAC;IACpB,IAAIA,KAAK,CAACG,YAAY,CAAC,YAAY,CAAC,EAAE,OAAO,IAAI;IACjD,IAAIH,KAAK,CAACG,YAAY,CAAC,iBAAiB,CAAC,EAAE,OAAO,IAAI;IACtD,IAAIH,KAAK,EAAEF,QAAQ,EAAE;MACnB,MAAMA,QAAmB,GAAG,EAAE,CAAC,CAAC;MAChC,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,KAAK,CAACF,QAAQ,CAACO,MAAM,EAAED,CAAC,EAAE,EAAEN,QAAQ,CAACQ,IAAI,CAACN,KAAK,CAACF,QAAQ,CAACS,IAAI,CAACH,CAAC,CAAE,CAAC;MACtF,MAAMI,MAAM,GAAGX,gBAAgB,CAACC,QAAQ,EAAEC,SAAS,CAAC;MACpD,IAAIS,MAAM,EAAE,OAAOA,MAAM;IAC3B;EACF;EACA,OAAO,KAAK;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAIC,IAAwB,IAAK;EAC9C,IAAI,CAACA,IAAI,EAAE,OAAO,KAAK;EACvB,IAAIA,IAAI,CAACC,WAAW,IAAID,IAAI,CAACC,WAAW,CAACN,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI;EAEhE,MAAMN,SAAS,GAAG,IAAIa,GAAG,CAAU,CAAC;EACpC,OAAOf,gBAAgB,CAAC,CAACa,IAAI,CAAC,EAAEX,SAAS,CAAC;AAC5C,CAAC;AAED,eAAeU,SAAS","ignoreList":[]}
|
package/lib/utils/hasParent.js
CHANGED
|
@@ -4,10 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.hasParent = void 0;
|
|
7
|
-
|
|
7
|
+
const hasParent = (element, parent) => {
|
|
8
8
|
if (!element) return false;
|
|
9
9
|
if (element === document.body) return parent === document.body;
|
|
10
10
|
if (element === parent) return true;
|
|
11
|
-
return
|
|
11
|
+
return hasParent(element.parentElement, parent);
|
|
12
12
|
};
|
|
13
|
+
exports.hasParent = hasParent;
|
|
13
14
|
//# sourceMappingURL=hasParent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasParent.js","names":["hasParent","
|
|
1
|
+
{"version":3,"file":"hasParent.js","names":["hasParent","element","parent","document","body","parentElement","exports"],"sources":["../../src/utils/hasParent.ts"],"sourcesContent":["export const hasParent = (element: Element | null | undefined, parent: Element): boolean => {\n if (!element) return false;\n if (element === document.body) return parent === document.body;\n if (element === parent) return true;\n return hasParent(element.parentElement, parent);\n};\n"],"mappings":";;;;;;AAAO,MAAMA,SAAS,GAAGA,CAACC,OAAmC,EAAEC,MAAe,KAAc;EAC1F,IAAI,CAACD,OAAO,EAAE,OAAO,KAAK;EAC1B,IAAIA,OAAO,KAAKE,QAAQ,CAACC,IAAI,EAAE,OAAOF,MAAM,KAAKC,QAAQ,CAACC,IAAI;EAC9D,IAAIH,OAAO,KAAKC,MAAM,EAAE,OAAO,IAAI;EACnC,OAAOF,SAAS,CAACC,OAAO,CAACI,aAAa,EAAEH,MAAM,CAAC;AACjD,CAAC;AAACI,OAAA,CAAAN,SAAA,GAAAA,SAAA","ignoreList":[]}
|
package/lib/utils/hasParent.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export const hasParent = (element, parent) => {
|
|
2
2
|
if (!element) return false;
|
|
3
3
|
if (element === document.body) return parent === document.body;
|
|
4
4
|
if (element === parent) return true;
|
|
5
|
-
return
|
|
5
|
+
return hasParent(element.parentElement, parent);
|
|
6
6
|
};
|
|
7
|
-
export { _hasParent as hasParent };
|
|
8
7
|
//# sourceMappingURL=hasParent.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasParent.mjs","names":["hasParent","element","parent","document","body","parentElement"
|
|
1
|
+
{"version":3,"file":"hasParent.mjs","names":["hasParent","element","parent","document","body","parentElement"],"sources":["../../src/utils/hasParent.ts"],"sourcesContent":["export const hasParent = (element: Element | null | undefined, parent: Element): boolean => {\n if (!element) return false;\n if (element === document.body) return parent === document.body;\n if (element === parent) return true;\n return hasParent(element.parentElement, parent);\n};\n"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAGA,CAACC,OAAmC,EAAEC,MAAe,KAAc;EAC1F,IAAI,CAACD,OAAO,EAAE,OAAO,KAAK;EAC1B,IAAIA,OAAO,KAAKE,QAAQ,CAACC,IAAI,EAAE,OAAOF,MAAM,KAAKC,QAAQ,CAACC,IAAI;EAC9D,IAAIH,OAAO,KAAKC,MAAM,EAAE,OAAO,IAAI;EACnC,OAAOF,SAAS,CAACC,OAAO,CAACI,aAAa,EAAEH,MAAM,CAAC;AACjD,CAAC","ignoreList":[]}
|
package/lib/utils/ifChildren.js
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
function IfChildren(props) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const {
|
|
9
|
+
children,
|
|
10
|
+
context
|
|
11
|
+
} = props;
|
|
10
12
|
if (typeof children === 'function') {
|
|
11
13
|
return children(context);
|
|
12
14
|
}
|
|
13
15
|
return children;
|
|
14
16
|
}
|
|
15
|
-
var _default = exports
|
|
17
|
+
var _default = exports.default = IfChildren;
|
|
16
18
|
//# sourceMappingURL=ifChildren.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ifChildren.js","names":["IfChildren","props","children","context","_default","exports"],"sources":["../../src/utils/ifChildren.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type IfChildrenType<T> = ((props: T) => React.ReactNode) | React.ReactNode;\n\nexport interface IIfChildrenProps<T extends {}> {\n context: T;\n children: IfChildrenType<T>;\n}\n\nfunction IfChildren<T extends {}>(props: IIfChildrenProps<T>) {\n const { children, context } = props;\n if (typeof children === 'function') {\n return children(context);\n }\n return children;\n}\n\nexport default IfChildren;\n"],"mappings":";;;;;;AASA,SAASA,UAAUA,CAAeC,KAA0B,EAAE;EAC5D,
|
|
1
|
+
{"version":3,"file":"ifChildren.js","names":["IfChildren","props","children","context","_default","exports","default"],"sources":["../../src/utils/ifChildren.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type IfChildrenType<T> = ((props: T) => React.ReactNode) | React.ReactNode;\n\nexport interface IIfChildrenProps<T extends {}> {\n context: T;\n children: IfChildrenType<T>;\n}\n\nfunction IfChildren<T extends {}>(props: IIfChildrenProps<T>) {\n const { children, context } = props;\n if (typeof children === 'function') {\n return children(context);\n }\n return children;\n}\n\nexport default IfChildren;\n"],"mappings":";;;;;;AASA,SAASA,UAAUA,CAAeC,KAA0B,EAAE;EAC5D,MAAM;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGF,KAAK;EACnC,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IAClC,OAAOA,QAAQ,CAACC,OAAO,CAAC;EAC1B;EACA,OAAOD,QAAQ;AACjB;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcN,UAAU","ignoreList":[]}
|
package/lib/utils/ifChildren.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ifChildren.mjs","names":["IfChildren","props","children","context"],"sources":["../../src/utils/ifChildren.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type IfChildrenType<T> = ((props: T) => React.ReactNode) | React.ReactNode;\n\nexport interface IIfChildrenProps<T extends {}> {\n context: T;\n children: IfChildrenType<T>;\n}\n\nfunction IfChildren<T extends {}>(props: IIfChildrenProps<T>) {\n const { children, context } = props;\n if (typeof children === 'function') {\n return children(context);\n }\n return children;\n}\n\nexport default IfChildren;\n"],"mappings":"AASA,SAASA,UAAUA,CAAeC,KAA0B,EAAE;EAC5D,
|
|
1
|
+
{"version":3,"file":"ifChildren.mjs","names":["IfChildren","props","children","context"],"sources":["../../src/utils/ifChildren.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type IfChildrenType<T> = ((props: T) => React.ReactNode) | React.ReactNode;\n\nexport interface IIfChildrenProps<T extends {}> {\n context: T;\n children: IfChildrenType<T>;\n}\n\nfunction IfChildren<T extends {}>(props: IIfChildrenProps<T>) {\n const { children, context } = props;\n if (typeof children === 'function') {\n return children(context);\n }\n return children;\n}\n\nexport default IfChildren;\n"],"mappings":"AASA,SAASA,UAAUA,CAAeC,KAA0B,EAAE;EAC5D,MAAM;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGF,KAAK;EACnC,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IAClC,OAAOA,QAAQ,CAACC,OAAO,CAAC;EAC1B;EACA,OAAOD,QAAQ;AACjB;AAEA,eAAeF,UAAU","ignoreList":[]}
|
package/lib/utils/injectStyle.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
6
|
+
exports.default = void 0;
|
|
9
7
|
// THIS USE BABEL-PLUGIN-CSS-STYLE
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
let sh = null;
|
|
10
|
+
const selectorClass = '_css-style';
|
|
13
11
|
function hashCode(str) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
let hash = 0;
|
|
13
|
+
let i;
|
|
14
|
+
let chr;
|
|
17
15
|
for (i = 0; i < str.length; i++) {
|
|
18
16
|
chr = str.charCodeAt(i);
|
|
19
17
|
hash = (hash << 5) - hash + chr;
|
|
@@ -22,26 +20,26 @@ function hashCode(str) {
|
|
|
22
20
|
return hash;
|
|
23
21
|
}
|
|
24
22
|
function injectStyle(css) {
|
|
25
|
-
if (
|
|
23
|
+
if (typeof window === 'object') {
|
|
26
24
|
if (!sh) {
|
|
27
|
-
|
|
25
|
+
const prevSh = document.querySelector(`.${selectorClass}`);
|
|
28
26
|
if (prevSh) {
|
|
29
27
|
sh = prevSh;
|
|
30
28
|
} else {
|
|
31
29
|
// @ts-ignore
|
|
32
|
-
|
|
30
|
+
const version = "17.0.0";
|
|
33
31
|
sh = document.createElement('style');
|
|
34
32
|
sh.setAttribute('data-ui-v', version);
|
|
35
33
|
sh.classList.add(selectorClass);
|
|
36
34
|
document.head.appendChild(sh);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
const hash = Math.abs(hashCode(css));
|
|
40
38
|
if (!sh.dataset[hash]) {
|
|
41
39
|
sh.dataset[hash] = true;
|
|
42
40
|
sh.insertAdjacentText('beforeend', css);
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
var _default = exports
|
|
44
|
+
var _default = exports.default = injectStyle;
|
|
47
45
|
//# sourceMappingURL=injectStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectStyle.js","names":["sh","selectorClass","hashCode","str","hash","i","chr","length","charCodeAt","injectStyle","css","window","
|
|
1
|
+
{"version":3,"file":"injectStyle.js","names":["sh","selectorClass","hashCode","str","hash","i","chr","length","charCodeAt","injectStyle","css","window","prevSh","document","querySelector","version","createElement","setAttribute","classList","add","head","appendChild","Math","abs","dataset","insertAdjacentText","_default","exports","default"],"sources":["../../src/utils/injectStyle.ts"],"sourcesContent":["// THIS USE BABEL-PLUGIN-CSS-STYLE\n\nlet sh: any = null;\nconst selectorClass = '_css-style';\n\nfunction hashCode(str: string) {\n let hash = 0;\n let i;\n let chr;\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return hash;\n}\n\nfunction injectStyle(css: string) {\n if (typeof window === 'object') {\n if (!sh) {\n const prevSh = document.querySelector(`.${selectorClass}`);\n if (prevSh) {\n sh = prevSh;\n } else {\n // @ts-ignore\n const version = preval`\n module.exports = require('../../package.json').version\n `;\n sh = document.createElement('style');\n sh.setAttribute('data-ui-v', version);\n sh.classList.add(selectorClass);\n document.head.appendChild(sh);\n }\n }\n const hash = Math.abs(hashCode(css));\n if (!sh.dataset[hash]) {\n sh.dataset[hash] = true;\n sh.insertAdjacentText('beforeend', css);\n }\n }\n}\n\nexport default injectStyle;\n"],"mappings":";;;;;;AAAA;;AAEA,IAAIA,EAAO,GAAG,IAAI;AAClB,MAAMC,aAAa,GAAG,YAAY;AAElC,SAASC,QAAQA,CAACC,GAAW,EAAE;EAC7B,IAAIC,IAAI,GAAG,CAAC;EACZ,IAAIC,CAAC;EACL,IAAIC,GAAG;EACP,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACI,MAAM,EAAEF,CAAC,EAAE,EAAE;IAC/BC,GAAG,GAAGH,GAAG,CAACK,UAAU,CAACH,CAAC,CAAC;IACvBD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGE,GAAG;IAC/BF,IAAI,IAAI,CAAC,CAAC,CAAC;EACb;EACA,OAAOA,IAAI;AACb;AAEA,SAASK,WAAWA,CAACC,GAAW,EAAE;EAChC,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC9B,IAAI,CAACX,EAAE,EAAE;MACP,MAAMY,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,IAAIb,aAAa,EAAE,CAAC;MAC1D,IAAIW,MAAM,EAAE;QACVZ,EAAE,GAAGY,MAAM;MACb,CAAC,MAAM;QACL;QACA,MAAMG,OAAO,WAEZ;QACDf,EAAE,GAAGa,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;QACpChB,EAAE,CAACiB,YAAY,CAAC,WAAW,EAAEF,OAAO,CAAC;QACrCf,EAAE,CAACkB,SAAS,CAACC,GAAG,CAAClB,aAAa,CAAC;QAC/BY,QAAQ,CAACO,IAAI,CAACC,WAAW,CAACrB,EAAE,CAAC;MAC/B;IACF;IACA,MAAMI,IAAI,GAAGkB,IAAI,CAACC,GAAG,CAACrB,QAAQ,CAACQ,GAAG,CAAC,CAAC;IACpC,IAAI,CAACV,EAAE,CAACwB,OAAO,CAACpB,IAAI,CAAC,EAAE;MACrBJ,EAAE,CAACwB,OAAO,CAACpB,IAAI,CAAC,GAAG,IAAI;MACvBJ,EAAE,CAACyB,kBAAkB,CAAC,WAAW,EAAEf,GAAG,CAAC;IACzC;EACF;AACF;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcnB,WAAW","ignoreList":[]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
1
|
// THIS USE BABEL-PLUGIN-CSS-STYLE
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
let sh = null;
|
|
4
|
+
const selectorClass = '_css-style';
|
|
6
5
|
function hashCode(str) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
let hash = 0;
|
|
7
|
+
let i;
|
|
8
|
+
let chr;
|
|
10
9
|
for (i = 0; i < str.length; i++) {
|
|
11
10
|
chr = str.charCodeAt(i);
|
|
12
11
|
hash = (hash << 5) - hash + chr;
|
|
@@ -15,21 +14,21 @@ function hashCode(str) {
|
|
|
15
14
|
return hash;
|
|
16
15
|
}
|
|
17
16
|
function injectStyle(css) {
|
|
18
|
-
if (
|
|
17
|
+
if (typeof window === 'object') {
|
|
19
18
|
if (!sh) {
|
|
20
|
-
|
|
19
|
+
const prevSh = document.querySelector(`.${selectorClass}`);
|
|
21
20
|
if (prevSh) {
|
|
22
21
|
sh = prevSh;
|
|
23
22
|
} else {
|
|
24
23
|
// @ts-ignore
|
|
25
|
-
|
|
24
|
+
const version = "17.0.0";
|
|
26
25
|
sh = document.createElement('style');
|
|
27
26
|
sh.setAttribute('data-ui-v', version);
|
|
28
27
|
sh.classList.add(selectorClass);
|
|
29
28
|
document.head.appendChild(sh);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
|
|
31
|
+
const hash = Math.abs(hashCode(css));
|
|
33
32
|
if (!sh.dataset[hash]) {
|
|
34
33
|
sh.dataset[hash] = true;
|
|
35
34
|
sh.insertAdjacentText('beforeend', css);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectStyle.mjs","names":["sh","selectorClass","hashCode","str","hash","i","chr","length","charCodeAt","injectStyle","css","window","
|
|
1
|
+
{"version":3,"file":"injectStyle.mjs","names":["sh","selectorClass","hashCode","str","hash","i","chr","length","charCodeAt","injectStyle","css","window","prevSh","document","querySelector","version","createElement","setAttribute","classList","add","head","appendChild","Math","abs","dataset","insertAdjacentText"],"sources":["../../src/utils/injectStyle.ts"],"sourcesContent":["// THIS USE BABEL-PLUGIN-CSS-STYLE\n\nlet sh: any = null;\nconst selectorClass = '_css-style';\n\nfunction hashCode(str: string) {\n let hash = 0;\n let i;\n let chr;\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return hash;\n}\n\nfunction injectStyle(css: string) {\n if (typeof window === 'object') {\n if (!sh) {\n const prevSh = document.querySelector(`.${selectorClass}`);\n if (prevSh) {\n sh = prevSh;\n } else {\n // @ts-ignore\n const version = preval`\n module.exports = require('../../package.json').version\n `;\n sh = document.createElement('style');\n sh.setAttribute('data-ui-v', version);\n sh.classList.add(selectorClass);\n document.head.appendChild(sh);\n }\n }\n const hash = Math.abs(hashCode(css));\n if (!sh.dataset[hash]) {\n sh.dataset[hash] = true;\n sh.insertAdjacentText('beforeend', css);\n }\n }\n}\n\nexport default injectStyle;\n"],"mappings":"AAAA;;AAEA,IAAIA,EAAO,GAAG,IAAI;AAClB,MAAMC,aAAa,GAAG,YAAY;AAElC,SAASC,QAAQA,CAACC,GAAW,EAAE;EAC7B,IAAIC,IAAI,GAAG,CAAC;EACZ,IAAIC,CAAC;EACL,IAAIC,GAAG;EACP,KAAKD,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACI,MAAM,EAAEF,CAAC,EAAE,EAAE;IAC/BC,GAAG,GAAGH,GAAG,CAACK,UAAU,CAACH,CAAC,CAAC;IACvBD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGE,GAAG;IAC/BF,IAAI,IAAI,CAAC,CAAC,CAAC;EACb;EACA,OAAOA,IAAI;AACb;AAEA,SAASK,WAAWA,CAACC,GAAW,EAAE;EAChC,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC9B,IAAI,CAACX,EAAE,EAAE;MACP,MAAMY,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,IAAIb,aAAa,EAAE,CAAC;MAC1D,IAAIW,MAAM,EAAE;QACVZ,EAAE,GAAGY,MAAM;MACb,CAAC,MAAM;QACL;QACA,MAAMG,OAAO,WAEZ;QACDf,EAAE,GAAGa,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;QACpChB,EAAE,CAACiB,YAAY,CAAC,WAAW,EAAEF,OAAO,CAAC;QACrCf,EAAE,CAACkB,SAAS,CAACC,GAAG,CAAClB,aAAa,CAAC;QAC/BY,QAAQ,CAACO,IAAI,CAACC,WAAW,CAACrB,EAAE,CAAC;MAC/B;IACF;IACA,MAAMI,IAAI,GAAGkB,IAAI,CAACC,GAAG,CAACrB,QAAQ,CAACQ,GAAG,CAAC,CAAC;IACpC,IAAI,CAACV,EAAE,CAACwB,OAAO,CAACpB,IAAI,CAAC,EAAE;MACrBJ,EAAE,CAACwB,OAAO,CAACpB,IAAI,CAAC,GAAG,IAAI;MACvBJ,EAAE,CAACyB,kBAAkB,CAAC,WAAW,EAAEf,GAAG,CAAC;IACzC;EACF;AACF;AAEA,eAAeD,WAAW","ignoreList":[]}
|
package/lib/utils/inputProps.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = getInputProps;
|
|
7
7
|
exports.inputProps = void 0;
|
|
8
|
-
|
|
8
|
+
const inputProps = exports.inputProps = ['autoFocus', 'autoComplete', 'defaultChecked', 'checked', 'disabled', 'name', 'type', 'value', 'defaultValue', 'id', 'indeterminate', 'required', 'onInvalid', 'onChange', 'onFocus', 'onBlur', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'tabIndex', 'data-ui-name', 'inputMode'];
|
|
9
9
|
function getInputProps(props, propsList, allAriaPropsToControl) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (
|
|
10
|
+
const result = [{}, {}];
|
|
11
|
+
const keysToSplit = propsList || inputProps;
|
|
12
|
+
for (const key in props) {
|
|
13
13
|
if (keysToSplit.includes(key) || allAriaPropsToControl && key.startsWith('aria-')) {
|
|
14
14
|
result[0][key] = props[key];
|
|
15
15
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputProps.js","names":["inputProps","exports","getInputProps","props","propsList","allAriaPropsToControl","result","keysToSplit","key","includes","startsWith"],"sources":["../../src/utils/inputProps.ts"],"sourcesContent":["export const inputProps = [\n 'autoFocus',\n 'autoComplete',\n 'defaultChecked',\n 'checked',\n 'disabled',\n 'name',\n 'type',\n 'value',\n 'defaultValue',\n 'id',\n 'indeterminate',\n 'required',\n 'onInvalid',\n 'onChange',\n 'onFocus',\n 'onBlur',\n 'onKeyDown',\n 'onKeyPress',\n 'onKeyUp',\n 'tabIndex',\n 'data-ui-name',\n 'inputMode',\n];\n\ntype ExtractedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Extract<keyof T, K[number]>>\n>;\ntype ExcludedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Exclude<keyof T, K[number]>>\n>;\n\nexport default function getInputProps<\n T extends Partial<Record<K[number], any>>,\n K extends Array<keyof T>,\n>(props: T, propsList?: K, allAriaPropsToControl?: boolean) {\n const result: [ExtractedProps<T, K>, ExcludedProps<T, K>] = [{}, {}];\n\n const keysToSplit = propsList || (inputProps as unknown as K);\n\n for (const key in props) {\n if (keysToSplit.includes(key) || (allAriaPropsToControl && key.startsWith('aria-'))) {\n result[0][key as unknown as keyof ExtractedProps<T, K>] = props[key];\n } else {\n result[1][key as unknown as keyof ExcludedProps<T, K>] = props[key];\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;AAAO,
|
|
1
|
+
{"version":3,"file":"inputProps.js","names":["inputProps","exports","getInputProps","props","propsList","allAriaPropsToControl","result","keysToSplit","key","includes","startsWith"],"sources":["../../src/utils/inputProps.ts"],"sourcesContent":["export const inputProps = [\n 'autoFocus',\n 'autoComplete',\n 'defaultChecked',\n 'checked',\n 'disabled',\n 'name',\n 'type',\n 'value',\n 'defaultValue',\n 'id',\n 'indeterminate',\n 'required',\n 'onInvalid',\n 'onChange',\n 'onFocus',\n 'onBlur',\n 'onKeyDown',\n 'onKeyPress',\n 'onKeyUp',\n 'tabIndex',\n 'data-ui-name',\n 'inputMode',\n];\n\ntype ExtractedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Extract<keyof T, K[number]>>\n>;\ntype ExcludedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Exclude<keyof T, K[number]>>\n>;\n\nexport default function getInputProps<\n T extends Partial<Record<K[number], any>>,\n K extends Array<keyof T>,\n>(props: T, propsList?: K, allAriaPropsToControl?: boolean) {\n const result: [ExtractedProps<T, K>, ExcludedProps<T, K>] = [{}, {}];\n\n const keysToSplit = propsList || (inputProps as unknown as K);\n\n for (const key in props) {\n if (keysToSplit.includes(key) || (allAriaPropsToControl && key.startsWith('aria-'))) {\n result[0][key as unknown as keyof ExtractedProps<T, K>] = props[key];\n } else {\n result[1][key as unknown as keyof ExcludedProps<T, K>] = props[key];\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;AAAO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,CACxB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,cAAc,EACd,IAAI,EACJ,eAAe,EACf,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,cAAc,EACd,WAAW,CACZ;AASc,SAASE,aAAaA,CAGnCC,KAAQ,EAAEC,SAAa,EAAEC,qBAA+B,EAAE;EAC1D,MAAMC,MAAmD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAEpE,MAAMC,WAAW,GAAGH,SAAS,IAAKJ,UAA2B;EAE7D,KAAK,MAAMQ,GAAG,IAAIL,KAAK,EAAE;IACvB,IAAII,WAAW,CAACE,QAAQ,CAACD,GAAG,CAAC,IAAKH,qBAAqB,IAAIG,GAAG,CAACE,UAAU,CAAC,OAAO,CAAE,EAAE;MACnFJ,MAAM,CAAC,CAAC,CAAC,CAACE,GAAG,CAA0C,GAAGL,KAAK,CAACK,GAAG,CAAC;IACtE,CAAC,MAAM;MACLF,MAAM,CAAC,CAAC,CAAC,CAACE,GAAG,CAAyC,GAAGL,KAAK,CAACK,GAAG,CAAC;IACrE;EACF;EAEA,OAAOF,MAAM;AACf","ignoreList":[]}
|
package/lib/utils/inputProps.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const inputProps = ['autoFocus', 'autoComplete', 'defaultChecked', 'checked', 'disabled', 'name', 'type', 'value', 'defaultValue', 'id', 'indeterminate', 'required', 'onInvalid', 'onChange', 'onFocus', 'onBlur', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'tabIndex', 'data-ui-name', 'inputMode'];
|
|
2
2
|
export default function getInputProps(props, propsList, allAriaPropsToControl) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (
|
|
3
|
+
const result = [{}, {}];
|
|
4
|
+
const keysToSplit = propsList || inputProps;
|
|
5
|
+
for (const key in props) {
|
|
6
6
|
if (keysToSplit.includes(key) || allAriaPropsToControl && key.startsWith('aria-')) {
|
|
7
7
|
result[0][key] = props[key];
|
|
8
8
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputProps.mjs","names":["inputProps","getInputProps","props","propsList","allAriaPropsToControl","result","keysToSplit","key","includes","startsWith"],"sources":["../../src/utils/inputProps.ts"],"sourcesContent":["export const inputProps = [\n 'autoFocus',\n 'autoComplete',\n 'defaultChecked',\n 'checked',\n 'disabled',\n 'name',\n 'type',\n 'value',\n 'defaultValue',\n 'id',\n 'indeterminate',\n 'required',\n 'onInvalid',\n 'onChange',\n 'onFocus',\n 'onBlur',\n 'onKeyDown',\n 'onKeyPress',\n 'onKeyUp',\n 'tabIndex',\n 'data-ui-name',\n 'inputMode',\n];\n\ntype ExtractedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Extract<keyof T, K[number]>>\n>;\ntype ExcludedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Exclude<keyof T, K[number]>>\n>;\n\nexport default function getInputProps<\n T extends Partial<Record<K[number], any>>,\n K extends Array<keyof T>,\n>(props: T, propsList?: K, allAriaPropsToControl?: boolean) {\n const result: [ExtractedProps<T, K>, ExcludedProps<T, K>] = [{}, {}];\n\n const keysToSplit = propsList || (inputProps as unknown as K);\n\n for (const key in props) {\n if (keysToSplit.includes(key) || (allAriaPropsToControl && key.startsWith('aria-'))) {\n result[0][key as unknown as keyof ExtractedProps<T, K>] = props[key];\n } else {\n result[1][key as unknown as keyof ExcludedProps<T, K>] = props[key];\n }\n }\n\n return result;\n}\n"],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"inputProps.mjs","names":["inputProps","getInputProps","props","propsList","allAriaPropsToControl","result","keysToSplit","key","includes","startsWith"],"sources":["../../src/utils/inputProps.ts"],"sourcesContent":["export const inputProps = [\n 'autoFocus',\n 'autoComplete',\n 'defaultChecked',\n 'checked',\n 'disabled',\n 'name',\n 'type',\n 'value',\n 'defaultValue',\n 'id',\n 'indeterminate',\n 'required',\n 'onInvalid',\n 'onChange',\n 'onFocus',\n 'onBlur',\n 'onKeyDown',\n 'onKeyPress',\n 'onKeyUp',\n 'tabIndex',\n 'data-ui-name',\n 'inputMode',\n];\n\ntype ExtractedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Extract<keyof T, K[number]>>\n>;\ntype ExcludedProps<T extends object, K extends Array<keyof T>> = Partial<\n Pick<T, Exclude<keyof T, K[number]>>\n>;\n\nexport default function getInputProps<\n T extends Partial<Record<K[number], any>>,\n K extends Array<keyof T>,\n>(props: T, propsList?: K, allAriaPropsToControl?: boolean) {\n const result: [ExtractedProps<T, K>, ExcludedProps<T, K>] = [{}, {}];\n\n const keysToSplit = propsList || (inputProps as unknown as K);\n\n for (const key in props) {\n if (keysToSplit.includes(key) || (allAriaPropsToControl && key.startsWith('aria-'))) {\n result[0][key as unknown as keyof ExtractedProps<T, K>] = props[key];\n } else {\n result[1][key as unknown as keyof ExcludedProps<T, K>] = props[key];\n }\n }\n\n return result;\n}\n"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAG,CACxB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,cAAc,EACd,IAAI,EACJ,eAAe,EACf,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,cAAc,EACd,WAAW,CACZ;AASD,eAAe,SAASC,aAAaA,CAGnCC,KAAQ,EAAEC,SAAa,EAAEC,qBAA+B,EAAE;EAC1D,MAAMC,MAAmD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAEpE,MAAMC,WAAW,GAAGH,SAAS,IAAKH,UAA2B;EAE7D,KAAK,MAAMO,GAAG,IAAIL,KAAK,EAAE;IACvB,IAAII,WAAW,CAACE,QAAQ,CAACD,GAAG,CAAC,IAAKH,qBAAqB,IAAIG,GAAG,CAACE,UAAU,CAAC,OAAO,CAAE,EAAE;MACnFJ,MAAM,CAAC,CAAC,CAAC,CAACE,GAAG,CAA0C,GAAGL,KAAK,CAACK,GAAG,CAAC;IACtE,CAAC,MAAM;MACLF,MAAM,CAAC,CAAC,CAAC,CAACE,GAAG,CAAyC,GAAGL,KAAK,CAACK,GAAG,CAAC;IACrE;EACF;EAEA,OAAOF,MAAM;AACf","ignoreList":[]}
|
|
@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isInteractiveElement = isInteractiveElement;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const interactiveTags = new Set(['button', 'a', 'input', 'select', 'textarea', 'details', 'summary']);
|
|
8
|
+
const interactiveRoles = new Set(['button', 'link', 'checkbox', 'radio', 'combobox', 'menuitem', 'menuitemcheckbox', 'menuitemradio']);
|
|
9
|
+
const uikitInteractive = ['Button', 'Link', 'Select', 'Dropdown', 'Tag', 'DescriptionTooltip'];
|
|
10
10
|
function isInteractiveElement(element) {
|
|
11
11
|
if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;
|
|
12
12
|
if (element.getAttribute('disabled') === 'true') return false;
|
|
13
|
-
|
|
14
|
-
if (uikitName && uikitInteractive.some(
|
|
15
|
-
|
|
16
|
-
})) return true;
|
|
17
|
-
var tagName = element.tagName.toLowerCase();
|
|
13
|
+
const uikitName = element.dataset.uiName;
|
|
14
|
+
if (uikitName && uikitInteractive.some(interactive => uikitName.startsWith(interactive))) return true;
|
|
15
|
+
const tagName = element.tagName.toLowerCase();
|
|
18
16
|
if (interactiveTags.has(tagName)) {
|
|
19
17
|
// Special case: <a> is only interactive with href
|
|
20
18
|
if (tagName === 'a') {
|
|
@@ -27,7 +25,7 @@ function isInteractiveElement(element) {
|
|
|
27
25
|
if (element.hasAttribute('tabindex') && element.tabIndex >= 0) return true;
|
|
28
26
|
|
|
29
27
|
// Elements with ARIA roles indicating interactivity
|
|
30
|
-
|
|
28
|
+
const role = element.getAttribute('role');
|
|
31
29
|
if (role && interactiveRoles.has(role.toLowerCase())) return true;
|
|
32
30
|
return false;
|
|
33
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInteractiveElement.js","names":["interactiveTags","Set","interactiveRoles","uikitInteractive","isInteractiveElement","element","HTMLElement","SVGElement","getAttribute","uikitName","dataset","uiName","some","interactive","startsWith","tagName","toLowerCase","has","hasAttribute","tabIndex","role"],"sources":["../../src/utils/isInteractiveElement.ts"],"sourcesContent":["const interactiveTags = new Set([\n 'button',\n 'a',\n 'input',\n 'select',\n 'textarea',\n 'details',\n 'summary',\n]);\n\nconst interactiveRoles = new Set([\n 'button',\n 'link',\n 'checkbox',\n 'radio',\n 'combobox',\n 'menuitem',\n 'menuitemcheckbox',\n 'menuitemradio',\n]);\n\nconst uikitInteractive = ['Button', 'Link', 'Select', 'Dropdown', 'Tag', 'DescriptionTooltip'];\n\nexport function isInteractiveElement(element: unknown): boolean {\n if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;\n if (element.getAttribute('disabled') === 'true') return false;\n\n const uikitName = element.dataset.uiName;\n\n if (uikitName && uikitInteractive.some((interactive) => uikitName.startsWith(interactive)))\n return true;\n\n const tagName = element.tagName.toLowerCase();\n\n if (interactiveTags.has(tagName)) {\n // Special case: <a> is only interactive with href\n if (tagName === 'a') {\n return element.hasAttribute('href');\n }\n return true;\n }\n\n // Elements with tabindex are usually meant to be interactive\n if (element.hasAttribute('tabindex') && element.tabIndex >= 0) return true;\n\n // Elements with ARIA roles indicating interactivity\n const role = element.getAttribute('role');\n if (role && interactiveRoles.has(role.toLowerCase())) return true;\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"isInteractiveElement.js","names":["interactiveTags","Set","interactiveRoles","uikitInteractive","isInteractiveElement","element","HTMLElement","SVGElement","getAttribute","uikitName","dataset","uiName","some","interactive","startsWith","tagName","toLowerCase","has","hasAttribute","tabIndex","role"],"sources":["../../src/utils/isInteractiveElement.ts"],"sourcesContent":["const interactiveTags = new Set([\n 'button',\n 'a',\n 'input',\n 'select',\n 'textarea',\n 'details',\n 'summary',\n]);\n\nconst interactiveRoles = new Set([\n 'button',\n 'link',\n 'checkbox',\n 'radio',\n 'combobox',\n 'menuitem',\n 'menuitemcheckbox',\n 'menuitemradio',\n]);\n\nconst uikitInteractive = ['Button', 'Link', 'Select', 'Dropdown', 'Tag', 'DescriptionTooltip'];\n\nexport function isInteractiveElement(element: unknown): boolean {\n if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;\n if (element.getAttribute('disabled') === 'true') return false;\n\n const uikitName = element.dataset.uiName;\n\n if (uikitName && uikitInteractive.some((interactive) => uikitName.startsWith(interactive)))\n return true;\n\n const tagName = element.tagName.toLowerCase();\n\n if (interactiveTags.has(tagName)) {\n // Special case: <a> is only interactive with href\n if (tagName === 'a') {\n return element.hasAttribute('href');\n }\n return true;\n }\n\n // Elements with tabindex are usually meant to be interactive\n if (element.hasAttribute('tabindex') && element.tabIndex >= 0) return true;\n\n // Elements with ARIA roles indicating interactivity\n const role = element.getAttribute('role');\n if (role && interactiveRoles.has(role.toLowerCase())) return true;\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,MAAMA,eAAe,GAAG,IAAIC,GAAG,CAAC,CAC9B,QAAQ,EACR,GAAG,EACH,OAAO,EACP,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,CACV,CAAC;AAEF,MAAMC,gBAAgB,GAAG,IAAID,GAAG,CAAC,CAC/B,QAAQ,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,eAAe,CAChB,CAAC;AAEF,MAAME,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,oBAAoB,CAAC;AAEvF,SAASC,oBAAoBA,CAACC,OAAgB,EAAW;EAC9D,IAAI,EAAEA,OAAO,YAAYC,WAAW,CAAC,IAAI,EAAED,OAAO,YAAYE,UAAU,CAAC,EAAE,OAAO,KAAK;EACvF,IAAIF,OAAO,CAACG,YAAY,CAAC,UAAU,CAAC,KAAK,MAAM,EAAE,OAAO,KAAK;EAE7D,MAAMC,SAAS,GAAGJ,OAAO,CAACK,OAAO,CAACC,MAAM;EAExC,IAAIF,SAAS,IAAIN,gBAAgB,CAACS,IAAI,CAAEC,WAAW,IAAKJ,SAAS,CAACK,UAAU,CAACD,WAAW,CAAC,CAAC,EACxF,OAAO,IAAI;EAEb,MAAME,OAAO,GAAGV,OAAO,CAACU,OAAO,CAACC,WAAW,CAAC,CAAC;EAE7C,IAAIhB,eAAe,CAACiB,GAAG,CAACF,OAAO,CAAC,EAAE;IAChC;IACA,IAAIA,OAAO,KAAK,GAAG,EAAE;MACnB,OAAOV,OAAO,CAACa,YAAY,CAAC,MAAM,CAAC;IACrC;IACA,OAAO,IAAI;EACb;;EAEA;EACA,IAAIb,OAAO,CAACa,YAAY,CAAC,UAAU,CAAC,IAAIb,OAAO,CAACc,QAAQ,IAAI,CAAC,EAAE,OAAO,IAAI;;EAE1E;EACA,MAAMC,IAAI,GAAGf,OAAO,CAACG,YAAY,CAAC,MAAM,CAAC;EACzC,IAAIY,IAAI,IAAIlB,gBAAgB,CAACe,GAAG,CAACG,IAAI,CAACJ,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI;EAEjE,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const interactiveTags = new Set(['button', 'a', 'input', 'select', 'textarea', 'details', 'summary']);
|
|
2
|
+
const interactiveRoles = new Set(['button', 'link', 'checkbox', 'radio', 'combobox', 'menuitem', 'menuitemcheckbox', 'menuitemradio']);
|
|
3
|
+
const uikitInteractive = ['Button', 'Link', 'Select', 'Dropdown', 'Tag', 'DescriptionTooltip'];
|
|
4
4
|
export function isInteractiveElement(element) {
|
|
5
5
|
if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;
|
|
6
6
|
if (element.getAttribute('disabled') === 'true') return false;
|
|
7
|
-
|
|
8
|
-
if (uikitName && uikitInteractive.some(
|
|
9
|
-
|
|
10
|
-
})) return true;
|
|
11
|
-
var tagName = element.tagName.toLowerCase();
|
|
7
|
+
const uikitName = element.dataset.uiName;
|
|
8
|
+
if (uikitName && uikitInteractive.some(interactive => uikitName.startsWith(interactive))) return true;
|
|
9
|
+
const tagName = element.tagName.toLowerCase();
|
|
12
10
|
if (interactiveTags.has(tagName)) {
|
|
13
11
|
// Special case: <a> is only interactive with href
|
|
14
12
|
if (tagName === 'a') {
|
|
@@ -21,7 +19,7 @@ export function isInteractiveElement(element) {
|
|
|
21
19
|
if (element.hasAttribute('tabindex') && element.tabIndex >= 0) return true;
|
|
22
20
|
|
|
23
21
|
// Elements with ARIA roles indicating interactivity
|
|
24
|
-
|
|
22
|
+
const role = element.getAttribute('role');
|
|
25
23
|
if (role && interactiveRoles.has(role.toLowerCase())) return true;
|
|
26
24
|
return false;
|
|
27
25
|
}
|