initial vitepress site with basic nav

This commit is contained in:
mrflos 2023-05-20 19:37:42 +03:00
parent a7df2e049d
commit 2029f16583
1900 changed files with 1014692 additions and 0 deletions

41
.vitepress/cache/deps/@theme_index.js vendored Normal file
View file

@ -0,0 +1,41 @@
// node_modules/vitepress/dist/client/theme-default/index.js
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/fonts.css";
// node_modules/vitepress/dist/client/theme-default/without-fonts.js
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/vars.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/base.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/utils.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/components/custom-block.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/components/vp-code-group.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/components/vp-doc.css";
import "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/styles/components/vp-sponsor.css";
import VPBadge from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPBadge.vue";
import Layout from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/Layout.vue";
import { default as default2 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPHomeHero.vue";
import { default as default3 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPHomeFeatures.vue";
import { default as default4 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPHomeSponsors.vue";
import { default as default5 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPDocAsideSponsors.vue";
import { default as default6 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPTeamPage.vue";
import { default as default7 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageTitle.vue";
import { default as default8 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPTeamPageSection.vue";
import { default as default9 } from "/home/mrflos/Developpements/vitepress/node_modules/vitepress/dist/client/theme-default/components/VPTeamMembers.vue";
var theme = {
Layout,
enhanceApp: ({ app }) => {
app.component("Badge", VPBadge);
}
};
var without_fonts_default = theme;
export {
default5 as VPDocAsideSponsors,
default3 as VPHomeFeatures,
default2 as VPHomeHero,
default4 as VPHomeSponsors,
default9 as VPTeamMembers,
default6 as VPTeamPage,
default8 as VPTeamPageSection,
default7 as VPTeamPageTitle,
without_fonts_default as default
};
//# sourceMappingURL=@theme_index.js.map

View file

@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../node_modules/vitepress/dist/client/theme-default/index.js", "../../../node_modules/vitepress/dist/client/theme-default/without-fonts.js"],
"sourcesContent": ["import './styles/fonts.css';\nexport * from './without-fonts';\nexport { default as default } from './without-fonts';\n", "import './styles/vars.css';\nimport './styles/base.css';\nimport './styles/utils.css';\nimport './styles/components/custom-block.css';\nimport './styles/components/vp-code.css';\nimport './styles/components/vp-code-group.css';\nimport './styles/components/vp-doc.css';\nimport './styles/components/vp-sponsor.css';\nimport VPBadge from './components/VPBadge.vue';\nimport Layout from './Layout.vue';\n// Note: if we add more optional components here, i.e. components that are not\n// used in the theme by default unless the user imports them, make sure to update\n// the `lazyDefaultThemeComponentsRE` regex in src/node/build/bundle.ts.\nexport { default as VPHomeHero } from './components/VPHomeHero.vue';\nexport { default as VPHomeFeatures } from './components/VPHomeFeatures.vue';\nexport { default as VPHomeSponsors } from './components/VPHomeSponsors.vue';\nexport { default as VPDocAsideSponsors } from './components/VPDocAsideSponsors.vue';\nexport { default as VPTeamPage } from './components/VPTeamPage.vue';\nexport { default as VPTeamPageTitle } from './components/VPTeamPageTitle.vue';\nexport { default as VPTeamPageSection } from './components/VPTeamPageSection.vue';\nexport { default as VPTeamMembers } from './components/VPTeamMembers.vue';\nconst theme = {\n Layout,\n enhanceApp: ({ app }) => {\n app.component('Badge', VPBadge);\n }\n};\nexport default theme;\n"],
"mappings": ";AAAA,OAAO;;;ACAP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,aAAa;AACpB,OAAO,YAAY;AAInB,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAAgC;AACzC,IAAM,QAAQ;AAAA,EACV;AAAA,EACA,YAAY,CAAC,EAAE,IAAI,MAAM;AACrB,QAAI,UAAU,SAAS,OAAO;AAAA,EAClC;AACJ;AACA,IAAO,wBAAQ;",
"names": ["default"]
}

19
.vitepress/cache/deps/_metadata.json vendored Normal file
View file

@ -0,0 +1,19 @@
{
"hash": "2fe20fc4",
"browserHash": "d1e27008",
"optimized": {
"vue": {
"src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "cc5e1408",
"needsInterop": false
},
"@theme/index": {
"src": "../../../node_modules/vitepress/dist/client/theme-default/index.js",
"file": "@theme_index.js",
"fileHash": "067f7034",
"needsInterop": false
}
},
"chunks": {}
}

3
.vitepress/cache/deps/package.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"type": "module"
}

10795
.vitepress/cache/deps/vue.js vendored Normal file

File diff suppressed because it is too large Load diff

7
.vitepress/cache/deps/vue.js.map vendored Normal file

File diff suppressed because one or more lines are too long

52
.vitepress/config.ts Normal file
View file

@ -0,0 +1,52 @@
import { defineConfig } from 'vitepress'
// https://vitepress.dev/reference/site-config
export default defineConfig({
lang: 'fr-FR',
title: "Doc technique YesWiki.pro",
description: "Infrastructure et outils libres utilisés",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Infrastructure', link: '/infrastructure' },
{ text: 'Installation', link: '/installation' },
{ text: 'Aide mémoire', link: '/minio-cli' }
],
search: {
provider: 'local'
},
sidebar: [
{
text: 'Infrastructure',
items: [
{ text: 'Vue d\'ensemble', link: '/infrastructure' },
{ text: 'Hébergement yeswiki.pro', link: '/hebergement' },
{ text: 'Ferme à CLIC', link: '/ferme-clic' },
{ text: 'CLIC yeswiki.net', link: '/clic-yeswiki-net' },
{ text: 'Monitoring', link: '/monitoring' },
{ text: 'Sites', link: '/sites' }
]
},
{
text: 'Installation et configuration',
items: [
{ text: 'Vue d\'ensemble', link: '/installation' },
{ text: 'Proxmox', link: '/proxmox' },
{ text: 'Garage', link: '/garage' },
{ text: 'Yeswiki', link: '/yeswiki' },
{ text: 'Borgmatic', link: '/borgmatic' }
]
},
{
text: 'Aide Mémoire / Commandes',
items: [
{ text: 'Minio CLI', link: '/minio-cli' }
]
}
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
]
}
})

85
borgmatic.md Normal file
View file

@ -0,0 +1,85 @@
# Borgmatic
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

85
clic-yeswiki-net.md Normal file
View file

@ -0,0 +1,85 @@
# CLIC YesWiki.net
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

85
ferme-clic.md Normal file
View file

@ -0,0 +1,85 @@
# Ferme à CLIC
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

85
garage.md Normal file
View file

@ -0,0 +1,85 @@
# Garage
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

85
hebergement.md Normal file
View file

@ -0,0 +1,85 @@
# Hébergement
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

25
index.md Normal file
View file

@ -0,0 +1,25 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home
hero:
name: "Doc technique YesWiki.pro"
text: "Infrastructure et outils libres utilisés"
tagline: Un fourre tout numérique pour avoir une vue d'ensemble et retrouver les informations utiles à l'utilisation de cette infra.
actions:
- theme: brand
text: Infrastructure
link: /infrastructure
- theme: alt
text: Outils libres
link: /outils
# features:
# - title: Feature A
# details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
# - title: Feature B
# details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
# - title: Feature C
# details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

85
infrastructure.md Normal file
View file

@ -0,0 +1,85 @@
# Infrastructure
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

49
installation.md Normal file
View file

@ -0,0 +1,49 @@
---
outline: deep
---
# Installation et configuration
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
```md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```
<script setup>
import { useData } from 'vitepress'
const { site, theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
## More
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

28
minio-cli.md Normal file
View file

@ -0,0 +1,28 @@
---
outline: deep
---
# Minio CLI
Une interface en cli pour mettre des fichiers sur les buckets S3 de [Garage](./garage).
::: tip
Dans cette documentation, on renomme le programme `mc` en `s3` pour éviter des interférences avec midnight commander. Les commandes à taper peuvent donc différer en fonction de cela.
:::
## Installation
Exemple pour une architecture 64 bits Intel :
```bash
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o /usr/local/bin/s3
chmod +x /usr/local/bin/s3
```
## Commandes
## Liens utiles
- [Documentation](https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart)

85
monitoring.md Normal file
View file

@ -0,0 +1,85 @@
# Monitoring
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

1
node_modules/.bin/esbuild generated vendored Symbolic link
View file

@ -0,0 +1 @@
../esbuild/bin/esbuild

1
node_modules/.bin/nanoid generated vendored Symbolic link
View file

@ -0,0 +1 @@
../nanoid/bin/nanoid.cjs

1
node_modules/.bin/parser generated vendored Symbolic link
View file

@ -0,0 +1 @@
../@babel/parser/bin/babel-parser.js

1
node_modules/.bin/rollup generated vendored Symbolic link
View file

@ -0,0 +1 @@
../rollup/dist/bin/rollup

1
node_modules/.bin/vite generated vendored Symbolic link
View file

@ -0,0 +1 @@
../vite/bin/vite.js

1
node_modules/.bin/vitepress generated vendored Symbolic link
View file

@ -0,0 +1 @@
../vitepress/bin/vitepress.js

883
node_modules/.package-lock.json generated vendored Normal file
View file

@ -0,0 +1,883 @@
{
"name": "vitepress",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@algolia/autocomplete-core": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.8.2.tgz",
"integrity": "sha512-mTeshsyFhAqw/ebqNsQpMtbnjr+qVOSKXArEj4K0d7sqc8It1XD0gkASwecm9mF/jlOQ4Z9RNg1HbdA8JPdRwQ==",
"dev": true,
"dependencies": {
"@algolia/autocomplete-shared": "1.8.2"
}
},
"node_modules/@algolia/autocomplete-preset-algolia": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.8.2.tgz",
"integrity": "sha512-J0oTx4me6ZM9kIKPuL3lyU3aB8DEvpVvR6xWmHVROx5rOYJGQcZsdG4ozxwcOyiiu3qxMkIbzntnV1S1VWD8yA==",
"dev": true,
"dependencies": {
"@algolia/autocomplete-shared": "1.8.2"
},
"peerDependencies": {
"@algolia/client-search": ">= 4.9.1 < 6",
"algoliasearch": ">= 4.9.1 < 6"
}
},
"node_modules/@algolia/autocomplete-shared": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.8.2.tgz",
"integrity": "sha512-b6Z/X4MczChMcfhk6kfRmBzPgjoPzuS9KGR4AFsiLulLNRAAqhP+xZTKtMnZGhLuc61I20d5WqlId02AZvcO6g==",
"dev": true
},
"node_modules/@algolia/cache-browser-local-storage": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.17.0.tgz",
"integrity": "sha512-myRSRZDIMYB8uCkO+lb40YKiYHi0fjpWRtJpR/dgkaiBlSD0plRyB6lLOh1XIfmMcSeBOqDE7y9m8xZMrXYfyQ==",
"dev": true,
"dependencies": {
"@algolia/cache-common": "4.17.0"
}
},
"node_modules/@algolia/cache-common": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.17.0.tgz",
"integrity": "sha512-g8mXzkrcUBIPZaulAuqE7xyHhLAYAcF2xSch7d9dABheybaU3U91LjBX6eJTEB7XVhEsgK4Smi27vWtAJRhIKQ==",
"dev": true
},
"node_modules/@algolia/cache-in-memory": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.17.0.tgz",
"integrity": "sha512-PT32ciC/xI8z919d0oknWVu3kMfTlhQn3MKxDln3pkn+yA7F7xrxSALysxquv+MhFfNAcrtQ/oVvQVBAQSHtdw==",
"dev": true,
"dependencies": {
"@algolia/cache-common": "4.17.0"
}
},
"node_modules/@algolia/client-account": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.17.0.tgz",
"integrity": "sha512-sSEHx9GA6m7wrlsSMNBGfyzlIfDT2fkz2u7jqfCCd6JEEwmxt8emGmxAU/0qBfbhRSuGvzojoLJlr83BSZAKjA==",
"dev": true,
"dependencies": {
"@algolia/client-common": "4.17.0",
"@algolia/client-search": "4.17.0",
"@algolia/transporter": "4.17.0"
}
},
"node_modules/@algolia/client-analytics": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.17.0.tgz",
"integrity": "sha512-84ooP8QA3mQ958hQ9wozk7hFUbAO+81CX1CjAuerxBqjKIInh1fOhXKTaku05O/GHBvcfExpPLIQuSuLYziBXQ==",
"dev": true,
"dependencies": {
"@algolia/client-common": "4.17.0",
"@algolia/client-search": "4.17.0",
"@algolia/requester-common": "4.17.0",
"@algolia/transporter": "4.17.0"
}
},
"node_modules/@algolia/client-common": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.17.0.tgz",
"integrity": "sha512-jHMks0ZFicf8nRDn6ma8DNNsdwGgP/NKiAAL9z6rS7CymJ7L0+QqTJl3rYxRW7TmBhsUH40wqzmrG6aMIN/DrQ==",
"dev": true,
"dependencies": {
"@algolia/requester-common": "4.17.0",
"@algolia/transporter": "4.17.0"
}
},
"node_modules/@algolia/client-personalization": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-4.17.0.tgz",
"integrity": "sha512-RMzN4dZLIta1YuwT7QC9o+OeGz2cU6eTOlGNE/6RcUBLOU3l9tkCOdln5dPE2jp8GZXPl2yk54b2nSs1+pAjqw==",
"dev": true,
"dependencies": {
"@algolia/client-common": "4.17.0",
"@algolia/requester-common": "4.17.0",
"@algolia/transporter": "4.17.0"
}
},
"node_modules/@algolia/client-search": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.17.0.tgz",
"integrity": "sha512-x4P2wKrrRIXszT8gb7eWsMHNNHAJs0wE7/uqbufm4tZenAp+hwU/hq5KVsY50v+PfwM0LcDwwn/1DroujsTFoA==",
"dev": true,
"dependencies": {
"@algolia/client-common": "4.17.0",
"@algolia/requester-common": "4.17.0",
"@algolia/transporter": "4.17.0"
}
},
"node_modules/@algolia/logger-common": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.17.0.tgz",
"integrity": "sha512-DGuoZqpTmIKJFDeyAJ7M8E/LOenIjWiOsg1XJ1OqAU/eofp49JfqXxbfgctlVZVmDABIyOz8LqEoJ6ZP4DTyvw==",
"dev": true
},
"node_modules/@algolia/logger-console": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.17.0.tgz",
"integrity": "sha512-zMPvugQV/gbXUvWBCzihw6m7oxIKp48w37QBIUu/XqQQfxhjoOE9xyfJr1KldUt5FrYOKZJVsJaEjTsu+bIgQg==",
"dev": true,
"dependencies": {
"@algolia/logger-common": "4.17.0"
}
},
"node_modules/@algolia/requester-browser-xhr": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.17.0.tgz",
"integrity": "sha512-aSOX/smauyTkP21Pf52pJ1O2LmNFJ5iHRIzEeTh0mwBeADO4GdG94cAWDILFA9rNblq/nK3EDh3+UyHHjplZ1A==",
"dev": true,
"dependencies": {
"@algolia/requester-common": "4.17.0"
}
},
"node_modules/@algolia/requester-common": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.17.0.tgz",
"integrity": "sha512-XJjmWFEUlHu0ijvcHBoixuXfEoiRUdyzQM6YwTuB8usJNIgShua8ouFlRWF8iCeag0vZZiUm4S2WCVBPkdxFgg==",
"dev": true
},
"node_modules/@algolia/requester-node-http": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.17.0.tgz",
"integrity": "sha512-bpb/wDA1aC6WxxM8v7TsFspB7yBN3nqCGs2H1OADolQR/hiAIjAxusbuMxVbRFOdaUvAIqioIIkWvZdpYNIn8w==",
"dev": true,
"dependencies": {
"@algolia/requester-common": "4.17.0"
}
},
"node_modules/@algolia/transporter": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.17.0.tgz",
"integrity": "sha512-6xL6H6fe+Fi0AEP3ziSgC+G04RK37iRb4uUUqVAH9WPYFI8g+LYFq6iv5HS8Cbuc5TTut+Bwj6G+dh/asdb9uA==",
"dev": true,
"dependencies": {
"@algolia/cache-common": "4.17.0",
"@algolia/logger-common": "4.17.0",
"@algolia/requester-common": "4.17.0"
}
},
"node_modules/@babel/parser": {
"version": "7.21.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz",
"integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==",
"dev": true,
"bin": {
"parser": "bin/babel-parser.js"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@docsearch/css": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.3.5.tgz",
"integrity": "sha512-NaXVp3I8LdmJ54fn038KHgG7HmbIzZlKS2FkVf6mKcW5bYMJovkx4947joQyZk5yubxOZ+ddHSh79y39Aevufg==",
"dev": true
},
"node_modules/@docsearch/js": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.3.5.tgz",
"integrity": "sha512-nZi074OCryZnzva2LNcbQkwBJIND6cvuFI4s1FIe6Ygf6n9g6B/IYUULXNx05rpoCZ+KEoEt3taROpsHBliuSw==",
"dev": true,
"dependencies": {
"@docsearch/react": "3.3.5",
"preact": "^10.0.0"
}
},
"node_modules/@docsearch/react": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.3.5.tgz",
"integrity": "sha512-Zuxf4z5PZ9eIQkVCNu76v1H+KAztKItNn3rLzZa7kpBS+++TgNARITnZeUS7C1DKoAhJZFr6T/H+Lvc6h/iiYg==",
"dev": true,
"dependencies": {
"@algolia/autocomplete-core": "1.8.2",
"@algolia/autocomplete-preset-algolia": "1.8.2",
"@docsearch/css": "3.3.5",
"algoliasearch": "^4.0.0"
},
"peerDependencies": {
"@types/react": ">= 16.8.0 < 19.0.0",
"react": ">= 16.8.0 < 19.0.0",
"react-dom": ">= 16.8.0 < 19.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz",
"integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.15",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
"dev": true
},
"node_modules/@types/web-bluetooth": {
"version": "0.0.17",
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz",
"integrity": "sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==",
"dev": true
},
"node_modules/@vitejs/plugin-vue": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-4.2.3.tgz",
"integrity": "sha512-R6JDUfiZbJA9cMiguQ7jxALsgiprjBeHL5ikpXfJCH62pPHtI+JdJ5xWj6Ev73yXSlYl86+blXn1kZHQ7uElxw==",
"dev": true,
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"peerDependencies": {
"vite": "^4.0.0",
"vue": "^3.2.25"
}
},
"node_modules/@vue/compiler-core": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.3.4.tgz",
"integrity": "sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.21.3",
"@vue/shared": "3.3.4",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.3.4.tgz",
"integrity": "sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==",
"dev": true,
"dependencies": {
"@vue/compiler-core": "3.3.4",
"@vue/shared": "3.3.4"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.3.4.tgz",
"integrity": "sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.20.15",
"@vue/compiler-core": "3.3.4",
"@vue/compiler-dom": "3.3.4",
"@vue/compiler-ssr": "3.3.4",
"@vue/reactivity-transform": "3.3.4",
"@vue/shared": "3.3.4",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.0",
"postcss": "^8.1.10",
"source-map-js": "^1.0.2"
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.3.4.tgz",
"integrity": "sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==",
"dev": true,
"dependencies": {
"@vue/compiler-dom": "3.3.4",
"@vue/shared": "3.3.4"
}
},
"node_modules/@vue/devtools-api": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz",
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==",
"dev": true
},
"node_modules/@vue/reactivity": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.3.4.tgz",
"integrity": "sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==",
"dev": true,
"dependencies": {
"@vue/shared": "3.3.4"
}
},
"node_modules/@vue/reactivity-transform": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.3.4.tgz",
"integrity": "sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.20.15",
"@vue/compiler-core": "3.3.4",
"@vue/shared": "3.3.4",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.0"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.3.4.tgz",
"integrity": "sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==",
"dev": true,
"dependencies": {
"@vue/reactivity": "3.3.4",
"@vue/shared": "3.3.4"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.3.4.tgz",
"integrity": "sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==",
"dev": true,
"dependencies": {
"@vue/runtime-core": "3.3.4",
"@vue/shared": "3.3.4",
"csstype": "^3.1.1"
}
},
"node_modules/@vue/server-renderer": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.3.4.tgz",
"integrity": "sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==",
"dev": true,
"dependencies": {
"@vue/compiler-ssr": "3.3.4",
"@vue/shared": "3.3.4"
},
"peerDependencies": {
"vue": "3.3.4"
}
},
"node_modules/@vue/shared": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz",
"integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==",
"dev": true
},
"node_modules/@vueuse/core": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.1.2.tgz",
"integrity": "sha512-roNn8WuerI56A5uiTyF/TEYX0Y+VKlhZAF94unUfdhbDUI+NfwQMn4FUnUscIRUhv3344qvAghopU4bzLPNFlA==",
"dev": true,
"dependencies": {
"@types/web-bluetooth": "^0.0.17",
"@vueuse/metadata": "10.1.2",
"@vueuse/shared": "10.1.2",
"vue-demi": ">=0.14.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/core/node_modules/vue-demi": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz",
"integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==",
"dev": true,
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vueuse/integrations": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@vueuse/integrations/-/integrations-10.1.2.tgz",
"integrity": "sha512-wUpG3Wv6LiWerOwCzOAM0iGhNQ4vfFUTkhj/xQy7TLXduh2M3D8N08aS0KqlxsejY6R8NLxydDIM+68QfHZZ8Q==",
"dev": true,
"dependencies": {
"@vueuse/core": "10.1.2",
"@vueuse/shared": "10.1.2",
"vue-demi": ">=0.14.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"async-validator": "*",
"axios": "*",
"change-case": "*",
"drauu": "*",
"focus-trap": "*",
"fuse.js": "*",
"idb-keyval": "*",
"jwt-decode": "*",
"nprogress": "*",
"qrcode": "*",
"sortablejs": "*",
"universal-cookie": "*"
},
"peerDependenciesMeta": {
"async-validator": {
"optional": true
},
"axios": {
"optional": true
},
"change-case": {
"optional": true
},
"drauu": {
"optional": true
},
"focus-trap": {
"optional": true
},
"fuse.js": {
"optional": true
},
"idb-keyval": {
"optional": true
},
"jwt-decode": {
"optional": true
},
"nprogress": {
"optional": true
},
"qrcode": {
"optional": true
},
"sortablejs": {
"optional": true
},
"universal-cookie": {
"optional": true
}
}
},
"node_modules/@vueuse/integrations/node_modules/vue-demi": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz",
"integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==",
"dev": true,
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vueuse/metadata": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.1.2.tgz",
"integrity": "sha512-3mc5BqN9aU2SqBeBuWE7ne4OtXHoHKggNgxZR2K+zIW4YLsy6xoZ4/9vErQs6tvoKDX6QAqm3lvsrv0mczAwIQ==",
"dev": true,
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/shared": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.1.2.tgz",
"integrity": "sha512-1uoUTPBlgyscK9v6ScGeVYDDzlPSFXBlxuK7SfrDGyUTBiznb3mNceqhwvZHjtDRELZEN79V5uWPTF1VDV8svA==",
"dev": true,
"dependencies": {
"vue-demi": ">=0.14.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/@vueuse/shared/node_modules/vue-demi": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz",
"integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==",
"dev": true,
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/algoliasearch": {
"version": "4.17.0",
"resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.17.0.tgz",
"integrity": "sha512-JMRh2Mw6sEnVMiz6+APsi7lx9a2jiDFF+WUtANaUVCv6uSU9UOLdo5h9K3pdP6frRRybaM2fX8b1u0nqICS9aA==",
"dev": true,
"dependencies": {
"@algolia/cache-browser-local-storage": "4.17.0",
"@algolia/cache-common": "4.17.0",
"@algolia/cache-in-memory": "4.17.0",
"@algolia/client-account": "4.17.0",
"@algolia/client-analytics": "4.17.0",
"@algolia/client-common": "4.17.0",
"@algolia/client-personalization": "4.17.0",
"@algolia/client-search": "4.17.0",
"@algolia/logger-common": "4.17.0",
"@algolia/logger-console": "4.17.0",
"@algolia/requester-browser-xhr": "4.17.0",
"@algolia/requester-common": "4.17.0",
"@algolia/requester-node-http": "4.17.0",
"@algolia/transporter": "4.17.0"
}
},
"node_modules/ansi-sequence-parser": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz",
"integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==",
"dev": true
},
"node_modules/body-scroll-lock": {
"version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/body-scroll-lock/-/body-scroll-lock-4.0.0-beta.0.tgz",
"integrity": "sha512-a7tP5+0Mw3YlUJcGAKUqIBkYYGlYxk2fnCasq/FUph1hadxlTRjF+gAcZksxANnaMnALjxEddmSi/H3OR8ugcQ==",
"dev": true
},
"node_modules/csstype": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
"integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==",
"dev": true
},
"node_modules/esbuild": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",
"integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==",
"dev": true,
"hasInstallScript": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/android-arm": "0.17.19",
"@esbuild/android-arm64": "0.17.19",
"@esbuild/android-x64": "0.17.19",
"@esbuild/darwin-arm64": "0.17.19",
"@esbuild/darwin-x64": "0.17.19",
"@esbuild/freebsd-arm64": "0.17.19",
"@esbuild/freebsd-x64": "0.17.19",
"@esbuild/linux-arm": "0.17.19",
"@esbuild/linux-arm64": "0.17.19",
"@esbuild/linux-ia32": "0.17.19",
"@esbuild/linux-loong64": "0.17.19",
"@esbuild/linux-mips64el": "0.17.19",
"@esbuild/linux-ppc64": "0.17.19",
"@esbuild/linux-riscv64": "0.17.19",
"@esbuild/linux-s390x": "0.17.19",
"@esbuild/linux-x64": "0.17.19",
"@esbuild/netbsd-x64": "0.17.19",
"@esbuild/openbsd-x64": "0.17.19",
"@esbuild/sunos-x64": "0.17.19",
"@esbuild/win32-arm64": "0.17.19",
"@esbuild/win32-ia32": "0.17.19",
"@esbuild/win32-x64": "0.17.19"
}
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"node_modules/focus-trap": {
"version": "7.4.3",
"resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.4.3.tgz",
"integrity": "sha512-BgSSbK4GPnS2VbtZ50VtOv1Sti6DIkj3+LkVjiWMNjLeAp1SH1UlLx3ULu/DCu4vq5R4/uvTm+zrvsMsuYmGLg==",
"dev": true,
"dependencies": {
"tabbable": "^6.1.2"
}
},
"node_modules/jsonc-parser": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz",
"integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==",
"dev": true
},
"node_modules/magic-string": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz",
"integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==",
"dev": true,
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.13"
},
"engines": {
"node": ">=12"
}
},
"node_modules/mark.js": {
"version": "8.11.1",
"resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz",
"integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==",
"dev": true
},
"node_modules/minisearch": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/minisearch/-/minisearch-6.1.0.tgz",
"integrity": "sha512-PNxA/X8pWk+TiqPbsoIYH0GQ5Di7m6326/lwU/S4mlo4wGQddIcf/V//1f9TB0V4j59b57b+HZxt8h3iMROGvg==",
"dev": true
},
"node_modules/nanoid": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
"dev": true
},
"node_modules/postcss": {
"version": "8.4.23",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz",
"integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"dependencies": {
"nanoid": "^3.3.6",
"picocolors": "^1.0.0",
"source-map-js": "^1.0.2"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/preact": {
"version": "10.14.1",
"resolved": "https://registry.npmjs.org/preact/-/preact-10.14.1.tgz",
"integrity": "sha512-4XDSnUisk3YFBb3p9WeKeH1mKoxdFUsaXcvxs9wlpYR1wax/TWJVqhwmIWbByX0h7jMEJH6Zc5J6jqc58FKaNQ==",
"dev": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/preact"
}
},
"node_modules/rollup": {
"version": "3.22.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.22.0.tgz",
"integrity": "sha512-imsigcWor5Y/dC0rz2q0bBt9PabcL3TORry2hAa6O6BuMvY71bqHyfReAz5qyAqiQATD1m70qdntqBfBQjVWpQ==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
},
"engines": {
"node": ">=14.18.0",
"npm": ">=8.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/shiki": {
"version": "0.14.2",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.2.tgz",
"integrity": "sha512-ltSZlSLOuSY0M0Y75KA+ieRaZ0Trf5Wl3gutE7jzLuIcWxLp5i/uEnLoQWNvgKXQ5OMpGkJnVMRLAuzjc0LJ2A==",
"dev": true,
"dependencies": {
"ansi-sequence-parser": "^1.1.0",
"jsonc-parser": "^3.2.0",
"vscode-oniguruma": "^1.7.0",
"vscode-textmate": "^8.0.0"
}
},
"node_modules/source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/tabbable": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.1.2.tgz",
"integrity": "sha512-qCN98uP7i9z0fIS4amQ5zbGBOq+OSigYeGvPy7NDk8Y9yncqDZ9pRPgfsc2PJIVM9RrJj7GIfuRgmjoUU9zTHQ==",
"dev": true
},
"node_modules/vite": {
"version": "4.3.8",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.3.8.tgz",
"integrity": "sha512-uYB8PwN7hbMrf4j1xzGDk/lqjsZvCDbt/JC5dyfxc19Pg8kRm14LinK/uq+HSLNswZEoKmweGdtpbnxRtrAXiQ==",
"dev": true,
"dependencies": {
"esbuild": "^0.17.5",
"postcss": "^8.4.23",
"rollup": "^3.21.0"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"peerDependencies": {
"@types/node": ">= 14",
"less": "*",
"sass": "*",
"stylus": "*",
"sugarss": "*",
"terser": "^5.4.0"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
"less": {
"optional": true
},
"sass": {
"optional": true
},
"stylus": {
"optional": true
},
"sugarss": {
"optional": true
},
"terser": {
"optional": true
}
}
},
"node_modules/vitepress": {
"version": "1.0.0-alpha.76",
"resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-alpha.76.tgz",
"integrity": "sha512-fzR1pDpGnSMeCJ+AnDdMe/ETD2G0Go+g6mTxDv9ps7Hmr1JjVqw97nasCyZg3jgfQxi2nt78EJ/bw7hY5n/rlw==",
"dev": true,
"dependencies": {
"@docsearch/css": "^3.3.5",
"@docsearch/js": "^3.3.5",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/devtools-api": "^6.5.0",
"@vueuse/core": "^10.1.2",
"@vueuse/integrations": "^10.1.2",
"body-scroll-lock": "4.0.0-beta.0",
"focus-trap": "^7.4.2",
"mark.js": "8.11.1",
"minisearch": "^6.1.0",
"shiki": "^0.14.2",
"vite": "^4.3.8",
"vue": "^3.3.4"
},
"bin": {
"vitepress": "bin/vitepress.js"
}
},
"node_modules/vscode-oniguruma": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz",
"integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==",
"dev": true
},
"node_modules/vscode-textmate": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz",
"integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==",
"dev": true
},
"node_modules/vue": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz",
"integrity": "sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==",
"dev": true,
"dependencies": {
"@vue/compiler-dom": "3.3.4",
"@vue/compiler-sfc": "3.3.4",
"@vue/runtime-dom": "3.3.4",
"@vue/server-renderer": "3.3.4",
"@vue/shared": "3.3.4"
}
}
}
}

