@ui5/webcomponents-base 0.0.0-7d5f73b20 → 0.0.0-81513ce21
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/.eslintignore +4 -4
- package/.eslintrc.cjs +3 -0
- package/.npsrc.json +3 -0
- package/CHANGELOG.md +185 -0
- package/bundle.esm.js +5 -1
- package/config/wdio.conf.cjs +400 -0
- package/dist/AssetRegistry.js.map +1 -1
- package/dist/Boot.d.ts +4 -3
- package/dist/Boot.js +31 -4
- package/dist/Boot.js.map +1 -1
- package/dist/CSP.js.map +1 -1
- package/dist/CustomElementsRegistry.js.map +1 -1
- package/dist/CustomElementsScope.js.map +1 -1
- package/dist/CustomElementsScopeUtils.js.map +1 -1
- package/dist/DOMObserver.js.map +1 -1
- package/dist/Device.js +109 -34
- package/dist/Device.js.map +1 -1
- package/dist/EventProvider.js +1 -1
- package/dist/EventProvider.js.map +1 -1
- package/dist/FeaturesRegistry.js.map +1 -1
- package/dist/FontFace.js.map +1 -1
- package/dist/InitialConfiguration.d.ts +6 -1
- package/dist/InitialConfiguration.js +11 -2
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/Keys.js.map +1 -1
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/MarkedEvents.js.map +1 -1
- package/dist/MediaRange.js.map +1 -1
- package/dist/PropertiesFileFormat.js.map +1 -1
- package/dist/Render.js.map +1 -1
- package/dist/RenderQueue.js.map +1 -1
- package/dist/Runtimes.js.map +1 -1
- package/dist/StaticArea.d.ts +3 -0
- package/dist/StaticArea.js +4 -3
- package/dist/StaticArea.js.map +1 -1
- package/dist/StaticAreaItem.js.map +1 -1
- package/dist/SystemCSSVars.js.map +1 -1
- package/dist/Theming.js.map +1 -1
- package/dist/UI5Element.d.ts +20 -14
- package/dist/UI5Element.js +18 -22
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/animations/AnimationQueue.js.map +1 -1
- package/dist/animations/animate.js.map +1 -1
- package/dist/animations/scroll.js.map +1 -1
- package/dist/animations/slideDown.js.map +1 -1
- package/dist/animations/slideUp.js.map +1 -1
- package/dist/api.json +1 -1
- package/dist/asset-registries/Icons.d.ts +18 -10
- package/dist/asset-registries/Icons.js +44 -23
- package/dist/asset-registries/Icons.js.map +1 -1
- package/dist/asset-registries/Illustrations.d.ts +1 -1
- package/dist/asset-registries/Illustrations.js.map +1 -1
- package/dist/asset-registries/LocaleData.js.map +1 -1
- package/dist/asset-registries/Themes.d.ts +1 -0
- package/dist/asset-registries/Themes.js +2 -0
- package/dist/asset-registries/Themes.js.map +1 -1
- package/dist/asset-registries/i18n.js +9 -3
- package/dist/asset-registries/i18n.js.map +1 -1
- package/dist/assets/Boot.34b7cea0.css +1 -0
- package/dist/assets/Boot.de8032fc.js +9 -0
- package/dist/assets/bundle.esm.6ca2666f.js +50 -0
- package/dist/assets-meta/IconCollectionsAlias.d.ts +24 -10
- package/dist/assets-meta/IconCollectionsAlias.js +29 -9
- package/dist/assets-meta/IconCollectionsAlias.js.map +1 -1
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/config/CalendarType.js.map +1 -1
- package/dist/config/FormatSettings.d.ts +5 -1
- package/dist/config/FormatSettings.js +5 -1
- package/dist/config/FormatSettings.js.map +1 -1
- package/dist/config/Icons.d.ts +43 -18
- package/dist/config/Icons.js +81 -26
- package/dist/config/Icons.js.map +1 -1
- package/dist/config/Language.d.ts +10 -1
- package/dist/config/Language.js +13 -1
- package/dist/config/Language.js.map +1 -1
- package/dist/config/NoConflict.js +1 -0
- package/dist/config/NoConflict.js.map +1 -1
- package/dist/config/RTL.js +3 -0
- package/dist/config/RTL.js.map +1 -1
- package/dist/config/Theme.d.ts +15 -5
- package/dist/config/Theme.js +25 -6
- package/dist/config/Theme.js.map +1 -1
- package/dist/config/ThemeRoots.js.map +1 -1
- package/dist/config/Timezone.d.ts +17 -0
- package/dist/config/Timezone.js +30 -0
- package/dist/config/Timezone.js.map +1 -0
- package/dist/decorators/customElement.d.ts +17 -2
- package/dist/decorators/customElement.js +26 -5
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/decorators/event.js +6 -6
- package/dist/decorators/event.js.map +1 -1
- package/dist/decorators/property.js +6 -6
- package/dist/decorators/property.js.map +1 -1
- package/dist/decorators/slot.js +9 -9
- package/dist/decorators/slot.js.map +1 -1
- package/dist/delegate/ItemNavigation.js.map +1 -1
- package/dist/delegate/ResizeHandler.d.ts +2 -1
- package/dist/delegate/ResizeHandler.js +7 -3
- package/dist/delegate/ResizeHandler.js.map +1 -1
- package/dist/delegate/ScrollEnablement.js.map +1 -1
- package/dist/features/F6Navigation.d.ts +3 -0
- package/dist/features/F6Navigation.js +77 -38
- package/dist/features/F6Navigation.js.map +1 -1
- package/dist/features/LegacyDateFormats.d.ts +18 -0
- package/dist/features/LegacyDateFormats.js +20 -0
- package/dist/features/LegacyDateFormats.js.map +1 -0
- package/dist/features/OpenUI5Element.js.map +1 -1
- package/dist/features/OpenUI5Enablement.js.map +1 -1
- package/dist/features/OpenUI5Support.d.ts +3 -0
- package/dist/features/OpenUI5Support.js +2 -0
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/generated/AssetParameters.js +2 -0
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/css/BusyIndicator.css.js.map +1 -1
- package/dist/generated/css/FontFace.css.js.map +1 -1
- package/dist/generated/css/OverrideFontFace.css.js.map +1 -1
- package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js +8 -10
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +1 -0
- package/dist/getSharedResource.d.ts +1 -1
- package/dist/getSharedResource.js +10 -2
- package/dist/getSharedResource.js.map +1 -1
- package/dist/global.d.ts +2 -0
- package/dist/i18nBundle.js +2 -1
- package/dist/i18nBundle.js.map +1 -1
- package/dist/locale/Locale.js.map +1 -1
- package/dist/locale/RTLAwareRegistry.d.ts +1 -1
- package/dist/locale/RTLAwareRegistry.js.map +1 -1
- package/dist/locale/applyDirection.js.map +1 -1
- package/dist/locale/directionChange.js.map +1 -1
- package/dist/locale/getEffectiveDir.js.map +1 -1
- package/dist/locale/getLocale.js.map +1 -1
- package/dist/locale/languageChange.js.map +1 -1
- package/dist/locale/nextFallbackLocale.js.map +1 -1
- package/dist/locale/normalizeLocale.js.map +1 -1
- package/dist/renderer/LitRenderer.d.ts +3 -3
- package/dist/renderer/LitRenderer.js.map +1 -1
- package/dist/renderer/executeTemplate.js +1 -1
- package/dist/renderer/executeTemplate.js.map +1 -1
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
- package/dist/theming/CustomStyle.js +7 -5
- package/dist/theming/CustomStyle.js.map +1 -1
- package/dist/theming/ThemeLoaded.js.map +1 -1
- package/dist/theming/ThemeRegistered.d.ts +4 -0
- package/dist/theming/ThemeRegistered.js +11 -0
- package/dist/theming/ThemeRegistered.js.map +1 -0
- package/dist/theming/applyTheme.js.map +1 -1
- package/dist/theming/getConstructableStyle.js.map +1 -1
- package/dist/theming/getEffectiveLinksHrefs.js.map +1 -1
- package/dist/theming/getEffectiveStyle.js.map +1 -1
- package/dist/theming/getStylesString.d.ts +1 -1
- package/dist/theming/getStylesString.js.map +1 -1
- package/dist/theming/getThemeDesignerTheme.js.map +1 -1
- package/dist/theming/preloadLinks.js.map +1 -1
- package/dist/thirdparty/_merge.js.map +1 -1
- package/dist/thirdparty/isPlainObject.js.map +1 -1
- package/dist/thirdparty/merge.js.map +1 -1
- package/dist/types/AnimationMode.d.ts +1 -1
- package/dist/types/AnimationMode.js +1 -1
- package/dist/types/AnimationMode.js.map +1 -1
- package/dist/types/CSSColor.d.ts +0 -1
- package/dist/types/CSSColor.js +0 -1
- package/dist/types/CSSColor.js.map +1 -1
- package/dist/types/CalendarType.d.ts +1 -1
- package/dist/types/CalendarType.js +1 -1
- package/dist/types/CalendarType.js.map +1 -1
- package/dist/types/DOMReference.js.map +1 -1
- package/dist/types/DataType.js.map +1 -1
- package/dist/types/Float.d.ts +0 -1
- package/dist/types/Float.js +0 -1
- package/dist/types/Float.js.map +1 -1
- package/dist/types/Integer.d.ts +0 -1
- package/dist/types/Integer.js +0 -1
- package/dist/types/Integer.js.map +1 -1
- package/dist/types/InvisibleMessageMode.d.ts +1 -1
- package/dist/types/InvisibleMessageMode.js +1 -1
- package/dist/types/InvisibleMessageMode.js.map +1 -1
- package/dist/types/ItemNavigationBehavior.d.ts +1 -1
- package/dist/types/ItemNavigationBehavior.js +1 -1
- package/dist/types/ItemNavigationBehavior.js.map +1 -1
- package/dist/types/NavigationMode.d.ts +1 -1
- package/dist/types/NavigationMode.js +1 -1
- package/dist/types/NavigationMode.js.map +1 -1
- package/dist/types/ValueState.d.ts +1 -1
- package/dist/types/ValueState.js +1 -1
- package/dist/types/ValueState.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/updateShadowRoot.js +11 -4
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/AriaLabelHelper.d.ts +10 -1
- package/dist/util/AriaLabelHelper.js +135 -8
- package/dist/util/AriaLabelHelper.js.map +1 -1
- package/dist/util/Caret.js.map +1 -1
- package/dist/util/ColorConversion.js.map +1 -1
- package/dist/util/FetchHelper.js.map +1 -1
- package/dist/util/FocusableElements.js +4 -3
- package/dist/util/FocusableElements.js.map +1 -1
- package/dist/util/HTMLSanitizer.js.map +1 -1
- package/dist/util/InvisibleMessage.js.map +1 -1
- package/dist/util/PopupUtils.js.map +1 -1
- package/dist/util/SlotsHelper.js.map +1 -1
- package/dist/util/StringHelper.js.map +1 -1
- package/dist/util/TabbableElements.js.map +1 -1
- package/dist/util/arraysAreEqual.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/createLinkInHead.js.map +1 -1
- package/dist/util/createStyleInHead.js.map +1 -1
- package/dist/util/debounce.js.map +1 -1
- package/dist/util/detectNavigatorLanguage.js.map +1 -1
- package/dist/util/escapeRegex.js.map +1 -1
- package/dist/util/formatMessage.js.map +1 -1
- package/dist/util/generateHighlightedMarkup.js.map +1 -1
- package/dist/util/getActiveElement.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +9 -9
- package/dist/util/getClassCopy.js.map +1 -1
- package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
- package/dist/util/getEffectiveContentDensity.js.map +1 -1
- package/dist/util/getEffectiveScrollbarStyle.js.map +1 -1
- package/dist/util/getFastNavigationGroups.js.map +1 -1
- package/dist/util/getFileExtension.js.map +1 -1
- package/dist/util/getNormalizedTarget.js.map +1 -1
- package/dist/util/getSingletonElementInstance.js.map +1 -1
- package/dist/util/isElementClickable.js.map +1 -1
- package/dist/util/isElementHidden.js.map +1 -1
- package/dist/util/isElementInView.js.map +1 -1
- package/dist/util/isElementTabbable.js.map +1 -1
- package/dist/util/isValidPropertyName.js.map +1 -1
- package/dist/util/whenDOMReady.js.map +1 -1
- package/dist/util/willShowContent.js.map +1 -1
- package/dist/validateThemeRoot.js +14 -13
- package/dist/validateThemeRoot.js.map +1 -1
- package/index.js +227 -1
- package/lib/generate-asset-parameters/index.js +4 -2
- package/lib/generate-styles/index.js +3 -3
- package/lib/generate-version-info/index.js +1 -1
- package/{package-scripts.js → package-scripts.cjs} +9 -5
- package/package.json +5 -4
- package/tsconfig.json +3 -1
- package/config/wdio.conf.js +0 -1
- package/dist/assets/bundle.esm.5c683084.js +0 -56
- package/dist/decorators/fastNavigation.d.ts +0 -7
- package/dist/decorators/fastNavigation.js +0 -13
- package/dist/decorators/fastNavigation.js.map +0 -1
- package/dist/decorators/languageAware.d.ts +0 -7
- package/dist/decorators/languageAware.js +0 -13
- package/dist/decorators/languageAware.js.map +0 -1
- package/dist/decorators/themeAware.d.ts +0 -7
- package/dist/decorators/themeAware.js +0 -13
- package/dist/decorators/themeAware.js.map +0 -1
- package/src/AssetRegistry.ts +0 -11
- package/src/Boot.ts +0 -61
- package/src/CSP.ts +0 -66
- package/src/CustomElementsRegistry.ts +0 -98
- package/src/CustomElementsScope.ts +0 -33
- package/src/CustomElementsScopeUtils.ts +0 -115
- package/src/DOMObserver.ts +0 -28
- package/src/Device.ts +0 -124
- package/src/EventProvider.ts +0 -87
- package/src/FeaturesRegistry.ts +0 -14
- package/src/FontFace.ts +0 -31
- package/src/InitialConfiguration.ts +0 -207
- package/src/Keys.ts +0 -295
- package/src/ManagedStyles.ts +0 -92
- package/src/MarkedEvents.ts +0 -20
- package/src/MediaRange.ts +0 -110
- package/src/PropertiesFileFormat.ts +0 -95
- package/src/Render.ts +0 -180
- package/src/RenderQueue.ts +0 -71
- package/src/Runtimes.ts +0 -114
- package/src/StaticArea.ts +0 -3
- package/src/StaticAreaItem.ts +0 -113
- package/src/SystemCSSVars.ts +0 -10
- package/src/Theming.ts +0 -4
- package/src/UI5Element.ts +0 -1156
- package/src/UI5ElementMetadata.ts +0 -389
- package/src/animations/AnimationQueue.ts +0 -43
- package/src/animations/animate.ts +0 -64
- package/src/animations/scroll.ts +0 -21
- package/src/animations/slideDown.ts +0 -72
- package/src/animations/slideUp.ts +0 -67
- package/src/asset-registries/Icons.ts +0 -162
- package/src/asset-registries/Illustrations.ts +0 -75
- package/src/asset-registries/LocaleData.ts +0 -172
- package/src/asset-registries/Themes.ts +0 -67
- package/src/asset-registries/i18n.ts +0 -118
- package/src/assets-meta/IconCollectionsAlias.ts +0 -18
- package/src/config/AnimationMode.ts +0 -33
- package/src/config/CalendarType.ts +0 -23
- package/src/config/FormatSettings.ts +0 -21
- package/src/config/Icons.ts +0 -59
- package/src/config/Language.ts +0 -72
- package/src/config/NoConflict.ts +0 -67
- package/src/config/RTL.ts +0 -41
- package/src/config/Theme.ts +0 -64
- package/src/config/ThemeRoots.ts +0 -41
- package/src/decorators/customElement.ts +0 -17
- package/src/decorators/event.ts +0 -28
- package/src/decorators/fastNavigation.ts +0 -14
- package/src/decorators/languageAware.ts +0 -14
- package/src/decorators/property.ts +0 -30
- package/src/decorators/slot.ts +0 -49
- package/src/decorators/themeAware.ts +0 -14
- package/src/delegate/ItemNavigation.ts +0 -393
- package/src/delegate/ResizeHandler.ts +0 -95
- package/src/delegate/ScrollEnablement.ts +0 -224
- package/src/features/F6Navigation.ts +0 -141
- package/src/features/OpenUI5Element.ts +0 -11
- package/src/features/OpenUI5Enablement.ts +0 -117
- package/src/features/OpenUI5Support.ts +0 -148
- package/src/generated/css/BusyIndicator.css.ts +0 -9
- package/src/generated/css/FontFace.css.ts +0 -9
- package/src/generated/css/OverrideFontFace.css.ts +0 -9
- package/src/generated/css/SystemCSSVars.css.ts +0 -9
- package/src/getSharedResource.ts +0 -30
- package/src/global.d.ts +0 -38
- package/src/i18nBundle.ts +0 -108
- package/src/locale/Locale.ts +0 -101
- package/src/locale/RTLAwareRegistry.ts +0 -16
- package/src/locale/applyDirection.ts +0 -18
- package/src/locale/directionChange.ts +0 -34
- package/src/locale/getEffectiveDir.ts +0 -28
- package/src/locale/getLocale.ts +0 -46
- package/src/locale/languageChange.ts +0 -24
- package/src/locale/nextFallbackLocale.ts +0 -28
- package/src/locale/normalizeLocale.ts +0 -56
- package/src/renderer/LitRenderer.ts +0 -60
- package/src/renderer/executeTemplate.ts +0 -40
- package/src/theming/CustomStyle.ts +0 -62
- package/src/theming/ThemeLoaded.ts +0 -24
- package/src/theming/applyTheme.ts +0 -90
- package/src/theming/getConstructableStyle.ts +0 -31
- package/src/theming/getEffectiveLinksHrefs.ts +0 -26
- package/src/theming/getEffectiveStyle.ts +0 -41
- package/src/theming/getStylesString.ts +0 -15
- package/src/theming/getThemeDesignerTheme.ts +0 -101
- package/src/theming/preloadLinks.ts +0 -24
- package/src/thirdparty/_merge.ts +0 -32
- package/src/thirdparty/isPlainObject.ts +0 -18
- package/src/thirdparty/merge.ts +0 -5
- package/src/types/AnimationMode.ts +0 -33
- package/src/types/CSSColor.ts +0 -20
- package/src/types/CalendarType.ts +0 -38
- package/src/types/DOMReference.ts +0 -28
- package/src/types/DataType.ts +0 -51
- package/src/types/Float.ts +0 -25
- package/src/types/Integer.ts +0 -25
- package/src/types/InvisibleMessageMode.ts +0 -27
- package/src/types/ItemNavigationBehavior.ts +0 -26
- package/src/types/NavigationMode.ts +0 -33
- package/src/types/ValueState.ts +0 -47
- package/src/types.ts +0 -30
- package/src/updateShadowRoot.ts +0 -37
- package/src/util/AriaLabelHelper.ts +0 -63
- package/src/util/Caret.ts +0 -28
- package/src/util/ColorConversion.ts +0 -399
- package/src/util/FetchHelper.ts +0 -31
- package/src/util/FocusableElements.ts +0 -92
- package/src/util/HTMLSanitizer.ts +0 -9
- package/src/util/InvisibleMessage.ts +0 -69
- package/src/util/PopupUtils.ts +0 -112
- package/src/util/SlotsHelper.ts +0 -39
- package/src/util/StringHelper.ts +0 -26
- package/src/util/TabbableElements.ts +0 -70
- package/src/util/arraysAreEqual.ts +0 -15
- package/src/util/clamp.ts +0 -12
- package/src/util/createLinkInHead.ts +0 -25
- package/src/util/createStyleInHead.ts +0 -20
- package/src/util/debounce.ts +0 -18
- package/src/util/detectNavigatorLanguage.ts +0 -13
- package/src/util/escapeRegex.ts +0 -11
- package/src/util/formatMessage.ts +0 -24
- package/src/util/generateHighlightedMarkup.ts +0 -43
- package/src/util/getActiveElement.ts +0 -11
- package/src/util/getClassCopy.ts +0 -12
- package/src/util/getDesigntimePropertyAsArray.ts +0 -4
- package/src/util/getEffectiveContentDensity.ts +0 -5
- package/src/util/getEffectiveScrollbarStyle.ts +0 -5
- package/src/util/getFastNavigationGroups.ts +0 -63
- package/src/util/getFileExtension.ts +0 -21
- package/src/util/getNormalizedTarget.ts +0 -16
- package/src/util/getSingletonElementInstance.ts +0 -13
- package/src/util/isElementClickable.ts +0 -19
- package/src/util/isElementHidden.ts +0 -9
- package/src/util/isElementInView.ts +0 -15
- package/src/util/isElementTabbable.ts +0 -37
- package/src/util/isValidPropertyName.ts +0 -29
- package/src/util/whenDOMReady.ts +0 -13
- package/src/util/willShowContent.ts +0 -7
- package/src/validateThemeRoot.ts +0 -58
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import DataType from "./types/DataType.js";
|
|
2
|
-
import { camelToKebabCase } from "./util/StringHelper.js";
|
|
3
|
-
import { getSlottedNodes } from "./util/SlotsHelper.js";
|
|
4
|
-
import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";
|
|
5
|
-
|
|
6
|
-
type SlotInvalidation = {
|
|
7
|
-
properties: boolean | Array<string>,
|
|
8
|
-
slots: boolean | Array<string>,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type Slot = {
|
|
12
|
-
type: typeof Node | typeof HTMLElement,
|
|
13
|
-
default?: boolean,
|
|
14
|
-
propertyName?: string,
|
|
15
|
-
individualSlots?: boolean,
|
|
16
|
-
invalidateOnChildChange?: boolean | SlotInvalidation,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type SlotValue = Node;
|
|
20
|
-
|
|
21
|
-
type Property = {
|
|
22
|
-
type?: BooleanConstructor | StringConstructor | ObjectConstructor | DataType
|
|
23
|
-
validator?: DataType,
|
|
24
|
-
defaultValue?: PropertyValue,
|
|
25
|
-
noAttribute?: boolean,
|
|
26
|
-
multiple?: boolean,
|
|
27
|
-
compareValues?: boolean,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type PropertyValue = boolean | number | string | object | undefined | null | DataType;
|
|
31
|
-
|
|
32
|
-
type EventData = Record<string, object>;
|
|
33
|
-
|
|
34
|
-
type Metadata = {
|
|
35
|
-
tag?: string,
|
|
36
|
-
managedSlots?: boolean,
|
|
37
|
-
properties?: Record<string, Property>,
|
|
38
|
-
slots?: Record<string, Slot>,
|
|
39
|
-
events?: EventData,
|
|
40
|
-
fastNavigation?: boolean,
|
|
41
|
-
themeAware?: boolean,
|
|
42
|
-
languageAware?: boolean,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type State = Record<string, PropertyValue | Array<SlotValue>>;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @class
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
class UI5ElementMetadata {
|
|
53
|
-
metadata: Metadata;
|
|
54
|
-
_initialState: State | undefined;
|
|
55
|
-
|
|
56
|
-
constructor(metadata: Metadata) {
|
|
57
|
-
this.metadata = metadata;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getInitialState() {
|
|
61
|
-
if (Object.prototype.hasOwnProperty.call(this, "_initialState")) {
|
|
62
|
-
return this._initialState!;
|
|
63
|
-
}
|
|
64
|
-
const initialState: State = {};
|
|
65
|
-
const slotsAreManaged = this.slotsAreManaged();
|
|
66
|
-
|
|
67
|
-
// Initialize properties
|
|
68
|
-
const props = this.getProperties();
|
|
69
|
-
for (const propName in props) { // eslint-disable-line
|
|
70
|
-
const propType = props[propName].type;
|
|
71
|
-
const propDefaultValue = props[propName].defaultValue;
|
|
72
|
-
|
|
73
|
-
if (propType === Boolean) {
|
|
74
|
-
initialState[propName] = false;
|
|
75
|
-
|
|
76
|
-
if (propDefaultValue !== undefined) {
|
|
77
|
-
console.warn("The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default"); // eslint-disable-line
|
|
78
|
-
}
|
|
79
|
-
} else if (props[propName].multiple) {
|
|
80
|
-
initialState[propName] = [];
|
|
81
|
-
} else if (propType === Object) {
|
|
82
|
-
initialState[propName] = "defaultValue" in props[propName] ? props[propName].defaultValue : {};
|
|
83
|
-
} else if (propType === String) {
|
|
84
|
-
initialState[propName] = "defaultValue" in props[propName] ? props[propName].defaultValue : "";
|
|
85
|
-
} else {
|
|
86
|
-
initialState[propName] = propDefaultValue;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Initialize slots
|
|
91
|
-
if (slotsAreManaged) {
|
|
92
|
-
const slots = this.getSlots();
|
|
93
|
-
for (const [slotName, slotData] of Object.entries<Slot>(slots)) { // eslint-disable-line
|
|
94
|
-
const propertyName = slotData.propertyName || slotName;
|
|
95
|
-
initialState[propertyName] = [];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this._initialState = initialState;
|
|
100
|
-
return initialState;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Validates the property's value and returns it if correct
|
|
105
|
-
* or returns the default value if not.
|
|
106
|
-
* <b>Note:</b> Only intended for use by UI5Element.js
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
static validatePropertyValue(value: PropertyValue, propData: Property) {
|
|
110
|
-
const isMultiple = propData.multiple;
|
|
111
|
-
if (isMultiple && value) {
|
|
112
|
-
return (value as Array<PropertyValue>).map((propValue: PropertyValue) => validateSingleProperty(propValue, propData));
|
|
113
|
-
}
|
|
114
|
-
return validateSingleProperty(value, propData);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Validates the slot's value and returns it if correct
|
|
119
|
-
* or throws an exception if not.
|
|
120
|
-
* <b>Note:</b> Only intended for use by UI5Element.js
|
|
121
|
-
* @pubic
|
|
122
|
-
*/
|
|
123
|
-
static validateSlotValue(value: Node, slotData: Slot) {
|
|
124
|
-
return validateSingleSlot(value, slotData);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Returns the tag of the UI5 Element without the scope
|
|
129
|
-
* @public
|
|
130
|
-
*/
|
|
131
|
-
getPureTag() {
|
|
132
|
-
return this.metadata.tag || "";
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Returns the tag of the UI5 Element
|
|
137
|
-
* @public
|
|
138
|
-
*/
|
|
139
|
-
getTag() {
|
|
140
|
-
const pureTag = this.metadata.tag;
|
|
141
|
-
|
|
142
|
-
if (!pureTag) {
|
|
143
|
-
return "";
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const suffix = getEffectiveScopingSuffixForTag(pureTag);
|
|
147
|
-
if (!suffix) {
|
|
148
|
-
return pureTag;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return `${pureTag}-${suffix}`;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Determines whether a property should have an attribute counterpart
|
|
156
|
-
* @public
|
|
157
|
-
* @param propName
|
|
158
|
-
* @returns {boolean}
|
|
159
|
-
*/
|
|
160
|
-
hasAttribute(propName: string) {
|
|
161
|
-
const propData = this.getProperties()[propName];
|
|
162
|
-
return propData.type !== Object && !propData.noAttribute && !propData.multiple;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Returns an array with the properties of the UI5 Element (in camelCase)
|
|
167
|
-
* @public
|
|
168
|
-
* @returns {string[]}
|
|
169
|
-
*/
|
|
170
|
-
getPropertiesList() {
|
|
171
|
-
return Object.keys(this.getProperties());
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Returns an array with the attributes of the UI5 Element (in kebab-case)
|
|
176
|
-
* @public
|
|
177
|
-
* @returns {string[]}
|
|
178
|
-
*/
|
|
179
|
-
getAttributesList() {
|
|
180
|
-
return this.getPropertiesList().filter(this.hasAttribute.bind(this)).map(camelToKebabCase);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Determines whether this UI5 Element has a default slot of type Node, therefore can slot text
|
|
185
|
-
* @returns {boolean}
|
|
186
|
-
*/
|
|
187
|
-
canSlotText() {
|
|
188
|
-
const defaultSlot = this.getSlots().default;
|
|
189
|
-
return defaultSlot && defaultSlot.type === Node;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Determines whether this UI5 Element supports any slots
|
|
194
|
-
* @public
|
|
195
|
-
*/
|
|
196
|
-
hasSlots() {
|
|
197
|
-
return !!Object.entries(this.getSlots()).length;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Determines whether this UI5 Element supports any slots with "individualSlots: true"
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
|
-
hasIndividualSlots() {
|
|
205
|
-
return this.slotsAreManaged() && Object.values(this.getSlots()).some(slotData => slotData.individualSlots);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Determines whether this UI5 Element needs to invalidate if children are added/removed/changed
|
|
210
|
-
* @public
|
|
211
|
-
*/
|
|
212
|
-
slotsAreManaged() {
|
|
213
|
-
return !!this.metadata.managedSlots;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Determines whether this control supports F6 fast navigation
|
|
218
|
-
* @public
|
|
219
|
-
*/
|
|
220
|
-
supportsF6FastNavigation() {
|
|
221
|
-
return !!this.metadata.fastNavigation;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Returns an object with key-value pairs of properties and their metadata definitions
|
|
226
|
-
* @public
|
|
227
|
-
*/
|
|
228
|
-
getProperties() {
|
|
229
|
-
if (!this.metadata.properties) {
|
|
230
|
-
this.metadata.properties = {};
|
|
231
|
-
}
|
|
232
|
-
return this.metadata.properties;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Returns an object with key-value pairs of events and their metadata definitions
|
|
237
|
-
* @public
|
|
238
|
-
*/
|
|
239
|
-
getEvents() {
|
|
240
|
-
if (!this.metadata.events) {
|
|
241
|
-
this.metadata.events = {};
|
|
242
|
-
}
|
|
243
|
-
return this.metadata.events;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Returns an object with key-value pairs of slots and their metadata definitions
|
|
248
|
-
* @public
|
|
249
|
-
*/
|
|
250
|
-
getSlots() {
|
|
251
|
-
if (!this.metadata.slots) {
|
|
252
|
-
this.metadata.slots = {};
|
|
253
|
-
}
|
|
254
|
-
return this.metadata.slots;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Determines whether this UI5 Element has any translatable texts (needs to be invalidated upon language change)
|
|
259
|
-
* @returns {boolean}
|
|
260
|
-
*/
|
|
261
|
-
isLanguageAware() {
|
|
262
|
-
return !!this.metadata.languageAware;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Determines whether this UI5 Element has any theme dependant carachteristics.
|
|
267
|
-
* @returns {boolean}
|
|
268
|
-
*/
|
|
269
|
-
isThemeAware() {
|
|
270
|
-
return !!this.metadata.themeAware;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Matches a changed entity (property/slot) with the given name against the "invalidateOnChildChange" configuration
|
|
275
|
-
* and determines whether this should cause and invalidation
|
|
276
|
-
*
|
|
277
|
-
* @param slotName the name of the slot in which a child was changed
|
|
278
|
-
* @param type the type of change in the child: "property" or "slot"
|
|
279
|
-
* @param name the name of the property/slot that changed
|
|
280
|
-
* @returns {boolean}
|
|
281
|
-
*/
|
|
282
|
-
shouldInvalidateOnChildChange(slotName: string, type: "property" | "slot", name: string) {
|
|
283
|
-
const config = this.getSlots()[slotName].invalidateOnChildChange;
|
|
284
|
-
|
|
285
|
-
// invalidateOnChildChange was not set in the slot metadata - by default child changes do not affect the component
|
|
286
|
-
if (config === undefined) {
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// The simple format was used: invalidateOnChildChange: true/false;
|
|
291
|
-
if (typeof config === "boolean") {
|
|
292
|
-
return config;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// The complex format was used: invalidateOnChildChange: { properties, slots }
|
|
296
|
-
if (typeof config === "object") {
|
|
297
|
-
// A property was changed
|
|
298
|
-
if (type === "property") {
|
|
299
|
-
// The config object does not have a properties field
|
|
300
|
-
if (config.properties === undefined) {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// The config object has the short format: properties: true/false
|
|
305
|
-
if (typeof config.properties === "boolean") {
|
|
306
|
-
return config.properties;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// The config object has the complex format: properties: [...]
|
|
310
|
-
if (Array.isArray(config.properties)) {
|
|
311
|
-
return config.properties.includes(name);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
throw new Error("Wrong format for invalidateOnChildChange.properties: boolean or array is expected");
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// A slot was changed
|
|
318
|
-
if (type === "slot") {
|
|
319
|
-
// The config object does not have a slots field
|
|
320
|
-
if (config.slots === undefined) {
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// The config object has the short format: slots: true/false
|
|
325
|
-
if (typeof config.slots === "boolean") {
|
|
326
|
-
return config.slots;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// The config object has the complex format: slots: [...]
|
|
330
|
-
if (Array.isArray(config.slots)) {
|
|
331
|
-
return config.slots.includes(name);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
throw new Error("Wrong format for invalidateOnChildChange.slots: boolean or array is expected");
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
throw new Error("Wrong format for invalidateOnChildChange: boolean or object is expected");
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
const validateSingleProperty = (value: PropertyValue, propData: Property) => {
|
|
343
|
-
const propertyType = propData.type;
|
|
344
|
-
let propertyValidator = propData.validator;
|
|
345
|
-
|
|
346
|
-
if (propertyType && (propertyType as typeof DataType).isDataTypeClass) {
|
|
347
|
-
propertyValidator = propertyType as typeof DataType;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (propertyValidator) {
|
|
351
|
-
return (propertyValidator as typeof DataType).isValid(value) ? value : propData.defaultValue;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (!propertyType || propertyType === String) {
|
|
355
|
-
return (typeof value === "string" || typeof value === "undefined" || value === null) ? value : value.toString();
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (propertyType === Boolean) {
|
|
359
|
-
return typeof value === "boolean" ? value : false;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (propertyType === Object) {
|
|
363
|
-
return typeof value === "object" ? value : propData.defaultValue;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// Check if "value" is part of the enum (propertyType) values and return the defaultValue if not found.
|
|
367
|
-
return value as string in propertyType ? value : propData.defaultValue;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const validateSingleSlot = (value: Node, slotData: Slot) => {
|
|
371
|
-
value && getSlottedNodes(value).forEach(el => {
|
|
372
|
-
if (!(el instanceof slotData.type)) {
|
|
373
|
-
throw new Error(`The element is not of type ${slotData.type.toString()}`);
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
return value;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
export default UI5ElementMetadata;
|
|
381
|
-
export type {
|
|
382
|
-
Property,
|
|
383
|
-
PropertyValue,
|
|
384
|
-
Slot,
|
|
385
|
-
SlotValue,
|
|
386
|
-
EventData,
|
|
387
|
-
State,
|
|
388
|
-
Metadata,
|
|
389
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
type TaskType = () => Promise<void>;
|
|
2
|
-
const tasks = new WeakMap<HTMLElement, Array<TaskType>>();
|
|
3
|
-
|
|
4
|
-
class AnimationQueue {
|
|
5
|
-
static get tasks() {
|
|
6
|
-
return tasks;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
static enqueue(element: HTMLElement, task: TaskType) {
|
|
10
|
-
if (!tasks.has(element)) {
|
|
11
|
-
tasks.set(element, []);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
tasks.get(element)!.push(task);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static run(element: HTMLElement, task: TaskType): Promise<void> {
|
|
18
|
-
if (!tasks.has(element)) {
|
|
19
|
-
tasks.set(element, []);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return task().then(() => {
|
|
23
|
-
const elementTasks = tasks.get(element);
|
|
24
|
-
|
|
25
|
-
if (elementTasks!.length > 0) {
|
|
26
|
-
return AnimationQueue.run(element, elementTasks!.shift()!);
|
|
27
|
-
}
|
|
28
|
-
tasks.delete(element);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static push(element: HTMLElement, task: TaskType) {
|
|
33
|
-
const elementTasks = tasks.get(element);
|
|
34
|
-
|
|
35
|
-
if (elementTasks) {
|
|
36
|
-
AnimationQueue.enqueue(element, task);
|
|
37
|
-
} else {
|
|
38
|
-
AnimationQueue.run(element, task);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default AnimationQueue;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import AnimationQueue from "./AnimationQueue.js";
|
|
2
|
-
|
|
3
|
-
type AnimateOptions = {
|
|
4
|
-
beforeStart?: () => void,
|
|
5
|
-
duration: number,
|
|
6
|
-
element: HTMLElement,
|
|
7
|
-
advance: (p: number) => void,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const animate = (options: AnimateOptions) => {
|
|
11
|
-
let start: number | null = null;
|
|
12
|
-
let stopped = false;
|
|
13
|
-
let animationFrame: number;
|
|
14
|
-
let stop: () => void;
|
|
15
|
-
let advanceAnimation: (timestamp: number) => void;
|
|
16
|
-
|
|
17
|
-
const promise = new Promise<void>((resolve, reject) => {
|
|
18
|
-
advanceAnimation = timestamp => {
|
|
19
|
-
start = start || timestamp;
|
|
20
|
-
|
|
21
|
-
const timeElapsed = timestamp - start;
|
|
22
|
-
const remaining = options.duration - timeElapsed;
|
|
23
|
-
|
|
24
|
-
if (timeElapsed <= options.duration) {
|
|
25
|
-
const currentAdvance = 1 - remaining / options.duration; // easing formula (currently linear)
|
|
26
|
-
options.advance(currentAdvance);
|
|
27
|
-
if (!stopped) {
|
|
28
|
-
animationFrame = requestAnimationFrame(advanceAnimation);
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
options.advance(1);
|
|
32
|
-
resolve();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
stop = () => {
|
|
37
|
-
stopped = true;
|
|
38
|
-
cancelAnimationFrame(animationFrame);
|
|
39
|
-
reject(new Error("animation stopped"));
|
|
40
|
-
};
|
|
41
|
-
}).catch((reason: Error) => reason);
|
|
42
|
-
|
|
43
|
-
AnimationQueue.push(options.element, () => {
|
|
44
|
-
if (typeof options.beforeStart === "function") {
|
|
45
|
-
options.beforeStart();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
requestAnimationFrame(advanceAnimation);
|
|
49
|
-
|
|
50
|
-
return new Promise(resolve => {
|
|
51
|
-
promise.then(() => resolve());
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
promise: () => promise,
|
|
57
|
-
stop: () => stop,
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
const duration = 400;
|
|
61
|
-
|
|
62
|
-
export { duration };
|
|
63
|
-
export type { AnimateOptions };
|
|
64
|
-
export default animate;
|
package/src/animations/scroll.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import animate, { duration } from "./animate.js";
|
|
2
|
-
|
|
3
|
-
const scroll = (element: HTMLElement, dx: number, dy: number) => {
|
|
4
|
-
let scrollLeft: number;
|
|
5
|
-
let scrollTop: number;
|
|
6
|
-
|
|
7
|
-
return animate({
|
|
8
|
-
beforeStart: () => {
|
|
9
|
-
scrollLeft = element.scrollLeft;
|
|
10
|
-
scrollTop = element.scrollTop;
|
|
11
|
-
},
|
|
12
|
-
duration,
|
|
13
|
-
element,
|
|
14
|
-
advance: progress => {
|
|
15
|
-
element.scrollLeft = scrollLeft + (progress * dx); // easing - linear
|
|
16
|
-
element.scrollTop = scrollTop + (progress * dy); // easing - linear
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default scroll;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import animate, { duration } from "./animate.js";
|
|
2
|
-
|
|
3
|
-
const slideDown = (element: HTMLElement) => {
|
|
4
|
-
let computedStyles: CSSStyleDeclaration,
|
|
5
|
-
paddingTop: number,
|
|
6
|
-
paddingBottom: number,
|
|
7
|
-
marginTop: number,
|
|
8
|
-
marginBottom: number,
|
|
9
|
-
height: number;
|
|
10
|
-
let storedOverflow: string,
|
|
11
|
-
storedPaddingTop: string,
|
|
12
|
-
storedPaddingBottom: string,
|
|
13
|
-
storedMarginTop: string,
|
|
14
|
-
storedMarginBottom: string,
|
|
15
|
-
storedHeight: string;
|
|
16
|
-
|
|
17
|
-
const animation = animate({
|
|
18
|
-
beforeStart: () => {
|
|
19
|
-
// Show the element to measure its properties
|
|
20
|
-
element.style.display = "block";
|
|
21
|
-
|
|
22
|
-
// Get Computed styles
|
|
23
|
-
computedStyles = getComputedStyle(element);
|
|
24
|
-
paddingTop = parseFloat(computedStyles.paddingTop);
|
|
25
|
-
paddingBottom = parseFloat(computedStyles.paddingBottom);
|
|
26
|
-
marginTop = parseFloat(computedStyles.marginTop);
|
|
27
|
-
marginBottom = parseFloat(computedStyles.marginBottom);
|
|
28
|
-
height = parseFloat(computedStyles.height);
|
|
29
|
-
|
|
30
|
-
// Store inline styles
|
|
31
|
-
storedOverflow = element.style.overflow;
|
|
32
|
-
storedPaddingTop = element.style.paddingTop;
|
|
33
|
-
storedPaddingBottom = element.style.paddingBottom;
|
|
34
|
-
storedMarginTop = element.style.marginTop;
|
|
35
|
-
storedMarginBottom = element.style.marginBottom;
|
|
36
|
-
storedHeight = element.style.height;
|
|
37
|
-
|
|
38
|
-
element.style.overflow = "hidden";
|
|
39
|
-
element.style.paddingTop = "0";
|
|
40
|
-
element.style.paddingBottom = "0";
|
|
41
|
-
element.style.marginTop = "0";
|
|
42
|
-
element.style.marginBottom = "0";
|
|
43
|
-
element.style.height = "0";
|
|
44
|
-
},
|
|
45
|
-
duration,
|
|
46
|
-
element,
|
|
47
|
-
advance: progress => {
|
|
48
|
-
// WORKAROUND
|
|
49
|
-
element.style.display = "block";
|
|
50
|
-
// END OF WORKAROUND
|
|
51
|
-
|
|
52
|
-
element.style.paddingTop = `${(paddingTop * progress)}px`;
|
|
53
|
-
element.style.paddingBottom = `${(paddingBottom * progress)}px`;
|
|
54
|
-
element.style.marginTop = `${(marginTop * progress)}px`;
|
|
55
|
-
element.style.marginBottom = `${(marginBottom * progress)}px`;
|
|
56
|
-
element.style.height = `${(height * progress)}px`;
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
animation.promise().then(() => {
|
|
61
|
-
element.style.overflow = storedOverflow;
|
|
62
|
-
element.style.paddingTop = storedPaddingTop;
|
|
63
|
-
element.style.paddingBottom = storedPaddingBottom;
|
|
64
|
-
element.style.marginTop = storedMarginTop;
|
|
65
|
-
element.style.marginBottom = storedMarginBottom;
|
|
66
|
-
element.style.height = storedHeight;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return animation;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default slideDown;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import animate, { duration } from "./animate.js";
|
|
2
|
-
|
|
3
|
-
const slideUp = (element: HTMLElement) => {
|
|
4
|
-
// Get Computed styles
|
|
5
|
-
let computedStyles: CSSStyleDeclaration,
|
|
6
|
-
paddingTop: number,
|
|
7
|
-
paddingBottom: number,
|
|
8
|
-
marginTop: number,
|
|
9
|
-
marginBottom: number,
|
|
10
|
-
height: number;
|
|
11
|
-
|
|
12
|
-
// Store inline styles
|
|
13
|
-
let storedOverflow: string,
|
|
14
|
-
storedPaddingTop: string,
|
|
15
|
-
storedPaddingBottom: string,
|
|
16
|
-
storedMarginTop: string,
|
|
17
|
-
storedMarginBottom: string,
|
|
18
|
-
storedHeight: string;
|
|
19
|
-
|
|
20
|
-
const animation = animate({
|
|
21
|
-
beforeStart: () => {
|
|
22
|
-
// Get Computed styles
|
|
23
|
-
const el = element;
|
|
24
|
-
computedStyles = getComputedStyle(el);
|
|
25
|
-
paddingTop = parseFloat(computedStyles.paddingTop);
|
|
26
|
-
paddingBottom = parseFloat(computedStyles.paddingBottom);
|
|
27
|
-
marginTop = parseFloat(computedStyles.marginTop);
|
|
28
|
-
marginBottom = parseFloat(computedStyles.marginBottom);
|
|
29
|
-
height = parseFloat(computedStyles.height);
|
|
30
|
-
|
|
31
|
-
// Store inline styles
|
|
32
|
-
storedOverflow = el.style.overflow;
|
|
33
|
-
storedPaddingTop = el.style.paddingTop;
|
|
34
|
-
storedPaddingBottom = el.style.paddingBottom;
|
|
35
|
-
storedMarginTop = el.style.marginTop;
|
|
36
|
-
storedMarginBottom = el.style.marginBottom;
|
|
37
|
-
storedHeight = el.style.height;
|
|
38
|
-
|
|
39
|
-
el.style.overflow = "hidden";
|
|
40
|
-
},
|
|
41
|
-
duration,
|
|
42
|
-
element,
|
|
43
|
-
advance: progress => {
|
|
44
|
-
element.style.paddingTop = `${paddingTop - (paddingTop * progress)}px`;
|
|
45
|
-
element.style.paddingBottom = `${paddingBottom - (paddingBottom * progress)}px`;
|
|
46
|
-
element.style.marginTop = `${marginTop - (marginTop * progress)}px`;
|
|
47
|
-
element.style.marginBottom = `${marginBottom - (marginBottom * progress)}px`;
|
|
48
|
-
element.style.height = `${height - (height * progress)}px`;
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
animation.promise().then(reason => {
|
|
53
|
-
if (!(reason instanceof Error)) {
|
|
54
|
-
element.style.overflow = storedOverflow;
|
|
55
|
-
element.style.paddingTop = storedPaddingTop;
|
|
56
|
-
element.style.paddingBottom = storedPaddingBottom;
|
|
57
|
-
element.style.marginTop = storedMarginTop;
|
|
58
|
-
element.style.marginBottom = storedMarginBottom;
|
|
59
|
-
element.style.height = storedHeight;
|
|
60
|
-
element.style.display = "none";
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
return animation;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default slideUp;
|