@everymatrix/lottery-tipping-bullet-group 1.87.26 → 1.87.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryTippingBulletGroup = require('./lottery-tipping-bullet-group-615f35b4.js');
5
+ const lotteryTippingBulletGroup = require('./lottery-tipping-bullet-group-46b915a5.js');
6
6
  require('./index-42492779.js');
7
7
 
8
8
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  const index = require('./index-42492779.js');
4
4
 
5
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6
+
5
7
  /**
6
8
  * @name setClientStyling
7
9
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -47,18 +49,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
47
49
  * @param {HTMLElement} stylingContainer The highest element of the widget
48
50
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
49
51
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
52
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
50
53
  */
51
- function setStreamStyling(stylingContainer, domain, subscription) {
52
- if (window.emMessageBus) {
53
- const sheet = document.createElement('style');
54
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
55
+ if (!window.emMessageBus) return;
54
56
 
55
- window.emMessageBus.subscribe(domain, (data) => {
56
- sheet.innerHTML = data;
57
- if (stylingContainer) {
58
- stylingContainer.appendChild(sheet);
59
- }
60
- });
57
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
58
+
59
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
60
+ subscription = getStyleTagSubscription(stylingContainer, domain);
61
+
62
+ return subscription;
63
+ }
64
+
65
+ if (!window[StyleCacheKey]) {
66
+ window[StyleCacheKey] = {};
61
67
  }
68
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
69
+
70
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
71
+ const wrappedUnsubscribe = () => {
72
+ if (window[StyleCacheKey][domain]) {
73
+ const cachedObject = window[StyleCacheKey][domain];
74
+ cachedObject.refCount > 1
75
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
76
+ : delete window[StyleCacheKey][domain];
77
+ }
78
+
79
+ originalUnsubscribe();
80
+ };
81
+ subscription.unsubscribe = wrappedUnsubscribe;
82
+
83
+ return subscription;
84
+ }
85
+
86
+ function getStyleTagSubscription(stylingContainer, domain) {
87
+ const sheet = document.createElement('style');
88
+
89
+ return window.emMessageBus.subscribe(domain, (data) => {
90
+ if (stylingContainer) {
91
+ sheet.innerHTML = data;
92
+ stylingContainer.appendChild(sheet);
93
+ }
94
+ });
95
+ }
96
+
97
+ function getAdoptStyleSubscription(stylingContainer, domain) {
98
+ return window.emMessageBus.subscribe(domain, (data) => {
99
+ if (!stylingContainer) return;
100
+
101
+ const shadowRoot = stylingContainer.getRootNode();
102
+ const cacheStyleObject = window[StyleCacheKey];
103
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
104
+
105
+ if (!cachedStyle) {
106
+ cachedStyle = new CSSStyleSheet();
107
+ cachedStyle.replaceSync(data);
108
+ cacheStyleObject[domain] = {
109
+ sheet: cachedStyle,
110
+ refCount: 1
111
+ };
112
+ } else {
113
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
114
+ }
115
+
116
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
117
+ if (!currentSheets.includes(cachedStyle)) {
118
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
119
+ }
120
+ });
62
121
  }
63
122
 
64
123
  const lotteryTippingBulletGroupCss = "";
@@ -114,13 +173,13 @@ const LotteryTippingBulletGroup = class {
114
173
  }
115
174
  handleMbSourceChange(newValue, oldValue) {
116
175
  if (newValue != oldValue) {
117
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
176
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
118
177
  }
119
178
  }
