@ui5/webcomponents-base 0.0.0-6ef02a35f → 0.0.0-7e7d9ea6f
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 +3 -2
- package/CHANGELOG.md +225 -0
- package/README.md +53 -7
- package/bundle.esm.js +13 -11
- package/dist/Boot.js +34 -18
- package/dist/CSP.js +59 -0
- package/dist/CustomElementsRegistry.js +60 -4
- package/dist/CustomElementsScope.js +20 -98
- package/dist/CustomElementsScopeUtils.js +108 -0
- package/dist/Device.js +20 -1
- package/dist/EventProvider.js +19 -25
- package/dist/FeaturesRegistry.js +4 -1
- package/dist/FontFace.js +7 -95
- package/dist/InitialConfiguration.js +11 -7
- package/dist/Keys.js +56 -0
- package/dist/ManagedStyles.js +83 -0
- package/dist/Render.js +3 -1
- package/dist/Runtimes.js +107 -0
- package/dist/StaticAreaItem.js +15 -10
- package/dist/SystemCSSVars.js +4 -25
- package/dist/UI5Element.js +59 -60
- package/dist/UI5ElementMetadata.js +47 -6
- package/dist/asset-registries/Icons.js +22 -8
- package/dist/asset-registries/Illustrations.js +10 -3
- package/dist/asset-registries/LocaleData.js +18 -4
- package/dist/asset-registries/Themes.js +6 -2
- package/dist/asset-registries/i18n.js +3 -1
- package/dist/assets/bundle.esm.691f93f5.js +43 -0
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/Icons.js +52 -0
- package/dist/config/Theme.js +25 -0
- package/dist/css/BusyIndicator.css +80 -0
- package/dist/css/FontFace.css +75 -0
- package/dist/css/OverrideFontFace.css +32 -0
- package/dist/css/SystemCSSVars.css +17 -0
- package/dist/delegate/ItemNavigation.js +75 -4
- package/dist/features/F6Navigation.js +110 -0
- package/dist/features/OpenUI5Enablement.js +119 -0
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/VersionInfo.js +10 -0
- package/dist/generated/css/BusyIndicator.css.js +5 -0
- package/dist/generated/css/FontFace.css.js +5 -0
- package/dist/generated/css/OverrideFontFace.css.js +5 -0
- package/dist/generated/css/SystemCSSVars.css.js +5 -0
- package/dist/i18nBundle.js +33 -2
- package/dist/renderer/LitRenderer.js +33 -12
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/renderer/executeTemplate.js +19 -2
- package/dist/sap/base/Log.js +2 -10
- package/dist/sap/base/assert.js +1 -5
- package/dist/sap/base/security/encodeCSS.js +14 -0
- package/dist/sap/base/security/encodeXML.js +23 -0
- package/dist/sap/base/strings/toHex.js +8 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
- package/dist/theming/CustomStyle.js +23 -3
- package/dist/theming/applyTheme.js +11 -10
- package/dist/theming/getEffectiveLinksHrefs.js +27 -0
- package/dist/theming/getEffectiveStyle.js +9 -0
- package/dist/theming/getStylesString.js +4 -2
- package/dist/theming/getThemeDesignerTheme.js +25 -5
- package/dist/theming/preloadLinks.js +23 -0
- package/dist/types/DataType.js +12 -0
- package/dist/types/Float.js +4 -0
- package/dist/types/Integer.js +4 -0
- package/dist/updateShadowRoot.js +9 -6
- package/dist/util/Caret.js +1 -14
- package/dist/util/ColorConversion.js +30 -2
- package/dist/util/FocusableElements.js +8 -6
- package/dist/util/InvisibleMessage.js +20 -9
- package/dist/util/TabbableElements.js +4 -0
- package/dist/util/createLinkInHead.js +19 -0
- package/dist/util/escapeRegex.js +10 -0
- package/dist/util/generateHighlightedMarkup.js +42 -0
- package/dist/util/getNormalizedTarget.js +16 -0
- package/dist/util/isDefaultSlotProvided.js +11 -0
- package/dist/util/isNodeHidden.js +1 -1
- package/hash.txt +1 -1
- package/lib/generate-asset-parameters/index.js +8 -5
- package/lib/generate-styles/index.js +26 -0
- package/lib/generate-version-info/index.js +32 -0
- package/package-scripts.js +25 -31
- package/package.json +11 -12
- package/src/Boot.js +34 -18
- package/src/CSP.js +59 -0
- package/src/CustomElementsRegistry.js +60 -4
- package/src/CustomElementsScope.js +20 -98
- package/src/CustomElementsScopeUtils.js +108 -0
- package/src/Device.js +20 -1
- package/src/EventProvider.js +19 -25
- package/src/FeaturesRegistry.js +4 -1
- package/src/FontFace.js +7 -95
- package/src/InitialConfiguration.js +11 -7
- package/src/Keys.js +56 -0
- package/src/ManagedStyles.js +83 -0
- package/src/Render.js +3 -1
- package/src/Runtimes.js +107 -0
- package/src/StaticAreaItem.js +15 -10
- package/src/SystemCSSVars.js +4 -25
- package/src/UI5Element.js +59 -60
- package/src/UI5ElementMetadata.js +47 -6
- package/src/asset-registries/Icons.js +22 -8
- package/src/asset-registries/Illustrations.js +10 -3
- package/src/asset-registries/LocaleData.js +18 -4
- package/src/asset-registries/Themes.js +6 -2
- package/src/asset-registries/i18n.js +3 -1
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/Icons.js +52 -0
- package/src/config/Theme.js +25 -0
- package/src/css/BusyIndicator.css +80 -0
- package/src/css/FontFace.css +75 -0
- package/src/css/OverrideFontFace.css +32 -0
- package/src/css/SystemCSSVars.css +17 -0
- package/src/delegate/ItemNavigation.js +75 -4
- package/src/features/F6Navigation.js +110 -0
- package/src/features/OpenUI5Enablement.js +119 -0
- package/src/i18nBundle.js +33 -2
- package/src/renderer/LitRenderer.js +33 -12
- package/src/renderer/directives/style-map.js +72 -0
- package/src/renderer/executeTemplate.js +19 -2
- package/src/theming/CustomStyle.js +23 -3
- package/src/theming/applyTheme.js +11 -10
- package/src/theming/getEffectiveLinksHrefs.js +27 -0
- package/src/theming/getEffectiveStyle.js +9 -0
- package/src/theming/getStylesString.js +4 -2
- package/src/theming/getThemeDesignerTheme.js +25 -5
- package/src/theming/preloadLinks.js +23 -0
- package/src/types/DataType.js +12 -0
- package/src/types/Float.js +4 -0
- package/src/types/Integer.js +4 -0
- package/src/updateShadowRoot.js +9 -6
- package/src/util/Caret.js +1 -14
- package/src/util/ColorConversion.js +30 -2
- package/src/util/FocusableElements.js +8 -6
- package/src/util/InvisibleMessage.js +20 -9
- package/src/util/TabbableElements.js +4 -0
- package/src/util/createLinkInHead.js +19 -0
- package/src/util/escapeRegex.js +10 -0
- package/src/util/generateHighlightedMarkup.js +42 -0
- package/src/util/getNormalizedTarget.js +16 -0
- package/src/util/isDefaultSlotProvided.js +11 -0
- package/src/util/isNodeHidden.js +1 -1
- package/used-modules.txt +4 -1
- package/config/.eslintrc.js +0 -3
- package/config/rollup.config.js +0 -1
- package/dist/config/AssetsPath.js +0 -17
- package/dist/isLegacyBrowser.js +0 -3
- package/dist/resources/bundle.esm.js +0 -26
- package/dist/resources/bundle.esm.js.map +0 -1
- package/dist/test-resources/assets/Themes.js +0 -17
- package/dist/test-resources/elements/Child.js +0 -35
- package/dist/test-resources/elements/Generic.js +0 -84
- package/dist/test-resources/elements/GenericExt.js +0 -26
- package/dist/test-resources/elements/NoShadowDOM.js +0 -13
- package/dist/test-resources/elements/Parent.js +0 -41
- package/dist/test-resources/elements/WithStaticArea.js +0 -76
- package/dist/test-resources/pages/AllTestElements.html +0 -39
- package/dist/test-resources/pages/Configuration.html +0 -18
- package/dist/test-resources/pages/ConfigurationScript.html +0 -34
- package/dist/test-resources/pages/assets/messagebundle_de.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_en.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_es.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_fr.properties +0 -1
- package/dist/test-resources/pages/i18n.html +0 -35
- package/dist/test-resources/specs/ConfigurationChange.spec.js +0 -27
- package/dist/test-resources/specs/ConfigurationScript.spec.js +0 -63
- package/dist/test-resources/specs/ConfigurationURL.spec.js +0 -93
- package/dist/test-resources/specs/CustomTheme.spec.js +0 -27
- package/dist/test-resources/specs/StaticArea.spec.js +0 -36
- package/dist/test-resources/specs/Theming.spec.js +0 -33
- package/dist/test-resources/specs/UI5ElementInvalidation.js +0 -242
- package/dist/test-resources/specs/UI5ElementLifecycle.js +0 -98
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +0 -75
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +0 -42
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +0 -14
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +0 -67
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +0 -24
- package/dist/test-resources/specs/UI5ElementSlots.js +0 -36
- package/dist/theming/createThemePropertiesStyleTag.js +0 -20
- package/dist/util/encodeCSS.js +0 -24
- package/src/config/AssetsPath.js +0 -17
- package/src/isLegacyBrowser.js +0 -3
- package/src/theming/createThemePropertiesStyleTag.js +0 -20
- package/src/util/encodeCSS.js +0 -24
|
@@ -1,102 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
const tagsCache = new Map(); // true/false means the tag should/should not be cached, undefined means not known yet.
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Sets the suffix to be used for custom elements scoping, f.e. pass "demo" to get tags such as "ui5-button-demo".
|
|
10
|
-
* Note: by default all tags starting with "ui5-" will be scoped, unless you change this by calling "setCustomElementsScopingRules"
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
* @param suffix The scoping suffix
|
|
14
|
-
*/
|
|
15
|
-
const setCustomElementsScopingSuffix = suffix => {
|
|
16
|
-
if (!suffix.match(/^[a-zA-Z0-9_-]+$/)) {
|
|
17
|
-
throw new Error("Only alphanumeric characters and dashes allowed for the scoping suffix");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
suf = suffix;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Returns the currently set scoping suffix, or undefined if not set.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
* @returns {String|undefined}
|
|
28
|
-
*/
|
|
29
|
-
const getCustomElementsScopingSuffix = () => {
|
|
30
|
-
return suf;
|
|
31
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
html,
|
|
3
|
+
svg,
|
|
4
|
+
unsafeStatic,
|
|
5
|
+
} from "lit-html/static.js";
|
|
32
6
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
throw new Error(`"rules.include" must be an array of regular expressions`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (rules.exclude && (!Array.isArray(rules.exclude) || rules.exclude.some(rule => !(rule instanceof RegExp)))) {
|
|
52
|
-
throw new Error(`"rules.exclude" must be an array of regular expressions`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
rules.exclude = rules.exclude || [];
|
|
56
|
-
rulesObj = rules;
|
|
57
|
-
tagsCache.clear(); // reset the cache upon setting new rules
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Returns the rules, governing which custom element tags to scope and which not. By default, all elements
|
|
62
|
-
* starting with "ui5-" are scoped. The default rules are: {include: [/^ui5-/]}.
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
* @returns {Object}
|
|
66
|
-
*/
|
|
67
|
-
const getCustomElementsScopingRules = () => {
|
|
68
|
-
return rulesObj;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Determines whether custom elements with the given tag should be scoped or not.
|
|
73
|
-
* The tag is first matched against the "include" rules and then against the "exclude" rules and the
|
|
74
|
-
* result is cached until new rules are set.
|
|
75
|
-
*
|
|
76
|
-
* @public
|
|
77
|
-
* @param tag
|
|
78
|
-
*/
|
|
79
|
-
const shouldScopeCustomElement = tag => {
|
|
80
|
-
if (!tagsCache.has(tag)) {
|
|
81
|
-
const result = rulesObj.include.some(rule => tag.match(rule)) && !rulesObj.exclude.some(rule => tag.match(rule));
|
|
82
|
-
tagsCache.set(tag, result);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return tagsCache.get(tag);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Returns the currently set scoping suffix, if any and if the tag should be scoped, or undefined otherwise.
|
|
90
|
-
*
|
|
91
|
-
* @public
|
|
92
|
-
* @param tag
|
|
93
|
-
* @returns {String}
|
|
94
|
-
*/
|
|
95
|
-
const getEffectiveScopingSuffixForTag = tag => {
|
|
96
|
-
if (shouldScopeCustomElement(tag)) {
|
|
97
|
-
return getCustomElementsScopingSuffix();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
7
|
+
import {
|
|
8
|
+
setCustomElementsScopingSuffix,
|
|
9
|
+
getCustomElementsScopingSuffix,
|
|
10
|
+
setCustomElementsScopingRules,
|
|
11
|
+
getCustomElementsScopingRules,
|
|
12
|
+
shouldScopeCustomElement,
|
|
13
|
+
getEffectiveScopingSuffixForTag,
|
|
14
|
+
} from "./CustomElementsScopeUtils.js";
|
|
15
|
+
import { registerFeature } from "./FeaturesRegistry.js";
|
|
16
|
+
|
|
17
|
+
registerFeature("LitStatic", {
|
|
18
|
+
html,
|
|
19
|
+
svg,
|
|
20
|
+
unsafeStatic,
|
|
21
|
+
});
|
|
100
22
|
|
|
101
23
|
export {
|
|
102
24
|
setCustomElementsScopingSuffix,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
let suf;
|
|
2
|
+
let rulesObj = {
|
|
3
|
+
include: [/^ui5-/],
|
|
4
|
+
exclude: [],
|
|
5
|
+
};
|
|
6
|
+
const tagsCache = new Map(); // true/false means the tag should/should not be cached, undefined means not known yet.
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sets the suffix to be used for custom elements scoping, f.e. pass "demo" to get tags such as "ui5-button-demo".
|
|
10
|
+
* Note: by default all tags starting with "ui5-" will be scoped, unless you change this by calling "setCustomElementsScopingRules"
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @param suffix The scoping suffix
|
|
14
|
+
*/
|
|
15
|
+
const setCustomElementsScopingSuffix = suffix => {
|
|
16
|
+
if (!suffix.match(/^[a-zA-Z0-9_-]+$/)) {
|
|
17
|
+
throw new Error("Only alphanumeric characters and dashes allowed for the scoping suffix");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
suf = suffix;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the currently set scoping suffix, or undefined if not set.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @returns {String|undefined}
|
|
28
|
+
*/
|
|
29
|
+
const getCustomElementsScopingSuffix = () => {
|
|
30
|
+
return suf;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Sets the rules, governing which custom element tags to scope and which not, f.e.
|
|
35
|
+
* setCustomElementsScopingRules({include: [/^ui5-/]}, exclude: [/^ui5-mylib-/, /^ui5-carousel$/]);
|
|
36
|
+
* will scope all elements starting with "ui5-" but not the ones starting with "ui5-mylib-" and not "ui5-carousel".
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
* @param rules Object with "include" and "exclude" properties, both arrays of regular expressions. Note that "include"
|
|
40
|
+
* rules are applied first and "exclude" rules second.
|
|
41
|
+
*/
|
|
42
|
+
const setCustomElementsScopingRules = rules => {
|
|
43
|
+
if (!rules || !rules.include) {
|
|
44
|
+
throw new Error(`"rules" must be an object with at least an "include" property`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!Array.isArray(rules.include) || rules.include.some(rule => !(rule instanceof RegExp))) {
|
|
48
|
+
throw new Error(`"rules.include" must be an array of regular expressions`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (rules.exclude && (!Array.isArray(rules.exclude) || rules.exclude.some(rule => !(rule instanceof RegExp)))) {
|
|
52
|
+
throw new Error(`"rules.exclude" must be an array of regular expressions`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
rules.exclude = rules.exclude || [];
|
|
56
|
+
rulesObj = rules;
|
|
57
|
+
tagsCache.clear(); // reset the cache upon setting new rules
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the rules, governing which custom element tags to scope and which not. By default, all elements
|
|
62
|
+
* starting with "ui5-" are scoped. The default rules are: {include: [/^ui5-/]}.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
* @returns {Object}
|
|
66
|
+
*/
|
|
67
|
+
const getCustomElementsScopingRules = () => {
|
|
68
|
+
return rulesObj;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Determines whether custom elements with the given tag should be scoped or not.
|
|
73
|
+
* The tag is first matched against the "include" rules and then against the "exclude" rules and the
|
|
74
|
+
* result is cached until new rules are set.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
* @param tag
|
|
78
|
+
*/
|
|
79
|
+
const shouldScopeCustomElement = tag => {
|
|
80
|
+
if (!tagsCache.has(tag)) {
|
|
81
|
+
const result = rulesObj.include.some(rule => tag.match(rule)) && !rulesObj.exclude.some(rule => tag.match(rule));
|
|
82
|
+
tagsCache.set(tag, result);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return tagsCache.get(tag);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns the currently set scoping suffix, if any and if the tag should be scoped, or undefined otherwise.
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
* @param tag
|
|
93
|
+
* @returns {String}
|
|
94
|
+
*/
|
|
95
|
+
const getEffectiveScopingSuffixForTag = tag => {
|
|
96
|
+
if (shouldScopeCustomElement(tag)) {
|
|
97
|
+
return getCustomElementsScopingSuffix();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
setCustomElementsScopingSuffix,
|
|
103
|
+
getCustomElementsScopingSuffix,
|
|
104
|
+
setCustomElementsScopingRules,
|
|
105
|
+
getCustomElementsScopingRules,
|
|
106
|
+
shouldScopeCustomElement,
|
|
107
|
+
getEffectiveScopingSuffixForTag,
|
|
108
|
+
};
|
package/dist/Device.js
CHANGED
|
@@ -5,9 +5,13 @@ const chrome = !ie && /(Chrome|CriOS)/.test(ua);
|
|
|
5
5
|
const safari = !ie && !chrome && /(Version|PhantomJS)\/(\d+\.\d+).*Safari/.test(ua);
|
|
6
6
|
const webkit = !ie && /webkit/.test(ua);
|
|
7
7
|
const windows = navigator.platform.indexOf("Win") !== -1;
|
|
8
|
+
const iOS = navigator.platform.match(/iPhone|iPad|iPod/) || (navigator.userAgent.match(/Mac/) && "ontouchend" in document);
|
|
8
9
|
const android = !windows && /Android/.test(ua);
|
|
9
10
|
const androidPhone = android && /(?=android)(?=.*mobile)/i.test(ua);
|
|
10
|
-
const ipad = /ipad/i.test(ua);
|
|
11
|
+
const ipad = /ipad/i.test(ua) || (/Macintosh/i.test(ua) && "ontouchend" in document);
|
|
12
|
+
// With iOS 13 the string 'iPad' was removed from the user agent string through a browser setting, which is applied on all sites by default:
|
|
13
|
+
// "Request Desktop Website -> All websites" (for more infos see: https://forums.developer.apple.com/thread/119186).
|
|
14
|
+
// Therefore the OS is detected as MACINTOSH instead of iOS and the device is a tablet if the Device.support.touch is true.
|
|
11
15
|
|
|
12
16
|
let windowsVersion;
|
|
13
17
|
let webkitVersion;
|
|
@@ -91,6 +95,18 @@ const isDesktop = () => {
|
|
|
91
95
|
return (!isTablet() && !isPhone()) || isWindows8OrAbove();
|
|
92
96
|
};
|
|
93
97
|
|
|
98
|
+
const isCombi = () => {
|
|
99
|
+
return isTablet() && isDesktop();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const isIOS = () => {
|
|
103
|
+
return iOS;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const isAndroid = () => {
|
|
107
|
+
return android || androidPhone;
|
|
108
|
+
};
|
|
109
|
+
|
|
94
110
|
export {
|
|
95
111
|
supportsTouch,
|
|
96
112
|
isIE,
|
|
@@ -99,4 +115,7 @@ export {
|
|
|
99
115
|
isPhone,
|
|
100
116
|
isTablet,
|
|
101
117
|
isDesktop,
|
|
118
|
+
isCombi,
|
|
119
|
+
isIOS,
|
|
120
|
+
isAndroid,
|
|
102
121
|
};
|
package/dist/EventProvider.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
class EventProvider {
|
|
2
2
|
constructor() {
|
|
3
|
-
this._eventRegistry =
|
|
3
|
+
this._eventRegistry = new Map();
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
attachEvent(eventName, fnFunction) {
|
|
7
7
|
const eventRegistry = this._eventRegistry;
|
|
8
|
-
|
|
8
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
9
9
|
|
|
10
10
|
if (!Array.isArray(eventListeners)) {
|
|
11
|
-
eventRegistry
|
|
12
|
-
|
|
11
|
+
eventRegistry.set(eventName, [fnFunction]);
|
|
12
|
+
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
eventListeners.
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
if (!eventListeners.includes(fnFunction)) {
|
|
16
|
+
eventListeners.push(fnFunction);
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
detachEvent(eventName, fnFunction) {
|
|
21
21
|
const eventRegistry = this._eventRegistry;
|
|
22
|
-
|
|
22
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
23
23
|
|
|
24
24
|
if (!eventListeners) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
+
const indexOfFnToDetach = eventListeners.indexOf(fnFunction);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
if (indexOfFnToDetach !== -1) {
|
|
30
|
+
eventListeners.splice(indexOfFnToDetach, 1);
|
|
31
|
+
}
|
|
31
32
|
|
|
32
33
|
if (eventListeners.length === 0) {
|
|
33
|
-
delete
|
|
34
|
+
eventRegistry.delete(eventName);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -43,14 +44,14 @@ class EventProvider {
|
|
|
43
44
|
*/
|
|
44
45
|
fireEvent(eventName, data) {
|
|
45
46
|
const eventRegistry = this._eventRegistry;
|
|
46
|
-
const eventListeners = eventRegistry
|
|
47
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
47
48
|
|
|
48
49
|
if (!eventListeners) {
|
|
49
50
|
return [];
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
return eventListeners.map(
|
|
53
|
-
return
|
|
53
|
+
return eventListeners.map(fn => {
|
|
54
|
+
return fn.call(this, data); // eslint-disable-line
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -67,24 +68,17 @@ class EventProvider {
|
|
|
67
68
|
|
|
68
69
|
isHandlerAttached(eventName, fnFunction) {
|
|
69
70
|
const eventRegistry = this._eventRegistry;
|
|
70
|
-
const eventListeners = eventRegistry
|
|
71
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
71
72
|
|
|
72
73
|
if (!eventListeners) {
|
|
73
74
|
return false;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
const event = eventListeners[i];
|
|
78
|
-
if (event["function"] === fnFunction) { // eslint-disable-line
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return false;
|
|
77
|
+
return eventListeners.includes(fnFunction);
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
hasListeners(eventName) {
|
|
87
|
-
return !!this._eventRegistry
|
|
81
|
+
return !!this._eventRegistry.get(eventName);
|
|
88
82
|
}
|
|
89
83
|
}
|
|
90
84
|
|
package/dist/FeaturesRegistry.js
CHANGED
package/dist/FontFace.js
CHANGED
|
@@ -1,95 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* CSS font face used for the texts provided by SAP.
|
|
3
|
-
*/
|
|
4
|
-
import createStyleInHead from "./util/createStyleInHead.js";
|
|
1
|
+
import { hasStyle, createStyle } from "./ManagedStyles.js";
|
|
5
2
|
import { getFeature } from "./FeaturesRegistry.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const font72RegularWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents`;
|
|
9
|
-
const font72RegularWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents`;
|
|
10
|
-
|
|
11
|
-
const font72RegularFullWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents`;
|
|
12
|
-
const font72RegularFullWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents`;
|
|
13
|
-
|
|
14
|
-
const font72BoldWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents`;
|
|
15
|
-
const font72BoldWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents`;
|
|
16
|
-
|
|
17
|
-
const font72BoldFullWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents`;
|
|
18
|
-
const font72BoldFullWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents`;
|
|
19
|
-
|
|
20
|
-
const fontFaceCSS = `
|
|
21
|
-
@font-face {
|
|
22
|
-
font-family: "72";
|
|
23
|
-
font-style: normal;
|
|
24
|
-
font-weight: 400;
|
|
25
|
-
src: local("72"),
|
|
26
|
-
url(${font72RegularWoff2}) format("woff2"),
|
|
27
|
-
url(${font72RegularWoff}) format("woff");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@font-face {
|
|
31
|
-
font-family: "72full";
|
|
32
|
-
font-style: normal;
|
|
33
|
-
font-weight: 400;
|
|
34
|
-
src: local('72-full'),
|
|
35
|
-
url(${font72RegularFullWoff2}) format("woff2"),
|
|
36
|
-
url(${font72RegularFullWoff}) format("woff");
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@font-face {
|
|
41
|
-
font-family: "72";
|
|
42
|
-
font-style: normal;
|
|
43
|
-
font-weight: 700;
|
|
44
|
-
src: local('72-Bold'),
|
|
45
|
-
url(${font72BoldWoff2}) format("woff2"),
|
|
46
|
-
url(${font72BoldWoff}) format("woff");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@font-face {
|
|
50
|
-
font-family: "72full";
|
|
51
|
-
font-style: normal;
|
|
52
|
-
font-weight: 700;
|
|
53
|
-
src: local('72-Bold-full'),
|
|
54
|
-
url(${font72BoldFullWoff2}) format("woff2"),
|
|
55
|
-
url(${font72BoldFullWoff}) format("woff");
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Some diacritics are supported by the 72 font:
|
|
61
|
-
* * Grave
|
|
62
|
-
* * Acute
|
|
63
|
-
* * Circumflex
|
|
64
|
-
* * Tilde
|
|
65
|
-
*
|
|
66
|
-
* However, the following diacritics and the combination of multiple diacritics (including the supported ones) are not supported:
|
|
67
|
-
* * Breve
|
|
68
|
-
* * Horn
|
|
69
|
-
* * Dot below
|
|
70
|
-
* * Hook above
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* Override for the characters that aren't covered by the '72' font to other system fonts
|
|
74
|
-
*
|
|
75
|
-
* U+0102-0103: A and a with Breve
|
|
76
|
-
* U+01A0-01A1: O and o with Horn
|
|
77
|
-
* U+01AF-01B0: U and u with Horn
|
|
78
|
-
* U+1EA0-1EB7: A and a with diacritics that are not supported by the font and combination of multiple diacritics
|
|
79
|
-
* U+1EB8-1EC7: E and e with diacritics that are not supported by the font and combination of multiple diacritics
|
|
80
|
-
* U+1EC8-1ECB: I and i with diacritics that are not supported by the font and combination of multiple diacritics
|
|
81
|
-
* U+1ECC-1EE3: O and o with diacritics that are not supported by the font and combination of multiple diacritics
|
|
82
|
-
* U+1EE4-1EF1: U and u with diacritics that are not supported by the font and combination of multiple diacritics
|
|
83
|
-
* U+1EF4-1EF7: Y and y with diacritics that are not supported by the font and combination of multiple diacritics
|
|
84
|
-
*
|
|
85
|
-
*/
|
|
86
|
-
const overrideFontFaceCSS = `
|
|
87
|
-
@font-face {
|
|
88
|
-
font-family: '72override';
|
|
89
|
-
unicode-range: U+0102-0103, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EB7, U+1EB8-1EC7, U+1EC8-1ECB, U+1ECC-1EE3, U+1EE4-1EF1, U+1EF4-1EF7;
|
|
90
|
-
src: local('Arial'), local('Helvetica'), local('sans-serif');
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
3
|
+
import fontFaceCSS from "./generated/css/FontFace.css.js";
|
|
4
|
+
import overrideFontFaceCSS from "./generated/css/OverrideFontFace.css.js";
|
|
93
5
|
|
|
94
6
|
const insertFontFace = () => {
|
|
95
7
|
const OpenUI5Support = getFeature("OpenUI5Support");
|
|
@@ -104,14 +16,14 @@ const insertFontFace = () => {
|
|
|
104
16
|
};
|
|
105
17
|
|
|
106
18
|
const insertMainFontFace = () => {
|
|
107
|
-
if (!
|
|
108
|
-
|
|
19
|
+
if (!hasStyle("data-ui5-font-face")) {
|
|
20
|
+
createStyle(fontFaceCSS, "data-ui5-font-face");
|
|
109
21
|
}
|
|
110
22
|
};
|
|
111
23
|
|
|
112
24
|
const insertOverrideFontFace = () => {
|
|
113
|
-
if (!
|
|
114
|
-
|
|
25
|
+
if (!hasStyle("data-ui5-font-face-override")) {
|
|
26
|
+
createStyle(overrideFontFaceCSS, "data-ui5-font-face-override");
|
|
115
27
|
}
|
|
116
28
|
};
|
|
117
29
|
|
|
@@ -13,7 +13,6 @@ let initialConfig = {
|
|
|
13
13
|
noConflict: false, // no URL
|
|
14
14
|
formatSettings: {},
|
|
15
15
|
fetchDefaultLanguage: false,
|
|
16
|
-
assetsPath: "",
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
/* General settings */
|
|
@@ -62,11 +61,6 @@ const getFormatSettings = () => {
|
|
|
62
61
|
return initialConfig.formatSettings;
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
const getAssetsPath = () => {
|
|
66
|
-
initConfiguration();
|
|
67
|
-
return initialConfig.assetsPath;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
64
|
const booleanMapping = new Map();
|
|
71
65
|
booleanMapping.set("true", true);
|
|
72
66
|
booleanMapping.set("false", false);
|
|
@@ -112,6 +106,14 @@ const parseURLParameters = () => {
|
|
|
112
106
|
});
|
|
113
107
|
};
|
|
114
108
|
|
|
109
|
+
const normalizeParamValue = (param, value) => {
|
|
110
|
+
if (param === "theme" && value.includes("@")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this
|
|
111
|
+
return value.split("@")[0];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return value;
|
|
115
|
+
};
|
|
116
|
+
|
|
115
117
|
const applyURLParam = (key, value, paramType) => {
|
|
116
118
|
const lowerCaseValue = value.toLowerCase();
|
|
117
119
|
const param = key.split(`${paramType}-`)[1];
|
|
@@ -119,6 +121,9 @@ const applyURLParam = (key, value, paramType) => {
|
|
|
119
121
|
if (booleanMapping.has(value)) {
|
|
120
122
|
value = booleanMapping.get(lowerCaseValue);
|
|
121
123
|
}
|
|
124
|
+
|
|
125
|
+
value = normalizeParamValue(param, value);
|
|
126
|
+
|
|
122
127
|
initialConfig[param] = value;
|
|
123
128
|
};
|
|
124
129
|
|
|
@@ -158,5 +163,4 @@ export {
|
|
|
158
163
|
getNoConflict,
|
|
159
164
|
getCalendarType,
|
|
160
165
|
getFormatSettings,
|
|
161
|
-
getAssetsPath,
|
|
162
166
|
};
|