@everymatrix/lottery-ticket-controller 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.
Files changed (40) hide show
  1. package/dist/cjs/helper-accordion_5.cjs.entry.js +661 -0
  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/collection-manifest.json +1 -7
  6. package/dist/collection/components/lottery-ticket-controller/lottery-ticket-controller.js +76 -4
  7. package/dist/collection/utils/locale.utils.js +14 -0
  8. package/dist/components/helper-accordion2.js +38 -4
  9. package/dist/components/lottery-bullet2.js +37 -3
  10. package/dist/components/lottery-grid2.js +43 -4
  11. package/dist/components/lottery-ticket-controller.js +52 -3
  12. package/dist/components/lottery-ticket2.js +0 -1
  13. package/dist/esm/helper-accordion_5.entry.js +653 -0
  14. package/dist/esm/{index-e3877ca0.js → index-74cef6d4.js} +17 -0
  15. package/dist/esm/loader.js +2 -2
  16. package/dist/esm/lottery-ticket-controller.js +2 -2
  17. package/dist/lottery-ticket-controller/lottery-ticket-controller.esm.js +1 -1
  18. package/dist/lottery-ticket-controller/p-72e48800.js +1 -0
  19. package/dist/lottery-ticket-controller/p-88036907.entry.js +1 -0
  20. package/dist/stencil.config.js +0 -3
  21. package/dist/types/components/lottery-ticket-controller/lottery-ticket-controller.d.ts +13 -0
  22. package/dist/types/components.d.ts +16 -0
  23. package/dist/types/utils/locale.utils.d.ts +1 -0
  24. package/package.json +6 -2
  25. package/dist/cjs/helper-accordion.cjs.entry.js +0 -92
  26. package/dist/cjs/lottery-bullet.cjs.entry.js +0 -41
  27. package/dist/cjs/lottery-grid.cjs.entry.js +0 -167
  28. package/dist/cjs/lottery-ticket-controller.cjs.entry.js +0 -69
  29. package/dist/cjs/lottery-ticket.cjs.entry.js +0 -169
  30. package/dist/esm/helper-accordion.entry.js +0 -88
  31. package/dist/esm/lottery-bullet.entry.js +0 -37
  32. package/dist/esm/lottery-grid.entry.js +0 -163
  33. package/dist/esm/lottery-ticket-controller.entry.js +0 -65
  34. package/dist/esm/lottery-ticket.entry.js +0 -165
  35. package/dist/lottery-ticket-controller/p-25f1639a.entry.js +0 -1
  36. package/dist/lottery-ticket-controller/p-3971b8e6.js +0 -1
  37. package/dist/lottery-ticket-controller/p-40d1058f.entry.js +0 -1
  38. package/dist/lottery-ticket-controller/p-dc525e6c.entry.js +0 -1
  39. package/dist/lottery-ticket-controller/p-f08b1b06.entry.js +0 -1
  40. package/dist/lottery-ticket-controller/p-f886ec7e.entry.js +0 -1
@@ -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([["lottery-bullet.cjs",[[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]],["lottery-grid.cjs",[[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"]]]]],["lottery-ticket.cjs",[[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"]]]]],["helper-accordion.cjs",[[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]}]]],["lottery-ticket-controller.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"]]]]]], 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],"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],"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([["lottery-bullet.cjs",[[1,"lottery-bullet",{"value":[1],"selectable":[4],"isSelected":[4,"is-selected"]}]]],["lottery-grid.cjs",[[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"]]]]],["lottery-ticket.cjs",[[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"]]]]],["helper-accordion.cjs",[[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]}]]],["lottery-ticket-controller.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"]]]]]], 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],"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],"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
  });
@@ -33,11 +33,5 @@
33
33
  ]
34
34
  }
35
35
  ],
36
- "bundles": [
37
- {
38
- "components": [
39
- "lottery-ticket-controller"
40
- ]
41
- }
42
- ]
36
+ "bundles": []
43
37
  }
@@ -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",
@@ -0,0 +1,14 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ ticket: 'Ticket',
6
+ },
7
+ ro: {
8
+ ticket: 'Bilet',
9
+ },
10
+ };
11
+ export const translate = (key, customLang) => {
12
+ const lang = customLang;
13
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
14
+ };
@@ -15,7 +15,7 @@ const translate = (key, customLang) => {
15
15
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
16
16
  };
17
17
 
18
- 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}";
18
+ 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}";
19
19
 
20
20
  const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
