diff --git a/index.d.ts b/index.d.ts index 5ac9a17..383799a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -13,6 +13,7 @@ declare class WebpackPwaManifest extends Plugin { declare namespace WebpackPwaManifest { type Direction = 'ltr' | 'rtl' | 'auto'; type Display = 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser'; + type DisplayOverride = 'window-controls-overlay' | Display; type Orientation = 'any' | 'natural' | 'landscape' | 'landscape-primary' | 'landscape-secondary' | 'portrait' | 'portrait-primary' | 'portrait-secondary'; type CrossOrigin = 'use-credentials' | 'anonymous'; interface ManifestOptions { @@ -20,6 +21,7 @@ declare namespace WebpackPwaManifest { description?: string; dir?: Direction; display?: Display; + display_override?: DisplayOverride[]; fingerprints?: boolean; filename?: string; icons?: Icon | Icon[]; diff --git a/src/index.js b/src/index.js index 0855ef2..8fc82c4 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ import checkDeprecated from './validators/versioning' class WebpackPwaManifest { constructor (options = {}) { - validatePresets(options, 'dir', 'display', 'orientation', 'crossorigin') + validatePresets(options, 'dir', 'display', 'display_override', 'orientation', 'crossorigin') validateColors(options, 'background_color', 'theme_color') checkDeprecated(options, 'useWebpackPublicPath') this._generator = null diff --git a/src/validators/presets.js b/src/validators/presets.js index 2fa011f..6fa5db8 100644 --- a/src/validators/presets.js +++ b/src/validators/presets.js @@ -10,12 +10,16 @@ const presets = { display: [ 'fullscreen', 'standalone', 'minimal-ui', 'browser' ], + display_override: [ + 'window-controls-overlay', 'fullscreen', 'standalone', 'minimal-ui', 'browser' + ], crossorigin: [ 'anonymous', 'use-credentials' ] } function hasPreset (key, value) { + if (Array.isArray(value)) return value.every(v => hasPreset(key, v)) return presets[key].indexOf(value) >= 0 }