mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-24 01:39:07 +01:00
update deps
(一部のハッキーな手法が死んでいたのでその修正も)
This commit is contained in:
parent
4222a8f21b
commit
7dfcc6a8ff
6
app.vue
6
app.vue
@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import TopIco from 'bi/chevron-up.svg';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
||||
import { locales } from '@/assets/data/locales';
|
||||
import NProgress from 'nprogress';
|
||||
import type { Graph, Thing } from 'schema-dts';
|
||||
import { cleanDoubleSlashes, joinURL, parseURL, stringifyParsedURL, withTrailingSlash } from 'ufo';
|
||||
|
||||
const nuxtApp = useNuxtApp();
|
||||
|
||||
const { t, locale, locales } = useI18n();
|
||||
const { t, locale } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const colorMode = useColorMode();
|
||||
@ -71,7 +71,7 @@ const getLdJson = (additionalGraphes: Thing[] = []): string => {
|
||||
ldJson['@graph'] = ldJson['@graph'].concat(additionalGraphes);
|
||||
return JSON.stringify(ldJson);
|
||||
};
|
||||
const currentLocaleIso = computed(() => (locales.value as LocaleObject[]).find((e) => e?.code === locale.value)?.iso);
|
||||
const currentLocaleIso = computed(() => locales.find((e) => e?.code === locale.value)?.iso);
|
||||
|
||||
const head = useLocaleHead({
|
||||
addSeoAttributes: true,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n';
|
||||
|
||||
export const localesConst = [
|
||||
{ files: [ 'ja-JP.json' ], code: 'ja', iso: 'ja-JP', name: '日本語' },
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { NavItem } from '@nuxt/content/dist/runtime/types';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n';
|
||||
import { parseURL } from 'ufo';
|
||||
|
||||
/**
|
||||
@ -8,7 +8,7 @@ import { parseURL } from 'ufo';
|
||||
* @param s パス
|
||||
* @returns パスの先にあるもの
|
||||
*/
|
||||
export function resolveObjPath(o: object, s: string): any {
|
||||
export function resolveObjPath(o: Record<string, any>, s: string): any {
|
||||
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
|
||||
s = s.replace(/^\./, ''); // strip a leading dot
|
||||
var a = s.split('.');
|
||||
|
@ -40,7 +40,7 @@
|
||||
<div class="input-group">
|
||||
<span class="input-group-text !rounded-l-full"><I18nIcon class="h-5 w-5" /><span class="sr-only">{{ $t('_nav.switchLang') }}</span></span>
|
||||
<select class="form-select !rounded-r-full" v-model="spLocaleOption" @change="changeLocale()">
|
||||
<option v-for="locale in locales" :value="locale.code">{{ locale.name }}</option>
|
||||
<option v-for="locale in localesConst" :value="locale.code">{{ locale.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</li>
|
||||
@ -64,7 +64,7 @@
|
||||
<button class="hover:opacity-80"><I18nIcon :class="['h-5 w-5', { 'text-white 3xl:text-slate-800 3xl:dark:text-slate-200': (landing && scrollPos >= -40) }]" /><span class="sr-only">{{ $t('_nav.switchLang') }}</span></button>
|
||||
<div class="absolute top-6 right-0 hidden group-hover:block z-[9955]">
|
||||
<ul class="px-4 py-2 bg-slate-50 dark:bg-slate-800 rounded-lg shadow-lg space-y-1">
|
||||
<li v-for="locale in locales">
|
||||
<li v-for="locale in localesConst">
|
||||
<GNuxtLink :to="switchLocalePath(locale.code)" :lang="locale.code" :class="['block _i18n whitespace-nowrap hover:text-accent-600 py-0.5', {'text-accent-600 font-bold': currentLocale === locale.code}]">
|
||||
<span v-if="currentLocale === locale.code"><DotIcon class="stroke-[3] stroke-current" /></span>{{ locale.name }}
|
||||
</GNuxtLink>
|
||||
@ -97,6 +97,8 @@ import MenuIcon from 'bi/list.svg';
|
||||
import XIcon from 'bi/x.svg';
|
||||
import DotIcon from 'bi/dot.svg';
|
||||
import NavData from '@/assets/data/nav';
|
||||
import { localesConst } from '@/assets/data/locales';
|
||||
import type { LocaleCodes } from '@/assets/data/locales';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
disableShadow?: boolean;
|
||||
@ -114,7 +116,7 @@ const props = withDefaults(defineProps<{
|
||||
|
||||
const navOpen = ref(false);
|
||||
|
||||
const { locales, locale: currentLocale } = useI18n();
|
||||
const { locale: currentLocale } = useI18n();
|
||||
const route = useRoute();
|
||||
const { push } = useRouter();
|
||||
const currentPath = ref(route.path);
|
||||
@ -127,7 +129,7 @@ watch(() => route.path,(to) => {
|
||||
|
||||
const switchLocalePath = useGSwitchLocalePath();
|
||||
const localePath = useGLocalePath();
|
||||
const spLocaleOption = ref<string>(currentLocale.value);
|
||||
const spLocaleOption = ref(currentLocale.value as LocaleCodes);
|
||||
function changeLocale() {
|
||||
const path = switchLocalePath(spLocaleOption.value);
|
||||
push(path);
|
||||
|
@ -1,17 +1,12 @@
|
||||
import {
|
||||
getComposer,
|
||||
useLocalePath as _useLocalePath,
|
||||
} from 'vue-i18n-routing';
|
||||
import type { LocaleCodes } from '@/assets/data/locales';
|
||||
import { locales } from "@/assets/data/locales";
|
||||
|
||||
/** useLocalePathのラッパー関数。 */
|
||||
export function useGLocalePath(
|
||||
options?: NonNullable<Parameters<typeof _useLocalePath>[0]>
|
||||
): ReturnType<typeof _useLocalePath> {
|
||||
const { route, router, i18n, strategy } = options || {}
|
||||
return _useLocalePath({
|
||||
route: route || useRoute(),
|
||||
router: router || useRouter(),
|
||||
i18n: i18n || getComposer(useNuxtApp().$i18n),
|
||||
strategy: strategy ?? 'prefix', // ←リンクではprefixつきにする
|
||||
})
|
||||
export function useGLocalePath() {
|
||||
const localePath = useLocalePath();
|
||||
|
||||
return (path: string, locale?: LocaleCodes) => {
|
||||
const _path = localePath(path, locale);
|
||||
return new RegExp(`^/(${locales.map((v) => v.code).join('|')})/`).test(_path) ? _path : `/${locales[0].code}${_path}`;
|
||||
};
|
||||
}
|
@ -1,17 +1,12 @@
|
||||
import {
|
||||
useSwitchLocalePath as _useSwitchLocalePath,
|
||||
getComposer,
|
||||
} from 'vue-i18n-routing';
|
||||
import type { LocaleCodes } from '@/assets/data/locales';
|
||||
import { locales } from "@/assets/data/locales";
|
||||
|
||||
/** useSwitchLocalePathのラッパー関数。 */
|
||||
export function useGSwitchLocalePath(
|
||||
options?: NonNullable<Parameters<typeof _useSwitchLocalePath>[0]>
|
||||
): ReturnType<typeof _useSwitchLocalePath> {
|
||||
const { route, router, i18n, strategy } = options || {}
|
||||
return _useSwitchLocalePath({
|
||||
route: route || useRoute(),
|
||||
router: router || useRouter(),
|
||||
i18n: i18n || getComposer(useNuxtApp().$i18n),
|
||||
strategy: strategy ?? 'prefix', // ←リンクではprefixつきにする
|
||||
});
|
||||
export function useGSwitchLocalePath() {
|
||||
const switchLocalePath = useSwitchLocalePath();
|
||||
|
||||
return (locale: LocaleCodes) => {
|
||||
const _path = switchLocalePath(locale);
|
||||
return new RegExp(`^/(${locales.map((v) => v.code).join('|')})/`).test(_path) ? _path : `/${locales[0].code}${_path}`;
|
||||
}
|
||||
}
|
@ -36,8 +36,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
||||
import NProgress from 'nprogress';
|
||||
import { locales } from '@/assets/data/locales';
|
||||
import { getGhIssueUrl } from './assets/js/misc/get-issue-url';
|
||||
import ExtIco from 'bi/box-arrow-up-right.svg';
|
||||
|
||||
@ -45,9 +45,9 @@ const error = useError();
|
||||
const colorMode = useColorMode();
|
||||
const runtimeConfig = useRuntimeConfig();
|
||||
|
||||
const { locale, locales } = useI18n();
|
||||
const { locale } = useI18n();
|
||||
const localePath = useGLocalePath();
|
||||
const currentLocaleIso = computed(() => (locales.value as LocaleObject[]).find((e) => e?.code === locale.value)?.iso);
|
||||
const currentLocaleIso = computed(() => locales.find((e) => e?.code === locale.value)?.iso);
|
||||
|
||||
const isNavOpen = ref<boolean>(false);
|
||||
const isCanvasLoaded = ref<boolean>(false);
|
||||
|
24
package.json
24
package.json
@ -9,36 +9,36 @@
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/parser": "^7.23.6",
|
||||
"@babel/parser": "^7.23.9",
|
||||
"@nuxt/content": "npm:@nuxt/content-edge@latest",
|
||||
"@nuxtjs/color-mode": "^3.3.2",
|
||||
"@nuxtjs/i18n": "8.0.0",
|
||||
"@nuxtjs/i18n": "^8.1.0",
|
||||
"@rollup/plugin-yaml": "^4.1.2",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^20.10.5",
|
||||
"@types/node": "^20.11.17",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/ua-parser-js": "^0.7.39",
|
||||
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.5",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"bootstrap": "^5.3.2",
|
||||
"bootstrap-icons": "^1.11.2",
|
||||
"github-markdown-css": "^5.5.0",
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"github-markdown-css": "^5.5.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"mfm-js": "^0.23.3",
|
||||
"misskey-js": "2024.2.0-beta.3",
|
||||
"nprogress": "^0.2.0",
|
||||
"nuxt": "^3.9.3",
|
||||
"postcss": "^8.4.32",
|
||||
"sass": "^1.69.5",
|
||||
"nuxt": "^3.10.1",
|
||||
"postcss": "^8.4.35",
|
||||
"sass": "^1.70.0",
|
||||
"schema-dts": "^1.1.2",
|
||||
"sitemap": "^7.1.1",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"ua-parser-js": "^1.0.37",
|
||||
"ufo": "^1.3.2",
|
||||
"ufo": "^1.4.0",
|
||||
"vite-svg-loader": "^4.0.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.10.2",
|
||||
"dependencies": {
|
||||
"nanoid": "^5.0.4"
|
||||
"nanoid": "^5.0.5"
|
||||
}
|
||||
}
|
||||
|
1544
pnpm-lock.yaml
1544
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ import { writeFileSync } from 'fs';
|
||||
import { redirects } from './../assets/data/old-hub-redirects';
|
||||
import { localesConst } from './../assets/data/locales';
|
||||
import type { LocaleCodes } from './../assets/data/locales';
|
||||
import type { PartialRecord } from './../types/others';
|
||||
import type { NuxtConfig } from 'nuxt/schema';
|
||||
import { joinURL, cleanDoubleSlashes } from 'ufo';
|
||||
|
||||
@ -30,7 +31,7 @@ export function getOldHubRedirects(mode: 'vercel'): VercelRouteSource[]
|
||||
export function getOldHubRedirects(mode: 'nitro' | 'vercel' = 'nitro'): NuxtConfig['routeRules'] | VercelRouteSource[] {
|
||||
|
||||
// 旧Hub時代の各言語のプレフィックス
|
||||
const hubLocales: Record<LocaleCodes, string> = {
|
||||
const hubLocales: PartialRecord<LocaleCodes, string> = {
|
||||
ja: '/',
|
||||
en: '/en',
|
||||
id: '/id',
|
||||
@ -92,7 +93,7 @@ export function getOldHubRedirects(mode: 'nitro' | 'vercel' = 'nitro'): NuxtConf
|
||||
destination = joinURL(`/${locale.code}`, destination);
|
||||
}
|
||||
|
||||
out[joinURL(hubLocales[locale.code], route[0])] = {
|
||||
out[joinURL(hubLocales[locale.code] ?? '/', route[0])] = {
|
||||
redirect: {
|
||||
to: destination,
|
||||
statusCode: 301,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useRuntimeConfig } from '#imports';
|
||||
import { withTrailingSlash } from 'ufo';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n';
|
||||
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
nitroApp.hooks.hook('render:html', (html, { event }) => {
|
||||
@ -19,7 +19,7 @@ export default defineNitroPlugin((nitroApp) => {
|
||||
html.htmlAttrs = [];
|
||||
|
||||
const remainingList: string[] = [];
|
||||
html.head.forEach((v) => {
|
||||
html.head.forEach((v: string) => {
|
||||
remainingList.push(...(v.match(/<!--(.|\n)*(?<=-->)/gm) ?? []));
|
||||
remainingList.push(...(v.match(/<link\s+rel="(og|alternate|canonical|me)[^>]+>/gm) ?? []));
|
||||
remainingList.push(...(v.match(/<meta[^>]+>/gm) ?? []));
|
||||
|
3
types/misc.d.ts
vendored
3
types/misc.d.ts
vendored
@ -1,5 +1,6 @@
|
||||
import type { LocaleCodes } from './../nuxt.config';
|
||||
import type { ComputedRef } from 'vue-demi'
|
||||
import type { ComputedRef } from 'vue-demi';
|
||||
import type { LocaleObject } from '@nuxtjs/i18n';
|
||||
|
||||
declare module '*.svg' {
|
||||
import { FunctionalComponent, SVGAttributes } from 'vue'
|
||||
|
Loading…
Reference in New Issue
Block a user