@everymatrix/lottery-ticket 0.0.3 → 0.1.4
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.
- package/dist/cjs/{index-fc097c03.js → index-1a18a097.js} +12 -7
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/lottery-bullet_3.cjs.entry.js +365 -0
- package/dist/cjs/lottery-ticket.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +15 -2
- package/dist/collection/components/lottery-ticket/lottery-ticket.css +121 -7
- package/dist/collection/components/lottery-ticket/lottery-ticket.js +58 -17
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +0 -1
- package/dist/components/lottery-bullet.js +6 -0
- package/dist/components/lottery-bullet2.js +56 -0
- package/dist/components/lottery-grid.js +6 -0
- package/dist/components/lottery-grid2.js +196 -0
- package/dist/components/lottery-ticket.js +48 -12
- package/dist/esm/{index-84f8a38a.js → index-c436caae.js} +12 -7
- package/dist/esm/loader.js +3 -3
- package/dist/esm/lottery-bullet_3.entry.js +359 -0
- package/dist/esm/lottery-ticket.js +3 -3
- package/dist/lottery-ticket/lottery-ticket.esm.js +1 -1
- package/dist/lottery-ticket/p-91b1278e.js +1 -0
- package/dist/lottery-ticket/p-ec3208f7.entry.js +1 -0
- package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +9 -1
- package/dist/types/components.d.ts +5 -9
- package/package.json +1 -1
- package/dist/cjs/lottery-ticket.cjs.entry.js +0 -147
- package/dist/esm/lottery-ticket.entry.js +0 -143
- package/dist/lottery-ticket/p-7ea3fc34.entry.js +0 -1
- package/dist/lottery-ticket/p-b69ccce7.js +0 -2
|
@@ -50,7 +50,7 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
|
50
50
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
51
51
|
if (listeners) {
|
|
52
52
|
listeners.map(([flags, name, method]) => {
|
|
53
|
-
const target = elm;
|
|
53
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
54
54
|
const handler = hostListenerProxy(hostRef, method);
|
|
55
55
|
const opts = hostListenerOpts(flags);
|
|
56
56
|
plt.ael(target, name, handler, opts);
|
|
@@ -74,6 +74,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
74
74
|
consoleError(e);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
78
|
+
if (flags & 4 /* TargetDocument */)
|
|
79
|
+
return doc;
|
|
80
|
+
if (flags & 8 /* TargetWindow */)
|
|
81
|
+
return win;
|
|
82
|
+
return elm;
|
|
83
|
+
};
|
|
77
84
|
// prettier-ignore
|
|
78
85
|
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
79
86
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
@@ -105,7 +112,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
105
112
|
};
|
|
106
113
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
107
114
|
let scopeId = getScopeId(cmpMeta);
|
|
108
|
-
|
|
115
|
+
let style = styles.get(scopeId);
|
|
109
116
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
110
117
|
// so the fallback is to always use the document for the root node in those cases
|
|
111
118
|
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -185,7 +192,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
185
192
|
let child = null;
|
|
186
193
|
let simple = false;
|
|
187
194
|
let lastSimple = false;
|
|
188
|
-
|
|
195
|
+
let vNodeChildren = [];
|
|
189
196
|
const walk = (c) => {
|
|
190
197
|
for (let i = 0; i < c.length; i++) {
|
|
191
198
|
child = c[i];
|
|
@@ -308,7 +315,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
308
315
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
309
316
|
try {
|
|
310
317
|
if (!elm.tagName.includes('-')) {
|
|
311
|
-
|
|
318
|
+
let n = newValue == null ? '' : newValue;
|
|
312
319
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
313
320
|
if (memberName === 'list') {
|
|
314
321
|
isProp = false;
|
|
@@ -365,7 +372,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
365
372
|
};
|
|
366
373
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
367
374
|
// tslint:disable-next-line: prefer-const
|
|
368
|
-
|
|
375
|
+
let newVNode = newParentVNode.$children$[childIndex];
|
|
369
376
|
let i = 0;
|
|
370
377
|
let elm;
|
|
371
378
|
let childNode;
|
|
@@ -1186,9 +1193,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1186
1193
|
if (module) {
|
|
1187
1194
|
return module[exportName];
|
|
1188
1195
|
}
|
|
1189
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1190
1196
|
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1191
|
-
/* @vite-ignore */
|
|
1192
1197
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1193
1198
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1194
1199
|
/* webpackMode: "lazy" */
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-1a18a097.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
return index.promiseResolve();
|
|
@@ -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-
|
|
17
|
+
return index.bootstrapLazy([["lottery-bullet_3.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"]]],[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
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-1a18a097.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
|
+
this.select = () => {
|
|
26
|
+
if (this.selectable) {
|
|
27
|
+
this.isSelected = !this.isSelected;
|
|
28
|
+
this.bulletEvent.emit({
|
|
29
|
+
value: this.value,
|
|
30
|
+
selected: this.isSelected
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select() }, this.value));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
LotteryBullet.style = lotteryBulletCss;
|
|
40
|
+
|
|
41
|
+
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}";
|
|
42
|
+
|
|
43
|
+
const LotteryGrid = class {
|
|
44
|
+
constructor(hostRef) {
|
|
45
|
+
index.registerInstance(this, hostRef);
|
|
46
|
+
this.gridFilledEvent = index.createEvent(this, "gridFilled", 7);
|
|
47
|
+
this.gridDirtyEvent = index.createEvent(this, "gridDirty", 7);
|
|
48
|
+
/**
|
|
49
|
+
* Number of bullets of grid
|
|
50
|
+
*/
|
|
51
|
+
this.totalNumbers = 0;
|
|
52
|
+
/**
|
|
53
|
+
* Number of maximum bullets that can be selected
|
|
54
|
+
*/
|
|
55
|
+
this.maximumAllowed = 0;
|
|
56
|
+
/**
|
|
57
|
+
* Minimum allowed of bullets
|
|
58
|
+
*/
|
|
59
|
+
this.minimumAllowed = 1;
|
|
60
|
+
/**
|
|
61
|
+
* Allows the user to select numbers on the grid
|
|
62
|
+
*/
|
|
63
|
+
this.selectable = true;
|
|
64
|
+
/**
|
|
65
|
+
* Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
|
|
66
|
+
*/
|
|
67
|
+
this.selectedNumbers = '';
|
|
68
|
+
/**
|
|
69
|
+
* Show only selected numbers
|
|
70
|
+
*/
|
|
71
|
+
this.displaySelected = false;
|
|
72
|
+
/**
|
|
73
|
+
* Language
|
|
74
|
+
*/
|
|
75
|
+
this.language = 'en';
|
|
76
|
+
this.numbers = [];
|
|
77
|
+
this.selectedCounter = 0;
|
|
78
|
+
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
let selected = [];
|
|
81
|
+
if (this.selectedNumbers.length > 0) {
|
|
82
|
+
selected = this.selectedNumbers.split(',');
|
|
83
|
+
this.selectedCounter = selected.length;
|
|
84
|
+
}
|
|
85
|
+
if (this.displaySelected) {
|
|
86
|
+
selected.forEach((item) => {
|
|
87
|
+
this.numbers.push({
|
|
88
|
+
number: item,
|
|
89
|
+
selected: true,
|
|
90
|
+
selectable: this.selectable
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
[...Array(this.totalNumbers).keys()]
|
|
96
|
+
.map(number => (number + 1).toString())
|
|
97
|
+
.forEach((number) => {
|
|
98
|
+
this.numbers.push({
|
|
99
|
+
number,
|
|
100
|
+
selected: selected.indexOf(number) >= 0 ? true : false,
|
|
101
|
+
selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
lotteryBulletSelectionHandler(event) {
|
|
107
|
+
this.numbers = this.numbers.map((item) => {
|
|
108
|
+
if (item.number == event.detail.value) {
|
|
109
|
+
return {
|
|
110
|
+
number: item.number,
|
|
111
|
+
selected: event.detail.selected,
|
|
112
|
+
selectable: item.selectable
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
number: item.number,
|
|
117
|
+
selected: item.selected,
|
|
118
|
+
selectable: item.selectable
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
if (event.detail.selected) {
|
|
122
|
+
this.selectedCounter += 1;
|
|
123
|
+
if (this.selectedCounter == this.maximumAllowed) {
|
|
124
|
+
this.numbers = this.numbers.map((item) => {
|
|
125
|
+
return {
|
|
126
|
+
number: item.number,
|
|
127
|
+
selected: item.selected,
|
|
128
|
+
selectable: item.selected ? true : false
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
this.gridFilledEvent.emit({
|
|
132
|
+
id: this.ticketId,
|
|
133
|
+
index: this.gridIndex,
|
|
134
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
if (this.selectedCounter == this.maximumAllowed) {
|
|
140
|
+
this.numbers = this.numbers.map((item) => {
|
|
141
|
+
return {
|
|
142
|
+
number: item.number,
|
|
143
|
+
selected: item.selected,
|
|
144
|
+
selectable: true
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
this.gridDirtyEvent.emit({
|
|
148
|
+
id: this.ticketId,
|
|
149
|
+
index: this.gridIndex,
|
|
150
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
this.selectedCounter -= 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async resetSelectionHandler(event) {
|
|
157
|
+
if (event.detail && event.detail == this.ticketId) {
|
|
158
|
+
this.selectedCounter = 0;
|
|
159
|
+
this.numbers = this.numbers.map((item) => {
|
|
160
|
+
return {
|
|
161
|
+
number: item.number,
|
|
162
|
+
selected: false,
|
|
163
|
+
selectable: this.selectable
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
this.gridDirtyEvent.emit({
|
|
167
|
+
id: this.ticketId,
|
|
168
|
+
index: this.gridIndex,
|
|
169
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async autoSelectionHandler(event) {
|
|
174
|
+
if (event.detail && event.detail == this.ticketId) {
|
|
175
|
+
this.resetSelectionHandler(event);
|
|
176
|
+
let array = [...Array(this.totalNumbers).keys()]
|
|
177
|
+
.map(number => number + 1)
|
|
178
|
+
.sort(() => 0.5 - Math.random());
|
|
179
|
+
array = array.slice(0, this.minimumAllowed);
|
|
180
|
+
this.numbers = this.numbers.map((item) => {
|
|
181
|
+
return {
|
|
182
|
+
number: item.number,
|
|
183
|
+
selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
|
|
184
|
+
selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
this.gridFilledEvent.emit({
|
|
188
|
+
id: this.ticketId,
|
|
189
|
+
index: this.gridIndex,
|
|
190
|
+
selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
|
|
191
|
+
});
|
|
192
|
+
this.selectedCounter = this.maximumAllowed;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
render() {
|
|
196
|
+
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 }))))));
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
LotteryGrid.style = lotteryGridCss;
|
|
200
|
+
|
|
201
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
202
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
203
|
+
const TRANSLATIONS = {
|
|
204
|
+
en: {
|
|
205
|
+
loading: 'Loading, please wait ...',
|
|
206
|
+
error: 'It was an error while trying to fetch the data',
|
|
207
|
+
grid: 'Grid',
|
|
208
|
+
multiplier: 'Multiplier',
|
|
209
|
+
numberOfDraws: 'Number of draws',
|
|
210
|
+
wagerPerDraw: 'Wager per draw',
|
|
211
|
+
resetButton: 'Reset',
|
|
212
|
+
autoButton: 'I feel lucky'
|
|
213
|
+
},
|
|
214
|
+
ro: {
|
|
215
|
+
loading: 'Se incarca, va rugam asteptati ...',
|
|
216
|
+
error: 'A fost o eroare in timp ce asteptam datele',
|
|
217
|
+
grid: 'Grid',
|
|
218
|
+
multiplier: 'Multiplicator',
|
|
219
|
+
numberOfDraws: 'Numarul de extrageri',
|
|
220
|
+
wagerPerDraw: 'Pariul per extragere',
|
|
221
|
+
resetButton: 'Reseteaza',
|
|
222
|
+
autoButton: 'Ma simt norocos'
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
const translate = (key, customLang) => {
|
|
226
|
+
const lang = customLang;
|
|
227
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
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}";
|
|
231
|
+
|
|
232
|
+
const LotteryTicket = class {
|
|
233
|
+
constructor(hostRef) {
|
|
234
|
+
index.registerInstance(this, hostRef);
|
|
235
|
+
this.ticketCompleted = index.createEvent(this, "ticketCompleted", 7);
|
|
236
|
+
this.autoSelection = index.createEvent(this, "autoSelection", 7);
|
|
237
|
+
this.resetSelection = index.createEvent(this, "resetSelection", 7);
|
|
238
|
+
this.stakeChange = index.createEvent(this, "stakeChange", 7);
|
|
239
|
+
this.multiplierChange = index.createEvent(this, "multiplierChange", 7);
|
|
240
|
+
/**
|
|
241
|
+
* Number of grids of a ticket
|
|
242
|
+
*/
|
|
243
|
+
this.numberOfGrids = 1;
|
|
244
|
+
/**
|
|
245
|
+
* Option to have the ticket registered for multiple draws
|
|
246
|
+
*/
|
|
247
|
+
this.multipleDraws = true;
|
|
248
|
+
/**
|
|
249
|
+
* Shows the reset button
|
|
250
|
+
*/
|
|
251
|
+
this.resetButton = false;
|
|
252
|
+
/**
|
|
253
|
+
* Shows the auto-pick button
|
|
254
|
+
*/
|
|
255
|
+
this.autoPick = false;
|
|
256
|
+
/**
|
|
257
|
+
* Language
|
|
258
|
+
*/
|
|
259
|
+
this.language = 'en';
|
|
260
|
+
this.multiplier = false;
|
|
261
|
+
this.numberOfDraws = 1;
|
|
262
|
+
this.isLoading = true;
|
|
263
|
+
this.hasErrors = false;
|
|
264
|
+
this.ticketDone = false;
|
|
265
|
+
this.isCustomSelect = false;
|
|
266
|
+
this.amountInfo = {};
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* @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
|
|
270
|
+
*/
|
|
271
|
+
checkForClickOutside(ev) {
|
|
272
|
+
if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
|
|
273
|
+
this.isCustomSelect = false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
connectedCallback() {
|
|
277
|
+
let url = new URL(`${this.endpoint}/games/${this.gameId}`);
|
|
278
|
+
fetch(url.href)
|
|
279
|
+
.then((response) => {
|
|
280
|
+
if (response.ok) {
|
|
281
|
+
return response.json();
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
// Throw error
|
|
285
|
+
this.hasErrors = true;
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
.then((data) => {
|
|
289
|
+
this.isLoading = false;
|
|
290
|
+
this.gameData = data;
|
|
291
|
+
this.grids = [...Array(data.rules.boards.length).keys()];
|
|
292
|
+
this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
|
|
293
|
+
})
|
|
294
|
+
.catch((err) => {
|
|
295
|
+
this.isLoading = false;
|
|
296
|
+
this.hasErrors = true;
|
|
297
|
+
console.error('Error!', err);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
multiplierChangeHandler(e) {
|
|
301
|
+
this.multiplier = e.target ? e.target.checked : false;
|
|
302
|
+
this.multiplierChange.emit(this.multiplier);
|
|
303
|
+
}
|
|
304
|
+
drawsChangeHandler(event) {
|
|
305
|
+
this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
|
|
306
|
+
this.ticketCompleted.emit(this.ticket);
|
|
307
|
+
}
|
|
308
|
+
gridFilledHandler(event) {
|
|
309
|
+
this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
|
|
310
|
+
this.ticketDone = true;
|
|
311
|
+
this.ticketCompleted.emit(this.ticket);
|
|
312
|
+
}
|
|
313
|
+
toggleAutoSelection() {
|
|
314
|
+
this.ticketDone = true;
|
|
315
|
+
this.autoSelection.emit(this.ticketId);
|
|
316
|
+
}
|
|
317
|
+
toggleResetSelection() {
|
|
318
|
+
this.ticketDone = false;
|
|
319
|
+
this.resetSelection.emit(this.ticketId);
|
|
320
|
+
}
|
|
321
|
+
changeStake(ticketid, amount) {
|
|
322
|
+
this.stakeChange.emit({
|
|
323
|
+
ticketId: ticketid,
|
|
324
|
+
stake: amount
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
toggleClass() {
|
|
328
|
+
this.isCustomSelect = !this.isCustomSelect;
|
|
329
|
+
}
|
|
330
|
+
setDropdownItem(item) {
|
|
331
|
+
this.amountInfo = {
|
|
332
|
+
amount: item.amount,
|
|
333
|
+
currency: item.currency
|
|
334
|
+
};
|
|
335
|
+
this.isCustomSelect = false;
|
|
336
|
+
this.changeStake(this.ticketId, item.amount);
|
|
337
|
+
}
|
|
338
|
+
render() {
|
|
339
|
+
if (this.isLoading) {
|
|
340
|
+
return (index.h("div", null, index.h("p", null, translate('loading', this.language))));
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
if (this.hasErrors) {
|
|
344
|
+
return (index.h("div", null, index.h("p", null, translate('error', this.language))));
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
const { rules } = this.gameData;
|
|
348
|
+
return (index.h("div", { class: "TicketContainer" }, index.h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
|
|
349
|
+
index.h("div", { class: "ButtonContainer" }, index.h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
|
|
350
|
+
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 &&
|
|
351
|
+
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 &&
|
|
352
|
+
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 ?
|
|
353
|
+
(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)))))));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
static get watchers() { return {
|
|
358
|
+
"numberOfDraws": ["drawsChangeHandler"]
|
|
359
|
+
}; }
|
|
360
|
+
};
|
|
361
|
+
LotteryTicket.style = lotteryTicketCss;
|
|
362
|
+
|
|
363
|
+
exports.lottery_bullet = LotteryBullet;
|
|
364
|
+
exports.lottery_grid = LotteryGrid;
|
|
365
|
+
exports.lottery_ticket = LotteryTicket;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-1a18a097.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
|
-
Stencil Client Patch Browser v2.
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
7
|
*/
|
|
8
8
|
const patchBrowser = () => {
|
|
9
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('lottery-ticket.cjs.js', document.baseURI).href));
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["lottery-
|
|
18
|
+
return index.bootstrapLazy([["lottery-bullet_3.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"]]],[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);
|
|
19
19
|
});
|
|
@@ -4,9 +4,22 @@
|
|
|
4
4
|
],
|
|
5
5
|
"compiler": {
|
|
6
6
|
"name": "@stencil/core",
|
|
7
|
-
"version": "2.
|
|
7
|
+
"version": "2.15.2",
|
|
8
8
|
"typescriptVersion": "4.5.4"
|
|
9
9
|
},
|
|
10
|
-
"collections": [
|
|
10
|
+
"collections": [
|
|
11
|
+
{
|
|
12
|
+
"name": "@everymatrix/lottery-bullet",
|
|
13
|
+
"tags": [
|
|
14
|
+
"lottery-bullet"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "@everymatrix/lottery-grid",
|
|
19
|
+
"tags": [
|
|
20
|
+
"lottery-grid"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
11
24
|
"bundles": []
|
|
12
25
|
}
|