@everymatrix/general-styling-wrapper 1.85.17 → 1.85.18

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.
@@ -59,6 +59,8 @@ function setClientStyling(stylingContainer, clientStyling) {
59
59
  * @param {string} clientStylingUrl The URL of the style content
60
60
  */
61
61
  function setClientStylingURL(stylingContainer, clientStylingUrl) {
62
+ if (!stylingContainer || !clientStylingUrl) return;
63
+
62
64
  const url = new URL(clientStylingUrl);
63
65
 
64
66
  fetch(url.href)
@@ -55,6 +55,8 @@ function setClientStyling(stylingContainer, clientStyling) {
55
55
  * @param {string} clientStylingUrl The URL of the style content
56
56
  */
57
57
  function setClientStylingURL(stylingContainer, clientStylingUrl) {
58
+ if (!stylingContainer || !clientStylingUrl) return;
59
+
58
60
  const url = new URL(clientStylingUrl);
59
61
 
60
62
  fetch(url.href)
@@ -1 +1 @@
1
- import{r as t,h as i,g as e}from"./index-7ef90fae.js";function n(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function s(t,i){const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const o=class{constructor(i){t(this,i),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,i){if(window.emMessageBus){const e=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{e.innerHTML=i,t&&t.appendChild(e)}))}}(this.el,`${this.mbSource}.Style`):(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&s(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(t,i){t!=i&&n(this.el,this.clientStyling)}handleClientStylingUrlChange(t,i){t!=i&&this.clientStylingUrl&&s(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&s(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const t=[];if(this.translationUrl){const n=(i=this.translationUrl,e=this.targetTranslations,new Promise((t=>{fetch(i).then((t=>t.json())).then((i=>{Object.keys(i).forEach((t=>{e[t]=e[t]||{},Object.keys(i[t]).forEach((n=>{if(!e.en[n])return;const s=e.en[n];"object"==typeof i[t][n]?(e[t][n]=e[t][n]||Object.assign({},s),Object.keys(i[t][n]).forEach((s=>{e[t][n][s]=i[t][n][s]}))):e[t][n]=i[t][n]||Object.assign({},s)}))})),t(!0)})).catch((i=>{console.error("Failed to load translations:",i),t(!1)}))})));t.push(n)}var i,e;return await Promise.all(t)}render(){return i("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},i("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return e(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};o.style=":host{display:block}";export{o as general_styling_wrapper}
1
+ import{r as t,h as i,g as e}from"./index-7ef90fae.js";function n(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function s(t,i){if(!t||!i)return;const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const o=class{constructor(i){t(this,i),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,i){if(window.emMessageBus){const e=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{e.innerHTML=i,t&&t.appendChild(e)}))}}(this.el,`${this.mbSource}.Style`):(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&s(this.el,this.clientStylingUrl),this.stylingAppends=!0))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleClientStylingChange(t,i){t!=i&&n(this.el,this.clientStyling)}handleClientStylingUrlChange(t,i){t!=i&&this.clientStylingUrl&&s(this.el,this.clientStylingUrl)}componentDidRender(){this.stylingAppends||(this.clientStyling&&n(this.el,this.clientStyling),this.clientStylingUrl&&s(this.el,this.clientStylingUrl),this.stylingAppends=!0)}async componentWillLoad(){const t=[];if(this.translationUrl){const n=(i=this.translationUrl,e=this.targetTranslations,new Promise((t=>{fetch(i).then((t=>t.json())).then((i=>{Object.keys(i).forEach((t=>{e[t]=e[t]||{},Object.keys(i[t]).forEach((n=>{if(!e.en[n])return;const s=e.en[n];"object"==typeof i[t][n]?(e[t][n]=e[t][n]||Object.assign({},s),Object.keys(i[t][n]).forEach((s=>{e[t][n][s]=i[t][n][s]}))):e[t][n]=i[t][n]||Object.assign({},s)}))})),t(!0)})).catch((i=>{console.error("Failed to load translations:",i),t(!1)}))})));t.push(n)}var i,e;return await Promise.all(t)}render(){return i("div",{key:"09ad83748bbad518743c8671b986c541c52bf3f0",class:"StyleShell"},i("slot",{key:"3b28b776d3944410c717b002b70946d274a4e8e7",name:"mainContent"}))}get el(){return e(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};o.style=":host{display:block}";export{o as general_styling_wrapper}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-styling-wrapper",
3
- "version": "1.85.17",
3
+ "version": "1.85.18",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",