17
node_modules/@algolia/autocomplete-core/README.md generated vendored Normal file
View file

@ -0,0 +1,17 @@
# @algolia/autocomplete-core
The [`autocomplete-core`](https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-core/createAutocomplete) package is the foundation of Autocomplete. It exposes primitives to build an autocomplete experience.
You likely dont need to use this package directly unless youre building a [renderer](https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer).
## Installation
```sh
yarn add @algolia/autocomplete-core
# or
npm install @algolia/autocomplete-core
```
## Documentation
See [**Documentation**](https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-core).

View file

@ -0,0 +1,2 @@
import { AutocompleteOptions, BaseItem } from './types';
export declare function checkOptions<TItem extends BaseItem>(options: AutocompleteOptions<TItem>): void;

View file

@ -0,0 +1,4 @@
import { warn } from '@algolia/autocomplete-shared';
export function checkOptions(options) {
process.env.NODE_ENV !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0;
}

View file

@ -0,0 +1,8 @@
import { AutocompleteApi, AutocompleteOptions as AutocompleteCoreOptions, BaseItem } from './types';
export interface AutocompleteOptionsWithMetadata<TItem extends BaseItem> extends AutocompleteCoreOptions<TItem> {
/**
* @internal
*/
__autocomplete_metadata?: Record<string, unknown>;
}
export declare function createAutocomplete<TItem extends BaseItem, TEvent = Event, TMouseEvent = MouseEvent, TKeyboardEvent = KeyboardEvent>(options: AutocompleteOptionsWithMetadata<TItem>): AutocompleteApi<TItem, TEvent, TMouseEvent, TKeyboardEvent>;

