@ui5/webcomponents-base 1.12.0-rc.0 → 1.12.0-rc.2
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/.eslintrc.js +3 -0
- package/CHANGELOG.md +27 -0
- package/dist/AssetRegistry.js.map +1 -1
- package/dist/Boot.js +14 -0
- 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.map +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.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.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.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/asset-registries/Icons.d.ts +6 -6
- package/dist/asset-registries/Icons.js +1 -1
- package/dist/asset-registries/Icons.js.map +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.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.0f056029.js +9 -0
- package/dist/assets/Boot.34b7cea0.css +1 -0
- package/dist/assets/{bundle.esm.5ddf1fb1.js → bundle.esm.90296f02.js} +1 -1
- package/dist/assets/test/pages/Boot.html.a40788ce.js +1 -0
- package/dist/assets/test/pages/{i18n.html.95232fe8.js → i18n.html.65058ddf.js} +1 -1
- package/dist/assets/test/pages/{i18n_texts.html.351ef5df.js → i18n_texts.html.4d80a4fd.js} +1 -1
- 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.js.map +1 -1
- 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.map +1 -1
- package/dist/config/RTL.js.map +1 -1
- package/dist/config/Theme.d.ts +10 -1
- package/dist/config/Theme.js +13 -1
- package/dist/config/Theme.js.map +1 -1
- package/dist/config/ThemeRoots.js.map +1 -1
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/decorators/event.js.map +1 -1
- package/dist/decorators/property.js.map +1 -1
- package/dist/decorators/slot.js.map +1 -1
- package/dist/delegate/ItemNavigation.js.map +1 -1
- package/dist/delegate/ResizeHandler.js.map +1 -1
- package/dist/delegate/ScrollEnablement.js.map +1 -1
- package/dist/features/F6Navigation.js.map +1 -1
- package/dist/features/LegacyDateFormats.js.map +1 -1
- package/dist/features/OpenUI5Element.js.map +1 -1
- package/dist/features/OpenUI5Enablement.js.map +1 -1
- package/dist/features/OpenUI5Support.js.map +1 -1
- 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/getSharedResource.js.map +1 -1
- package/dist/i18nBundle.js.map +1 -1
- package/dist/locale/Locale.js.map +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.js.map +1 -1
- package/dist/renderer/executeTemplate.js.map +1 -1
- package/dist/test/pages/AllTestElements.html +2 -2
- package/dist/test/pages/Boot.html +4 -4
- package/dist/test/pages/Configuration.html +2 -2
- package/dist/test/pages/ConfigurationScript.html +2 -2
- package/dist/test/pages/WithComplexTemplate.html +2 -2
- package/dist/test/pages/i18n.html +3 -3
- package/dist/test/pages/i18n_texts.html +3 -3
- 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.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.js.map +1 -1
- package/dist/types/CSSColor.js.map +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.js.map +1 -1
- package/dist/types/Integer.js.map +1 -1
- package/dist/types/InvisibleMessageMode.js.map +1 -1
- package/dist/types/ItemNavigationBehavior.js.map +1 -1
- package/dist/types/NavigationMode.js.map +1 -1
- package/dist/types/ValueState.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/updateShadowRoot.js.map +1 -1
- 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.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.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.map +1 -1
- package/package-scripts.js +1 -2
- package/package.json +4 -4
- package/tsconfig.json +1 -0
- package/dist/assets/Boot.6335ce08.css +0 -1
- package/dist/assets/Boot.6f2dd050.js +0 -9
- package/dist/assets/test/pages/Boot.html.3e0c3154.js +0 -1
- package/src/AssetRegistry.ts +0 -11
- package/src/Boot.ts +0 -76
- 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 -203
- 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 -1159
- 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 -161
- package/src/asset-registries/Illustrations.ts +0 -75
- package/src/asset-registries/LocaleData.ts +0 -172
- package/src/asset-registries/Themes.ts +0 -72
- package/src/asset-registries/i18n.ts +0 -118
- package/src/assets-meta/IconCollectionsAlias.ts +0 -41
- package/src/config/AnimationMode.ts +0 -33
- package/src/config/CalendarType.ts +0 -23
- package/src/config/FormatSettings.ts +0 -35
- package/src/config/Icons.ts +0 -126
- package/src/config/Language.ts +0 -72
- package/src/config/NoConflict.ts +0 -67
- package/src/config/RTL.ts +0 -45
- package/src/config/Theme.ts +0 -64
- package/src/config/ThemeRoots.ts +0 -41
- package/src/decorators/customElement.ts +0 -57
- package/src/decorators/event.ts +0 -28
- package/src/decorators/property.ts +0 -30
- package/src/decorators/slot.ts +0 -49
- package/src/delegate/ItemNavigation.ts +0 -393
- package/src/delegate/ResizeHandler.ts +0 -100
- package/src/delegate/ScrollEnablement.ts +0 -224
- package/src/features/F6Navigation.ts +0 -195
- package/src/features/LegacyDateFormats.ts +0 -40
- package/src/features/OpenUI5Element.ts +0 -11
- package/src/features/OpenUI5Enablement.ts +0 -117
- package/src/features/OpenUI5Support.ts +0 -153
- 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 -39
- 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 -64
- 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 -19
- 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 -24
- package/src/types/Integer.ts +0 -24
- 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 -42
- package/src/util/AriaLabelHelper.ts +0 -218
- 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,56 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_LOCALE } from "../generated/AssetParameters.js";
|
|
2
|
-
|
|
3
|
-
const localeRegEX = /^((?:[A-Z]{2,3}(?:-[A-Z]{3}){0,3})|[A-Z]{4}|[A-Z]{5,8})(?:-([A-Z]{4}))?(?:-([A-Z]{2}|[0-9]{3}))?((?:-[0-9A-Z]{5,8}|-[0-9][0-9A-Z]{3})*)((?:-[0-9A-WYZ](?:-[0-9A-Z]{2,8})+)*)(?:-(X(?:-[0-9A-Z]{1,8})+))?$/i;
|
|
4
|
-
const SAPSupportabilityLocales = /(?:^|-)(saptrc|sappsd)(?:-|$)/i;
|
|
5
|
-
|
|
6
|
-
/* Map for old language names for a few ISO639 codes. */
|
|
7
|
-
const M_ISO639_NEW_TO_OLD = {
|
|
8
|
-
"he": "iw",
|
|
9
|
-
"yi": "ji",
|
|
10
|
-
"nb": "no",
|
|
11
|
-
"sr": "sh",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Normalizes the given locale in BCP-47 syntax.
|
|
16
|
-
* @param {string} locale locale to normalize
|
|
17
|
-
* @returns {string} Normalized locale, "undefined" if the locale can't be normalized or the default locale, if no locale provided.
|
|
18
|
-
*/
|
|
19
|
-
const normalizeLocale = (locale: string) => {
|
|
20
|
-
let m;
|
|
21
|
-
|
|
22
|
-
if (!locale) {
|
|
23
|
-
return DEFAULT_LOCALE;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (typeof locale === "string" && (m = localeRegEX.exec(locale.replace(/_/g, "-")))) {/* eslint-disable-line */
|
|
27
|
-
let language = m[1].toLowerCase();
|
|
28
|
-
let region = m[3] ? m[3].toUpperCase() : undefined;
|
|
29
|
-
const script = m[2] ? m[2].toLowerCase() : undefined;
|
|
30
|
-
const variants = m[4] ? m[4].slice(1) : undefined;
|
|
31
|
-
const isPrivate = m[6];
|
|
32
|
-
|
|
33
|
-
language = M_ISO639_NEW_TO_OLD[language as keyof typeof M_ISO639_NEW_TO_OLD] || language;
|
|
34
|
-
|
|
35
|
-
// recognize and convert special SAP supportability locales (overwrites m[]!)
|
|
36
|
-
if ((isPrivate && (m = SAPSupportabilityLocales.exec(isPrivate))) /* eslint-disable-line */ ||
|
|
37
|
-
(variants && (m = SAPSupportabilityLocales.exec(variants)))) {/* eslint-disable-line */
|
|
38
|
-
return `en_US_${m[1].toLowerCase()}`; // for now enforce en_US (agreed with SAP SLS)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Chinese: when no region but a script is specified, use default region for each script
|
|
42
|
-
if (language === "zh" && !region) {
|
|
43
|
-
if (script === "hans") {
|
|
44
|
-
region = "CN";
|
|
45
|
-
} else if (script === "hant") {
|
|
46
|
-
region = "TW";
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return language + (region ? "_" + region + (variants ? "_" + variants.replace("-", "_") : "") : ""); /* eslint-disable-line */
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return DEFAULT_LOCALE;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default normalizeLocale;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
render,
|
|
3
|
-
html,
|
|
4
|
-
svg,
|
|
5
|
-
TemplateResult,
|
|
6
|
-
} from "lit-html";
|
|
7
|
-
|
|
8
|
-
import { getFeature } from "../FeaturesRegistry.js";
|
|
9
|
-
import type { LitStatic } from "../CustomElementsScope.js";
|
|
10
|
-
import type OpenUI5Enablement from "../features/OpenUI5Enablement.js";
|
|
11
|
-
import type UI5Element from "../UI5Element.js";
|
|
12
|
-
import type { Renderer, RendererOptions } from "../UI5Element.js";
|
|
13
|
-
import { TemplateFunctionResult } from "./executeTemplate.js";
|
|
14
|
-
|
|
15
|
-
const effectiveHtml = (strings: TemplateStringsArray, ...values: Array<unknown>) => {
|
|
16
|
-
const litStatic = getFeature<typeof LitStatic>("LitStatic");
|
|
17
|
-
const fn = litStatic ? litStatic.html : html;
|
|
18
|
-
return fn(strings, ...values);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const effectiveSvg = (strings: TemplateStringsArray, ...values: Array<unknown>) => {
|
|
22
|
-
const litStatic = getFeature<typeof LitStatic>("LitStatic");
|
|
23
|
-
const fn = litStatic ? litStatic.svg : svg;
|
|
24
|
-
return fn(strings, ...values);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const litRender: Renderer = (templateResult: TemplateFunctionResult, container: HTMLElement | DocumentFragment, styleStrOrHrefsArr: string | Array<string> | undefined, forStaticArea: boolean, options: RendererOptions) => {
|
|
28
|
-
const openUI5Enablement = getFeature<typeof OpenUI5Enablement>("OpenUI5Enablement");
|
|
29
|
-
if (openUI5Enablement && !forStaticArea) {
|
|
30
|
-
templateResult = openUI5Enablement.wrapTemplateResultInBusyMarkup(effectiveHtml, options.host as UI5Element, templateResult as TemplateResult);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (typeof styleStrOrHrefsArr === "string") {
|
|
34
|
-
templateResult = effectiveHtml`<style>${styleStrOrHrefsArr}</style>${templateResult}`;
|
|
35
|
-
} else if (Array.isArray(styleStrOrHrefsArr) && styleStrOrHrefsArr.length) {
|
|
36
|
-
templateResult = effectiveHtml`${styleStrOrHrefsArr.map(href => effectiveHtml`<link type="text/css" rel="stylesheet" href="${href}">`)}${templateResult}`;
|
|
37
|
-
}
|
|
38
|
-
render(templateResult as TemplateResult, container, options);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const scopeTag = (tag: string, tags: Array<string>, suffix: string) => {
|
|
42
|
-
const litStatic = getFeature<typeof LitStatic>("LitStatic");
|
|
43
|
-
if (litStatic) {
|
|
44
|
-
return litStatic.unsafeStatic((tags || []).includes(tag) ? `${tag}-${suffix}` : tag);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
effectiveHtml as html,
|
|
50
|
-
effectiveSvg as svg,
|
|
51
|
-
};
|
|
52
|
-
export { scopeTag };
|
|
53
|
-
export { repeat } from "lit-html/directives/repeat.js";
|
|
54
|
-
export { classMap } from "lit-html/directives/class-map.js";
|
|
55
|
-
// @ts-ignore style-map is a JS file
|
|
56
|
-
export { styleMap } from "./directives/style-map.js";
|
|
57
|
-
export { ifDefined } from "lit-html/directives/if-defined.js";
|
|
58
|
-
export { unsafeHTML } from "lit-html/directives/unsafe-html.js";
|
|
59
|
-
|
|
60
|
-
export default litRender;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { getCustomElementsScopingSuffix, shouldScopeCustomElement } from "../CustomElementsScopeUtils.js";
|
|
2
|
-
import type UI5Element from "../UI5Element.js";
|
|
3
|
-
|
|
4
|
-
type TemplateFunctionResult = object;
|
|
5
|
-
type TemplateFunction = (component: UI5Element, tagsToScope: Array<string>, scope: string | undefined) => TemplateFunctionResult;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Runs a component's template with the component's current state, while also scoping HTML
|
|
9
|
-
*
|
|
10
|
-
* @param template - the template to execute
|
|
11
|
-
* @param component - the component
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
const executeTemplate = (template: TemplateFunction, component: UI5Element): TemplateFunctionResult => {
|
|
15
|
-
const tagsToScope = getTagsToScope(component);
|
|
16
|
-
const scope = getCustomElementsScopingSuffix();
|
|
17
|
-
return template(component, tagsToScope, scope);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns all tags, used inside component's template subject to scoping.
|
|
22
|
-
* @param component - the component
|
|
23
|
-
* @returns {Array[]}
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
const getTagsToScope = (component: UI5Element) => {
|
|
27
|
-
const ctor = component.constructor as typeof UI5Element;
|
|
28
|
-
|
|
29
|
-
const componentTag = ctor.getMetadata().getPureTag();
|
|
30
|
-
const tagsToScope = ctor.getUniqueDependencies().map((dep: typeof UI5Element) => dep.getMetadata().getPureTag()).filter(shouldScopeCustomElement);
|
|
31
|
-
|
|
32
|
-
if (shouldScopeCustomElement(componentTag)) {
|
|
33
|
-
tagsToScope.push(componentTag);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return tagsToScope;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default executeTemplate;
|
|
40
|
-
export type { TemplateFunction, TemplateFunctionResult };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { reRenderAllUI5Elements } from "../Render.js";
|
|
2
|
-
import getSharedResource from "../getSharedResource.js";
|
|
3
|
-
import EventProvider from "../EventProvider.js";
|
|
4
|
-
|
|
5
|
-
type CustomCSSChangeCallback = (tag: string) => void;
|
|
6
|
-
|
|
7
|
-
const getEventProvider = () => getSharedResource("CustomStyle.eventProvider", new EventProvider<string, void>());
|
|
8
|
-
const CUSTOM_CSS_CHANGE = "CustomCSSChange";
|
|
9
|
-
|
|
10
|
-
const attachCustomCSSChange = (listener: CustomCSSChangeCallback) => {
|
|
11
|
-
getEventProvider().attachEvent(CUSTOM_CSS_CHANGE, listener);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const detachCustomCSSChange = (listener: CustomCSSChangeCallback) => {
|
|
15
|
-
getEventProvider().detachEvent(CUSTOM_CSS_CHANGE, listener);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const fireCustomCSSChange = (tag: string) => {
|
|
19
|
-
return getEventProvider().fireEvent(CUSTOM_CSS_CHANGE, tag);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const getCustomCSSFor = () => getSharedResource<Record<string, Array<string>>>("CustomStyle.customCSSFor", {});
|
|
23
|
-
|
|
24
|
-
// Listen to the eventProvider, in case other copies of this CustomStyle module fire this
|
|
25
|
-
// event, and this copy would therefore need to reRender the ui5 webcomponents; but
|
|
26
|
-
// don't reRender if it was this copy that fired the event to begin with.
|
|
27
|
-
let skipRerender: boolean;
|
|
28
|
-
attachCustomCSSChange((tag: string) => {
|
|
29
|
-
if (!skipRerender) {
|
|
30
|
-
reRenderAllUI5Elements({ tag });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const addCustomCSS = (tag: string, css: string) => {
|
|
35
|
-
const customCSSFor = getCustomCSSFor();
|
|
36
|
-
if (!customCSSFor[tag]) {
|
|
37
|
-
customCSSFor[tag] = [];
|
|
38
|
-
}
|
|
39
|
-
customCSSFor[tag].push(css);
|
|
40
|
-
|
|
41
|
-
skipRerender = true;
|
|
42
|
-
try {
|
|
43
|
-
// The event is fired and the attached event listeners are all called synchronously
|
|
44
|
-
// The skipRerender flag will be used to avoid calling reRenderAllUI5Elements twice when it is this copy
|
|
45
|
-
// of CustomStyle.js which is firing the `CustomCSSChange` event.
|
|
46
|
-
fireCustomCSSChange(tag);
|
|
47
|
-
} finally {
|
|
48
|
-
skipRerender = false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return reRenderAllUI5Elements({ tag });
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const getCustomCSS = (tag: string) => {
|
|
55
|
-
const customCSSFor = getCustomCSSFor();
|
|
56
|
-
return customCSSFor[tag] ? customCSSFor[tag].join("") : "";
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
addCustomCSS,
|
|
61
|
-
getCustomCSS,
|
|
62
|
-
attachCustomCSSChange,
|
|
63
|
-
detachCustomCSSChange,
|
|
64
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import EventProvider from "../EventProvider.js";
|
|
2
|
-
|
|
3
|
-
type ThemeLoadedCallback = (theme: string) => void;
|
|
4
|
-
|
|
5
|
-
const eventProvider = new EventProvider<string, void>();
|
|
6
|
-
const THEME_LOADED = "themeLoaded";
|
|
7
|
-
|
|
8
|
-
const attachThemeLoaded = (listener: ThemeLoadedCallback) => {
|
|
9
|
-
eventProvider.attachEvent(THEME_LOADED, listener);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const detachThemeLoaded = (listener: ThemeLoadedCallback) => {
|
|
13
|
-
eventProvider.detachEvent(THEME_LOADED, listener);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const fireThemeLoaded = (theme: string) => {
|
|
17
|
-
return eventProvider.fireEvent(THEME_LOADED, theme);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
attachThemeLoaded,
|
|
22
|
-
detachThemeLoaded,
|
|
23
|
-
fireThemeLoaded,
|
|
24
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { getThemeProperties, getRegisteredPackages, isThemeRegistered } from "../asset-registries/Themes.js";
|
|
2
|
-
import { removeStyle, createOrUpdateStyle } from "../ManagedStyles.js";
|
|
3
|
-
import getThemeDesignerTheme from "./getThemeDesignerTheme.js";
|
|
4
|
-
import { fireThemeLoaded } from "./ThemeLoaded.js";
|
|
5
|
-
import { getFeature } from "../FeaturesRegistry.js";
|
|
6
|
-
import { attachCustomThemeStylesToHead, getThemeRoot } from "../config/ThemeRoots.js";
|
|
7
|
-
import type OpenUI5Support from "../features/OpenUI5Support.js";
|
|
8
|
-
import { DEFAULT_THEME } from "../generated/AssetParameters.js";
|
|
9
|
-
|
|
10
|
-
const BASE_THEME_PACKAGE = "@ui5/webcomponents-theming";
|
|
11
|
-
|
|
12
|
-
const isThemeBaseRegistered = () => {
|
|
13
|
-
const registeredPackages = getRegisteredPackages();
|
|
14
|
-
return registeredPackages.has(BASE_THEME_PACKAGE);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const loadThemeBase = async (theme: string) => {
|
|
18
|
-
if (!isThemeBaseRegistered()) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const cssData = await getThemeProperties(BASE_THEME_PACKAGE, theme);
|
|
23
|
-
if (cssData) {
|
|
24
|
-
createOrUpdateStyle(cssData, "data-ui5-theme-properties", BASE_THEME_PACKAGE);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const deleteThemeBase = () => {
|
|
29
|
-
removeStyle("data-ui5-theme-properties", BASE_THEME_PACKAGE);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const loadComponentPackages = async (theme: string) => {
|
|
33
|
-
const registeredPackages = getRegisteredPackages();
|
|
34
|
-
|
|
35
|
-
const packagesStylesPromises = [...registeredPackages].map(async packageName => {
|
|
36
|
-
if (packageName === BASE_THEME_PACKAGE) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const cssData = await getThemeProperties(packageName, theme);
|
|
41
|
-
if (cssData) {
|
|
42
|
-
createOrUpdateStyle(cssData, "data-ui5-theme-properties", packageName);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return Promise.all(packagesStylesPromises);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const detectExternalTheme = async (theme: string) => {
|
|
50
|
-
// If theme designer theme is detected, use this
|
|
51
|
-
const extTheme = getThemeDesignerTheme();
|
|
52
|
-
if (extTheme) {
|
|
53
|
-
return extTheme;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// If OpenUI5Support is enabled, try to find out if it loaded variables
|
|
57
|
-
const openUI5Support = getFeature<typeof OpenUI5Support>("OpenUI5Support");
|
|
58
|
-
if (openUI5Support) {
|
|
59
|
-
const varsLoaded = openUI5Support.cssVariablesLoaded();
|
|
60
|
-
if (varsLoaded) {
|
|
61
|
-
return {
|
|
62
|
-
themeName: openUI5Support.getConfigurationSettingsObject()?.theme, // just themeName
|
|
63
|
-
baseThemeName: "", // baseThemeName is only relevant for custom themes
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
} else if (getThemeRoot()) {
|
|
67
|
-
await attachCustomThemeStylesToHead(theme);
|
|
68
|
-
|
|
69
|
-
return getThemeDesignerTheme();
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const applyTheme = async (theme: string) => {
|
|
74
|
-
const extTheme = await detectExternalTheme(theme);
|
|
75
|
-
|
|
76
|
-
// Only load theme_base properties if there is no externally loaded theme, or there is, but it is not being loaded
|
|
77
|
-
if (!extTheme || theme !== extTheme.themeName) {
|
|
78
|
-
await loadThemeBase(theme);
|
|
79
|
-
} else {
|
|
80
|
-
deleteThemeBase();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Always load component packages properties. For non-registered themes, try with the base theme, if any
|
|
84
|
-
const packagesTheme = isThemeRegistered(theme) ? theme : extTheme && extTheme.baseThemeName;
|
|
85
|
-
await loadComponentPackages(packagesTheme || DEFAULT_THEME);
|
|
86
|
-
|
|
87
|
-
fireThemeLoaded(theme);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export default applyTheme;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import getEffectiveStyle from "./getEffectiveStyle.js";
|
|
2
|
-
import { attachCustomCSSChange } from "./CustomStyle.js";
|
|
3
|
-
import UI5Element from "../UI5Element.js";
|
|
4
|
-
|
|
5
|
-
const constructableStyleMap = new Map<string, Array<CSSStyleSheet>>();
|
|
6
|
-
|
|
7
|
-
attachCustomCSSChange((tag: string) => {
|
|
8
|
-
constructableStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns (and caches) a constructable style sheet for a web component class
|
|
13
|
-
* Note: Chrome
|
|
14
|
-
* @param ElementClass
|
|
15
|
-
* @returns {*}
|
|
16
|
-
*/
|
|
17
|
-
const getConstructableStyle = (ElementClass: typeof UI5Element, forStaticArea = false) => {
|
|
18
|
-
const tag = ElementClass.getMetadata().getTag();
|
|
19
|
-
const key = `${tag}_${forStaticArea ? "static" : "normal"}`;
|
|
20
|
-
|
|
21
|
-
if (!constructableStyleMap.has(key)) {
|
|
22
|
-
const styleContent = getEffectiveStyle(ElementClass, forStaticArea);
|
|
23
|
-
const style = new CSSStyleSheet();
|
|
24
|
-
style.replaceSync(styleContent);
|
|
25
|
-
constructableStyleMap.set(key, [style]);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return constructableStyleMap.get(key)!;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default getConstructableStyle;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getUrl } from "../CSP.js";
|
|
2
|
-
import { getFeature } from "../FeaturesRegistry.js";
|
|
3
|
-
import type UI5Element from "../UI5Element.js";
|
|
4
|
-
import type OpenUI5Enablement from "../features/OpenUI5Enablement.js";
|
|
5
|
-
import type { ComponentStylesData, StyleDataCSP } from "../types.js";
|
|
6
|
-
|
|
7
|
-
const MAX_DEPTH_INHERITED_CLASSES = 10; // TypeScript complains about Infinity and big numbers
|
|
8
|
-
|
|
9
|
-
const getEffectiveLinksHrefs = (ElementClass: typeof UI5Element, forStaticArea = false) => {
|
|
10
|
-
const stylesData: ComponentStylesData = ElementClass[forStaticArea ? "staticAreaStyles" : "styles"];
|
|
11
|
-
|
|
12
|
-
if (!stylesData) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const stylesDataArray: ComponentStylesData = Array.isArray(stylesData) ? stylesData : [stylesData];
|
|
17
|
-
|
|
18
|
-
const openUI5Enablement = getFeature<typeof OpenUI5Enablement>("OpenUI5Enablement");
|
|
19
|
-
if (openUI5Enablement) {
|
|
20
|
-
stylesDataArray.push(openUI5Enablement.getBusyIndicatorStyles());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return stylesDataArray.flat(MAX_DEPTH_INHERITED_CLASSES).filter(data => !!data).map(data => getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default getEffectiveLinksHrefs;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { getCustomCSS, attachCustomCSSChange } from "./CustomStyle.js";
|
|
2
|
-
import getStylesString from "./getStylesString.js";
|
|
3
|
-
import { getFeature } from "../FeaturesRegistry.js";
|
|
4
|
-
import type UI5Element from "../UI5Element.js";
|
|
5
|
-
import OpenUI5Enablement from "../features/OpenUI5Enablement.js";
|
|
6
|
-
|
|
7
|
-
const effectiveStyleMap = new Map<string, string>();
|
|
8
|
-
|
|
9
|
-
attachCustomCSSChange((tag: string) => {
|
|
10
|
-
effectiveStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const getEffectiveStyle = (ElementClass: typeof UI5Element, forStaticArea = false) => {
|
|
14
|
-
const tag = ElementClass.getMetadata().getTag();
|
|
15
|
-
const key = `${tag}_${forStaticArea ? "static" : "normal"}`;
|
|
16
|
-
const openUI5Enablement = getFeature<typeof OpenUI5Enablement>("OpenUI5Enablement");
|
|
17
|
-
|
|
18
|
-
if (!effectiveStyleMap.has(key)) {
|
|
19
|
-
let effectiveStyle;
|
|
20
|
-
let busyIndicatorStyles = "";
|
|
21
|
-
|
|
22
|
-
if (openUI5Enablement) {
|
|
23
|
-
busyIndicatorStyles = getStylesString(openUI5Enablement.getBusyIndicatorStyles());
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (forStaticArea) {
|
|
27
|
-
effectiveStyle = getStylesString(ElementClass.staticAreaStyles);
|
|
28
|
-
} else {
|
|
29
|
-
const customStyle = getCustomCSS(tag) || "";
|
|
30
|
-
const builtInStyles = getStylesString(ElementClass.styles);
|
|
31
|
-
effectiveStyle = `${builtInStyles} ${customStyle}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
effectiveStyle = `${effectiveStyle} ${busyIndicatorStyles}`;
|
|
35
|
-
effectiveStyleMap.set(key, effectiveStyle);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return effectiveStyleMap.get(key)!; // The key is guaranteed to exist
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default getEffectiveStyle;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ComponentStylesData, StyleData } from "../types.js";
|
|
2
|
-
|
|
3
|
-
const MAX_DEPTH_INHERITED_CLASSES = 10; // TypeScript complains about Infinity and big numbers
|
|
4
|
-
|
|
5
|
-
const getStylesString = (styles: ComponentStylesData) => {
|
|
6
|
-
if (Array.isArray(styles)) {
|
|
7
|
-
return (styles.filter(style => !!style).flat(MAX_DEPTH_INHERITED_CLASSES) as Array<StyleData>).map((style: StyleData) => {
|
|
8
|
-
return typeof style === "string" ? style : style.content;
|
|
9
|
-
}).join(" ");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return typeof styles === "string" ? styles : styles.content;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default getStylesString;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
type ThemeDescriptor = {
|
|
2
|
-
themeName: string,
|
|
3
|
-
baseThemeName?: string,
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
type ThemeMetadata = {
|
|
7
|
-
Path: string,
|
|
8
|
-
Extends: Array<string>,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const warnings = new Set<string>();
|
|
12
|
-
|
|
13
|
-
const getThemeMetadata = () => {
|
|
14
|
-
// Check if the class was already applied, most commonly to the link/style tag with the CSS Variables
|
|
15
|
-
let el = document.querySelector(".sapThemeMetaData-Base-baseLib") || document.querySelector(".sapThemeMetaData-UI5-sap-ui-core");
|
|
16
|
-
if (el) {
|
|
17
|
-
return getComputedStyle(el).backgroundImage;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
el = document.createElement("span");
|
|
21
|
-
(el as HTMLSpanElement).style.display = "none";
|
|
22
|
-
|
|
23
|
-
// Try with sapThemeMetaData-Base-baseLib first
|
|
24
|
-
el.classList.add("sapThemeMetaData-Base-baseLib");
|
|
25
|
-
document.body.appendChild(el);
|
|
26
|
-
let metadata = getComputedStyle(el).backgroundImage;
|
|
27
|
-
|
|
28
|
-
// Try with sapThemeMetaData-UI5-sap-ui-core only if the previous selector was not found
|
|
29
|
-
if (metadata === "none") {
|
|
30
|
-
el.classList.add("sapThemeMetaData-UI5-sap-ui-core");
|
|
31
|
-
metadata = getComputedStyle(el).backgroundImage;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
document.body.removeChild(el);
|
|
35
|
-
|
|
36
|
-
return metadata;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const parseThemeMetadata = (metadataString: string) => {
|
|
40
|
-
const params = /\(["']?data:text\/plain;utf-8,(.*?)['"]?\)$/i.exec(metadataString);
|
|
41
|
-
if (params && params.length >= 2) {
|
|
42
|
-
let paramsString = params[1];
|
|
43
|
-
paramsString = paramsString.replace(/\\"/g, `"`);
|
|
44
|
-
if (paramsString.charAt(0) !== "{" && paramsString.charAt(paramsString.length - 1) !== "}") {
|
|
45
|
-
try {
|
|
46
|
-
paramsString = decodeURIComponent(paramsString);
|
|
47
|
-
} catch (ex) {
|
|
48
|
-
if (!warnings.has("decode")) {
|
|
49
|
-
console.warn("Malformed theme metadata string, unable to decodeURIComponent"); // eslint-disable-line
|
|
50
|
-
warnings.add("decode");
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
return JSON.parse(paramsString) as ThemeMetadata;
|
|
57
|
-
} catch (ex) {
|
|
58
|
-
if (!warnings.has("parse")) {
|
|
59
|
-
console.warn("Malformed theme metadata string, unable to parse JSON"); // eslint-disable-line
|
|
60
|
-
warnings.add("parse");
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const processThemeMetadata = (metadata: ThemeMetadata): ThemeDescriptor | undefined => {
|
|
67
|
-
let themeName;
|
|
68
|
-
let baseThemeName;
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
themeName = metadata.Path.match(/\.([^.]+)\.css_variables$/)![1];
|
|
72
|
-
baseThemeName = metadata.Extends[0];
|
|
73
|
-
} catch (ex) {
|
|
74
|
-
if (!warnings.has("object")) {
|
|
75
|
-
console.warn("Malformed theme metadata Object", metadata); // eslint-disable-line
|
|
76
|
-
warnings.add("object");
|
|
77
|
-
}
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
themeName,
|
|
83
|
-
baseThemeName,
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const getThemeDesignerTheme = (): ThemeDescriptor | undefined => {
|
|
88
|
-
const metadataString = getThemeMetadata();
|
|
89
|
-
if (!metadataString || metadataString === "none") {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const metadata = parseThemeMetadata(metadataString);
|
|
94
|
-
|
|
95
|
-
if (metadata) {
|
|
96
|
-
return processThemeMetadata(metadata);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default getThemeDesignerTheme;
|
|
101
|
-
export type { ThemeDescriptor };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import getEffectiveLinksHrefs from "./getEffectiveLinksHrefs.js";
|
|
2
|
-
import createLinkInHead from "../util/createLinkInHead.js";
|
|
3
|
-
import { shouldUseLinks, shouldPreloadLinks } from "../CSP.js";
|
|
4
|
-
import type UI5Element from "../UI5Element.js";
|
|
5
|
-
|
|
6
|
-
const preloaded = new Set<string>();
|
|
7
|
-
|
|
8
|
-
const preloadLinks = (ElementClass: typeof UI5Element) => {
|
|
9
|
-
if (!shouldUseLinks() || !shouldPreloadLinks()) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const linksHrefs = getEffectiveLinksHrefs(ElementClass, false) || [];
|
|
14
|
-
const staticAreaLinksHrefs = getEffectiveLinksHrefs(ElementClass, true) || [];
|
|
15
|
-
|
|
16
|
-
[...linksHrefs, ...staticAreaLinksHrefs].forEach(href => {
|
|
17
|
-
if (!preloaded.has(href)) {
|
|
18
|
-
createLinkInHead(href, { rel: "preload", as: "style" });
|
|
19
|
-
preloaded.add(href);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default preloadLinks;
|
package/src/thirdparty/_merge.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import isPlainObject from './isPlainObject.js';
|
|
2
|
-
var oToken = Object.create(null);
|
|
3
|
-
var fnMerge = function (arg1?: any, arg2?: any, arg3?: any, arg4?: any) {
|
|
4
|
-
var src, copyIsArray, copy, name, options, clone, target = arguments[2] || {}, i = 3, length = arguments.length, deep = arguments[0] || false, skipToken = arguments[1] ? undefined : oToken;
|
|
5
|
-
if (typeof target !== 'object' && typeof target !== 'function') {
|
|
6
|
-
target = {};
|
|
7
|
-
}
|
|
8
|
-
for (; i < length; i++) {
|
|
9
|
-
if ((options = arguments[i]) != null) {
|
|
10
|
-
for (name in options) {
|
|
11
|
-
src = target[name];
|
|
12
|
-
copy = options[name];
|
|
13
|
-
if (name === '__proto__' || target === copy) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
if (deep && copy && (isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
|
|
17
|
-
if (copyIsArray) {
|
|
18
|
-
copyIsArray = false;
|
|
19
|
-
clone = src && Array.isArray(src) ? src : [];
|
|
20
|
-
} else {
|
|
21
|
-
clone = src && isPlainObject(src) ? src : {};
|
|
22
|
-
}
|
|
23
|
-
target[name] = fnMerge(deep, arguments[1], clone, copy);
|
|
24
|
-
} else if (copy !== skipToken) {
|
|
25
|
-
target[name] = copy;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
export default fnMerge;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var class2type = {};
|
|
2
|
-
var hasOwn = class2type.hasOwnProperty;
|
|
3
|
-
var toString = class2type.toString;
|
|
4
|
-
var fnToString = hasOwn.toString;
|
|
5
|
-
var ObjectFunctionString = fnToString.call(Object);
|
|
6
|
-
var fnIsPlainObject = function (obj: object) {
|
|
7
|
-
var proto, Ctor;
|
|
8
|
-
if (!obj || toString.call(obj) !== "[object Object]") {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
proto = Object.getPrototypeOf(obj);
|
|
12
|
-
if (!proto) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
16
|
-
return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
|
|
17
|
-
};
|
|
18
|
-
export default fnIsPlainObject;
|
package/src/thirdparty/merge.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Different types of AnimationMode.
|
|
3
|
-
*
|
|
4
|
-
* @readonly
|
|
5
|
-
* @enum {string}
|
|
6
|
-
* @public
|
|
7
|
-
* @author SAP SE
|
|
8
|
-
* @alias sap.ui.webc.base.types.AnimationMode
|
|
9
|
-
*/
|
|
10
|
-
enum AnimationMode {
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
* @type {Full}
|
|
14
|
-
*/
|
|
15
|
-
Full = "full",
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
* @type {Basic}
|
|
19
|
-
*/
|
|
20
|
-
Basic = "basic",
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
* @type {Minimal}
|
|
24
|
-
*/
|
|
25
|
-
Minimal = "minimal",
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
* @type {None}
|
|
29
|
-
*/
|
|
30
|
-
None = "none",
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default AnimationMode;
|