instantsearch.js 4.49.1 → 4.49.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.
- package/README.md +3 -3
- package/cjs/components/Answers/Answers.js +6 -16
- package/cjs/components/Breadcrumb/Breadcrumb.js +5 -12
- package/cjs/components/ClearRefinements/ClearRefinements.js +4 -11
- package/cjs/components/CurrentRefinements/CurrentRefinements.js +5 -12
- package/cjs/components/GeoSearchControls/GeoSearchButton.js +4 -6
- package/cjs/components/GeoSearchControls/GeoSearchControls.js +11 -20
- package/cjs/components/GeoSearchControls/GeoSearchToggle.js +4 -6
- package/cjs/components/Highlight/Highlight.js +3 -11
- package/cjs/components/Hits/Hits.js +8 -20
- package/cjs/components/InfiniteHits/InfiniteHits.js +13 -25
- package/cjs/components/InternalHighlight/InternalHighlight.js +0 -3
- package/cjs/components/MenuSelect/MenuSelect.js +9 -19
- package/cjs/components/Pagination/Pagination.js +10 -17
- package/cjs/components/Panel/Panel.js +7 -26
- package/cjs/components/PoweredBy/PoweredBy.js +4 -5
- package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +2 -6
- package/cjs/components/RangeInput/RangeInput.js +16 -48
- package/cjs/components/RefinementList/RefinementList.js +19 -73
- package/cjs/components/RefinementList/RefinementListItem.js +8 -14
- package/cjs/components/RelevantSort/RelevantSort.js +4 -8
- package/cjs/components/ReverseHighlight/ReverseHighlight.js +3 -11
- package/cjs/components/ReverseSnippet/ReverseSnippet.js +3 -11
- package/cjs/components/SearchBox/SearchBox.js +25 -69
- package/cjs/components/Selector/Selector.js +3 -6
- package/cjs/components/Slider/Pit.js +3 -10
- package/cjs/components/Slider/Rheostat.js +63 -131
- package/cjs/components/Slider/Slider.js +28 -65
- package/cjs/components/Snippet/Snippet.js +3 -11
- package/cjs/components/Stats/Stats.js +7 -20
- package/cjs/components/Template/Template.js +8 -37
- package/cjs/components/ToggleRefinement/ToggleRefinement.js +4 -10
- package/cjs/components/VoiceSearch/VoiceSearch.js +8 -15
- package/cjs/connectors/answers/connectAnswers.js +21 -36
- package/cjs/connectors/autocomplete/connectAutocomplete.js +8 -25
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +17 -48
- package/cjs/connectors/clear-refinements/connectClearRefinements.js +27 -45
- package/cjs/connectors/configure/connectConfigure.js +6 -20
- package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +11 -36
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +18 -57
- package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +17 -37
- package/cjs/connectors/geo-search/connectGeoSearch.js +17 -47
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +38 -74
- package/cjs/connectors/hits/connectHits.js +10 -26
- package/cjs/connectors/hits/connectHitsWithInsights.js +0 -4
- package/cjs/connectors/hits-per-page/connectHitsPerPage.js +15 -38
- package/cjs/connectors/index.js +62 -96
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +26 -62
- package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +0 -4
- package/cjs/connectors/menu/connectMenu.js +28 -66
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +24 -78
- package/cjs/connectors/pagination/Paginator.js +3 -20
- package/cjs/connectors/pagination/connectPagination.js +8 -25
- package/cjs/connectors/powered-by/connectPoweredBy.js +4 -13
- package/cjs/connectors/query-rules/connectQueryRules.js +32 -56
- package/cjs/connectors/range/connectRange.js +41 -101
- package/cjs/connectors/rating-menu/connectRatingMenu.js +23 -79
- package/cjs/connectors/refinement-list/connectRefinementList.js +37 -70
- package/cjs/connectors/relevant-sort/connectRelevantSort.js +4 -14
- package/cjs/connectors/search-box/connectSearchBox.js +7 -23
- package/cjs/connectors/sort-by/connectSortBy.js +11 -21
- package/cjs/connectors/stats/connectStats.js +4 -11
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +29 -63
- package/cjs/connectors/voice-search/connectVoiceSearch.js +13 -35
- package/cjs/helpers/components/Highlight.js +4 -12
- package/cjs/helpers/components/ReverseHighlight.js +7 -19
- package/cjs/helpers/components/ReverseSnippet.js +7 -19
- package/cjs/helpers/components/Snippet.js +4 -12
- package/cjs/helpers/components/index.js +0 -8
- package/cjs/helpers/get-insights-anonymous-user-token.js +4 -15
- package/cjs/helpers/highlight.js +10 -16
- package/cjs/helpers/index.js +17 -31
- package/cjs/helpers/insights.js +5 -17
- package/cjs/helpers/reverseHighlight.js +10 -16
- package/cjs/helpers/reverseSnippet.js +10 -16
- package/cjs/helpers/snippet.js +10 -16
- package/cjs/index.js +3 -18
- package/cjs/lib/InstantSearch.js +79 -180
- package/cjs/lib/createHelpers.js +4 -11
- package/cjs/lib/formatNumber.js +0 -1
- package/cjs/lib/infiniteHitsCache/index.js +0 -2
- package/cjs/lib/infiniteHitsCache/sessionStorage.js +9 -18
- package/cjs/lib/insights/client.js +8 -34
- package/cjs/lib/insights/index.js +7 -13
- package/cjs/lib/insights/listener.js +4 -20
- package/cjs/lib/routers/history.js +63 -102
- package/cjs/lib/routers/index.js +0 -2
- package/cjs/lib/stateMappings/index.js +0 -3
- package/cjs/lib/stateMappings/simple.js +6 -13
- package/cjs/lib/stateMappings/singleIndex.js +1 -7
- package/cjs/lib/suit.js +2 -5
- package/cjs/lib/templating/index.js +0 -4
- package/cjs/lib/templating/prepareTemplateProps.js +8 -19
- package/cjs/lib/templating/renderTemplate.js +9 -24
- package/cjs/lib/utils/capitalize.js +0 -1
- package/cjs/lib/utils/checkIndexUiState.js +15 -43
- package/cjs/lib/utils/checkRendering.js +0 -2
- package/cjs/lib/utils/clearRefinements.js +2 -9
- package/cjs/lib/utils/concatHighlightedParts.js +1 -3
- package/cjs/lib/utils/createConcurrentSafePromise.js +0 -3
- package/cjs/lib/utils/createSendEventForFacet.js +7 -14
- package/cjs/lib/utils/createSendEventForHits.js +9 -33
- package/cjs/lib/utils/debounce.js +0 -3
- package/cjs/lib/utils/defer.js +0 -11
- package/cjs/lib/utils/detect-insights-client.js +0 -2
- package/cjs/lib/utils/documentation.js +2 -5
- package/cjs/lib/utils/escape-highlight.js +5 -22
- package/cjs/lib/utils/escape-html.js +9 -7
- package/cjs/lib/utils/escapeFacetValue.js +1 -5
- package/cjs/lib/utils/find.js +2 -5
- package/cjs/lib/utils/findIndex.js +0 -3
- package/cjs/lib/utils/geo-search.js +14 -34
- package/cjs/lib/utils/getAppIdAndApiKey.js +2 -3
- package/cjs/lib/utils/getContainerNode.js +0 -6
- package/cjs/lib/utils/getHighlightFromSiblings.js +0 -6
- package/cjs/lib/utils/getHighlightedParts.js +1 -4
- package/cjs/lib/utils/getObjectType.js +0 -1
- package/cjs/lib/utils/getPropertyByPath.js +0 -1
- package/cjs/lib/utils/getRefinements.js +13 -26
- package/cjs/lib/utils/getWidgetAttribute.js +0 -6
- package/cjs/lib/utils/hits-absolute-position.js +2 -6
- package/cjs/lib/utils/hits-query-id.js +2 -7
- package/cjs/lib/utils/index.js +0 -92
- package/cjs/lib/utils/isDomElement.js +0 -1
- package/cjs/lib/utils/isEqual.js +0 -8
- package/cjs/lib/utils/isFacetRefined.js +0 -1
- package/cjs/lib/utils/isFiniteNumber.js +0 -1
- package/cjs/lib/utils/isIndexWidget.js +0 -1
- package/cjs/lib/utils/isPlainObject.js +3 -11
- package/cjs/lib/utils/isSpecialClick.js +0 -1
- package/cjs/lib/utils/logger.js +3 -13
- package/cjs/lib/utils/mergeSearchParameters.js +16 -40
- package/cjs/lib/utils/noop.js +0 -1
- package/cjs/lib/utils/range.js +8 -14
- package/cjs/lib/utils/render-args.js +0 -2
- package/cjs/lib/utils/resolveSearchParameters.js +0 -3
- package/cjs/lib/utils/reverseHighlightedParts.js +2 -8
- package/cjs/lib/utils/safelyRunOnBrowser.js +7 -9
- package/cjs/lib/utils/serializer.js +1 -3
- package/cjs/lib/utils/setIndexHelperState.js +0 -5
- package/cjs/lib/utils/toArray.js +0 -1
- package/cjs/lib/utils/typedObject.js +0 -1
- package/cjs/lib/utils/uniq.js +0 -1
- package/cjs/lib/version.js +1 -1
- package/cjs/lib/voiceSearchHelper/index.js +8 -36
- package/cjs/middlewares/createInsightsMiddleware.js +15 -44
- package/cjs/middlewares/createMetadataMiddleware.js +4 -12
- package/cjs/middlewares/createRouterMiddleware.js +8 -19
- package/cjs/middlewares/index.js +0 -6
- package/cjs/types/algoliasearch.js +0 -2
- package/cjs/types/index.js +0 -28
- package/cjs/widgets/analytics/analytics.js +12 -47
- package/cjs/widgets/answers/answers.js +19 -39
- package/cjs/widgets/breadcrumb/breadcrumb.js +18 -38
- package/cjs/widgets/clear-refinements/clear-refinements.js +15 -35
- package/cjs/widgets/configure/configure.js +2 -10
- package/cjs/widgets/configure-related-items/configure-related-items.js +2 -10
- package/cjs/widgets/current-refinements/current-refinements.js +12 -30
- package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +6 -25
- package/cjs/widgets/geo-search/GeoSearchRenderer.js +41 -68
- package/cjs/widgets/geo-search/createHTMLMarker.js +30 -60
- package/cjs/widgets/geo-search/defaultTemplates.js +0 -3
- package/cjs/widgets/geo-search/geo-search.js +27 -59
- package/cjs/widgets/hierarchical-menu/defaultTemplates.js +4 -7
- package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +28 -47
- package/cjs/widgets/hits/hits.js +16 -37
- package/cjs/widgets/hits-per-page/hits-per-page.js +13 -31
- package/cjs/widgets/index/index.js +49 -95
- package/cjs/widgets/index.js +12 -50
- package/cjs/widgets/infinite-hits/infinite-hits.js +23 -44
- package/cjs/widgets/menu/defaultTemplates.js +3 -6
- package/cjs/widgets/menu/menu.js +23 -43
- package/cjs/widgets/menu-select/defaultTemplates.js +1 -3
- package/cjs/widgets/menu-select/menu-select.js +18 -38
- package/cjs/widgets/numeric-menu/defaultTemplates.js +3 -4
- package/cjs/widgets/numeric-menu/numeric-menu.js +17 -37
- package/cjs/widgets/pagination/pagination.js +32 -53
- package/cjs/widgets/panel/panel.js +20 -48
- package/cjs/widgets/places/places.js +16 -33
- package/cjs/widgets/powered-by/powered-by.js +10 -27
- package/cjs/widgets/query-rule-context/query-rule-context.js +2 -13
- package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +14 -32
- package/cjs/widgets/range-input/range-input.js +23 -50
- package/cjs/widgets/range-slider/range-slider.js +28 -53
- package/cjs/widgets/rating-menu/defaultTemplates.js +8 -14
- package/cjs/widgets/rating-menu/rating-menu.js +17 -38
- package/cjs/widgets/refinement-list/defaultTemplates.js +5 -8
- package/cjs/widgets/refinement-list/refinement-list.js +39 -60
- package/cjs/widgets/relevant-sort/relevant-sort.js +10 -29
- package/cjs/widgets/search-box/defaultTemplates.js +0 -5
- package/cjs/widgets/search-box/search-box.js +31 -49
- package/cjs/widgets/sort-by/sort-by.js +11 -29
- package/cjs/widgets/stats/defaultTemplates.js +0 -1
- package/cjs/widgets/stats/stats.js +27 -57
- package/cjs/widgets/toggle-refinement/toggle-refinement.js +16 -36
- package/cjs/widgets/voice-search/defaultTemplates.js +4 -14
- package/cjs/widgets/voice-search/voice-search.js +17 -36
- package/dist/instantsearch.development.d.ts +8 -6
- package/dist/instantsearch.development.js +1722 -3088
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +8 -6
- package/dist/instantsearch.production.min.d.ts +8 -6
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Answers/Answers.js +6 -11
- package/es/components/Breadcrumb/Breadcrumb.js +5 -7
- package/es/components/ClearRefinements/ClearRefinements.js +4 -6
- package/es/components/CurrentRefinements/CurrentRefinements.js +7 -10
- package/es/components/GeoSearchControls/GeoSearchButton.js +6 -6
- package/es/components/GeoSearchControls/GeoSearchControls.js +11 -13
- package/es/components/GeoSearchControls/GeoSearchToggle.js +6 -6
- package/es/components/Highlight/Highlight.js +3 -7
- package/es/components/Hits/Hits.js +8 -15
- package/es/components/InfiniteHits/InfiniteHits.js +13 -20
- package/es/components/MenuSelect/MenuSelect.js +9 -13
- package/es/components/Pagination/Pagination.js +12 -15
- package/es/components/Panel/Panel.js +7 -20
- package/es/components/PoweredBy/PoweredBy.js +6 -5
- package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +4 -4
- package/es/components/RangeInput/RangeInput.js +16 -43
- package/es/components/RefinementList/RefinementList.js +19 -64
- package/es/components/RefinementList/RefinementListItem.js +8 -10
- package/es/components/RelevantSort/RelevantSort.js +6 -6
- package/es/components/ReverseHighlight/ReverseHighlight.js +3 -7
- package/es/components/ReverseSnippet/ReverseSnippet.js +3 -7
- package/es/components/SearchBox/SearchBox.js +25 -63
- package/es/components/Selector/Selector.js +5 -5
- package/es/components/Slider/Pit.js +3 -7
- package/es/components/Slider/Rheostat.js +64 -129
- package/es/components/Slider/Slider.js +28 -58
- package/es/components/Snippet/Snippet.js +3 -7
- package/es/components/Stats/Stats.js +7 -15
- package/es/components/Template/Template.js +8 -32
- package/es/components/ToggleRefinement/ToggleRefinement.js +4 -6
- package/es/components/VoiceSearch/VoiceSearch.js +10 -13
- package/es/connectors/answers/connectAnswers.js +21 -35
- package/es/connectors/autocomplete/connectAutocomplete.js +8 -23
- package/es/connectors/breadcrumb/connectBreadcrumb.js +17 -46
- package/es/connectors/clear-refinements/connectClearRefinements.js +27 -43
- package/es/connectors/configure/connectConfigure.js +7 -16
- package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +11 -31
- package/es/connectors/current-refinements/connectCurrentRefinements.js +18 -55
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +17 -35
- package/es/connectors/geo-search/connectGeoSearch.js +17 -45
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +38 -72
- package/es/connectors/hits/connectHits.js +10 -24
- package/es/connectors/hits-per-page/connectHitsPerPage.js +15 -36
- package/es/connectors/index.d.ts +2 -1
- package/es/connectors/index.js +6 -3
- package/es/connectors/infinite-hits/connectInfiniteHits.js +26 -60
- package/es/connectors/menu/connectMenu.js +28 -64
- package/es/connectors/numeric-menu/connectNumericMenu.js +24 -76
- package/es/connectors/pagination/Paginator.js +3 -19
- package/es/connectors/pagination/connectPagination.js +8 -21
- package/es/connectors/powered-by/connectPoweredBy.js +4 -11
- package/es/connectors/query-rules/connectQueryRules.js +32 -54
- package/es/connectors/range/connectRange.js +41 -99
- package/es/connectors/rating-menu/connectRatingMenu.js +23 -77
- package/es/connectors/refinement-list/connectRefinementList.js +37 -68
- package/es/connectors/relevant-sort/connectRelevantSort.js +4 -13
- package/es/connectors/search-box/connectSearchBox.js +7 -21
- package/es/connectors/sort-by/connectSortBy.js +11 -19
- package/es/connectors/stats/connectStats.js +4 -9
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +29 -61
- package/es/connectors/voice-search/connectVoiceSearch.js +13 -31
- package/es/helpers/components/Highlight.js +4 -8
- package/es/helpers/components/ReverseHighlight.js +7 -15
- package/es/helpers/components/ReverseSnippet.js +7 -15
- package/es/helpers/components/Snippet.js +4 -8
- package/es/helpers/get-insights-anonymous-user-token.js +2 -10
- package/es/helpers/highlight.js +9 -11
- package/es/helpers/insights.js +3 -10
- package/es/helpers/reverseHighlight.js +9 -11
- package/es/helpers/reverseSnippet.js +9 -11
- package/es/helpers/snippet.js +9 -11
- package/es/index.js +0 -2
- package/es/lib/InstantSearch.js +79 -170
- package/es/lib/createHelpers.js +4 -8
- package/es/lib/infiniteHitsCache/sessionStorage.js +9 -16
- package/es/lib/insights/client.js +8 -32
- package/es/lib/insights/listener.js +6 -18
- package/es/lib/routers/history.js +63 -99
- package/es/lib/stateMappings/simple.js +6 -12
- package/es/lib/stateMappings/singleIndex.js +1 -6
- package/es/lib/suit.js +2 -3
- package/es/lib/templating/prepareTemplateProps.js +8 -18
- package/es/lib/templating/renderTemplate.js +9 -20
- package/es/lib/utils/checkIndexUiState.js +18 -40
- package/es/lib/utils/clearRefinements.js +2 -8
- package/es/lib/utils/concatHighlightedParts.js +1 -1
- package/es/lib/utils/createConcurrentSafePromise.js +0 -2
- package/es/lib/utils/createSendEventForFacet.js +7 -12
- package/es/lib/utils/createSendEventForHits.js +8 -30
- package/es/lib/utils/debounce.js +0 -2
- package/es/lib/utils/defer.js +0 -10
- package/es/lib/utils/documentation.js +2 -3
- package/es/lib/utils/escape-highlight.js +3 -16
- package/es/lib/utils/escape-html.js +9 -5
- package/es/lib/utils/escapeFacetValue.js +0 -2
- package/es/lib/utils/find.js +2 -4
- package/es/lib/utils/findIndex.js +0 -2
- package/es/lib/utils/geo-search.js +14 -32
- package/es/lib/utils/getAppIdAndApiKey.js +2 -2
- package/es/lib/utils/getContainerNode.js +1 -5
- package/es/lib/utils/getHighlightFromSiblings.js +0 -3
- package/es/lib/utils/getHighlightedParts.js +1 -2
- package/es/lib/utils/getRefinements.js +13 -24
- package/es/lib/utils/getWidgetAttribute.js +0 -5
- package/es/lib/utils/hits-absolute-position.js +2 -5
- package/es/lib/utils/hits-query-id.js +2 -6
- package/es/lib/utils/isEqual.js +0 -7
- package/es/lib/utils/isPlainObject.js +3 -10
- package/es/lib/utils/logger.js +2 -12
- package/es/lib/utils/mergeSearchParameters.js +16 -37
- package/es/lib/utils/range.js +8 -13
- package/es/lib/utils/resolveSearchParameters.js +0 -2
- package/es/lib/utils/reverseHighlightedParts.js +2 -6
- package/es/lib/utils/safelyRunOnBrowser.js +7 -8
- package/es/lib/utils/setIndexHelperState.js +0 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/lib/voiceSearchHelper/index.js +8 -35
- package/es/middlewares/createInsightsMiddleware.js +15 -41
- package/es/middlewares/createMetadataMiddleware.js +3 -9
- package/es/middlewares/createRouterMiddleware.js +8 -13
- package/es/types/index.js +9 -5
- package/es/widgets/analytics/analytics.js +12 -45
- package/es/widgets/answers/answers.js +19 -28
- package/es/widgets/breadcrumb/breadcrumb.js +18 -27
- package/es/widgets/clear-refinements/clear-refinements.js +15 -24
- package/es/widgets/configure/configure.js +3 -6
- package/es/widgets/configure-related-items/configure-related-items.js +2 -7
- package/es/widgets/current-refinements/current-refinements.js +12 -21
- package/es/widgets/dynamic-widgets/dynamic-widgets.js +6 -20
- package/es/widgets/geo-search/GeoSearchRenderer.js +41 -63
- package/es/widgets/geo-search/createHTMLMarker.js +30 -59
- package/es/widgets/geo-search/defaultTemplates.js +2 -2
- package/es/widgets/geo-search/geo-search.js +27 -49
- package/es/widgets/hierarchical-menu/defaultTemplates.js +5 -4
- package/es/widgets/hierarchical-menu/hierarchical-menu.js +28 -36
- package/es/widgets/hits/hits.js +16 -25
- package/es/widgets/hits-per-page/hits-per-page.js +13 -22
- package/es/widgets/index/index.js +49 -91
- package/es/widgets/index.d.ts +2 -1
- package/es/widgets/index.js +4 -3
- package/es/widgets/infinite-hits/infinite-hits.js +23 -32
- package/es/widgets/menu/defaultTemplates.js +4 -3
- package/es/widgets/menu/menu.js +23 -32
- package/es/widgets/menu-select/defaultTemplates.js +1 -1
- package/es/widgets/menu-select/menu-select.js +18 -27
- package/es/widgets/numeric-menu/defaultTemplates.js +4 -3
- package/es/widgets/numeric-menu/numeric-menu.js +17 -26
- package/es/widgets/pagination/pagination.js +32 -44
- package/es/widgets/panel/panel.js +20 -40
- package/es/widgets/places/places.js +16 -32
- package/es/widgets/powered-by/powered-by.js +10 -18
- package/es/widgets/query-rule-context/query-rule-context.js +2 -9
- package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +13 -22
- package/es/widgets/range-input/range-input.js +23 -40
- package/es/widgets/range-slider/range-slider.js +28 -44
- package/es/widgets/rating-menu/defaultTemplates.js +9 -12
- package/es/widgets/rating-menu/rating-menu.js +17 -27
- package/es/widgets/refinement-list/defaultTemplates.js +6 -5
- package/es/widgets/refinement-list/refinement-list.js +39 -48
- package/es/widgets/relevant-sort/relevant-sort.js +10 -19
- package/es/widgets/search-box/defaultTemplates.js +1 -4
- package/es/widgets/search-box/search-box.js +31 -39
- package/es/widgets/sort-by/sort-by.js +11 -20
- package/es/widgets/stats/stats.js +26 -45
- package/es/widgets/toggle-refinement/toggle-refinement.js +16 -25
- package/es/widgets/voice-search/defaultTemplates.js +5 -13
- package/es/widgets/voice-search/voice-search.js +17 -26
- package/package.json +20 -119
- package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.input.js +0 -1
- package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.output.js +0 -1
- package/CHANGELOG.md +0 -3693
|
@@ -4,21 +4,13 @@ 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
8
|
var _index = require("../utils/index.js");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
11
|
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
|
-
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
13
|
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
|
-
|
|
22
14
|
var setWindowTitle = function setWindowTitle(title) {
|
|
23
15
|
if (title) {
|
|
24
16
|
// This function is only executed on browsers so we can disable this check.
|
|
@@ -26,7 +18,6 @@ var setWindowTitle = function setWindowTitle(title) {
|
|
|
26
18
|
window.document.title = title;
|
|
27
19
|
}
|
|
28
20
|
};
|
|
29
|
-
|
|
30
21
|
var BrowserHistory = /*#__PURE__*/function () {
|
|
31
22
|
/**
|
|
32
23
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
@@ -34,34 +25,22 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
34
25
|
*/
|
|
35
26
|
function BrowserHistory(_ref) {
|
|
36
27
|
var _this = this;
|
|
37
|
-
|
|
38
28
|
var windowTitle = _ref.windowTitle,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
_ref$writeDelay = _ref.writeDelay,
|
|
30
|
+
writeDelay = _ref$writeDelay === void 0 ? 400 : _ref$writeDelay,
|
|
31
|
+
createURL = _ref.createURL,
|
|
32
|
+
parseURL = _ref.parseURL,
|
|
33
|
+
getLocation = _ref.getLocation;
|
|
45
34
|
_classCallCheck(this, BrowserHistory);
|
|
46
|
-
|
|
47
35
|
_defineProperty(this, "windowTitle", void 0);
|
|
48
|
-
|
|
49
36
|
_defineProperty(this, "writeDelay", void 0);
|
|
50
|
-
|
|
51
37
|
_defineProperty(this, "_createURL", void 0);
|
|
52
|
-
|
|
53
38
|
_defineProperty(this, "parseURL", void 0);
|
|
54
|
-
|
|
55
39
|
_defineProperty(this, "getLocation", void 0);
|
|
56
|
-
|
|
57
40
|
_defineProperty(this, "writeTimer", void 0);
|
|
58
|
-
|
|
59
41
|
_defineProperty(this, "inPopState", false);
|
|
60
|
-
|
|
61
42
|
_defineProperty(this, "isDisposed", false);
|
|
62
|
-
|
|
63
43
|
_defineProperty(this, "latestAcknowledgedHistory", 0);
|
|
64
|
-
|
|
65
44
|
this.windowTitle = windowTitle;
|
|
66
45
|
this.writeTimer = undefined;
|
|
67
46
|
this.writeDelay = writeDelay;
|
|
@@ -70,18 +49,15 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
70
49
|
this.getLocation = getLocation;
|
|
71
50
|
(0, _index.safelyRunOnBrowser)(function (_ref2) {
|
|
72
51
|
var window = _ref2.window;
|
|
73
|
-
|
|
74
52
|
var title = _this.windowTitle && _this.windowTitle(_this.read());
|
|
75
|
-
|
|
76
53
|
setWindowTitle(title);
|
|
77
54
|
_this.latestAcknowledgedHistory = window.history.length;
|
|
78
55
|
});
|
|
79
56
|
}
|
|
57
|
+
|
|
80
58
|
/**
|
|
81
59
|
* Reads the URL and returns a syncable UI search state.
|
|
82
60
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
61
|
_createClass(BrowserHistory, [{
|
|
86
62
|
key: "read",
|
|
87
63
|
value: function read() {
|
|
@@ -90,72 +66,64 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
90
66
|
location: this.getLocation()
|
|
91
67
|
});
|
|
92
68
|
}
|
|
69
|
+
|
|
93
70
|
/**
|
|
94
71
|
* Pushes a search state into the URL.
|
|
95
72
|
*/
|
|
96
|
-
|
|
97
73
|
}, {
|
|
98
74
|
key: "write",
|
|
99
75
|
value: function write(routeState) {
|
|
100
76
|
var _this2 = this;
|
|
101
|
-
|
|
102
77
|
(0, _index.safelyRunOnBrowser)(function (_ref3) {
|
|
103
78
|
var window = _ref3.window;
|
|
104
|
-
|
|
105
79
|
var url = _this2.createURL(routeState);
|
|
106
|
-
|
|
107
80
|
var title = _this2.windowTitle && _this2.windowTitle(routeState);
|
|
108
|
-
|
|
109
81
|
if (_this2.writeTimer) {
|
|
110
82
|
clearTimeout(_this2.writeTimer);
|
|
111
83
|
}
|
|
112
|
-
|
|
113
84
|
_this2.writeTimer = setTimeout(function () {
|
|
114
85
|
setWindowTitle(title);
|
|
115
|
-
|
|
116
86
|
if (_this2.shouldWrite(url)) {
|
|
117
87
|
window.history.pushState(routeState, title || '', url);
|
|
118
88
|
_this2.latestAcknowledgedHistory = window.history.length;
|
|
119
89
|
}
|
|
120
|
-
|
|
121
90
|
_this2.inPopState = false;
|
|
122
91
|
_this2.writeTimer = undefined;
|
|
123
92
|
}, _this2.writeDelay);
|
|
124
93
|
});
|
|
125
94
|
}
|
|
95
|
+
|
|
126
96
|
/**
|
|
127
97
|
* Sets a callback on the `onpopstate` event of the history API of the current page.
|
|
128
98
|
* It enables the URL sync to keep track of the changes.
|
|
129
99
|
*/
|
|
130
|
-
|
|
131
100
|
}, {
|
|
132
101
|
key: "onUpdate",
|
|
133
102
|
value: function onUpdate(callback) {
|
|
134
103
|
var _this3 = this;
|
|
135
|
-
|
|
136
104
|
this._onPopState = function (event) {
|
|
137
105
|
if (_this3.writeTimer) {
|
|
138
106
|
clearTimeout(_this3.writeTimer);
|
|
139
107
|
_this3.writeTimer = undefined;
|
|
140
108
|
}
|
|
141
|
-
|
|
142
109
|
_this3.inPopState = true;
|
|
143
|
-
var routeState = event.state;
|
|
110
|
+
var routeState = event.state;
|
|
111
|
+
|
|
112
|
+
// At initial load, the state is read from the URL without update.
|
|
144
113
|
// Therefore the state object is not available.
|
|
145
114
|
// In this case, we fallback and read the URL.
|
|
146
|
-
|
|
147
115
|
if (!routeState) {
|
|
148
116
|
callback(_this3.read());
|
|
149
117
|
} else {
|
|
150
118
|
callback(routeState);
|
|
151
119
|
}
|
|
152
120
|
};
|
|
153
|
-
|
|
154
121
|
(0, _index.safelyRunOnBrowser)(function (_ref4) {
|
|
155
122
|
var window = _ref4.window;
|
|
156
123
|
window.addEventListener('popstate', _this3._onPopState);
|
|
157
124
|
});
|
|
158
125
|
}
|
|
126
|
+
|
|
159
127
|
/**
|
|
160
128
|
* Creates a complete URL from a given syncable UI state.
|
|
161
129
|
*
|
|
@@ -163,7 +131,6 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
163
131
|
* This allows to handle cases like using a <base href>.
|
|
164
132
|
* See: https://github.com/algolia/instantsearch.js/issues/790
|
|
165
133
|
*/
|
|
166
|
-
|
|
167
134
|
}, {
|
|
168
135
|
key: "createURL",
|
|
169
136
|
value: function createURL(routeState) {
|
|
@@ -173,35 +140,30 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
173
140
|
location: this.getLocation()
|
|
174
141
|
});
|
|
175
142
|
}
|
|
143
|
+
|
|
176
144
|
/**
|
|
177
145
|
* Removes the event listener and cleans up the URL.
|
|
178
146
|
*/
|
|
179
|
-
|
|
180
147
|
}, {
|
|
181
148
|
key: "dispose",
|
|
182
149
|
value: function dispose() {
|
|
183
150
|
var _this4 = this;
|
|
184
|
-
|
|
185
151
|
this.isDisposed = true;
|
|
186
152
|
(0, _index.safelyRunOnBrowser)(function (_ref5) {
|
|
187
153
|
var window = _ref5.window;
|
|
188
|
-
|
|
189
154
|
if (_this4._onPopState) {
|
|
190
155
|
window.removeEventListener('popstate', _this4._onPopState);
|
|
191
156
|
}
|
|
192
157
|
});
|
|
193
|
-
|
|
194
158
|
if (this.writeTimer) {
|
|
195
159
|
clearTimeout(this.writeTimer);
|
|
196
160
|
}
|
|
197
|
-
|
|
198
161
|
this.write({});
|
|
199
162
|
}
|
|
200
163
|
}, {
|
|
201
164
|
key: "shouldWrite",
|
|
202
165
|
value: function shouldWrite(url) {
|
|
203
166
|
var _this5 = this;
|
|
204
|
-
|
|
205
167
|
return (0, _index.safelyRunOnBrowser)(function (_ref6) {
|
|
206
168
|
var window = _ref6.window;
|
|
207
169
|
// We do want to `pushState` if:
|
|
@@ -210,75 +172,74 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
210
172
|
// - the last write was from InstantSearch.js
|
|
211
173
|
// (unlike a SPA, where it would have last written)
|
|
212
174
|
var lastPushWasByISAfterDispose = !(_this5.isDisposed && _this5.latestAcknowledgedHistory !== window.history.length);
|
|
213
|
-
return (
|
|
175
|
+
return (
|
|
176
|
+
// When the last state change was through popstate, the IS.js state changes,
|
|
214
177
|
// but that should not write the URL.
|
|
215
|
-
!_this5.inPopState &&
|
|
216
|
-
|
|
178
|
+
!_this5.inPopState &&
|
|
179
|
+
// When the previous pushState after dispose was by IS.js, we want to write the URL.
|
|
180
|
+
lastPushWasByISAfterDispose &&
|
|
181
|
+
// When the URL is the same as the current one, we do not want to write it.
|
|
217
182
|
url !== window.location.href
|
|
218
183
|
);
|
|
219
184
|
});
|
|
220
185
|
}
|
|
221
186
|
}]);
|
|
222
|
-
|
|
223
187
|
return BrowserHistory;
|
|
224
188
|
}();
|
|
225
|
-
|
|
226
189
|
function historyRouter() {
|
|
227
190
|
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
191
|
+
_ref7$createURL = _ref7.createURL,
|
|
192
|
+
createURL = _ref7$createURL === void 0 ? function (_ref8) {
|
|
193
|
+
var qsModule = _ref8.qsModule,
|
|
231
194
|
routeState = _ref8.routeState,
|
|
232
195
|
location = _ref8.location;
|
|
233
|
-
|
|
196
|
+
var protocol = location.protocol,
|
|
234
197
|
hostname = location.hostname,
|
|
235
198
|
_location$port = location.port,
|
|
236
199
|
port = _location$port === void 0 ? '' : _location$port,
|
|
237
200
|
pathname = location.pathname,
|
|
238
201
|
hash = location.hash;
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
}
|
|
202
|
+
var queryString = qsModule.stringify(routeState);
|
|
203
|
+
var portWithPrefix = port === '' ? '' : ":".concat(port);
|
|
246
204
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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.');
|
|
205
|
+
// IE <= 11 has no proper `location.origin` so we cannot rely on it.
|
|
206
|
+
if (!queryString) {
|
|
207
|
+
return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname).concat(hash);
|
|
278
208
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
209
|
+
return "".concat(protocol, "//").concat(hostname).concat(portWithPrefix).concat(pathname, "?").concat(queryString).concat(hash);
|
|
210
|
+
} : _ref7$createURL,
|
|
211
|
+
_ref7$parseURL = _ref7.parseURL,
|
|
212
|
+
parseURL = _ref7$parseURL === void 0 ? function (_ref9) {
|
|
213
|
+
var qsModule = _ref9.qsModule,
|
|
214
|
+
location = _ref9.location;
|
|
215
|
+
// `qs` by default converts arrays with more than 20 items to an object.
|
|
216
|
+
// We want to avoid this because the data structure manipulated can therefore vary.
|
|
217
|
+
// Setting the limit to `100` seems a good number because the engine's default is 100
|
|
218
|
+
// (it can go up to 1000 but it is very unlikely to select more than 100 items in the UI).
|
|
219
|
+
//
|
|
220
|
+
// Using an `arrayLimit` of `n` allows `n + 1` items.
|
|
221
|
+
//
|
|
222
|
+
// See:
|
|
223
|
+
// - https://github.com/ljharb/qs#parsing-arrays
|
|
224
|
+
// - https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/
|
|
225
|
+
return qsModule.parse(location.search.slice(1), {
|
|
226
|
+
arrayLimit: 99
|
|
227
|
+
});
|
|
228
|
+
} : _ref7$parseURL,
|
|
229
|
+
_ref7$writeDelay = _ref7.writeDelay,
|
|
230
|
+
writeDelay = _ref7$writeDelay === void 0 ? 400 : _ref7$writeDelay,
|
|
231
|
+
windowTitle = _ref7.windowTitle,
|
|
232
|
+
_ref7$getLocation = _ref7.getLocation,
|
|
233
|
+
getLocation = _ref7$getLocation === void 0 ? function () {
|
|
234
|
+
return (0, _index.safelyRunOnBrowser)(function (_ref10) {
|
|
235
|
+
var window = _ref10.window;
|
|
236
|
+
return window.location;
|
|
237
|
+
}, {
|
|
238
|
+
fallback: function fallback() {
|
|
239
|
+
throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
} : _ref7$getLocation;
|
|
282
243
|
return new BrowserHistory({
|
|
283
244
|
createURL: createURL,
|
|
284
245
|
parseURL: parseURL,
|
package/cjs/lib/routers/index.js
CHANGED
|
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "singleIndex", {
|
|
|
15
15
|
return _singleIndex.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
var _simple = _interopRequireDefault(require("./simple.js"));
|
|
20
|
-
|
|
21
19
|
var _singleIndex = _interopRequireDefault(require("./singleIndex.js"));
|
|
22
|
-
|
|
23
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,27 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = simpleStateMapping;
|
|
7
|
-
|
|
8
|
-
function
|
|
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
|
-
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
12
9
|
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
|
-
|
|
14
10
|
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
11
|
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
12
|
function getIndexStateWithoutConfigure(uiState) {
|
|
19
13
|
var configure = uiState.configure,
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
trackedUiState = _objectWithoutProperties(uiState, ["configure"]);
|
|
22
15
|
return trackedUiState;
|
|
23
|
-
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// technically a URL could contain any key, since users provide it,
|
|
24
19
|
// which is why the input to this function is UiState, not something
|
|
25
20
|
// which excludes "configure" as this function does.
|
|
26
|
-
|
|
27
|
-
|
|
28
21
|
function simpleStateMapping() {
|
|
29
22
|
return {
|
|
30
23
|
stateToRoute: function stateToRoute(uiState) {
|
|
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = singleIndexStateMapping;
|
|
7
|
-
|
|
8
7
|
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
|
-
|
|
10
8
|
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
9
|
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
10
|
function getIndexStateWithoutConfigure(uiState) {
|
|
15
11
|
var configure = uiState.configure,
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
trackedUiState = _objectWithoutProperties(uiState, ["configure"]);
|
|
18
13
|
return trackedUiState;
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
function singleIndexStateMapping(indexName) {
|
|
22
16
|
return {
|
|
23
17
|
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
|
-
|
|
13
|
-
|
|
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
6
|
var _prepareTemplateProps = require("./prepareTemplateProps.js");
|
|
8
|
-
|
|
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
17
|
var _renderTemplate = require("./renderTemplate.js");
|
|
21
|
-
|
|
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;
|
|
@@ -4,28 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.prepareTemplateProps = prepareTemplateProps;
|
|
7
|
-
|
|
8
7
|
var _uniq = require("../utils/uniq.js");
|
|
9
|
-
|
|
10
|
-
function
|
|
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
|
-
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
14
10
|
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
|
-
|
|
16
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
-
|
|
18
12
|
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
13
|
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
|
-
|
|
14
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
24
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
|
-
|
|
26
16
|
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
|
-
|
|
17
|
+
function prepareTemplates(
|
|
18
|
+
// can not use = {} here, since the template could have different constraints
|
|
29
19
|
defaultTemplates) {
|
|
30
20
|
var templates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
21
|
var allKeys = (0, _uniq.uniq)([].concat(_toConsumableArray(Object.keys(defaultTemplates || {})), _toConsumableArray(Object.keys(templates))));
|
|
@@ -44,15 +34,14 @@ defaultTemplates) {
|
|
|
44
34
|
useCustomCompileOptions: {}
|
|
45
35
|
});
|
|
46
36
|
}
|
|
37
|
+
|
|
47
38
|
/**
|
|
48
39
|
* Prepares an object to be passed to the Template widget
|
|
49
40
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
41
|
function prepareTemplateProps(_ref) {
|
|
53
42
|
var defaultTemplates = _ref.defaultTemplates,
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
templates = _ref.templates,
|
|
44
|
+
templatesConfig = _ref.templatesConfig;
|
|
56
45
|
var preparedTemplates = prepareTemplates(defaultTemplates, templates);
|
|
57
46
|
return _objectSpread({
|
|
58
47
|
templatesConfig: templatesConfig
|
|
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.renderTemplate = renderTemplate;
|
|
7
|
-
|
|
8
7
|
var _hogan = _interopRequireDefault(require("hogan.js"));
|
|
9
|
-
|
|
10
8
|
var _preact = require("htm/preact");
|
|
11
|
-
|
|
12
9
|
var _index = require("../../helpers/components/index.js");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
22
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; }
|
|
23
|
-
|
|
24
15
|
// We add all our template helper methods to the template as lambdas. Note
|
|
25
16
|
// that lambdas in Mustache are supposed to accept a second argument of
|
|
26
17
|
// `render` to get the rendered value, not the literal `{{value}}`. But
|
|
@@ -32,32 +23,27 @@ function transformHelpersToHogan() {
|
|
|
32
23
|
return Object.keys(helpers).reduce(function (acc, helperKey) {
|
|
33
24
|
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, helperKey, function () {
|
|
34
25
|
var _this = this;
|
|
35
|
-
|
|
36
26
|
return function (text) {
|
|
37
27
|
var render = function render(value) {
|
|
38
28
|
return _hogan.default.compile(value, compileOptions).render(_this);
|
|
39
29
|
};
|
|
40
|
-
|
|
41
30
|
return helpers[helperKey].call(data, text, render);
|
|
42
31
|
};
|
|
43
32
|
}));
|
|
44
33
|
}, {});
|
|
45
34
|
}
|
|
46
|
-
|
|
47
35
|
function renderTemplate(_ref) {
|
|
48
36
|
var templates = _ref.templates,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
templateKey = _ref.templateKey,
|
|
38
|
+
compileOptions = _ref.compileOptions,
|
|
39
|
+
helpers = _ref.helpers,
|
|
40
|
+
data = _ref.data,
|
|
41
|
+
bindEvent = _ref.bindEvent,
|
|
42
|
+
sendEvent = _ref.sendEvent;
|
|
55
43
|
var template = templates[templateKey];
|
|
56
|
-
|
|
57
44
|
if (typeof template !== 'string' && typeof template !== 'function') {
|
|
58
45
|
throw new Error("Template must be 'string' or 'function', was '".concat(_typeof(template), "' (key: ").concat(templateKey, ")"));
|
|
59
46
|
}
|
|
60
|
-
|
|
61
47
|
if (typeof template === 'function') {
|
|
62
48
|
// @MAJOR no longer pass bindEvent when string templates are removed
|
|
63
49
|
var params = bindEvent || {};
|
|
@@ -71,7 +57,6 @@ function renderTemplate(_ref) {
|
|
|
71
57
|
};
|
|
72
58
|
return template(data, params);
|
|
73
59
|
}
|
|
74
|
-
|
|
75
60
|
var transformedHelpers = transformHelpersToHogan(helpers, compileOptions, data);
|
|
76
61
|
return _hogan.default.compile(template, compileOptions).render(_objectSpread(_objectSpread({}, data), {}, {
|
|
77
62
|
helpers: transformedHelpers
|