@everymatrix/lottery-grid 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.
@@ -268,6 +268,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
268
268
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
269
269
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
270
270
  }
271
+ else if (memberName === 'ref') {
272
+ // minifier will clean this up
273
+ if (newValue) {
274
+ newValue(elm);
275
+ }
276
+ }
271
277
  else if ((!isProp ) &&
272
278
  memberName[0] === 'o' &&
273
279
  memberName[1] === 'n') {
@@ -424,6 +430,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
424
430
  for (; startIdx <= endIdx; ++startIdx) {
425
431
  if ((vnode = vnodes[startIdx])) {
426
432
  elm = vnode.$elm$;
433
+ callNodeRefs(vnode);
427
434
  // remove the vnode's element from the dom
428
435
  elm.remove();
429
436
  }
@@ -542,6 +549,12 @@ const patch = (oldVNode, newVNode) => {
542
549
  elm.data = text;
543
550
  }
544
551
  };
552
+ const callNodeRefs = (vNode) => {
553
+ {
554
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
555
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
556
+ }
557
+ };
545
558
  const renderVdom = (hostRef, renderFnResults) => {
546
559
  const hostElm = hostRef.$hostElement$;
547
560
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -683,7 +696,11 @@ const postUpdateComponent = (hostRef) => {
683
696
  const tagName = hostRef.$cmpMeta$.$tagName$;
684
697
  const elm = hostRef.$hostElement$;
685
698
  const endPostUpdate = createTime('postUpdate', tagName);
699
+ const instance = hostRef.$lazyInstance$ ;
686
700
  const ancestorComponent = hostRef.$ancestorComponent$;
701
+ {
702
+ safeCall(instance, 'componentDidRender');
703
+ }
687
704
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
688
705
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
689
706
  {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-74b5228f.js');
5
+ const index = require('./index-fdfc1a6c.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"]]]]]], options);
17
+ return index.bootstrapLazy([["lottery-bullet_2.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"],"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
 
@@ -0,0 +1,270 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-fdfc1a6c.js');
6
+
7
+ 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}";
8
+
9
+ const LotteryBullet = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.bulletEvent = index.createEvent(this, "lotteryBulletSelection", 7);
13
+ /**
14
+ * Value of the bullet
15
+ */
16
+ this.value = '0';
17
+ /**
18
+ * Marks if the bullet should be selectable
19
+ */
20
+ this.selectable = true;
21
+ /**
22
+ * Marks if the bullet should be selected
23
+ */
24
+ this.isSelected = false;
25
+ /**
26
+ * Client custom styling via string
27
+ */
28
+ this.clientStyling = '';
29
+ /**
30
+ * Client custom styling via url content
31
+ */
32
+ this.clientStylingUrlContent = '';
33
+ this.limitStylingAppends = false;
34
+ this.select = () => {
35
+ if (this.selectable) {
36
+ this.isSelected = !this.isSelected;
37
+ this.bulletEvent.emit({
38
+ value: this.value,
39
+ selected: this.isSelected
40
+ });
41
+ }
42
+ };
43
+ this.setClientStyling = () => {
44
+ let sheet = document.createElement('style');
45
+ sheet.innerHTML = this.clientStyling;
46
+ this.stylingContainer.prepend(sheet);
47
+ };
48
+ this.setClientStylingURL = () => {
49
+ let cssFile = document.createElement('style');
50
+ setTimeout(() => {
51
+ cssFile.innerHTML = this.clientStylingUrlContent;
52
+ this.stylingContainer.prepend(cssFile);
53
+ }, 1);
54
+ };
55
+ }
56
+ componentDidRender() {
57
+ // start custom styling area
58
+ if (!this.limitStylingAppends && this.stylingContainer) {
59
+ if (this.clientStyling)
60
+ this.setClientStyling();
61
+ if (this.clientStylingUrlContent)
62
+ this.setClientStylingURL();
63
+ this.limitStylingAppends = true;
64
+ }
65
+ // end custom styling area
66
+ }
67
+ render() {
68
+ return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
69
+ }
70
+ };
71
+ LotteryBullet.style = lotteryBulletCss;
72
+
73
+ 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}";
74
+
75
+ const LotteryGrid = class {
76
+ constructor(hostRef) {
77
+ index.registerInstance(this, hostRef);
78
+ this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
79
+ this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
80
+ /**
81
+ * Number of bullets of grid
82
+ */
83
+ this.totalNumbers = 0;
84
+ /**
85
+ * Number of maximum bullets that can be selected
86
+ */
87
+ this.maximumAllowed = 0;
88
+ /**
89
+ * Minimum allowed of bullets
90
+ */
91
+ this.minimumAllowed = 1;
92
+ /**
93
+ * Allows the user to select numbers on the grid
94
+ */
95
+ this.selectable = true;
96
+ /**
97
+ * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
98
+ */
99
+ this.selectedNumbers = '';
100
+ /**
101
+ * Show only selected numbers
102
+ */
103
+ this.displaySelected = false;
104
+ /**
105
+ * Language
106
+ */
107
+ this.language = 'en';
108
+ /**
109
+ * Personalize grid for ticket
110
+ */
111
+ this.gridType = '';
112
+ /**
113
+ * Client custom styling via string
114
+ */
115
+ this.clientStyling = '';
116
+ /**
117
+ * Client custom styling via url content
118
+ */
119
+ this.clientStylingUrlContent = '';
120
+ this.numbers = [];
121
+ this.limitStylingAppends = false;
122
+ this.selectedCounter = 0;
123
+ this.setClientStyling = () => {
124
+ let sheet = document.createElement('style');
125
+ sheet.innerHTML = this.clientStyling;
126
+ this.stylingContainer.prepend(sheet);
127
+ };
128
+ this.setClientStylingURL = () => {
129
+ let cssFile = document.createElement('style');
130
+ setTimeout(() => {
131
+ cssFile.innerHTML = this.clientStylingUrlContent;
132
+ this.stylingContainer.prepend(cssFile);
133
+ }, 1);
134
+ };
135
+ }
136
+ connectedCallback() {
137
+ let selected = [];
138
+ if (this.selectedNumbers.length > 0) {
139
+ selected = this.selectedNumbers.split(',');
140
+ this.selectedCounter = selected.length;
141
+ }
142
+ if (this.displaySelected) {
143
+ selected.forEach((item) => {
144
+ this.numbers.push({
145
+ number: item,
146
+ selected: true,
147
+ selectable: this.selectable
148
+ });
149
+ });
150
+ }
151
+ else {
152
+ [...Array(this.totalNumbers).keys()]
153
+ .map(number => (number + 1).toString())
154
+ .forEach((number) => {
155
+ this.numbers.push({
156
+ number,
157
+ selected: selected.indexOf(number) >= 0 ? true : false,
158
+ selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
159
+ });
160
+ });
161
+ }
162
+ }
163
+ componentDidRender() {
164
+ // start custom styling area
165
+ if (!this.limitStylingAppends && this.stylingContainer) {
166
+ if (this.clientStyling)
167
+ this.setClientStyling();
168
+ if (this.clientStylingUrlContent)
169
+ this.setClientStylingURL();
170
+ this.limitStylingAppends = true;
171
+ }
172
+ // end custom styling area
173
+ }
174
+ lotteryBulletSelectionHandler(event) {
175
+ this.numbers = this.numbers.map((item) => {
176
+ if (item.number == event.detail.value) {
177
+ return {
178
+ number: item.number,
179
+ selected: event.detail.selected,
180
+ selectable: item.selectable
181
+ };
182
+ }
183
+ return {
184
+ number: item.number,
185
+ selected: item.selected,
186
+ selectable: item.selectable
187
+ };
188
+ });
189
+ if (event.detail.selected) {
190
+ this.selectedCounter += 1;
191
+ if (this.selectedCounter == this.maximumAllowed) {
192
+ this.numbers = this.numbers.map((item) => {
193
+ return {
194
+ number: item.number,
195
+ selected: item.selected,
196
+ selectable: item.selected ? true : false
197
+ };
198
+ });
199
+ this.gridFilledEvent.emit({
200
+ id: this.ticketId,
201
+ index: this.gridIndex,
202
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
203
+ });
204
+ }
205
+ }
206
+ else {
207
+ if (this.selectedCounter == this.maximumAllowed) {
208
+ this.numbers = this.numbers.map((item) => {
209
+ return {
210
+ number: item.number,
211
+ selected: item.selected,
212
+ selectable: true
213
+ };
214
+ });
215
+ this.gridDirtyEvent.emit({
216
+ id: this.ticketId,
217
+ index: this.gridIndex,
218
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
219
+ });
220
+ }
221
+ this.selectedCounter -= 1;
222
+ }
223
+ }
224
+ async resetSelectionHandler(event) {
225
+ if (event.detail && event.detail == this.ticketId) {
226
+ this.selectedCounter = 0;
227
+ this.numbers = this.numbers.map((item) => {
228
+ return {
229
+ number: item.number,
230
+ selected: false,
231
+ selectable: this.selectable
232
+ };
233
+ });
234
+ this.gridDirtyEvent.emit({
235
+ id: this.ticketId,
236
+ index: this.gridIndex,
237
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
238
+ });
239
+ }
240
+ }
241
+ async autoSelectionHandler(event) {
242
+ if (event.detail && event.detail == this.ticketId) {
243
+ this.resetSelectionHandler(event);
244
+ let array = [...Array(this.totalNumbers).keys()]
245
+ .map(number => number + 1)
246
+ .sort(() => 0.5 - Math.random());
247
+ array = array.slice(0, this.minimumAllowed);
248
+ this.numbers = this.numbers.map((item) => {
249
+ return {
250
+ number: item.number,
251
+ selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
252
+ selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
253
+ };
254
+ });
255
+ this.gridFilledEvent.emit({
256
+ id: this.ticketId,
257
+ index: this.gridIndex,
258
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
259
+ });
260
+ this.selectedCounter = this.maximumAllowed;
261
+ }
262
+ }
263
+ render() {
264
+ 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 }))))));
265
+ }
266
+ };
267
+ LotteryGrid.style = lotteryGridCss;
268
+
269
+ exports.lottery_bullet = LotteryBullet;
270
+ exports.lottery_grid = LotteryGrid;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-74b5228f.js');
3
+ const index = require('./index-fdfc1a6c.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"]]]]]], options);
18
+ return index.bootstrapLazy([["lottery-bullet_2.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"],"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
  });
@@ -15,11 +15,5 @@
15
15
  ]