View file

@ -0,0 +1,89 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { checkOptions } from './checkOptions';
import { createStore } from './createStore';
import { getAutocompleteSetters } from './getAutocompleteSetters';
import { getDefaultProps } from './getDefaultProps';
import { getPropGetters } from './getPropGetters';
import { getMetadata, injectMetadata } from './metadata';
import { onInput } from './onInput';
import { stateReducer } from './stateReducer';
export function createAutocomplete(options) {
checkOptions(options);
var subscribers = [];
var props = getDefaultProps(options, subscribers);
var store = createStore(stateReducer, props, onStoreStateChange);
var setters = getAutocompleteSetters({
store: store
});
var propGetters = getPropGetters(_objectSpread({
props: props,
refresh: refresh,
store: store,
navigator: props.navigator
}, setters));
function onStoreStateChange(_ref) {
var prevState = _ref.prevState,
state = _ref.state;
props.onStateChange(_objectSpread({
prevState: prevState,
state: state,
refresh: refresh,
navigator: props.navigator
}, setters));
}
function refresh() {
return onInput(_objectSpread({
event: new Event('input'),
nextState: {
isOpen: store.getState().isOpen
},
props: props,
navigator: props.navigator,
query: store.getState().query,
refresh: refresh,
store: store
}, setters));
}
props.plugins.forEach(function (plugin) {
var _plugin$subscribe;
return (_plugin$subscribe = plugin.subscribe) === null || _plugin$subscribe === void 0 ? void 0 : _plugin$subscribe.call(plugin, _objectSpread(_objectSpread({}, setters), {}, {
navigator: props.navigator,
refresh: refresh,
onSelect: function onSelect(fn) {
subscribers.push({
onSelect: fn
});
},
onActive: function onActive(fn) {
subscribers.push({
onActive: fn
});
},
onResolve: function onResolve(fn) {
subscribers.push({
onResolve: fn
});
}
}));
});
injectMetadata({
metadata: getMetadata({
plugins: props.plugins,
options: options
}),
environment: props.environment
});
return _objectSpread(_objectSpread({
refresh: refresh,
navigator: props.navigator
}, propGetters), setters);
}

View file

@ -0,0 +1,7 @@
import { AutocompleteState, AutocompleteStore, BaseItem, InternalAutocompleteOptions, Reducer } from './types';
declare type OnStoreStateChange<TItem extends BaseItem> = ({ prevState, state, }: {
prevState: AutocompleteState<TItem>;
state: AutocompleteState<TItem>;
}) => void;
export declare function createStore<TItem extends BaseItem>(reducer: Reducer, props: InternalAutocompleteOptions<TItem>, onStoreStateChange: OnStoreStateChange<TItem>): AutocompleteStore<TItem>;
export {};

View file

@ -0,0 +1,29 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { createCancelablePromiseList } from './utils';
export function createStore(reducer, props, onStoreStateChange) {
var state = props.initialState;
return {
getState: function getState() {
return state;
},
dispatch: function dispatch(action, payload) {
var prevState = _objectSpread({}, state);
state = reducer(state, {
type: action,
props: props,
payload: payload
});
onStoreStateChange({
state: state,
prevState: prevState
});
},
pendingRequests: createCancelablePromiseList()
};
}

View file

@ -0,0 +1,13 @@
import { AutocompleteCollection, AutocompleteStore, BaseItem } from './types';
interface GetAutocompleteSettersOptions<TItem extends BaseItem> {
store: AutocompleteStore<TItem>;
}
export declare function getAutocompleteSetters<TItem extends BaseItem>({ store, }: GetAutocompleteSettersOptions<TItem>): {
setActiveItemId: import("./types").StateUpdater<number | null>;
setQuery: import("./types").StateUpdater<string>;
setCollections: import("./types").StateUpdater<(AutocompleteCollection<TItem> | import("./types").AutocompleteCollectionItemsArray<TItem>)[]>;
setIsOpen: import("./types").StateUpdater<boolean>;
setStatus: import("./types").StateUpdater<"idle" | "loading" | "stalled" | "error">;
setContext: import("./types").StateUpdater<import("./types").AutocompleteContext>;
};
export {};

View file

@ -0,0 +1,55 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { flatten } from '@algolia/autocomplete-shared';
export function getAutocompleteSetters(_ref) {
var store = _ref.store;
var setActiveItemId = function setActiveItemId(value) {
store.dispatch('setActiveItemId', value);
};
var setQuery = function setQuery(value) {
store.dispatch('setQuery', value);
};
var setCollections = function setCollections(rawValue) {
var baseItemId = 0;
var value = rawValue.map(function (collection) {
return _objectSpread(_objectSpread({}, collection), {}, {
// We flatten the stored items to support calling `getAlgoliaResults`
// from the source itself.
items: flatten(collection.items).map(function (item) {
return _objectSpread(_objectSpread({}, item), {}, {
__autocomplete_id: baseItemId++
});
})
});
});
store.dispatch('setCollections', value);
};
var setIsOpen = function setIsOpen(value) {
store.dispatch('setIsOpen', value);
};
var setStatus = function setStatus(value) {
store.dispatch('setStatus', value);
};
var setContext = function setContext(value) {
store.dispatch('setContext', value);
};
return {
setActiveItemId: setActiveItemId,
setQuery: setQuery,
setCollections: setCollections,
setIsOpen: setIsOpen,
setStatus: setStatus,
setContext: setContext
};
}

View file

@ -0,0 +1,6 @@
import { AutocompleteState, BaseItem } from './types';
interface GetCompletionProps<TItem extends BaseItem> {
state: AutocompleteState<TItem>;
}
export declare function getCompletion<TItem extends BaseItem>({ state, }: GetCompletionProps<TItem>): string | null;
export {};

View file

@ -0,0 +1,12 @@
import { getActiveItem } from './utils';
export function getCompletion(_ref) {
var _getActiveItem;
var state = _ref.state;
if (state.isOpen === false || state.activeItemId === null) {
return null;
}
return ((_getActiveItem = getActiveItem(state)) === null || _getActiveItem === void 0 ? void 0 : _getActiveItem.itemInputValue) || null;
}

View file

@ -0,0 +1,2 @@
import { AutocompleteOptions, AutocompleteSubscribers, BaseItem, InternalAutocompleteOptions } from './types';
export declare function getDefaultProps<TItem extends BaseItem>(props: AutocompleteOptions<TItem>, pluginSubscribers: AutocompleteSubscribers<TItem>): InternalAutocompleteOptions<TItem>;

View file

@ -0,0 +1,144 @@
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { getItemsCount, generateAutocompleteId, flatten } from '@algolia/autocomplete-shared';
import { getNormalizedSources } from './utils';
export function getDefaultProps(props, pluginSubscribers) {
var _props$id;
/* eslint-disable no-restricted-globals */
var environment = typeof window !== 'undefined' ? window : {};
/* eslint-enable no-restricted-globals */
var plugins = props.plugins || [];
return _objectSpread(_objectSpread({
debug: false,
openOnFocus: false,
placeholder: '',
autoFocus: false,
defaultActiveItemId: null,
stallThreshold: 300,
environment: environment,
shouldPanelOpen: function shouldPanelOpen(_ref) {
var state = _ref.state;
return getItemsCount(state) > 0;
},
reshape: function reshape(_ref2) {
var sources = _ref2.sources;
return sources;
}
}, props), {}, {
// Since `generateAutocompleteId` triggers a side effect (it increments
// an internal counter), we don't want to execute it if unnecessary.
id: (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generateAutocompleteId(),
plugins: plugins,
// The following props need to be deeply defaulted.
initialState: _objectSpread({
activeItemId: null,
query: '',
completion: null,
collections: [],
isOpen: false,
status: 'idle',
context: {}
}, props.initialState),
onStateChange: function onStateChange(params) {
var _props$onStateChange;
(_props$onStateChange = props.onStateChange) === null || _props$onStateChange === void 0 ? void 0 : _props$onStateChange.call(props, params);
plugins.forEach(function (x) {
var _x$onStateChange;
return (_x$onStateChange = x.onStateChange) === null || _x$onStateChange === void 0 ? void 0 : _x$onStateChange.call(x, params);
});
},
onSubmit: function onSubmit(params) {
var _props$onSubmit;
(_props$onSubmit = props.onSubmit) === null || _props$onSubmit === void 0 ? void 0 : _props$onSubmit.call(props, params);
plugins.forEach(function (x) {
var _x$onSubmit;
return (_x$onSubmit = x.onSubmit) === null || _x$onSubmit === void 0 ? void 0 : _x$onSubmit.call(x, params);
});
},
onReset: function onReset(params) {
var _props$onReset;
(_props$onReset = props.onReset) === null || _props$onReset === void 0 ? void 0 : _props$onReset.call(props, params);
plugins.forEach(function (x) {
var _x$onReset;
return (_x$onReset = x.onReset) === null || _x$onReset === void 0 ? void 0 : _x$onReset.call(x, params);
});
},
getSources: function getSources(params) {
return Promise.all([].concat(_toConsumableArray(plugins.map(function (plugin) {
return plugin.getSources;
})), [props.getSources]).filter(Boolean).map(function (getSources) {
return getNormalizedSources(getSources, params);
})).then(function (nested) {
return flatten(nested);
}).then(function (sources) {
return sources.map(function (source) {
return _objectSpread(_objectSpread({}, source), {}, {
onSelect: function onSelect(params) {
source.onSelect(params);
pluginSubscribers.forEach(function (x) {
var _x$onSelect;
return (_x$onSelect = x.onSelect) === null || _x$onSelect === void 0 ? void 0 : _x$onSelect.call(x, params);
});
},
onActive: function onActive(params) {
source.onActive(params);
pluginSubscribers.forEach(function (x) {
var _x$onActive;
return (_x$onActive = x.onActive) === null || _x$onActive === void 0 ? void 0 : _x$onActive.call(x, params);
});
},
onResolve: function onResolve(params) {
source.onResolve(params);
pluginSubscribers.forEach(function (x) {
var _x$onResolve;
return (_x$onResolve = x.onResolve) === null || _x$onResolve === void 0 ? void 0 : _x$onResolve.call(x, params);
});
}
});
});
});
},
navigator: _objectSpread({
navigate: function navigate(_ref3) {
var itemUrl = _ref3.itemUrl;
environment.location.assign(itemUrl);
},
navigateNewTab: function navigateNewTab(_ref4) {
var itemUrl = _ref4.itemUrl;
var windowReference = environment.open(itemUrl, '_blank', 'noopener');
windowReference === null || windowReference === void 0 ? void 0 : windowReference.focus();
},
navigateNewWindow: function navigateNewWindow(_ref5) {
var itemUrl = _ref5.itemUrl;
environment.open(itemUrl, '_blank', 'noopener');
}
}, props.navigator)
});
}

View file

@ -0,0 +1,16 @@
import { AutocompleteScopeApi, AutocompleteStore, BaseItem, GetEnvironmentProps, GetFormProps, GetInputProps, GetItemProps, GetLabelProps, GetListProps, GetPanelProps, GetRootProps, InternalAutocompleteOptions } from './types';
interface GetPropGettersOptions<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
store: AutocompleteStore<TItem>;
props: InternalAutocompleteOptions<TItem>;
}
export declare function getPropGetters<TItem extends BaseItem, TEvent, TMouseEvent, TKeyboardEvent>({ props, refresh, store, ...setters }: GetPropGettersOptions<TItem>): {
getEnvironmentProps: GetEnvironmentProps;
getRootProps: GetRootProps;
getFormProps: GetFormProps<TEvent>;
getLabelProps: GetLabelProps;
getInputProps: GetInputProps<TEvent, TMouseEvent, TKeyboardEvent>;
getPanelProps: GetPanelProps<TMouseEvent>;
getListProps: GetListProps;
getItemProps: GetItemProps<any, TMouseEvent>;
};
export {};

