import { fragmentSettings } from '@anglefeint/astro-theme/utils/fragments'; // Package-owned project configuration. import { validateComments } from '@anglefeint/astro-theme/utils/comments'; import { normalizeMusic } from '@anglefeint/astro-theme/utils/music'; import { THEME_CONFIG } from '@anglefeint/user-config'; import { validateBlogPageSize } from '../../utils/blog-pagination'; const commentsConfig = THEME_CONFIG.theme.comments; validateComments(commentsConfig); const normalizedCommentTerm = commentsConfig.term.trim(); const normalizedCommentNumber = commentsConfig.number.trim(); /** * Theme behavior config. */ export const THEME = { FRAGMENTS: fragmentSettings(THEME_CONFIG.theme.fragments), HOME: { SHOW_INITIALIZE: THEME_CONFIG.theme.home?.showInitialize ?? true, SHOW_FOLLOW: THEME_CONFIG.theme.home?.showFollow ?? true, SHOW_TRACE: THEME_CONFIG.theme.home?.showTrace ?? true, }, MATH: { ENABLED: THEME_CONFIG.theme.math?.enabled ?? true }, ANALYTICS: { GOOGLE_ANALYTICS_ID: THEME_CONFIG.analytics?.googleAnalyticsId ?? '' }, FOOTER: { SHOW_CREDITS: THEME_CONFIG.theme.footer?.showCredits ?? true, LINKS: THEME_CONFIG.theme.footer?.links ?? [], }, MUSIC: normalizeMusic(THEME_CONFIG.theme.music), /** Posts per page on blog list */ BLOG_PAGE_SIZE: validateBlogPageSize(THEME_CONFIG.theme.blogPageSize), /** Number of latest posts shown on home page */ HOME_LATEST_COUNT: THEME_CONFIG.theme.homeLatestCount, /** Whether to enable the About page (disable to hide from nav/routes if needed) */ DECODER_PAGE_ENABLED: THEME_CONFIG.theme.enableDecoderPage ?? true, ABOUT_PAGE_ENABLED: THEME_CONFIG.theme.enableAboutPage, /** Default for article contents; individual posts may override it. */ TOC: { ENABLED: THEME_CONFIG.theme.toc?.enabled ?? true }, SEARCH: { ENABLED: THEME_CONFIG.theme.search?.enabled ?? true }, TAGS: { ENABLED: THEME_CONFIG.theme.tags?.enabled ?? true }, SOCIAL_IMAGE: { ENABLED: THEME_CONFIG.theme.socialImage?.enabled ?? true }, /** Pagination behavior and style strategy for blog list */ PAGINATION: { WINDOW_SIZE: THEME_CONFIG.theme.pagination.windowSize, SHOW_JUMP_THRESHOLD: THEME_CONFIG.theme.pagination.showJumpThreshold, JUMP: { ENABLED: THEME_CONFIG.theme.pagination.jump.enabled, ENTER_TO_GO: THEME_CONFIG.theme.pagination.jump.enterToGo, }, STYLE: { ENABLED: THEME_CONFIG.theme.pagination.style.enabled, MODE: THEME_CONFIG.theme.pagination.style.mode, VARIANTS: THEME_CONFIG.theme.pagination.style.variants, FIXED_VARIANT: THEME_CONFIG.theme.pagination.style.fixedVariant, }, }, /** Optional visual effects switches */ EFFECTS: { ENABLE_RED_QUEEN: THEME_CONFIG.theme.effects.enableRedQueen, ENABLE_HOME_PASSAGE: THEME_CONFIG.theme.effects.enableHomePassage, }, /** Optional comments integration (Giscus) */ COMMENTS: { SHARE_ACROSS_LOCALES: commentsConfig.shareAcrossLocales ?? false, ENABLED: THEME_CONFIG.theme.comments.enabled, REPO: THEME_CONFIG.theme.comments.repo, REPO_ID: THEME_CONFIG.theme.comments.repoId, CATEGORY: THEME_CONFIG.theme.comments.category, CATEGORY_ID: THEME_CONFIG.theme.comments.categoryId, MAPPING: THEME_CONFIG.theme.comments.mapping, TERM: normalizedCommentTerm, NUMBER: normalizedCommentNumber, STRICT: THEME_CONFIG.theme.comments.strict, REACTIONS_ENABLED: THEME_CONFIG.theme.comments.reactionsEnabled, EMIT_METADATA: THEME_CONFIG.theme.comments.emitMetadata, INPUT_POSITION: THEME_CONFIG.theme.comments.inputPosition, THEME: THEME_CONFIG.theme.comments.theme, LANG: THEME_CONFIG.theme.comments.lang, LOADING: THEME_CONFIG.theme.comments.loading, CROSSORIGIN: THEME_CONFIG.theme.comments.crossorigin, }, } as const;