16
16
  }
17
17
  ],
18
- "bundles": [
19
- {
20
- "components": [
21
- "lottery-grid"
22
- ]
23
- }
24
- ]
18
+ "bundles": []
25
19
  }
@@ -15,5 +15,8 @@
15
15
  display: flex;
16
16
  flex-direction: row;
17
17
  flex-wrap: wrap;
18
- gap: 25px;
18
+ gap: 20px;
19
+ }
20
+ .Grid.TicketGrid {
21
+ gap: 5px;
19
22
  }
@@ -31,8 +31,33 @@ export class LotteryGrid {
31
31
  * Language
32
32
  */
33
33
  this.language = 'en';
34
+ /**
35
+ * Personalize grid for ticket
36
+ */
37
+ this.gridType = '';
38
+ /**
39
+ * Client custom styling via string
40
+ */
41
+ this.clientStyling = '';
42
+ /**
43
+ * Client custom styling via url content
44
+ */
45
+ this.clientStylingUrlContent = '';
34
46
  this.numbers = [];
47
+ this.limitStylingAppends = false;
35
48
  this.selectedCounter = 0;
49
+ this.setClientStyling = () => {
50
+ let sheet = document.createElement('style');
51
+ sheet.innerHTML = this.clientStyling;
52
+ this.stylingContainer.prepend(sheet);
53
+ };
54
+ this.setClientStylingURL = () => {
55
+ let cssFile = document.createElement('style');
56
+ setTimeout(() => {
57
+ cssFile.innerHTML = this.clientStylingUrlContent;
58
+ this.stylingContainer.prepend(cssFile);
59
+ }, 1);
60
+ };
36
61
  }
