@algolia/autocomplete-js 1.19.2 → 1.19.4
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.
|
@@ -6,5 +6,16 @@ export var LoadingIcon = function LoadingIcon(_ref) {
|
|
|
6
6
|
element.setAttribute('width', '20');
|
|
7
7
|
element.setAttribute('height', '20');
|
|
8
8
|
element.innerHTML = "<circle\n cx=\"50\"\n cy=\"50\"\n fill=\"none\"\n r=\"35\"\n stroke=\"currentColor\"\n stroke-dasharray=\"164.93361431346415 56.97787143782138\"\n stroke-width=\"6\"\n>\n <animateTransform\n attributeName=\"transform\"\n type=\"rotate\"\n repeatCount=\"indefinite\"\n dur=\"1s\"\n values=\"0 50 50;90 50 50;180 50 50;360 50 50\"\n keyTimes=\"0;0.40;0.65;1\"\n />\n</circle>";
|
|
9
|
+
var pauseAnimations = function pauseAnimations() {
|
|
10
|
+
// Wait until the element is in the DOM.
|
|
11
|
+
if (!element.parentElement) {
|
|
12
|
+
setTimeout(pauseAnimations, 0);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
element.pauseAnimations();
|
|
16
|
+
};
|
|
17
|
+
if ('pauseAnimations' in element) {
|
|
18
|
+
pauseAnimations();
|
|
19
|
+
}
|
|
9
20
|
return element;
|
|
10
21
|
};
|
package/dist/esm/render.js
CHANGED
|
@@ -32,6 +32,7 @@ export function renderSearchBox(_ref) {
|
|
|
32
32
|
setProperties(dom.loadingIndicator, {
|
|
33
33
|
hidden: state.status !== 'stalled'
|
|
34
34
|
});
|
|
35
|
+
toggleAnimation(dom.loadingIndicator, state.status === 'stalled');
|
|
35
36
|
setProperties(dom.clearButton, {
|
|
36
37
|
hidden: !state.query
|
|
37
38
|
});
|
|
@@ -42,6 +43,23 @@ export function renderSearchBox(_ref) {
|
|
|
42
43
|
hidden: Boolean(state.query)
|
|
43
44
|
});
|
|
44
45
|
}
|
|
46
|
+
|
|
47
|
+
// Safari will animate the SVG even when it's hidden. We need to pause the
|
|
48
|
+
// animation manually. See:
|
|
49
|
+
// - https://github.com/algolia/autocomplete/issues/1322
|
|
50
|
+
// - https://bugs.webkit.org/show_bug.cgi?id=298217
|
|
51
|
+
function toggleAnimation(element, isActive) {
|
|
52
|
+
var _element$firstChild;
|
|
53
|
+
var svgElement = ((_element$firstChild = element.firstChild) === null || _element$firstChild === void 0 ? void 0 : _element$firstChild.nodeName) === 'svg' ? element.firstChild : null;
|
|
54
|
+
if (!svgElement || !svgElement.pauseAnimations || !svgElement.unpauseAnimations) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (isActive) {
|
|
58
|
+
svgElement.unpauseAnimations();
|
|
59
|
+
} else {
|
|
60
|
+
svgElement.pauseAnimations();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
45
63
|
export function renderPanel(render, _ref2) {
|
|
46
64
|
var autocomplete = _ref2.autocomplete,
|
|
47
65
|
autocompleteScopeApi = _ref2.autocompleteScopeApi,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-js 1.19.
|
|
1
|
+
/*! @algolia/autocomplete-js 1.19.4 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -347,7 +347,7 @@
|
|
|
347
347
|
return undefined;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
var version = '1.19.
|
|
350
|
+
var version = '1.19.4';
|
|
351
351
|
|
|
352
352
|
var userAgents$1 = [{
|
|
353
353
|
segment: 'autocomplete-core',
|
|
@@ -3841,6 +3841,17 @@
|
|
|
3841
3841
|
element.setAttribute('width', '20');
|
|
3842
3842
|
element.setAttribute('height', '20');
|
|
3843
3843
|
element.innerHTML = "<circle\n cx=\"50\"\n cy=\"50\"\n fill=\"none\"\n r=\"35\"\n stroke=\"currentColor\"\n stroke-dasharray=\"164.93361431346415 56.97787143782138\"\n stroke-width=\"6\"\n>\n <animateTransform\n attributeName=\"transform\"\n type=\"rotate\"\n repeatCount=\"indefinite\"\n dur=\"1s\"\n values=\"0 50 50;90 50 50;180 50 50;360 50 50\"\n keyTimes=\"0;0.40;0.65;1\"\n />\n</circle>";
|
|
3844
|
+
var pauseAnimations = function pauseAnimations() {
|
|
3845
|
+
// Wait until the element is in the DOM.
|
|
3846
|
+
if (!element.parentElement) {
|
|
3847
|
+
setTimeout(pauseAnimations, 0);
|
|
3848
|
+
return;
|
|
3849
|
+
}
|
|
3850
|
+
element.pauseAnimations();
|
|
3851
|
+
};
|
|
3852
|
+
if ('pauseAnimations' in element) {
|
|
3853
|
+
pauseAnimations();
|
|
3854
|
+
}
|
|
3844
3855
|
return element;
|
|
3845
3856
|
};
|
|
3846
3857
|
|
|
@@ -4887,6 +4898,7 @@
|
|
|
4887
4898
|
setProperties(dom.loadingIndicator, {
|
|
4888
4899
|
hidden: state.status !== 'stalled'
|
|
4889
4900
|
});
|
|
4901
|
+
toggleAnimation(dom.loadingIndicator, state.status === 'stalled');
|
|
4890
4902
|
setProperties(dom.clearButton, {
|
|
4891
4903
|
hidden: !state.query
|
|
4892
4904
|
});
|
|
@@ -4897,6 +4909,23 @@
|
|
|
4897
4909
|
hidden: Boolean(state.query)
|
|
4898
4910
|
});
|
|
4899
4911
|
}
|
|
4912
|
+
|
|
4913
|
+
// Safari will animate the SVG even when it's hidden. We need to pause the
|
|
4914
|
+
// animation manually. See:
|
|
4915
|
+
// - https://github.com/algolia/autocomplete/issues/1322
|
|
4916
|
+
// - https://bugs.webkit.org/show_bug.cgi?id=298217
|
|
4917
|
+
function toggleAnimation(element, isActive) {
|
|
4918
|
+
var _element$firstChild;
|
|
4919
|
+
var svgElement = ((_element$firstChild = element.firstChild) === null || _element$firstChild === void 0 ? void 0 : _element$firstChild.nodeName) === 'svg' ? element.firstChild : null;
|
|
4920
|
+
if (!svgElement || !svgElement.pauseAnimations || !svgElement.unpauseAnimations) {
|
|
4921
|
+
return;
|
|
4922
|
+
}
|
|
4923
|
+
if (isActive) {
|
|
4924
|
+
svgElement.unpauseAnimations();
|
|
4925
|
+
} else {
|
|
4926
|
+
svgElement.pauseAnimations();
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4900
4929
|
function renderPanel(render, _ref2) {
|
|
4901
4930
|
var autocomplete = _ref2.autocomplete,
|
|
4902
4931
|
autocompleteScopeApi = _ref2.autocompleteScopeApi,
|