@everymatrix/helper-date-navigator 0.1.26 → 0.1.27
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/cjs/{helper-date-navigator-ec7c6e2d.js → helper-date-navigator-212cbc53.js} +70 -11
- package/dist/cjs/helper-date-navigator.cjs.entry.js +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/esm/{helper-date-navigator-9d4b05fa.js → helper-date-navigator-6fa6fff7.js} +70 -11
- package/dist/esm/helper-date-navigator.entry.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/helper-date-navigator/{helper-date-navigator-9d4b05fa.js → helper-date-navigator-6fa6fff7.js} +107 -107
- package/dist/helper-date-navigator/helper-date-navigator.entry.js +1 -1
- package/dist/helper-date-navigator/index.esm.js +1 -1
- package/package.json +1 -1
|
@@ -6719,6 +6719,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
6719
6719
|
<div on-click="_scrollForward" part="forward-button" aria-hidden="true"></div>
|
|
6720
6720
|
`}static get is(){return "vaadin-tabs"}}v(vh);
|
|
6721
6721
|
|
|
6722
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
6723
|
+
|
|
6722
6724
|
/**
|
|
6723
6725
|
* @name setClientStyling
|
|
6724
6726
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -6764,18 +6766,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
6764
6766
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
6765
6767
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
6766
6768
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
6769
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
6767
6770
|
*/
|
|
6768
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
6769
|
-
if (window.emMessageBus)
|
|
6770
|
-
const sheet = document.createElement('style');
|
|
6771
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
6772
|
+
if (!window.emMessageBus) return;
|
|
6771
6773
|
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6774
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
6775
|
+
|
|
6776
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
6777
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
6778
|
+
|
|
6779
|
+
return subscription;
|
|
6780
|
+
}
|
|
6781
|
+
|
|
6782
|
+
if (!window[StyleCacheKey]) {
|
|
6783
|
+
window[StyleCacheKey] = {};
|
|
6778
6784
|
}
|
|
6785
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
6786
|
+
|
|
6787
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
6788
|
+
const wrappedUnsubscribe = () => {
|
|
6789
|
+
if (window[StyleCacheKey][domain]) {
|
|
6790
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
6791
|
+
cachedObject.refCount > 1
|
|
6792
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
6793
|
+
: delete window[StyleCacheKey][domain];
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6796
|
+
originalUnsubscribe();
|
|
6797
|
+
};
|
|
6798
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
6799
|
+
|
|
6800
|
+
return subscription;
|
|
6801
|
+
}
|
|
6802
|
+
|
|
6803
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
6804
|
+
const sheet = document.createElement('style');
|
|
6805
|
+
|
|
6806
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
6807
|
+
if (stylingContainer) {
|
|
6808
|
+
sheet.innerHTML = data;
|
|
6809
|
+
stylingContainer.appendChild(sheet);
|
|
6810
|
+
}
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
|
|
6814
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
6815
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
6816
|
+
if (!stylingContainer) return;
|
|
6817
|
+
|
|
6818
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
6819
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
6820
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
6821
|
+
|
|
6822
|
+
if (!cachedStyle) {
|
|
6823
|
+
cachedStyle = new CSSStyleSheet();
|
|
6824
|
+
cachedStyle.replaceSync(data);
|
|
6825
|
+
cacheStyleObject[domain] = {
|
|
6826
|
+
sheet: cachedStyle,
|
|
6827
|
+
refCount: 1
|
|
6828
|
+
};
|
|
6829
|
+
} else {
|
|
6830
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
6831
|
+
}
|
|
6832
|
+
|
|
6833
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
6834
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
6835
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
6836
|
+
}
|
|
6837
|
+
});
|
|
6779
6838
|
}
|
|
6780
6839
|
|
|
6781
6840
|
const DEFAULT_LANGUAGE = 'en';
|
|
@@ -6921,7 +6980,7 @@ const HelperDateNavigator = class {
|
|
|
6921
6980
|
}
|
|
6922
6981
|
handleMbSourceChange(newValue, oldValue) {
|
|
6923
6982
|
if (newValue != oldValue) {
|
|
6924
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
6983
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
6925
6984
|
}
|
|
6926
6985
|
}
|
|
6927
6986
|
handleGameIdStringChange(newValue, oldValue) {
|
|
@@ -6956,7 +7015,7 @@ const HelperDateNavigator = class {
|
|
|
6956
7015
|
componentDidLoad() {
|
|
6957
7016
|
if (this.stylingContainer) {
|
|
6958
7017
|
if (this.mbSource)
|
|
6959
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
7018
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
6960
7019
|
if (this.clientStyling)
|
|
6961
7020
|
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
6962
7021
|
if (this.clientStylingUrl)
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -6717,6 +6717,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
6717
6717
|
<div on-click="_scrollForward" part="forward-button" aria-hidden="true"></div>
|
|
6718
6718
|
`}static get is(){return "vaadin-tabs"}}v(vh);
|
|
6719
6719
|
|
|
6720
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
6721
|
+
|
|
6720
6722
|
/**
|
|
6721
6723
|
* @name setClientStyling
|
|
6722
6724
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -6762,18 +6764,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
6762
6764
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
6763
6765
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
6764
6766
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
6767
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
6765
6768
|
*/
|
|
6766
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
6767
|
-
if (window.emMessageBus)
|
|
6768
|
-
const sheet = document.createElement('style');
|
|
6769
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
6770
|
+
if (!window.emMessageBus) return;
|
|
6769
6771
|
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6772
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
6773
|
+
|
|
6774
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
6775
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
6776
|
+
|
|
6777
|
+
return subscription;
|
|
6778
|
+
}
|
|
6779
|
+
|
|
6780
|
+
if (!window[StyleCacheKey]) {
|
|
6781
|
+
window[StyleCacheKey] = {};
|
|
6776
6782
|
}
|
|
6783
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
6784
|
+
|
|
6785
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
6786
|
+
const wrappedUnsubscribe = () => {
|
|
6787
|
+
if (window[StyleCacheKey][domain]) {
|
|
6788
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
6789
|
+
cachedObject.refCount > 1
|
|
6790
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
6791
|
+
: delete window[StyleCacheKey][domain];
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
originalUnsubscribe();
|
|
6795
|
+
};
|
|
6796
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
6797
|
+
|
|
6798
|
+
return subscription;
|
|
6799
|
+
}
|
|
6800
|
+
|
|
6801
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
6802
|
+
const sheet = document.createElement('style');
|
|
6803
|
+
|
|
6804
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
6805
|
+
if (stylingContainer) {
|
|
6806
|
+
sheet.innerHTML = data;
|
|
6807
|
+
stylingContainer.appendChild(sheet);
|
|
6808
|
+
}
|
|
6809
|
+
});
|
|
6810
|
+
}
|
|
6811
|
+
|
|
6812
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
6813
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
6814
|
+
if (!stylingContainer) return;
|
|
6815
|
+
|
|
6816
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
6817
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
6818
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
6819
|
+
|
|
6820
|
+
if (!cachedStyle) {
|
|
6821
|
+
cachedStyle = new CSSStyleSheet();
|
|
6822
|
+
cachedStyle.replaceSync(data);
|
|
6823
|
+
cacheStyleObject[domain] = {
|
|
6824
|
+
sheet: cachedStyle,
|
|
6825
|
+
refCount: 1
|
|
6826
|
+
};
|
|
6827
|
+
} else {
|
|
6828
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
6829
|
+
}
|
|
6830
|
+
|
|
6831
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
6832
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
6833
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
6834
|
+
}
|
|
6835
|
+
});
|
|
6777
6836
|
}
|
|
6778
6837
|
|
|
6779
6838
|
const DEFAULT_LANGUAGE = 'en';
|
|
@@ -6919,7 +6978,7 @@ const HelperDateNavigator = class {
|
|
|
6919
6978
|
}
|
|
6920
6979
|
handleMbSourceChange(newValue, oldValue) {
|
|
6921
6980
|
if (newValue != oldValue) {
|
|
6922
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
6981
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
6923
6982
|
}
|
|
6924
6983
|
}
|
|
6925
6984
|
handleGameIdStringChange(newValue, oldValue) {
|
|
@@ -6954,7 +7013,7 @@ const HelperDateNavigator = class {
|
|
|
6954
7013
|
componentDidLoad() {
|
|
6955
7014
|
if (this.stylingContainer) {
|
|
6956
7015
|
if (this.mbSource)
|
|
6957
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
7016
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
6958
7017
|
if (this.clientStyling)
|
|
6959
7018
|
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
6960
7019
|
if (this.clientStylingUrl)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { H as helper_date_navigator } from './helper-date-navigator-
|
|
1
|
+
export { H as helper_date_navigator } from './helper-date-navigator-6fa6fff7.js';
|
|
2
2
|
import './index-aec7c9dd.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { H as HelperDateNavigator } from './helper-date-navigator-
|
|
1
|
+
export { H as HelperDateNavigator } from './helper-date-navigator-6fa6fff7.js';
|
|
2
2
|
import './index-aec7c9dd.js';
|