@ui5/webcomponents-base 0.0.0-3790e6927 → 0.0.0-38861c872

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.
Files changed (172) hide show
  1. package/CHANGELOG.md +410 -0
  2. package/README.md +2 -1
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/AssetRegistry.d.ts +2 -2
  5. package/dist/AssetRegistry.js +2 -2
  6. package/dist/AssetRegistry.js.map +1 -1
  7. package/dist/Boot.js +1 -1
  8. package/dist/Boot.js.map +1 -1
  9. package/dist/CustomElementsScope.d.ts +4 -4
  10. package/dist/CustomElementsScope.js +2 -2
  11. package/dist/CustomElementsScope.js.map +1 -1
  12. package/dist/CustomElementsScopeUtils.d.ts +8 -1
  13. package/dist/CustomElementsScopeUtils.js +13 -1
  14. package/dist/CustomElementsScopeUtils.js.map +1 -1
  15. package/dist/Device.d.ts +2 -1
  16. package/dist/Device.js +10 -1
  17. package/dist/Device.js.map +1 -1
  18. package/dist/FontFace.js +1 -1
  19. package/dist/FontFace.js.map +1 -1
  20. package/dist/InitialConfiguration.d.ts +2 -1
  21. package/dist/InitialConfiguration.js +7 -2
  22. package/dist/InitialConfiguration.js.map +1 -1
  23. package/dist/Keys.d.ts +5 -1
  24. package/dist/Keys.js +109 -106
  25. package/dist/Keys.js.map +1 -1
  26. package/dist/ManagedStyles.d.ts +5 -4
  27. package/dist/ManagedStyles.js +92 -23
  28. package/dist/ManagedStyles.js.map +1 -1
  29. package/dist/MediaRange.d.ts +0 -6
  30. package/dist/MediaRange.js +5 -15
  31. package/dist/MediaRange.js.map +1 -1
  32. package/dist/StaticAreaItem.d.ts +3 -4
  33. package/dist/StaticAreaItem.js +9 -11
  34. package/dist/StaticAreaItem.js.map +1 -1
  35. package/dist/UI5Element.d.ts +28 -25
  36. package/dist/UI5Element.js +40 -35
  37. package/dist/UI5Element.js.map +1 -1
  38. package/dist/UI5ElementMetadata.d.ts +4 -11
  39. package/dist/UI5ElementMetadata.js +3 -11
  40. package/dist/UI5ElementMetadata.js.map +1 -1
  41. package/dist/asset-registries/Icons.d.ts +4 -3
  42. package/dist/asset-registries/Icons.js +28 -17
  43. package/dist/asset-registries/Icons.js.map +1 -1
  44. package/dist/asset-registries/Illustrations.d.ts +1 -0
  45. package/dist/asset-registries/Illustrations.js +50 -20
  46. package/dist/asset-registries/Illustrations.js.map +1 -1
  47. package/dist/asset-registries/Themes.d.ts +4 -3
  48. package/dist/asset-registries/Themes.js +26 -10
  49. package/dist/asset-registries/Themes.js.map +1 -1
  50. package/dist/asset-registries/i18n.js +2 -1
  51. package/dist/asset-registries/i18n.js.map +1 -1
  52. package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.d.ts +1 -2
  53. package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.js +1 -2
  54. package/dist/asset-registries/util/IconCollectionsAlias.js.map +1 -0
  55. package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +20 -0
  56. package/dist/asset-registries/util/IconCollectionsByTheme.js +42 -0
  57. package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -0
  58. package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +13 -0
  59. package/dist/asset-registries/util/getIconCollectionByTheme.js +29 -0
  60. package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -0
  61. package/dist/config/CalendarType.d.ts +8 -1
  62. package/dist/config/CalendarType.js +18 -2
  63. package/dist/config/CalendarType.js.map +1 -1
  64. package/dist/config/Icons.d.ts +2 -17
  65. package/dist/config/Icons.js +1 -60
  66. package/dist/config/Icons.js.map +1 -1
  67. package/dist/connectToComponent.d.ts +9 -0
  68. package/dist/connectToComponent.js +59 -0
  69. package/dist/connectToComponent.js.map +1 -0
  70. package/dist/css/FontFace.css +47 -17
  71. package/dist/custom-elements-internal.json +5154 -0
  72. package/dist/custom-elements.json +4917 -0
  73. package/dist/decorators/customElement.d.ts +1 -1
  74. package/dist/decorators/customElement.js +1 -1
  75. package/dist/decorators/customElement.js.map +1 -1
  76. package/dist/delegate/ItemNavigation.d.ts +1 -0
  77. package/dist/delegate/ItemNavigation.js +4 -5
  78. package/dist/delegate/ItemNavigation.js.map +1 -1
  79. package/dist/delegate/ResizeHandler.d.ts +4 -6
  80. package/dist/delegate/ResizeHandler.js +4 -6
  81. package/dist/delegate/ResizeHandler.js.map +1 -1
  82. package/dist/delegate/ScrollEnablement.js +2 -2
  83. package/dist/delegate/ScrollEnablement.js.map +1 -1
  84. package/dist/features/OpenUI5Enablement.d.ts +1 -1
  85. package/dist/features/OpenUI5Support.d.ts +13 -3
  86. package/dist/features/OpenUI5Support.js +89 -33
  87. package/dist/features/OpenUI5Support.js.map +1 -1
  88. package/dist/generated/AssetParameters.d.ts +6 -0
  89. package/dist/generated/AssetParameters.js +3 -10
  90. package/dist/generated/AssetParameters.js.map +1 -0
  91. package/dist/generated/VersionInfo.d.ts +10 -0
  92. package/dist/generated/VersionInfo.js +9 -8
  93. package/dist/generated/VersionInfo.js.map +1 -0
  94. package/dist/generated/css/FontFace.css.js +1 -1
  95. package/dist/generated/css/FontFace.css.js.map +1 -1
  96. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +1 -1
  97. package/dist/i18nBundle.d.ts +2 -4
  98. package/dist/i18nBundle.js +1 -4
  99. package/dist/i18nBundle.js.map +1 -1
  100. package/dist/renderer/LitRenderer.d.ts +2 -2
  101. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +111 -96
  102. package/dist/theming/applyTheme.js +5 -5
  103. package/dist/theming/applyTheme.js.map +1 -1
  104. package/dist/types/AnimationMode.d.ts +0 -8
  105. package/dist/types/AnimationMode.js +0 -8
  106. package/dist/types/AnimationMode.js.map +1 -1
  107. package/dist/types/CSSColor.d.ts +0 -4
  108. package/dist/types/CSSColor.js +0 -4
  109. package/dist/types/CSSColor.js.map +1 -1
  110. package/dist/types/CSSSize.d.ts +11 -0
  111. package/dist/types/CSSSize.js +14 -0
  112. package/dist/types/CSSSize.js.map +1 -0
  113. package/dist/types/CalendarType.d.ts +0 -9
  114. package/dist/types/CalendarType.js +0 -9
  115. package/dist/types/CalendarType.js.map +1 -1
  116. package/dist/types/DOMReference.d.ts +0 -4
  117. package/dist/types/DOMReference.js +0 -4
  118. package/dist/types/DOMReference.js.map +1 -1
  119. package/dist/types/DataType.d.ts +1 -6
  120. package/dist/types/DataType.js +1 -6
  121. package/dist/types/DataType.js.map +1 -1
  122. package/dist/types/Float.d.ts +0 -3
  123. package/dist/types/Float.js +0 -3
  124. package/dist/types/Float.js.map +1 -1
  125. package/dist/types/Integer.d.ts +0 -3
  126. package/dist/types/Integer.js +0 -3
  127. package/dist/types/Integer.js.map +1 -1
  128. package/dist/types/InvisibleMessageMode.d.ts +5 -10
  129. package/dist/types/InvisibleMessageMode.js +4 -11
  130. package/dist/types/InvisibleMessageMode.js.map +1 -1
  131. package/dist/types/ItemNavigationBehavior.d.ts +0 -6
  132. package/dist/types/ItemNavigationBehavior.js +0 -6
  133. package/dist/types/ItemNavigationBehavior.js.map +1 -1
  134. package/dist/types/NavigationMode.d.ts +0 -8
  135. package/dist/types/NavigationMode.js +0 -8
  136. package/dist/types/NavigationMode.js.map +1 -1
  137. package/dist/types/ValueState.d.ts +0 -14
  138. package/dist/types/ValueState.js +0 -14
  139. package/dist/types/ValueState.js.map +1 -1
  140. package/dist/updateShadowRoot.js +2 -1
  141. package/dist/updateShadowRoot.js.map +1 -1
  142. package/dist/util/ColorConversion.js +200 -195
  143. package/dist/util/ColorConversion.js.map +1 -1
  144. package/dist/util/InvisibleMessage.d.ts +1 -1
  145. package/dist/util/InvisibleMessage.js.map +1 -1
  146. package/dist/util/PopupUtils.js +1 -1
  147. package/dist/util/PopupUtils.js.map +1 -1
  148. package/dist/util/detectNavigatorLanguage.d.ts +2 -2
  149. package/dist/util/detectNavigatorLanguage.js +2 -1
  150. package/dist/util/detectNavigatorLanguage.js.map +1 -1
  151. package/dist/util/getClassCopy.d.ts +49 -33
  152. package/dist/util/getDesigntimePropertyAsArray.d.ts +2 -2
  153. package/dist/util/getDesigntimePropertyAsArray.js +2 -1
  154. package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
  155. package/dist/util/getParentElement.d.ts +2 -0
  156. package/dist/util/getParentElement.js +5 -0
  157. package/dist/util/getParentElement.js.map +1 -0
  158. package/dist/util/isElementContainingBlock.d.ts +2 -0
  159. package/dist/util/isElementContainingBlock.js +11 -0
  160. package/dist/util/isElementContainingBlock.js.map +1 -0
  161. package/index.js +3 -3
  162. package/lib/generate-asset-parameters/index.js +2 -2
  163. package/lib/generate-version-info/index.js +2 -2
  164. package/package-scripts.cjs +9 -13
  165. package/package.json +8 -5
  166. package/src/css/FontFace.css +47 -17
  167. package/tsconfig.json +4 -0
  168. package/dist/api.json +0 -1
  169. package/dist/assets/Boot.34b7cea0.css +0 -1
  170. package/dist/assets/Boot.c42af4c1.js +0 -9
  171. package/dist/assets/bundle.esm.5317b298.js +0 -50
  172. package/dist/assets-meta/IconCollectionsAlias.js.map +0 -1
