@everymatrix/general-styling-wrapper 1.94.17 → 1.94.19

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.
@@ -171,21 +171,23 @@ const GeneralStylingWrapper = class {
171
171
  }
172
172
  componentDidLoad() {
173
173
  if (this.el) {
174
- if (window.emMessageBus != undefined) {
174
+ if (this.mbSource)
175
175
  setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
176
- }
177
- else {
178
- if (this.clientStyling)
179
- setClientStyling(this.el, this.clientStyling);
180
- if (this.clientStylingUrl)
181
- setClientStylingURL(this.el, this.clientStylingUrl);
182
- this.stylingAppends = true;
183
- }
176
+ if (this.clientStyling)
177
+ setClientStyling(this.el, this.clientStyling);
178
+ if (this.clientStylingUrl)
179
+ setClientStylingURL(this.el, this.clientStylingUrl);
180
+ this.stylingAppends = true;
184
181
  }
185
182
  }
186
183
  disconnectedCallback() {
187
184
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
188
185
  }
186
+ handleMbSourceChange(newValue, oldValue) {
187
+ if (newValue != oldValue) {
188
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
189
+ }
190
+ }
189
191
  handleClientStylingChange(newValue, oldValue) {
190
192
  if (newValue != oldValue) {
191
193
  setClientStyling(this.el, this.clientStyling);
@@ -217,10 +219,11 @@ const GeneralStylingWrapper = class {
217
219
  return await Promise.all(promises);
218
220
  }
219
221
  render() {
220
- return (index.h("div", { key: '09ad83748bbad518743c8671b986c541c52bf3f0', class: "StyleShell" }, index.h("slot", { key: '3b28b776d3944410c717b002b70946d274a4e8e7', name: "mainContent" })));
222
+ return (index.h("div", { key: 'e660ceb69f5e848c788c3924fc814c0fa7a777a2', class: "StyleShell" }, index.h("slot", { key: '35014b6c0c32532af11e6a629ba9b13942504d21', name: "mainContent" })));
221
223
  }
222
224
  get el() { return index.getElement(this); }
223
225
  static get watchers() { return {
226
+ "mbSource": ["handleMbSourceChange"],
224
227
  "clientStyling": ["handleClientStylingChange"],
225
228
  "clientStylingUrl": ["handleClientStylingUrlChange"]
226
229
  }; }
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["general-styling-wrapper.cjs",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
22
+ return index.bootstrapLazy([["general-styling-wrapper.cjs",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"mbSource":["handleMbSourceChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["general-styling-wrapper.cjs",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
11
+ return index.bootstrapLazy([["general-styling-wrapper.cjs",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"mbSource":["handleMbSourceChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -12,21 +12,23 @@ export class GeneralStylingWrapper {
12
12
  }
13
13
  componentDidLoad() {
14
14
  if (this.el) {
15
- if (window.emMessageBus != undefined) {
15
+ if (this.mbSource)
16
16
  setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
17
- }
18
- else {
19
- if (this.clientStyling)
20
- setClientStyling(this.el, this.clientStyling);
21
- if (this.clientStylingUrl)
22
- setClientStylingURL(this.el, this.clientStylingUrl);
23
- this.stylingAppends = true;
24
- }
17
+ if (this.clientStyling)
18
+ setClientStyling(this.el, this.clientStyling);
19
+ if (this.clientStylingUrl)
20
+ setClientStylingURL(this.el, this.clientStylingUrl);
21
+ this.stylingAppends = true;
25
22
  }
26
23
  }
27
24
  disconnectedCallback() {
28
25
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
29
26
  }
27
+ handleMbSourceChange(newValue, oldValue) {
28
+ if (newValue != oldValue) {
29
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
30
+ }
31
+ }
30
32
  handleClientStylingChange(newValue, oldValue) {
31
33
  if (newValue != oldValue) {
32
34
  setClientStyling(this.el, this.clientStyling);
@@ -58,7 +60,7 @@ export class GeneralStylingWrapper {
58
60
  return await Promise.all(promises);
59
61
  }
60
62
  render() {
61
- return (h("div", { key: '09ad83748bbad518743c8671b986c541c52bf3f0', class: "StyleShell" }, h("slot", { key: '3b28b776d3944410c717b002b70946d274a4e8e7', name: "mainContent" })));
63
+ return (h("div", { key: 'e660ceb69f5e848c788c3924fc814c0fa7a777a2', class: "StyleShell" }, h("slot", { key: '35014b6c0c32532af11e6a629ba9b13942504d21', name: "mainContent" })));
62
64
  }
63
65
  static get is() { return "general-styling-wrapper"; }
64
66
  static get originalStyleUrls() {
@@ -170,6 +172,9 @@ export class GeneralStylingWrapper {
170
172
  static get elementRef() { return "el"; }
171
173
  static get watchers() {
172
174
  return [{
175
+ "propName": "mbSource",
176
+ "methodName": "handleMbSourceChange"
177
+ }, {
173
178
  "propName": "clientStyling",
174
179
  "methodName": "handleClientStylingChange"
175
180
  }, {
@@ -167,21 +167,23 @@ const GeneralStylingWrapper = class {
167
167
  }
168
168
  componentDidLoad() {
169
169
  if (this.el) {
170
- if (window.emMessageBus != undefined) {
170
+ if (this.mbSource)
171
171
  setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
172
- }
173
- else {
174
- if (this.clientStyling)
175
- setClientStyling(this.el, this.clientStyling);
176
- if (this.clientStylingUrl)
177
- setClientStylingURL(this.el, this.clientStylingUrl);
178
- this.stylingAppends = true;
179
- }
172
+ if (this.clientStyling)
173
+ setClientStyling(this.el, this.clientStyling);
174
+ if (this.clientStylingUrl)
175
+ setClientStylingURL(this.el, this.clientStylingUrl);
176
+ this.stylingAppends = true;
180
177
  }
181
178
  }
182
179
  disconnectedCallback() {
183
180
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
184
181
  }
182
+ handleMbSourceChange(newValue, oldValue) {
183
+ if (newValue != oldValue) {
184
+ setStreamStyling(this.el, `${this.mbSource}.Style`, this.stylingSubscription);
185
+ }
186
+ }
185
187
  handleClientStylingChange(newValue, oldValue) {
186
188
  if (newValue != oldValue) {
187
189
  setClientStyling(this.el, this.clientStyling);
@@ -213,10 +215,11 @@ const GeneralStylingWrapper = class {
213
215
  return await Promise.all(promises);
214
216
  }
215
217
  render() {
216
- return (h("div", { key: '09ad83748bbad518743c8671b986c541c52bf3f0', class: "StyleShell" }, h("slot", { key: '3b28b776d3944410c717b002b70946d274a4e8e7', name: "mainContent" })));
218
+ return (h("div", { key: 'e660ceb69f5e848c788c3924fc814c0fa7a777a2', class: "StyleShell" }, h("slot", { key: '35014b6c0c32532af11e6a629ba9b13942504d21', name: "mainContent" })));
217
219
  }
218
220
  get el() { return getElement(this); }
219
221
  static get watchers() { return {
222
+ "mbSource": ["handleMbSourceChange"],
220
223
  "clientStyling": ["handleClientStylingChange"],
221
224
  "clientStylingUrl": ["handleClientStylingUrlChange"]
222
225
  }; }
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["general-styling-wrapper",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
19
+ return bootstrapLazy([["general-styling-wrapper",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"mbSource":["handleMbSourceChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
20
20
  });
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["general-styling-wrapper",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
8
+ return bootstrapLazy([["general-styling-wrapper",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]},null,{"mbSource":["handleMbSourceChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -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]&&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 e,g as n}from"./index-7ef90fae.js";const i="__WIDGET_GLOBAL_STYLE_CACHE__";function s(t,e){if(t){const n=document.createElement("style");n.innerHTML=e,t.appendChild(n)}}function o(t,e){if(!t||!e)return;const n=new URL(e);fetch(n.href).then((t=>t.text())).then((e=>{const n=document.createElement("style");n.innerHTML=e,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function h(t,e,n,s=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!s)return n=function(t,e){const n=document.createElement("style");return window.emMessageBus.subscribe(e,(e=>{t&&(n.innerHTML=e,t.appendChild(n))}))}(t,e),n;window[i]||(window[i]={}),n=function(t,e){return window.emMessageBus.subscribe(e,(n=>{if(!t)return;const s=t.getRootNode(),o=window[i];let h=o[e]&&o[e].sheet;h?o[e].refCount=o[e].refCount+1:(h=new CSSStyleSheet,h.replaceSync(n),o[e]={sheet:h,refCount:1});const c=s.adoptedStyleSheets||[];c.includes(h)||(s.adoptedStyleSheets=[...c,h])}))}(t,e);const o=n.unsubscribe.bind(n);return n.unsubscribe=()=>{if(window[i][e]){const t=window[i][e];t.refCount>1?t.refCount=t.refCount-1:delete window[i][e]}o()},n}const c=class{constructor(e){t(this,e),this.stylingAppends=!1,this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.targetTranslations=void 0}componentDidLoad(){this.el&&(this.mbSource&&h(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()}handleMbSourceChange(t,e){t!=e&&h(this.el,`${this.mbSource}.Style`,this.stylingSubscription)}handleClientStylingChange(t,e){t!=e&&s(this.el,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&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=(e=this.translationUrl,n=this.targetTranslations,new Promise((t=>{fetch(e).then((t=>t.json())).then((e=>{Object.keys(e).forEach((t=>{n[t]=n[t]||{},Object.keys(e[t]).forEach((i=>{if(!n.en[i])return;const s=n.en[i];"object"==typeof e[t][i]?(n[t][i]=n[t][i]||Object.assign({},s),Object.keys(e[t][i]).forEach((s=>{n[t][i][s]=e[t][i][s]}))):n[t][i]=e[t][i]||Object.assign({},s)}))})),t(!0)})).catch((e=>{console.error("Failed to load translations:",e),t(!1)}))})));t.push(i)}var e,n;return await Promise.all(t)}render(){return e("div",{key:"e660ceb69f5e848c788c3924fc814c0fa7a777a2",class:"StyleShell"},e("slot",{key:"35014b6c0c32532af11e6a629ba9b13942504d21",name:"mainContent"}))}get el(){return n(this)}static get watchers(){return{mbSource:["handleMbSourceChange"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};c.style=":host{display:block}";export{c as general_styling_wrapper}
@@ -1 +1 @@
1
- import{p as n,b as l}from"./index-7ef90fae.js";export{s as setNonce}from"./index-7ef90fae.js";import{g as e}from"./app-globals-0f993ce5.js";(()=>{const l=import.meta.url,e={};return""!==l&&(e.resourcesUrl=new URL(".",l).href),n(e)})().then((async n=>(await e(),l([["general-styling-wrapper",[[4,"general-styling-wrapper",{clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],mbSource:[1,"mb-source"],translationUrl:[1,"translation-url"],targetTranslations:[16]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}]]]],n))));
1
+ import{p as n,b as e}from"./index-7ef90fae.js";export{s as setNonce}from"./index-7ef90fae.js";import{g as l}from"./app-globals-0f993ce5.js";(()=>{const e=import.meta.url,l={};return""!==e&&(l.resourcesUrl=new URL(".",e).href),n(l)})().then((async n=>(await l(),e([["general-styling-wrapper",[[4,"general-styling-wrapper",{clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],mbSource:[1,"mb-source"],translationUrl:[1,"translation-url"],targetTranslations:[16]},null,{mbSource:["handleMbSourceChange"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}]]]],n))));
@@ -23,6 +23,7 @@ export declare class GeneralStylingWrapper {
23
23
  private stylingAppends;
24
24
  componentDidLoad(): void;
25
25
  disconnectedCallback(): void;
26
+ handleMbSourceChange(newValue: any, oldValue: any): void;
26
27
  handleClientStylingChange(newValue: any, oldValue: any): void;
27
28
  handleClientStylingUrlChange(newValue: any, oldValue: any): void;
28
29
  componentDidRender(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-styling-wrapper",
3
- "version": "1.94.17",
3
+ "version": "1.94.19",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",