feat(frontend): 設定の検索 (#15505)

* wip

* wip

* wip

* test

* wip rollup pluginでsearchIndexの情報生成

* wip

* SPDX

* wip: markerIdを自動付与

* rollupでビルド時・devモード時に毎回uuidを生成するように

* 開発サーバーでだけ必要な挙動は開発サーバーのみで

* 条件が逆

* wip: childrenの生成

* update comment

* update comment

* rename auto generated file

* hashをパスと行数から決定

* Update privacy.vue

* Update privacy.vue

* wip

* Update general.vue

* Update general.vue

* wip

* wip

* Update SearchMarker.vue

* wip

* Update profile.vue

* Update mute-block.vue

* Update mute-block.vue

* Update general.vue

* Update general.vue

* childrenがduplicate key errorを吐く問題をいったん解決

* マーカーの形を成形

* loggerを置きかえ

* とりあえず省略記法に対応

* Refactor and Format codes

* wip

* Update settings-search-index.ts

* wip

* wip

* とりあえず不確定要因の仮置きidを削除

* hashの生成を正規化(絶対パスになっていたのを緩和)

* pathの入力を省略可能に

* adminでもパス生成できるように

* Update settings-search-index.ts

* Update privacy.vue

* wip

* build searchIndex

* wip

* build

* Update general.vue

* build

* Update sounds.vue

* build

* build

* Update sounds.vue

* 🎨

* 🎨

* Update privacy.vue

* Update privacy.vue

* Update security.vue

* create-search-indexを多少改善

* build

* Update 2fa.vue

* wip

* 必ずtransformCodeCacheを利用するように, キャッシュの明確な受け渡しを定義

* キャッシュはdevServerでなくても更新

* Revert "wip"

This reverts commit 41bffd3a13.

* inlining

* wip

* Update theme.vue

* 🎨

* wip normalize

* Update theme.vue

* キャッシュのパス変換

* build

* wip

* wip

* Update SearchMarker.vue

* i18n.ts['key'] の形式が取り出せない問題のFix

* build

* 仮でpath入れ

* 必ず絶対パスが使われるように

* wip

* 🎨

* storybookビルド時はcreateSearchIndexをしない

* inliningの構造化

* format code

* Update index.vue

* wip

* wip

* 🎨

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* clean up

* Update navbar.vue

* enhance: 検索で上下矢印を使用することで検索結果を移動できるように

* refactor

* fix(frontend): PageWindowでSearchMarkerが動作するように

* enhance(frontend): SearchMarkerの点滅を一定時間で止める

* lint fix

* fix: 子要素監視が抜けていたのを修正

* アニメーションの回数はCSSで制御するように

* refactor

* enhance(frontend): 検索インデックス作成時のログを削減

* revert

* fix

* fix

---------

Co-authored-by: tai-cha <dev@taichan.site>
Co-authored-by: taichan <40626578+tai-cha@users.noreply.github.com>
Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
syuilo
2025-03-06 23:15:19 +09:00
committed by GitHub
parent 46067f6e17
commit 0214a0001f
36 changed files with 4706 additions and 1402 deletions

View File

@@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="!narrow || currentPage?.route.name == null" class="nav">
<div class="baaadecd">
<MkInfo v-if="emailNotConfigured" warn class="info">{{ i18n.ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
<MkSuperMenu :def="menuDef" :grid="narrow"></MkSuperMenu>
<MkSuperMenu :def="menuDef" :grid="narrow" :searchIndex="SETTING_INDEX"></MkSuperMenu>
</div>
</div>
<div v-if="!(narrow && currentPage?.route.name == null)" class="main">
@@ -29,6 +29,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<script setup lang="ts">
import { computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import type { PageMetadata } from '@/scripts/page-metadata.js';
import type { SuperMenuDef } from '@/components/MkSuperMenu.vue';
import { i18n } from '@/i18n.js';
import MkInfo from '@/components/MkInfo.vue';
import MkSuperMenu from '@/components/MkSuperMenu.vue';
@@ -38,8 +40,9 @@ import { instance } from '@/instance.js';
import { definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
import * as os from '@/os.js';
import { useRouter } from '@/router/supplier.js';
import type { PageMetadata } from '@/scripts/page-metadata.js';
import type { SuperMenuDef } from '@/components/MkSuperMenu.vue';
import { searchIndexes } from '@/scripts/autogen/settings-search-index.js';
const SETTING_INDEX = searchIndexes; // TODO: lazy load
const indexInfo = {
title: i18n.ts.settings,
@@ -63,7 +66,6 @@ const ro = new ResizeObserver((entries, observer) => {
});
const menuDef = computed<SuperMenuDef[]>(() => [{
title: i18n.ts.basicSettings,
items: [{
icon: 'ti ti-user',
text: i18n.ts.profile,
@@ -101,32 +103,31 @@ const menuDef = computed<SuperMenuDef[]>(() => [{
active: currentPage.value?.route.name === 'security',
}],
}, {
title: i18n.ts.clientSettings,
items: [{
icon: 'ti ti-adjustments',
text: i18n.ts.general,
to: '/settings/general',
active: currentPage.value?.route.name === 'general',
text: i18n.ts.preferences,
to: '/settings/preferences',
active: currentPage.value?.route.name === 'preferences',
}, {
icon: 'ti ti-palette',
text: i18n.ts.theme,
to: '/settings/theme',
active: currentPage.value?.route.name === 'theme',
}, {
icon: 'ti ti-menu-2',
text: i18n.ts.navbar,
to: '/settings/navbar',
active: currentPage.value?.route.name === 'navbar',
}, {
icon: 'ti ti-equal-double',
text: i18n.ts.statusbar,
to: '/settings/statusbar',
active: currentPage.value?.route.name === 'statusbar',
icon: 'ti ti-device-desktop',
text: i18n.ts.appearance,
to: '/settings/appearance',
active: currentPage.value?.route.name === 'appearance',
}, {
icon: 'ti ti-music',
text: i18n.ts.sounds,
to: '/settings/sounds',
active: currentPage.value?.route.name === 'sounds',
}, {
icon: 'ti ti-accessible',
text: i18n.ts.accessibility,
to: '/settings/accessibility',
active: currentPage.value?.route.name === 'accessibility',
}, {
icon: 'ti ti-plug',
text: i18n.ts.plugins,
@@ -134,7 +135,6 @@ const menuDef = computed<SuperMenuDef[]>(() => [{
active: currentPage.value?.route.name === 'plugin',
}],
}, {
title: i18n.ts.otherSettings,
items: [{
icon: 'ti ti-badges',
text: i18n.ts.roles,
@@ -160,11 +160,6 @@ const menuDef = computed<SuperMenuDef[]>(() => [{
text: i18n.ts.importAndExport,
to: '/settings/import-export',
active: currentPage.value?.route.name === 'import-export',
}, {
icon: 'ti ti-plane',
text: `${i18n.ts.accountMigration}`,
to: '/settings/migration',
active: currentPage.value?.route.name === 'migration',
}, {
icon: 'ti ti-dots',
text: i18n.ts.other,