@everymatrix/lottery-ticket 0.1.6 → 0.1.20

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.
@@ -23,6 +23,14 @@ export class LotteryTicket {
23
23
  * Language
24
24
  */
25
25
  this.language = 'en';
26
+ /**
27
+ * Client custom styling via string
28
+ */
29
+ this.clientStyling = '';
30
+ /**
31
+ * Client custom styling via url content
32
+ */
33
+ this.clientStylingUrlContent = '';
26
34
  this.multiplier = false;
27
35
  this.numberOfDraws = 1;
28
36
  this.isLoading = true;
@@ -30,6 +38,19 @@ export class LotteryTicket {
30
38
  this.ticketDone = false;
31
39
  this.isCustomSelect = false;
32
40
  this.amountInfo = {};
41
+ this.limitStylingAppends = false;
42
+ this.setClientStyling = () => {
43
+ let sheet = document.createElement('style');
44
+ sheet.innerHTML = this.clientStyling;
45
+ this.stylingContainer.prepend(sheet);
46
+ };
47
+ this.setClientStylingURL = () => {
48
+ let cssFile = document.createElement('style');
49
+ setTimeout(() => {
50
+ cssFile.innerHTML = this.clientStylingUrlContent;
51
+ this.stylingContainer.prepend(cssFile);
52
+ }, 1);
53
+ };
33
54
  }
34
55
  /**
35
56
  * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
@@ -63,6 +84,17 @@ export class LotteryTicket {
63
84
  console.error('Error!', err);
64
85
  });
65
86
  }
87
+ componentDidRender() {
88
+ // start custom styling area
89
+ if (!this.limitStylingAppends && this.stylingContainer) {
90
+ if (this.clientStyling)
91
+ this.setClientStyling();
92
+ if (this.clientStylingUrlContent)
93
+ this.setClientStylingURL();
94
+ this.limitStylingAppends = true;
95
+ }
96
+ // end custom styling area
97
+ }
66
98
  multiplierChangeHandler(e) {
67
99
  this.multiplier = e.target ? e.target.checked : false;
68
100
  this.multiplierChange.emit(this.multiplier);
@@ -113,7 +145,7 @@ export class LotteryTicket {
113
145
  }
114
146
  else {
115
147
  const { rules } = this.gameData;
116
- return (h("div", { class: "TicketContainer" },
148
+ return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el },
117
149
  h("p", { class: "TicketTitle" }, this.gameData.name),
118
150
  this.resetButton && this.ticketDone &&
119
151
  h("div", { class: "ButtonContainer" },
@@ -126,7 +158,7 @@ export class LotteryTicket {
126
158
  translate('grid', this.language),
127
159
  " ",
128
160
  item),
129
- h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))),
161
+ h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))),
130
162
  rules.multiplier &&
131
163
  h("div", null,
132
164
  h("label", { class: "Toggle" },
@@ -315,6 +347,42 @@ export class LotteryTicket {
315
347
  "attribute": "language",
316
348
  "reflect": false,
317
349
  "defaultValue": "'en'"
350
+ },
351
+ "clientStyling": {
352
+ "type": "string",
353
+ "mutable": false,
354
+ "complexType": {
355
+ "original": "string",
356
+ "resolved": "string",
357
+ "references": {}
358
+ },
359
+ "required": false,
360
+ "optional": false,
361
+ "docs": {
362
+ "tags": [],
363
+ "text": "Client custom styling via string"
364
+ },
365
+ "attribute": "client-styling",
366
+ "reflect": false,
367
+ "defaultValue": "''"
368
+ },
369
+ "clientStylingUrlContent": {
370
+ "type": "string",
371
+ "mutable": false,
372
+ "complexType": {
373
+ "original": "string",
374
+ "resolved": "string",
375
+ "references": {}
376
+ },
377
+ "required": false,
378
+ "optional": false,
379
+ "docs": {
380
+ "tags": [],
381
+ "text": "Client custom styling via url content"
382
+ },
383
+ "attribute": "client-styling-url-content",
384
+ "reflect": false,
385
+ "defaultValue": "''"
318
386
  }
319
387
  }; }
320
388
  static get states() { return {
@@ -324,7 +392,8 @@ export class LotteryTicket {
324
392
  "hasErrors": {},
325
393
  "ticketDone": {},
326
394
  "isCustomSelect": {},
327
- "amountInfo": {}
395
+ "amountInfo": {},
396
+ "limitStylingAppends": {}
328
397
  }; }
329
398
  static get events() { return [{
330
399
  "method": "ticketCompleted",
@@ -0,0 +1,6 @@
1
+ import { L as LotteryBullet$1, d as defineCustomElement$1 } from './lottery-bullet2.js';
2
+
3
+ const LotteryBullet = LotteryBullet$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { LotteryBullet, defineCustomElement };
@@ -0,0 +1,91 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+
3
+ const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
4
+
5
+ const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
11
+ /**
12
+ * Value of the bullet
13
+ */
14
+ this.value = '0';
15
+ /**
16
+ * Marks if the bullet should be selectable
17
+ */
18
+ this.selectable = true;
19
+ /**
20
+ * Marks if the bullet should be selected
21
+ */
22
+ this.isSelected = false;
23
+ /**
24
+ * Client custom styling via string
25
+ */
26
+ this.clientStyling = '';
27
+ /**
28
+ * Client custom styling via url content
29
+ */
30
+ this.clientStylingUrlContent = '';
31
+ this.limitStylingAppends = false;
32
+ this.select = () => {
33
+ if (this.selectable) {
34
+ this.isSelected = !this.isSelected;
35
+ this.bulletEvent.emit({
36
+ value: this.value,
37
+ selected: this.isSelected
38
+ });
39
+ }
40
+ };
41
+ this.setClientStyling = () => {
42
+ let sheet = document.createElement('style');
43
+ sheet.innerHTML = this.clientStyling;
44
+ this.stylingContainer.prepend(sheet);
45
+ };
46
+ this.setClientStylingURL = () => {
47
+ let cssFile = document.createElement('style');
48
+ setTimeout(() => {
49
+ cssFile.innerHTML = this.clientStylingUrlContent;
50
+ this.stylingContainer.prepend(cssFile);
51
+ }, 1);
52
+ };
53
+ }
54
+ componentDidRender() {
55
+ // start custom styling area
56
+ if (!this.limitStylingAppends && this.stylingContainer) {
57
+ if (this.clientStyling)
58
+ this.setClientStyling();
59
+ if (this.clientStylingUrlContent)
60
+ this.setClientStylingURL();
61
+ this.limitStylingAppends = true;
62
+ }
63
+ // end custom styling area
64
+ }
65
+ render() {
66
+ return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
67
+ }
68
+ static get style() { return lotteryBulletCss; }
69
+ }, [1, "lottery-bullet", {
70
+ "value": [1],
71
+ "selectable": [4],
72
+ "isSelected": [4, "is-selected"],
73
+ "clientStyling": [1, "client-styling"],
74
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
75
+ "limitStylingAppends": [32]
76
+ }]);
77
+ function defineCustomElement() {
78
+ if (typeof customElements === "undefined") {
79
+ return;
80
+ }
81
+ const components = ["lottery-bullet"];
82
+ components.forEach(tagName => { switch (tagName) {
83
+ case "lottery-bullet":
84
+ if (!customElements.get(tagName)) {
85
+ customElements.define(tagName, LotteryBullet);
86
+ }
87
+ break;
88
+ } });
89
+ }
90
+
91
+ export { LotteryBullet as L, defineCustomElement as d };
@@ -0,0 +1,6 @@
1
+ import { L as LotteryGrid$1, d as defineCustomElement$1 } from './lottery-grid2.js';
2
+
3
+ const LotteryGrid = LotteryGrid$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { LotteryGrid, defineCustomElement };
@@ -0,0 +1,236 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$1 } from './lottery-bullet2.js';
3
+
4
+ const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
5
+
6
+ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.gridFilledEvent = createEvent(this, "gridFilled", 7);
12
+ this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
13
+ /**
14
+ * Number of bullets of grid
15
+ */
16
+ this.totalNumbers = 0;
17
+ /**
18
+ * Number of maximum bullets that can be selected
19
+ */
20
+ this.maximumAllowed = 0;
21
+ /**
22
+ * Minimum allowed of bullets
23
+ */
24
+ this.minimumAllowed = 1;
25
+ /**
26
+ * Allows the user to select numbers on the grid
27
+ */
28
+ this.selectable = true;
29
+ /**
30
+ * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
31
+ */
32
+ this.selectedNumbers = '';
33
+ /**
34
+ * Show only selected numbers
35
+ */
36
+ this.displaySelected = false;
37
+ /**
38
+ * Language
39
+ */
40
+ this.language = 'en';
41
+ /**
42
+ * Personalize grid for ticket
43
+ */
44
+ this.gridType = '';
45
+ /**
46
+ * Client custom styling via string
47
+ */
48
+ this.clientStyling = '';
49
+ /**
50
+ * Client custom styling via url content
51
+ */
52
+ this.clientStylingUrlContent = '';
53
+ this.numbers = [];
54
+ this.limitStylingAppends = false;
55
+ this.selectedCounter = 0;
56
+ this.setClientStyling = () => {
57
+ let sheet = document.createElement('style');
58
+ sheet.innerHTML = this.clientStyling;
59
+ this.stylingContainer.prepend(sheet);
60
+ };
61
+ this.setClientStylingURL = () => {
62
+ let cssFile = document.createElement('style');
63
+ setTimeout(() => {
64
+ cssFile.innerHTML = this.clientStylingUrlContent;
65
+ this.stylingContainer.prepend(cssFile);
66
+ }, 1);
67
+ };
68
+ }
69
+ connectedCallback() {
70
+ let selected = [];
71
+ if (this.selectedNumbers.length > 0) {
72
+ selected = this.selectedNumbers.split(',');
73
+ this.selectedCounter = selected.length;
74
+ }
75
+ if (this.displaySelected) {
76
+ selected.forEach((item) => {
77
+ this.numbers.push({
78
+ number: item,
79
+ selected: true,
80
+ selectable: this.selectable
81
+ });
82
+ });
83
+ }
84
+ else {
85
+ [...Array(this.totalNumbers).keys()]
86
+ .map(number => (number + 1).toString())
87
+ .forEach((number) => {
88
+ this.numbers.push({
89
+ number,
90
+ selected: selected.indexOf(number) >= 0 ? true : false,
91
+ selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
92
+ });
93
+ });
94
+ }
95
+ }
96
+ componentDidRender() {
97
+ // start custom styling area
98
+ if (!this.limitStylingAppends && this.stylingContainer) {
99
+ if (this.clientStyling)
100
+ this.setClientStyling();
101
+ if (this.clientStylingUrlContent)
102
+ this.setClientStylingURL();
103
+ this.limitStylingAppends = true;
104
+ }
105
+ // end custom styling area
106
+ }
107
+ lotteryBulletSelectionHandler(event) {
108
+ this.numbers = this.numbers.map((item) => {
109
+ if (item.number == event.detail.value) {
110
+ return {
111
+ number: item.number,
112
+ selected: event.detail.selected,
113
+ selectable: item.selectable
114
+ };
115
+ }
116
+ return {
117
+ number: item.number,
118
+ selected: item.selected,
119
+ selectable: item.selectable
120
+ };
121
+ });
122
+ if (event.detail.selected) {
123
+ this.selectedCounter += 1;
124
+ if (this.selectedCounter == this.maximumAllowed) {
125
+ this.numbers = this.numbers.map((item) => {
126
+ return {
127
+ number: item.number,
128
+ selected: item.selected,
129
+ selectable: item.selected ? true : false
130
+ };
131
+ });
132
+ this.gridFilledEvent.emit({
133
+ id: this.ticketId,
134
+ index: this.gridIndex,
135
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
136
+ });
137
+ }
138
+ }
139
+ else {
140
+ if (this.selectedCounter == this.maximumAllowed) {
141
+ this.numbers = this.numbers.map((item) => {
142
+ return {
143
+ number: item.number,
144
+ selected: item.selected,
145
+ selectable: true
146
+ };
147
+ });
148
+ this.gridDirtyEvent.emit({
149
+ id: this.ticketId,
150
+ index: this.gridIndex,
151
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
152
+ });
153
+ }
154
+ this.selectedCounter -= 1;
155
+ }
156
+ }
157
+ async resetSelectionHandler(event) {
158
+ if (event.detail && event.detail == this.ticketId) {
159
+ this.selectedCounter = 0;
160
+ this.numbers = this.numbers.map((item) => {
161
+ return {
162
+ number: item.number,
163
+ selected: false,
164
+ selectable: this.selectable
165
+ };
166
+ });
167
+ this.gridDirtyEvent.emit({
168
+ id: this.ticketId,
169
+ index: this.gridIndex,
170
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
171
+ });
172
+ }
173
+ }
174
+ async autoSelectionHandler(event) {
175
+ if (event.detail && event.detail == this.ticketId) {
176
+ this.resetSelectionHandler(event);
177
+ let array = [...Array(this.totalNumbers).keys()]
178
+ .map(number => number + 1)
179
+ .sort(() => 0.5 - Math.random());
180
+ array = array.slice(0, this.minimumAllowed);
181
+ this.numbers = this.numbers.map((item) => {
182
+ return {
183
+ number: item.number,
184
+ selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
185
+ selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
186
+ };
187
+ });
188
+ this.gridFilledEvent.emit({
189
+ id: this.ticketId,
190
+ index: this.gridIndex,
191
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
192
+ });
193
+ this.selectedCounter = this.maximumAllowed;
194
+ }
195
+ }
196
+ render() {
197
+ return (h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
198
+ }
199
+ static get style() { return lotteryGridCss; }
200
+ }, [1, "lottery-grid", {
201
+ "ticketId": [2, "ticket-id"],
202
+ "totalNumbers": [2, "total-numbers"],
203
+ "gameId": [1, "game-id"],
204
+ "maximumAllowed": [2, "maximum-allowed"],
205
+ "minimumAllowed": [2, "minimum-allowed"],
206
+ "selectable": [4],
207
+ "selectedNumbers": [1, "selected-numbers"],
208
+ "displaySelected": [4, "display-selected"],
209
+ "language": [1],
210
+ "gridIndex": [2, "grid-index"],
211
+ "gridType": [1, "grid-type"],
212
+ "clientStyling": [1, "client-styling"],
213
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
214
+ "numbers": [32],
215
+ "limitStylingAppends": [32]
216
+ }, [[0, "lotteryBulletSelection", "lotteryBulletSelectionHandler"], [4, "resetSelection", "resetSelectionHandler"], [4, "autoSelection", "autoSelectionHandler"]]]);
217
+ function defineCustomElement() {
218
+ if (typeof customElements === "undefined") {
219
+ return;
220
+ }
221
+ const components = ["lottery-grid", "lottery-bullet"];
222
+ components.forEach(tagName => { switch (tagName) {
223
+ case "lottery-grid":
224
+ if (!customElements.get(tagName)) {
225
+ customElements.define(tagName, LotteryGrid);
226
+ }
227
+ break;
228
+ case "lottery-bullet":
229
+ if (!customElements.get(tagName)) {
230
+ defineCustomElement$1();
231
+ }
232
+ break;
233
+ } });
234
+ }
235
+
236
+ export { LotteryGrid as L, defineCustomElement as d };
@@ -1,5 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import '@everymatrix/lottery-grid';
2
+ import { d as defineCustomElement$3 } from './lottery-bullet2.js';
3
+ import { d as defineCustomElement$2 } from './lottery-grid2.js';
3
4
 