View file

@ -0,0 +1,349 @@
var _excluded = ["props", "refresh", "store"],
_excluded2 = ["inputElement", "formElement", "panelElement"],
_excluded3 = ["inputElement"],
_excluded4 = ["inputElement", "maxLength"],
_excluded5 = ["sourceIndex"],
_excluded6 = ["sourceIndex"],
_excluded7 = ["item", "source", "sourceIndex"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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; }
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; }
import { noop } from '@algolia/autocomplete-shared';
import { onInput } from './onInput';
import { onKeyDown as _onKeyDown } from './onKeyDown';
import { getActiveItem, isOrContainsNode, isSamsung } from './utils';
export function getPropGetters(_ref) {
var props = _ref.props,
refresh = _ref.refresh,
store = _ref.store,
setters = _objectWithoutProperties(_ref, _excluded);
var getEnvironmentProps = function getEnvironmentProps(providedProps) {
var inputElement = providedProps.inputElement,
formElement = providedProps.formElement,
panelElement = providedProps.panelElement,
rest = _objectWithoutProperties(providedProps, _excluded2);
function onMouseDownOrTouchStart(event) {
// The `onTouchStart`/`onMouseDown` events shouldn't trigger the `blur`
// handler when it's not an interaction with Autocomplete.
// We detect it with the following heuristics:
// - the panel is closed AND there are no pending requests
// (no interaction with the autocomplete, no future state updates)
// - OR the touched target is the input element (should open the panel)
var isAutocompleteInteraction = store.getState().isOpen || !store.pendingRequests.isEmpty();
if (!isAutocompleteInteraction || event.target === inputElement) {
return;
} // @TODO: support cases where there are multiple Autocomplete instances.
// Right now, a second instance makes this computation return false.
var isTargetWithinAutocomplete = [formElement, panelElement].some(function (contextNode) {
return isOrContainsNode(contextNode, event.target);
});
if (isTargetWithinAutocomplete === false) {
store.dispatch('blur', null); // If requests are still pending when the user closes the panel, they
// could reopen the panel once they resolve.
// We want to prevent any subsequent query from reopening the panel
// because it would result in an unsolicited UI behavior.
if (!props.debug) {
store.pendingRequests.cancelAll();
}
}
}
return _objectSpread({
// We do not rely on the native `blur` event of the input to close the
// panel, but rather on a custom `touchstart`/`mousedown` event outside
// of the autocomplete elements.
// This ensures we don't mistakenly interpret interactions within the
// autocomplete (but outside of the input) as a signal to close the panel.
// For example, clicking reset button causes an input blur, but if
// `openOnFocus=true`, it shouldn't close the panel.
// On touch devices, scrolling results (`touchmove`) causes an input blur
// but shouldn't close the panel.
onTouchStart: onMouseDownOrTouchStart,
onMouseDown: onMouseDownOrTouchStart,
// When scrolling on touch devices (mobiles, tablets, etc.), we want to
// mimic the native platform behavior where the input is blurred to
// hide the virtual keyboard. This gives more vertical space to
// discover all the suggestions showing up in the panel.
onTouchMove: function onTouchMove(event) {
if (store.getState().isOpen === false || inputElement !== props.environment.document.activeElement || event.target === inputElement) {
return;
}
inputElement.blur();
}
}, rest);
};
var getRootProps = function getRootProps(rest) {
return _objectSpread({
role: 'combobox',
'aria-expanded': store.getState().isOpen,
'aria-haspopup': 'listbox',
'aria-owns': store.getState().isOpen ? "".concat(props.id, "-list") : undefined,
'aria-labelledby': "".concat(props.id, "-label")
}, rest);
};
var getFormProps = function getFormProps(providedProps) {
var inputElement = providedProps.inputElement,
rest = _objectWithoutProperties(providedProps, _excluded3);
return _objectSpread({
action: '',
noValidate: true,
role: 'search',
onSubmit: function onSubmit(event) {
var _providedProps$inputE;
event.preventDefault();
props.onSubmit(_objectSpread({
event: event,
refresh: refresh,
state: store.getState()
}, setters));
store.dispatch('submit', null);
(_providedProps$inputE = providedProps.inputElement) === null || _providedProps$inputE === void 0 ? void 0 : _providedProps$inputE.blur();
},
onReset: function onReset(event) {
var _providedProps$inputE2;
event.preventDefault();
props.onReset(_objectSpread({
event: event,
refresh: refresh,
state: store.getState()
}, setters));
store.dispatch('reset', null);
(_providedProps$inputE2 = providedProps.inputElement) === null || _providedProps$inputE2 === void 0 ? void 0 : _providedProps$inputE2.focus();
}
}, rest);
};
var getInputProps = function getInputProps(providedProps) {
var _props$environment$na;
function onFocus(event) {
// We want to trigger a query when `openOnFocus` is true
// because the panel should open with the current query.
if (props.openOnFocus || Boolean(store.getState().query)) {
onInput(_objectSpread({
event: event,
props: props,
query: store.getState().completion || store.getState().query,
refresh: refresh,
store: store
}, setters));
}
store.dispatch('focus', null);
}
var _ref2 = providedProps || {},
inputElement = _ref2.inputElement,
_ref2$maxLength = _ref2.maxLength,
maxLength = _ref2$maxLength === void 0 ? 512 : _ref2$maxLength,
rest = _objectWithoutProperties(_ref2, _excluded4);
var activeItem = getActiveItem(store.getState());
var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
var shouldFallbackKeyHint = isSamsung(userAgent);
var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
return _objectSpread({
'aria-autocomplete': 'both',
'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,
'aria-controls': store.getState().isOpen ? "".concat(props.id, "-list") : undefined,
'aria-labelledby': "".concat(props.id, "-label"),
value: store.getState().completion || store.getState().query,
id: "".concat(props.id, "-input"),
autoComplete: 'off',
autoCorrect: 'off',
autoCapitalize: 'off',
enterKeyHint: enterKeyHint,
spellCheck: 'false',
autoFocus: props.autoFocus,
placeholder: props.placeholder,
maxLength: maxLength,
type: 'search',
onChange: function onChange(event) {
onInput(_objectSpread({
event: event,
props: props,
query: event.currentTarget.value.slice(0, maxLength),
refresh: refresh,
store: store
}, setters));
},
onKeyDown: function onKeyDown(event) {
_onKeyDown(_objectSpread({
event: event,
props: props,
refresh: refresh,
store: store
}, setters));
},
onFocus: onFocus,
// We don't rely on the `blur` event.
// See explanation in `onTouchStart`/`onMouseDown`.
// @MAJOR See if we need to keep this handler.
onBlur: noop,
onClick: function onClick(event) {
// When the panel is closed and you click on the input while
// the input is focused, the `onFocus` event is not triggered
// (default browser behavior).
// In an autocomplete context, it makes sense to open the panel in this
// case.
// We mimic this event by catching the `onClick` event which
// triggers the `onFocus` for the panel to open.
if (providedProps.inputElement === props.environment.document.activeElement && !store.getState().isOpen) {
onFocus(event);
}
}
}, rest);
};
var getAutocompleteId = function getAutocompleteId(instanceId, sourceId) {
return typeof sourceId !== 'undefined' ? "".concat(instanceId, "-").concat(sourceId) : instanceId;
};
var getLabelProps = function getLabelProps(providedProps) {
var _ref3 = providedProps || {},
sourceIndex = _ref3.sourceIndex,
rest = _objectWithoutProperties(_ref3, _excluded5);
return _objectSpread({
htmlFor: "".concat(getAutocompleteId(props.id, sourceIndex), "-input"),
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-label")
}, rest);
};
var getListProps = function getListProps(providedProps) {
var _ref4 = providedProps || {},
sourceIndex = _ref4.sourceIndex,
rest = _objectWithoutProperties(_ref4, _excluded6);
return _objectSpread({
role: 'listbox',
'aria-labelledby': "".concat(getAutocompleteId(props.id, sourceIndex), "-label"),
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-list")
}, rest);
};
var getPanelProps = function getPanelProps(rest) {
return _objectSpread({
onMouseDown: function onMouseDown(event) {
// Prevents the `activeElement` from being changed to the panel so
// that the blur event is not triggered, otherwise it closes the
// panel.
event.preventDefault();
},
onMouseLeave: function onMouseLeave() {
store.dispatch('mouseleave', null);
}
}, rest);
};
var getItemProps = function getItemProps(providedProps) {
var item = providedProps.item,
source = providedProps.source,
sourceIndex = providedProps.sourceIndex,
rest = _objectWithoutProperties(providedProps, _excluded7);
return _objectSpread({
id: "".concat(getAutocompleteId(props.id, sourceIndex), "-item-").concat(item.__autocomplete_id),
role: 'option',
'aria-selected': store.getState().activeItemId === item.__autocomplete_id,
onMouseMove: function onMouseMove(event) {
if (item.__autocomplete_id === store.getState().activeItemId) {
return;
}
store.dispatch('mousemove', item.__autocomplete_id);
var activeItem = getActiveItem(store.getState());
if (store.getState().activeItemId !== null && activeItem) {
var _item = activeItem.item,
itemInputValue = activeItem.itemInputValue,
itemUrl = activeItem.itemUrl,
_source = activeItem.source;
_source.onActive(_objectSpread({
event: event,
item: _item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: _source,
state: store.getState()
}, setters));
}
},
onMouseDown: function onMouseDown(event) {
// Prevents the `activeElement` from being changed to the item so it
// can remain with the current `activeElement`.
event.preventDefault();
},
onClick: function onClick(event) {
var itemInputValue = source.getItemInputValue({
item: item,
state: store.getState()
});
var itemUrl = source.getItemUrl({
item: item,
state: store.getState()
}); // If `getItemUrl` is provided, it means that the suggestion
// is a link, not plain text that aims at updating the query.
// We can therefore skip the state change because it will update
// the `activeItemId`, resulting in a UI flash, especially
// noticeable on mobile.
var runPreCommand = itemUrl ? Promise.resolve() : onInput(_objectSpread({
event: event,
nextState: {
isOpen: false
},
props: props,
query: itemInputValue,
refresh: refresh,
store: store
}, setters));
runPreCommand.then(function () {
source.onSelect(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
});
}
}, rest);
};
return {
getEnvironmentProps: getEnvironmentProps,
getRootProps: getRootProps,
getFormProps: getFormProps,
getLabelProps: getLabelProps,
getInputProps: getInputProps,
getPanelProps: getPanelProps,
getListProps: getListProps,
getItemProps: getItemProps
};
}

View file

@ -0,0 +1,3 @@
export * from './createAutocomplete';
export * from './getDefaultProps';
export * from './types';

View file

@ -0,0 +1,3 @@
export * from './createAutocomplete';
export * from './getDefaultProps';
export * from './types';

View file

@ -0,0 +1,33 @@
import { UserAgent } from '@algolia/autocomplete-shared';
import { AutocompleteEnvironment, AutocompleteOptionsWithMetadata, AutocompletePlugin, BaseItem } from '.';
declare type AutocompleteMetadata = {
plugins: Array<{
name: string | undefined;
options: string[];
}>;
options: Record<string, string[]>;
ua: UserAgent[];
};
declare type GetMetadataParams<TItem extends BaseItem, TData = unknown> = {
plugins: Array<AutocompletePlugin<TItem, TData>>;
options: AutocompleteOptionsWithMetadata<TItem>;
};
export declare function getMetadata<TItem extends BaseItem, TData = unknown>({ plugins, options, }: GetMetadataParams<TItem, TData>): {
plugins: {
name: string | undefined;
options: string[];
}[];
options: {
'autocomplete-core': string[];
};
ua: {
segment: string;
version: string;
}[];
};
declare type InlineMetadataParams = {
metadata: AutocompleteMetadata;
environment: AutocompleteEnvironment;
};
export declare function injectMetadata({ metadata, environment, }: InlineMetadataParams): void;
export {};

View file

@ -0,0 +1,44 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { userAgents } from '@algolia/autocomplete-shared';
export function getMetadata(_ref) {
var _, _options$__autocomple, _options$__autocomple2, _options$__autocomple3;
var plugins = _ref.plugins,
options = _ref.options;
var optionsKey = (_ = (((_options$__autocomple = options.__autocomplete_metadata) === null || _options$__autocomple === void 0 ? void 0 : _options$__autocomple.userAgents) || [])[0]) === null || _ === void 0 ? void 0 : _.segment;
var extraOptions = optionsKey ? _defineProperty({}, optionsKey, Object.keys(((_options$__autocomple2 = options.__autocomplete_metadata) === null || _options$__autocomple2 === void 0 ? void 0 : _options$__autocomple2.options) || {})) : {};
return {
plugins: plugins.map(function (plugin) {
return {
name: plugin.name,
options: Object.keys(plugin.__autocomplete_pluginOptions || [])
};
}),
options: _objectSpread({
'autocomplete-core': Object.keys(options)
}, extraOptions),
ua: userAgents.concat(((_options$__autocomple3 = options.__autocomplete_metadata) === null || _options$__autocomple3 === void 0 ? void 0 : _options$__autocomple3.userAgents) || [])
};
}
export function injectMetadata(_ref3) {
var _environment$navigato, _environment$navigato2;
var metadata = _ref3.metadata,
environment = _ref3.environment;
var isMetadataEnabled = (_environment$navigato = environment.navigator) === null || _environment$navigato === void 0 ? void 0 : (_environment$navigato2 = _environment$navigato.userAgent) === null || _environment$navigato2 === void 0 ? void 0 : _environment$navigato2.includes('Algolia Crawler');
if (isMetadataEnabled) {
var metadataContainer = environment.document.createElement('meta');
var headRef = environment.document.querySelector('head');
metadataContainer.name = 'algolia:metadata';
setTimeout(function () {
metadataContainer.content = JSON.stringify(metadata);
headRef.appendChild(metadataContainer);
}, 0);
}
}

View file

@ -0,0 +1,18 @@
import { AutocompleteScopeApi, AutocompleteState, AutocompleteStore, BaseItem, InternalAutocompleteOptions } from './types';
import { CancelablePromise } from './utils';
interface OnInputParams<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
event: any;
/**
* The next partial state to apply after the function is called.
*
* This is useful when we call `onInput` in a different scenario than an
* actual input. For example, we use `onInput` when we click on an item,
* but we want to close the panel in that case.
*/
nextState?: Partial<AutocompleteState<TItem>>;
props: InternalAutocompleteOptions<TItem>;
query: string;
store: AutocompleteStore<TItem>;
}
export declare function onInput<TItem extends BaseItem>({ event, nextState, props, query, refresh, store, ...setters }: OnInputParams<TItem>): CancelablePromise<void>;
export {};

