@khmyznikov/pwa-install
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ ## Contributor guidelines |
@@ -106,2 +106,11 @@ { | ||
"kind": "field", | ||
"name": "disableClose", | ||
"type": { | ||
"text": "boolean" | ||
}, | ||
"default": "false", | ||
"attribute": "disable-close" | ||
}, | ||
{ | ||
"kind": "field", | ||
"name": "externalPromptEvent", | ||
@@ -329,2 +338,10 @@ "type": { | ||
"fieldName": "disableChrome" | ||
}, | ||
{ | ||
"name": "disable-close", | ||
"type": { | ||
"text": "boolean" | ||
}, | ||
"default": "false", | ||
"fieldName": "disableClose" | ||
} | ||
@@ -331,0 +348,0 @@ ], |
@@ -15,2 +15,3 @@ /// <reference types="dom-chromium-installation-events" /> | ||
disableChrome: boolean; | ||
disableClose: boolean; | ||
static get styles(): CSSStyleSheet[]; | ||
@@ -17,0 +18,0 @@ externalPromptEvent: BeforeInstallPromptEvent | null; |
export declare const sourceLocale = "en"; | ||
export declare const targetLocales: readonly ["cs", "de", "el", "es", "fr", "it", "nl", "pl", "ru", "sr", "tr", "uk", "zh", "zh-CN"]; | ||
export declare const allLocales: readonly ["cs", "de", "el", "en", "es", "fr", "it", "nl", "pl", "ru", "sr", "tr", "uk", "zh", "zh-CN"]; | ||
export declare const targetLocales: readonly ["cs", "de", "el", "es", "fr", "it", "nl", "no", "pl", "ru", "sr", "tr", "uk", "zh", "zh-CN"]; | ||
export declare const allLocales: readonly ["cs", "de", "el", "en", "es", "fr", "it", "nl", "no", "pl", "ru", "sr", "tr", "uk", "zh", "zh-CN"]; |
import { WebAppManifest } from 'web-app-manifest'; | ||
declare const template: (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, howToForApple: any, isDesktop: boolean, howToRequested: boolean, toggleGallery: any, galleryRequested: boolean) => import("lit-html").TemplateResult<1>; | ||
declare const template: (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, disableClose: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, howToForApple: any, isDesktop: boolean, howToRequested: boolean, toggleGallery: any, galleryRequested: boolean) => import("lit-html").TemplateResult<1>; | ||
export default template; |
@@ -13,2 +13,3 @@ import { LitElement } from 'lit'; | ||
hideDialog: () => void; | ||
disableClose: boolean; | ||
private _callInstall; | ||
@@ -15,0 +16,0 @@ private _callHide; |
import { WebAppManifest } from 'web-app-manifest'; | ||
declare const template: (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, install: any, toggleGallery: any, galleryRequested: boolean) => import("lit-html").TemplateResult<1>; | ||
declare const template: (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, disableClose: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, install: any, toggleGallery: any, galleryRequested: boolean) => import("lit-html").TemplateResult<1>; | ||
export default template; |
@@ -0,0 +0,0 @@ { |
@@ -1,1 +0,1 @@ | ||
var cacheName="PWAinstallDemo-21.1.2024/19:24:34",filesToCache=["/pwa-install/","manifest.json"];function sendMessage(e,n){return new Promise((function(t,s){var a=new MessageChannel;e.postMessage(n,[a.port2])}))}function sendMessageToAll(e,n){clients.matchAll().then((t=>{t.forEach((n=>{sendMessage(n,e)})),n&&"function"==typeof n&&n()}))}self.addEventListener("install",(function(e){e.waitUntil(caches.open(cacheName).then((function(e){return e.addAll(filesToCache)}))),self.skipWaiting()})),self.addEventListener("activate",(function(e){return e.waitUntil(caches.keys().then((function(e){return Promise.all(e.map((function(e){if(e!==cacheName)return sendMessageToAll("NEW_VERSION"),caches.delete(e)})))}))),self.clients.claim()})),self.addEventListener("fetch",(function(e){e.respondWith(caches.match(e.request,{ignoreSearch:!0}).then((function(n){return n||fetch(e.request)})))})),self.addEventListener("message",(e=>{e&&e.data&&e.data.message})); | ||
var cacheName="PWAinstallDemo-9.3.2024/20:18:50",filesToCache=["/pwa-install/","manifest.json"];function sendMessage(e,n){return new Promise((function(t,s){var a=new MessageChannel;e.postMessage(n,[a.port2])}))}function sendMessageToAll(e,n){clients.matchAll().then((t=>{t.forEach((n=>{sendMessage(n,e)})),n&&"function"==typeof n&&n()}))}self.addEventListener("install",(function(e){e.waitUntil(caches.open(cacheName).then((function(e){return e.addAll(filesToCache)}))),self.skipWaiting()})),self.addEventListener("activate",(function(e){return e.waitUntil(caches.keys().then((function(e){return Promise.all(e.map((function(e){if(e!==cacheName)return sendMessageToAll("NEW_VERSION"),caches.delete(e)})))}))),self.clients.claim()})),self.addEventListener("fetch",(function(e){e.respondWith(caches.match(e.request,{ignoreSearch:!0}).then((function(n){return n||fetch(e.request)})))})),self.addEventListener("message",(e=>{e&&e.data&&e.data.message})); |
@@ -18,3 +18,4 @@ { | ||
"it", | ||
"cs" | ||
"cs", | ||
"no" | ||
], | ||
@@ -21,0 +22,0 @@ "tsConfig": "tsconfig.json", |
{ | ||
"name": "@khmyznikov/pwa-install", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "PWA install dialog provide more convenience user experience and fix lack of native dialogs in some browsers.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -9,3 +9,3 @@ [![Published on NPM](https://img.shields.io/npm/v/@khmyznikov/pwa-install.svg)](https://www.npmjs.com/package/@khmyznikov/pwa-install) | ||
Use it as [Web Component with any **modern** framework](https://academind.com/tutorials/web-components-introduction/#consuming-the-web-component-in-vue). No polyfill is required. | ||
Use it as [Web Component with any **modern** framework](https://custom-elements-everywhere.com/). No polyfill is required. | ||
[React polyfill](https://glitch.com/edit/#!/mango-shine-diagram?path=src%2Fcomponents%2Fpwa-install.jsx). | ||
@@ -73,2 +73,3 @@ | ||
disable-chrome="true" | ||
disable-close="true" | ||
@@ -186,2 +187,3 @@ install-description="Custom call to install text" | ||
- *CS* | ||
- *NO* | ||
@@ -195,4 +197,4 @@ Language should change automatically based on browser settings. Please create the pull-request if you want to help with translation to your language. It's an easy process. | ||
## ROADMAP | ||
- support async load with external beforeinstallprompt catcher | ||
- legacy react wrap | ||
- style customization | ||
- samsung mobile support | ||
- mozilla mobile support | ||
- manual theme |
@@ -0,0 +0,0 @@ import { LitElement, html } from 'lit'; |
@@ -0,0 +0,0 @@ import { html } from 'lit'; |
@@ -43,2 +43,3 @@ import { LitElement, PropertyValues, html } from 'lit'; | ||
@property({attribute: 'disable-chrome', type: Boolean}) disableChrome = false; | ||
@property({attribute: 'disable-close', type: Boolean}) disableClose = false; | ||
@@ -271,2 +272,3 @@ static get styles() { | ||
this.disableScreenshots, | ||
this.disableClose, | ||
this.icon, | ||
@@ -289,2 +291,3 @@ this._manifest, | ||
this.disableScreenshots, | ||
this.disableClose, | ||
this.icon, | ||
@@ -291,0 +294,0 @@ this._manifest, |
@@ -21,2 +21,3 @@ import { configureLocalization } from '@lit/localize'; | ||
import * as cs from "./locales/cs"; | ||
import * as no from "./locales/no"; | ||
@@ -37,3 +38,4 @@ const localizedTemplates = new Map([ | ||
['it', it], | ||
['cs', cs] | ||
['cs', cs], | ||
['no', no] | ||
]) | ||
@@ -40,0 +42,0 @@ |
@@ -21,2 +21,3 @@ // Do not modify this file by hand! | ||
`nl`, | ||
`no`, | ||
`pl`, | ||
@@ -43,2 +44,3 @@ `ru`, | ||
`nl`, | ||
`no`, | ||
`pl`, | ||
@@ -45,0 +47,0 @@ `ru`, |
@@ -6,3 +6,3 @@ import { html } from 'lit'; | ||
const template = (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, howToForApple: any, isDesktop: boolean, howToRequested: boolean, toggleGallery: any, galleryRequested: boolean) => { | ||
const template = (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, disableClose: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, howToForApple: any, isDesktop: boolean, howToRequested: boolean, toggleGallery: any, galleryRequested: boolean) => { | ||
const installDialogClassesApple = () => { return {available: installAvailable, 'how-to': howToRequested, gallery: galleryRequested, desktop: isDesktop}}; | ||
@@ -17,5 +17,5 @@ const screenshotsAvailable = !disableScreenshots && manifest.screenshots && manifest.screenshots.length; | ||
</div> | ||
<button type="button" title="close" class="close" @click='${hideDialog}'> | ||
${!disableClose? html`<button type="button" title="close" class="close" @click='${hideDialog}'> | ||
<svg viewBox="0 0 24 24"><path d="M5.3 18.7c.2.2.4.3.7.3s.5-.1.7-.3l5.3-5.3 5.3 5.3a1.08 1.08 0 0 0 .7.3 1.08 1.08 0 0 0 .7-.3c.4-.4.4-1 0-1.4L13.4 12l5.3-5.3c.4-.4.4-1 0-1.4s-1-.4-1.4 0L12 10.6 6.7 5.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4l5.3 5.3-5.3 5.3c-.4.4-.4 1 0 1.4z"/></svg> | ||
</button> | ||
</button>` : ''} | ||
<div class="about"> | ||
@@ -22,0 +22,0 @@ <div class="name"> |
@@ -24,2 +24,3 @@ import { LitElement, html } from 'lit'; | ||
@property() hideDialog = () => {}; | ||
@property() disableClose = false; | ||
@@ -64,7 +65,8 @@ private _callInstall = () => { | ||
if (getYCoord(e) >= window.innerHeight - 25){ | ||
if (!this.disableClose && getYCoord(e) >= window.innerHeight - 25) { | ||
closeDragElement(e, window.innerHeight + 50, true); | ||
return | ||
} | ||
if (window.innerHeight - getYCoord(e) > element.clientHeight / 2.5){ | ||
if (window.innerHeight - getYCoord(e) > element.clientHeight / 2.5) { | ||
closeDragElement(e, window.innerHeight - element.clientHeight); | ||
@@ -86,2 +88,6 @@ | ||
if (this.disableClose && window.innerHeight - currentY < 70) { | ||
return | ||
} | ||
if (currentY <= (window.innerHeight - element.clientHeight + dragOffset)) { | ||
@@ -88,0 +94,0 @@ return |
@@ -0,0 +0,0 @@ import { html } from 'lit'; |
@@ -0,0 +0,0 @@ export default class TouchDragListener { |
@@ -6,3 +6,3 @@ import { html } from 'lit'; | ||
const template = (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, install: any, toggleGallery: any, galleryRequested: boolean) => { | ||
const template = (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, disableClose: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, install: any, toggleGallery: any, galleryRequested: boolean) => { | ||
const installDialogClasses = () => { return {available: installAvailable, gallery: galleryRequested }}; | ||
@@ -21,5 +21,5 @@ const screenshotsAvailable = !disableScreenshots && manifest.screenshots && manifest.screenshots.length; | ||
<label>${name}</label> | ||
<button class="material-button secondary close" @click='${hideDialog}'> | ||
${!disableClose? html`<button class="material-button secondary close" @click='${hideDialog}'> | ||
<svg viewBox="0 0 24 24"><path d="M5.3 18.7c.2.2.4.3.7.3s.5-.1.7-.3l5.3-5.3 5.3 5.3a1.08 1.08 0 0 0 .7.3 1.08 1.08 0 0 0 .7-.3c.4-.4.4-1 0-1.4L13.4 12l5.3-5.3c.4-.4.4-1 0-1.4s-1-.4-1.4 0L12 10.6 6.7 5.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4l5.3 5.3-5.3 5.3c-.4.4-.4 1 0 1.4z"/></svg> | ||
</button> | ||
</button>` : ''} | ||
</div> | ||
@@ -42,3 +42,3 @@ <div class="hostname">${location.hostname}</div> | ||
<div class="dialog-body"> | ||
<pwa-bottom-sheet .props=${{name, icon, description}} .install=${install} .hideDialog=${hideDialog}> | ||
<pwa-bottom-sheet .props=${{name, icon, description}} .disableClose=${disableClose} .install=${install} .hideDialog=${hideDialog}> | ||
</pwa-bottom-sheet> | ||
@@ -45,0 +45,0 @@ ${screenshotsAvailable? html`<pwa-gallery .screenshots=${manifest.screenshots}></pwa-gallery>`: ''} |
@@ -0,0 +0,0 @@ import { ImageResource } from 'web-app-manifest'; |
@@ -0,0 +0,0 @@ import { IRelatedApp } from './types/types'; |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ import express from 'express'; |
@@ -0,0 +0,0 @@ var cacheName = 'PWAinstallDemo-' + BUILD_TIMESTAMP; |
@@ -0,0 +0,0 @@ import path, { resolve } from 'path'; |
@@ -0,0 +0,0 @@ import common from './webpack.common.js'; |
@@ -0,0 +0,0 @@ import common from "./webpack.common.js"; |
@@ -0,0 +0,0 @@ import prod from './webpack.prod.js'; |
@@ -0,0 +0,0 @@ import prod from './webpack.prod.js'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1474846
117
3902
197