21
  constructor() {
@@ -63,11 +63,43 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
63
63
  * Language
64
64
  */
65
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 = '';
74
+ this.limitStylingAppends = false;
75
+ this.setClientStyling = () => {
76
+ let sheet = document.createElement('style');
77
+ sheet.innerHTML = this.clientStyling;
78
+ this.stylingContainer.prepend(sheet);
79
+ };
80
+ this.setClientStylingURL = () => {
81
+ let cssFile = document.createElement('style');
82
+ setTimeout(() => {
83
+ cssFile.innerHTML = this.clientStylingUrlContent;
84
+ this.stylingContainer.prepend(cssFile);
85
+ }, 1);
86
+ };
66
87
  }
67
88
  // @TODO fix the `any` type :)
68
89
  connectedCallback() {
69
90
  this.showContent = !this.collapsed;
70
91
  }
92
+ componentDidRender() {
93
+ // start custom styling area
94
+ if (!this.limitStylingAppends && this.stylingContainer) {
95
+ if (this.clientStyling)
96
+ this.setClientStyling();
97
+ if (this.clientStylingUrlContent)
98
+ this.setClientStylingURL();
99
+ this.limitStylingAppends = true;
100
+ }
101
+ // end custom styling area
102
+ }
71
103
  toggleContent() {
72
104
  this.showContent = !this.showContent;
73
105
  }
@@ -79,7 +111,7 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
79
111
  this.accordionEvent.emit();
80
112
  }
81
113
  render() {
82
- return (h("div", { class: "Wrapper" }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
114
+ return (h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle Description" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
83
115
  h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
84
116
  h("div", null, this.deleteTab &&
85
117
  h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
@@ -96,7 +128,10 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
96
128
  "eventName": [1, "event-name"],
97
129
  "collapsed": [4],
98
130
  "language": [1],
99
- "showContent": [32]
131
+ "clientStyling": [1, "client-styling"],
132
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
133
+ "showContent": [32],
134
+ "limitStylingAppends": [32]
100
135
  }]);
101
136
  function defineCustomElement() {
102
137
  if (typeof customElements === "undefined") {
@@ -111,6 +146,5 @@ function defineCustomElement() {
111
146
  break;
112
147
  } });
113
148
  }
114
- defineCustomElement();
115
149
 
116
150
  export { Accordion as A, defineCustomElement as d };
@@ -20,6 +20,15 @@ const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
20
20
  * Marks if the bullet should be selected
21
21
  */
22
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;
23
32
  this.select = () => {
24
33
  if (this.selectable) {
25
34
  this.isSelected = !this.isSelected;
@@ -29,15 +38,41 @@ const LotteryBullet = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
29
38
  });
30
39
  }
31
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
32
64
  }
33
65
  render() {
34
- return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
66
+ return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
35
67
  }
36
68
  static get style() { return lotteryBulletCss; }
37
69
  }, [1, "lottery-bullet", {
38
70
  "value": [1],
39
71
  "selectable": [4],
40
- "isSelected": [4, "is-selected"]
72
+ "isSelected": [4, "is-selected"],
73
+ "clientStyling": [1, "client-styling"],
74
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
75
+ "limitStylingAppends": [32]
41
76
  }]);
42
77
  function defineCustomElement() {
43
78
  if (typeof customElements === "undefined") {
@@ -52,6 +87,5 @@ function defineCustomElement() {
52
87
  break;
53
88
  } });
54
89
  }
55
- defineCustomElement();
56
90
 
57
91
  export { LotteryBullet as L, defineCustomElement as d };
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { d as defineCustomElement$1 } from './lottery-bullet2.js';
3
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:25px}";
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
5
 
6
6
  const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -38,8 +38,33 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
38
38
  * Language
39
39
  */
40
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 = '';
41
53
  this.numbers = [];
54
+ this.limitStylingAppends = false;
42
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
+ };
43
68
  }
44
69
  connectedCallback() {
45
70
  let selected = [];
@@ -68,6 +93,17 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
68
93
  });
69
94
  }
70
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
+ }
71
107
  lotteryBulletSelectionHandler(event) {
72
108
  this.numbers = this.numbers.map((item) => {
73
109
  if (item.number == event.detail.value) {
@@ -158,7 +194,7 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
158
194
  }
159
195
  }
160
196
  render() {
161
- return (h("div", { class: "GridContainer" }, h("div", { class: "Grid" }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
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 }))))));
162
198
  }
163
199
  static get style() { return lotteryGridCss; }
164
200
  }, [1, "lottery-grid", {
@@ -172,7 +208,11 @@ const LotteryGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
172
208
  "displaySelected": [4, "display-selected"],
173
209
  "language": [1],
174
210
  "gridIndex": [2, "grid-index"],
175
- "numbers": [32]
211
+ "gridType": [1, "grid-type"],
212
+ "clientStyling": [1, "client-styling"],
213
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
214
+ "numbers": [32],
215
+ "limitStylingAppends": [32]
176
216
  }, [[0, "lotteryBulletSelection", "lotteryBulletSelectionHandler"], [4, "resetSelection", "resetSelectionHandler"], [4, "autoSelection", "autoSelectionHandler"]]]);
