@openui5/sap.ui.core 1.139.0 → 1.140.0

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 (337) hide show
  1. package/THIRDPARTY.txt +1 -1
  2. package/package.json +1 -1
  3. package/src/jquery.sap.global.js +1 -1
  4. package/src/jquery.sap.mobile.js +0 -8
  5. package/src/jquery.sap.properties.js +1 -1
  6. package/src/jquery.sap.resources.js +1 -1
  7. package/src/jquery.sap.script.js +1 -1
  8. package/src/jquery.sap.storage.js +3 -3
  9. package/src/sap/base/Event.js +1 -1
  10. package/src/sap/base/Eventing.js +1 -1
  11. package/src/sap/base/config.js +1 -1
  12. package/src/sap/base/i18n/LanguageTag.js +1 -1
  13. package/src/sap/base/i18n/date/TimezoneUtils.js +1 -1
  14. package/src/sap/base/security/URLListValidator.js +7 -3
  15. package/src/sap/base/util/restricted/_CancelablePromise.js +1 -1
  16. package/src/sap/base/util/restricted/_castArray.js +1 -1
  17. package/src/sap/base/util/restricted/_compact.js +1 -1
  18. package/src/sap/base/util/restricted/_curry.js +1 -1
  19. package/src/sap/base/util/restricted/_debounce.js +1 -1
  20. package/src/sap/base/util/restricted/_difference.js +1 -1
  21. package/src/sap/base/util/restricted/_differenceBy.js +1 -1
  22. package/src/sap/base/util/restricted/_differenceWith.js +1 -1
  23. package/src/sap/base/util/restricted/_flatMap.js +1 -1
  24. package/src/sap/base/util/restricted/_flatMapDeep.js +1 -1
  25. package/src/sap/base/util/restricted/_flatMapDepth.js +1 -1
  26. package/src/sap/base/util/restricted/_flatten.js +1 -1
  27. package/src/sap/base/util/restricted/_flattenDeep.js +1 -1
  28. package/src/sap/base/util/restricted/_flattenDepth.js +1 -1
  29. package/src/sap/base/util/restricted/_intersection.js +1 -1
  30. package/src/sap/base/util/restricted/_intersectionBy.js +1 -1
  31. package/src/sap/base/util/restricted/_intersectionWith.js +1 -1
  32. package/src/sap/base/util/restricted/_isEqual.js +1 -1
  33. package/src/sap/base/util/restricted/_isEqualWith.js +1 -1
  34. package/src/sap/base/util/restricted/_isNil.js +1 -1
  35. package/src/sap/base/util/restricted/_max.js +1 -1
  36. package/src/sap/base/util/restricted/_merge.js +1 -1
  37. package/src/sap/base/util/restricted/_mergeWith.js +1 -1
  38. package/src/sap/base/util/restricted/_min.js +1 -1
  39. package/src/sap/base/util/restricted/_omit.js +1 -1
  40. package/src/sap/base/util/restricted/_pick.js +1 -1
  41. package/src/sap/base/util/restricted/_pickBy.js +1 -1
  42. package/src/sap/base/util/restricted/_throttle.js +1 -1
  43. package/src/sap/base/util/restricted/_toArray.js +1 -1
  44. package/src/sap/base/util/restricted/_union.js +1 -1
  45. package/src/sap/base/util/restricted/_unionBy.js +1 -1
  46. package/src/sap/base/util/restricted/_unionWith.js +1 -1
  47. package/src/sap/base/util/restricted/_uniq.js +1 -1
  48. package/src/sap/base/util/restricted/_uniqBy.js +1 -1
  49. package/src/sap/base/util/restricted/_uniqWith.js +1 -1
  50. package/src/sap/base/util/restricted/_without.js +1 -1
  51. package/src/sap/base/util/restricted/_xor.js +1 -1
  52. package/src/sap/base/util/restricted/_xorBy.js +1 -1
  53. package/src/sap/base/util/restricted/_xorWith.js +1 -1
  54. package/src/sap/base/util/restricted/_zipObject.js +1 -1
  55. package/src/sap/base/util/restricted/_zipObjectDeep.js +1 -1
  56. package/src/sap/ui/Device.js +3 -3
  57. package/src/sap/ui/Global.js +3 -3
  58. package/src/sap/ui/base/BindingParser.js +1 -1
  59. package/src/sap/ui/base/Event.js +1 -1
  60. package/src/sap/ui/base/EventProvider.js +1 -1
  61. package/src/sap/ui/base/Interface.js +1 -1
  62. package/src/sap/ui/base/ManagedObject.js +1 -1
  63. package/src/sap/ui/base/ManagedObjectMetadata.js +1 -1
  64. package/src/sap/ui/base/Metadata.js +1 -1
  65. package/src/sap/ui/base/Object.js +1 -1
  66. package/src/sap/ui/base/ObjectPool.js +1 -1
  67. package/src/sap/ui/core/.library +2 -2
  68. package/src/sap/ui/core/BusyIndicator.js +1 -1
  69. package/src/sap/ui/core/Component.js +1 -1
  70. package/src/sap/ui/core/ComponentContainer.js +1 -1
  71. package/src/sap/ui/core/ComponentMetadata.js +1 -1
  72. package/src/sap/ui/core/ComponentSupport.js +1 -1
  73. package/src/sap/ui/core/Configuration.js +1 -1
  74. package/src/sap/ui/core/Control.js +1 -1
  75. package/src/sap/ui/core/Core.js +2 -11
  76. package/src/sap/ui/core/CustomData.js +1 -1
  77. package/src/sap/ui/core/DeclarativeSupport.js +1 -1
  78. package/src/sap/ui/core/Element.js +1 -1
  79. package/src/sap/ui/core/ElementMetadata.js +1 -1
  80. package/src/sap/ui/core/EnabledPropagator.js +1 -1
  81. package/src/sap/ui/core/EventBus.js +1 -1
  82. package/src/sap/ui/core/Fragment.js +1 -1
  83. package/src/sap/ui/core/HTML.js +1 -1
  84. package/src/sap/ui/core/History.js +1 -1
  85. package/src/sap/ui/core/Icon.js +1 -1
  86. package/src/sap/ui/core/IndicationColorSupport.js +1 -1
  87. package/src/sap/ui/core/IntervalTrigger.js +1 -1
  88. package/src/sap/ui/core/InvisibleMessage.js +1 -1
  89. package/src/sap/ui/core/InvisibleRenderer.js +1 -1
  90. package/src/sap/ui/core/InvisibleText.js +1 -1
  91. package/src/sap/ui/core/Item.js +1 -1
  92. package/src/sap/ui/core/LabelEnablement.js +1 -1
  93. package/src/sap/ui/core/LayoutData.js +1 -1
  94. package/src/sap/ui/core/Lib.js +15 -108
  95. package/src/sap/ui/core/ListItem.js +1 -1
  96. package/src/sap/ui/core/LocalBusyIndicator.js +1 -1
  97. package/src/sap/ui/core/Locale.js +1 -1
  98. package/src/sap/ui/core/LocaleData.js +1 -1
  99. package/src/sap/ui/core/Manifest.js +1 -1
  100. package/src/sap/ui/core/Message.js +1 -1
  101. package/src/sap/ui/core/RenderManager.js +1 -1
  102. package/src/sap/ui/core/Renderer.js +1 -1
  103. package/src/sap/ui/core/ResizeHandler.js +1 -1
  104. package/src/sap/ui/core/ScrollBar.js +1 -1
  105. package/src/sap/ui/core/SeparatorItem.js +1 -1
  106. package/src/sap/ui/core/Theming.js +145 -76
  107. package/src/sap/ui/core/Title.js +1 -1
  108. package/src/sap/ui/core/TooltipBase.js +1 -1
  109. package/src/sap/ui/core/UIArea.js +1 -1
  110. package/src/sap/ui/core/UIComponent.js +1 -1
  111. package/src/sap/ui/core/UIComponentMetadata.js +1 -1
  112. package/src/sap/ui/core/ValueStateSupport.js +1 -1
  113. package/src/sap/ui/core/VariantLayoutData.js +1 -1
  114. package/src/sap/ui/core/XMLComposite.js +1 -1
  115. package/src/sap/ui/core/XMLCompositeMetadata.js +1 -1
  116. package/src/sap/ui/core/XMLTemplateProcessor.js +1 -1
  117. package/src/sap/ui/core/date/UI5Date.js +1 -1
  118. package/src/sap/ui/core/delegate/ItemNavigation.js +1 -1
  119. package/src/sap/ui/core/delegate/ScrollEnablement.js +1 -1
  120. package/src/sap/ui/core/dnd/DragDropBase.js +1 -1
  121. package/src/sap/ui/core/dnd/DragDropInfo.js +1 -1
  122. package/src/sap/ui/core/dnd/DragInfo.js +1 -1
  123. package/src/sap/ui/core/dnd/DropInfo.js +1 -1
  124. package/src/sap/ui/core/format/FormatUtils.js +1 -1
  125. package/src/sap/ui/core/format/NumberFormat.js +1 -1
  126. package/src/sap/ui/core/format/TimezoneUtil.js +1 -1
  127. package/src/sap/ui/core/getCompatibilityVersion.js +1 -1
  128. package/src/sap/ui/core/hyphenation/Hyphenation.js +1 -1
  129. package/src/sap/ui/core/library.js +3 -3
  130. package/src/sap/ui/core/message/ControlMessageProcessor.js +1 -1
  131. package/src/sap/ui/core/message/Message.js +1 -1
  132. package/src/sap/ui/core/message/MessageManager.js +1 -1
  133. package/src/sap/ui/core/message/MessageParser.js +1 -1
  134. package/src/sap/ui/core/message/MessageProcessor.js +1 -1
  135. package/src/sap/ui/core/messagebundle_ar.properties +26 -11
  136. package/src/sap/ui/core/messagebundle_bg.properties +21 -6
  137. package/src/sap/ui/core/messagebundle_ca.properties +24 -9
  138. package/src/sap/ui/core/messagebundle_cnr.properties +23 -8
  139. package/src/sap/ui/core/messagebundle_cs.properties +24 -9
  140. package/src/sap/ui/core/messagebundle_cy.properties +24 -9
  141. package/src/sap/ui/core/messagebundle_da.properties +21 -6
  142. package/src/sap/ui/core/messagebundle_de.properties +16 -1
  143. package/src/sap/ui/core/messagebundle_el.properties +26 -11
  144. package/src/sap/ui/core/messagebundle_en.properties +24 -9
  145. package/src/sap/ui/core/messagebundle_en_GB.properties +24 -9
  146. package/src/sap/ui/core/messagebundle_en_US_saprigi.properties +24 -9
  147. package/src/sap/ui/core/messagebundle_es.properties +21 -6
  148. package/src/sap/ui/core/messagebundle_es_MX.properties +24 -9
  149. package/src/sap/ui/core/messagebundle_et.properties +31 -16
  150. package/src/sap/ui/core/messagebundle_fi.properties +20 -5
  151. package/src/sap/ui/core/messagebundle_fr.properties +22 -7
  152. package/src/sap/ui/core/messagebundle_fr_CA.properties +20 -5
  153. package/src/sap/ui/core/messagebundle_hi.properties +24 -9
  154. package/src/sap/ui/core/messagebundle_hr.properties +20 -5
  155. package/src/sap/ui/core/messagebundle_hu.properties +23 -8
  156. package/src/sap/ui/core/messagebundle_id.properties +20 -5
  157. package/src/sap/ui/core/messagebundle_it.properties +23 -8
  158. package/src/sap/ui/core/messagebundle_iw.properties +21 -6
  159. package/src/sap/ui/core/messagebundle_ja.properties +19 -4
  160. package/src/sap/ui/core/messagebundle_kk.properties +22 -7
  161. package/src/sap/ui/core/messagebundle_ko.properties +20 -5
  162. package/src/sap/ui/core/messagebundle_lt.properties +20 -5
  163. package/src/sap/ui/core/messagebundle_lv.properties +20 -5
  164. package/src/sap/ui/core/messagebundle_mk.properties +25 -10
  165. package/src/sap/ui/core/messagebundle_ms.properties +24 -9
  166. package/src/sap/ui/core/messagebundle_nl.properties +22 -7
  167. package/src/sap/ui/core/messagebundle_no.properties +22 -7
  168. package/src/sap/ui/core/messagebundle_pl.properties +19 -4
  169. package/src/sap/ui/core/messagebundle_pt.properties +18 -3
  170. package/src/sap/ui/core/messagebundle_pt_PT.properties +18 -3
  171. package/src/sap/ui/core/messagebundle_ro.properties +22 -7
  172. package/src/sap/ui/core/messagebundle_ru.properties +19 -4
  173. package/src/sap/ui/core/messagebundle_sh.properties +23 -8
  174. package/src/sap/ui/core/messagebundle_sk.properties +23 -8
  175. package/src/sap/ui/core/messagebundle_sl.properties +20 -5
  176. package/src/sap/ui/core/messagebundle_sr.properties +23 -8
  177. package/src/sap/ui/core/messagebundle_sv.properties +23 -8
  178. package/src/sap/ui/core/messagebundle_th.properties +20 -5
  179. package/src/sap/ui/core/messagebundle_tr.properties +20 -5
  180. package/src/sap/ui/core/messagebundle_uk.properties +22 -7
  181. package/src/sap/ui/core/messagebundle_vi.properties +18 -3
  182. package/src/sap/ui/core/messagebundle_zh_CN.properties +24 -9
  183. package/src/sap/ui/core/messagebundle_zh_TW.properties +20 -5
  184. package/src/sap/ui/core/mvc/HTMLView.js +1 -1
  185. package/src/sap/ui/core/mvc/JSONView.js +1 -1
  186. package/src/sap/ui/core/mvc/JSView.js +1 -1
  187. package/src/sap/ui/core/mvc/TemplateView.js +1 -1
  188. package/src/sap/ui/core/mvc/View.js +1 -1
  189. package/src/sap/ui/core/mvc/XMLView.js +1 -1
  190. package/src/sap/ui/core/plugin/DeclarativeSupport.js +1 -1
  191. package/src/sap/ui/core/plugin/TemplatingSupport.js +1 -1
  192. package/src/sap/ui/core/postmessage/Bus.js +1 -1
  193. package/src/sap/ui/core/postmessage/confirmationDialog.js +1 -1
  194. package/src/sap/ui/core/routing/Route.js +1 -1
  195. package/src/sap/ui/core/routing/Router.js +19 -1
  196. package/src/sap/ui/core/search/OpenSearchProvider.js +1 -1
  197. package/src/sap/ui/core/search/SearchProvider.js +1 -1
  198. package/src/sap/ui/core/service/Service.js +1 -1
  199. package/src/sap/ui/core/service/ServiceFactory.js +1 -1
  200. package/src/sap/ui/core/service/ServiceFactoryRegistry.js +1 -1
  201. package/src/sap/ui/core/support/Plugin.js +1 -1
  202. package/src/sap/ui/core/support/Support.js +1 -1
  203. package/src/sap/ui/core/support/plugins/ControlTree.js +1 -1
  204. package/src/sap/ui/core/support/plugins/Interaction.js +1 -1
  205. package/src/sap/ui/core/support/plugins/LocalStorage.js +1 -1
  206. package/src/sap/ui/core/support/plugins/Performance.js +1 -1
  207. package/src/sap/ui/core/support/plugins/Selector.js +1 -1
  208. package/src/sap/ui/core/support/plugins/TechInfo.js +1 -1
  209. package/src/sap/ui/core/support/plugins/Trace.js +1 -1
  210. package/src/sap/ui/core/support/plugins/ViewInfo.js +1 -1
  211. package/src/sap/ui/core/themes/base/base.less +20 -20
  212. package/src/sap/ui/core/themes/base/shared.less +4 -1
  213. package/src/sap/ui/core/themes/base/skeleton.less +3 -3
  214. package/src/sap/ui/core/theming/Parameters.js +717 -755
  215. package/src/sap/ui/core/theming/ThemeHelper.js +0 -77
  216. package/src/sap/ui/core/theming/ThemeManager.js +535 -526
  217. package/src/sap/ui/core/tmpl/DOMAttribute.js +1 -1
  218. package/src/sap/ui/core/tmpl/DOMElement.js +1 -1
  219. package/src/sap/ui/core/tmpl/HandlebarsTemplate.js +1 -1
  220. package/src/sap/ui/core/tmpl/Template.js +1 -1
  221. package/src/sap/ui/core/tmpl/TemplateControl.js +1 -1
  222. package/src/sap/ui/core/util/AsyncHintsHelper.js +1 -1
  223. package/src/sap/ui/core/util/Export.js +1 -1
  224. package/src/sap/ui/core/util/ExportCell.js +1 -1
  225. package/src/sap/ui/core/util/ExportColumn.js +1 -1
  226. package/src/sap/ui/core/util/ExportRow.js +1 -1
  227. package/src/sap/ui/core/util/ExportType.js +1 -1
  228. package/src/sap/ui/core/util/ExportTypeCSV.js +1 -1
  229. package/src/sap/ui/core/util/File.js +1 -1
  230. package/src/sap/ui/core/util/LibraryInfo.js +1 -1
  231. package/src/sap/ui/core/util/MockServer.js +1 -1
  232. package/src/sap/ui/core/util/PasteHelper.js +1 -1
  233. package/src/sap/ui/core/util/serializer/HTMLViewSerializer.js +1 -1
  234. package/src/sap/ui/core/util/serializer/Serializer.js +1 -1
  235. package/src/sap/ui/core/util/serializer/ViewSerializer.js +1 -1
  236. package/src/sap/ui/core/util/serializer/XMLViewSerializer.js +1 -1
  237. package/src/sap/ui/core/util/serializer/delegate/Delegate.js +1 -1
  238. package/src/sap/ui/core/util/serializer/delegate/HTML.js +1 -1
  239. package/src/sap/ui/core/util/serializer/delegate/XML.js +1 -1
  240. package/src/sap/ui/core/webc/WebComponent.js +93 -45
  241. package/src/sap/ui/core/webc/WebComponentMetadata.js +40 -6
  242. package/src/sap/ui/core/ws/ReadyState.js +1 -1
  243. package/src/sap/ui/core/ws/SapPcpWebSocket.js +1 -1
  244. package/src/sap/ui/core/ws/WebSocket.js +1 -1
  245. package/src/sap/ui/debug/ControlTree.js +1 -1
  246. package/src/sap/ui/debug/DebugEnv.js +1 -1
  247. package/src/sap/ui/debug/PropertyList.js +1 -1
  248. package/src/sap/ui/dom/includeStylesheet.js +4 -1
  249. package/src/sap/ui/model/ClientModel.js +1 -1
  250. package/src/sap/ui/model/CompositeDataState.js +1 -1
  251. package/src/sap/ui/model/CompositeType.js +1 -1
  252. package/src/sap/ui/model/DataState.js +1 -1
  253. package/src/sap/ui/model/MetaModel.js +1 -1
  254. package/src/sap/ui/model/Model.js +7 -7
  255. package/src/sap/ui/model/SelectionModel.js +1 -1
  256. package/src/sap/ui/model/SimpleType.js +1 -1
  257. package/src/sap/ui/model/TreeAutoExpandMode.js +1 -1
  258. package/src/sap/ui/model/Type.js +1 -1
  259. package/src/sap/ui/model/json/JSONModel.js +1 -1
  260. package/src/sap/ui/model/json/TypedJSONContext.js +16 -0
  261. package/src/sap/ui/model/json/TypedJSONModel.js +16 -0
  262. package/src/sap/ui/model/message/MessageModel.js +1 -1
  263. package/src/sap/ui/model/odata/ODataAnnotations.js +1 -1
  264. package/src/sap/ui/model/odata/ODataMessageParser.js +1 -1
  265. package/src/sap/ui/model/odata/ODataMetaModel.js +1 -1
  266. package/src/sap/ui/model/odata/ODataMetadata.js +4 -4
  267. package/src/sap/ui/model/odata/ODataModel.js +1 -1
  268. package/src/sap/ui/model/odata/ODataTreeBindingFlat.js +9 -8
  269. package/src/sap/ui/model/odata/_AnnotationHelperExpression.js +2 -2
  270. package/src/sap/ui/model/odata/type/Boolean.js +1 -1
  271. package/src/sap/ui/model/odata/type/Byte.js +1 -1
  272. package/src/sap/ui/model/odata/type/Currency.js +1 -1
  273. package/src/sap/ui/model/odata/type/Date.js +1 -1
  274. package/src/sap/ui/model/odata/type/DateTime.js +1 -1
  275. package/src/sap/ui/model/odata/type/DateTimeBase.js +1 -1
  276. package/src/sap/ui/model/odata/type/DateTimeOffset.js +1 -1
  277. package/src/sap/ui/model/odata/type/DateTimeWithTimezone.js +1 -1
  278. package/src/sap/ui/model/odata/type/Decimal.js +1 -1
  279. package/src/sap/ui/model/odata/type/Double.js +1 -1
  280. package/src/sap/ui/model/odata/type/Guid.js +1 -1
  281. package/src/sap/ui/model/odata/type/Int.js +1 -1
  282. package/src/sap/ui/model/odata/type/Int16.js +1 -1
  283. package/src/sap/ui/model/odata/type/Int32.js +1 -1
  284. package/src/sap/ui/model/odata/type/Int64.js +1 -1
  285. package/src/sap/ui/model/odata/type/ODataType.js +1 -1
  286. package/src/sap/ui/model/odata/type/Raw.js +1 -1
  287. package/src/sap/ui/model/odata/type/SByte.js +1 -1
  288. package/src/sap/ui/model/odata/type/Single.js +1 -1
  289. package/src/sap/ui/model/odata/type/Stream.js +1 -1
  290. package/src/sap/ui/model/odata/type/String.js +1 -1
  291. package/src/sap/ui/model/odata/type/Time.js +1 -1
  292. package/src/sap/ui/model/odata/type/TimeOfDay.js +1 -1
  293. package/src/sap/ui/model/odata/type/Unit.js +1 -1
  294. package/src/sap/ui/model/odata/v2/Context.js +1 -1
  295. package/src/sap/ui/model/odata/v2/ODataAnnotations.js +1 -1
  296. package/src/sap/ui/model/odata/v2/ODataContextBinding.js +2 -2
  297. package/src/sap/ui/model/odata/v2/ODataListBinding.js +2 -2
  298. package/src/sap/ui/model/odata/v2/ODataModel.js +41 -59
  299. package/src/sap/ui/model/odata/v2/ODataTreeBinding.js +82 -60
  300. package/src/sap/ui/model/odata/v4/Context.js +1 -1
  301. package/src/sap/ui/model/odata/v4/ODataContextBinding.js +1 -1
  302. package/src/sap/ui/model/odata/v4/ODataListBinding.js +1 -1
  303. package/src/sap/ui/model/odata/v4/ODataMetaModel.js +35 -20
  304. package/src/sap/ui/model/odata/v4/ODataModel.js +1 -1
  305. package/src/sap/ui/model/odata/v4/ODataParentBinding.js +32 -5
  306. package/src/sap/ui/model/odata/v4/ODataPropertyBinding.js +1 -1
  307. package/src/sap/ui/model/odata/v4/lib/_AggregationCache.js +11 -1
  308. package/src/sap/ui/model/odata/v4/lib/_Cache.js +7 -9
  309. package/src/sap/ui/model/odata/v4/lib/_Helper.js +12 -12
  310. package/src/sap/ui/model/odata/v4/lib/_Requestor.js +16 -6
  311. package/src/sap/ui/model/resource/ResourceModel.js +1 -1
  312. package/src/sap/ui/model/type/Boolean.js +1 -1
  313. package/src/sap/ui/model/type/Currency.js +1 -1
  314. package/src/sap/ui/model/type/Date.js +1 -1
  315. package/src/sap/ui/model/type/DateInterval.js +1 -1
  316. package/src/sap/ui/model/type/DateTime.js +1 -1
  317. package/src/sap/ui/model/type/DateTimeInterval.js +1 -1
  318. package/src/sap/ui/model/type/FileSize.js +1 -1
  319. package/src/sap/ui/model/type/Float.js +1 -1
  320. package/src/sap/ui/model/type/Integer.js +1 -1
  321. package/src/sap/ui/model/type/String.js +1 -1
  322. package/src/sap/ui/model/type/Time.js +1 -1
  323. package/src/sap/ui/model/type/TimeInterval.js +1 -1
  324. package/src/sap/ui/model/type/Unit.js +19 -5
  325. package/src/sap/ui/model/xml/XMLModel.js +1 -1
  326. package/src/sap/ui/qunit/utils/ControlIterator.js +1 -2
  327. package/src/sap/ui/qunit/utils/MemoryLeakCheck.js +1 -1
  328. package/src/sap/ui/test/TestUtils.js +27 -15
  329. package/src/sap/ui/test/generic/TestBase.js +1 -1
  330. package/src/sap/ui/test/generic/Utils.js +6 -6
  331. package/src/sap/ui/test/opaQunit.js +3 -0
  332. package/src/sap/ui/thirdparty/qunit-2.js +4 -1
  333. package/src/sap/ui/util/Mobile.js +0 -9
  334. package/src/sap/ui/util/Storage.js +1 -1
  335. package/src/ui5loader.js +1 -1
  336. package/ui5.yaml +0 -1
  337. package/src/sap/ui/core/plugin/LessSupport.js +0 -542
