@everymatrix/general-styling-wrapper 1.88.5 → 1.88.7

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.
@@ -136,7 +136,7 @@ function getAdoptStyleSubscription(stylingContainer, domain) {
136
136
 
137
137
  const shadowRoot = stylingContainer.getRootNode();
138
138
  const cacheStyleObject = window[StyleCacheKey];
139
- let cachedStyle = cacheStyleObject[domain]?.sheet;
139
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
140
140
 
141
141
  if (!cachedStyle) {
142
142
  cachedStyle = new CSSStyleSheet();
@@ -132,7 +132,7 @@ function getAdoptStyleSubscription(stylingContainer, domain) {
132
132
 
133
133
  const shadowRoot = stylingContainer.getRootNode();
134
134
  const cacheStyleObject = window[StyleCacheKey];
135
- let cachedStyle = cacheStyleObject[domain]?.sheet;
135
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
136
136
 
137
137
  if (!cachedStyle) {
138
138
  cachedStyle = new CSSStyleSheet();
@@ -1 +1 @@
1
- import{r as t,h as n,g as e}from"./index-7ef90fae.js";const i="__WIDGET_GLOBAL_STYLE_CACHE__";function s(t,n){if(t){const e=document.createElement("style");e.innerHTML=n,t.appendChild(e)}}function o(t,n){if(!t||!n)return;const e=new URL(n);fetch(e.href).then((t=>t.text())).then((n=>{const e=document.createElement("style");e.innerHTML=n,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const h=class{constructor(n){t(this,n),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?function(t,n,e,s=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!s)return function(t,n){const e=document.createElement("style");return window.emMessageBus.subscribe(n,(n=>{t&&(e.innerHTML=n,t.appendChild(e))}))}(t,n);window[i]||(window[i]={});const o=(e=function(t,n){return window.emMessageBus.subscribe(n,(e=>{if(!t)return;const s=t.getRootNode(),o=window[i];let h=o[n]?.sheet;h?o[n].refCount=o[n].refCount+1:(h=new CSSStyleSheet,h.replaceSync(e),o[n]={sheet:h,refCount:1});const c=s.adoptedStyleSheets||[];c.includes(h)||(s.adoptedStyleSheets=[...c,h])}))}(t,n)).unsubscribe.bind(e);e.unsubscribe=()=>{if(window[i][n]){const t=window[i][n];t.refCount>1?t.refCount=t.refCount-1:delete window[i][n]}o()}}(this.el,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&s(this.el,this.clientStyling),this.clientStylingUrl&&o(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(t,n){t!=n&&s(this.el,this.clientStyling)}handleClientStylingUrlChange(t,n){t!=n&&this.clientStylingUrl&&o(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&s(this.el,this.clientStyling),this.clientStylingUrl&&o(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const t=[];if(this.translationUrl){const i=(n=this.translationUrl,e=this.targetTranslations,new Promise((t=>{fetch(n).then((t=>t.json())).then((n=>{Object.keys(n).forEach((t=>{e[t]=e[t]||{},Object.keys(n[t]).forEach((i=>{if(!e.en[i])return;const s=e.en[i];"object"==typeof n[t][i]?(e[t][i]=e[t][i]||Object.assign({},s),Object.keys(n[t][i]).forEach((s=>{e[t][i][s]=n[t][i][s]}))):e[t][i]=n[t][i]||Object.assign({},s)}))})),t(!0)})).catch((n=>{console.error("Failed to load translations:",n),t(!1)}))})));t.push(i)}var n,e;return await Promise.all(t)}render(){return n("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},n("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return e(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};h.style=":host{display:block}";export{h as general_styling_wrapper}
1
+ import{r as t,h as n,g as e}from"./index-7ef90fae.js";const i="__WIDGET_GLOBAL_STYLE_CACHE__";function s(t,n){if(t){const e=document.createElement("style");e.innerHTML=n,t.appendChild(e)}}function o(t,n){if(!t||!n)return;const e=new URL(n);fetch(e.href).then((t=>t.text())).then((n=>{const e=document.createElement("style");e.innerHTML=n,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const h=class{constructor(n){t(this,n),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(null!=window.emMessageBus?function(t,n,e,s=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!s)return function(t,n){const e=document.createElement("style");return window.emMessageBus.subscribe(n,(n=>{t&&(e.innerHTML=n,t.appendChild(e))}))}(t,n);window[i]||(window[i]={});const o=(e=function(t,n){return window.emMessageBus.subscribe(n,(e=>{if(!t)return;const s=t.getRootNode(),o=window[i];let h=o[n]&&o[n].sheet;h?o[n].refCount=o[n].refCount+1:(h=new CSSStyleSheet,h.replaceSync(e),o[n]={sheet:h,refCount:1});const c=s.adoptedStyleSheets||[];c.includes(h)||(s.adoptedStyleSheets=[...c,h])}))}(t,n)).unsubscribe.bind(e);e.unsubscribe=()=>{if(window[i][n]){const t=window[i][n];t.refCount>1?t.refCount=t.refCount-1:delete window[i][n]}o()}}(this.el,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&s(this.el,this.clientStyling),this.clientStylingUrl&&o(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(t,n){t!=n&&s(this.el,this.clientStyling)}handleClientStylingUrlChange(t,n){t!=n&&this.clientStylingUrl&&o(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&s(this.el,this.clientStyling),this.clientStylingUrl&&o(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const t=[];if(this.translationUrl){const i=(n=this.translationUrl,e=this.targetTranslations,new Promise((t=>{fetch(n).then((t=>t.json())).then((n=>{Object.keys(n).forEach((t=>{e[t]=e[t]||{},Object.keys(n[t]).forEach((i=>{if(!e.en[i])return;const s=e.en[i];"object"==typeof n[t][i]?(e[t][i]=e[t][i]||Object.assign({},s),Object.keys(n[t][i]).forEach((s=>{e[t][i][s]=n[t][i][s]}))):e[t][i]=n[t][i]||Object.assign({},s)}))})),t(!0)})).catch((n=>{console.error("Failed to load translations:",n),t(!1)}))})));t.push(i)}var n,e;return await Promise.all(t)}render(){return n("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},n("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return e(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};h.style=":host{display:block}";export{h as general_styling_wrapper}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-styling-wrapper",
3
- "version": "1.88.5",
3
+ "version": "1.88.7",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",