@everymatrix/lottery-tipping-entrance 1.87.26 → 1.87.28

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/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { L as LotteryTippingEntrance } from './lottery-tipping-entrance-e25ad0da.js';
1
+ export { L as LotteryTippingEntrance } from './lottery-tipping-entrance-1da12caf.js';
2
2
  import './index-c22bb7d4.js';
@@ -6660,6 +6660,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
6660
6660
  <div on-click="_scrollForward" part="forward-button" aria-hidden="true"></div>
6661
6661
  `}static get is(){return "vaadin-tabs"}}v(vh);
6662
6662
 
6663
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6664
+
6663
6665
  /**
6664
6666
  * @name setClientStyling
6665
6667
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -6705,18 +6707,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
6705
6707
  * @param {HTMLElement} stylingContainer The highest element of the widget
6706
6708
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
6707
6709
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
6710
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
6708
6711
  */
6709
- function setStreamStyling(stylingContainer, domain, subscription) {
6710
- if (window.emMessageBus) {
6711
- const sheet = document.createElement('style');
6712
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
6713
+ if (!window.emMessageBus) return;
6712
6714
 
6713
- window.emMessageBus.subscribe(domain, (data) => {
6714
- sheet.innerHTML = data;
6715
- if (stylingContainer) {
6716
- stylingContainer.appendChild(sheet);
6717
- }
6718
- });
6715
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
6716
+
6717
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
6718
+ subscription = getStyleTagSubscription(stylingContainer, domain);
6719
+
6720
+ return subscription;
6719
6721
  }
6722
+
6723
+ if (!window[StyleCacheKey]) {
6724
+ window[StyleCacheKey] = {};
6725
+ }
6726
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
6727
+
6728
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
6729
+ const wrappedUnsubscribe = () => {
6730
+ if (window[StyleCacheKey][domain]) {
6731
+ const cachedObject = window[StyleCacheKey][domain];
6732
+ cachedObject.refCount > 1
6733
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
6734
+ : delete window[StyleCacheKey][domain];
6735
+ }
6736
+
6737
+ originalUnsubscribe();
6738
+ };
6739
+ subscription.unsubscribe = wrappedUnsubscribe;
6740
+
6741
+ return subscription;
6742
+ }
6743
+
6744
+ function getStyleTagSubscription(stylingContainer, domain) {
6745
+ const sheet = document.createElement('style');
6746
+
6747
+ return window.emMessageBus.subscribe(domain, (data) => {
6748
+ if (stylingContainer) {
6749
+ sheet.innerHTML = data;
6750
+ stylingContainer.appendChild(sheet);
6751
+ }
6752
+ });
6753
+ }
6754
+
6755
+ function getAdoptStyleSubscription(stylingContainer, domain) {
6756
+ return window.emMessageBus.subscribe(domain, (data) => {
6757
+ if (!stylingContainer) return;
6758
+
6759
+ const shadowRoot = stylingContainer.getRootNode();
6760
+ const cacheStyleObject = window[StyleCacheKey];
6761
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
6762
+
6763
+ if (!cachedStyle) {
6764
+ cachedStyle = new CSSStyleSheet();
6765
+ cachedStyle.replaceSync(data);
6766
+ cacheStyleObject[domain] = {
6767
+ sheet: cachedStyle,
6768
+ refCount: 1
6769
+ };
6770
+ } else {
6771
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
6772
+ }
6773
+
6774
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
6775
+ if (!currentSheets.includes(cachedStyle)) {
6776
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
6777
+ }
6778
+ });
6720
6779
  }
6721
6780
 
6722
6781
  function _typeof(o) {
@@ -9399,7 +9458,7 @@ const LotteryTippingEntrance = class {
9399
9458
  }
9400
9459
  handleMbSourceChange(newValue, oldValue) {
9401
9460
  if (newValue != oldValue) {
9402
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
9461
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
9403
9462
  }
9404
9463
  }
9405
9464
  async onPropsChange() {
@@ -9414,7 +9473,7 @@ const LotteryTippingEntrance = class {
9414
9473
  componentDidLoad() {
9415
9474
  if (this.stylingContainer) {
9416
9475
  if (this.mbSource)
9417
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
9476
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
9418
9477
  if (this.clientStyling)
9419
9478
  setClientStyling(this.stylingContainer, this.clientStyling);
9420
9479
  if (this.clientStylingUrl)