hy-pattern-lib
Advanced tools
Comparing version 1.14.4 to 1.15.0
@@ -1,1 +0,1 @@ | ||
{"android-chrome-192x192.png":"/dist/images/android-chrome-192x192-3bc725c510d5c2126fd4da315429ff88.png","android-chrome-512x512.png":"/dist/images/android-chrome-512x512-c935b258093602e1f4b8868e89183ee0.png","apple-touch-icon.png":"/dist/images/apple-touch-icon-6f6d1f38f430341d786d0723bdbbfbb4.png","favicon-16x16.png":"/dist/images/favicon-16x16-494ac48e30f8461737bd9dcc35f07661.png","favicon-32x32.png":"/dist/images/favicon-32x32-c51c80a71f151b959d09310d29b350ab.png","favicon.ico":"/dist/images/favicon-4c3bf619a150afdb61f2299426020107.ico","happy-yoga.svg":"/dist/images/happy-yoga-8a212ef3eec3f83a7b774188f7289e3c.svg","hy-components.js":"/dist/hy-components-2714fd070c643ce89003065bae59e9a6.js","hy-pattern-lib.css":"/dist/hy-pattern-lib-72772f8f0c1a5f3bced196f06f01d80f.css","mstile-150x150.png":"/dist/images/mstile-150x150-8a48a2ace4c60a682e91f9550087c715.png","sad-puppy-5xx.jpg":"/dist/images/sad-puppy-5xx-f2969e7eb69609c5b1f67944b5e86b9d.jpg","safari-pinned-tab.svg":"/dist/images/safari-pinned-tab-1cf9ee989e1a131779da8da982fdc529.svg","wondering-puppy-4xx.jpg":"/dist/images/wondering-puppy-4xx-47159657b681fc63e9f2ae617969b2f8.jpg"} | ||
{"android-chrome-192x192.png":"/dist/images/android-chrome-192x192-3bc725c510d5c2126fd4da315429ff88.png","android-chrome-512x512.png":"/dist/images/android-chrome-512x512-c935b258093602e1f4b8868e89183ee0.png","apple-touch-icon.png":"/dist/images/apple-touch-icon-6f6d1f38f430341d786d0723bdbbfbb4.png","favicon-16x16.png":"/dist/images/favicon-16x16-494ac48e30f8461737bd9dcc35f07661.png","favicon-32x32.png":"/dist/images/favicon-32x32-c51c80a71f151b959d09310d29b350ab.png","favicon.ico":"/dist/images/favicon-4c3bf619a150afdb61f2299426020107.ico","happy-yoga.svg":"/dist/images/happy-yoga-8a212ef3eec3f83a7b774188f7289e3c.svg","hy-components.js":"/dist/hy-components-c858e46264165c641a4b14295d29d711.js","hy-pattern-lib.css":"/dist/hy-pattern-lib-a4c8ee92f90c2a395d1ee017f67c9e0d.css","mstile-150x150.png":"/dist/images/mstile-150x150-8a48a2ace4c60a682e91f9550087c715.png","sad-puppy-5xx.jpg":"/dist/images/sad-puppy-5xx-f2969e7eb69609c5b1f67944b5e86b9d.jpg","safari-pinned-tab.svg":"/dist/images/safari-pinned-tab-1cf9ee989e1a131779da8da982fdc529.svg","wondering-puppy-4xx.jpg":"/dist/images/wondering-puppy-4xx-47159657b681fc63e9f2ae617969b2f8.jpg"} |
@@ -9,2 +9,3 @@ /* global HTMLElement, customElements */ | ||
#close | ||
#download | ||
#previous | ||
@@ -59,2 +60,3 @@ #currentImage | ||
onclose() { | ||
this.#download?.remove() | ||
this.#dialog?.close() | ||
@@ -93,2 +95,6 @@ this.#dialog?.removeEventListener('click', this.#outsideClickHandler) | ||
await this.#download?.remove() | ||
this.#download = await downloadLinkElement(imageLink) | ||
this.#dialog.appendChild(this.#download) | ||
if (this.#dialog){ | ||
@@ -155,1 +161,21 @@ this.#imageContainer.innerHTML = '' | ||
} | ||
async function downloadLinkElement(imageLink) { | ||
const res = await fetch(imageLink.href) | ||
let url | ||
if (!res.ok) {url = imageLink.href } // fallback to original url | ||
const file = await res.blob() | ||
url = URL.createObjectURL(file) | ||
const element = document.createElement('a') | ||
element.setAttribute('aria-label', 'download') | ||
element.setAttribute('target', '_blank') | ||
element.setAttribute('rel', 'noopener') | ||
element.href = url | ||
element.setAttribute('download', imgFileName(imageLink)) | ||
element.classList.add('download-image') | ||
return element | ||
} | ||
function imgFileName({ href, title }) { | ||
return href.split('/').pop() | ||
} |
{ | ||
"name": "hy-pattern-lib", | ||
"version": "1.14.4", | ||
"version": "1.15.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1455114
1624
3