@@ -1,70 +1,122 @@
1
1
  import createStyleInHead from "./util/createStyleInHead.js";
2
2
  import createLinkInHead from "./util/createLinkInHead.js";
3
3
  import { shouldUseLinks, getUrl } from "./CSP.js";
4
- import { getCurrentRuntimeIndex } from "./Runtimes.js";
4
+ import { isSafari } from "./Device.js";
5
+ import { getCurrentRuntimeIndex, compareRuntimes } from "./Runtimes.js";
5
6
  const getStyleId = (name, value) => {
6
7
  return value ? `${name}|${value}` : name;
7
8
  };
8
- const createStyle = (data, name, value = "") => {
9
- let content = typeof data === "string" ? data : data.content;
10
- if (content.includes("[_ui5host]")) {
11
- content = content.replaceAll("[_ui5host]", `[_ui5rt${getCurrentRuntimeIndex()}]`);
9
+ const shouldUpdate = (runtimeIndex) => {
10
+ if (runtimeIndex === undefined) {
11
+ return true;
12
12
  }
13
+ return compareRuntimes(getCurrentRuntimeIndex(), parseInt(runtimeIndex)) === 1; // 1 means the current is newer, 0 means the same, -1 means the resource's runtime is newer
14
+ };
15
+ const createStyle = (data, name, value = "", theme) => {
16
+ const content = typeof data === "string" ? data : data.content;
17
+ const currentRuntimeIndex = getCurrentRuntimeIndex();
13
18
  if (shouldUseLinks()) {
14
19
  const attributes = {};
15
20
  attributes[name] = value;
21
+ if (theme) {
22
+ attributes["data-ui5-runtime-index"] = currentRuntimeIndex;
23
+ attributes["data-ui5-theme"] = theme;
24
+ }
16
25
  const href = getUrl(data.packageName, data.fileName);
17
26
  createLinkInHead(href, attributes);
18
27
  }
19
- else if (document.adoptedStyleSheets) {
28
+ else if (document.adoptedStyleSheets && !isSafari()) {
20
29
  const stylesheet = new CSSStyleSheet();
21
30
  stylesheet.replaceSync(content);
22
31
  stylesheet._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later
32
+ if (theme) {
33
+ stylesheet._ui5RuntimeIndex = currentRuntimeIndex;
34
+ stylesheet._ui5Theme = theme;
35
+ }
23
36
  document.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];
24
37
  }
25
38
  else {
26
39
  const attributes = {};
27
40
  attributes[name] = value;
41
+ if (theme) {
42
+ attributes["data-ui5-runtime-index"] = currentRuntimeIndex;
43
+ attributes["data-ui5-theme"] = theme;
44
+ }
28
45
  createStyleInHead(content, attributes);
29
46
  }
30
47
  };
31
- const updateStyle = (data, name, value = "") => {
32
- let content = typeof data === "string" ? data : data.content;
33
- if (content.includes("[_ui5host]")) {
34
- content = content.replaceAll("[_ui5host]", `[_ui5rt${getCurrentRuntimeIndex()}]`);
35
- }
48
+ const updateStyle = (data, name, value = "", theme) => {
49
+ const content = typeof data === "string" ? data : data.content;
50
+ const currentRuntimeIndex = getCurrentRuntimeIndex();
36
51
  if (shouldUseLinks()) {
37
52
  const link = document.querySelector(`head>link[${name}="${value}"]`);
38
- link.href = getUrl(data.packageName, data.fileName);
53
+ const href = getUrl(data.packageName, data.fileName);
54
+ if (!theme) {
55
+ link.href = href;
56
+ }
57
+ else {
58
+ const linkRuntimeIndex = link.getAttribute("data-ui5-runtime-index") || undefined;
59
+ const linkTheme = link.getAttribute("data-ui5-theme");
60
+ if (linkTheme !== theme || shouldUpdate(linkRuntimeIndex)) {
61
+ link.href = href;
62
+ link.setAttribute("data-ui5-runtime-index", String(currentRuntimeIndex));
63
+ link.setAttribute("data-ui5-theme", theme);
64
+ }
65
+ }
39
66
  }
40
- else if (document.adoptedStyleSheets) {
67
+ else if (document.adoptedStyleSheets && !isSafari()) {
41
68
  const stylesheet = document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value));
42
- if (stylesheet) {
69
+ if (!stylesheet) {
70
+ return;
71
+ }
72
+ if (!theme) {
43
73
  stylesheet.replaceSync(content || "");
44
74
  }
75
+ else {
76
+ const stylesheetRuntimeIndex = stylesheet._ui5RuntimeIndex;
77
+ const stylesheetTheme = stylesheet._ui5Theme;
78
+ if (stylesheetTheme !== theme || shouldUpdate(stylesheetRuntimeIndex)) {
79
+ stylesheet.replaceSync(content || "");
80
+ stylesheet._ui5RuntimeIndex = String(currentRuntimeIndex);
81
+ stylesheet._ui5Theme = theme;
82
+ }
83
+ }
45
84
  }
46
85
  else {
47
86
  const style = document.querySelector(`head>style[${name}="${value}"]`);
48
- if (style) {
87
+ if (!style) {
88
+ return;
89
+ }
90
+ if (!theme) {
49
91
  style.textContent = content || "";
50
92
  }
93
+ else {
94
+ const styleRuntimeIndex = style.getAttribute("data-ui5-runtime-index") || undefined;
95
+ const styleTheme = style.getAttribute("data-ui5-theme");
96
+ if (styleTheme !== theme || shouldUpdate(styleRuntimeIndex)) {
97
+ style.textContent = content || "";
98
+ style.setAttribute("data-ui5-runtime-index", String(currentRuntimeIndex));
99
+ style.setAttribute("data-ui5-theme", theme);
100
+ }
101
+ }
51
102
  }
52
103
  };
53
104
  const hasStyle = (name, value = "") => {
54
105
  if (shouldUseLinks()) {
55
106
  return !!document.querySelector(`head>link[${name}="${value}"]`);
56
107
  }
57
- if (document.adoptedStyleSheets) {
58
- return !!document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value));
108
+ const styleElement = document.querySelector(`head>style[${name}="${value}"]`);
109
+ if (document.adoptedStyleSheets && !isSafari()) {
110
+ return !!styleElement || !!document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value));
59
111
  }
60
- return !!document.querySelector(`head>style[${name}="${value}"]`);
112
+ return !!styleElement;
61
113
  };
62
114
  const removeStyle = (name, value = "") => {
63
115
  if (shouldUseLinks()) {
64
116
  const linkElement = document.querySelector(`head>link[${name}="${value}"]`);
65
117
  linkElement?.parentElement?.removeChild(linkElement);
66
118
  }
67
- else if (document.adoptedStyleSheets) {
119
+ else if (document.adoptedStyleSheets && !isSafari()) {
68
120
  document.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => sh._ui5StyleId !== getStyleId(name, value));
69
121
  }
70
122
  else {
@@ -72,13 +124,30 @@ const removeStyle = (name, value = "") => {
72
124
  styleElement?.parentElement?.removeChild(styleElement);
73
125
  }
74
126
  };
75
- const createOrUpdateStyle = (data, name, value = "") => {
127
+ const createOrUpdateStyle = (data, name, value = "", theme) => {
76
128
  if (hasStyle(name, value)) {
77
- updateStyle(data, name, value);
129
+ updateStyle(data, name, value, theme);
78
130
  }
79
131
  else {
80
- createStyle(data, name, value);
132
+ createStyle(data, name, value, theme);
133
+ }
134
+ };
135
+ const mergeStyles = (style1, style2) => {
136
+ if (style1 === undefined) {
137
+ return style2;
138
+ }
139
+ if (style2 === undefined) {
140
+ return style1;
141
+ }
142
+ const style2Content = typeof style2 === "string" ? style2 : style2.content;
143
+ if (typeof style1 === "string") {
144
+ return `${style1} ${style2Content}`;
81
145
  }
146
+ return {
147
+ content: `${style1.content} ${style2Content}`,
148
+ packageName: style1.packageName,
149
+ fileName: style1.fileName,
150
+ };
82
151
  };
83
- export { createStyle, hasStyle, updateStyle, removeStyle, createOrUpdateStyle, };
152
+ export { createStyle, hasStyle, updateStyle, removeStyle, createOrUpdateStyle, mergeStyles, };
84
153
  //# sourceMappingURL=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AAC,aAAa,CAAC,gBAAgB,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC;QAChF,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;KACvD;AACF,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAe,EAAE,IAAY,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE;IACzE,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;QAC1B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;KAC/B;SAAM;QACN,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;KAC/B;AACF,CAAC,CAAC;AAEF,OAAO,EACN,WAAW,EACX,QAAQ,EACR,WAAW,EACX,WAAW,EACX,mBAAmB,GACnB,CAAC","sourcesContent":["import createStyleInHead from \"./util/createStyleInHead.js\";\nimport createLinkInHead from \"./util/createLinkInHead.js\";\nimport { shouldUseLinks, getUrl } from \"./CSP.js\";\nimport { StyleData, StyleDataCSP } from \"./types.js\";\nimport { getCurrentRuntimeIndex } from \"./Runtimes.js\";\n\nconst getStyleId = (name: string, value: string) => {\n\treturn value ? `${name}|${value}` : name;\n};\n\nconst createStyle = (data: StyleData, name: string, value = \"\") => {\n\tlet content = typeof data === \"string\" ? data : data.content;\n\n\tif (content.includes(\"[_ui5host]\")) {\n\t\tcontent = content.replaceAll(\"[_ui5host]\", `[_ui5rt${getCurrentRuntimeIndex()}]`);\n\t}\n\n\tif (shouldUseLinks()) {\n\t\tconst attributes = {} as Record<string, any>;\n\t\tattributes[name] = value;\n\t\tconst href = getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName);\n\t\tcreateLinkInHead(href, attributes);\n\t} else if (document.adoptedStyleSheets) {\n\t\tconst stylesheet = new CSSStyleSheet();\n\t\tstylesheet.replaceSync(content);\n\t\t(stylesheet as Record<string, any>)._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later\n\t\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n\t} else {\n\t\tconst attributes = {} as Record<string, any>;\n\t\tattributes[name] = value;\n\t\tcreateStyleInHead(content, attributes);\n\t}\n};\n\nconst updateStyle = (data: StyleData, name: string, value = \"\") => {\n\tlet content = typeof data === \"string\" ? data : data.content;\n\n\tif (content.includes(\"[_ui5host]\")) {\n\t\tcontent = content.replaceAll(\"[_ui5host]\", `[_ui5rt${getCurrentRuntimeIndex()}]`);\n\t}\n\n\tif (shouldUseLinks()) {\n\t\tconst link = document.querySelector(`head>link[${name}=\"${value}\"]`) as HTMLLinkElement;\n\t\tlink.href = getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName);\n\t} else if (document.adoptedStyleSheets) {\n\t\tconst stylesheet = document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\t\tif (stylesheet) {\n\t\t\tstylesheet.replaceSync(content || \"\");\n\t\t}\n\t} else {\n\t\tconst style = document.querySelector(`head>style[${name}=\"${value}\"]`);\n\t\tif (style) {\n\t\t\tstyle.textContent = content || \"\";\n\t\t}\n\t}\n};\n\nconst hasStyle = (name: string, value = \"\") => {\n\tif (shouldUseLinks()) {\n\t\treturn !!document.querySelector(`head>link[${name}=\"${value}\"]`);\n\t}\n\n\tif (document.adoptedStyleSheets) {\n\t\treturn !!document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\t}\n\n\treturn !!document.querySelector(`head>style[${name}=\"${value}\"]`);\n};\n\nconst removeStyle = (name: string, value = \"\") => {\n\tif (shouldUseLinks()) {\n\t\tconst linkElement = document.querySelector(`head>link[${name}=\"${value}\"]`);\n\t\tlinkElement?.parentElement?.removeChild(linkElement);\n\t} else if (document.adoptedStyleSheets) {\n\t\tdocument.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => (sh as Record<string, any>)._ui5StyleId !== getStyleId(name, value));\n\t} else {\n\t\tconst styleElement = document.querySelector(`head > style[${name}=\"${value}\"]`);\n\t\tstyleElement?.parentElement?.removeChild(styleElement);\n\t}\n};\n\nconst createOrUpdateStyle = (data: StyleData, name: string, value = \"\") => {\n\tif (hasStyle(name, value)) {\n\t\tupdateStyle(data, name, value);\n\t} else {\n\t\tcreateStyle(data, name, value);\n\t}\n};\n\nexport {\n\tcreateStyle,\n\thasStyle,\n\tupdateStyle,\n\tremoveStyle,\n\tcreateOrUpdateStyle,\n};\n\nexport type {\n\tStyleData,\n\tStyleDataCSP,\n};\n"]}
1
+ {"version":3,"file":"ManagedStyles.js","sourceRoot":"","sources":["../src/ManagedStyles.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE;IAClD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,YAAgC,EAAE,EAAE;IACzD,IAAI,YAAY,KAAK,SAAS,EAAE;QAC/B,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,eAAe,CAAC,sBAAsB,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,2FAA2F;AAC5K,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAe,EAAE,IAAY,EAAE,KAAK,GAAG,EAAE,EAAE,KAAc,EAAE,EAAE;IACjF,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,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AAE,aAAa,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;KACvD;AACF,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAe,EAAE,IAAY,EAAE,KAAK,GAAG,EAAE,EAAE,KAAc,EAAE,EAAE;IACzF,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;QAC1B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACtC;SAAM;QACN,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACtC;AACF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAE,MAAkB,EAAE,EAAE;IAC9D,IAAI,MAAM,KAAK,SAAS,EAAE;QACzB,OAAO,MAAM,CAAC;KACd;IACD,IAAI,MAAM,KAAK,SAAS,EAAE;QACzB,OAAO,MAAM,CAAC;KACd;IACD,MAAM,aAAa,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IAC3E,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC/B,OAAO,GAAG,MAAM,IAAI,aAAa,EAAE,CAAC;KACpC;IACD,OAAO;QACN,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,IAAI,aAAa,EAAE;QAC7C,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;KACzB,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,EACN,WAAW,EACX,QAAQ,EACR,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,GACX,CAAC","sourcesContent":["import createStyleInHead from \"./util/createStyleInHead.js\";\nimport createLinkInHead from \"./util/createLinkInHead.js\";\nimport { shouldUseLinks, getUrl } from \"./CSP.js\";\nimport { StyleData, StyleDataCSP } from \"./types.js\";\nimport { isSafari } from \"./Device.js\";\nimport { getCurrentRuntimeIndex, compareRuntimes } from \"./Runtimes.js\";\n\nconst getStyleId = (name: string, value: string) => {\n\treturn value ? `${name}|${value}` : name;\n};\n\nconst shouldUpdate = (runtimeIndex: string | undefined) => {\n\tif (runtimeIndex === undefined) {\n\t\treturn true;\n\t}\n\treturn compareRuntimes(getCurrentRuntimeIndex(), parseInt(runtimeIndex)) === 1; // 1 means the current is newer, 0 means the same, -1 means the resource's runtime is newer\n};\n\nconst createStyle = (data: StyleData, name: string, value = \"\", theme?: string) => {\n\tconst content = typeof data === \"string\" ? data : data.content;\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\n\tif (shouldUseLinks()) {\n\t\tconst attributes = {} as Record<string, any>;\n\t\tattributes[name] = value;\n\t\tif (theme) {\n\t\t\tattributes[\"data-ui5-runtime-index\"] = currentRuntimeIndex;\n\t\t\tattributes[\"data-ui5-theme\"] = theme;\n\t\t}\n\t\tconst href = getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName);\n\t\tcreateLinkInHead(href, attributes);\n\t} else if (document.adoptedStyleSheets && !isSafari()) {\n\t\tconst stylesheet = new CSSStyleSheet();\n\t\tstylesheet.replaceSync(content);\n\t\t(stylesheet as Record<string, any>)._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later\n\t\tif (theme) {\n\t\t\t(stylesheet as Record<string, any>)._ui5RuntimeIndex = currentRuntimeIndex;\n\t\t\t(stylesheet as Record<string, any>)._ui5Theme = theme;\n\t\t}\n\t\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n\t} else {\n\t\tconst attributes = {} as Record<string, any>;\n\t\tattributes[name] = value;\n\t\tif (theme) {\n\t\t\tattributes[\"data-ui5-runtime-index\"] = currentRuntimeIndex;\n\t\t\tattributes[\"data-ui5-theme\"] = theme;\n\t\t}\n\t\tcreateStyleInHead(content, attributes);\n\t}\n};\n\nconst updateStyle = (data: StyleData, name: string, value = \"\", theme?: string) => {\n\tconst content = typeof data === \"string\" ? data : data.content;\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\n\tif (shouldUseLinks()) {\n\t\tconst link = document.querySelector(`head>link[${name}=\"${value}\"]`) as HTMLLinkElement;\n\t\tconst href = getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName);\n\n\t\tif (!theme) {\n\t\t\tlink.href = href;\n\t\t} else {\n\t\t\tconst linkRuntimeIndex = link.getAttribute(\"data-ui5-runtime-index\") || undefined;\n\t\t\tconst linkTheme = link.getAttribute(\"data-ui5-theme\");\n\t\t\tif (linkTheme !== theme || shouldUpdate(linkRuntimeIndex)) {\n\t\t\t\tlink.href = href;\n\t\t\t\tlink.setAttribute(\"data-ui5-runtime-index\", String(currentRuntimeIndex));\n\t\t\t\tlink.setAttribute(\"data-ui5-theme\", theme);\n\t\t\t}\n\t\t}\n\t} else if (document.adoptedStyleSheets && !isSafari()) {\n\t\tconst stylesheet = document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\t\tif (!stylesheet) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!theme) {\n\t\t\tstylesheet.replaceSync(content || \"\");\n\t\t} else {\n\t\t\tconst stylesheetRuntimeIndex: string | undefined = (stylesheet as Record<string, any>)._ui5RuntimeIndex;\n\t\t\tconst stylesheetTheme: string | undefined = (stylesheet as Record<string, any>)._ui5Theme;\n\t\t\tif (stylesheetTheme !== theme || shouldUpdate(stylesheetRuntimeIndex)) {\n\t\t\t\tstylesheet.replaceSync(content || \"\");\n\t\t\t\t(stylesheet as Record<string, any>)._ui5RuntimeIndex = String(currentRuntimeIndex);\n\t\t\t\t(stylesheet as Record<string, any>)._ui5Theme = theme;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst style = document.querySelector(`head>style[${name}=\"${value}\"]`);\n\t\tif (!style) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!theme) {\n\t\t\tstyle.textContent = content || \"\";\n\t\t} else {\n\t\t\tconst styleRuntimeIndex = style.getAttribute(\"data-ui5-runtime-index\") || undefined;\n\t\t\tconst styleTheme = style.getAttribute(\"data-ui5-theme\");\n\t\t\tif (styleTheme !== theme || shouldUpdate(styleRuntimeIndex)) {\n\t\t\t\tstyle.textContent = content || \"\";\n\t\t\t\tstyle.setAttribute(\"data-ui5-runtime-index\", String(currentRuntimeIndex));\n\t\t\t\tstyle.setAttribute(\"data-ui5-theme\", theme);\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst hasStyle = (name: string, value = \"\"): boolean => {\n\tif (shouldUseLinks()) {\n\t\treturn !!document.querySelector(`head>link[${name}=\"${value}\"]`);\n\t}\n\n\tconst styleElement = document.querySelector(`head>style[${name}=\"${value}\"]`);\n\n\tif (document.adoptedStyleSheets && !isSafari()) {\n\t\treturn !!styleElement || !!document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\t}\n\n\treturn !!styleElement;\n};\n\nconst removeStyle = (name: string, value = \"\") => {\n\tif (shouldUseLinks()) {\n\t\tconst linkElement = document.querySelector(`head>link[${name}=\"${value}\"]`);\n\t\tlinkElement?.parentElement?.removeChild(linkElement);\n\t} else if (document.adoptedStyleSheets && !isSafari()) {\n\t\tdocument.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => (sh as Record<string, any>)._ui5StyleId !== getStyleId(name, value));\n\t} else {\n\t\tconst styleElement = document.querySelector(`head > style[${name}=\"${value}\"]`);\n\t\tstyleElement?.parentElement?.removeChild(styleElement);\n\t}\n};\n\nconst createOrUpdateStyle = (data: StyleData, name: string, value = \"\", theme?: string) => {\n\tif (hasStyle(name, value)) {\n\t\tupdateStyle(data, name, value, theme);\n\t} else {\n\t\tcreateStyle(data, name, value, theme);\n\t}\n};\n\nconst mergeStyles = (style1?: StyleData, style2?: StyleData) => {\n\tif (style1 === undefined) {\n\t\treturn style2;\n\t}\n\tif (style2 === undefined) {\n\t\treturn style1;\n\t}\n\tconst style2Content = typeof style2 === \"string\" ? style2 : style2.content;\n\tif (typeof style1 === \"string\") {\n\t\treturn `${style1} ${style2Content}`;\n\t}\n\treturn {\n\t\tcontent: `${style1.content} ${style2Content}`,\n\t\tpackageName: style1.packageName,\n\t\tfileName: style1.fileName,\n\t};\n};\n\nexport {\n\tcreateStyle,\n\thasStyle,\n\tupdateStyle,\n\tremoveStyle,\n\tcreateOrUpdateStyle,\n\tmergeStyles,\n};\n\nexport type {\n\tStyleData,\n\tStyleDataCSP,\n};\n"]}
@@ -2,8 +2,6 @@ type Range = Map<string, Array<number>>;
2
2
  /**
3
3
  * Enumeration containing the names and settings of predefined screen width media query range sets.
4
4
  *
5
- * @namespace
6
- * @name MediaRange.RANGESETS
7
5
  * @public
8
6
  */
9
7
  declare enum RANGESETS {
@@ -18,16 +16,12 @@ declare enum RANGESETS {
18
16
  * <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
19
17
  * </ul>
20
18
  *
21
- * @name MediaRange.RANGESETS.RANGE_4STEPS
22
19
  * @public
23
20
  */
24
21
  RANGE_4STEPS = "4Step"
25
22
  }
26
23
  /**
27
24
  * API for screen width changes.
28
- *
29
- * @namespace
30
- * @name MediaRange
31
25
  */
32
26
  declare const MediaRange: {
33
27
  RANGESETS: typeof RANGESETS;
@@ -7,8 +7,6 @@ DEAFULT_RANGE_SET.set("XL", [1440, Infinity]);
7
7
  /**
8
8
  * Enumeration containing the names and settings of predefined screen width media query range sets.
9
9
  *
10
- * @namespace
11
- * @name MediaRange.RANGESETS
12
10
  * @public
13
11
  */
14
12
  var RANGESETS;
@@ -24,7 +22,6 @@ var RANGESETS;
24
22
  * <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
25
23
  * </ul>
26
24
  *
27
- * @name MediaRange.RANGESETS.RANGE_4STEPS
28
25
  * @public
29
26
  */
30
27
  RANGESETS["RANGE_4STEPS"] = "4Step";
@@ -45,10 +42,9 @@ var RANGESETS;
45
42
  * <li><code>"Large"</code>: For screens greater than or equal to 400 pixels.</li>
46
43
  * </ul>
47
44
  *
48
- * @param {string} name The name of the range set to be initialized.
45
+ * @param name The name of the range set to be initialized.
49
46
  * The name must be a valid id and consist only of letters and numeric digits.
50
- * @param {Range} [range] The given range set.
51
- * @name MediaRange.initRangeSet
47
+ * @param range The given range set.
52
48
  */
53
49
  const initRangeSet = (name, range) => {
54
50
  mediaRanges.set(name, range);
@@ -59,13 +55,10 @@ const initRangeSet = (name, range) => {
59
55
  * If the optional parameter <code>width</code> is given, the active range will be determined for that width,
60
56
  * otherwise it is determined for the current window size.
61
57
  *
62
- * @param {string} name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
63
- * @param {number} [width] An optional width, based on which the range should be determined;
58
+ * @param name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
59
+ * @param [width] An optional width, based on which the range should be determined;
64
60
  * If <code>width</code> is not provided, the window size will be used.
65
- * @returns {string} The name of the current active interval of the range set.
66
- *
67
- * @name MediaRange.getCurrentRange
68
- * @function
61
+ * @returns The name of the current active interval of the range set.
69
62
  * @public
70
63
  */
71
64
  const getCurrentRange = (name, width = window.innerWidth) => {
@@ -84,9 +77,6 @@ const getCurrentRange = (name, width = window.innerWidth) => {
84
77
  };
85
78
  /**
86
79
  * API for screen width changes.
87
- *
88
- * @namespace
89
- * @name MediaRange
90
80
  */
91
81
  const MediaRange = {
92
82
  RANGESETS,
@@ -1 +1 @@
1
- {"version":3,"file":"MediaRange.js","sourceRoot":"","sources":["../src/MediaRange.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAiB,CAAC;AAE7C,MAAM,iBAAiB,GAAU,IAAI,GAAG,EAAyB,CAAC;AAClE,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACrC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAA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;AAEH,MAAM,UAAU,GAAG;IAClB,SAAS;IACT,YAAY;IACZ,eAAe;CACf,CAAC;AAEF,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAE9E,eAAe,UAAU,CAAC","sourcesContent":["type Range = Map<string, Array<number>>;\n\nconst mediaRanges = new Map<string, Range>();\n\nconst DEAFULT_RANGE_SET: Range = new Map<string, Array<number>>();\nDEAFULT_RANGE_SET.set(\"S\", [0, 599]);\nDEAFULT_RANGE_SET.set(\"M\", [600, 1023]);\nDEAFULT_RANGE_SET.set(\"L\", [1024, 1439]);\nDEAFULT_RANGE_SET.set(\"XL\", [1440, Infinity]);\n\n/**\n * Enumeration containing the names and settings of predefined screen width media query range sets.\n *\n * @namespace\n * @name MediaRange.RANGESETS\n * @public\n */\n enum RANGESETS {\n\t/**\n\t * A 4-step range set (S-M-L-XL).\n\t *\n\t * The ranges of this set are:\n\t * <ul>\n\t * <li><code>\"S\"</code>: For screens smaller than 600 pixels.</li>\n\t * <li><code>\"M\"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>\n\t * <li><code>\"L\"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>\n\t * <li><code>\"XL\"</code>: For screens greater than or equal to 1440 pixels.</li>\n\t * </ul>\n\t *\n\t * @name MediaRange.RANGESETS.RANGE_4STEPS\n\t * @public\n\t */\n\tRANGE_4STEPS = \"4Step\",\n}\n\n/**\n * Initializes a screen width media query range set.\n *\n * This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.\n *\n * A range set can be defined as shown in the following example:\n * <pre>\n * MediaRange.initRangeSet(\"MyRangeSet\", [200, 400], [\"Small\", \"Medium\", \"Large\"]);\n * </pre>\n * This example defines the following named ranges:\n * <ul>\n * <li><code>\"Small\"</code>: For screens smaller than 200 pixels.</li>\n * <li><code>\"Medium\"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>\n * <li><code>\"Large\"</code>: For screens greater than or equal to 400 pixels.</li>\n * </ul>\n *\n * @param {string} name The name of the range set to be initialized.\n * The name must be a valid id and consist only of letters and numeric digits.\n * @param {Range} [range] The given range set.\n * @name MediaRange.initRangeSet\n */\nconst initRangeSet = (name: string, range: Range) => {\n\tmediaRanges.set(name, range);\n};\n\n/**\n * Returns information about the current active range of the range set with the given name.\n *\n * If the optional parameter <code>width</code> is given, the active range will be determined for that width,\n * otherwise it is determined for the current window size.\n *\n * @param {string} name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})\n * @param {number} [width] An optional width, based on which the range should be determined;\n * If <code>width</code> is not provided, the window size will be used.\n * @returns {string} The name of the current active interval of the range set.\n *\n * @name MediaRange.getCurrentRange\n * @function\n * @public\n */\nconst getCurrentRange = (name: string, width = window.innerWidth): string => {\n\tlet rangeSet = mediaRanges.get(name);\n\n\tif (!rangeSet) {\n\t\trangeSet = mediaRanges.get(RANGESETS.RANGE_4STEPS)!;\n\t}\n\n\tlet currentRangeName;\n\tconst effectiveWidth = Math.floor(width);\n\n\trangeSet.forEach((value, key) => {\n\t\tif (effectiveWidth >= value[0] && effectiveWidth <= value[1]) {\n\t\t\tcurrentRangeName = key;\n\t\t}\n\t});\n\n\treturn currentRangeName || [...rangeSet.keys()][0];\n};\n\n/**\n * API for screen width changes.\n *\n * @namespace\n * @name MediaRange\n */\n\nconst MediaRange = {\n\tRANGESETS,\n\tinitRangeSet,\n\tgetCurrentRange,\n};\n\nMediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, DEAFULT_RANGE_SET);\n\nexport default MediaRange;\n"]}
1
+ {"version":3,"file":"MediaRange.js","sourceRoot":"","sources":["../src/MediaRange.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAiB,CAAC;AAE7C,MAAM,iBAAiB,GAAU,IAAI,GAAG,EAAyB,CAAC;AAClE,iBAAiB,CAAC,GAAG,CAAC,GAAG,EA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gBAAgB,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,GAAG;IAClB,SAAS;IACT,YAAY;IACZ,eAAe;CACf,CAAC;AAEF,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAE9E,eAAe,UAAU,CAAC","sourcesContent":["type Range = Map<string, Array<number>>;\n\nconst mediaRanges = new Map<string, Range>();\n\nconst DEAFULT_RANGE_SET: Range = new Map<string, Array<number>>();\nDEAFULT_RANGE_SET.set(\"S\", [0, 599]);\nDEAFULT_RANGE_SET.set(\"M\", [600, 1023]);\nDEAFULT_RANGE_SET.set(\"L\", [1024, 1439]);\nDEAFULT_RANGE_SET.set(\"XL\", [1440, Infinity]);\n\n/**\n * Enumeration containing the names and settings of predefined screen width media query range sets.\n *\n * @public\n */\n enum RANGESETS {\n\t/**\n\t * A 4-step range set (S-M-L-XL).\n\t *\n\t * The ranges of this set are:\n\t * <ul>\n\t * <li><code>\"S\"</code>: For screens smaller than 600 pixels.</li>\n\t * <li><code>\"M\"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>\n\t * <li><code>\"L\"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>\n\t * <li><code>\"XL\"</code>: For screens greater than or equal to 1440 pixels.</li>\n\t * </ul>\n\t *\n\t * @public\n\t */\n\tRANGE_4STEPS = \"4Step\",\n}\n\n/**\n * Initializes a screen width media query range set.\n *\n * This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.\n *\n * A range set can be defined as shown in the following example:\n * <pre>\n * MediaRange.initRangeSet(\"MyRangeSet\", [200, 400], [\"Small\", \"Medium\", \"Large\"]);\n * </pre>\n * This example defines the following named ranges:\n * <ul>\n * <li><code>\"Small\"</code>: For screens smaller than 200 pixels.</li>\n * <li><code>\"Medium\"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>\n * <li><code>\"Large\"</code>: For screens greater than or equal to 400 pixels.</li>\n * </ul>\n *\n * @param name The name of the range set to be initialized.\n * The name must be a valid id and consist only of letters and numeric digits.\n * @param range The given range set.\n */\nconst initRangeSet = (name: string, range: Range) => {\n\tmediaRanges.set(name, range);\n};\n\n/**\n * Returns information about the current active range of the range set with the given name.\n *\n * If the optional parameter <code>width</code> is given, the active range will be determined for that width,\n * otherwise it is determined for the current window size.\n *\n * @param name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})\n * @param [width] An optional width, based on which the range should be determined;\n * If <code>width</code> is not provided, the window size will be used.\n * @returns The name of the current active interval of the range set.\n * @public\n */\nconst getCurrentRange = (name: string, width = window.innerWidth): string => {\n\tlet rangeSet = mediaRanges.get(name);\n\n\tif (!rangeSet) {\n\t\trangeSet = mediaRanges.get(RANGESETS.RANGE_4STEPS)!;\n\t}\n\n\tlet currentRangeName;\n\tconst effectiveWidth = Math.floor(width);\n\n\trangeSet.forEach((value, key) => {\n\t\tif (effectiveWidth >= value[0] && effectiveWidth <= value[1]) {\n\t\t\tcurrentRangeName = key;\n\t\t}\n\t});\n\n\treturn currentRangeName || [...rangeSet.keys()][0];\n};\n\n/**\n * API for screen width changes.\n */\nconst MediaRange = {\n\tRANGESETS,\n\tinitRangeSet,\n\tgetCurrentRange,\n};\n\nMediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, DEAFULT_RANGE_SET);\n\nexport default MediaRange;\n"]}
@@ -1,9 +1,7 @@
1
1
  import "./StaticArea.js";
2
2
  import type UI5Element from "./UI5Element.js";
3
3
  /**
4
- *
5
4
  * @class
6
- * @author SAP SE
7
5
  * @private
8
6
  */
9
7
  declare class StaticAreaItem extends HTMLElement {
@@ -11,13 +9,14 @@ declare class StaticAreaItem extends HTMLElement {
11
9
  ownerElement?: UI5Element;
12
10
  constructor();
13
11
  /**
14
- * @param {UI5Element} ownerElement the UI5Element instance that owns this static area item
12
+ * @param ownerElement the UI5Element instance that owns this static area item
15
13
  */
16
14
  setOwnerElement(ownerElement: UI5Element): void;
17
15
  /**
18
16
  * Updates the shadow root of the static area item with the latest state, if rendered
19
17
  */
20
18
  update(): void;
19
+ updateAdditionalProperties(): void;
21
20
  /**
22
21
  * Sets the correct content density based on the owner element's state
23
22
  * @private
@@ -26,8 +25,8 @@ declare class StaticAreaItem extends HTMLElement {
26
25
  _updateDirection(): void;
27
26
  _updateAdditionalAttrs(): void;
28
27
  /**
29
- * @protected
30
28
  * Returns reference to the DOM element where the current fragment is added.
29
+ * @protected
31
30
  */
32
31
  getDomRef(): Promise<ShadowRoot | null>;
33
32
  static getTag(): string;
@@ -4,13 +4,10 @@ import { renderFinished } from "./Render.js";
4
4
  import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
5
5
  import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";
6
6
  import getEffectiveDir from "./locale/getEffectiveDir.js";
7
- import { getCurrentRuntimeIndex } from "./Runtimes.js";
8
7
  const pureTagName = "ui5-static-area-item";
9
8
  const popupIntegrationAttr = "data-sap-ui-integration-popup-content";
10
9
  /**
11
- *
12
10
  * @class
13
- * @author SAP SE
14
11
  * @private
15
12
  */
16
13
  class StaticAreaItem extends HTMLElement {
@@ -20,7 +17,7 @@ class StaticAreaItem extends HTMLElement {
20
17
  this.attachShadow({ mode: "open" });
21
18
  }
22
19
  /**
23
- * @param {UI5Element} ownerElement the UI5Element instance that owns this static area item
20
+ * @param ownerElement the UI5Element instance that owns this static area item
24
21
  */
25
22
  setOwnerElement(ownerElement) {
26
23
  this.ownerElement = ownerElement;
@@ -34,12 +31,15 @@ class StaticAreaItem extends HTMLElement {
34
31
  */
35
32
  update() {
36
33
  if (this._rendered) {
37
- this._updateAdditionalAttrs();
38
- this._updateContentDensity();
39
- this._updateDirection();
34
+ this.updateAdditionalProperties();
40
35
  updateShadowRoot(this.ownerElement, true);
41
36
  }
42
37
  }
38
+ updateAdditionalProperties() {
39
+ this._updateAdditionalAttrs();
40
+ this._updateContentDensity();
41
+ this._updateDirection();
42
+ }
43
43
  /**
44
44
  * Sets the correct content density based on the owner element's state
45
45
  * @private
@@ -66,17 +66,15 @@ class StaticAreaItem extends HTMLElement {
66
66
  }
67
67
  }
68
68
  _updateAdditionalAttrs() {
69
- this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
70
- this.setAttribute("_ui5host", "");
71
69
  this.setAttribute(pureTagName, "");
72
70
  this.setAttribute(popupIntegrationAttr, "");
73
71
  }
74
72
  /**
75
- * @protected
76
73
  * Returns reference to the DOM element where the current fragment is added.
74
+ * @protected
77
75
  */
78
76
  async getDomRef() {
79
- this._updateContentDensity();
77
+ this.updateAdditionalProperties();
80
78
  if (!this._rendered) {
81
79
  this._rendered = true;
82
80
  updateShadowRoot(this.ownerElement, true);
@@ -1 +1 @@
1
- {"version":3,"file":"StaticAreaItem.js","sourceRoot":"","sources":["../src/StaticAreaItem.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,0BAA0B,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC3C,MAAM,oBAAoB,GAAG,uCAAuC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,cAAe,SAAQ,WAAW;IAIvC;QACC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACrC,CAAC;I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ot.js\";\nimport { renderFinished } from \"./Render.js\";\nimport getEffectiveContentDensity from \"./util/getEffectiveContentDensity.js\";\nimport { getEffectiveScopingSuffixForTag } from \"./CustomElementsScopeUtils.js\";\nimport getEffectiveDir from \"./locale/getEffectiveDir.js\";\nimport type UI5Element from \"./UI5Element.js\";\nimport { getCurrentRuntimeIndex } from \"./Runtimes.js\";\n\nconst pureTagName = \"ui5-static-area-item\";\nconst popupIntegrationAttr = \"data-sap-ui-integration-popup-content\";\n\n/**\n *\n * @class\n * @author SAP SE\n * @private\n */\nclass StaticAreaItem extends HTMLElement {\n\t_rendered: boolean;\n\townerElement?: UI5Element;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._rendered = false;\n\t\tthis.attachShadow({ mode: \"open\" });\n\t}\n\n\t/**\n\t * @param {UI5Element} ownerElement the UI5Element instance that owns this static area item\n\t */\n\tsetOwnerElement(ownerElement: UI5Element) {\n\t\tthis.ownerElement = ownerElement;\n\t\tthis.classList.add(this.ownerElement._id); // used for getting the popover in the tests\n\t\tif (this.ownerElement.hasAttribute(\"data-ui5-static-stable\")) {\n\t\t\tthis.setAttribute(\"data-ui5-stable\", this.ownerElement.getAttribute(\"data-ui5-static-stable\")!); // stable selector\n\t\t}\n\t}\n\n\t/**\n\t * Updates the shadow root of the static area item with the latest state, if rendered\n\t */\n\tupdate() {\n\t\tif (this._rendered) {\n\t\t\tthis._updateAdditionalAttrs();\n\t\t\tthis._updateContentDensity();\n\t\t\tthis._updateDirection();\n\t\t\tupdateShadowRoot(this.ownerElement!, true);\n\t\t}\n\t}\n\n\t/**\n\t * Sets the correct content density based on the owner element's state\n\t * @private\n\t */\n\t_updateContentDensity() {\n\t\tif (getEffectiveContentDensity(this.ownerElement!) === \"compact\") {\n\t\t\tthis.classList.add(\"sapUiSizeCompact\");\n\t\t\tthis.classList.add(\"ui5-content-density-compact\");\n\t\t} else {\n\t\t\tthis.classList.remove(\"sapUiSizeCompact\");\n\t\t\tthis.classList.remove(\"ui5-content-density-compact\");\n\t\t}\n\t}\n\n\t_updateDirection() {\n\t\tif (this.ownerElement) {\n\t\t\tconst dir = getEffectiveDir(this.ownerElement);\n\t\t\tif (dir) {\n\t\t\t\tthis.setAttribute(\"dir\", dir);\n\t\t\t} else {\n\t\t\t\tthis.removeAttribute(\"dir\");\n\t\t\t}\n\t\t}\n\t}\n\n\t_updateAdditionalAttrs() {\n\t\tthis.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, \"\");\n\t\tthis.setAttribute(\"_ui5host\", \"\");\n\t\tthis.setAttribute(pureTagName, \"\");\n\t\tthis.setAttribute(popupIntegrationAttr, \"\");\n\t}\n\n\t/**\n\t * @protected\n\t * Returns reference to the DOM element where the current fragment is added.\n\t */\n\tasync getDomRef() {\n\t\tthis._updateContentDensity();\n\t\tif (!this._rendered) {\n\t\t\tthis._rendered = true;\n\t\t\tupdateShadowRoot(this.ownerElement!, true);\n\t\t}\n\t\tawait renderFinished(); // Wait for the content of the ui5-static-area-item to be rendered\n\t\treturn this.shadowRoot;\n\t}\n\n\tstatic getTag() {\n\t\tconst suffix = getEffectiveScopingSuffixForTag(pureTagName);\n\t\tif (!suffix) {\n\t\t\treturn pureTagName;\n\t\t}\n\n\t\treturn `${pureTagName}-${suffix}`;\n\t}\n\n\tstatic createInstance() {\n\t\tif (!customElements.get(StaticAreaItem.getTag())) {\n\t\t\tcustomElements.define(StaticAreaItem.getTag(), StaticAreaItem);\n\t\t}\n\n\t\treturn document.createElement(this.getTag()) as StaticAreaItem;\n\t}\n}\n\nexport default StaticAreaItem;\n"]}
1
+ {"version":3,"file":"StaticAreaItem.js","sourceRoot":"","sources":["../src/StaticAreaItem.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,0BAA0B,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,+BAA+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,EAAE,CAAC,EAAE;YACjD,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC;SAC/D;QAED,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAmB,CAAC;IAChE,CAAC;CACD;AAED,eAAe,cAAc,CAAC","sourcesContent":["import \"./StaticArea.js\";\nimport updateShadowRoot from \"./updateShadowRoot.js\";\nimport { renderFinished } from \"./Render.js\";\nimport getEffectiveContentDensity from \"./util/getEffectiveContentDensity.js\";\nimport { getEffectiveScopingSuffixForTag } from \"./CustomElementsScopeUtils.js\";\nimport getEffectiveDir from \"./locale/getEffectiveDir.js\";\nimport type UI5Element from \"./UI5Element.js\";\n\nconst pureTagName = \"ui5-static-area-item\";\nconst popupIntegrationAttr = \"data-sap-ui-integration-popup-content\";\n\n/**\n * @class\n * @private\n */\nclass StaticAreaItem extends HTMLElement {\n\t_rendered: boolean;\n\townerElement?: UI5Element;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._rendered = false;\n\t\tthis.attachShadow({ mode: \"open\" });\n\t}\n\n\t/**\n\t * @param ownerElement the UI5Element instance that owns this static area item\n\t */\n\tsetOwnerElement(ownerElement: UI5Element) {\n\t\tthis.ownerElement = ownerElement;\n\t\tthis.classList.add(this.ownerElement._id); // used for getting the popover in the tests\n\t\tif (this.ownerElement.hasAttribute(\"data-ui5-static-stable\")) {\n\t\t\tthis.setAttribute(\"data-ui5-stable\", this.ownerElement.getAttribute(\"data-ui5-static-stable\")!); // stable selector\n\t\t}\n\t}\n\n\t/**\n\t * Updates the shadow root of the static area item with the latest state, if rendered\n\t */\n\tupdate() {\n\t\tif (this._rendered) {\n\t\t\tthis.updateAdditionalProperties();\n\t\t\tupdateShadowRoot(this.ownerElement!, true);\n\t\t}\n\t}\n\n\tupdateAdditionalProperties() {\n\t\tthis._updateAdditionalAttrs();\n\t\tthis._updateContentDensity();\n\t\tthis._updateDirection();\n\t}\n\n\t/**\n\t * Sets the correct content density based on the owner element's state\n\t * @private\n\t */\n\t_updateContentDensity() {\n\t\tif (getEffectiveContentDensity(this.ownerElement!) === \"compact\") {\n\t\t\tthis.classList.add(\"sapUiSizeCompact\");\n\t\t\tthis.classList.add(\"ui5-content-density-compact\");\n\t\t} else {\n\t\t\tthis.classList.remove(\"sapUiSizeCompact\");\n\t\t\tthis.classList.remove(\"ui5-content-density-compact\");\n\t\t}\n\t}\n\n\t_updateDirection() {\n\t\tif (this.ownerElement) {\n\t\t\tconst dir = getEffectiveDir(this.ownerElement);\n\t\t\tif (dir) {\n\t\t\t\tthis.setAttribute(\"dir\", dir);\n\t\t\t} else {\n\t\t\t\tthis.removeAttribute(\"dir\");\n\t\t\t}\n\t\t}\n\t}\n\n\t_updateAdditionalAttrs() {\n\t\tthis.setAttribute(pureTagName, \"\");\n\t\tthis.setAttribute(popupIntegrationAttr, \"\");\n\t}\n\n\t/**\n\t * Returns reference to the DOM element where the current fragment is added.\n\t * @protected\n\t */\n\tasync getDomRef() {\n\t\tthis.updateAdditionalProperties();\n\t\tif (!this._rendered) {\n\t\t\tthis._rendered = true;\n\t\t\tupdateShadowRoot(this.ownerElement!, true);\n\t\t}\n\t\tawait renderFinished(); // Wait for the content of the ui5-static-area-item to be rendered\n\t\treturn this.shadowRoot;\n\t}\n\n\tstatic getTag() {\n\t\tconst suffix = getEffectiveScopingSuffixForTag(pureTagName);\n\t\tif (!suffix) {\n\t\t\treturn pureTagName;\n\t\t}\n\n\t\treturn `${pureTagName}-${suffix}`;\n\t}\n\n\tstatic createInstance() {\n\t\tif (!customElements.get(StaticAreaItem.getTag())) {\n\t\t\tcustomElements.define(StaticAreaItem.getTag(), StaticAreaItem);\n\t\t}\n\n\t\treturn document.createElement(this.getTag()) as StaticAreaItem;\n\t}\n}\n\nexport default StaticAreaItem;\n"]}
@@ -26,12 +26,9 @@ type InvalidationInfo = ChangeInfo & {
26
26
  type ChildChangeListener = (param: InvalidationInfo) => void;
27
27
  type SlotChangeListener = (this: HTMLSlotElement, ev: Event) => void;
28
28
  /**
29
+ * @class
29
30
  * Base class for all UI5 Web Components
30
31
  *
31
- * @class
32
- * @constructor
33
- * @author SAP SE
34
- * @alias sap.ui.webc.base.UI5Element
35
32
  * @extends HTMLElement
36
33
  * @public
37
34
  */
@@ -39,7 +36,8 @@ declare abstract class UI5Element extends HTMLElement {
39
36
  __id?: string;
40
37
  _suppressInvalidation: boolean;
41
38
  _changedState: Array<ChangeInfo>;
42
- _eventProvider: EventProvider<InvalidationInfo, void>;
39
+ _invalidationEventProvider: EventProvider<InvalidationInfo, void>;
40
+ _componentStateFinalizedEventProvider: EventProvider<void, void>;
43
41
  _inDOM: boolean;
44
42
  _fullyConnected: boolean;
45
43
  _childChangeListeners: Map<string, ChildChangeListener>;
@@ -49,7 +47,6 @@ declare abstract class UI5Element extends HTMLElement {
49
47
  };
50
48
  _doNotSyncAttributes: Set<string>;
51
49
  _state: State;
52
- _onComponentStateFinalized?: () => void;
53
50
  _getRealDomRef?: () => HTMLElement;
54
51
  staticAreaItem?: StaticAreaItem;
55
52
  static template?: TemplateFunction;
@@ -125,22 +122,22 @@ declare abstract class UI5Element extends HTMLElement {
125
122
  /**
126
123
  * Attach a callback that will be executed whenever the component is invalidated
127
124
  *
128
- * @param {InvalidationInfo} callback
125
+ * @param callback
129
126
  * @public
130
127
  */
131
128
  attachInvalidate(callback: (param: InvalidationInfo) => void): void;
132
129
  /**
133
130
  * Detach the callback that is executed whenever the component is invalidated
134
131
  *
135
- * @param {InvalidationInfo} callback
132
+ * @param callback
136
133
  * @public
137
134
  */
138
135
  detachInvalidate(callback: (param: InvalidationInfo) => void): void;
139
136
  /**
140
137
  * Callback that is executed whenever a monitored child changes its state
141
138
  *
142
- * @param {sting} slotName the slot in which a child was invalidated
143
- * @param { ChangeInfo } childChangeInfo the changeInfo object for the child in the given slot
139
+ * @param slotName the slot in which a child was invalidated
140
+ * @param childChangeInfo the changeInfo object for the child in the given slot
144
141
  * @private
145
142
  */
146
143
  _onChildChange(slotName: string, childChangeInfo: ChangeInfo): void;
@@ -165,15 +162,13 @@ declare abstract class UI5Element extends HTMLElement {
165
162
  * Returns a singleton event listener for the "change" event of a child in a given slot
166
163
  *
167
164
  * @param slotName the name of the slot, where the child is
168
- * @returns {ChildChangeListener}
169
165
  * @private
170
166
  */
171
- _getChildChangeListener(slotName: string): ChildChangeListener | undefined;
167
+ _getChildChangeListener(slotName: string): ChildChangeListener;
172
168
  /**
173
169
  * Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
174
170
  *
175
171
  * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
176
- * @returns {SlotChangeListener}
177
172
  * @private
178
173
  */
179
174
  _getSlotChangeListener(slotName: string): SlotChangeListener;
@@ -257,7 +252,7 @@ declare abstract class UI5Element extends HTMLElement {
257
252
  getFocusDomRefAsync(): Promise<HTMLElement | undefined>;
258
253
  /**
259
254
  * Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
260
- * @param {FocusOptions} focusOptions additional options for the focus
255
+ * @param focusOptions additional options for the focus
261
256
  * @public
262
257
  */
263
258
  focus(focusOptions?: FocusOptions): Promise<void>;
@@ -268,7 +263,7 @@ declare abstract class UI5Element extends HTMLElement {
268
263
  * @param data - additional data for the event
269
264
  * @param cancelable - true, if the user can call preventDefault on the event object
270
265
  * @param bubbles - true, if the event bubbles
271
- * @returns {boolean} false, if the event was cancelled (preventDefault called), true otherwise
266
+ * @returns false, if the event was cancelled (preventDefault called), true otherwise
272
267
  */
273
268
  fireEvent<T>(name: string, data?: T, cancelable?: boolean, bubbles?: boolean): boolean;
274
269
  _fireEvent<T>(name: string, data?: T, cancelable?: boolean, bubbles?: boolean): boolean;
@@ -277,19 +272,33 @@ declare abstract class UI5Element extends HTMLElement {
277
272
  * Useful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.
278
273
  * @public
279
274
  */
280
- getSlottedNodes<T = Node>(slotName: string): T[];
275
+ getSlottedNodes<T = Node>(slotName: string): Array<T>;
276
+ /**
277
+ * Attach a callback that will be executed whenever the component's state is finalized
278
+ *
279
+ * @param callback
280
+ * @public
281
+ */
282
+ attachComponentStateFinalized(callback: () => void): void;
283
+ /**
284
+ * Detach the callback that is executed whenever the component's state is finalized
285
+ *
286
+ * @param callback
287
+ * @public
288
+ */
289
+ detachComponentStateFinalized(callback: () => void): void;
281
290
  /**
282
291
  * Determines whether the component should be rendered in RTL mode or not.
283
292
  * Returns: "rtl", "ltr" or undefined
284
293
  *
285
294
  * @public
286
- * @returns {String|undefined}
295
+ * @default undefined
287
296
  */
288
297
  get effectiveDir(): string | undefined;
289
298
  /**
290
299
  * Used to duck-type UI5 elements without using instanceof
291
- * @returns {boolean}
292
300
  * @public
301
+ * @default true
293
302
  */
294
303
  get isUI5Element(): boolean;
295
304
  get classes(): ClassMap;
@@ -342,37 +351,31 @@ declare abstract class UI5Element extends HTMLElement {
342
351
  *
343
352
  * @public
344
353
  */
345
- static getUniqueDependencies(this: typeof UI5Element): (typeof UI5Element)[];
354
+ static getUniqueDependencies(this: typeof UI5Element): Array<typeof UI5Element>;
346
355
  /**
347
356
  * Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
348
- *
349
- * @returns {Promise}
350
357
  */
351
358
  static whenDependenciesDefined(): Promise<Array<typeof UI5Element>>;
352
359
  /**
353
360
  * Hook that will be called upon custom element definition
354
361
  *
355
362
  * @protected
356
- * @returns {Promise<void>}
357
363
  */
358
364
  static onDefine(): Promise<void>;
359
365
  /**
360
366
  * Registers a UI5 Web Component in the browser window object
361
367
  * @public
362
- * @returns {Promise<UI5Element>}
363
368
  */
364
369
  static define(): Promise<typeof UI5Element>;
365
370
  /**
366
371
  * Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
367
372
  * Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
368
373
  * @public
369
- * @returns {UI5ElementMetadata}
370
374
  */
371
375
  static getMetadata(): UI5ElementMetadata;
372
376
  }
373
377
  /**
374
378
  * Always use duck-typing to cover all runtimes on the page.
375
- * @returns {boolean}
376
379
  */
377
380
  declare const instanceOfUI5Element: (object: any) => object is UI5Element;
378
381
  export default UI5Element;