instantsearch.js 4.46.0 → 4.46.1
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/CHANGELOG.md +12 -1
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
- package/cjs/helpers/components/Highlight.js +7 -7
- package/cjs/helpers/components/ReverseHighlight.js +7 -7
- package/cjs/helpers/components/ReverseSnippet.js +7 -7
- package/cjs/helpers/components/Snippet.js +7 -7
- package/cjs/lib/InstantSearch.js +33 -24
- package/cjs/lib/utils/capitalize.js +2 -5
- package/cjs/lib/utils/checkIndexUiState.js +3 -5
- package/cjs/lib/utils/checkRendering.js +4 -9
- package/cjs/lib/utils/clearRefinements.js +3 -9
- package/cjs/lib/utils/concatHighlightedParts.js +1 -1
- package/cjs/lib/utils/createSendEventForFacet.js +2 -4
- package/cjs/lib/utils/defer.js +3 -6
- package/cjs/lib/utils/detect-insights-client.js +1 -1
- package/cjs/lib/utils/documentation.js +6 -9
- package/cjs/lib/utils/escape-highlight.js +4 -6
- package/cjs/lib/utils/escape-html.js +60 -0
- package/cjs/lib/utils/find.js +2 -5
- package/cjs/lib/utils/findIndex.js +2 -5
- package/cjs/lib/utils/getContainerNode.js +4 -9
- package/cjs/lib/utils/getHighlightFromSiblings.js +3 -5
- package/cjs/lib/utils/getHighlightedParts.js +1 -1
- package/cjs/lib/utils/getObjectType.js +2 -5
- package/cjs/lib/utils/getPropertyByPath.js +2 -5
- package/cjs/lib/utils/getRefinements.js +4 -6
- package/cjs/lib/utils/index.js +562 -440
- package/cjs/lib/utils/isDomElement.js +2 -5
- package/cjs/lib/utils/isEqual.js +2 -5
- package/cjs/lib/utils/isFacetRefined.js +1 -1
- package/cjs/lib/utils/isFiniteNumber.js +3 -5
- package/cjs/lib/utils/isIndexWidget.js +10 -0
- package/cjs/lib/utils/isPlainObject.js +2 -5
- package/cjs/lib/utils/isSpecialClick.js +2 -5
- package/cjs/lib/utils/logger.js +3 -5
- package/cjs/lib/utils/mergeSearchParameters.js +7 -10
- package/cjs/lib/utils/noop.js +2 -5
- package/cjs/lib/utils/prepareTemplateProps.js +4 -9
- package/cjs/lib/utils/range.js +2 -5
- package/cjs/lib/utils/renderTemplate.js +2 -5
- package/cjs/lib/utils/resolveSearchParameters.js +3 -6
- package/cjs/lib/utils/reverseHighlightedParts.js +3 -5
- package/cjs/lib/utils/setIndexHelperState.js +28 -0
- package/cjs/lib/utils/toArray.js +2 -5
- package/cjs/lib/utils/uniq.js +2 -5
- package/cjs/lib/version.js +1 -1
- package/cjs/middlewares/createInsightsMiddleware.js +23 -30
- package/cjs/middlewares/createMetadataMiddleware.js +1 -0
- package/cjs/middlewares/createRouterMiddleware.js +1 -0
- package/cjs/widgets/index/index.js +8 -12
- package/dist/instantsearch.development.d.ts +11 -3
- package/dist/instantsearch.development.js +2242 -2181
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +11 -3
- package/dist/instantsearch.production.min.d.ts +11 -3
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/es/components/ClearRefinements/ClearRefinements.d.ts +1 -1
- package/es/components/GeoSearchControls/GeoSearchControls.d.ts +1 -1
- package/es/components/Hits/Hits.d.ts +1 -2
- package/es/components/RefinementList/RefinementList.d.ts +1 -1
- package/es/components/Template/Template.d.ts +1 -2
- package/es/components/ToggleRefinement/ToggleRefinement.d.ts +1 -4
- package/es/components/ToggleRefinement/ToggleRefinement.js +0 -4
- package/es/connectors/toggle-refinement/connectToggleRefinement.d.ts +3 -2
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
- package/es/helpers/components/Highlight.js +7 -5
- package/es/helpers/components/ReverseHighlight.js +7 -5
- package/es/helpers/components/ReverseSnippet.js +7 -5
- package/es/helpers/components/Snippet.js +7 -5
- package/es/lib/InstantSearch.d.ts +6 -1
- package/es/lib/InstantSearch.js +34 -21
- package/es/lib/utils/capitalize.d.ts +1 -2
- package/es/lib/utils/capitalize.js +2 -4
- package/es/lib/utils/checkIndexUiState.js +1 -1
- package/es/lib/utils/checkRendering.d.ts +1 -2
- package/es/lib/utils/checkRendering.js +3 -6
- package/es/lib/utils/clearRefinements.d.ts +4 -8
- package/es/lib/utils/clearRefinements.js +3 -8
- package/es/lib/utils/concatHighlightedParts.d.ts +1 -1
- package/es/lib/utils/concatHighlightedParts.js +1 -1
- package/es/lib/utils/createSendEventForFacet.js +1 -1
- package/es/lib/utils/createSendEventForHits.d.ts +0 -3
- package/es/lib/utils/createSendEventForHits.js +0 -3
- package/es/lib/utils/defer.d.ts +2 -2
- package/es/lib/utils/defer.js +2 -5
- package/es/lib/utils/detect-insights-client.d.ts +1 -1
- package/es/lib/utils/detect-insights-client.js +1 -1
- package/es/lib/utils/documentation.d.ts +2 -2
- package/es/lib/utils/documentation.js +4 -4
- package/es/lib/utils/escape-highlight.js +2 -2
- package/es/lib/utils/{escape.d.ts → escape-html.d.ts} +6 -2
- package/es/lib/utils/escape-html.js +51 -0
- package/es/lib/utils/escapeFacetValue.d.ts +1 -1
- package/es/lib/utils/find.d.ts +1 -2
- package/es/lib/utils/find.js +2 -4
- package/es/lib/utils/findIndex.d.ts +1 -2
- package/es/lib/utils/findIndex.js +2 -4
- package/es/lib/utils/getContainerNode.d.ts +1 -2
- package/es/lib/utils/getContainerNode.js +3 -5
- package/es/lib/utils/getHighlightFromSiblings.d.ts +1 -1
- package/es/lib/utils/getHighlightFromSiblings.js +2 -2
- package/es/lib/utils/getHighlightedParts.d.ts +1 -1
- package/es/lib/utils/getHighlightedParts.js +1 -1
- package/es/lib/utils/getObjectType.d.ts +1 -2
- package/es/lib/utils/getObjectType.js +2 -4
- package/es/lib/utils/getPropertyByPath.d.ts +1 -2
- package/es/lib/utils/getPropertyByPath.js +2 -4
- package/es/lib/utils/getRefinements.d.ts +1 -1
- package/es/lib/utils/getRefinements.js +2 -2
- package/es/lib/utils/index.d.ts +46 -46
- package/es/lib/utils/index.js +46 -46
- package/es/lib/utils/isDomElement.d.ts +1 -2
- package/es/lib/utils/isDomElement.js +2 -4
- package/es/lib/utils/isEqual.d.ts +1 -2
- package/es/lib/utils/isEqual.js +2 -4
- package/es/lib/utils/isFacetRefined.d.ts +1 -1
- package/es/lib/utils/isFacetRefined.js +1 -1
- package/es/lib/utils/isFiniteNumber.d.ts +1 -2
- package/es/lib/utils/isFiniteNumber.js +3 -4
- package/es/lib/utils/isIndexWidget.d.ts +3 -0
- package/es/lib/utils/isIndexWidget.js +3 -0
- package/es/lib/utils/isPlainObject.d.ts +1 -2
- package/es/lib/utils/isPlainObject.js +2 -4
- package/es/lib/utils/isSpecialClick.d.ts +1 -2
- package/es/lib/utils/isSpecialClick.js +2 -4
- package/es/lib/utils/logger.js +1 -1
- package/es/lib/utils/mergeSearchParameters.d.ts +1 -2
- package/es/lib/utils/mergeSearchParameters.js +4 -6
- package/es/lib/utils/noop.d.ts +1 -2
- package/es/lib/utils/noop.js +1 -3
- package/es/lib/utils/prepareTemplateProps.d.ts +2 -2
- package/es/lib/utils/prepareTemplateProps.js +3 -5
- package/es/lib/utils/range.d.ts +2 -2
- package/es/lib/utils/range.js +2 -4
- package/es/lib/utils/renderTemplate.d.ts +1 -2
- package/es/lib/utils/renderTemplate.js +2 -4
- package/es/lib/utils/resolveSearchParameters.d.ts +1 -2
- package/es/lib/utils/resolveSearchParameters.js +2 -4
- package/es/lib/utils/reverseHighlightedParts.d.ts +1 -1
- package/es/lib/utils/reverseHighlightedParts.js +2 -2
- package/es/lib/utils/setIndexHelperState.d.ts +3 -0
- package/es/lib/utils/setIndexHelperState.js +19 -0
- package/es/lib/utils/toArray.d.ts +3 -2
- package/es/lib/utils/toArray.js +2 -4
- package/es/lib/utils/uniq.d.ts +1 -2
- package/es/lib/utils/uniq.js +2 -4
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createInsightsMiddleware.js +23 -27
- package/es/middlewares/createMetadataMiddleware.js +1 -0
- package/es/middlewares/createRouterMiddleware.js +1 -0
- package/es/types/middleware.d.ts +1 -0
- package/es/widgets/index/index.d.ts +0 -1
- package/es/widgets/index/index.js +5 -6
- package/package.json +5 -5
- package/cjs/lib/utils/convertNumericRefinementsToFilters.js +0 -31
- package/cjs/lib/utils/escape.js +0 -35
- package/cjs/lib/utils/unescape.js +0 -32
- package/es/lib/utils/convertNumericRefinementsToFilters.d.ts +0 -2
- package/es/lib/utils/convertNumericRefinementsToFilters.js +0 -24
- package/es/lib/utils/escape.js +0 -27
- package/es/lib/utils/unescape.d.ts +0 -9
- package/es/lib/utils/unescape.js +0 -25
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This implementation is taken from Lodash implementation.
|
|
3
|
+
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/escape.js
|
|
4
|
+
*/
|
|
5
|
+
// Used to map characters to HTML entities.
|
|
6
|
+
var htmlEntities = {
|
|
7
|
+
'&': '&',
|
|
8
|
+
'<': '<',
|
|
9
|
+
'>': '>',
|
|
10
|
+
'"': '"',
|
|
11
|
+
"'": '''
|
|
12
|
+
}; // Used to match HTML entities and HTML characters.
|
|
13
|
+
|
|
14
|
+
var regexUnescapedHtml = /[&<>"']/g;
|
|
15
|
+
var regexHasUnescapedHtml = RegExp(regexUnescapedHtml.source);
|
|
16
|
+
/**
|
|
17
|
+
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
|
18
|
+
* corresponding HTML entities.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export function escape(value) {
|
|
22
|
+
return value && regexHasUnescapedHtml.test(value) ? value.replace(regexUnescapedHtml, function (character) {
|
|
23
|
+
return htmlEntities[character];
|
|
24
|
+
}) : value;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This implementation is taken from Lodash implementation.
|
|
28
|
+
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js
|
|
29
|
+
*/
|
|
30
|
+
// Used to map HTML entities to characters.
|
|
31
|
+
|
|
32
|
+
var htmlCharacters = {
|
|
33
|
+
'&': '&',
|
|
34
|
+
'<': '<',
|
|
35
|
+
'>': '>',
|
|
36
|
+
'"': '"',
|
|
37
|
+
''': "'"
|
|
38
|
+
}; // Used to match HTML entities and HTML characters.
|
|
39
|
+
|
|
40
|
+
var regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g;
|
|
41
|
+
var regexHasEscapedHtml = RegExp(regexEscapedHtml.source);
|
|
42
|
+
/**
|
|
43
|
+
* Converts the HTML entities "&", "<", ">", '"', and "'" in `string` to their
|
|
44
|
+
* characters.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export function unescape(value) {
|
|
48
|
+
return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function (character) {
|
|
49
|
+
return htmlCharacters[character];
|
|
50
|
+
}) : value;
|
|
51
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare type FacetValue = string | number | undefined;
|
|
1
|
+
declare type FacetValue = string | number | boolean | undefined;
|
|
2
2
|
export declare function unescapeFacetValue<TFacetValue extends FacetValue>(value: TFacetValue): TFacetValue;
|
|
3
3
|
export declare function escapeFacetValue<TFacetValue extends FacetValue>(value: TFacetValue): TFacetValue;
|
|
4
4
|
export {};
|
package/es/lib/utils/find.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function find<TItem>(items: TItem[], predicate: (value: TItem, index: number, obj: TItem[]) => boolean): TItem | undefined;
|
|
2
|
-
export default find;
|
|
1
|
+
export declare function find<TItem>(items: TItem[], predicate: (value: TItem, index: number, obj: TItem[]) => boolean): TItem | undefined;
|
package/es/lib/utils/find.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// was decided as too risky.
|
|
5
5
|
// @MAJOR Replace with the native `Array.prototype.find` method
|
|
6
6
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
|
|
7
|
-
function find(items, predicate) {
|
|
7
|
+
export function find(items, predicate) {
|
|
8
8
|
var value;
|
|
9
9
|
|
|
10
10
|
for (var i = 0; i < items.length; i++) {
|
|
@@ -16,6 +16,4 @@ function find(items, predicate) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
return undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default find;
|
|
19
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function findIndex<TItem>(array: TItem[], comparator: (value: TItem) => boolean): number;
|
|
2
|
-
export default findIndex;
|
|
1
|
+
export declare function findIndex<TItem>(array: TItem[], comparator: (value: TItem) => boolean): number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// was decided as too risky.
|
|
5
5
|
// @MAJOR Replace with the native `Array.prototype.findIndex` method
|
|
6
6
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
|
|
7
|
-
function findIndex(array, comparator) {
|
|
7
|
+
export function findIndex(array, comparator) {
|
|
8
8
|
if (!Array.isArray(array)) {
|
|
9
9
|
return -1;
|
|
10
10
|
}
|
|
@@ -16,6 +16,4 @@ function findIndex(array, comparator) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
return -1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default findIndex;
|
|
19
|
+
}
|
|
@@ -7,5 +7,4 @@
|
|
|
7
7
|
* @return {HTMLElement} Container node
|
|
8
8
|
* @throws Error when the type is not correct
|
|
9
9
|
*/
|
|
10
|
-
declare function getContainerNode(selectorOrHTMLElement: string | HTMLElement): HTMLElement;
|
|
11
|
-
export default getContainerNode;
|
|
10
|
+
export declare function getContainerNode(selectorOrHTMLElement: string | HTMLElement): HTMLElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import isDomElement from "./isDomElement.js";
|
|
1
|
+
import { isDomElement } from "./isDomElement.js";
|
|
2
2
|
/**
|
|
3
3
|
* Return the container. If it's a string, it is considered a
|
|
4
4
|
* css selector and retrieves the first matching element. Otherwise
|
|
@@ -9,7 +9,7 @@ import isDomElement from "./isDomElement.js";
|
|
|
9
9
|
* @throws Error when the type is not correct
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
function getContainerNode(selectorOrHTMLElement) {
|
|
12
|
+
export function getContainerNode(selectorOrHTMLElement) {
|
|
13
13
|
var isSelectorString = typeof selectorOrHTMLElement === 'string';
|
|
14
14
|
var domElement = isSelectorString ? document.querySelector(selectorOrHTMLElement) : selectorOrHTMLElement;
|
|
15
15
|
|
|
@@ -24,6 +24,4 @@ function getContainerNode(selectorOrHTMLElement) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
return domElement;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default getContainerNode;
|
|
27
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { HighlightedParts } from '../../types';
|
|
2
|
-
export
|
|
2
|
+
export declare function getHighlightFromSiblings(parts: HighlightedParts[], i: number): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import unescape from "./
|
|
1
|
+
import { unescape } from "./escape-html.js";
|
|
2
2
|
var hasAlphanumeric = new RegExp(/\w/i);
|
|
3
|
-
export
|
|
3
|
+
export function getHighlightFromSiblings(parts, i) {
|
|
4
4
|
var _parts, _parts2;
|
|
5
5
|
|
|
6
6
|
var current = parts[i];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TAG_REPLACEMENT } from "./escape-highlight.js";
|
|
2
|
-
export
|
|
2
|
+
export function getHighlightedParts(highlightedValue) {
|
|
3
3
|
var highlightPostTag = TAG_REPLACEMENT.highlightPostTag,
|
|
4
4
|
highlightPreTag = TAG_REPLACEMENT.highlightPreTag;
|
|
5
5
|
var splitByPreTag = highlightedValue.split(highlightPreTag);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function getObjectType(object: unknown): string;
|
|
2
|
-
export default getObjectType;
|
|
1
|
+
export declare function getObjectType(object: unknown): string;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function getPropertyByPath(object: Record<string, any> | undefined, path: string | string[]): any;
|
|
2
|
-
export default getPropertyByPath;
|
|
1
|
+
export declare function getPropertyByPath(object: Record<string, any> | undefined, path: string | string[]): any;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
function getPropertyByPath(object, path) {
|
|
1
|
+
export function getPropertyByPath(object, path) {
|
|
2
2
|
var parts = Array.isArray(path) ? path : path.split('.');
|
|
3
3
|
return parts.reduce(function (current, key) {
|
|
4
4
|
return current && current[key];
|
|
5
5
|
}, object);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default getPropertyByPath;
|
|
6
|
+
}
|
|
@@ -36,4 +36,4 @@ export declare type FacetExcludeRefinement = {
|
|
|
36
36
|
exhaustive?: boolean;
|
|
37
37
|
};
|
|
38
38
|
export declare type Refinement = FacetRefinement | QueryRefinement | NumericRefinement | FacetExcludeRefinement | TagRefinement;
|
|
39
|
-
export
|
|
39
|
+
export declare function getRefinements(results: SearchResults | Record<string, never>, state: SearchParameters, includesQuery?: boolean): Refinement[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import find from "./find.js";
|
|
1
|
+
import { find } from "./find.js";
|
|
2
2
|
import { unescapeFacetValue, escapeFacetValue } from "./escapeFacetValue.js";
|
|
3
3
|
|
|
4
4
|
function getRefinement(state, type, attribute, name) {
|
|
@@ -52,7 +52,7 @@ function getRefinement(state, type, attribute, name) {
|
|
|
52
52
|
return res;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export
|
|
55
|
+
export function getRefinements(results, state) {
|
|
56
56
|
var includesQuery = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
57
57
|
var refinements = [];
|
|
58
58
|
var _state$facetsRefineme = state.facetsRefinements,
|
package/es/lib/utils/index.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export { default as renderTemplate } from './renderTemplate';
|
|
8
|
-
export { default as getRefinements } from './getRefinements';
|
|
9
|
-
export { default as clearRefinements } from './clearRefinements';
|
|
10
|
-
export { escapeFacetValue, unescapeFacetValue } from './escapeFacetValue';
|
|
11
|
-
export { default as checkRendering } from './checkRendering';
|
|
12
|
-
export { checkIndexUiState } from './checkIndexUiState';
|
|
13
|
-
export { default as getPropertyByPath } from './getPropertyByPath';
|
|
14
|
-
export { default as getObjectType } from './getObjectType';
|
|
15
|
-
export { default as noop } from './noop';
|
|
16
|
-
export { default as isFiniteNumber } from './isFiniteNumber';
|
|
17
|
-
export { default as isPlainObject } from './isPlainObject';
|
|
18
|
-
export { default as uniq } from './uniq';
|
|
19
|
-
export { default as range } from './range';
|
|
20
|
-
export { default as isEqual } from './isEqual';
|
|
21
|
-
export { default as escape } from './escape';
|
|
22
|
-
export { default as unescape } from './unescape';
|
|
23
|
-
export { default as concatHighlightedParts } from './concatHighlightedParts';
|
|
24
|
-
export { default as getHighlightedParts } from './getHighlightedParts';
|
|
25
|
-
export { default as getHighlightFromSiblings } from './getHighlightFromSiblings';
|
|
26
|
-
export { default as reverseHighlightedParts } from './reverseHighlightedParts';
|
|
27
|
-
export { default as find } from './find';
|
|
28
|
-
export { default as findIndex } from './findIndex';
|
|
29
|
-
export { default as mergeSearchParameters } from './mergeSearchParameters';
|
|
30
|
-
export { default as resolveSearchParameters } from './resolveSearchParameters';
|
|
31
|
-
export { default as toArray } from './toArray';
|
|
32
|
-
export { warning, deprecate } from './logger';
|
|
33
|
-
export { escapeHits, TAG_PLACEHOLDER, TAG_REPLACEMENT, escapeFacets, } from './escape-highlight';
|
|
34
|
-
export { createDocumentationLink, createDocumentationMessageGenerator, } from './documentation';
|
|
35
|
-
export { aroundLatLngToPosition, insideBoundingBoxToBoundingBox, } from './geo-search';
|
|
36
|
-
export { addAbsolutePosition } from './hits-absolute-position';
|
|
37
|
-
export { addQueryID } from './hits-query-id';
|
|
38
|
-
export { default as isFacetRefined } from './isFacetRefined';
|
|
1
|
+
export * from './capitalize';
|
|
2
|
+
export * from './checkIndexUiState';
|
|
3
|
+
export * from './checkRendering';
|
|
4
|
+
export * from './clearRefinements';
|
|
5
|
+
export * from './concatHighlightedParts';
|
|
6
|
+
export * from './createConcurrentSafePromise';
|
|
39
7
|
export * from './createSendEventForFacet';
|
|
40
8
|
export * from './createSendEventForHits';
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
9
|
+
export * from './setIndexHelperState';
|
|
10
|
+
export * from './isIndexWidget';
|
|
11
|
+
export * from './cx';
|
|
12
|
+
export * from './debounce';
|
|
13
|
+
export * from './defer';
|
|
14
|
+
export * from './documentation';
|
|
15
|
+
export * from './escape-highlight';
|
|
16
|
+
export * from './escape-html';
|
|
17
|
+
export * from './escapeFacetValue';
|
|
18
|
+
export * from './find';
|
|
19
|
+
export * from './findIndex';
|
|
20
|
+
export * from './geo-search';
|
|
21
|
+
export * from './getAppIdAndApiKey';
|
|
22
|
+
export * from './getContainerNode';
|
|
23
|
+
export * from './getHighlightedParts';
|
|
24
|
+
export * from './getHighlightFromSiblings';
|
|
25
|
+
export * from './getObjectType';
|
|
26
|
+
export * from './getPropertyByPath';
|
|
27
|
+
export * from './getRefinements';
|
|
28
|
+
export * from './getWidgetAttribute';
|
|
29
|
+
export * from './hits-absolute-position';
|
|
30
|
+
export * from './hits-query-id';
|
|
31
|
+
export * from './isDomElement';
|
|
32
|
+
export * from './isEqual';
|
|
33
|
+
export * from './isFacetRefined';
|
|
34
|
+
export * from './isFiniteNumber';
|
|
35
|
+
export * from './isPlainObject';
|
|
36
|
+
export * from './isSpecialClick';
|
|
37
|
+
export * from './logger';
|
|
38
|
+
export * from './mergeSearchParameters';
|
|
39
|
+
export * from './noop';
|
|
40
|
+
export * from './prepareTemplateProps';
|
|
41
|
+
export * from './range';
|
|
42
|
+
export * from './renderTemplate';
|
|
43
|
+
export * from './resolveSearchParameters';
|
|
44
|
+
export * from './reverseHighlightedParts';
|
|
45
|
+
export * from './safelyRunOnBrowser';
|
|
46
|
+
export * from './serializer';
|
|
47
|
+
export * from './toArray';
|
|
48
|
+
export * from './uniq';
|
package/es/lib/utils/index.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export { default as renderTemplate } from "./renderTemplate.js";
|
|
8
|
-
export { default as getRefinements } from "./getRefinements.js";
|
|
9
|
-
export { default as clearRefinements } from "./clearRefinements.js";
|
|
10
|
-
export { escapeFacetValue, unescapeFacetValue } from "./escapeFacetValue.js";
|
|
11
|
-
export { default as checkRendering } from "./checkRendering.js";
|
|
12
|
-
export { checkIndexUiState } from "./checkIndexUiState.js";
|
|
13
|
-
export { default as getPropertyByPath } from "./getPropertyByPath.js";
|
|
14
|
-
export { default as getObjectType } from "./getObjectType.js";
|
|
15
|
-
export { default as noop } from "./noop.js";
|
|
16
|
-
export { default as isFiniteNumber } from "./isFiniteNumber.js";
|
|
17
|
-
export { default as isPlainObject } from "./isPlainObject.js";
|
|
18
|
-
export { default as uniq } from "./uniq.js";
|
|
19
|
-
export { default as range } from "./range.js";
|
|
20
|
-
export { default as isEqual } from "./isEqual.js";
|
|
21
|
-
export { default as escape } from "./escape.js";
|
|
22
|
-
export { default as unescape } from "./unescape.js";
|
|
23
|
-
export { default as concatHighlightedParts } from "./concatHighlightedParts.js";
|
|
24
|
-
export { default as getHighlightedParts } from "./getHighlightedParts.js";
|
|
25
|
-
export { default as getHighlightFromSiblings } from "./getHighlightFromSiblings.js";
|
|
26
|
-
export { default as reverseHighlightedParts } from "./reverseHighlightedParts.js";
|
|
27
|
-
export { default as find } from "./find.js";
|
|
28
|
-
export { default as findIndex } from "./findIndex.js";
|
|
29
|
-
export { default as mergeSearchParameters } from "./mergeSearchParameters.js";
|
|
30
|
-
export { default as resolveSearchParameters } from "./resolveSearchParameters.js";
|
|
31
|
-
export { default as toArray } from "./toArray.js";
|
|
32
|
-
export { warning, deprecate } from "./logger.js";
|
|
33
|
-
export { escapeHits, TAG_PLACEHOLDER, TAG_REPLACEMENT, escapeFacets } from "./escape-highlight.js";
|
|
34
|
-
export { createDocumentationLink, createDocumentationMessageGenerator } from "./documentation.js";
|
|
35
|
-
export { aroundLatLngToPosition, insideBoundingBoxToBoundingBox } from "./geo-search.js";
|
|
36
|
-
export { addAbsolutePosition } from "./hits-absolute-position.js";
|
|
37
|
-
export { addQueryID } from "./hits-query-id.js";
|
|
38
|
-
export { default as isFacetRefined } from "./isFacetRefined.js";
|
|
1
|
+
export * from "./capitalize.js";
|
|
2
|
+
export * from "./checkIndexUiState.js";
|
|
3
|
+
export * from "./checkRendering.js";
|
|
4
|
+
export * from "./clearRefinements.js";
|
|
5
|
+
export * from "./concatHighlightedParts.js";
|
|
6
|
+
export * from "./createConcurrentSafePromise.js";
|
|
39
7
|
export * from "./createSendEventForFacet.js";
|
|
40
8
|
export * from "./createSendEventForHits.js";
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
9
|
+
export * from "./setIndexHelperState.js";
|
|
10
|
+
export * from "./isIndexWidget.js";
|
|
11
|
+
export * from "./cx.js";
|
|
12
|
+
export * from "./debounce.js";
|
|
13
|
+
export * from "./defer.js";
|
|
14
|
+
export * from "./documentation.js";
|
|
15
|
+
export * from "./escape-highlight.js";
|
|
16
|
+
export * from "./escape-html.js";
|
|
17
|
+
export * from "./escapeFacetValue.js";
|
|
18
|
+
export * from "./find.js";
|
|
19
|
+
export * from "./findIndex.js";
|
|
20
|
+
export * from "./geo-search.js";
|
|
21
|
+
export * from "./getAppIdAndApiKey.js";
|
|
22
|
+
export * from "./getContainerNode.js";
|
|
23
|
+
export * from "./getHighlightedParts.js";
|
|
24
|
+
export * from "./getHighlightFromSiblings.js";
|
|
25
|
+
export * from "./getObjectType.js";
|
|
26
|
+
export * from "./getPropertyByPath.js";
|
|
27
|
+
export * from "./getRefinements.js";
|
|
28
|
+
export * from "./getWidgetAttribute.js";
|
|
29
|
+
export * from "./hits-absolute-position.js";
|
|
30
|
+
export * from "./hits-query-id.js";
|
|
31
|
+
export * from "./isDomElement.js";
|
|
32
|
+
export * from "./isEqual.js";
|
|
33
|
+
export * from "./isFacetRefined.js";
|
|
34
|
+
export * from "./isFiniteNumber.js";
|
|
35
|
+
export * from "./isPlainObject.js";
|
|
36
|
+
export * from "./isSpecialClick.js";
|
|
37
|
+
export * from "./logger.js";
|
|
38
|
+
export * from "./mergeSearchParameters.js";
|
|
39
|
+
export * from "./noop.js";
|
|
40
|
+
export * from "./prepareTemplateProps.js";
|
|
41
|
+
export * from "./range.js";
|
|
42
|
+
export * from "./renderTemplate.js";
|
|
43
|
+
export * from "./resolveSearchParameters.js";
|
|
44
|
+
export * from "./reverseHighlightedParts.js";
|
|
45
|
+
export * from "./safelyRunOnBrowser.js";
|
|
46
|
+
export * from "./serializer.js";
|
|
47
|
+
export * from "./toArray.js";
|
|
48
|
+
export * from "./uniq.js";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function isDomElement(object: any): object is HTMLElement;
|
|
2
|
-
export default isDomElement;
|
|
1
|
+
export declare function isDomElement(object: any): object is HTMLElement;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function isEqual(first: any, second: any): boolean;
|
|
2
|
-
export default isEqual;
|
|
1
|
+
export declare function isEqual(first: any, second: any): boolean;
|
package/es/lib/utils/isEqual.js
CHANGED
|
@@ -2,7 +2,7 @@ function isPrimitive(obj) {
|
|
|
2
2
|
return obj !== Object(obj);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
function isEqual(first, second) {
|
|
5
|
+
export function isEqual(first, second) {
|
|
6
6
|
if (first === second) {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
|
@@ -28,6 +28,4 @@ function isEqual(first, second) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
return true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default isEqual;
|
|
31
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
|
|
2
|
-
export
|
|
2
|
+
export declare function isFacetRefined(helper: AlgoliaSearchHelper, facet: string, value: string): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function isFacetRefined(helper, facet, value) {
|
|
2
2
|
if (helper.state.isHierarchicalFacet(facet)) {
|
|
3
3
|
return helper.state.isHierarchicalFacetRefined(facet, value);
|
|
4
4
|
} else if (helper.state.isConjunctiveFacet(facet)) {
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function isFiniteNumber(value: any): value is number;
|
|
2
|
-
export default isFiniteNumber;
|
|
1
|
+
export declare function isFiniteNumber(value: any): value is number;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// This is the `Number.isFinite()` polyfill recommended by MDN.
|
|
2
2
|
// We do not provide any tests for this function.
|
|
3
3
|
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill
|
|
4
|
-
|
|
4
|
+
// @MAJOR Replace with the native `Number.isFinite` method
|
|
5
|
+
export function isFiniteNumber(value) {
|
|
5
6
|
return typeof value === 'number' && isFinite(value);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default isFiniteNumber;
|
|
7
|
+
}
|
|
@@ -23,7 +23,7 @@ function isObjectLike(value) {
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
function isPlainObject(value) {
|
|
26
|
+
export function isPlainObject(value) {
|
|
27
27
|
if (!isObjectLike(value) || getTag(value) !== '[object Object]') {
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
@@ -39,6 +39,4 @@ function isPlainObject(value) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
return Object.getPrototypeOf(value) === proto;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default isPlainObject;
|
|
42
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function isSpecialClick(event: MouseEvent): boolean;
|
|
2
|
-
export default isSpecialClick;
|
|
1
|
+
export declare function isSpecialClick(event: MouseEvent): boolean;
|
package/es/lib/utils/logger.js
CHANGED
|
@@ -8,8 +8,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
8
8
|
|
|
9
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; }
|
|
10
10
|
|
|
11
|
-
import findIndex from "./findIndex.js";
|
|
12
|
-
import uniq from "./uniq.js";
|
|
11
|
+
import { findIndex } from "./findIndex.js";
|
|
12
|
+
import { uniq } from "./uniq.js";
|
|
13
13
|
|
|
14
14
|
var mergeWithRest = function mergeWithRest(left, right) {
|
|
15
15
|
var facets = right.facets,
|
|
@@ -107,7 +107,7 @@ var mergeRuleContexts = function mergeRuleContexts(left, right) {
|
|
|
107
107
|
return left;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
var
|
|
110
|
+
export var mergeSearchParameters = function mergeSearchParameters() {
|
|
111
111
|
for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
112
112
|
parameters[_key] = arguments[_key];
|
|
113
113
|
}
|
|
@@ -125,6 +125,4 @@ var merge = function merge() {
|
|
|
125
125
|
var facetsMerged = mergeFacets(ruleContextsMerged, right);
|
|
126
126
|
return mergeWithRest(facetsMerged, right);
|
|
127
127
|
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export default merge;
|
|
128
|
+
};
|
package/es/lib/utils/noop.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function noop(..._args: any[]): void;
|
|
2
|
-
export default noop;
|
|
1
|
+
export declare function noop(..._args: any[]): void;
|
package/es/lib/utils/noop.js
CHANGED
|
@@ -14,9 +14,9 @@ export declare type PreparedTemplateProps<TTemplates extends Templates> = {
|
|
|
14
14
|
/**
|
|
15
15
|
* Prepares an object to be passed to the Template widget
|
|
16
16
|
*/
|
|
17
|
-
declare function prepareTemplateProps<TTemplates extends Templates>({ defaultTemplates, templates, templatesConfig, }: {
|
|
17
|
+
export declare function prepareTemplateProps<TTemplates extends Templates>({ defaultTemplates, templates, templatesConfig, }: {
|
|
18
18
|
defaultTemplates: TTemplates;
|
|
19
19
|
templates?: Partial<TTemplates>;
|
|
20
20
|
templatesConfig: TemplatesConfig;
|
|
21
21
|
}): PreparedTemplateProps<TTemplates>;
|
|
22
|
-
export
|
|
22
|
+
export {};
|
|
@@ -16,7 +16,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
import uniq from "./uniq.js";
|
|
19
|
+
import { uniq } from "./uniq.js";
|
|
20
20
|
|
|
21
21
|
function prepareTemplates( // can not use = {} here, since the template could have different constraints
|
|
22
22
|
defaultTemplates) {
|
|
@@ -42,7 +42,7 @@ defaultTemplates) {
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
function prepareTemplateProps(_ref) {
|
|
45
|
+
export function prepareTemplateProps(_ref) {
|
|
46
46
|
var defaultTemplates = _ref.defaultTemplates,
|
|
47
47
|
templates = _ref.templates,
|
|
48
48
|
templatesConfig = _ref.templatesConfig;
|
|
@@ -50,6 +50,4 @@ function prepareTemplateProps(_ref) {
|
|
|
50
50
|
return _objectSpread({
|
|
51
51
|
templatesConfig: templatesConfig
|
|
52
52
|
}, preparedTemplates);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default prepareTemplateProps;
|
|
53
|
+
}
|
package/es/lib/utils/range.d.ts
CHANGED