@supersoniks/concorde 3.0.6 → 3.0.8

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.
Files changed (35) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +119 -119
  3. package/concorde-core.es.js +1180 -1136
  4. package/dist/concorde-core.bundle.js +119 -119
  5. package/dist/concorde-core.es.js +1180 -1136
  6. package/docs/assets/{index-DWBLY4SP.js → index-Ce3mr_lI.js} +1 -1
  7. package/docs/index.html +3 -3
  8. package/index.html +2 -2
  9. package/package.json +6 -4
  10. package/src/core/components/ui/toast/toast.ts +48 -26
  11. package/src/core/core.ts +1 -5
  12. package/src/core/mixins/Fetcher.ts +5 -1
  13. package/src/core/mixins/Subscriber.ts +63 -27
  14. package/src/core/utils/PublisherProxy.ts +61 -13
  15. package/vite/config.js +2 -0
  16. package/vite.config.mts +1 -1
  17. package/docs/assets/index-1TMaJjPy.js +0 -4040
  18. package/docs/assets/index-3W2s1DcY.js +0 -4040
  19. package/docs/assets/index-B-7rKIow.js +0 -4040
  20. package/docs/assets/index-BGZLt2PX.js +0 -4040
  21. package/docs/assets/index-BJY63wEA.js +0 -4040
  22. package/docs/assets/index-BLpP1vLa.js +0 -4040
  23. package/docs/assets/index-BLr8ygoi.js +0 -4040
  24. package/docs/assets/index-BXaJoTcR.js +0 -4040
  25. package/docs/assets/index-Bln0wc2P.js +0 -4040
  26. package/docs/assets/index-BsUX98bJ.js +0 -4040
  27. package/docs/assets/index-CILRGlUn.js +0 -4040
  28. package/docs/assets/index-Cutw0yfi.js +0 -4040
  29. package/docs/assets/index-DyD3o74q.js +0 -4040
  30. package/docs/assets/index-NCT3BKv0.js +0 -4040
  31. package/docs/assets/index-PbOx6NxY.js +0 -4040
  32. package/docs/assets/index-U_hssYGq.js +0 -4040
  33. package/docs/assets/index-cNBBlbBt.js +0 -4040
  34. package/docs/assets/index-gx6CCJoi.js +0 -4040
  35. package/docs/assets/index-l8XRMBvs.js +0 -4040
