diff --git a/babel.config.json b/babel.config.json index 3b7f619..2d1ba9c 100644 --- a/babel.config.json +++ b/babel.config.json @@ -3,7 +3,8 @@ [ "@babel/preset-env", { - "targets": { + "targets": + { "node": "6.10", "esmodules": true } @@ -21,7 +22,9 @@ ] ], "plugins": [ + "@babel/plugin-syntax-top-level-await", "@babel/plugin-proposal-object-rest-spread", - "@babel/plugin-syntax-jsx" + "@babel/plugin-syntax-jsx", + "@babel/plugin-proposal-class-properties" ] } diff --git a/dist/css/app.css b/dist/css/app.css deleted file mode 100644 index ab7c8ac..0000000 --- a/dist/css/app.css +++ /dev/null @@ -1 +0,0 @@ -.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.meta-MetaWindow{position:fixed}.meta-MetaWindow .meta-error,.meta-MetaWindow .meta-spinner,.meta-MetaWindow .meta-spinner_embed{display:none;align-items:center;justify-content:center;z-index:2;text-align:center}.meta-MetaWindow .meta-spinner,.meta-MetaWindow .meta-spinner_embed{font-size:2rem;color:#fff;font-weight:700;text-transform:uppercase;position:absolute;left:0;right:0;top:0;bottom:0}.meta-MetaWindow .meta-spinner_embed{display:flex}.meta-MetaWindow-overlay{background:rgba(0,0,0,.8);display:none;position:fixed;left:0;right:0;top:0;bottom:0;align-items:center;justify-content:center;z-index:98}.meta-MetaWindow-overlay__loading .meta-spinner,.meta-MetaWindow-overlay__open{display:flex}.meta-MetaWindow-overlay__error .meta-content{justify-content:center}.meta-MetaWindow-overlay__error .meta-error{display:flex}.meta-MetaWindow .meta-nav{font-size:2rem;color:#fff;text-shadow:#000 0 0 .25em;border:0;background:none;z-index:2}.meta-MetaWindow .meta-nav:focus,.meta-MetaWindow .meta-nav:hover{color:#fff}.meta-MetaWindow .meta-nav:hover{color:#eceff1;background:none;text-shadow:none;text-decoration:none}.meta-MetaWindow .meta-nav-arrow{position:absolute;bottom:0;top:auto;display:flex;justify-content:center;align-items:center;font-size:2.5rem;padding:.25rem .5rem;z-index:2}.meta-MetaWindow .meta-nav-arrow:focus .fa,.meta-MetaWindow .meta-nav-arrow:focus .fab,.meta-MetaWindow .meta-nav-arrow:focus .far,.meta-MetaWindow .meta-nav-arrow:focus .fas,.meta-MetaWindow .meta-nav-arrow:hover .fa,.meta-MetaWindow .meta-nav-arrow:hover .fab,.meta-MetaWindow .meta-nav-arrow:hover .far,.meta-MetaWindow .meta-nav-arrow:hover .fas{transform:scale(1.5)}@media (min-width:992px){.meta-MetaWindow .meta-nav-arrow{top:0;bottom:0}}.meta-MetaWindow .meta-nav-arrow__next{right:0}.meta-MetaWindow .meta-nav-arrow__prev{left:0}@media (min-width:992px){.meta-MetaWindow .meta-nav-arrow__next{right:-3rem}.meta-MetaWindow .meta-nav-arrow__prev{left:-3rem}}.meta-MetaWindow .meta-close{position:absolute;top:-3rem;right:0;width:1.25em}.meta-MetaWindow .meta-close:hover .fa,.meta-MetaWindow .meta-close:hover .fab,.meta-MetaWindow .meta-close:hover .far,.meta-MetaWindow .meta-close:hover .fas{transform:rotate(-180deg)}@media (min-width:992px){.meta-MetaWindow .meta-close{top:-3rem;right:-3rem}}.meta-MetaWindow .meta-content{position:relative;width:100%;height:80%;display:flex;flex-direction:column;z-index:1}@media (min-width:992px){.meta-MetaWindow .meta-content{width:90%;height:90%;width:calc(90% - 3rem);height:calc(90% - 3rem)}}.meta-MetaWindow .meta-wrap{max-height:100%;max-width:100%;width:100%;overflow:auto;word-break:break-word;margin:0 auto}.meta-MetaWindow .meta-wrap img{object-fit:cover;max-width:100%;max-height:100%}.meta-MetaWindow__text .meta-content{background:#fff;color:#000;padding:1rem 0 1rem 1rem}.meta-MetaWindow__text .meta-wrap{padding-right:1rem}.meta-MetaWindow__image .meta-wrap,.meta-MetaWindow__image .typography,.meta-MetaWindow__video .meta-wrap,.meta-MetaWindow__video .typography{overflow:hidden;display:flex;justify-content:center;align-items:center;flex-direction:column;max-height:100%;max-width:100%;min-height:100%}.meta-MetaWindow__image .meta-wrap img,.meta-MetaWindow__image .typography img,.meta-MetaWindow__video .meta-wrap img,.meta-MetaWindow__video .typography img{margin:0}.meta-MetaWindow__embed:before,.meta-MetaWindow__video:before{content:"";display:block;position:relative;width:100%;padding-top:56.25%}.meta-MetaWindow__embed a[rel="nofollow noreferrer noopener"],.meta-MetaWindow__video a[rel="nofollow noreferrer noopener"]{color:#fff;font-size:1.2rem;font-weight:700}.meta-MetaWindow__embed a[rel="nofollow noreferrer noopener"]:before,.meta-MetaWindow__video a[rel="nofollow noreferrer noopener"]:before{content:"Unable to load. Please follow the provided link: ";display:block}.meta-MetaWindow__embed iframe,.meta-MetaWindow__video iframe{position:absolute;top:0;left:0;width:100%;height:100%} \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index 1e3a154..216aec5 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,3 +1,3 @@ Meta-lightbox Demo

Meta-lightbox Demo

NODE_ENV: production

Loading data

Load an Image
Load JSON


Load Partial AJAX HTML
Not Found test

Embeds

Embed Youtube link
Embed Vimeo link
Embed SoundCloud link
Embed Instagram

Other

Use [data-toggle="lightbox"] attribute to attach lightbox action and [href] to specify URL.

Use [data-gallery="YOUR_GALLERY_NAME"] to group ligthboxes with next/prev arrows

Use [data-toggle="lightbox"] + [data-href] attribute to toggle lightbox on regular elements. Click me!

\ No newline at end of file + padding: 2rem; + }

Meta-lightbox Demo

NODE_ENV: production

Loading data

Load an Image
Load JSON


Load Partial AJAX HTML
Not Found test

Embeds

Embed Youtube link
Embed Vimeo link
Embed SoundCloud link
Embed Instagram

Other

Use [data-toggle="lightbox"] attribute to attach lightbox action and [href] to specify URL.

Use [data-gallery="YOUR_GALLERY_NAME"] to group ligthboxes with next/prev arrows

Use [data-toggle="lightbox"] + [data-href] attribute to toggle lightbox on regular elements. Click me!

