@vuepress-plume/plugin-search 1.0.0-rc.97 → 1.0.0-rc.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/components/Search.vue +1 -1
- package/lib/client/components/SearchBox.vue +15 -15
- package/lib/client/components/SearchButton.vue +1 -1
- package/lib/client/composables/index.d.ts +2 -2
- package/lib/client/composables/index.js +17 -17
- package/lib/client/config.js +1 -1
- package/lib/node/index.js +1 -1
- package/lib/shared/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
defineAsyncComponent,
|
|
5
5
|
ref,
|
|
6
6
|
} from 'vue'
|
|
7
|
-
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
|
8
7
|
import SearchButton from './SearchButton.vue'
|
|
8
|
+
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
|
9
9
|
|
|
10
10
|
defineProps<{
|
|
11
11
|
locales: SearchBoxLocales
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
computedAsync,
|
|
4
|
+
debouncedWatch,
|
|
5
|
+
onKeyStroke,
|
|
6
|
+
useEventListener,
|
|
7
|
+
useScrollLock,
|
|
8
|
+
useSessionStorage,
|
|
9
|
+
} from '@vueuse/core'
|
|
10
|
+
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
|
11
|
+
import Mark from 'mark.js/src/vanilla.js'
|
|
12
|
+
import MiniSearch, { type SearchResult } from 'minisearch'
|
|
13
|
+
import {
|
|
4
14
|
computed,
|
|
5
15
|
markRaw,
|
|
6
16
|
nextTick,
|
|
7
17
|
onBeforeUnmount,
|
|
8
18
|
onMounted,
|
|
19
|
+
type Ref,
|
|
9
20
|
ref,
|
|
10
21
|
shallowRef,
|
|
11
22
|
toRef,
|
|
12
23
|
watch,
|
|
13
24
|
} from 'vue'
|
|
14
25
|
import { useRouteLocale, useRouter } from 'vuepress/client'
|
|
15
|
-
import {
|
|
16
|
-
computedAsync,
|
|
17
|
-
debouncedWatch,
|
|
18
|
-
onKeyStroke,
|
|
19
|
-
useEventListener,
|
|
20
|
-
useScrollLock,
|
|
21
|
-
useSessionStorage,
|
|
22
|
-
} from '@vueuse/core'
|
|
23
|
-
import Mark from 'mark.js/src/vanilla.js'
|
|
24
|
-
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
|
25
|
-
import MiniSearch, { type SearchResult } from 'minisearch'
|
|
26
26
|
import { useLocale, useSearchIndex } from '../composables/index.js'
|
|
27
|
-
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
|
28
27
|
import { LRUCache } from '../utils/index.js'
|
|
29
|
-
import SearchIcon from './icons/SearchIcon.vue'
|
|
30
|
-
import ClearIcon from './icons/ClearIcon.vue'
|
|
31
28
|
import BackIcon from './icons/BackIcon.vue'
|
|
29
|
+
import ClearIcon from './icons/ClearIcon.vue'
|
|
30
|
+
import SearchIcon from './icons/SearchIcon.vue'
|
|
31
|
+
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
|
32
32
|
|
|
33
33
|
const props = defineProps<{
|
|
34
34
|
locales: SearchBoxLocales
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { toRef } from 'vue'
|
|
3
|
-
import type { SearchBoxLocales } from '../../shared/index.js'
|
|
4
3
|
import { useLocale } from '../composables/index.js'
|
|
4
|
+
import type { SearchBoxLocales } from '../../shared/index.js'
|
|
5
5
|
|
|
6
6
|
const props = defineProps<{
|
|
7
7
|
locales: SearchBoxLocales
|
|
@@ -3,10 +3,10 @@ import { MaybeRef } from 'vue';
|
|
|
3
3
|
import * as ______shared_index_js from '../../shared/index.js';
|
|
4
4
|
import { SearchBoxLocales } from '../../shared/index.js';
|
|
5
5
|
|
|
6
|
+
declare function useLocale(locales: MaybeRef<SearchBoxLocales>): vue.ComputedRef<Partial<______shared_index_js.SearchLocaleOptions>>;
|
|
7
|
+
|
|
6
8
|
declare function useSearchIndex(): vue.ShallowRef<Record<string, () => Promise<{
|
|
7
9
|
default: string;
|
|
8
10
|
}>>>;
|
|
9
11
|
|
|
10
|
-
declare function useLocale(locales: MaybeRef<SearchBoxLocales>): vue.ComputedRef<Partial<______shared_index_js.SearchLocaleOptions>>;
|
|
11
|
-
|
|
12
12
|
export { useLocale, useSearchIndex };
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
// src/client/composables/searchIndex.ts
|
|
2
|
-
import { searchIndex } from "@internal/minisearchIndex";
|
|
3
|
-
import { shallowRef } from "vue";
|
|
4
|
-
var searchIndexData = shallowRef(searchIndex);
|
|
5
|
-
function useSearchIndex() {
|
|
6
|
-
return searchIndexData;
|
|
7
|
-
}
|
|
8
|
-
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
9
|
-
__VUE_HMR_RUNTIME__.updateSearchIndex = (data) => {
|
|
10
|
-
searchIndexData.value = data;
|
|
11
|
-
};
|
|
12
|
-
__VUE_HMR_RUNTIME__.updateSearchIndex = (data) => {
|
|
13
|
-
searchIndexData.value = data;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
1
|
// src/client/composables/locale.ts
|
|
18
|
-
import { useRouteLocale } from "vuepress/client";
|
|
19
2
|
import { computed, toRef } from "vue";
|
|
3
|
+
import { useRouteLocale } from "vuepress/client";
|
|
20
4
|
var defaultLocales = {
|
|
21
5
|
"/": {
|
|
22
6
|
placeholder: "Search",
|
|
@@ -40,6 +24,22 @@ function useLocale(locales) {
|
|
|
40
24
|
const locale = computed(() => localesRef.value[routeLocale.value] ?? defaultLocales[routeLocale.value] ?? defaultLocales["/"]);
|
|
41
25
|
return locale;
|
|
42
26
|
}
|
|
27
|
+
|
|
28
|
+
// src/client/composables/searchIndex.ts
|
|
29
|
+
import { searchIndex } from "@internal/minisearchIndex";
|
|
30
|
+
import { shallowRef } from "vue";
|
|
31
|
+
var searchIndexData = shallowRef(searchIndex);
|
|
32
|
+
function useSearchIndex() {
|
|
33
|
+
return searchIndexData;
|
|
34
|
+
}
|
|
35
|
+
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
36
|
+
__VUE_HMR_RUNTIME__.updateSearchIndex = (data) => {
|
|
37
|
+
searchIndexData.value = data;
|
|
38
|
+
};
|
|
39
|
+
__VUE_HMR_RUNTIME__.updateSearchIndex = (data) => {
|
|
40
|
+
searchIndexData.value = data;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
43
|
export {
|
|
44
44
|
useLocale,
|
|
45
45
|
useSearchIndex
|
package/lib/client/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/client/config.ts
|
|
2
|
-
import { defineClientConfig } from "vuepress/client";
|
|
3
2
|
import { h } from "vue";
|
|
3
|
+
import { defineClientConfig } from "vuepress/client";
|
|
4
4
|
import Search from "./components/Search.vue";
|
|
5
5
|
var locales = __SEARCH_LOCALES__;
|
|
6
6
|
var searchOptions = __SEARCH_OPTIONS__;
|
package/lib/node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/node/searchPlugin.ts
|
|
2
|
+
import { addViteOptimizeDepsInclude } from "@vuepress/helper";
|
|
2
3
|
import chokidar from "chokidar";
|
|
3
4
|
import { getDirname, path } from "vuepress/utils";
|
|
4
|
-
import { addViteOptimizeDepsInclude } from "@vuepress/helper";
|
|
5
5
|
|
|
6
6
|
// src/node/prepareSearchIndex.ts
|
|
7
7
|
import MiniSearch from "minisearch";
|
package/lib/shared/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress-plume/plugin-search",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.98",
|
|
5
5
|
"description": "The Plugin for VuePress 2 - local search",
|
|
6
6
|
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"@vueuse/core": "^11.0.3",
|
|
39
39
|
"@vueuse/integrations": "^11.0.3",
|
|
40
40
|
"chokidar": "^3.6.0",
|
|
41
|
-
"focus-trap": "^7.
|
|
41
|
+
"focus-trap": "^7.6.0",
|
|
42
42
|
"mark.js": "^8.11.1",
|
|
43
43
|
"minisearch": "^7.1.0",
|
|
44
44
|
"p-map": "^7.0.2",
|
|
45
|
-
"vue": "^3.5.
|
|
45
|
+
"vue": "^3.5.4"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|