@algolia/autocomplete-js 1.19.2 → 1.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.2 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.19.3 | 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.2';
350
+ var version = '1.19.3';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -4887,6 +4887,7 @@
4887
4887
  setProperties(dom.loadingIndicator, {
4888
4888
  hidden: state.status !== 'stalled'
4889
4889
  });
4890
+ toggleAnimation(dom.loadingIndicator, state.status === 'stalled');
4890
4891
  setProperties(dom.clearButton, {
4891
4892
  hidden: !state.query
4892
4893
  });
@@ -4897,6 +4898,23 @@
4897
4898
  hidden: Boolean(state.query)
4898
4899
  });
4899
4900
  }
4901
+
4902
+ // Safari will animate the SVG even when it's hidden. We need to pause the
4903
+ // animation manually. See:
4904
+ // - https://github.com/algolia/autocomplete/issues/1322
4905
+ // - https://bugs.webkit.org/show_bug.cgi?id=298217
4906
+ function toggleAnimation(element, isActive) {
4907
+ var _element$firstChild;
4908
+ var svgElement = ((_element$firstChild = element.firstChild) === null || _element$firstChild === void 0 ? void 0 : _element$firstChild.nodeName) === 'svg' ? element.firstChild : null;
4909
+ if (!svgElement || !svgElement.pauseAnimations || !svgElement.unpauseAnimations) {
4910
+ return;
4911
+ }
4912
+ if (isActive) {
4913
+ svgElement.unpauseAnimations();
4914
+ } else {
4915
+ svgElement.pauseAnimations();
4916
+ }
4917
+ }
4900
4918
  function renderPanel(render, _ref2) {
4901
4919
  var autocomplete = _ref2.autocomplete,
4902
4920
  autocompleteScopeApi = _ref2.autocompleteScopeApi,