@everymatrix/lottery-ticket-controller 0.1.7 → 0.1.21

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.
Files changed (26) hide show
  1. package/dist/cjs/helper-accordion_5.cjs.entry.js +236 -25
  2. package/dist/cjs/{index-95915aab.js → index-dd94b8db.js} +17 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/lottery-ticket-controller.cjs.js +2 -2
  5. package/dist/collection/components/lottery-ticket-controller/lottery-ticket-controller.js +76 -4
  6. package/dist/collection/utils/locale.utils.js +20 -0
  7. package/dist/components/helper-accordion2.js +44 -3
  8. package/dist/components/lottery-bullet2.js +37 -2
  9. package/dist/components/lottery-grid2.js +43 -3
  10. package/dist/components/lottery-ticket-controller.js +58 -2
  11. package/dist/components/lottery-ticket2.js +58 -3
  12. package/dist/esm/helper-accordion_5.entry.js +236 -25
  13. package/dist/esm/{index-e3877ca0.js → index-74cef6d4.js} +17 -0
  14. package/dist/esm/loader.js +2 -2
  15. package/dist/esm/lottery-ticket-controller.js +2 -2
  16. package/dist/lottery-ticket-controller/lottery-ticket-controller.esm.js +1 -1
  17. package/dist/lottery-ticket-controller/p-72e48800.js +1 -0
  18. package/dist/lottery-ticket-controller/p-9a5da031.entry.js +1 -0
  19. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-ticket-controller/.stencil/packages/lottery-ticket-controller/stencil.config.d.ts +2 -0
  20. package/dist/types/components/lottery-ticket-controller/lottery-ticket-controller.d.ts +13 -0
  21. package/dist/types/components.d.ts +16 -0
  22. package/dist/types/utils/locale.utils.d.ts +1 -0
  23. package/package.json +5 -1
  24. package/dist/lottery-ticket-controller/p-3971b8e6.js +0 -1
  25. package/dist/lottery-ticket-controller/p-95406ad0.entry.js +0 -1
  26. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-ticket-controller/.stencil/packages/lottery-ticket-controller/stencil.config.d.ts +0 -2
@@ -2,24 +2,30 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-95915aab.js');
5
+ const index = require('./index-dd94b8db.js');
6
6
 
7
- const DEFAULT_LANGUAGE$1 = 'en';
8
- const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
9
- const TRANSLATIONS$1 = {
7
+ const DEFAULT_LANGUAGE$2 = 'en';
8
+ const SUPPORTED_LANGUAGES$2 = ['ro', 'en'];
9
+ const TRANSLATIONS$2 = {
10
10
  en: {
11
11
  deleteTicket: 'Delete ticket'
12
12
  },
13
13
  ro: {
14
14
  deleteTicket: 'Sterge biletul'
15
15
  },
16
+ fr: {
17
+ deleteTicket: 'Supprimer le billet'
18
+ },
19
+ ar: {
20
+ deleteTicket: 'حذف التذكرة'
21
+ }
16
22
  };
17
- const translate$1 = (key, customLang) => {
23
+ const translate$2 = (key, customLang) => {
18
24
  const lang = customLang;
19
- return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
25
+ return TRANSLATIONS$2[lang !== undefined && SUPPORTED_LANGUAGES$2.includes(lang) ? lang : DEFAULT_LANGUAGE$2][key];
20
26
  };
21
27
 
22
- const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px 4px 0 0;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
28
+ const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:1px}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff;text-transform:capitalize}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
23
29
 
