@everymatrix/lottery-ticket 0.0.3
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 +1250 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/lottery-ticket.cjs.entry.js +147 -0
- package/dist/cjs/lottery-ticket.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/lottery-ticket/lottery-ticket.css +193 -0
- package/dist/collection/components/lottery-ticket/lottery-ticket.js +384 -0
- package/dist/collection/components/lottery-ticket/lottery-ticket.types.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +28 -0
- package/dist/collection/utils/utils.js +0 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +2 -0
- package/dist/components/lottery-ticket.d.ts +11 -0
- package/dist/components/lottery-ticket.js +175 -0
- package/dist/esm/index-84f8a38a.js +1224 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/lottery-ticket.entry.js +143 -0
- package/dist/esm/lottery-ticket.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-ticket/index.esm.js +0 -0
- package/dist/lottery-ticket/lottery-ticket.esm.js +1 -0
- package/dist/lottery-ticket/p-7ea3fc34.entry.js +1 -0
- package/dist/lottery-ticket/p-b69ccce7.js +2 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +2 -0
- package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +61 -0
- package/dist/types/components/lottery-ticket/lottery-ticket.types.d.ts +49 -0
- package/dist/types/components.d.ts +113 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +0 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function applyPolyfills() {
|
|
2
|
+
var promises = [];
|
|
3
|
+
if (typeof window !== 'undefined') {
|
|
4
|
+
var win = window;
|
|
5
|
+
|
|
6
|
+
if (!win.customElements ||
|
|
7
|
+
(win.Element && (!win.Element.prototype.closest || !win.Element.prototype.matches || !win.Element.prototype.remove || !win.Element.prototype.getRootNode))) {
|
|
8
|
+
promises.push(import(/* webpackChunkName: "polyfills-dom" */ './dom.js'));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var checkIfURLIsSupported = function() {
|
|
12
|
+
try {
|
|
13
|
+
var u = new URL('b', 'http://a');
|
|
14
|
+
u.pathname = 'c%20d';
|
|
15
|
+
return (u.href === 'http://a/c%20d') && u.searchParams;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (
|
|
22
|
+
'function' !== typeof Object.assign || !Object.entries ||
|
|
23
|
+
!Array.prototype.find || !Array.prototype.includes ||
|
|
24
|
+
!String.prototype.startsWith || !String.prototype.endsWith ||
|
|
25
|
+
(win.NodeList && !win.NodeList.prototype.forEach) ||
|
|
26
|
+
!win.fetch ||
|
|
27
|
+
!checkIfURLIsSupported() ||
|
|
28
|
+
typeof WeakMap == 'undefined'
|
|
29
|
+
) {
|
|
30
|
+
promises.push(import(/* webpackChunkName: "polyfills-core-js" */ './core-js.js'));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return Promise.all(promises);
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SystemJS 4.0.2
|
|
3
|
+
* MANUAL PATCH: remove script.crossOrigin = "anonymous"
|
|
4
|
+
* MANUAL PATCH: add conditionally apply, n.System=n.System||new u
|
|
5
|
+
*/
|
|
6
|
+
!function(){var e="undefined"!=typeof self,n=e?self:global;var t;if("undefined"!=typeof document){var e=document.querySelector("base[href]");e&&(t=e.href)}if(!t&&"undefined"!=typeof location){var e=(t=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(t=t.slice(0,e+1))}var r=/\\/g,o="undefined"!=typeof Symbol,i=o&&Symbol.toStringTag,c=o?Symbol():"@";function u(){this[c]={}}var s=u.prototype;var l;s.import=function(e,n){var t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){var n=function e(n,t,r){var o=n[c][t];if(o)return o;var u=[],s=Object.create(null);i&&Object.defineProperty(s,i,{value:"Module"});var l=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw Error("Module "+t+" did not instantiate");var r=e[1](function(e,n){o.h=!0;var t=!1;if("object"!=typeof e)e in s&&s[e]===n||(s[e]=n,t=!0);else for(var n in e){var r=e[n];n in s&&s[n]===r||(s[n]=r,t=!0)}if(t)for(var e=0;e<u.length;e++)u[e](s);return n},2===e[1].length?{import:function(e){return n.import(e,t)},meta:n.createContext(t)}:void 0);return o.e=r.execute||function(){},[e[0],r.setters||[]]});var f=l.then(function(r){return Promise.all(r[0].map(function(o,i){var c=r[1][i];return Promise.resolve(n.resolve(o,t)).then(function(r){var o=e(n,r,t);return Promise.resolve(o.I).then(function(){return c&&(o.i.push(c),!o.h&&o.I||c(o.n)),o})})})).then(function(e){o.d=e})});return f.catch(function(e){o.e=null,o.er=e}),o=n[c][t]={id:t,i:u,n:s,I:l,L:f,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0}}(t,e);return n.C||function(e,n){return n.C=function e(n,t,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then(function(){return Promise.all(t.d.map(function(t){return e(n,t,r)}))})}(e,n,{}).then(function(){return function e(n,t,r){if(r[t.id])return;if(r[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}var o;return t.d.forEach(function(t){{var i=e(n,t,r);i&&(o=o||[]).push(i)}}),o?Promise.all(o).then(i):i();function i(){try{var e=t.e.call(f);if(e)return e=e.then(function(){t.C=t.n,t.E=null}),t.E=t.E||e;t.C=t.n}catch(e){throw t.er=e,e}finally{t.L=t.I=void 0,t.e=null}}}(e,n,{})}).then(function(){return n.n})}(t,n)})},s.createContext=function(e){return{url:e}},s.register=function(e,n){l=[e,n]},s.getRegister=function(){var e=l;return l=void 0,e};var f=Object.freeze(Object.create(null));n.System=n.System||new u;var d=s.register;s.register=function(e,n){d.call(this,e,n)},s.instantiate=function(e,n){var t=this;return".json"===e.substr(-5)?fetch(e).then(function(e){return e.text()}).then(function(e){return[[],function(n){return{execute:function(){n("default",JSON.parse(e))}}}]}):new Promise(function(r,o){var i;function c(n){n.filename===e&&(i=n.error)}window.addEventListener("error",c);var u=document.createElement("script");u.charset="utf-8",u.async=!0,u.addEventListener("error",function(){window.removeEventListener("error",c),o(Error("Error loading "+e+(n?" from "+n:"")))}),u.addEventListener("load",function(){window.removeEventListener("error",c),document.head.removeChild(u),i?o(i):r(t.getRegister())}),u.src=e,document.head.appendChild(u)})},e&&"function"==typeof importScripts&&(s.instantiate=function(e){var n=this;return new Promise(function(t,r){try{importScripts(e)}catch(e){r(e)}t(n.getRegister())})}),s.resolve=function(e,n){var o=function(e,n){if(-1!==e.indexOf("\\")&&(e=e.replace(r,"/")),"/"===e[0]&&"/"===e[1])return n.slice(0,n.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){var t=n.slice(0,n.indexOf(":")+1);var r;if(r="/"===n[t.length+1]?"file:"!==t?(r=n.slice(t.length+2)).slice(r.indexOf("/")+1):n.slice(8):n.slice(t.length+("/"===n[t.length])),"/"===e[0])return n.slice(0,n.length-r.length-1)+e;var o=r.slice(0,r.lastIndexOf("/")+1)+e,i=[];var c=-1;for(var e=0;e<o.length;e++)-1!==c?"/"===o[e]&&(i.push(o.slice(c,e+1)),c=-1):"."===o[e]?"."!==o[e+1]||"/"!==o[e+2]&&e+2!==o.length?"/"===o[e+1]||e+1===o.length?e+=1:c=e:(i.pop(),e+=2):c=e;return-1!==c&&i.push(o.slice(c)),n.slice(0,n.length-r.length)+i.join("")}}(e,n||t);if(!o){if(-1!==e.indexOf(":"))return Promise.resolve(e);throw Error('Cannot resolve "'+e+(n?'" from '+n:'"'))}return Promise.resolve(o)}}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './esm/index.js';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,b as t}from"./p-b69ccce7.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-7ea3fc34",[[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]},[[0,"gridFilled","gridFilledHandler"]]]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i}from"./p-b69ccce7.js";import"@everymatrix/lottery-grid";const r=["ro","en"],n={en:{loading:"Loading, please wait ...",error:"It was an error while trying to fetch the data",grid:"Grid",multiplier:"Multiplier",numberOfDraws:"Number of draws",wagerPerDraw:"Wager per draw",resetButton:"Reset",autoButton:"I feel lucky"},ro:{loading:"Se incarca, va rugam asteptati ...",error:"A fost o eroare in timp ce asteptam datele",grid:"Grid",multiplier:"Multiplicator",numberOfDraws:"Numarul de extrageri",wagerPerDraw:"Pariul per extragere",resetButton:"Reseteaza",autoButton:"Ma simt norocos"}},s=(t,e)=>{const i=e;return n[void 0!==i&&r.includes(i)?i:"en"][t]},a=class{constructor(i){t(this,i),this.ticketCompleted=e(this,"ticketCompleted",7),this.autoSelection=e(this,"autoSelection",7),this.resetSelection=e(this,"resetSelection",7),this.stakeChange=e(this,"stakeChange",7),this.multiplierChange=e(this,"multiplierChange",7),this.numberOfGrids=1,this.multipleDraws=!0,this.resetButton=!1,this.autoPick=!1,this.language="en",this.multiplier=!1,this.numberOfDraws=1,this.isLoading=!0,this.hasErrors=!1,this.ticketDone=!1}connectedCallback(){let t=new URL(`${this.endpoint}/games/${this.gameId}`);fetch(t.href).then((t=>{if(t.ok)return t.json();this.hasErrors=!0})).then((t=>{this.isLoading=!1,this.gameData=t,this.grids=[...Array(t.rules.boards.length).keys()]})).catch((t=>{this.isLoading=!1,this.hasErrors=!0,console.error("Error!",t)}))}multiplierChangeHandler(t){this.multiplier=!!t.target&&t.target.checked,this.multiplierChange.emit(this.multiplier)}drawsChangeHandler(t){this.ticket=Object.assign(Object.assign({},this.ticket),{draws:t}),this.ticketCompleted.emit(this.ticket)}gridFilledHandler(t){this.ticket=Object.assign(Object.assign({},t.detail),{draws:this.numberOfDraws}),this.ticketDone=!0,this.ticketCompleted.emit(this.ticket)}toggleAutoSelection(){this.ticketDone=!0,this.autoSelection.emit(this.ticketId)}toggleResetSelection(){this.ticketDone=!1,this.resetSelection.emit(this.ticketId)}changeStake(t){this.stakeChange.emit({ticketId:this.ticketId,stake:t.target.value})}render(){if(this.isLoading)return i("div",null,i("p",null,s("loading",this.language)));if(this.hasErrors)return i("div",null,i("p",null,s("error",this.language)));{const{rules:t}=this.gameData;return i("div",{class:"TicketContainer"},i("p",null,this.gameData.name),this.resetButton&&this.ticketDone&&i("a",{class:"ResetButton",onClick:()=>this.toggleResetSelection()},s("resetButton",this.language)),this.autoPick&&!this.ticketDone&&i("a",{class:"AutoButton",onClick:()=>this.toggleAutoSelection()},s("autoButton",this.language)),this.grids.map(((e,r)=>i("div",{class:"TicketGridBullets"},i("p",{class:"TicketGridTitle"},s("grid",this.language)," ",e),i("lottery-grid",{"grid-index":r,"maximum-allowed":t.boards[r].maximumAllowed,"minimum-allowed":t.boards[r].minimumAllowed,"total-numbers":t.boards[r].totalNumbers,selectable:!0,"reset-button":!0,"auto-pick":!0,"game-id":this.gameId,"ticket-id":this.ticketId,language:this.language})))),t.multiplier&&i("div",null,i("label",{class:"Toggle"},i("label",{class:"Label"},s("multiplier",this.language),": "),i("input",{class:"ToggleCheckbox",type:"checkbox",onInput:t=>this.multiplierChangeHandler(t)}),i("div",{class:"ToggleSwitch"}))),this.multipleDraws&&i("div",{class:"TicketDraws"},i("label",{class:"Label"},s("numberOfDraws",this.language),": "),i("div",{class:"NumberInput"},i("button",{onClick:()=>this.numberOfDraws>1?this.numberOfDraws--:this.numberOfDraws=1,class:"Minus"},"-"),i("input",{class:"InputDefault",min:"1",value:this.numberOfDraws,type:"number"}),i("button",{onClick:()=>this.numberOfDraws++,class:"Plus"},"+"))),i("label",{class:"Label"},s("wagerPerDraw",this.language),": "),i("div",{class:"WagerInput"},t.stakes.length>1?i("div",null,i("select",{class:"InputDefault",onChange:t=>this.changeStake(t)},t.stakes.map((t=>i("option",{value:t.amount},t.amount," ",t.currency))))):i("div",null,i("input",{min:"1",value:t.stakes[0].amount,type:"number",disabled:!0}),i("p",{class:"WagerInputTitle"},t.stakes[0].currency))))}}static get watchers(){return{numberOfDraws:["drawsChangeHandler"]}}};a.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.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;background-color:transparent;border:none;align-items:center;justify-content:center;height:20px;margin:0;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);width:30px;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:block;border-radius:4px;padding:8px 25px;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:block;border-radius:4px;padding:8px 25px;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}';export{a as lottery_ticket}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let t,e,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l),ce:(t,e)=>new CustomEvent(t,e)},c=t=>Promise.resolve(t),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(t){}return!1})(),i=(t,e,n)=>{n&&n.map((([n,l,s])=>{const c=t,r=u(e,s),i=a(n);o.ael(c,l,r,i),(e.o=e.o||[]).push((()=>o.rel(c,l,r,i)))}))},u=(t,e)=>n=>{try{256&t.t?t.i[e](n):(t.u=t.u||[]).push([e,n])}catch(t){I(t)}},a=t=>0!=(2&t),f=new WeakMap,h=t=>"sc-"+t.h,y={},$=t=>"object"==(t=typeof t)||"function"===t,d=(t,e,...n)=>{let l=null,s=!1,o=!1;const c=[],r=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!$(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?m(null,l):l),o=s)};if(r(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const i=m(t,null);return i.m=e,c.length>0&&(i.p=c),i},m=(t,e)=>({t:0,S:t,$:e,g:null,p:null,m:null}),p={},b=(t,e,n,s,c,r)=>{if(n!==s){let i=G(t,e),u=e.toLowerCase();if("class"===e){const e=t.classList,l=S(n),o=S(s);e.remove(...l.filter((t=>t&&!o.includes(t)))),e.add(...o.filter((t=>t&&!l.includes(t))))}else if(i||"o"!==e[0]||"n"!==e[1]){const l=$(s);if((i||l&&null!==s)&&!c)try{if(t.tagName.includes("-"))t[e]=s;else{const l=null==s?"":s;"list"===e?i=!1:null!=n&&t[e]==l||(t[e]=l)}}catch(t){}null==s||!1===s?!1===s&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&r||c)&&!l&&t.setAttribute(e,s=!0===s?"":s)}else e="-"===e[2]?e.slice(3):G(l,u)?u.slice(2):u[2]+e.slice(3),n&&o.rel(t,e,n,!1),s&&o.ael(t,e,s,!1)}},w=/\s/,S=t=>t?t.split(w):[],g=(t,e,n,l)=>{const s=11===e.g.nodeType&&e.g.host?e.g.host:e.g,o=t&&t.m||y,c=e.m||y;for(l in o)l in c||b(s,l,o[l],void 0,n,e.t);for(l in c)b(s,l,o[l],c[l],n,e.t)},j=(e,n,l)=>{const o=n.p[l];let c,r,i=0;if(null!==o.$)c=o.g=s.createTextNode(o.$);else if(c=o.g=s.createElement(o.S),g(null,o,!1),null!=t&&c["s-si"]!==t&&c.classList.add(c["s-si"]=t),o.p)for(i=0;i<o.p.length;++i)r=j(e,o,i),r&&c.appendChild(r);return c},v=(t,n,l,s,o,c)=>{let r,i=t;for(i.shadowRoot&&i.tagName===e&&(i=i.shadowRoot);o<=c;++o)s[o]&&(r=j(null,l,o),r&&(s[o].g=r,i.insertBefore(r,n)))},k=(t,e,n,l)=>{for(;e<=n;++e)(l=t[e])&&l.g.remove()},M=(t,e)=>t.S===e.S,C=(t,e)=>{const n=e.g=t.g,l=t.p,s=e.p,o=e.$;null===o?(g(t,e,!1),null!==l&&null!==s?((t,e,n,l)=>{let s,o=0,c=0,r=e.length-1,i=e[0],u=e[r],a=l.length-1,f=l[0],h=l[a];for(;o<=r&&c<=a;)null==i?i=e[++o]:null==u?u=e[--r]:null==f?f=l[++c]:null==h?h=l[--a]:M(i,f)?(C(i,f),i=e[++o],f=l[++c]):M(u,h)?(C(u,h),u=e[--r],h=l[--a]):M(i,h)?(C(i,h),t.insertBefore(i.g,u.g.nextSibling),i=e[++o],h=l[--a]):M(u,f)?(C(u,f),t.insertBefore(u.g,i.g),u=e[--r],f=l[++c]):(s=j(e&&e[c],n,c),f=l[++c],s&&i.g.parentNode.insertBefore(s,i.g));o>r?v(t,null==l[a+1]?null:l[a+1].g,n,l,c,a):c>a&&k(e,o,r)})(n,l,e,s):null!==s?(null!==t.$&&(n.textContent=""),v(n,null,e,s,0,s.length-1)):null!==l&&k(l,0,l.length-1)):t.$!==o&&(n.data=o)},O=(t,e,n)=>{const l=(t=>z(t).j)(t);return{emit:t=>P(l,e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t})}},P=(t,e,n)=>{const l=o.ce(e,n);return t.dispatchEvent(l),l},x=(t,e)=>{e&&!t.v&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.v=e)))},E=(t,e)=>{if(t.t|=16,!(4&t.t))return x(t,t.k),lt((()=>N(t,e)));t.t|=512},N=(t,e)=>{const n=t.i;return e&&(t.t|=256,t.u&&(t.u.map((([t,e])=>R(n,t,e))),t.u=null)),U(void 0,(()=>T(t,n,e)))},T=async(t,e,n)=>{const l=t.j,o=l["s-rc"];n&&(t=>{const e=t.M,n=t.j,l=e.t,o=((t,e)=>{let n=h(e);const l=Q.get(n);if(t=11===t.nodeType?t:s,l)if("string"==typeof l){let e,o=f.get(t=t.head||t);o||f.set(t,o=new Set),o.has(n)||(e=s.createElement("style"),e.innerHTML=l,t.insertBefore(e,t.querySelector("link")),o&&o.add(n))}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(t);A(t,e),o&&(o.map((t=>t())),l["s-rc"]=void 0);{const e=l["s-p"],n=()=>F(t);0===e.length?n():(Promise.all(e).then(n),t.t|=4,e.length=0)}},A=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C||m(null,null),c=(t=>t&&t.S===p)(l)?l:d(null,null,l);e=s.tagName,c.S=null,c.t|=4,n.C=c,c.g=o.g=s.shadowRoot||s,t=s["s-sc"],C(o,c)})(n,l)}catch(t){I(t,n.j)}return null},F=t=>{const e=t.j,n=t.k;64&t.t||(t.t|=64,W(e),t.O(e),n||L()),t.v&&(t.v(),t.v=void 0),512&t.t&&nt((()=>E(t,!1))),t.t&=-517},L=()=>{W(s.documentElement),nt((()=>P(l,"appload",{detail:{namespace:"lottery-ticket"}})))},R=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){I(t)}},U=(t,e)=>t&&t.then?t.then(e):e(),W=t=>t.classList.add("hydrated"),q=(t,e,n)=>{if(e.P){t.watchers&&(e.N=t.watchers);const l=Object.entries(e.P),s=t.prototype;if(l.map((([t,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,t,{get(){return((t,e)=>z(this).T.get(e))(0,t)},set(n){((t,e,n,l)=>{const s=z(t),o=s.j,c=s.T.get(e),r=s.t,i=s.i;if(n=((t,e)=>null==t||$(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?parseFloat(t):1&e?t+"":t)(n,l.P[e][0]),(!(8&r)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(s.T.set(e,n),i)){if(l.N&&128&r){const t=l.N[e];t&&t.map((t=>{try{i[t](n,c,e)}catch(t){I(t,o)}}))}2==(18&r)&&E(s,!1)}})(this,t,n,e)},configurable:!0,enumerable:!0})})),1&n){const e=new Map;s.attributeChangedCallback=function(t,n,l){o.jmp((()=>{const n=e.get(t);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},t.observedAttributes=l.filter((([t,e])=>15&e[0])).map((([t,n])=>{const l=n[1]||t;return e.set(l,t),l}))}}return t},H=t=>{R(t,"connectedCallback")},V=(t,e={})=>{const n=[],c=e.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),y=s.createElement("style"),$=[];let d,m=!0;Object.assign(o,e),o.l=new URL(e.resourcesUrl||"./",s.baseURI).href,t.map((t=>{t[1].map((e=>{const l={t:e[0],h:e[1],P:e[2],A:e[3]};l.P=e[2],l.A=e[3],l.N={};const s=l.h,a=class extends HTMLElement{constructor(t){super(t),D(t=this,l),1&l.t&&t.attachShadow({mode:"open"})}connectedCallback(){d&&(clearTimeout(d),d=null),m?$.push(this):o.jmp((()=>(t=>{if(0==(1&o.t)){const e=z(t),n=e.M,l=()=>{};if(1&e.t)i(t,e,n.A),H(e.i);else{e.t|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){x(e,e.k=n);break}}n.P&&Object.entries(n.P).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n,l,s)=>{if(0==(32&e.t)){{if(e.t|=32,(s=K(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(n.N=s.watchers,q(s,n,2),s.isProxied=!0);const t=()=>{};e.t|=8;try{new s(e)}catch(t){I(t)}e.t&=-9,e.t|=128,t(),H(e.i)}if(s.style){let t=s.style;const e=h(n);if(!Q.has(e)){const l=()=>{};((t,e,n)=>{let l=Q.get(t);r&&n?(l=l||new CSSStyleSheet,l.replace(e)):l=e,Q.set(t,l)})(e,t,!!(1&n.t)),l()}}}const o=e.k,c=()=>E(e,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,e,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const t=z(this);t.o&&(t.o.map((t=>t())),t.o=void 0)}})()))}componentOnReady(){return z(this).F}};l.L=t[0],c.includes(s)||u.get(s)||(n.push(s),u.define(s,q(a,l,1)))}))})),y.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",y.setAttribute("data-styles",""),a.insertBefore(y,f?f.nextSibling:a.firstChild),m=!1,$.length?$.map((t=>t.connectedCallback())):o.jmp((()=>d=setTimeout(L,30)))},_=new WeakMap,z=t=>_.get(t),B=(t,e)=>_.set(e.i=t,e),D=(t,e)=>{const n={t:0,j:t,M:e,T:new Map};return n.F=new Promise((t=>n.O=t)),t["s-p"]=[],t["s-rc"]=[],i(t,n,e.A),_.set(t,n)},G=(t,e)=>e in t,I=(t,e)=>(0,console.error)(t,e),J=new Map,K=t=>{const e=t.h.replace(/-/g,"_"),n=t.L,l=J.get(n);return l?l[e]:import(`./${n}.entry.js`).then((t=>(J.set(n,t),t[e])),I)
|
|
2
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},Q=new Map,X=[],Y=[],Z=(t,e)=>l=>{t.push(l),n||(n=!0,e&&4&o.t?nt(et):o.raf(et))},tt=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){I(t)}t.length=0},et=()=>{tt(X),tt(Y),(n=X.length>0)&&o.raf(et)},nt=t=>c().then(t),lt=Z(Y,!0);export{V as b,O as c,d as h,c as p,B as r}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { sass } from '@stencil/sass';
|
|
2
|
+
export const config = {
|
|
3
|
+
namespace: 'lottery-ticket',
|
|
4
|
+
taskQueue: 'async',
|
|
5
|
+
plugins: [sass()],
|
|
6
|
+
outputTargets: [
|
|
7
|
+
{
|
|
8
|
+
type: 'dist',
|
|
9
|
+
esmLoaderPath: '../loader',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'dist-custom-elements',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'docs-readme',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'www',
|
|
19
|
+
serviceWorker: null, // disable service workers
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { GridEvent } from './lottery-ticket.types';
|
|
3
|
+
import '@everymatrix/lottery-grid';
|
|
4
|
+
export declare class LotteryTicket {
|
|
5
|
+
/**
|
|
6
|
+
* NorWAy endpoint
|
|
7
|
+
*/
|
|
8
|
+
endpoint: string;
|
|
9
|
+
/**
|
|
10
|
+
* Game ID
|
|
11
|
+
*/
|
|
12
|
+
gameId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Number of grids of a ticket
|
|
15
|
+
*/
|
|
16
|
+
numberOfGrids: number;
|
|
17
|
+
/**
|
|
18
|
+
* Option to have the ticket registered for multiple draws
|
|
19
|
+
*/
|
|
20
|
+
multipleDraws: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Ticket ID
|
|
23
|
+
*/
|
|
24
|
+
ticketId: number;
|
|
25
|
+
/**
|
|
26
|
+
* Shows the reset button
|
|
27
|
+
*/
|
|
28
|
+
resetButton: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Shows the auto-pick button
|
|
31
|
+
*/
|
|
32
|
+
autoPick: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Language
|
|
35
|
+
*/
|
|
36
|
+
language: string;
|
|
37
|
+
private grids;
|
|
38
|
+
private gameData;
|
|
39
|
+
private ticket;
|
|
40
|
+
multiplier: boolean;
|
|
41
|
+
private numberOfDraws;
|
|
42
|
+
private isLoading;
|
|
43
|
+
private hasErrors;
|
|
44
|
+
private ticketDone;
|
|
45
|
+
/**
|
|
46
|
+
* @TODO including ts type
|
|
47
|
+
*/
|
|
48
|
+
ticketCompleted: EventEmitter<any>;
|
|
49
|
+
autoSelection: EventEmitter<any>;
|
|
50
|
+
resetSelection: EventEmitter<any>;
|
|
51
|
+
stakeChange: EventEmitter<any>;
|
|
52
|
+
multiplierChange: EventEmitter<any>;
|
|
53
|
+
connectedCallback(): void;
|
|
54
|
+
multiplierChangeHandler(e: any): void;
|
|
55
|
+
drawsChangeHandler(event: CustomEvent<any>): void;
|
|
56
|
+
gridFilledHandler(event: CustomEvent<GridEvent>): void;
|
|
57
|
+
toggleAutoSelection(): void;
|
|
58
|
+
toggleResetSelection(): void;
|
|
59
|
+
changeStake(event: any): void;
|
|
60
|
+
render(): any;
|
|
61
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface GameData {
|
|
2
|
+
href: string;
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
rules: Rules;
|
|
7
|
+
prize: Array<Prize>;
|
|
8
|
+
draws: Array<DrawItem>;
|
|
9
|
+
vendor: Vendor;
|
|
10
|
+
}
|
|
11
|
+
export interface Rules {
|
|
12
|
+
boards: Array<Boards>;
|
|
13
|
+
multiplier: boolean;
|
|
14
|
+
stakes: Array<Stakes>;
|
|
15
|
+
}
|
|
16
|
+
export interface Boards {
|
|
17
|
+
totalNumbers: number;
|
|
18
|
+
maximumAllowed: number;
|
|
19
|
+
minimumAllowed: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Stakes {
|
|
22
|
+
currency: string;
|
|
23
|
+
amount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface Prize {
|
|
26
|
+
currency: string;
|
|
27
|
+
amount: number;
|
|
28
|
+
}
|
|
29
|
+
export interface DrawItem {
|
|
30
|
+
id: string;
|
|
31
|
+
date: string;
|
|
32
|
+
winningNumbers: Array<number>;
|
|
33
|
+
prize: Array<Prize>;
|
|
34
|
+
pages: Pages;
|
|
35
|
+
}
|
|
36
|
+
export interface Pages {
|
|
37
|
+
first: string;
|
|
38
|
+
next: string;
|
|
39
|
+
previous: string;
|
|
40
|
+
last: string;
|
|
41
|
+
}
|
|
42
|
+
export interface Vendor {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
46
|
+
export interface GridEvent {
|
|
47
|
+
id: string;
|
|
48
|
+
selectedNumbers: Array<string>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This is an autogenerated file created by the Stencil compiler.
|
|
5
|
+
* It contains typing information for all components that exist in this project.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
export namespace Components {
|
|
9
|
+
interface LotteryTicket {
|
|
10
|
+
/**
|
|
11
|
+
* Shows the auto-pick button
|
|
12
|
+
*/
|
|
13
|
+
"autoPick": boolean;
|
|
14
|
+
/**
|
|
15
|
+
* NorWAy endpoint
|
|
16
|
+
*/
|
|
17
|
+
"endpoint": string;
|
|
18
|
+
/**
|
|
19
|
+
* Game ID
|
|
20
|
+
*/
|
|
21
|
+
"gameId": string;
|
|
22
|
+
/**
|
|
23
|
+
* Language
|
|
24
|
+
*/
|
|
25
|
+
"language": string;
|
|
26
|
+
/**
|
|
27
|
+
* Option to have the ticket registered for multiple draws
|
|
28
|
+
*/
|
|
29
|
+
"multipleDraws": boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Number of grids of a ticket
|
|
32
|
+
*/
|
|
33
|
+
"numberOfGrids": number;
|
|
34
|
+
/**
|
|
35
|
+
* Shows the reset button
|
|
36
|
+
*/
|
|
37
|
+
"resetButton": boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Ticket ID
|
|
40
|
+
*/
|
|
41
|
+
"ticketId": number;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export interface LotteryTicketCustomEvent<T> extends CustomEvent<T> {
|
|
45
|
+
detail: T;
|
|
46
|
+
target: HTMLLotteryTicketElement;
|
|
47
|
+
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLLotteryTicketElement extends Components.LotteryTicket, HTMLStencilElement {
|
|
50
|
+
}
|
|
51
|
+
var HTMLLotteryTicketElement: {
|
|
52
|
+
prototype: HTMLLotteryTicketElement;
|
|
53
|
+
new (): HTMLLotteryTicketElement;
|
|
54
|
+
};
|
|
55
|
+
interface HTMLElementTagNameMap {
|
|
56
|
+
"lottery-ticket": HTMLLotteryTicketElement;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
declare namespace LocalJSX {
|
|
60
|
+
interface LotteryTicket {
|
|
61
|
+
/**
|
|
62
|
+
* Shows the auto-pick button
|
|
63
|
+
*/
|
|
64
|
+
"autoPick"?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* NorWAy endpoint
|
|
67
|
+
*/
|
|
68
|
+
"endpoint"?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Game ID
|
|
71
|
+
*/
|
|
72
|
+
"gameId"?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Language
|
|
75
|
+
*/
|
|
76
|
+
"language"?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Option to have the ticket registered for multiple draws
|
|
79
|
+
*/
|
|
80
|
+
"multipleDraws"?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Number of grids of a ticket
|
|
83
|
+
*/
|
|
84
|
+
"numberOfGrids"?: number;
|
|
85
|
+
"onAutoSelection"?: (event: LotteryTicketCustomEvent<any>) => void;
|
|
86
|
+
"onMultiplierChange"?: (event: LotteryTicketCustomEvent<any>) => void;
|
|
87
|
+
"onResetSelection"?: (event: LotteryTicketCustomEvent<any>) => void;
|
|
88
|
+
"onStakeChange"?: (event: LotteryTicketCustomEvent<any>) => void;
|
|
89
|
+
/**
|
|
90
|
+
* @TODO including ts type
|
|
91
|
+
*/
|
|
92
|
+
"onTicketCompleted"?: (event: LotteryTicketCustomEvent<any>) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Shows the reset button
|
|
95
|
+
*/
|
|
96
|
+
"resetButton"?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Ticket ID
|
|
99
|
+
*/
|
|
100
|
+
"ticketId"?: number;
|
|
101
|
+
}
|
|
102
|
+
interface IntrinsicElements {
|
|
103
|
+
"lottery-ticket": LotteryTicket;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export { LocalJSX as JSX };
|
|
107
|
+
declare module "@stencil/core" {
|
|
108
|
+
export namespace JSX {
|
|
109
|
+
interface IntrinsicElements {
|
|
110
|
+
"lottery-ticket": LocalJSX.LotteryTicket & JSXBase.HTMLAttributes<HTMLLotteryTicketElement>;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|