feat: publish HoloLake model-native living system source

This commit is contained in:
冰朔 2026-08-03 10:04:41 +08:00
commit c395dd3a99
2467 changed files with 615073 additions and 0 deletions

View file

@ -0,0 +1,26 @@
import type { NoteWidthMode } from '../types'
import { detectFrontmatterState } from './frontmatter'
export const DEFAULT_NOTE_WIDTH_MODE: NoteWidthMode = 'normal'
export function normalizeNoteWidthMode(value: unknown): NoteWidthMode | null {
if (typeof value !== 'string') return null
const normalized = value.trim().toLowerCase()
return normalized === 'normal' || normalized === 'wide' ? normalized : null
}
export function resolveNoteWidthMode(noteWidth: unknown, defaultWidth: unknown): NoteWidthMode {
return normalizeNoteWidthMode(noteWidth)
?? normalizeNoteWidthMode(defaultWidth)
?? DEFAULT_NOTE_WIDTH_MODE
}
export function toggleNoteWidthMode(width: unknown): NoteWidthMode {
return resolveNoteWidthMode(width, DEFAULT_NOTE_WIDTH_MODE) === 'wide' ? 'normal' : 'wide'
}
export function canPersistNoteWidthMode(content: string | null): boolean {
const frontmatterState = detectFrontmatterState(content)
return frontmatterState === 'valid' || frontmatterState === 'empty'
}