View file

@ -0,0 +1,134 @@
var _excluded = ["event", "nextState", "props", "query", "refresh", "store"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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; }
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; }
import { reshape } from './reshape';
import { preResolve, resolve, postResolve } from './resolve';
import { cancelable, createConcurrentSafePromise, getActiveItem } from './utils';
var lastStalledId = null;
var runConcurrentSafePromise = createConcurrentSafePromise();
export function onInput(_ref) {
var event = _ref.event,
_ref$nextState = _ref.nextState,
nextState = _ref$nextState === void 0 ? {} : _ref$nextState,
props = _ref.props,
query = _ref.query,
refresh = _ref.refresh,
store = _ref.store,
setters = _objectWithoutProperties(_ref, _excluded);
if (lastStalledId) {
props.environment.clearTimeout(lastStalledId);
}
var setCollections = setters.setCollections,
setIsOpen = setters.setIsOpen,
setQuery = setters.setQuery,
setActiveItemId = setters.setActiveItemId,
setStatus = setters.setStatus;
setQuery(query);
setActiveItemId(props.defaultActiveItemId);
if (!query && props.openOnFocus === false) {
var _nextState$isOpen;
var collections = store.getState().collections.map(function (collection) {
return _objectSpread(_objectSpread({}, collection), {}, {
items: []
});
});
setStatus('idle');
setCollections(collections);
setIsOpen((_nextState$isOpen = nextState.isOpen) !== null && _nextState$isOpen !== void 0 ? _nextState$isOpen : props.shouldPanelOpen({
state: store.getState()
})); // We make sure to update the latest resolved value of the tracked
// promises to keep late resolving promises from "cancelling" the state
// updates performed in this code path.
// We chain with a void promise to respect `onInput`'s expected return type.
var _request = cancelable(runConcurrentSafePromise(collections).then(function () {
return Promise.resolve();
}));
return store.pendingRequests.add(_request);
}
setStatus('loading');
lastStalledId = props.environment.setTimeout(function () {
setStatus('stalled');
}, props.stallThreshold); // We track the entire promise chain triggered by `onInput` before mutating
// the Autocomplete state to make sure that any state manipulation is based on
// fresh data regardless of when promises individually resolve.
// We don't track nested promises and only rely on the full chain resolution,
// meaning we should only ever manipulate the state once this concurrent-safe
// promise is resolved.
var request = cancelable(runConcurrentSafePromise(props.getSources(_objectSpread({
query: query,
refresh: refresh,
state: store.getState()
}, setters)).then(function (sources) {
return Promise.all(sources.map(function (source) {
return Promise.resolve(source.getItems(_objectSpread({
query: query,
refresh: refresh,
state: store.getState()
}, setters))).then(function (itemsOrDescription) {
return preResolve(itemsOrDescription, source.sourceId, store.getState());
});
})).then(resolve).then(function (responses) {
return postResolve(responses, sources, store);
}).then(function (collections) {
return reshape({
collections: collections,
props: props,
state: store.getState()
});
});
}))).then(function (collections) {
var _nextState$isOpen2;
// Parameters passed to `onInput` could be stale when the following code
// executes, because `onInput` calls may not resolve in order.
// If it becomes a problem we'll need to save the last passed parameters.
// See: https://codesandbox.io/s/agitated-cookies-y290z
setStatus('idle');
setCollections(collections);
var isPanelOpen = props.shouldPanelOpen({
state: store.getState()
});
setIsOpen((_nextState$isOpen2 = nextState.isOpen) !== null && _nextState$isOpen2 !== void 0 ? _nextState$isOpen2 : props.openOnFocus && !query && isPanelOpen || isPanelOpen);
var highlightedItem = getActiveItem(store.getState());
if (store.getState().activeItemId !== null && highlightedItem) {
var item = highlightedItem.item,
itemInputValue = highlightedItem.itemInputValue,
itemUrl = highlightedItem.itemUrl,
source = highlightedItem.source;
source.onActive(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
}
}).finally(function () {
setStatus('idle');
if (lastStalledId) {
props.environment.clearTimeout(lastStalledId);
}
});
return store.pendingRequests.add(request);
}

View file

@ -0,0 +1,8 @@
import { AutocompleteScopeApi, AutocompleteStore, BaseItem, InternalAutocompleteOptions } from './types';
interface OnKeyDownOptions<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
event: KeyboardEvent;
props: InternalAutocompleteOptions<TItem>;
store: AutocompleteStore<TItem>;
}
export declare function onKeyDown<TItem extends BaseItem>({ event, props, refresh, store, ...setters }: OnKeyDownOptions<TItem>): void;
export {};

View file

@ -0,0 +1,205 @@
var _excluded = ["event", "props", "refresh", "store"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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; }
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; }
import { onInput } from './onInput';
import { getActiveItem } from './utils';
export function onKeyDown(_ref) {
var event = _ref.event,
props = _ref.props,
refresh = _ref.refresh,
store = _ref.store,
setters = _objectWithoutProperties(_ref, _excluded);
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
// eslint-disable-next-line no-inner-declarations
var triggerScrollIntoView = function triggerScrollIntoView() {
var nodeItem = props.environment.document.getElementById("".concat(props.id, "-item-").concat(store.getState().activeItemId));
if (nodeItem) {
if (nodeItem.scrollIntoViewIfNeeded) {
nodeItem.scrollIntoViewIfNeeded(false);
} else {
nodeItem.scrollIntoView(false);
}
}
}; // eslint-disable-next-line no-inner-declarations
var triggerOnActive = function triggerOnActive() {
var highlightedItem = getActiveItem(store.getState());
if (store.getState().activeItemId !== null && highlightedItem) {
var item = highlightedItem.item,
itemInputValue = highlightedItem.itemInputValue,
itemUrl = highlightedItem.itemUrl,
source = highlightedItem.source;
source.onActive(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
}
}; // Default browser behavior changes the caret placement on ArrowUp and
// ArrowDown.
event.preventDefault(); // When re-opening the panel, we need to split the logic to keep the actions
// synchronized as `onInput` returns a promise.
if (store.getState().isOpen === false && (props.openOnFocus || Boolean(store.getState().query))) {
onInput(_objectSpread({
event: event,
props: props,
query: store.getState().query,
refresh: refresh,
store: store
}, setters)).then(function () {
store.dispatch(event.key, {
nextActiveItemId: props.defaultActiveItemId
});
triggerOnActive(); // Since we rely on the DOM, we need to wait for all the micro tasks to
// finish (which include re-opening the panel) to make sure all the
// elements are available.
setTimeout(triggerScrollIntoView, 0);
});
} else {
store.dispatch(event.key, {});
triggerOnActive();
triggerScrollIntoView();
}
} else if (event.key === 'Escape') {
// This prevents the default browser behavior on `input[type="search"]`
// from removing the query right away because we first want to close the
// panel.
event.preventDefault();
store.dispatch(event.key, null); // Hitting the `Escape` key signals the end of a user interaction with the
// autocomplete. At this point, we should ignore any requests that are still
// pending and could reopen the panel once they resolve, because that would
// result in an unsolicited UI behavior.
store.pendingRequests.cancelAll();
} else if (event.key === 'Tab') {
store.dispatch('blur', null); // Hitting the `Escape` key signals the end of a user interaction with the
// autocomplete. At this point, we should ignore any requests that are still
// pending and could reopen the panel once they resolve, because that would
// result in an unsolicited UI behavior.
store.pendingRequests.cancelAll();
} else if (event.key === 'Enter') {
// No active item, so we let the browser handle the native `onSubmit` form
// event.
if (store.getState().activeItemId === null || store.getState().collections.every(function (collection) {
return collection.items.length === 0;
})) {
// If requests are still pending when the panel closes, they could reopen
// the panel once they resolve.
// We want to prevent any subsequent query from reopening the panel
// because it would result in an unsolicited UI behavior.
if (!props.debug) {
store.pendingRequests.cancelAll();
}
return;
} // This prevents the `onSubmit` event to be sent because an item is
// highlighted.
event.preventDefault();
var _ref2 = getActiveItem(store.getState()),
item = _ref2.item,
itemInputValue = _ref2.itemInputValue,
itemUrl = _ref2.itemUrl,
source = _ref2.source;
if (event.metaKey || event.ctrlKey) {
if (itemUrl !== undefined) {
source.onSelect(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
props.navigator.navigateNewTab({
itemUrl: itemUrl,
item: item,
state: store.getState()
});
}
} else if (event.shiftKey) {
if (itemUrl !== undefined) {
source.onSelect(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
props.navigator.navigateNewWindow({
itemUrl: itemUrl,
item: item,
state: store.getState()
});
}
} else if (event.altKey) {// Keep native browser behavior
} else {
if (itemUrl !== undefined) {
source.onSelect(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
props.navigator.navigate({
itemUrl: itemUrl,
item: item,
state: store.getState()
});
return;
}
onInput(_objectSpread({
event: event,
nextState: {
isOpen: false
},
props: props,
query: itemInputValue,
refresh: refresh,
store: store
}, setters)).then(function () {
source.onSelect(_objectSpread({
event: event,
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
refresh: refresh,
source: source,
state: store.getState()
}, setters));
});
}
}
}

View file

@ -0,0 +1,11 @@
import { AutocompleteCollection, AutocompleteState, BaseItem, InternalAutocompleteOptions } from './types';
declare type ReshapeParams<TItem extends BaseItem> = {
collections: Array<AutocompleteCollection<any>>;
props: InternalAutocompleteOptions<TItem>;
state: AutocompleteState<TItem>;
};
export declare function reshape<TItem extends BaseItem>({ collections, props, state, }: ReshapeParams<TItem>): {
source: import("./types").AutocompleteReshapeSource<TItem>;
items: TItem[];
}[];
export {};

View file

@ -0,0 +1,47 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { flatten } from '@algolia/autocomplete-shared';
export function reshape(_ref) {
var collections = _ref.collections,
props = _ref.props,
state = _ref.state;
// Sources are grouped by `sourceId` to conveniently pick them via destructuring.
// Example: `const { recentSearchesPlugin } = sourcesBySourceId`
var originalSourcesBySourceId = collections.reduce(function (acc, collection) {
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, collection.source.sourceId, _objectSpread(_objectSpread({}, collection.source), {}, {
getItems: function getItems() {
// We provide the resolved items from the collection to the `reshape` prop.
return flatten(collection.items);
}
})));
}, {});
var _props$plugins$reduce = props.plugins.reduce(function (acc, plugin) {
if (plugin.reshape) {
return plugin.reshape(acc);
}
return acc;
}, {
sourcesBySourceId: originalSourcesBySourceId,
state: state
}),
sourcesBySourceId = _props$plugins$reduce.sourcesBySourceId;
var reshapeSources = props.reshape({
sourcesBySourceId: sourcesBySourceId,
sources: Object.values(sourcesBySourceId),
state: state
}); // We reconstruct the collections with the items modified by the `reshape` prop.
return flatten(reshapeSources).filter(Boolean).map(function (source) {
return {
source: source,
items: source.getItems()
};
});
}

View file

@ -0,0 +1,42 @@
import type { ExecuteResponse, RequesterDescription, TransformResponse } from '@algolia/autocomplete-preset-algolia';
import { MultipleQueriesQuery, SearchForFacetValuesResponse, SearchResponse } from '@algolia/client-search';
import { AutocompleteState, AutocompleteStore, BaseItem, InternalAutocompleteSource } from './types';
declare type RequestDescriptionPreResolved<TItem extends BaseItem> = Pick<RequesterDescription<TItem>, 'execute' | 'requesterId' | 'searchClient' | 'transformResponse'> & {
requests: Array<{
query: MultipleQueriesQuery;
sourceId: string;
transformResponse: TransformResponse<TItem>;
}>;
};
declare type RequestDescriptionPreResolvedCustom<TItem extends BaseItem> = {
items: TItem[] | TItem[][];
sourceId: string;
transformResponse?: undefined;
};
export declare function preResolve<TItem extends BaseItem>(itemsOrDescription: TItem[] | TItem[][] | RequesterDescription<TItem>, sourceId: string, state: AutocompleteState<TItem>): RequestDescriptionPreResolved<TItem> | RequestDescriptionPreResolvedCustom<TItem>;
export declare function resolve<TItem extends BaseItem>(items: Array<RequestDescriptionPreResolved<TItem> | RequestDescriptionPreResolvedCustom<TItem>>): Promise<(RequestDescriptionPreResolvedCustom<TItem> | {
items: SearchForFacetValuesResponse | SearchResponse<TItem>;
sourceId: string;
transformResponse: TransformResponse<TItem>;
})[]>;
export declare function postResolve<TItem extends BaseItem>(responses: Array<RequestDescriptionPreResolvedCustom<TItem> | ExecuteResponse<TItem>[0]>, sources: Array<InternalAutocompleteSource<TItem>>, store: AutocompleteStore<TItem>): {
source: InternalAutocompleteSource<TItem>;
items: {
label: string;
count: number;
_highlightResult: {
label: {
value: string;
};
};
}[][] | {
label: string;
count: number;
_highlightResult: {
label: {
value: string;
};
};
}[] | import("@algolia/client-search").Hit<TItem>[] | (SearchForFacetValuesResponse | SearchResponse<TItem> | TItem[] | TItem[][])[];
}[];
export {};

View file

@ -0,0 +1,132 @@
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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; }
import { decycle, flatten, invariant } from '@algolia/autocomplete-shared';
import { mapToAlgoliaResponse } from './utils';
function isDescription(item) {
return Boolean(item.execute);
}
function isRequesterDescription(description) {
return Boolean(description === null || description === void 0 ? void 0 : description.execute);
}
export function preResolve(itemsOrDescription, sourceId, state) {
if (isRequesterDescription(itemsOrDescription)) {
var contextParameters = itemsOrDescription.requesterId === 'algolia' ? Object.assign.apply(Object, [{}].concat(_toConsumableArray(Object.keys(state.context).map(function (key) {
var _state$context$key;
return (_state$context$key = state.context[key]) === null || _state$context$key === void 0 ? void 0 : _state$context$key.__algoliaSearchParameters;
})))) : {};
return _objectSpread(_objectSpread({}, itemsOrDescription), {}, {
requests: itemsOrDescription.queries.map(function (query) {
return {
query: itemsOrDescription.requesterId === 'algolia' ? _objectSpread(_objectSpread({}, query), {}, {
params: _objectSpread(_objectSpread({}, contextParameters), query.params)
}) : query,
sourceId: sourceId,
transformResponse: itemsOrDescription.transformResponse
};
})
});
}
return {
items: itemsOrDescription,
sourceId: sourceId
};
}
export function resolve(items) {
var packed = items.reduce(function (acc, current) {
if (!isDescription(current)) {
acc.push(current);
return acc;
}
var searchClient = current.searchClient,
execute = current.execute,
requesterId = current.requesterId,
requests = current.requests;
var container = acc.find(function (item) {
return isDescription(current) && isDescription(item) && item.searchClient === searchClient && Boolean(requesterId) && item.requesterId === requesterId;
});
if (container) {
var _container$items;
(_container$items = container.items).push.apply(_container$items, _toConsumableArray(requests));
} else {
var request = {
execute: execute,
requesterId: requesterId,
items: requests,
searchClient: searchClient
};
acc.push(request);
}
return acc;
}, []);
var values = packed.map(function (maybeDescription) {
if (!isDescription(maybeDescription)) {
return Promise.resolve(maybeDescription);
}
var _ref = maybeDescription,
execute = _ref.execute,
items = _ref.items,
searchClient = _ref.searchClient;
return execute({
searchClient: searchClient,
requests: items
});
});
return Promise.all(values).then(function (responses) {
return flatten(responses);
});
}
export function postResolve(responses, sources, store) {
return sources.map(function (source) {
var matches = responses.filter(function (response) {
return response.sourceId === source.sourceId;
});
var results = matches.map(function (_ref2) {
var items = _ref2.items;
return items;
});
var transform = matches[0].transformResponse;
var items = transform ? transform(mapToAlgoliaResponse(results)) : results;
source.onResolve({
source: source,
results: results,
items: items,
state: store.getState()
});
invariant(Array.isArray(items), function () {
return "The `getItems` function from source \"".concat(source.sourceId, "\" must return an array of items but returned type ").concat(JSON.stringify(_typeof(items)), ":\n\n").concat(JSON.stringify(decycle(items), null, 2), ".\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems");
});
invariant(items.every(Boolean), "The `getItems` function from source \"".concat(source.sourceId, "\" must return an array of items but returned ").concat(JSON.stringify(undefined), ".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"));
return {
source: source,
items: items
};
});
}

