Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/app/pages/components/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ usePaperOgImage({

const { docFor } = await useComponentSummaries()

function sectionLabel(id: '' | 'form' | 'prose'): string {
function sectionLabel(id: SectionId | ''): string {
return componentSectionLabel(id, t)
}
</script>
Expand Down
26 changes: 18 additions & 8 deletions docs/app/utils/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down Expand Up @@ -85,24 +91,28 @@ 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
}
}
}

/** 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<CatalogSection | { id: ''; concepts: ConceptGroup[] }> {
const byId = new Map(catalog.map(group => [group.id, group]))
const used = new Set<string>()
Expand Down
6 changes: 4 additions & 2 deletions docs/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@
"required": "Required.",
"default": "Default",
"sections": {
"form": "Form",
"prose": "Prose"
"foundation": "Foundation",
"chrome": "Chrome",
"control": "Control",
"pattern": "Pattern"
}
}
}
6 changes: 4 additions & 2 deletions docs/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@
"required": "必須。",
"default": "デフォルト",
"sections": {
"form": "フォーム",
"prose": "本文"
"foundation": "基盤",
"chrome": "クローム",
"control": "コントロール",
"pattern": "パターン"
}
}
}
6 changes: 4 additions & 2 deletions docs/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@
"required": "必填。",
"default": "默认",
"sections": {
"form": "表单",
"prose": "正文"
"foundation": "基础",
"chrome": "装饰",
"control": "控件",
"pattern": "模式"
}
}
}
22 changes: 18 additions & 4 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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)
Expand Down Expand Up @@ -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'],
},
},
Expand Down Expand Up @@ -149,4 +161,6 @@ export default defineNuxtConfig({
},

typescript: { strict: true },
})
} as unknown as NuxtConfig

export default defineNuxtConfig(nuxtConfig)
Loading