24
30
  const Accordion = class {
25
31
  constructor(hostRef) {
@@ -65,11 +71,43 @@ const Accordion = class {
65
71
  * Language
66
72
  */
67
73
  this.language = 'en';
74
+ /**
75
+ * Client custom styling via string
76
+ */
77
+ this.clientStyling = '';
78
+ /**
79
+ * Client custom styling via url content
80
+ */
81
+ this.clientStylingUrlContent = '';
82
+ this.limitStylingAppends = false;
83
+ this.setClientStyling = () => {
84
+ let sheet = document.createElement('style');
85
+ sheet.innerHTML = this.clientStyling;
86
+ this.stylingContainer.prepend(sheet);
87
+ };
88
+ this.setClientStylingURL = () => {
89
+ let cssFile = document.createElement('style');
90
+ setTimeout(() => {
91
+ cssFile.innerHTML = this.clientStylingUrlContent;
92
+ this.stylingContainer.prepend(cssFile);
93
+ }, 1);
94
+ };
68
95
  }
69
96
  // @TODO fix the `any` type :)
70
97
  connectedCallback() {
71
98
  this.showContent = !this.collapsed;
72
99
  }
100
+ componentDidRender() {
101
+ // start custom styling area
102
+ if (!this.limitStylingAppends && this.stylingContainer) {
103
+ if (this.clientStyling)
104
+ this.setClientStyling();
105
+ if (this.clientStylingUrlContent)
106
+ this.setClientStylingURL();
107
+ this.limitStylingAppends = true;
108
+ }
109
+ // end custom styling area
110
+ }
73
111
  toggleContent() {
74
112
  this.showContent = !this.showContent;
75
113
  }
@@ -81,10 +119,10 @@ const Accordion = class {
81
119
  this.accordionEvent.emit();
82
120
  }
83
121
  render() {
84
- return (index.h("div", { class: "Wrapper" }, index.h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
122
+ return (index.h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, index.h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle Description" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
85
123
  index.h("div", null, index.h("div", { class: "Content" }, index.h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
86
124
  index.h("div", null, this.deleteTab &&
87
- index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$1('deleteTicket', this.language)))))));
125
+ index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate$2('deleteTicket', this.language)))))));
88
126
  }
89
127
  };
90
128
  Accordion.style = helperAccordionCss;
@@ -107,6 +145,15 @@ const LotteryBullet = class {
107
145
  * Marks if the bullet should be selected
108
146
  */
109
147
  this.isSelected = false;
148
+ /**
149
+ * Client custom styling via string
150
+ */
151
+ this.clientStyling = '';
152
+ /**
153
+ * Client custom styling via url content
154
+ */
155
+ this.clientStylingUrlContent = '';
156
+ this.limitStylingAppends = false;
110
157
  this.select = () => {
111
158
  if (this.selectable) {
112
159
  this.isSelected = !this.isSelected;
@@ -116,14 +163,37 @@ const LotteryBullet = class {
116
163
  });
117
164
  }
118
165
  };
166
+ this.setClientStyling = () => {
167
+ let sheet = document.createElement('style');
168
+ sheet.innerHTML = this.clientStyling;
169
+ this.stylingContainer.prepend(sheet);
170
+ };
171
+ this.setClientStylingURL = () => {
172
+ let cssFile = document.createElement('style');
173
+ setTimeout(() => {
174
+ cssFile.innerHTML = this.clientStylingUrlContent;
175
+ this.stylingContainer.prepend(cssFile);
176
+ }, 1);
177
+ };
178
+ }
179
+ componentDidRender() {
180
+ // start custom styling area
181
+ if (!this.limitStylingAppends && this.stylingContainer) {
182
+ if (this.clientStyling)
183
+ this.setClientStyling();
184
+ if (this.clientStylingUrlContent)
185
+ this.setClientStylingURL();
186
+ this.limitStylingAppends = true;
187
+ }
188
+ // end custom styling area
119
189
  }
120
190
  render() {
121
- return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
191
+ return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
122
192
  }
123
193
  };
124
194
  LotteryBullet.style = lotteryBulletCss;
125
195
 
126
- 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:25px}";
196
+ 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}";
127
197
 
128
198
  const LotteryGrid = class {
129
199
  constructor(hostRef) {
@@ -158,8 +228,33 @@ const LotteryGrid = class {
158
228
  * Language
159
229
  */
160
230
  this.language = 'en';
231
+ /**
232
+ * Personalize grid for ticket
233
+ */
234
+ this.gridType = '';
235
+ /**
236
+ * Client custom styling via string
237
+ */
238
+ this.clientStyling = '';
239
+ /**
240
+ * Client custom styling via url content
241
+ */
242
+ this.clientStylingUrlContent = '';
161
243
  this.numbers = [];
244
+ this.limitStylingAppends = false;
162
245
  this.selectedCounter = 0;
246
+ this.setClientStyling = () => {
247
+ let sheet = document.createElement('style');
248
+ sheet.innerHTML = this.clientStyling;
249
+ this.stylingContainer.prepend(sheet);
250
+ };
251
+ this.setClientStylingURL = () => {
252
+ let cssFile = document.createElement('style');
253
+ setTimeout(() => {
254
+ cssFile.innerHTML = this.clientStylingUrlContent;
255
+ this.stylingContainer.prepend(cssFile);
256
+ }, 1);
257
+ };
163
258
  }
164
259
  connectedCallback() {
165
260
  let selected = [];
@@ -188,6 +283,17 @@ const LotteryGrid = class {
188
283
  });
189
284
  }
190
285
  }
