instantsearch.js 4.54.0 → 4.54.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/cjs/components/Pagination/Pagination.js +35 -17
- package/cjs/components/Template/Template.js +6 -3
- package/cjs/helpers/highlight.js +5 -0
- package/cjs/helpers/reverseHighlight.js +5 -0
- package/cjs/helpers/reverseSnippet.js +5 -0
- package/cjs/helpers/snippet.js +5 -0
- package/cjs/lib/server.js +60 -0
- package/cjs/lib/utils/index.js +11 -0
- package/cjs/lib/utils/walkIndex.js +18 -0
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/pagination/pagination.js +51 -39
- package/cjs/widgets/panel/panel.js +0 -2
- package/dist/instantsearch.development.d.ts +27 -4
- package/dist/instantsearch.development.js +112 -63
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +27 -4
- package/dist/instantsearch.production.min.d.ts +27 -4
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Pagination/Pagination.js +34 -17
- package/es/components/Panel/Panel.d.ts +1 -1
- package/es/components/Template/Template.js +6 -3
- package/es/helpers/highlight.d.ts +3 -0
- package/es/helpers/highlight.js +5 -0
- package/es/helpers/reverseHighlight.d.ts +3 -0
- package/es/helpers/reverseHighlight.js +5 -0
- package/es/helpers/reverseSnippet.d.ts +3 -0
- package/es/helpers/reverseSnippet.js +5 -0
- package/es/helpers/snippet.d.ts +3 -0
- package/es/helpers/snippet.js +5 -0
- package/es/lib/server.d.ts +10 -0
- package/es/lib/server.js +53 -0
- package/es/lib/utils/index.d.ts +1 -0
- package/es/lib/utils/index.js +1 -0
- package/es/lib/utils/walkIndex.d.ts +5 -0
- package/es/lib/utils/walkIndex.js +12 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/pagination/pagination.d.ts +12 -5
- package/es/widgets/pagination/pagination.js +51 -39
- package/es/widgets/panel/panel.js +0 -2
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.54.
|
|
1
|
+
/*! InstantSearch.js 4.54.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -11707,6 +11707,10 @@
|
|
|
11707
11707
|
};
|
|
11708
11708
|
|
|
11709
11709
|
var suit = component('Highlight');
|
|
11710
|
+
|
|
11711
|
+
/**
|
|
11712
|
+
* @deprecated use html tagged templates and the Highlight component instead
|
|
11713
|
+
*/
|
|
11710
11714
|
function highlight(_ref) {
|
|
11711
11715
|
var attribute = _ref.attribute,
|
|
11712
11716
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -11714,6 +11718,7 @@
|
|
|
11714
11718
|
hit = _ref.hit,
|
|
11715
11719
|
_ref$cssClasses = _ref.cssClasses,
|
|
11716
11720
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11721
|
+
_warning(false, "`instantsearch.highlight` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `Highlight` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") ;
|
|
11717
11722
|
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);
|
|
11718
11723
|
|
|
11719
11724
|
// @MAJOR fallback to attribute value if highlight is not found
|
|
@@ -11730,6 +11735,10 @@
|
|
|
11730
11735
|
}
|
|
11731
11736
|
|
|
11732
11737
|
var suit$1 = component('ReverseHighlight');
|
|
11738
|
+
|
|
11739
|
+
/**
|
|
11740
|
+
* @deprecated use html tagged templates and the ReverseHighlight component instead
|
|
11741
|
+
*/
|
|
11733
11742
|
function reverseHighlight(_ref) {
|
|
11734
11743
|
var attribute = _ref.attribute,
|
|
11735
11744
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -11737,6 +11746,7 @@
|
|
|
11737
11746
|
hit = _ref.hit,
|
|
11738
11747
|
_ref$cssClasses = _ref.cssClasses,
|
|
11739
11748
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11749
|
+
_warning(false, "`instantsearch.reverseHighlight` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `ReverseHighlight` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") ;
|
|
11740
11750
|
var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);
|
|
11741
11751
|
|
|
11742
11752
|
// @MAJOR fallback to attribute value if highlight is not found
|
|
@@ -11754,6 +11764,10 @@
|
|
|
11754
11764
|
}
|
|
11755
11765
|
|
|
11756
11766
|
var suit$2 = component('Snippet');
|
|
11767
|
+
|
|
11768
|
+
/**
|
|
11769
|
+
* @deprecated use html tagged templates and the Snippet component instead
|
|
11770
|
+
*/
|
|
11757
11771
|
function snippet(_ref) {
|
|
11758
11772
|
var attribute = _ref.attribute,
|
|
11759
11773
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -11761,6 +11775,7 @@
|
|
|
11761
11775
|
hit = _ref.hit,
|
|
11762
11776
|
_ref$cssClasses = _ref.cssClasses,
|
|
11763
11777
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11778
|
+
_warning(false, "`instantsearch.snippet` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `Snippet` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") ;
|
|
11764
11779
|
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);
|
|
11765
11780
|
|
|
11766
11781
|
// @MAJOR fallback to attribute value if snippet is not found
|
|
@@ -11777,6 +11792,10 @@
|
|
|
11777
11792
|
}
|
|
11778
11793
|
|
|
11779
11794
|
var suit$3 = component('ReverseSnippet');
|
|
11795
|
+
|
|
11796
|
+
/**
|
|
11797
|
+
* @deprecated use html tagged templates and the ReverseSnippet component instead
|
|
11798
|
+
*/
|
|
11780
11799
|
function reverseSnippet(_ref) {
|
|
11781
11800
|
var attribute = _ref.attribute,
|
|
11782
11801
|
_ref$highlightedTagNa = _ref.highlightedTagName,
|
|
@@ -11784,6 +11803,7 @@
|
|
|
11784
11803
|
hit = _ref.hit,
|
|
11785
11804
|
_ref$cssClasses = _ref.cssClasses,
|
|
11786
11805
|
cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;
|
|
11806
|
+
_warning(false, "`instantsearch.reverseSnippet` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `ReverseSnippet` component.\n\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates") ;
|
|
11787
11807
|
var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);
|
|
11788
11808
|
|
|
11789
11809
|
// @MAJOR fallback to attribute value if snippet is not found
|
|
@@ -13640,7 +13660,7 @@
|
|
|
13640
13660
|
};
|
|
13641
13661
|
}
|
|
13642
13662
|
|
|
13643
|
-
var version$1 = '4.54.
|
|
13663
|
+
var version$1 = '4.54.1';
|
|
13644
13664
|
|
|
13645
13665
|
var withUsage$r = createDocumentationMessageGenerator({
|
|
13646
13666
|
name: 'instantsearch'
|
|
@@ -15535,9 +15555,12 @@
|
|
|
15535
15555
|
key: "render",
|
|
15536
15556
|
value: function render() {
|
|
15537
15557
|
var _this = this;
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15558
|
+
{
|
|
15559
|
+
var nonFunctionTemplates = Object.keys(this.props.templates).filter(function (key) {
|
|
15560
|
+
return typeof _this.props.templates[key] !== 'function';
|
|
15561
|
+
});
|
|
15562
|
+
_warning(nonFunctionTemplates.length === 0, "Hogan.js and string-based templates are deprecated and will not be supported in InstantSearch.js 5.x.\n\nYou can replace them with function-form templates and use either the provided `html` function or JSX templates.\n\nString-based templates: ".concat(nonFunctionTemplates.join(', '), ".\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/#upgrade-templates")) ;
|
|
15563
|
+
}
|
|
15541
15564
|
var RootTagName = this.props.rootTagName;
|
|
15542
15565
|
var useCustomCompileOptions = this.props.useCustomCompileOptions[this.props.templateKey];
|
|
15543
15566
|
var compileOptions = useCustomCompileOptions ? this.props.templatesConfig.compileOptions : {};
|
|
@@ -18256,7 +18279,8 @@
|
|
|
18256
18279
|
ariaLabel: "First",
|
|
18257
18280
|
className: props.cssClasses.firstPageItem,
|
|
18258
18281
|
isDisabled: props.isFirstPage,
|
|
18259
|
-
|
|
18282
|
+
templates: props.templates,
|
|
18283
|
+
templateKey: "first",
|
|
18260
18284
|
pageNumber: 0,
|
|
18261
18285
|
createURL: props.createURL,
|
|
18262
18286
|
cssClasses: props.cssClasses,
|
|
@@ -18265,7 +18289,8 @@
|
|
|
18265
18289
|
ariaLabel: "Previous",
|
|
18266
18290
|
className: props.cssClasses.previousPageItem,
|
|
18267
18291
|
isDisabled: props.isFirstPage,
|
|
18268
|
-
|
|
18292
|
+
templates: props.templates,
|
|
18293
|
+
templateKey: "previous",
|
|
18269
18294
|
pageNumber: props.currentPage - 1,
|
|
18270
18295
|
createURL: props.createURL,
|
|
18271
18296
|
cssClasses: props.cssClasses,
|
|
@@ -18276,7 +18301,8 @@
|
|
|
18276
18301
|
ariaLabel: "Page ".concat(pageNumber + 1),
|
|
18277
18302
|
className: props.cssClasses.pageItem,
|
|
18278
18303
|
isSelected: pageNumber === props.currentPage,
|
|
18279
|
-
|
|
18304
|
+
templates: props.templates,
|
|
18305
|
+
templateKey: "page",
|
|
18280
18306
|
pageNumber: pageNumber,
|
|
18281
18307
|
createURL: props.createURL,
|
|
18282
18308
|
cssClasses: props.cssClasses,
|
|
@@ -18286,7 +18312,8 @@
|
|
|
18286
18312
|
ariaLabel: "Next",
|
|
18287
18313
|
className: props.cssClasses.nextPageItem,
|
|
18288
18314
|
isDisabled: props.isLastPage,
|
|
18289
|
-
|
|
18315
|
+
templates: props.templates,
|
|
18316
|
+
templateKey: "next",
|
|
18290
18317
|
pageNumber: props.currentPage + 1,
|
|
18291
18318
|
createURL: props.createURL,
|
|
18292
18319
|
cssClasses: props.cssClasses,
|
|
@@ -18295,7 +18322,8 @@
|
|
|
18295
18322
|
ariaLabel: "Last",
|
|
18296
18323
|
className: props.cssClasses.lastPageItem,
|
|
18297
18324
|
isDisabled: props.isLastPage,
|
|
18298
|
-
|
|
18325
|
+
templates: props.templates,
|
|
18326
|
+
templateKey: "last",
|
|
18299
18327
|
pageNumber: props.nbPages - 1,
|
|
18300
18328
|
createURL: props.createURL,
|
|
18301
18329
|
cssClasses: props.cssClasses,
|
|
@@ -18303,7 +18331,8 @@
|
|
|
18303
18331
|
})));
|
|
18304
18332
|
}
|
|
18305
18333
|
function PaginationLink(_ref) {
|
|
18306
|
-
var
|
|
18334
|
+
var templates = _ref.templates,
|
|
18335
|
+
templateKey = _ref.templateKey,
|
|
18307
18336
|
ariaLabel = _ref.ariaLabel,
|
|
18308
18337
|
pageNumber = _ref.pageNumber,
|
|
18309
18338
|
className = _ref.className,
|
|
@@ -18316,18 +18345,28 @@
|
|
|
18316
18345
|
createClickHandler = _ref.createClickHandler;
|
|
18317
18346
|
return h("li", {
|
|
18318
18347
|
className: cx(cssClasses.item, className, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem)
|
|
18319
|
-
}, isDisabled ? h(
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18348
|
+
}, isDisabled ? h(Template, {
|
|
18349
|
+
rootTagName: "span",
|
|
18350
|
+
rootProps: {
|
|
18351
|
+
className: cssClasses.link
|
|
18352
|
+
},
|
|
18353
|
+
templateKey: templateKey,
|
|
18354
|
+
templates: templates,
|
|
18355
|
+
data: {
|
|
18356
|
+
page: pageNumber + 1
|
|
18323
18357
|
}
|
|
18324
|
-
}) : h(
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
|
|
18358
|
+
}) : h(Template, {
|
|
18359
|
+
rootTagName: "a",
|
|
18360
|
+
rootProps: {
|
|
18361
|
+
className: cssClasses.link,
|
|
18362
|
+
'aria-label': ariaLabel,
|
|
18363
|
+
href: createURL(pageNumber),
|
|
18364
|
+
onClick: createClickHandler(pageNumber)
|
|
18365
|
+
},
|
|
18366
|
+
templateKey: templateKey,
|
|
18367
|
+
templates: templates,
|
|
18368
|
+
data: {
|
|
18369
|
+
page: pageNumber + 1
|
|
18331
18370
|
}
|
|
18332
18371
|
}));
|
|
18333
18372
|
}
|
|
@@ -18337,28 +18376,40 @@
|
|
|
18337
18376
|
name: 'pagination'
|
|
18338
18377
|
});
|
|
18339
18378
|
var defaultTemplates$a = {
|
|
18340
|
-
previous:
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18379
|
+
previous: function previous() {
|
|
18380
|
+
return '‹';
|
|
18381
|
+
},
|
|
18382
|
+
next: function next() {
|
|
18383
|
+
return '›';
|
|
18384
|
+
},
|
|
18385
|
+
page: function page(_ref) {
|
|
18386
|
+
var _page = _ref.page;
|
|
18387
|
+
return "".concat(_page);
|
|
18388
|
+
},
|
|
18389
|
+
first: function first() {
|
|
18390
|
+
return '«';
|
|
18391
|
+
},
|
|
18392
|
+
last: function last() {
|
|
18393
|
+
return '»';
|
|
18394
|
+
}
|
|
18344
18395
|
};
|
|
18345
|
-
var renderer$c = function renderer(
|
|
18346
|
-
var containerNode =
|
|
18347
|
-
cssClasses =
|
|
18348
|
-
templates =
|
|
18349
|
-
showFirst =
|
|
18350
|
-
showLast =
|
|
18351
|
-
showPrevious =
|
|
18352
|
-
showNext =
|
|
18353
|
-
scrollToNode =
|
|
18354
|
-
return function (
|
|
18355
|
-
var createURL =
|
|
18356
|
-
currentRefinement =
|
|
18357
|
-
nbPages =
|
|
18358
|
-
pages =
|
|
18359
|
-
isFirstPage =
|
|
18360
|
-
isLastPage =
|
|
18361
|
-
refine =
|
|
18396
|
+
var renderer$c = function renderer(_ref2) {
|
|
18397
|
+
var containerNode = _ref2.containerNode,
|
|
18398
|
+
cssClasses = _ref2.cssClasses,
|
|
18399
|
+
templates = _ref2.templates,
|
|
18400
|
+
showFirst = _ref2.showFirst,
|
|
18401
|
+
showLast = _ref2.showLast,
|
|
18402
|
+
showPrevious = _ref2.showPrevious,
|
|
18403
|
+
showNext = _ref2.showNext,
|
|
18404
|
+
scrollToNode = _ref2.scrollToNode;
|
|
18405
|
+
return function (_ref3, isFirstRendering) {
|
|
18406
|
+
var createURL = _ref3.createURL,
|
|
18407
|
+
currentRefinement = _ref3.currentRefinement,
|
|
18408
|
+
nbPages = _ref3.nbPages,
|
|
18409
|
+
pages = _ref3.pages,
|
|
18410
|
+
isFirstPage = _ref3.isFirstPage,
|
|
18411
|
+
isLastPage = _ref3.isLastPage,
|
|
18412
|
+
refine = _ref3.refine;
|
|
18362
18413
|
if (isFirstRendering) return;
|
|
18363
18414
|
var setCurrentPage = function setCurrentPage(pageNumber) {
|
|
18364
18415
|
refine(pageNumber);
|
|
@@ -18384,24 +18435,24 @@
|
|
|
18384
18435
|
};
|
|
18385
18436
|
};
|
|
18386
18437
|
var pagination = function pagination(widgetParams) {
|
|
18387
|
-
var
|
|
18388
|
-
container =
|
|
18389
|
-
|
|
18390
|
-
userTemplates =
|
|
18391
|
-
|
|
18392
|
-
userCssClasses =
|
|
18393
|
-
totalPages =
|
|
18394
|
-
padding =
|
|
18395
|
-
|
|
18396
|
-
showFirst =
|
|
18397
|
-
|
|
18398
|
-
showLast =
|
|
18399
|
-
|
|
18400
|
-
showPrevious =
|
|
18401
|
-
|
|
18402
|
-
showNext =
|
|
18403
|
-
|
|
18404
|
-
userScrollTo =
|
|
18438
|
+
var _ref4 = widgetParams || {},
|
|
18439
|
+
container = _ref4.container,
|
|
18440
|
+
_ref4$templates = _ref4.templates,
|
|
18441
|
+
userTemplates = _ref4$templates === void 0 ? {} : _ref4$templates,
|
|
18442
|
+
_ref4$cssClasses = _ref4.cssClasses,
|
|
18443
|
+
userCssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses,
|
|
18444
|
+
totalPages = _ref4.totalPages,
|
|
18445
|
+
padding = _ref4.padding,
|
|
18446
|
+
_ref4$showFirst = _ref4.showFirst,
|
|
18447
|
+
showFirst = _ref4$showFirst === void 0 ? true : _ref4$showFirst,
|
|
18448
|
+
_ref4$showLast = _ref4.showLast,
|
|
18449
|
+
showLast = _ref4$showLast === void 0 ? true : _ref4$showLast,
|
|
18450
|
+
_ref4$showPrevious = _ref4.showPrevious,
|
|
18451
|
+
showPrevious = _ref4$showPrevious === void 0 ? true : _ref4$showPrevious,
|
|
18452
|
+
_ref4$showNext = _ref4.showNext,
|
|
18453
|
+
showNext = _ref4$showNext === void 0 ? true : _ref4$showNext,
|
|
18454
|
+
_ref4$scrollTo = _ref4.scrollTo,
|
|
18455
|
+
userScrollTo = _ref4$scrollTo === void 0 ? 'body' : _ref4$scrollTo;
|
|
18405
18456
|
if (!container) {
|
|
18406
18457
|
throw new Error(withUsage$G('The `container` option is required.'));
|
|
18407
18458
|
}
|
|
@@ -18619,8 +18670,6 @@
|
|
|
18619
18670
|
}
|
|
18620
18671
|
var containerNode = getContainerNode(widgetParams.container);
|
|
18621
18672
|
var defaultTemplates = {
|
|
18622
|
-
header: '',
|
|
18623
|
-
footer: '',
|
|
18624
18673
|
collapseButtonText: function collapseButtonText(_ref4) {
|
|
18625
18674
|
var isCollapsed = _ref4.collapsed;
|
|
18626
18675
|
return "<svg\n class=\"".concat(cssClasses.collapseIcon, "\"\n style=\"width: 1em; height: 1em;\"\n viewBox=\"0 0 500 500\"\n >\n <path d=\"").concat(isCollapsed ? 'M100 250l300-150v300z' : 'M250 400l150-300H100z', "\" fill=\"currentColor\" />\n </svg>");
|