\ No newline at end of file diff --git a/dist/js/app.js b/dist/js/app.js index c545c2e..38ed0dc 100644 --- a/dist/js/app.js +++ b/dist/js/app.js @@ -1 +1 @@ -!function(){var e={131:function(e,t,n){e.exports=n(190)},309:function(e,t,n){"use strict";var r=n(193),i=n(567),d=n(971),h=n(450),y=n(876),g=n(105),b=n(364),v=n(817);e.exports=function xhrAdapter(e){return new Promise((function dispatchXhrRequest(t,n){var _=e.data,w=e.headers;r.isFormData(_)&&delete w["Content-Type"];var C=new XMLHttpRequest;if(e.auth){var S=e.auth.username||"",E=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";w.Authorization="Basic "+btoa(S+":"+E)}var x=y(e.baseURL,e.url);if(C.open(e.method.toUpperCase(),h(x,e.params,e.paramsSerializer),!0),C.timeout=e.timeout,C.onreadystatechange=function handleLoad(){if(C&&4===C.readyState&&(0!==C.status||C.responseURL&&0===C.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in C?g(C.getAllResponseHeaders()):null,d={data:e.responseType&&"text"!==e.responseType?C.response:C.responseText,status:C.status,statusText:C.statusText,headers:r,config:e,request:C};i(t,n,d),C=null}},C.onabort=function handleAbort(){C&&(n(v("Request aborted",e,"ECONNABORTED",C)),C=null)},C.onerror=function handleError(){n(v("Network Error",e,null,C)),C=null},C.ontimeout=function handleTimeout(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(v(t,e,"ECONNABORTED",C)),C=null},r.isStandardBrowserEnv()){var k=(e.withCredentials||b(x))&&e.xsrfCookieName?d.read(e.xsrfCookieName):void 0;k&&(w[e.xsrfHeaderName]=k)}if("setRequestHeader"in C&&r.forEach(w,(function setRequestHeader(e,t){"undefined"===typeof _&&"content-type"===t.toLowerCase()?delete w[t]:C.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(C.withCredentials=!!e.withCredentials),e.responseType)try{C.responseType=e.responseType}catch(K){if("json"!==e.responseType)throw K}"function"===typeof e.onDownloadProgress&&C.addEventListener("progress",e.onDownloadProgress),"function"===typeof e.onUploadProgress&&C.upload&&C.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function onCanceled(e){C&&(C.abort(),n(e),C=null)})),_||(_=null),C.send(_)}))}},190:function(e,t,n){"use strict";var r=n(193),i=n(34),d=n(985),h=n(398);function createInstance(e){var t=new d(e),n=i(d.prototype.request,t);return r.extend(n,d.prototype,t),r.extend(n,t),n}var y=createInstance(n(849));y.Axios=d,y.create=function create(e){return createInstance(h(y.defaults,e))},y.Cancel=n(24),y.CancelToken=n(90),y.isCancel=n(780),y.all=function all(e){return Promise.all(e)},y.spread=n(506),y.isAxiosError=n(69),e.exports=y,e.exports.default=y},24:function(e){"use strict";function Cancel(e){this.message=e}Cancel.prototype.toString=function toString(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,e.exports=Cancel},90:function(e,t,n){"use strict";var r=n(24);function CancelToken(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function promiseExecutor(e){t=e}));var n=this;e((function cancel(e){n.reason||(n.reason=new r(e),t(n.reason))}))}CancelToken.prototype.throwIfRequested=function throwIfRequested(){if(this.reason)throw this.reason},CancelToken.source=function source(){var e;return{token:new CancelToken((function executor(t){e=t})),cancel:e}},e.exports=CancelToken},780:function(e){"use strict";e.exports=function isCancel(e){return!(!e||!e.__CANCEL__)}},985:function(e,t,n){"use strict";var r=n(193),i=n(450),d=n(370),h=n(235),y=n(398);function Axios(e){this.defaults=e,this.interceptors={request:new d,response:new d}}Axios.prototype.request=function request(e){"string"===typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=y(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[h,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function unshiftRequestInterceptors(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function pushResponseInterceptors(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Axios.prototype.getUri=function getUri(e){return e=y(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function forEachMethodNoData(e){Axios.prototype[e]=function(t,n){return this.request(y(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function forEachMethodWithData(e){Axios.prototype[e]=function(t,n,r){return this.request(y(r||{},{method:e,url:t,data:n}))}})),e.exports=Axios},370:function(e,t,n){"use strict";var r=n(193);function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function use(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},InterceptorManager.prototype.eject=function eject(e){this.handlers[e]&&(this.handlers[e]=null)},InterceptorManager.prototype.forEach=function forEach(e){r.forEach(this.handlers,(function forEachHandler(t){null!==t&&e(t)}))},e.exports=InterceptorManager},876:function(e,t,n){"use strict";var r=n(482),i=n(229);e.exports=function buildFullPath(e,t){return e&&!r(t)?i(e,t):t}},817:function(e,t,n){"use strict";var r=n(28);e.exports=function createError(e,t,n,i,d){var h=new Error(e);return r(h,t,n,i,d)}},235:function(e,t,n){"use strict";var r=n(193),i=n(788),d=n(780),h=n(849);function throwIfCancellationRequested(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function dispatchRequest(e){return throwIfCancellationRequested(e),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function cleanHeaderConfig(t){delete e.headers[t]})),(e.adapter||h.adapter)(e).then((function onAdapterResolution(t){return throwIfCancellationRequested(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function onAdapterRejection(t){return d(t)||(throwIfCancellationRequested(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},28:function(e){"use strict";e.exports=function enhanceError(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},398:function(e,t,n){"use strict";var r=n(193);e.exports=function mergeConfig(e,t){t=t||{};var n={},i=["url","method","data"],d=["headers","auth","proxy","params"],h=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],y=["validateStatus"];function getMergedValue(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function mergeDeepProperties(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=getMergedValue(void 0,e[i])):n[i]=getMergedValue(e[i],t[i])}r.forEach(i,(function valueFromConfig2(e){r.isUndefined(t[e])||(n[e]=getMergedValue(void 0,t[e]))})),r.forEach(d,mergeDeepProperties),r.forEach(h,(function defaultToConfig2(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=getMergedValue(void 0,e[i])):n[i]=getMergedValue(void 0,t[i])})),r.forEach(y,(function merge(r){r in t?n[r]=getMergedValue(e[r],t[r]):r in e&&(n[r]=getMergedValue(void 0,e[r]))}));var g=i.concat(d).concat(h).concat(y),b=Object.keys(e).concat(Object.keys(t)).filter((function filterAxiosKeys(e){return-1===g.indexOf(e)}));return r.forEach(b,mergeDeepProperties),n}},567:function(e,t,n){"use strict";var r=n(817);e.exports=function settle(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},788:function(e,t,n){"use strict";var r=n(193);e.exports=function transformData(e,t,n){return r.forEach(n,(function transform(n){e=n(e,t)})),e}},849:function(e,t,n){"use strict";var r=n(193),i=n(655),d={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var h={adapter:function getDefaultAdapter(){var e;return("undefined"!==typeof XMLHttpRequest||"undefined"!==typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=n(309)),e}(),transformRequest:[function transformRequest(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(setContentTypeIfUnset(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(setContentTypeIfUnset(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function transformResponse(e){if("string"===typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function validateStatus(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function forEachMethodNoData(e){h.headers[e]={}})),r.forEach(["post","put","patch"],(function forEachMethodWithData(e){h.headers[e]=r.merge(d)})),e.exports=h},34:function(e){"use strict";e.exports=function bind(e,t){return function wrap(){for(var n=new Array(arguments.length),r=0;r=0)return;h[t]="set-cookie"===t?(h[t]?h[t]:[]).concat([n]):h[t]?h[t]+", "+n:n}})),h):h}},506:function(e){"use strict";e.exports=function spread(e){return function wrap(t){return e.apply(null,t)}}},193:function(e,t,n){"use strict";function _typeof(e){return(_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=n(34),i=Object.prototype.toString;function isArray(e){return"[object Array]"===i.call(e)}function isUndefined(e){return"undefined"===typeof e}function isObject(e){return null!==e&&"object"===_typeof(e)}function isPlainObject(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isFunction(e){return"[object Function]"===i.call(e)}function forEach(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==_typeof(e)&&(e=[e]),isArray(e))for(var n=0,r=e.length;n=0&&b>0){if(e===t)return[g,b];for(r=[],d=n.length;v>=0&&!y;)v==g?(r.push(v),g=n.indexOf(e,v+1)):1==r.length?y=[r.pop(),b]:((i=r.pop())=0?g:b;r.length&&(y=[d,h])}return y}e.exports=balanced,balanced.range=range},464:function(e,t,n){var r=n(359);e.exports=function expandTop(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return expand(function escapeBraces(e){return e.split("\\\\").join(i).split("\\{").join(d).split("\\}").join(h).split("\\,").join(y).split("\\.").join(g)}(e),!0).map(unescapeBraces)};var i="\0SLASH"+Math.random()+"\0",d="\0OPEN"+Math.random()+"\0",h="\0CLOSE"+Math.random()+"\0",y="\0COMMA"+Math.random()+"\0",g="\0PERIOD"+Math.random()+"\0";function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function unescapeBraces(e){return e.split(i).join("\\").split(d).join("{").split(h).join("}").split(y).join(",").split(g).join(".")}function parseCommaParts(e){if(!e)return[""];var t=[],n=r("{","}",e);if(!n)return e.split(",");var i=n.pre,d=n.body,h=n.post,y=i.split(",");y[y.length-1]+="{"+d+"}";var g=parseCommaParts(h);return h.length&&(y[y.length-1]+=g.shift(),y.push.apply(y,g)),t.push.apply(t,y),t}function embrace(e){return"{"+e+"}"}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function expand(e,t){var n=[],i=r("{","}",e);if(!i)return[e];var d=i.pre,y=i.post.length?expand(i.post,!1):[""];if(/\$$/.test(i.pre))for(var g=0;g=0;if(!S&&!E)return i.post.match(/,.*\}/)?expand(e=i.pre+"{"+i.body+h+i.post):[e];if(S)v=i.body.split(/\.\./);else if(1===(v=parseCommaParts(i.body)).length&&1===(v=expand(v[0],!1).map(embrace)).length)return y.map((function(e){return i.pre+v[0]+e}));if(S){var x=numeric(v[0]),k=numeric(v[1]),K=Math.max(v[0].length,v[1].length),M=3==v.length?Math.abs(numeric(v[2])):1,R=lte;k0){var P=new Array(j+1).join("0");T=A<0?"-"+P+T.slice(1):P+T}}_.push(T)}}else{_=[];for(var L=0;Le.length)&&(t=e.length);for(var n=0,r=new Array(t);n-1&&i.splice(y,1)}if(0!==i.length)return!1}return!0}},{key:"_checkSubCombo",value:function _checkSubCombo(e,t,n){e=e.slice(0),n=n.slice(t);for(var r=t,i=0;i-1&&(e.splice(i,1),i-=1,y>r&&(r=y),0===e.length))return r}return-1}}]),KeyCombo}();e.comboDeliminator=">",e.keyDeliminator="+",e.parseComboStr=function(t){for(var n=e._splitStr(t,e.comboDeliminator),r=[],i=0;i0&&n[h]===r&&"\\"!==n[h-1]&&(d.push(i.trim()),i="",h+=1),i+=n[h];return i&&d.push(i.trim()),d};var t=function(){function Locale(e){_classCallCheck(this,Locale),this.localeName=e,this.activeTargetKeys=[],this.pressedKeys=[],this._appliedMacros=[],this._keyMap={},this._killKeyCodes=[],this._macros=[]}return _createClass(Locale,[{key:"bindKeyCode",value:function bindKeyCode(e,t){"string"===typeof t&&(t=[t]),this._keyMap[e]=t}},{key:"bindMacro",value:function bindMacro(t,n){"string"===typeof n&&(n=[n]);var r=null;"function"===typeof n&&(r=n,n=null);var i={keyCombo:new e(t),keyNames:n,handler:r};this._macros.push(i)}},{key:"getKeyCodes",value:function getKeyCodes(e){var t=[];for(var n in this._keyMap)this._keyMap[n].indexOf(e)>-1&&t.push(0|n);return t}},{key:"getKeyNames",value:function getKeyNames(e){return this._keyMap[e]||[]}},{key:"setKillKey",value:function setKillKey(e){if("string"!==typeof e)this._killKeyCodes.push(e);else for(var t=this.getKeyCodes(e),n=0;n-1&&this.pressedKeys.splice(d,1)}this.activeTargetKeys.length=0,this._clearMacros()}}},{key:"_applyMacros",value:function _applyMacros(){for(var e=this._macros.slice(0),t=0;t-1&&this.pressedKeys.splice(r,1)}t.handler&&(t.keyNames=null),this._appliedMacros.splice(e,1),e-=1}}}}]),Locale}(),r=function(){function Keyboard(e,t,n,r){_classCallCheck(this,Keyboard),this._locale=null,this._currentContext="",this._contexts={},this._listeners=[],this._appliedListeners=[],this._locales={},this._targetElement=null,this._targetWindow=null,this._targetPlatform="",this._targetUserAgent="",this._isModernBrowser=!1,this._targetKeyDownBinding=null,this._targetKeyUpBinding=null,this._targetResetBinding=null,this._paused=!1,this._contexts.global={listeners:this._listeners,targetWindow:e,targetElement:t,targetPlatform:n,targetUserAgent:r},this.setContext("global")}return _createClass(Keyboard,[{key:"setLocale",value:function setLocale(e,n){var r=null;return"string"===typeof e?n?n(r=new t(e),this._targetPlatform,this._targetUserAgent):r=this._locales[e]||null:e=(r=e)._localeName,this._locale=r,this._locales[e]=r,r&&(this._locale.pressedKeys=r.pressedKeys),this}},{key:"getLocale",value:function getLocale(e){return e||(e=this._locale.localeName),this._locales[e]||null}},{key:"bind",value:function bind(t,n,r,i){if(null!==t&&"function"!==typeof t||(i=r,r=n,n=t,t=null),t&&"object"===_typeof(t)&&"number"===typeof t.length){for(var d=0;d"]),e.bindMacro("shift + /",["questionmark","?"]),t.match("Mac")?e.bindMacro("command",["mod","modifier"]):e.bindMacro("ctrl",["mod","modifier"]);for(var r=65;r<=90;r+=1){var i=String.fromCharCode(r+32),d=String.fromCharCode(r);e.bindKeyCode(r,i),e.bindMacro("shift + "+i,d),e.bindMacro("capslock + "+i,d)}var h,y,g=n.match("Firefox")?59:186,b=n.match("Firefox")?173:189,v=n.match("Firefox")?61:187;t.match("Mac")&&(n.match("Safari")||n.match("Chrome"))?(h=91,y=93):t.match("Mac")&&n.match("Opera")?(h=17,y=17):t.match("Mac")&&n.match("Firefox")&&(h=224,y=224),e.bindKeyCode(g,["semicolon",";"]),e.bindKeyCode(b,["dash","-"]),e.bindKeyCode(v,["equal","equalsign","="]),e.bindKeyCode(h,["command","windows","win","super","leftcommand","leftwindows","leftwin","leftsuper"]),e.bindKeyCode(y,["command","windows","win","super","rightcommand","rightwindows","rightwin","rightsuper"]),e.setKillKey("command")})),i.Keyboard=r,i.Locale=t,i.KeyCombo=e,i},"object"===_typeof2(t)?e.exports=d():void 0===(i="function"===typeof(r=d)?r.call(t,n,t,e):r)||(e.exports=i)},962:function(e,t,n){e.exports=minimatch,minimatch.Minimatch=Minimatch;var r={sep:"/"};try{r=n(61)}catch(w){}var i=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={},d=n(464),h={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},y="[^/]",g="[^/]*?",b=function charSet(e){return e.split("").reduce((function(e,t){return e[t]=!0,e}),{})}("().*{}+?[]^$\\!");var v=/\/+/;function ext(e,t){e=e||{},t=t||{};var n={};return Object.keys(t).forEach((function(e){n[e]=t[e]})),Object.keys(e).forEach((function(t){n[t]=e[t]})),n}function minimatch(e,t,n){if("string"!==typeof t)throw new TypeError("glob pattern string required");return n||(n={}),!(!n.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Minimatch(t,n).match(e))}function Minimatch(e,t){if(!(this instanceof Minimatch))return new Minimatch(e,t);if("string"!==typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==r.sep&&(e=e.split(r.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function braceExpand(e,t){if(t||(t=this instanceof Minimatch?this.options:{}),"undefined"===typeof(e="undefined"===typeof e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:d(e)}minimatch.filter=function filter(e,t){return t=t||{},function(n,r,i){return minimatch(n,e,t)}},minimatch.defaults=function(e){if(!e||!Object.keys(e).length)return minimatch;var t=minimatch,n=function minimatch(n,r,i){return t.minimatch(n,r,ext(e,i))};return n.Minimatch=function Minimatch(n,r){return new t.Minimatch(n,ext(e,r))},n},Minimatch.defaults=function(e){return e&&Object.keys(e).length?minimatch.defaults(e).Minimatch:Minimatch},Minimatch.prototype.debug=function(){},Minimatch.prototype.make=function make(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,n),n=this.globParts=n.map((function(e){return e.split(v)})),this.debug(this.pattern,n),n=n.map((function(e,t,n){return e.map(this.parse,this)}),this),this.debug(this.pattern,n),n=n.filter((function(e){return-1===e.indexOf(!1)})),this.debug(this.pattern,n),this.set=n},Minimatch.prototype.parseNegate=function parseNegate(){var e=this.pattern,t=!1,n=this.options,r=0;if(n.nonegate)return;for(var i=0,d=e.length;i65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return i;if(""===e)return"";var r,d="",v=!!n.nocase,C=!1,S=[],E=[],x=!1,k=-1,K=-1,M="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",R=this;function clearStateChar(){if(r){switch(r){case"*":d+=g,v=!0;break;case"?":d+=y,v=!0;break;default:d+="\\"+r}R.debug("clearStateChar %j %j",r,d),r=!1}}for(var O,A=0,T=e.length;A-1;B--){var q=E[B],D=d.slice(0,q.reStart),H=d.slice(q.reStart,q.reEnd-8),z=d.slice(q.reEnd-8,q.reEnd),F=d.slice(q.reEnd);z+=F;var W=D.split("(").length-1,V=F;for(A=0;A=0&&!(i=e[d]);d--);for(d=0;d>> no match, partial?",e,w,t,C),w!==y))}if("string"===typeof v?(b=r.nocase?_.toLowerCase()===v.toLowerCase():_===v,this.debug("string match",v,_,b)):(b=_.match(v),this.debug("pattern match",v,_,b)),!b)return!1}if(d===y&&h===g)return!0;if(d===y)return n;if(h===g)return d===y-1&&""===e[d];throw new Error("wtf?")}},761:function(e,t,n){"use strict";var r=n(617);function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction,e.exports=function(){function shim(e,t,n,i,d,h){if(h!==r){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}function getShim(){return shim}shim.isRequired=shim;var e={array:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return e.PropTypes=e,e}},977:function(e,t,n){e.exports=n(761)()},617:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},329:function(e,t,n){var r,i,d;i=[t,n(9)],void 0===(d="function"===typeof(r=function(e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=_interopRequireDefault(t);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}e.default=n.default})?r.apply(t,i):r)||(e.exports=d)},9:function(e,t,n){var r,i,d;function _typeof(e){return(_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}i=[t,n(804),n(977)],void 0===(d="function"===typeof(r=function(e,t,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=setHasSupportToCaptureOption;var r=_interopRequireDefault(t),i=_interopRequireDefault(n);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var d=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var h=function(){function defineProperties(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{capture:!0};return y?e:e.capture}function getPosition(e){if("touches"in e){var t=e.touches[0];return{x:t.pageX,y:t.pageY}}return{x:e.screenX,y:e.screenY}}var g=function(e){function ReactSwipe(){var e;_classCallCheck(this,ReactSwipe);for(var t=arguments.length,n=Array(t),r=0;rt&&this.props.onSwipeRight(1,e),this.movePosition.deltaY<-t?this.props.onSwipeUp(1,e):this.movePosition.deltaY>t&&this.props.onSwipeDown(1,e)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function _setSwiperRef(e){this.swiper=e,this.props.innerRef(e)}},{key:"render",value:function render(){var e=this.props,t=(e.tagName,e.className),n=e.style,i=e.children,h=(e.allowMouseEvents,e.onSwipeUp,e.onSwipeDown,e.onSwipeLeft,e.onSwipeRight,e.onSwipeStart,e.onSwipeMove,e.onSwipeEnd,e.innerRef,e.tolerance,_objectWithoutProperties(e,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]));return r.default.createElement(this.props.tagName,d({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:t,style:n},h),i)}}]),ReactSwipe}(t.Component);g.displayName="ReactSwipe",g.propTypes={tagName:i.default.string,className:i.default.string,style:i.default.object,children:i.default.node,allowMouseEvents:i.default.bool,onSwipeUp:i.default.func,onSwipeDown:i.default.func,onSwipeLeft:i.default.func,onSwipeRight:i.default.func,onSwipeStart:i.default.func,onSwipeMove:i.default.func,onSwipeEnd:i.default.func,innerRef:i.default.func,tolerance:i.default.number.isRequired},g.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function onSwipeUp(){},onSwipeDown:function onSwipeDown(){},onSwipeLeft:function onSwipeLeft(){},onSwipeRight:function onSwipeRight(){},onSwipeStart:function onSwipeStart(){},onSwipeMove:function onSwipeMove(){},onSwipeEnd:function onSwipeEnd(){},innerRef:function innerRef(){},tolerance:0},e.default=g})?r.apply(t,i):r)||(e.exports=d)},123:function(e,t,n){var r,i,d,h;function _typeof(e){return(_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}h=function(e,t,n,r){"use strict";function o(e){return e&&"object"==_typeof(e)&&"default"in e?e:{default:e}}var i=o(t),d=o(n),h=o(r),y=function u(){return(y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==d[0]&&2!==d[0])){h=0;continue}if(3===d[0]&&(!i||d[1]>i[0]&&d[1]e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?r--:r=e.state.collections[t].length-1,e.state.collections[t][r].click(),console.log("".concat(e.name,": prev")),w.dispatchEvent(new Event("{ui.name}.prev"))})),_defineProperty(_assertThisInitialized(n),"reset",(function(){_assertThisInitialized(n).setState({content:"",type:[],shown:!1,loading:!1,error:!1,embed:!1})})),_defineProperty(_assertThisInitialized(n),"embed",(function(e){var t=_assertThisInitialized(n);console.log("".concat(t.name,": embed")),t.reset(),t.setState({embed:e,loading:!1,type:["embed","video"]}),t.show()})),_defineProperty(_assertThisInitialized(n),"setCaption",(function(e){var t=_assertThisInitialized(n);console.log("".concat(t.name,": setCaption")),t.state.caption=e})),_defineProperty(_assertThisInitialized(n),"getCaption",(function(){return{__html:_assertThisInitialized(n).state.caption}})),_defineProperty(_assertThisInitialized(n),"load",(function(e){var t=_assertThisInitialized(n),r=t.axios;t.reset(),t.setState({loading:!0}),t.show(),r.get(e,{responseType:"arraybuffer"}).then((function(e){switch(console.log("".concat(t.name,": response content-type: ").concat(e.headers["content-type"])),e.headers["content-type"]){case"image/jpeg":case"image/png":case"image/svg+xml":case"image/bmp":case"image/gif":case"image/tiff":case"image/webp":case"image/jpg":case"image/svg":t.setContent(''),"image");break;case"application/json":case"application/ld+json":case"application/json; charset=UTF-8":var n=JSON.parse(t._abToString(e.data));t.setContent("".concat(n.Content),"text html json");break;case"text/html":case"application/xhtml+xml":case"text/plain":case"text/html; charset=UTF-8":case"application/xhtml+xml; charset=UTF-8":case"text/plain; charset=UTF-8":t.setContent(t._abToString(e.data),"text html pajax");break;default:console.warn("".concat(t.name,": Unknown response content-type!"))}w.dispatchEvent(new Event("{ui.name}.loaded"))})).catch((function(e){console.error(e);var n="";if(e.response)switch(e.response.status){case 404:n="Not Found.";break;case 500:n="Server issue, please try again latter.";break;default:n="Something went wrong."}else e.request?n="No response received":console.warn("Error",e.message);t.setState({error:n}),w.dispatchEvent(new Event("{ui.name}.error"))})).then((function(){t.setState({loading:!1})}))})),_defineProperty(_assertThisInitialized(n),"_abToString",(function(e){return String.fromCharCode.apply(null,new Uint8Array(e))})),_defineProperty(_assertThisInitialized(n),"_imageEncode",(function(e){new Uint8Array(e);return btoa([].reduce.call(new Uint8Array(e),(function(e,t){return e+String.fromCharCode(t)}),""))})),_defineProperty(_assertThisInitialized(n),"setContent",(function(e,t){var r=_assertThisInitialized(n);console.log("".concat(r.name,": setContent"));var i=t||["html","text"];Array.isArray(i)||(i=t.split(" ")),r.setState({content:e,type:i})})),_defineProperty(_assertThisInitialized(n),"show",(function(){var e=_assertThisInitialized(n);console.log("".concat(e.name,": show")),e.setState({shown:!0}),w.dispatchEvent(new Event("{ui.name}.show"))})),_defineProperty(_assertThisInitialized(n),"hide",(function(){var e=_assertThisInitialized(n);console.log("".concat(e.name,": hide")),b().withContext(name,(function(){b().unbind("left",e.prev),b().unbind("right",e.next)})),b().setContext("index"),e.setState({shown:!1}),w.dispatchEvent(new Event("{ui.name}.hide"))})),_defineProperty(_assertThisInitialized(n),"getHtml",(function(){return{__html:_assertThisInitialized(n).state.content}}));var r=_assertThisInitialized(n);return r.name=r.constructor.name,console.log("".concat(r.name,": init")),r.axios=S,w.dispatchEvent(new Event("{ui.name}.init")),n}return function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}(MetaWindow,[{key:"onSwipeMove",value:function onSwipeMove(e,t){var n=this.ui,r=e.x;n.locked||Math.abs(r)<50||(n.locked=!0,setTimeout((function(){n.locked=!1}),1e3),r>0?(console.log("".concat(n.name,": swipe right")),n.prev()):(console.log("".concat(n.name,": swipe left")),n.next()))}},{key:"render",value:function render(){var e=this,t=e.name,n=null,r=e.state.current;if(b().setContext(t),b().withContext(t,(function(){b().unbind("left",e.prev),b().unbind("right",e.next)})),r){var i=r.getAttribute("data-gallery");i&&e.state.collections[i].length>1&&(n=React.createElement("nav",{className:"meta-navs"},React.createElement("button",{className:"meta-nav meta-nav-arrow meta-nav-arrow__prev a",onClick:e.prev},React.createElement("i",{className:"fa fas fa-chevron-left"}),React.createElement("span",{className:"sr-only"},"Previous")),React.createElement("button",{className:"meta-nav meta-nav-arrow meta-nav-arrow__next a",onClick:e.next},React.createElement("i",{className:"fa fas fa-chevron-right"}),React.createElement("span",{className:"sr-only"},"Next"))),b().withContext(t,(function(){b().bind("left",e.prev),b().bind("right",e.next)})))}var d=e.state.embed?React.createElement("section",{className:"meta-wrap typography"},React.createElement(_(),{url:e.state.embed,providers:[].concat(_toConsumableArray(v.defaultProviders),[C]),LoadingFallbackElement:React.createElement("div",{className:"meta-spinner_embed"},"... Loading ...")})):React.createElement("section",{className:"meta-wrap typography",dangerouslySetInnerHTML:e.getHtml()}),h="meta-".concat(t," meta-").concat(t,"__").concat(e.state.type.join(" meta-".concat(t,"__"))),g="meta-".concat(t,"-overlay").concat(e.state.shown?" meta-".concat(t,"-overlay__open"):"").concat(e.state.loading?" meta-".concat(t,"-overlay__loading"):"").concat(e.state.error?" meta-".concat(t,"-overlay__error"):""),w=e.state.caption?React.createElement("div",{className:"meta-caption",dangerouslySetInnerHTML:e.getCaption()}):"";return React.createElement(y(),{className:h,ui:e,onSwipeMove:e.onSwipeMove},React.createElement("div",{className:g},React.createElement("article",{className:"meta-content"},n,React.createElement("button",{className:"meta-nav meta-close a",onClick:e.hide},React.createElement("i",{className:"fa fas fa-times"}),React.createElement("span",{className:"sr-only"},"Close")),React.createElement("div",{className:"meta-spinner"},"... Loading ..."),React.createElement("div",{className:"meta-error alert alert-danger"},e.state.error),d,w)))}}]),MetaWindow}(n.Component);!function(n){var i=d().render(r().createElement(E,null),document.getElementById("MetaLightboxApp")),h=function initMetaWindowLinks(){var e=i;console.log("MetaWindow: [links] init"),document.querySelectorAll('[data-toggle="lightbox"],[data-gallery="${gallery}"]').forEach((function(t){var n=t.getAttribute("data-gallery");n&&(e.state.collections[n]=[],document.querySelectorAll('[data-toggle="lightbox"][data-gallery="'.concat(n,'"]')).forEach((function(t){e.state.collections[n].push(t)}))),t.addEventListener("click",(function(t){t.preventDefault(),console.log("MetaWindow: [link] click");var n=t.currentTarget,r=n.getAttribute("href")||n.getAttribute("data-href"),i=n.getAttribute("data-embed");e.state.current=n,i?e.embed(r):e.load(r);var d=n.getAttribute("data-title");d&&e.setCaption(d)}))}))};n.addEventListener("".concat(t),h),n.addEventListener("".concat(e),h),n.addEventListener("MetaWindow.initLinks",h)}(window)}()}(); \ No newline at end of file +!function(){var e={163:function(e,t,n){e.exports=n(900)},641:function(e,t,n){"use strict";var r=n(233),o=n(658),a=n(194),i=n(588),s=n(972),c=n(33),u=n(980),f=n(224);e.exports=function xhrAdapter(e){return new Promise((function dispatchXhrRequest(t,n){var l=e.data,d=e.headers;r.isFormData(l)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(h+":"+m)}var g=s(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),i(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function handleLoad(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in p?c(p.getAllResponseHeaders()):null,a={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};o(t,n,a),p=null}},p.onabort=function handleAbort(){p&&(n(f("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function handleError(){n(f("Network Error",e,null,p)),p=null},p.ontimeout=function handleTimeout(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(f(t,e,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var y=(e.withCredentials||u(g))&&e.xsrfCookieName?a.read(e.xsrfCookieName):void 0;y&&(d[e.xsrfHeaderName]=y)}if("setRequestHeader"in p&&r.forEach(d,(function setRequestHeader(e,t){"undefined"===typeof l&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(v){if("json"!==e.responseType)throw v}"function"===typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"===typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function onCanceled(e){p&&(p.abort(),n(e),p=null)})),l||(l=null),p.send(l)}))}},900:function(e,t,n){"use strict";var r=n(233),o=n(813),a=n(947),i=n(545);function createInstance(e){var t=new a(e),n=o(a.prototype.request,t);return r.extend(n,a.prototype,t),r.extend(n,t),n}var s=createInstance(n(840));s.Axios=a,s.create=function create(e){return createInstance(i(s.defaults,e))},s.Cancel=n(215),s.CancelToken=n(269),s.isCancel=n(989),s.all=function all(e){return Promise.all(e)},s.spread=n(115),s.isAxiosError=n(749),e.exports=s,e.exports.default=s},215:function(e){"use strict";function Cancel(e){this.message=e}Cancel.prototype.toString=function toString(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0,e.exports=Cancel},269:function(e,t,n){"use strict";var r=n(215);function CancelToken(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function promiseExecutor(e){t=e}));var n=this;e((function cancel(e){n.reason||(n.reason=new r(e),t(n.reason))}))}CancelToken.prototype.throwIfRequested=function throwIfRequested(){if(this.reason)throw this.reason},CancelToken.source=function source(){var e;return{token:new CancelToken((function executor(t){e=t})),cancel:e}},e.exports=CancelToken},989:function(e){"use strict";e.exports=function isCancel(e){return!(!e||!e.__CANCEL__)}},947:function(e,t,n){"use strict";var r=n(233),o=n(588),a=n(462),i=n(216),s=n(545);function Axios(e){this.defaults=e,this.interceptors={request:new a,response:new a}}Axios.prototype.request=function request(e){"string"===typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[i,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function unshiftRequestInterceptors(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function pushResponseInterceptors(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Axios.prototype.getUri=function getUri(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function forEachMethodNoData(e){Axios.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function forEachMethodWithData(e){Axios.prototype[e]=function(t,n,r){return this.request(s(r||{},{method:e,url:t,data:n}))}})),e.exports=Axios},462:function(e,t,n){"use strict";var r=n(233);function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function use(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},InterceptorManager.prototype.eject=function eject(e){this.handlers[e]&&(this.handlers[e]=null)},InterceptorManager.prototype.forEach=function forEach(e){r.forEach(this.handlers,(function forEachHandler(t){null!==t&&e(t)}))},e.exports=InterceptorManager},972:function(e,t,n){"use strict";var r=n(877),o=n(20);e.exports=function buildFullPath(e,t){return e&&!r(t)?o(e,t):t}},224:function(e,t,n){"use strict";var r=n(872);e.exports=function createError(e,t,n,o,a){var i=new Error(e);return r(i,t,n,o,a)}},216:function(e,t,n){"use strict";var r=n(233),o=n(824),a=n(989),i=n(840);function throwIfCancellationRequested(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function dispatchRequest(e){return throwIfCancellationRequested(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function cleanHeaderConfig(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function onAdapterResolution(t){return throwIfCancellationRequested(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function onAdapterRejection(t){return a(t)||(throwIfCancellationRequested(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},872:function(e){"use strict";e.exports=function enhanceError(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},545:function(e,t,n){"use strict";var r=n(233);e.exports=function mergeConfig(e,t){t=t||{};var n={},o=["url","method","data"],a=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function getMergedValue(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function mergeDeepProperties(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=getMergedValue(void 0,e[o])):n[o]=getMergedValue(e[o],t[o])}r.forEach(o,(function valueFromConfig2(e){r.isUndefined(t[e])||(n[e]=getMergedValue(void 0,t[e]))})),r.forEach(a,mergeDeepProperties),r.forEach(i,(function defaultToConfig2(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=getMergedValue(void 0,e[o])):n[o]=getMergedValue(void 0,t[o])})),r.forEach(s,(function merge(r){r in t?n[r]=getMergedValue(e[r],t[r]):r in e&&(n[r]=getMergedValue(void 0,e[r]))}));var c=o.concat(a).concat(i).concat(s),u=Object.keys(e).concat(Object.keys(t)).filter((function filterAxiosKeys(e){return-1===c.indexOf(e)}));return r.forEach(u,mergeDeepProperties),n}},658:function(e,t,n){"use strict";var r=n(224);e.exports=function settle(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},824:function(e,t,n){"use strict";var r=n(233);e.exports=function transformData(e,t,n){return r.forEach(n,(function transform(n){e=n(e,t)})),e}},840:function(e,t,n){"use strict";var r=n(233),o=n(904),a={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i={adapter:function getDefaultAdapter(){var e;return("undefined"!==typeof XMLHttpRequest||"undefined"!==typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=n(641)),e}(),transformRequest:[function transformRequest(e,t){return o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(setContentTypeIfUnset(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(setContentTypeIfUnset(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function transformResponse(e){if("string"===typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function validateStatus(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function forEachMethodNoData(e){i.headers[e]={}})),r.forEach(["post","put","patch"],(function forEachMethodWithData(e){i.headers[e]=r.merge(a)})),e.exports=i},813:function(e){"use strict";e.exports=function bind(e,t){return function wrap(){for(var n=new Array(arguments.length),r=0;r=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}})),i):i}},115:function(e){"use strict";e.exports=function spread(e){return function wrap(t){return e.apply(null,t)}}},233:function(e,t,n){"use strict";function _typeof(e){return(_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=n(813),o=Object.prototype.toString;function isArray(e){return"[object Array]"===o.call(e)}function isUndefined(e){return"undefined"===typeof e}function isObject(e){return null!==e&&"object"===_typeof(e)}function isPlainObject(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isFunction(e){return"[object Function]"===o.call(e)}function forEach(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==_typeof(e)&&(e=[e]),isArray(e))for(var n=0,r=e.length;n0?o--:o=e.state.collections[r].length-1,e.state.collections[r][o].click(),console.log("".concat(e.name,": prev")),n.dispatchEvent(new Event("{ui.name}.prev"))})),_defineProperty(this,"reset",(function(){t.setState({content:"",type:[],shown:!1,loading:!1,error:!1,embed:!1})})),_defineProperty(this,"load",(function(e){var r=t,o=r.axios;r.reset(),r.setState({loading:!0}),r.show(),o.get(e,{responseType:"arraybuffer"}).then((function(e){console.log("".concat(r.name,": response content-type: ").concat(e.headers["content-type"]));var t=JSON.parse(r._abToString(e.data));switch(e.headers["content-type"]){case"image/jpeg":case"image/png":case"image/svg+xml":case"image/bmp":case"image/gif":case"image/tiff":case"image/webp":case"image/jpg":case"image/svg":r.setContent(''),"image");break;case"application/json":case"application/ld+json":case"application/json; charset=UTF-8":r.setContent("".concat(t.Content),"text html json");break;case"text/html":case"application/xhtml+xml":case"text/plain":case"text/html; charset=UTF-8":case"application/xhtml+xml; charset=UTF-8":case"text/plain; charset=UTF-8":r.setContent(r._abToString(e.data),"text html pajax");break;default:console.warn("".concat(r.name,": Unknown response content-type!"))}n.dispatchEvent(new Event("{ui.name}.loaded"))})).catch((function(e){console.error(e);var t="";if(e.response)switch(e.response.status){case 404:t="Not Found.";break;case 500:t="Server issue, please try again latter.";break;default:t="Something went wrong."}else e.request?t="No response received":console.warn("Error",e.message);r.setState({error:t}),n.dispatchEvent(new Event("{ui.name}.error"))})).then((function(){r.setState({loading:!1})}))})),_defineProperty(this,"_currIndex",(function(){var e=t,n=e.state.current,r=n.getAttribute("data-gallery");return e.state.collections[r].indexOf(n)})),_defineProperty(this,"embed",(function(e){var n=t;console.log("".concat(n.name,": embed")),n.reset(),n.setState({embed:e,loading:!1,type:["embed","video"]}),n.show()})),_defineProperty(this,"setCaption",(function(e){var n=t;console.log("".concat(n.name,": setCaption")),n.state.caption=e})),_defineProperty(this,"getCaption",(function(){return{__html:t.state.caption}})),_defineProperty(this,"_abToString",(function(e){return String.fromCharCode.apply(null,new Uint8Array(e))})),_defineProperty(this,"_imageEncode",(function(e){new Uint8Array(e);return btoa([].reduce.call(new Uint8Array(e),(function(e,t){return e+String.fromCharCode(t)}),""))})),_defineProperty(this,"setContent",(function(e,n){var r=t;console.log("".concat(r.name,": setContent"));var o=n||["html","text"];Array.isArray(o)||(o=n.split(" ")),r.setState({content:e,type:o})})),_defineProperty(this,"getHtml",(function(){return t.state.content}));var o=this;o.name=o.constructor.name,console.log("".concat(o.name,": init")),o.axios=r,n.dispatchEvent(new Event("{ui.name}.init"))}return function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}(MetaWindow,[{key:"init",value:function init(){var e=this;console.log("MetaWindow: [links] init"),e.state.collections={},document.querySelectorAll('[data-toggle="lightbox"],[data-gallery="${gallery}"]').forEach((function(t){var n=t.getAttribute("data-gallery");n&&(e.state.collections[n]=[],document.querySelectorAll('[data-toggle="lightbox"][data-gallery="'.concat(n,'"]')).forEach((function(t){e.state.collections[n].push(t)}))),t.addEventListener("click",(function(t){t.preventDefault(),console.log("MetaWindow: [link] click");var n=t.currentTarget,r=n.getAttribute("href")||n.getAttribute("data-href"),o=n.getAttribute("data-embed");e.state.current=n,o?e.embed(r):e.load(r);var a=n.getAttribute("data-title");a&&e.setCaption(a)}))}))}},{key:"onSwipeMove",value:function onSwipeMove(e,t){var n=this.ui,r=e.x;n.locked||Math.abs(r)<50||(n.locked=!0,setTimeout((function(){n.locked=!1}),1e3),r>0?(console.log("".concat(n.name,": swipe right")),n.prev()):(console.log("".concat(n.name,": swipe left")),n.next()))}},{key:"setState",value:function setState(e){this.state=Object.assign({},this.state,e)}},{key:"render",value:function render(e){var t=this,n=t.name,r=t.state.current,o="";if(r){var a=r.getAttribute("data-gallery");if(a&&t.state.collections[a].length>1){var i=document.createElement("nav");nav.classList.add("meta-navs");var s=document.createElement("button");s.classList.add("meta-nav","meta-nav-arrow","meta-nav-arrow__prev","a"),s.innerHTML=' Previous',i.append(s);var c=document.createElement("button");c.classList.add("meta-nav","meta-nav-arrow","meta-nav-arrow__prev","a"),c.innerHTML=' Next',i.append(c),o=i.innerHTML}}var u="";u=t.state.embed?'
... Loading ...
':'
'.concat(t.getHtml(),"
");var f=t.state.caption?'
'.concat(t.getCaption(),"
"):"",l="meta-".concat(n," meta-").concat(n,"__").concat(t.state.type.join(" meta-".concat(n,"__"))),d="meta-".concat(n,"-overlay").concat(t.state.shown?" meta-".concat(n,"-overlay__open"):"").concat(t.state.loading?" meta-".concat(n,"-overlay__loading"):"").concat(t.state.error?" meta-".concat(n,"-overlay__error"):""),p="".concat('
'.concat(o)+'
... Loading ...
').concat(t.state.error?'
'.concat(t.state.error,"
"):"").concat(u," ").concat(f,"")+"
";return e.innerHTML=p,t}}]),MetaWindow}()),a=document.getElementById("MetaLightboxApp");a||console.log("MetaWindow: missing container"),o.render(a);var i=function init(){o.init()};window.addEventListener("".concat(t),i),window.addEventListener("".concat(e),i),window.addEventListener("MetaWindow.initLinks",i)}()}(); \ No newline at end of file diff --git a/dist/records.json b/dist/records.json index c2c94f7..5771290 100644 --- a/dist/records.json +++ b/dist/records.json @@ -3,23 +3,25 @@ { "chunks": { "byName": { - "HtmlWebpackPlugin_0": 443 + "HtmlWebpackPlugin_0-0": 563 }, "bySource": { - "0 HtmlWebpackPlugin_0": 443 + "0 HtmlWebpackPlugin_0-0": 563 }, "usedIds": [ - 443 + 563 ] }, "modules": { "byIdentifier": { - "./node_modules/.pnpm/html-loader@1.3.2_webpack@5.45.1/node_modules/html-loader/dist/cjs.js!./src/html/meta-lightbox.html": 288, - "./node_modules/.pnpm/html-webpack-plugin@4.5.2_webpack@5.45.1/node_modules/html-webpack-plugin/lib/loader.js!./src/index.html": 987 + "./node_modules/.pnpm/html-loader@2.1.2_webpack@5.48.0/node_modules/html-loader/dist/cjs.js!./src/html/meta-lightbox.html": 688, + "./node_modules/.pnpm/html-webpack-plugin@5.3.2_webpack@5.48.0/node_modules/html-webpack-plugin/lib/loader.js!./src/index.html": 255, + "javascript/esm|data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;": 163 }, "usedIds": [ - 288, - 987 + 163, + 255, + 688 ] } } @@ -37,88 +39,64 @@ }, "modules": { "byIdentifier": { - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/index.js": 131, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/adapters/xhr.js": 309, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/axios.js": 190, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/cancel/Cancel.js": 24, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/cancel/CancelToken.js": 90, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/cancel/isCancel.js": 780, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/Axios.js": 985, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/InterceptorManager.js": 370, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/buildFullPath.js": 876, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/createError.js": 817, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/dispatchRequest.js": 235, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/enhanceError.js": 28, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/mergeConfig.js": 398, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/settle.js": 567, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/core/transformData.js": 788, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/defaults.js": 849, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/bind.js": 34, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/buildURL.js": 450, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/combineURLs.js": 229, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/cookies.js": 971, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/isAbsoluteURL.js": 482, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/isAxiosError.js": 69, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/isURLSameOrigin.js": 364, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/normalizeHeaderName.js": 655, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/parseHeaders.js": 105, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/helpers/spread.js": 506, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1/node_modules/axios/lib/utils.js": 193, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js": 359, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js": 464, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/keyboardjs@2.6.4/node_modules/keyboardjs/dist/keyboard.js": 711, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/minimatch@3.0.4/node_modules/minimatch/minimatch.js": 962, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/prop-types@15.7.2/node_modules/prop-types/factoryWithThrowingShims.js": 761, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/prop-types@15.7.2/node_modules/prop-types/index.js": 977, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/prop-types@15.7.2/node_modules/prop-types/lib/ReactPropTypesSecret.js": 617, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/react-easy-swipe@0.0.21/node_modules/react-easy-swipe/lib/index.js": 329, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/react-easy-swipe@0.0.21/node_modules/react-easy-swipe/lib/react-swipe.js": 9, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/react-tiny-oembed@1.1.0_react-dom@17.0.2+react@17.0.2/node_modules/react-tiny-oembed/lib/index.js": 123, - "./node_modules/.pnpm/babel-loader@8.2.2_83afa9dfc9d2abf24d72ba2d4f88c1d9/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./src/js/_index.js|14056f186fa0be4fe4b8cf54ad4f081b": 658, - "external \"React\"": 804, - "ignored|./node_modules/.pnpm/minimatch@3.0.4/node_modules/minimatch|path": 61 + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/index.js": 163, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/adapters/xhr.js": 641, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/axios.js": 900, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/cancel/Cancel.js": 215, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/cancel/CancelToken.js": 269, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/cancel/isCancel.js": 989, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/Axios.js": 947, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/InterceptorManager.js": 462, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/buildFullPath.js": 972, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/createError.js": 224, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/dispatchRequest.js": 216, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/enhanceError.js": 872, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/mergeConfig.js": 545, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/settle.js": 658, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/core/transformData.js": 824, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/defaults.js": 840, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/bind.js": 813, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/buildURL.js": 588, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/combineURLs.js": 20, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/cookies.js": 194, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/isAbsoluteURL.js": 877, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/isAxiosError.js": 749, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/isURLSameOrigin.js": 980, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/normalizeHeaderName.js": 904, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/parseHeaders.js": 33, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/helpers/spread.js": 115, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./node_modules/.pnpm/axios@0.21.1_debug@4.3.2/node_modules/axios/lib/utils.js": 233, + "./node_modules/.pnpm/babel-loader@8.2.2_8b0464c8bf295490a69e78f11399b5a8/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use!./src/js/app.js|4a63aef513028d871fff28ba08c40b98": 858 }, "usedIds": [ - 9, - 24, - 28, - 34, - 61, - 69, - 90, - 105, - 123, - 131, - 190, - 193, - 229, - 235, - 309, - 329, - 359, - 364, - 370, - 398, - 450, - 464, - 482, - 506, - 567, - 617, - 655, + 20, + 33, + 115, + 163, + 194, + 215, + 216, + 224, + 233, + 269, + 462, + 545, + 588, + 641, 658, - 711, - 761, - 780, - 788, - 804, - 817, - 849, - 876, - 962, - 971, - 977, - 985 + 749, + 813, + 824, + 840, + 858, + 872, + 877, + 900, + 904, + 947, + 972, + 980, + 989 ] } } \ No newline at end of file diff --git a/dist/report.html b/dist/report.html index 477cb6b..42d3718 100644 --- a/dist/report.html +++ b/dist/report.html @@ -3,7 +3,7 @@ - @a2nt/meta-lightbox-react [3 Aug 2021 at 21:56] + @a2nt/ss-bootstrap-ui-webpack-boilerplate-react [4 Aug 2021 at 00:14] diff --git a/package.json b/package.json index 050cfb9..b0fcfb7 100644 --- a/package.json +++ b/package.json @@ -1,184 +1,197 @@ { - "name": "@a2nt/meta-lightbox", - "version": "3.1.6", - "description": "Vanilla JS: Universal Lightbox window", - "author": "Tony Air ", - "license": "BSD-2-Clause", - "repository": { - "type": "git", - "url": "git+https://github.com/a2nt/meta-lightbox.git" - }, - "private": false, - "engines": { - "node": ">= 12", - "yarn": ">= 1.22.0" - }, - "scripts": { - "start": "cross-env NODE_ENV=development webpack-dev-server --https --config webpack.config.serve.js", - "dash": "cross-env NODE_ENV=development webpack-dashboard -- webpack-dev-server --config webpack.config.serve.js", - "build": "cross-env NODE_ENV=production webpack --progress --stats-all", - "lint:check": "eslint ./src --config eslint.config.json && sass-lint ./src --config sass-lint.yml -v -q", - "lint:fix": "eslint ./src --config eslint.config.json --fix && sass-lint ./src --config sass-lint.yml -v -q --fix", - "lint:js": "eslint ./src --config eslint.config.json", - "lint:sass": "sass-lint ./src --config sass-lint.yml -v -q", - "prebuild": "yarn lint:fix && rimraf dist", - "prepare": "yarn lint:fix && yarn build", - "prunecaches": "rimraf ./node_modules/.cache/", - "postinstall": "npm run prunecaches", - "postuninstall": "npm run prunecaches", - "preinstall": "npx only-allow pnpm" - }, - "directories": { - "assets": { - "css": [ - "dist/css/app.css" - ], - "js": [ - "dist/js/app.js" - ] - } - }, - "main": "./dist/js/app.js", - "browser": { - "app": "./dist/js/app.js" - }, - "module": "./src/js/app.js", - "browserslist": [ - "defaults", - "ie>=11" - ], - "dependencies": { - "axios": "^0.21.1", - "balanced-match": "^1.0.2", - "bootstrap": "^4.6.0", - "brace-expansion": "^2.0.1", - "font-awesome": "^4.7.0", - "keyboardjs": "^2.6.4", - "material-design-color": "^2.3.2", - "minimatch": "^3.0.4", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "react-easy-swipe": "^0.0.21", - "react-tiny-oembed": "^1.1.0", - "setimmediate": "^1.0.5" - }, - "devDependencies": { - "@a2nt/image-sprite-webpack-plugin": "^0.2.5", - "@babel/core": "^7.14.6", - "@babel/eslint-parser": "^7.14.7", - "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/plugin-proposal-object-rest-spread": "^7.14.7", - "@babel/plugin-syntax-jsx": "^7.14.5", - "@babel/plugin-transform-react-jsx": "^7.14.5", - "@babel/preset-env": "^7.14.7", - "@babel/preset-react": "^7.14.5", - "@babel/runtime": "^7.14.6", - "@googlemaps/markerclustererplus": "*", - "animate.css": "^4.1.1", - "ansi-html": "^0.0.7", - "ansi-regex": "^5.0.0", - "autoprefixer": "^10.3.1", - "babel-loader": "^8.2.2", - "classnames": "^2.3.1", - "copy-webpack-plugin": "^7.0.0", - "croppie": "^2.6.5", - "cross-env": "^7.0.3", - "css-loader": "^5.2.7", - "eslint": "^7.31.0", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-jquery": "^1.5.1", - "eslint-plugin-react": "^7.24.0", - "events": "^3.3.0", - "exif-js": "^2.3.0", - "exports-loader": "^2.0.0", - "fast-levenshtein": "^3.0.0", - "fastest-levenshtein": "^1.0.12", - "favicons-webpack-plugin": "github:jantimon/favicons-webpack-plugin#benkostr-webpack-5", - "file-loader": "^6.2.0", - "hoist-non-react-statics": "^3.3.2", - "html-dom-parser": "^1.0.1", - "html-entities": "^1.4.0", - "html-loader": "^1.3.2", - "html-react-parser": "^1.2.7", - "html-webpack-plugin": "^4.5.2", - "image-minimizer-webpack-plugin": "^2.2.0", - "imagemin-jpegtran": "^7.0.0", - "img-optimize-loader": "^1.0.7", - "loglevel": "^1.7.1", - "mini-css-extract-plugin": "^1.6.2", - "node-sass": "^5.0.0", - "object-assign": "^4.1.1", - "optimize-css-assets-webpack-plugin": "^5.0.8", - "postcss-loader": "^4.3.0", - "prop-types": "^15.7.2", - "punycode": "^2.1.1", - "querystring": "^0.2.1", - "react-hot-loader": "^4.13.0", - "react-is": "^17.0.2", - "react-lifecycles-compat": "^3.0.4", - "resolve-url-loader": "^3.1.4", - "rimraf": "^3.0.2", - "routie": "0.0.1", - "sass-lint": "^1.13.1", - "sass-lint-fix": "^1.12.1", - "sass-loader": "^10.2.0", - "scheduler": "^0.20.2", - "shallowequal": "^1.1.0", - "strip-ansi": "^6.0.0", - "style-loader": "^2.0.0", - "svg-url-loader": "^7.1.1", - "terser-webpack-plugin": "^5.1.4", - "url": "^0.11.0", - "url-loader": "^4.1.1", - "webpack": "^5.45.1", - "webpack-bundle-analyzer": "^4.4.2", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^4.0.0-beta.3", - "webpack-manifest-plugin": "^3.1.1", - "webpack-merge": "^5.8.0", - "yarn": "^1.22.10" - }, - "stylelint": { - "rules": { - "block-no-empty": null, - "color-no-invalid-hex": true, - "comment-empty-line-before": [ - "always", - { - "ignore": [ - "stylelint-commands", - "after-comment" - ] - } - ], - "declaration-colon-space-after": "always", - "indentation": [ - 4, - { - "except": [ - "value" - ] - } - ], - "max-empty-lines": 2, - "rule-empty-line-before": [ - "always", - { - "except": [ - "first-nested" - ], - "ignore": [ - "after-comment" - ] - } - ], - "unit-whitelist": [ - "em", - "rem", - "%", - "s", - "px" - ] - } - } + "name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate", + "version": "4.0.8", + "description": "This UI Kit allows you to build Bootstrap 5 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.", + "author": "Tony Air ", + "license": "BSD-2-Clause", + "repository": { + "type": "git", + "url": "git+https://github.com/a2nt/webpack-bootstrap-ui-kit.git" + }, + "private": false, + "engines": { + "node": ">= 12", + "yarn": ">= 1.22.0" + }, + "scripts": { + "start": "cross-env NODE_ENV=development webpack-dev-server --config webpack.config.serve.js", + "dash": "cross-env NODE_ENV=development webpack-dashboard -- webpack-dev-server --config webpack.config.serve.js", + "build": "cross-env NODE_ENV=production webpack --progress --stats-all", + "lint:check": "eslint ./src --config eslint.config.json && sass-lint ./src --config sass-lint.yml -v -q", + "lint:fix": "eslint ./src --config eslint.config.json --fix && sass-lint ./src --config sass-lint.yml -v -q --fix", + "lint:js": "eslint ./src --config eslint.config.json", + "lint:sass": "sass-lint ./src --config sass-lint.yml -v -q", + "prebuild": "yarn lint:fix && rimraf dist", + "prepare": "yarn lint:fix && yarn build", + "prunecaches": "rimraf ./node_modules/.cache/", + "postinstall": "npm run prunecaches", + "postuninstall": "npm run prunecaches", + "preinstall": "npx only-allow pnpm", + "update": "npx msw init ./src/_graphql" + }, + "directories": { + "assets": { + "css": [ + "dist/css/app.css" + ], + "js": [ + "dist/js/app.js" + ] + } + }, + "main": "./dist/js/app.js", + "browser": { + "app": "./dist/js/app.js" + }, + "module": "./src/js/app.js", + "browserslist": [ + "defaults", + "ie>=11" + ], + "dependencies": { + "axios": "^0.21.1", + "es6-template": "^1.0.4" + }, + "devDependencies": { + "@a2nt/image-sprite-webpack-plugin": "^0.2.5", + "@babel/core": "^7.14.8", + "@babel/eslint-parser": "^7.14.9", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-object-rest-spread": "^7.14.7", + "@babel/plugin-syntax-jsx": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-react-jsx": "^7.14.9", + "@babel/plugin-transform-runtime": "^7.14.5", + "@babel/preset-env": "^7.14.9", + "@babel/preset-react": "^7.14.5", + "@babel/runtime": "^7.14.8", + "@googlemaps/markerclustererplus": "*", + "@sucrase/webpack-loader": "^2.0.0", + "@ungap/global-this": "^0.4.4", + "@wry/context": "^0.6.0", + "@wry/equality": "^0.5.1", + "@wry/trie": "^0.3.0", + "animate.css": "^4.1.1", + "ansi-html": "^0.0.7", + "ansi-regex": "^6.0.0", + "autoprefixer": "^10.3.1", + "babel-loader": "^8.2.2", + "classnames": "^2.3.1", + "copy-webpack-plugin": "^9.0.1", + "croppie": "^2.6.5", + "cross-env": "^7.0.3", + "css-loader": "^6.2.0", + "css-minimizer-webpack-plugin": "^3.0.2", + "debug": "^4.3.2", + "eslint": "^7.32.0", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jquery": "^1.5.1", + "eslint-plugin-react": "^7.24.0", + "events": "^3.3.0", + "exif-js": "^2.3.0", + "exports-loader": "^3.0.0", + "fast-json-stable-stringify": "^2.1.0", + "fast-levenshtein": "^3.0.0", + "fastest-levenshtein": "^1.0.12", + "favicons": "^6.2.2", + "favicons-webpack-plugin": "5.0.2", + "file-loader": "^6.2.0", + "graphql-tag": "^2.12.5", + "hoist-non-react-statics": "^3.3.2", + "html-dom-parser": "^1.0.1", + "html-entities": "^2.3.2", + "html-loader": "^2.1.2", + "html-react-parser": "^1.2.7", + "html-webpack-plugin": "^5.3.2", + "img-optimize-loader": "^1.0.7", + "loglevel": "^1.7.1", + "mini-css-extract-plugin": "^2.1.0", + "ms": "^2.1.3", + "msw": "^0.33.2", + "node-fetch": "^2.6.1", + "node-sass": "^6.0.1", + "object-assign": "^4.1.1", + "optimism": "^0.16.1", + "postcss-loader": "^6.1.1", + "prop-types": "^15.7.2", + "punycode": "^2.1.1", + "querystring": "^0.2.1", + "raw-loader": "^4.0.2", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-hot-loader": "^4.13.0", + "react-is": "^17.0.2", + "react-lifecycles-compat": "^3.0.4", + "regenerator-runtime": "^0.13.9", + "resolve-url-loader": "^4.0.0", + "rimraf": "^3.0.2", + "routie": "0.0.1", + "sass-lint": "^1.13.1", + "sass-lint-fix": "^1.12.1", + "sass-loader": "^12.1.0", + "scheduler": "^0.20.2", + "shallowequal": "^1.1.0", + "strip-ansi": "^7.0.0", + "style-loader": "^3.2.1", + "sucrase": "^3.20.0", + "svg-url-loader": "^7.1.1", + "symbol-observable": "^4.0.0", + "terser-webpack-plugin": "^5.1.4", + "ts-invariant": "^0.9.0", + "tslib": "^2.3.0", + "url": "^0.11.0", + "url-loader": "^4.1.1", + "webpack": "^5.48.0", + "webpack-bundle-analyzer": "^4.4.2", + "webpack-cli": "^4.7.2", + "webpack-dev-server": "^4.0.0-rc.0", + "webpack-manifest-plugin": "^4.0.2", + "webpack-merge": "^5.8.0", + "yarn": "^1.22.11", + "zen-observable": "^0.8.15", + "zen-observable-ts": "^1.1.0" + }, + "stylelint": { + "rules": { + "block-no-empty": null, + "color-no-invalid-hex": true, + "comment-empty-line-before": [ + "always", + { + "ignore": [ + "stylelint-commands", + "after-comment" + ] + } + ], + "declaration-colon-space-after": "always", + "indentation": [ + 4, + { + "except": [ + "value" + ] + } + ], + "max-empty-lines": 2, + "rule-empty-line-before": [ + "always", + { + "except": [ + "first-nested" + ], + "ignore": [ + "after-comment" + ] + } + ], + "unit-whitelist": [ + "em", + "rem", + "%", + "s", + "px" + ] + } + } } diff --git a/src/html/meta-lightbox.html b/src/html/meta-lightbox.html index 8c382a5..c062e05 100755 --- a/src/html/meta-lightbox.html +++ b/src/html/meta-lightbox.html @@ -1,108 +1,59 @@ -
-
-

Loading data

+
+

Loading data

+

+ Load an Image +
+ + Load JSON + - -
- - Load Partial AJAX HTML
- - - Not Found test - -

- -

Embeds

-

- Embed Youtube link -
- Embed Vimeo link -
- - Embed SoundCloud link
- Embed Instagram -

- -

Other

-

- - Use [data-toggle="lightbox"] attribute to attach lightbox action - and [href] to specify URL. - -

-

- - Use [data-gallery="YOUR_GALLERY_NAME"] to group ligthboxes with - next/prev arrows - -

-

- Use [data-toggle="lightbox"] + [data-href] attribute to toggle - lightbox on regular elements. - Click me! -

-
- -
+ +
+ + Load Partial AJAX HTML
+ + Not Found test + +

+

Embeds

+

+ Embed Youtube link +
+ Embed Vimeo link +
+ Embed SoundCloud link
+ Embed Instagram +

+

Other

+

+ + Use [data-toggle="lightbox"] attribute to attach lightbox action + and [href] to specify URL. + +

+

+ + Use [data-gallery="YOUR_GALLERY_NAME"] to group ligthboxes with + next/prev arrows + +

+

+ Use [data-toggle="lightbox"] + [data-href] attribute to toggle + lightbox on regular elements. + Click me! +

+
+
diff --git a/src/index.html b/src/index.html index 3e8e1a2..eac0ce5 100755 --- a/src/index.html +++ b/src/index.html @@ -1,43 +1,36 @@ - - - - - - Meta-lightbox Demo - - - -
-

Meta-lightbox Demo

- NODE_ENV: <%= NODE_ENV %> <%= - require('html-loader!./html/meta-lightbox.html') %> -
-
- - <%= REACT_SCRIPTS %> + + + + + + Meta-lightbox Demo + + - - + +
+

Meta-lightbox Demo

+ NODE_ENV: + <%= NODE_ENV %> + <%= + require('html-loader!./html/meta-lightbox.html').default %> +
+
+ + <%= REACT_SCRIPTS %> + + + + + + - - - diff --git a/src/js/_window.jsx b/src/js/_window.js similarity index 50% rename from src/js/_window.jsx rename to src/js/_window.js index 385ecde..78427ea 100755 --- a/src/js/_window.jsx +++ b/src/js/_window.js @@ -3,78 +3,11 @@ */ import Events from './_events'; -import { - Component -} from 'react'; -import Swipe from 'react-easy-swipe'; -import KeyboardJS from 'keyboardjs'; - -import Embed, { - defaultProviders -} from 'react-tiny-oembed'; const W = window; - -const InstagramProvider = { - provider_name: 'Instagram', - provider_url: 'https://instagram.com', - endpoints: [{ - schemes: [ - 'http://instagram.com/*/p/*,', - 'http://www.instagram.com/*/p/*,', - 'https://instagram.com/*/p/*,', - 'https://www.instagram.com/*/p/*,', - 'http://instagram.com/p/*', - 'http://instagr.am/p/*', - 'http://www.instagram.com/p/*', - 'http://www.instagr.am/p/*', - 'https://instagram.com/p/*', - 'https://instagr.am/p/*', - 'https://www.instagram.com/p/*', - 'https://www.instagr.am/p/*', - 'http://instagram.com/tv/*', - 'http://instagr.am/tv/*', - 'http://www.instagram.com/tv/*', - 'http://www.instagr.am/tv/*', - 'https://instagram.com/tv/*', - 'https://instagr.am/tv/*', - 'https://www.instagram.com/tv/*', - 'https://www.instagr.am/tv/*', - ], - url: 'https://graph.facebook.com/v9.0/instagram_oembed', - formats: ['json'], - }, - { - schemes: [ - 'http://instagram.com/*/p/*,', - 'http://www.instagram.com/*/p/*,', - 'https://instagram.com/*/p/*,', - 'https://www.instagram.com/*/p/*,', - 'http://instagram.com/p/*', - 'http://instagr.am/p/*', - 'http://www.instagram.com/p/*', - 'http://www.instagr.am/p/*', - 'https://instagram.com/p/*', - 'https://instagr.am/p/*', - 'https://www.instagram.com/p/*', - 'https://www.instagr.am/p/*', - 'http://instagram.com/tv/*', - 'http://instagr.am/tv/*', - 'http://www.instagram.com/tv/*', - 'http://www.instagr.am/tv/*', - 'https://instagram.com/tv/*', - 'https://instagr.am/tv/*', - 'https://www.instagram.com/tv/*', - 'https://www.instagr.am/tv/*', - ], - url: 'https://api.instagram.com/oembed', - formats: ['json'], - }, ], -}; - const axios = require('axios'); -class MetaWindow extends Component { +class MetaWindow { state = { content: '', type: [], @@ -84,11 +17,57 @@ class MetaWindow extends Component { embed: false, collections: [], current: null, + target: null, }; - constructor(props) { - super(props); + init(target) { + const ui = this; + console.log(`MetaWindow: [links] init`); + ui.state.target = target; + // reset collections + ui.state.collections = {}; + + // collect new collections + document.querySelectorAll('[data-toggle="lightbox"],[data-gallery="${gallery}"]').forEach((el) => { + const gallery = el.getAttribute('data-gallery'); + if (gallery) { + ui.state.collections[gallery] = []; + document + .querySelectorAll( + `[data-toggle="lightbox"][data-gallery="${gallery}"]`, + ) + .forEach((el) => { + ui.state.collections[gallery].push(el); + }); + } + + // click handler + el.addEventListener('click', (e) => { + e.preventDefault(); + console.log(`MetaWindow: [link] click`); + + const el = e.currentTarget; + const link = + el.getAttribute('href') || el.getAttribute('data-href'); + const embed = el.getAttribute('data-embed'); + ui.state.current = el; + + if (embed) { + ui.embed(link); + } else { + ui.load(link); + } + + const title = el.getAttribute('data-title'); + if (title) { + ui.setCaption(title); + } + }); + }); + } + + constructor(props) { const ui = this; ui.name = ui.constructor.name; console.log(`${ui.name}: init`); @@ -97,12 +76,24 @@ class MetaWindow extends Component { W.dispatchEvent(new Event(`{ui.name}.init`)); } - _currIndex = () => { + show = () => { const ui = this; - const el = ui.state.current; - const gallery = el.getAttribute('data-gallery'); + console.log(`${ui.name}: show`); - return ui.state.collections[gallery].indexOf(el); + ui.setState({ + shown: true, + }); + W.dispatchEvent(new Event(`{ui.name}.show`)); + }; + + hide = () => { + const ui = this; + + console.log(`${ui.name}: hide`); + ui.setState({ + shown: false, + }); + W.dispatchEvent(new Event(`{ui.name}.hide`)); }; next = () => { @@ -154,40 +145,13 @@ class MetaWindow extends Component { }); }; - embed = (link) => { - const ui = this; - console.log(`${ui.name}: embed`); - - ui.reset(); - ui.setState({ - embed: link, - loading: false, - type: ['embed', 'video'], - }); - ui.show(); - }; - - setCaption = (title) => { - const ui = this; - console.log(`${ui.name}: setCaption`); - - ui.state.caption = title; - }; - - getCaption = () => { - const ui = this; - return { - __html: ui.state.caption - }; - } - load = (link) => { const ui = this; const axios = ui.axios; ui.reset(); ui.setState({ - loading: true + loading: true, }); ui.show(); @@ -200,6 +164,7 @@ class MetaWindow extends Component { console.log( `${ui.name}: response content-type: ${resp.headers['content-type']}`, ); + let json = false; switch (resp.headers['content-type']) { case 'image/jpeg': @@ -212,10 +177,9 @@ class MetaWindow extends Component { // irregular types: case 'image/jpg': case 'image/svg': + //json = JSON.parse(ui._abToString(resp.data)); ui.setContent( - ``, + ``, 'image', ); break; @@ -223,7 +187,6 @@ class MetaWindow extends Component { case 'application/ld+json': // irregular types: case 'application/json; charset=UTF-8': - const json = JSON.parse(ui._abToString(resp.data)); ui.setContent(`${json['Content']}`, 'text html json'); break; @@ -272,28 +235,61 @@ class MetaWindow extends Component { } ui.setState({ - error: msg + error: msg, }); W.dispatchEvent(new Event(`{ui.name}.error`)); }) .then(() => { ui.setState({ - loading: false + loading: false, }); }); }; + _currIndex = () => { + const ui = this; + const el = ui.state.current; + const gallery = el.getAttribute('data-gallery'); + + return ui.state.collections[gallery].indexOf(el); + }; + + embed = (link) => { + const ui = this; + console.log(`${ui.name}: embed`); + + ui.reset(); + ui.setState({ + embed: link, + loading: false, + type: ['embed', 'video'], + }); + ui.show(); + }; + + setCaption = (title) => { + const ui = this; + console.log(`${ui.name}: setCaption`); + + ui.state.caption = title; + }; + + getCaption = () => { + const ui = this; + return ui.state.caption; + } + _abToString = (arrayBuffer) => { return String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)); }; _imageEncode = (arrayBuffer) => { - let u8 = new Uint8Array(arrayBuffer); - let b64encoded = btoa( + const u8 = new Uint8Array(arrayBuffer); + const b64encoded = btoa( [].reduce.call( new Uint8Array(arrayBuffer), - function(p, c) { + (p, c) => { return p + String.fromCharCode(c); }, '', @@ -314,166 +310,117 @@ class MetaWindow extends Component { ui.setState({ content: html, - type: typeArr + type: typeArr, }); }; - show = () => { - const ui = this; - console.log(`${ui.name}: show`); - - ui.setState({ - shown: true - }); - W.dispatchEvent(new Event(`{ui.name}.show`)); - }; - - hide = () => { - const ui = this; - - console.log(`${ui.name}: hide`); - - KeyboardJS.withContext(name, () => { - KeyboardJS.unbind('left', ui.prev); - KeyboardJS.unbind('right', ui.next); - }); - - KeyboardJS.setContext('index'); - - ui.setState({ - shown: false - }); - W.dispatchEvent(new Event(`{ui.name}.hide`)); - }; - getHtml = () => { const ui = this; - return { - __html: ui.state.content - }; + return ui.state.content; }; - - onSwipeMove(position, event) { - const ui = this.ui; - const x = position.x; - - if (ui.locked || Math.abs(x) < 50) { - return; - } - - ui.locked = true; - setTimeout(() => { - ui.locked = false; - }, 1000); - - if (x > 0) { - console.log(`${ui.name}: swipe right`); - ui.prev(); - } else { - console.log(`${ui.name}: swipe left`); - ui.next(); - } + setState(newState) { + const ui = this; + ui.state = Object.assign({}, ui.state, newState); + ui.render(); } - render() { const ui = this; const name = ui.name; - let navs = null; + const navs = null; const el = ui.state.current; - KeyboardJS.setContext(name); - KeyboardJS.withContext(name, () => { - KeyboardJS.unbind('left', ui.prev); - KeyboardJS.unbind('right', ui.next); + + ui.state.target.innerHTML = ''; + const meta = document.createElement('div'); + meta.classList.add(`meta-${name}`, `meta-${name}__${ui.state.type.join(` meta-${name}__`)}`); + ui.state.target.append(meta); + + const metaOverlay = document.createElement('div'); + metaOverlay.classList.add(`meta-${name}-overlay`); + if (ui.state.shown) { + metaOverlay.classList.add(`meta-${name}-overlay__open`); + } + if (ui.state.loading) { + metaOverlay.classList.add(`meta-${name}-overlay__loading`); + } + if (ui.state.error) { + metaOverlay.classList.add(`meta-${name}-overlay__error`); + } + meta.append(metaOverlay); + + const metaContent = document.createElement('div'); + metaContent.classList.add('meta-content'); + metaOverlay.append(metaContent); + + const btnClose = document.createElement('button'); + btnClose.classList.add('meta-nav', 'meta-close', 'a'); + btnClose.innerHTML = + '' + + ' Close'; + btnClose.addEventListener('click', (e) => { + e.preventDefault(); + ui.hide(); }); + metaContent.append(btnClose); if (el) { const gallery = el.getAttribute('data-gallery'); if (gallery && ui.state.collections[gallery].length > 1) { - navs = ( - - ); + const navs = document.createElement('nav'); + navs.classList.add('meta-navs'); - KeyboardJS.withContext(name, () => { - KeyboardJS.bind('left', ui.prev); - KeyboardJS.bind('right', ui.next); + const prevBtn = document.createElement('button'); + prevBtn.classList.add('meta-nav', 'meta-nav-arrow', 'meta-nav-arrow__prev', 'a'); + prevBtn.innerHTML = '' + + ' Previous'; + prevBtn.addEventListener('click', (e) => { + e.preventDefault(); + ui.prev(); }); + navs.append(prevBtn); + + const nextBtn = document.createElement('button'); + nextBtn.classList.add('meta-nav', 'meta-nav-arrow', 'meta-nav-arrow__prev', 'a'); + nextBtn.innerHTML = '' + + ' Next'; + nextBtn.addEventListener('click', (e) => { + e.preventDefault(); + ui.next(); + }); + navs.append(nextBtn); + + metaContent.append(navs); } } - const content = ui.state.embed ? ( -
- - ... Loading ... - - /> -
- ) : ( -
- ); + let content = ''; + if (ui.state.embed) { + content = '
' + + ' ... Loading ... ' + + '
'; + } else { + const content = document.createElement('section'); + content.classList.add('meta-wrap', 'typography'); + content.innerHTML = ui.getHtml(); + metaContent.append(content); + } - const className = `meta-${name} meta-${name}__${ui.state.type.join( - ` meta-${name}__`, - )}`; + if (ui.state.error) { + const error = document.createElement('div'); + error.classList.add('meta-error'); + error.innerHTML = ui.state.error; + metaContent.append(error); + } else if (ui.state.caption) { + const caption = document.createElement('div'); + caption.classList.add('meta-caption'); + caption.innerHTML = ui.getCaption(); + metaContent.append(caption); + } - const overlayClassName = `meta-${name}-overlay${ - ui.state.shown ? ` meta-${name}-overlay__open` : '' - }${ui.state.loading ? ` meta-${name}-overlay__loading` : ''}${ - ui.state.error ? ` meta-${name}-overlay__error` : '' - }`; - - const caption = ui.state.caption ? -
: - ''; - - return ( - -
-
- {navs} - - -
... Loading ...
-
- {ui.state.error} -
- - {content} - - {caption} -
-
-
- ); + return ui; } } diff --git a/src/js/app.js b/src/js/app.js index 453ab59..8bf0e72 100755 --- a/src/js/app.js +++ b/src/js/app.js @@ -5,69 +5,28 @@ */ import Events from './_events'; +import MetaWindow from './_window'; -import React from 'react'; -import ReactDOM from 'react-dom'; -import MetaWindow from './_window.jsx'; +const ui = new MetaWindow(); +const container = document.getElementById('MetaLightboxApp'); +if (!container) { + console.log(`MetaWindow: missing container`); +} -const AppUI = ((W) => { - const MetaLightbox = ReactDOM.render( - , - document.getElementById('MetaLightboxApp'), - ); +const init = () => { + ui.init(container); +}; - const initMetaWindowLinks = () => { - const ui = MetaLightbox; - console.log(`MetaWindow: [links] init`); +window.addEventListener(`${Events.LOADED}`, init); +window.addEventListener(`${Events.AJAX}`, init); +window.addEventListener(`MetaWindow.initLinks`, init); - document.querySelectorAll('[data-toggle="lightbox"],[data-gallery="${gallery}"]').forEach((el) => { - // collections - const gallery = el.getAttribute('data-gallery'); - if (gallery) { - ui.state.collections[gallery] = []; - document - .querySelectorAll( - `[data-toggle="lightbox"][data-gallery="${gallery}"]`, - ) - .forEach((el) => { - ui.state.collections[gallery].push(el); - }); - } +function importAll(r) { + return r.keys().map(r); +} - // click handler - el.addEventListener('click', (e) => { - e.preventDefault(); - console.log(`MetaWindow: [link] click`); +const images = importAll( + require.context('../img/', false, /\.(png|jpe?g|svg)$/), +); - const el = e.currentTarget; - const link = - el.getAttribute('href') || el.getAttribute('data-href'); - const embed = el.getAttribute('data-embed'); - ui.state.current = el; - - if (embed) { - ui.embed(link); - } else { - ui.load(link); - } - - const title = el.getAttribute('data-title'); - if (title) { - ui.setCaption(title); - } - }); - }); - }; - - W.addEventListener(`${Events.LOADED}`, initMetaWindowLinks); - W.addEventListener(`${Events.AJAX}`, initMetaWindowLinks); - W.addEventListener(`MetaWindow.initLinks`, initMetaWindowLinks); - - return MetaLightbox; -})(window); - -export default AppUI; - -// display custom HTML content manually using JS -//M.setContent('ZZZZZZZZZAAAA11BBBB122'); -//M.show(); +export default ui; diff --git a/webpack.config.common.js b/webpack.config.common.js index 0b5f18a..0df6a33 100755 --- a/webpack.config.common.js +++ b/webpack.config.common.js @@ -2,13 +2,42 @@ * Common Environment */ -const webpack = require('webpack'); -const commonVariables = require('./webpack.configuration'); -const conf = commonVariables.configuration; +const YML_PATH = './webpack.yml'; +const CONF_VAR = 'App\\Templates\\WebpackTemplateProvider'; const path = require('path'); -const filesystem = require('fs'); +const fs = require('fs'); +const yaml = require('js-yaml'); +const webpack = require('webpack'); +/* + * Load webpack configuration from webpack.yml + */ + +const yml = yaml.load( + fs.readFileSync(path.join(__dirname, YML_PATH), 'utf8'), +); +const conf = yml[CONF_VAR] + +let themes = []; +// add themes +if (conf.THEMESDIR) { + const themeDir = conf.THEMESDIR; + const dir = path.resolve(__dirname, themeDir); + + if (fs.existsSync(dir)) { + fs.readdirSync(dir).forEach((file) => { + filePath = path.join(themeDir, file); + const stat = fs.statSync(filePath); + + if (stat && stat.isDirectory()) { + themes.push(filePath); + } + }); + } +} + +/* Setup Entries */ const includes = {}; const modules = [ path.resolve(__dirname, conf.APPDIR, conf.SRC), @@ -28,10 +57,10 @@ const _addAppFiles = (theme) => { themeName = 'app'; } - if (filesystem.existsSync(path.join(dirPath, conf.SRC, 'js', '_index.js'))) { - includes[`${themeName}`] = path.join(dirPath, conf.SRC, 'js', '_index.js'); + if (fs.existsSync(path.join(dirPath, conf.SRC, 'js', 'app.js'))) { + includes[`${themeName}`] = path.join(dirPath, conf.SRC, 'js', 'app.js'); } else if ( - filesystem.existsSync(path.join(dirPath, conf.SRC, 'scss', 'app.scss')) + fs.existsSync(path.join(dirPath, conf.SRC, 'scss', 'app.scss')) ) { includes[`${themeName}`] = path.join( dirPath, @@ -50,13 +79,13 @@ const _addAppFiles = (theme) => { const dirPath = path.resolve(__dirname, dir); let results = []; - filesystem.readdirSync(dirPath).forEach((file) => { + fs.readdirSync(dirPath).forEach((file) => { if (file.charAt(0) === '_') { return; } const filePath = path.join(dirPath, file); - const stat = filesystem.statSync(filePath); + const stat = fs.statSync(filePath); if (stat && stat.isDirectory() && includeSubFolders) { results = results.concat( @@ -72,7 +101,7 @@ const _addAppFiles = (theme) => { // add page specific scripts const typesJSPath = path.join(theme, conf.TYPESJS); - if (filesystem.existsSync(typesJSPath)) { + if (fs.existsSync(typesJSPath)) { const pageScripts = _getAllFilesFromFolder(typesJSPath, true); pageScripts.forEach((file) => { includes[`${themeName}_${path.basename(file, '.js')}`] = file; @@ -81,7 +110,7 @@ const _addAppFiles = (theme) => { // add page specific scss const typesSCSSPath = path.join(theme, conf.TYPESSCSS); - if (filesystem.existsSync(typesSCSSPath)) { + if (fs.existsSync(typesSCSSPath)) { const scssIncludes = _getAllFilesFromFolder(typesSCSSPath, true); scssIncludes.forEach((file) => { includes[`${themeName}_${path.basename(file, '.scss')}`] = file; @@ -91,28 +120,44 @@ const _addAppFiles = (theme) => { _addAppFiles(conf.APPDIR); +// remove some backend includes +delete includes['app_editor']; +delete includes['app_cms']; +delete includes['app_order']; + // add themes -commonVariables.themes.forEach((theme) => { +themes.forEach((theme) => { _addAppFiles(theme); }); module.exports = { - entry: includes, - externals: { - jquery: 'jQuery', - react: 'React', - 'react-dom': 'ReactDOM', - }, - resolve: { - modules: modules, - alias: { - 'window.jQuery': require.resolve('jquery'), - $: require.resolve('jquery'), - jquery: require.resolve('jquery'), - jQuery: require.resolve('jquery'), - react: require.resolve('react'), - 'react-dom': require.resolve('react-dom'), + configuration: conf, + themes: themes, + webpack: { + entry: includes, + externals: { + // comment out jQuery if you don't use it to prevent bootstrap thinking that there's jQuery present + //jquery: 'jQuery', + react: 'React', + 'react-dom': 'ReactDOM', }, - fallback: { path: false }, - }, + resolve: { + modules: modules, + alias: { + // comment out jQuery if you don't use it to prevent bootstrap thinking that there's jQuery present + /*'window.jQuery': require.resolve('jquery'), + $: require.resolve('jquery'), + jquery: require.resolve('jquery'), + jQuery: require.resolve('jquery'),*/ + react: require.resolve('react'), + 'react-dom': require.resolve('react-dom'), + }, + fallback: { + path: false + }, + }, + experiments: { + topLevelAwait: true, + }, + } }; diff --git a/webpack.config.js b/webpack.config.js index 1705ccb..f493e00 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,393 +1,397 @@ /* * Production assets generation */ -const webpack = require('webpack'); -const commonVariables = require('./webpack.configuration'); -const conf = commonVariables.configuration; -const { merge } = require('webpack-merge'); const common = require('./webpack.config.common.js'); +const conf = common.configuration; -const filesystem = require('fs'); +const webpack = require('webpack'); +const { + merge +} = require('webpack-merge'); + + +const fs = require('fs'); const path = require('path'); const FaviconsWebpackPlugin = require('favicons-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); -const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const ImageminPlugin = require('image-minimizer-webpack-plugin'); -const ImageSpritePlugin = require('@a2nt/image-sprite-webpack-plugin'); +//const ImageSpritePlugin = require('@a2nt/image-sprite-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const UIInfo = require('./package.json'); const UIVERSION = JSON.stringify(UIInfo.version); +const UIMetaInfo = require('./package.json'); const NODE_ENV = conf.NODE_ENV || process.env.NODE_ENV; const COMPRESS = NODE_ENV === 'production' ? true : false; +const IP = process.env.IP || conf.HOSTNAME; +const PORT = process.env.PORT || conf.PORT; + console.log('NODE_ENV: ' + NODE_ENV); console.log('COMPRESS: ' + COMPRESS); console.log('WebP images: ' + conf['webp']); +console.log('GRAPHQL_API_KEY: ' + conf['GRAPHQL_API_KEY']); let plugins = [ - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - react: 'React', - 'react-dom': 'ReactDOM', - Popper: ['popper.js', 'default'], - Util: 'exports-loader?Util!bootstrap/js/dist/util', - Alert: 'exports-loader?Alert!bootstrap/js/dist/alert', - Button: 'exports-loader?Button!bootstrap/js/dist/button', - Carousel: 'exports-loader?Carousel!bootstrap/js/dist/carousel', - Collapse: 'exports-loader?Collapse!bootstrap/js/dist/collapse', - Dropdown: 'exports-loader?Dropdown!bootstrap/js/dist/dropdown', - Modal: 'exports-loader?Modal!bootstrap/js/dist/modal', - Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip', - Popover: 'exports-loader?Popover!bootstrap/js/dist/popover', - Scrollspy: 'exports-loader?Scrollspy!bootstrap/js/dist/scrollspy', - Tab: 'exports-loader?Tab!bootstrap/js/dist/tab', - }), - new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify(NODE_ENV), - }, - UINAME: JSON.stringify(UIInfo.name), - UIVERSION: UIVERSION, - UIAUTHOR: JSON.stringify(UIInfo.author), - }), - new webpack.LoaderOptionsPlugin({ - minimize: COMPRESS, - debug: !COMPRESS, - }), - new MiniCssExtractPlugin({ - filename: 'css/[name].css', - //allChunks: true, - }), + new webpack.ProvidePlugin({ + react: 'React', + 'react-dom': 'ReactDOM', + /*$: 'jquery', + jQuery: 'jquery', + Popper: ['popper.js', 'default'], + Util: 'exports-loader?Util!bootstrap/js/dist/util', + Alert: 'exports-loader?Alert!bootstrap/js/dist/alert', + Button: 'exports-loader?Button!bootstrap/js/dist/button', + Carousel: 'exports-loader?Carousel!bootstrap/js/dist/carousel', + Collapse: 'exports-loader?Collapse!bootstrap/js/dist/collapse', + Dropdown: 'exports-loader?Dropdown!bootstrap/js/dist/dropdown', + Modal: 'exports-loader?Modal!bootstrap/js/dist/modal', + Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip', + Popover: 'exports-loader?Popover!bootstrap/js/dist/popover', + Scrollspy: 'exports-loader?Scrollspy!bootstrap/js/dist/scrollspy', + Tab: 'exports-loader?Tab!bootstrap/js/dist/tab',*/ + }), + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(NODE_ENV), + }, + UINAME: JSON.stringify(UIInfo.name), + UIVERSION: UIVERSION, + UIAUTHOR: JSON.stringify(UIInfo.author), + UIMetaNAME: JSON.stringify(UIMetaInfo.name), + UIMetaVersion: JSON.stringify(UIMetaInfo.version), + GRAPHQL_API_KEY: JSON.stringify(conf['GRAPHQL_API_KEY']), + SWVERSION: JSON.stringify(`sw-${new Date().getTime()}`), + BASE_HREF: JSON.stringify(''), + }), + new webpack.LoaderOptionsPlugin({ + minimize: COMPRESS, + debug: !COMPRESS, + }), + new MiniCssExtractPlugin({ + filename: 'css/[name].css', + //allChunks: true, + }), ]; if (COMPRESS) { - plugins.push( - new OptimizeCssAssetsPlugin({ - //assetNameRegExp: /\.optimize\.css$/g, - cssProcessor: require('cssnano'), - cssProcessorPluginOptions: { - preset: ['default'], - }, - cssProcessorOptions: { - zindex: true, - cssDeclarationSorter: true, - reduceIdents: false, - mergeIdents: true, - mergeRules: true, - mergeLonghand: true, - discardUnused: true, - discardOverridden: true, - discardDuplicates: true, - discardComments: { - removeAll: true, - }, - }, - canPrint: true, - }), - ); - plugins.push(require('autoprefixer')); - plugins.push( - new ImageminPlugin({ - minimizerOptions: { - // Lossless optimization with custom option - // Feel free to experiment with options for better result for you - plugins: [ - ['gifsicle', { interlaced: true }], - ['jpegtran', { progressive: true }], - ['optipng', { optimizationLevel: 5 }], - [ - 'svgo', - { - plugins: [ - { - removeViewBox: false, - }, - ], - }, - ], - ], - }, - }), - ); + plugins.push(require('autoprefixer')); - plugins.push( - new ImageSpritePlugin({ - exclude: /exclude|original|default-|icons|sprite|svg|logo|favicon/, - commentOrigin: false, - compress: COMPRESS, - extensions: ['png'], - indent: '', - log: true, - //outputPath: path.join(__dirname, conf.APPDIR, conf.DIST), - outputFilename: 'img/sprite-[hash].png', - padding: 0, - }), - ); + /*plugins.push( + new ImageSpritePlugin({ + exclude: /exclude|original|default-|icons|sprite|svg|logo|favicon/, + commentOrigin: false, + compress: COMPRESS, + extensions: ['png'], + indent: '', + log: true, + //outputPath: path.join(__dirname, conf.APPDIR, conf.DIST), + outputFilename: 'img/sprite-[hash].png', + padding: 0, + }), + );*/ } const indexPath = path.join(__dirname, conf.APPDIR, conf.SRC, 'index.html'); -if (filesystem.existsSync(indexPath)) { - plugins.push( - new HtmlWebpackPlugin({ - publicPath: '', - template: path.join(conf.APPDIR, conf.SRC, 'index.html'), - templateParameters: { - NODE_ENV: NODE_ENV, - REACT_SCRIPTS: - NODE_ENV === 'production' - ? '' - : '', - }, - }), - ); +if (fs.existsSync(indexPath)) { + plugins.push( + new HtmlWebpackPlugin({ + publicPath: '', + template: path.join(conf.APPDIR, conf.SRC, 'index.html'), + templateParameters: { + NODE_ENV: NODE_ENV, + GRAPHQL_URL: conf['GRAPHQL_URL'], + STATIC_URL: conf['STATIC_URL'], + REACT_SCRIPTS: NODE_ENV === 'production' ? + '' : '', + }, + xhtml: true, + }), + ); } const faviconPath = path.join(__dirname, conf.APPDIR, conf.SRC, 'favicon.png'); -if (filesystem.existsSync(faviconPath)) { - plugins.push( - new FaviconsWebpackPlugin({ - title: 'Webpack App', - logo: faviconPath, - prefix: '/icons/', - emitStats: false, - persistentCache: true, - inject: false, - statsFilename: path.join( - conf.APPDIR, - conf.DIST, - 'icons', - 'iconstats.json', - ), - icons: { - android: true, - appleIcon: true, - appleStartup: true, - coast: true, - favicons: true, - firefox: true, - opengraph: true, - twitter: true, - yandex: true, - windows: true, - }, - }), - ); +if (fs.existsSync(faviconPath)) { + plugins.push( + new FaviconsWebpackPlugin({ + title: 'Webpack App', + logo: faviconPath, + prefix: '/icons/', + emitStats: false, + persistentCache: true, + inject: false, + statsFilename: path.join( + conf.APPDIR, + conf.DIST, + 'icons', + 'iconstats.json', + ), + icons: { + android: true, + appleIcon: true, + appleStartup: true, + coast: true, + favicons: true, + firefox: true, + opengraph: true, + twitter: true, + yandex: true, + windows: true, + }, + }), + ); } // add themes favicons -commonVariables.themes.forEach((theme) => { - const faviconPath = path.join(__dirname, theme, conf.SRC, 'favicon.png'); - if (filesystem.existsSync(faviconPath)) { - plugins.push( - new FaviconsWebpackPlugin({ - title: 'Webpack App', - logo: faviconPath, - prefix: '/' + theme + '-icons/', - emitStats: false, - persistentCache: true, - inject: false, - statsFilename: path.join( - conf.APPDIR, - conf.DIST, - theme + '-icons', - 'iconstats.json', - ), - icons: { - android: true, - appleIcon: true, - appleStartup: true, - coast: true, - favicons: true, - firefox: true, - opengraph: true, - twitter: true, - yandex: true, - windows: true, - }, - }), - ); - } +common.themes.forEach((theme) => { + const faviconPath = path.join(__dirname, theme, conf.SRC, 'favicon.png'); + if (fs.existsSync(faviconPath)) { + plugins.push( + new FaviconsWebpackPlugin({ + title: 'Webpack App', + logo: faviconPath, + prefix: '/' + theme + '-icons/', + emitStats: false, + persistentCache: true, + inject: false, + statsFilename: path.join( + conf.APPDIR, + conf.DIST, + theme + '-icons', + 'iconstats.json', + ), + icons: { + android: true, + appleIcon: true, + appleStartup: true, + coast: true, + favicons: true, + firefox: true, + opengraph: true, + twitter: true, + yandex: true, + windows: true, + }, + }), + ); + } }); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') - .BundleAnalyzerPlugin; + .BundleAnalyzerPlugin; plugins.push( - new BundleAnalyzerPlugin({ - analyzerMode: 'static', - openAnalyzer: false, - }), + new BundleAnalyzerPlugin({ + analyzerMode: 'static', + openAnalyzer: false, + }), ); -const cfg = merge(common, { - mode: NODE_ENV, - cache: { - type: 'filesystem', - }, - recordsPath: path.join(__dirname, conf.APPDIR, conf.DIST, 'records.json'), - optimization: { - //removeAvailableModules: false, - //realContentHash: false, - splitChunks: { - name: 'vendor', - minChunks: 2, - }, - concatenateModules: true, //ModuleConcatenationPlugin - minimizer: [ - new TerserPlugin({ - terserOptions: { - module: false, - parse: { - // we want terser to parse ecma 8 code. However, we don't want it - // to apply any minfication steps that turns valid ecma 5 code - // into invalid ecma 5 code. This is why the 'compress' and 'output' - // sections only apply transformations that are ecma 5 safe - // https://github.com/facebook/create-react-app/pull/4234 - ecma: 8, - }, - compress: { - ecma: 5, - warnings: false, - // Disabled because of an issue with Uglify breaking seemingly valid code: - // https://github.com/facebook/create-react-app/issues/2376 - // Pending further investigation: - // https://github.com/mishoo/UglifyJS2/issues/2011 - comparisons: false, - }, - keep_fnames: true, - keep_classnames: true, +const cfg = merge(common.webpack, { + mode: NODE_ENV, + cache: { + type: 'filesystem', + }, + recordsPath: path.join(__dirname, conf.APPDIR, conf.DIST, 'records.json'), + optimization: { + //removeAvailableModules: false, + //realContentHash: false, + splitChunks: { + name: 'vendor', + minChunks: 2, + }, + concatenateModules: true, //ModuleConcatenationPlugin + minimizer: [ + new TerserPlugin({ + terserOptions: { + module: false, + parse: { + // we want terser to parse ecma 8 code. However, we don't want it + // to apply any minfication steps that turns valid ecma 5 code + // into invalid ecma 5 code. This is why the 'compress' and 'output' + // sections only apply transformations that are ecma 5 safe + // https://github.com/facebook/create-react-app/pull/4234 + ecma: 8, + }, + compress: { + ecma: 5, + warnings: false, + // Disabled because of an issue with Uglify breaking seemingly valid code: + // https://github.com/facebook/create-react-app/issues/2376 + // Pending further investigation: + // https://github.com/mishoo/UglifyJS2/issues/2011 + comparisons: false, + }, + keep_fnames: true, + keep_classnames: true, - mangle: { - safari10: true, - keep_fnames: true, - keep_classnames: true, - reserved: ['$', 'jQuery', 'jquery'], - }, - output: { - ecma: 5, - comments: false, - // Turned on because emoji and regex is not minified properly using default - // https://github.com/facebook/create-react-app/issues/2488 - ascii_only: true, - }, - }, - // Use multi-process parallel running to improve the build speed - // Default number of concurrent runs: os.cpus().length - 1 - parallel: true, - }), - ], - }, + mangle: { + safari10: true, + keep_fnames: true, + keep_classnames: true, + reserved: ['$', 'jQuery', 'jquery'], + }, + output: { + ecma: 5, + comments: false, + // Turned on because emoji and regex is not minified properly using default + // https://github.com/facebook/create-react-app/issues/2488 + ascii_only: true, + }, + }, + // Use multi-process parallel running to improve the build speed + // Default number of concurrent runs: os.cpus().length - 1 + parallel: true, + }), + new CssMinimizerPlugin({ + parallel: true, + minimizerOptions: [{ + preset: [ + 'default', + { + discardComments: { + removeAll: true + }, + zindex: true, + cssDeclarationSorter: true, + reduceIdents: false, + mergeIdents: true, + mergeRules: true, + mergeLonghand: true, + discardUnused: true, + discardOverridden: true, + discardDuplicates: true, + }, + ], + }, ], + minify: [ + CssMinimizerPlugin.cssnanoMinify, + //CssMinimizerPlugin.cleanCssMinify, + ] + }), + ], + }, - output: { - publicPath: path.join(conf.APPDIR, conf.DIST), - path: path.join(__dirname, conf.APPDIR, conf.DIST), - filename: path.join('js', '[name].js'), - }, + output: { + publicPath: path.join(conf.APPDIR, conf.DIST), + path: path.join(__dirname, conf.APPDIR, conf.DIST), + filename: path.join('js', '[name].js'), + }, - module: { - rules: [ - { - test: /\.jsx?$/, - //exclude: /node_modules/, - use: { - loader: 'babel-loader', - options: { - presets: [ - '@babel/preset-env', - '@babel/react', - { - plugins: [ - '@babel/plugin-proposal-class-properties', - ], - }, - ], //Preset used for env setup - plugins: [['@babel/transform-react-jsx']], - cacheDirectory: true, - cacheCompression: true, - }, - }, - }, - { - test: /\.s?css$/, - use: [ - { - loader: MiniCssExtractPlugin.loader, - }, - { - loader: 'css-loader', - options: { - sourceMap: !COMPRESS, - }, - }, - { - loader: 'resolve-url-loader', - }, - { - loader: 'sass-loader', - options: { - sourceMap: !COMPRESS, - }, - }, - ], - }, - { - test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, - use: [ - { - loader: 'file-loader', - options: { - name: '[name].[ext]', - outputPath: 'fonts/', - publicPath: '../fonts/', - }, - }, - ], - }, - { - test: /\.(ttf|otf|eot|svg|woff(2)?)$/, - use: [ - { - loader: 'file-loader', - options: { - name: '[name].[ext]', - outputPath: 'fonts/', - publicPath: '../fonts/', - }, - }, - ], - }, - { - test: /\.(png|webp|jpg|jpeg|gif|svg)$/, - use: [ - { - loader: 'img-optimize-loader', - options: { - name: '[name].[ext]', - outputPath: 'img/', - publicPath: '../img/', - compress: { - // This will take more time and get smaller images. - mode: 'low', // 'lossless', 'high', 'low' - disableOnDevelopment: true, - webp: conf['webp'], - }, - inline: { - limit: 1, - }, - }, - }, - ], - }, - ], - }, + module: { + rules: [{ + test: /\.jsx?$/, + //exclude: /node_modules/, + use: { + loader: 'babel-loader', //'@sucrase/webpack-loader', + options: { + //transforms: ['jsx'] + presets: [ + '@babel/preset-env', + '@babel/react', + { + plugins: [ + '@babel/plugin-proposal-class-properties', + ], + }, + ], //Preset used for env setup + plugins: [ + ['@babel/transform-react-jsx'] + ], + cacheDirectory: true, + cacheCompression: true, + }, + }, + }, + { + test: /\.s?css$/, + use: [{ + loader: MiniCssExtractPlugin.loader, + }, + { + loader: 'css-loader', + options: { + sourceMap: !COMPRESS, + }, + }, + { + loader: 'resolve-url-loader', + }, + { + loader: 'sass-loader', + options: { + sourceMap: !COMPRESS, + }, + }, ], + }, + { + test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, + use: [{ + loader: 'file-loader', + options: { + name: '[name].[ext]', + outputPath: 'fonts/', + publicPath: '../fonts/', + }, + }, ], + }, + { + test: /\.(ttf|otf|eot|woff(2)?)$/, + use: [{ + loader: 'file-loader', + options: { + name: '[name].[ext]', + outputPath: 'fonts/', + publicPath: '../fonts/', + }, + }, ], + }, + { + test: /\.(png|webp|jpg|jpeg|gif|svg)$/, + use: [{ + loader: 'img-optimize-loader', + options: { + name: '[name].[ext]', + outputPath: 'img/', + publicPath: '../img/', + compress: { + // This will take more time and get smaller images. + mode: 'low', // 'lossless', 'high', 'low' + disableOnDevelopment: true, + webp: conf['webp'], + // loseless compression for png + optipng: { + optimizationLevel: 4, + }, + // lossy compression for png. This will generate smaller file than optipng. + pngquant: { + quality: [0.2, 0.8], + }, + // Compression for svg. + svgo: true, + // Compression for gif. + gifsicle: { + optimizationLevel: 3, + }, + // Compression for jpg. + mozjpeg: { + progressive: true, + quality: 60, + }, + }, + inline: { + limit: 1, + }, + }, + }, ], + }, ], + }, - plugins: plugins, + plugins: plugins, }); console.log(cfg); diff --git a/webpack.config.serve.js b/webpack.config.serve.js index e38069a..3c2fbcc 100755 --- a/webpack.config.serve.js +++ b/webpack.config.serve.js @@ -1,23 +1,27 @@ /* * Development assets generation */ +const common = require('./webpack.config.common.js'); +const conf = common.configuration; const path = require('path'); +const fs = require('fs'); + //const autoprefixer = require('autoprefixer'); const webpack = require('webpack'); -const { merge } = require('webpack-merge'); +const { + merge +} = require('webpack-merge'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); -const common = require('./webpack.config.common.js'); -const commonVariables = require('./webpack.configuration'); -const conf = commonVariables.configuration; - const IP = process.env.IP || conf.HOSTNAME; const PORT = process.env.PORT || conf.PORT; const UIInfo = require('./package.json'); +const UIVERSION = JSON.stringify(UIInfo.version); +const UIMetaInfo = require('./package.json'); const NODE_ENV = 'development'; //conf.NODE_ENV || process.env.NODE_ENV; const COMPRESS = NODE_ENV === 'production' ? true : false; @@ -25,152 +29,152 @@ const COMPRESS = NODE_ENV === 'production' ? true : false; console.log('NODE_ENV: ' + NODE_ENV); console.log('COMPRESS: ' + COMPRESS); console.log('WebP images: ' + conf['webp']); +console.log('GRAPHQL_API_KEY: ' + conf['GRAPHQL_API_KEY']); +console.log('HTTPS: ' + conf['HTTPS']); -const config = merge(common, { - mode: 'development', - - entry: { - /*hot: [ - 'react-hot-loader/patch', - 'webpack-dev-server/?https://' + conf.HOSTNAME + ':' + conf.PORT, - 'webpack/hot/only-dev-server', - ],*/ - }, - - output: { - path: path.join(__dirname), - filename: '[name].js', - // necessary for HMR to know where to load the hot update chunks - publicPath: 'https://' + conf.HOSTNAME + ':' + conf.PORT + '/', - }, - - module: { - rules: [ - { - test: /\.jsx?$/, - //exclude: /node_modules/, - use: { - loader: 'babel-loader', - options: { - presets: [ - '@babel/preset-env', - '@babel/react', - { - plugins: ['@babel/plugin-proposal-class-properties'], - }, - ], //Preset used for env setup - plugins: [['@babel/transform-react-jsx']], - cacheDirectory: true, - cacheCompression: true, - }, - }, - }, - { - test: /\.s?css$/, - use: [ - { - loader: MiniCssExtractPlugin.loader, - }, - { - loader: 'css-loader', - options: { - sourceMap: !COMPRESS, - }, - }, - { - loader: 'resolve-url-loader', - }, - { - loader: 'sass-loader', - options: { - sourceMap: false, - }, - }, - ], - }, - { - test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, - use: [ - { - loader: 'url-loader', - }, - ], - }, - { - test: /\.(gif|png|jpg|jpeg|ttf|otf|eot|svg|webp|woff(2)?)$/, - use: [ - { - loader: 'file-loader', - options: { - name(file) { - return 'public/[path][name].[ext]'; - }, - }, - }, - ], - }, - ], - }, - plugins: [ +const plugins = [ new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - 'window.jQuery': 'jquery', - Popper: ['popper.js', 'default'], - Util: 'exports-loader?Util!bootstrap/js/dist/util', - Alert: 'exports-loader?Alert!bootstrap/js/dist/alert', - Button: 'exports-loader?Button!bootstrap/js/dist/button', - Carousel: 'exports-loader?Carousel!bootstrap/js/dist/carousel', - Collapse: 'exports-loader?Collapse!bootstrap/js/dist/collapse', - Dropdown: 'exports-loader?Dropdown!bootstrap/js/dist/dropdown', - Modal: 'exports-loader?Modal!bootstrap/js/dist/modal', - Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip', - Popover: 'exports-loader?Popover!bootstrap/js/dist/popover', - Scrollspy: 'exports-loader?Scrollspy!bootstrap/js/dist/scrollspy', - Tab: 'exports-loader?Tab!bootstrap/js/dist/tab', + react: 'React', + 'react-dom': 'ReactDOM', + /*$: 'jquery', + jQuery: 'jquery',*/ }), new webpack.DefinePlugin({ - UINAME: JSON.stringify(UIInfo.name), - UIVERSION: JSON.stringify(UIInfo.version), - UIAUTHOR: JSON.stringify(UIInfo.author), + UINAME: JSON.stringify(UIInfo.name), + UIVERSION: UIVERSION, + UIAUTHOR: JSON.stringify(UIInfo.author), + UIMetaNAME: JSON.stringify(UIMetaInfo.name), + UIMetaVersion: JSON.stringify(UIMetaInfo.version), + GRAPHQL_API_KEY: JSON.stringify(conf['GRAPHQL_API_KEY']), + SWVERSION: JSON.stringify(`sw-${new Date().getTime()}`), + BASE_HREF: JSON.stringify( + `http${conf['HTTPS'] ? 's' : ''}://${IP}:${PORT}`, + ), }), //new webpack.HotModuleReplacementPlugin(), new MiniCssExtractPlugin(), - new HtmlWebpackPlugin({ - publicPath: '', - template: path.join(conf.APPDIR, conf.SRC, 'index.html'), - templateParameters: { - NODE_ENV: NODE_ENV, - REACT_SCRIPTS: - NODE_ENV === 'production' - ? '' - : '', - }, - }), - ], +]; - devServer: { - host: IP, - port: PORT, - historyApiFallback: false, - //hot: true, - /*clientLogLevel: 'info', - disableHostCheck: true, - contentBase: [ - path.resolve(__dirname, 'public'), - path.resolve(__dirname, 'public', 'resources'), - path.resolve(__dirname, 'public', 'resources', conf.APPDIR, conf.DIST), - 'node_modules', - ],*/ - //watchContentBase: true, - overlay: { - warnings: true, - errors: true, +const indexPath = path.join(__dirname, conf.APPDIR, conf.SRC, 'index.html'); +if (fs.existsSync(indexPath)) { + plugins.push( + new HtmlWebpackPlugin({ + publicPath: '', + template: path.join(conf.APPDIR, conf.SRC, 'index.html'), + templateParameters: { + NODE_ENV: NODE_ENV, + GRAPHQL_URL: conf['GRAPHQL_URL'], + STATIC_URL: conf['STATIC_URL'], + REACT_SCRIPTS: NODE_ENV === 'production' ? + '' : '', + }, + }), + ); +} + +const config = merge(common.webpack, { + mode: 'development', + + entry: { + /*hot: [ + 'react-hot-loader/patch', + 'webpack-dev-server/?https://' + conf.HOSTNAME + ':' + conf.PORT, + 'webpack/hot/only-dev-server', + ],*/ }, - headers: { - 'Access-Control-Allow-Origin': '*', + + output: { + path: path.join(__dirname), + filename: '[name].js', + // necessary for HMR to know where to load the hot update chunks + publicPath: `http${conf['HTTPS'] ? 's' : ''}://${conf['HOSTNAME']}:${ + conf.PORT + }/`, + }, + + module: { + rules: [{ + test: /\.jsx?$/, + //exclude: /node_modules/, + use: { + loader: '@sucrase/webpack-loader', //'babel-loader', + options: { + transforms: ['jsx'] + /*presets: [ + '@babel/preset-env', + '@babel/react', + { + plugins: [ + '@babel/plugin-proposal-class-properties', + '@babel/plugin-syntax-top-level-await', + ], + }, + ], //Preset used for env setup + plugins: [ + ['@babel/transform-react-jsx'], + ['@babel/plugin-syntax-top-level-await'], + ], + cacheDirectory: true, + cacheCompression: true,*/ + }, + }, + }, + { + test: /\.s?css$/, + use: [{ + loader: MiniCssExtractPlugin.loader, + }, + { + loader: 'css-loader', + options: { + sourceMap: !COMPRESS, + }, + }, + { + loader: 'resolve-url-loader', + }, + { + loader: 'sass-loader', + options: { + sourceMap: false, + }, + }, ], + }, + { + test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, + use: [{ + loader: 'url-loader', + }, ], + }, + { + test: /\.(gif|png|jpg|jpeg|ttf|otf|eot|svg|webp|woff(2)?)$/, + use: [{ + loader: 'file-loader', + options: { + name(file) { + return 'public/[path][name].[ext]'; + }, + }, + }, ], + }, ], + }, + plugins: plugins, + + devServer: { + host: IP, + port: PORT, + historyApiFallback: false, + static: path.resolve(__dirname, conf['APPDIR'], conf['SRC']), + https: conf['HTTPS'], + hot: false, + //injectClient: conf['injectClient'], + + headers: { + 'Access-Control-Allow-Origin': '*', + 'Referrer-Policy': 'unsafe-url', + 'service-worker-allowed': '/', + }, }, - }, }); module.exports = config; diff --git a/webpack.configuration.js b/webpack.configuration.js deleted file mode 100755 index ed154b2..0000000 --- a/webpack.configuration.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Load webpack configuration from app/_config/webpack.yml - */ - -const path = require('path'); -const filesystem = require('fs'); -const fs = require('fs'); -const yaml = require('js-yaml'); - -const conf = yaml.safeLoad( - fs.readFileSync(path.join(__dirname, '/webpack.yml'), 'utf8'), -); - -let themes = []; -// add themes -if (conf['Site\\Templates\\WebpackTemplateProvider'].THEMESDIR) { - const themeDir = conf['Site\\Templates\\WebpackTemplateProvider'].THEMESDIR; - const dir = path.resolve(__dirname, themeDir); - - if (filesystem.existsSync(dir)) { - filesystem.readdirSync(dir).forEach((file) => { - filePath = path.join(themeDir, file); - const stat = filesystem.statSync(filePath); - - if (stat && stat.isDirectory()) { - themes.push(filePath); - } - }); - } -} - -module.exports = { - configuration: conf['Site\\Templates\\WebpackTemplateProvider'], - themes: themes, -}; diff --git a/webpack.yml b/webpack.yml index 267c3f0..be99b51 100755 --- a/webpack.yml +++ b/webpack.yml @@ -2,14 +2,19 @@ # with all configuration variables presented # Cuz WebPack compiling script use it to set configuration -Site\Templates\WebpackTemplateProvider: +App\Templates\WebpackTemplateProvider: APPDIR: ./ THEMESDIR: themes HOSTNAME: 127.0.0.1 - PORT: 3000 + PORT: 3001 SRC: src DIST: dist TYPESJS: src/js/types TYPESSCSS: src/scss/types - NODE_ENV: production #production,development webp: false + NODE_ENV: production #production,development + HTTPS: false + injectClient: true # disable it to test caching service worker + GRAPHQL_URL: 'http://127.0.0.1/graphql' + GRAPHQL_API_KEY: 'ApKrRSjySO4JAmX3E2Z7HvrBD0m8xdDlAiXyh4IbH3w' + STATIC_URL: 'http://127.0.0.1'