diff --git a/docs/app/pages/components/index.vue b/docs/app/pages/components/index.vue index ef96d0a..93f597d 100644 --- a/docs/app/pages/components/index.vue +++ b/docs/app/pages/components/index.vue @@ -10,7 +10,7 @@ usePaperOgImage({ const { docFor } = await useComponentSummaries() -function sectionLabel(id: '' | 'form' | 'prose'): string { +function sectionLabel(id: SectionId | ''): string { return componentSectionLabel(id, t) } diff --git a/docs/app/utils/components.ts b/docs/app/utils/components.ts index 7d791dd..d21ccb3 100644 --- a/docs/app/utils/components.ts +++ b/docs/app/utils/components.ts @@ -36,7 +36,13 @@ const SECTIONS = [ { id: 'pattern', concepts: ['navigation', 'disclosure', 'feedback'] }, ] as const -type SectionId = (typeof SECTIONS)[number]['id'] +export type SectionId = (typeof SECTIONS)[number]['id'] + +type SectionLabelKey = + | 'components.sections.foundation' + | 'components.sections.chrome' + | 'components.sections.control' + | 'components.sections.pattern' /** One group per folder in `src/components`. A sibling `Name.demo.vue` is that component's demo. */ function createCatalog(): ConceptGroup[] { @@ -85,16 +91,20 @@ export function componentCatalog(): ConceptGroup[] { } export function componentSectionLabel( - id: string, - translate: (key: 'components.sections.form' | 'components.sections.prose') => string, + id: SectionId | '', + translate: (key: SectionLabelKey) => string, ): string { switch (id) { case '': return '' - case 'form': - return translate('components.sections.form') - case 'prose': - return translate('components.sections.prose') + case 'foundation': + return translate('components.sections.foundation') + case 'chrome': + return translate('components.sections.chrome') + case 'control': + return translate('components.sections.control') + case 'pattern': + return translate('components.sections.pattern') default: { const unexpected: never = id return unexpected @@ -102,7 +112,7 @@ export function componentSectionLabel( } } -/** Concepts sit under a section such as form or prose. A folder with no section is still listed. */ +/** Concepts sit under a catalog section grade. A folder with no section is still listed. */ export function componentSections(): Array { const byId = new Map(catalog.map(group => [group.id, group])) const used = new Set() diff --git a/docs/i18n/locales/en.json b/docs/i18n/locales/en.json index 49bae33..9fb28d4 100644 --- a/docs/i18n/locales/en.json +++ b/docs/i18n/locales/en.json @@ -96,8 +96,10 @@ "required": "Required.", "default": "Default", "sections": { - "form": "Form", - "prose": "Prose" + "foundation": "Foundation", + "chrome": "Chrome", + "control": "Control", + "pattern": "Pattern" } } } diff --git a/docs/i18n/locales/ja.json b/docs/i18n/locales/ja.json index b187d34..9665b30 100644 --- a/docs/i18n/locales/ja.json +++ b/docs/i18n/locales/ja.json @@ -96,8 +96,10 @@ "required": "必須。", "default": "デフォルト", "sections": { - "form": "フォーム", - "prose": "本文" + "foundation": "基盤", + "chrome": "クローム", + "control": "コントロール", + "pattern": "パターン" } } } diff --git a/docs/i18n/locales/zh.json b/docs/i18n/locales/zh.json index e592fd8..209aed5 100644 --- a/docs/i18n/locales/zh.json +++ b/docs/i18n/locales/zh.json @@ -96,8 +96,10 @@ "required": "必填。", "default": "默认", "sections": { - "form": "表单", - "prose": "正文" + "foundation": "基础", + "chrome": "装饰", + "control": "控件", + "pattern": "模式" } } } diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts index c940d78..4d3e415 100644 --- a/docs/nuxt.config.ts +++ b/docs/nuxt.config.ts @@ -6,8 +6,14 @@ import { componentFile } from './app/utils/component-files' import { keepEmptyTitle } from './app/utils/empty-title' import { listPublicShareImages } from './app/utils/public-files' import { IMAGE_ORIGIN, SITE_DESCRIPTION, SITE_NAME } from './app/utils/site' +import type { NuxtConfig } from 'nuxt/schema' import ligThemes from './app/assets/lig-themes.json' +const shikiThemes = { + default: ligThemes.default as typeof ligThemes.default & { type: 'light' }, + dark: ligThemes.dark as typeof ligThemes.dark & { type: 'dark' }, +} + const siteDist = fileURLToPath(new URL('../dist', import.meta.url)) const componentsRoot = fileURLToPath(new URL('../src/components', import.meta.url)) @@ -32,13 +38,19 @@ function componentRoutes(): string[] { return routes } -export default defineNuxtConfig({ +const nuxtConfig = { extends: ['@froq/og-covers-layer'], compatibilityDate: '2026-09-19', hooks: { - 'content:file:afterParse': ({ file, content }) => { + 'content:file:afterParse': ({ + file, + content, + }: { + file: { body: unknown } + content: object + }) => { keepEmptyTitle(content, file.body) if (typeof file.body === 'string') (content as { words?: number }).words = countCardWords(file.body) @@ -102,7 +114,7 @@ export default defineNuxtConfig({ build: { markdown: { highlight: { - theme: { default: ligThemes.default, dark: ligThemes.dark }, + theme: shikiThemes, langs: ['ts', 'vue', 'bash', 'css', 'json'], }, }, @@ -149,4 +161,6 @@ export default defineNuxtConfig({ }, typescript: { strict: true }, -}) +} as unknown as NuxtConfig + +export default defineNuxtConfig(nuxtConfig)