4
5
  const DEFAULT_LANGUAGE = 'en';
5
6
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
@@ -62,6 +63,14 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
62
63
  * Language
63
64
  */
64
65
  this.language = 'en';
66
+ /**
67
+ * Client custom styling via string
68
+ */
69
+ this.clientStyling = '';
70
+ /**
71
+ * Client custom styling via url content
72
+ */
73
+ this.clientStylingUrlContent = '';
65
74
  this.multiplier = false;
66
75
  this.numberOfDraws = 1;
67
76
  this.isLoading = true;
@@ -69,6 +78,19 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
69
78
  this.ticketDone = false;
70
79
  this.isCustomSelect = false;
71
80
  this.amountInfo = {};
81
+ this.limitStylingAppends = false;
82
+ this.setClientStyling = () => {
83
+ let sheet = document.createElement('style');
84
+ sheet.innerHTML = this.clientStyling;
85
+ this.stylingContainer.prepend(sheet);
86
+ };
87
+ this.setClientStylingURL = () => {
88
+ let cssFile = document.createElement('style');
89
+ setTimeout(() => {
90
+ cssFile.innerHTML = this.clientStylingUrlContent;
91
+ this.stylingContainer.prepend(cssFile);
92
+ }, 1);
93
+ };
72
94
  }
