mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-21 16:33:48 +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">
|
<script setup lang="ts">
|
||||||
import TopIco from 'bi/chevron-up.svg';
|
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 NProgress from 'nprogress';
|
||||||
import type { Graph, Thing } from 'schema-dts';
|
import type { Graph, Thing } from 'schema-dts';
|
||||||
import { cleanDoubleSlashes, joinURL, parseURL, stringifyParsedURL, withTrailingSlash } from 'ufo';
|
import { cleanDoubleSlashes, joinURL, parseURL, stringifyParsedURL, withTrailingSlash } from 'ufo';
|
||||||
|
|
||||||
const nuxtApp = useNuxtApp();
|
const nuxtApp = useNuxtApp();
|
||||||
|
|
||||||
const { t, locale, locales } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const colorMode = useColorMode();
|
const colorMode = useColorMode();
|
||||||
@ -71,7 +71,7 @@ const getLdJson = (additionalGraphes: Thing[] = []): string => {
|
|||||||
ldJson['@graph'] = ldJson['@graph'].concat(additionalGraphes);
|
ldJson['@graph'] = ldJson['@graph'].concat(additionalGraphes);
|
||||||
return JSON.stringify(ldJson);
|
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({
|
const head = useLocaleHead({
|
||||||
addSeoAttributes: true,
|
addSeoAttributes: true,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
import type { LocaleObject } from '@nuxtjs/i18n';
|
||||||
|
|
||||||
export const localesConst = [
|
export const localesConst = [
|
||||||
{ files: [ 'ja-JP.json' ], code: 'ja', iso: 'ja-JP', name: '日本語' },
|
{ 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 { 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';
|
import { parseURL } from 'ufo';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8,7 +8,7 @@ import { parseURL } from 'ufo';
|
|||||||
* @param s パス
|
* @param s パス
|
||||||
* @returns パスの先にあるもの
|
* @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(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
|
||||||
s = s.replace(/^\./, ''); // strip a leading dot
|
s = s.replace(/^\./, ''); // strip a leading dot
|
||||||
var a = s.split('.');
|
var a = s.split('.');
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<div class="input-group">
|
<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>
|
<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()">
|
<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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</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>
|
<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]">
|
<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">
|
<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}]">
|
<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 }}
|
<span v-if="currentLocale === locale.code"><DotIcon class="stroke-[3] stroke-current" /></span>{{ locale.name }}
|
||||||
</GNuxtLink>
|
</GNuxtLink>
|
||||||
@ -97,6 +97,8 @@ import MenuIcon from 'bi/list.svg';
|
|||||||
import XIcon from 'bi/x.svg';
|
import XIcon from 'bi/x.svg';
|
||||||
import DotIcon from 'bi/dot.svg';
|
import DotIcon from 'bi/dot.svg';
|
||||||
import NavData from '@/assets/data/nav';
|
import NavData from '@/assets/data/nav';
|
||||||
|
import { localesConst } from '@/assets/data/locales';
|
||||||
|
import type { LocaleCodes } from '@/assets/data/locales';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
disableShadow?: boolean;
|
disableShadow?: boolean;
|
||||||
@ -114,7 +116,7 @@ const props = withDefaults(defineProps<{
|
|||||||
|
|
||||||
const navOpen = ref(false);
|
const navOpen = ref(false);
|
||||||
|
|
||||||
const { locales, locale: currentLocale } = useI18n();
|
const { locale: currentLocale } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const currentPath = ref(route.path);
|
const currentPath = ref(route.path);
|
||||||
@ -127,7 +129,7 @@ watch(() => route.path,(to) => {
|
|||||||
|
|
||||||
const switchLocalePath = useGSwitchLocalePath();
|
const switchLocalePath = useGSwitchLocalePath();
|
||||||
const localePath = useGLocalePath();
|
const localePath = useGLocalePath();
|
||||||
const spLocaleOption = ref<string>(currentLocale.value);
|
const spLocaleOption = ref(currentLocale.value as LocaleCodes);
|
||||||
function changeLocale() {
|
function changeLocale() {
|
||||||
const path = switchLocalePath(spLocaleOption.value);
|
const path = switchLocalePath(spLocaleOption.value);
|
||||||
push(path);
|
push(path);
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
import {
|
import type { LocaleCodes } from '@/assets/data/locales';
|
||||||
getComposer,
|
import { locales } from "@/assets/data/locales";
|
||||||
useLocalePath as _useLocalePath,
|
|
||||||
} from 'vue-i18n-routing';
|
|
||||||
|
|
||||||
/** useLocalePathのラッパー関数。 */
|
/** useLocalePathのラッパー関数。 */
|
||||||
export function useGLocalePath(
|
export function useGLocalePath() {
|
||||||
options?: NonNullable<Parameters<typeof _useLocalePath>[0]>
|
const localePath = useLocalePath();
|
||||||
): ReturnType<typeof _useLocalePath> {
|
|
||||||
const { route, router, i18n, strategy } = options || {}
|
return (path: string, locale?: LocaleCodes) => {
|
||||||
return _useLocalePath({
|
const _path = localePath(path, locale);
|
||||||
route: route || useRoute(),
|
return new RegExp(`^/(${locales.map((v) => v.code).join('|')})/`).test(_path) ? _path : `/${locales[0].code}${_path}`;
|
||||||
router: router || useRouter(),
|
};
|
||||||
i18n: i18n || getComposer(useNuxtApp().$i18n),
|
|
||||||
strategy: strategy ?? 'prefix', // ←リンクではprefixつきにする
|
|
||||||
})
|
|
||||||
}
|
}
|
@ -1,17 +1,12 @@
|
|||||||
import {
|
import type { LocaleCodes } from '@/assets/data/locales';
|
||||||
useSwitchLocalePath as _useSwitchLocalePath,
|
import { locales } from "@/assets/data/locales";
|
||||||
getComposer,
|
|
||||||
} from 'vue-i18n-routing';
|
|
||||||
|
|
||||||
/** useSwitchLocalePathのラッパー関数。 */
|
/** useSwitchLocalePathのラッパー関数。 */
|
||||||
export function useGSwitchLocalePath(
|
export function useGSwitchLocalePath() {
|
||||||
options?: NonNullable<Parameters<typeof _useSwitchLocalePath>[0]>
|
const switchLocalePath = useSwitchLocalePath();
|
||||||
): ReturnType<typeof _useSwitchLocalePath> {
|
|
||||||
const { route, router, i18n, strategy } = options || {}
|
return (locale: LocaleCodes) => {
|
||||||
return _useSwitchLocalePath({
|
const _path = switchLocalePath(locale);
|
||||||
route: route || useRoute(),
|
return new RegExp(`^/(${locales.map((v) => v.code).join('|')})/`).test(_path) ? _path : `/${locales[0].code}${_path}`;
|
||||||
router: router || useRouter(),
|
}
|
||||||
i18n: i18n || getComposer(useNuxtApp().$i18n),
|
|
||||||
strategy: strategy ?? 'prefix', // ←リンクではprefixつきにする
|
|
||||||
});
|
|
||||||
}
|
}
|
@ -36,8 +36,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
|
||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
|
import { locales } from '@/assets/data/locales';
|
||||||
import { getGhIssueUrl } from './assets/js/misc/get-issue-url';
|
import { getGhIssueUrl } from './assets/js/misc/get-issue-url';
|
||||||
import ExtIco from 'bi/box-arrow-up-right.svg';
|
import ExtIco from 'bi/box-arrow-up-right.svg';
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ const error = useError();
|
|||||||
const colorMode = useColorMode();
|
const colorMode = useColorMode();
|
||||||
const runtimeConfig = useRuntimeConfig();
|
const runtimeConfig = useRuntimeConfig();
|
||||||
|
|
||||||
const { locale, locales } = useI18n();
|
const { locale } = useI18n();
|
||||||
const localePath = useGLocalePath();
|
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 isNavOpen = ref<boolean>(false);
|
||||||
const isCanvasLoaded = ref<boolean>(false);
|
const isCanvasLoaded = ref<boolean>(false);
|
||||||
|
24
package.json
24
package.json
@ -9,36 +9,36 @@
|
|||||||
"postinstall": "nuxt prepare"
|
"postinstall": "nuxt prepare"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/parser": "^7.23.6",
|
"@babel/parser": "^7.23.9",
|
||||||
"@nuxt/content": "npm:@nuxt/content-edge@latest",
|
"@nuxt/content": "npm:@nuxt/content-edge@latest",
|
||||||
"@nuxtjs/color-mode": "^3.3.2",
|
"@nuxtjs/color-mode": "^3.3.2",
|
||||||
"@nuxtjs/i18n": "8.0.0",
|
"@nuxtjs/i18n": "^8.1.0",
|
||||||
"@rollup/plugin-yaml": "^4.1.2",
|
"@rollup/plugin-yaml": "^4.1.2",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/node": "^20.10.5",
|
"@types/node": "^20.11.17",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.5",
|
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.5",
|
||||||
"autoprefixer": "^10.4.16",
|
"autoprefixer": "^10.4.17",
|
||||||
"bootstrap": "^5.3.2",
|
"bootstrap": "^5.3.2",
|
||||||
"bootstrap-icons": "^1.11.2",
|
"bootstrap-icons": "^1.11.3",
|
||||||
"github-markdown-css": "^5.5.0",
|
"github-markdown-css": "^5.5.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"mfm-js": "^0.23.3",
|
"mfm-js": "^0.23.3",
|
||||||
"misskey-js": "2024.2.0-beta.3",
|
"misskey-js": "2024.2.0-beta.3",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"nuxt": "^3.9.3",
|
"nuxt": "^3.10.1",
|
||||||
"postcss": "^8.4.32",
|
"postcss": "^8.4.35",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.70.0",
|
||||||
"schema-dts": "^1.1.2",
|
"schema-dts": "^1.1.2",
|
||||||
"sitemap": "^7.1.1",
|
"sitemap": "^7.1.1",
|
||||||
"tailwindcss": "^3.4.0",
|
"tailwindcss": "^3.4.1",
|
||||||
"ua-parser-js": "^1.0.37",
|
"ua-parser-js": "^1.0.37",
|
||||||
"ufo": "^1.3.2",
|
"ufo": "^1.4.0",
|
||||||
"vite-svg-loader": "^4.0.0"
|
"vite-svg-loader": "^4.0.0"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.10.2",
|
"packageManager": "pnpm@8.10.2",
|
||||||
"dependencies": {
|
"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 { redirects } from './../assets/data/old-hub-redirects';
|
||||||
import { localesConst } from './../assets/data/locales';
|
import { localesConst } from './../assets/data/locales';
|
||||||
import type { LocaleCodes } from './../assets/data/locales';
|
import type { LocaleCodes } from './../assets/data/locales';
|
||||||
|
import type { PartialRecord } from './../types/others';
|
||||||
import type { NuxtConfig } from 'nuxt/schema';
|
import type { NuxtConfig } from 'nuxt/schema';
|
||||||
import { joinURL, cleanDoubleSlashes } from 'ufo';
|
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[] {
|
export function getOldHubRedirects(mode: 'nitro' | 'vercel' = 'nitro'): NuxtConfig['routeRules'] | VercelRouteSource[] {
|
||||||
|
|
||||||
// 旧Hub時代の各言語のプレフィックス
|
// 旧Hub時代の各言語のプレフィックス
|
||||||
const hubLocales: Record<LocaleCodes, string> = {
|
const hubLocales: PartialRecord<LocaleCodes, string> = {
|
||||||
ja: '/',
|
ja: '/',
|
||||||
en: '/en',
|
en: '/en',
|
||||||
id: '/id',
|
id: '/id',
|
||||||
@ -92,7 +93,7 @@ export function getOldHubRedirects(mode: 'nitro' | 'vercel' = 'nitro'): NuxtConf
|
|||||||
destination = joinURL(`/${locale.code}`, destination);
|
destination = joinURL(`/${locale.code}`, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
out[joinURL(hubLocales[locale.code], route[0])] = {
|
out[joinURL(hubLocales[locale.code] ?? '/', route[0])] = {
|
||||||
redirect: {
|
redirect: {
|
||||||
to: destination,
|
to: destination,
|
||||||
statusCode: 301,
|
statusCode: 301,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useRuntimeConfig } from '#imports';
|
import { useRuntimeConfig } from '#imports';
|
||||||
import { withTrailingSlash } from 'ufo';
|
import { withTrailingSlash } from 'ufo';
|
||||||
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
import type { LocaleObject } from '@nuxtjs/i18n';
|
||||||
|
|
||||||
export default defineNitroPlugin((nitroApp) => {
|
export default defineNitroPlugin((nitroApp) => {
|
||||||
nitroApp.hooks.hook('render:html', (html, { event }) => {
|
nitroApp.hooks.hook('render:html', (html, { event }) => {
|
||||||
@ -19,7 +19,7 @@ export default defineNitroPlugin((nitroApp) => {
|
|||||||
html.htmlAttrs = [];
|
html.htmlAttrs = [];
|
||||||
|
|
||||||
const remainingList: string[] = [];
|
const remainingList: string[] = [];
|
||||||
html.head.forEach((v) => {
|
html.head.forEach((v: string) => {
|
||||||
remainingList.push(...(v.match(/<!--(.|\n)*(?<=-->)/gm) ?? []));
|
remainingList.push(...(v.match(/<!--(.|\n)*(?<=-->)/gm) ?? []));
|
||||||
remainingList.push(...(v.match(/<link\s+rel="(og|alternate|canonical|me)[^>]+>/gm) ?? []));
|
remainingList.push(...(v.match(/<link\s+rel="(og|alternate|canonical|me)[^>]+>/gm) ?? []));
|
||||||
remainingList.push(...(v.match(/<meta[^>]+>/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 { 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' {
|
declare module '*.svg' {
|
||||||
import { FunctionalComponent, SVGAttributes } from 'vue'
|
import { FunctionalComponent, SVGAttributes } from 'vue'
|
||||||
|
Loading…
Reference in New Issue
Block a user