UNPKG

@stacksjs/stx

Version:

A performant UI Framework. Powered by Bun.

218 lines 5.33 kB
/** * PWA route cache configuration * Defines how specific routes should be cached by the service worker */ export declare interface PwaRouteCache { pattern: string strategy: PwaCacheStrategy cacheName?: string maxAgeSeconds?: number maxEntries?: number } /** * PWA icon configuration for automatic generation */ export declare interface PwaIconConfig { src: string sizes?: number[] generateWebP?: boolean generateAppleIcons?: boolean outputDir?: string purpose?: ('any' | 'maskable' | 'monochrome')[] } /** * PWA shortcut definition for app shortcuts menu */ export declare interface PwaShortcut { name: string shortName?: string description?: string url: string icons?: Array<{ src: string, sizes: string, type?: string }> } /** * PWA screenshot definition for app store listings */ export declare interface PwaScreenshot { src: string sizes: string type?: string label?: string platform?: 'wide' | 'narrow' } /** * PWA Web App Manifest configuration */ export declare interface PwaManifestConfig { name: string shortName?: string description?: string startUrl?: string display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser' displayOverride?: string[] orientation?: 'portrait' | 'landscape' | 'any' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary' themeColor?: string backgroundColor?: string scope?: string lang?: string dir?: 'ltr' | 'rtl' | 'auto' id?: string categories?: string[] shortcuts?: PwaShortcut[] screenshots?: PwaScreenshot[] launchHandler?: 'auto' | 'focus-existing' | 'navigate-new' | 'navigate-existing' handleLinks?: 'auto' | 'preferred' | 'not-preferred' edgeSidePanel?: { enabled: boolean preferredWidth?: number } } /** * PWA offline fallback page configuration */ export declare interface PwaOfflineConfig { enabled: boolean page?: string fallbackTitle?: string fallbackMessage?: string precacheAssets?: string[] } /** * Service worker configuration */ export declare interface PwaServiceWorkerConfig { fileName?: string cacheVersion?: string skipWaiting?: boolean clientsClaim?: boolean navigationPreload?: boolean excludeRoutes?: string[] cacheFileTypes?: string[] useWorkbox?: boolean } /** * Push notification configuration */ export declare interface PwaPushConfig { enabled: boolean vapidPublicKey?: string subscriptionEndpoint?: string defaultIcon?: string defaultBadge?: string defaultOptions?: { /** Enable vibration */ vibrate?: number[] /** Require interaction to dismiss */ requireInteraction?: boolean } } /** * Background sync configuration */ export declare interface PwaBackgroundSyncConfig { enabled: boolean queueName?: string maxRetentionMinutes?: number maxRetries?: number minInterval?: number forms?: string[] endpoints?: string[] } /** * Share target configuration for receiving shared content */ export declare interface PwaShareTargetConfig { enabled: boolean action: string method?: 'GET' | 'POST' enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' params?: { /** Parameter name for shared title */ title?: string /** Parameter name for shared text */ text?: string /** Parameter name for shared URL */ url?: string } acceptFiles?: Array<{ name: string accept: string[] }> } /** * File handler configuration for handling specific file types */ export declare interface PwaFileHandlerConfig { enabled: boolean action?: string accept?: Record<string, string[]> launchType?: 'single-client' | 'multiple-clients' icons?: Array<{ src: string, sizes: string, type: string }> } /** * Protocol handler configuration */ export declare interface PwaProtocolHandlerConfig { protocol: string url: string } /** * Cache storage limits configuration */ export declare interface PwaCacheStorageConfig { maxSize?: number maxEntries?: number maxAge?: number purgeStrategy?: 'lru' | 'fifo' | 'lfu' } /** * Update notification configuration */ export declare interface PwaUpdateConfig { enabled: boolean promptUser?: boolean autoReload?: boolean message?: string uiSelector?: string } /** * Auto-precaching configuration */ export declare interface PwaPrecacheConfig { enabled: boolean includeHtml?: boolean includeJs?: boolean includeCss?: boolean includeImages?: boolean includeFonts?: boolean include?: string[] exclude?: string[] maxFileSizeKB?: number } /** * Complete PWA configuration */ export declare interface PwaConfig { enabled: boolean manifest: PwaManifestConfig icons?: PwaIconConfig routes?: PwaRouteCache[] offline?: PwaOfflineConfig serviceWorker?: PwaServiceWorkerConfig autoInject?: boolean push?: PwaPushConfig backgroundSync?: PwaBackgroundSyncConfig shareTarget?: PwaShareTargetConfig fileHandlers?: PwaFileHandlerConfig protocolHandlers?: PwaProtocolHandlerConfig[] cacheStorage?: PwaCacheStorageConfig updates?: PwaUpdateConfig precache?: PwaPrecacheConfig } /** * Progressive Web App (PWA) Types */ /** * PWA caching strategy for service worker routes */ export type PwaCacheStrategy = 'cache-first' | 'network-first' | 'stale-while-revalidate' | 'network-only' | 'cache-only'