286
+ componentDidRender() {
287
+ // start custom styling area
288
+ if (!this.limitStylingAppends && this.stylingContainer) {
289
+ if (this.clientStyling)
290
+ this.setClientStyling();
291
+ if (this.clientStylingUrlContent)
292
+ this.setClientStylingURL();
293
+ this.limitStylingAppends = true;
294
+ }
295
+ // end custom styling area
296
+ }
191
297
  lotteryBulletSelectionHandler(event) {
192
298
  this.numbers = this.numbers.map((item) => {
193
299
  if (item.number == event.detail.value) {
@@ -278,14 +384,14 @@ const LotteryGrid = class {
278
384
  }
279
385
  }
280
386
  render() {
281
- return (index.h("div", { class: "GridContainer" }, index.h("div", { class: "Grid" }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
387
+ return (index.h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, index.h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => index.h("div", null, index.h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
282
388
  }
283
389
  };
284
390
  LotteryGrid.style = lotteryGridCss;
285
391
 
286
- const DEFAULT_LANGUAGE = 'en';
287
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
288
- const TRANSLATIONS = {
392
+ const DEFAULT_LANGUAGE$1 = 'en';
393
+ const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
394
+ const TRANSLATIONS$1 = {
289
395
  en: {
290
396
  loading: 'Loading, please wait ...',
291
397
  error: 'It was an error while trying to fetch the data',
@@ -306,10 +412,30 @@ const TRANSLATIONS = {
306
412
  resetButton: 'Reseteaza',
307
413
  autoButton: 'Ma simt norocos'
308
414
  },
415
+ fr: {
416
+ loading: 'Loading, please wait ...',
417
+ error: 'It was an error while trying to fetch the data',
418
+ grid: 'Grid',
419
+ multiplier: 'Multiplier',
420
+ numberOfDraws: 'Number of draws',
421
+ wagerPerDraw: 'Wager per draw',
422
+ resetButton: 'Reset',
423
+ autoButton: 'I feel lucky'
424
+ },
425
+ ar: {
426
+ loading: 'Loading, please wait ...',
427
+ error: 'It was an error while trying to fetch the data',
428
+ grid: 'Grid',
429
+ multiplier: 'Multiplier',
430
+ numberOfDraws: 'Number of draws',
431
+ wagerPerDraw: 'Wager per draw',
432
+ resetButton: 'Reset',
433
+ autoButton: 'I feel lucky'
434
+ }
309
435
  };
310
- const translate = (key, customLang) => {
436
+ const translate$1 = (key, customLang) => {
311
437
  const lang = customLang;
312
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
438
+ return TRANSLATIONS$1[lang !== undefined && SUPPORTED_LANGUAGES$1.includes(lang) ? lang : DEFAULT_LANGUAGE$1][key];
313
439
  };
314
440
 
315
441
  const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #F1F1F1 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
@@ -342,6 +468,14 @@ const LotteryTicket = class {
342
468
  * Language
343
469
  */
344
470
  this.language = 'en';
471
+ /**
472
+ * Client custom styling via string
473
+ */
474
+ this.clientStyling = '';
475
+ /**
476
+ * Client custom styling via url content
477
+ */
478
+ this.clientStylingUrlContent = '';
345
479
  this.multiplier = false;
346
480
  this.numberOfDraws = 1;
347
481
  this.isLoading = true;
@@ -349,6 +483,19 @@ const LotteryTicket = class {
349
483
  this.ticketDone = false;
350
484
  this.isCustomSelect = false;
351
485
  this.amountInfo = {};
486
+ this.limitStylingAppends = false;
487
+ this.setClientStyling = () => {
488
+ let sheet = document.createElement('style');
489
+ sheet.innerHTML = this.clientStyling;
490
+ this.stylingContainer.prepend(sheet);
491
+ };
492
+ this.setClientStylingURL = () => {
493
+ let cssFile = document.createElement('style');
494
+ setTimeout(() => {
495
+ cssFile.innerHTML = this.clientStylingUrlContent;
496
+ this.stylingContainer.prepend(cssFile);
497
+ }, 1);
498
+ };
352
499
  }
353
500
  /**
354
501
  * @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
@@ -382,6 +529,17 @@ const LotteryTicket = class {
382
529
  console.error('Error!', err);
383
530
  });
384
531
  }
532
+ componentDidRender() {
533
+ // start custom styling area
534
+ if (!this.limitStylingAppends && this.stylingContainer) {
535
+ if (this.clientStyling)
536
+ this.setClientStyling();
537
+ if (this.clientStylingUrlContent)
538
+ this.setClientStylingURL();
539
+ this.limitStylingAppends = true;
540
+ }
541
+ // end custom styling area
542
+ }
385
543
  multiplierChangeHandler(e) {
386
544
  this.multiplier = e.target ? e.target.checked : false;
387
545
  this.multiplierChange.emit(this.multiplier);
@@ -422,19 +580,19 @@ const LotteryTicket = class {
422
580
  }
423
581
  render() {
424
582
  if (this.isLoading) {
425
- return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
583
+ return (index.h("div", null, index.h("p", null, translate$1('loading', this.language))));
426
584
  }
427
585
  else {
428
586
  if (this.hasErrors) {
429
- return (index.h("div", null, index.h("p", null, translate('error', this.language))));
587
+ return (index.h("div", null, index.h("p", null, translate$1('error', this.language))));
430
588
  }
431
589
  else {
432
590
  const { rules } = this.gameData;
433
- return (index.h("div", { class: "TicketContainer" }, index.h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
434
- index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
435
- index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": rules.boards[index$1].maximumAllowed, "minimum-allowed": rules.boards[index$1].minimumAllowed, "total-numbers": rules.boards[index$1].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language }))), rules.multiplier &&
436
- index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
437
- index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("div", null, index.h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
591
+ return (index.h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, index.h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
592
+ index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate$1('resetButton', this.language))), this.autoPick && !this.ticketDone &&
593
+ index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate$1('autoButton', this.language))), this.grids.map((item, index$1) => index.h("div", { class: "TicketGridBullets" }, index.h("p", { class: "TicketGridTitle" }, translate$1('grid', this.language), " ", item), index.h("lottery-grid", { "grid-index": index$1, "maximum-allowed": rules.boards[index$1].maximumAllowed, "minimum-allowed": rules.boards[index$1].minimumAllowed, "total-numbers": rules.boards[index$1].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 &&
594
+ index.h("div", null, index.h("label", { class: "Toggle" }, index.h("label", { class: "Label" }, translate$1('multiplier', this.language), ": "), index.h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), index.h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
595
+ index.h("div", { class: "TicketDraws" }, index.h("label", { class: "Label" }, translate$1('numberOfDraws', this.language), ": "), index.h("div", { class: "NumberInput" }, index.h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), index.h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), index.h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), index.h("div", null, index.h("label", { class: "Label" }, translate$1('wagerPerDraw', this.language), ": "), index.h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
438
596
  (index.h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, index.h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, index.h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), index.h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), index.h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, index.h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => index.h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (index.h("div", null, index.h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), index.h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
439
597
  }
440
598
  }
@@ -445,6 +603,27 @@ const LotteryTicket = class {
445
603
  };
446
604
  LotteryTicket.style = lotteryTicketCss;
447
605
 
606
+ const DEFAULT_LANGUAGE = 'en';
607
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
608
+ const TRANSLATIONS = {
609
+ en: {
610
+ ticket: 'Ticket',
611
+ },
612
+ ro: {
613
+ ticket: 'Bilet',
614
+ },
615
+ fr: {
616
+ ticket: 'Billet'
617
+ },
618
+ ar: {
619
+ ticket: 'تذكرة',
620
+ }
621
+ };
622
+ const translate = (key, customLang) => {
623
+ const lang = customLang;
624
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
625
+ };
626
+
448
627
  const lotteryTicketControllerCss = ":host{display:block}";
449
628
 
450
629
  const LotteryTicketController = class {
@@ -491,6 +670,27 @@ const LotteryTicketController = class {
491
670
  * Shows the reset button
492
671
  */
493
672
  this.resetButton = false;
673
+ /**
674
+ * Client custom styling via string
675
+ */
676
+ this.clientStyling = '';
677
+ /**
678
+ * Client custom styling via url content
679
+ */
680
+ this.clientStylingUrlContent = '';
681
+ this.limitStylingAppends = false;
682
+ this.setClientStyling = () => {
683
+ let sheet = document.createElement('style');
684
+ sheet.innerHTML = this.clientStyling;
685
+ this.stylingContainer.prepend(sheet);
686
+ };
687
+ this.setClientStylingURL = () => {
688
+ let cssFile = document.createElement('style');
689
+ setTimeout(() => {
690
+ cssFile.innerHTML = this.clientStylingUrlContent;
691
+ this.stylingContainer.prepend(cssFile);
692
+ }, 1);
693
+ };
494
694
  }
495
695
  // @TODO fix the `any` type
496
696
  helperAccordionActionHandler() {
@@ -501,8 +701,19 @@ const LotteryTicketController = class {
501
701
  ticketId: this.ticketId
502
702
  });
503
703
  }
704
+ componentDidRender() {
705
+ // start custom styling area
706
+ if (!this.limitStylingAppends && this.stylingContainer) {
707
+ if (this.clientStyling)
708
+ this.setClientStyling();
709
+ if (this.clientStylingUrlContent)
710
+ this.setClientStylingURL();
711
+ this.limitStylingAppends = true;
712
+ }
713
+ // end custom styling area
714
+ }
504
715
  render() {
505
- return (index.h("div", null, index.h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, index.h("div", { slot: "accordionContent" }, index.h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
716
+ return (index.h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el }, index.h("helper-accordion", { "header-title": `${translate('ticket', this.language)} ${this.ticketId}`, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }, index.h("div", { slot: "accordionContent" }, index.h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))));
506
717
  }
507
718
  };
508
719
  LotteryTicketController.style = lotteryTicketControllerCss;
@@ -270,6 +270,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
270
270
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
271
271
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
272
272
  }
273
+ else if (memberName === 'ref') {
274
+ // minifier will clean this up
275
+ if (newValue) {
276
+ newValue(elm);
277
+ }
278
+ }
273
279
  else if ((!isProp ) &&
274
280
  memberName[0] === 'o' &&
275
281
  memberName[1] === 'n') {
@@ -426,6 +432,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
426
432
  for (; startIdx <= endIdx; ++startIdx) {
427
433
  if ((vnode = vnodes[startIdx])) {
428
434
  elm = vnode.$elm$;
435
+ callNodeRefs(vnode);
429
436
  // remove the vnode's element from the dom
430
437
  elm.remove();
431
438
  }
@@ -547,6 +554,12 @@ const patch = (oldVNode, newVNode) => {
547
554
  elm.data = text;
548
555
  }
549
556
  };
557
+ const callNodeRefs = (vNode) => {
558
+ {
559
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
560
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
561
+ }
562
+ };
550
563
  const renderVdom = (hostRef, renderFnResults) => {
551
564
  const hostElm = hostRef.$hostElement$;
552
565
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -688,7 +701,11 @@ const postUpdateComponent = (hostRef) => {
688
701
  const tagName = hostRef.$cmpMeta$.$tagName$;
689
702
  const elm = hostRef.$hostElement$;
690
703
  const endPostUpdate = createTime('postUpdate', tagName);
704
+ const instance = hostRef.$lazyInstance$ ;
691
705
  const ancestorComponent = hostRef.$ancestorComponent$;
706
+ {
707
+ safeCall(instance, 'componentDidRender');
708
+ }
692
709
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
693
710
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
694
711
  {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-95915aab.js');
5
+ const index = require('./index-dd94b8db.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[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"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}],[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"],"numbers":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]]], options);
17
+ return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[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,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showContent":[32],"limitStylingAppends":[32]}],[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);
18
18
  });
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-95915aab.js');
3
+ const index = require('./index-dd94b8db.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[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"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}],[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"],"numbers":[32]},[[0,"lotteryBulletSelection","lotteryBulletSelectionHandler"],[4,"resetSelection","resetSelectionHandler"],[4,"autoSelection","autoSelectionHandler"]]],[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]]], options);
18
+ return index.bootstrapLazy([["helper-accordion_5.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"limitStylingAppends":[32]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[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,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showContent":[32],"limitStylingAppends":[32]}],[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);
19
19
  });
@@ -1,6 +1,7 @@
1
- import { Component, h, Listen, Prop, Event } from '@stencil/core';
1
+ import { Component, h, Listen, Prop, Event, State } from '@stencil/core';
2
2
  import '@everymatrix/helper-accordion';
3
3
  import '@everymatrix/lottery-ticket';
4
+ import { translate } from '../../utils/locale.utils';
4
5
  export class LotteryTicketController {
5
6
  constructor() {
6
7
  /**
@@ -43,6 +44,27 @@ export class LotteryTicketController {
43
44
  * Shows the reset button
44
45
  */
45
46
  this.resetButton = false;
47
+ /**
48
+ * Client custom styling via string
49
+ */
50
+ this.clientStyling = '';
51
+ /**
52
+ * Client custom styling via url content
53
+ */
54
+ this.clientStylingUrlContent = '';
55
+ this.limitStylingAppends = false;
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
+ };
46
68
  }
47
69
  // @TODO fix the `any` type
48
70
  helperAccordionActionHandler() {
@@ -53,11 +75,22 @@ export class LotteryTicketController {
53
75
  ticketId: this.ticketId
54
76
  });
55
77
  }
78
+ componentDidRender() {
79
+ // start custom styling area
80
+ if (!this.limitStylingAppends && this.stylingContainer) {
81
+ if (this.clientStyling)
82
+ this.setClientStyling();
83
+ if (this.clientStylingUrlContent)
84
+ this.setClientStylingURL();
85
+ this.limitStylingAppends = true;
86
+ }
87
+ // end custom styling area
88
+ }
56
89
  render() {
57
- return (h("div", null,
58
- h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language },
90
+ return (h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el },
91
+ h("helper-accordion", { "header-title": `${translate('ticket', this.language)} ${this.ticketId}`, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent },
59
92
  h("div", { slot: "accordionContent" },
60
- h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
93
+ h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent })))));
61
94
  }
62
95
  static get is() { return "lottery-ticket-controller"; }
63
96
  static get encapsulation() { return "shadow"; }
@@ -281,8 +314,47 @@ export class LotteryTicketController {
281
314
  "attribute": "reset-button",
282
315
  "reflect": false,
283
316
  "defaultValue": "false"
317
+ },
318
+ "clientStyling": {
319
+ "type": "string",
320
+ "mutable": false,
321
+ "complexType": {
322
+ "original": "string",
323
+ "resolved": "string",
324
+ "references": {}
325
+ },
326
+ "required": false,
327
+ "optional": false,
328
+ "docs": {
329
+ "tags": [],
330
+ "text": "Client custom styling via string"
331
+ },
332
+ "attribute": "client-styling",
333
+ "reflect": false,
334
+ "defaultValue": "''"
335
+ },
336
+ "clientStylingUrlContent": {
337
+ "type": "string",
338
+ "mutable": false,
339
+ "complexType": {
340
+ "original": "string",
341
+ "resolved": "string",
342
+ "references": {}
343
+ },
344
+ "required": false,
345
+ "optional": false,
346
+ "docs": {
347
+ "tags": [],
348
+ "text": "Client custom styling via url content"
349
+ },
350
+ "attribute": "client-styling-url-content",
351
+ "reflect": false,
352
+ "defaultValue": "''"
284
353
  }
285
354
  }; }
355
+ static get states() { return {
356
+ "limitStylingAppends": {}
357
+ }; }
286
358
  static get events() { return [{
287
359
  "method": "deleteTicketEvent",
288
360
  "name": "deleteTicket",