View file

@ -0,0 +1,2 @@
import { Reducer } from './types';
export declare const stateReducer: Reducer;

View file

@ -0,0 +1,161 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { getItemsCount, invariant } from '@algolia/autocomplete-shared';
import { getCompletion } from './getCompletion';
import { getNextActiveItemId } from './utils';
export var stateReducer = function stateReducer(state, action) {
switch (action.type) {
case 'setActiveItemId':
{
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: action.payload
});
}
case 'setQuery':
{
return _objectSpread(_objectSpread({}, state), {}, {
query: action.payload,
completion: null
});
}
case 'setCollections':
{
return _objectSpread(_objectSpread({}, state), {}, {
collections: action.payload
});
}
case 'setIsOpen':
{
return _objectSpread(_objectSpread({}, state), {}, {
isOpen: action.payload
});
}
case 'setStatus':
{
return _objectSpread(_objectSpread({}, state), {}, {
status: action.payload
});
}
case 'setContext':
{
return _objectSpread(_objectSpread({}, state), {}, {
context: _objectSpread(_objectSpread({}, state.context), action.payload)
});
}
case 'ArrowDown':
{
var nextState = _objectSpread(_objectSpread({}, state), {}, {
activeItemId: action.payload.hasOwnProperty('nextActiveItemId') ? action.payload.nextActiveItemId : getNextActiveItemId(1, state.activeItemId, getItemsCount(state), action.props.defaultActiveItemId)
});
return _objectSpread(_objectSpread({}, nextState), {}, {
completion: getCompletion({
state: nextState
})
});
}
case 'ArrowUp':
{
var _nextState = _objectSpread(_objectSpread({}, state), {}, {
activeItemId: getNextActiveItemId(-1, state.activeItemId, getItemsCount(state), action.props.defaultActiveItemId)
});
return _objectSpread(_objectSpread({}, _nextState), {}, {
completion: getCompletion({
state: _nextState
})
});
}
case 'Escape':
{
if (state.isOpen) {
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: null,
isOpen: false,
completion: null
});
}
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: null,
query: '',
status: 'idle',
collections: []
});
}
case 'submit':
{
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: null,
isOpen: false,
status: 'idle'
});
}
case 'reset':
{
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: // Since we open the panel on reset when openOnFocus=true
// we need to restore the highlighted index to the defaultActiveItemId. (DocSearch use-case)
// Since we close the panel when openOnFocus=false
// we lose track of the highlighted index. (Query-suggestions use-case)
action.props.openOnFocus === true ? action.props.defaultActiveItemId : null,
status: 'idle',
query: ''
});
}
case 'focus':
{
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: action.props.defaultActiveItemId,
isOpen: (action.props.openOnFocus || Boolean(state.query)) && action.props.shouldPanelOpen({
state: state
})
});
}
case 'blur':
{
if (action.props.debug) {
return state;
}
return _objectSpread(_objectSpread({}, state), {}, {
isOpen: false,
activeItemId: null
});
}
case 'mousemove':
{
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: action.payload
});
}
case 'mouseleave':
{
return _objectSpread(_objectSpread({}, state), {}, {
activeItemId: action.props.defaultActiveItemId
});
}
default:
invariant(false, "The reducer action ".concat(JSON.stringify(action.type), " is not supported."));
return state;
}
};

View file

