@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
104 lines • 2.5 kB
TypeScript
import type { PwaManifestConfig, StxOptions } from '../types';
/**
* Generate a Web App Manifest object from configuration
*/
export declare function generateManifest(options: StxOptions): WebAppManifest | null;
/**
* Generate manifest.json file content as a string
*/
export declare function generateManifestJson(options: StxOptions): string;
/**
* Merge user manifest config with defaults
*/
export declare function mergeManifestConfig(userConfig: Partial<PwaManifestConfig>, defaultConfig: PwaManifestConfig): PwaManifestConfig;
/**
* Validate manifest configuration
* Returns an array of validation errors
*/
export declare function validateManifest(options: StxOptions): string[];
/**
* Manifest icon entry structure
*/
export declare interface ManifestIcon {
src: string
sizes: string
type: string
purpose?: string
}
/**
* Share target entry structure
*/
export declare interface ManifestShareTarget {
action: string
method?: 'GET' | 'POST'
enctype?: string
params: {
title?: string
text?: string
url?: string
files?: Array<{
name: string
accept: string[]
}>
}
}
/**
* File handler entry structure
*/
export declare interface ManifestFileHandler {
action: string
accept: Record<string, string[]>
icons?: ManifestIcon[]
launch_type?: 'single-client' | 'multiple-clients'
}
/**
* Protocol handler entry structure
*/
export declare interface ManifestProtocolHandler {
protocol: string
url: string
}
/**
* Complete Web App Manifest structure
*/
export declare interface WebAppManifest {
name: string
short_name?: string
description?: string
start_url: string
display: string
display_override?: string[]
orientation?: string
theme_color?: string
background_color?: string
scope?: string
lang?: string
dir?: string
id?: string
categories?: string[]
icons: ManifestIcon[]
shortcuts?: Array<{
name: string
short_name?: string
description?: string
url: string
icons?: ManifestIcon[]
}>
screenshots?: Array<{
src: string
sizes: string
type?: string
label?: string
form_factor?: 'wide' | 'narrow'
}>
share_target?: ManifestShareTarget
file_handlers?: ManifestFileHandler[]
protocol_handlers?: ManifestProtocolHandler[]
launch_handler?: {
client_mode: 'auto' | 'focus-existing' | 'navigate-new' | 'navigate-existing'
}
handle_links?: 'auto' | 'preferred' | 'not-preferred'
edge_side_panel?: {
preferred_width?: number
}
}