@ui5/webcomponents-base 1.1.2 → 1.2.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.
@@ -5,18 +5,20 @@ import { attachBoot } from "../Boot.js";
5
5
  let politeSpan;
6
6
  let assertiveSpan;
7
7
 
8
+ const setOutOfViewportStyles = el => {
9
+ el.style.position = "absolute";
10
+ el.style.clip = "rect(1px,1px,1px,1px)";
11
+ el.style.userSelect = "none";
12
+ el.style.left = "-1000px";
13
+ el.style.top = "-1000px";
14
+ el.style.pointerEvents = "none";
15
+ };
16
+
8
17
  attachBoot(() => {
9
18
  if (politeSpan && assertiveSpan) {
10
19
  return;
11
20
  }
12
21
 
13
- const styles = `position: absolute;
14
- clip: rect(1px,1px,1px,1px);
15
- user-select: none;
16
- left: -1000px;
17
- top: -1000px;
18
- pointer-events: none;`;
19
-
20
22
  politeSpan = document.createElement("span");
21
23
  assertiveSpan = document.createElement("span");
22
24
 
@@ -29,8 +31,8 @@ attachBoot(() => {
29
31
  politeSpan.setAttribute("role", "alert");
30
32
  assertiveSpan.setAttribute("role", "alert");
31
33
 
32
- politeSpan.style.cssText = styles;
33
- assertiveSpan.style.cssText = styles;
34
+ setOutOfViewportStyles(politeSpan);
35
+ setOutOfViewportStyles(assertiveSpan);
34
36
 
35
37
  getSingletonElementInstance("ui5-static-area").appendChild(politeSpan);
36
38
  getSingletonElementInstance("ui5-static-area").appendChild(assertiveSpan);
@@ -27,6 +27,10 @@ const getTabbables = (nodes, tabbables) => {
27
27
  currentNode = Array.from(children).find(node => node.tagName !== "STYLE");
28
28
  }
29
29
 
30
+ if (!currentNode) {
31
+ return;
32
+ }
33
+
30
34
  if (isNodeTabbable(currentNode)) {
31
35
  tabbablesNodes.push(currentNode);
32
36
  }
package/hash.txt CHANGED
@@ -1 +1 @@
1
- 8tp6F3Mz0kW7xUTtxVN0BiPw7WM=
1
+ 46lbK6+vsQuteRCCbgMD8Xa14pY=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-base",
3
- "version": "1.1.2",
3
+ "version": "1.2.2",
4
4
  "description": "UI5 Web Components: webcomponents.base",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -37,8 +37,8 @@
37
37
  "devDependencies": {
38
38
  "@buxlabs/amd-to-es6": "0.16.1",
39
39
  "@openui5/sap.ui.core": "1.94.0",
40
- "@ui5/webcomponents-tools": "1.1.2",
41
- "chromedriver": "96.0.0",
40
+ "@ui5/webcomponents-tools": "1.2.2",
41
+ "chromedriver": "99.0.0",
42
42
  "clean-css": "^5.2.2",
43
43
  "copy-and-watch": "^0.1.5",
44
44
  "eslint": "^7.22.0",
package/src/Boot.js CHANGED
@@ -1,4 +1,3 @@
1
- import EventProvider from "./EventProvider.js";
2
1
  import whenDOMReady from "./util/whenDOMReady.js";
3
2
  import insertFontFace from "./FontFace.js";
4
3
  import insertSystemCSSVars from "./SystemCSSVars.js";
@@ -8,15 +7,15 @@ import { registerCurrentRuntime } from "./Runtimes.js";
8
7
  import { getFeature } from "./FeaturesRegistry.js";
9
8
 
10
9
  let bootPromise;
11
- const eventProvider = new EventProvider();
12
10
 
13
11
  /**
14
12
  * Attach a callback that will be executed on boot
15
13
  * @public
16
14
  * @param listener
17
15
  */
18
- const attachBoot = listener => {
19
- eventProvider.attachEvent("boot", listener);
16
+ const attachBoot = async listener => {
17
+ await boot();
18
+ listener();
20
19
  };
21
20
 
22
21
  const boot = async () => {
@@ -46,7 +45,6 @@ const boot = async () => {
46
45
  OpenUI5Support && OpenUI5Support.attachListeners();
47
46
  insertFontFace();
48
47
  insertSystemCSSVars();
49
- await eventProvider.fireEventAsync("boot");
50
48
 
51
49
  resolve();
52
50
  });
package/src/Keys.js CHANGED
@@ -153,8 +153,12 @@ const isEnd = event => (event.key ? event.key === "End" : event.keyCode === KeyC
153
153
 
154
154
  const isHomeCtrl = event => (event.key ? event.key === "Home" : event.keyCode === KeyCodes.HOME) && checkModifierKeys(event, true, false, false);
155
155
 
156
+ const isHomeShift = event => (event.key ? event.key === "Home" : event.keyCode === KeyCodes.HOME) && checkModifierKeys(event, false, false, true);
157
+
156
158
  const isEndCtrl = event => (event.key ? event.key === "End" : event.keyCode === KeyCodes.END) && checkModifierKeys(event, true, false, false);
157
159
 
160
+ const isEndShift = event => (event.key ? event.key === "End" : event.keyCode === KeyCodes.END) && checkModifierKeys(event, false, false, true);
161
+
158
162
  const isEscape = event => (event.key ? event.key === "Escape" || event.key === "Esc" : event.keyCode === KeyCodes.ESCAPE) && !hasModifierKeys(event);
159
163
 
160
164
  const isTabNext = event => (event.key ? event.key === "Tab" : event.keyCode === KeyCodes.TAB) && !hasModifierKeys(event);
@@ -213,6 +217,8 @@ const isShowByArrows = event => {
213
217
 
214
218
  const isShift = event => event.key === "Shift" || event.keyCode === KeyCodes.SHIFT;
215
219
 
220
+ const isCtrlA = event => ((event.key === "A" || event.key === "a") || event.which === KeyCodes.A) && checkModifierKeys(event, true, false, false);
221
+
216
222
  const hasModifierKeys = event => event.shiftKey || event.altKey || getCtrlKey(event);
217
223
 
218
224
  const getCtrlKey = event => !!(event.metaKey || event.ctrlKey); // double negation doesn't have effect on boolean but ensures null and undefined are equivalent to false.
@@ -248,6 +254,8 @@ export {
248
254
  isMinus,
249
255
  isHomeCtrl,
250
256
  isEndCtrl,
257
+ isHomeShift,
258
+ isEndShift,
251
259
  isEscape,
252
260
  isTabNext,
253
261
  isTabPrevious,
@@ -268,4 +276,5 @@ export {
268
276
  isPageUpShiftCtrl,
269
277
  isPageDownShiftCtrl,
270
278
  isShift,
279
+ isCtrlA,
271
280
  };
@@ -1,6 +1,6 @@
1
1
  import getSharedResource from "../getSharedResource.js";
2
2
  import IconCollectionsAlias from "../assets-meta/IconCollectionsAlias.js";
3
- import { isTheme } from "../config/Theme.js";
3
+ import { isThemeFamily } from "../config/Theme.js";
4
4
 
5
5
  const loaders = new Map();
6
6
  const registry = getSharedResource("SVGIcons.registry", new Map());
@@ -118,7 +118,7 @@ const _getRegisteredNames = async () => {
118
118
  };
119
119
 
120
120
  const _getDefaultCollection = () => {
121
- return isTheme("sap_horizon") ? "SAP-icons-v5" : "SAP-icons";
121
+ return isThemeFamily("sap_horizon") ? "SAP-icons-v5" : "SAP-icons";
122
122
  };
123
123
 
124
124
  const _normalizeCollection = collectionName => {
@@ -13,7 +13,6 @@ const M_ISO639_OLD_TO_NEW = {
13
13
  "iw": "he",
14
14
  "ji": "yi",
15
15
  "in": "id",
16
- "sh": "sr",
17
16
  };
18
17
 
19
18
  const DEV_MODE = false;
@@ -48,6 +47,12 @@ const calcLocale = (language, region, script) => {
48
47
  }
49
48
  }
50
49
 
50
+ // Special case 3: for Serbian, there are cyrillic and latin scripts, "sh" and "sr-latn" map to "latin", "sr" maps to cyrillic.
51
+ if (language === "sh" || (language === "sr" && script === "Latn")) {
52
+ language = "sr";
53
+ region = "Latn";
54
+ }
55
+
51
56
  // try language + region
52
57
  let localeId = `${language}_${region}`;
53
58
  if (SUPPORTED_LOCALES.includes(localeId)) {
@@ -35,8 +35,19 @@ const isTheme = _theme => {
35
35
  return currentTheme === _theme || currentTheme === `${_theme}_exp`;
36
36
  };
37
37
 
38
+ /**
39
+ * Returns if the current theme is part of given theme family
40
+ * @private
41
+ * @param {String} the theme family
42
+ * @returns {boolean}
43
+ */
44
+ const isThemeFamily = _theme => {
45
+ return getTheme().startsWith(_theme);
46
+ };
47
+
38
48
  export {
39
49
  getTheme,
40
50
  setTheme,
41
51
  isTheme,
52
+ isThemeFamily,
42
53
  };
@@ -35,6 +35,36 @@
35
35
  url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
36
36
  }
37
37
 
38
+ @font-face {
39
+ font-family: '72-Bold';
40
+ font-style: normal;
41
+ src: local('72-Bold'),
42
+ url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"),
43
+ url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff");
44
+ }
45
+
46
+ @font-face {
47
+ font-family: '72-Boldfull';
48
+ font-style: normal;
49
+ src: url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2"),
50
+ url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
51
+ }
52
+
53
+ @font-face {
54
+ font-family: '72-Light';
55
+ font-style: normal;
56
+ src: local('72-Light'),
57
+ url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff2?ui5-webcomponents) format("woff2"),
58
+ url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff?ui5-webcomponents) format("woff");
59
+ }
60
+
61
+ @font-face {
62
+ font-family: '72-Lightfull';
63
+ font-style: normal;
64
+ src: url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff2?ui5-webcomponents) format("woff2"),
65
+ url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff?ui5-webcomponents) format("woff");
66
+ }
67
+
38
68
  @font-face {
39
69
  font-family: "72Black";
40
70
  font-style: bold;
@@ -5,18 +5,20 @@ import { attachBoot } from "../Boot.js";
5
5
  let politeSpan;
6
6
  let assertiveSpan;
7
7
 
8
+ const setOutOfViewportStyles = el => {
9
+ el.style.position = "absolute";
10
+ el.style.clip = "rect(1px,1px,1px,1px)";
11
+ el.style.userSelect = "none";
12
+ el.style.left = "-1000px";
13
+ el.style.top = "-1000px";
14
+ el.style.pointerEvents = "none";
15
+ };
16
+
8
17
  attachBoot(() => {
9
18
  if (politeSpan && assertiveSpan) {
10
19
  return;
11
20
  }
12
21
 
13
- const styles = `position: absolute;
14
- clip: rect(1px,1px,1px,1px);
15
- user-select: none;
16
- left: -1000px;
17
- top: -1000px;
18
- pointer-events: none;`;
19
-
20
22
  politeSpan = document.createElement("span");
21
23
  assertiveSpan = document.createElement("span");
22
24
 
@@ -29,8 +31,8 @@ attachBoot(() => {
29
31
  politeSpan.setAttribute("role", "alert");
30
32
  assertiveSpan.setAttribute("role", "alert");
31
33
 
32
- politeSpan.style.cssText = styles;
33
- assertiveSpan.style.cssText = styles;
34
+ setOutOfViewportStyles(politeSpan);
35
+ setOutOfViewportStyles(assertiveSpan);
34
36
 
35
37
  getSingletonElementInstance("ui5-static-area").appendChild(politeSpan);
36
38
  getSingletonElementInstance("ui5-static-area").appendChild(assertiveSpan);
@@ -27,6 +27,10 @@ const getTabbables = (nodes, tabbables) => {
27
27
  currentNode = Array.from(children).find(node => node.tagName !== "STYLE");
28
28
  }
29
29
 
30
+ if (!currentNode) {
31
+ return;
32
+ }
33
+
30
34
  if (isNodeTabbable(currentNode)) {
31
35
  tabbablesNodes.push(currentNode);
32
36
  }