73
95
  /**
74
96
  * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
@@ -102,6 +124,17 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
102
124
  console.error('Error!', err);
103
125
  });
104
126
  }
127
+ componentDidRender() {
128
+ // start custom styling area
129
+ if (!this.limitStylingAppends && this.stylingContainer) {
130
+ if (this.clientStyling)
131
+ this.setClientStyling();
132
+ if (this.clientStylingUrlContent)
133
+ this.setClientStylingURL();
134
+ this.limitStylingAppends = true;
135
+ }
136
+ // end custom styling area
137
+ }
105
138
  multiplierChangeHandler(e) {
106
139
  this.multiplier = e.target ? e.target.checked : false;
107
140
  this.multiplierChange.emit(this.multiplier);
@@ -150,9 +183,9 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
150
183
  }
151
184
  else {
152
185
  const { rules } = this.gameData;
153
- return (h("div", { class: "TicketContainer" }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
186
+ return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
154
187
  h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
155
- h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
188
+ h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), rules.multiplier &&
156
189
  h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
157
190
  h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
158
191
  (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
@@ -172,28 +205,40 @@ const LotteryTicket$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
172
205
  "resetButton": [4, "reset-button"],
173
206
  "autoPick": [4, "auto-pick"],
174
207
  "language": [1],
208
+ "clientStyling": [1, "client-styling"],
209
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
175
210
  "multiplier": [32],
176
211
  "numberOfDraws": [32],
177
212
  "isLoading": [32],
178
213
  "hasErrors": [32],
179
214
  "ticketDone": [32],
180
215
  "isCustomSelect": [32],
181
- "amountInfo": [32]
216
+ "amountInfo": [32],
217
+ "limitStylingAppends": [32]
182
218
  }, [[8, "click", "checkForClickOutside"], [0, "gridFilled", "gridFilledHandler"]]]);
183
219
  function defineCustomElement$1() {
184
220
  if (typeof customElements === "undefined") {
185
221
  return;
186
222
  }
187
- const components = ["lottery-ticket"];
223
+ const components = ["lottery-ticket", "lottery-bullet", "lottery-grid"];
188
224
  components.forEach(tagName => { switch (tagName) {
189
225
  case "lottery-ticket":
190
226
  if (!customElements.get(tagName)) {
191
227
  customElements.define(tagName, LotteryTicket$1);
192
228
  }
193
229
  break;
230
+ case "lottery-bullet":
231
+ if (!customElements.get(tagName)) {
232
+ defineCustomElement$3();
233
+ }
234
+ break;
235
+ case "lottery-grid":
236
+ if (!customElements.get(tagName)) {
237
+ defineCustomElement$2();
238
+ }
239
+ break;
194
240
  } });
195
241
  }
196
- defineCustomElement$1();
197
242
 
198
243
  const LotteryTicket = LotteryTicket$1;
199
244
  const defineCustomElement = defineCustomElement$1;
@@ -53,6 +53,8 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
53
53
  }
54
54
  };
55
55
  const getHostListenerTarget = (elm, flags) => {
56
+ if (flags & 4 /* TargetDocument */)
57
+ return doc;
56
58
  if (flags & 8 /* TargetWindow */)
