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