@ -0,0 +1,15 @@
import { AutocompleteNavigator } from './AutocompleteNavigator';
import { AutocompletePropGetters } from './AutocompletePropGetters';
import { AutocompleteSetters } from './AutocompleteSetters';
export declare type BaseItem = Record<string, unknown>;
export interface AutocompleteScopeApi<TItem extends BaseItem> extends AutocompleteSetters<TItem> {
/**
* Triggers a search to refresh the state.
*/
refresh(): Promise<void>;
/**
* Functions to navigate to a URL.
*/
navigator: AutocompleteNavigator<TItem>;
}
export declare type AutocompleteApi<TItem extends BaseItem, TEvent = Event, TMouseEvent = MouseEvent, TKeyboardEvent = KeyboardEvent> = AutocompleteScopeApi<TItem> & AutocompletePropGetters<TItem, TEvent, TMouseEvent, TKeyboardEvent>;

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,10 @@
import { BaseItem } from './AutocompleteApi';
import { InternalAutocompleteSource } from './AutocompleteSource';
export interface AutocompleteCollection<TItem extends BaseItem> {
source: InternalAutocompleteSource<TItem>;
items: TItem[];
}
export interface AutocompleteCollectionItemsArray<TItem extends BaseItem> {
source: InternalAutocompleteSource<TItem>;
items: TItem[][];
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,3 @@
export interface AutocompleteContext {
[key: string]: unknown;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,13 @@
export declare type AutocompleteEnvironment = Window | {
[prop: string]: unknown;
addEventListener: Window['addEventListener'];
removeEventListener: Window['removeEventListener'];
setTimeout: Window['setTimeout'];
clearTimeout: Window['clearTimeout'];
document: Window['document'];
location: {
assign: Location['assign'];
};
open: Window['open'];
navigator?: Partial<Window['navigator']>;
};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,28 @@
import { BaseItem } from './AutocompleteApi';
import { AutocompleteState } from './AutocompleteState';
export interface AutocompleteNavigator<TItem extends BaseItem> {
/**
* Called when a URL should be open in the current page.
*/
navigate(params: {
itemUrl: string;
item: TItem;
state: AutocompleteState<TItem>;
}): void;
/**
* Called when a URL should be open in a new tab.
*/
navigateNewTab(params: {
itemUrl: string;
item: TItem;
state: AutocompleteState<TItem>;
}): void;
/**
* Called when a URL should be open in a new window.
*/
navigateNewWindow(params: {
itemUrl: string;
item: TItem;
state: AutocompleteState<TItem>;
}): void;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,185 @@
import { MaybePromise } from '@algolia/autocomplete-shared';
import { AutocompleteScopeApi, BaseItem } from './AutocompleteApi';
import { AutocompleteEnvironment } from './AutocompleteEnvironment';
import { AutocompleteNavigator } from './AutocompleteNavigator';
import { AutocompletePlugin } from './AutocompletePlugin';
import { Reshape } from './AutocompleteReshape';
import { AutocompleteSource, InternalAutocompleteSource } from './AutocompleteSource';
import { AutocompleteState } from './AutocompleteState';
export interface OnSubmitParams<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
state: AutocompleteState<TItem>;
event: any;
}
export declare type OnResetParams<TItem extends BaseItem> = OnSubmitParams<TItem>;
export interface OnInputParams<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
query: string;
state: AutocompleteState<TItem>;
}
export declare type GetSourcesParams<TItem extends BaseItem> = OnInputParams<TItem>;
export declare type GetSources<TItem extends BaseItem> = (params: GetSourcesParams<TItem>) => MaybePromise<Array<AutocompleteSource<TItem> | boolean | undefined>>;
export declare type InternalGetSources<TItem extends BaseItem> = (params: GetSourcesParams<TItem>) => Promise<Array<InternalAutocompleteSource<TItem>>>;
interface OnStateChangeProps<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
/**
* The current Autocomplete state.
*/
state: AutocompleteState<TItem>;
/**
* The previous Autocomplete state.
*/
prevState: AutocompleteState<TItem>;
}
export interface AutocompleteOptions<TItem extends BaseItem> {
/**
* A flag to activate the debug mode.
*
* This is useful while developing because it keeps the panel open even when the blur event occurs. **Make sure to disable it in production.**
*
* See [**Debugging**](https://www.algolia.com/doc/ui-libraries/autocomplete/guides/debugging/) for more information.
*
* @default false
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-debug
*/
debug?: boolean;
/**
* An ID for the autocomplete to create accessible attributes.
*
* It is incremented by default when creating a new Autocomplete instance.
*
* @default "autocomplete-0"
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-id
*/
id?: string;
/**
* The function called when the internal state changes.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-onstatechange
*/
onStateChange?(props: OnStateChangeProps<TItem>): void;
/**
* The placeholder text to show in the search input when there's no query.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-placeholder
*/
placeholder?: string;
/**
* Whether to focus the search input or not when the page is loaded.
*
* @default false
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-autofocus
*/
autoFocus?: boolean;
/**
* The default item index to pre-select.
*
* We recommend using `0` when the autocomplete is used to open links, instead of triggering a search in an application.
*
* @default null
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-defaultactiveitemid
*/
defaultActiveItemId?: number | null;
/**
* Whether to open the panel on focus when there's no query.
*
* @default false
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-openonfocus
*/
openOnFocus?: boolean;
/**
* How many milliseconds must elapse before considering the autocomplete experience [stalled](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-status).
*
* @default 300
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-stallthreshold
*/
stallThreshold?: number;
/**
* The initial state to apply when autocomplete is created.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-initialstate
*/
initialState?: Partial<AutocompleteState<TItem>>;
/**
* The [sources](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/) to get the suggestions from.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-getsources
*/
getSources?: GetSources<TItem>;
/**
* The environment in which your application is running.
*
* This is useful if you're using autocomplete in a different context than `window`.
*
* @default window
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-environment
*/
environment?: AutocompleteEnvironment;
/**
* An implementation of Autocomplete's Navigator API to redirect the user when opening a link.
*
* Learn more on the [**Navigator API**](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/keyboard-navigation/) documentation.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-navigator
*/
navigator?: Partial<AutocompleteNavigator<TItem>>;
/**
* The function called to determine whether the panel should open or not.
*
* By default, the panel opens when there are items in the state.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-shouldpanelopen
*/
shouldPanelOpen?(params: {
state: AutocompleteState<TItem>;
}): boolean;
/**
* The function called when submitting the Autocomplete form.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-onsubmit
*/
onSubmit?(params: OnSubmitParams<TItem>): void;
/**
* The function called when resetting the Autocomplete form.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-onreset
*/
onReset?(params: OnResetParams<TItem>): void;
/**
* The plugins that encapsulate and distribute custom Autocomplete behaviors.
*
* See [**Plugins**](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/) for more information.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-plugins
*/
plugins?: Array<AutocompletePlugin<any, any>>;
/**
* The function called to reshape the sources after they're resolved.
*
* This is useful to transform sources before rendering them. You can group sources by attribute, remove duplicates, create shared limits between sources, etc.
*
* See [**Reshaping sources**](https://www.algolia.com/doc/ui-libraries/autocomplete/guides/reshaping-sources/) for more information.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-reshape
*/
reshape?: Reshape<TItem>;
}
export interface InternalAutocompleteOptions<TItem extends BaseItem> extends AutocompleteOptions<TItem> {
debug: boolean;
id: string;
onStateChange(props: OnStateChangeProps<TItem>): void;
placeholder: string;
autoFocus: boolean;
defaultActiveItemId: number | null;
openOnFocus: boolean;
stallThreshold: number;
initialState: AutocompleteState<TItem>;
getSources: InternalGetSources<TItem>;
environment: AutocompleteEnvironment;
navigator: AutocompleteNavigator<TItem>;
plugins: Array<AutocompletePlugin<any, any>>;
shouldPanelOpen(params: {
state: AutocompleteState<TItem>;
}): boolean;
onSubmit(params: OnSubmitParams<TItem>): void;
onReset(params: OnResetParams<TItem>): void;
reshape: Reshape<TItem>;
}
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,43 @@
import { AutocompleteScopeApi, BaseItem } from './AutocompleteApi';
import { AutocompleteOptions } from './AutocompleteOptions';
import { PluginReshape } from './AutocompleteReshape';
import { OnSelectParams, OnActiveParams, OnResolveParams } from './AutocompleteSource';
declare type PluginSubscriber<TParams> = (params: TParams) => void;
export interface PluginSubscribeParams<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
onSelect(fn: PluginSubscriber<OnSelectParams<TItem>>): void;
onActive(fn: PluginSubscriber<OnActiveParams<TItem>>): void;
onResolve(fn: PluginSubscriber<OnResolveParams<TItem>>): void;
}
export declare type AutocompletePlugin<TItem extends BaseItem, TData = unknown> = Partial<Pick<AutocompleteOptions<any>, 'onStateChange' | 'onSubmit' | 'onReset'> & Pick<AutocompleteOptions<TItem>, 'getSources'>> & {
/**
* The function called when Autocomplete starts.
*
* It lets you subscribe to lifecycle hooks and interact with the instance's state and context.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/#param-subscribe
*/
subscribe?(params: PluginSubscribeParams<any>): void;
/**
* An extra plugin object to expose properties and functions as APIs.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/#param-data
*/
data?: TData;
/**
* A name to identify the plugin.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/#param-name
*/
name?: string;
/**
* A function to reshape the sources.
*
* It gets called before the user's reshape function.
*/
reshape?: PluginReshape<TItem>;
/**
* @internal
*/
__autocomplete_pluginOptions?: Record<string, any>;
};
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,100 @@
import { BaseItem } from './AutocompleteApi';
import { InternalAutocompleteSource } from './AutocompleteSource';
export interface AutocompletePropGetters<TItem extends BaseItem, TEvent = Event, TMouseEvent = MouseEvent, TKeyboardEvent = KeyboardEvent> {
getEnvironmentProps: GetEnvironmentProps;
getRootProps: GetRootProps;
getFormProps: GetFormProps<TEvent>;
getLabelProps: GetLabelProps;
getInputProps: GetInputProps<TEvent, TMouseEvent, TKeyboardEvent>;
getPanelProps: GetPanelProps<TMouseEvent>;
getListProps: GetListProps;
getItemProps: GetItemProps<TItem, TMouseEvent>;
}
export declare type GetEnvironmentProps = (props: {
[key: string]: unknown;
formElement: HTMLElement;
inputElement: HTMLInputElement;
panelElement: HTMLElement;
}) => {
onTouchStart(event: TouchEvent): void;
onTouchMove(event: TouchEvent): void;
onMouseDown(event: MouseEvent): void;
};
export declare type GetRootProps = (props?: {
[key: string]: unknown;
}) => {
role: string;
'aria-expanded': boolean;
'aria-haspopup': boolean | 'dialog' | 'menu' | 'true' | 'false' | 'grid' | 'listbox' | 'tree' | undefined;
'aria-owns': string | undefined;
'aria-labelledby': string;
};
export declare type GetFormProps<TEvent = Event> = (props: {
[key: string]: unknown;
inputElement: HTMLInputElement | null;
}) => {
action: '';
noValidate: true;
role: 'search';
onSubmit(event: TEvent): void;
onReset(event: TEvent): void;
};
export declare type GetLabelProps = (props?: {
[key: string]: unknown;
sourceIndex?: number;
}) => {
htmlFor: string;
id: string;
};
export declare type GetInputProps<TEvent, TMouseEvent, TKeyboardEvent> = (props: {
[key: string]: unknown;
inputElement: HTMLInputElement | null;
maxLength?: number;
}) => {
id: string;
value: string;
autoFocus: boolean;
placeholder: string;
autoComplete: 'on' | 'off';
autoCorrect: 'on' | 'off';
autoCapitalize: 'on' | 'off';
enterKeyHint: 'go' | 'search';
spellCheck: 'false';
maxLength: number;
type: 'search';
'aria-autocomplete': 'none' | 'inline' | 'list' | 'both';
'aria-activedescendant': string | undefined;
'aria-controls': string | undefined;
'aria-labelledby': string;
onChange(event: TEvent): void;
onKeyDown(event: TKeyboardEvent): void;
onFocus(event: TEvent): void;
onBlur(): void;
onClick(event: TMouseEvent): void;
};
export declare type GetPanelProps<TMouseEvent> = (props?: {
[key: string]: unknown;
}) => {
onMouseDown(event: TMouseEvent): void;
onMouseLeave(): void;
};
export declare type GetListProps = (props?: {
[key: string]: unknown;
sourceIndex?: number;
}) => {
role: string;
'aria-labelledby': string;
id: string;
};
export declare type GetItemProps<TItem extends BaseItem, TMouseEvent = MouseEvent> = (props: {
[key: string]: unknown;
item: TItem;
source: InternalAutocompleteSource<TItem>;
}) => {
id: string;
role: string;
'aria-selected': boolean;
onMouseMove(event: TMouseEvent): void;
onMouseDown(event: TMouseEvent): void;
onClick(event: TMouseEvent): void;
};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,25 @@
import { BaseItem } from './AutocompleteApi';
import { AutocompleteSource } from './AutocompleteSource';
import { AutocompleteState } from './AutocompleteState';
export declare type AutocompleteReshapeSource<TItem extends BaseItem> = AutocompleteSource<TItem> & {
getItems(): TItem[];
};
export declare type AutocompleteReshapeSourcesBySourceId<TItem extends BaseItem> = Record<string, AutocompleteReshapeSource<TItem>>;
export declare type ReshapeParams<TItem extends BaseItem, TState extends AutocompleteState<TItem> = AutocompleteState<TItem>> = {
/**
* The resolved sources provided by [`getSources`](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getsources)
*/
sources: Array<AutocompleteReshapeSource<TItem>>;
/**
* The resolved sources grouped by [`sourceId`](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-sourceid)s
*/
sourcesBySourceId: AutocompleteReshapeSourcesBySourceId<TItem>;
/**
* The current Autocomplete state.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state
*/
state: TState;
};
export declare type Reshape<TItem extends BaseItem, TState extends AutocompleteState<TItem> = AutocompleteState<TItem>> = (params: ReshapeParams<TItem, TState>) => Array<AutocompleteReshapeSource<TItem>>;
export declare type PluginReshape<TItem extends BaseItem, TState extends AutocompleteState<TItem> = AutocompleteState<TItem>> = (params: Omit<ReshapeParams<TItem, TState>, 'sources'>) => Omit<ReshapeParams<TItem, TState>, 'sources'>;

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,46 @@
import { BaseItem } from './AutocompleteApi';
import { AutocompleteCollection, AutocompleteCollectionItemsArray } from './AutocompleteCollection';
import { AutocompleteState } from './AutocompleteState';
export declare type StateUpdater<TState> = (value: TState) => void;
export interface AutocompleteSetters<TItem extends BaseItem> {
/**
* Sets the highlighted item index.
*
* Pass `null` to unselect items.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setactiveitemid
*/
setActiveItemId: StateUpdater<AutocompleteState<TItem>['activeItemId']>;
/**
* Sets the query.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setquery
*/
setQuery: StateUpdater<AutocompleteState<TItem>['query']>;
/**
* Sets the collections.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setcollections
*/
setCollections: StateUpdater<Array<AutocompleteCollection<TItem> | AutocompleteCollectionItemsArray<TItem>>>;
/**
* Sets whether the panel is open or not.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setisopen
*/
setIsOpen: StateUpdater<AutocompleteState<TItem>['isOpen']>;
/**
* Sets the status of the autocomplete.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setisopen
*/
setStatus: StateUpdater<AutocompleteState<TItem>['status']>;
/**
* Sets the context passed to lifecycle hooks.
*
* See more in [**Context**](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/context/).
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setcontext
*/
setContext: StateUpdater<AutocompleteState<TItem>['context']>;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,75 @@
import type { SearchForFacetValuesResponse, SearchResponse, RequesterDescription } from '@algolia/autocomplete-preset-algolia';
import type { MaybePromise } from '@algolia/autocomplete-shared';
import { FacetHit, Hit } from '@algolia/client-search';
import { AutocompleteScopeApi, BaseItem } from './AutocompleteApi';
import { GetSourcesParams } from './AutocompleteOptions';
import { AutocompleteState } from './AutocompleteState';
export interface OnSelectParams<TItem extends BaseItem> extends AutocompleteScopeApi<TItem> {
state: AutocompleteState<TItem>;
event: any;
item: TItem;
itemInputValue: ReturnType<InternalAutocompleteSource<TItem>['getItemInputValue']>;
itemUrl: ReturnType<InternalAutocompleteSource<TItem>['getItemUrl']>;
source: InternalAutocompleteSource<TItem>;
}
export declare type OnActiveParams<TItem extends BaseItem> = OnSelectParams<TItem>;
export declare type OnResolveParams<TItem extends BaseItem> = {
source: AutocompleteSource<TItem>;
results: SearchForFacetValuesResponse | SearchResponse<TItem> | TItem[] | TItem[][];
items: FacetHit[][] | FacetHit[] | Array<Hit<TItem>> | Array<SearchForFacetValuesResponse | SearchResponse<TItem> | TItem[] | TItem[][]>;
state: AutocompleteState<TItem>;
};
declare type DefaultIndicator = {
/**
* Optional key on a function to indicate it's the default value of this function.
*/
__default?: boolean;
};
export interface AutocompleteSource<TItem extends BaseItem> {
/**
* Unique identifier for the source.
*/
sourceId: string;
/**
* The function called to get the value of an item.
*
* The value is used to fill the search box.
*/
getItemInputValue?: DefaultIndicator & (({ item, state, }: {
item: TItem;
state: AutocompleteState<TItem>;
}) => string);
/**
* The function called to get the URL of the item.
*
* The value is used to add [keyboard accessibility](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/keyboard-navigation/) features to let users open items in the current tab, a new tab, or a new window.
*/
getItemUrl?: DefaultIndicator & (({ item, state, }: {
item: TItem;
state: AutocompleteState<TItem>;
}) => string | undefined);
/**
* The function called when the input changes.
*
* You can use this function to filter the items based on the query.
*/
getItems(params: GetSourcesParams<TItem>): MaybePromise<TItem[] | TItem[][] | RequesterDescription<TItem>>;
/**
* The function called whenever an item is selected.
*/
onSelect?: DefaultIndicator & ((params: OnSelectParams<TItem>) => void);
/**
* The function called whenever an item is active.
*
* You can trigger different behaviors if the item is active depending on the triggering event using the `event` parameter.
*/
onActive?: DefaultIndicator & ((params: OnActiveParams<TItem>) => void);
/**
* The function called whenever a source resolves.
*/
onResolve?: DefaultIndicator & ((params: OnResolveParams<TItem>) => void);
}
export declare type InternalAutocompleteSource<TItem extends BaseItem> = {
[KParam in keyof AutocompleteSource<TItem>]-?: AutocompleteSource<TItem>[KParam];
};
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,12 @@
import { BaseItem } from './AutocompleteApi';
import { AutocompleteCollection } from './AutocompleteCollection';
import { AutocompleteContext } from './AutocompleteContext';
export interface AutocompleteState<TItem extends BaseItem> {
activeItemId: number | null;
query: string;
completion: string | null;
collections: Array<AutocompleteCollection<TItem>>;
isOpen: boolean;
status: 'idle' | 'loading' | 'stalled' | 'error';
context: AutocompleteContext;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,17 @@
import { CancelablePromiseList } from '../utils';
import { BaseItem } from './AutocompleteApi';
import { InternalAutocompleteOptions } from './AutocompleteOptions';
import { AutocompleteState } from './AutocompleteState';
export interface AutocompleteStore<TItem extends BaseItem> {
getState(): AutocompleteState<TItem>;
dispatch(action: ActionType, payload: any): void;
pendingRequests: CancelablePromiseList<void>;
}
export declare type Reducer = <TItem extends BaseItem>(state: AutocompleteState<TItem>, action: Action<TItem, any>) => AutocompleteState<TItem>;
declare type Action<TItem extends BaseItem, TPayload> = {
type: ActionType;
props: InternalAutocompleteOptions<TItem>;
payload: TPayload;
};
export declare type ActionType = 'setActiveItemId' | 'setQuery' | 'setCollections' | 'setIsOpen' | 'setStatus' | 'setContext' | 'ArrowUp' | 'ArrowDown' | 'Escape' | 'Enter' | 'submit' | 'reset' | 'focus' | 'blur' | 'mousemove' | 'mouseleave' | 'click';
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,8 @@
import { BaseItem } from './AutocompleteApi';
import { OnActiveParams, OnResolveParams, OnSelectParams } from './AutocompleteSource';
export declare type AutocompleteSubscriber<TItem extends BaseItem> = {
onSelect(params: OnSelectParams<TItem>): void;
onActive(params: OnActiveParams<TItem>): void;
onResolve(params: OnResolveParams<TItem>): void;
};
export declare type AutocompleteSubscribers<TItem extends BaseItem> = Array<Partial<AutocompleteSubscriber<TItem>>>;

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,13 @@
export * from './AutocompleteApi';
export * from './AutocompleteCollection';
export * from './AutocompleteContext';
export * from './AutocompleteEnvironment';
export * from './AutocompleteOptions';
export * from './AutocompleteSource';
export * from './AutocompletePropGetters';
export * from './AutocompletePlugin';
export * from './AutocompleteReshape';
export * from './AutocompleteSetters';
export * from './AutocompleteState';
export * from './AutocompleteStore';
export * from './AutocompleteSubscribers';

View file

@ -0,0 +1,13 @@
export * from './AutocompleteApi';
export * from './AutocompleteCollection';
export * from './AutocompleteContext';
export * from './AutocompleteEnvironment';
export * from './AutocompleteOptions';
export * from './AutocompleteSource';
export * from './AutocompletePropGetters';
export * from './AutocompletePlugin';
export * from './AutocompleteReshape';
export * from './AutocompleteSetters';
export * from './AutocompleteState';
export * from './AutocompleteStore';
export * from './AutocompleteSubscribers';

View file

@ -0,0 +1,15 @@
declare type PromiseExecutor<TValue> = (resolve: (value: TValue | PromiseLike<TValue>) => void, reject: (reason?: any) => void) => void;
export declare type CancelablePromise<TValue> = {
then<TResultFulfilled = TValue, TResultRejected = never>(onfulfilled?: ((value: TValue) => TResultFulfilled | PromiseLike<TResultFulfilled> | CancelablePromise<TResultFulfilled>) | undefined | null, onrejected?: ((reason: any) => TResultRejected | PromiseLike<TResultRejected> | CancelablePromise<TResultRejected>) | undefined | null): CancelablePromise<TResultFulfilled | TResultRejected>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult> | CancelablePromise<TResult>) | undefined | null): CancelablePromise<TValue | TResult>;
finally(onfinally?: (() => void) | undefined | null): CancelablePromise<TValue>;
cancel(): void;
isCanceled(): boolean;
};
export declare function createCancelablePromise<TValue>(executor: PromiseExecutor<TValue>): CancelablePromise<TValue>;
export declare namespace createCancelablePromise {
var resolve: <TValue>(value?: TValue | PromiseLike<TValue> | CancelablePromise<TValue> | undefined) => CancelablePromise<TValue | CancelablePromise<TValue> | undefined>;
var reject: (reason?: any) => CancelablePromise<never>;
}
export declare function cancelable<TValue>(promise: Promise<TValue>): CancelablePromise<TValue>;
export {};

