@htmlbricks/hb-downloader 0.19.33 → 0.19.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/release/manifest.json +1 -1
- package/release/release.js +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@htmlbricks/hb-downloader",
|
|
3
3
|
"displayName": "Svelte-Bootstrap Downloader WebComponent",
|
|
4
4
|
"description": "Svelte-Bootstrap Downloader WebComponent",
|
|
5
|
-
"version": "0.19.
|
|
5
|
+
"version": "0.19.34",
|
|
6
6
|
"main": "release/release.js",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"wc-js-utils": "^0.0.1"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@htmlbricks/hb-dialog": "^0.19.
|
|
73
|
+
"@htmlbricks/hb-dialog": "^0.19.34"
|
|
74
74
|
},
|
|
75
75
|
"keywords": [
|
|
76
76
|
"svelte",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"webcomponents"
|
|
79
79
|
],
|
|
80
80
|
"contributors": [],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "28c90fc782ed835d594189464e1675edb08a93f2"
|
|
82
82
|
}
|
package/release/manifest.json
CHANGED
package/release/release.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var release=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function a(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function s(e,t){e.appendChild(t)}function i(e,t,n){e.insertBefore(t,n||null)}function l(e){e.parentNode&&e.parentNode.removeChild(e)}function c(e){return document.createElement(e)}function u(e){return document.createTextNode(e)}function d(){return u(" ")}function p(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function f(e,t,n){t in e?e[t]="boolean"==typeof e[t]&&""===n||n:p(e,t,n)}function m(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function h(e,t,n,o){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,o?"important":"")}function g(e){const t={};for(const n of e)t[n.name]=n.value;return t}let v;function b(e){v=e}function y(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const e=y();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const a=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,o,t),r}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,a)})),!a.defaultPrevented}return!0}}const $=[],x=[],E=[],k=[],C=Promise.resolve();let _=!1;function T(e){E.push(e)}const L=new Set;let j=0;function D(){if(0!==j)return;const e=v;do{try{for(;j<$.length;){const e=$[j];j++,b(e),M(e.$$)}}catch(e){throw $.length=0,j=0,e}for(b(null),$.length=0,j=0;x.length;)x.pop()();for(let e=0;e<E.length;e+=1){const t=E[e];L.has(t)||(L.add(t),t())}E.length=0}while($.length);for(;k.length;)k.pop()();_=!1,L.clear(),b(e)}function M(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(T)}}const N=new Set;function O(e,t){-1===e.$$.dirty[0]&&($.push(e),_||(_=!0,C.then(D)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function A(a,s,i,c,u,d,p,f=[-1]){const m=v;b(a);const h=a.$$={fragment:null,ctx:[],props:d,update:e,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(m?m.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:s.target||m.$$.root};p&&p(h.root);let g=!1;if(h.ctx=i?i(a,s.props||{},((e,t,...n)=>{const o=n.length?n[0]:t;return h.ctx&&u(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),g&&O(a,e)),t})):[],h.update(),g=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);h.fragment&&h.fragment.l(e),e.forEach(l)}else h.fragment&&h.fragment.c();s.intro&&((y=a.$$.fragment)&&y.i&&(N.delete(y),y.i(w))),function(e,n,a,s){const{fragment:i,after_update:l}=e.$$;i&&i.m(n,a),s||T((()=>{const n=e.$$.on_mount.map(t).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...n):o(n),e.$$.on_mount=[]})),l.forEach(T)}(a,s.target,s.anchor,s.customElement),D()}var y,w;b(m)}let P;"function"==typeof HTMLElement&&(P=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(r);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const e=o.indexOf(n);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var R={name:"@htmlbricks/hb-downloader",displayName:"Svelte-Bootstrap Downloader WebComponent",description:"Svelte-Bootstrap Downloader WebComponent",version:"0.19.33",main:"release/release.js",publishConfig:{access:"public"},author:"Dario Caruso <dev@dariocaruso.info> (https://dariocaruso.info)",authorUrl:"https://dariocaruso.info",license:"MIT","license-docs":"CC BY 4.0","license-translations":"CC BY 4.0","license-images":"CC BY-NC 4.0",engines:{node:">=16.0.0"},scripts:{start:"sirv dist",dev:"rm -rf ./dist && rollup -c -w",build:"rm -rf ./dist && rollup -c","generate-manifest":"npm run generate-schemes && monorepo-wc-packages-manifester --dir $PWD","generate-component-schema":"ts-json-schema-generator --type 'Component' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent.type.d.json","generate-events-schema":"ts-json-schema-generator --type 'Events' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent_events.type.d.json","generate-schemes":"npm run generate-events-schema && npm run generate-component-schema",copydest:"rm -rf release && mkdir -p release && mkdir -p release && cp dist/* ./release/","build-extra":"tsc --moduleResolution node --module es2020 --esModuleInterop true --outDir dist --sourceMap --skipLibCheck extra/*","build:release":"PRODUCTION=true npm run build && npm run build-extra && npm run generate-manifest && npm run copydest",prepublish:"npm run build:release"},devDependencies:{"@rollup/plugin-alias":"^3.1.2","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.2.1","@tsconfig/svelte":"^1.0.10","@types/node":"^16.7.1","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0",eslint:"^7.25.0","eslint-plugin-jsdoc":"^33.0.0","eslint-plugin-svelte3":"^3.2.0","monorepo-wc-packages-manifester":"^0.0.3","node-sass":"^6.0.1",postcss:"^8.2.13","postcss-load-config":"^3.0.1",prettier:"^2.8.4",rollup:"^2.46.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-css-only":"^3.1.0","rollup-plugin-livereload":"^2.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-ts-paths":"^1.0.5","rollup-plugin-typescript2":"^0.31.1",sass:"^1.32.12","sirv-cli":"^1.0.11",svelte:"^3.46.2","svelte-check":"^1.5.2","svelte-preprocess":"^4.7.2","ts-json-schema-generator":"^0.98.0","ts-node":"^9.1.1",tslib:"^2.2.0",ttypescript:"^1.5.12",typescript:"^4.2.4","typescript-transform-paths":"^2.2.3","wc-js-utils":"^0.0.1"},dependencies:{"@htmlbricks/hb-dialog":"^0.19.33"},keywords:["svelte","svelte-webcomponents","webcomponents"],contributors:[],gitHead:"c5a1ec9591addcb4d2555e407b777db1eaee4bbe"};var S,H=(function(e,t){t.__esModule=!0,t.LanguageTranslator=t.addComponent=t.getChildStyleToPass=void 0,t.getChildStyleToPass=function(e,t){var n,o,r="";if(e&&(null==t?void 0:t.length)&&(null===(n=Object.keys(e))||void 0===n?void 0:n.length)&&(null===(o=null==t?void 0:t.filter((function(t){return Object.keys(e).includes(t.name)})))||void 0===o?void 0:o.length))for(var a=function(n){(null==t?void 0:t.filter((function(t){return t.name===n&&t.defaultValue!==e[n]})))&&(r+="".concat(n,":").concat(e[n],";"))},s=0,i=Object.keys(e);s<i.length;s++)a(i[s]);return r},t.addComponent=function(e){var t,n=(null===(t=null==e?void 0:e.repoName.split("/"))||void 0===t?void 0:t[1])||(null==e?void 0:e.repoName);if(!n)throw new Error("wrong componentPath "+(null==e?void 0:e.repoName));if(!(null==e?void 0:e.version))throw new Error("wrong version "+(null==e?void 0:e.version));var o=(null==e?void 0:e.iifePath)||"release/release.js";if(!document.getElementById(n+"-script"))try{var r=document.createElement("script");r.id=n+"-script",r.src="https://cdn.jsdelivr.net/npm/".concat(e.repoName,"@").concat(e.version,"/").concat(o),(null==e?void 0:e.local)&&location.href.includes("localhost")&&(r.src="".concat(e.local)),document.head.appendChild(r)}catch(e){console.warn(e)}};var n=function(){function e(e){if(!(null==e?void 0:e.dictionary))throw new Error("no dictionary provided");this.dictionary=e.dictionary,this.setLang(null==e?void 0:e.lang)}return e.prototype.setLang=function(t){t||(t=e.getDefaultLang()),this.lang=t},e.prototype.translateWord=function(t,n){return e.getDictionaryWord(t,this.dictionary,n||this.lang)},e.prototype.translateDate=function(t,n,o){return e.formatDate(t,n,o||this.lang)},e.getDefaultLang=function(){var e,t,n,o,r,a="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(t=null===(e=navigator.languages[0])||void 0===e?void 0:e.split("-")[0])||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.length)&&(a=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),a},e.getDictionaryWord=function(t,n,o){var r;if(!t)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[t]))return n[o][t];var a="",s=e.getDefaultLang();if(!o||s!==o){var i=null==n?void 0:n[s];(null==i?void 0:i[t])&&(a=i[t])}return a},e.formatDate=function(t,n,o){if(!t)throw new Error("no date provided");if("function"!=typeof t.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||e.getDefaultLang(),n).format(t)},e}();t.LanguageTranslator=n}(S={exports:{}},S.exports),S.exports),V=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,B=/\n/g,I=/^\s*/,W=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,z=/^:\s*/,U=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,q=/^[;\s]*/,F=/^\s+|\s+$/g,Y="\n",G="/",J="*",K="",X="comment",Q="declaration",Z=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,o=1;function r(e){var t=e.match(B);t&&(n+=t.length);var r=e.lastIndexOf(Y);o=~r?e.length-r:o+e.length}function a(){var e={line:n,column:o};return function(t){return t.position=new s(e),c(),t}}function s(e){this.start=e,this.end={line:n,column:o},this.source=t.source}function i(r){var a=new Error(t.source+":"+n+":"+o+": "+r);if(a.reason=r,a.filename=t.source,a.line=n,a.column=o,a.source=e,!t.silent)throw a}function l(t){var n=t.exec(e);if(n){var o=n[0];return r(o),e=e.slice(o.length),n}}function c(){l(I)}function u(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=a();if(G==e.charAt(0)&&J==e.charAt(1)){for(var n=2;K!=e.charAt(n)&&(J!=e.charAt(n)||G!=e.charAt(n+1));)++n;if(n+=2,K===e.charAt(n-1))return i("End of comment missing");var s=e.slice(2,n-2);return o+=2,r(s),e=e.slice(n),o+=2,t({type:X,comment:s})}}function p(){var e=a(),t=l(W);if(t){if(d(),!l(z))return i("property missing ':'");var n=l(U),o=e({type:Q,property:ee(t[0].replace(V,K)),value:n?ee(n[0].replace(V,K)):K});return l(q),o}}return s.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=p();)!1!==e&&(t.push(e),u(t));return t}()};function ee(e){return e?e.replace(F,K):K}var te=function(e,t){var n,o=null;if(!e||"string"!=typeof e)return o;for(var r,a,s=Z(e),i="function"==typeof t,l=0,c=s.length;l<c;l++)r=(n=s[l]).property,a=n.value,i?t(r,a,n):a&&(o||(o={}),o[r]=a);return o},ne={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"},{name:"--hb-modal-max-width",valueType:"htmlsize",defaultValue:"500px"}],parts:[{name:"modal-dialog",description:"The modal dialog"}]};function oe(e){let t;return{c(){t=u(e[5])},m(e,n){i(e,t,n)},p(e,n){32&n&&m(t,e[5])},d(e){e&&l(t)}}}function re(e){let t,n,o,r,a,d=Math.round(e[4]/e[3]*100)+"";return{c(){t=c("div"),n=c("div"),o=u(d),r=u("%"),p(n,"class","progress-bar"),h(n,"width",Math.round(e[4]/e[3]*100)+"%"),p(n,"role","progressbar"),p(n,"aria-valuenow",a=Math.round(e[4]/e[3]*100)),p(n,"aria-valuemin","0"),p(n,"aria-valuemax","100"),p(t,"class","progress")},m(e,a){i(e,t,a),s(t,n),s(n,o),s(n,r)},p(e,t){24&t&&d!==(d=Math.round(e[4]/e[3]*100)+"")&&m(o,d),24&t&&h(n,"width",Math.round(e[4]/e[3]*100)+"%"),24&t&&a!==(a=Math.round(e[4]/e[3]*100))&&p(n,"aria-valuenow",a)},d(e){e&&l(t)}}}function ae(t){let n;return{c(){n=c("div"),n.innerHTML='<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>',p(n,"class","progress")},m(e,t){i(e,n,t)},p:e,d(e){e&&l(n)}}}function se(t){let n,o,r,a,u,m,h,g,v;function b(e,t){return e[3]||e[5]?e[5]?e[5]?oe:void 0:re:ae}let y=b(t),w=y&&y(t);return{c(){n=c("hb-dialog"),o=c("span"),o.innerHTML='<slot name="title">Downloading</slot>',r=d(),a=c("div"),w&&w.c(),u=d(),m=c("span"),this.c=e,p(o,"slot","title"),p(a,"slot","body-content"),p(m,"slot","modal-footer"),f(n,"style",t[2]),f(n,"id",t[0]),f(n,"show",h=t[1]?"yes":"no")},m(e,l){var c,d,p,f;i(e,n,l),s(n,o),s(n,r),s(n,a),w&&w.m(a,null),s(n,u),s(n,m),g||(c=n,d="modalShow",p=t[12],c.addEventListener(d,p,f),v=()=>c.removeEventListener(d,p,f),g=!0)},p(e,[t]){y===(y=b(e))&&w?w.p(e,t):(w&&w.d(1),w=y&&y(e),w&&(w.c(),w.m(a,null))),4&t&&f(n,"style",e[2]),1&t&&f(n,"id",e[0]),2&t&&h!==(h=e[1]?"yes":"no")&&f(n,"show",h)},i:e,o:e,d(e){e&&l(n),w&&w.d(),g=!1,v()}}}function ie(e,t,n){let o,{style:r}=t,a="";const s=y(),i=w();function l(e,t){i(e,t),s.dispatchEvent&&s.dispatchEvent(new CustomEvent(e,{detail:t}))}H.addComponent({repoName:"@htmlbricks/hb-dialog",version:R.version});let c,u,d,p,{downloadid:f}=t,{uri:m}=t,{headers:h}=t,{targetfilename:g}=t,v=0;function b(e){e.show?(n(0,f=e.id),function(){function e(e){console.error(e),e&&n(5,p=e),u=null,l("downloadError",{downloaded:d,id:f,error:e})}n(4,v=0),u=new XMLHttpRequest;try{if(u.open("GET",m,!0),h)for(const e of Object.keys(h))u.setRequestHeader(e,h[e]);u.responseType="blob",u.onload=function(){if(u.status&&(u.status>299||u.status<200))return e("request error");const t=(window.URL||window.webkitURL).createObjectURL(this.response),o=document.createElement("a");return o.href=t,o.target="_blank",o.download=g,document.body.appendChild(o),o.click(),document.body.removeChild(o),console.log("loadEnd"),n(0,f=""),n(1,m=""),u=null,n(11,d=!0),n(5,p=null),l("downloadComplete",{downloaded:d,id:f||"default"})},u.onerror=t=>e(t),u.onprogress=function(e){n(3,c=(null==e?void 0:e.total)||0),n(4,v=(null==e?void 0:e.loaded)||0)},u.onloadend=function(e){},u.send()}catch(t){return console.error("download err ",t),e(t)}}()):(n(1,m=""),n(0,f=""),n(5,p=null),u&&u.abort(),u=null),l("modalShow",e)}return e.$$set=e=>{"style"in e&&n(9,r=e.style),"downloadid"in e&&n(0,f=e.downloadid),"uri"in e&&n(1,m=e.uri),"headers"in e&&n(7,h=e.headers),"targetfilename"in e&&n(8,g=e.targetfilename)},e.$$.update=()=>{if(3971&e.$$.dirty){r&&(n(10,o=te(r)),n(2,a=H.getChildStyleToPass(o,null==ne?void 0:ne.vars))),f||n(0,f=""),d||n(11,d=!1),m||n(1,m="");try{h&&"string"==typeof h&&n(7,h=JSON.parse(h))}catch(e){}!g&&m&&n(8,g=m.split("/")[m.split("/").length-1].split("?")[0])}},[f,m,a,c,v,p,b,h,g,r,o,d,e=>b(e.detail)]}class le extends P{constructor(e){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:#fff;text-align:center;white-space:nowrap;background-color:var(--bs-primary,#07689f);transition:width 0.6s ease}@media(prefers-reduced-motion: reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media(prefers-reduced-motion: reduce){.progress-bar-animated{animation:none}}:host{font-family:"Roboto", sans-serif}</style>',A(this,{target:this.shadowRoot,props:g(this.attributes),customElement:!0},ie,se,a,{style:9,downloadid:0,uri:1,headers:7,targetfilename:8},null),e&&(e.target&&i(e.target,this,e.anchor),e.props&&(this.$set(e.props),D()))}static get observedAttributes(){return["style","downloadid","uri","headers","targetfilename"]}get style(){return this.$$.ctx[9]}set style(e){this.$$set({style:e}),D()}get downloadid(){return this.$$.ctx[0]}set downloadid(e){this.$$set({downloadid:e}),D()}get uri(){return this.$$.ctx[1]}set uri(e){this.$$set({uri:e}),D()}get headers(){return this.$$.ctx[7]}set headers(e){this.$$set({headers:e}),D()}get targetfilename(){return this.$$.ctx[8]}set targetfilename(e){this.$$set({targetfilename:e}),D()}}return customElements.define("hb-downloader",le),le}();
|
|
1
|
+
var release=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function a(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function s(e,t){e.appendChild(t)}function i(e,t,n){e.insertBefore(t,n||null)}function l(e){e.parentNode&&e.parentNode.removeChild(e)}function u(e){return document.createElement(e)}function c(e){return document.createTextNode(e)}function d(){return c(" ")}function p(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function f(e,t,n){t in e?e[t]="boolean"==typeof e[t]&&""===n||n:p(e,t,n)}function m(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function h(e,t,n,o){null===n?e.style.removeProperty(t):e.style.setProperty(t,n,o?"important":"")}function g(e){const t={};for(const n of e)t[n.name]=n.value;return t}let v;function y(e){v=e}function b(){if(!v)throw new Error("Function called outside component initialization");return v}function w(){const e=b();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const a=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,o,t),r}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,a)})),!a.defaultPrevented}return!0}}const $=[],x=[],E=[],k=[],C=Promise.resolve();let _=!1;function T(e){E.push(e)}const L=new Set;let j=0;function D(){if(0!==j)return;const e=v;do{try{for(;j<$.length;){const e=$[j];j++,y(e),M(e.$$)}}catch(e){throw $.length=0,j=0,e}for(y(null),$.length=0,j=0;x.length;)x.pop()();for(let e=0;e<E.length;e+=1){const t=E[e];L.has(t)||(L.add(t),t())}E.length=0}while($.length);for(;k.length;)k.pop()();_=!1,L.clear(),y(e)}function M(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(T)}}const N=new Set;function O(e,t){-1===e.$$.dirty[0]&&($.push(e),_||(_=!0,C.then(D)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function A(a,s,i,u,c,d,p,f=[-1]){const m=v;y(a);const h=a.$$={fragment:null,ctx:[],props:d,update:e,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(m?m.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:s.target||m.$$.root};p&&p(h.root);let g=!1;if(h.ctx=i?i(a,s.props||{},((e,t,...n)=>{const o=n.length?n[0]:t;return h.ctx&&c(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),g&&O(a,e)),t})):[],h.update(),g=!0,o(h.before_update),h.fragment=!!u&&u(h.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);h.fragment&&h.fragment.l(e),e.forEach(l)}else h.fragment&&h.fragment.c();s.intro&&((b=a.$$.fragment)&&b.i&&(N.delete(b),b.i(w))),function(e,n,a,s){const{fragment:i,after_update:l}=e.$$;i&&i.m(n,a),s||T((()=>{const n=e.$$.on_mount.map(t).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...n):o(n),e.$$.on_mount=[]})),l.forEach(T)}(a,s.target,s.anchor,s.customElement),D()}var b,w;y(m)}let P;"function"==typeof HTMLElement&&(P=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(r);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const e=o.indexOf(n);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var R={name:"@htmlbricks/hb-downloader",displayName:"Svelte-Bootstrap Downloader WebComponent",description:"Svelte-Bootstrap Downloader WebComponent",version:"0.19.34",main:"release/release.js",publishConfig:{access:"public"},author:"Dario Caruso <dev@dariocaruso.info> (https://dariocaruso.info)",authorUrl:"https://dariocaruso.info",license:"MIT","license-docs":"CC BY 4.0","license-translations":"CC BY 4.0","license-images":"CC BY-NC 4.0",engines:{node:">=16.0.0"},scripts:{start:"sirv dist",dev:"rm -rf ./dist && rollup -c -w",build:"rm -rf ./dist && rollup -c","generate-manifest":"npm run generate-schemes && monorepo-wc-packages-manifester --dir $PWD","generate-component-schema":"ts-json-schema-generator --type 'Component' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent.type.d.json","generate-events-schema":"ts-json-schema-generator --type 'Events' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent_events.type.d.json","generate-schemes":"npm run generate-events-schema && npm run generate-component-schema",copydest:"rm -rf release && mkdir -p release && mkdir -p release && cp dist/* ./release/","build-extra":"tsc --moduleResolution node --module es2020 --esModuleInterop true --outDir dist --sourceMap --skipLibCheck extra/*","build:release":"PRODUCTION=true npm run build && npm run build-extra && npm run generate-manifest && npm run copydest",prepublish:"npm run build:release"},devDependencies:{"@rollup/plugin-alias":"^3.1.2","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.2.1","@tsconfig/svelte":"^1.0.10","@types/node":"^16.7.1","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0",eslint:"^7.25.0","eslint-plugin-jsdoc":"^33.0.0","eslint-plugin-svelte3":"^3.2.0","monorepo-wc-packages-manifester":"^0.0.3","node-sass":"^6.0.1",postcss:"^8.2.13","postcss-load-config":"^3.0.1",prettier:"^2.8.4",rollup:"^2.46.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-css-only":"^3.1.0","rollup-plugin-livereload":"^2.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-ts-paths":"^1.0.5","rollup-plugin-typescript2":"^0.31.1",sass:"^1.32.12","sirv-cli":"^1.0.11",svelte:"^3.46.2","svelte-check":"^1.5.2","svelte-preprocess":"^4.7.2","ts-json-schema-generator":"^0.98.0","ts-node":"^9.1.1",tslib:"^2.2.0",ttypescript:"^1.5.12",typescript:"^4.2.4","typescript-transform-paths":"^2.2.3","wc-js-utils":"^0.0.1"},dependencies:{"@htmlbricks/hb-dialog":"^0.19.34"},keywords:["svelte","svelte-webcomponents","webcomponents"],contributors:[],gitHead:"28c90fc782ed835d594189464e1675edb08a93f2"};var S,H=(function(e,t){t.__esModule=!0,t.LanguageTranslator=t.addComponent=t.getChildStyleToPass=void 0,t.getChildStyleToPass=function(e,t){var n,o,r="";if(e&&(null==t?void 0:t.length)&&(null===(n=Object.keys(e))||void 0===n?void 0:n.length)&&(null===(o=null==t?void 0:t.filter((function(t){return Object.keys(e).includes(t.name)})))||void 0===o?void 0:o.length))for(var a=function(n){(null==t?void 0:t.filter((function(t){return t.name===n&&t.defaultValue!==e[n]})))&&(r+="".concat(n,":").concat(e[n],";"))},s=0,i=Object.keys(e);s<i.length;s++)a(i[s]);return r},t.addComponent=function(e){var t,n=(null===(t=null==e?void 0:e.repoName.split("/"))||void 0===t?void 0:t[1])||(null==e?void 0:e.repoName);if(!n)throw new Error("wrong componentPath "+(null==e?void 0:e.repoName));if(!(null==e?void 0:e.version))throw new Error("wrong version "+(null==e?void 0:e.version));var o=(null==e?void 0:e.iifePath)||"release/release.js";if(!document.getElementById(n+"-script"))try{var r=document.createElement("script");r.id=n+"-script",r.src="https://cdn.jsdelivr.net/npm/".concat(e.repoName,"@").concat(e.version,"/").concat(o),(null==e?void 0:e.local)&&location.href.includes("localhost")&&(r.src="".concat(e.local)),document.head.appendChild(r)}catch(e){console.warn(e)}};var n=function(){function e(e){if(!(null==e?void 0:e.dictionary))throw new Error("no dictionary provided");this.dictionary=e.dictionary,this.setLang(null==e?void 0:e.lang)}return e.prototype.setLang=function(t){t||(t=e.getDefaultLang()),this.lang=t},e.prototype.translateWord=function(t,n){return e.getDictionaryWord(t,this.dictionary,n||this.lang)},e.prototype.translateDate=function(t,n,o){return e.formatDate(t,n,o||this.lang)},e.getDefaultLang=function(){var e,t,n,o,r,a="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(t=null===(e=navigator.languages[0])||void 0===e?void 0:e.split("-")[0])||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.length)&&(a=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),a},e.getDictionaryWord=function(t,n,o){var r;if(!t)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[t]))return n[o][t];var a="",s=e.getDefaultLang();if(!o||s!==o){var i=null==n?void 0:n[s];(null==i?void 0:i[t])&&(a=i[t])}return a},e.formatDate=function(t,n,o){if(!t)throw new Error("no date provided");if("function"!=typeof t.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||e.getDefaultLang(),n).format(t)},e}();t.LanguageTranslator=n}(S={exports:{}},S.exports),S.exports),V=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,B=/\n/g,I=/^\s*/,W=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,z=/^:\s*/,U=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,q=/^[;\s]*/,F=/^\s+|\s+$/g,Y="\n",G="/",J="*",K="",X="comment",Q="declaration",Z=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,o=1;function r(e){var t=e.match(B);t&&(n+=t.length);var r=e.lastIndexOf(Y);o=~r?e.length-r:o+e.length}function a(){var e={line:n,column:o};return function(t){return t.position=new s(e),u(),t}}function s(e){this.start=e,this.end={line:n,column:o},this.source=t.source}function i(r){var a=new Error(t.source+":"+n+":"+o+": "+r);if(a.reason=r,a.filename=t.source,a.line=n,a.column=o,a.source=e,!t.silent)throw a}function l(t){var n=t.exec(e);if(n){var o=n[0];return r(o),e=e.slice(o.length),n}}function u(){l(I)}function c(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=a();if(G==e.charAt(0)&&J==e.charAt(1)){for(var n=2;K!=e.charAt(n)&&(J!=e.charAt(n)||G!=e.charAt(n+1));)++n;if(n+=2,K===e.charAt(n-1))return i("End of comment missing");var s=e.slice(2,n-2);return o+=2,r(s),e=e.slice(n),o+=2,t({type:X,comment:s})}}function p(){var e=a(),t=l(W);if(t){if(d(),!l(z))return i("property missing ':'");var n=l(U),o=e({type:Q,property:ee(t[0].replace(V,K)),value:n?ee(n[0].replace(V,K)):K});return l(q),o}}return s.prototype.content=e,u(),function(){var e,t=[];for(c(t);e=p();)!1!==e&&(t.push(e),c(t));return t}()};function ee(e){return e?e.replace(F,K):K}var te=function(e,t){var n,o=null;if(!e||"string"!=typeof e)return o;for(var r,a,s=Z(e),i="function"==typeof t,l=0,u=s.length;l<u;l++)r=(n=s[l]).property,a=n.value,i?t(r,a,n):a&&(o||(o={}),o[r]=a);return o},ne={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"},{name:"--hb-modal-max-width",valueType:"htmlsize",defaultValue:"500px"}],parts:[{name:"modal-dialog",description:"The modal dialog"}]};function oe(e){let t;return{c(){t=c(e[5])},m(e,n){i(e,t,n)},p(e,n){32&n&&m(t,e[5])},d(e){e&&l(t)}}}function re(e){let t,n,o,r,a,d=Math.round(e[4]/e[3]*100)+"";return{c(){t=u("div"),n=u("div"),o=c(d),r=c("%"),p(n,"class","progress-bar"),h(n,"width",Math.round(e[4]/e[3]*100)+"%"),p(n,"role","progressbar"),p(n,"aria-valuenow",a=Math.round(e[4]/e[3]*100)),p(n,"aria-valuemin","0"),p(n,"aria-valuemax","100"),p(t,"class","progress")},m(e,a){i(e,t,a),s(t,n),s(n,o),s(n,r)},p(e,t){24&t&&d!==(d=Math.round(e[4]/e[3]*100)+"")&&m(o,d),24&t&&h(n,"width",Math.round(e[4]/e[3]*100)+"%"),24&t&&a!==(a=Math.round(e[4]/e[3]*100))&&p(n,"aria-valuenow",a)},d(e){e&&l(t)}}}function ae(t){let n;return{c(){n=u("div"),n.innerHTML='<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>',p(n,"class","progress")},m(e,t){i(e,n,t)},p:e,d(e){e&&l(n)}}}function se(t){let n,o,r,a,c,m,h,g,v;function y(e,t){return e[3]||e[5]?e[5]?e[5]?oe:void 0:re:ae}let b=y(t),w=b&&b(t);return{c(){n=u("hb-dialog"),o=u("span"),o.innerHTML='<slot name="title">Downloading</slot>',r=d(),a=u("div"),w&&w.c(),c=d(),m=u("span"),this.c=e,p(o,"slot","title"),p(a,"slot","body-content"),p(m,"slot","modal-footer"),f(n,"style",t[2]),f(n,"id",t[0]),f(n,"show",h=t[1]?"yes":"no")},m(e,l){var u,d,p,f;i(e,n,l),s(n,o),s(n,r),s(n,a),w&&w.m(a,null),s(n,c),s(n,m),g||(u=n,d="modalShow",p=t[12],u.addEventListener(d,p,f),v=()=>u.removeEventListener(d,p,f),g=!0)},p(e,[t]){b===(b=y(e))&&w?w.p(e,t):(w&&w.d(1),w=b&&b(e),w&&(w.c(),w.m(a,null))),4&t&&f(n,"style",e[2]),1&t&&f(n,"id",e[0]),2&t&&h!==(h=e[1]?"yes":"no")&&f(n,"show",h)},i:e,o:e,d(e){e&&l(n),w&&w.d(),g=!1,v()}}}function ie(e,t,n){let o,{style:r}=t,a="";const s=b(),i=w();function l(e,t){i(e,t),s.dispatchEvent&&s.dispatchEvent(new CustomEvent(e,{detail:t}))}H.addComponent({repoName:"@htmlbricks/hb-dialog",version:R.version});let u,c,d,p,{downloadid:f}=t,{uri:m}=t,{headers:h}=t,{targetfilename:g}=t,v=0;function y(e){e.show?(n(0,f=e.id),function(){function e(e){console.error(e),e&&n(5,p=e),c=null,l("downloadError",{downloaded:d,id:f,error:e})}n(4,v=0),c=new XMLHttpRequest;try{if(c.open("GET",m,!0),h)for(const e of Object.keys(h))c.setRequestHeader(e,h[e]);c.responseType="blob",c.onload=function(){if(c.status&&(c.status>299||c.status<200))return e("request error");const t=(window.URL||window.webkitURL).createObjectURL(this.response),o=document.createElement("a");return o.href=t,o.target="_blank",o.download=g,document.body.appendChild(o),o.click(),document.body.removeChild(o),console.log("loadEnd"),n(0,f=""),n(1,m=""),c=null,n(11,d=!0),n(5,p=null),l("downloadComplete",{downloaded:d,id:f||"default"})},c.onerror=t=>e(t),c.onprogress=function(e){n(3,u=(null==e?void 0:e.total)||0),n(4,v=(null==e?void 0:e.loaded)||0)},c.onloadend=function(e){},c.send()}catch(t){return console.error("download err ",t),e(t)}}()):(n(1,m=""),n(0,f=""),n(5,p=null),c&&c.abort(),c=null),l("modalShow",e)}return e.$$set=e=>{"style"in e&&n(9,r=e.style),"downloadid"in e&&n(0,f=e.downloadid),"uri"in e&&n(1,m=e.uri),"headers"in e&&n(7,h=e.headers),"targetfilename"in e&&n(8,g=e.targetfilename)},e.$$.update=()=>{if(3971&e.$$.dirty){r&&(n(10,o=te(r)),n(2,a=H.getChildStyleToPass(o,null==ne?void 0:ne.vars))),f||n(0,f=""),d||n(11,d=!1),m||n(1,m="");try{h&&"string"==typeof h&&n(7,h=JSON.parse(h))}catch(e){}!g&&m&&n(8,g=m.split("/")[m.split("/").length-1].split("?")[0])}},[f,m,a,u,v,p,y,h,g,r,o,d,e=>y(e.detail)]}class le extends P{constructor(e){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{display:flex;height:1rem;overflow:hidden;font-size:0.75rem;background-color:#e9ecef;border-radius:0.25rem}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:#fff;text-align:center;white-space:nowrap;background-color:var(--bs-primary,#07689f);transition:width 0.6s ease}@media(prefers-reduced-motion: reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-size:1rem 1rem}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media(prefers-reduced-motion: reduce){.progress-bar-animated{animation:none}}:host{font-family:"Roboto", sans-serif}</style>',A(this,{target:this.shadowRoot,props:g(this.attributes),customElement:!0},ie,se,a,{style:9,downloadid:0,uri:1,headers:7,targetfilename:8},null),e&&(e.target&&i(e.target,this,e.anchor),e.props&&(this.$set(e.props),D()))}static get observedAttributes(){return["style","downloadid","uri","headers","targetfilename"]}get style(){return this.$$.ctx[9]}set style(e){this.$$set({style:e}),D()}get downloadid(){return this.$$.ctx[0]}set downloadid(e){this.$$set({downloadid:e}),D()}get uri(){return this.$$.ctx[1]}set uri(e){this.$$set({uri:e}),D()}get headers(){return this.$$.ctx[7]}set headers(e){this.$$set({headers:e}),D()}get targetfilename(){return this.$$.ctx[8]}set targetfilename(e){this.$$set({targetfilename:e}),D()}}return customElements.define("hb-downloader",le),le}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|