37
62
  connectedCallback() {
38
63
  let selected = [];
@@ -61,6 +86,17 @@ export class LotteryGrid {
61
86
  });
62
87
  }
63
88
  }
89
+ componentDidRender() {
90
+ // start custom styling area
91
+ if (!this.limitStylingAppends && this.stylingContainer) {
92
+ if (this.clientStyling)
93
+ this.setClientStyling();
94
+ if (this.clientStylingUrlContent)
95
+ this.setClientStylingURL();
96
+ this.limitStylingAppends = true;
97
+ }
98
+ // end custom styling area
99
+ }
64
100
  lotteryBulletSelectionHandler(event) {
65
101
  this.numbers = this.numbers.map((item) => {
66
102
  if (item.number == event.detail.value) {
@@ -151,9 +187,9 @@ export class LotteryGrid {
151
187
  }
152
188
  }
153
189
  render() {
154
- return (h("div", { class: "GridContainer" },
155
- h("div", { class: "Grid" }, this.numbers.map((item) => h("div", null,
156
- h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected }))))));
190
+ return (h("div", { class: "GridContainer", ref: el => this.stylingContainer = el },
191
+ h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null,
192
+ h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
157
193
  }
158
194
  static get is() { return "lottery-grid"; }
159
195
  static get encapsulation() { return "shadow"; }
@@ -340,10 +376,65 @@ export class LotteryGrid {
340
376
  },
341
377
  "attribute": "grid-index",
342
378
  "reflect": false
379
+ },
380
+ "gridType": {
381
+ "type": "string",
382
+ "mutable": false,
383
+ "complexType": {
384
+ "original": "string",
385
+ "resolved": "string",
386
+ "references": {}
387
+ },
388
+ "required": false,
389
+ "optional": false,
390
+ "docs": {
391
+ "tags": [],
392
+ "text": "Personalize grid for ticket"
393
+ },
394
+ "attribute": "grid-type",
395
+ "reflect": false,
396
+ "defaultValue": "''"
397
+ },
398
+ "clientStyling": {
399
+ "type": "string",
400
+ "mutable": false,
401
+ "complexType": {
402
+ "original": "string",
403
+ "resolved": "string",
404
+ "references": {}
405
+ },
406
+ "required": false,
407
+ "optional": false,
408
+ "docs": {
409
+ "tags": [],
410
+ "text": "Client custom styling via string"
411
+ },
412
+ "attribute": "client-styling",
413
+ "reflect": false,
414
+ "defaultValue": "''"
415
+ },
416
+ "clientStylingUrlContent": {
417
+ "type": "string",
418
+ "mutable": false,
419
+ "complexType": {
420
+ "original": "string",
421
+ "resolved": "string",
422
+ "references": {}
423
+ },
424
+ "required": false,
425
+ "optional": false,
426
+ "docs": {
427
+ "tags": [],
428
+ "text": "Client custom styling via url content"
429
+ },
430
+ "attribute": "client-styling-url-content",
431
+ "reflect": false,
432
+ "defaultValue": "''"
343
433
  }
344
434
  }; }
345
435
  static get states() { return {
346
- "numbers": {}
436
+ "numbers": {},
437
+ "limitStylingAppends": {}
347
438
  }; }
348
439
  static get events() { return [{
349
440
  "method": "gridFilledEvent",
@@ -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$2 } 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$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -38,8 +38,33 @@ const LotteryGrid$1 = /*@__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$1 = /*@__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$1 = /*@__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$1 = /*@__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$1() {
178
218
  if (typeof customElements === "undefined") {
@@ -192,7 +232,6 @@ function defineCustomElement$1() {
192
232
  break;
193
233
  } });
194
234
  }
195
- defineCustomElement$1();
196
235
 
197
236
  const LotteryGrid = LotteryGrid$1;
198
237
  const defineCustomElement = defineCustomElement$1;