@beinformed/ui 1.63.2 → 1.63.4

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 (466) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/esm/constants/Settings.js +3 -14
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/exceptions/NotFoundException.js +1 -2
  5. package/esm/exceptions/NotFoundException.js.map +1 -1
  6. package/esm/hooks/useI18n.js +1 -6
  7. package/esm/hooks/useI18n.js.map +1 -1
  8. package/esm/hooks/useModal.js +3 -4
  9. package/esm/hooks/useModal.js.map +1 -1
  10. package/esm/hooks/useModelCatalog.js +10 -30
  11. package/esm/hooks/useModelCatalog.js.map +1 -1
  12. package/esm/hooks/useModularUI.js +4 -5
  13. package/esm/hooks/useModularUI.js.map +1 -1
  14. package/esm/hooks/useModularUIBasic.js +7 -8
  15. package/esm/hooks/useModularUIBasic.js.map +1 -1
  16. package/esm/i18n/Locale.js +2 -5
  17. package/esm/i18n/Locale.js.map +1 -1
  18. package/esm/i18n/Locales.js +2 -5
  19. package/esm/i18n/Locales.js.map +1 -1
  20. package/esm/i18n/Message.js +9 -10
  21. package/esm/i18n/Message.js.map +1 -1
  22. package/esm/i18n/withMessage.js +1 -6
  23. package/esm/i18n/withMessage.js.map +1 -1
  24. package/esm/models/actions/ActionCollection.js +3 -6
  25. package/esm/models/actions/ActionCollection.js.map +1 -1
  26. package/esm/models/actions/ActionModel.js +1 -4
  27. package/esm/models/actions/ActionModel.js.map +1 -1
  28. package/esm/models/application/ApplicationModel.js +2 -2
  29. package/esm/models/application/ApplicationModel.js.map +1 -1
  30. package/esm/models/attributes/AttributeCollection.js +4 -14
  31. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  32. package/esm/models/attributes/AttributeDataHelper.js +1 -2
  33. package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
  34. package/esm/models/attributes/AttributeSetModel.js +1 -5
  35. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  36. package/esm/models/attributes/CaptchaAttributeModel.js +2 -2
  37. package/esm/models/attributes/CaptchaAttributeModel.js.map +1 -1
  38. package/esm/models/attributes/ChoiceAttributeModel.js +1 -3
  39. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  40. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +3 -9
  41. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  42. package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -8
  43. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  44. package/esm/models/attributes/PasswordAttributeModel.js +2 -2
  45. package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
  46. package/esm/models/attributes/UploadAttributeModel.js +2 -2
  47. package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
  48. package/esm/models/attributes/input-constraints/ConstraintCollection.js +1 -2
  49. package/esm/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  50. package/esm/models/attributes/input-constraints/ConstraintModel.js +1 -2
  51. package/esm/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  52. package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -4
  53. package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  54. package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -6
  55. package/esm/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  56. package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -4
  57. package/esm/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
  58. package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
  59. package/esm/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
  60. package/esm/models/attributes/layouthint-rules/DependentAttribute.js +2 -2
  61. package/esm/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  62. package/esm/models/base/BaseCollection.js +1 -2
  63. package/esm/models/base/BaseCollection.js.map +1 -1
  64. package/esm/models/base/BaseModel.js +6 -9
  65. package/esm/models/base/BaseModel.js.map +1 -1
  66. package/esm/models/base/ResourceModel.js +1 -2
  67. package/esm/models/base/ResourceModel.js.map +1 -1
  68. package/esm/models/concepts/BusinessScenarioModel.js +2 -2
  69. package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
  70. package/esm/models/concepts/ConceptDetailModel.js +1 -2
  71. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  72. package/esm/models/concepts/ConceptLinkModel.js +1 -3
  73. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  74. package/esm/models/concepts/ConceptRelationCollection.js +1 -4
  75. package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
  76. package/esm/models/concepts/ConceptRelationModel.js +1 -3
  77. package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
  78. package/esm/models/concepts/SourceReferenceCollection.js +1 -4
  79. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  80. package/esm/models/concepts/SourceReferenceModel.js +7 -3
  81. package/esm/models/concepts/SourceReferenceModel.js.flow +6 -0
  82. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  83. package/esm/models/content/ContentLinkModel.js +1 -3
  84. package/esm/models/content/ContentLinkModel.js.map +1 -1
  85. package/esm/models/content/ContentTOCModel.js +2 -2
  86. package/esm/models/content/ContentTOCModel.js.map +1 -1
  87. package/esm/models/contentconfiguration/ContentConfigurationElements.js +1 -2
  88. package/esm/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
  89. package/esm/models/error/ErrorModel.js +1 -3
  90. package/esm/models/error/ErrorModel.js.map +1 -1
  91. package/esm/models/filters/FilterCollection.js +1 -4
  92. package/esm/models/filters/FilterCollection.js.map +1 -1
  93. package/esm/models/form/FormModel.js +3 -9
  94. package/esm/models/form/FormModel.js.map +1 -1
  95. package/esm/models/form/FormObjectModel.js +2 -4
  96. package/esm/models/form/FormObjectModel.js.map +1 -1
  97. package/esm/models/href/Href.js +3 -6
  98. package/esm/models/href/Href.js.map +1 -1
  99. package/esm/models/href/ListHref.js +1 -2
  100. package/esm/models/href/ListHref.js.map +1 -1
  101. package/esm/models/layouthint/LayoutHintCollection.js +3 -10
  102. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  103. package/esm/models/links/LinkCollection.js +6 -15
  104. package/esm/models/links/LinkCollection.js.map +1 -1
  105. package/esm/models/list/ListModel.js +2 -2
  106. package/esm/models/list/ListModel.js.map +1 -1
  107. package/esm/models/modelcatalog/ModelCategoryCollection.js +1 -2
  108. package/esm/models/modelcatalog/ModelCategoryCollection.js.map +1 -1
  109. package/esm/models/parameter/Parameter.js +2 -4
  110. package/esm/models/parameter/Parameter.js.map +1 -1
  111. package/esm/models/resolveModel.js +1 -2
  112. package/esm/models/resolveModel.js.map +1 -1
  113. package/esm/models/sorting/SortingModel.js +1 -2
  114. package/esm/models/sorting/SortingModel.js.map +1 -1
  115. package/esm/models/user/UserServicesModel.js +2 -2
  116. package/esm/models/user/UserServicesModel.js.map +1 -1
  117. package/esm/modularui/Authenticate.js +4 -6
  118. package/esm/modularui/Authenticate.js.flow +6 -6
  119. package/esm/modularui/Authenticate.js.map +1 -1
  120. package/esm/modularui/ModularUIRequest.js +1 -2
  121. package/esm/modularui/ModularUIRequest.js.map +1 -1
  122. package/esm/react/ErrorBoundary.js +2 -2
  123. package/esm/react/ErrorBoundary.js.map +1 -1
  124. package/esm/react/ErrorBoundaryFallback.js +13 -16
  125. package/esm/react/ErrorBoundaryFallback.js.map +1 -1
  126. package/esm/react/utils.js +1 -3
  127. package/esm/react/utils.js.map +1 -1
  128. package/esm/react-client/Init.js +20 -23
  129. package/esm/react-client/Init.js.map +1 -1
  130. package/esm/react-client/client.js +9 -13
  131. package/esm/react-client/client.js.map +1 -1
  132. package/esm/react-server/renderSSRComplete.js +9 -10
  133. package/esm/react-server/renderSSRComplete.js.map +1 -1
  134. package/esm/react-server/renderSSRMinimal.js +7 -8
  135. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  136. package/esm/react-server/serverNoSSR.js +11 -12
  137. package/esm/react-server/serverNoSSR.js.map +1 -1
  138. package/esm/react-server/serverSSR.js +11 -12
  139. package/esm/react-server/serverSSR.js.map +1 -1
  140. package/esm/react-server/serverUtil.js +1 -3
  141. package/esm/react-server/serverUtil.js.map +1 -1
  142. package/esm/react-theme/ThemeProvider.js +7 -11
  143. package/esm/react-theme/ThemeProvider.js.map +1 -1
  144. package/esm/react-theme/createTheme.js +3 -10
  145. package/esm/react-theme/createTheme.js.map +1 -1
  146. package/esm/react-theme/utils/background.js +3 -4
  147. package/esm/react-theme/utils/background.js.map +1 -1
  148. package/esm/react-theme/utils/colors.js +7 -16
  149. package/esm/react-theme/utils/colors.js.map +1 -1
  150. package/esm/react-theme/utils/contrast.js +11 -19
  151. package/esm/react-theme/utils/contrast.js.map +1 -1
  152. package/esm/react-theme/utils/corners.js +10 -16
  153. package/esm/react-theme/utils/corners.js.map +1 -1
  154. package/esm/react-theme/utils/spacers.js +15 -38
  155. package/esm/react-theme/utils/spacers.js.map +1 -1
  156. package/esm/react-theme/utils/themeProps.js +7 -22
  157. package/esm/react-theme/utils/themeProps.js.map +1 -1
  158. package/esm/redux/_i18n/I18nReducer.js +5 -8
  159. package/esm/redux/_i18n/I18nReducer.js.map +1 -1
  160. package/esm/redux/_modularui/ModularUIActions.js +19 -23
  161. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  162. package/esm/redux/_modularui/ModularUIConnector.js +4 -5
  163. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  164. package/esm/redux/_modularui/ModularUIReducer.js +14 -19
  165. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  166. package/esm/redux/_modularui/ModularUIUtils.js +1 -2
  167. package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
  168. package/esm/redux/_modularui/withModularUI.js +1 -2
  169. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  170. package/esm/redux/_router/RouterReducer.js +1 -3
  171. package/esm/redux/_router/RouterReducer.js.map +1 -1
  172. package/esm/redux/actions/FormAttributeSet.js +34 -37
  173. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  174. package/esm/redux/actions/FormAutosubmit.js +1 -2
  175. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  176. package/esm/redux/actions/Preferences.js +8 -15
  177. package/esm/redux/actions/Preferences.js.map +1 -1
  178. package/esm/redux/connectors/CaseView.js +3 -6
  179. package/esm/redux/connectors/CaseView.js.map +1 -1
  180. package/esm/redux/connectors/ConceptDetail.js +4 -7
  181. package/esm/redux/connectors/ConceptDetail.js.map +1 -1
  182. package/esm/redux/connectors/ContentBrowser.js +3 -6
  183. package/esm/redux/connectors/ContentBrowser.js.map +1 -1
  184. package/esm/redux/connectors/ContentDetail.js +4 -7
  185. package/esm/redux/connectors/ContentDetail.js.map +1 -1
  186. package/esm/redux/connectors/ContentDetailSection.js +5 -8
  187. package/esm/redux/connectors/ContentDetailSection.js.map +1 -1
  188. package/esm/redux/connectors/Form.js +4 -5
  189. package/esm/redux/connectors/Form.js.map +1 -1
  190. package/esm/redux/connectors/FormAttributeSet.js +5 -8
  191. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  192. package/esm/redux/connectors/ListDetail.js +3 -6
  193. package/esm/redux/connectors/ListDetail.js.map +1 -1
  194. package/esm/redux/connectors/ModelCatalog.js +3 -6
  195. package/esm/redux/connectors/ModelCatalog.js.map +1 -1
  196. package/esm/redux/connectors/PanelRenderer.js +5 -6
  197. package/esm/redux/connectors/PanelRenderer.js.map +1 -1
  198. package/esm/redux/connectors/QuickSearch.js +3 -6
  199. package/esm/redux/connectors/QuickSearch.js.map +1 -1
  200. package/esm/redux/connectors/Tab.js +3 -6
  201. package/esm/redux/connectors/Tab.js.map +1 -1
  202. package/esm/redux/reducers/AuthReducer.js +1 -3
  203. package/esm/redux/reducers/AuthReducer.js.map +1 -1
  204. package/esm/redux/reducers/ErrorReducer.js +1 -3
  205. package/esm/redux/reducers/ErrorReducer.js.map +1 -1
  206. package/esm/redux/reducers/ModalsReducer.js +1 -3
  207. package/esm/redux/reducers/ModalsReducer.js.map +1 -1
  208. package/esm/redux/reducers/ModelCatalogReducer.js +1 -3
  209. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  210. package/esm/redux/reducers/NotificationReducer.js +1 -3
  211. package/esm/redux/reducers/NotificationReducer.js.map +1 -1
  212. package/esm/redux/reducers/PreferencesReducer.js +1 -3
  213. package/esm/redux/reducers/PreferencesReducer.js.map +1 -1
  214. package/esm/redux/reducers/ProgressIndicatorReducer.js +1 -3
  215. package/esm/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  216. package/esm/redux/store/beforeRenderHooks.js +1 -3
  217. package/esm/redux/store/beforeRenderHooks.js.map +1 -1
  218. package/esm/utils/browser/Cache.js +1 -5
  219. package/esm/utils/browser/Cache.js.map +1 -1
  220. package/esm/utils/datetime/DateTimeUtil.js +45 -91
  221. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  222. package/esm/utils/fetch/xhr.js +1 -2
  223. package/esm/utils/fetch/xhr.js.map +1 -1
  224. package/esm/utils/helpers/repositoryResource.js +1 -3
  225. package/esm/utils/helpers/repositoryResource.js.map +1 -1
  226. package/esm/utils/helpers/sanitizeHtml.js +3 -4
  227. package/esm/utils/helpers/sanitizeHtml.js.map +1 -1
  228. package/esm/utils/number/DecimalFormat.js +1 -2
  229. package/esm/utils/number/DecimalFormat.js.map +1 -1
  230. package/esm/utils/number/formatValue.js +1 -4
  231. package/esm/utils/number/formatValue.js.map +1 -1
  232. package/esm/utils/number/parseNumbers.js +2 -6
  233. package/esm/utils/number/parseNumbers.js.map +1 -1
  234. package/lib/constants/Settings.js +3 -14
  235. package/lib/constants/Settings.js.map +1 -1
  236. package/lib/exceptions/NotFoundException.js +1 -2
  237. package/lib/exceptions/NotFoundException.js.map +1 -1
  238. package/lib/hooks/useI18n.js +1 -6
  239. package/lib/hooks/useI18n.js.map +1 -1
  240. package/lib/hooks/useModal.js +3 -4
  241. package/lib/hooks/useModal.js.map +1 -1
  242. package/lib/hooks/useModelCatalog.js +10 -30
  243. package/lib/hooks/useModelCatalog.js.map +1 -1
  244. package/lib/hooks/useModularUI.js +4 -5
  245. package/lib/hooks/useModularUI.js.map +1 -1
  246. package/lib/hooks/useModularUIBasic.js +7 -8
  247. package/lib/hooks/useModularUIBasic.js.map +1 -1
  248. package/lib/i18n/Locale.js +2 -5
  249. package/lib/i18n/Locale.js.map +1 -1
  250. package/lib/i18n/Locales.js +2 -5
  251. package/lib/i18n/Locales.js.map +1 -1
  252. package/lib/i18n/Message.js +9 -10
  253. package/lib/i18n/Message.js.map +1 -1
  254. package/lib/i18n/withMessage.js +1 -6
  255. package/lib/i18n/withMessage.js.map +1 -1
  256. package/lib/models/actions/ActionCollection.js +3 -6
  257. package/lib/models/actions/ActionCollection.js.map +1 -1
  258. package/lib/models/actions/ActionModel.js +1 -4
  259. package/lib/models/actions/ActionModel.js.map +1 -1
  260. package/lib/models/application/ApplicationModel.js +2 -2
  261. package/lib/models/application/ApplicationModel.js.map +1 -1
  262. package/lib/models/attributes/AttributeCollection.js +4 -14
  263. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  264. package/lib/models/attributes/AttributeDataHelper.js +1 -2
  265. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  266. package/lib/models/attributes/AttributeSetModel.js +1 -5
  267. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  268. package/lib/models/attributes/CaptchaAttributeModel.js +2 -2
  269. package/lib/models/attributes/CaptchaAttributeModel.js.map +1 -1
  270. package/lib/models/attributes/ChoiceAttributeModel.js +1 -3
  271. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  272. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +3 -9
  273. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  274. package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -8
  275. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  276. package/lib/models/attributes/PasswordAttributeModel.js +2 -2
  277. package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
  278. package/lib/models/attributes/UploadAttributeModel.js +2 -2
  279. package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
  280. package/lib/models/attributes/input-constraints/ConstraintCollection.js +1 -2
  281. package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  282. package/lib/models/attributes/input-constraints/ConstraintModel.js +1 -2
  283. package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  284. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js +1 -4
  285. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  286. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js +1 -6
  287. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  288. package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js +1 -4
  289. package/lib/models/attributes/input-constraints/NumberGroupingConstraint.js.map +1 -1
  290. package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js +1 -2
  291. package/lib/models/attributes/input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint.js.map +1 -1
  292. package/lib/models/attributes/layouthint-rules/DependentAttribute.js +2 -2
  293. package/lib/models/attributes/layouthint-rules/DependentAttribute.js.map +1 -1
  294. package/lib/models/base/BaseCollection.js +1 -2
  295. package/lib/models/base/BaseCollection.js.map +1 -1
  296. package/lib/models/base/BaseModel.js +6 -9
  297. package/lib/models/base/BaseModel.js.map +1 -1
  298. package/lib/models/base/ResourceModel.js +1 -2
  299. package/lib/models/base/ResourceModel.js.map +1 -1
  300. package/lib/models/concepts/BusinessScenarioModel.js +2 -2
  301. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  302. package/lib/models/concepts/ConceptDetailModel.js +1 -2
  303. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  304. package/lib/models/concepts/ConceptLinkModel.js +1 -3
  305. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  306. package/lib/models/concepts/ConceptRelationCollection.js +1 -4
  307. package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
  308. package/lib/models/concepts/ConceptRelationModel.js +1 -3
  309. package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
  310. package/lib/models/concepts/SourceReferenceCollection.js +1 -4
  311. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  312. package/lib/models/concepts/SourceReferenceModel.js +7 -3
  313. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  314. package/lib/models/content/ContentLinkModel.js +1 -3
  315. package/lib/models/content/ContentLinkModel.js.map +1 -1
  316. package/lib/models/content/ContentTOCModel.js +2 -2
  317. package/lib/models/content/ContentTOCModel.js.map +1 -1
  318. package/lib/models/contentconfiguration/ContentConfigurationElements.js +1 -2
  319. package/lib/models/contentconfiguration/ContentConfigurationElements.js.map +1 -1
  320. package/lib/models/error/ErrorModel.js +1 -3
  321. package/lib/models/error/ErrorModel.js.map +1 -1
  322. package/lib/models/filters/FilterCollection.js +1 -4
  323. package/lib/models/filters/FilterCollection.js.map +1 -1
  324. package/lib/models/form/FormModel.js +3 -9
  325. package/lib/models/form/FormModel.js.map +1 -1
  326. package/lib/models/form/FormObjectModel.js +2 -4
  327. package/lib/models/form/FormObjectModel.js.map +1 -1
  328. package/lib/models/href/Href.js +3 -6
  329. package/lib/models/href/Href.js.map +1 -1
  330. package/lib/models/href/ListHref.js +1 -2
  331. package/lib/models/href/ListHref.js.map +1 -1
  332. package/lib/models/layouthint/LayoutHintCollection.js +3 -10
  333. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  334. package/lib/models/links/LinkCollection.js +6 -15
  335. package/lib/models/links/LinkCollection.js.map +1 -1
  336. package/lib/models/list/ListModel.js +2 -2
  337. package/lib/models/list/ListModel.js.map +1 -1
  338. package/lib/models/modelcatalog/ModelCategoryCollection.js +1 -2
  339. package/lib/models/modelcatalog/ModelCategoryCollection.js.map +1 -1
  340. package/lib/models/parameter/Parameter.js +2 -4
  341. package/lib/models/parameter/Parameter.js.map +1 -1
  342. package/lib/models/resolveModel.js +1 -2
  343. package/lib/models/resolveModel.js.map +1 -1
  344. package/lib/models/sorting/SortingModel.js +1 -2
  345. package/lib/models/sorting/SortingModel.js.map +1 -1
  346. package/lib/models/user/UserServicesModel.js +2 -2
  347. package/lib/models/user/UserServicesModel.js.map +1 -1
  348. package/lib/modularui/Authenticate.js +4 -6
  349. package/lib/modularui/Authenticate.js.map +1 -1
  350. package/lib/modularui/ModularUIRequest.js +1 -2
  351. package/lib/modularui/ModularUIRequest.js.map +1 -1
  352. package/lib/react/ErrorBoundary.js +2 -2
  353. package/lib/react/ErrorBoundary.js.map +1 -1
  354. package/lib/react/ErrorBoundaryFallback.js +13 -16
  355. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  356. package/lib/react/utils.js +1 -3
  357. package/lib/react/utils.js.map +1 -1
  358. package/lib/react-client/Init.js +20 -23
  359. package/lib/react-client/Init.js.map +1 -1
  360. package/lib/react-client/client.js +9 -13
  361. package/lib/react-client/client.js.map +1 -1
  362. package/lib/react-server/renderSSRComplete.js +9 -10
  363. package/lib/react-server/renderSSRComplete.js.map +1 -1
  364. package/lib/react-server/renderSSRMinimal.js +7 -8
  365. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  366. package/lib/react-server/serverNoSSR.js +11 -12
  367. package/lib/react-server/serverNoSSR.js.map +1 -1
  368. package/lib/react-server/serverSSR.js +11 -12
  369. package/lib/react-server/serverSSR.js.map +1 -1
  370. package/lib/react-server/serverUtil.js +1 -3
  371. package/lib/react-server/serverUtil.js.map +1 -1
  372. package/lib/react-theme/ThemeProvider.js +7 -11
  373. package/lib/react-theme/ThemeProvider.js.map +1 -1
  374. package/lib/react-theme/createTheme.js +3 -10
  375. package/lib/react-theme/createTheme.js.map +1 -1
  376. package/lib/react-theme/utils/background.js +3 -4
  377. package/lib/react-theme/utils/background.js.map +1 -1
  378. package/lib/react-theme/utils/colors.js +7 -16
  379. package/lib/react-theme/utils/colors.js.map +1 -1
  380. package/lib/react-theme/utils/contrast.js +11 -19
  381. package/lib/react-theme/utils/contrast.js.map +1 -1
  382. package/lib/react-theme/utils/corners.js +10 -16
  383. package/lib/react-theme/utils/corners.js.map +1 -1
  384. package/lib/react-theme/utils/spacers.js +15 -38
  385. package/lib/react-theme/utils/spacers.js.map +1 -1
  386. package/lib/react-theme/utils/themeProps.js +7 -22
  387. package/lib/react-theme/utils/themeProps.js.map +1 -1
  388. package/lib/redux/_i18n/I18nReducer.js +5 -8
  389. package/lib/redux/_i18n/I18nReducer.js.map +1 -1
  390. package/lib/redux/_modularui/ModularUIActions.js +19 -23
  391. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  392. package/lib/redux/_modularui/ModularUIConnector.js +4 -5
  393. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  394. package/lib/redux/_modularui/ModularUIReducer.js +14 -19
  395. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  396. package/lib/redux/_modularui/ModularUIUtils.js +1 -2
  397. package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
  398. package/lib/redux/_modularui/withModularUI.js +1 -2
  399. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  400. package/lib/redux/_router/RouterReducer.js +1 -3
  401. package/lib/redux/_router/RouterReducer.js.map +1 -1
  402. package/lib/redux/actions/FormAttributeSet.js +34 -37
  403. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  404. package/lib/redux/actions/FormAutosubmit.js +1 -2
  405. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  406. package/lib/redux/actions/Preferences.js +8 -15
  407. package/lib/redux/actions/Preferences.js.map +1 -1
  408. package/lib/redux/connectors/CaseView.js +3 -6
  409. package/lib/redux/connectors/CaseView.js.map +1 -1
  410. package/lib/redux/connectors/ConceptDetail.js +4 -7
  411. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  412. package/lib/redux/connectors/ContentBrowser.js +3 -6
  413. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  414. package/lib/redux/connectors/ContentDetail.js +4 -7
  415. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  416. package/lib/redux/connectors/ContentDetailSection.js +5 -8
  417. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  418. package/lib/redux/connectors/Form.js +4 -5
  419. package/lib/redux/connectors/Form.js.map +1 -1
  420. package/lib/redux/connectors/FormAttributeSet.js +5 -8
  421. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  422. package/lib/redux/connectors/ListDetail.js +3 -6
  423. package/lib/redux/connectors/ListDetail.js.map +1 -1
  424. package/lib/redux/connectors/ModelCatalog.js +3 -6
  425. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  426. package/lib/redux/connectors/PanelRenderer.js +5 -6
  427. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  428. package/lib/redux/connectors/QuickSearch.js +3 -6
  429. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  430. package/lib/redux/connectors/Tab.js +3 -6
  431. package/lib/redux/connectors/Tab.js.map +1 -1
  432. package/lib/redux/reducers/AuthReducer.js +1 -3
  433. package/lib/redux/reducers/AuthReducer.js.map +1 -1
  434. package/lib/redux/reducers/ErrorReducer.js +1 -3
  435. package/lib/redux/reducers/ErrorReducer.js.map +1 -1
  436. package/lib/redux/reducers/ModalsReducer.js +1 -3
  437. package/lib/redux/reducers/ModalsReducer.js.map +1 -1
  438. package/lib/redux/reducers/ModelCatalogReducer.js +1 -3
  439. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  440. package/lib/redux/reducers/NotificationReducer.js +1 -3
  441. package/lib/redux/reducers/NotificationReducer.js.map +1 -1
  442. package/lib/redux/reducers/PreferencesReducer.js +1 -3
  443. package/lib/redux/reducers/PreferencesReducer.js.map +1 -1
  444. package/lib/redux/reducers/ProgressIndicatorReducer.js +1 -3
  445. package/lib/redux/reducers/ProgressIndicatorReducer.js.map +1 -1
  446. package/lib/redux/store/beforeRenderHooks.js +1 -3
  447. package/lib/redux/store/beforeRenderHooks.js.map +1 -1
  448. package/lib/utils/browser/Cache.js +1 -5
  449. package/lib/utils/browser/Cache.js.map +1 -1
  450. package/lib/utils/datetime/DateTimeUtil.js +45 -91
  451. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  452. package/lib/utils/fetch/xhr.js +1 -2
  453. package/lib/utils/fetch/xhr.js.map +1 -1
  454. package/lib/utils/helpers/repositoryResource.js +1 -3
  455. package/lib/utils/helpers/repositoryResource.js.map +1 -1
  456. package/lib/utils/helpers/sanitizeHtml.js +3 -4
  457. package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
  458. package/lib/utils/number/DecimalFormat.js +1 -2
  459. package/lib/utils/number/DecimalFormat.js.map +1 -1
  460. package/lib/utils/number/formatValue.js +1 -4
  461. package/lib/utils/number/formatValue.js.map +1 -1
  462. package/lib/utils/number/parseNumbers.js +2 -6
  463. package/lib/utils/number/parseNumbers.js.map +1 -1
  464. package/package.json +23 -23
  465. package/src/models/concepts/SourceReferenceModel.js +6 -0
  466. package/src/modularui/Authenticate.js +6 -6