177
217
  function defineCustomElement() {
178
218
  if (typeof customElements === "undefined") {
@@ -192,6 +232,5 @@ function defineCustomElement() {
192
232
  break;
193
233
  } });
194
234
  }
195
- defineCustomElement();
196
235
 
197
236
  export { LotteryGrid as L, defineCustomElement as d };
@@ -4,6 +4,21 @@ import { d as defineCustomElement$4 } from './lottery-bullet2.js';
4
4
  import { d as defineCustomElement$3 } from './lottery-grid2.js';
5
5
  import { d as defineCustomElement$2 } from './lottery-ticket2.js';
6
6
 
7
+ const DEFAULT_LANGUAGE = 'en';
8
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
9
+ const TRANSLATIONS = {
10
+ en: {
11
+ ticket: 'Ticket',
12
+ },
13
+ ro: {
14
+ ticket: 'Bilet',
15
+ },
16
+ };
17
+ const translate = (key, customLang) => {
18
+ const lang = customLang;
19
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
20
+ };
21
+
7
22
  const lotteryTicketControllerCss = ":host{display:block}";
8
23
 
9
24
  const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -52,6 +67,27 @@ const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends
52
67
  * Shows the reset button
53
68
  */
54
69
  this.resetButton = false;
70
+ /**
71
+ * Client custom styling via string
72
+ */
73
+ this.clientStyling = '';
74
+ /**
75
+ * Client custom styling via url content
76
+ */
77
+ this.clientStylingUrlContent = '';
78
+ this.limitStylingAppends = false;
79
+ this.setClientStyling = () => {
80
+ let sheet = document.createElement('style');
81
+ sheet.innerHTML = this.clientStyling;
82
+ this.stylingContainer.prepend(sheet);
83
+ };
84
+ this.setClientStylingURL = () => {
85
+ let cssFile = document.createElement('style');
86
+ setTimeout(() => {
87
+ cssFile.innerHTML = this.clientStylingUrlContent;
88
+ this.stylingContainer.prepend(cssFile);
89
+ }, 1);
90
+ };
55
91
  }
56
92
  // @TODO fix the `any` type
57
93
  helperAccordionActionHandler() {
@@ -62,8 +98,19 @@ const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends
62
98
  ticketId: this.ticketId
63
99
  });
64
100
  }
101
+ componentDidRender() {
102
+ // start custom styling area
103
+ if (!this.limitStylingAppends && this.stylingContainer) {
104
+ if (this.clientStyling)
105
+ this.setClientStyling();
106
+ if (this.clientStylingUrlContent)
107
+ this.setClientStylingURL();
108
+ this.limitStylingAppends = true;
109
+ }
110
+ // end custom styling area
111
+ }
65
112
  render() {
66
- return (h("div", null, 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 }, h("div", { slot: "accordionContent" }, 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 })))));
113
+ return (h("div", { class: "LotteryTicketControllerContainer", ref: el => this.stylingContainer = el }, 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 }, h("div", { slot: "accordionContent" }, 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 })))));
67
114
  }
68
115
  static get style() { return lotteryTicketControllerCss; }
69
116
  }, [1, "lottery-ticket-controller", {
@@ -78,7 +125,10 @@ const LotteryTicketController$1 = /*@__PURE__*/ proxyCustomElement(class extends
78
125
  "last": [4],
79
126
  "language": [1],
80
127
  "autoPick": [4, "auto-pick"],
81
- "resetButton": [4, "reset-button"]
128
+ "resetButton": [4, "reset-button"],
129
+ "clientStyling": [1, "client-styling"],
130
+ "clientStylingUrlContent": [1, "client-styling-url-content"],
131
+ "limitStylingAppends": [32]
82
132
  }, [[0, "helperAccordionAction", "helperAccordionActionHandler"]]]);
83
133
  function defineCustomElement$1() {
84
134
  if (typeof customElements === "undefined") {
@@ -113,7 +163,6 @@ function defineCustomElement$1() {
113
163
  break;
114
164
  } });
115
165
  }
116
- defineCustomElement$1();
117
166
 
118
167
  const LotteryTicketController = LotteryTicketController$1;
119
168
  const defineCustomElement = defineCustomElement$1;
@@ -204,6 +204,5 @@ function defineCustomElement() {
204
204
  break;
205
205
  } });
206
206
  }
207
- defineCustomElement();
208
207
 
209
208
  export { LotteryTicket as L, defineCustomElement as d };