120
179
  componentDidLoad() {
121
180
  if (this.stylingContainer) {
122
181
  if (this.mbSource)
123
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
182
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
124
183
  if (this.clientStyling)
125
184
  setClientStyling(this.stylingContainer, this.clientStyling);
126
185
  if (this.clientStylingUrl)
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-42492779.js');
6
- const lotteryTippingBulletGroup = require('./lottery-tipping-bullet-group-615f35b4.js');
6
+ const lotteryTippingBulletGroup = require('./lottery-tipping-bullet-group-46b915a5.js');
7
7
 
8
8
  const lotteryTippingBulletCss = ".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";
9
9
  const LotteryTippingBulletStyle0 = lotteryTippingBulletCss;
@@ -33,13 +33,13 @@ const LotteryTippingBullet = class {
33
33
  }
34
34
  handleMbSourceChange(newValue, oldValue) {
35
35
  if (newValue != oldValue) {
36
- lotteryTippingBulletGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
36
+ lotteryTippingBulletGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
37
37
  }
38
38
  }
39
39
  componentDidLoad() {
40
40
  if (this.stylingContainer) {
41
41
  if (this.mbSource)
42
- lotteryTippingBulletGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
42
+ lotteryTippingBulletGroup.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
43
43
  if (this.clientStyling)
44
44
  lotteryTippingBulletGroup.setClientStyling(this.stylingContainer, this.clientStyling);
45
45
  if (this.clientStylingUrl)
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { L as LotteryTippingBulletGroup } from './lottery-tipping-bullet-group-c07232e8.js';
1
+ export { L as LotteryTippingBulletGroup } from './lottery-tipping-bullet-group-704f336f.js';
2
2
  import './index-1483af1f.js';
@@ -1,5 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-1483af1f.js';
2
2
 
3
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
4
+
3
5
  /**
4
6
  * @name setClientStyling
5
7
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -45,18 +47,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
45
47
  * @param {HTMLElement} stylingContainer The highest element of the widget
46
48
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
47
49
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
50
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
48
51
  */
49
- function setStreamStyling(stylingContainer, domain, subscription) {
50
- if (window.emMessageBus) {
51
- const sheet = document.createElement('style');
52
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
53
+ if (!window.emMessageBus) return;
52
54
 
53
- window.emMessageBus.subscribe(domain, (data) => {
54
- sheet.innerHTML = data;
55
- if (stylingContainer) {
56
- stylingContainer.appendChild(sheet);
57
- }
58
- });
55
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
56
+
57
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
58
+ subscription = getStyleTagSubscription(stylingContainer, domain);
59
+
60
+ return subscription;
61
+ }
62
+
63
+ if (!window[StyleCacheKey]) {
64
+ window[StyleCacheKey] = {};
59
65
  }
66
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
67
+
68
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
69
+ const wrappedUnsubscribe = () => {
70
+ if (window[StyleCacheKey][domain]) {
71
+ const cachedObject = window[StyleCacheKey][domain];
72
+ cachedObject.refCount > 1
73
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
74
+ : delete window[StyleCacheKey][domain];
75
+ }
76
+
77
+ originalUnsubscribe();
78
+ };
79
+ subscription.unsubscribe = wrappedUnsubscribe;
80
+
81
+ return subscription;
82
+ }
83
+
84
+ function getStyleTagSubscription(stylingContainer, domain) {
85
+ const sheet = document.createElement('style');
86
+
87
+ return window.emMessageBus.subscribe(domain, (data) => {
88
+ if (stylingContainer) {
89
+ sheet.innerHTML = data;
90
+ stylingContainer.appendChild(sheet);
91
+ }
92
+ });
93
+ }
94
+
95
+ function getAdoptStyleSubscription(stylingContainer, domain) {
96
+ return window.emMessageBus.subscribe(domain, (data) => {
97
+ if (!stylingContainer) return;
98
+
99
+ const shadowRoot = stylingContainer.getRootNode();
100
+ const cacheStyleObject = window[StyleCacheKey];
101
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
102
+
103
+ if (!cachedStyle) {
104
+ cachedStyle = new CSSStyleSheet();
105
+ cachedStyle.replaceSync(data);
106
+ cacheStyleObject[domain] = {
107
+ sheet: cachedStyle,
108
+ refCount: 1
109
+ };
110
+ } else {
111
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
112
+ }
113
+
114
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
115
+ if (!currentSheets.includes(cachedStyle)) {
116
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
117
+ }
118
+ });
60
119
  }
61
120
 
62
121
  const lotteryTippingBulletGroupCss = "";
@@ -112,13 +171,13 @@ const LotteryTippingBulletGroup = class {
112
171
  }
113
172
  handleMbSourceChange(newValue, oldValue) {
114
173
  if (newValue != oldValue) {
115
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
174
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
116
175
  }
117
176
  }
118
177
  componentDidLoad() {
119
178
  if (this.stylingContainer) {
120
179
  if (this.mbSource)
121
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
180
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
122
181
  if (this.clientStyling)
123
182
  setClientStyling(this.stylingContainer, this.clientStyling);
124
183
  if (this.clientStylingUrl)
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-1483af1f.js';
2
- import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './lottery-tipping-bullet-group-c07232e8.js';
3
- export { L as lottery_tipping_bullet_group } from './lottery-tipping-bullet-group-c07232e8.js';
2
+ import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './lottery-tipping-bullet-group-704f336f.js';
3
+ export { L as lottery_tipping_bullet_group } from './lottery-tipping-bullet-group-704f336f.js';
4
4
 
5
5
  const lotteryTippingBulletCss = ".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";
6
6
  const LotteryTippingBulletStyle0 = lotteryTippingBulletCss;
@@ -30,13 +30,13 @@ const LotteryTippingBullet = class {
30
30
  }
31
31
  handleMbSourceChange(newValue, oldValue) {
32
32
  if (newValue != oldValue) {
33
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
33
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
34
34
  }
35
35
  }
36
36
  componentDidLoad() {
37
37
  if (this.stylingContainer) {
38
38
  if (this.mbSource)
39
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
39
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
40
40
  if (this.clientStyling)
41
41
  setClientStyling(this.stylingContainer, this.clientStyling);
42
42
  if (this.clientStylingUrl)
@@ -1 +1 @@
1
- export{L as LotteryTippingBulletGroup}from"./lottery-tipping-bullet-group-c07232e8.js";import"./index-1483af1f.js";
1
+ export{L as LotteryTippingBulletGroup}from"./lottery-tipping-bullet-group-704f336f.js";import"./index-1483af1f.js";
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i}from"./index-1483af1f.js";const n="__WIDGET_GLOBAL_STYLE_CACHE__";function s(t,e){if(t){const i=document.createElement("style");i.innerHTML=e,t.appendChild(i)}}function l(t,e){if(!t||!e)return;const i=new URL(e);fetch(i.href).then((t=>t.text())).then((e=>{const i=document.createElement("style");i.innerHTML=e,t&&t.appendChild(i)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function o(t,e,i,s=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!s)return i=function(t,e){const i=document.createElement("style");return window.emMessageBus.subscribe(e,(e=>{t&&(i.innerHTML=e,t.appendChild(i))}))}(t,e),i;window[n]||(window[n]={}),i=function(t,e){return window.emMessageBus.subscribe(e,(i=>{if(!t)return;const s=t.getRootNode(),l=window[n];let o=l[e]?.sheet;o?l[e].refCount=l[e].refCount+1:(o=new CSSStyleSheet,o.replaceSync(i),l[e]={sheet:o,refCount:1});const h=s.adoptedStyleSheets||[];h.includes(o)||(s.adoptedStyleSheets=[...h,o])}))}(t,e);const l=i.unsubscribe.bind(i);return i.unsubscribe=()=>{if(window[n][e]){const t=window[n][e];t.refCount>1?t.refCount=t.refCount-1:delete window[n][e]}l()},i}const h=class{constructor(i){t(this,i),this.lotteryTippingBulletGroupToggleEvent=e(this,"lotteryTippingBulletGroupToggle",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.positionIdx=void 0,this.theme="default",this.mode="single",this.bulletConfigContent=""}get bulletConfigArr(){const t=[{value:"1"},{value:"X"},{value:"2"}];if("string"!=typeof this.bulletConfigContent||!this.bulletConfigContent)return t;try{return JSON.parse(this.bulletConfigContent)}catch(e){return console.error("Error parsing bulletConfigContent:",e),t}}handleClientStylingChange(t,e){t!=e&&s(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&l(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&o(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&o(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&s(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&l(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}lotteryTippingBulletSelectionHandler(t){const{positionIdx:e}=t.detail;this.handleToggle(e)}handleToggle(t){let e=[...this.bulletConfigArr];"single"===this.mode?(e=e.map((t=>Object.assign(Object.assign({},t),{isSelected:!1}))),e[t].isSelected=!0):(e=e.map((t=>Object.assign({},t))),e[t].isSelected=!e[t].isSelected),this.lotteryTippingBulletGroupToggleEvent.emit({bulletConfigArr:e,positionIdx:this.positionIdx+"-"+t})}render(){var t;return i("div",{ref:t=>this.stylingContainer=t,key:this.positionIdx},i("div",{key:"68223022eed831932c571378164be913206d98e9",style:{display:"flex",flexDirection:"row",gap:"10px"}},null===(t=this.bulletConfigArr)||void 0===t?void 0:t.map(((t,e)=>i("div",{key:e},i("lottery-tipping-bullet",{value:t.value,isSelected:t.isSelected,"position-idx":e,disabled:t.disabled,theme:this.theme,clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,mbSource:this.mbSource}))))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};h.style="";export{h as L,l as a,o as b,s}
@@ -1 +1 @@
1
- import{r as t,c as e,h as r}from"./index-1483af1f.js";import{s as i,a as o,b as n}from"./lottery-tipping-bullet-group-c07232e8.js";export{L as lottery_tipping_bullet_group}from"./lottery-tipping-bullet-group-c07232e8.js";const l=class{constructor(r){t(this,r),this.lotteryTippingBulletToggleEvent=e(this,"lotteryTippingBulletToggle",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.positionIdx=void 0,this.theme="default",this.value="",this.disabled=!1,this.isSelected=!1}handleClientStylingChange(t,e){t!=e&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&n(this.stylingContainer,`${this.mbSource}.Style`)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&n(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))}handleClick(){this.disabled||this.lotteryTippingBulletToggleEvent.emit({positionIdx:this.positionIdx})}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){return r("div",{key:"ef0fee38ed62adb7809b5a60668af6a499ebe5a6",ref:t=>this.stylingContainer=t},"text"===this.theme?r("div",{class:{LotteryTippingBullet__segment:!0,"LotteryTippingBullet__segment--text":!0}},this.value):r("button",{class:{LotteryTippingBullet__segment:!0,"LotteryTippingBullet__segment--disabled":this.disabled,"LotteryTippingBullet__segment--active":this.isSelected},onClick:this.handleClick.bind(this)},this.isSelected?"X":this.value))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};l.style=".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";export{l as lottery_tipping_bullet}
1
+ import{r as t,c as e,h as i}from"./index-1483af1f.js";import{s as r,a as o,b as n}from"./lottery-tipping-bullet-group-704f336f.js";export{L as lottery_tipping_bullet_group}from"./lottery-tipping-bullet-group-704f336f.js";const l=class{constructor(i){t(this,i),this.lotteryTippingBulletToggleEvent=e(this,"lotteryTippingBulletToggle",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.positionIdx=void 0,this.theme="default",this.value="",this.disabled=!1,this.isSelected=!1}handleClientStylingChange(t,e){t!=e&&r(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&n(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&n(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))}handleClick(){this.disabled||this.lotteryTippingBulletToggleEvent.emit({positionIdx:this.positionIdx})}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){return i("div",{key:"ef0fee38ed62adb7809b5a60668af6a499ebe5a6",ref:t=>this.stylingContainer=t},"text"===this.theme?i("div",{class:{LotteryTippingBullet__segment:!0,"LotteryTippingBullet__segment--text":!0}},this.value):i("button",{class:{LotteryTippingBullet__segment:!0,"LotteryTippingBullet__segment--disabled":this.disabled,"LotteryTippingBullet__segment--active":this.isSelected},onClick:this.handleClick.bind(this)},this.isSelected?"X":this.value))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};l.style=".LotteryTippingBullet__segment{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;font-size:16px;line-height:1;font-weight:500;color:var(--emw--color-typography, #000);background:var(--emw--color-background, #fff);border:1px solid var(--emw--color-gray-100, #e6e6e6);border-radius:6px;cursor:pointer;transition:all 0.2s ease;user-select:none}.LotteryTippingBullet__segment:not(.LotteryTippingBullet__segment--disabled):hover{cursor:pointer;animation:jelly 0.3s ease-in-out;transform:scale(1.02)}.LotteryTippingBullet__segment--text{border:none;color:var(--emw--color-typography, #000);background:transparent;font-weight:400}.LotteryTippingBullet__segment--text:hover{cursor:not-allowed !important}.LotteryTippingBullet__segment--active{font-weight:600;background-color:var(--emw--color-background-inverse, #000);color:var(--emw--color-primary, #fed275)}.LotteryTippingBullet__segment--disabled:not(.LotteryTippingBullet__segment--active){background-color:var(--emw--color-background-tertiary, #ccc);color:var(--emw--color-gray-150, #6f6f6f);border-color:var(--emw--color-gray-100, #e6e6e6)}.LotteryTippingBullet__segment--disabled:hover{cursor:not-allowed}@keyframes jelly{0%{transform:translate(0, 0)}20%{transform:translate(-0.5px, -0.5px)}40%{transform:translate(0.5px, 0.5px)}60%{transform:translate(-0.25px, -0.25px)}80%{transform:translate(0.25px, 0.25px)}100%{transform:translate(0, 0)}}";export{l as lottery_tipping_bullet}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-tipping-bullet-group",
3
- "version": "1.87.26",
3
+ "version": "1.87.27",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as e}from"./index-1483af1f.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)}))}function l(t,i){if(window.emMessageBus){const e=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{e.innerHTML=i,t&&t.appendChild(e)}))}}const o=class{constructor(e){t(this,e),this.lotteryTippingBulletGroupToggleEvent=i(this,"lotteryTippingBulletGroupToggle",7),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.positionIdx=void 0,this.theme="default",this.mode="single",this.bulletConfigContent=""}get bulletConfigArr(){const t=[{value:"1"},{value:"X"},{value:"2"}];if("string"!=typeof this.bulletConfigContent||!this.bulletConfigContent)return t;try{return JSON.parse(this.bulletConfigContent)}catch(i){return console.error("Error parsing bulletConfigContent:",i),t}}handleClientStylingChange(t,i){t!=i&&n(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,i){t!=i&&s(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,i){t!=i&&l(this.stylingContainer,`${this.mbSource}.Style`)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&l(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}lotteryTippingBulletSelectionHandler(t){const{positionIdx:i}=t.detail;this.handleToggle(i)}handleToggle(t){let i=[...this.bulletConfigArr];"single"===this.mode?(i=i.map((t=>Object.assign(Object.assign({},t),{isSelected:!1}))),i[t].isSelected=!0):(i=i.map((t=>Object.assign({},t))),i[t].isSelected=!i[t].isSelected),this.lotteryTippingBulletGroupToggleEvent.emit({bulletConfigArr:i,positionIdx:this.positionIdx+"-"+t})}render(){var t;return e("div",{ref:t=>this.stylingContainer=t,key:this.positionIdx},e("div",{key:"68223022eed831932c571378164be913206d98e9",style:{display:"flex",flexDirection:"row",gap:"10px"}},null===(t=this.bulletConfigArr)||void 0===t?void 0:t.map(((t,i)=>e("div",{key:i},e("lottery-tipping-bullet",{value:t.value,isSelected:t.isSelected,"position-idx":i,disabled:t.disabled,theme:this.theme,clientStyling:this.clientStyling,clientStylingUrl:this.clientStylingUrl,mbSource:this.mbSource}))))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};o.style="";export{o as L,s as a,l as b,n as s}