@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
@@ -1 +1 @@
1
- {"version":3,"file":"createTheme.js","names":["_flattenDeep","_interopRequireDefault","require","_objects","_Settings","replacePlaceholders","inputTheme","_context","possibleKeys","_map","default","_keys","call","key","join","re","RegExp","_entries","forEach","_ref","value","replace","match","capture","generateTheme","storedTheme","storedSettings","settings","generatedTheme","_len","arguments","length","themeElements","Array","_key","element","isPlainObject","generatedSettings","createTheme","_len2","themeConfigs","_key2","customTheme","flattenDeep","setSettings","_default","exports"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAIA,MAAMG,mBAAmB,GAAIC,UAAiB,IAAK;EAAA,IAAAC,QAAA;EACjD,MAAMC,YAAY,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAH,QAAA,OAAAI,KAAA,CAAAD,OAAA,EAAYJ,UAAU,CAAC,EAAAM,IAAA,CAAAL,QAAA,EACpCM,GAAG,IAAK,MAAMA,GAAG,KAAK,CAAC,CAC5BC,IAAI,CAAC,GAAG,CAAC;EAEZ,MAAMC,EAAE,GAAG,IAAIC,MAAM,CAAC,OAAOR,YAAY,GAAG,EAAE,GAAG,CAAC;EAClD,IAAAS,QAAA,CAAAP,OAAA,EAAeJ,UAAU,CAAC,CAACY,OAAO,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACN,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ACA,OAAOrB,mBAAmB,CAACuB,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,MAAMU,WAAW,GAAG,SAAAA,CAClBb,WAAkB,EAUX;EAAA,SAAAc,KAAA,GAAAT,SAAA,CAAAC,MAAA,EATJS,YAAY,OAAAP,KAAA,CAAAM,KAAA,OAAAA,KAAA,WAAAE,KAAA,MAAAA,KAAA,GAAAF,KAAA,EAAAE,KAAA;IAAZD,YAAY,CAAAC,KAAA,QAAAX,SAAA,CAAAW,KAAA;EAAA;EAUf,MAAMC,WAAW,GAAGlB,aAAa,CAACC,WAAW,EAAE,GAAG,IAAAkB,oBAAW,EAACH,YAAY,CAAC,CAAC;EAE5E,IAAIE,WAAW,EAAE;IACf,IAAAE,qBAAW,EAACF,WAAW,CAACf,QAAQ,CAAC;EACnC;EAEA,OAAOe,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAApC,OAAA,GAEa4B,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"createTheme.js","names":["_flattenDeep","_interopRequireDefault","require","_objects","_Settings","replacePlaceholders","inputTheme","_context","possibleKeys","_map","default","_keys","call","key","join","re","RegExp","_entries","forEach","value","replace","match","capture","generateTheme","storedTheme","themeElements","storedSettings","settings","generatedTheme","element","isPlainObject","generatedSettings","createTheme","themeConfigs","customTheme","flattenDeep","setSettings","_default","exports"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAIA,MAAMG,mBAAmB,GAAIC,UAAiB,IAAK;EAAA,IAAAC,QAAA;EACjD,MAAMC,YAAY,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAH,QAAA,OAAAI,KAAA,CAAAD,OAAA,EAAYJ,UAAU,CAAC,EAAAM,IAAA,CAAAL,QAAA,EACpCM,GAAG,IAAK,MAAMA,GAAG,KAAK,CAAC,CAC5BC,IAAI,CAAC,GAAG,CAAC;EAEZ,MAAMC,EAAE,GAAG,IAAIC,MAAM,CAAC,OAAOR,YAAY,GAAG,EAAE,GAAG,CAAC;EAClD,IAAAS,QAAA,CAAAP,OAAA,EAAeJ,UAAU,CAAC,CAACY,OAAO,CAAC,CAAC,CAACL,GAAG,EAAEM,KAAK,CAAC,KAAK;IACnD,IAAIN,GAAG,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ACA,MAAMI,WAAW,GAAGA,CAClBR,WAAkB,EAClB,GAAGS,YAAgD,KAS5C;EACP,MAAMC,WAAW,GAAGX,aAAa,CAACC,WAAW,EAAE,GAAG,IAAAW,oBAAW,EAACF,YAAY,CAAC,CAAC;EAE5E,IAAIC,WAAW,EAAE;IACf,IAAAE,qBAAW,EAACF,WAAW,CAACP,QAAQ,CAAC;EACnC;EAEA,OAAOO,WAAW;AACpB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAA5B,OAAA,GAEasB,WAAW","ignoreList":[]}
@@ -7,10 +7,9 @@ exports.renderBackground = void 0;
7
7
  var _themeProps = require("./themeProps");
8
8
  /**
9
9
  */
10
- const renderBackground = (path, defaultValue) => _ref => {
11
- let {
12
- theme
13
- } = _ref;
10
+ const renderBackground = (path, defaultValue) => ({
11
+ theme
12
+ }) => {
14
13
  const value = (0, _themeProps.getThemeProp)(theme, path, defaultValue);
15
14
  if (typeof value === "string") {
16
15
  return `background: ${value}`;
@@ -1 +1 @@
1
- {"version":3,"file":"background.js","names":["_themeProps","require","renderBackground","path","defaultValue","_ref","theme","value","getThemeProp","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,gBAAgB,GACpBA,CAACC,IAAY,EAAEC,YAAqB,KACpCC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EACxB,MAAME,KAAK,GAAG,IAAAC,wBAAY,EAACF,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;AAACE,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"background.js","names":["_themeProps","require","renderBackground","path","defaultValue","theme","value","getThemeProp","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAIA;AACA;AACA,MAAMC,gBAAgB,GACpBA,CAACC,IAAY,EAAEC,YAAqB,KACpC,CAAC;EAAEC;AAAsB,CAAC,KAAK;EAC7B,MAAMC,KAAK,GAAG,IAAAC,wBAAY,EAACF,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;AAACE,OAAA,CAAAN,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -11,12 +11,9 @@ var _themeProps = require("./themeProps");
11
11
  */
12
12
  /**
13
13
  */
14
- const darkenColor = (amount, path, defaultValue) => _ref => {
15
- let {
16
- theme
17
- } = _ref;
18
- return (0, _polished.darken)(amount, (0, _themeProps.getThemeProp)(theme, path, defaultValue));
19
- };
14
+ const darkenColor = (amount, path, defaultValue) => ({
15
+ theme
16
+ }) => (0, _polished.darken)(amount, (0, _themeProps.getThemeProp)(theme, path, defaultValue));
20
17
 
21
18
  /*
22
19
  * Themed color x amount lightened
@@ -24,12 +21,9 @@ const darkenColor = (amount, path, defaultValue) => _ref => {
24
21
  /**
25
22
  */
26
23
  exports.darkenColor = darkenColor;
27
- const lightenColor = (amount, path, defaultValue) => _ref2 => {
28
- let {
29
- theme
30
- } = _ref2;
31
- return (0, _polished.lighten)(amount, (0, _themeProps.getThemeProp)(theme, path, defaultValue));
32
- };
24
+ const lightenColor = (amount, path, defaultValue) => ({
25
+ theme
26
+ }) => (0, _polished.lighten)(amount, (0, _themeProps.getThemeProp)(theme, path, defaultValue));
33
27
 
34
28
  /*
35
29
  * Make a color lighter or darker in the same color family
@@ -37,9 +31,6 @@ const lightenColor = (amount, path, defaultValue) => _ref2 => {
37
31
  /**
38
32
  */
39
33
  exports.lightenColor = lightenColor;
40
- const changeHSL = function (color, saturation, lightness) {
41
- let hueAdjustment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
42
- return (0, _polished.hsl)((0, _polished.parseToHsl)(color).hue + hueAdjustment, saturation, lightness);
43
- };
34
+ const changeHSL = (color, saturation, lightness, hueAdjustment = 0) => (0, _polished.hsl)((0, _polished.parseToHsl)(color).hue + hueAdjustment, saturation, lightness);
44
35
  exports.changeHSL = changeHSL;
45
36
  //# sourceMappingURL=colors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":["_polished","require","_themeProps","darkenColor","amount","path","defaultValue","_ref","theme","darken","getThemeProp","exports","lightenColor","_ref2","lighten","changeHSL","color","saturation","lightness","hueAdjustment","arguments","length","undefined","hsl","parseToHsl","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,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA,MAAME,WAAW,GACfA,CACEC,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvBC,IAAA;EAAA,IAAC;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAAA,OACxB,IAAAE,gBAAM,EAACL,MAAM,EAAE,IAAAM,wBAAY,EAACF,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC,CAAC;AAAA;;AAE3D;AACA;AACA;AACA;AACA;AADAK,OAAA,CAAAR,WAAA,GAAAA,WAAA;AAEA,MAAMS,YAAY,GAChBA,CACER,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvBO,KAAA;EAAA,IAAC;IAAEL;EAAsB,CAAC,GAAAK,KAAA;EAAA,OACxB,IAAAC,iBAAO,EAACV,MAAM,EAAE,IAAAM,wBAAY,EAACF,KAAK,EAAEH,IAAI,EAAEC,YAAY,CAAC,CAAC;AAAA;;AAE5D;AACA;AACA;AACA;AACA;AADAK,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEA,MAAMG,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,OACd,IAAAG,aAAG,EAAC,IAAAC,oBAAU,EAACR,KAAK,CAAC,CAACS,GAAG,GAAGN,aAAa,EAAEF,UAAU,EAAEC,SAAS,CAAC;AAAA;AAACP,OAAA,CAAAI,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"colors.js","names":["_polished","require","_themeProps","darkenColor","amount","path","defaultValue","theme","darken","getThemeProp","exports","lightenColor","lighten","changeHSL","color","saturation","lightness","hueAdjustment","hsl","parseToHsl","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,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACA;AACA;AACA;AACA,MAAME,WAAW,GACfA,CACEC,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvB,CAAC;EAAEC;AAAsB,CAAC,KACxB,IAAAC,gBAAM,EAACJ,MAAM,EAAE,IAAAK,wBAAY,EAACF,KAAK,EAAEF,IAAI,EAAEC,YAAY,CAAC,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AADAI,OAAA,CAAAP,WAAA,GAAAA,WAAA;AAEA,MAAMQ,YAAY,GAChBA,CACEP,MAAuB,EACvBC,IAAY,EACZC,YAAqB,KAEvB,CAAC;EAAEC;AAAsB,CAAC,KACxB,IAAAK,iBAAO,EAACR,MAAM,EAAE,IAAAK,wBAAY,EAACF,KAAK,EAAEF,IAAI,EAAEC,YAAY,CAAC,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AADAI,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEA,MAAME,SAAS,GAAGA,CAChBC,KAAa,EACbC,UAAmB,EACnBC,SAAkB,EAClBC,aAAqB,GAAG,CAAC,KACd,IAAAC,aAAG,EAAC,IAAAC,oBAAU,EAACL,KAAK,CAAC,CAACM,GAAG,GAAGH,aAAa,EAAEF,UAAU,EAAEC,SAAS,CAAC;AAACN,OAAA,CAAAG,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -35,10 +35,7 @@ const getYIQ = color => {
35
35
  * the preferred color is returned
36
36
  */
37
37
  exports.getYIQ = getYIQ;
38
- const getContrastYIQ = function (color) {
39
- let dark = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "#212529";
40
- let light = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "#fff";
41
- let preferredColor = arguments.length > 3 ? arguments[3] : undefined;
38
+ const getContrastYIQ = (color, dark = "#212529", light = "#fff", preferredColor) => {
42
39
  const yiqColor = getYIQ(color);
43
40
  if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {
44
41
  return preferredColor;
@@ -75,21 +72,16 @@ const getBackgroundColor = (theme, bgColorProperty, defaultValue) => {
75
72
  * Retrieve the contrast color for the given background property,
76
73
  * based on theme properties
77
74
  */
78
- const renderContrastColor = function (bgColorProperty, preferredColorProperty) {
79
- let standardDarkProperty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "YIQ_DARK_COLOR";
80
- let standardLightProperty = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "YIQ_LIGHT_COLOR";
81
- return _ref => {
82
- let {
83
- theme = {
84
- settings: {}
85
- }
86
- } = _ref;
87
- const bgColor = getBackgroundColor(theme, bgColorProperty, "#ffffff");
88
- const preferredColor = (0, _themeProps.getThemeStringProp)(theme, preferredColorProperty);
89
- const darkColor = (0, _themeProps.getThemeStringProp)(theme, standardDarkProperty, "#212529");
90
- const lightColor = (0, _themeProps.getThemeStringProp)(theme, standardLightProperty, "#fff");
91
- return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);
92
- };
75
+ const renderContrastColor = (bgColorProperty, preferredColorProperty, standardDarkProperty = "YIQ_DARK_COLOR", standardLightProperty = "YIQ_LIGHT_COLOR") => ({
76
+ theme = {
77
+ settings: {}
78
+ }
79
+ }) => {
80
+ const bgColor = getBackgroundColor(theme, bgColorProperty, "#ffffff");
81
+ const preferredColor = (0, _themeProps.getThemeStringProp)(theme, preferredColorProperty);
82
+ const darkColor = (0, _themeProps.getThemeStringProp)(theme, standardDarkProperty, "#212529");
83
+ const lightColor = (0, _themeProps.getThemeStringProp)(theme, standardLightProperty, "#fff");
84
+ return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);
93
85
  };
94
86
  exports.renderContrastColor = renderContrastColor;
95
87
  //# sourceMappingURL=contrast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contrast.js","names":["_polished","require","_themeProps","_exceptions","getColorContrast","color1","color2","luminance1","getLuminance","luminance2","parseFloat","toFixed","exports","getYIQ","color","rgb","parseToRgb","red","green","blue","getContrastYIQ","dark","arguments","length","undefined","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","ThemePropertyException","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","_ref","settings","getThemeStringProp"],"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,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAa;EACnE,MAAMC,UAAU,GAAG,IAAAC,sBAAY,EAACH,MAAM,CAAC;EACvC,MAAMI,UAAU,GAAG,IAAAD,sBAAY,EAACF,MAAM,CAAC;EACvC,OAAOI,UAAU,CACf,CAACH,UAAU,GAAGE,UAAU,GACpB,CAACF,UAAU,GAAG,IAAI,KAAKE,UAAU,GAAG,IAAI,CAAC,GACzC,CAACA,UAAU,GAAG,IAAI,KAAKF,UAAU,GAAG,IAAI,CAAC,EAC3CI,OAAO,CAAC,CAAC,CACb,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AADAC,OAAA,CAAAR,gBAAA,GAAAA,gBAAA;AAEA,MAAMS,MAAM,GAAIC,KAAa,IAAa;EAC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Ac,CAACc,OAAO,EAAEN,SAAS,EAAEC,UAAU,EAAEH,cAAc,CAAC;EACvE,CAAC;AAAA;AAACd,OAAA,CAAA0B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"contrast.js","names":["_polished","require","_themeProps","_exceptions","getColorContrast","color1","color2","luminance1","getLuminance","luminance2","parseFloat","toFixed","exports","getYIQ","color","rgb","parseToRgb","red","green","blue","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","ThemePropertyException","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","settings","getThemeStringProp"],"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,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAa;EACnE,MAAMC,UAAU,GAAG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AC;EAE3E,OAAOlB,cAAc,CAACW,OAAO,EAAEN,SAAS,EAAEC,UAAU,EAAEH,cAAc,CAAC;AACvE,CAAC;AAACX,OAAA,CAAAuB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -13,22 +13,16 @@ const DEFAULT_CORNER_PROPERTY = "border-radius";
13
13
  */
14
14
  /**
15
15
  */
16
- const roundedCorners = function () {
17
- let property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CORNER_PROPERTY;
18
- let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "BORDER_RADIUS";
19
- let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "0.25rem";
20
- return _ref => {
21
- let {
22
- theme = {
23
- settings: {}
24
- }
25
- } = _ref;
26
- if (theme.ROUNDED_CORNERS) {
27
- const propertyName = property && property !== DEFAULT_CORNER_PROPERTY ? `border-${property}-radius` : DEFAULT_CORNER_PROPERTY;
28
- return `${propertyName}: ${(0, _themeProps.getThemeStringProp)(theme, path, defaultValue)}`;
29
- }
30
- return "";
31
- };
16
+ const roundedCorners = (property = DEFAULT_CORNER_PROPERTY, path = "BORDER_RADIUS", defaultValue = "0.25rem") => ({
17
+ theme = {
18
+ settings: {}
19
+ }
20
+ }) => {
21
+ if (theme.ROUNDED_CORNERS) {
22
+ const propertyName = property && property !== DEFAULT_CORNER_PROPERTY ? `border-${property}-radius` : DEFAULT_CORNER_PROPERTY;
23
+ return `${propertyName}: ${(0, _themeProps.getThemeStringProp)(theme, path, defaultValue)}`;
24
+ }
25
+ return "";
32
26
  };
33
27
  exports.roundedCorners = roundedCorners;
34
28
  //# sourceMappingURL=corners.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"corners.js","names":["_themeProps","require","DEFAULT_CORNER_PROPERTY","roundedCorners","property","arguments","length","undefined","path","defaultValue","_ref","theme","settings","ROUNDED_CORNERS","propertyName","getThemeStringProp","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAIA,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,KAAK,IAAAC,8BAAkB,EAC3CJ,KAAK,EACLH,IAAI,EACJC,YACF,CAAC,EAAE;IACL;IAEA,OAAO,EAAE;EACX,CAAC;AAAA;AAACO,OAAA,CAAAb,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"file":"corners.js","names":["_themeProps","require","DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","settings","ROUNDED_CORNERS","propertyName","getThemeStringProp","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAIA,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,KAAK,IAAAC,8BAAkB,EAC3CJ,KAAK,EACLF,IAAI,EACJC,YACF,CAAC,EAAE;EACL;EAEA,OAAO,EAAE;AACX,CAAC;AAACM,OAAA,CAAAT,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -12,10 +12,7 @@ var _IllegalArgumentException = _interopRequireDefault(require("../../exceptions
12
12
  var _IllegalStateException = _interopRequireDefault(require("../../exceptions/IllegalStateException"));
13
13
  /**
14
14
  */
15
- const getSize = function (theme) {
16
- let ratio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
17
- let path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "SPACER";
18
- let unit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "rem";
15
+ const getSize = (theme, ratio = 1, path = "SPACER", unit = "rem") => {
19
16
  if (typeof ratio === "string") {
20
17
  return ratio;
21
18
  }
@@ -34,17 +31,11 @@ const getSize = function (theme) {
34
31
  */
35
32
  /**
36
33
  */
37
- const spacer = function () {
38
- let ratio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
39
- return _ref => {
40
- let {
41
- theme = {
42
- settings: {}
43
- }
44
- } = _ref;
45
- return getSize(theme, ratio);
46
- };
47
- };
34
+ const spacer = (ratio = 1) => ({
35
+ theme = {
36
+ settings: {}
37
+ }
38
+ }) => getSize(theme, ratio);
48
39
 
49
40
  /*
50
41
  * Render spacers based on the given ratio * theme SPACER
@@ -54,19 +45,11 @@ const spacer = function () {
54
45
  /**
55
46
  */
56
47
  exports.spacer = spacer;
57
- const spacers = function () {
58
- for (var _len = arguments.length, ratios = new Array(_len), _key = 0; _key < _len; _key++) {
59
- ratios[_key] = arguments[_key];
48
+ const spacers = (...ratios) => ({
49
+ theme = {
50
+ settings: {}
60
51
  }
61
- return _ref2 => {
62
- let {
63
- theme = {
64
- settings: {}
65
- }
66
- } = _ref2;
67
- return (0, _map.default)(ratios).call(ratios, ratio => getSize(theme, ratio)).join(" ");
68
- };
69
- };
52
+ }) => (0, _map.default)(ratios).call(ratios, ratio => getSize(theme, ratio)).join(" ");
70
53
 
71
54
  /*
72
55
  * Render a gutter based on GUTTER property
@@ -74,16 +57,10 @@ const spacers = function () {
74
57
  /**
75
58
  */
76
59
  exports.spacers = spacers;
77
- const gutter = function () {
78
- let ratio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
79
- return _ref3 => {
80
- let {
81
- theme = {
82
- settings: {}
83
- }
84
- } = _ref3;
85
- return getSize(theme, ratio, "GRID_GUTTER", "px");
86
- };
87
- };
60
+ const gutter = (ratio = 1) => ({
61
+ theme = {
62
+ settings: {}
63
+ }
64
+ }) => getSize(theme, ratio, "GRID_GUTTER", "px");
88
65
  exports.gutter = gutter;
89
66
  //# sourceMappingURL=spacers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spacers.js","names":["_big","_interopRequireDefault","require","_IllegalArgumentException","_IllegalStateException","getSize","theme","ratio","arguments","length","undefined","path","unit","size","Big","times","IllegalStateException","IllegalArgumentException","_stringify","default","spacer","_ref","settings","exports","spacers","_len","ratios","Array","_key","_ref2","_map","call","join","gutter","_ref3"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\",\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`,\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio, \"GRID_GUTTER\", \"px\");\n\nexport { spacer, spacers, gutter };\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA,MAAMG,OAAO,GAAG,SAAAA,CACdC,KAAY,EAIT;EAAA,IAHHC,KAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IAC1BG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,QAAQ;EAAA,IACvBI,IAAY,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEpB,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC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,IAAAC,IAAA,CAAAX,OAAA,EAAAO,MAAM,EAAAK,IAAA,CAANL,MAAM,EAAMnB,KAAK,IAAKF,OAAO,CAACC,KAAK,EAAEC,KAAK,CAAC,CAAC,CAACyB,IAAI,CAAC,GAAG,CAAC;EAAA;AAAA;;AAE1D;AACA;AACA;AACA;AACA;AADAT,OAAA,CAAAC,OAAA,GAAAA,OAAA;AAEA,MAAMS,MAAM,GACV,SAAAA,CAAA;EAAA,IAAC1B,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,OAClB0B,KAAA;IAAA,IAAC;MAAE5B,KAAK,GAAG;QAAEgB,QAAQ,EAAE,CAAC;MAAE;IAAkB,CAAC,GAAAY,KAAA;IAAA,OAC3C7B,OAAO,CAACC,KAAK,EAAEC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC;EAAA;AAAA;AAACgB,OAAA,CAAAU,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"file":"spacers.js","names":["_big","_interopRequireDefault","require","_IllegalArgumentException","_IllegalStateException","getSize","theme","ratio","path","unit","size","Big","times","IllegalStateException","IllegalArgumentException","_stringify","default","spacer","settings","exports","spacers","ratios","_map","call","join","gutter"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\",\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`,\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = { settings: {} } }: UtilThemeProps) =>\n getSize(theme, ratio, \"GRID_GUTTER\", \"px\");\n\nexport { spacer, spacers, gutter };\n"],"mappings":";;;;;;;;;AACA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA,MAAMG,OAAO,GAAGA,CACdC,KAAY,EACZC,KAAsB,GAAG,CAAC,EAC1BC,IAAY,GAAG,QAAQ,EACvBC,IAAY,GAAG,KAAK,KACjB;EACH,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAI,OAAOD,KAAK,CAACE,IAAI,CAAC,KAAK,QAAQ,EAAE;MACnC,MAAME,IAAI,GAAG,IAAAC,YAAG,EAACJ,KAAK,CAAC,CAACK,KAAK,CAACN,KAAK,CAACE,IAAI,CAAC,CAAC;MAC1C,OAAO,GAAGE,IAAI,GAAGD,IAAI,EAAE;IACzB;IACA,MAAM,IAAII,8BAAqB,CAAC,QAAQL,IAAI,mBAAmB,CAAC;EAClE;EAEA,MAAM,IAAIM,iCAAwB,CAChC,SAAS,IAAAC,UAAA,CAAAC,OAAA,EAAeT,KAAK,CAAC,6BAChC,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMU,MAAM,GACVA,CAACV,KAAa,GAAG,CAAC,KAClB,CAAC;EAAED,KAAK,GAAG;IAAEY,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAC3Cb,OAAO,CAACC,KAAK,EAAEC,KAAK,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AADAY,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAEA,MAAMG,OAAO,GACXA,CAAC,GAAGC,MAA8B,KAClC,CAAC;EAAEf,KAAK,GAAG;IAAEY,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAC3C,IAAAI,IAAA,CAAAN,OAAA,EAAAK,MAAM,EAAAE,IAAA,CAANF,MAAM,EAAMd,KAAK,IAAKF,OAAO,CAACC,KAAK,EAAEC,KAAK,CAAC,CAAC,CAACiB,IAAI,CAAC,GAAG,CAAC;;AAE1D;AACA;AACA;AACA;AACA;AADAL,OAAA,CAAAC,OAAA,GAAAA,OAAA;AAEA,MAAMK,MAAM,GACVA,CAAClB,KAAa,GAAG,CAAC,KAClB,CAAC;EAAED,KAAK,GAAG;IAAEY,QAAQ,EAAE,CAAC;EAAE;AAAkB,CAAC,KAC3Cb,OAAO,CAACC,KAAK,EAAEC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC;AAACY,OAAA,CAAAM,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -8,20 +8,14 @@ var _objects = require("../../utils/helpers/objects");
8
8
  var _exceptions = require("../../exceptions");
9
9
  /**
10
10
  */
11
- const getProp = function () {
12
- let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
- let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
14
- let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
11
+ const getProp = (theme = {}, path = "", defaultValue = "") => {
15
12
  return path === "" ? defaultValue : (0, _objects.get)(theme, path, defaultValue);
16
13
  };
17
14
 
18
15
  /**
19
16
  */
20
17
  exports.getProp = getProp;
21
- const getThemeProp = function () {
22
- let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
- let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
24
- let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
18
+ const getThemeProp = (theme = {}, path = "", defaultValue = "") => {
25
19
  const value = getProp(theme, path, defaultValue);
26
20
  if (value != null && (typeof value === "string" || typeof value === "number" || typeof value === "object")) {
27
21
  return value;
@@ -32,10 +26,7 @@ const getThemeProp = function () {
32
26
  /**
33
27
  */
34
28
  exports.getThemeProp = getThemeProp;
35
- const getThemeStringProp = function () {
36
- let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37
- let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
38
- let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
29
+ const getThemeStringProp = (theme = {}, path = "", defaultValue = "") => {
39
30
  const value = getProp(theme, path, defaultValue);
40
31
  if (typeof value === "string") {
41
32
  return value;
@@ -48,10 +39,7 @@ const getThemeStringProp = function () {
48
39
  /**
49
40
  */
50
41
  exports.getThemeStringProp = getThemeStringProp;
51
- const getThemeNumberProp = function () {
52
- let theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
53
- let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
54
- let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
42
+ const getThemeNumberProp = (theme = {}, path = "", defaultValue = 0) => {
55
43
  const value = getProp(theme, path, defaultValue);
56
44
  if (typeof value === "number") {
57
45
  return value;
@@ -65,11 +53,8 @@ const getThemeNumberProp = function () {
65
53
  /**
66
54
  */
67
55
  exports.getThemeNumberProp = getThemeNumberProp;
68
- const themeProp = (path, defaultValue) => _ref => {
69
- let {
70
- theme
71
- } = _ref;
72
- return getThemeProp(theme, path, defaultValue);
73
- };
56
+ const themeProp = (path, defaultValue) => ({
57
+ theme
58
+ }) => getThemeProp(theme, path, defaultValue);
74
59
  exports.themeProp = themeProp;
75
60
  //# sourceMappingURL=themeProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"themeProps.js","names":["_objects","require","_exceptions","getProp","theme","arguments","length","undefined","path","defaultValue","get","exports","getThemeProp","value","ThemePropertyException","getThemeStringProp","toString","getThemeNumberProp","themeProp","_ref"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\",\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\",\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`,\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\",\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`,\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0,\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`,\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue,\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACO,MAAME,OAAO,GAAG,SAAAA,CAAA,EAID;EAAA,IAHpBC,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IACzBG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACjBI,YAA4B,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAEjC,OAAOG,IAAI,KAAK,EAAE,GAAGC,YAAY,GAAG,IAAAC,YAAG,EAACN,KAAK,EAAEI,IAAI,EAAEC,YAAY,CAAC;AACpE,CAAC;;AAED;AACA;AADAE,OAAA,CAAAR,OAAA,GAAAA,OAAA;AAEO,MAAMS,YAAY,GAAG,SAAAA,CAAA,EAIP;EAAA,IAHnBR,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IACzBG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACjBI,YAA4B,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA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,KAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IACzBG,IAAY,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IACjBI,YAAoB,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAExB,MAAMQ,KAAK,GAAGV,OAAO,CAACC,KAAK,EAAEI,IAAI,EAAEC,YAAY,CAAC;EAEhD,IAAI,OAAOI,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,MAAM,IAAIC,kCAAsB,CAC9B,GAAGN,IAAI,0BAA0B,OAAOK,KAAK,EAC/C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AADAF,OAAA,CAAAM,kBAAA,GAAAA,kBAAA;AAEO,MAAMC,SAAS,GACpBA,CACEV,IAAY,EACZC,YAA6B,KAE/BU,IAAA;EAAA,IAAC;IAAEf;EAAwB,CAAC,GAAAe,IAAA;EAAA,OAC1BP,YAAY,CAACR,KAAK,EAAEI,IAAI,EAAEC,YAAY,CAAC;AAAA;AAACE,OAAA,CAAAO,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"file":"themeProps.js","names":["_objects","require","_exceptions","getProp","theme","path","defaultValue","get","exports","getThemeProp","value","ThemePropertyException","getThemeStringProp","toString","getThemeNumberProp","themeProp"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\",\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\",\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`,\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\",\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`,\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0,\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`,\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue,\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAIA;AACA;AACO,MAAME,OAAO,GAAGA,CACrBC,KAAoB,GAAG,CAAC,CAAC,EACzBC,IAAY,GAAG,EAAE,EACjBC,YAA4B,GAAG,EAAE,KACb;EACpB,OAAOD,IAAI,KAAK,EAAE,GAAGC,YAAY,GAAG,IAAAC,YAAG,EAACH,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC;AACpE,CAAC;;AAED;AACA;AADAE,OAAA,CAAAL,OAAA,GAAAA,OAAA;AAEO,MAAMM,YAA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;IAC7B,OAAOA,KAAK;EACd;EAEA,MAAM,IAAIC,kCAAsB,CAC9B,GAAGN,IAAI,0BAA0B,OAAOK,KAAK,EAC/C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AADAF,OAAA,CAAAM,kBAAA,GAAAA,kBAAA;AAEO,MAAMC,SAAS,GACpBA,CACEV,IAAY,EACZC,YAA6B,KAE/B,CAAC;EAAEF;AAAwB,CAAC,KAC1BK,YAAY,CAACL,KAAK,EAAEC,IAAI,EAAEC,YAAY,CAAC;AAACE,OAAA,CAAAO,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -28,11 +28,10 @@ const updateLocale = (state, locale) => {
28
28
 
29
29
  /**
30
30
  */
31
- const setLocales = (state, _ref) => {
32
- let {
33
- locale,
34
- locales
35
- } = _ref;
31
+ const setLocales = (state, {
32
+ locale,
33
+ locales
34
+ }) => {
36
35
  // set locale in cookie
37
36
  if (state.locales.length > 1) {
38
37
  (0, _Cookies.setCookie)("locale", locale);
@@ -67,9 +66,7 @@ const initialState = {
67
66
  /**
68
67
  * Form reducer
69
68
  */
70
- const I18nReducer = function () {
71
- let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
72
- let action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : void 0;
69
+ const I18nReducer = (state = initialState, action = void 0) => {
73
70
  if (!action) {
74
71
  return state;
75
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"I18nReducer.js","names":["_Cache","_interopRequireDefault","require","_Cookies","_Locales","updateLocale","state","locale","locales","length","setCookie","clearCookie","Cache","clear","setLocales","_ref","getDefaultLocale","navigator","language","split","initialState","Locales","I18nReducer","arguments","undefined","action","type","payload","exports"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie, clearCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n if (state.locales?.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales },\n) => {\n // set locale in cookie\n if (state.locales.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\nconst getDefaultLocale = () => {\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator?.language.split(\"-\")[0] || \"en\";\n }\n return \"en\";\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: getDefaultLocale(),\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAMA;AACA;AACA,MAAMG,YAAY,GAAGA,CAACC,KAAgB,EAAEC,MAAc,KAAK;EACzD;EACA,IAAID,KAAK,CAACE,OAAO,EAAEC,MAAM,GAAG,CAAC,EAAE;IAC7B,IAAAC,kBAAS,EAAC,QAAQ,EAAEH,MAAM,CAAC;EAC7B,CAAC,MAAM;IACL,IAAAI,oBAAW,EAAC,QAAQ,CAAC;EACvB;;EAEA;EACAC,cAAK,CAAC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AAQmB,MAAM,CAACC,IAAI;IACjB,KAAK,aAAa;MAChB,OAAOZ,UAAU,CAACR,KAAK,EAAEmB,MAAM,CAACE,OAAO,CAAC;IAE1C,KAAK,eAAe;MAClB,OAAOtB,YAAY,CAACC,KAAK,EAAEmB,MAAM,CAACE,OAAO,CAAC;IAE5C;MACE,OAAOrB,KAAK;EAChB;AACF,CAAC;AAACsB,OAAA,CAAAN,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"I18nReducer.js","names":["_Cache","_interopRequireDefault","require","_Cookies","_Locales","updateLocale","state","locale","locales","length","setCookie","clearCookie","Cache","clear","setLocales","getDefaultLocale","navigator","language","split","initialState","Locales","I18nReducer","action","type","payload","exports"],"sources":["../../../src/redux/_i18n/I18nReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie, clearCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state: I18nState, locale: string) => {\n // set locale in cookie\n if (state.locales?.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (\n state: I18nState,\n { locale, locales }: { locale: string, locales: Locales },\n) => {\n // set locale in cookie\n if (state.locales.length > 1) {\n setCookie(\"locale\", locale);\n } else {\n clearCookie(\"locale\");\n }\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\nconst getDefaultLocale = () => {\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator?.language.split(\"-\")[0] || \"en\";\n }\n return \"en\";\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: getDefaultLocale(),\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAMA;AACA;AACA,MAAMG,YAAY,GAAGA,CAACC,KAAgB,EAAEC,MAAc,KAAK;EACzD;EACA,IAAID,KAAK,CAACE,OAAO,EAAEC,MAAM,GAAG,CAAC,EAAE;IAC7B,IAAAC,kBAAS,EAAC,QAAQ,EAAEH,MAAM,CAAC;EAC7B,CAAC,MAAM;IACL,IAAAI,oBAAW,EAAC,QAAQ,CAAC;EACvB;;EAEA;EACAC,cAAK,CAACC,KAAK,CAAC,CAAC;EAEb,OAAO;IACL,GAAGP,KAAK;IACRC;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,MAAMO,UAAU,GAAGA,CACjBR,KAAgB,EAChB;EAAEC,MAAM;EAAEC;AAA8C,CAAC,KACtD;EACH;EACA,IAAIF,KAAK,CAACE,OAAO,CAACC,MAAM,GAAG,CAAC,EAAE;IAC5B,IAAAC,kBAAS,EAAC,QAAQ,EAAEH,MAAM,CAAC;EAC7B,CAAC,MAAM;IACL,IAAAI,oBAAW,EAAC,QAAQ,CAAC;EACvB;EAEA,IAAIJ,MAAM,EAAE;IACV,OAAO;MACL,GAAGD,KAAK;MACRE,OAAO;MACPD;IACF,CAAC;EACH;EAEA,OAAO;IACL,GAAGD,KAAK;IACRE;EACF,CAAC;AACH,CAAC;AAED,MAAMO,gBAAgB,GAAGA,CAAA,KAAM;EAC7B,IAAI,OAAOC,SAAS,KAAK,WAAW,IAAIA,SAAS,EAAEC,QAAQ,EAAE;IAC3D,OAAOD,SAAS,EAAEC,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI;EAClD;EACA,OAAO,IAAI;AACb,CAAC;;AAED;AACA,MAAMC,YAAuB,GAAG;EAC9BX,OAAO,EAAE,IAAIY,gBAAO,CAAC,CAAC;EACtBb,MAAM,EAAEQ,gBAAgB,CAAC;AAC3B,CAAC;;AAED;AACA;AACA;AACO,MAAMM,WAA4C,GAAGA,CAC1Df,KAAK,GAAGa,YAAY,EACpBG,MAAM,GAAG,KAAK,CAAC,KACZ;EACH,IAAI,CAACA,MAAM,EAAE;IACX,OAAOhB,KAAK;EACd;EAEA,QAAQgB,MAAM,CAACC,IAAI;IACjB,KAAK,aAAa;MAChB,OAAOT,UAAU,CAACR,KAAK,EAAEgB,MAAM,CAACE,OAAO,CAAC;IAE1C,KAAK,eAAe;MAClB,OAAOnB,YAAY,CAACC,KAAK,EAAEgB,MAAM,CAACE,OAAO,CAAC;IAE5C;MACE,OAAOlB,KAAK;EAChB;AACF,CAAC;AAACmB,OAAA,CAAAJ,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -148,30 +148,26 @@ const loadModel = (key, href, options) => ({
148
148
  /**
149
149
  */
150
150
  exports.loadModel = loadModel;
151
- const loadModularUI = function (key, href, options) {
152
- let retryCount = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 3;
153
- let retryDelay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 200;
154
- return (dispatch, getState) => {
155
- const modularuiStore = getState()?.modularui;
156
- const currentRequest = modularuiStore?.[key];
157
- const isLoading = currentRequest?.status === _Constants.MODULARUI_STATUS.LOADING;
158
- if (isLoading) {
159
- const isDifferentRequest = currentRequest.requestOptions?.href?.toString() !== href.toString();
160
- if (isDifferentRequest && retryCount > 0) {
161
- return new _promise.default(resolve => {
162
- setTimeout(() => {
163
- resolve(dispatch(loadModularUI(key, href, options, retryCount - 1, retryDelay)));
164
- }, retryDelay);
165
- });
166
- }
167
-
168
- // Same request is already loading — do nothing
169
- return _promise.default.resolve();
151
+ const loadModularUI = (key, href, options, retryCount = 3, retryDelay = 200) => (dispatch, getState) => {
152
+ const modularuiStore = getState()?.modularui;
153
+ const currentRequest = modularuiStore?.[key];
154
+ const isLoading = currentRequest?.status === _Constants.MODULARUI_STATUS.LOADING;
155
+ if (isLoading) {
156
+ const isDifferentRequest = currentRequest.requestOptions?.href?.toString() !== href.toString();
157
+ if (isDifferentRequest && retryCount > 0) {
158
+ return new _promise.default(resolve => {
159
+ setTimeout(() => {
160
+ resolve(dispatch(loadModularUI(key, href, options, retryCount - 1, retryDelay)));
161
+ }, retryDelay);
162
+ });
170
163
  }
171
- dispatch((0, _ProgressIndicator.startProgress)());
172
- const loadModelPromise = dispatch(loadModel(key, href, options));
173
- return _promise.default.resolve(loadModelPromise).then(() => dispatch((0, _ProgressIndicator.finishProgress)())).catch(error => dispatch((0, _Error.handleError)(error)));
174
- };
164
+
165
+ // Same request is already loading — do nothing
166
+ return _promise.default.resolve();
167
+ }
168
+ dispatch((0, _ProgressIndicator.startProgress)());
169
+ const loadModelPromise = dispatch(loadModel(key, href, options));
170
+ return _promise.default.resolve(loadModelPromise).then(() => dispatch((0, _ProgressIndicator.finishProgress)())).catch(error => dispatch((0, _Error.handleError)(error)));
175
171
  };
176
172
 
177
173
  /**