57
59
  return win;
58
60
  return elm;
@@ -246,6 +248,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
246
248
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
247
249
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
248
250
  }
251
+ else if (memberName === 'ref') {
252
+ // minifier will clean this up
253
+ if (newValue) {
254
+ newValue(elm);
255
+ }
256
+ }
249
257
  else if ((!isProp ) &&
250
258
  memberName[0] === 'o' &&
251
259
  memberName[1] === 'n') {
@@ -402,6 +410,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
402
410
  for (; startIdx <= endIdx; ++startIdx) {
403
411
  if ((vnode = vnodes[startIdx])) {
404
412
  elm = vnode.$elm$;
413
+ callNodeRefs(vnode);
405
414
  // remove the vnode's element from the dom
406
415
  elm.remove();
407
416
  }
@@ -520,6 +529,12 @@ const patch = (oldVNode, newVNode) => {
520
529
  elm.data = text;
521
530
  }
522
531
  };
532
+ const callNodeRefs = (vNode) => {
533
+ {
534
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
535
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
536
+ }
537
+ };
523
538
  const renderVdom = (hostRef, renderFnResults) => {
524
539
  const hostElm = hostRef.$hostElement$;
525
540
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -661,7 +676,11 @@ const postUpdateComponent = (hostRef) => {
661
676
  const tagName = hostRef.$cmpMeta$.$tagName$;
662
677
  const elm = hostRef.$hostElement$;
663
678
  const endPostUpdate = createTime('postUpdate', tagName);
679
+ const instance = hostRef.$lazyInstance$ ;
664
680
  const ancestorComponent = hostRef.$ancestorComponent$;
681
+ {
682
+ safeCall(instance, 'componentDidRender');
683
+ }
665
684
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
666
685
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
667
686
  {
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-7f2eb2db.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-7790b5a7.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["lottery-ticket",[[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]]]]], options);
13
+ return bootstrapLazy([["lottery-bullet_3",[[1,"lottery-ticket",{"endpoint":[1],"gameId":[1,"game-id"],"numberOfGrids":[2,"number-of-grids"],"multipleDraws":[4,"multiple-draws"],"ticketId":[2,"ticket-id"],"resetButton":[4,"reset-button"],"autoPick":[4,"auto-pick"],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"multiplier":[32],"numberOfDraws":[32],"isLoading":[32],"hasErrors":[32],"ticketDone":[32],"isCustomSelect":[32],"amountInfo":[32],"limitStylingAppends":[32]},[[8,"click","checkForClickOutside"],[0,"gridFilled","gridFilledHandler"]]],[1,"lottery-grid",{"ticketId":[2,"ticket-id"],"totalNumbers":[2,"total-numbers"],"gameId":[1,"game-id"],"maximumAllowed":[2,"maximum-allowed"],"minimumAllowed":[2,"minimum-allowed"],"selectable":[4],"selectedNumbers":[1,"selected-numbers"],"displaySelected":[4,"display-selected"],"language":[1],"gridIndex":[2,"grid-index"],"gridType":[1,"grid-type"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"numbers":[32],"limitStylingAppends":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]}]]]], options);
14
14
  });
15
15
  };
16
16