@docsearch/react
Advanced tools
Comparing version 3.0.0-alpha.37 to 3.0.0-alpha.38
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
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); } | ||
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; } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
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; } | ||
@@ -19,3 +7,3 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import React, { useMemo } from 'react'; | ||
import { ControlKeyIcon } from './icons/ControlKeyIcon'; | ||
@@ -39,12 +27,8 @@ import { SearchIcon } from './icons/SearchIcon'; | ||
buttonAriaLabel = _translations$buttonA === void 0 ? 'Search' : _translations$buttonA; | ||
var _useState = useState(null), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
key = _useState2[0], | ||
setKey = _useState2[1]; | ||
useEffect(function () { | ||
var key = useMemo(function () { | ||
if (typeof navigator !== 'undefined') { | ||
setKey(isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT); | ||
return isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT; | ||
} | ||
return null; | ||
}, []); | ||
@@ -51,0 +35,0 @@ return /*#__PURE__*/React.createElement("button", _extends({ |
@@ -175,10 +175,14 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
return searchClient.initIndex(indexName).search(query, _objectSpread({ | ||
attributesToRetrieve: ['hierarchy.lvl0', 'hierarchy.lvl1', 'hierarchy.lvl2', 'hierarchy.lvl3', 'hierarchy.lvl4', 'hierarchy.lvl5', 'hierarchy.lvl6', 'content', 'type', 'url'], | ||
attributesToSnippet: ["hierarchy.lvl1:".concat(snippetLength.current), "hierarchy.lvl2:".concat(snippetLength.current), "hierarchy.lvl3:".concat(snippetLength.current), "hierarchy.lvl4:".concat(snippetLength.current), "hierarchy.lvl5:".concat(snippetLength.current), "hierarchy.lvl6:".concat(snippetLength.current), "content:".concat(snippetLength.current)], | ||
snippetEllipsisText: '…', | ||
highlightPreTag: '<mark>', | ||
highlightPostTag: '</mark>', | ||
hitsPerPage: 20 | ||
}, searchParameters)).catch(function (error) { | ||
return searchClient.search([{ | ||
query: query, | ||
indexName: indexName, | ||
params: _objectSpread({ | ||
attributesToRetrieve: ['hierarchy.lvl0', 'hierarchy.lvl1', 'hierarchy.lvl2', 'hierarchy.lvl3', 'hierarchy.lvl4', 'hierarchy.lvl5', 'hierarchy.lvl6', 'content', 'type', 'url'], | ||
attributesToSnippet: ["hierarchy.lvl1:".concat(snippetLength.current), "hierarchy.lvl2:".concat(snippetLength.current), "hierarchy.lvl3:".concat(snippetLength.current), "hierarchy.lvl4:".concat(snippetLength.current), "hierarchy.lvl5:".concat(snippetLength.current), "hierarchy.lvl6:".concat(snippetLength.current), "content:".concat(snippetLength.current)], | ||
snippetEllipsisText: '…', | ||
highlightPreTag: '<mark>', | ||
highlightPostTag: '</mark>', | ||
hitsPerPage: 20 | ||
}, searchParameters) | ||
}]).catch(function (error) { | ||
// The Algolia `RetryError` happens when all the servers have | ||
@@ -194,4 +198,6 @@ // failed, meaning that there's no chance the response comes | ||
}).then(function (_ref8) { | ||
var hits = _ref8.hits, | ||
nbHits = _ref8.nbHits; | ||
var results = _ref8.results; | ||
var _results$ = results[0], | ||
hits = _results$.hits, | ||
nbHits = _results$.nbHits; | ||
var sources = groupBy(hits, function (hit) { | ||
@@ -198,0 +204,0 @@ return removeHighlightTags(hit); |
@@ -1,1 +0,1 @@ | ||
export declare const version = "3.0.0-alpha.37"; | ||
export declare const version = "3.0.0-alpha.38"; |
@@ -1,1 +0,1 @@ | ||
export var version = '3.0.0-alpha.37'; | ||
export var version = '3.0.0-alpha.38'; |
{ | ||
"name": "@docsearch/react", | ||
"description": "React package for DocSearch, the best search experience for docs.", | ||
"version": "3.0.0-alpha.37", | ||
"version": "3.0.0-alpha.38", | ||
"license": "MIT", | ||
@@ -39,3 +39,3 @@ "homepage": "https://docsearch.algolia.com", | ||
"@algolia/autocomplete-preset-algolia": "1.2.1", | ||
"@docsearch/css": "3.0.0-alpha.37", | ||
"@docsearch/css": "3.0.0-alpha.38", | ||
"algoliasearch": "^4.0.0" | ||
@@ -42,0 +42,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
383728
1939
+ Added@docsearch/css@3.0.0-alpha.38(transitive)
- Removed@docsearch/css@3.0.0-alpha.37(transitive)