instantsearch.js 4.49.1 → 4.49.3

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 (396) hide show
  1. package/README.md +14 -8
  2. package/cjs/components/Answers/Answers.js +11 -18
  3. package/cjs/components/Breadcrumb/Breadcrumb.js +6 -13
  4. package/cjs/components/ClearRefinements/ClearRefinements.js +5 -12
  5. package/cjs/components/CurrentRefinements/CurrentRefinements.js +8 -16
  6. package/cjs/components/GeoSearchControls/GeoSearchButton.js +4 -7
  7. package/cjs/components/GeoSearchControls/GeoSearchControls.js +14 -23
  8. package/cjs/components/GeoSearchControls/GeoSearchToggle.js +4 -7
  9. package/cjs/components/Highlight/Highlight.js +5 -12
  10. package/cjs/components/Hits/Hits.js +13 -22
  11. package/cjs/components/InfiniteHits/InfiniteHits.js +18 -27
  12. package/cjs/components/InternalHighlight/InternalHighlight.js +0 -3
  13. package/cjs/components/MenuSelect/MenuSelect.js +12 -22
  14. package/cjs/components/Pagination/Pagination.js +12 -20
  15. package/cjs/components/Panel/Panel.js +9 -28
  16. package/cjs/components/PoweredBy/PoweredBy.js +4 -6
  17. package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +3 -8
  18. package/cjs/components/RangeInput/RangeInput.js +21 -51
  19. package/cjs/components/RefinementList/RefinementList.js +30 -81
  20. package/cjs/components/RefinementList/RefinementListItem.js +9 -15
  21. package/cjs/components/RelevantSort/RelevantSort.js +5 -10
  22. package/cjs/components/ReverseHighlight/ReverseHighlight.js +5 -12
  23. package/cjs/components/ReverseSnippet/ReverseSnippet.js +5 -12
  24. package/cjs/components/SearchBox/SearchBox.js +35 -77
  25. package/cjs/components/Selector/Selector.js +3 -7
  26. package/cjs/components/Slider/Pit.js +7 -11
  27. package/cjs/components/Slider/Rheostat.js +69 -133
  28. package/cjs/components/Slider/Slider.js +39 -72
  29. package/cjs/components/Snippet/Snippet.js +5 -12
  30. package/cjs/components/Stats/Stats.js +13 -22
  31. package/cjs/components/Template/Template.js +17 -44
  32. package/cjs/components/ToggleRefinement/ToggleRefinement.js +5 -11
  33. package/cjs/components/VoiceSearch/VoiceSearch.js +9 -17
  34. package/cjs/connectors/answers/connectAnswers.js +36 -46
  35. package/cjs/connectors/autocomplete/connectAutocomplete.js +21 -35
  36. package/cjs/connectors/breadcrumb/connectBreadcrumb.js +27 -55
  37. package/cjs/connectors/clear-refinements/connectClearRefinements.js +41 -56
  38. package/cjs/connectors/configure/connectConfigure.js +17 -28
  39. package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +21 -43
  40. package/cjs/connectors/current-refinements/connectCurrentRefinements.js +29 -65
  41. package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +27 -45
  42. package/cjs/connectors/geo-search/connectGeoSearch.js +32 -59
  43. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +50 -82
  44. package/cjs/connectors/hits/connectHits.js +25 -38
  45. package/cjs/connectors/hits/connectHitsWithInsights.js +3 -7
  46. package/cjs/connectors/hits-per-page/connectHitsPerPage.js +26 -46
  47. package/cjs/connectors/index.js +92 -126
  48. package/cjs/connectors/infinite-hits/connectInfiniteHits.js +43 -75
  49. package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +3 -7
  50. package/cjs/connectors/menu/connectMenu.js +39 -73
  51. package/cjs/connectors/numeric-menu/connectNumericMenu.js +37 -86
  52. package/cjs/connectors/pagination/Paginator.js +11 -25
  53. package/cjs/connectors/pagination/connectPagination.js +17 -31
  54. package/cjs/connectors/powered-by/connectPoweredBy.js +13 -19
  55. package/cjs/connectors/query-rules/connectQueryRules.js +44 -65
  56. package/cjs/connectors/range/connectRange.js +72 -129
  57. package/cjs/connectors/rating-menu/connectRatingMenu.js +34 -87
  58. package/cjs/connectors/refinement-list/connectRefinementList.js +51 -79
  59. package/cjs/connectors/relevant-sort/connectRelevantSort.js +11 -18
  60. package/cjs/connectors/search-box/connectSearchBox.js +15 -28
  61. package/cjs/connectors/sort-by/connectSortBy.js +21 -28
  62. package/cjs/connectors/stats/connectStats.js +12 -16
  63. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +44 -75
  64. package/cjs/connectors/voice-search/connectVoiceSearch.js +22 -41
  65. package/cjs/helpers/components/Highlight.js +11 -18
  66. package/cjs/helpers/components/ReverseHighlight.js +19 -26
  67. package/cjs/helpers/components/ReverseSnippet.js +19 -26
  68. package/cjs/helpers/components/Snippet.js +11 -18
  69. package/cjs/helpers/components/index.js +4 -12
  70. package/cjs/helpers/get-insights-anonymous-user-token.js +6 -17
  71. package/cjs/helpers/highlight.js +15 -19
  72. package/cjs/helpers/index.js +23 -37
  73. package/cjs/helpers/insights.js +9 -21
  74. package/cjs/helpers/reverseHighlight.js +16 -20
  75. package/cjs/helpers/reverseSnippet.js +16 -20
  76. package/cjs/helpers/snippet.js +15 -19
  77. package/cjs/index.js +12 -27
  78. package/cjs/lib/InstantSearch.js +108 -207
  79. package/cjs/lib/createHelpers.js +15 -19
  80. package/cjs/lib/formatNumber.js +0 -1
  81. package/cjs/lib/infiniteHitsCache/index.js +1 -3
  82. package/cjs/lib/infiniteHitsCache/sessionStorage.js +14 -22
  83. package/cjs/lib/insights/client.js +17 -40
  84. package/cjs/lib/insights/index.js +9 -15
  85. package/cjs/lib/insights/listener.js +7 -24
  86. package/cjs/lib/routers/history.js +75 -117
  87. package/cjs/lib/routers/index.js +1 -3
  88. package/cjs/lib/stateMappings/index.js +2 -5
  89. package/cjs/lib/stateMappings/simple.js +11 -14
  90. package/cjs/lib/stateMappings/singleIndex.js +6 -8
  91. package/cjs/lib/suit.js +2 -5
  92. package/cjs/lib/templating/index.js +2 -6
  93. package/cjs/lib/templating/prepareTemplateProps.js +14 -22
  94. package/cjs/lib/templating/renderTemplate.js +17 -30
  95. package/cjs/lib/utils/capitalize.js +0 -1
  96. package/cjs/lib/utils/checkIndexUiState.js +19 -47
  97. package/cjs/lib/utils/checkRendering.js +1 -3
  98. package/cjs/lib/utils/clearRefinements.js +2 -9
  99. package/cjs/lib/utils/concatHighlightedParts.js +2 -4
  100. package/cjs/lib/utils/createConcurrentSafePromise.js +0 -3
  101. package/cjs/lib/utils/createSendEventForFacet.js +8 -15
  102. package/cjs/lib/utils/createSendEventForHits.js +10 -34
  103. package/cjs/lib/utils/debounce.js +0 -3
  104. package/cjs/lib/utils/defer.js +0 -11
  105. package/cjs/lib/utils/detect-insights-client.js +1 -3
  106. package/cjs/lib/utils/documentation.js +2 -5
  107. package/cjs/lib/utils/escape-highlight.js +13 -26
  108. package/cjs/lib/utils/escape-html.js +9 -7
  109. package/cjs/lib/utils/escapeFacetValue.js +1 -5
  110. package/cjs/lib/utils/find.js +2 -5
  111. package/cjs/lib/utils/findIndex.js +0 -3
  112. package/cjs/lib/utils/geo-search.js +21 -37
  113. package/cjs/lib/utils/getAppIdAndApiKey.js +2 -3
  114. package/cjs/lib/utils/getContainerNode.js +1 -7
  115. package/cjs/lib/utils/getHighlightFromSiblings.js +1 -7
  116. package/cjs/lib/utils/getHighlightedParts.js +2 -5
  117. package/cjs/lib/utils/getObjectType.js +0 -1
  118. package/cjs/lib/utils/getPropertyByPath.js +0 -1
  119. package/cjs/lib/utils/getRefinements.js +30 -45
  120. package/cjs/lib/utils/getWidgetAttribute.js +0 -6
  121. package/cjs/lib/utils/hits-absolute-position.js +6 -7
  122. package/cjs/lib/utils/hits-query-id.js +6 -8
  123. package/cjs/lib/utils/index.js +46 -138
  124. package/cjs/lib/utils/isDomElement.js +0 -1
  125. package/cjs/lib/utils/isEqual.js +2 -7
  126. package/cjs/lib/utils/isFacetRefined.js +0 -1
  127. package/cjs/lib/utils/isFiniteNumber.js +0 -1
  128. package/cjs/lib/utils/isIndexWidget.js +0 -1
  129. package/cjs/lib/utils/isPlainObject.js +3 -11
  130. package/cjs/lib/utils/isSpecialClick.js +0 -1
  131. package/cjs/lib/utils/logger.js +6 -16
  132. package/cjs/lib/utils/mergeSearchParameters.js +23 -43
  133. package/cjs/lib/utils/noop.js +0 -1
  134. package/cjs/lib/utils/range.js +9 -15
  135. package/cjs/lib/utils/render-args.js +0 -2
  136. package/cjs/lib/utils/resolveSearchParameters.js +0 -3
  137. package/cjs/lib/utils/reverseHighlightedParts.js +7 -10
  138. package/cjs/lib/utils/safelyRunOnBrowser.js +7 -9
  139. package/cjs/lib/utils/serializer.js +1 -3
  140. package/cjs/lib/utils/setIndexHelperState.js +2 -7
  141. package/cjs/lib/utils/toArray.js +0 -1
  142. package/cjs/lib/utils/typedObject.js +0 -1
  143. package/cjs/lib/utils/uniq.js +0 -1
  144. package/cjs/lib/version.js +1 -1
  145. package/cjs/lib/voiceSearchHelper/index.js +12 -37
  146. package/cjs/middlewares/createInsightsMiddleware.js +30 -54
  147. package/cjs/middlewares/createMetadataMiddleware.js +7 -15
  148. package/cjs/middlewares/createRouterMiddleware.js +16 -24
  149. package/cjs/middlewares/index.js +3 -9
  150. package/cjs/types/algoliasearch.js +0 -2
  151. package/cjs/types/index.js +14 -42
  152. package/cjs/widgets/analytics/analytics.js +22 -48
  153. package/cjs/widgets/answers/answers.js +32 -49
  154. package/cjs/widgets/breadcrumb/breadcrumb.js +31 -48
  155. package/cjs/widgets/clear-refinements/clear-refinements.js +28 -45
  156. package/cjs/widgets/configure/configure.js +9 -14
  157. package/cjs/widgets/configure-related-items/configure-related-items.js +9 -14
  158. package/cjs/widgets/current-refinements/current-refinements.js +22 -37
  159. package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +17 -32
  160. package/cjs/widgets/geo-search/GeoSearchRenderer.js +50 -72
  161. package/cjs/widgets/geo-search/createHTMLMarker.js +34 -62
  162. package/cjs/widgets/geo-search/defaultTemplates.js +0 -3
  163. package/cjs/widgets/geo-search/geo-search.js +44 -70
  164. package/cjs/widgets/hierarchical-menu/defaultTemplates.js +5 -9
  165. package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +41 -57
  166. package/cjs/widgets/hits/hits.js +32 -50
  167. package/cjs/widgets/hits-per-page/hits-per-page.js +24 -39
  168. package/cjs/widgets/index/index.js +71 -113
  169. package/cjs/widgets/index.js +47 -85
  170. package/cjs/widgets/infinite-hits/infinite-hits.js +39 -57
  171. package/cjs/widgets/menu/defaultTemplates.js +4 -8
  172. package/cjs/widgets/menu/menu.js +36 -53
  173. package/cjs/widgets/menu-select/defaultTemplates.js +2 -4
  174. package/cjs/widgets/menu-select/menu-select.js +31 -48
  175. package/cjs/widgets/numeric-menu/defaultTemplates.js +3 -5
  176. package/cjs/widgets/numeric-menu/numeric-menu.js +30 -47
  177. package/cjs/widgets/pagination/pagination.js +43 -61
  178. package/cjs/widgets/panel/panel.js +31 -56
  179. package/cjs/widgets/places/places.js +22 -34
  180. package/cjs/widgets/powered-by/powered-by.js +20 -34
  181. package/cjs/widgets/query-rule-context/query-rule-context.js +10 -18
  182. package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +24 -39
  183. package/cjs/widgets/range-input/range-input.js +36 -60
  184. package/cjs/widgets/range-slider/range-slider.js +39 -61
  185. package/cjs/widgets/rating-menu/defaultTemplates.js +9 -16
  186. package/cjs/widgets/rating-menu/rating-menu.js +30 -48
  187. package/cjs/widgets/refinement-list/defaultTemplates.js +6 -10
  188. package/cjs/widgets/refinement-list/refinement-list.js +54 -72
  189. package/cjs/widgets/relevant-sort/relevant-sort.js +21 -37
  190. package/cjs/widgets/search-box/defaultTemplates.js +0 -5
  191. package/cjs/widgets/search-box/search-box.js +42 -57
  192. package/cjs/widgets/sort-by/sort-by.js +21 -36
  193. package/cjs/widgets/stats/defaultTemplates.js +1 -2
  194. package/cjs/widgets/stats/stats.js +40 -67
  195. package/cjs/widgets/toggle-refinement/toggle-refinement.js +29 -46
  196. package/cjs/widgets/voice-search/defaultTemplates.js +4 -14
  197. package/cjs/widgets/voice-search/voice-search.js +28 -44
  198. package/dist/instantsearch.development.d.ts +9 -6
  199. package/dist/instantsearch.development.js +1840 -3142
  200. package/dist/instantsearch.development.js.map +1 -1
  201. package/dist/instantsearch.production.d.ts +9 -6
  202. package/dist/instantsearch.production.min.d.ts +9 -6
  203. package/dist/instantsearch.production.min.js +2 -2
  204. package/dist/instantsearch.production.min.js.map +1 -1
  205. package/es/components/Answers/Answers.js +10 -13
  206. package/es/components/Breadcrumb/Breadcrumb.js +5 -8
  207. package/es/components/ClearRefinements/ClearRefinements.js +4 -7
  208. package/es/components/CurrentRefinements/CurrentRefinements.js +5 -10
  209. package/es/components/GeoSearchControls/GeoSearchButton.js +4 -6
  210. package/es/components/GeoSearchControls/GeoSearchControls.js +11 -14
  211. package/es/components/GeoSearchControls/GeoSearchToggle.js +4 -6
  212. package/es/components/Highlight/Highlight.js +4 -7
  213. package/es/components/Hits/Hits.js +12 -17
  214. package/es/components/InfiniteHits/InfiniteHits.js +17 -22
  215. package/es/components/MenuSelect/MenuSelect.js +9 -14
  216. package/es/components/Pagination/Pagination.js +10 -15
  217. package/es/components/Panel/Panel.js +8 -22
  218. package/es/components/PoweredBy/PoweredBy.js +4 -5
  219. package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +2 -4
  220. package/es/components/RangeInput/RangeInput.js +20 -46
  221. package/es/components/RefinementList/RefinementList.js +24 -67
  222. package/es/components/RefinementList/RefinementListItem.js +8 -11
  223. package/es/components/RelevantSort/RelevantSort.js +4 -6
  224. package/es/components/ReverseHighlight/ReverseHighlight.js +4 -7
  225. package/es/components/ReverseSnippet/ReverseSnippet.js +4 -7
  226. package/es/components/SearchBox/SearchBox.js +29 -66
  227. package/es/components/Selector/Selector.js +3 -5
  228. package/es/components/Slider/Pit.js +7 -9
  229. package/es/components/Slider/Rheostat.js +70 -133
  230. package/es/components/Slider/Slider.js +34 -61
  231. package/es/components/Snippet/Snippet.js +4 -7
  232. package/es/components/Stats/Stats.js +12 -17
  233. package/es/components/Template/Template.js +12 -35
  234. package/es/components/ToggleRefinement/ToggleRefinement.js +4 -7
  235. package/es/components/VoiceSearch/VoiceSearch.js +8 -13
  236. package/es/connectors/answers/connectAnswers.js +27 -36
  237. package/es/connectors/autocomplete/connectAutocomplete.js +12 -24
  238. package/es/connectors/breadcrumb/connectBreadcrumb.js +22 -48
  239. package/es/connectors/clear-refinements/connectClearRefinements.js +32 -45
  240. package/es/connectors/configure/connectConfigure.js +11 -17
  241. package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +16 -33
  242. package/es/connectors/current-refinements/connectCurrentRefinements.js +23 -57
  243. package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +20 -36
  244. package/es/connectors/geo-search/connectGeoSearch.js +21 -46
  245. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +44 -74
  246. package/es/connectors/hits/connectHits.js +14 -25
  247. package/es/connectors/hits-per-page/connectHitsPerPage.js +20 -38
  248. package/es/connectors/index.d.ts +2 -1
  249. package/es/connectors/index.js +6 -3
  250. package/es/connectors/infinite-hits/connectInfiniteHits.js +32 -62
  251. package/es/connectors/menu/connectMenu.js +34 -66
  252. package/es/connectors/numeric-menu/connectNumericMenu.js +31 -78
  253. package/es/connectors/pagination/Paginator.js +8 -21
  254. package/es/connectors/pagination/connectPagination.js +12 -22
  255. package/es/connectors/powered-by/connectPoweredBy.js +8 -12
  256. package/es/connectors/query-rules/connectQueryRules.js +37 -56
  257. package/es/connectors/range/connectRange.js +46 -101
  258. package/es/connectors/rating-menu/connectRatingMenu.js +28 -79
  259. package/es/connectors/refinement-list/connectRefinementList.js +43 -69
  260. package/es/connectors/relevant-sort/connectRelevantSort.js +8 -14
  261. package/es/connectors/search-box/connectSearchBox.js +11 -22
  262. package/es/connectors/sort-by/connectSortBy.js +15 -20
  263. package/es/connectors/stats/connectStats.js +8 -10
  264. package/es/connectors/toggle-refinement/connectToggleRefinement.js +33 -62
  265. package/es/connectors/toggle-refinement/types.js +1 -0
  266. package/es/connectors/voice-search/connectVoiceSearch.js +17 -32
  267. package/es/helpers/components/Highlight.js +5 -8
  268. package/es/helpers/components/ReverseHighlight.js +13 -16
  269. package/es/helpers/components/ReverseSnippet.js +13 -16
  270. package/es/helpers/components/Snippet.js +5 -8
  271. package/es/helpers/get-insights-anonymous-user-token.js +2 -10
  272. package/es/helpers/highlight.js +10 -10
  273. package/es/helpers/insights.js +3 -10
  274. package/es/helpers/reverseHighlight.js +10 -10
  275. package/es/helpers/reverseSnippet.js +10 -10
  276. package/es/helpers/snippet.js +10 -10
  277. package/es/index.js +0 -2
  278. package/es/lib/InstantSearch.js +83 -172
  279. package/es/lib/createHelpers.js +8 -9
  280. package/es/lib/infiniteHitsCache/sessionStorage.js +10 -16
  281. package/es/lib/insights/client.js +12 -33
  282. package/es/lib/insights/listener.js +4 -18
  283. package/es/lib/routers/history.js +69 -108
  284. package/es/lib/stateMappings/simple.js +11 -13
  285. package/es/lib/stateMappings/singleIndex.js +6 -7
  286. package/es/lib/suit.js +2 -3
  287. package/es/lib/templating/prepareTemplateProps.js +13 -20
  288. package/es/lib/templating/renderTemplate.js +12 -21
  289. package/es/lib/utils/checkIndexUiState.js +19 -41
  290. package/es/lib/utils/clearRefinements.js +2 -8
  291. package/es/lib/utils/concatHighlightedParts.js +1 -1
  292. package/es/lib/utils/createConcurrentSafePromise.js +0 -2
  293. package/es/lib/utils/createSendEventForFacet.js +7 -12
  294. package/es/lib/utils/createSendEventForHits.js +8 -30
  295. package/es/lib/utils/debounce.js +0 -2
  296. package/es/lib/utils/defer.js +0 -10
  297. package/es/lib/utils/documentation.js +2 -3
  298. package/es/lib/utils/escape-highlight.js +9 -18
  299. package/es/lib/utils/escape-html.js +9 -5
  300. package/es/lib/utils/escapeFacetValue.js +0 -2
  301. package/es/lib/utils/find.js +2 -4
  302. package/es/lib/utils/findIndex.js +0 -2
  303. package/es/lib/utils/geo-search.js +21 -35
  304. package/es/lib/utils/getAppIdAndApiKey.js +2 -2
  305. package/es/lib/utils/getContainerNode.js +1 -5
  306. package/es/lib/utils/getHighlightFromSiblings.js +0 -3
  307. package/es/lib/utils/getHighlightedParts.js +1 -2
  308. package/es/lib/utils/getRefinements.js +28 -41
  309. package/es/lib/utils/getWidgetAttribute.js +0 -5
  310. package/es/lib/utils/hits-absolute-position.js +6 -6
  311. package/es/lib/utils/hits-query-id.js +6 -7
  312. package/es/lib/utils/isEqual.js +2 -6
  313. package/es/lib/utils/isPlainObject.js +3 -10
  314. package/es/lib/utils/logger.js +4 -14
  315. package/es/lib/utils/mergeSearchParameters.js +21 -38
  316. package/es/lib/utils/range.js +9 -14
  317. package/es/lib/utils/resolveSearchParameters.js +0 -2
  318. package/es/lib/utils/reverseHighlightedParts.js +6 -7
  319. package/es/lib/utils/safelyRunOnBrowser.js +7 -8
  320. package/es/lib/utils/setIndexHelperState.js +0 -2
  321. package/es/lib/version.d.ts +1 -1
  322. package/es/lib/version.js +1 -1
  323. package/es/lib/voiceSearchHelper/index.js +12 -36
  324. package/es/lib/voiceSearchHelper/types.js +1 -0
  325. package/es/middlewares/createInsightsMiddleware.js +21 -42
  326. package/es/middlewares/createMetadataMiddleware.js +3 -9
  327. package/es/middlewares/createRouterMiddleware.js +12 -14
  328. package/es/types/algoliasearch.js +1 -0
  329. package/es/types/component.js +1 -0
  330. package/es/types/connector.js +1 -0
  331. package/es/types/index.js +9 -5
  332. package/es/types/insights.js +1 -0
  333. package/es/types/instantsearch.js +1 -0
  334. package/es/types/middleware.js +1 -0
  335. package/es/types/render-state.js +1 -0
  336. package/es/types/results.js +1 -0
  337. package/es/types/router.js +1 -0
  338. package/es/types/templates.js +1 -0
  339. package/es/types/ui-state.js +1 -0
  340. package/es/types/utils.js +1 -0
  341. package/es/types/widget-factory.js +1 -0
  342. package/es/types/widget.js +1 -0
  343. package/es/widgets/analytics/analytics.js +19 -43
  344. package/es/widgets/answers/answers.js +23 -30
  345. package/es/widgets/breadcrumb/breadcrumb.js +22 -29
  346. package/es/widgets/clear-refinements/clear-refinements.js +19 -26
  347. package/es/widgets/configure/configure.js +7 -7
  348. package/es/widgets/configure-related-items/configure-related-items.js +6 -8
  349. package/es/widgets/current-refinements/current-refinements.js +16 -23
  350. package/es/widgets/dynamic-widgets/dynamic-widgets.js +11 -21
  351. package/es/widgets/geo-search/GeoSearchRenderer.d.js +1 -0
  352. package/es/widgets/geo-search/GeoSearchRenderer.js +47 -65
  353. package/es/widgets/geo-search/createHTMLMarker.d.ts +1 -0
  354. package/es/widgets/geo-search/createHTMLMarker.js +34 -61
  355. package/es/widgets/geo-search/defaultTemplates.js +0 -2
  356. package/es/widgets/geo-search/geo-search.d.ts +1 -0
  357. package/es/widgets/geo-search/geo-search.js +34 -50
  358. package/es/widgets/hierarchical-menu/defaultTemplates.js +4 -4
  359. package/es/widgets/hierarchical-menu/hierarchical-menu.js +32 -38
  360. package/es/widgets/hits/hits.js +20 -27
  361. package/es/widgets/hits-per-page/hits-per-page.js +17 -24
  362. package/es/widgets/index/index.js +55 -93
  363. package/es/widgets/index.d.ts +2 -1
  364. package/es/widgets/index.js +4 -3
  365. package/es/widgets/infinite-hits/infinite-hits.js +27 -34
  366. package/es/widgets/menu/defaultTemplates.js +3 -3
  367. package/es/widgets/menu/menu.js +27 -34
  368. package/es/widgets/menu-select/defaultTemplates.js +1 -1
  369. package/es/widgets/menu-select/menu-select.js +22 -29
  370. package/es/widgets/numeric-menu/defaultTemplates.js +3 -3
  371. package/es/widgets/numeric-menu/numeric-menu.js +21 -28
  372. package/es/widgets/pagination/pagination.js +36 -46
  373. package/es/widgets/panel/panel.js +24 -42
  374. package/es/widgets/places/places.js +22 -33
  375. package/es/widgets/powered-by/powered-by.js +14 -20
  376. package/es/widgets/query-rule-context/query-rule-context.js +6 -10
  377. package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +17 -24
  378. package/es/widgets/range-input/range-input.js +28 -43
  379. package/es/widgets/range-slider/range-slider.js +33 -47
  380. package/es/widgets/rating-menu/defaultTemplates.js +8 -12
  381. package/es/widgets/rating-menu/rating-menu.js +21 -29
  382. package/es/widgets/refinement-list/defaultTemplates.js +5 -5
  383. package/es/widgets/refinement-list/refinement-list.js +43 -50
  384. package/es/widgets/relevant-sort/relevant-sort.js +14 -21
  385. package/es/widgets/search-box/defaultTemplates.js +0 -4
  386. package/es/widgets/search-box/search-box.js +35 -41
  387. package/es/widgets/sort-by/sort-by.js +15 -22
  388. package/es/widgets/stats/stats.js +30 -47
  389. package/es/widgets/toggle-refinement/toggle-refinement.js +20 -27
  390. package/es/widgets/voice-search/defaultTemplates.js +4 -13
  391. package/es/widgets/voice-search/voice-search.js +21 -28
  392. package/package.json +20 -119
  393. package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.input.js +0 -1
  394. package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.output.js +0 -1
  395. package/scripts/transforms/__tests__/addWidget-to-addWidgets.test.js +1 -0
  396. package/CHANGELOG.md +0 -3693
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = historyRouter;
7
-
8
7
  var _qs = _interopRequireDefault(require("qs"));