@@ -4,874 +4,836 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- 'sap/ui/core/Lib',
8
7
  'sap/ui/core/Theming',
9
8
  'sap/ui/thirdparty/URI',
10
9
  '../Element',
11
10
  'sap/base/future',
12
11
  'sap/base/Log',
13
- 'sap/base/util/extend',
14
12
  'sap/base/util/syncFetch',
15
- 'sap/ui/core/theming/ThemeManager',
16
- './ThemeHelper'
17
- ],
18
- function(Library, Theming, URI, Element, future, Log, extend, syncFetch, ThemeManager, ThemeHelper) {
13
+ 'sap/ui/base/OwnStatics',
14
+ './ThemeManager'
15
+ ], function(
16
+ Theming,
17
+ URI,
18
+ Element,
19
+ future,
20
+ Log,
21
+ syncFetch,
22
+ OwnStatics,
23
+ ThemeManager
24
+ ) {
19
25
  "use strict";
20
26
 
21
- var syncCallBehavior = sap.ui.loader._.getSyncCallBehavior();
22
-
23
- /**
24
- * A helper used for (read-only) access to CSS parameters at runtime.
25
- *
26
- * @author SAP SE
27
- * @namespace
28
- *
29
- * @public
30
- * @alias sap.ui.core.theming.Parameters
31
- */
32
- var Parameters = {};
33
-
34
- var mParameters = null;
35
- var sTheme = null;
36
-
37
- var aParametersToLoad = [];
38
-
39
- var aCallbackRegistry = [];
40
-
41
- var sBootstrapOrigin = new URI(sap.ui.require.toUrl(""), document.baseURI).origin();
42
- var mOriginsNeedingCredentials = {};
43
-
44
- // match a CSS url
45
- var rCssUrl = /url[\s]*\('?"?([^\'")]*)'?"?\)/;
46
-
47
- var bUseInlineParameters = new URLSearchParams(window.location.search).get("sap-ui-xx-no-inline-theming-parameters") !== "true";
48
-
49
- /**
50
- * Resolves relative URLs in parameter values.
51
- * Only for inline-parameters.
52
- *
53
- * Parameters containing CSS URLs will automatically be resolved to the theme-specific location they originate from.
54
- *
55
- * Example:
56
- * A parameter for the "sap_horizon" theme will be resolved to a libraries "[library path...]/themes/sap_horizon" folder.
57
- * Relative URLs can resolve backwards, too, so given the sample above, a parameter value of <code>url('../my_logo.jpeg')</code>
58
- * will resolve to the "[library path...]/themes" folder.
59
- *
60
- * @param {string} sUrl the relative URL to resolve
61
- * @param {string} sThemeBaseUrl the theme base URL, pointing to the library that contains the parameter
62
- * @returns {string} the resolved URL in CSS URL notation
63
- */
64
- function checkAndResolveRelativeUrl(sUrl, sThemeBaseUrl) {
65
- var aMatch = rCssUrl.exec(sUrl);
66
- if (aMatch) {
67
- var oUri = new URI(aMatch[1]);
68
- if (oUri.is("relative")) {
69
- // Rewrite relative URLs based on the theme base url
70
- // Otherwise they would be relative to the HTML page which is incorrect
71
- var sNormalizedUrl = oUri.absoluteTo(sThemeBaseUrl).normalize().toString();
72
- sUrl = "url('" + sNormalizedUrl + "')";
73
- }
27
+ const syncCallBehavior = sap.ui.loader._.getSyncCallBehavior();
28
+ const { attachChange } = OwnStatics.get(Theming);
29
+ const { getAllLibraryInfoObjects } = OwnStatics.get(ThemeManager);
30
+
31
+ /**
32
+ * A helper used for (read-only) access to CSS parameters at runtime.
33
+ *
34
+ * @author SAP SE
35
+ * @namespace
36
+ *
37
+ * @public
38
+ * @alias sap.ui.core.theming.Parameters
39
+ */
40
+ var Parameters = {};
41
+
42
+ var mParameters = null;
43
+ var sTheme = null;
44
+
45
+ var aParametersToLoad = [...getAllLibraryInfoObjects().keys()];
46
+
47
+ var aCallbackRegistry = [];
48
+
49
+ var sBootstrapOrigin = new URI(sap.ui.require.toUrl(""), document.baseURI).origin();
50
+ var mOriginsNeedingCredentials = {};
51
+
52
+ // match a CSS url
53
+ var rCssUrl = /url[\s]*\('?"?([^\'")]*)'?"?\)/;
54
+
55
+ /**
56
+ * Resolves relative URLs in parameter values.
57
+ * Only for inline-parameters.
58
+ *
59
+ * Parameters containing CSS URLs will automatically be resolved to the theme-specific location they originate from.
60
+ *
61
+ * Example:
62
+ * A parameter for the "sap_horizon" theme will be resolved to a libraries "[library path...]/themes/sap_horizon" folder.
63
+ * Relative URLs can resolve backwards, too, so given the sample above, a parameter value of <code>url('../my_logo.jpeg')</code>
64
+ * will resolve to the "[library path...]/themes" folder.
65
+ *
66
+ * @param {string} sUrl the relative URL to resolve
67
+ * @param {string} sThemeBaseUrl the theme base URL, pointing to the library that contains the parameter
68
+ * @returns {string} the resolved URL in CSS URL notation
69
+ */
70
+ function checkAndResolveRelativeUrl(sUrl, sThemeBaseUrl) {
71
+ var aMatch = rCssUrl.exec(sUrl);
72
+ if (aMatch) {
73
+ var oUri = new URI(aMatch[1]);
74
+ if (oUri.is("relative")) {
75
+ // Rewrite relative URLs based on the theme base url
76
+ // Otherwise they would be relative to the HTML page which is incorrect
77
+ var sNormalizedUrl = oUri.absoluteTo(sThemeBaseUrl).normalize().toString();
78
+ sUrl = "url('" + sNormalizedUrl + "')";
74
79
  }
75
-
76
- return sUrl;
77
80
  }
78
81
 
79
- function mergeParameterSet(mCurrent, mNew, sThemeBaseUrl) {
80
- for (var sParam in mNew) {
81
- if (typeof mCurrent[sParam] === "undefined") {
82
- mCurrent[sParam] = checkAndResolveRelativeUrl(mNew[sParam], sThemeBaseUrl);
83
- }
82
+ return sUrl;
83
+ }
84
+
85
+ function mergeParameterSet(mCurrent, mNew, sThemeBaseUrl) {
86
+ for (var sParam in mNew) {
87
+ if (typeof mCurrent[sParam] === "undefined") {
88
+ mCurrent[sParam] = checkAndResolveRelativeUrl(mNew[sParam], sThemeBaseUrl);
84
89
  }
85
- return mCurrent;
86
90
  }
91
+ return mCurrent;
92
+ }
87
93
 
88
- function mergeParameters(mNewParameters, sThemeBaseUrl) {
94
+ function mergeParameters(mNewParameters, sThemeBaseUrl) {
89
95
 
90
- // normalize parameter maps
91
- // scoped themes like sap_belize already provide nested objects:
92
- if (typeof mNewParameters["default"] !== "object") {
93
- mNewParameters = {
94
- "default": mNewParameters,
95
- "scopes": {}
96
- };
97
- }
96
+ // normalize parameter maps
97
+ // scoped themes like sap_belize already provide nested objects:
98
+ if (typeof mNewParameters["default"] !== "object") {
99
+ mNewParameters = {
100
+ "default": mNewParameters,
101
+ "scopes": {}
102
+ };
103
+ }
98
104
 
99
- // ensure parameters objects
100
- mParameters = mParameters || {};
101
- mParameters["default"] = mParameters["default"] || {};
102
- mParameters["scopes"] = mParameters["scopes"] || {};
103
-
104
- // merge default parameters
105
- mergeParameterSet(mParameters["default"], mNewParameters["default"], sThemeBaseUrl);
106
-
107
- // merge scopes
108
- if (typeof mNewParameters["scopes"] === "object") {
109
- for (var sScopeName in mNewParameters["scopes"]) {
110
- // ensure scope object
111
- mParameters["scopes"][sScopeName] = mParameters["scopes"][sScopeName] || {};
112
- // merge scope set
113
- mergeParameterSet(mParameters["scopes"][sScopeName], mNewParameters["scopes"][sScopeName], sThemeBaseUrl);
114
- }
105
+ // ensure parameters objects
106
+ mParameters = mParameters || {};
107
+ mParameters["default"] = mParameters["default"] || {};
108
+ mParameters["scopes"] = mParameters["scopes"] || {};
109
+
110
+ // merge default parameters
111
+ mergeParameterSet(mParameters["default"], mNewParameters["default"], sThemeBaseUrl);
112
+
113
+ // merge scopes
114
+ if (typeof mNewParameters["scopes"] === "object") {
115
+ for (var sScopeName in mNewParameters["scopes"]) {
116
+ // ensure scope object
117
+ mParameters["scopes"][sScopeName] = mParameters["scopes"][sScopeName] || {};
118
+ // merge scope set
119
+ mergeParameterSet(mParameters["scopes"][sScopeName], mNewParameters["scopes"][sScopeName], sThemeBaseUrl);
115
120
  }
116
121
  }
122
+ }
117
123
 
118
- function forEachStyleSheet(fnCallback) {
119
- document.querySelectorAll("link[id^=sap-ui-theme-]").forEach(function(linkNode) {
120
- fnCallback(linkNode.getAttribute("id"));
121
- });
124
+ function forEachStyleSheet(fnCallback) {
125
+ for (const [libId, libInfo] of getAllLibraryInfoObjects()) {
126
+ fnCallback(libId, libInfo);
122
127
  }
128
+ }
123
129
 
124
- function parseParameters(sId, bAsync) {
125
- var oUrl = getThemeBaseUrlForId(sId);
130
+ function parseParameters(libInfo, bAsync) {
131
+ var oUrl = getThemeBaseUrlForId(libInfo);
126
132
 
127
- var bThemeApplied = ThemeHelper.checkAndRemoveStyle({ id: sId });
133
+ var bThemeApplied = libInfo.finishedLoading;
128
134
 
129
- if (!bThemeApplied && !bAsync) {
130
- Log.warning("Parameters have been requested but theme is not applied, yet.", "sap.ui.core.theming.Parameters");
131
- }
135
+ if (!bThemeApplied && !bAsync) {
136
+ Log.warning("Parameters have been requested but theme is not applied, yet.", "sap.ui.core.theming.Parameters");
137
+ }
132
138
 
133
- // In some browsers (e.g. Safari) it might happen that after switching the theme or adopting the <link>'s href,
134
- // the parameters from the previous stylesheet are taken. This can be prevented by checking whether the theme is applied.
135
- if (bThemeApplied && bUseInlineParameters) {
136
- var oLink = document.getElementById(sId);
137
- var sDataUri = window.getComputedStyle(oLink).getPropertyValue("background-image");
138
- var aParams = /\(["']?data:text\/plain;utf-8,(.*?)['"]?\)$/i.exec(sDataUri);
139
- if (aParams && aParams.length >= 2) {
140
- var sParams = aParams[1];
141
- // decode only if necessary
142
- if (sParams.charAt(0) !== "{" && sParams.charAt(sParams.length - 1) !== "}") {
143
- try {
144
- sParams = decodeURIComponent(sParams);
145
- } catch (ex) {
146
- future.warningThrows("Could not decode theme parameters URI from " + oUrl.styleSheetUrl, { cause: ex });
147
- }
148
- }
139
+ // In some browsers (e.g. Safari) it might happen that after switching the theme or adopting the <link>'s href,
140
+ // the parameters from the previous stylesheet are taken. This can be prevented by checking whether the theme is applied.
141
+ if (bThemeApplied) {
142
+ var oLink = document.getElementById(libInfo.linkId);
143
+ var sDataUri = window.getComputedStyle(oLink).getPropertyValue("background-image");
144
+ var aParams = /\(["']?data:text\/plain;utf-8,(.*?)['"]?\)$/i.exec(sDataUri);
145
+ if (aParams && aParams.length >= 2) {
146
+ var sParams = aParams[1];
147
+ // decode only if necessary
148
+ if (sParams.charAt(0) !== "{" && sParams.charAt(sParams.length - 1) !== "}") {
149
149
  try {
150
- var oParams = JSON.parse(sParams);
151
- mergeParameters(oParams, oUrl.themeBaseUrl);
152
- return true; // parameters successfully parsed
150
+ sParams = decodeURIComponent(sParams);
153
151
  } catch (ex) {
154
- future.warningThrows("Could not parse theme parameters from " + oUrl.styleSheetUrl + ".", { cause: ex , suffix: "Loading library-parameters.json as fallback solution." });
152
+ future.warningThrows("Could not decode theme parameters URI from " + oUrl.styleSheetUrl, { cause: ex });
155
153
  }
156
154
  }
155
+ try {
156
+ var oParams = JSON.parse(sParams);
157
+ mergeParameters(oParams, oUrl.themeBaseUrl);
158
+ return true; // parameters successfully parsed
159
+ } catch (ex) {
160
+ future.warningThrows("Could not parse theme parameters from " + oUrl.styleSheetUrl + ".", { cause: ex , suffix: "Loading library-parameters.json as fallback solution." });
161
+ }
157
162
  }
158
- // sync: return false if parameter could not be parsed OR theme is not applied OR library has no parameters
159
- // For sync path this triggers a sync library-parameters.json request as fallback
160
- // async: always return bThemeApplied. Issues during parsing are not relevant for further processing because
161
- // there is no fallback as in the sync case
162
- return bAsync ? bThemeApplied : false;
163
163
  }
164
+ // sync: return false if parameter could not be parsed OR theme is not applied OR library has no parameters
165
+ // For sync path this triggers a sync library-parameters.json request as fallback
166
+ // async: always return bThemeApplied. Issues during parsing are not relevant for further processing because
167
+ // there is no fallback as in the sync case
168
+ return bAsync ? bThemeApplied : false;
169
+ }
170
+
171
+ /**
172
+ * Load parameters for a library/theme combination as identified by the URL of the library.css
173
+ * @param {object} libInfo Library info object from ThemeManager
174
+ */
175
+ function loadParameters(libInfo) {
176
+ var oUrl = getThemeBaseUrlForId(libInfo);
177
+
178
+ // try to parse the inline-parameters for the given library
179
+ // this may fail for a number of reasons, see below
180
+ if (!parseParameters(libInfo)) {
181
+ // derive parameter file URL from CSS file URL
182
+ // $1: name of library (incl. variants)
183
+ // $2: additional parameters, e.g. for sap-ui-merged, version/sap-ui-dist-version
184
+ var sUrl = oUrl.styleSheetUrl.replace(/\/(?:css_variables|library)([^\/.]*)\.(?:css|less)($|[?#])/, function($0, $1, $2) {
185
+ return "/library-parameters.json" + ($2 ? $2 : "");
186
+ });
164
187
 
165
- /**
166
- * Load parameters for a library/theme combination as identified by the URL of the library.css
167
- * @param {string} sId the library name for which parameters might be loaded
168
- */
169
- function loadParameters(sId) {
170
- var oUrl = getThemeBaseUrlForId(sId);
171
-
172
- // try to parse the inline-parameters for the given library
173
- // this may fail for a number of reasons, see below
174
- if (!parseParameters(sId)) {
175
- // derive parameter file URL from CSS file URL
176
- // $1: name of library (incl. variants)
177
- // $2: additional parameters, e.g. for sap-ui-merged, version/sap-ui-dist-version
178
- var sUrl = oUrl.styleSheetUrl.replace(/\/(?:css_variables|library)([^\/.]*)\.(?:css|less)($|[?#])/, function($0, $1, $2) {
179
- return "/library-parameters.json" + ($2 ? $2 : "");
180
- });
181
-
182
- if (syncCallBehavior === 2) {
183
- Log.error("[nosync] Loading library-parameters.json ignored", sUrl, "sap.ui.core.theming.Parameters");
184
- return;
185
- } else if (syncCallBehavior === 1) {
186
- Log.error("[nosync] Loading library-parameters.json with sync XHR", sUrl, "sap.ui.core.theming.Parameters");
187
- }
188
+ if (syncCallBehavior === 2) {
189
+ Log.error("[nosync] Loading library-parameters.json ignored", sUrl, "sap.ui.core.theming.Parameters");
190
+ return;
191
+ } else if (syncCallBehavior === 1) {
192
+ Log.error("[nosync] Loading library-parameters.json with sync XHR", sUrl, "sap.ui.core.theming.Parameters");
193
+ }
188
194
 
189
- // check if we need to send credentials
190
- var sThemeOrigin = new URI(oUrl.themeBaseUrl).origin();
191
- var bWithCredentials = mOriginsNeedingCredentials[sThemeOrigin];
192
- var aWithCredentials = [];
193
-
194
- // initially we don't have any information if the target origin needs credentials or not ...
195
- if (bWithCredentials === undefined) {
196
- // ... so we assume that for all cross-origins except the UI5 bootstrap we need credentials.
197
- // Setting the XHR's "withCredentials" flag does not do anything for same origin requests.
198
- if (sUrl.startsWith(sBootstrapOrigin)) {
199
- aWithCredentials = [false, true];
200
- } else {
201
- aWithCredentials = [true, false];
202
- }
195
+ // check if we need to send credentials
196
+ var sThemeOrigin = new URI(oUrl.themeBaseUrl).origin();
197
+ var bWithCredentials = mOriginsNeedingCredentials[sThemeOrigin];
198
+ var aWithCredentials = [];
199
+
200
+ // initially we don't have any information if the target origin needs credentials or not ...
201
+ if (bWithCredentials === undefined) {
202
+ // ... so we assume that for all cross-origins except the UI5 bootstrap we need credentials.
203
+ // Setting the XHR's "withCredentials" flag does not do anything for same origin requests.
204
+ if (sUrl.startsWith(sBootstrapOrigin)) {
205
+ aWithCredentials = [false, true];
203
206
  } else {
204
- aWithCredentials = [bWithCredentials];
207
+ aWithCredentials = [true, false];
205
208
  }
206
-
207
- // trigger a sync. loading of the parameters.json file
208
- loadParametersJSON(sUrl, oUrl.themeBaseUrl, aWithCredentials);
209
+ } else {
210
+ aWithCredentials = [bWithCredentials];
209
211
  }
212
+
213
+ // trigger a sync. loading of the parameters.json file
214
+ loadParametersJSON(sUrl, oUrl.themeBaseUrl, aWithCredentials);
210
215
  }
216
+ }
211
217
 
212
- function getThemeBaseUrlForId (sId) {
213
- // read inline parameters from css style rule
214
- // (can be switched off for testing purposes via private URI parameter "sap-ui-xx-no-inline-theming-parameters=true")
215
- var oLink = document.getElementById(sId);
218
+ function getThemeBaseUrlForId (libInfo) {
219
+ if (!libInfo.getUrl().url && !libInfo.cssLinkElement) {
220
+ future.warningThrows(`sap.ui.core.theming.Parameters: Could not find stylesheet element with ID "${libInfo.id}"`);
221
+ return undefined;
222
+ }
216
223
 
217
- if (!oLink) {
218
- future.warningThrows(`sap.ui.core.theming.Parameters: Could not find stylesheet element with ID "${sId}"`);
219
- return undefined;
220
- }
224
+ var sStyleSheetUrl = libInfo.getUrl().url || libInfo.cssLinkElement?.getAttribute("href");
221
225
 
222
- var sStyleSheetUrl = oLink.href;
226
+ // Remove CSS file name and query to create theme base url (to resolve relative urls)
227
+ return {
228
+ themeBaseUrl: new URI(sStyleSheetUrl).filename("").query("").toString(),
229
+ styleSheetUrl : sStyleSheetUrl
230
+ };
231
+ }
232
+
233
+ /**
234
+ * Loads a parameters.json file from given URL.
235
+ * @param {string} sUrl URL
236
+ * @param {string} sThemeBaseUrl Base URL
237
+ * @param {boolean[]} aWithCredentials probing values for requesting with or without credentials
238
+ */
239
+ function loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials) {
240
+ var oHeaders = {
241
+ Accept: syncFetch.ContentTypes.JSON
242
+ };
223
243
 
224
- // Remove CSS file name and query to create theme base url (to resolve relative urls)
225
- return {
226
- themeBaseUrl: new URI(sStyleSheetUrl).filename("").query("").toString(),
227
- styleSheetUrl : sStyleSheetUrl
228
- };
244
+ var bCurrentWithCredentials = aWithCredentials.shift();
245
+ if (bCurrentWithCredentials) {
246
+ // the X-Requested-With Header is essential for the Theming-Service to determine if a GET request will be handled
247
+ // This forces a preflight request which should give us valid Allow headers:
248
+ // Access-Control-Allow-Origin: ... fully qualified requestor origin ...
249
+ // Access-Control-Allow-Credentials: true
250
+ oHeaders["X-Requested-With"] = "XMLHttpRequest";
229
251
  }
230
252
 
231
- /**
232
- * Loads a parameters.json file from given URL.
233
- * @param {string} sUrl URL
234
- * @param {string} sThemeBaseUrl Base URL
235
- * @param {boolean[]} aWithCredentials probing values for requesting with or without credentials
236
- */
237
- function loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials) {
238
- var oHeaders = {
239
- Accept: syncFetch.ContentTypes.JSON
240
- };
241
-
242
- var bCurrentWithCredentials = aWithCredentials.shift();
243
- if (bCurrentWithCredentials) {
244
- // the X-Requested-With Header is essential for the Theming-Service to determine if a GET request will be handled
245
- // This forces a preflight request which should give us valid Allow headers:
246
- // Access-Control-Allow-Origin: ... fully qualified requestor origin ...
247
- // Access-Control-Allow-Credentials: true
248
- oHeaders["X-Requested-With"] = "XMLHttpRequest";
249
- }
250
-
251
- function fnErrorCallback(error) {
252
- // ignore failure at least temporarily as long as there are libraries built using outdated tools which produce no json file
253
- future.errorThrows("Could not load theme parameters from: " + sUrl, { cause: error }); // could be an error as well, but let's avoid more CSN messages...
254
-
255
- if (aWithCredentials.length > 0) {
256
- // In a CORS scenario, IF we have sent credentials on the first try AND the request failed,
257
- // we expect that a service could have answered with the following Allow header:
258
- // Access-Control-Allow-Origin: *
259
- // In this case we must not send credentials, otherwise the service would have answered with:
260
- // Access-Control-Allow-Origin: https://...
261
- // Access-Control-Allow-Credentials: true
262
- // Due to security constraints, the browser does not hand out any more information in a CORS scenario,
263
- // so now we try again without credentials.
264
- Log.warning("Initial library-parameters.json request failed ('withCredentials=" + bCurrentWithCredentials + "'; sUrl: '" + sUrl + "').\n" +
265
- "Retrying with 'withCredentials=" + !bCurrentWithCredentials + "'.", "sap.ui.core.theming.Parameters");
266
- loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials);
267
- }
253
+ function fnErrorCallback(error) {
254
+ // ignore failure at least temporarily as long as there are libraries built using outdated tools which produce no json file
255
+ future.errorThrows("Could not load theme parameters from: " + sUrl, { cause: error }); // could be an error as well, but let's avoid more CSN messages...
256
+
257
+ if (aWithCredentials.length > 0) {
258
+ // In a CORS scenario, IF we have sent credentials on the first try AND the request failed,
259
+ // we expect that a service could have answered with the following Allow header:
260
+ // Access-Control-Allow-Origin: *
261
+ // In this case we must not send credentials, otherwise the service would have answered with:
262
+ // Access-Control-Allow-Origin: https://...
263
+ // Access-Control-Allow-Credentials: true
264
+ // Due to security constraints, the browser does not hand out any more information in a CORS scenario,
265
+ // so now we try again without credentials.
266
+ Log.warning("Initial library-parameters.json request failed ('withCredentials=" + bCurrentWithCredentials + "'; sUrl: '" + sUrl + "').\n" +
267
+ "Retrying with 'withCredentials=" + !bCurrentWithCredentials + "'.", "sap.ui.core.theming.Parameters");
268
+ loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials);
268
269
  }
270
+ }
269
271
 
270
- // load and evaluate parameter file
271
- try {
272
- var response = syncFetch(sUrl, {
273
- credentials: bCurrentWithCredentials ? "include" : "omit",
274
- headers: oHeaders
275
- });
276
- if (response.ok) {
277
- var data = response.json();
278
- // Once we have a successful request we track the credentials setting for this origin
279
- var sThemeOrigin = new URI(sThemeBaseUrl).origin();
280
- mOriginsNeedingCredentials[sThemeOrigin] = bCurrentWithCredentials;
281
-
282
- if (Array.isArray(data)) {
283
- // in the sap-ui-merged use case, multiple JSON files are merged into and transferred as a single JSON array
284
- for (var j = 0; j < data.length; j++) {
285
- var oParams = data[j];
286
- mergeParameters(oParams, sThemeBaseUrl);
287
- }
288
- } else {
289
- mergeParameters(data, sThemeBaseUrl);
272
+ // load and evaluate parameter file
273
+ try {
274
+ var response = syncFetch(sUrl, {
275
+ credentials: bCurrentWithCredentials ? "include" : "omit",
276
+ headers: oHeaders
277
+ });
278
+ if (response.ok) {
279
+ var data = response.json();
280
+ // Once we have a successful request we track the credentials setting for this origin
281
+ var sThemeOrigin = new URI(sThemeBaseUrl).origin();
282
+ mOriginsNeedingCredentials[sThemeOrigin] = bCurrentWithCredentials;
283
+
284
+ if (Array.isArray(data)) {
285
+ // in the sap-ui-merged use case, multiple JSON files are merged into and transferred as a single JSON array
286
+ for (var j = 0; j < data.length; j++) {
287
+ var oParams = data[j];
288
+ mergeParameters(oParams, sThemeBaseUrl);
290
289
  }
291
290
  } else {
292
- throw new Error(response.statusText || response.status);
291
+ mergeParameters(data, sThemeBaseUrl);
293
292
  }
294
-
295
- } catch (error) {
296
- fnErrorCallback(error);
297
- }
298
- }
299
-
300
- /**
301
- * Retrieves a map containing all inline-parameters.
302
- *
303
- * @param {boolean} bAsync=undefined whether to load and parse the parameters asynchronously, default sync
304
- * @returns {object} a map of all parameters
305
- */
306
- function getParameters(bAsync) {
307
- // Initial loading
308
- if (!mParameters) {
309
- // Merge an empty parameter set to initialize the internal object
310
- mergeParameters({}, "");
311
-
312
- forEachStyleSheet(function (sId) {
313
- if (bAsync) {
314
- if (!parseParameters(sId, bAsync)) {
315
- aParametersToLoad.push(sId);
316
- }
317
- } else {
318
- loadParameters(sId);
319
- }
320
- });
293
+ } else {
294
+ throw new Error(response.statusText || response.status);
321
295
  }
322
296
 
323
- return mParameters;
297
+ } catch (error) {
298
+ fnErrorCallback(error);
324
299
  }
325
-
326
- function parsePendingLibraryParameters() {
327
- var aPendingThemes = [];
328
-
329
- aParametersToLoad.forEach(function (sId) {
330
- // Try to parse parameters (in case theme is already applied). Else keep parameter ID for later
331
- if (!parseParameters(sId, /*bAsync=*/true)) {
332
- aPendingThemes.push(sId);
300
+ }
301
+
302
+ /**
303
+ * Retrieves a map containing all inline-parameters.
304
+ *
305
+ * @param {boolean} bAsync=undefined whether to load and parse the parameters asynchronously, default sync
306
+ * @returns {object} a map of all parameters
307
+ */
308
+ function getParameters(bAsync) {
309
+ // Initial loading
310
+ if (!mParameters) {
311
+ // Merge an empty parameter set to initialize the internal object
312
+ mergeParameters({}, "");
313
+
314
+ forEachStyleSheet(function (libId, libInfo) {
315
+ if (bAsync) {
316
+ if (!parseParameters(libInfo, bAsync)) {
317
+ aParametersToLoad.push(libId);
318
+ }
319
+ } else {
320
+ loadParameters(libInfo);
333
321
  }
334
322
  });
335
-
336
- // Keep theme IDs which are not ready for later
337
- aParametersToLoad = aPendingThemes;
338
323
  }
339
324
 
340
- /**
341
- * Loads library-parameters.json files if some libraries are missing.
342
- */
343
- function loadPendingLibraryParameters() {
344
- // lazy loading of further library parameters
345
- aParametersToLoad.forEach(loadParameters);
346
-
347
- // clear queue
348
- aParametersToLoad = [];
349
- }
325
+ return mParameters;
326
+ }
350
327
 
351
- /**
352
- * Called by the Core when a new library and its stylesheet have been loaded.
353
- * Must be called AFTER a link-tag (with id: "sap-ui-theme" + sLibName) for the theme has been created.
354
- * @param {string} sLibId id of theme link-tag
355
- * @private
356
- */
357
- Parameters._addLibraryTheme = function(sLibId) {
358
- // only queue new libraries if some have been loaded already
359
- // otherwise they will be loaded when the first one requests a parameter
360
- // see "Parameters.get" for lazy loading of queued library parameters
361
- if (mParameters) {
362
- aParametersToLoad.push("sap-ui-theme-" + sLibId);
363
- }
364
- };
328
+ function parsePendingLibraryParameters() {
329
+ var aPendingThemes = [];
365
330
 
366
- /**
367
- * Returns parameter value from given map and handles legacy parameter names
368
- *
369
- * @param {object} mOptions options map
370
- * @param {string} mOptions.parameterName Parameter name / key
371
- * @param {string} mOptions.scopeName Scope name
372
- * @param {boolean} mOptions.loadPendingParameters If set to "true" and no parameter value is found,
373
- * all pending parameters will be loaded (see Parameters._addLibraryTheme)
374
- * @param {boolean} mOptions.async whether the parameter value should be retrieved asynchronous
375
- * @returns {string|undefined} parameter value or undefined
376
- * @private
377
- */
378
- function getParam(mOptions) {
379
- var bAsync = mOptions.async, oParams = getParameters(bAsync);
380
- if (mOptions.scopeName) {
381
- oParams = oParams["scopes"][mOptions.scopeName];
382
- } else {
383
- oParams = oParams["default"];
331
+ aParametersToLoad.forEach(function (sId) {
332
+ // Try to parse parameters (in case theme is already applied). Else keep parameter ID for later
333
+ if (!parseParameters(getAllLibraryInfoObjects(sId), /*bAsync=*/true)) {
334
+ aPendingThemes.push(sId);
384
335
  }
336
+ });
337
+
338
+ // Keep theme IDs which are not ready for later
339
+ aParametersToLoad = aPendingThemes;
340
+ }
341
+
342
+ /**
343
+ * Loads library-parameters.json files if some libraries are missing.
344
+ */
345
+ function loadPendingLibraryParameters() {
346
+ // lazy loading of further library parameters
347
+ aParametersToLoad.map((id) => getAllLibraryInfoObjects(id)).forEach(loadParameters);
348
+
349
+ // clear queue
350
+ aParametersToLoad = [];
351
+ }
352
+
353
+ /**
354
+ * Called by the Core when a new library and its stylesheet have been loaded.
355
+ * Must be called AFTER a link-tag (with id: "sap-ui-theme" + sLibName) for the theme has been created.
356
+ * @param {string} sLibId id of theme link-tag
357
+ * @private
358
+ */
359
+ Parameters._addLibraryTheme = function(sLibId) {
360
+ aParametersToLoad.push(sLibId);
361
+ };
362
+
363
+ /**
364
+ * Returns parameter value from given map and handles legacy parameter names
365
+ *
366
+ * @param {object} mOptions options map
367
+ * @param {string} mOptions.parameterName Parameter name / key
368
+ * @param {string} mOptions.scopeName Scope name
369
+ * @param {boolean} mOptions.loadPendingParameters If set to "true" and no parameter value is found,
370
+ * all pending parameters will be loaded (see Parameters._addLibraryTheme)
371
+ * @param {boolean} mOptions.async whether the parameter value should be retrieved asynchronous
372
+ * @returns {string|undefined} parameter value or undefined
373
+ * @private
374
+ */
375
+ function getParam(mOptions) {
376
+ var bAsync = mOptions.async, oParams = getParameters(bAsync);
377
+ if (mOptions.scopeName) {
378
+ oParams = oParams["scopes"][mOptions.scopeName];
379
+ } else {
380
+ oParams = oParams["default"];
381
+ }
385
382
 
386
- var sParamValue = oParams[mOptions.parameterName];
383
+ var sParamValue = oParams[mOptions.parameterName];
387
384
 
388
- // [Compatibility]: if a parameter contains a prefix, we cut off the ":" and try again
389
- // e.g. "my.lib:paramName"
390
- if (!sParamValue) {
391
- var iIndex = mOptions.parameterName.indexOf(":");
392
- if (iIndex != -1) {
393
- var sParamNameWithoutColon = mOptions.parameterName.substr(iIndex + 1);
394
- sParamValue = oParams[sParamNameWithoutColon];
395
- }
385
+ // [Compatibility]: if a parameter contains a prefix, we cut off the ":" and try again
386
+ // e.g. "my.lib:paramName"
387
+ if (!sParamValue) {
388
+ var iIndex = mOptions.parameterName.indexOf(":");
389
+ if (iIndex != -1) {
390
+ var sParamNameWithoutColon = mOptions.parameterName.substr(iIndex + 1);
391
+ sParamValue = oParams[sParamNameWithoutColon];
396
392
  }
393
+ }
397
394
 
398
- // Sync: Fallback path for when parameter could not be found so far, library.css MIGHT be not loaded
399
- if (mOptions.loadPendingParameters && typeof sParamValue === "undefined" && !bAsync) {
400
- // Include library theme in case it's not already done, since link tag for library
401
- // is added asynchronous after initLibrary has been executed
402
- var aAllLibrariesRequireCss = Library.getAllInstancesRequiringCss();
403
- aAllLibrariesRequireCss.forEach(function (oLibThemingInfo) {
404
- ThemeManager._includeLibraryThemeAndEnsureThemeRoot(oLibThemingInfo);
405
- });
406
-
407
- loadPendingLibraryParameters();
408
- sParamValue = getParam({
409
- parameterName: mOptions.parameterName,
410
- scopeName: mOptions.scopeName,
411
- loadPendingParameters: false // prevent recursion
412
- });
413
- }
395
+ // Sync: Fallback path for when parameter could not be found so far, library.css MIGHT be not loaded
396
+ if (mOptions.loadPendingParameters && typeof sParamValue === "undefined" && !bAsync) {
397
+ loadPendingLibraryParameters();
414
398
 
415
- return sParamValue;
399
+ sParamValue = getParam({
400
+ parameterName: mOptions.parameterName,
401
+ scopeName: mOptions.scopeName,
402
+ loadPendingParameters: false // prevent recursion
403
+ });
416
404
  }
417
405
 
418
- function getParamForActiveScope(sParamName, oElement, bAsync) {
419
- // check for scopes and try to find the classes in Control Tree
420
- var aScopeChain = Parameters.getActiveScopesFor(oElement, bAsync);
406
+ return sParamValue;
407
+ }
421
408
 
422
- var aFilteredScopeChain = aScopeChain.flat().reduce(function (aResult, sScope) {
423
- if (aResult.indexOf(sScope) === -1) {
424
- aResult.push(sScope);
425
- }
426
- return aResult;
427
- }, []);
409
+ function getParamForActiveScope(sParamName, oElement, bAsync) {
410
+ // check for scopes and try to find the classes in Control Tree
411
+ var aScopeChain = Parameters.getActiveScopesFor(oElement, bAsync);
428
412
 
429
- for (var i = 0; i < aFilteredScopeChain.length; i++) {
430
- var sScopeName = aFilteredScopeChain[i];
413
+ var aFilteredScopeChain = aScopeChain.flat().reduce(function (aResult, sScope) {
414
+ if (aResult.indexOf(sScope) === -1) {
415
+ aResult.push(sScope);
416
+ }
417
+ return aResult;
418
+ }, []);
431
419
 
432
- var sParamValue = getParam({
433
- parameterName: sParamName,
434
- scopeName: sScopeName,
435
- async: bAsync
436
- });
420
+ for (var i = 0; i < aFilteredScopeChain.length; i++) {
421
+ var sScopeName = aFilteredScopeChain[i];
437
422
 
438
- if (sParamValue) {
439
- return sParamValue;
440
- }
441
- }
442
- // if no matching scope was found return the default parameter
443
- return getParam({
423
+ var sParamValue = getParam({
444
424
  parameterName: sParamName,
425
+ scopeName: sScopeName,
445
426
  async: bAsync
446
427
  });
447
- }
448
428
 
449
- /**
450
- * Returns the scopes from current theming parameters.
451
- *
452
- * @private
453
- * @ui5-restricted sap.ui.core
454
- * @param {boolean} [bAvoidLoading] Whether loading of parameters should be avoided
455
- * @param {boolean} [bAsync] Whether loading of parameters should be asynchronous
456
- * @return {string[]|undefined} Scope names
457
- */
458
- Parameters._getScopes = function(bAvoidLoading, bAsync) {
459
- if ( bAvoidLoading && !mParameters ) {
460
- return;
429
+ if (sParamValue) {
430
+ return sParamValue;
431
+ }
432
+ }
433
+ // if no matching scope was found return the default parameter
434
+ return getParam({
435
+ parameterName: sParamName,
436
+ async: bAsync
437
+ });
438
+ }
439
+
440
+ /**
441
+ * Returns the scopes from current theming parameters.
442
+ *
443
+ * @private
444
+ * @ui5-restricted sap.ui.core
445
+ * @param {boolean} [bAvoidLoading] Whether loading of parameters should be avoided
446
+ * @param {boolean} [bAsync] Whether loading of parameters should be asynchronous
447
+ * @return {string[]|undefined} Scope names
448
+ */
449
+ Parameters._getScopes = function(bAvoidLoading, bAsync) {
450
+ if ( bAvoidLoading && !mParameters ) {
451
+ return undefined;
452
+ }
453
+ var oParams = getParameters(bAsync);
454
+ var aScopes = Object.keys(oParams["scopes"]);
455
+ return aScopes;
456
+ };
457
+
458
+ /**
459
+ * Returns the active scope(s) for a given control by looking up the hierarchy.
460
+ *
461
+ * The lookup navigates the DOM hierarchy if it's available. Otherwise if controls aren't rendered yet,
462
+ * it navigates the control hierarchy. By navigating the control hierarchy, inner-html elements
463
+ * with the respective scope classes can't get recognized as the Custom Style Class API does only for
464
+ * root elements.
465
+ *
466
+ * @private
467
+ * @ui5-restricted sap.viz
468
+ * @param {object} oElement element/control instance
469
+ * @param {boolean} bAsync Whether the scope should be retrieved asynchronous
470
+ * @return {Array.<Array.<string>>} Two dimensional array with scopes in bottom up order
471
+ */
472
+ Parameters.getActiveScopesFor = function(oElement, bAsync) {
473
+ var aScopeChain = [];
474
+
475
+ if (oElement instanceof Element) {
476
+ var domRef = oElement.getDomRef();
477
+
478
+ // make sure to first load all pending parameters
479
+ // doing it later (lazy) might change the behavior in case a scope is initially not defined
480
+ if (bAsync) {
481
+ parsePendingLibraryParameters();
482
+ } else {
483
+ loadPendingLibraryParameters();
461
484
  }
462
- var oParams = getParameters(bAsync);
463
- var aScopes = Object.keys(oParams["scopes"]);
464
- return aScopes;
465
- };
466
-
467
- /**
468
- * Returns the active scope(s) for a given control by looking up the hierarchy.
469
- *
470
- * The lookup navigates the DOM hierarchy if it's available. Otherwise if controls aren't rendered yet,
471
- * it navigates the control hierarchy. By navigating the control hierarchy, inner-html elements
472
- * with the respective scope classes can't get recognized as the Custom Style Class API does only for
473
- * root elements.
474
- *
475
- * @private
476
- * @ui5-restricted sap.viz
477
- * @param {object} oElement element/control instance
478
- * @param {boolean} bAsync Whether the scope should be retrieved asynchronous
479
- * @return {Array.<Array.<string>>} Two dimensional array with scopes in bottom up order
480
- */
481
- Parameters.getActiveScopesFor = function(oElement, bAsync) {
482
- var aScopeChain = [];
483
485
 
484
- if (oElement instanceof Element) {
485
- var domRef = oElement.getDomRef();
486
+ // check for scopes and try to find the classes in parent chain
487
+ var aScopes = this._getScopes(undefined, bAsync);
486
488
 
487
- // make sure to first load all pending parameters
488
- // doing it later (lazy) might change the behavior in case a scope is initially not defined
489
- if (bAsync) {
490
- parsePendingLibraryParameters();
491
- } else {
492
- loadPendingLibraryParameters();
493
- }
489
+ if (aScopes.length) {
490
+ if (domRef) {
491
+ var fnNodeHasStyleClass = function(sScopeName) {
492
+ var scopeList = domRef.classList;
493
+ return scopeList && scopeList.contains(sScopeName);
494
+ };
494
495
 
495
- // check for scopes and try to find the classes in parent chain
496
- var aScopes = this._getScopes(undefined, bAsync);
497
-
498
- if (aScopes.length) {
499
- if (domRef) {
500
- var fnNodeHasStyleClass = function(sScopeName) {
501
- var scopeList = domRef.classList;
502
- return scopeList && scopeList.contains(sScopeName);
503
- };
504
-
505
- while (domRef) {
506
- var aFoundScopeClasses = aScopes.filter(fnNodeHasStyleClass);
507
- if (aFoundScopeClasses.length > 0) {
508
- aScopeChain.push(aFoundScopeClasses);
509
- }
510
- domRef = domRef.parentNode;
496
+ while (domRef) {
497
+ const aFoundScopeClasses = aScopes.filter(fnNodeHasStyleClass);
498
+ if (aFoundScopeClasses.length > 0) {
499
+ aScopeChain.push(aFoundScopeClasses);
511
500
  }
512
- } else {
513
- var fnControlHasStyleClass = function(sScopeName) {
514
- return typeof oElement.hasStyleClass === "function" && oElement.hasStyleClass(sScopeName);
515
- };
516
-
517
- while (oElement) {
518
- var aFoundScopeClasses = aScopes.filter(fnControlHasStyleClass);
519
- if (aFoundScopeClasses.length > 0) {
520
- aScopeChain.push(aFoundScopeClasses);
521
- }
522
- oElement = typeof oElement.getParent === "function" && oElement.getParent();
501
+ domRef = domRef.parentNode;
502
+ }
503
+ } else {
504
+ var fnControlHasStyleClass = function(sScopeName) {
505
+ return typeof oElement.hasStyleClass === "function" && oElement.hasStyleClass(sScopeName);
506
+ };
507
+
508
+ while (oElement) {
509
+ const aFoundScopeClasses = aScopes.filter(fnControlHasStyleClass);
510
+ if (aFoundScopeClasses.length > 0) {
511
+ aScopeChain.push(aFoundScopeClasses);
523
512
  }
513
+ oElement = typeof oElement.getParent === "function" && oElement.getParent();
524
514
  }
525
515
  }
526
516
  }
527
- return aScopeChain;
528
- };
529
-
530
- /**
531
- *
532
- * Theming Parameter Value
533
- *
534
- * @typedef {(string|Object<string,string>|undefined)} sap.ui.core.theming.Parameters.Value
535
- * @public
536
- */
517
+ }
518
+ return aScopeChain;
519
+ };
520
+
521
+ /**
522
+ *
523
+ * Theming Parameter Value
524
+ *
525
+ * @typedef {(string|Object<string,string>|undefined)} sap.ui.core.theming.Parameters.Value
526
+ * @public
527
+ */
528
+
529
+ /**
530
+ * <p>
531
+ * Returns the current value for one or more theming parameters, depending on the given arguments.
532
+ * The synchronous usage of this API has been deprecated and only the asynchronous usage should still be used
533
+ * (see the 4th bullet point and the code examples below).
534
+ * </p>
535
+ *
536
+ * <p>
537
+ * The theming parameters are immutable and cannot be changed at runtime.
538
+ * Multiple <code>Parameters.get()</code> API calls for the same parameter name will always result in the same parameter value.
539
+ * </p>
540
+ *
541
+ * <p>
542
+ * The following API variants are available (see also the below examples):
543
+ * <ul>
544
+ * <li> <b>(deprecated since 1.92)</b> If no parameter is given a key-value map containing all parameters is returned</li>
545
+ * <li> <b>(deprecated since 1.94)</b> If a <code>string</code> is given as first parameter the value is returned as a <code>string</code></li>
546
+ * <li> <b>(deprecated since 1.94)</b> If an <code>array</code> is given as first parameter a key-value map containing all parameters from the <code>array</code> is returned</li>
547
+ * <li>If an <code>object</code> is given as first parameter the result is returned immediately in case all parameters are loaded and available or within the callback in case not all CSS files are already loaded.
548
+ * This is the <b>only asynchronous</b> API variant. This variant is the preferred way to retrieve theming parameters.
549
+ * The structure of the return value is the same as listed above depending on the type of the name property within the <code>object</code>.</li>
550
+ * </ul>
551
+ * </p>
552
+ *
553
+ * <p>The returned key-value maps are a copy so changing values in the map does not have any effect</p>
554
+ *
555
+ * <p>
556
+ * Please see the examples below for a detailed guide on how to use the <b>asynchronous variant</b> of the API.
557
+ * </p>
558
+ *
559
+ * @example <caption>Scenario 1: Parameters are already available</caption>
560
+ * // "sapUiParam1", "sapUiParam2", "sapUiParam3" are already available
561
+ * Parameters.get({
562
+ * name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
563
+ * callback: function(mParams) {
564
+ * // callback is not called, since all Parameters are available synchronously
565
+ * }
566
+ * });
567
+ * // As described above, returns a map with key-value pairs corresponding to the parameters:
568
+ * // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
569
+ *
570
+ * @example <caption>Scenario 2: Some Parameters are missing </caption>
571
+ * // "sapUiParam1", "sapUiParam2" are already available
572
+ * // "sapUiParam3" is not yet available
573
+ * Parameters.get({
574
+ * name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
575
+ * callback: function(mParams) {
576
+ * // Parameters.get() callback gets the same map with key-value pairs as in "Scenario 1".
577
+ * // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
578
+ * }
579
+ * });
580
+ * // return-value is undefined, since not all Parameters are yet available synchronously
581
+ *
582
+ * @example <caption>Scenario 3: Default values</caption>
583
+ * // Scenario 1 (all parameters are available): the returned parameter map can be used to merge with a map of default values.
584
+ * // Scenario 2 (one or more parameters are missing): the returned undefined value does not change the default parameters
585
+ * // This allows you to always retrieve a consistent set of parameters, either synchronously via the return-value or asynchronously via the provided callback.
586
+ * var mMyParams = Object.assign({
587
+ * sapUiParam1: "1rem",
588
+ * sapUiParam2: "#FF0000",
589
+ * sapUiParam3: "16px"
590
+ * }, Parameters.get({
591
+ * name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
592
+ * callback: function(mParams) {
593
+ * // merge the current parameters with the actual parameters in case they are retrieved asynchronously
594
+ * Object.assign(mMyParams, mParams);
595
+ * }
596
+ * }));
597
+ *
598
+ * @param {string | string[] | object} vName the (array with) CSS parameter name(s) or an object containing the (array with) CSS parameter name(s),
599
+ * the scopeElement and a callback for async retrieval of parameters.
600
+ * @param {string | string[]} vName.name the (array with) CSS parameter name(s)
601
+ * @param {sap.ui.core.Element} [vName.scopeElement]
602
+ * Element / control instance to take into account when looking for a parameter value.
603
+ * This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
604
+ * @param {function(sap.ui.core.theming.Parameters.Value)} [vName.callback] If given, the callback is only executed in case there are still parameters pending and one or more of the requested parameters is missing.
605
+ * @param {sap.ui.core.Element} [oElement]
606
+ * Element / control instance to take into account when looking for a parameter value.
607
+ * This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
608
+ * @returns {sap.ui.core.theming.Parameters.Value} the CSS parameter value(s) or <code>undefined</code> if the parameters could not be retrieved.
609
+ *
610
+ * @public
611
+ */
612
+ Parameters.get = function(vName, oElement) {
613
+ let sParamName, fnAsyncCallback, bAsync, aNames, iIndex;
614
+
615
+ // Whether parameters containing CSS URLs should be parsed into regular URL strings,
616
+ // e.g. a parameter value of url('https://myapp.sample/image.jpeg') will be returned as "https://myapp.sample/image.jpeg".
617
+ // Empty strings as well as the special CSS value 'none' will be parsed to null.
618
+ let bParseUrls;
619
+
620
+ var findRegisteredCallback = function (oCallbackInfo) { return oCallbackInfo.callback === fnAsyncCallback; };
621
+
622
+ if (!sTheme) {
623
+ sTheme = Theming.getTheme();
624
+ }
537
625
 
538
626
  /**
539
- * <p>
540
- * Returns the current value for one or more theming parameters, depending on the given arguments.
541
- * The synchronous usage of this API has been deprecated and only the asynchronous usage should still be used
542
- * (see the 4th bullet point and the code examples below).
543
- * </p>
544
- *
545
- * <p>
546
- * The theming parameters are immutable and cannot be changed at runtime.
547
- * Multiple <code>Parameters.get()</code> API calls for the same parameter name will always result in the same parameter value.
548
- * </p>
549
- *
550
- * <p>
551
- * The following API variants are available (see also the below examples):
552
- * <ul>
553
- * <li> <b>(deprecated since 1.92)</b> If no parameter is given a key-value map containing all parameters is returned</li>
554
- * <li> <b>(deprecated since 1.94)</b> If a <code>string</code> is given as first parameter the value is returned as a <code>string</code></li>
555
- * <li> <b>(deprecated since 1.94)</b> If an <code>array</code> is given as first parameter a key-value map containing all parameters from the <code>array</code> is returned</li>
556
- * <li>If an <code>object</code> is given as first parameter the result is returned immediately in case all parameters are loaded and available or within the callback in case not all CSS files are already loaded.
557
- * This is the <b>only asynchronous</b> API variant. This variant is the preferred way to retrieve theming parameters.
558
- * The structure of the return value is the same as listed above depending on the type of the name property within the <code>object</code>.</li>
559
- * </ul>
560
- * </p>
561
- *
562
- * <p>The returned key-value maps are a copy so changing values in the map does not have any effect</p>
563
- *
564
- * <p>
565
- * Please see the examples below for a detailed guide on how to use the <b>asynchronous variant</b> of the API.
566
- * </p>
567
- *
568
- * @example <caption>Scenario 1: Parameters are already available</caption>
569
- * // "sapUiParam1", "sapUiParam2", "sapUiParam3" are already available
570
- * Parameters.get({
571
- * name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
572
- * callback: function(mParams) {
573
- * // callback is not called, since all Parameters are available synchronously
574
- * }
575
- * });
576
- * // As described above, returns a map with key-value pairs corresponding to the parameters:
577
- * // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
578
- *
579
- * @example <caption>Scenario 2: Some Parameters are missing </caption>
580
- * // "sapUiParam1", "sapUiParam2" are already available
581
- * // "sapUiParam3" is not yet available
582
- * Parameters.get({
583
- * name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
584
- * callback: function(mParams) {
585
- * // Parameters.get() callback gets the same map with key-value pairs as in "Scenario 1".
586
- * // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
587
- * }
588
- * });
589
- * // return-value is undefined, since not all Parameters are yet available synchronously
590
- *
591
- * @example <caption>Scenario 3: Default values</caption>
592
- * // Scenario 1 (all parameters are available): the returned parameter map can be used to merge with a map of default values.
593
- * // Scenario 2 (one or more parameters are missing): the returned undefined value does not change the default parameters
594
- * // This allows you to always retrieve a consistent set of parameters, either synchronously via the return-value or asynchronously via the provided callback.
595
- * var mMyParams = Object.assign({
596
- * sapUiParam1: "1rem",
597
- * sapUiParam2: "#FF0000",
598
- * sapUiParam3: "16px"
599
- * }, Parameters.get({
600
- * name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
601
- * callback: function(mParams) {
602
- * // merge the current parameters with the actual parameters in case they are retrieved asynchronously
603
- * Object.assign(mMyParams, mParams);
604
- * }
605
- * }));
606
- *
607
- * @param {string | string[] | object} vName the (array with) CSS parameter name(s) or an object containing the (array with) CSS parameter name(s),
608
- * the scopeElement and a callback for async retrieval of parameters.
609
- * @param {string | string[]} vName.name the (array with) CSS parameter name(s)
610
- * @param {sap.ui.core.Element} [vName.scopeElement]
611
- * Element / control instance to take into account when looking for a parameter value.
612
- * This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
613
- * @param {function(sap.ui.core.theming.Parameters.Value)} [vName.callback] If given, the callback is only executed in case there are still parameters pending and one or more of the requested parameters is missing.
614
- * @param {sap.ui.core.Element} [oElement]
615
- * Element / control instance to take into account when looking for a parameter value.
616
- * This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
617
- * @returns {sap.ui.core.theming.Parameters.Value} the CSS parameter value(s) or <code>undefined</code> if the parameters could not be retrieved.
618
- *
619
- * @public
627
+ * Parameters.get() without arguments returns
628
+ * copy of complete default parameter set
629
+ * @deprecated As of Version 1.120
620
630
  */
621
- Parameters.get = function(vName, oElement) {
622
- let sParamName, fnAsyncCallback, bAsync, aNames, iIndex;
623
-
624
- // Whether parameters containing CSS URLs should be parsed into regular URL strings,
625
- // e.g. a parameter value of url('https://myapp.sample/image.jpeg') will be returned as "https://myapp.sample/image.jpeg".
626
- // Empty strings as well as the special CSS value 'none' will be parsed to null.
627
- let bParseUrls;
631
+ if (arguments.length === 0) {
632
+ Log.warning(
633
+ "[FUTURE FATAL] Legacy variant usage of sap.ui.core.theming.Parameters.get API detected. Do not use the Parameters.get() API to retrieve ALL theming parameters, " +
634
+ "as this will lead to unwanted synchronous requests. " +
635
+ "Use the asynchronous API variant instead and retrieve a fixed set of parameters.",
636
+ "LegacyParametersGet",
637
+ "sap.ui.support",
638
+ function() { return { type: "LegacyParametersGet" }; }
639
+ );
640
+
641
+ // retrieve parameters
642
+ // optionally might also trigger a sync JSON request, if a library was loaded but not parsed yet
643
+ var oParams = getParameters();
644
+ return Object.assign({}, oParams["default"]);
645
+ }
628
646
 
629
- var findRegisteredCallback = function (oCallbackInfo) { return oCallbackInfo.callback === fnAsyncCallback; };
647
+ if (!vName) {
648
+ return undefined;
649
+ }
630
650
 
631
- if (!sTheme) {
632
- sTheme = Theming.getTheme();
651
+ if (vName instanceof Object && !Array.isArray(vName)) {
652
+ // async variant of Parameters.get
653
+ if (!vName.name) {
654
+ future.warningThrows("sap.ui.core.theming.Parameters: Get was called with an object argument without one or more parameter names.");
655
+ return undefined;
633
656
  }
634
-
635
- /**
636
- * Parameters.get() without arguments returns
637
- * copy of complete default parameter set
638
- * @deprecated As of Version 1.120
639
- */
640
- if (arguments.length === 0) {
641
- Log.warning(
642
- "[FUTURE FATAL] Legacy variant usage of sap.ui.core.theming.Parameters.get API detected. Do not use the Parameters.get() API to retrieve ALL theming parameters, " +
643
- "as this will lead to unwanted synchronous requests. " +
644
- "Use the asynchronous API variant instead and retrieve a fixed set of parameters.",
645
- "LegacyParametersGet",
646
- "sap.ui.support",
647
- function() { return { type: "LegacyParametersGet" }; }
648
- );
649
-
650
- // first try to load all pending parameters
651
- loadPendingLibraryParameters();
652
-
653
- // retrieve parameters
654
- // optionally might also trigger a sync JSON request, if a library was loaded but not parsed yet
655
- var oParams = getParameters();
656
- return Object.assign({}, oParams["default"]);
657
+ oElement = vName.scopeElement;
658
+ fnAsyncCallback = vName.callback;
659
+ bParseUrls = vName._restrictedParseUrls || false;
660
+ aNames = typeof vName.name === "string" ? [vName.name] : vName.name;
661
+ bAsync = true;
662
+ } else {
663
+ // legacy variant
664
+ if (typeof vName === "string") {
665
+ aNames = [vName];
666
+ } else { // vName is Array
667
+ aNames = vName;
657
668
  }
658
669
 
659
- if (!vName) {
660
- return undefined;
661
- }
670
+ Log.warning(
671
+ "[FUTURE FATAL] Legacy variant usage of sap.ui.core.theming.Parameters.get API detected for parameter(s): '" + aNames.join(", ") +
672
+ "'. This could lead to bad performance and additional synchronous XHRs, as parameters might not be available yet. Use asynchronous variant instead.",
673
+ "LegacyParametersGet",
674
+ "sap.ui.support",
675
+ function() { return { type: "LegacyParametersGet" }; }
676
+ );
677
+ }
662
678
 
663
- if (vName instanceof Object && !Array.isArray(vName)) {
664
- // async variant of Parameters.get
665
- if (!vName.name) {
666
- future.warningThrows("sap.ui.core.theming.Parameters: Get was called with an object argument without one or more parameter names.");
667
- return undefined;
668
- }
669
- oElement = vName.scopeElement;
670
- fnAsyncCallback = vName.callback;
671
- bParseUrls = vName._restrictedParseUrls || false;
672
- aNames = typeof vName.name === "string" ? [vName.name] : vName.name;
673
- bAsync = true;
679
+ var resolveWithParameter;
680
+ var lookForParameter = function (sName) {
681
+ if (oElement instanceof Element) {
682
+ return getParamForActiveScope(sName, oElement, bAsync);
674
683
  } else {
675
- // legacy variant
676
- if (typeof vName === "string") {
677
- aNames = [vName];
678
- } else { // vName is Array
679
- aNames = vName;
684
+ if (bAsync) {
685
+ parsePendingLibraryParameters();
680
686
  }
681
-
682
- Log.warning(
683
- "[FUTURE FATAL] Legacy variant usage of sap.ui.core.theming.Parameters.get API detected for parameter(s): '" + aNames.join(", ") +
684
- "'. This could lead to bad performance and additional synchronous XHRs, as parameters might not be available yet. Use asynchronous variant instead.",
685
- "LegacyParametersGet",
686
- "sap.ui.support",
687
- function() { return { type: "LegacyParametersGet" }; }
688
- );
687
+ return getParam({
688
+ parameterName: sName,
689
+ loadPendingParameters: !bAsync,
690
+ async: bAsync
691
+ });
689
692
  }
693
+ };
690
694
 
691
- var resolveWithParameter;
692
- var lookForParameter = function (sName) {
693
- if (oElement instanceof Element) {
694
- return getParamForActiveScope(sName, oElement, bAsync);
695
- } else {
696
- if (bAsync) {
697
- parsePendingLibraryParameters();
698
- }
699
- return getParam({
700
- parameterName: sName,
701
- loadPendingParameters: !bAsync,
702
- async: bAsync
703
- });
704
- }
705
- };
706
-
707
- const mResult = {};
695
+ const mResult = {};
708
696
 
709
- for (var i = 0; i < aNames.length; i++) {
710
- sParamName = aNames[i];
711
- var sParamValue = lookForParameter(sParamName);
712
- if (!bAsync || sParamValue) {
713
- mResult[sParamName] = sParamValue;
714
- }
697
+ for (var i = 0; i < aNames.length; i++) {
698
+ sParamName = aNames[i];
699
+ var sParamValue = lookForParameter(sParamName);
700
+ if (!bAsync || sParamValue) {
701
+ mResult[sParamName] = sParamValue;
715
702
  }
703
+ }
716
704
 
717
- if (bAsync && fnAsyncCallback && Object.keys(mResult).length !== aNames.length) {
718
- resolveWithParameter = function () {
719
- Theming.detachApplied(resolveWithParameter);
720
- var vParams = this.get({ // Don't pass callback again
721
- name: vName.name,
722
- scopeElement: vName.scopeElement
723
- });
724
-
725
- if (!vParams || (typeof vParams === "object" && (Object.keys(vParams).length !== aNames.length))) {
726
- Log.error(`sap.ui.core.theming.Parameters: The following parameters could not be found: "${aNames.length === 1 ? aNames[0] : aNames.filter((n) => vParams && !Object.hasOwn(vParams, n))}"`);
727
- }
728
-
729
- fnAsyncCallback(vParams);
730
- aCallbackRegistry.splice(aCallbackRegistry.findIndex(findRegisteredCallback), 1);
731
- }.bind(this);
705
+ if (bAsync && fnAsyncCallback && Object.keys(mResult).length !== aNames.length) {
706
+ resolveWithParameter = function () {
707
+ Theming.detachApplied(resolveWithParameter);
708
+ var vParams = this.get({ // Don't pass callback again
709
+ name: vName.name,
710
+ scopeElement: vName.scopeElement
711
+ });
732
712
 
733
- // Check if identical callback is already registered and reregister with current parameters
734
- iIndex = aCallbackRegistry.findIndex(findRegisteredCallback);
735
- if (iIndex >= 0) {
736
- Theming.detachApplied(aCallbackRegistry[iIndex].eventHandler);
737
- aCallbackRegistry[iIndex].eventHandler = resolveWithParameter;
738
- } else {
739
- aCallbackRegistry.push({ callback: fnAsyncCallback, eventHandler: resolveWithParameter });
713
+ if (!vParams || (typeof vParams === "object" && (Object.keys(vParams).length !== aNames.length))) {
714
+ Log.error(`sap.ui.core.theming.Parameters: The following parameters could not be found: "${aNames.length === 1 ? aNames[0] : aNames.filter((n) => vParams && !Object.hasOwn(vParams, n))}"`);
740
715
  }
741
- Theming.attachApplied(resolveWithParameter);
742
- return undefined; // Don't return partial result in case we expect applied event.
743
- }
744
-
745
- // parse CSS URL strings
746
- // The URLs itself have been resolved at this point
747
- if (bParseUrls) {
748
- parseUrls(mResult);
749
- }
750
716
 
751
- // if only 1 parameter is requests we unwrap the results array
752
- return aNames.length === 1 ? mResult[aNames[0]] : mResult;
753
- };
717
+ fnAsyncCallback(vParams);
718
+ aCallbackRegistry.splice(aCallbackRegistry.findIndex(findRegisteredCallback), 1);
719
+ }.bind(this);
754
720
 
755
- /**
756
- * Checks the given map of parameters for CSS URLs and parses them to a regular string.
757
- * Modifies the mParams argument in place.
758
- *
759
- * In order to only retrieve resolved URL strings and not the CSS URL strings, we expose a restricted Parameters.get() option <code>_restrictedParseUrls</code>.
760
- *
761
- * A URL parameter value of '' (empty string) or "none" (standard CSS value) will result in <code>null</code>.
762
- * As with any other <code>Parameters.get()</code> call, a non-existent parameter will result in <code>undefined</code>.
763
- *
764
- * Usage in controls:
765
- *
766
- * @example <caption>Scenario 4: Parsing CSS URLs</caption>
767
- * const sUrl = Parameters.get({
768
- * name: ["sapUiUrlParam"],
769
- * _restrictedParseUrls: true
770
- * }) ?? "https://my.bootstrap.url/resource/my/lib/images/fallback.jpeg"; // fallback via nullish coalescing operator
771
- *
772
- * @param {object<string,string|undefined>} mParams a set of parameters that should be parsed for CSS URLs
773
- */
774
- function parseUrls(mParams) {
775
- for (const sKey in mParams) {
776
- if (Object.hasOwn(mParams, sKey)) {
777
- let sValue = mParams[sKey];
778
- const match = rCssUrl.exec(sValue);
779
- if (match) {
780
- sValue = match[1];
781
- } else if (sValue === "''" || sValue === "none") {
782
- sValue = null;
783
- }
784
- mParams[sKey] = sValue;
785
- }
721
+ // Check if identical callback is already registered and reregister with current parameters
722
+ iIndex = aCallbackRegistry.findIndex(findRegisteredCallback);
723
+ if (iIndex >= 0) {
724
+ Theming.detachApplied(aCallbackRegistry[iIndex].eventHandler);
725
+ aCallbackRegistry[iIndex].eventHandler = resolveWithParameter;
726
+ } else {
727
+ aCallbackRegistry.push({ callback: fnAsyncCallback, eventHandler: resolveWithParameter });
786
728
  }
729
+ Theming.attachApplied(resolveWithParameter);
730
+ return undefined; // Don't return partial result in case we expect applied event.
787
731
  }
788
732
 
789
- /**
790
- *
791
- * Uses the parameters provide to re-set the parameters map or
792
- * reloads them as usually.
793
- *
794
- * @param {Object} mLibraryParameters
795
- * @private
796
- */
797
- Parameters._setOrLoadParameters = function(mLibraryParameters) {
733
+ // parse CSS URL strings
734
+ // The URLs itself have been resolved at this point
735
+ if (bParseUrls) {
736
+ parseUrls(mResult);
737
+ }
798
738
 
799
- // don't use this.reset(), as it will set the variable to null
800
- mParameters = {
801
- "default": {},
802
- "scopes": {}
803
- };
804
- sTheme = Theming.getTheme();
805
- forEachStyleSheet(function(sId) {
806
- var sLibname = sId.substr(13); // length of sap-ui-theme-
807
- if (mLibraryParameters[sLibname]) {
808
- // if parameters are already provided for this lib, use them (e.g. from LessSupport)
809
- extend(mParameters["default"], mLibraryParameters[sLibname]);
810
- } else {
811
- // otherwise use inline-parameters or library-parameters.json
812
- loadParameters(sId);
739
+ // if only 1 parameter is requests we unwrap the results array
740
+ return aNames.length === 1 ? mResult[aNames[0]] : mResult;
741
+ };
742
+
743
+ /**
744
+ * Checks the given map of parameters for CSS URLs and parses them to a regular string.
745
+ * Modifies the mParams argument in place.
746
+ *
747
+ * In order to only retrieve resolved URL strings and not the CSS URL strings, we expose a restricted Parameters.get() option <code>_restrictedParseUrls</code>.
748
+ *
749
+ * A URL parameter value of '' (empty string) or "none" (standard CSS value) will result in <code>null</code>.
750
+ * As with any other <code>Parameters.get()</code> call, a non-existent parameter will result in <code>undefined</code>.
751
+ *
752
+ * Usage in controls:
753
+ *
754
+ * @example <caption>Scenario 4: Parsing CSS URLs</caption>
755
+ * const sUrl = Parameters.get({
756
+ * name: ["sapUiUrlParam"],
757
+ * _restrictedParseUrls: true
758
+ * }) ?? "https://my.bootstrap.url/resource/my/lib/images/fallback.jpeg"; // fallback via nullish coalescing operator
759
+ *
760
+ * @param {object<string,string|undefined>} mParams a set of parameters that should be parsed for CSS URLs
761
+ */
762
+ function parseUrls(mParams) {
763
+ for (const sKey in mParams) {
764
+ if (Object.hasOwn(mParams, sKey)) {
765
+ let sValue = mParams[sKey];
766
+ const match = rCssUrl.exec(sValue);
767
+ if (match) {
768
+ sValue = match[1];
769
+ } else if (sValue === "''" || sValue === "none") {
770
+ sValue = null;
813
771
  }
814
- });
815
- };
816
-
817
- /**
818
- * Resets the CSS parameters which finally will reload the parameters
819
- * the next time they are queried via the method <code>get</code>.
820
- *
821
- * @public
822
- * @deprecated As of version 1.92 without a replacement. Application code should
823
- * not be able to interfere with the automated determination of theme parameters.
824
- * Resetting the parameters unnecessarily could impact performance. Please use
825
- * the (potentially async) API to get parameter values and rely on the framework
826
- * to update parameter values when the theme changes.
827
- */
828
- Parameters.reset = function() {
829
- this._reset.apply(this, arguments);
830
- };
831
-
832
- /**
833
- * Resets the CSS parameters which finally will reload the parameters
834
- * the next time they are queried via the method <code>get</code>.
835
- *
836
- * @private
837
- * @ui5-restricted sap.ui.core.theming
838
- */
839
- Parameters._reset = function() {
840
- // hidden parameter {boolean} bOnlyWhenNecessary
841
- var bOnlyWhenNecessary = arguments[0] === true;
842
- if ( !bOnlyWhenNecessary || Theming.getTheme() !== sTheme ) {
843
- sTheme = Theming.getTheme();
844
- aParametersToLoad = [];
845
- mParameters = null;
772
+ mParams[sKey] = sValue;
846
773
  }
847
- };
848
-
774
+ }
775
+ }
776
+
777
+ /**
778
+ * Resets the CSS parameters which finally will reload the parameters
779
+ * the next time they are queried via the method <code>get</code>.
780
+ *
781
+ * @public
782
+ * @deprecated As of version 1.92 without a replacement. Application code should
783
+ * not be able to interfere with the automated determination of theme parameters.
784
+ * Resetting the parameters unnecessarily could impact performance. Please use
785
+ * the (potentially async) API to get parameter values and rely on the framework
786
+ * to update parameter values when the theme changes.
787
+ */
788
+ Parameters.reset = function() {
789
+ reset(true);
790
+ };
791
+
792
+ /**
793
+ * Resets the CSS parameters which finally will reload the parameters
794
+ * the next time they are queried via the method <code>get</code>.
795
+ */
796
+ function reset() {
849
797
  /**
850
- * Helper function to get an image URL based on a given theme parameter.
851
- *
852
- * @private
853
- * @param {string} sParamName the theme parameter which contains the logo definition. If nothing is defined the parameter 'sapUiGlobalLogo' is used.
854
- * @param {boolean} bForce whether a valid URL should be returned even if there is no logo defined.
798
+ * hidden parameter {boolean} bForce
855
799
  * @deprecated
856
800
  */
857
- Parameters._getThemeImage = function(sParamName, bForce) {
858
- sParamName = sParamName || "sapUiGlobalLogo";
859
- var logo = Parameters.get(sParamName);
860
- if (logo) {
861
- var match = rCssUrl.exec(logo);
862
- if (match) {
863
- logo = match[1];
864
- } else if (logo === "''" || logo === "none") {
865
- logo = null;
866
- }
801
+ const bForce = arguments[0] === true;
802
+ if ( bForce || Theming.getTheme() !== sTheme ) {
803
+ sTheme = Theming.getTheme();
804
+ aParametersToLoad = [...getAllLibraryInfoObjects().keys()];
805
+ mParameters = null;
806
+ }
807
+ }
808
+
809
+ /**
810
+ * Helper function to get an image URL based on a given theme parameter.
811
+ *
812
+ * @private
813
+ * @param {string} sParamName the theme parameter which contains the logo definition. If nothing is defined the parameter 'sapUiGlobalLogo' is used.
814
+ * @param {boolean} bForce whether a valid URL should be returned even if there is no logo defined.
815
+ * @deprecated
816
+ */
817
+ Parameters._getThemeImage = function(sParamName, bForce) {
818
+ sParamName = sParamName || "sapUiGlobalLogo";
819
+ var logo = Parameters.get(sParamName);
820
+ if (logo) {
821
+ var match = rCssUrl.exec(logo);
822
+ if (match) {
823
+ logo = match[1];
824
+ } else if (logo === "''" || logo === "none") {
825
+ logo = null;
867
826
  }
827
+ }
868
828
 
869
- if (bForce && !logo) {
870
- return sap.ui.require.toUrl('sap/ui/core/themes/base/img/1x1.gif');
871
- }
829
+ if (bForce && !logo) {
830
+ return sap.ui.require.toUrl('sap/ui/core/themes/base/img/1x1.gif');
831
+ }
872
832
 
873
- return logo;
874
- };
833
+ return logo;
834
+ };
835
+
836
+ attachChange(reset);
875
837
 
876
838
  return Parameters;
877
839