@@ -8,14 +8,13 @@ import htmlpage from "./htmlpage";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  /**
10
10
  */
11
- const renderSSRMinimal = _ref => {
12
- let {
13
- store,
14
- theme,
15
- UUID = "",
16
- render,
17
- template = htmlpage
18
- } = _ref;
11
+ const renderSSRMinimal = ({
12
+ store,
13
+ theme,
14
+ UUID = "",
15
+ render,
16
+ template = htmlpage
17
+ }) => {
19
18
  const sheet = new ServerStyleSheet();
20
19
  const appHTML = renderToString(/*#__PURE__*/_jsx(Provider, {
21
20
  store: store,
@@ -1 +1 @@
1
- {"version":3,"file":"renderSSRMinimal.js","names":["renderToString","Provider","ServerStyleSheet","StyleSheetManager","ThemeProvider","getBasePathServer","createHead","dehydrate","htmlpage","jsx","_jsx","renderSSRMinimal","_ref","store","theme","UUID","render","template","sheet","appHTML","children","instance","head","contextPath","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { getBasePathServer } from \"../constants/Settings\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: getBasePathServer(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AACvE,OAAOC,aAAa,MAAM,8BAA8B;AAExD,SAASC,iBAAiB,QAAQ,uBAAuB;AAEzD,SAASC,UAAU,EAAEC,SAAS,QAAQ,cAAc;AACpD,OAAOC,QAAQ,MAAM,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAalC;AACA;AACA,MAAMC,gBAAgB,GAAGC,IAAA,IAMJ;EAAA,IANK;IACxBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,MAAM;IACNC,QAAQ,GAAGT;EACN,CAAC,GAAAI,IAAA;EACN,MAAMM,KAAK,GAAG,IAAIhB,gBAAgB,CAAC,CAAC;EAEpC,MAAMiB,OAAO,GAAGnB,cAAc,cAC5BU,IAAA,CAACT,QAAQ;IAACY,KAAK,EAAEA,KAAM;IAAAO,QAAA,eACrBV,IAAA,CAACP,iBAAiB;MAACe,KAAK,EAAEA,KAAK,CAACG,QAAS;MAAAD,QAAA,eACvCV,IAAA,CAACN,aAAa;QAACU,KAAK,EAAEA,KAAM;QAAAM,QAAA,EAAEJ,MAAM,CAAC;MAAC,CAAgB;IAAC,CACtC;EAAC,CACZ,CACZ,CAAC;EAED,MAAMM,IAAI,GAAGhB,UAAU,CAACY,KAAK,EAAEH,IAAI,CAAC;EACpC,OAAOE,QAAQ,CAAC;IACdM,WAAW,EAAElB,iBAAiB,CAAC,CAAC;IAChCmB,IAAI,EAAEL,OAAO;IACbG,IAAI;IACJG,KAAK,EAAElB,SAAS,CAACM,KAAK,CAAC;IACvBE;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeJ,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"renderSSRMinimal.js","names":["renderToString","Provider","ServerStyleSheet","StyleSheetManager","ThemeProvider","getBasePathServer","createHead","dehydrate","htmlpage","jsx","_jsx","renderSSRMinimal","store","theme","UUID","render","template","sheet","appHTML","children","instance","head","contextPath","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { getBasePathServer } from \"../constants/Settings\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: getBasePathServer(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AACvE,OAAOC,aAAa,MAAM,8BAA8B;AAExD,SAASC,iBAAiB,QAAQ,uBAAuB;AAEzD,SAASC,UAAU,EAAEC,SAAS,QAAQ,cAAc;AACpD,OAAOC,QAAQ,MAAM,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAalC;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,KAAK;EACLC,KAAK;EACLC,IAAI,GAAG,EAAE;EACTC,MAAM;EACNC,QAAQ,GAAGR;AACN,CAAC,KAAa;EACnB,MAAMS,KAAK,GAAG,IAAIf,gBAAgB,CAAC,CAAC;EAEpC,MAAMgB,OAAO,GAAGlB,cAAc,cAC5BU,IAAA,CAACT,QAAQ;IAACW,KAAK,EAAEA,KAAM;IAAAO,QAAA,eACrBT,IAAA,CAACP,iBAAiB;MAACc,KAAK,EAAEA,KAAK,CAACG,QAAS;MAAAD,QAAA,eACvCT,IAAA,CAACN,aAAa;QAACS,KAAK,EAAEA,KAAM;QAAAM,QAAA,EAAEJ,MAAM,CAAC;MAAC,CAAgB;IAAC,CACtC;EAAC,CACZ,CACZ,CAAC;EAED,MAAMM,IAAI,GAAGf,UAAU,CAACW,KAAK,EAAEH,IAAI,CAAC;EACpC,OAAOE,QAAQ,CAAC;IACdM,WAAW,EAAEjB,iBAAiB,CAAC,CAAC;IAChCkB,IAAI,EAAEL,OAAO;IACbG,IAAI;IACJG,KAAK,EAAEjB,SAAS,CAACK,KAAK,CAAC;IACvBE;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeH,gBAAgB","ignoreList":[]}
@@ -7,18 +7,17 @@ import renderSSRMinimal from "./renderSSRMinimal";
7
7
  import createTheme from "../react-theme/createTheme";
8
8
  /**
9
9
  */
10
- const serverNoSSR = _ref => {
11
- let {
12
- request,
13
- locales,
14
- customReducers,
15
- serverPreferences = [],
16
- theme,
17
- render,
18
- template,
19
- beforeRenderHooks,
20
- preloadApplication = true
21
- } = _ref;
10
+ const serverNoSSR = ({
11
+ request,
12
+ locales,
13
+ customReducers,
14
+ serverPreferences = [],
15
+ theme,
16
+ render,
17
+ template,
18
+ beforeRenderHooks,
19
+ preloadApplication = true
20
+ }) => {
22
21
  const isPreviewCheck = request.getHeader("X-BI-Preview-Available");
23
22
  if (isPreviewCheck) {
24
23
  return "<h1>Preview Available</h1>";
@@ -1 +1 @@
1
- {"version":3,"file":"serverNoSSR.js","names":["createUUID","getFullRequestHref","createReduxStore","setI18n","setApplication","setServerPreferences","setConfigurationTheme","handleErrors","handleBeforeRenderHooks","renderSSRMinimal","createTheme","serverNoSSR","_ref","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","preloadApplication","isPreviewCheck","getHeader","UUID","__webpack_nonce__","requestHref","store","storedTheme","getState","preferences"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { Theme } from \"../react-theme/types\";\n\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Theme | Array<Theme>,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n preloadApplication?: boolean,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n preloadApplication = true,\n}: serverProps): string => {\n const isPreviewCheck = request.getHeader(\"X-BI-Preview-Available\");\n if (isPreviewCheck) {\n return \"<h1>Preview Available</h1>\";\n }\n\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n //$FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n if (preloadApplication) {\n setApplication(store);\n }\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":"AACA,OAAO,eAAe;AAEtB,OAAOA,UAAU,MAAM,6BAA6B;AACpD,SAASC,kBAAkB,Q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O,KAAK;IAAEd;EAAQ,CAAC,CAAC;EAE9D,OAAOJ,gBAAgB,CAAC;IAAEkB,KAAK;IAAEV,KAAK;IAAEO,IAAI;IAAEN,MAAM;IAAEC;EAAS,CAAC,CAAC;AACnE,CAAC;AAED,eAAeR,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"serverNoSSR.js","names":["createUUID","getFullRequestHref","createReduxStore","setI18n","setApplication","setServerPreferences","setConfigurationTheme","handleErrors","handleBeforeRenderHooks","renderSSRMinimal","createTheme","serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","preloadApplication","isPreviewCheck","getHeader","UUID","__webpack_nonce__","requestHref","store","storedTheme","getState","preferences"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { Theme } from \"../react-theme/types\";\n\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Theme | Array<Theme>,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n preloadApplication?: boolean,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n preloadApplication = true,\n}: serverProps): string => {\n const isPreviewCheck = request.getHeader(\"X-BI-Preview-Available\");\n if (isPreviewCheck) {\n return \"<h1>Preview Available</h1>\";\n }\n\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n //$FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n if (preloadApplication) {\n setApplication(store);\n }\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":"AACA,OAAO,eAAe;AAEtB,OAAOA,UAAU,MAAM,6BAA6B;AACpD,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,SACEC,gBAAgB,EAChBC,OAAO,EACPC,cAAc,EACdC,oBAAoB,EACpBC,qBAAqB,EACrBC,YAAY,QACP,cAAc;AAErB,SAASC,uBAAuB,QAAQ,kCAAkC;AAE1E,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,OAAOC,WAAW,MAAM,4BAA4B;AAoBpD;AACA;AACA,MAAMC,WAAW,GAAGA,CAAC;EACnBC,OAAO;EACPC,OAAO;EACPC,cAAc;EACdC,iBAAiB,GAAG,EAAE;EACtBC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,iBAAiB;EACjBC,kBAAkB,GAAG;AACV,CAAC,KAAa;EACzB,MAAMC,cAAc,GAAGT,OAAO,CAACU,SAAS,CAAC,wBAAwB,CAAC;EAClE,IAAID,cAAc,EAAE;IAClB,OAAO,4BAA4B;EACrC;EAEA,MAAME,IAAI,GAAGvB,UAAU,CAAC,CAAC;EACzBwB,iBAAiB,GAAGD,IAAI,CAAC,CAAC;;EAE1B,MAAME,WAAW,GAAGxB,kBAAkB,CAACW,OAAO,CAAC;EAE/C,MAAMc,KAAK,GAAGxB,gBAAgB,CAACuB,WAAW,EAAEX,cAAc,CAAC;EAE3DT,oBAAoB,CAACqB,KAAK,EAAEX,iBAAiB,CAAC;EAC9CT,qBAAqB,CAACoB,KAAK,CAAC;EAE5B,IAAIV,KAAK,EAAE;IACT,MAAMW,WAAW,GAAGD,KAAK,CAACE,QAAQ,CAAC,CAAC,EAAEC,WAAW,EAAEb,KAAK;IACxD;IACAN,WAAW,CAACiB,WAAW,EAAEX,KAAK,CAAC;EACjC;EAEAb,OAAO,CAACuB,KAAK,EAAEb,OAAO,EAAED,OAAO,CAAC;EAEhC,IAAIQ,kBAAkB,EAAE;IACtBhB,cAAc,CAACsB,KAAK,CAAC;EACvB;EAEAnB,YAAY,CAACmB,KAAK,CAAC;EAEnBlB,uBAAuB,CAACW,iBAAiB,EAAE;IAAEO,KAAK;IAAEd;EAAQ,CAAC,CAAC;EAE9D,OAAOH,gBAAgB,CAAC;IAAEiB,KAAK;IAAEV,KAAK;IAAEO,IAAI;IAAEN,MAAM;IAAEC;EAAS,CAAC,CAAC;AACnE,CAAC;AAED,eAAeP,WAAW","ignoreList":[]}
@@ -6,18 +6,17 @@ import { handleBeforeRenderHooks } from "../redux/store/beforeRenderHooks";
6
6
  import renderSSRComplete from "./renderSSRComplete";
7
7
  /**
8
8
  */
9
- const serverSSR = _ref => {
10
- let {
11
- request,
12
- locales,
13
- customReducers,
14
- serverPreferences = [],
15
- theme = null,
16
- render,
17
- ErrorPage,
18
- template,
19
- beforeRenderHooks
20
- } = _ref;
9
+ const serverSSR = ({
10
+ request,
11
+ locales,
12
+ customReducers,
13
+ serverPreferences = [],
14
+ theme = null,
15
+ render,
16
+ ErrorPage,
17
+ template,
18
+ beforeRenderHooks
19
+ }) => {
21
20
  const UUID = createUUID();
22
21
  __webpack_nonce__ = UUID; // NOSONAR
23
22
 
@@ -1 +1 @@
1
- {"version":3,"file":"serverSSR.js","names":["createUUID","getFullRequestHref","createReduxStore","setI18n","setServerPreferences","setConfigurationTheme","handleBeforeRenderHooks","renderSSRComplete","serverSSR","_ref","request","locales","customReducers","serverPreferences","theme","render","ErrorPage","template","beforeRenderHooks","UUID","__webpack_nonce__","requestHref","store"],"sources":["../../src/react-server/serverSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRComplete from \"./renderSSRComplete\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n ErrorPage?: any,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n ErrorPage,\n template,\n beforeRenderHooks,\n}: serverProps): Promise<string> => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n setI18n(store, locales, request);\n\n handleBeforeRenderHooks(beforeRenderHooks, { request, store });\n\n return renderSSRComplete({\n store,\n theme,\n UUID,\n requestHref,\n render,\n ErrorPage,\n template,\n });\n};\n\nexport default serverSSR;\n"],"mappings":"AACA,OAAO,eAAe;AAEtB,OAAOA,UAAU,MAAM,6BAA6B;AACpD,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,SACEC,gBAAgB,EAChBC,OAAO,EACPC,oBAAoB,EACpBC,qBAAqB,QAChB,cAAc;AAErB,SAASC,uBAAuB,QAAQ,kCAAkC;AAE1E,OAAOC,iBAAiB,MAAM,qBAAqB;AAkBnD;AACA;AACA,MAAMC,SAAS,GAAGC,IAAA,IAUkB;EAAA,IAVjB;IACjBC,OAAO;IACPC,OAAO;IACPC,cAAc;IACdC,iBAAiB,GAAG,EAAE;IACtBC,KAAK,GAAG,IAAI;IACZC,MAAM;IACNC,SAAS;IACTC,QAAQ;IACRC;EACW,CAAC,GAAAT,IAAA;EACZ,MAAMU,IAAI,GAAGnB,UAAU,CAAC,CAAC;EACzBoB,iBAAiB,GAAGD,IAAI,CAAC,CAAC;;EAE1B,MAAME,WAAW,GAAGpB,kBAAkB,CAACS,OAAO,CAAC;EAC/C,MAAMY,KAAK,GAAGpB,gBAAgB,CAACmB,WAAW,EAAET,cAAc,CAAC;EAE3DR,oBAAoB,CAACkB,KAAK,EAAET,iBAAiB,CAAC;EAC9CR,qBAAqB,CAACiB,KAAK,CAAC;EAC5BnB,OAAO,CAACmB,KAAK,EAAEX,OAAO,EAAED,OAAO,CAAC;EAEhCJ,uBAAuB,CAACY,iBAAiB,EAAE;IAAER,OAAO;IAAEY;EAAM,CAAC,CAAC;EAE9D,OAAOf,iBAAiB,CAAC;IACvBe,KAAK;IACLR,KAAK;IACLK,IAAI;IACJE,WAAW;IACXN,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeT,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"serverSSR.js","names":["createUUID","getFullRequestHref","createReduxStore","setI18n","setServerPreferences","setConfigurationTheme","handleBeforeRenderHooks","renderSSRComplete","serverSSR","request","locales","customReducers","serverPreferences","theme","render","ErrorPage","template","beforeRenderHooks","UUID","__webpack_nonce__","requestHref","store"],"sources":["../../src/react-server/serverSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRComplete from \"./renderSSRComplete\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n ErrorPage?: any,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n ErrorPage,\n template,\n beforeRenderHooks,\n}: serverProps): Promise<string> => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n setI18n(store, locales, request);\n\n handleBeforeRenderHooks(beforeRenderHooks, { request, store });\n\n return renderSSRComplete({\n store,\n theme,\n UUID,\n requestHref,\n render,\n ErrorPage,\n template,\n });\n};\n\nexport default serverSSR;\n"],"mappings":"AACA,OAAO,eAAe;AAEtB,OAAOA,UAAU,MAAM,6BAA6B;AACpD,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,SACEC,gBAAgB,EAChBC,OAAO,EACPC,oBAAoB,EACpBC,qBAAqB,QAChB,cAAc;AAErB,SAASC,uBAAuB,QAAQ,kCAAkC;AAE1E,OAAOC,iBAAiB,MAAM,qBAAqB;AAkBnD;AACA;AACA,MAAMC,SAAS,GAAGA,CAAC;EACjBC,OAAO;EACPC,OAAO;EACPC,cAAc;EACdC,iBAAiB,GAAG,EAAE;EACtBC,KAAK,GAAG,IAAI;EACZC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC;AACW,CAAC,KAAsB;EAClC,MAAMC,IAAI,GAAGlB,UAAU,CAAC,CAAC;EACzBmB,iBAAiB,GAAGD,IAAI,CAAC,CAAC;;EAE1B,MAAME,WAAW,GAAGnB,kBAAkB,CAACQ,OAAO,CAAC;EAC/C,MAAMY,KAAK,GAAGnB,gBAAgB,CAACkB,WAAW,EAAET,cAAc,CAAC;EAE3DP,oBAAoB,CAACiB,KAAK,EAAET,iBAAiB,CAAC;EAC9CP,qBAAqB,CAACgB,KAAK,CAAC;EAC5BlB,OAAO,CAACkB,KAAK,EAAEX,OAAO,EAAED,OAAO,CAAC;EAEhCH,uBAAuB,CAACW,iBAAiB,EAAE;IAAER,OAAO;IAAEY;EAAM,CAAC,CAAC;EAE9D,OAAOd,iBAAiB,CAAC;IACvBc,KAAK;IACLR,KAAK;IACLK,IAAI;IACJE,WAAW;IACXN,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeR,SAAS","ignoreList":[]}
@@ -33,9 +33,7 @@ const createReduxStore = (requestHref, customReducers, initialState) => {
33
33
 
34
34
  /**
35
35
  */
36
- const setI18n = function (store) {
37
- let locales = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
38
- let request = arguments.length > 2 ? arguments[2] : undefined;
36
+ const setI18n = (store, locales = [], request) => {
39
37
  if (!Array.isArray(locales)) {
40
38
  throw new IllegalArgumentException("locales must be an array of objects");
41
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serverUtil.js","names":["createMemoryHistory","has","deepmerge","configureStore","availableLocales","Locales","getPreferredLocale","setLocales","setServerPreference","setThemePreference","setPreference","setAllContentInDataSetting","setLoginPreferences","setDateTimeSettings","getEnabledLocales","IllegalArgumentException","initModels","getLocale","ModularUIRequest","createReduxStore","requestHref","customReducers","initialState","history","initialEntries","toString","store","setI18n","locales","arguments","length","undefined","request","Array","isArray","mergedLocales","_mapInstanceProperty","call","locale","code","customLocale","_findInstanceProperty","custLocale","forEach","some","push","enabledLocales","_filterInstanceProperty","_context","_includesInstanceProperty","localesInstance","preferredLocale","dispatch","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreferences","preferencesProvider","isStudioContext","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","_startsWithInstanceProperty","dataFetcher","fetch","Error","setApplication","getState","application","fetchSync","connectKey","key","model","e","handleErrors","state","error","shouldThrowOnServer","dehydrate","modularui","status","lastModification","filteredState","_JSON$stringify","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n setDateTimeSettings,\n} from \"../redux/actions/Preferences\";\n\nimport { getEnabledLocales } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>,\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava,\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getEnabledLocales().includes(locale.code),\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n store.dispatch(setDateTimeSettings());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`,\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ]),\n );\n } catch (e) {\n // swallow error, in this case we just don't pre-cache the webapplication,\n // which has not much difference for the end user\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object,\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;AACA,SAASA,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,SAAS,MAAM,WAAW;AAEjC,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,OAAOC,OAAO,MAAM,iBAAiB;AAErC,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,UAAU,QAAQ,4BAA4B;AAEvD,SACEC,mBAAmB,EACnBC,kBAAkB,EAClBC,aAAa,EACbC,0BAA0B,EAC1BC,mBAAmB,EACnBC,mBAAmB,QACd,8BAA8B;AAErC,SAASC,iBAAiB,QAAQ,uBAAuB;AAEzD,SAASC,wBAAwB,QAAQ,eAAe;AAExD,SAASC,UAAU,QAAQ,UAAU;AACrC,SAASC,SAAS,QAAQ,yBAAyB;AAEnD,OAAOC,gBAAgB,MAAM,+BAA+B;AAa5D;AACA;AACA,MAAMC,gBAAgB,GAAGA,CACvBC,WAAiB,EACjBC,cAAsB,EACtBC,YAAiC,KAClB;EACf;EACA,MAAMC,OAAsB,GAAGvB,mBAAmB,CAAC;IACjDwB,cAAc,EAAE,CAACJ,WAAW,CAACK,QAAQ,CAAC,CAAC;EACzC,CAAC,CAAC;EAEF,MAAM;IAAEC;EAAM,CAAC,GAAGv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C;;AAED;AACA;AACA,MAAMC,UAAU,GAAGA,CACjBC,KAAU,EACVC,IAAY,EACZC,aAAsB,KACX;EACX,MAAMC,KAAK,GAAGH,KAAK,CAACI,YAAY,CAAC,CAAC;EAClC,MAAMC,IAAI,GAAGH,aAAa,GAAG,CAAC,GAAGA,aAAa,CAACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAED,SACE7E,gBAAgB,EAChBQ,OAAO,EACP4C,cAAc,EACdZ,oBAAoB,EACpBG,qBAAqB,EACrB4B,UAAU,EACVX,YAAY,EACZI,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"serverUtil.js","names":["createMemoryHistory","has","deepmerge","configureStore","availableLocales","Locales","getPreferredLocale","setLocales","setServerPreference","setThemePreference","setPreference","setAllContentInDataSetting","setLoginPreferences","setDateTimeSettings","getEnabledLocales","IllegalArgumentException","initModels","getLocale","ModularUIRequest","createReduxStore","requestHref","customReducers","initialState","history","initialEntries","toString","store","setI18n","locales","request","Array","isArray","mergedLocales","_mapInstanceProperty","call","locale","code","customLocale","_findInstanceProperty","custLocale","forEach","some","push","enabledLocales","_filterInstanceProperty","_context","_includesInstanceProperty","localesInstance","preferredLocale","dispatch","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreferences","preferencesProvider","isStudioContext","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","_startsWithInstanceProperty","dataFetcher","fetch","Error","setApplication","getState","application","fetchSync","connectKey","key","model","e","handleErrors","state","error","shouldThrowOnServer","dehydrate","modularui","status","lastModification","undefined","filteredState","_JSON$stringify","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n setDateTimeSettings,\n} from \"../redux/actions/Preferences\";\n\nimport { getEnabledLocales } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>,\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava,\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getEnabledLocales().includes(locale.code),\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>,\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n store.dispatch(setDateTimeSettings());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`,\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ]),\n );\n } catch (e) {\n // swallow error, in this case we just don't pre-cache the webapplication,\n // which has not much difference for the end user\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object,\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;AACA,SAASA,mBAAmB,QAAQ,SAAS;AAC7C,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,SAAS,MAAM,WAAW;AAEjC,OAAO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,SAAS,EAAE;IACjC,MAAM;MAAEC,MAAM;MAAER,KAAK;MAAES;IAAiB,CAAC,GAAGN,KAAK,CAACI,SAAS,CAACR,GAAG,CAAC;IAEhE,IAAIC,KAAK,EAAE;MACTO,SAAS,CAACR,GAAG,CAAC,GAAG;QACfS,MAAM;QACNC,gBAAgB;QAChBT,KAAK,EAAEA,KAAK,CAACM,SAAS,CAAC;MACzB,CAAC;IACH,CAAC,MAAM;MACLC,SAAS,CAACR,GAAG,CAAC,GAAG;QACfS,MAAM;QACNC,gBAAgB;QAChBT,KAAK,EAAEU;MACT,CAAC;IACH;EACF;EAEA,MAAMC,aAAa,GAAG;IACpB,GAAGR,KAAK;IACRI;EACF,CAAC;EAED,OAAOK,eAAA,CAAeD,aAAa,CAAC,CAACE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC/D,CAAC;;AAED;AACA;AACA,MAAMC,UAAU,GAAGA,CACjBC,KAAU,EACVC,IAAY,EACZC,aAAsB,KACX;EACX,MAAMC,KAAK,GAAGH,KAAK,CAACI,YAAY,CAAC,CAAC;EAClC,MAAMC,IAAI,GAAGH,aAAa,GAAG,CAAC,GAAGA,aAAa,CAACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAED,SACE3E,gBAAgB,EAChBQ,OAAO,EACPyC,cAAc,EACdZ,oBAAoB,EACpBG,qBAAqB,EACrB6B,UAAU,EACVZ,YAAY,EACZI,SAAS","ignoreList":[]}
@@ -4,17 +4,13 @@ import createTheme from "./createTheme";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  /**
6
6
  */
7
- const ThemeProvider = _ref => {
8
- let {
9
- theme,
10
- children
11
- } = _ref;
12
- const storedTheme = useSelector(_ref2 => {
13
- let {
14
- preferences
15
- } = _ref2;
16
- return preferences.theme;
17
- });
7
+ const ThemeProvider = ({
8
+ theme,
9
+ children
10
+ }) => {
11
+ const storedTheme = useSelector(({
12
+ preferences
13
+ }) => preferences.theme);
18
14
  const finalTheme = createTheme(storedTheme, theme);
19
15
  return /*#__PURE__*/_jsx(SCThemeProvider, {
20
16
  theme: finalTheme,
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","names":["useSelector","ThemeProvider","SCThemeProvider","createTheme","jsx","_jsx","_ref","theme","children","storedTheme","_ref2","preferences","finalTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,aAAa,IAAIC,eAAe,QAAQ,mBAAmB;AAEpE,OAAOC,WAAW,MAAM,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUxC;AACA;AACA,MAAMJ,aAAa,GAAGK,IAAA,IAAsC;EAAA,IAArC;IAAEC,KAAK;IAAEC;EAAgB,CAAC,GAAAF,IAAA;EAC/C,MAAMG,WAAW,GAAGT,WAAW,CAACU,KAAA;IAAA,IAAC;MAAEC;IAAY,CAAC,GAAAD,KAAA;IAAA,OAAKC,WAAW,CAACJ,KAAK;EAAA,EAAC;EACvE,MAAMK,UAAU,GAAGT,WAAW,CAACM,WAAW,EAAEF,KAAK,CAAC;EAElD,oBAAOF,IAAA,CAACH,eAAe;IAACK,KAAK,EAAEK,UAAW;IAAAJ,QAAA,EAAEA;EAAQ,CAAkB,CAAC;AACzE,CAAC;AACDP,aAAa,CAACY,WAAW,GAAG,kBAAkB;AAE9C,eAAeZ,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"ThemeProvider.js","names":["useSelector","ThemeProvider","SCThemeProvider","createTheme","jsx","_jsx","theme","children","storedTheme","preferences","finalTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,aAAa,IAAIC,eAAe,QAAQ,mBAAmB;AAEpE,OAAOC,WAAW,MAAM,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUxC;AACA;AACA,MAAMJ,aAAa,GAAGA,CAAC;EAAEK,KAAK;EAAEC;AAAgB,CAAC,KAAW;EAC1D,MAAMC,WAAW,GAAGR,WAAW,CAAC,CAAC;IAAES;EAAY,CAAC,KAAKA,WAAW,CAACH,KAAK,CAAC;EACvE,MAAMI,UAAU,GAAGP,WAAW,CAACK,WAAW,EAAEF,KAAK,CAAC;EAElD,oBAAOD,IAAA,CAACH,eAAe;IAACI,KAAK,EAAEI,UAAW;IAAAH,QAAA,EAAEA;EAAQ,CAAkB,CAAC;AACzE,CAAC;AACDN,aAAa,CAACU,WAAW,GAAG,kBAAkB;AAE9C,eAAeV,aAAa","ignoreList":[]}
@@ -8,8 +8,7 @@ const replacePlaceholders = inputTheme => {
8
8
  var _context;
9
9
  const possibleKeys = _mapInstanceProperty(_context = _Object$keys(inputTheme)).call(_context, key => `\\b${key}\\b`).join("|");
10
10
  const re = new RegExp(`\\$(${possibleKeys})`, "g");
11
- _Object$entries(inputTheme).forEach(_ref => {
12
- let [key, value] = _ref;
11
+ _Object$entries(inputTheme).forEach(([key, value]) => {
13
12
  if (key !== "settings" && typeof value === "string") {
14
13
  inputTheme[key] = value.replace(re,
15
14
  // $FlowIssue[incompatible-call]
@@ -18,14 +17,11 @@ const replacePlaceholders = inputTheme => {
18
17
  });
19
18
  return inputTheme;
20
19
  };
21
- const generateTheme = function (storedTheme) {
20
+ const generateTheme = (storedTheme, ...themeElements) => {
22
21
  const storedSettings = storedTheme?.settings ?? {};
23
22
  let generatedTheme = {
24
23
  settings: {}
25
24
  };
26
- for (var _len = arguments.length, themeElements = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
27
- themeElements[_key - 1] = arguments[_key];
28
- }
29
25
  for (const element of themeElements) {
30
26
  if (typeof element === "function") {
31
27
  generatedTheme = element(replacePlaceholders(generatedTheme));
@@ -94,10 +90,7 @@ const generateTheme = function (storedTheme) {
94
90
  * SECONDARY_COLOR: "#00ff00",
95
91
  * }
96
92
  */
97
- const createTheme = function (storedTheme) {
98
- for (var _len2 = arguments.length, themeConfigs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
99
- themeConfigs[_key2 - 1] = arguments[_key2];
100
- }
93
+ const createTheme = (storedTheme, ...themeConfigs) => {
101
94
  const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));
102
95
  if (customTheme) {
103
96
  setSettings(customTheme.settings);
@@ -1 +1 @@
1
- {"version":3,"file":"createTheme.js","names":["flattenDeep","isPlainObject","setSettings","replacePlaceholders","inputTheme","_context","possibleKeys","_mapInstanceProperty","_Object$keys","call","key","join","re","RegExp","_Object$entries","forEach","_ref","value","replace","match","capture","generateTheme","storedTheme","storedSettings","settings","generatedTheme","_len","arguments","length","themeElements","Array","_key","element","generatedSettings","createTheme","_len2","themeConfigs","_key2","customTheme"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme: Theme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n // $FlowIssue[incompatible-call]\n (match, capture) => inputTheme[capture],\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme: Theme, ...themeElements: Array<Theme>) => {\n const storedSettings = storedTheme?.settings ?? {};\n\n let generatedTheme = { settings: {} };\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n const generatedSettings = generatedTheme.settings;\n // $FlowFixMe[cannot-spread-indexer]\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n if (\"settings\" in element) {\n generatedTheme.settings = {\n ...generatedSettings,\n ...element.settings,\n ...storedSettings,\n };\n }\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme> | void>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;AACA,OAAOA,WAAW,MAAM,oBAAoB;AAE5C,SAASC,aAAa,QAAQ,0BAA0B;AAExD,SAASC,WAAW,QAAQ,uBAAuB;AAInD,MAAMC,mBAAmB,GAAIC,UAAiB,IAAK;EAAA,IAAAC,QAAA;EACjD,MAAMC,YAAY,GAAGC,oBAAA,CAAAF,QAAA,GAAAG,YAAA,CAAY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AAGR,cAAc,CAACD,QAAQ;MACjD;MACAC,cAAc,GAAG;QAAE,GAAGA,cAAc;QAAE,GAAGO,OAAO;QAAE,GAAGV;MAAY,CAAC;MAClE,IAAI,UAAU,IAAIU,OAAO,EAAE;QACzBP,cAAc,CAACD,QAAQ,GAAG;UACxB,GAAGS,iBAAiB;UACpB,GAAGD,OAAO,CAACR,QAAQ;UACnB,GAAGD;QACL,CAAC;MACH;IACF;EACF;;EAEA;EACA,OAAOpB,mBAAmB,CAACsB,cAAc,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMS,WAAW,GAAG,SAAAA,CAClBZ,WAAkB,EAUX;EAAA,SAAAa,KAAA,GAAAR,SAAA,CAAAC,MAAA,EATJQ,YAAY,OAAAN,KAAA,CAAAK,KAAA,OAAAA,KAAA,WAAAE,KAAA,MAAAA,KAAA,GAAAF,KAAA,EAAAE,KAAA;IAAZD,YAAY,CAAAC,KAAA,QAAAV,SAAA,CAAAU,KAAA;EAAA;EAUf,MAAMC,WAAW,GAAGjB,aAAa,CAACC,WAAW,EAAE,GAAGtB,WAAW,CAACoC,YAAY,CAAC,CAAC;EAE5E,IAAIE,WAAW,EAAE;IACfpC,WAAW,CAACoC,WAAW,CAACd,QAAQ,CAAC;EACnC;EAEA,OAAOc,WAAW;AACpB,CAAC;AAED,eAAeJ,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"createTheme.js","names":["flattenDeep","isPlainObject","setSettings","replacePlaceholders","inputTheme","_context","possibleKeys","_mapInstanceProperty","_Object$keys","call","key","join","re","RegExp","_Object$entries","forEach","value","replace","match","capture","generateTheme","storedTheme","themeElements","storedSettings","settings","generatedTheme","element","generatedSettings","createTheme","themeConfigs","customTheme"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme: Theme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (key !== \"settings\" && typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n // $FlowIssue[incompatible-call]\n (match, capture) => inputTheme[capture],\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme: Theme, ...themeElements: Array<Theme>) => {\n const storedSettings = storedTheme?.settings ?? {};\n\n let generatedTheme = { settings: {} };\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n const generatedSettings = generatedTheme.settings;\n // $FlowFixMe[cannot-spread-indexer]\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n if (\"settings\" in element) {\n generatedTheme.settings = {\n ...generatedSettings,\n ...element.settings,\n ...storedSettings,\n };\n }\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme> | void>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;AACA,OAAOA,WAAW,MAAM,oBAAoB;AAE5C,SAASC,aAAa,QAAQ,0BAA0B;AAExD,SAASC,WAAW,QAAQ,uBAAuB;AAInD,MAAMC,mBAAmB,GAAIC,UAAiB,IAAK;EAAA,IAAAC,QAAA;EACjD,MAAMC,YAAY,GAAGC,oBAAA,CAAAF,QAAA,GAAAG,YAAA,CAAYJ,UAAU,CAAC,EAAAK,IAAA,CAAAJ,QAAA,EACpCK,GAAG,IAAK,MAAMA,GAAG,KAAK,CAAC,CAC5BC,IAAI,CAAC,GAAG,CAAC;EAEZ,MAAMC,EAAE,GAAG,IAAIC,MAAM,CAAC,OAAOP,YAAY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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAGA,CAClBP,WAAkB,EAClB,GAAGQ,YAAgD,KAS5C;EACP,MAAMC,WAAW,GAAGV,aAAa,CAACC,WAAW,EAAE,GAAGrB,WAAW,CAAC6B,YAAY,CAAC,CAAC;EAE5E,IAAIC,WAAW,EAAE;IACf5B,WAAW,CAAC4B,WAAW,CAACN,QAAQ,CAAC;EACnC;EAEA,OAAOM,WAAW;AACpB,CAAC;AAED,eAAeF,WAAW","ignoreList":[]}
@@ -1,10 +1,9 @@
1
1
  import { getThemeProp } from "./themeProps";
2
2
  /**
3
3
  */
4
- const renderBackground = (path, defaultValue) => _ref => {
5
- let {
6
- theme
7
- } = _ref;
4
+ const renderBackground = (path, defaultValue) => ({
5
+ theme
6
+ }) => {
8
7
  const value = getThemeProp(theme, path, defaultValue);
9
8
  if (typeof value === "string") {
10
9
  return `background: ${value}`;
@@ -1 +1 @@
1
- {"version":3,"file":"background.js","names":["getThemeProp","renderBackground","path","defaultValue","_ref","theme","value"],"sources":["../../../src/react-theme/utils/background.js"],"sourcesContent":["// @flow\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n */\nconst renderBackground =\n (path: string, defaultValue?: string): ((UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,cAAc;AAI3C;AACA;AACA,MAAMC,gBAAgB,GACpBA,CAACC,IAAY,EAAEC,YAAqB,KACpCC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EACxB,MAAME,KAAK,GAAGN,YAAY,CAACK,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC;EAErD,IAAI,OAAOG,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,eAAeA,KAAK,EAAE;EAC/B;EAEA,OAAOA,KAAK;AACd,CAAC;AAEH,SAASL,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"background.js","names":["getThemeProp","renderBackground","path","defaultValue","theme","value"],"sources":["../../../src/react-theme/utils/background.js"],"sourcesContent":["// @flow\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n */\nconst renderBackground =\n (path: string, defaultValue?: string): ((UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,cAAc;AAI3C;AACA;AACA,MAAMC,gBAAgB,GACpBA,CAACC,IAAY,EAAEC,YAAqB,KACpC,CAAC;EAAEC;AAAsB,CAAC,KAAK;EAC7B,MAAMC,KAAK,GAAGL,YAAY,CAACI,KAAK,EAAEF,IAAI,EAAEC,YAAY,CAAC;EAErD,IAAI,OAAOE,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,eAAeA,KAAK,EAAE;EAC/B;EAEA,OAAOA,KAAK;AACd,CAAC;AAEH,SAASJ,gBAAgB","ignoreList":[]}
@@ -5,33 +5,24 @@ import { getThemeProp } from "./themeProps";
5
5
  */
6
6
  /**
7
7
  */
8
- const darkenColor = (amount, path, defaultValue) => _ref => {
9
- let {
10
- theme
11
- } = _ref;
12
- return darken(amount, getThemeProp(theme, path, defaultValue));
13
- };
8
+ const darkenColor = (amount, path, defaultValue) => ({
9
+ theme
10
+ }) => darken(amount, getThemeProp(theme, path, defaultValue));
14
11
 
15
12
  /*
16
13
  * Themed color x amount lightened
17
14
  */
18
15
  /**
19
16
  */
20
- const lightenColor = (amount, path, defaultValue) => _ref2 => {
21
- let {
22
- theme
23
- } = _ref2;
24
- return lighten(amount, getThemeProp(theme, path, defaultValue));
25
- };
17
+ const lightenColor = (amount, path, defaultValue) => ({
18
+ theme
19
+ }) => lighten(amount, getThemeProp(theme, path, defaultValue));
26
20
 
27
21
  /*
28
22
  * Make a color lighter or darker in the same color family
29
23
  */
30
24
  /**
31
25
  */
32
- const changeHSL = function (color, saturation, lightness) {
33
- let hueAdjustment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
34
- return hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);
35
- };
26
+ const changeHSL = (color, saturation, lightness, hueAdjustment = 0) => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);
36
27
  export { darkenColor, lightenColor, changeHSL };
37
28
  //# sourceMappingURL=colors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":["darken","hsl","lighten","parseToHsl","getThemeProp","darkenColor","amount","path","defaultValue","_ref","theme","lightenColor","_ref2","changeHSL","color","saturation","lightness","hueAdjustment","arguments","length","undefined","hue"],"sources":["../../../src/react-theme/utils/colors.js"],"sourcesContent":["// @flow\nimport { darken, hsl, lighten, parseToHsl } from \"polished\";\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\n/**\n */\nconst darkenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string,\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Themed color x amount lightened\n */\n/**\n */\nconst lightenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string,\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Make a color lighter or darker in the same color family\n */\n/**\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment: number = 0,\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n"],"mappings":"AACA,SAASA,MAAM,EAAEC,GAAG,EAAEC,OAAO,EAAEC,UAAU,QAAQ,UAAU;AAC3D,SAASC,YAAY,QAAQ,cAAc;AAI3C;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GACfA,CACEC,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvBC,IAAA;EAAA,IAAC;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAAA,OACxBT,MAAM,CAACM,MAAM,EAAEF,YAAY,CAACM,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC,CAAC;AAAA;;AAE3D;AACA;AACA;AACA;AACA;AACA,MAAMG,YAAY,GAChBA,CACEL,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvBI,KAAA;EAAA,IAAC;IAAEF;EAAsB,CAAC,GAAAE,KAAA;EAAA,OACxBV,OAAO,CAACI,MAAM,EAAEF,YAAY,CAACM,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC,CAAC;AAAA;;AAE5D;AACA;AACA;AACA;AACA;AACA,MAAMK,SAAS,GAAG,SAAAA,CAChBC,KAAa,EACbC,UAAmB,EACnBC,SAAkB;EAAA,IAClBC,aAAqB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,OACdjB,GAAG,CAACE,UAAU,CAACW,KAAK,CAAC,CAACO,GAAG,GAAGJ,aAAa,EAAEF,UAAU,EAAEC,SAAS,CAAC;AAAA;AAE9E,SAASX,WAAW,EAAEM,YAAY,EAAEE,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"colors.js","names":["darken","hsl","lighten","parseToHsl","getThemeProp","darkenColor","amount","path","defaultValue","theme","lightenColor","changeHSL","color","saturation","lightness","hueAdjustment","hue"],"sources":["../../../src/react-theme/utils/colors.js"],"sourcesContent":["// @flow\nimport { darken, hsl, lighten, parseToHsl } from \"polished\";\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\n/**\n */\nconst darkenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string,\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Themed color x amount lightened\n */\n/**\n */\nconst lightenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string,\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Make a color lighter or darker in the same color family\n */\n/**\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment: number = 0,\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n"],"mappings":"AACA,SAASA,MAAM,EAAEC,GAAG,EAAEC,OAAO,EAAEC,UAAU,QAAQ,UAAU;AAC3D,SAASC,YAAY,QAAQ,cAAc;AAI3C;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GACfA,CACEC,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvB,CAAC;EAAEC;AAAsB,CAAC,KACxBT,MAAM,CAACM,MAAM,EAAEF,YAAY,CAACK,KAAK,EAAEF,IAAI,EAAEC,YAAY,CAAC,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AACA,MAAME,YAAY,GAChBA,CACEJ,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvB,CAAC;EAAEC;AAAsB,CAAC,KACxBP,OAAO,CAACI,MAAM,EAAEF,YAAY,CAACK,KAAK,EAAEF,IAAI,EAAEC,YAAY,CAAC,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA,MAAMG,SAAS,GAAGA,CAChBC,KAAa,EACbC,UAAmB,EACnBC,SAAkB,EAClBC,aAAqB,GAAG,CAAC,KACdd,GAAG,CAACE,UAAU,CAACS,KAAK,CAAC,CAACI,GAAG,GAAGD,aAAa,EAAEF,UAAU,EAAEC,SAAS,CAAC;AAE9E,SAAST,WAAW,EAAEK,YAAY,EAAEC,SAAS","ignoreList":[]}
@@ -27,10 +27,7 @@ const getYIQ = color => {
27
27
  * When the contrast between the color and the light or dark color is too low,
28
28
  * the preferred color is returned
29
29
  */
30
- const getContrastYIQ = function (color) {
31
- let dark = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "#212529";
32
- let light = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "#fff";
33
- let preferredColor = arguments.length > 3 ? arguments[3] : undefined;
30
+ const getContrastYIQ = (color, dark = "#212529", light = "#fff", preferredColor) => {
34
31
  const yiqColor = getYIQ(color);
35
32
  if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {
36
33
  return preferredColor;
@@ -66,21 +63,16 @@ const getBackgroundColor = (theme, bgColorProperty, defaultValue) => {
66
63
  * Retrieve the contrast color for the given background property,
67
64
  * based on theme properties
68
65
  */
69
- const renderContrastColor = function (bgColorProperty, preferredColorProperty) {
70
- let standardDarkProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "YIQ_DARK_COLOR";
71
- let standardLightProperty = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "YIQ_LIGHT_COLOR";
72
- return _ref => {
73
- let {
74
- theme = {
75
- settings: {}
76
- }
77
- } = _ref;
78
- const bgColor = getBackgroundColor(theme, bgColorProperty, "#ffffff");
79
- const preferredColor = getThemeStringProp(theme, preferredColorProperty);
80
- const darkColor = getThemeStringProp(theme, standardDarkProperty, "#212529");
81
- const lightColor = getThemeStringProp(theme, standardLightProperty, "#fff");
82
- return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);
83
- };
66
+ const renderContrastColor = (bgColorProperty, preferredColorProperty, standardDarkProperty = "YIQ_DARK_COLOR", standardLightProperty = "YIQ_LIGHT_COLOR") => ({
67
+ theme = {
68
+ settings: {}
69
+ }
70
+ }) => {
71
+ const bgColor = getBackgroundColor(theme, bgColorProperty, "#ffffff");
72
+ const preferredColor = getThemeStringProp(theme, preferredColorProperty);
73
+ const darkColor = getThemeStringProp(theme, standardDarkProperty, "#212529");
74
+ const lightColor = getThemeStringProp(theme, standardLightProperty, "#fff");
75
+ return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);
84
76
  };
85
77
  export { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };
86
78
  //# sourceMappingURL=contrast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contrast.js","names":["getLuminance","parseToRgb","getThemeStringProp","getProp","ThemePropertyException","getColorContrast","color1","color2","luminance1","luminance2","parseFloat","toFixed","getYIQ","color","rgb","red","green","blue","getContrastYIQ","dark","arguments","length","undefined","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","backgroundColor","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","_ref","settings"],"sources":["../../../src/react-theme/utils/contrast.js"],"sourcesContent":["// @flow\nimport { getLuminance, parseToRgb } from \"polished\";\n\nimport { getThemeStringProp, getProp } from \"./themeProps\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string): number => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2),\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\n/**\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: string,\n dark: string = \"#212529\",\n light: string = \"#fff\",\n preferredColor?: string,\n): string => {\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\n/**\n */\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string,\n) => {\n let bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (typeof bgColor === \"object\") {\n bgColor = bgColor?.backgroundColor ?? defaultValue;\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n throw new ThemePropertyException(\n `${bgColorProperty} is not a string, but: ${typeof bgColor}`,\n );\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty: string,\n preferredColorProperty?: string,\n standardDarkProperty: string = \"YIQ_DARK_COLOR\",\n standardLightProperty: string = \"YIQ_LIGHT_COLOR\",\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\",\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport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qBAA6B,GAAAjB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,iBAAiB;EAAA,OAEnDkB,IAAA,IAAkD;IAAA,IAAjD;MAAET,KAAK,GAAG;QAAEU,QAAQ,EAAE,CAAC;MAAE;IAAkB,CAAC,GAAAD,IAAA;IAC3C,MAAMN,OAAO,GAAGJ,kBAAkB,CAACC,KAAK,EAAEC,eAAe,EAAE,SAAS,CAAC;IACrE,MAAMN,cAAc,GAAGtB,kBAAkB,CAAC2B,KAAK,EAAEM,sBAAsB,CAAC;IACxE,MAAMT,SAAS,GAAGxB,kBAAkB,CAClC2B,KAAK,EACLO,oBAAoB,EACpB,SACF,CAAC;IACD,MAAMT,UAAU,GAAGzB,kBAAkB,CAAC2B,KAAK,EAAEQ,qBAAqB,EAAE,MAAM,CAAC;IAE3E,OAAOnB,cAAc,CAACc,OAAO,EAAEN,SAAS,EAAEC,UAAU,EAAEH,cAAc,CAAC;EACvE,CAAC;AAAA;AAEH,SAASnB,gBAAgB,EAAEO,MAAM,EAAEM,cAAc,EAAEgB,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"contrast.js","names":["getLuminance","parseToRgb","getThemeStringProp","getProp","ThemePropertyException","getColorContrast","color1","color2","luminance1","luminance2","parseFloat","toFixed","getYIQ","color","rgb","red","green","blue","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","backgroundColor","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","settings"],"sources":["../../../src/react-theme/utils/contrast.js"],"sourcesContent":["// @flow\nimport { getLuminance, parseToRgb } from \"polished\";\n\nimport { getThemeStringProp, getProp } from \"./themeProps\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string): number => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2),\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\n/**\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: string,\n dark: string = \"#212529\",\n light: string = \"#fff\",\n preferredColor?: string,\n): string => {\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\n/**\n */\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string,\n) => {\n let bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (typeof bgColor === \"object\") {\n bgColor = bgColor?.backgroundColor ?? defaultValue;\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n throw new ThemePropertyException(\n `${bgColorProperty} is not a string, but: ${typeof bgColor}`,\n );\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty: string,\n preferredColorProperty?: string,\n standardDarkProperty: string = \"YIQ_DARK_COLOR\",\n standardLightProperty: string = \"YIQ_LIGHT_COLOR\",\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\",\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n"],"mappings":"AACA,SAASA,YAAY,EAAEC,UAAU,QAAQ,UAAU;AAEnD,SAASC,kBAAkB,EAAEC,OAAO,QAAQ,cAAc;AAE1D,SAASC,sBAAsB,QAAQ,kBAAkB;AAIzD;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAa;EACnE,MAAMC,UAAU,GAAGR,YAAY,CAACM,MAAM,CAAC;EACvC,MAAMG,UAAU,GAAGT,YAAY,CAACO,MAAM,CAAC;EACvC,OAAOG,UAAU,CACf,CAACF,UAAU,GAAGC,UAAU,GACpB,CAACD,UAAU,GAAG,IAAI,KAAKC,UAAU,GAAG,IAAI,CAAC,GACzC,CAACA,UAAU,GAAG,IAAI,KAAKD,UAAU,GAAG,IAAI,CAAC,EAC3CG,OAAO,CAAC,CAAC,CACb,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,MAAM,GAAIC,KAAa,IAAa;EACxC,MAAMC,GAAG,GAAGb,UAAU,CAACY,KAAK,CAAC;EAE7B,OAAO,CAACC,GAAG,CAACC,GAAG,GAAG,GAAG,GAAGD,GAAG,CAACE,KAAK,GAAG,GAAG,GAAGF,GAAG,CAACG,IAAI,GAAG,GAAG,IAAI,IAAI;AAClE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CACrBL,KAAa,EACbM,IAAY,GAAG,SAAS,EACxB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A6B,GAAG,iBAAiB,KAEnD,CAAC;EAAER,KAAK,GAAG;IAAES,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAAK;EAChD,MAAMN,OAAO,GAAGJ,kBAAkB,CAACC,KAAK,EAAEC,eAAe,EAAE,SAAS,CAAC;EACrE,MAAMN,cAAc,GAAGnB,kBAAkB,CAACwB,KAAK,EAAEM,sBAAsB,CAAC;EACxE,MAAMT,SAAS,GAAGrB,kBAAkB,CAClCwB,KAAK,EACLO,oBAAoB,EACpB,SACF,CAAC;EACD,MAAMT,UAAU,GAAGtB,kBAAkB,CAACwB,KAAK,EAAEQ,qBAAqB,EAAE,MAAM,CAAC;EAE3E,OAAOhB,cAAc,CAACW,OAAO,EAAEN,SAAS,EAAEC,UAAU,EAAEH,cAAc,CAAC;AACvE,CAAC;AAEH,SAAShB,gBAAgB,EAAEO,MAAM,EAAEM,cAAc,EAAEa,mBAAmB","ignoreList":[]}
@@ -7,22 +7,16 @@ const DEFAULT_CORNER_PROPERTY = "border-radius";
7
7
  */
8
8
  /**
9
9
  */
10
- const roundedCorners = function () {
11
- let property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CORNER_PROPERTY;
12
- let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "BORDER_RADIUS";
13
- let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "0.25rem";
14
- return _ref => {
15
- let {
16
- theme = {
17
- settings: {}
18
- }
19
- } = _ref;
20
- if (theme.ROUNDED_CORNERS) {
21
- const propertyName = property && property !== DEFAULT_CORNER_PROPERTY ? `border-${property}-radius` : DEFAULT_CORNER_PROPERTY;
22
- return `${propertyName}: ${getThemeStringProp(theme, path, defaultValue)}`;
23
- }
24
- return "";
25
- };
10
+ const roundedCorners = (property = DEFAULT_CORNER_PROPERTY, path = "BORDER_RADIUS", defaultValue = "0.25rem") => ({
11
+ theme = {
12
+ settings: {}
13
+ }
14
+ }) => {
15
+ if (theme.ROUNDED_CORNERS) {
16
+ const propertyName = property && property !== DEFAULT_CORNER_PROPERTY ? `border-${property}-radius` : DEFAULT_CORNER_PROPERTY;
17
+ return `${propertyName}: ${getThemeStringProp(theme, path, defaultValue)}`;
18
+ }
19
+ return "";
26
20
  };
27
21
  export { roundedCorners };
28
22
  //# sourceMappingURL=corners.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"corners.js","names":["getThemeStringProp","DEFAULT_CORNER_PROPERTY","roundedCorners","property","arguments","length","undefined","path","defaultValue","_ref","theme","settings","ROUNDED_CORNERS","propertyName"],"sources":["../../../src/react-theme/utils/corners.js"],"sourcesContent":["// @flow\nimport { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\n/**\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path: string = \"BORDER_RADIUS\",\n defaultValue: string = \"0.25rem\",\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue,\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,cAAc;AAIjD,MAAMC,uBAAuB,GAAG,eAAe;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAClB,SAAAA,CAAA;EAAA,IACEC,QAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGH,uBAAuB;EAAA,IAC1CM,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,eAAe;EAAA,IAC9BI,YAAoB,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EAAA,OAElCK,IAAA,IAAkD;IAAA,IAAjD;MAAEC,KAAK,GAAG;QAAEC,QAAQ,EAAE,CAAC;MAAE;IAAkB,CAAC,GAAAF,IAAA;IAC3C,IAAIC,KAAK,CAACE,eAAe,EAAE;MACzB,MAAMC,YAAY,GAChBV,QAAQ,IAAIA,QAAQ,KAAKF,uBAAuB,GAC5C,UAAUE,QAAQ,SAAS,GAC3BF,uBAAuB;MAE7B,OAAO,GAAGY,YAAY,KAAKb,kBAAkB,CAC3CU,KAAK,EACLH,IAAI,EACJC,YACF,CAAC,EAAE;IACL;IAEA,OAAO,EAAE;EACX,CAAC;AAAA;AAEH,SAASN,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"corners.js","names":["getThemeStringProp","DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","settings","ROUNDED_CORNERS","propertyName"],"sources":["../../../src/react-theme/utils/corners.js"],"sourcesContent":["// @flow\nimport { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\n/**\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path: string = \"BORDER_RADIUS\",\n defaultValue: string = \"0.25rem\",\n ): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue,\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,cAAc;AAIjD,MAAMC,uBAAuB,GAAG,eAAe;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAClBA,CACEC,QAAgB,GAAGF,uBAAuB,EAC1CG,IAAY,GAAG,eAAe,EAC9BC,YAAoB,GAAG,SAAS,KAElC,CAAC;EAAEC,KAAK,GAAG;IAAEC,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAAK;EAChD,IAAID,KAAK,CAACE,eAAe,EAAE;IACzB,MAAMC,YAAY,GAChBN,QAAQ,IAAIA,QAAQ,KAAKF,uBAAuB,GAC5C,UAAUE,QAAQ,SAAS,GAC3BF,uBAAuB;IAE7B,OAAO,GAAGQ,YAAY,KAAKT,kBAAkB,CAC3CM,KAAK,EACLF,IAAI,EACJC,YACF,CAAC,EAAE;EACL;EAEA,OAAO,EAAE;AACX,CAAC;AAEH,SAASH,cAAc","ignoreList":[]}