9
-
10
- var _index = require("../utils/index.js");
11
-
8
+ var _utils = require("../utils");
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
10
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
14
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
-
16
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
-
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
19
-
20
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
-
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
13
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
22
17
  var setWindowTitle = function setWindowTitle(title) {
23
18
  if (title) {
24
19
  // This function is only executed on browsers so we can disable this check.
@@ -26,7 +21,6 @@ var setWindowTitle = function setWindowTitle(title) {
26
21
  window.document.title = title;
27
22
  }
28
23
  };
29
-
30
24
  var BrowserHistory = /*#__PURE__*/function () {
31
25
  /**
32
26
  * Initializes a new storage provider that syncs the search state to the URL
@@ -34,54 +28,39 @@ var BrowserHistory = /*#__PURE__*/function () {
34
28
  */
35
29
  function BrowserHistory(_ref) {
36
30
  var _this = this;
37
-
38
31
  var windowTitle = _ref.windowTitle,
39
- _ref$writeDelay = _ref.writeDelay,
40
- writeDelay = _ref$writeDelay === void 0 ? 400 : _ref$writeDelay,
41
- createURL = _ref.createURL,
42
- parseURL = _ref.parseURL,
43
- getLocation = _ref.getLocation;
44
-
32
+ _ref$writeDelay = _ref.writeDelay,
33
+ writeDelay = _ref$writeDelay === void 0 ? 400 : _ref$writeDelay,
34
+ createURL = _ref.createURL,
35
+ parseURL = _ref.parseURL,
36
+ getLocation = _ref.getLocation;
45
37
  _classCallCheck(this, BrowserHistory);
46
-
47
38
  _defineProperty(this, "windowTitle", void 0);
48
-
49
39
  _defineProperty(this, "writeDelay", void 0);
50
-
51
40
  _defineProperty(this, "_createURL", void 0);
52
-
53
41
  _defineProperty(this, "parseURL", void 0);
54
-
55
42
  _defineProperty(this, "getLocation", void 0);
56
-
57
43
  _defineProperty(this, "writeTimer", void 0);
58
-
59
44
  _defineProperty(this, "inPopState", false);
60
-
61
45
  _defineProperty(this, "isDisposed", false);
62
-
63
46
  _defineProperty(this, "latestAcknowledgedHistory", 0);
64
-
65
47
  this.windowTitle = windowTitle;
66
48
  this.writeTimer = undefined;
67
49
  this.writeDelay = writeDelay;
68
50
  this._createURL = createURL;
69
51
  this.parseURL = parseURL;
70
52
  this.getLocation = getLocation;
71
- (0, _index.safelyRunOnBrowser)(function (_ref2) {
53
+ (0, _utils.safelyRunOnBrowser)(function (_ref2) {
72
54
  var window = _ref2.window;
73
-
74
55
  var title = _this.windowTitle && _this.windowTitle(_this.read());
75
-
76
56
  setWindowTitle(title);
77
57
  _this.latestAcknowledgedHistory = window.history.length;
78
58
  });
79
59
  }
60
+
80
61
  /**
81
62
  * Reads the URL and returns a syncable UI search state.
82
63
  */
83
-
84
-
85
64
  _createClass(BrowserHistory, [{
86
65
  key: "read",
87
66
  value: function read() {
@@ -90,72 +69,58 @@ var BrowserHistory = /*#__PURE__*/function () {
90
69
  location: this.getLocation()
91
70
  });
92
71
  }
72
+
93
73
  /**
94
74
  * Pushes a search state into the URL.
95
75
  */
96
-
97
76
  }, {
98
77
  key: "write",
99
78
  value: function write(routeState) {
100
79
  var _this2 = this;
101
-
102
- (0, _index.safelyRunOnBrowser)(function (_ref3) {
80
+ (0, _utils.safelyRunOnBrowser)(function (_ref3) {
103
81
  var window = _ref3.window;
104
-
105
82
  var url = _this2.createURL(routeState);
106
-
107
83
  var title = _this2.windowTitle && _this2.windowTitle(routeState);
108
-
109
84
  if (_this2.writeTimer) {
110
85
  clearTimeout(_this2.writeTimer);
111
86
  }
112
-
113
87
  _this2.writeTimer = setTimeout(function () {
114
88
  setWindowTitle(title);
115
-
116
89
  if (_this2.shouldWrite(url)) {
117
90
  window.history.pushState(routeState, title || '', url);
118
91
  _this2.latestAcknowledgedHistory = window.history.length;
119
92
  }
120
-
121
93
  _this2.inPopState = false;
122
94
  _this2.writeTimer = undefined;
123
95
  }, _this2.writeDelay);
124
96
  });
125
97
  }
98
+
126
99
  /**
127
100
  * Sets a callback on the `onpopstate` event of the history API of the current page.
128
101
  * It enables the URL sync to keep track of the changes.
129
102
  */
130
-
131
103
  }, {
132
104
  key: "onUpdate",
133
105
  value: function onUpdate(callback) {
134
106
  var _this3 = this;
135
-
136
- this._onPopState = function (event) {
107
+ this._onPopState = function () {
137
108
  if (_this3.writeTimer) {
138
109
  clearTimeout(_this3.writeTimer);
139
110
  _this3.writeTimer = undefined;
140
111
  }
141
-
142
112
  _this3.inPopState = true;
143
- var routeState = event.state; // At initial load, the state is read from the URL without update.
144
- // Therefore the state object is not available.
145
- // In this case, we fallback and read the URL.
146
113
 
147
- if (!routeState) {
148
- callback(_this3.read());
149
- } else {
150
- callback(routeState);
151
- }
114
+ // We always read the state from the URL because the state of the history
115
+ // can be incorect in some cases (e.g. using React Router).
116
+ callback(_this3.read());
152
117
  };
153
-
154
- (0, _index.safelyRunOnBrowser)(function (_ref4) {
118
+ (0, _utils.safelyRunOnBrowser)(function (_ref4) {
155
119
  var window = _ref4.window;
156
120
  window.addEventListener('popstate', _this3._onPopState);
157
121
  });
158
122
  }
123
+
159
124
  /**
160
125
  * Creates a complete URL from a given syncable UI state.
161
126
  *
@@ -163,7 +128,6 @@ var BrowserHistory = /*#__PURE__*/function () {
163
128
  * This allows to handle cases like using a <base href>.
164
129
  * See: https://github.com/algolia/instantsearch.js/issues/790
165
130
  */
166
-
167
131
  }, {
168
132
  key: "createURL",
169
133
  value: function createURL(routeState) {
@@ -173,36 +137,31 @@ var BrowserHistory = /*#__PURE__*/function () {
173
137
  location: this.getLocation()
174
138
  });
175
139
  }
140
+
176
141
  /**
177
142
  * Removes the event listener and cleans up the URL.
178
143
  */
179
-
180
144
  }, {
181
145
  key: "dispose",
182
146
  value: function dispose() {
183
147
  var _this4 = this;
184
-
185
148
  this.isDisposed = true;
186
- (0, _index.safelyRunOnBrowser)(function (_ref5) {
149
+ (0, _utils.safelyRunOnBrowser)(function (_ref5) {
187
150
  var window = _ref5.window;
188
-
189
151
  if (_this4._onPopState) {
190
152
  window.removeEventListener('popstate', _this4._onPopState);
191
153
  }
192
154
  });
193
-
194
155
  if (this.writeTimer) {
195
156
  clearTimeout(this.writeTimer);
196
157
  }
197
-
198
158
  this.write({});
199
159
  }
200
160
  }, {
201
161
  key: "shouldWrite",
202
162
  value: function shouldWrite(url) {
203
163
  var _this5 = this;
204
-
205
- return (0, _index.safelyRunOnBrowser)(function (_ref6) {
164
+ return (0, _utils.safelyRunOnBrowser)(function (_ref6) {
206
165
  var window = _ref6.window;
207
166
  // We do want to `pushState` if:
208
167
  // - the router is not disposed, IS.js needs to update the URL
@@ -210,75 +169,74 @@ var BrowserHistory = /*#__PURE__*/function () {
210
169
  // - the last write was from InstantSearch.js
211
170
  // (unlike a SPA, where it would have last written)
212
171
  var lastPushWasByISAfterDispose = !(_this5.isDisposed && _this5.latestAcknowledgedHistory !== window.history.length);
213
- return (// When the last state change was through popstate, the IS.js state changes,
172
+ return (
173
+ // When the last state change was through popstate, the IS.js state changes,
214
174
  // but that should not write the URL.
215
- !_this5.inPopState && // When the previous pushState after dispose was by IS.js, we want to write the URL.
216
- lastPushWasByISAfterDispose && // When the URL is the same as the current one, we do not want to write it.
175
+ !_this5.inPopState &&
176
+ // When the previous pushState after dispose was by IS.js, we want to write the URL.
177
+ lastPushWasByISAfterDispose &&
178
+ // When the URL is the same as the current one, we do not want to write it.
217
179
  url !== window.location.href
218
180
  );
219
181
  });
220
182
  }
221
183
  }]);
222
-
223
184
  return BrowserHistory;
224
185
  }();
225
-
226
186
  function historyRouter() {
227
187
  var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
228
- _ref7$createURL = _ref7.createURL,
229
- createURL = _ref7$createURL === void 0 ? function (_ref8) {
230
- var qsModule = _ref8.qsModule,
188
+ _ref7$createURL = _ref7.createURL,
189
+ createURL = _ref7$createURL === void 0 ? function (_ref8) {
190
+ var qsModule = _ref8.qsModule,
231
191
  routeState = _ref8.routeState,
232
192
  location = _ref8.location;
233
- var protocol = location.protocol,
193
+ var protocol = location.protocol,
234
194
  hostname = location.hostname,
235
195
  _location$port = location.port,
236
196
  port = _location$port === void 0 ? '' : _location$port,
237
197
  pathname = location.pathname,
238
198
  hash = location.hash;
239
- var queryString = qsModule.stringify(routeState);
240
- var portWithPrefix = port === '' ? '' : ":".concat(port); // IE <= 11 has no proper `location.origin` so we cannot rely on it.
241
-
242
- // IE <= 11 has no proper `location.origin` so we cannot rely on it.
243
- if (!queryString) {
244
- return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname).concat(hash);
245
- }
199
+ var queryString = qsModule.stringify(routeState);
200
+ var portWithPrefix = port === '' ? '' : ":".concat(port);
246
201
 
247
- return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname, "?").concat(queryString).concat(hash);
248
- } : _ref7$createURL,
249
- _ref7$parseURL = _ref7.parseURL,
250
- parseURL = _ref7$parseURL === void 0 ? function (_ref9) {
251
- var qsModule = _ref9.qsModule,
252
- location = _ref9.location;
253
- // `qs` by default converts arrays with more than 20 items to an object.
254
- // We want to avoid this because the data structure manipulated can therefore vary.
255
- // Setting the limit to `100` seems a good number because the engine's default is 100
256
- // (it can go up to 1000 but it is very unlikely to select more than 100 items in the UI).
257
- //
258
- // Using an `arrayLimit` of `n` allows `n + 1` items.
259
- //
260
- // See:
261
- // - https://github.com/ljharb/qs#parsing-arrays
262
- // - https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/
263
- return qsModule.parse(location.search.slice(1), {
264
- arrayLimit: 99
265
- });
266
- } : _ref7$parseURL,
267
- _ref7$writeDelay = _ref7.writeDelay,
268
- writeDelay = _ref7$writeDelay === void 0 ? 400 : _ref7$writeDelay,
269
- windowTitle = _ref7.windowTitle,
270
- _ref7$getLocation = _ref7.getLocation,
271
- getLocation = _ref7$getLocation === void 0 ? function () {
272
- return (0, _index.safelyRunOnBrowser)(function (_ref10) {
273
- var window = _ref10.window;
274
- return window.location;
275
- }, {
276
- fallback: function fallback() {
277
- throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');
202
+ // IE <= 11 has no proper `location.origin` so we cannot rely on it.
203
+ if (!queryString) {
204
+ return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname).concat(hash);
278
205
  }
279
- });
280
- } : _ref7$getLocation;
281
-
206
+ return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname, "?").concat(queryString).concat(hash);
207
+ } : _ref7$createURL,
208
+ _ref7$parseURL = _ref7.parseURL,
209
+ parseURL = _ref7$parseURL === void 0 ? function (_ref9) {
210
+ var qsModule = _ref9.qsModule,
211
+ location = _ref9.location;
212
+ // `qs` by default converts arrays with more than 20 items to an object.
213
+ // We want to avoid this because the data structure manipulated can therefore vary.
214
+ // Setting the limit to `100` seems a good number because the engine's default is 100
215
+ // (it can go up to 1000 but it is very unlikely to select more than 100 items in the UI).
216
+ //
217
+ // Using an `arrayLimit` of `n` allows `n + 1` items.
218
+ //
219
+ // See:
220
+ // - https://github.com/ljharb/qs#parsing-arrays
221
+ // - https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/
222
+ return qsModule.parse(location.search.slice(1), {
223
+ arrayLimit: 99
224
+ });
225
+ } : _ref7$parseURL,
226
+ _ref7$writeDelay = _ref7.writeDelay,
227
+ writeDelay = _ref7$writeDelay === void 0 ? 400 : _ref7$writeDelay,
228
+ windowTitle = _ref7.windowTitle,
229
+ _ref7$getLocation = _ref7.getLocation,
230
+ getLocation = _ref7$getLocation === void 0 ? function () {
231
+ return (0, _utils.safelyRunOnBrowser)(function (_ref10) {
232
+ var window = _ref10.window;
233
+ return window.location;
234
+ }, {
235
+ fallback: function fallback() {
236
+ throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');
237
+ }
238
+ });
239
+ } : _ref7$getLocation;
282
240
  return new BrowserHistory({
283
241
  createURL: createURL,
284
242
  parseURL: parseURL,
@@ -9,7 +9,5 @@ Object.defineProperty(exports, "history", {
9
9
  return _history.default;
10
10
  }
11
11
  });
12
-
13
- var _history = _interopRequireDefault(require("./history.js"));
14
-
12
+ var _history = _interopRequireDefault(require("./history"));
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "singleIndex", {
15
15
  return _singleIndex.default;
16
16
  }
17
17
  });
18
-
19
- var _simple = _interopRequireDefault(require("./simple.js"));
20
-
21
- var _singleIndex = _interopRequireDefault(require("./singleIndex.js"));
22
-
18
+ var _simple = _interopRequireDefault(require("./simple"));
19
+ var _singleIndex = _interopRequireDefault(require("./singleIndex"));
23
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,30 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = simpleStateMapping;
7
-
8
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
9
-
10
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
-
12
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
-
8
+ var _excluded = ["configure"];
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
14
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
-
16
15
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
-
18
16
  function getIndexStateWithoutConfigure(uiState) {
19
17
  var configure = uiState.configure,
20
- trackedUiState = _objectWithoutProperties(uiState, ["configure"]);
21
-
18
+ trackedUiState = _objectWithoutProperties(uiState, _excluded);
22
19
  return trackedUiState;
23
- } // technically a URL could contain any key, since users provide it,
20
+ }
21
+
22
+ // technically a URL could contain any key, since users provide it,
24
23
  // which is why the input to this function is UiState, not something
25
24
  // which excludes "configure" as this function does.
26
-
27
-
28
25
  function simpleStateMapping() {
29
26
  return {
30
27
  stateToRoute: function stateToRoute(uiState) {
@@ -1,23 +1,21 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = singleIndexStateMapping;
7
-
8
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
-
8
+ var _excluded = ["configure"];
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
12
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
-
12
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
-
14
14
  function getIndexStateWithoutConfigure(uiState) {
15
15
  var configure = uiState.configure,
16
- trackedUiState = _objectWithoutProperties(uiState, ["configure"]);
17
-
16
+ trackedUiState = _objectWithoutProperties(uiState, _excluded);
18
17
  return trackedUiState;
19
18
  }
20
-
21
19
  function singleIndexStateMapping(indexName) {
22
20
  return {
23
21
  stateToRoute: function stateToRoute(uiState) {
package/cjs/lib/suit.js CHANGED
@@ -5,17 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.component = void 0;
7
7
  var NAMESPACE = 'ais';
8
-
9
8
  var component = function component(componentName) {
10
9
  return function () {
11
10
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
12
- descendantName = _ref.descendantName,
13
- modifierName = _ref.modifierName;
14
-
11
+ descendantName = _ref.descendantName,
12
+ modifierName = _ref.modifierName;
15
13
  var descendent = descendantName ? "-".concat(descendantName) : '';
16
14
  var modifier = modifierName ? "--".concat(modifierName) : '';
17
15
  return "".concat(NAMESPACE, "-").concat(componentName).concat(descendent).concat(modifier);
18
16
  };
19
17
  };
20
-
21
18
  exports.component = component;
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _prepareTemplateProps = require("./prepareTemplateProps.js");
8
-
6
+ var _prepareTemplateProps = require("./prepareTemplateProps");
9
7
  Object.keys(_prepareTemplateProps).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _prepareTemplateProps[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_prepareTemplateProps).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
- var _renderTemplate = require("./renderTemplate.js");
21
-
17
+ var _renderTemplate = require("./renderTemplate");
22
18
  Object.keys(_renderTemplate).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _renderTemplate[key]) return;
@@ -1,31 +1,24 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.prepareTemplateProps = prepareTemplateProps;
7
-
8
- var _uniq = require("../utils/uniq.js");
9
-
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
11
-
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
13
-
14
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
-
8
+ var _uniq = require("../utils/uniq");
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
14
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
17
-
18
15
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
-
20
16
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
-
22
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
23
-
17
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
24
18
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
25
-
26
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
-
28
- function prepareTemplates( // can not use = {} here, since the template could have different constraints
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
20
+ function prepareTemplates(
21
+ // can not use = {} here, since the template could have different constraints
29
22
  defaultTemplates) {
30
23
  var templates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
24
  var allKeys = (0, _uniq.uniq)([].concat(_toConsumableArray(Object.keys(defaultTemplates || {})), _toConsumableArray(Object.keys(templates))));
@@ -44,15 +37,14 @@ defaultTemplates) {
44
37
  useCustomCompileOptions: {}
45
38
  });
46
39
  }
40
+
47
41
  /**
48
42
  * Prepares an object to be passed to the Template widget
49
43
  */
50
-
51
-
52
44
  function prepareTemplateProps(_ref) {
53
45
  var defaultTemplates = _ref.defaultTemplates,
54
- templates = _ref.templates,
55
- templatesConfig = _ref.templatesConfig;
46
+ templates = _ref.templates,
47
+ templatesConfig = _ref.templatesConfig;
56
48
  var preparedTemplates = prepareTemplates(defaultTemplates, templates);
57
49
  return _objectSpread({
58
50
  templatesConfig: templatesConfig