@bpd-library/utilities 1.2.9 → 1.2.10-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/config/oats-generator.config.js +2 -0
  2. package/dist/api/http.d.ts +1 -0
  3. package/dist/api/http.js +3 -2
  4. package/dist/api/http.js.map +1 -1
  5. package/dist/api/index.js +0 -1
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/api-utilities/api-utilities.types.d.ts +1 -1
  8. package/dist/api-utilities/api-utilities.types.js.map +1 -1
  9. package/dist/api-utilities/compose-exclude-string.d.ts +3 -0
  10. package/dist/api-utilities/compose-exclude-string.js +5 -0
  11. package/dist/api-utilities/compose-exclude-string.js.map +1 -0
  12. package/dist/date.d.ts +2 -1
  13. package/dist/date.js +6 -1
  14. package/dist/date.js.map +1 -1
  15. package/dist/environment.d.ts +15 -3
  16. package/dist/environment.js +14 -14
  17. package/dist/environment.js.map +1 -1
  18. package/dist/esm/api/http.js +120 -0
  19. package/dist/esm/api/http.js.map +1 -0
  20. package/dist/esm/api/index.js +11 -0
  21. package/dist/esm/api/index.js.map +1 -0
  22. package/dist/esm/api-utilities/compose-exclude-string.js +6 -0
  23. package/dist/esm/api-utilities/compose-exclude-string.js.map +1 -0
  24. package/dist/esm/api-utilities/decimal-range/merge-decimal-range.js +13 -0
  25. package/dist/esm/api-utilities/decimal-range/merge-decimal-range.js.map +1 -0
  26. package/dist/esm/api-utilities/decimal-range/merge-specification-range.js +29 -0
  27. package/dist/esm/api-utilities/decimal-range/merge-specification-range.js.map +1 -0
  28. package/dist/esm/api-utilities/district-status.js +14 -0
  29. package/dist/esm/api-utilities/district-status.js.map +1 -0
  30. package/dist/esm/api-utilities/find-filter.js +41 -0
  31. package/dist/esm/api-utilities/find-filter.js.map +1 -0
  32. package/dist/esm/api-utilities/get/coordinates.js +31 -0
  33. package/dist/esm/api-utilities/get/coordinates.js.map +1 -0
  34. package/dist/esm/api-utilities/get/layer-raster.js +4 -0
  35. package/dist/esm/api-utilities/get/layer-raster.js.map +1 -0
  36. package/dist/esm/api-utilities/show-mortgage-price.js +11 -0
  37. package/dist/esm/api-utilities/show-mortgage-price.js.map +1 -0
  38. package/dist/esm/api-utilities/show-price.js +13 -0
  39. package/dist/esm/api-utilities/show-price.js.map +1 -0
  40. package/dist/esm/constants/index.js +7 -0
  41. package/dist/esm/constants/index.js.map +1 -0
  42. package/dist/esm/date.js +11 -0
  43. package/dist/esm/date.js.map +1 -0
  44. package/dist/esm/debounce.js +25 -0
  45. package/dist/esm/debounce.js.map +1 -0
  46. package/dist/esm/dom/dom.js +9 -0
  47. package/dist/esm/dom/dom.js.map +1 -0
  48. package/dist/esm/environment.js +27 -0
  49. package/dist/esm/environment.js.map +1 -0
  50. package/dist/esm/extended-api-models/excluded-properties.js +36 -0
  51. package/dist/esm/extended-api-models/excluded-properties.js.map +1 -0
  52. package/dist/esm/extended-api-models/extended-area-projects.js +12 -0
  53. package/dist/esm/extended-api-models/extended-area-projects.js.map +1 -0
  54. package/dist/esm/extended-api-models/extended-area.js +182 -0
  55. package/dist/esm/extended-api-models/extended-area.js.map +1 -0
  56. package/dist/esm/extended-api-models/status/apartment-building-status.js +60 -0
  57. package/dist/esm/extended-api-models/status/apartment-building-status.js.map +1 -0
  58. package/dist/esm/extended-api-models/status/construction-number-status.js +20 -0
  59. package/dist/esm/extended-api-models/status/construction-number-status.js.map +1 -0
  60. package/dist/esm/extended-api-models/status/property-type-status.js +60 -0
  61. package/dist/esm/extended-api-models/status/property-type-status.js.map +1 -0
  62. package/dist/esm/extended-api-models/utilities/apartment-building-view.js +5 -0
  63. package/dist/esm/extended-api-models/utilities/apartment-building-view.js.map +1 -0
  64. package/dist/esm/extended-api-models/utilities/extended-model-price-range.js +37 -0
  65. package/dist/esm/extended-api-models/utilities/extended-model-price-range.js.map +1 -0
  66. package/dist/esm/extended-api-models/utilities/find-extended-object.js +23 -0
  67. package/dist/esm/extended-api-models/utilities/find-extended-object.js.map +1 -0
  68. package/dist/esm/extended-api-models/utilities/is-apartment.js +14 -0
  69. package/dist/esm/extended-api-models/utilities/is-apartment.js.map +1 -0
  70. package/dist/esm/function-is-true.js +13 -0
  71. package/dist/esm/function-is-true.js.map +1 -0
  72. package/dist/esm/generated/bpd-client.js +53 -0
  73. package/dist/esm/generated/bpd-client.js.map +1 -0
  74. package/dist/esm/geometry/country-bounding-box.js +14 -0
  75. package/dist/esm/geometry/country-bounding-box.js.map +1 -0
  76. package/dist/esm/geometry/geometry.js +65 -0
  77. package/dist/esm/geometry/geometry.js.map +1 -0
  78. package/dist/esm/hooks/use-click-outside.js +34 -0
  79. package/dist/esm/hooks/use-click-outside.js.map +1 -0
  80. package/dist/esm/hooks/use-form-changes.js +30 -0
  81. package/dist/esm/hooks/use-form-changes.js.map +1 -0
  82. package/dist/esm/hooks/use-history.js +15 -0
  83. package/dist/esm/hooks/use-history.js.map +1 -0
  84. package/dist/esm/hooks/use-keyboard-focus.js +14 -0
  85. package/dist/esm/hooks/use-keyboard-focus.js.map +1 -0
  86. package/dist/esm/hooks/use-lazy.js +47 -0
  87. package/dist/esm/hooks/use-lazy.js.map +1 -0
  88. package/dist/esm/hooks/use-map-storage.js +16 -0
  89. package/dist/esm/hooks/use-map-storage.js.map +1 -0
  90. package/dist/esm/hooks/use-scroll-position.js +23 -0
  91. package/dist/esm/hooks/use-scroll-position.js.map +1 -0
  92. package/dist/esm/hooks/use-scroll-to.js +66 -0
  93. package/dist/esm/hooks/use-scroll-to.js.map +1 -0
  94. package/dist/esm/hooks/use-stylesheet.js +8 -0
  95. package/dist/esm/hooks/use-stylesheet.js.map +1 -0
  96. package/dist/esm/hooks/use-url-params.js +31 -0
  97. package/dist/esm/hooks/use-url-params.js.map +1 -0
  98. package/dist/esm/index.js +40 -0
  99. package/dist/esm/index.js.map +1 -0
  100. package/dist/esm/is-touch.js +32 -0
  101. package/dist/esm/is-touch.js.map +1 -0
  102. package/dist/esm/media-query/breakpoints.js +29 -0
  103. package/dist/esm/media-query/breakpoints.js.map +1 -0
  104. package/dist/esm/media-query/media-query.js +39 -0
  105. package/dist/esm/media-query/media-query.js.map +1 -0
  106. package/dist/esm/media-query/utils/index.js +35 -0
  107. package/dist/esm/media-query/utils/index.js.map +1 -0
  108. package/dist/esm/raf-throttle.js +24 -0
  109. package/dist/esm/raf-throttle.js.map +1 -0
  110. package/dist/esm/throttle.js +23 -0
  111. package/dist/esm/throttle.js.map +1 -0
  112. package/dist/esm/to-currency.js +26 -0
  113. package/dist/esm/to-currency.js.map +1 -0
  114. package/dist/extended-api-models/excluded-properties.d.ts +5 -0
  115. package/dist/extended-api-models/excluded-properties.js +35 -0
  116. package/dist/extended-api-models/excluded-properties.js.map +1 -0
  117. package/dist/extended-api-models/status/construction-number-status.js +8 -1
  118. package/dist/extended-api-models/status/construction-number-status.js.map +1 -1
  119. package/dist/generated/bpd-client.d.ts +72 -9
  120. package/dist/generated/bpd-client.js +21 -13
  121. package/dist/generated/bpd-client.js.map +1 -1
  122. package/dist/hooks/use-stylesheet.d.ts +1 -0
  123. package/dist/hooks/use-stylesheet.js +5 -0
  124. package/dist/hooks/use-stylesheet.js.map +1 -0
  125. package/dist/lib/api/http.js +117 -0
  126. package/dist/lib/api/http.js.map +1 -0
  127. package/dist/lib/api/index.js +8 -0
  128. package/dist/lib/api/index.js.map +1 -0
  129. package/dist/lib/api-utilities/api-utilities.js +9 -0
  130. package/dist/lib/api-utilities/api-utilities.js.map +1 -0
  131. package/dist/lib/api-utilities/api-utilities.test.js +122 -0
  132. package/dist/lib/api-utilities/api-utilities.test.js.map +1 -0
  133. package/dist/lib/api-utilities/api-utilities.types.js +1 -0
  134. package/dist/lib/api-utilities/api-utilities.types.js.map +1 -0
  135. package/dist/lib/api-utilities/compose-exclude-string.js +5 -0
  136. package/dist/lib/api-utilities/compose-exclude-string.js.map +1 -0
  137. package/dist/lib/api-utilities/decimal-range/merge-decimal-range.js +12 -0
  138. package/dist/lib/api-utilities/decimal-range/merge-decimal-range.js.map +1 -0
  139. package/dist/lib/api-utilities/decimal-range/merge-specification-range.js +27 -0
  140. package/dist/lib/api-utilities/decimal-range/merge-specification-range.js.map +1 -0
  141. package/dist/lib/api-utilities/district-status.js +13 -0
  142. package/dist/lib/api-utilities/district-status.js.map +1 -0
  143. package/dist/lib/api-utilities/find-filter.js +40 -0
  144. package/dist/lib/api-utilities/find-filter.js.map +1 -0
  145. package/dist/lib/api-utilities/get/coordinates.js +29 -0
  146. package/dist/lib/api-utilities/get/coordinates.js.map +1 -0
  147. package/dist/lib/api-utilities/get/layer-raster.js +3 -0
  148. package/dist/lib/api-utilities/get/layer-raster.js.map +1 -0
  149. package/dist/lib/api-utilities/index.js +2 -0
  150. package/dist/lib/api-utilities/index.js.map +1 -0
  151. package/dist/lib/api-utilities/show-mortgage-price.js +10 -0
  152. package/dist/lib/api-utilities/show-mortgage-price.js.map +1 -0
  153. package/dist/lib/api-utilities/show-price.js +12 -0
  154. package/dist/lib/api-utilities/show-price.js.map +1 -0
  155. package/dist/lib/constants/index.js +5 -0
  156. package/dist/lib/constants/index.js.map +1 -0
  157. package/dist/lib/date.js +10 -0
  158. package/dist/lib/date.js.map +1 -0
  159. package/dist/lib/debounce.js +23 -0
  160. package/dist/lib/debounce.js.map +1 -0
  161. package/dist/lib/dom/dom.js +7 -0
  162. package/dist/lib/dom/dom.js.map +1 -0
  163. package/dist/lib/dom/index.js +2 -0
  164. package/dist/lib/dom/index.js.map +1 -0
  165. package/dist/lib/environment.js +25 -0
  166. package/dist/lib/environment.js.map +1 -0
  167. package/dist/lib/extended-api-models/excluded-properties.js +35 -0
  168. package/dist/lib/extended-api-models/excluded-properties.js.map +1 -0
  169. package/dist/lib/extended-api-models/extended-area-projects.js +10 -0
  170. package/dist/lib/extended-api-models/extended-area-projects.js.map +1 -0
  171. package/dist/lib/extended-api-models/extended-area.js +179 -0
  172. package/dist/lib/extended-api-models/extended-area.js.map +1 -0
  173. package/dist/lib/extended-api-models/index.js +7 -0
  174. package/dist/lib/extended-api-models/index.js.map +1 -0
  175. package/dist/lib/extended-api-models/status/apartment-building-status.js +58 -0
  176. package/dist/lib/extended-api-models/status/apartment-building-status.js.map +1 -0
  177. package/dist/lib/extended-api-models/status/construction-number-status.js +19 -0
  178. package/dist/lib/extended-api-models/status/construction-number-status.js.map +1 -0
  179. package/dist/lib/extended-api-models/status/property-type-status.js +58 -0
  180. package/dist/lib/extended-api-models/status/property-type-status.js.map +1 -0
  181. package/dist/lib/extended-api-models/utilities/apartment-building-view.js +4 -0
  182. package/dist/lib/extended-api-models/utilities/apartment-building-view.js.map +1 -0
  183. package/dist/lib/extended-api-models/utilities/extended-model-price-range.js +35 -0
  184. package/dist/lib/extended-api-models/utilities/extended-model-price-range.js.map +1 -0
  185. package/dist/lib/extended-api-models/utilities/find-extended-object.js +21 -0
  186. package/dist/lib/extended-api-models/utilities/find-extended-object.js.map +1 -0
  187. package/dist/lib/extended-api-models/utilities/is-apartment.js +13 -0
  188. package/dist/lib/extended-api-models/utilities/is-apartment.js.map +1 -0
  189. package/dist/lib/function-is-true.js +11 -0
  190. package/dist/lib/function-is-true.js.map +1 -0
  191. package/dist/lib/generated/bpd-client.js +50 -0
  192. package/dist/lib/generated/bpd-client.js.map +1 -0
  193. package/dist/lib/generated/index.js +2 -0
  194. package/dist/lib/generated/index.js.map +1 -0
  195. package/dist/lib/geometry/country-bounding-box.js +12 -0
  196. package/dist/lib/geometry/country-bounding-box.js.map +1 -0
  197. package/dist/lib/geometry/geometry.js +64 -0
  198. package/dist/lib/geometry/geometry.js.map +1 -0
  199. package/dist/lib/geometry/geometry.test.js +87 -0
  200. package/dist/lib/geometry/geometry.test.js.map +1 -0
  201. package/dist/lib/geometry/index.js +3 -0
  202. package/dist/lib/geometry/index.js.map +1 -0
  203. package/dist/lib/hooks/index.js +11 -0
  204. package/dist/lib/hooks/index.js.map +1 -0
  205. package/dist/lib/hooks/use-click-outside.js +32 -0
  206. package/dist/lib/hooks/use-click-outside.js.map +1 -0
  207. package/dist/lib/hooks/use-delegate-listen.js +10 -0
  208. package/dist/lib/hooks/use-delegate-listen.js.map +1 -0
  209. package/dist/lib/hooks/use-form-changes.js +27 -0
  210. package/dist/lib/hooks/use-form-changes.js.map +1 -0
  211. package/dist/lib/hooks/use-history.js +13 -0
  212. package/dist/lib/hooks/use-history.js.map +1 -0
  213. package/dist/lib/hooks/use-input.js +28 -0
  214. package/dist/lib/hooks/use-input.js.map +1 -0
  215. package/dist/lib/hooks/use-keyboard-focus.js +11 -0
  216. package/dist/lib/hooks/use-keyboard-focus.js.map +1 -0
  217. package/dist/lib/hooks/use-lazy.js +44 -0
  218. package/dist/lib/hooks/use-lazy.js.map +1 -0
  219. package/dist/lib/hooks/use-map-storage.js +14 -0
  220. package/dist/lib/hooks/use-map-storage.js.map +1 -0
  221. package/dist/lib/hooks/use-scroll-position.js +20 -0
  222. package/dist/lib/hooks/use-scroll-position.js.map +1 -0
  223. package/dist/lib/hooks/use-scroll-to.js +64 -0
  224. package/dist/lib/hooks/use-scroll-to.js.map +1 -0
  225. package/dist/lib/hooks/use-stylesheet.js +5 -0
  226. package/dist/lib/hooks/use-stylesheet.js.map +1 -0
  227. package/dist/lib/hooks/use-text.js +16 -0
  228. package/dist/lib/hooks/use-text.js.map +1 -0
  229. package/dist/lib/hooks/use-url-params.js +28 -0
  230. package/dist/lib/hooks/use-url-params.js.map +1 -0
  231. package/dist/lib/index.js +18 -0
  232. package/dist/lib/index.js.map +1 -0
  233. package/dist/lib/is-touch.js +30 -0
  234. package/dist/lib/is-touch.js.map +1 -0
  235. package/dist/lib/media-query/breakpoints.js +27 -0
  236. package/dist/lib/media-query/breakpoints.js.map +1 -0
  237. package/dist/lib/media-query/index.js +2 -0
  238. package/dist/lib/media-query/index.js.map +1 -0
  239. package/dist/lib/media-query/media-query.js +36 -0
  240. package/dist/lib/media-query/media-query.js.map +1 -0
  241. package/dist/lib/media-query/media-query.types.js +1 -0
  242. package/dist/lib/media-query/media-query.types.js.map +1 -0
  243. package/dist/lib/media-query/utils/index.js +32 -0
  244. package/dist/lib/media-query/utils/index.js.map +1 -0
  245. package/dist/lib/raf-throttle.js +22 -0
  246. package/dist/lib/raf-throttle.js.map +1 -0
  247. package/dist/lib/throttle.js +22 -0
  248. package/dist/lib/throttle.js.map +1 -0
  249. package/dist/lib/to-currency.js +24 -0
  250. package/dist/lib/to-currency.js.map +1 -0
  251. package/dist/types/api/http.d.ts +47 -0
  252. package/dist/types/api/index.d.ts +2 -0
  253. package/dist/types/api-utilities/api-utilities.d.ts +8 -0
  254. package/dist/types/api-utilities/api-utilities.test.d.ts +1 -0
  255. package/dist/types/api-utilities/api-utilities.types.d.ts +46 -0
  256. package/dist/types/api-utilities/compose-exclude-string.d.ts +3 -0
  257. package/dist/types/api-utilities/decimal-range/merge-decimal-range.d.ts +3 -0
  258. package/dist/types/api-utilities/decimal-range/merge-specification-range.d.ts +13 -0
  259. package/dist/types/api-utilities/district-status.d.ts +3 -0
  260. package/dist/types/api-utilities/find-filter.d.ts +32 -0
  261. package/dist/types/api-utilities/get/coordinates.d.ts +6 -0
  262. package/dist/types/api-utilities/get/layer-raster.d.ts +3 -0
  263. package/dist/types/api-utilities/index.d.ts +1 -0
  264. package/dist/types/api-utilities/show-mortgage-price.d.ts +3 -0
  265. package/dist/types/api-utilities/show-price.d.ts +7 -0
  266. package/dist/types/constants/index.d.ts +4 -0
  267. package/dist/types/date.d.ts +3 -0
  268. package/dist/types/debounce.d.ts +5 -0
  269. package/dist/types/dom/dom.d.ts +6 -0
  270. package/dist/types/dom/index.d.ts +1 -0
  271. package/dist/types/environment.d.ts +9 -0
  272. package/dist/types/extended-api-models/excluded-properties.d.ts +5 -0
  273. package/dist/types/extended-api-models/extended-area-projects.d.ts +3 -0
  274. package/dist/types/extended-api-models/extended-area.d.ts +13 -0
  275. package/dist/types/extended-api-models/index.d.ts +6 -0
  276. package/dist/types/extended-api-models/status/apartment-building-status.d.ts +3 -0
  277. package/dist/types/extended-api-models/status/construction-number-status.d.ts +3 -0
  278. package/dist/types/extended-api-models/status/property-type-status.d.ts +4 -0
  279. package/dist/types/extended-api-models/utilities/apartment-building-view.d.ts +4 -0
  280. package/dist/types/extended-api-models/utilities/extended-model-price-range.d.ts +4 -0
  281. package/dist/types/extended-api-models/utilities/find-extended-object.d.ts +4 -0
  282. package/dist/types/extended-api-models/utilities/is-apartment.d.ts +11 -0
  283. package/dist/types/function-is-true.d.ts +1 -0
  284. package/dist/types/generated/bpd-client.d.ts +808 -0
  285. package/dist/types/generated/index.d.ts +1 -0
  286. package/dist/types/geometry/country-bounding-box.d.ts +6 -0
  287. package/dist/types/geometry/geometry.d.ts +11 -0
  288. package/dist/types/geometry/geometry.test.d.ts +8 -0
  289. package/dist/types/geometry/index.d.ts +2 -0
  290. package/dist/types/hooks/index.d.ts +10 -0
  291. package/dist/types/hooks/use-click-outside.d.ts +6 -0
  292. package/dist/types/hooks/use-delegate-listen.d.ts +6 -0
  293. package/dist/types/hooks/use-form-changes.d.ts +12 -0
  294. package/dist/types/hooks/use-history.d.ts +4 -0
  295. package/dist/types/hooks/use-input.d.ts +41 -0
  296. package/dist/types/hooks/use-keyboard-focus.d.ts +6 -0
  297. package/dist/types/hooks/use-lazy.d.ts +21 -0
  298. package/dist/types/hooks/use-map-storage.d.ts +6 -0
  299. package/dist/types/hooks/use-scroll-position.d.ts +10 -0
  300. package/dist/types/hooks/use-scroll-to.d.ts +8 -0
  301. package/dist/types/hooks/use-stylesheet.d.ts +1 -0
  302. package/dist/types/hooks/use-text.d.ts +1 -0
  303. package/dist/types/hooks/use-url-params.d.ts +5 -0
  304. package/dist/types/index.d.ts +17 -0
  305. package/dist/types/is-touch.d.ts +8 -0
  306. package/dist/types/media-query/breakpoints.d.ts +26 -0
  307. package/dist/types/media-query/index.d.ts +1 -0
  308. package/dist/types/media-query/media-query.d.ts +13 -0
  309. package/dist/types/media-query/media-query.types.d.ts +14 -0
  310. package/dist/types/media-query/utils/index.d.ts +3 -0
  311. package/dist/types/raf-throttle.d.ts +4 -0
  312. package/dist/types/throttle.d.ts +2 -0
  313. package/dist/types/to-currency.d.ts +3 -0
  314. package/package.json +3 -3