View file

@ -0,0 +1,70 @@
function createInternalCancelablePromise(promise, initialState) {
var state = initialState;
return {
then: function then(onfulfilled, onrejected) {
return createInternalCancelablePromise(promise.then(createCallback(onfulfilled, state, promise), createCallback(onrejected, state, promise)), state);
},
catch: function _catch(onrejected) {
return createInternalCancelablePromise(promise.catch(createCallback(onrejected, state, promise)), state);
},
finally: function _finally(onfinally) {
if (onfinally) {
state.onCancelList.push(onfinally);
}
return createInternalCancelablePromise(promise.finally(createCallback(onfinally && function () {
state.onCancelList = [];
return onfinally();
}, state, promise)), state);
},
cancel: function cancel() {
state.isCanceled = true;
var callbacks = state.onCancelList;
state.onCancelList = [];
callbacks.forEach(function (callback) {
callback();
});
},
isCanceled: function isCanceled() {
return state.isCanceled === true;
}
};
}
export function createCancelablePromise(executor) {
return createInternalCancelablePromise(new Promise(function (resolve, reject) {
return executor(resolve, reject);
}), {
isCanceled: false,
onCancelList: []
});
}
createCancelablePromise.resolve = function (value) {
return cancelable(Promise.resolve(value));
};
createCancelablePromise.reject = function (reason) {
return cancelable(Promise.reject(reason));
};
export function cancelable(promise) {
return createInternalCancelablePromise(promise, {
isCanceled: false,
onCancelList: []
});
}
function createCallback(onResult, state, fallback) {
if (!onResult) {
return fallback;
}
return function callback(arg) {
if (state.isCanceled) {
return arg;
}
return onResult(arg);
};
}

View file

@ -0,0 +1,21 @@
import { CancelablePromise } from '.';
export declare type CancelablePromiseList<TValue> = {
/**
* Add a cancelable promise to the list.
*
* @param cancelablePromise The cancelable promise to add.
*/
add(cancelablePromise: CancelablePromise<TValue>): CancelablePromise<TValue>;
/**
* Cancel all pending promises.
*
* Requests aren't actually stopped. All pending promises will settle, but
* attached handlers won't run.
*/
cancelAll(): void;
/**
* Whether there are pending promises in the list.
*/
isEmpty(): boolean;
};
export declare function createCancelablePromiseList<TValue>(): CancelablePromiseList<TValue>;

View file

@ -0,0 +1,21 @@
export function createCancelablePromiseList() {
var list = [];
return {
add: function add(cancelablePromise) {
list.push(cancelablePromise);
return cancelablePromise.finally(function () {
list = list.filter(function (item) {
return item !== cancelablePromise;
});
});
},
cancelAll: function cancelAll() {
list.forEach(function (promise) {
return promise.cancel();
});
},
isEmpty: function isEmpty() {
return list.length === 0;
}
};
}

View file

@ -0,0 +1,8 @@
import { MaybePromise } from '@algolia/autocomplete-shared';
/**
* Creates a runner that executes promises in a concurrent-safe way.
*
* This is useful to prevent older promises to resolve after a newer promise,
* otherwise resulting in stale resolved values.
*/
export declare function createConcurrentSafePromise(): <TValue>(promise: MaybePromise<TValue>) => Promise<TValue>;

View file

@ -0,0 +1,37 @@
/**
* Creates a runner that executes promises in a concurrent-safe way.
*
* This is useful to prevent older promises to resolve after a newer promise,
* otherwise resulting in stale resolved values.
*/
export function createConcurrentSafePromise() {
var basePromiseId = -1;
var latestResolvedId = -1;
var latestResolvedValue = undefined;
return function runConcurrentSafePromise(promise) {
basePromiseId++;
var currentPromiseId = basePromiseId;
return Promise.resolve(promise).then(function (x) {
// The promise might take too long to resolve and get outdated. This would
// result in resolving stale values.
// When this happens, we ignore the promise value and return the one
// coming from the latest resolved value.
//
// +----------------------------------+
// | 100ms |
// | run(1) +---> R1 |
// | 300ms |
// | run(2) +-------------> R2 (SKIP) |
// | 200ms |
// | run(3) +--------> R3 |
// +----------------------------------+
if (latestResolvedValue && currentPromiseId < latestResolvedId) {
return latestResolvedValue;
}
latestResolvedId = currentPromiseId;
latestResolvedValue = x;
return x;
});
};
}

View file

@ -0,0 +1,7 @@
import { AutocompleteState, BaseItem } from '../types';
export declare function getActiveItem<TItem extends BaseItem>(state: AutocompleteState<TItem>): {
item: TItem;
itemInputValue: string;
itemUrl: string | undefined;
source: import("../types").InternalAutocompleteSource<TItem>;
} | null;

View file

@ -0,0 +1,85 @@
// We don't have access to the autocomplete source when we call `onKeyDown`
// or `onClick` because those are native browser events.
// However, we can get the source from the suggestion index.
function getCollectionFromActiveItemId(state) {
// Given 3 sources with respectively 1, 2 and 3 suggestions: [1, 2, 3]
// We want to get the accumulated counts:
// [1, 1 + 2, 1 + 2 + 3] = [1, 3, 3 + 3] = [1, 3, 6]
var accumulatedCollectionsCount = state.collections.map(function (collections) {
return collections.items.length;
}).reduce(function (acc, collectionsCount, index) {
var previousValue = acc[index - 1] || 0;
var nextValue = previousValue + collectionsCount;
acc.push(nextValue);
return acc;
}, []); // Based on the accumulated counts, we can infer the index of the suggestion.
var collectionIndex = accumulatedCollectionsCount.reduce(function (acc, current) {
if (current <= state.activeItemId) {
return acc + 1;
}
return acc;
}, 0);
return state.collections[collectionIndex];
}
/**
* Gets the highlighted index relative to a suggestion object (not the absolute
* highlighted index).
*
* Example:
* [['a', 'b'], ['c', 'd', 'e'], ['f']]
*
* (absolute: 3, relative: 1)
*/
function getRelativeActiveItemId(_ref) {
var state = _ref.state,
collection = _ref.collection;
var isOffsetFound = false;
var counter = 0;
var previousItemsOffset = 0;
while (isOffsetFound === false) {
var currentCollection = state.collections[counter];
if (currentCollection === collection) {
isOffsetFound = true;
break;
}
previousItemsOffset += currentCollection.items.length;
counter++;
}
return state.activeItemId - previousItemsOffset;
}
export function getActiveItem(state) {
var collection = getCollectionFromActiveItemId(state);
if (!collection) {
return null;
}
var item = collection.items[getRelativeActiveItemId({
state: state,
collection: collection
})];
var source = collection.source;
var itemInputValue = source.getItemInputValue({
item: item,
state: state
});
var itemUrl = source.getItemUrl({
item: item,
state: state
});
return {
item: item,
itemInputValue: itemInputValue,
itemUrl: itemUrl,
source: source
};
}

View file

@ -0,0 +1,17 @@
/**
* Returns the next active item ID from the current state.
*
* We allow circular keyboard navigation from the base index.
* The base index can either be `null` (nothing is highlighted) or `0`
* (the first item is highlighted).
* The base index is allowed to get assigned `null` only if
* `props.defaultActiveItemId` is `null`. This pattern allows to "stop"
* by the actual query before navigating to other suggestions as seen on
* Google or Amazon.
*
* @param moveAmount The offset to increment (or decrement) the last index
* @param baseIndex The current index to compute the next index from
* @param itemCount The number of items
* @param defaultActiveItemId The default active index to fallback to
*/
export declare function getNextActiveItemId(moveAmount: number, baseIndex: number | null, itemCount: number, defaultActiveItemId: number | null): number | null;

View file

@ -0,0 +1,33 @@
/**
* Returns the next active item ID from the current state.
*
* We allow circular keyboard navigation from the base index.
* The base index can either be `null` (nothing is highlighted) or `0`
* (the first item is highlighted).
* The base index is allowed to get assigned `null` only if
* `props.defaultActiveItemId` is `null`. This pattern allows to "stop"
* by the actual query before navigating to other suggestions as seen on
* Google or Amazon.
*
* @param moveAmount The offset to increment (or decrement) the last index
* @param baseIndex The current index to compute the next index from
* @param itemCount The number of items
* @param defaultActiveItemId The default active index to fallback to
*/
export function getNextActiveItemId(moveAmount, baseIndex, itemCount, defaultActiveItemId) {
if (!itemCount) {
return null;
}
if (moveAmount < 0 && (baseIndex === null || defaultActiveItemId !== null && baseIndex === 0)) {
return itemCount + moveAmount;
}
var numericIndex = (baseIndex === null ? -1 : baseIndex) + moveAmount;
if (numericIndex <= -1 || numericIndex >= itemCount) {
return defaultActiveItemId === null ? null : 0;
}
return numericIndex;
}

View file

@ -0,0 +1,2 @@
import { BaseItem, GetSources, GetSourcesParams, InternalGetSources } from '../types';
export declare function getNormalizedSources<TItem extends BaseItem>(getSources: GetSources<TItem>, params: GetSourcesParams<TItem>): ReturnType<InternalGetSources<TItem>>;

View file

@ -0,0 +1,53 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
import { invariant, decycle, noop } from '@algolia/autocomplete-shared';
export function getNormalizedSources(getSources, params) {
var seenSourceIds = [];
return Promise.resolve(getSources(params)).then(function (sources) {
invariant(Array.isArray(sources), function () {
return "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof(sources)), ":\n\n").concat(JSON.stringify(decycle(sources), null, 2));
});
return Promise.all(sources // We allow `undefined` and `false` sources to allow users to use
// `Boolean(query) && source` (=> `false`).
// We need to remove these values at this point.
.filter(function (maybeSource) {
return Boolean(maybeSource);
}).map(function (source) {
invariant(typeof source.sourceId === 'string', 'A source must provide a `sourceId` string.');
if (seenSourceIds.includes(source.sourceId)) {
throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(source.sourceId), " is not unique."));
}
seenSourceIds.push(source.sourceId);
var defaultSource = {
getItemInputValue: function getItemInputValue(_ref) {
var state = _ref.state;
return state.query;
},
getItemUrl: function getItemUrl() {
return undefined;
},
onSelect: function onSelect(_ref2) {
var setIsOpen = _ref2.setIsOpen;
setIsOpen(false);
},
onActive: noop,
onResolve: noop
};
Object.keys(defaultSource).forEach(function (key) {
defaultSource[key].__default = true;
});
var normalizedSource = _objectSpread(_objectSpread({}, defaultSource), source);
return Promise.resolve(normalizedSource);
}));
});
}

View file

@ -0,0 +1,9 @@
export * from './createCancelablePromise';
export * from './createCancelablePromiseList';
export * from './createConcurrentSafePromise';
export * from './getNextActiveItemId';
export * from './getNormalizedSources';
export * from './getActiveItem';
export * from './isOrContainsNode';
export * from './isSamsung';
export * from './mapToAlgoliaResponse';

View file

@ -0,0 +1,9 @@
export * from './createCancelablePromise';
export * from './createCancelablePromiseList';
export * from './createConcurrentSafePromise';
export * from './getNextActiveItemId';
export * from './getNormalizedSources';
export * from './getActiveItem';
export * from './isOrContainsNode';
export * from './isSamsung';
export * from './mapToAlgoliaResponse';

View file

@ -0,0 +1 @@
export declare function isOrContainsNode(parent: Node, child: Node): boolean;

View file

@ -0,0 +1,3 @@
export function isOrContainsNode(parent, child) {
return parent === child || parent.contains(child);
}

View file

@ -0,0 +1 @@
export declare function isSamsung(userAgent: string): boolean;

Some files were not shown because too many files have changed in this diff Show more