@supersoniks/concorde 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +0 -0
- package/concorde-core.bundle.js +1 -1
- package/concorde-core.es.js +1 -1
- package/package.json +4 -2
package/cli.js
CHANGED
|
File without changes
|
package/concorde-core.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){var t,e;let s=class t{static getLanguage(){const t=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||t}static getCookies(){return document.cookie.split(";").reduce(((t,e)=>{const s=e.indexOf("=");return t[e.substring(0,s).trim()]=e.substring(s+1),t}),{})}static everyAncestors(t,e){for(;t;){if(!e(t))return;t=t.parentNode||t.host}}static getAncestorAttributeValue(t,e){if(!t)return null;for(;!("hasAttribute"in t)||!t.hasAttribute(e);){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return"hasAttribute"in t?t.getAttribute(e):null}static getApiConfiguration(e){const s=t.getAncestorAttributeValue(e,"token"),i=null!=t.getAncestorAttributeValue(e,"addHTTPResponse"),r=t.getAncestorAttributeValue(e,"serviceURL");let o=null,n=null;const a=t.getAncestorAttributeValue(e,"tokenProvider"),l=t.getAncestorAttributeValue(e,"eventsApiToken");s||(o=t.getAncestorAttributeValue(e,"userName"),n=t.getAncestorAttributeValue(e,"password"));return{serviceURL:r,token:s,userName:o,password:n,authToken:l,tokenProvider:a,addHTTPResponse:i,credentials:t.getAncestorAttributeValue(e,"credentials")||void 0,cache:e.getAttribute("cache"),blockUntilDone:e.hasAttribute("blockUntilDone")}}static getClosestElement(t,e){for(;!t.nodeName||t.nodeName.toLowerCase()!==e;){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return t.nodeName?t:null}static getClosestForm(e){return t.getClosestElement(e,"form")}static async loadJS(t){return new Promise((async e=>{const s=document.createElement("script");s.src=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}static async loadCSS(t){return new Promise((async e=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}},i=class{static ucFirst(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.substring(1)}static minutesDuration(t,e="",i="long"){e||(e=s.getLanguage());function r(t,e,s){return Intl.NumberFormat(t,{style:"unit",unit:e,unitDisplay:s}).format}const[o,n]=(a=t,l=60,[Math.floor(a/l),a%l]);var a,l;const c=[];return o&&c.push(r(e,"hour",i)(o)),n&&c.push(r(e,"minute",i)(n)),new Intl.ListFormat(e,{style:"long",type:"conjunction"}).format(c)}static js(t){try{return Function("return "+t)()}catch(e){return""}}};function r(t){return"object"==typeof t&&null!=t}const o=class t{constructor(t,e){for(this._proxies_=new Map,this._is_savable_=!1,this._invalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=t,this.parent=e||null,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const t of this._proxies_.values())t.delete();this._invalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),t.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(t=!1){if(this._mutationListeners_.forEach((t=>t())),this._is_savable_&&!l.changed){l.changed=!0,l.saveId++;const t=l.saveId;setTimeout((()=>l.getInstance().saveToLocalStorage(t)),1e3)}t||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(t=!1){this._assignmentId_++;const e=this._assignmentId_;if(await(async()=>new Promise((t=>{window.queueMicrotask((()=>t(null)))})))(),e!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach((t=>t(s))),this._publishInternalMutation_(t)}_publishInvalidation_(){this._invalidateListeners_.forEach((t=>t()))}_publishDynamicFilling_(t,e){this._fillListeners_.forEach((s=>{s[t]!==e&&(s[t]=e)})),this._publishTemplateFilling_(t,e)}_publishTemplateFilling_(t,e){this._templateFillListeners_.forEach((s=>{const i=Object.getOwnPropertyDescriptor(s,t);(!i||i.set||i.writable)&&(s.propertyMap&&s.propertyMap[t]&&(t=s.propertyMap[t]),void 0!==s[t]&&s[t]!==e&&(s[t]=e))}))}onAssign(t,e=!0){"function"==typeof t&&(this._assignListeners_.has(t)||(this._assignListeners_.add(t),e&&t(this.get())))}offAssign(t){this._assignListeners_.delete(t)}onInvalidate(t){"function"==typeof t&&this._invalidateListeners_.add(t)}offInvalidate(t){"function"==typeof t&&this._invalidateListeners_.delete(t)}invalidate(){this._publishInvalidation_()}onInternalMutation(t){"function"==typeof t&&(this._mutationListeners_.add(t),t())}offInternalMutation(t){"function"==typeof t&&this._mutationListeners_.delete(t)}startTemplateFilling(t){if(this._templateFillListeners_.add(t),"object"==typeof this._value_)for(const e in this._value_){let s=e;const i=this._value_[e];t.propertyMap&&t.propertyMap[e]&&(s=t.propertyMap[e]),void 0!==t[e]&&t[e]!==i&&(t[s]=i)}}stopTemplateFilling(t){this._templateFillListeners_.delete(t)}startDynamicFilling(t){this._fillListeners_.add(t);for(const e in this._value_){const s=this._value_[e];t[e]!==s&&(t[e]=s)}}stopDynamicFilling(t){this._fillListeners_.delete(t)}async set(t,e=!1){var s;if(this._value_===t)return!0;if(this._value_&&Object.prototype.hasOwnProperty.call(this._value_,"__value")&&Object.prototype.hasOwnProperty.call(t,"__value")&&this._value_.__value===t.__value)return!0;const i=this._value_;this._value_=r(t)?t:{__value:t},this._cachedGet_=void 0;if(Object.prototype.hasOwnProperty.call(this._value_,"__value"))return await this._publishAssignement_(e),!0;for(const r in this._value_)void 0===this._value_[r]&&delete this._value_[r];if(this._proxies_.forEach(((t,e)=>{void 0===this._value_[e]&&"_parent_"!=e&&i[e]&&(this._value_[e]=null)})),await this._publishAssignement_(),r(this._value_))for(const o in this._value_){const e=t[o],i=r(e)?e:{__value:e};this._proxies_.has(o)?(await(null==(s=this._proxies_.get(o))?void 0:s.set(i,!0)),this._publishDynamicFilling_(o,e)):this._publishDynamicFilling_(o,e)}return!0}get(){if(void 0!==this._cachedGet_)return this._cachedGet_;if(l.modifiedCollectore.length>0&&l.modifiedCollectore[0].add(this),Object.prototype.hasOwnProperty.call(this._value_,"__value")){const t=this._value_.__value;return this._cachedGet_=null!=t?t:null}return this._cachedGet_=this._value_}get $tag(){this._instanceCounter_||(t.instancesCounter++,this._instanceCounter_=t.instancesCounter),t.instances.set(this._instanceCounter_,this);return'<reactive-publisher-proxy publisher="'+this._instanceCounter_+'"></reactive-publisher-proxy>'}};o.instances=new Map,o.instancesCounter=0;let n=o;const a=class t{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],null!=t.instance)throw"Singleton / use getInstance";t.instance=this,this.isLocalStrorageReady=this.cleanStorageData()}async cleanStorageData(){return new Promise((t=>{(async()=>{try{let s=localStorage.getItem("publisher-proxies-data"),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch(e){this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem("publisher-proxies-data",s),this.localStorageData={};const r=(new Date).getTime()-432e5;for(const t in this.localStorageData){this.localStorageData[t].lastModifiationMS<r&&delete this.localStorageData[t]}t(!0)}catch(e){window.requestAnimationFrame((()=>{t(!1)})),console.log("no publisher cache in this browser")}})()}))}static getInstance(){return null==t.instance?new t:t.instance}static get(e,s){return t.getInstance().get(e,s)}static collectModifiedPublisher(){t.modifiedCollectore.unshift(new Set)}static getModifiedPublishers(){return t.modifiedCollectore.shift()}static delete(e){return!!e&&t.getInstance().delete(e)}async setLocalData(t,e){var i;await this.isLocalStrorageReady,t.set((null==(i=this.localStorageData[e+"¤lang_"+s.getLanguage()])?void 0:i.data)||t.get())}get(t,e){const s="enabled"===(null==e?void 0:e.localStorageMode);if(!this.publishers.has(t)){const e=new h({});this.set(t,e)}const i=this.publishers.get(t);return s&&-1===this.initialisedData.indexOf(t)&&(i._is_savable_=!0,this.initialisedData.push(t),this.setLocalData(i,t)),this.publishers.get(t)}set(t,e){this.publishers.set(t,e)}delete(t){return!!this.publishers.has(t)&&(this.publishers.delete(t),!0)}async saveToLocalStorage(e=0){if(e===t.saveId||e%10==0)try{if(!t.changed||t.saving)return;t.saving=!0,t.changed=!1;const e=Array.from(this.publishers.keys());let i=!1;for(const t of e){const e=this.publishers.get(t);if(!(null==e?void 0:e._is_savable_))continue;const r=null==e?void 0:e.get();r&&(this.localStorageData[t+"¤lang_"+s.getLanguage()]={lastModifiationMS:(new Date).getTime(),data:r},i=!0)}if(i){const t=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem("publisher-proxies-data",t)}if(t.saving=!1,t.changed){t.saveId++;const e=t.saveId;setTimeout((()=>this.saveToLocalStorage(e)),1e3)}}catch(i){t.saving=!1}}async compress(t,e){const s=(new TextEncoder).encode(t),i=new window.CompressionStream(e),r=i.writable.getWriter();r.write(s),r.close();const o=await new Response(i.readable).arrayBuffer(),n=new Uint8Array(o);let a="";for(let l=0;l<n.length;l++)a+=String.fromCharCode(n[l]);return btoa(a)}async decompress(t,e){const s=atob(t),i=Uint8Array.from(s,(t=>t.charCodeAt(0))).buffer,r=new window.DecompressionStream(e),o=r.writable.getWriter();o.write(i),o.close();const n=await new Response(r.readable).arrayBuffer();return(new TextDecoder).decode(n)}};a.buildDate="Thu Apr 04 2024 10:59:02 GMT+0200 (Central European Summer Time)",a.changed=!1,a.saving=!1,a.saveId=0,a.instance=null,a.modifiedCollectore=[];let l=a;const c=new Set(["invalidate","onInvalidate","offInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_value_","_is_savable_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_"]);class h extends n{constructor(t,e=null){super(t,e);const s=new Proxy(this,{get:function(t,e){if(e==Symbol.toPrimitive)return()=>s.get();if(c.has(e))return t[e];if(!t._proxies_.has(e)){const i=t._value_[e],o=new h(r(i)?i:{__value:i},t);o._proxies_.set("_parent_",s),t._proxies_.set(e,o)}return t._proxies_.get(e)},set:function(t,e,i){var o;if("_value_"==e)return t._value_=i,!0;if("_cachedGet_"==e)return t._cachedGet_=i,!0;if("_assignmentId_"==e)return t._assignmentId_=i,!0;if("_is_savable_"==e)return t._is_savable_=i,!0;if("_instanceCounter_"==e)return t._instanceCounter_=i,!0;if(!t._proxies_.has(e)){const i=new h({},t);i._proxies_.set("_parent_",s),t._proxies_.set(e,i)}return t._value_[e]!==i&&(t._value_[e]=i,t._publishDynamicFilling_(e,i),null==(o=t._proxies_.get(e))||o.set(r(i)?i:{__value:i})),!0},deleteProperty:function(t,e){var s;return t._publishDynamicFilling_(e,null),null==(s=t._proxies_.get(e))||s.set(null),delete t._value_[e]},has:function(t,e){return e in t._value_&&"_lockInternalMutationPublishing_"!=e},defineProperty:function(t,e,s){return s&&"value"in s&&(t._value_[e]=s.value),!0},getOwnPropertyDescriptor:function(t,e){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}});return s}toString(){return"hey"}valueOf(){return 2}getProperty(t,e){return t[e]}}"undefined"!=typeof module&&(module.exports={Publisher:h,PublisherManager:l});class d extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=t=>{this.innerHTML=t.toString()}}connectedCallback(){var t;this.publisherId=this.getAttribute("publisher")||"",this.publisher=n.instances.get(parseInt(this.publisherId)),null==(t=this.publisher)||t.onAssign(this.onAssign)}disconnectedCallback(){var t;null==(t=this.publisher)||t.offAssign(this.onAssign)}}customElements.define("reactive-publisher-proxy",d);const p=class t{static disable(){this.enabled&&(this.enabled=!1,Array.from(t.observedElements.keys()).forEach((e=>t.unObserve(e))))}static observe(e){if(!e)return;if(!t.enabled)return;if(t.observedElements.has(e))return;const s=new MutationObserver(t.onMutation),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-bind"]};s.observe(e,i),e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))),t.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))):e.childNodes.forEach((e=>t.onAdded(e)))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))):e.childNodes.forEach((e=>t.onRemoved(e)))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":t.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach((e=>{t.onAdded(e)})),s.removedNodes.forEach((e=>{t.onRemoved(e)}))}}static removePublisherListeners(e){const s=t.publisherListeners.get(e);s&&(t.publisherListeners.delete(e),s.forEach((t=>{var e;null==(e=t.publisher)||e.offAssign(t.onAssign)})))}static getVariablesDescriptor(t){let e=t.match(/(\$(?:\w+\\?\.?)+)/g);return e=e?e.map((t=>t.replace("$",""))):[t],e=e.filter((t=>t.length>0)),{expression:t.replace("\\",""),variables:e.map((t=>t.split(/\b\.\b/).map((t=>t.replace("\\","")))))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter((t=>0==t.name.indexOf("::"))).map((e=>({propertyToUpdate:e.name.substring(2).replace(/-((html)|\w)/g,(t=>t.substring(1).toUpperCase())),bindedVariablesDescriptor:t.getVariablesDescriptor(e.value)}))):[]}static getSubPublisher(t,e){if(!e)return t;for(const s of e)if("_self_"!=s){if(!t)return null;t=t[s]}return t}static addPublisherListeners(e){t.removePublisherListeners(e);const r=s.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!r)return;const o=l.getInstance().get(r),n=t.getDataBindItems(e),a=[];n.forEach((s=>{const r=s.bindedVariablesDescriptor,n=s.propertyToUpdate;for(const l of r.variables){const s=l;let c=o;c=t.getSubPublisher(o,s);const h=e,d={publisher:c,onAssign:()=>{const e=r.variables.map((e=>{var s;return null==(s=t.getSubPublisher(o,e))?void 0:s.get()}));let s=r.expression,a=!1;if(1==e.length&&r.variables[0].join(".")==s.substring(1)){let t=e[0];return null===t&&(t=""),void(h[n]=t)}for(let t=0;t<e.length;t++){let i=e[t];const o=r.variables[t];null===i&&(a=!0,i=void 0),s=s.replace("$"+o.join("."),i)}if(-1!=s.indexOf("|")){const t=s.indexOf("|");if(0==t)s=i.js(s.substring(1));else{const e=s.substring(0,t),r=s.substring(t+1),o=i[e];s=a?"":o?o(r):s}}else s=a?"":s;h[n]=s}};null==c||c.onAssign(d.onAssign),a.push(d)}})),t.publisherListeners.set(e,a)}};p.observedElements=new Map,p.enabled=!0,p.publisherListeners=new Map;let u=p;u.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=u);let g=class t{static shallowEqual(t,e,s=!0){const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length&&s)return!1;for(const o of i){const i=t[o],r=e[o];if(s?i!==r:i!=r)return!1}return!0}static deepEqual(e,s,i=!0){const r=Object.keys(e),o=Object.keys(s);if(r.length!==o.length&&i)return!1;for(const n of r){const r=e[n],o=s[n],a=t.isObject(r)&&t.isObject(o),l=i?r!==o:r!=o;if(a&&!t.deepEqual(r,o)||!a&&l)return!1}return!0}static isObject(t){return null!=t&&"object"==typeof t}static isUndefindOrNull(t){return null==t}static isEmpty(e){return!!t.isUndefindOrNull(e)||0===Object.keys(e).length}static traverse(e,s,i=!1){for(const r of s){const s=e[r];if(void 0===s)return;e=i&&t.isObject(s)?Object.assign(Array.isArray(s)?[]:{},e,s):e[r]}return e}static getURLSearchArray(e,s=""){let i=[];for(let r in e){const o=e[r];s&&(r=s+"["+r+"]"),t.isObject(o)?i=[...i,...this.getURLSearchArray(o,r)]:i.push(`${r}=${o}`)}return i}static getURLSearchString(e){return t.getURLSearchArray(e,"").join("&")}};
|
|
1
|
+
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){var t,e;let s=class t{static getLanguage(){const t=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||t}static getCookies(){return document.cookie.split(";").reduce(((t,e)=>{const s=e.indexOf("=");return t[e.substring(0,s).trim()]=e.substring(s+1),t}),{})}static everyAncestors(t,e){for(;t;){if(!e(t))return;t=t.parentNode||t.host}}static getAncestorAttributeValue(t,e){if(!t)return null;for(;!("hasAttribute"in t)||!t.hasAttribute(e);){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return"hasAttribute"in t?t.getAttribute(e):null}static getApiConfiguration(e){const s=t.getAncestorAttributeValue(e,"token"),i=null!=t.getAncestorAttributeValue(e,"addHTTPResponse"),r=t.getAncestorAttributeValue(e,"serviceURL");let o=null,n=null;const a=t.getAncestorAttributeValue(e,"tokenProvider"),l=t.getAncestorAttributeValue(e,"eventsApiToken");s||(o=t.getAncestorAttributeValue(e,"userName"),n=t.getAncestorAttributeValue(e,"password"));return{serviceURL:r,token:s,userName:o,password:n,authToken:l,tokenProvider:a,addHTTPResponse:i,credentials:t.getAncestorAttributeValue(e,"credentials")||void 0,cache:e.getAttribute("cache"),blockUntilDone:e.hasAttribute("blockUntilDone")}}static getClosestElement(t,e){for(;!t.nodeName||t.nodeName.toLowerCase()!==e;){if(!(t.parentNode||t.host))break;t=t.parentNode||t.host}return t.nodeName?t:null}static getClosestForm(e){return t.getClosestElement(e,"form")}static async loadJS(t){return new Promise((async e=>{const s=document.createElement("script");s.src=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}static async loadCSS(t){return new Promise((async e=>{const s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=t,s.onload=()=>e(!0),s.onerror=()=>e(!0),document.head.appendChild(s)}))}},i=class{static ucFirst(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.substring(1)}static minutesDuration(t,e="",i="long"){e||(e=s.getLanguage());function r(t,e,s){return Intl.NumberFormat(t,{style:"unit",unit:e,unitDisplay:s}).format}const[o,n]=(a=t,l=60,[Math.floor(a/l),a%l]);var a,l;const c=[];return o&&c.push(r(e,"hour",i)(o)),n&&c.push(r(e,"minute",i)(n)),new Intl.ListFormat(e,{style:"long",type:"conjunction"}).format(c)}static js(t){try{return Function("return "+t)()}catch(e){return""}}};function r(t){return"object"==typeof t&&null!=t}const o=class t{constructor(t,e){for(this._proxies_=new Map,this._is_savable_=!1,this._invalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=t,this.parent=e||null,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const t of this._proxies_.values())t.delete();this._invalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),t.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(t=!1){if(this._mutationListeners_.forEach((t=>t())),this._is_savable_&&!l.changed){l.changed=!0,l.saveId++;const t=l.saveId;setTimeout((()=>l.getInstance().saveToLocalStorage(t)),1e3)}t||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(t=!1){this._assignmentId_++;const e=this._assignmentId_;if(await(async()=>new Promise((t=>{window.queueMicrotask((()=>t(null)))})))(),e!==this._assignmentId_)return;const s=this.get();this._assignListeners_.forEach((t=>t(s))),this._publishInternalMutation_(t)}_publishInvalidation_(){this._invalidateListeners_.forEach((t=>t()))}_publishDynamicFilling_(t,e){this._fillListeners_.forEach((s=>{s[t]!==e&&(s[t]=e)})),this._publishTemplateFilling_(t,e)}_publishTemplateFilling_(t,e){this._templateFillListeners_.forEach((s=>{const i=Object.getOwnPropertyDescriptor(s,t);(!i||i.set||i.writable)&&(s.propertyMap&&s.propertyMap[t]&&(t=s.propertyMap[t]),void 0!==s[t]&&s[t]!==e&&(s[t]=e))}))}onAssign(t,e=!0){"function"==typeof t&&(this._assignListeners_.has(t)||(this._assignListeners_.add(t),e&&t(this.get())))}offAssign(t){this._assignListeners_.delete(t)}onInvalidate(t){"function"==typeof t&&this._invalidateListeners_.add(t)}offInvalidate(t){"function"==typeof t&&this._invalidateListeners_.delete(t)}invalidate(){this._publishInvalidation_()}onInternalMutation(t){"function"==typeof t&&(this._mutationListeners_.add(t),t())}offInternalMutation(t){"function"==typeof t&&this._mutationListeners_.delete(t)}startTemplateFilling(t){if(this._templateFillListeners_.add(t),"object"==typeof this._value_)for(const e in this._value_){let s=e;const i=this._value_[e];t.propertyMap&&t.propertyMap[e]&&(s=t.propertyMap[e]),void 0!==t[e]&&t[e]!==i&&(t[s]=i)}}stopTemplateFilling(t){this._templateFillListeners_.delete(t)}startDynamicFilling(t){this._fillListeners_.add(t);for(const e in this._value_){const s=this._value_[e];t[e]!==s&&(t[e]=s)}}stopDynamicFilling(t){this._fillListeners_.delete(t)}async set(t,e=!1){var s;if(this._value_===t)return!0;if(this._value_&&Object.prototype.hasOwnProperty.call(this._value_,"__value")&&Object.prototype.hasOwnProperty.call(t,"__value")&&this._value_.__value===t.__value)return!0;const i=this._value_;this._value_=r(t)?t:{__value:t},this._cachedGet_=void 0;if(Object.prototype.hasOwnProperty.call(this._value_,"__value"))return await this._publishAssignement_(e),!0;for(const r in this._value_)void 0===this._value_[r]&&delete this._value_[r];if(this._proxies_.forEach(((t,e)=>{void 0===this._value_[e]&&"_parent_"!=e&&i[e]&&(this._value_[e]=null)})),await this._publishAssignement_(),r(this._value_))for(const o in this._value_){const e=t[o],i=r(e)?e:{__value:e};this._proxies_.has(o)?(await(null==(s=this._proxies_.get(o))?void 0:s.set(i,!0)),this._publishDynamicFilling_(o,e)):this._publishDynamicFilling_(o,e)}return!0}get(){if(void 0!==this._cachedGet_)return this._cachedGet_;if(l.modifiedCollectore.length>0&&l.modifiedCollectore[0].add(this),Object.prototype.hasOwnProperty.call(this._value_,"__value")){const t=this._value_.__value;return this._cachedGet_=null!=t?t:null}return this._cachedGet_=this._value_}get $tag(){this._instanceCounter_||(t.instancesCounter++,this._instanceCounter_=t.instancesCounter),t.instances.set(this._instanceCounter_,this);return'<reactive-publisher-proxy publisher="'+this._instanceCounter_+'"></reactive-publisher-proxy>'}};o.instances=new Map,o.instancesCounter=0;let n=o;const a=class t{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],null!=t.instance)throw"Singleton / use getInstance";t.instance=this,this.isLocalStrorageReady=this.cleanStorageData()}async cleanStorageData(){return new Promise((t=>{(async()=>{try{let s=localStorage.getItem("publisher-proxies-data"),i=null;if(s&&(i=await this.decompress(s,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch(e){this.localStorageData={}}else s=await this.compress("{}","gzip"),localStorage.setItem("publisher-proxies-data",s),this.localStorageData={};const r=(new Date).getTime()-432e5;for(const t in this.localStorageData){this.localStorageData[t].lastModifiationMS<r&&delete this.localStorageData[t]}t(!0)}catch(e){window.requestAnimationFrame((()=>{t(!1)})),console.log("no publisher cache in this browser")}})()}))}static getInstance(){return null==t.instance?new t:t.instance}static get(e,s){return t.getInstance().get(e,s)}static collectModifiedPublisher(){t.modifiedCollectore.unshift(new Set)}static getModifiedPublishers(){return t.modifiedCollectore.shift()}static delete(e){return!!e&&t.getInstance().delete(e)}async setLocalData(t,e){var i;await this.isLocalStrorageReady,t.set((null==(i=this.localStorageData[e+"¤lang_"+s.getLanguage()])?void 0:i.data)||t.get())}get(t,e){const s="enabled"===(null==e?void 0:e.localStorageMode);if(!this.publishers.has(t)){const e=new h({});this.set(t,e)}const i=this.publishers.get(t);return s&&-1===this.initialisedData.indexOf(t)&&(i._is_savable_=!0,this.initialisedData.push(t),this.setLocalData(i,t)),this.publishers.get(t)}set(t,e){this.publishers.set(t,e)}delete(t){return!!this.publishers.has(t)&&(this.publishers.delete(t),!0)}async saveToLocalStorage(e=0){if(e===t.saveId||e%10==0)try{if(!t.changed||t.saving)return;t.saving=!0,t.changed=!1;const e=Array.from(this.publishers.keys());let i=!1;for(const t of e){const e=this.publishers.get(t);if(!(null==e?void 0:e._is_savable_))continue;const r=null==e?void 0:e.get();r&&(this.localStorageData[t+"¤lang_"+s.getLanguage()]={lastModifiationMS:(new Date).getTime(),data:r},i=!0)}if(i){const t=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem("publisher-proxies-data",t)}if(t.saving=!1,t.changed){t.saveId++;const e=t.saveId;setTimeout((()=>this.saveToLocalStorage(e)),1e3)}}catch(i){t.saving=!1}}async compress(t,e){const s=(new TextEncoder).encode(t),i=new window.CompressionStream(e),r=i.writable.getWriter();r.write(s),r.close();const o=await new Response(i.readable).arrayBuffer(),n=new Uint8Array(o);let a="";for(let l=0;l<n.length;l++)a+=String.fromCharCode(n[l]);return btoa(a)}async decompress(t,e){const s=atob(t),i=Uint8Array.from(s,(t=>t.charCodeAt(0))).buffer,r=new window.DecompressionStream(e),o=r.writable.getWriter();o.write(i),o.close();const n=await new Response(r.readable).arrayBuffer();return(new TextDecoder).decode(n)}};a.buildDate="Thu Apr 04 2024 11:34:32 GMT+0200 (Central European Summer Time)",a.changed=!1,a.saving=!1,a.saveId=0,a.instance=null,a.modifiedCollectore=[];let l=a;const c=new Set(["invalidate","onInvalidate","offInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_value_","_is_savable_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_"]);class h extends n{constructor(t,e=null){super(t,e);const s=new Proxy(this,{get:function(t,e){if(e==Symbol.toPrimitive)return()=>s.get();if(c.has(e))return t[e];if(!t._proxies_.has(e)){const i=t._value_[e],o=new h(r(i)?i:{__value:i},t);o._proxies_.set("_parent_",s),t._proxies_.set(e,o)}return t._proxies_.get(e)},set:function(t,e,i){var o;if("_value_"==e)return t._value_=i,!0;if("_cachedGet_"==e)return t._cachedGet_=i,!0;if("_assignmentId_"==e)return t._assignmentId_=i,!0;if("_is_savable_"==e)return t._is_savable_=i,!0;if("_instanceCounter_"==e)return t._instanceCounter_=i,!0;if(!t._proxies_.has(e)){const i=new h({},t);i._proxies_.set("_parent_",s),t._proxies_.set(e,i)}return t._value_[e]!==i&&(t._value_[e]=i,t._publishDynamicFilling_(e,i),null==(o=t._proxies_.get(e))||o.set(r(i)?i:{__value:i})),!0},deleteProperty:function(t,e){var s;return t._publishDynamicFilling_(e,null),null==(s=t._proxies_.get(e))||s.set(null),delete t._value_[e]},has:function(t,e){return e in t._value_&&"_lockInternalMutationPublishing_"!=e},defineProperty:function(t,e,s){return s&&"value"in s&&(t._value_[e]=s.value),!0},getOwnPropertyDescriptor:function(t,e){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}});return s}toString(){return"hey"}valueOf(){return 2}getProperty(t,e){return t[e]}}"undefined"!=typeof module&&(module.exports={Publisher:h,PublisherManager:l});class d extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=t=>{this.innerHTML=t.toString()}}connectedCallback(){var t;this.publisherId=this.getAttribute("publisher")||"",this.publisher=n.instances.get(parseInt(this.publisherId)),null==(t=this.publisher)||t.onAssign(this.onAssign)}disconnectedCallback(){var t;null==(t=this.publisher)||t.offAssign(this.onAssign)}}customElements.define("reactive-publisher-proxy",d);const p=class t{static disable(){this.enabled&&(this.enabled=!1,Array.from(t.observedElements.keys()).forEach((e=>t.unObserve(e))))}static observe(e){if(!e)return;if(!t.enabled)return;if(t.observedElements.has(e))return;const s=new MutationObserver(t.onMutation),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-bind"]};s.observe(e,i),e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))),t.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.addPublisherListeners(e))):e.childNodes.forEach((e=>t.onAdded(e)))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&t.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach((e=>t.removePublisherListeners(e))):e.childNodes.forEach((e=>t.onRemoved(e)))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":t.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach((e=>{t.onAdded(e)})),s.removedNodes.forEach((e=>{t.onRemoved(e)}))}}static removePublisherListeners(e){const s=t.publisherListeners.get(e);s&&(t.publisherListeners.delete(e),s.forEach((t=>{var e;null==(e=t.publisher)||e.offAssign(t.onAssign)})))}static getVariablesDescriptor(t){let e=t.match(/(\$(?:\w+\\?\.?)+)/g);return e=e?e.map((t=>t.replace("$",""))):[t],e=e.filter((t=>t.length>0)),{expression:t.replace("\\",""),variables:e.map((t=>t.split(/\b\.\b/).map((t=>t.replace("\\","")))))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter((t=>0==t.name.indexOf("::"))).map((e=>({propertyToUpdate:e.name.substring(2).replace(/-((html)|\w)/g,(t=>t.substring(1).toUpperCase())),bindedVariablesDescriptor:t.getVariablesDescriptor(e.value)}))):[]}static getSubPublisher(t,e){if(!e)return t;for(const s of e)if("_self_"!=s){if(!t)return null;t=t[s]}return t}static addPublisherListeners(e){t.removePublisherListeners(e);const r=s.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!r)return;const o=l.getInstance().get(r),n=t.getDataBindItems(e),a=[];n.forEach((s=>{const r=s.bindedVariablesDescriptor,n=s.propertyToUpdate;for(const l of r.variables){const s=l;let c=o;c=t.getSubPublisher(o,s);const h=e,d={publisher:c,onAssign:()=>{const e=r.variables.map((e=>{var s;return null==(s=t.getSubPublisher(o,e))?void 0:s.get()}));let s=r.expression,a=!1;if(1==e.length&&r.variables[0].join(".")==s.substring(1)){let t=e[0];return null===t&&(t=""),void(h[n]=t)}for(let t=0;t<e.length;t++){let i=e[t];const o=r.variables[t];null===i&&(a=!0,i=void 0),s=s.replace("$"+o.join("."),i)}if(-1!=s.indexOf("|")){const t=s.indexOf("|");if(0==t)s=i.js(s.substring(1));else{const e=s.substring(0,t),r=s.substring(t+1),o=i[e];s=a?"":o?o(r):s}}else s=a?"":s;h[n]=s}};null==c||c.onAssign(d.onAssign),a.push(d)}})),t.publisherListeners.set(e,a)}};p.observedElements=new Map,p.enabled=!0,p.publisherListeners=new Map;let u=p;u.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=u);let g=class t{static shallowEqual(t,e,s=!0){const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length&&s)return!1;for(const o of i){const i=t[o],r=e[o];if(s?i!==r:i!=r)return!1}return!0}static deepEqual(e,s,i=!0){const r=Object.keys(e),o=Object.keys(s);if(r.length!==o.length&&i)return!1;for(const n of r){const r=e[n],o=s[n],a=t.isObject(r)&&t.isObject(o),l=i?r!==o:r!=o;if(a&&!t.deepEqual(r,o)||!a&&l)return!1}return!0}static isObject(t){return null!=t&&"object"==typeof t}static isUndefindOrNull(t){return null==t}static isEmpty(e){return!!t.isUndefindOrNull(e)||0===Object.keys(e).length}static traverse(e,s,i=!1){for(const r of s){const s=e[r];if(void 0===s)return;e=i&&t.isObject(s)?Object.assign(Array.isArray(s)?[]:{},e,s):e[r]}return e}static getURLSearchArray(e,s=""){let i=[];for(let r in e){const o=e[r];s&&(r=s+"["+r+"]"),t.isObject(o)?i=[...i,...this.getURLSearchArray(o,r)]:i.push(`${r}=${o}`)}return i}static getURLSearchString(e){return t.getURLSearchArray(e,"").join("&")}};
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
package/concorde-core.es.js
CHANGED
|
@@ -621,7 +621,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
621
621
|
return new TextDecoder().decode(result);
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
|
-
_PublisherManager.buildDate = "Thu Apr 04 2024
|
|
624
|
+
_PublisherManager.buildDate = "Thu Apr 04 2024 11:34:32 GMT+0200 (Central European Summer Time)";
|
|
625
625
|
_PublisherManager.changed = false;
|
|
626
626
|
_PublisherManager.saving = false;
|
|
627
627
|
_PublisherManager.saveId = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersoniks/concorde",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -288,5 +288,7 @@
|
|
|
288
288
|
".": "./core/core"
|
|
289
289
|
},
|
|
290
290
|
"type": "module",
|
|
291
|
-
"bin":
|
|
291
|
+
"bin": {
|
|
292
|
+
"concorde": "./cli.js"
|
|
293
|
+
}
|
|
292
294
|
}
|