mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
5cad4d3df9
- Service worker: versioned cache name, navigation preload, stale-while-revalidate for images
- New PWAModule extracted from MiscModule with async registration and update detection
- SW update notification toast in Hugo template with i18n support (16 languages)
- Web app manifest template (site.webmanifest) generated from [params.app] config
- [params.app] keys migrated to snake_case: name, short_name, pwa, no_favicon, svg_favicon, mask_color, tile_color, theme_color
- enablePWA moved from [params] to [params.app].pwa
- theme_color no longer accepts single-value, only {light, dark} map
- EventBus: new fixit:sw-update event
- SCSS: new _sw-toast.scss widget for update notification
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { printBanner } from './core/banner'
|
|
import { PublicAPI } from './core/public-api'
|
|
|
|
/**
|
|
* FixIt theme entry point — initializes all modules and the window.fixit facade.
|
|
*
|
|
* Responsibilities:
|
|
* - Create PublicAPI which initializes all service modules.
|
|
* - Run the init sequence on `DOMContentLoaded`.
|
|
*/
|
|
function bootstrap(): void {
|
|
// Build window.fixit facade with all modules
|
|
window.fixit = new PublicAPI()
|
|
|
|
/**
|
|
* Initialize all modules in dependency order.
|
|
*
|
|
* 1. UI framework — menu (mask overlay), theme (color scheme)
|
|
* 2. Interactive components — toc (sidebar), search (overlay)
|
|
* 3. Content enhancement — content (details, tooltips), enc (decryption)
|
|
* 4. Global features — misc (PWA, comments), events (scroll, resize)
|
|
*/
|
|
function init() {
|
|
try {
|
|
window.fixit.menu.setup()
|
|
window.fixit.theme.setup()
|
|
window.fixit.toc.setup()
|
|
window.fixit.search.setup()
|
|
window.fixit.content.setup()
|
|
window.fixit.enc.setup()
|
|
window.fixit.pwa.setup()
|
|
window.fixit.misc.setup()
|
|
window.fixit.events.setup()
|
|
}
|
|
catch (err) {
|
|
console.error(err)
|
|
}
|
|
printBanner(window.fixit.version)
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', init, false)
|
|
}
|
|
|
|
bootstrap()
|