diff --git a/components/app/Fuse.vue b/components/app/Fuse.vue new file mode 100644 index 000000000..ee19a31fb --- /dev/null +++ b/components/app/Fuse.vue @@ -0,0 +1,38 @@ + + + diff --git a/components/app/Header.vue b/components/app/Header.vue index 7d32d2e43..567e969a7 100644 --- a/components/app/Header.vue +++ b/components/app/Header.vue @@ -83,7 +83,7 @@ - + diff --git a/components/app/Lunr.vue b/components/app/Lunr.vue deleted file mode 100644 index c6f3dcbf3..000000000 --- a/components/app/Lunr.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/components/app/Search.vue b/components/app/PowerSearch.vue similarity index 88% rename from components/app/Search.vue rename to components/app/PowerSearch.vue index dbdd68f38..ad402751c 100644 --- a/components/app/Search.vue +++ b/components/app/PowerSearch.vue @@ -8,7 +8,7 @@ type="text" autocomplete="off" name="command" - :placeholder="$t('app.type_a_command_search')" + :placeholder="$t('app.type_a_command_search').toString()" class=" bg-transparent border-b border-dividerLight @@ -17,10 +17,9 @@ p-6 " /> - @@ -39,7 +38,7 @@
{{ $t(map.section) }}
- import { ref } from "@nuxtjs/composition-api" import { HoppAction, invokeAction } from "~/helpers/actions" -import { spotlight as mappings, lunr } from "~/helpers/shortcuts" +import { spotlight as mappings, fuse } from "~/helpers/shortcuts" defineProps<{ show: boolean diff --git a/components/app/SearchEntry.vue b/components/app/PowerSearchEntry.vue similarity index 100% rename from components/app/SearchEntry.vue rename to components/app/PowerSearchEntry.vue diff --git a/components/app/Shortcuts.vue b/components/app/Shortcuts.vue index 1a27f422f..0b8fd803d 100644 --- a/components/app/Shortcuts.vue +++ b/components/app/Shortcuts.vue @@ -19,11 +19,12 @@ - + +
+
+

+ {{ $t(map.item.section) }} +

+ +
+
+ manage_search + + {{ $t("state.nothing_found") }} "{{ filterText }}" + +
+
{{ $t(map.section) }} -
- - {{ $t(shortcut.label) }} - - - {{ key }} - -
+ :shortcut="shortcut" + />
- diff --git a/helpers/shortcuts.js b/helpers/shortcuts.js index 01cce5d48..2a72b065d 100644 --- a/helpers/shortcuts.js +++ b/helpers/shortcuts.js @@ -193,75 +193,100 @@ export const spotlight = [ }, ] -export const lunr = [ +export const fuse = [ { keys: ["?"], label: "shortcut.general.help_menu", action: "modals.support.toggle", icon: "life-buoy", - tags: "help support menu discord twitter documentation troubleshooting chat community feedback report bug issue ticket", + tags: [ + "help", + "support", + "menu", + "discord", + "twitter", + "documentation", + "troubleshooting", + "chat", + "community", + "feedback", + "report", + "bug", + "issue", + "ticket", + ], }, { keys: [getPlatformSpecialKey(), "K"], label: "shortcut.general.show_all", action: "flyouts.keybinds.toggle", icon: "zap", - tags: "keyboard shortcuts", + tags: ["keyboard", "shortcuts"], }, { keys: [getPlatformSpecialKey(), "←"], label: "shortcut.navigation.back", action: "navigation.jump.back", icon: "arrow-right", - tags: "back jump page navigation go", + tags: ["back", "jump", "page", "navigation", "go"], }, { keys: [getPlatformSpecialKey(), "→"], label: "shortcut.navigation.forward", action: "navigation.jump.forward", icon: "arrow-right", - tags: "forward jump next forward page navigation go", + tags: ["forward", "jump", "next", "forward", "page", "navigation", "go"], }, { keys: [getPlatformAlternateKey(), "R"], label: "shortcut.navigation.rest", action: "navigation.jump.rest", icon: "arrow-right", - tags: "rest jump page navigation go", + tags: ["rest", "jump", "page", "navigation", "go"], }, { keys: [getPlatformAlternateKey(), "Q"], label: "shortcut.navigation.graphql", action: "navigation.jump.graphql", icon: "arrow-right", - tags: "graphql jump page navigation go", + tags: ["graphql", "jump", "page", "navigation", "go"], }, { keys: [getPlatformAlternateKey(), "W"], label: "shortcut.navigation.realtime", action: "navigation.jump.realtime", icon: "arrow-right", - tags: "realtime jump page navigation websocket socket mqtt sse go", + tags: [ + "realtime", + "jump", + "page", + "navigation", + "websocket", + "socket", + "mqtt", + "sse", + "go", + ], }, { keys: [getPlatformAlternateKey(), "D"], label: "shortcut.navigation.documentation", action: "navigation.jump.documentation", icon: "arrow-right", - tags: "documentation jump page navigation go", + tags: ["documentation", "jump", "page", "navigation", "go"], }, { keys: [getPlatformAlternateKey(), "S"], label: "shortcut.navigation.settings", action: "navigation.jump.settings", icon: "arrow-right", - tags: "settings jump page navigation account theme go", + tags: ["settings", "jump", "page", "navigation", "account", "theme", "go"], }, { keys: [getPlatformSpecialKey(), "M"], label: "shortcut.miscellaneous.invite", action: "modals.share.toggle", icon: "gift", - tags: "invite share app friends people social", + tags: ["invite", "share", "app", "friends", "people", "social"], }, ] diff --git a/package-lock.json b/package-lock.json index 85673876a..897a20ee0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,11 +21,11 @@ "core-js": "^3.17.2", "esprima": "^4.0.1", "firebase": "^9.0.1", + "fuse.js": "^6.4.6", "graphql": "^15.5.0", "graphql-language-service-interface": "^2.8.4", "json-loader": "^0.5.7", "lodash": "^4.17.21", - "lunr": "^2.3.9", "mustache": "^4.2.0", "node-interval-tree": "^1.3.3", "nuxt": "^2.15.8", @@ -62,7 +62,6 @@ "@testing-library/jest-dom": "^5.14.1", "@types/cookie": "^0.4.1", "@types/lodash": "^4.14.172", - "@types/lunr": "^2.3.4", "@types/splitpanes": "^2.2.1", "@vue/runtime-dom": "^3.2.9", "@vue/test-utils": "^1.2.2", @@ -8130,12 +8129,6 @@ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" }, - "node_modules/@types/lunr": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.3.4.tgz", - "integrity": "sha512-j4x4XJwZvorEUbA519VdQ5b9AOU9TSvfi8tvxMAfP8XzNLtFex7A8vFQwqOx3WACbV0KMXbACV3cZl4/gynQ7g==", - "dev": true - }, "node_modules/@types/mdast": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.7.tgz", @@ -17443,6 +17436,14 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "node_modules/fuse.js": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.4.6.tgz", + "integrity": "sha512-/gYxR/0VpXmWSfZOIPS3rWwU8SHgsRTwWuXhyb2O6s7aRuVtHtxCkR33bNYu3wyLyNx/Wpv0vU7FZy8Vj53VNw==", + "engines": { + "node": ">=10" + } + }, "node_modules/gaze": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", @@ -23240,11 +23241,6 @@ "yallist": "^3.0.2" } }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" - }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -42085,12 +42081,6 @@ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" }, - "@types/lunr": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@types/lunr/-/lunr-2.3.4.tgz", - "integrity": "sha512-j4x4XJwZvorEUbA519VdQ5b9AOU9TSvfi8tvxMAfP8XzNLtFex7A8vFQwqOx3WACbV0KMXbACV3cZl4/gynQ7g==", - "dev": true - }, "@types/mdast": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.7.tgz", @@ -49459,6 +49449,11 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "fuse.js": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.4.6.tgz", + "integrity": "sha512-/gYxR/0VpXmWSfZOIPS3rWwU8SHgsRTwWuXhyb2O6s7aRuVtHtxCkR33bNYu3wyLyNx/Wpv0vU7FZy8Vj53VNw==" + }, "gaze": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", @@ -53815,11 +53810,6 @@ "yallist": "^3.0.2" } }, - "lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" - }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", diff --git a/package.json b/package.json index 8a0154866..71b1e7143 100644 --- a/package.json +++ b/package.json @@ -37,11 +37,11 @@ "core-js": "^3.17.2", "esprima": "^4.0.1", "firebase": "^9.0.1", + "fuse.js": "^6.4.6", "graphql": "^15.5.0", "graphql-language-service-interface": "^2.8.4", "json-loader": "^0.5.7", "lodash": "^4.17.21", - "lunr": "^2.3.9", "mustache": "^4.2.0", "node-interval-tree": "^1.3.3", "nuxt": "^2.15.8", @@ -78,7 +78,6 @@ "@testing-library/jest-dom": "^5.14.1", "@types/cookie": "^0.4.1", "@types/lodash": "^4.14.172", - "@types/lunr": "^2.3.4", "@types/splitpanes": "^2.2.1", "@vue/runtime-dom": "^3.2.9", "@vue/test-utils": "^1.2.2",