@@ -1,4 +1,4 @@
1
- var Co=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Qh=Co((dd,kt)=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))r(t);new MutationObserver(t=>{for(const n of t)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function s(t){const n={};return t.integrity&&(n.integrity=t.integrity),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?n.credentials="include":t.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(t){if(t.ep)return;t.ep=!0;const n=s(t);fetch(t.href,n)}})();let pe=class Ue{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,s)=>{const r=s.indexOf("=");return e[s.substring(0,r).trim()]=s.substring(r+1),e},{})}static everyAncestors(e,s){for(;e;){if(!s(e))return;e=e.parentNode||e.host}}static getAncestorAttributeValue(e,s){if(!e)return null;for(;!("hasAttribute"in e&&e.hasAttribute(s))&&(e.parentNode||e.host);)e=e.parentNode||e.host;return"hasAttribute"in e?e.getAttribute(s):null}static getApiConfiguration(e){const s=Ue.getAncestorAttributeValue(e,"token"),r=Ue.getAncestorAttributeValue(e,"addHTTPResponse")!=null,t=Ue.getAncestorAttributeValue(e,"serviceURL");let n=null,o=null;const a=Ue.getAncestorAttributeValue(e,"tokenProvider"),c=Ue.getAncestorAttributeValue(e,"eventsApiToken");s||(n=Ue.getAncestorAttributeValue(e,"userName"),o=Ue.getAncestorAttributeValue(e,"password"));const d=Ue.getAncestorAttributeValue(e,"credentials")||void 0,b=e.getAttribute("cache"),m=e.hasAttribute("blockUntilDone");return{serviceURL:t,token:s,userName:n,password:o,authToken:c,tokenProvider:a,addHTTPResponse:r,credentials:d,cache:b,blockUntilDone:m}}static getClosestElement(e,s){for(;!(e.nodeName&&e.nodeName.toLowerCase()===s)&&(e.parentNode||e.host);)e=e.parentNode||e.host;return e.nodeName?e:null}static getClosestForm(e){return Ue.getClosestElement(e,"form")}static async loadJS(e){return new Promise(async r=>{const t=document.createElement("script");t.src=e,t.onload=()=>r(!0),t.onerror=()=>r(!0),document.head.appendChild(t)})}static async loadCSS(e){return new Promise(async r=>{const t=document.createElement("link");t.type="text/css",t.rel="stylesheet",t.href=e,t.onload=()=>r(!0),t.onerror=()=>r(!0),document.head.appendChild(t)})}},Ms=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,s="",r="long"){s||(s=pe.getLanguage());const t=(d,b)=>[Math.floor(d/b),d%b];function n(d,b,m){return new Intl.NumberFormat(d,{style:"unit",unit:b,unitDisplay:m}).format}const[o,a]=t(e,60),c=[];return o&&c.push(n(s,"hour",r)(o)),a&&c.push(n(s,"minute",r)(a)),new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(c)}static js(e){try{return Function("return "+e)()}catch{return""}}};function ns(i){return typeof i=="object"&&i!=null}const Fo=async()=>new Promise(i=>{window.queueMicrotask(()=>i(null))});var qe;let Ir=(qe=class{constructor(e,s){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_=e,this.parent=s||null,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e of this._proxies_.values())e.delete();this._invalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),qe.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_(e=!1){if(this._mutationListeners_.forEach(s=>s()),this._is_savable_&&!B.changed){B.changed=!0,B.saveId++;const s=B.saveId;setTimeout(()=>B.getInstance().saveToLocalStorage(s),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){this._assignmentId_++;const s=this._assignmentId_;if(await Fo(),s!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(t=>t(r)),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,s){this._fillListeners_.forEach(r=>{r[e]!==s&&(r[e]=s)}),this._publishTemplateFilling_(e,s)}_publishTemplateFilling_(e,s){this._templateFillListeners_.forEach(r=>{const t=Object.getOwnPropertyDescriptor(r,e);t&&!t.set&&!t.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==s&&(r[e]=s))})}onAssign(e,s=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),s&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const s in this._value_){let r=s;const t=this._value_[s];e.propertyMap&&e.propertyMap[s]&&(r=e.propertyMap[s]),typeof e[s]<"u"&&e[s]!==t&&(e[r]=t)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const s in this._value_){const r=this._value_[s];e[s]!==r&&(e[s]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}async set(e,s=!1){var n;if(this._value_===e||this._value_&&e&&Object.prototype.hasOwnProperty.call(this._value_,"__value")&&Object.prototype.hasOwnProperty.call(e,"__value")&&this._value_.__value===e.__value)return!0;const r=this._value_;if(this._value_=ns(e)?e:{__value:e},this._cachedGet_=void 0,Object.prototype.hasOwnProperty.call(this._value_,"__value"))return await this._publishAssignement_(s),!0;for(const o in this._value_)this._value_[o]===void 0&&delete this._value_[o];if(this._proxies_.forEach((o,a)=>{this._value_[a]===void 0&&a!="_parent_"&&r[a]&&(this._value_[a]=null)}),await this._publishAssignement_(),ns(this._value_))for(const o in this._value_){const a=e[o],d=ns(a)?a:{__value:a};if(!this._proxies_.has(o)){this._publishDynamicFilling_(o,a);continue}await((n=this._proxies_.get(o))==null?void 0:n.set(d,!0)),this._publishDynamicFilling_(o,a)}return!0}get(){if(this._cachedGet_!==void 0)return this._cachedGet_;if(B.modifiedCollectore.length>0&&B.modifiedCollectore[0].add(this),Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_}get $tag(){return this._instanceCounter_||(qe.instancesCounter++,this._instanceCounter_=qe.instancesCounter),qe.instances.set(this._instanceCounter_,this),'<reactive-publisher-proxy publisher="'+this._instanceCounter_+'"></reactive-publisher-proxy>'}},qe.instances=new Map,qe.instancesCounter=0,qe);var q;let B=(q=class{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],q.instance!=null)throw"Singleton / use getInstance";q.instance=this,this.isLocalStrorageReady=this.cleanStorageData()}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem("publisher-proxies-data"),t=null;if(r&&(t=await this.decompress(r,"gzip")),t)try{this.localStorageData=JSON.parse(t)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem("publisher-proxies-data",r),this.localStorageData={};const n=new Date().getTime()-1e3*60*60*12;for(const o in this.localStorageData)this.localStorageData[o].lastModifiationMS<n&&delete this.localStorageData[o];e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.log("no publisher cache in this browser")}})()})}static getInstance(){return q.instance==null?new q:q.instance}static get(e,s){return q.getInstance().get(e,s)}static collectModifiedPublisher(){q.modifiedCollectore.unshift(new Set)}static getModifiedPublishers(){return q.modifiedCollectore.shift()}static delete(e){return e?q.getInstance().delete(e):!1}async setLocalData(e,s){var r;await this.isLocalStrorageReady,e.set(((r=this.localStorageData[s+"¤lang_"+pe.getLanguage()])==null?void 0:r.data)||e.get())}get(e,s){const r=(s==null?void 0:s.localStorageMode)==="enabled";if(!this.publishers.has(e)){const n={},o=new hs(n);this.set(e,o)}const t=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(t._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(t,e)),this.publishers.get(e)}set(e,s){this.publishers.set(e,s)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==q.saveId&&e%10!=0))try{if(!q.changed||q.saving)return;q.saving=!0,q.changed=!1;const s=Array.from(this.publishers.keys());let r=!1;for(const t of s){const n=this.publishers.get(t);if(!(n!=null&&n._is_savable_))continue;const o=n==null?void 0:n.get();o&&(this.localStorageData[t+"¤lang_"+pe.getLanguage()]={lastModifiationMS:new Date().getTime(),data:o},r=!0)}if(r){const t=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem("publisher-proxies-data",t)}if(q.saving=!1,q.changed){q.saveId++;const t=q.saveId;setTimeout(()=>this.saveToLocalStorage(t),1e3)}}catch{q.saving=!1}}async compress(e,s){const r=new TextEncoder().encode(e),t=window,n=new t.CompressionStream(s),o=n.writable.getWriter();o.write(r),o.close();const a=await new Response(n.readable).arrayBuffer(),c=new Uint8Array(a);let d="";for(let b=0;b<c.length;b++)d+=String.fromCharCode(c[b]);return btoa(d)}async decompress(e,s){const r=atob(e),n=Uint8Array.from(r,b=>b.charCodeAt(0)).buffer,o=window,a=new o.DecompressionStream(s),c=a.writable.getWriter();c.write(n),c.close();const d=await new Response(a.readable).arrayBuffer();return new TextDecoder().decode(d)}},q.buildDate="Thu Apr 11 2024 15:43:26 GMT+0200 (Central European Summer Time)",q.changed=!1,q.saving=!1,q.saveId=0,q.instance=null,q.modifiedCollectore=[],q);const So=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 hs extends Ir{constructor(e,s=null){super(e,s);const r=new Proxy(this,{get:function(t,n){if(n==Symbol.toPrimitive)return()=>r.get();if(So.has(n))return t[n];if(!t._proxies_.has(n)){const o=t._value_[n],a=new hs(ns(o)?o:{__value:o},t);a._proxies_.set("_parent_",r),t._proxies_.set(n,a)}return t._proxies_.get(n)},set:function(t,n,o){var c;if(n=="_value_")return t._value_=o,!0;if(n=="_cachedGet_")return t._cachedGet_=o,!0;if(n=="_assignmentId_")return t._assignmentId_=o,!0;if(n=="_is_savable_")return t._is_savable_=o,!0;if(n=="_instanceCounter_")return t._instanceCounter_=o,!0;if(!t._proxies_.has(n)){const d=new hs({},t);d._proxies_.set("_parent_",r),t._proxies_.set(n,d)}return t._value_[n]!==o&&(t._value_[n]=o,t._publishDynamicFilling_(n,o),(c=t._proxies_.get(n))==null||c.set(ns(o)?o:{__value:o})),!0},deleteProperty:function(t,n){var o;return t._publishDynamicFilling_(n,null),(o=t._proxies_.get(n))==null||o.set(null),delete t._value_[n]},has:function(t,n){return n in t._value_&&n!="_lockInternalMutationPublishing_"},defineProperty:function(t,n,o){return o&&"value"in o&&(t._value_[n]=o.value),!0},getOwnPropertyDescriptor:function(t,n){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}});return r}toString(){return"hey"}valueOf(){return 2}getProperty(e,s){return e[s]}}class Po extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){var e;this.publisherId=this.getAttribute("publisher")||"",this.publisher=Ir.instances.get(parseInt(this.publisherId)),(e=this.publisher)==null||e.onAssign(this.onAssign)}disconnectedCallback(){var e;(e=this.publisher)==null||e.offAssign(this.onAssign)}}customElements.define("reactive-publisher-proxy",Po);var N;let ws=(N=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(N.observedElements.keys()).forEach(e=>N.unObserve(e)))}static observe(e){if(!e||!N.enabled||N.observedElements.has(e))return;const s=new MutationObserver(N.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],s.observe(e,r),e.querySelectorAll("[data-bind]").forEach(t=>N.addPublisherListeners(t)),N.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>N.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&N.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>N.addPublisherListeners(s)):e.childNodes.forEach(s=>N.onAdded(s))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&N.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>N.removePublisherListeners(s)):e.childNodes.forEach(s=>N.onRemoved(s))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":N.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach(r=>{N.onAdded(r)}),s.removedNodes.forEach(r=>{N.onRemoved(r)});break}}static removePublisherListeners(e){const s=N.publisherListeners.get(e);s&&(N.publisherListeners.delete(e),s.forEach(r=>{var t;(t=r.publisher)==null||t.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let s=e.match(/(\$(?:\w+\\?\.?)+)/g);return s?s=s.map(r=>r.replace("$","")):s=[e],s=s.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:s.map(r=>r.split(/\b\.\b/).map(t=>t.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(s=>s.name.indexOf("::")==0).map(s=>({propertyToUpdate:s.name.substring(2).replace(/-((html)|\w)/g,t=>t.substring(1).toUpperCase()),bindedVariablesDescriptor:N.getVariablesDescriptor(s.value)})):[]}static getSubPublisher(e,s){if(!s)return e;for(const r of s)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){N.removePublisherListeners(e);const s=pe.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!s)return;const r=B.getInstance().get(s),t=N.getDataBindItems(e),n=[];t.forEach(o=>{const a=o.bindedVariablesDescriptor,c=o.propertyToUpdate;for(const d of a.variables){const b=d;let m=r;m=N.getSubPublisher(r,b);const y=e,A={publisher:m,onAssign:()=>{const g=a.variables.map(x=>{var u;return(u=N.getSubPublisher(r,x))==null?void 0:u.get()});let f=a.expression,w=!1;if(g.length==1&&a.variables[0].join(".")==f.substring(1)){let x=g[0];x===null&&(x=""),y[c]=x;return}for(let x=0;x<g.length;x++){let u=g[x];const h=a.variables[x];u===null&&(w=!0,u=void 0),f=f.replace("$"+h.join("."),u)}if(f.indexOf("|")!=-1){const x=f.indexOf("|");if(x==0)f=Ms.js(f.substring(1));else{const u=f.substring(0,x),h=f.substring(x+1),p=Ms[u];f=w?"":p?p(h):f}}else f=w?"":f;y[c]=f}};m==null||m.onAssign(A.onAssign),n.push(A)}}),N.publisherListeners.set(e,n)}},N.observedElements=new Map,N.enabled=!0,N.publisherListeners=new Map,N);ws.observe(document.documentElement);window.SonicDataBindObserver||(window.SonicDataBindObserver=ws);let ne=class ht{static shallowEqual(e,s,r=!0){const t=Object.keys(e),n=Object.keys(s);if(t.length!==n.length&&r)return!1;for(const o of t){const a=e[o],c=s[o];if(r?a!==c:a!=c)return!1}return!0}static deepEqual(e,s,r=!0){const t=Object.keys(e),n=Object.keys(s);if(t.length!==n.length&&r)return!1;for(const o of t){const a=e[o],c=s[o],d=ht.isObject(a)&&ht.isObject(c),b=r?a!==c:a!=c;if(d&&!ht.deepEqual(a,c)||!d&&b)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ht.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,s,r=!1){for(const t of s){const n=e[t];if(n===void 0)return;r&&ht.isObject(n)?e=Object.assign(Array.isArray(n)?[]:{},e,n):e=e[t]}return e}static getURLSearchArray(e,s=""){let r=[];for(let t in e){const n=e[t];s&&(t=s+"["+t+"]"),ht.isObject(n)?r=[...r,...this.getURLSearchArray(n,t)]:r.push(`${t}=${n}`)}return r}static getURLSearchString(e){return ht.getURLSearchArray(e,"").join("&")}};/**
1
+ var Co=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Qh=Co((dd,kt)=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))r(t);new MutationObserver(t=>{for(const n of t)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function s(t){const n={};return t.integrity&&(n.integrity=t.integrity),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?n.credentials="include":t.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(t){if(t.ep)return;t.ep=!0;const n=s(t);fetch(t.href,n)}})();let pe=class Ue{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,s)=>{const r=s.indexOf("=");return e[s.substring(0,r).trim()]=s.substring(r+1),e},{})}static everyAncestors(e,s){for(;e;){if(!s(e))return;e=e.parentNode||e.host}}static getAncestorAttributeValue(e,s){if(!e)return null;for(;!("hasAttribute"in e&&e.hasAttribute(s))&&(e.parentNode||e.host);)e=e.parentNode||e.host;return"hasAttribute"in e?e.getAttribute(s):null}static getApiConfiguration(e){const s=Ue.getAncestorAttributeValue(e,"token"),r=Ue.getAncestorAttributeValue(e,"addHTTPResponse")!=null,t=Ue.getAncestorAttributeValue(e,"serviceURL");let n=null,o=null;const a=Ue.getAncestorAttributeValue(e,"tokenProvider"),c=Ue.getAncestorAttributeValue(e,"eventsApiToken");s||(n=Ue.getAncestorAttributeValue(e,"userName"),o=Ue.getAncestorAttributeValue(e,"password"));const d=Ue.getAncestorAttributeValue(e,"credentials")||void 0,b=e.getAttribute("cache"),m=e.hasAttribute("blockUntilDone");return{serviceURL:t,token:s,userName:n,password:o,authToken:c,tokenProvider:a,addHTTPResponse:r,credentials:d,cache:b,blockUntilDone:m}}static getClosestElement(e,s){for(;!(e.nodeName&&e.nodeName.toLowerCase()===s)&&(e.parentNode||e.host);)e=e.parentNode||e.host;return e.nodeName?e:null}static getClosestForm(e){return Ue.getClosestElement(e,"form")}static async loadJS(e){return new Promise(async r=>{const t=document.createElement("script");t.src=e,t.onload=()=>r(!0),t.onerror=()=>r(!0),document.head.appendChild(t)})}static async loadCSS(e){return new Promise(async r=>{const t=document.createElement("link");t.type="text/css",t.rel="stylesheet",t.href=e,t.onload=()=>r(!0),t.onerror=()=>r(!0),document.head.appendChild(t)})}},Ms=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,s="",r="long"){s||(s=pe.getLanguage());const t=(d,b)=>[Math.floor(d/b),d%b];function n(d,b,m){return new Intl.NumberFormat(d,{style:"unit",unit:b,unitDisplay:m}).format}const[o,a]=t(e,60),c=[];return o&&c.push(n(s,"hour",r)(o)),a&&c.push(n(s,"minute",r)(a)),new Intl.ListFormat(s,{style:"long",type:"conjunction"}).format(c)}static js(e){try{return Function("return "+e)()}catch{return""}}};function ns(i){return typeof i=="object"&&i!=null}const Fo=async()=>new Promise(i=>{window.queueMicrotask(()=>i(null))});var qe;let Ir=(qe=class{constructor(e,s){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_=e,this.parent=s||null,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e of this._proxies_.values())e.delete();this._invalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),qe.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_(e=!1){if(this._mutationListeners_.forEach(s=>s()),this._is_savable_&&!B.changed){B.changed=!0,B.saveId++;const s=B.saveId;setTimeout(()=>B.getInstance().saveToLocalStorage(s),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){this._assignmentId_++;const s=this._assignmentId_;if(await Fo(),s!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(t=>t(r)),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,s){this._fillListeners_.forEach(r=>{r[e]!==s&&(r[e]=s)}),this._publishTemplateFilling_(e,s)}_publishTemplateFilling_(e,s){this._templateFillListeners_.forEach(r=>{const t=Object.getOwnPropertyDescriptor(r,e);t&&!t.set&&!t.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==s&&(r[e]=s))})}onAssign(e,s=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),s&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const s in this._value_){let r=s;const t=this._value_[s];e.propertyMap&&e.propertyMap[s]&&(r=e.propertyMap[s]),typeof e[s]<"u"&&e[s]!==t&&(e[r]=t)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const s in this._value_){const r=this._value_[s];e[s]!==r&&(e[s]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}async set(e,s=!1){var n;if(this._value_===e||this._value_&&e&&Object.prototype.hasOwnProperty.call(this._value_,"__value")&&Object.prototype.hasOwnProperty.call(e,"__value")&&this._value_.__value===e.__value)return!0;const r=this._value_;if(this._value_=ns(e)?e:{__value:e},this._cachedGet_=void 0,Object.prototype.hasOwnProperty.call(this._value_,"__value"))return await this._publishAssignement_(s),!0;for(const o in this._value_)this._value_[o]===void 0&&delete this._value_[o];if(this._proxies_.forEach((o,a)=>{this._value_[a]===void 0&&a!="_parent_"&&r[a]&&(this._value_[a]=null)}),await this._publishAssignement_(),ns(this._value_))for(const o in this._value_){const a=e[o],d=ns(a)?a:{__value:a};if(!this._proxies_.has(o)){this._publishDynamicFilling_(o,a);continue}await((n=this._proxies_.get(o))==null?void 0:n.set(d,!0)),this._publishDynamicFilling_(o,a)}return!0}get(){if(this._cachedGet_!==void 0)return this._cachedGet_;if(B.modifiedCollectore.length>0&&B.modifiedCollectore[0].add(this),Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_}get $tag(){return this._instanceCounter_||(qe.instancesCounter++,this._instanceCounter_=qe.instancesCounter),qe.instances.set(this._instanceCounter_,this),'<reactive-publisher-proxy publisher="'+this._instanceCounter_+'"></reactive-publisher-proxy>'}},qe.instances=new Map,qe.instancesCounter=0,qe);var q;let B=(q=class{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],q.instance!=null)throw"Singleton / use getInstance";q.instance=this,this.isLocalStrorageReady=this.cleanStorageData()}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem("publisher-proxies-data"),t=null;if(r&&(t=await this.decompress(r,"gzip")),t)try{this.localStorageData=JSON.parse(t)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem("publisher-proxies-data",r),this.localStorageData={};const n=new Date().getTime()-1e3*60*60*12;for(const o in this.localStorageData)this.localStorageData[o].lastModifiationMS<n&&delete this.localStorageData[o];e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.log("no publisher cache in this browser")}})()})}static getInstance(){return q.instance==null?new q:q.instance}static get(e,s){return q.getInstance().get(e,s)}static collectModifiedPublisher(){q.modifiedCollectore.unshift(new Set)}static getModifiedPublishers(){return q.modifiedCollectore.shift()}static delete(e){return e?q.getInstance().delete(e):!1}async setLocalData(e,s){var r;await this.isLocalStrorageReady,e.set(((r=this.localStorageData[s+"¤lang_"+pe.getLanguage()])==null?void 0:r.data)||e.get())}get(e,s){const r=(s==null?void 0:s.localStorageMode)==="enabled";if(!this.publishers.has(e)){const n={},o=new hs(n);this.set(e,o)}const t=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(t._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(t,e)),this.publishers.get(e)}set(e,s){this.publishers.set(e,s)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==q.saveId&&e%10!=0))try{if(!q.changed||q.saving)return;q.saving=!0,q.changed=!1;const s=Array.from(this.publishers.keys());let r=!1;for(const t of s){const n=this.publishers.get(t);if(!(n!=null&&n._is_savable_))continue;const o=n==null?void 0:n.get();o&&(this.localStorageData[t+"¤lang_"+pe.getLanguage()]={lastModifiationMS:new Date().getTime(),data:o},r=!0)}if(r){const t=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem("publisher-proxies-data",t)}if(q.saving=!1,q.changed){q.saveId++;const t=q.saveId;setTimeout(()=>this.saveToLocalStorage(t),1e3)}}catch{q.saving=!1}}async compress(e,s){const r=new TextEncoder().encode(e),t=window,n=new t.CompressionStream(s),o=n.writable.getWriter();o.write(r),o.close();const a=await new Response(n.readable).arrayBuffer(),c=new Uint8Array(a);let d="";for(let b=0;b<c.length;b++)d+=String.fromCharCode(c[b]);return btoa(d)}async decompress(e,s){const r=atob(e),n=Uint8Array.from(r,b=>b.charCodeAt(0)).buffer,o=window,a=new o.DecompressionStream(s),c=a.writable.getWriter();c.write(n),c.close();const d=await new Response(a.readable).arrayBuffer();return new TextDecoder().decode(d)}},q.buildDate="Thu Apr 11 2024 15:54:25 GMT+0200 (Central European Summer Time)",q.changed=!1,q.saving=!1,q.saveId=0,q.instance=null,q.modifiedCollectore=[],q);const So=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 hs extends Ir{constructor(e,s=null){super(e,s);const r=new Proxy(this,{get:function(t,n){if(n==Symbol.toPrimitive)return()=>r.get();if(So.has(n))return t[n];if(!t._proxies_.has(n)){const o=t._value_[n],a=new hs(ns(o)?o:{__value:o},t);a._proxies_.set("_parent_",r),t._proxies_.set(n,a)}return t._proxies_.get(n)},set:function(t,n,o){var c;if(n=="_value_")return t._value_=o,!0;if(n=="_cachedGet_")return t._cachedGet_=o,!0;if(n=="_assignmentId_")return t._assignmentId_=o,!0;if(n=="_is_savable_")return t._is_savable_=o,!0;if(n=="_instanceCounter_")return t._instanceCounter_=o,!0;if(!t._proxies_.has(n)){const d=new hs({},t);d._proxies_.set("_parent_",r),t._proxies_.set(n,d)}return t._value_[n]!==o&&(t._value_[n]=o,t._publishDynamicFilling_(n,o),(c=t._proxies_.get(n))==null||c.set(ns(o)?o:{__value:o})),!0},deleteProperty:function(t,n){var o;return t._publishDynamicFilling_(n,null),(o=t._proxies_.get(n))==null||o.set(null),delete t._value_[n]},has:function(t,n){return n in t._value_&&n!="_lockInternalMutationPublishing_"},defineProperty:function(t,n,o){return o&&"value"in o&&(t._value_[n]=o.value),!0},getOwnPropertyDescriptor:function(t,n){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return t._value_.__value?Object.keys(t._value_.__value):Object.keys(t._value_)}});return r}toString(){return"hey"}valueOf(){return 2}getProperty(e,s){return e[s]}}class Po extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){var e;this.publisherId=this.getAttribute("publisher")||"",this.publisher=Ir.instances.get(parseInt(this.publisherId)),(e=this.publisher)==null||e.onAssign(this.onAssign)}disconnectedCallback(){var e;(e=this.publisher)==null||e.offAssign(this.onAssign)}}customElements.define("reactive-publisher-proxy",Po);var N;let ws=(N=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(N.observedElements.keys()).forEach(e=>N.unObserve(e)))}static observe(e){if(!e||!N.enabled||N.observedElements.has(e))return;const s=new MutationObserver(N.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],s.observe(e,r),e.querySelectorAll("[data-bind]").forEach(t=>N.addPublisherListeners(t)),N.observedElements.set(e,s)}static unObserve(e){if(!e)return;const s=this.observedElements.get(e);s&&(s.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>N.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&N.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>N.addPublisherListeners(s)):e.childNodes.forEach(s=>N.onAdded(s))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&N.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(s=>N.removePublisherListeners(s)):e.childNodes.forEach(s=>N.onRemoved(s))}static onMutation(e){for(const s of e)switch(s.type){case"attributes":N.addPublisherListeners(s.target);break;case"childList":s.addedNodes.forEach(r=>{N.onAdded(r)}),s.removedNodes.forEach(r=>{N.onRemoved(r)});break}}static removePublisherListeners(e){const s=N.publisherListeners.get(e);s&&(N.publisherListeners.delete(e),s.forEach(r=>{var t;(t=r.publisher)==null||t.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let s=e.match(/(\$(?:\w+\\?\.?)+)/g);return s?s=s.map(r=>r.replace("$","")):s=[e],s=s.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:s.map(r=>r.split(/\b\.\b/).map(t=>t.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(s=>s.name.indexOf("::")==0).map(s=>({propertyToUpdate:s.name.substring(2).replace(/-((html)|\w)/g,t=>t.substring(1).toUpperCase()),bindedVariablesDescriptor:N.getVariablesDescriptor(s.value)})):[]}static getSubPublisher(e,s){if(!s)return e;for(const r of s)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){N.removePublisherListeners(e);const s=pe.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!s)return;const r=B.getInstance().get(s),t=N.getDataBindItems(e),n=[];t.forEach(o=>{const a=o.bindedVariablesDescriptor,c=o.propertyToUpdate;for(const d of a.variables){const b=d;let m=r;m=N.getSubPublisher(r,b);const y=e,A={publisher:m,onAssign:()=>{const g=a.variables.map(x=>{var u;return(u=N.getSubPublisher(r,x))==null?void 0:u.get()});let f=a.expression,w=!1;if(g.length==1&&a.variables[0].join(".")==f.substring(1)){let x=g[0];x===null&&(x=""),y[c]=x;return}for(let x=0;x<g.length;x++){let u=g[x];const h=a.variables[x];u===null&&(w=!0,u=void 0),f=f.replace("$"+h.join("."),u)}if(f.indexOf("|")!=-1){const x=f.indexOf("|");if(x==0)f=Ms.js(f.substring(1));else{const u=f.substring(0,x),h=f.substring(x+1),p=Ms[u];f=w?"":p?p(h):f}}else f=w?"":f;y[c]=f}};m==null||m.onAssign(A.onAssign),n.push(A)}}),N.publisherListeners.set(e,n)}},N.observedElements=new Map,N.enabled=!0,N.publisherListeners=new Map,N);ws.observe(document.documentElement);window.SonicDataBindObserver||(window.SonicDataBindObserver=ws);let ne=class ht{static shallowEqual(e,s,r=!0){const t=Object.keys(e),n=Object.keys(s);if(t.length!==n.length&&r)return!1;for(const o of t){const a=e[o],c=s[o];if(r?a!==c:a!=c)return!1}return!0}static deepEqual(e,s,r=!0){const t=Object.keys(e),n=Object.keys(s);if(t.length!==n.length&&r)return!1;for(const o of t){const a=e[o],c=s[o],d=ht.isObject(a)&&ht.isObject(c),b=r?a!==c:a!=c;if(d&&!ht.deepEqual(a,c)||!d&&b)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ht.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,s,r=!1){for(const t of s){const n=e[t];if(n===void 0)return;r&&ht.isObject(n)?e=Object.assign(Array.isArray(n)?[]:{},e,n):e=e[t]}return e}static getURLSearchArray(e,s=""){let r=[];for(let t in e){const n=e[t];s&&(t=s+"["+t+"]"),ht.isObject(n)?r=[...r,...this.getURLSearchArray(n,t)]:r.push(`${t}=${n}`)}return r}static getURLSearchString(e){return ht.getURLSearchArray(e,"").join("&")}};/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
package/docs/index.html CHANGED
@@ -10,7 +10,7 @@
10
10
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
11
11
  <link href="https://fonts.cdnfonts.com/css/inter" rel="stylesheet" />
12
12
 
13
- <script type="module" crossorigin src="./assets/index-DWBLY4SP.js"></script>
13
+ <script type="module" crossorigin src="./assets/index-Ce3mr_lI.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="./assets/index--bDsd7qW.css">
15
15
  </head>
16
16
  <body class="px-6 lg:px-20">
@@ -20,7 +20,7 @@
20
20
  class="flex items-center gap-4 border-b-[.3rem] border-current py-3 sticky top-0 z-40 text-neutral-900 bg-neutral-0"
21
21
  >
22
22
  <div class="font-bold text-4xl">
23
- <sonic-link href="./">
23
+ <sonic-link href="#">
24
24
  <svg
25
25
  xmlns="http://www.w3.org/2000/svg"
26
26
  width="222.442"
@@ -102,7 +102,7 @@
102
102
  size="2xl"
103
103
  variant="outline"
104
104
  type="primary"
105
- href="./#docs/_getting-started/start.md/start"
105
+ href="#docs/_getting-started/start.md/start"
106
106
  >
107
107
  <sonic-icon
108
108
  name="airplane"
package/index.html CHANGED
@@ -20,7 +20,7 @@
20
20
  class="flex items-center gap-4 border-b-[.3rem] border-current py-3 sticky top-0 z-40 text-neutral-900 bg-neutral-0"
21
21
  >
22
22
  <div class="font-bold text-4xl">
23
- <sonic-link href="./">
23
+ <sonic-link href="#">
24
24
  <svg
25
25
  xmlns="http://www.w3.org/2000/svg"
26
26
  width="222.442"
@@ -102,7 +102,7 @@
102
102
  size="2xl"
103
103
  variant="outline"
104
104
  type="primary"
105
- href="./#docs/_getting-started/start.md/start"
105
+ href="#docs/_getting-started/start.md/start"
106
106
  >
107
107
  <sonic-icon
108
108
  name="airplane"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
@@ -21,8 +21,6 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@jest/globals": "^29.7.0",
24
- "@lit-labs/motion": "^1.0.7",
25
- "@lit-labs/observers": "^2.0.2",
26
24
  "@tailwindcss/typography": "^0.5.12",
27
25
  "@types/intl": "^1.2.2",
28
26
  "@types/jest": "^29.5.12",
@@ -37,7 +35,11 @@
37
35
  "rollup-plugin-postcss-lit": "^2.1.0",
38
36
  "tailwindcss": "^3.4.3",
39
37
  "typescript": "^5.4.3",
40
- "url-pattern": "^1.0.3",
41
38
  "vite": "^5.2.8"
39
+ },
40
+ "dependencies": {
41
+ "@lit-labs/motion": "^1.0.7",
42
+ "@lit-labs/observers": "^2.0.2",
43
+ "url-pattern": "^1.0.3"
42
44
  }
43
45
  }
@@ -1,16 +1,16 @@
1
- import {html, LitElement, nothing} from "lit";
2
- import {customElement, property} from "lit/decorators.js";
3
- import {repeat} from "lit/directives/repeat.js";
4
- import {animate} from "@lit-labs/motion";
1
+ import { html, LitElement, nothing } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ import { repeat } from "lit/directives/repeat.js";
4
+ import { animate } from "@lit-labs/motion";
5
5
  import Objects from "@supersoniks/concorde/core/utils/Objects";
6
6
  import "@supersoniks/concorde/core/components/ui/icon/icon";
7
- import {ifDefined} from "lit/directives/if-defined.js";
8
- import {unsafeHTML} from "lit/directives/unsafe-html.js";
9
- import {styleMap, StyleInfo} from "lit/directives/style-map.js";
7
+ import { ifDefined } from "lit/directives/if-defined.js";
8
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
9
+ import { styleMap, StyleInfo } from "lit/directives/style-map.js";
10
10
  import "@supersoniks/concorde/core/components/ui/toast/toast-item";
11
- import {Toast} from "@supersoniks/concorde/core/components/ui/toast/types";
12
- import {ConcordeWindow} from "@supersoniks/concorde/core/_types/types";
13
- import {Theme} from "@supersoniks/concorde/core/components/ui/theme/theme";
11
+ import { Toast } from "@supersoniks/concorde/core/components/ui/toast/types";
12
+ import { ConcordeWindow } from "@supersoniks/concorde/core/_types/types";
13
+ import { Theme } from "@supersoniks/concorde/core/components/ui/theme/theme";
14
14
 
15
15
  declare const window: ConcordeWindow;
16
16
 
@@ -18,7 +18,7 @@ const tagName = "sonic-toast";
18
18
 
19
19
  @customElement(tagName)
20
20
  export class SonicToast extends LitElement {
21
- @property({type: Array}) toasts: Toast[] = [];
21
+ @property({ type: Array }) toasts: Toast[] = [];
22
22
  static delegateToasts = false;
23
23
 
24
24
  createRenderRoot() {
@@ -71,7 +71,13 @@ export class SonicToast extends LitElement {
71
71
  duration: 250,
72
72
  easing: `cubic-bezier(0.250, 0.250, 0.420, 1.225)`,
73
73
  },
74
- in: [{transform: "translateY(0) scale(1.25)", boxShadow: "0 0 0 rgba(0,0,0,0)", opacity: 0}],
74
+ in: [
75
+ {
76
+ transform: "translateY(0) scale(1.25)",
77
+ boxShadow: "0 0 0 rgba(0,0,0,0)",
78
+ opacity: 0,
79
+ },
80
+ ],
75
81
  out: [
76
82
  {
77
83
  transform: "scale(.90) ",
@@ -94,7 +100,7 @@ export class SonicToast extends LitElement {
94
100
  static removeAll() {
95
101
  if (SonicToast.delegateToasts) {
96
102
  SonicToast.handleExistingToastDelegation();
97
- window.parent.postMessage({type: "removeAllToasts"}, "*");
103
+ window.parent.postMessage({ type: "removeAllToasts" }, "*");
98
104
  return;
99
105
  }
100
106
  const toastComponent: SonicToast = SonicToast.getInstance();
@@ -114,7 +120,7 @@ export class SonicToast extends LitElement {
114
120
  static add(conf: Toast) {
115
121
  if (SonicToast.delegateToasts) {
116
122
  SonicToast.handleExistingToastDelegation();
117
- window.parent.postMessage({type: "addToast", toast: conf}, "*");
123
+ window.parent.postMessage({ type: "addToast", toast: conf }, "*");
118
124
  return;
119
125
  }
120
126
  // Init toast area si absente (au <sonic-theme> ou <body< à défaut)
@@ -123,7 +129,9 @@ export class SonicToast extends LitElement {
123
129
  // Ajoute le toast à la liste
124
130
  const nextId = conf.id ?? new Date().valueOf();
125
131
 
126
- const interactiveRegExp = new RegExp("</a>|</.*?button>|</.*?input>|</.*?textarea>|</.*?select>");
132
+ const interactiveRegExp = new RegExp(
133
+ "</a>|</.*?button>|</.*?input>|</.*?textarea>|</.*?select>"
134
+ );
127
135
  const hasInteractive = interactiveRegExp.test(conf.text);
128
136
 
129
137
  const currentToast = {
@@ -146,11 +154,13 @@ export class SonicToast extends LitElement {
146
154
  }
147
155
 
148
156
  if (toastComponent?.toasts.length) {
149
- const toastA = {...currentToast};
157
+ const toastA = { ...currentToast };
150
158
  for (const toast of toastComponent.toasts) {
151
- const toastB = {...toast};
159
+ const toastB = { ...toast };
152
160
  toastA.id = toastB.id = 0;
153
- if (/*!currentToast.preserve && */ Objects.shallowEqual(toastA, toastB)) {
161
+ if (
162
+ /*!currentToast.preserve && */ Objects.shallowEqual(toastA, toastB)
163
+ ) {
154
164
  return null;
155
165
  }
156
166
  }
@@ -164,14 +174,20 @@ export class SonicToast extends LitElement {
164
174
  static handleExistingToastDelegation() {
165
175
  if (!this.delegateToasts) return;
166
176
  const toastComponent: SonicToast = SonicToast.getInstance();
167
- window.parent.postMessage({type: "addToasts", toasts: toastComponent.toasts}, "*");
177
+ window.parent.postMessage(
178
+ { type: "addToasts", toasts: toastComponent.toasts },
179
+ "*"
180
+ );
168
181
  toastComponent.toasts = [];
169
182
  }
170
183
 
171
184
  static removeItem(toastToRemove?: Toast) {
172
185
  if (SonicToast.delegateToasts) {
173
186
  SonicToast.handleExistingToastDelegation();
174
- window.parent.postMessage({type: "removeToast", toast: toastToRemove}, "*");
187
+ window.parent.postMessage(
188
+ { type: "removeToast", toast: toastToRemove },
189
+ "*"
190
+ );
175
191
  return;
176
192
  }
177
193
  const toastComponent: SonicToast = SonicToast.getInstance();
@@ -182,15 +198,18 @@ export class SonicToast extends LitElement {
182
198
  removeItem(toastToRemove?: Toast) {
183
199
  if (!toastToRemove) return;
184
200
  this.toasts = this.toasts.filter((toast) => {
185
- toast = {...toast};
201
+ toast = { ...toast };
186
202
  delete toast.id;
187
203
  return !Objects.shallowEqual(toast, toastToRemove, false);
188
204
  });
189
205
  }
190
206
  }
191
207
 
208
+ declare const __SONIC_PREFIX__: string;
192
209
  if (typeof window !== "undefined") {
193
- window.SonicToast = SonicToast;
210
+ if (__SONIC_PREFIX__ == "sonic") {
211
+ window.SonicToast = window.SonicToast || SonicToast;
212
+ }
194
213
  }
195
214
 
196
215
  /**
@@ -199,14 +218,17 @@ if (typeof window !== "undefined") {
199
218
  function handleIframeContexts() {
200
219
  const onPostMessage = (e: MessageEvent) => {
201
220
  if (e.data.type == "querySonicToastAvailability") {
202
- (e.source as Window).postMessage({type: "sonicToastAvailable"}, "*");
221
+ (e.source as Window).postMessage({ type: "sonicToastAvailable" }, "*");
203
222
  }
204
223
  if (e.data.type == "sonicToastAvailable") {
205
224
  SonicToast.delegateToasts = true;
206
225
  SonicToast.handleExistingToastDelegation();
207
226
  }
208
227
  if (e.data.type == "addToasts") {
209
- SonicToast.getInstance().toasts = [...SonicToast.getInstance().toasts, ...e.data.toasts];
228
+ SonicToast.getInstance().toasts = [
229
+ ...SonicToast.getInstance().toasts,
230
+ ...e.data.toasts,
231
+ ];
210
232
  }
211
233
  if (e.data.type == "removeAllToasts") {
212
234
  SonicToast.removeAll();
@@ -223,14 +245,14 @@ function handleIframeContexts() {
223
245
  window.addEventListener("message", onPostMessage, false);
224
246
 
225
247
  if (isIframe) {
226
- window.parent.postMessage({type: "querySonicToastAvailability"}, "*");
248
+ window.parent.postMessage({ type: "querySonicToastAvailability" }, "*");
227
249
  }
228
250
 
229
251
  // tell iframes that sonic-toast is available
230
252
 
231
253
  if (!isIframe) {
232
254
  for (const iframe of document.querySelectorAll("iframe")) {
233
- iframe.contentWindow?.postMessage({type: "sonicToastAvailable"}, "*");
255
+ iframe.contentWindow?.postMessage({ type: "sonicToastAvailable" }, "*");
234
256
  }
235
257
  }
236
258
  }
package/src/core/core.ts CHANGED
@@ -2,13 +2,9 @@ import "./components/functional/functional";
2
2
  import "./components/ui/ui";
3
3
  import "./mixins/mixins";
4
4
  import "./utils/url-pattern";
5
- import {PublisherManager} from "@supersoniks/concorde/core/utils/PublisherProxy";
6
- import DataBindObserver from "./utils/DataBindObserver";
7
- import {ConcordeWindow} from "./_types/types";
5
+ import { ConcordeWindow } from "./_types/types";
8
6
 
9
7
  declare const window: ConcordeWindow;
10
- if (!window.SonicPublisherManager) window.SonicPublisherManager = PublisherManager;
11
- if (!window.SonicDataBindObserver) window.SonicDataBindObserver = DataBindObserver;
12
8
  window.queueMicrotask =
13
9
  window.queueMicrotask ||
14
10
  function (callback) {
@@ -85,6 +85,8 @@ const Fetcher = <
85
85
  }
86
86
  _endPoint = "";
87
87
 
88
+ @property() noErrorsRecordings = false;
89
+
88
90
  @property() get props(): (PropsType & ResultTypeInterface) | null {
89
91
  return super.props as (PropsType & ResultTypeInterface) | null;
90
92
  }
@@ -146,7 +148,9 @@ const Fetcher = <
146
148
 
147
149
  this.fetchedData = data;
148
150
  if (this.api.lastResult && !this.api.lastResult.ok) {
149
- fetchersInError.add(this);
151
+ if (!this.noErrorsRecordings) {
152
+ fetchersInError.add(this);
153
+ }
150
154
  dispatchFetchError(this.api.lastResult);
151
155
  }
152
156
  if (!this.isConnected) {
@@ -1,12 +1,18 @@
1
- import {APIConfiguration} from "@supersoniks/concorde/core/utils/api";
1
+ import { APIConfiguration } from "@supersoniks/concorde/core/utils/api";
2
2
  import DataBindObserver from "@supersoniks/concorde/core/utils/DataBindObserver";
3
3
  import HTML from "@supersoniks/concorde/core/utils/HTML";
4
4
  import Objects from "@supersoniks/concorde/core/utils/Objects";
5
- import {PublisherManager} from "@supersoniks/concorde/core/utils/PublisherProxy";
6
- import {LitElement, PropertyValues} from "lit";
7
- import {property} from "lit/decorators.js";
5
+ import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
6
+ import { LitElement, PropertyValues } from "lit";
7
+ import { property } from "lit/decorators.js";
8
8
  import WordingDirective from "../directives/Wording";
9
- import {PublisherInterface, TypeAndRecordOfType, ConcordeWindow, MixinArgsType, CoreJSType} from "@supersoniks/concorde/core/_types/types";
9
+ import {
10
+ PublisherInterface,
11
+ TypeAndRecordOfType,
12
+ ConcordeWindow,
13
+ MixinArgsType,
14
+ CoreJSType,
15
+ } from "@supersoniks/concorde/core/_types/types";
10
16
  declare const window: ConcordeWindow;
11
17
  type Constructor<T> = new (...args: MixinArgsType[]) => T;
12
18
  let keepDebugOnMouseOut = false;
@@ -29,8 +35,16 @@ export interface SubscriberInterface<PropsType = CoreJSType> {
29
35
  shadowRoot?: ShadowRoot;
30
36
  dispatchEvent(event: Event): void;
31
37
  setAttribute(name: string, value: string): void;
32
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
33
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
38
+ addEventListener(
39
+ type: string,
40
+ listener: EventListenerOrEventListenerObject,
41
+ options?: boolean | AddEventListenerOptions
42
+ ): void;
43
+ removeEventListener(
44
+ type: string,
45
+ listener: EventListenerOrEventListenerObject,
46
+ options?: boolean | EventListenerOptions
47
+ ): void;
34
48
  removeAttribute(name: string): void;
35
49
  initPublisher(): void;
36
50
  getApiConfiguration(): APIConfiguration;
@@ -42,7 +56,10 @@ export interface SubscriberInterface<PropsType = CoreJSType> {
42
56
  getBoundingClientRect(): DOMRect;
43
57
  }
44
58
 
45
- const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> = Constructor<LitElement>>(
59
+ const Subscriber = <
60
+ PropsType = CoreJSType,
61
+ T extends Constructor<LitElement> = Constructor<LitElement>
62
+ >(
46
63
  superClass: T,
47
64
  type?: PropsType
48
65
  ) => {
@@ -62,16 +79,16 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
62
79
  args;
63
80
  }
64
81
 
65
- @property({type: Number}) collectDependenciesVersion = 0;
82
+ @property({ type: Number }) collectDependenciesVersion = 0;
66
83
 
67
- @property({type: Boolean}) displayContents = false;
84
+ @property({ type: Boolean }) displayContents = false;
68
85
 
69
86
  /**
70
87
  * noAutoFill permet de désactiver le remplissage automatique des propriétés par le publisher dans le cas ou on utilise "props" seulement ou le dataBinding par exemple
71
88
  */
72
- @property({type: Boolean}) noAutoFill = false;
89
+ @property({ type: Boolean }) noAutoFill = false;
73
90
 
74
- @property({type: Boolean}) forceAutoFill = false;
91
+ @property({ type: Boolean }) forceAutoFill = false;
75
92
 
76
93
  /**
77
94
  * Passer ce paramètre à true permet de ne pas mettre à jour le composant lors d'un changement de interne de la propriété nommé props.
@@ -88,8 +105,8 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
88
105
  * Permet de mapper un nom de propriété de donnée source vars une propriété du subscriber à la volée
89
106
  */
90
107
 
91
- @property({type: Object}) propertyMap: object | null = null;
92
- @property({type: String, attribute: "data-title"}) title = "";
108
+ @property({ type: Object }) propertyMap: object | null = null;
109
+ @property({ type: String, attribute: "data-title" }) title = "";
93
110
 
94
111
  /**
95
112
  * va de parent en parent pour trouver un attribut
@@ -111,13 +128,14 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
111
128
  /**
112
129
  * L'id / l'adresse du publisher accessible via PublisherManager.get(dataProvider)
113
130
  */
114
- @property({reflect: true}) dataProvider: string | null = null;
131
+ @property({ reflect: true }) dataProvider: string | null = null;
115
132
 
116
133
  /**
117
134
  * On peut utiliser cette fonction pour lier un publisher spécifique au composant si besoin.
118
135
  * voir l'utilisation dans list.ts
119
136
  */
120
- @property() bindPublisher: (() => PublisherInterface<PropsType>) | null = null;
137
+ @property() bindPublisher: (() => PublisherInterface<PropsType>) | null =
138
+ null;
121
139
 
122
140
  /**
123
141
  * Les props du composant.
@@ -131,7 +149,10 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
131
149
  return this.publisher.get();
132
150
  }
133
151
  set props(value) {
134
- if (typeof value == "string" && ["{", "["].includes(value.trim().charAt(0))) {
152
+ if (
153
+ typeof value == "string" &&
154
+ ["{", "["].includes(value.trim().charAt(0))
155
+ ) {
135
156
  value = JSON.parse(value);
136
157
  }
137
158
  if (value == this._props) return;
@@ -148,8 +169,14 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
148
169
  protected updated(_changedProperties: PropertyValues): void {
149
170
  super.updated(_changedProperties);
150
171
  const ref = this.shadowRoot || this;
151
- const children = [...ref.children].filter((child) => child.tagName != "STYLE");
152
- const display = this.displayContents ? "contents" : children.length == 0 ? "none" : null;
172
+ const children = [...ref.children].filter(
173
+ (child) => child.tagName != "STYLE"
174
+ );
175
+ const display = this.displayContents
176
+ ? "contents"
177
+ : children.length == 0
178
+ ? "none"
179
+ : null;
153
180
  if (display) this.style.display = display;
154
181
  else this.style.removeProperty("display");
155
182
  }
@@ -243,7 +270,11 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
243
270
  if (!keepDebugOnMouseOut) this.removeDebugger();
244
271
  });
245
272
  this.publisher?.onInternalMutation(() => {
246
- (this.debug as HTMLElement).innerHTML = `🤖 DataProvider : "<b style="font-weight:bold;color:#fff;">${this.dataProvider}</b>"<br>
273
+ (
274
+ this.debug as HTMLElement
275
+ ).innerHTML = `🤖 DataProvider : "<b style="font-weight:bold;color:#fff;">${
276
+ this.dataProvider
277
+ }</b>"<br>
247
278
  <div style="font-size:10px;border-top:1px dashed;margin-top:5px;padding-left:23px;opacity:.6;padding-top:5px;">
248
279
  Variable disponible dans la console<br>
249
280
  ctrl + Clique : épingler / désépingler
@@ -313,21 +344,27 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
313
344
  if (this.onAssign) this.publisher.offAssign(this.onAssign);
314
345
  }
315
346
  const mng = PublisherManager.getInstance();
316
- if (!this.dataProvider) this.dataProvider = this.getAncestorAttributeValue("dataProvider");
347
+ if (!this.dataProvider)
348
+ this.dataProvider = this.getAncestorAttributeValue("dataProvider");
317
349
  let publisherId = this.dataProvider;
318
350
  if (!publisherId && this._props) {
319
- this.dataProvider = publisherId = "__subscriber__" + SubscriberElement.instanceCounter;
351
+ this.dataProvider = publisherId =
352
+ "__subscriber__" + SubscriberElement.instanceCounter;
320
353
  }
321
354
  if (publisherId) {
322
355
  if (this.bindPublisher) {
323
356
  mng.set(publisherId, this.bindPublisher());
324
357
  }
325
358
 
326
- let pub = mng.get(publisherId, {localStorageMode: this.getAttribute("localStorage") || "disabled"});
359
+ let pub = mng.get(publisherId, {
360
+ localStorageMode: this.getAttribute("localStorage") || "disabled",
361
+ });
327
362
  this.dataProvider = publisherId;
328
363
 
329
364
  if (this.hasAttribute("subDataProvider")) {
330
- const dataPath: string = this.getAttribute("subDataProvider") as string;
365
+ const dataPath: string = this.getAttribute(
366
+ "subDataProvider"
367
+ ) as string;
331
368
  this.dataProvider = publisherId + "/" + dataPath;
332
369
  pub = Objects.traverse(pub, dataPath.split("."));
333
370
  mng.set(this.dataProvider, pub);
@@ -340,7 +377,8 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
340
377
  this.publisher.set(this._props);
341
378
  }
342
379
  if (!this.noAutoFill) this.publisher.startTemplateFilling(this);
343
- if (this.renderOnPropsInternalChange) this.publisher.onInternalMutation(this.requestUpdate);
380
+ if (this.renderOnPropsInternalChange)
381
+ this.publisher.onInternalMutation(this.requestUpdate);
344
382
  this.publisher.onAssign(this.onAssign);
345
383
  }
346
384
  }
@@ -348,5 +386,3 @@ const Subscriber = <PropsType = CoreJSType, T extends Constructor<LitElement> =
348
386
  return SubscriberElement as Constructor<SubscriberInterface<PropsType>> & T;
349
387
  };
350
388
  export default Subscriber;
351
-
352
- if (!window.SonicPublisherManager) window.SonicPublisherManager = PublisherManager;