@@ -0,0 +1,47 @@
1
+ import { useRef, useElement } from '@atomify/hooks';
2
+
3
+ const LAZY_HOOKS = {
4
+ LAZY_LOADING_HOOK: 'data-lazy-loading',
5
+ LAZY_ERROR_HOOK: 'data-lazy-error',
6
+ LAZY_SUCCESS_HOOK: 'data-lazy-success',
7
+ };
8
+ const LAZY_STATES = {
9
+ ERROR: 'error',
10
+ LOADING: 'loading',
11
+ SUCCESS: 'success',
12
+ };
13
+ const useLazy = ({ fetcher, loadingResult, errorResult, successResult, }) => {
14
+ const LazyResult = useRef(loadingResult);
15
+ const lazyLoadingResult = useElement(`[${LAZY_HOOKS.LAZY_LOADING_HOOK}]`);
16
+ const lazyErrorResult = useElement(`${[LAZY_HOOKS.LAZY_ERROR_HOOK]}`);
17
+ const lazySuccessResult = useElement(`${[LAZY_HOOKS.LAZY_SUCCESS_HOOK]}`);
18
+ const response = useRef(null);
19
+ const state = useRef(LAZY_STATES.LOADING);
20
+ async function initFetcher() {
21
+ const activeChild = lazyLoadingResult.current ||
22
+ lazySuccessResult.current ||
23
+ lazyErrorResult.current ||
24
+ false;
25
+ if (state.current !== LAZY_STATES.LOADING) {
26
+ state.current = LAZY_STATES.LOADING;
27
+ }
28
+ try {
29
+ const data = await fetcher();
30
+ response.current = data;
31
+ if (activeChild && activeChild.parentNode) {
32
+ activeChild.parentNode.replaceChild(successResult(data), activeChild);
33
+ }
34
+ state.current = LAZY_STATES.SUCCESS;
35
+ }
36
+ catch (error) {
37
+ if (activeChild && activeChild.parentNode) {
38
+ activeChild.parentNode.replaceChild(errorResult(), activeChild);
39
+ }
40
+ state.current = LAZY_STATES.ERROR;
41
+ }
42
+ }
43
+ return [LazyResult.current, initFetcher, response, state];
44
+ };
45
+
46
+ export { LAZY_HOOKS, LAZY_STATES, useLazy };
47
+ //# sourceMappingURL=use-lazy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-lazy.js","sources":["../../../src/hooks/use-lazy.ts"],"sourcesContent":["import { useElement, useRef } from '@atomify/hooks';\nimport { MutableRefObject } from '@atomify/hooks/dist/hooks';\n\ntype LazyResult = HTMLElement;\n\ninterface UseLazyProps<T> {\n fetcher: () => Promise<T>;\n loadingResult: () => LazyResult;\n errorResult: () => LazyResult;\n successResult: (data?: T) => LazyResult;\n}\n\ntype LazyReturn<T> = [\n () => LazyResult,\n () => Promise<void>,\n MutableRefObject<T | null>,\n MutableRefObject<string>,\n];\n\nexport const LAZY_HOOKS = {\n LAZY_LOADING_HOOK: 'data-lazy-loading',\n LAZY_ERROR_HOOK: 'data-lazy-error',\n LAZY_SUCCESS_HOOK: 'data-lazy-success',\n};\n\nexport const LAZY_STATES = {\n ERROR: 'error',\n LOADING: 'loading',\n SUCCESS: 'success',\n};\n\nexport const useLazy = <T = any>({\n fetcher,\n loadingResult,\n errorResult,\n successResult,\n}: UseLazyProps<T>): LazyReturn<T> => {\n const LazyResult = useRef<() => LazyResult>(loadingResult);\n const lazyLoadingResult = useElement<HTMLElement>(`[${LAZY_HOOKS.LAZY_LOADING_HOOK}]`);\n const lazyErrorResult = useElement<HTMLElement>(`${[LAZY_HOOKS.LAZY_ERROR_HOOK]}`);\n const lazySuccessResult = useElement<HTMLElement>(`${[LAZY_HOOKS.LAZY_SUCCESS_HOOK]}`);\n const response = useRef<T | null>(null);\n const state = useRef<string>(LAZY_STATES.LOADING);\n\n async function initFetcher() {\n const activeChild =\n lazyLoadingResult.current ||\n lazySuccessResult.current ||\n lazyErrorResult.current ||\n false;\n\n if (state.current !== LAZY_STATES.LOADING) {\n state.current = LAZY_STATES.LOADING;\n }\n\n try {\n const data = await fetcher();\n\n response.current = data;\n\n if (activeChild && activeChild.parentNode) {\n activeChild.parentNode.replaceChild(successResult(data), activeChild);\n }\n\n state.current = LAZY_STATES.SUCCESS;\n } catch (error) {\n if (activeChild && activeChild.parentNode) {\n activeChild.parentNode.replaceChild(errorResult(), activeChild);\n }\n\n state.current = LAZY_STATES.ERROR;\n }\n }\n\n return [LazyResult.current, initFetcher, response, state];\n};\n"],"names":[],"mappings":";;MAmBa,UAAU,GAAG;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,eAAe,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,mBAAmB;EACxC;MAEW,WAAW,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;EACpB;MAEW,OAAO,GAAG,CAAU,EAC7B,OAAO,EACP,aAAa,EACb,WAAW,EACX,aAAa,GACC;IACd,MAAM,UAAU,GAAG,MAAM,CAAmB,aAAa,CAAC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,UAAU,CAAc,IAAI,UAAU,CAAC,iBAAiB,GAAG,CAAC,CAAC;IACvF,MAAM,eAAe,GAAG,UAAU,CAAc,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACnF,MAAM,iBAAiB,GAAG,UAAU,CAAc,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACvF,MAAM,QAAQ,GAAG,MAAM,CAAW,IAAI,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,MAAM,CAAS,WAAW,CAAC,OAAO,CAAC,CAAC;IAElD,eAAe,WAAW;QACtB,MAAM,WAAW,GACb,iBAAiB,CAAC,OAAO;YACzB,iBAAiB,CAAC,OAAO;YACzB,eAAe,CAAC,OAAO;YACvB,KAAK,CAAC;QAEV,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,CAAC,OAAO,EAAE;YACvC,KAAK,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;SACvC;QAED,IAAI;YACA,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;YAE7B,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAExB,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU,EAAE;gBACvC,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;aACzE;YAED,KAAK,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;SACvC;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU,EAAE;gBACvC,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;aACnE;YAED,KAAK,CAAC,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC;SACrC;KACJ;IAED,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC9D;;;;"}
@@ -0,0 +1,16 @@
1
+ const useMapStorage = () => {
2
+ const mapStorage = new Map();
3
+ const setItem = (key, value) => mapStorage.set(key, value);
4
+ const getItem = (key) => mapStorage.get(key);
5
+ const hasItem = (key) => mapStorage.has(key);
6
+ const deleteItem = (key) => mapStorage.delete(key);
7
+ return {
8
+ setItem,
9
+ getItem,
10
+ hasItem,
11
+ deleteItem,
12
+ };
13
+ };
14
+
15
+ export { useMapStorage };
16
+ //# sourceMappingURL=use-map-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-map-storage.js","sources":["../../../src/hooks/use-map-storage.ts"],"sourcesContent":["export const useMapStorage = <T = any, V = any>() => {\n const mapStorage = new Map<T, V>();\n\n const setItem = (key: T, value: V) => mapStorage.set(key, value);\n\n const getItem = (key: T) => mapStorage.get(key);\n\n const hasItem = (key: T) => mapStorage.has(key);\n\n const deleteItem = (key: T) => mapStorage.delete(key);\n\n return {\n setItem,\n getItem,\n hasItem,\n deleteItem,\n };\n};\n"],"names":[],"mappings":"MAAa,aAAa,GAAG;IACzB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAQ,CAAC;IAEnC,MAAM,OAAO,GAAG,CAAC,GAAM,EAAE,KAAQ,KAAK,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjE,MAAM,OAAO,GAAG,CAAC,GAAM,KAAK,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhD,MAAM,OAAO,GAAG,CAAC,GAAM,KAAK,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhD,MAAM,UAAU,GAAG,CAAC,GAAM,KAAK,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAEtD,OAAO;QACH,OAAO;QACP,OAAO;QACP,OAAO;QACP,UAAU;KACb,CAAC;AACN;;;;"}
@@ -0,0 +1,23 @@
1
+ import { useRef, useListen } from '@atomify/hooks';
2
+ import { rafThrottle } from '../raf-throttle.js';
3
+
4
+ const useScrollPosition = (callback, useWindow) => {
5
+ const position = useRef(getScrollPosition(useWindow));
6
+ function setScrollPosition() {
7
+ const currentPosition = getScrollPosition(useWindow);
8
+ callback({ prevPosition: position.current, currentPosition });
9
+ position.current = currentPosition;
10
+ }
11
+ const throttle = rafThrottle(setScrollPosition);
12
+ useListen(window, 'scroll', throttle);
13
+ };
14
+ function getScrollPosition(useWindow) {
15
+ const target = document.body;
16
+ const position = target.getBoundingClientRect();
17
+ return useWindow
18
+ ? { x: window.scrollX, y: window.scrollY }
19
+ : { x: position.left, y: position.top };
20
+ }
21
+
22
+ export { useScrollPosition };
23
+ //# sourceMappingURL=use-scroll-position.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-scroll-position.js","sources":["../../../src/hooks/use-scroll-position.ts"],"sourcesContent":["import { useListen, useRef } from '@atomify/hooks';\n\nimport { rafThrottle } from '../raf-throttle';\n\ntype ScrollPosition = { x: number; y: number };\nexport type ScrollCallback = {\n prevPosition: ScrollPosition;\n currentPosition: ScrollPosition;\n};\n\n/**\n * Hook that returns the browser viewport X and Y scroll position.\n * @param {({\n * currentPosition,\n * prevPosition,\n * }: {\n * prevPosition: ScrollPosition;\n * currentPosition: ScrollPosition;\n * }) => void} callback\n * @param {boolean} [useWindow]\n * @param {number} [wait]\n */\nexport const useScrollPosition = (\n callback: ({ currentPosition, prevPosition }: ScrollCallback) => void,\n useWindow?: boolean,\n) => {\n const position = useRef<ScrollPosition>(getScrollPosition(useWindow));\n\n function setScrollPosition() {\n const currentPosition = getScrollPosition(useWindow);\n callback({ prevPosition: position.current, currentPosition });\n position.current = currentPosition;\n }\n\n const throttle = rafThrottle(setScrollPosition);\n\n useListen(window, 'scroll', throttle);\n};\n\n/**\n * Returns the current scroll position\n * @param {(boolean | undefined)} useWindow\n * @returns\n */\nfunction getScrollPosition(useWindow: boolean | undefined) {\n const target = document.body;\n const position = target.getBoundingClientRect();\n\n return useWindow\n ? { x: window.scrollX, y: window.scrollY }\n : { x: position.left, y: position.top };\n}\n"],"names":[],"mappings":";;;MAsBa,iBAAiB,GAAG,CAC7B,QAAqE,EACrE,SAAmB;IAEnB,MAAM,QAAQ,GAAG,MAAM,CAAiB,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;IAEtE,SAAS,iBAAiB;QACtB,MAAM,eAAe,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACrD,QAAQ,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;QAC9D,QAAQ,CAAC,OAAO,GAAG,eAAe,CAAC;KACtC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAEhD,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1C,EAAE;AAOF,SAAS,iBAAiB,CAAC,SAA8B;IACrD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAEhD,OAAO,SAAS;UACV,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE;UACxC,EAAE,CAAC,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;AAChD;;;;"}
@@ -0,0 +1,66 @@
1
+ const ST_DURATION = 500;
2
+ const ST_OFFSET = 50;
3
+ const useScrollTo = (options = {}) => {
4
+ function to(target) {
5
+ const scrollConfig = {
6
+ position: target.getBoundingClientRect(),
7
+ offset: options.offset || ST_OFFSET,
8
+ duration: options.duration || ST_DURATION,
9
+ scrollElement: options.scrollElement || null,
10
+ delay: options.delay || 0,
11
+ };
12
+ return scrollTo(scrollConfig);
13
+ }
14
+ return to;
15
+ };
16
+ function scrollTo({ position, offset, duration, scrollElement, delay, }) {
17
+ return new Promise(resolve => {
18
+ const scrollPosition = window.scrollY === undefined ? window.pageYOffset : window.scrollY;
19
+ const to = parseInt((position.top + scrollPosition - offset).toFixed(0), 10);
20
+ const start = scrollElement
21
+ ? scrollElement.scrollTop
22
+ : Math.max(document.body.scrollTop, document.documentElement.scrollTop);
23
+ const change = to - start;
24
+ let currentTime = 0;
25
+ const increment = 10;
26
+ const direction = to > start ? 1 : 0;
27
+ let timeout;
28
+ const animate = () => {
29
+ currentTime += increment;
30
+ const val = parseInt(easeInOutQuad(currentTime, start, change, duration).toFixed(0), 10);
31
+ if (scrollElement) {
32
+ scrollElement.scrollTop = val;
33
+ }
34
+ else {
35
+ document.body.scrollTop = val;
36
+ document.documentElement.scrollTop = val;
37
+ }
38
+ if ((val >= to && direction === 1) || (val <= to && direction === 0)) {
39
+ resolve();
40
+ }
41
+ else {
42
+ requestAnimationFrame(animate);
43
+ }
44
+ };
45
+ if (delay > 0) {
46
+ timeout = setTimeout(() => {
47
+ animate();
48
+ clearTimeout(timeout);
49
+ }, delay);
50
+ }
51
+ else {
52
+ animate();
53
+ }
54
+ });
55
+ }
56
+ function easeInOutQuad(t, b, c, d) {
57
+ t /= d / 2;
58
+ if (t < 1) {
59
+ return (c / 2) * t * t + b;
60
+ }
61
+ t--;
62
+ return (-c / 2) * (t * (t - 2) - 1) + b;
63
+ }
64
+
65
+ export { useScrollTo };
66
+ //# sourceMappingURL=use-scroll-to.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-scroll-to.js","sources":["../../../src/hooks/use-scroll-to.ts"],"sourcesContent":["const ST_DURATION = 500;\nconst ST_OFFSET = 50;\n\ninterface ScrollOptions {\n offset?: number;\n duration?: number;\n scrollElement?: HTMLElement;\n delay?: number;\n}\n\nexport const useScrollTo = (options: ScrollOptions = {}) => {\n function to(target: HTMLElement) {\n const scrollConfig = {\n position: target.getBoundingClientRect(),\n offset: options.offset || ST_OFFSET,\n duration: options.duration || ST_DURATION,\n scrollElement: options.scrollElement || null,\n delay: options.delay || 0,\n };\n\n return scrollTo(scrollConfig);\n }\n\n return to;\n};\n\n/**\n * Scrolls to an element\n * @param {({\n * position: DOMRect;\n * offset: number;\n * duration: number;\n * scrollElement: HTMLElement | null;\n * })} {\n * position,\n * offset,\n * duration,\n * scrollElement,\n * }\n * @returns\n */\nfunction scrollTo({\n position,\n offset,\n duration,\n scrollElement,\n delay,\n}: {\n position: DOMRect;\n offset: number;\n duration: number;\n scrollElement: HTMLElement | null;\n delay: number;\n}) {\n return new Promise(resolve => {\n const scrollPosition = window.scrollY === undefined ? window.pageYOffset : window.scrollY;\n const to = parseInt((position.top + scrollPosition - offset).toFixed(0), 10);\n const start = scrollElement\n ? scrollElement.scrollTop\n : Math.max(document.body.scrollTop, document.documentElement.scrollTop);\n const change = to - start;\n let currentTime = 0;\n const increment = 10;\n const direction = to > start ? 1 : 0;\n\n let timeout: any;\n\n const animate = () => {\n currentTime += increment;\n const val = parseInt(\n easeInOutQuad(currentTime, start, change, duration).toFixed(0),\n 10,\n );\n\n if (scrollElement) {\n scrollElement.scrollTop = val;\n } else {\n document.body.scrollTop = val;\n document.documentElement.scrollTop = val;\n }\n\n if ((val >= to && direction === 1) || (val <= to && direction === 0)) {\n resolve();\n } else {\n requestAnimationFrame(animate);\n }\n };\n\n if (delay > 0) {\n timeout = setTimeout(() => {\n animate();\n clearTimeout(timeout);\n }, delay);\n } else {\n animate();\n }\n });\n}\n\nfunction easeInOutQuad(t: number, b: number, c: number, d: number) {\n t /= d / 2;\n if (t < 1) {\n return (c / 2) * t * t + b;\n }\n t--;\n return (-c / 2) * (t * (t - 2) - 1) + b;\n}\n"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,SAAS,GAAG,EAAE,CAAC;MASR,WAAW,GAAG,CAAC,UAAyB,EAAE;IACnD,SAAS,EAAE,CAAC,MAAmB;QAC3B,MAAM,YAAY,GAAG;YACjB,QAAQ,EAAE,MAAM,CAAC,qBAAqB,EAAE;YACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,SAAS;YACnC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,WAAW;YACzC,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI;YAC5C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;SAC5B,CAAC;QAEF,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAC;KACjC;IAED,OAAO,EAAE,CAAC;AACd,EAAE;AAiBF,SAAS,QAAQ,CAAC,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,aAAa,EACb,KAAK,GAOR;IACG,OAAO,IAAI,OAAO,CAAC,OAAO;QACtB,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,KAAK,SAAS,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QAC1F,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,GAAG,cAAc,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7E,MAAM,KAAK,GAAG,aAAa;cACrB,aAAa,CAAC,SAAS;cACvB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC;QAC1B,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;QAErC,IAAI,OAAY,CAAC;QAEjB,MAAM,OAAO,GAAG;YACZ,WAAW,IAAI,SAAS,CAAC;YACzB,MAAM,GAAG,GAAG,QAAQ,CAChB,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAC9D,EAAE,CACL,CAAC;YAEF,IAAI,aAAa,EAAE;gBACf,aAAa,CAAC,SAAS,GAAG,GAAG,CAAC;aACjC;iBAAM;gBACH,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;gBAC9B,QAAQ,CAAC,eAAe,CAAC,SAAS,GAAG,GAAG,CAAC;aAC5C;YAED,IAAI,CAAC,GAAG,IAAI,EAAE,IAAI,SAAS,KAAK,CAAC,MAAM,GAAG,IAAI,EAAE,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE;gBAClE,OAAO,EAAE,CAAC;aACb;iBAAM;gBACH,qBAAqB,CAAC,OAAO,CAAC,CAAC;aAClC;SACJ,CAAC;QAEF,IAAI,KAAK,GAAG,CAAC,EAAE;YACX,OAAO,GAAG,UAAU,CAAC;gBACjB,OAAO,EAAE,CAAC;gBACV,YAAY,CAAC,OAAO,CAAC,CAAC;aACzB,EAAE,KAAK,CAAC,CAAC;SACb;aAAM;YACH,OAAO,EAAE,CAAC;SACb;KACJ,CAAC,CAAC;AACP,CAAC;AAED,SAAS,aAAa,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IAC7D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,EAAE;QACP,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAC9B;IACD,CAAC,EAAE,CAAC;IACJ,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAC5C;;;;"}
@@ -0,0 +1,8 @@
1
+ import { useStyles, unsafeCSS } from '@atomify/hooks';
2
+
3
+ function useStylesheet(style) {
4
+ useStyles(() => unsafeCSS(style));
5
+ }
6
+
7
+ export { useStylesheet };
8
+ //# sourceMappingURL=use-stylesheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-stylesheet.js","sources":["../../../src/hooks/use-stylesheet.ts"],"sourcesContent":["import { unsafeCSS, useStyles } from '@atomify/hooks';\n/**\n * Add styling through imported css files (Webpack)\n * @export\n * @param {string} style\n */\nexport function useStylesheet(style: string) {\n useStyles(() => unsafeCSS(style));\n}\n"],"names":[],"mappings":";;SAMgB,aAAa,CAAC,KAAa;IACvC,SAAS,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACtC;;;;"}
@@ -0,0 +1,31 @@
1
+ import QueryString from 'query-string';
2
+ import { useHistory } from './use-history.js';
3
+
4
+ const useUrlParams = () => {
5
+ function pushParams(param, value) {
6
+ const { push } = useHistory();
7
+ const url = window.location.href.split('?');
8
+ const parsed = QueryString.parse(location.search);
9
+ parsed[param] = value;
10
+ const stringified = QueryString.stringify(parsed);
11
+ const pageUrl = `${url[0]}?${stringified}`;
12
+ push(pageUrl);
13
+ }
14
+ function getParams(param) {
15
+ const parsed = QueryString.parse(location.search);
16
+ return parsed[param];
17
+ }
18
+ function clearParams() {
19
+ const { push } = useHistory();
20
+ const url = window.location.href.split('?');
21
+ push(url[0]);
22
+ }
23
+ return {
24
+ push: pushParams,
25
+ get: getParams,
26
+ clear: clearParams,
27
+ };
28
+ };
29
+
30
+ export { useUrlParams };
31
+ //# sourceMappingURL=use-url-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-url-params.js","sources":["../../../src/hooks/use-url-params.ts"],"sourcesContent":["import QueryString from 'query-string';\n\nimport { useHistory } from './use-history';\n\nexport const useUrlParams = () => {\n function pushParams(param: string, value: string) {\n const { push } = useHistory();\n const url = window.location.href.split('?');\n\n const parsed = QueryString.parse(location.search);\n\n parsed[param] = value;\n\n const stringified = QueryString.stringify(parsed);\n const pageUrl = `${url[0]}?${stringified}`;\n\n push(pageUrl);\n }\n\n function getParams(param: string) {\n const parsed = QueryString.parse(location.search);\n\n return parsed[param];\n }\n\n function clearParams() {\n const { push } = useHistory();\n const url = window.location.href.split('?');\n\n push(url[0]);\n }\n\n return {\n push: pushParams,\n get: getParams,\n clear: clearParams,\n };\n};\n"],"names":[],"mappings":";;;MAIa,YAAY,GAAG;IACxB,SAAS,UAAU,CAAC,KAAa,EAAE,KAAa;QAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE5C,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAElD,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAEtB,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC;QAE3C,IAAI,CAAC,OAAO,CAAC,CAAC;KACjB;IAED,SAAS,SAAS,CAAC,KAAa;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAElD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACxB;IAED,SAAS,WAAW;QAChB,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE5C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAChB;IAED,OAAO;QACH,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,WAAW;KACrB,CAAC;AACN;;;;"}
@@ -0,0 +1,40 @@
1
+ export { APIClient } from './api/index.js';
2
+ export { apartmentBuildingDeleteApartmentBuilding, apartmentBuildingGetByExternalId, apartmentBuildingQuery, apartmentBuildingUpdateApartmentBuilding, areaProjectGetById, areaProjectQuery, cityGetById, cityGetByName, cityQuery, communityRedirectAsset, constructionNumberGetById, constructionNumberQuery, countryGetById, countryGetByIsoCode, countryQuery, districtGetById, districtQuery, formCase, formDynamic, formLead, fundaCompareFundaObjectRevisionChanges, fundaExecuteFundaPublisher, fundaGet, fundaGetActiveBrokersInGateway, fundaGetAllGwnVersionsByProjectId, fundaQuery, fundaRemoveVersionFromGwn, fundaShowConvertedFundaObject, fundaShowFundaProjectLogs, fundaShowLastSubmittedProject, fundaSubmit, fundaValidate, geoFeatureDeleteGeoFeature, geoFeatureUpsertAreaFeatures, geoFeatureUpsertGeoFeature, grantGetById, grantQuery, projectPhaseGetById, projectPhaseQuery, propertyTypeGetById, propertyTypeQuery, provinceGetById, provinceGetByName, provinceQuery, regionGetById, regionQuery, resourceDeleteResource, resourceUpdateResource } from './generated/bpd-client.js';
3
+ export { elements } from './dom/dom.js';
4
+ export { useScrollPosition } from './hooks/use-scroll-position.js';
5
+ export { useStylesheet } from './hooks/use-stylesheet.js';
6
+ export { useClickOutside } from './hooks/use-click-outside.js';
7
+ export { useHistory } from './hooks/use-history.js';
8
+ export { useScrollTo } from './hooks/use-scroll-to.js';
9
+ export { useUrlParams } from './hooks/use-url-params.js';
10
+ export { useMapStorage } from './hooks/use-map-storage.js';
11
+ export { LAZY_HOOKS, LAZY_STATES, useLazy } from './hooks/use-lazy.js';
12
+ export { useUsingKeyboard } from './hooks/use-keyboard-focus.js';
13
+ export { useFormChanges } from './hooks/use-form-changes.js';
14
+ export { ATOMS, DESIGN_SYSTEM, MOLECULES, ORGANISMS } from './constants/index.js';
15
+ export { debounce } from './debounce.js';
16
+ export { DetectTouch, detectTouch } from './is-touch.js';
17
+ export { environment } from './environment.js';
18
+ export { rafThrottle } from './raf-throttle.js';
19
+ export { deviceWidth, getCurrentBreakpoint, max, mediaIsMatch, mediaWatcher, min, useMedia } from './media-query/media-query.js';
20
+ export { functionIsTrue } from './function-is-true.js';
21
+ export { getDistrictStatus } from './api-utilities/district-status.js';
22
+ export { filterApartmentBuildings, filterAreaProjects, filterConstructionNumbers, filterDistricts, filterProjectPhases, filterPropertyTypes, findApartmentBuilding, findAreaProject, findConstructionNumber, findDistrict, findProjectPhase, findPropertyType } from './api-utilities/find-filter.js';
23
+ export { showPrice } from './api-utilities/show-price.js';
24
+ export { getApiObjectCenter, getApiObjectCoordinates, validateCoordinates } from './api-utilities/get/coordinates.js';
25
+ export { getApiObjectLayerRaster } from './api-utilities/get/layer-raster.js';
26
+ export { mergeDecimalRange } from './api-utilities/decimal-range/merge-decimal-range.js';
27
+ export { mergeConstructionNumberSpecification, mergePropertySpecification } from './api-utilities/decimal-range/merge-specification-range.js';
28
+ export { calculateBoundingBox, calculateBoundingBoxCenter, calculateCenter, calculateDistance, calculateMapDataBoundingBox, calculateMapDataCenter, expandBoundingBox, mergeBoundingBoxes, withinBoundingBox } from './geometry/geometry.js';
29
+ export { COUNTRY_BBOX, getCountryBoundingBox } from './geometry/country-bounding-box.js';
30
+ export { betweenDates, calculateDifferenceInDays } from './date.js';
31
+ export { putThousandsSeparators, round, toCurrency } from './to-currency.js';
32
+ export { getExtendedModelPriceRange } from './extended-api-models/utilities/extended-model-price-range.js';
33
+ export { getApartmentBuildingView, getApartmentBuildingViewById } from './extended-api-models/utilities/apartment-building-view.js';
34
+ export { isApartment } from './extended-api-models/utilities/is-apartment.js';
35
+ export { findExtendedObjectById } from './extended-api-models/utilities/find-extended-object.js';
36
+ export { extendedArea } from './extended-api-models/extended-area.js';
37
+ export { getExtendedAreaProjects } from './extended-api-models/extended-area-projects.js';
38
+ export { throttle } from './throttle.js';
39
+ export { breakpoints } from './media-query/breakpoints.js';
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,32 @@
1
+ const IS_TOUCH = 'is-touch';
2
+ const WITH_MOUSE = `${IS_TOUCH}--with-mouse`;
3
+ const html = document.documentElement;
4
+ class DetectTouch {
5
+ constructor() {
6
+ this.hasMouse = false;
7
+ this.touch =
8
+ 'ontouchstart' in html ||
9
+ navigator.maxTouchPoints > 0 ||
10
+ navigator.msMaxTouchPoints > 0;
11
+ html.addEventListener('touchstart', () => {
12
+ html.removeEventListener('mousemove', () => this.handleMouseEvent());
13
+ });
14
+ html.addEventListener('mousemove', () => this.handleMouseEvent());
15
+ if (this.touch) {
16
+ html.classList.add(IS_TOUCH);
17
+ }
18
+ }
19
+ get isTouchDevice() {
20
+ return this.touch;
21
+ }
22
+ handleMouseEvent() {
23
+ if (!this.hasMouse && html.classList.contains(IS_TOUCH)) {
24
+ html.classList.add(WITH_MOUSE);
25
+ this.hasMouse = true;
26
+ }
27
+ }
28
+ }
29
+ const detectTouch = new DetectTouch();
30
+
31
+ export { DetectTouch, detectTouch };
32
+ //# sourceMappingURL=is-touch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-touch.js","sources":["../../src/is-touch.ts"],"sourcesContent":["const IS_TOUCH = 'is-touch';\nconst WITH_MOUSE = `${IS_TOUCH}--with-mouse`;\nconst html = document.documentElement;\n\nexport class DetectTouch {\n touch: boolean;\n hasMouse: boolean;\n\n get isTouchDevice() {\n return this.touch;\n }\n\n constructor() {\n this.hasMouse = false;\n this.touch =\n 'ontouchstart' in html ||\n navigator.maxTouchPoints > 0 ||\n navigator.msMaxTouchPoints > 0;\n\n html.addEventListener('touchstart', () => {\n html.removeEventListener('mousemove', () => this.handleMouseEvent());\n });\n\n html.addEventListener('mousemove', () => this.handleMouseEvent());\n\n if (this.touch) {\n html.classList.add(IS_TOUCH);\n }\n }\n\n handleMouseEvent() {\n if (!this.hasMouse && html.classList.contains(IS_TOUCH)) {\n html.classList.add(WITH_MOUSE);\n this.hasMouse = true;\n }\n }\n}\n\nexport const detectTouch = new DetectTouch();\n"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,UAAU,CAAC;AAC5B,MAAM,UAAU,GAAG,GAAG,QAAQ,cAAc,CAAC;AAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;MAEzB,WAAW;IAQpB;QACI,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,KAAK;YACN,cAAc,IAAI,IAAI;gBACtB,SAAS,CAAC,cAAc,GAAG,CAAC;gBAC5B,SAAS,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAEnC,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE;YAChC,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;SACxE,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAElE,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAChC;KACJ;IApBD,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;IAoBD,gBAAgB;QACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACrD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACxB;KACJ;CACJ;MAEY,WAAW,GAAG,IAAI,WAAW;;;;"}
@@ -0,0 +1,29 @@
1
+ const breakpoints = {
2
+ mobile: {
3
+ size: 320,
4
+ active: false,
5
+ },
6
+ mobilePlus: {
7
+ size: 480,
8
+ active: false,
9
+ },
10
+ tabletPortrait: {
11
+ size: 768,
12
+ active: false,
13
+ },
14
+ tabletLandscape: {
15
+ size: 1024,
16
+ active: false,
17
+ },
18
+ laptop: {
19
+ size: 1260,
20
+ active: false,
21
+ },
22
+ desktop: {
23
+ size: 1600,
24
+ active: false,
25
+ },
26
+ };
27
+
28
+ export { breakpoints };
29
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.js","sources":["../../../src/media-query/breakpoints.ts"],"sourcesContent":["export const breakpoints = {\n mobile: {\n size: 320,\n active: false,\n },\n mobilePlus: {\n size: 480,\n active: false,\n },\n tabletPortrait: {\n size: 768,\n active: false,\n },\n tabletLandscape: {\n size: 1024,\n active: false,\n },\n laptop: {\n size: 1260,\n active: false,\n },\n desktop: {\n size: 1600,\n active: false,\n },\n};\n"],"names":[],"mappings":"MAAa,WAAW,GAAG;IACvB,MAAM,EAAE;QACJ,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,KAAK;KAChB;IACD,UAAU,EAAE;QACR,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,KAAK;KAChB;IACD,cAAc,EAAE;QACZ,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,KAAK;KAChB;IACD,eAAe,EAAE;QACb,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,KAAK;KAChB;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,KAAK;KAChB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,KAAK;KAChB;;;;;"}
@@ -0,0 +1,39 @@
1
+ import { breakpoints } from './breakpoints.js';
2
+ export { breakpoints } from './breakpoints.js';
3
+ import { getSizeFromBreakpoint, getMediaQueries } from './utils/index.js';
4
+
5
+ const max = (breakpoint) => `(max-width: ${getSizeFromBreakpoint(breakpoint)}px)`;
6
+ const min = (breakpoint) => `(min-width: ${getSizeFromBreakpoint(breakpoint)}px)`;
7
+ const mediaIsMatch = (breakpoint) => window.matchMedia(breakpoint).matches;
8
+ const deviceWidth = {
9
+ isMobilePlusAndSmaller: mediaIsMatch(`${min('mobile')} and ${max('mobilePlus')}`),
10
+ isTabletPortraitAndSmaller: mediaIsMatch(`${min('mobile')} and ${max('tabletPortrait')}`),
11
+ };
12
+ const mediaWatcher = (mediaQuery, layoutChangedCallback) => {
13
+ const mediaQueryListener = window.matchMedia(mediaQuery);
14
+ mediaQueryListener.addListener((e) => layoutChangedCallback(e.matches));
15
+ layoutChangedCallback(mediaQueryListener.matches);
16
+ };
17
+ const getCurrentBreakpoint = () => getMediaQueries().reduce((previous, current) => window.matchMedia(current.query()).matches ? current.breakpoint : previous, undefined);
18
+ const useMedia = (callback) => {
19
+ const breakpointObject = getMediaQueries();
20
+ breakpointObject
21
+ .map((breakpoint) => {
22
+ return {
23
+ listener: window.matchMedia(breakpoint.query()),
24
+ breakpoint: breakpoint.breakpoint,
25
+ };
26
+ })
27
+ .forEach((breakpoint) => breakpoint.listener.addListener((e) => handleMediaListeners(e, breakpoint.breakpoint)));
28
+ function handleMediaListeners(event, key) {
29
+ if (!event.matches)
30
+ return;
31
+ Object.keys(breakpoints).forEach((item) => (breakpoints[item].active =
32
+ item === key ? event.matches : !event.matches));
33
+ callback(breakpoints);
34
+ }
35
+ callback(breakpoints);
36
+ };
37
+
38
+ export { deviceWidth, getCurrentBreakpoint, max, mediaIsMatch, mediaWatcher, min, useMedia };
39
+ //# sourceMappingURL=media-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-query.js","sources":["../../../src/media-query/media-query.ts"],"sourcesContent":["import { breakpoints } from './breakpoints';\nimport { BreakpointFunction, Breakpoints, UseMediaFunction } from './media-query.types';\nimport { getMediaQueries, getSizeFromBreakpoint } from './utils';\n\nconst max: BreakpointFunction = (breakpoint) =>\n `(max-width: ${getSizeFromBreakpoint(breakpoint)}px)`;\n\nconst min: BreakpointFunction = (breakpoint) =>\n `(min-width: ${getSizeFromBreakpoint(breakpoint)}px)`;\n\n/**\n * Check if the given breakpoint is a match\n * @param breakpoint { string }\n */\nexport const mediaIsMatch = (breakpoint: string) => window.matchMedia(breakpoint).matches;\n\nexport const deviceWidth = {\n isMobilePlusAndSmaller: mediaIsMatch(`${min('mobile')} and ${max('mobilePlus')}`),\n isTabletPortraitAndSmaller: mediaIsMatch(`${min('mobile')} and ${max('tabletPortrait')}`),\n};\n\n/**\n * Method that calls a callback everytime a media-query matches\n * mediaWatcher(`(min-width: 600px)`, (matches) => {\n * console.log(matches);\n * });\n * @function mediaWatcher\n * @param mediaQuery { string }\n * @param layoutChangedCallback { callback }\n */\nconst mediaWatcher = (\n mediaQuery: string,\n layoutChangedCallback: (mediaQueryMatches: boolean) => void,\n) => {\n const mediaQueryListener = window.matchMedia(mediaQuery);\n mediaQueryListener.addListener((e) => layoutChangedCallback(e.matches));\n layoutChangedCallback(mediaQueryListener.matches);\n};\n\n/**\n * Returns current active breakpoint\n * @function getCurrentBreakpoint\n */\nconst getCurrentBreakpoint = () =>\n getMediaQueries().reduce(\n (previous, current) =>\n window.matchMedia(current.query()).matches ? current.breakpoint : (previous as any),\n undefined,\n );\n\n/**\n * Returns the breakpoints object in the given callback\n * @function useMedia\n * @param callback returns @type Breakpoints\n */\nconst useMedia = (callback: UseMediaFunction) => {\n const breakpointObject = getMediaQueries();\n\n breakpointObject\n .map((breakpoint) => {\n return {\n listener: window.matchMedia(breakpoint.query()),\n breakpoint: breakpoint.breakpoint,\n };\n })\n .forEach((breakpoint) =>\n breakpoint.listener.addListener((e) => handleMediaListeners(e, breakpoint.breakpoint)),\n );\n\n function handleMediaListeners(event: { matches: boolean; media: string }, key: Breakpoints) {\n if (!event.matches) return;\n\n Object.keys(breakpoints).forEach(\n (item: any) =>\n (breakpoints[item as Breakpoints].active =\n item === key ? event.matches : !event.matches),\n );\n\n callback(breakpoints);\n }\n\n callback(breakpoints);\n};\n\nexport { breakpoints, min, max, useMedia, mediaWatcher, getCurrentBreakpoint, Breakpoints };\n"],"names":[],"mappings":";;;;MAIM,GAAG,GAAuB,CAAC,UAAU,KACvC,eAAe,qBAAqB,CAAC,UAAU,CAAC,MAAM;MAEpD,GAAG,GAAuB,CAAC,UAAU,KACvC,eAAe,qBAAqB,CAAC,UAAU,CAAC,MAAM;MAM7C,YAAY,GAAG,CAAC,UAAkB,KAAK,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,QAAQ;MAE7E,WAAW,GAAG;IACvB,sBAAsB,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;IACjF,0BAA0B,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;EAC3F;MAWI,YAAY,GAAG,CACjB,UAAkB,EAClB,qBAA2D;IAE3D,MAAM,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACzD,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,qBAAqB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,qBAAqB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACtD,EAAE;MAMI,oBAAoB,GAAG,MACzB,eAAe,EAAE,CAAC,MAAM,CACpB,CAAC,QAAQ,EAAE,OAAO,KACd,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,UAAU,GAAI,QAAgB,EACvF,SAAS,EACX;MAOA,QAAQ,GAAG,CAAC,QAA0B;IACxC,MAAM,gBAAgB,GAAG,eAAe,EAAE,CAAC;IAE3C,gBAAgB;SACX,GAAG,CAAC,CAAC,UAAU;QACZ,OAAO;YACH,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;YAC/C,UAAU,EAAE,UAAU,CAAC,UAAU;SACpC,CAAC;KACL,CAAC;SACD,OAAO,CAAC,CAAC,UAAU,KAChB,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CACzF,CAAC;IAEN,SAAS,oBAAoB,CAAC,KAA0C,EAAE,GAAgB;QACtF,IAAI,CAAC,KAAK,CAAC,OAAO;YAAE,OAAO;QAE3B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAC5B,CAAC,IAAS,MACL,WAAW,CAAC,IAAmB,CAAC,CAAC,MAAM;YACpC,IAAI,KAAK,GAAG,GAAG,KAAK,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CACzD,CAAC;QAEF,QAAQ,CAAC,WAAW,CAAC,CAAC;KACzB;IAED,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC1B;;;;"}
@@ -0,0 +1,35 @@
1
+ import { breakpoints } from '../breakpoints.js';
2
+
3
+ function getSizeFromBreakpoint(breakpointValue) {
4
+ if (breakpoints[breakpointValue].size) {
5
+ return breakpoints[breakpointValue].size;
6
+ }
7
+ else {
8
+ console.error('No valid breakpoint or size specified for media.');
9
+ return '0';
10
+ }
11
+ }
12
+ function getMediaQueries() {
13
+ const breakpointMap = Object.keys(breakpoints);
14
+ return breakpointMap.map((item, index) => {
15
+ const breakpoint = breakpoints[item];
16
+ const breakpointAbove = breakpoints[breakpointMap[index + 1]];
17
+ return {
18
+ breakpoint: item,
19
+ query: () => {
20
+ if (index === 0) {
21
+ return `(max-width: ${breakpointAbove.size - 1}px)`;
22
+ }
23
+ else if (index === breakpointMap.length - 1) {
24
+ return `(min-width: ${breakpoint.size}px)`;
25
+ }
26
+ else {
27
+ return `(max-width: ${breakpointAbove.size - 1}px) and (min-width: ${breakpoint.size}px)`;
28
+ }
29
+ },
30
+ };
31
+ });
32
+ }
33
+
34
+ export { getMediaQueries, getSizeFromBreakpoint };
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/media-query/utils/index.ts"],"sourcesContent":["import { breakpoints } from '../breakpoints';\nimport { Breakpoints, MediaQuery } from '../media-query.types';\n\nexport function getSizeFromBreakpoint(breakpointValue: Breakpoints) {\n if (breakpoints[breakpointValue].size) {\n return breakpoints[breakpointValue].size;\n } else {\n console.error('No valid breakpoint or size specified for media.');\n return '0';\n }\n}\n\nexport function getMediaQueries(): MediaQuery[] {\n const breakpointMap = Object.keys(breakpoints);\n\n return breakpointMap.map((item: any, index: number) => {\n const breakpoint = breakpoints[item as Breakpoints];\n const breakpointAbove = breakpoints[breakpointMap[index + 1] as Breakpoints];\n\n return {\n breakpoint: item,\n query: () => {\n if (index === 0) {\n return `(max-width: ${breakpointAbove.size - 1}px)`;\n } else if (index === breakpointMap.length - 1) {\n return `(min-width: ${breakpoint.size}px)`;\n } else {\n return `(max-width: ${breakpointAbove.size - 1}px) and (min-width: ${\n breakpoint.size\n }px)`;\n }\n },\n };\n });\n}\n"],"names":[],"mappings":";;SAGgB,qBAAqB,CAAC,eAA4B;IAC9D,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE;QACnC,OAAO,WAAW,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC;KAC5C;SAAM;QACH,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAClE,OAAO,GAAG,CAAC;KACd;AACL,CAAC;SAEe,eAAe;IAC3B,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAE/C,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,KAAa;QAC9C,MAAM,UAAU,GAAG,WAAW,CAAC,IAAmB,CAAC,CAAC;QACpD,MAAM,eAAe,GAAG,WAAW,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC,CAAgB,CAAC,CAAC;QAE7E,OAAO;YACH,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE;gBACH,IAAI,KAAK,KAAK,CAAC,EAAE;oBACb,OAAO,eAAe,eAAe,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC;iBACvD;qBAAM,IAAI,KAAK,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC3C,OAAO,eAAe,UAAU,CAAC,IAAI,KAAK,CAAC;iBAC9C;qBAAM;oBACH,OAAO,eAAe,eAAe,CAAC,IAAI,GAAG,CAAC,uBAC1C,UAAU,CAAC,IACf,KAAK,CAAC;iBACT;aACJ;SACJ,CAAC;KACL,CAAC,CAAC;AACP;;;;"}
@@ -0,0 +1,24 @@
1
+ const rafThrottle = (callback) => {
2
+ let requestId = null;
3
+ let lastArgs = null;
4
+ const wrapperFunction = (...args) => {
5
+ lastArgs = args;
6
+ if (requestId) {
7
+ return;
8
+ }
9
+ requestId = requestAnimationFrame(() => {
10
+ requestId = null;
11
+ callback(...lastArgs);
12
+ });
13
+ };
14
+ wrapperFunction.cancel = () => {
15
+ if (requestId !== null) {
16
+ cancelAnimationFrame(requestId);
17
+ requestId = null;
18
+ }
19
+ };
20
+ return wrapperFunction;
21
+ };
22
+
23
+ export { rafThrottle };
24
+ //# sourceMappingURL=raf-throttle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raf-throttle.js","sources":["../../src/raf-throttle.ts"],"sourcesContent":["export const rafThrottle = (callback: (...args: any[]) => void) => {\n let requestId: null | number = null;\n\n let lastArgs: any = null;\n\n const wrapperFunction = (...args: any[]) => {\n // Always capture the latest value\n lastArgs = args;\n\n // There is already a frame queued\n if (requestId) {\n return;\n }\n\n // Schedule a new frame\n requestId = requestAnimationFrame(() => {\n requestId = null;\n callback(...lastArgs);\n });\n };\n\n wrapperFunction.cancel = () => {\n if (requestId !== null) {\n cancelAnimationFrame(requestId);\n requestId = null;\n }\n };\n\n return wrapperFunction;\n};\n"],"names":[],"mappings":"MAAa,WAAW,GAAG,CAAC,QAAkC;IAC1D,IAAI,SAAS,GAAkB,IAAI,CAAC;IAEpC,IAAI,QAAQ,GAAQ,IAAI,CAAC;IAEzB,MAAM,eAAe,GAAG,CAAC,GAAG,IAAW;QAEnC,QAAQ,GAAG,IAAI,CAAC;QAGhB,IAAI,SAAS,EAAE;YACX,OAAO;SACV;QAGD,SAAS,GAAG,qBAAqB,CAAC;YAC9B,SAAS,GAAG,IAAI,CAAC;YACjB,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;SACzB,CAAC,CAAC;KACN,CAAC;IAEF,eAAe,CAAC,MAAM,GAAG;QACrB,IAAI,SAAS,KAAK,IAAI,EAAE;YACpB,oBAAoB,CAAC,SAAS,CAAC,CAAC;YAChC,SAAS,GAAG,IAAI,CAAC;SACpB;KACJ,CAAC;IAEF,OAAO,eAAe,CAAC;AAC3B;;;;"}
@@ -0,0 +1,23 @@
1
+ const throttle = (fn, wait = 300) => {
2
+ let inThrottle, lastFn, lastTime;
3
+ return function () {
4
+ const context = this, args = arguments;
5
+ if (!inThrottle) {
6
+ fn.apply(context, args);
7
+ lastTime = Date.now();
8
+ inThrottle = true;
9
+ }
10
+ else {
11
+ clearTimeout(lastFn);
12
+ lastFn = setTimeout(() => {
13
+ if (Date.now() - lastTime >= wait) {
14
+ fn.apply(context, args);
15
+ lastTime = Date.now();
16
+ }
17
+ }, Math.max(wait - (Date.now() - lastTime), 0));
18
+ }
19
+ };
20
+ };
21
+
22
+ export { throttle };
23
+ //# sourceMappingURL=throttle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"throttle.js","sources":["../../src/throttle.ts"],"sourcesContent":["const throttle = (fn: Function, wait: number = 300) => {\n let inThrottle: boolean, lastFn: ReturnType<typeof setTimeout>, lastTime: number;\n\n return function (this: any) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const context = this,\n // eslint-disable-next-line prefer-rest-params\n args = arguments;\n if (!inThrottle) {\n fn.apply(context, args);\n lastTime = Date.now();\n inThrottle = true;\n } else {\n clearTimeout(lastFn);\n lastFn = setTimeout(() => {\n if (Date.now() - lastTime >= wait) {\n fn.apply(context, args);\n lastTime = Date.now();\n }\n }, Math.max(wait - (Date.now() - lastTime), 0));\n }\n };\n};\n\nexport { throttle };\n"],"names":[],"mappings":"MAAM,QAAQ,GAAG,CAAC,EAAY,EAAE,OAAe,GAAG;IAC9C,IAAI,UAAmB,EAAE,MAAqC,EAAE,QAAgB,CAAC;IAEjF,OAAO;QAEH,MAAM,OAAO,GAAG,IAAI,EAEhB,IAAI,GAAG,SAAS,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE;YACb,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACxB,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACtB,UAAU,GAAG,IAAI,CAAC;SACrB;aAAM;YACH,YAAY,CAAC,MAAM,CAAC,CAAC;YACrB,MAAM,GAAG,UAAU,CAAC;gBAChB,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,IAAI,IAAI,EAAE;oBAC/B,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBACxB,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;iBACzB;aACJ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SACnD;KACJ,CAAC;AACN;;;;"}
@@ -0,0 +1,26 @@
1
+ const round = (value, decimals) => Number(Math.round(value + 'e' + decimals) + 'e-' + decimals).toFixed(decimals);
2
+ const putThousandsSeparators = (value, sep) => {
3
+ let transformedValue = null;
4
+ if (sep == null) {
5
+ sep = '.';
6
+ }
7
+ if (value.toString() === value.toLocaleString()) {
8
+ const parts = value.toString().split(',');
9
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, sep);
10
+ transformedValue = parts[1] ? parts.join(',') : parts[0];
11
+ }
12
+ else {
13
+ transformedValue = value.toLocaleString();
14
+ }
15
+ return transformedValue;
16
+ };
17
+ const toCurrency = (value, decimals = 2) => {
18
+ let transformedValue = null;
19
+ transformedValue = round(Number(value), decimals);
20
+ transformedValue = `${value.toString().replace('.', ',')}`;
21
+ transformedValue = putThousandsSeparators(value);
22
+ return `€ ${transformedValue}`;
23
+ };
24
+
25
+ export { putThousandsSeparators, round, toCurrency };
26
+ //# sourceMappingURL=to-currency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-currency.js","sources":["../../src/to-currency.ts"],"sourcesContent":["export const round = (value: number, decimals: number) =>\n Number(Math.round(value + ('e' as any) + decimals) + 'e-' + decimals).toFixed(decimals);\n\nexport const putThousandsSeparators = (value: number | string, sep?: string) => {\n let transformedValue = null;\n\n if (sep == null) {\n sep = '.';\n }\n\n // check if it needs formatting\n if (value.toString() === value.toLocaleString()) {\n // split decimals\n const parts = value.toString().split(',');\n\n // format whole numbers\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, sep);\n\n // put them back together\n transformedValue = parts[1] ? parts.join(',') : parts[0];\n } else {\n transformedValue = value.toLocaleString();\n }\n\n return transformedValue;\n};\n\nexport const toCurrency = (value: number, decimals = 2) => {\n let transformedValue = null;\n\n transformedValue = round(Number(value), decimals);\n transformedValue = `${value.toString().replace('.', ',')}`;\n transformedValue = putThousandsSeparators(value);\n\n return `€ ${transformedValue}`;\n};\n"],"names":[],"mappings":"MAAa,KAAK,GAAG,CAAC,KAAa,EAAE,QAAgB,KACjD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,GAAW,GAAG,QAAQ,CAAC,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE;MAE/E,sBAAsB,GAAG,CAAC,KAAsB,EAAE,GAAY;IACvE,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAE5B,IAAI,GAAG,IAAI,IAAI,EAAE;QACb,GAAG,GAAG,GAAG,CAAC;KACb;IAGD,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,cAAc,EAAE,EAAE;QAE7C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAG1C,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAG1D,gBAAgB,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;KAC5D;SAAM;QACH,gBAAgB,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;KAC7C;IAED,OAAO,gBAAgB,CAAC;AAC5B,EAAE;MAEW,UAAU,GAAG,CAAC,KAAa,EAAE,QAAQ,GAAG,CAAC;IAClD,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAE5B,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC;IAClD,gBAAgB,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC3D,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAEjD,OAAO,KAAK,gBAAgB,EAAE,CAAC;AACnC;;;;"}
@@ -0,0 +1,5 @@
1
+ import { ConstructionNumberModel, ProjectPhaseModel, PropertyTypeModel } from '@/generated';
2
+ declare const EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES: (keyof ConstructionNumberModel)[];
3
+ declare const EXCLUDED_PROPERTY_TYPE_PROPERTIES: (keyof PropertyTypeModel)[];
4
+ declare const EXCLUDED_PROJECT_PHASE_PROPERTIES: (keyof ProjectPhaseModel)[];
5
+ export { EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES, EXCLUDED_PROPERTY_TYPE_PROPERTIES, EXCLUDED_PROJECT_PHASE_PROPERTIES, };
@@ -0,0 +1,35 @@
1
+ const EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES = [
2
+ 'shortDescription',
3
+ 'longDescription',
4
+ 'resources',
5
+ 'gardens',
6
+ 'outbuildings',
7
+ 'groundLease',
8
+ 'floors',
9
+ 'outsideSpace',
10
+ 'extraSpecifications',
11
+ 'landRegistration',
12
+ ];
13
+ const EXCLUDED_PROPERTY_TYPE_PROPERTIES = [
14
+ 'shortDescription',
15
+ 'longDescription',
16
+ 'environmentTypes',
17
+ 'groundLease',
18
+ 'resources',
19
+ 'constructionStartDate',
20
+ 'indicationServiceCosts',
21
+ 'indicationSecurity',
22
+ 'floors',
23
+ 'gardens',
24
+ 'outbuildings',
25
+ 'usp1Title',
26
+ 'usp1Text',
27
+ 'usp2Title',
28
+ 'usp2Text',
29
+ ];
30
+ const EXCLUDED_PROJECT_PHASE_PROPERTIES = [
31
+ 'longDescription',
32
+ 'resources',
33
+ ];
34
+ export { EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES, EXCLUDED_PROPERTY_TYPE_PROPERTIES, EXCLUDED_PROJECT_PHASE_PROPERTIES, };
35
+ //# sourceMappingURL=excluded-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"excluded-properties.js","sourceRoot":"","sources":["../../src/extended-api-models/excluded-properties.ts"],"names":[],"mappings":"AAKA,MAAM,uCAAuC,GAAsC;IAC/E,kBAAkB;IAClB,iBAAiB;IACjB,WAAW;IACX,SAAS;IACT,cAAc;IACd,aAAa;IACb,QAAQ;IACR,cAAc;IACd,qBAAqB;IACrB,kBAAkB;CACrB,CAAC;AAKF,MAAM,iCAAiC,GAAgC;IACnE,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,aAAa;IACb,WAAW;IACX,uBAAuB;IACvB,wBAAwB;IACxB,oBAAoB;IACpB,QAAQ;IACR,SAAS;IACT,cAAc;IACd,WAAW;IACX,UAAU;IACV,WAAW;IACX,UAAU;CACb,CAAC;AAKF,MAAM,iCAAiC,GAAgC;IACnE,iBAAiB;IACjB,WAAW;CACd,CAAC;AAEF,OAAO,EACH,uCAAuC,EACvC,iCAAiC,EACjC,iCAAiC,GACpC,CAAC","sourcesContent":["import { ConstructionNumberModel, ProjectPhaseModel, PropertyTypeModel } from '@/generated';\n\n/*\n THE EXCLUDED VALUES ALSO NEED TO BE CHANGED IN api-utilitites.types.ts\n*/\nconst EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES: (keyof ConstructionNumberModel)[] = [\n 'shortDescription',\n 'longDescription',\n 'resources',\n 'gardens',\n 'outbuildings',\n 'groundLease',\n 'floors',\n 'outsideSpace',\n 'extraSpecifications',\n 'landRegistration',\n];\n\n/*\n THE EXCLUDED VALUES ALSO NEED TO BE CHANGED IN api-utilitites.types.ts\n*/\nconst EXCLUDED_PROPERTY_TYPE_PROPERTIES: (keyof PropertyTypeModel)[] = [\n 'shortDescription',\n 'longDescription',\n 'environmentTypes',\n 'groundLease',\n 'resources',\n 'constructionStartDate',\n 'indicationServiceCosts',\n 'indicationSecurity',\n 'floors',\n 'gardens',\n 'outbuildings',\n 'usp1Title',\n 'usp1Text',\n 'usp2Title',\n 'usp2Text',\n];\n\n/*\n THE EXCLUDED VALUES ALSO NEED TO BE CHANGED IN api-utilitites.types.ts\n*/\nconst EXCLUDED_PROJECT_PHASE_PROPERTIES: (keyof ProjectPhaseModel)[] = [\n 'longDescription',\n 'resources',\n];\n\nexport {\n EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES,\n EXCLUDED_PROPERTY_TYPE_PROPERTIES,\n EXCLUDED_PROJECT_PHASE_PROPERTIES,\n};\n"]}
@@ -1,11 +1,18 @@
1
+ import { hasDatePassed } from '../../date';
1
2
  const constructionNumberStatus = (constructionNumber) => {
2
3
  const { projectPhase, availabilityStatus } = constructionNumber;
3
4
  const { isRental, status: projectPhaseStatus } = projectPhase || {};
4
5
  if (projectPhaseStatus === 'InPreparation')
5
- return 'InPreparation';
6
+ return availabilityStatus === 'Reserved' ? 'Reserved' : 'InPreparation';
6
7
  if (projectPhaseStatus === 'Sold')
7
8
  return 'UnderConstruction';
8
9
  switch (availabilityStatus) {
10
+ case 'Reserved':
11
+ if (projectPhaseStatus === 'OnSale' && (projectPhase === null || projectPhase === void 0 ? void 0 : projectPhase.allocationDate) &&
12
+ hasDatePassed(projectPhase.allocationDate)) {
13
+ return 'InOption';
14
+ }
15
+ return 'Reserved';
9
16
  case 'InOption':
10
17
  return 'InOption';
11
18
  case 'Available':