@everymatrix/lottery-ticket-controller 0.0.3 → 0.1.1

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.
@@ -0,0 +1,156 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4814ed9d.js');
6
+ require('@everymatrix/lottery-ticket');
7
+
8
+ const DEFAULT_LANGUAGE = 'en';
9
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
10
+ const TRANSLATIONS = {
11
+ en: {
12
+ deleteTicket: 'Delete ticket'
13
+ },
14
+ ro: {
15
+ deleteTicket: 'Sterge biletul'
16
+ },
17
+ };
18
+ const translate = (key, customLang) => {
19
+ const lang = customLang;
20
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
21
+ };
22
+
23
+ const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px 4px 0 0;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
24
+
25
+ const Accordion = class {
26
+ constructor(hostRef) {
27
+ index.registerInstance(this, hostRef);
28
+ this.accordionEvent = index.createEvent(this, "helperAccordionAction", 7);
29
+ /**
30
+ * Flag for ticket history
31
+ */
32
+ this.ticketHistoryFlag = false;
33
+ /**
34
+ * Title (top header)
35
+ */
36
+ this.headerTitle = '';
37
+ /**
38
+ * SubTitle (top header)
39
+ */
40
+ this.headerSubtitle = '';
41
+ /**
42
+ * Description
43
+ */
44
+ this.description = '';
45
+ /**
46
+ * Enables footer content
47
+ */
48
+ this.footer = false;
49
+ /**
50
+ * Enables footer button for tab deletion
51
+ */
52
+ this.deleteTab = false;
53
+ /**
54
+ * Activates postMessages as events for actions from the widget
55
+ */
56
+ this.postMessage = false;
57
+ /**
58
+ * Name of the event emitter by the action button
59
+ */
60
+ this.eventName = 'helperAccordionAction';
61
+ /**
62
+ * Collapsed
63
+ */
64
+ this.collapsed = true;
65
+ /**
66
+ * Language
67
+ */
68
+ this.language = 'en';
69
+ }
70
+ // @TODO fix the `any` type :)
71
+ connectedCallback() {
72
+ this.showContent = !this.collapsed;
73
+ }
74
+ toggleContent() {
75
+ this.showContent = !this.showContent;
76
+ }
77
+ deleteAction() {
78
+ if (this.postMessage) {
79
+ // @TODO maybe change the name type, this one sucks
80
+ window.postMessage({ type: this.eventName }, window.location.href);
81
+ }
82
+ this.accordionEvent.emit();
83
+ }
84
+ render() {
85
+ return (index.h("div", { class: "Wrapper" }, index.h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
86
+ index.h("div", null, index.h("div", { class: "Content" }, index.h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
87
+ index.h("div", null, this.deleteTab &&
88
+ index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
89
+ }
90
+ };
91
+ Accordion.style = helperAccordionCss;
92
+
93
+ const lotteryTicketControllerCss = ":host{display:block}";
94
+
95
+ const LotteryTicketController = class {
96
+ constructor(hostRef) {
97
+ index.registerInstance(this, hostRef);
98
+ this.deleteTicketEvent = index.createEvent(this, "deleteTicket", 7);
99
+ /**
100
+ * Endpoint URL for the source of data (NorWAy standard)
101
+ */
102
+ this.endpoint = '';
103
+ /**
104
+ * Ticket number
105
+ */
106
+ this.ticketId = 1;
107
+ /**
108
+ * Activates postMessages as events for actions from the widget
109
+ */
110
+ this.postMessage = false;
111
+ /**
112
+ * Name of the event emitter by the action button
113
+ */
114
+ this.eventName = 'deleteTicketAction';
115
+ /**
116
+ * Collapsed
117
+ */
118
+ this.collapsed = true;
119
+ /**
120
+ * Number of grids?
121
+ */
122
+ this.numberOfGrids = 1;
123
+ /**
124
+ * This toggles if the last ticket added should be expanded or not
125
+ */
126
+ this.last = false;
127
+ /**
128
+ * Language
129
+ */
130
+ this.language = 'en';
131
+ /**
132
+ * Shows the auto-pick button
133
+ */
134
+ this.autoPick = false;
135
+ /**
136
+ * Shows the reset button
137
+ */
138
+ this.resetButton = false;
139
+ }
140
+ // @TODO fix the `any` type
141
+ helperAccordionActionHandler() {
142
+ if (this.postMessage) {
143
+ window.postMessage({ type: this.eventName }, window.location.href);
144
+ }
145
+ this.deleteTicketEvent.emit({
146
+ ticketId: this.ticketId
147
+ });
148
+ }
149
+ render() {
150
+ return (index.h("div", null, index.h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, index.h("div", { slot: "accordionContent" }, index.h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
151
+ }
152
+ };
153
+ LotteryTicketController.style = lotteryTicketControllerCss;
154
+
155
+ exports.helper_accordion = Accordion;
156
+ exports.lottery_ticket_controller = LotteryTicketController;
@@ -105,7 +105,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
105
105
  };
106
106
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
107
107
  let scopeId = getScopeId(cmpMeta);
108
- const style = styles.get(scopeId);
108
+ let style = styles.get(scopeId);
109
109
  // if an element is NOT connected then getRootNode() will return the wrong root node
110
110
  // so the fallback is to always use the document for the root node in those cases
111
111
  styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
@@ -185,7 +185,7 @@ const h = (nodeName, vnodeData, ...children) => {
185
185
  let child = null;
186
186
  let simple = false;
187
187
  let lastSimple = false;
188
- const vNodeChildren = [];
188
+ let vNodeChildren = [];
189
189
  const walk = (c) => {
190
190
  for (let i = 0; i < c.length; i++) {
191
191
  child = c[i];
@@ -209,6 +209,19 @@ const h = (nodeName, vnodeData, ...children) => {
209
209
  }
210
210
  };
211
211
  walk(children);
212
+ if (vnodeData) {
213
+ {
214
+ const classData = vnodeData.className || vnodeData.class;
215
+ if (classData) {
216
+ vnodeData.class =
217
+ typeof classData !== 'object'
218
+ ? classData
219
+ : Object.keys(classData)
220
+ .filter((k) => classData[k])
221
+ .join(' ');
222
+ }
223
+ }
224
+ }
212
225
  const vnode = newVNode(nodeName, null);
213
226
  vnode.$attrs$ = vnodeData;
214
227
  if (vNodeChildren.length > 0) {
@@ -242,14 +255,60 @@ const isHost = (node) => node && node.$tag$ === Host;
242
255
  const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
243
256
  if (oldValue !== newValue) {
244
257
  let isProp = isMemberInElement(elm, memberName);
245
- memberName.toLowerCase();
246
- {
258
+ let ln = memberName.toLowerCase();
259
+ if (memberName === 'class') {
260
+ const classList = elm.classList;
261
+ const oldClasses = parseClassList(oldValue);
262
+ const newClasses = parseClassList(newValue);
263
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
264
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
265
+ }
266
+ else if ((!isProp ) &&
267
+ memberName[0] === 'o' &&
268
+ memberName[1] === 'n') {
269
+ // Event Handlers
270
+ // so if the member name starts with "on" and the 3rd characters is
271
+ // a capital letter, and it's not already a member on the element,
272
+ // then we're assuming it's an event listener
273
+ if (memberName[2] === '-') {
274
+ // on- prefixed events
275
+ // allows to be explicit about the dom event to listen without any magic
276
+ // under the hood:
277
+ // <my-cmp on-click> // listens for "click"
278
+ // <my-cmp on-Click> // listens for "Click"
279
+ // <my-cmp on-ionChange> // listens for "ionChange"
280
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
281
+ memberName = memberName.slice(3);
282
+ }
283
+ else if (isMemberInElement(win, ln)) {
284
+ // standard event
285
+ // the JSX attribute could have been "onMouseOver" and the
286
+ // member name "onmouseover" is on the window's prototype
287
+ // so let's add the listener "mouseover", which is all lowercased
288
+ memberName = ln.slice(2);
289
+ }
290
+ else {
291
+ // custom event
292
+ // the JSX attribute could have been "onMyCustomEvent"
293
+ // so let's trim off the "on" prefix and lowercase the first character
294
+ // and add the listener "myCustomEvent"
295
+ // except for the first character, we keep the event name case
296
+ memberName = ln[2] + memberName.slice(3);
297
+ }
298
+ if (oldValue) {
299
+ plt.rel(elm, memberName, oldValue, false);
300
+ }
301
+ if (newValue) {
302
+ plt.ael(elm, memberName, newValue, false);
303
+ }
304
+ }
305
+ else {
247
306
  // Set property if it exists and it's not a SVG
248
307
  const isComplex = isComplexType(newValue);
249
308
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
250
309
  try {
251
310
  if (!elm.tagName.includes('-')) {
252
- const n = newValue == null ? '' : newValue;
311
+ let n = newValue == null ? '' : newValue;
253
312
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
254
313
  if (memberName === 'list') {
255
314
  isProp = false;
@@ -280,6 +339,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
280
339
  }
281
340
  }
282
341
  };
342
+ const parseClassListRegex = /\s/;
343
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
283
344
  const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
284
345
  // if the element passed in is a shadow root, which is a document fragment
285
346
  // then we want to be adding attrs/props to the shadow root's "host" element
@@ -304,11 +365,15 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
304
365
  };
305
366
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
306
367
  // tslint:disable-next-line: prefer-const
307
- const newVNode = newParentVNode.$children$[childIndex];
368
+ let newVNode = newParentVNode.$children$[childIndex];
308
369
  let i = 0;
309
370
  let elm;
310
371
  let childNode;
311
- {
372
+ if (newVNode.$text$ !== null) {
373
+ // create text node
374
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
375
+ }
376
+ else {
312
377
  // create element
313
378
  elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
314
379
  // add css classes, attrs, props, listeners, etc.
@@ -437,10 +502,14 @@ const patch = (oldVNode, newVNode) => {
437
502
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
438
503
  const oldChildren = oldVNode.$children$;
439
504
  const newChildren = newVNode.$children$;
440
- {
505
+ const tag = newVNode.$tag$;
506
+ const text = newVNode.$text$;
507
+ if (text === null) {
441
508
  // element node
442
509
  {
443
- {
510
+ if (tag === 'slot')
511
+ ;
512
+ else {
444
513
  // either this is the first render of an element OR it's an update
445
514
  // AND we already know it's possible it could have changed
446
515
  // this updates the element's css classes, attrs, props, listeners, etc.
@@ -452,6 +521,11 @@ const patch = (oldVNode, newVNode) => {
452
521
  updateChildren(elm, oldChildren, newVNode, newChildren);
453
522
  }
454
523
  else if (newChildren !== null) {
524
+ // no old child vnodes, but there are new child vnodes to add
525
+ if (oldVNode.$text$ !== null) {
526
+ // the old vnode was text, so be sure to clear it out
527
+ elm.textContent = '';
528
+ }
455
529
  // add the new vnode children
456
530
  addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
457
531
  }
@@ -460,6 +534,11 @@ const patch = (oldVNode, newVNode) => {
460
534
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
461
535
  }
462
536
  }
537
+ else if (oldVNode.$text$ !== text) {
538
+ // update the text content for the text only vnode
539
+ // and also only if the text is different than before
540
+ elm.data = text;
541
+ }
463
542
  };
464
543
  const renderVdom = (hostRef, renderFnResults) => {
465
544
  const hostElm = hostRef.$hostElement$;
@@ -863,6 +942,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
863
942
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
864
943
  }
865
944
  endNewInstance();
945
+ fireConnectedCallback(hostRef.$lazyInstance$);
866
946
  }
867
947
  if (Cstr.style) {
868
948
  // this component has styles but we haven't registered them yet
@@ -891,6 +971,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
891
971
  schedule();
892
972
  }
893
973
  };
974
+ const fireConnectedCallback = (instance) => {
975
+ {
976
+ safeCall(instance, 'connectedCallback');
977
+ }
978
+ };
894
979
  const connectedCallback = (elm) => {
895
980
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
896
981
  const hostRef = getHostRef(elm);
@@ -934,6 +1019,8 @@ const connectedCallback = (elm) => {
934
1019
  // reattach any event listeners to the host
935
1020
  // since they would have been removed when disconnected
936
1021
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1022
+ // fire off connectedCallback() on component instance
1023
+ fireConnectedCallback(hostRef.$lazyInstance$);
937
1024
  }
938
1025
  endConnected();
939
1026
  }
@@ -1070,9 +1157,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1070
1157
  if (module) {
1071
1158
  return module[exportName];
1072
1159
  }
1073
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1074
1160
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1075
- /* @vite-ignore */
1076
1161
  /* webpackInclude: /\.entry\.js$/ */
1077
1162
  /* webpackExclude: /\.system\.entry\.js$/ */
1078
1163
  /* webpackMode: "lazy" */
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-498fdd8e.js');
5
+ const index = require('./index-4814ed9d.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.17.0 | MIT Licensed | https://stenciljs.com
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-ticket-controller.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]]]]], options);
17
+ return index.bootstrapLazy([["helper-accordion_2.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-498fdd8e.js');
3
+ const index = require('./index-4814ed9d.js');
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v2.17.0 | MIT Licensed | https://stenciljs.com
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-controller.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-ticket-controller.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]]]]], options);
18
+ return index.bootstrapLazy([["helper-accordion_2.cjs",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}]]]], options);
19
19
  });
@@ -4,9 +4,16 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.17.0",
7
+ "version": "2.15.2",
8
8
  "typescriptVersion": "4.5.4"
9
9
  },
10
- "collections": [],
10
+ "collections": [
11
+ {
12
+ "name": "@everymatrix/helper-accordion",
13
+ "tags": [
14
+ "helper-accordion"
15
+ ]
16
+ }
17
+ ],
11
18
  "bundles": []
12
19
  }
@@ -0,0 +1,6 @@
1
+ import { A as Accordion, d as defineCustomElement$1 } from './helper-accordion2.js';
2
+
3
+ const HelperAccordion = Accordion;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { HelperAccordion, defineCustomElement };
@@ -0,0 +1,115 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
5
+ const TRANSLATIONS = {
6
+ en: {
7
+ deleteTicket: 'Delete ticket'
8
+ },
9
+ ro: {
10
+ deleteTicket: 'Sterge biletul'
11
+ },
12
+ };
13
+ const translate = (key, customLang) => {
14
+ const lang = customLang;
15
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
16
+ };
17
+
18
+ const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px 4px 0 0;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
19
+
20
+ const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
+ constructor() {
22
+ super();
23
+ this.__registerHost();
24
+ this.__attachShadow();
25
+ this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
26
+ /**
27
+ * Flag for ticket history
28
+ */
29
+ this.ticketHistoryFlag = false;
30
+ /**
31
+ * Title (top header)
32
+ */
33
+ this.headerTitle = '';
34
+ /**
35
+ * SubTitle (top header)
36
+ */
37
+ this.headerSubtitle = '';
38
+ /**
39
+ * Description
40
+ */
41
+ this.description = '';
42
+ /**
43
+ * Enables footer content
44
+ */
45
+ this.footer = false;
46
+ /**
47
+ * Enables footer button for tab deletion
48
+ */
49
+ this.deleteTab = false;
50
+ /**
51
+ * Activates postMessages as events for actions from the widget
52
+ */
53
+ this.postMessage = false;
54
+ /**
55
+ * Name of the event emitter by the action button
56
+ */
57
+ this.eventName = 'helperAccordionAction';
58
+ /**
59
+ * Collapsed
60
+ */
61
+ this.collapsed = true;
62
+ /**
63
+ * Language
64
+ */
65
+ this.language = 'en';
66
+ }
67
+ // @TODO fix the `any` type :)
68
+ connectedCallback() {
69
+ this.showContent = !this.collapsed;
70
+ }
71
+ toggleContent() {
72
+ this.showContent = !this.showContent;
73
+ }
74
+ deleteAction() {
75
+ if (this.postMessage) {
76
+ // @TODO maybe change the name type, this one sucks
77
+ window.postMessage({ type: this.eventName }, window.location.href);
78
+ }
79
+ this.accordionEvent.emit();
80
+ }
81
+ render() {
82
+ return (h("div", { class: "Wrapper" }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
83
+ h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
84
+ h("div", null, this.deleteTab &&
85
+ h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
86
+ }
87
+ static get style() { return helperAccordionCss; }
88
+ }, [1, "helper-accordion", {
89
+ "ticketHistoryFlag": [4, "ticket-history-flag"],
90
+ "headerTitle": [1, "header-title"],
91
+ "headerSubtitle": [1, "header-subtitle"],
92
+ "description": [1],
93
+ "footer": [4],
94
+ "deleteTab": [4, "delete-tab"],
95
+ "postMessage": [4, "post-message"],
96
+ "eventName": [1, "event-name"],
97
+ "collapsed": [4],
98
+ "language": [1],
99
+ "showContent": [32]
100
+ }]);
101
+ function defineCustomElement() {
102
+ if (typeof customElements === "undefined") {
103
+ return;
104
+ }
105
+ const components = ["helper-accordion"];
106
+ components.forEach(tagName => { switch (tagName) {
107
+ case "helper-accordion":
108
+ if (!customElements.get(tagName)) {
109
+ customElements.define(tagName, Accordion);
110
+ }
111
+ break;
112
+ } });
113
+ }
114
+
115
+ export { Accordion as A, defineCustomElement as d };
@@ -1,5 +1,6 @@
1
1
  /* LotteryTicketController custom elements */
2
- export { LotteryTicketController as LotteryTicketController } from '../types/components/lottery-ticket-controller/lottery-ticket-controller';
2
+
3
+ import type { Components, JSX } from "../types/components";
3
4
 
4
5
  /**
5
6
  * Used to manually set the base path where assets can be found.
@@ -19,4 +20,7 @@ export interface SetPlatformOptions {
19
20
  rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
20
21
  }
21
22
  export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
23
+
24
+ export type { Components, JSX };
25
+
22
26
  export * from '../types';
@@ -1,2 +1 @@
1
1
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
2
- export { LotteryTicketController, defineCustomElement as defineCustomElementLotteryTicketController } from './lottery-ticket-controller.js';
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import '@everymatrix/helper-accordion';
3
2
  import '@everymatrix/lottery-ticket';
3
+ import { d as defineCustomElement$2 } from './helper-accordion2.js';
4
4
 
5
5
  const lotteryTicketControllerCss = ":host{display:block}";
6
6
 
@@ -82,13 +82,18 @@ function defineCustomElement$1() {
82
82
  if (typeof customElements === "undefined") {
83
83
  return;
84
84
  }
85
- const components = ["lottery-ticket-controller"];
85
+ const components = ["lottery-ticket-controller", "helper-accordion"];
86
86
  components.forEach(tagName => { switch (tagName) {
87
87
  case "lottery-ticket-controller":
88
88
  if (!customElements.get(tagName)) {
89
89
  customElements.define(tagName, LotteryTicketController$1);
90
90
  }
91
91
  break;
92
+ case "helper-accordion":
93
+ if (!customElements.get(tagName)) {
94
+ defineCustomElement$2();
95
+ }
96
+ break;
92
97
  } });
93
98
  }
94
99
 
@@ -0,0 +1,151 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-116c3025.js';
2
+ import '@everymatrix/lottery-ticket';
3
+
4
+ const DEFAULT_LANGUAGE = 'en';
5
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
6
+ const TRANSLATIONS = {
7
+ en: {
8
+ deleteTicket: 'Delete ticket'
9
+ },
10
+ ro: {
11
+ deleteTicket: 'Sterge biletul'
12
+ },
13
+ };
14
+ const translate = (key, customLang) => {
15
+ const lang = customLang;
16
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
17
+ };
18
+
19
+ const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px 4px 0 0;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
20
+
21
+ const Accordion = class {
22
+ constructor(hostRef) {
23
+ registerInstance(this, hostRef);
24
+ this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
25
+ /**
26
+ * Flag for ticket history
27
+ */
28
+ this.ticketHistoryFlag = false;
29
+ /**
30
+ * Title (top header)
31
+ */
32
+ this.headerTitle = '';
33
+ /**
34
+ * SubTitle (top header)
35
+ */
36
+ this.headerSubtitle = '';
37
+ /**
38
+ * Description
39
+ */
40
+ this.description = '';
41
+ /**
42
+ * Enables footer content
43
+ */
44
+ this.footer = false;
45
+ /**
46
+ * Enables footer button for tab deletion
47
+ */
48
+ this.deleteTab = false;
49
+ /**
50
+ * Activates postMessages as events for actions from the widget
51
+ */
52
+ this.postMessage = false;
53
+ /**
54
+ * Name of the event emitter by the action button
55
+ */
56
+ this.eventName = 'helperAccordionAction';
57
+ /**
58
+ * Collapsed
59
+ */
60
+ this.collapsed = true;
61
+ /**
62
+ * Language
63
+ */
64
+ this.language = 'en';
65
+ }
66
+ // @TODO fix the `any` type :)
67
+ connectedCallback() {
68
+ this.showContent = !this.collapsed;
69
+ }
70
+ toggleContent() {
71
+ this.showContent = !this.showContent;
72
+ }
73
+ deleteAction() {
74
+ if (this.postMessage) {
75
+ // @TODO maybe change the name type, this one sucks
76
+ window.postMessage({ type: this.eventName }, window.location.href);
77
+ }
78
+ this.accordionEvent.emit();
79
+ }
80
+ render() {
81
+ return (h("div", { class: "Wrapper" }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle" }, this.description), h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
82
+ h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
83
+ h("div", null, this.deleteTab &&
84
+ h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
85
+ }
86
+ };
87
+ Accordion.style = helperAccordionCss;
88
+
89
+ const lotteryTicketControllerCss = ":host{display:block}";
90
+
91
+ const LotteryTicketController = class {
92
+ constructor(hostRef) {
93
+ registerInstance(this, hostRef);
94
+ this.deleteTicketEvent = createEvent(this, "deleteTicket", 7);
95
+ /**
96
+ * Endpoint URL for the source of data (NorWAy standard)
97
+ */
98
+ this.endpoint = '';
99
+ /**
100
+ * Ticket number
101
+ */
102
+ this.ticketId = 1;
103
+ /**
104
+ * Activates postMessages as events for actions from the widget
105
+ */
106
+ this.postMessage = false;
107
+ /**
108
+ * Name of the event emitter by the action button
109
+ */
110
+ this.eventName = 'deleteTicketAction';
111
+ /**
112
+ * Collapsed
113
+ */
114
+ this.collapsed = true;
115
+ /**
116
+ * Number of grids?
117
+ */
118
+ this.numberOfGrids = 1;
119
+ /**
120
+ * This toggles if the last ticket added should be expanded or not
121
+ */
122
+ this.last = false;
123
+ /**
124
+ * Language
125
+ */
126
+ this.language = 'en';
127
+ /**
128
+ * Shows the auto-pick button
129
+ */
130
+ this.autoPick = false;
131
+ /**
132
+ * Shows the reset button
133
+ */
134
+ this.resetButton = false;
135
+ }
136
+ // @TODO fix the `any` type
137
+ helperAccordionActionHandler() {
138
+ if (this.postMessage) {
139
+ window.postMessage({ type: this.eventName }, window.location.href);
140
+ }
141
+ this.deleteTicketEvent.emit({
142
+ ticketId: this.ticketId
143
+ });
144
+ }
145
+ render() {
146
+ return (h("div", null, h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, h("div", { slot: "accordionContent" }, h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
147
+ }
148
+ };
149
+ LotteryTicketController.style = lotteryTicketControllerCss;
150
+
151
+ export { Accordion as helper_accordion, LotteryTicketController as lottery_ticket_controller };
@@ -83,7 +83,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
83
83
  };
84
84
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
85
85
  let scopeId = getScopeId(cmpMeta);
86
- const style = styles.get(scopeId);
86
+ let style = styles.get(scopeId);
87
87
  // if an element is NOT connected then getRootNode() will return the wrong root node
88
88
  // so the fallback is to always use the document for the root node in those cases
89
89
  styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
@@ -163,7 +163,7 @@ const h = (nodeName, vnodeData, ...children) => {
163
163
  let child = null;
164
164
  let simple = false;
165
165
  let lastSimple = false;
166
- const vNodeChildren = [];
166
+ let vNodeChildren = [];
167
167
  const walk = (c) => {
168
168
  for (let i = 0; i < c.length; i++) {
169
169
  child = c[i];
@@ -187,6 +187,19 @@ const h = (nodeName, vnodeData, ...children) => {
187
187
  }
188
188
  };
189
189
  walk(children);
190
+ if (vnodeData) {
191
+ {
192
+ const classData = vnodeData.className || vnodeData.class;
193
+ if (classData) {
194
+ vnodeData.class =
195
+ typeof classData !== 'object'
196
+ ? classData
197
+ : Object.keys(classData)
198
+ .filter((k) => classData[k])
199
+ .join(' ');
200
+ }
201
+ }
202
+ }
190
203
  const vnode = newVNode(nodeName, null);
191
204
  vnode.$attrs$ = vnodeData;
192
205
  if (vNodeChildren.length > 0) {
@@ -220,14 +233,60 @@ const isHost = (node) => node && node.$tag$ === Host;
220
233
  const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
221
234
  if (oldValue !== newValue) {
222
235
  let isProp = isMemberInElement(elm, memberName);
223
- memberName.toLowerCase();
224
- {
236
+ let ln = memberName.toLowerCase();
237
+ if (memberName === 'class') {
238
+ const classList = elm.classList;
239
+ const oldClasses = parseClassList(oldValue);
240
+ const newClasses = parseClassList(newValue);
241
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
242
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
243
+ }
244
+ else if ((!isProp ) &&
245
+ memberName[0] === 'o' &&
246
+ memberName[1] === 'n') {
247
+ // Event Handlers
248
+ // so if the member name starts with "on" and the 3rd characters is
249
+ // a capital letter, and it's not already a member on the element,
250
+ // then we're assuming it's an event listener
251
+ if (memberName[2] === '-') {
252
+ // on- prefixed events
253
+ // allows to be explicit about the dom event to listen without any magic
254
+ // under the hood:
255
+ // <my-cmp on-click> // listens for "click"
256
+ // <my-cmp on-Click> // listens for "Click"
257
+ // <my-cmp on-ionChange> // listens for "ionChange"
258
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
259
+ memberName = memberName.slice(3);
260
+ }
261
+ else if (isMemberInElement(win, ln)) {
262
+ // standard event
263
+ // the JSX attribute could have been "onMouseOver" and the
264
+ // member name "onmouseover" is on the window's prototype
265
+ // so let's add the listener "mouseover", which is all lowercased
266
+ memberName = ln.slice(2);
267
+ }
268
+ else {
269
+ // custom event
270
+ // the JSX attribute could have been "onMyCustomEvent"
271
+ // so let's trim off the "on" prefix and lowercase the first character
272
+ // and add the listener "myCustomEvent"
273
+ // except for the first character, we keep the event name case
274
+ memberName = ln[2] + memberName.slice(3);
275
+ }
276
+ if (oldValue) {
277
+ plt.rel(elm, memberName, oldValue, false);
278
+ }
279
+ if (newValue) {
280
+ plt.ael(elm, memberName, newValue, false);
281
+ }
282
+ }
283
+ else {
225
284
  // Set property if it exists and it's not a SVG
226
285
  const isComplex = isComplexType(newValue);
227
286
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
228
287
  try {
229
288
  if (!elm.tagName.includes('-')) {
230
- const n = newValue == null ? '' : newValue;
289
+ let n = newValue == null ? '' : newValue;
231
290
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
232
291
  if (memberName === 'list') {
233
292
  isProp = false;
@@ -258,6 +317,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
258
317
  }
259
318
  }
260
319
  };
320
+ const parseClassListRegex = /\s/;
321
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
261
322
  const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
262
323
  // if the element passed in is a shadow root, which is a document fragment
263
324
  // then we want to be adding attrs/props to the shadow root's "host" element
@@ -282,11 +343,15 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
282
343
  };
283
344
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
284
345
  // tslint:disable-next-line: prefer-const
285
- const newVNode = newParentVNode.$children$[childIndex];
346
+ let newVNode = newParentVNode.$children$[childIndex];
286
347
  let i = 0;
287
348
  let elm;
288
349
  let childNode;
289
- {
350
+ if (newVNode.$text$ !== null) {
351
+ // create text node
352
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
353
+ }
354
+ else {
290
355
  // create element
291
356
  elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
292
357
  // add css classes, attrs, props, listeners, etc.
@@ -415,10 +480,14 @@ const patch = (oldVNode, newVNode) => {
415
480
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
416
481
  const oldChildren = oldVNode.$children$;
417
482
  const newChildren = newVNode.$children$;
418
- {
483
+ const tag = newVNode.$tag$;
484
+ const text = newVNode.$text$;
485
+ if (text === null) {
419
486
  // element node
420
487
  {
421
- {
488
+ if (tag === 'slot')
489
+ ;
490
+ else {
422
491
  // either this is the first render of an element OR it's an update
423
492
  // AND we already know it's possible it could have changed
424
493
  // this updates the element's css classes, attrs, props, listeners, etc.
@@ -430,6 +499,11 @@ const patch = (oldVNode, newVNode) => {
430
499
  updateChildren(elm, oldChildren, newVNode, newChildren);
431
500
  }
432
501
  else if (newChildren !== null) {
502
+ // no old child vnodes, but there are new child vnodes to add
503
+ if (oldVNode.$text$ !== null) {
504
+ // the old vnode was text, so be sure to clear it out
505
+ elm.textContent = '';
506
+ }
433
507
  // add the new vnode children
434
508
  addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
435
509
  }
@@ -438,6 +512,11 @@ const patch = (oldVNode, newVNode) => {
438
512
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
439
513
  }
440
514
  }
515
+ else if (oldVNode.$text$ !== text) {
516
+ // update the text content for the text only vnode
517
+ // and also only if the text is different than before
518
+ elm.data = text;
519
+ }
441
520
  };
442
521
  const renderVdom = (hostRef, renderFnResults) => {
443
522
  const hostElm = hostRef.$hostElement$;
@@ -841,6 +920,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
841
920
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
842
921
  }
843
922
  endNewInstance();
923
+ fireConnectedCallback(hostRef.$lazyInstance$);
844
924
  }
845
925
  if (Cstr.style) {
846
926
  // this component has styles but we haven't registered them yet
@@ -869,6 +949,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
869
949
  schedule();
870
950
  }
871
951
  };
952
+ const fireConnectedCallback = (instance) => {
953
+ {
954
+ safeCall(instance, 'connectedCallback');
955
+ }
956
+ };
872
957
  const connectedCallback = (elm) => {
873
958
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
874
959
  const hostRef = getHostRef(elm);
@@ -912,6 +997,8 @@ const connectedCallback = (elm) => {
912
997
  // reattach any event listeners to the host
913
998
  // since they would have been removed when disconnected
914
999
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1000
+ // fire off connectedCallback() on component instance
1001
+ fireConnectedCallback(hostRef.$lazyInstance$);
915
1002
  }
916
1003
  endConnected();
917
1004
  }
@@ -1048,9 +1135,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1048
1135
  if (module) {
1049
1136
  return module[exportName];
1050
1137
  }
1051
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1052
1138
  return import(
1053
- /* @vite-ignore */
1054
1139
  /* webpackInclude: /\.entry\.js$/ */
1055
1140
  /* webpackExclude: /\.system\.entry\.js$/ */
1056
1141
  /* webpackMode: "lazy" */
@@ -1,7 +1,7 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-4b81518c.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-116c3025.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Esm v2.17.0 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchEsm = () => {
7
7
  return promiseResolve();
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["lottery-ticket-controller",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]]]]], options);
13
+ return bootstrapLazy([["helper-accordion_2",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -1,7 +1,7 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-4b81518c.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-116c3025.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Browser v2.17.0 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchBrowser = () => {
7
7
  const importMeta = import.meta.url;
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["lottery-ticket-controller",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]]]]], options);
16
+ return bootstrapLazy([["helper-accordion_2",[[1,"lottery-ticket-controller",{"endpoint":[1],"ticketId":[2,"ticket-id"],"ticketDescription":[1,"ticket-description"],"gameId":[1,"game-id"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"numberOfGrids":[2,"number-of-grids"],"last":[4],"language":[1],"autoPick":[4,"auto-pick"],"resetButton":[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"helper-accordion",{"ticketHistoryFlag":[4,"ticket-history-flag"],"headerTitle":[1,"header-title"],"headerSubtitle":[1,"header-subtitle"],"description":[1],"footer":[4],"deleteTab":[4,"delete-tab"],"postMessage":[4,"post-message"],"eventName":[1,"event-name"],"collapsed":[4],"language":[1],"showContent":[32]}]]]], options);
17
17
  });
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-fe83d21a.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-5186fd30",[[1,"lottery-ticket-controller",{endpoint:[1],ticketId:[2,"ticket-id"],ticketDescription:[1,"ticket-description"],gameId:[1,"game-id"],postMessage:[4,"post-message"],eventName:[1,"event-name"],collapsed:[4],numberOfGrids:[2,"number-of-grids"],last:[4],language:[1],autoPick:[4,"auto-pick"],resetButton:[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]]]]],e)));
1
+ import{p as e,b as t}from"./p-b4ec0994.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-efb11dcf",[[1,"lottery-ticket-controller",{endpoint:[1],ticketId:[2,"ticket-id"],ticketDescription:[1,"ticket-description"],gameId:[1,"game-id"],postMessage:[4,"post-message"],eventName:[1,"event-name"],collapsed:[4],numberOfGrids:[2,"number-of-grids"],last:[4],language:[1],autoPick:[4,"auto-pick"],resetButton:[4,"reset-button"]},[[0,"helperAccordionAction","helperAccordionActionHandler"]]],[1,"helper-accordion",{ticketHistoryFlag:[4,"ticket-history-flag"],headerTitle:[1,"header-title"],headerSubtitle:[1,"header-subtitle"],description:[1],footer:[4],deleteTab:[4,"delete-tab"],postMessage:[4,"post-message"],eventName:[1,"event-name"],collapsed:[4],language:[1],showContent:[32]}]]]],e)));
@@ -0,0 +1 @@
1
+ let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const c=e,r=u(t,s),i=a(n);o.ael(c,l,r,i),(t.o=t.o||[]).push((()=>o.rel(c,l,r,i)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){I(e)}},a=e=>0!=(2&e),f=new WeakMap,h=e=>"sc-"+e.h,$={},d=e=>"object"==(e=typeof e)||"function"===e,y=(e,t,...n)=>{let l=null,s=!1,o=!1,c=[];const r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!d(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?m(null,l):l),o=s)};if(r(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=m(e,null);return i.m=t,c.length>0&&(i.p=c),i},m=(e,t)=>({t:0,S:e,$:t,g:null,p:null,m:null}),p={},b=(e,t,n,s,c,r)=>{if(n!==s){let i=G(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=S(n),o=S(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if(i||"o"!==t[0]||"n"!==t[1]){const l=d(s);if((i||l&&null!==s)&&!c)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||c)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):G(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},w=/\s/,S=e=>e?e.split(w):[],g=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.m||$,c=t.m||$;for(l in o)l in c||b(s,l,o[l],void 0,n,t.t);for(l in c)b(s,l,o[l],c[l],n,t.t)},j=(t,n,l)=>{let o,c,r=n.p[l],i=0;if(null!==r.$)o=r.g=s.createTextNode(r.$);else if(o=r.g=s.createElement(r.S),g(null,r,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.p)for(i=0;i<r.p.length;++i)c=j(t,r,i),c&&o.appendChild(c);return o},v=(e,n,l,s,o,c)=>{let r,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=c;++o)s[o]&&(r=j(null,l,o),r&&(s[o].g=r,i.insertBefore(r,n)))},k=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.g.remove()},M=(e,t)=>e.S===t.S,C=(e,t)=>{const n=t.g=e.g,l=e.p,s=t.p,o=t.$;null===o?("slot"===t.S||g(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,c=0,r=t.length-1,i=t[0],u=t[r],a=l.length-1,f=l[0],h=l[a];for(;o<=r&&c<=a;)null==i?i=t[++o]:null==u?u=t[--r]:null==f?f=l[++c]:null==h?h=l[--a]:M(i,f)?(C(i,f),i=t[++o],f=l[++c]):M(u,h)?(C(u,h),u=t[--r],h=l[--a]):M(i,h)?(C(i,h),e.insertBefore(i.g,u.g.nextSibling),i=t[++o],h=l[--a]):M(u,f)?(C(u,f),e.insertBefore(u.g,i.g),u=t[--r],f=l[++c]):(s=j(t&&t[c],n,c),f=l[++c],s&&i.g.parentNode.insertBefore(s,i.g));o>r?v(e,null==l[a+1]?null:l[a+1].g,n,l,c,a):c>a&&k(t,o,r)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),v(n,null,t,s,0,s.length-1)):null!==l&&k(l,0,l.length-1)):e.$!==o&&(n.data=o)},O=(e,t,n)=>{const l=(e=>z(e).j)(e);return{emit:e=>P(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},P=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},x=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},E=(e,t)=>{if(e.t|=16,!(4&e.t))return x(e,e.k),le((()=>N(e,t)));e.t|=512},N=(e,t)=>{const n=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>R(n,e,t))),e.u=null)),U(void 0,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.M,n=e.j,l=t.t,o=((e,t)=>{let n=h(t),l=Q.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=f.get(e=e.head||e);o||f.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);A(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>F(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.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=(e=>e&&e.S===p)(l)?l:y(null,null,l);t=s.tagName,c.S=null,c.t|=4,n.C=c,c.g=o.g=s.shadowRoot||s,e=s["s-sc"],C(o,c)})(n,l)}catch(e){I(e,n.j)}return null},F=e=>{const t=e.j,n=e.k;64&e.t||(e.t|=64,W(t),e.O(t),n||L()),e.v&&(e.v(),e.v=void 0),512&e.t&&ne((()=>E(e,!1))),e.t&=-517},L=()=>{W(s.documentElement),ne((()=>P(l,"appload",{detail:{namespace:"lottery-ticket-controller"}})))},R=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){I(e)}},U=(e,t)=>e&&e.then?e.then(t):t(),W=e=>e.classList.add("hydrated"),q=(e,t,n)=>{if(t.P){const l=Object.entries(t.P),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>z(this).N.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=z(e),o=s.N.get(t),c=s.t,r=s.i;n=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.P[t][0]),8&c&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.N.set(t,n),r&&2==(18&c)&&E(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);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}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},H=e=>{R(e,"connectedCallback")},V=(e,t={})=>{const n=[],c=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let y,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],P:t[2],T:t[3]};l.P=t[2],l.T=t[3];const s=l.h,a=class extends HTMLElement{constructor(e){super(e),D(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),m?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=z(e),n=t.M,l=()=>{};if(1&t.t)i(e,t,n.T),H(t.i);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){x(t,t.k=n);break}}n.P&&Object.entries(n.P).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=K(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(q(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){I(e)}t.t&=-9,e(),H(t.i)}if(s.style){let e=s.style;const t=h(n);if(!Q.has(t)){const l=()=>{};((e,t,n)=>{let l=Q.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Q.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.k,c=()=>E(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=z(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return z(this).A}};l.F=e[0],c.includes(s)||u.get(s)||(n.push(s),u.define(s,q(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),m=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>y=setTimeout(L,30)))},_=new WeakMap,z=e=>_.get(e),B=(e,t)=>_.set(t.i=e,t),D=(e,t)=>{const n={t:0,j:e,M:t,N:new Map};return n.A=new Promise((e=>n.O=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.T),_.set(e,n)},G=(e,t)=>t in e,I=(e,t)=>(0,console.error)(e,t),J=new Map,K=e=>{const t=e.h.replace(/-/g,"_"),n=e.F,l=J.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(J.set(n,e),e[t])),I)},Q=new Map,X=[],Y=[],Z=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?ne(te):o.raf(te))},ee=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){I(e)}e.length=0},te=()=>{ee(X),ee(Y),(n=X.length>0)&&o.raf(te)},ne=e=>c().then(e),le=Z(Y,!0);export{V as b,O as c,y as h,c as p,B as r}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i}from"./p-b4ec0994.js";import"@everymatrix/lottery-ticket";const s=["ro","en"],o={en:{deleteTicket:"Delete ticket"},ro:{deleteTicket:"Sterge biletul"}},r=class{constructor(i){t(this,i),this.accordionEvent=e(this,"helperAccordionAction",7),this.ticketHistoryFlag=!1,this.headerTitle="",this.headerSubtitle="",this.description="",this.footer=!1,this.deleteTab=!1,this.postMessage=!1,this.eventName="helperAccordionAction",this.collapsed=!0,this.language="en"}connectedCallback(){this.showContent=!this.collapsed}toggleContent(){this.showContent=!this.showContent}deleteAction(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.accordionEvent.emit()}render(){return i("div",{class:"Wrapper"},i("div",{class:!0===this.ticketHistoryFlag?"HeaderTicketHistory":"Header"},i("p",{class:"Title"},this.headerTitle),i("p",{class:"Subtitle"},this.headerSubtitle),i("p",{class:"Subtitle"},this.description),i("span",{class:"Expand",onClick:()=>this.toggleContent()},this.showContent?"<":">")),this.showContent&&i("div",null,i("div",{class:"Content"},i("slot",{name:"accordionContent"}),this.footer&&this.showContent&&i("div",null,this.deleteTab&&i("span",{class:"ActionButton",onClick:()=>this.deleteAction()},(()=>{const t=this.language;return o[void 0!==t&&s.includes(t)?t:"en"].deleteTicket})())))))}};r.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}.Header{border-radius:4px 4px 0 0;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}';const n=class{constructor(i){t(this,i),this.deleteTicketEvent=e(this,"deleteTicket",7),this.endpoint="",this.ticketId=1,this.postMessage=!1,this.eventName="deleteTicketAction",this.collapsed=!0,this.numberOfGrids=1,this.last=!1,this.language="en",this.autoPick=!1,this.resetButton=!1}helperAccordionActionHandler(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.deleteTicketEvent.emit({ticketId:this.ticketId})}render(){return i("div",null,i("helper-accordion",{"header-title":"Ticket "+this.ticketId,"header-subtitle":this.ticketDescription,footer:!0,"delete-tab":!0,collapsed:!this.last||this.collapsed,language:this.language},i("div",{slot:"accordionContent"},i("lottery-ticket",{endpoint:this.endpoint,"game-id":this.gameId,"ticket-id":this.ticketId,"number-of-grids":this.numberOfGrids,language:this.language,"reset-button":this.resetButton,"auto-pick":this.autoPick}))))}};n.style=":host{display:block}";export{r as helper_accordion,n as lottery_ticket_controller}
@@ -57,10 +57,6 @@ export namespace Components {
57
57
  "ticketId": number;
58
58
  }
59
59
  }
60
- export interface LotteryTicketControllerCustomEvent<T> extends CustomEvent<T> {
61
- detail: T;
62
- target: HTMLLotteryTicketControllerElement;
63
- }
64
60
  declare global {
65
61
  interface HTMLLotteryTicketControllerElement extends Components.LotteryTicketController, HTMLStencilElement {
66
62
  }
@@ -106,7 +102,7 @@ declare namespace LocalJSX {
106
102
  * Number of grids?
107
103
  */
108
104
  "numberOfGrids"?: number;
109
- "onDeleteTicket"?: (event: LotteryTicketControllerCustomEvent<any>) => void;
105
+ "onDeleteTicket"?: (event: CustomEvent<any>) => void;
110
106
  /**
111
107
  * Activates postMessages as events for actions from the widget
112
108
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-ticket-controller",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1,71 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-498fdd8e.js');
6
- require('@everymatrix/helper-accordion');
7
- require('@everymatrix/lottery-ticket');
8
-
9
- const lotteryTicketControllerCss = ":host{display:block}";
10
-
11
- const LotteryTicketController = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- this.deleteTicketEvent = index.createEvent(this, "deleteTicket", 7);
15
- /**
16
- * Endpoint URL for the source of data (NorWAy standard)
17
- */
18
- this.endpoint = '';
19
- /**
20
- * Ticket number
21
- */
22
- this.ticketId = 1;
23
- /**
24
- * Activates postMessages as events for actions from the widget
25
- */
26
- this.postMessage = false;
27
- /**
28
- * Name of the event emitter by the action button
29
- */
30
- this.eventName = 'deleteTicketAction';
31
- /**
32
- * Collapsed
33
- */
34
- this.collapsed = true;
35
- /**
36
- * Number of grids?
37
- */
38
- this.numberOfGrids = 1;
39
- /**
40
- * This toggles if the last ticket added should be expanded or not
41
- */
42
- this.last = false;
43
- /**
44
- * Language
45
- */
46
- this.language = 'en';
47
- /**
48
- * Shows the auto-pick button
49
- */
50
- this.autoPick = false;
51
- /**
52
- * Shows the reset button
53
- */
54
- this.resetButton = false;
55
- }
56
- // @TODO fix the `any` type
57
- helperAccordionActionHandler() {
58
- if (this.postMessage) {
59
- window.postMessage({ type: this.eventName }, window.location.href);
60
- }
61
- this.deleteTicketEvent.emit({
62
- ticketId: this.ticketId
63
- });
64
- }
65
- render() {
66
- return (index.h("div", null, index.h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, index.h("div", { slot: "accordionContent" }, index.h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
67
- }
68
- };
69
- LotteryTicketController.style = lotteryTicketControllerCss;
70
-
71
- exports.lottery_ticket_controller = LotteryTicketController;
@@ -1,67 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-4b81518c.js';
2
- import '@everymatrix/helper-accordion';
3
- import '@everymatrix/lottery-ticket';
4
-
5
- const lotteryTicketControllerCss = ":host{display:block}";
6
-
7
- const LotteryTicketController = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.deleteTicketEvent = createEvent(this, "deleteTicket", 7);
11
- /**
12
- * Endpoint URL for the source of data (NorWAy standard)
13
- */
14
- this.endpoint = '';
15
- /**
16
- * Ticket number
17
- */
18
- this.ticketId = 1;
19
- /**
20
- * Activates postMessages as events for actions from the widget
21
- */
22
- this.postMessage = false;
23
- /**
24
- * Name of the event emitter by the action button
25
- */
26
- this.eventName = 'deleteTicketAction';
27
- /**
28
- * Collapsed
29
- */
30
- this.collapsed = true;
31
- /**
32
- * Number of grids?
33
- */
34
- this.numberOfGrids = 1;
35
- /**
36
- * This toggles if the last ticket added should be expanded or not
37
- */
38
- this.last = false;
39
- /**
40
- * Language
41
- */
42
- this.language = 'en';
43
- /**
44
- * Shows the auto-pick button
45
- */
46
- this.autoPick = false;
47
- /**
48
- * Shows the reset button
49
- */
50
- this.resetButton = false;
51
- }
52
- // @TODO fix the `any` type
53
- helperAccordionActionHandler() {
54
- if (this.postMessage) {
55
- window.postMessage({ type: this.eventName }, window.location.href);
56
- }
57
- this.deleteTicketEvent.emit({
58
- ticketId: this.ticketId
59
- });
60
- }
61
- render() {
62
- return (h("div", null, h("helper-accordion", { "header-title": 'Ticket ' + this.ticketId, "header-subtitle": this.ticketDescription, footer: true, "delete-tab": true, collapsed: !this.last || this.collapsed, language: this.language }, h("div", { slot: "accordionContent" }, h("lottery-ticket", { endpoint: this.endpoint, "game-id": this.gameId, "ticket-id": this.ticketId, "number-of-grids": this.numberOfGrids, language: this.language, "reset-button": this.resetButton, "auto-pick": this.autoPick })))));
63
- }
64
- };
65
- LotteryTicketController.style = lotteryTicketControllerCss;
66
-
67
- export { LotteryTicketController as lottery_ticket_controller };
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as e}from"./p-fe83d21a.js";import"@everymatrix/helper-accordion";import"@everymatrix/lottery-ticket";const s=class{constructor(e){t(this,e),this.deleteTicketEvent=i(this,"deleteTicket",7),this.endpoint="",this.ticketId=1,this.postMessage=!1,this.eventName="deleteTicketAction",this.collapsed=!0,this.numberOfGrids=1,this.last=!1,this.language="en",this.autoPick=!1,this.resetButton=!1}helperAccordionActionHandler(){this.postMessage&&window.postMessage({type:this.eventName},window.location.href),this.deleteTicketEvent.emit({ticketId:this.ticketId})}render(){return e("div",null,e("helper-accordion",{"header-title":"Ticket "+this.ticketId,"header-subtitle":this.ticketDescription,footer:!0,"delete-tab":!0,collapsed:!this.last||this.collapsed,language:this.language},e("div",{slot:"accordionContent"},e("lottery-ticket",{endpoint:this.endpoint,"game-id":this.gameId,"ticket-id":this.ticketId,"number-of-grids":this.numberOfGrids,language:this.language,"reset-button":this.resetButton,"auto-pick":this.autoPick}))))}};s.style=":host{display:block}";export{s as lottery_ticket_controller}
@@ -1,2 +0,0 @@
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)},r=t=>Promise.resolve(t),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(t){}return!1})(),i=(t,e,n)=>{n&&n.map((([n,l,s])=>{const r=t,c=u(e,s),i=a(n);o.ael(r,l,c,i),(e.o=e.o||[]).push((()=>o.rel(r,l,c,i)))}))},u=(t,e)=>n=>{try{256&t.t?t.i[e](n):(t.u=t.u||[]).push([e,n])}catch(t){B(t)}},a=t=>0!=(2&t),f=new WeakMap,h=t=>"sc-"+t.h,$={},d=t=>"object"==(t=typeof t)||"function"===t,y=(t,e,...n)=>{let l=null,s=!1,o=!1;const r=[],c=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!d(l))&&(l+=""),s&&o?r[r.length-1].$+=l:r.push(s?m(null,l):l),o=s)};c(n);const i=m(t,null);return i.m=e,r.length>0&&(i.p=r),i},m=(t,e)=>({t:0,S:t,$:e,g:null,p:null,m:null}),p={},b=(t,e,n,l,s,o)=>{if(n!==l){let r=z(t,e);e.toLowerCase();{const c=d(l);if((r||c&&null!==l)&&!s)try{if(t.tagName.includes("-"))t[e]=l;else{const s=null==l?"":l;"list"===e?r=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!r||4&o||s)&&!c&&t.setAttribute(e,l=!0===l?"":l)}}},w=(t,e,n,l)=>{const s=11===e.g.nodeType&&e.g.host?e.g.host:e.g,o=t&&t.m||$,r=e.m||$;for(l in o)l in r||b(s,l,o[l],void 0,n,e.t);for(l in r)b(s,l,o[l],r[l],n,e.t)},S=(e,n,l)=>{const o=n.p[l];let r,c,i=0;if(r=o.g=s.createElement(o.S),w(null,o,!1),null!=t&&r["s-si"]!==t&&r.classList.add(r["s-si"]=t),o.p)for(i=0;i<o.p.length;++i)c=S(e,o,i),c&&r.appendChild(c);return r},g=(t,n,l,s,o,r)=>{let c,i=t;for(i.shadowRoot&&i.tagName===e&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=S(null,l,o),c&&(s[o].g=c,i.insertBefore(c,n)))},v=(t,e,n,l)=>{for(;e<=n;++e)(l=t[e])&&l.g.remove()},M=(t,e)=>t.S===e.S,j=(t,e)=>{const n=e.g=t.g,l=t.p,s=e.p;w(t,e,!1),null!==l&&null!==s?((t,e,n,l)=>{let s,o=0,r=0,c=e.length-1,i=e[0],u=e[c],a=l.length-1,f=l[0],h=l[a];for(;o<=c&&r<=a;)null==i?i=e[++o]:null==u?u=e[--c]:null==f?f=l[++r]:null==h?h=l[--a]:M(i,f)?(j(i,f),i=e[++o],f=l[++r]):M(u,h)?(j(u,h),u=e[--c],h=l[--a]):M(i,h)?(j(i,h),t.insertBefore(i.g,u.g.nextSibling),i=e[++o],h=l[--a]):M(u,f)?(j(u,f),t.insertBefore(u.g,i.g),u=e[--c],f=l[++r]):(s=S(e&&e[r],n,r),f=l[++r],s&&i.g.parentNode.insertBefore(s,i.g));o>c?g(t,null==l[a+1]?null:l[a+1].g,n,l,r,a):r>a&&v(e,o,c)})(n,l,e,s):null!==s?g(n,null,e,s,0,s.length-1):null!==l&&v(l,0,l.length-1)},k=(t,e,n)=>{const l=(t=>H(t).v)(t);return{emit:t=>C(l,e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t})}},C=(t,e,n)=>{const l=o.ce(e,n);return t.dispatchEvent(l),l},O=(t,e)=>{e&&!t.M&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.M=e)))},P=(t,e)=>{if(t.t|=16,!(4&t.t))return O(t,t.j),tt((()=>x(t,e)));t.t|=512},x=(t,e)=>{const n=t.i;return e&&(t.t|=256,t.u&&(t.u.map((([t,e])=>F(n,t,e))),t.u=null)),L(void 0,(()=>E(t,n,e)))},E=async(t,e,n)=>{const l=t.v,o=l["s-rc"];n&&(t=>{const e=t.k,n=t.v,l=e.t,o=((t,e)=>{let n=h(e);const l=I.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);N(t,e),o&&(o.map((t=>t())),l["s-rc"]=void 0);{const e=l["s-p"],n=()=>T(t);0===e.length?n():(Promise.all(e).then(n),t.t|=4,e.length=0)}},N=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.v,o=n.C||m(null,null),r=(t=>t&&t.S===p)(l)?l:y(null,null,l);e=s.tagName,r.S=null,r.t|=4,n.C=r,r.g=o.g=s.shadowRoot||s,t=s["s-sc"],j(o,r)})(n,l)}catch(t){B(t,n.v)}return null},T=t=>{const e=t.v,n=t.j;64&t.t||(t.t|=64,R(e),t.O(e),n||A()),t.M&&(t.M(),t.M=void 0),512&t.t&&Z((()=>P(t,!1))),t.t&=-517},A=()=>{R(s.documentElement),Z((()=>C(l,"appload",{detail:{namespace:"lottery-ticket-controller"}})))},F=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){B(t)}},L=(t,e)=>t&&t.then?t.then(e):e(),R=t=>t.classList.add("hydrated"),U=(t,e,n)=>{if(e.P){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)=>H(this).N.get(e))(0,t)},set(n){((t,e,n,l)=>{const s=H(t),o=s.N.get(e),r=s.t,c=s.i;n=((t,e)=>null==t||d(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!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.N.set(e,n),c&&2==(18&r)&&P(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},W=(t,e={})=>{const n=[],r=e.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let y,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],T:e[3]};l.P=e[2],l.T=e[3];const s=l.h,a=class extends HTMLElement{constructor(t){super(t),_(t=this,l),1&l.t&&t.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),m?d.push(this):o.jmp((()=>(t=>{if(0==(1&o.t)){const e=H(t),n=e.k,l=()=>{};if(1&e.t)i(t,e,n.T);else{e.t|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){O(e,e.j=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=G(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(U(s,n,2),s.isProxied=!0);const t=()=>{};e.t|=8;try{new s(e)}catch(t){B(t)}e.t&=-9,t()}if(s.style){let t=s.style;const e=h(n);if(!I.has(e)){const l=()=>{};((t,e,n)=>{let l=I.get(t);c&&n?(l=l||new CSSStyleSheet,l.replace(e)):l=e,I.set(t,l)})(e,t,!!(1&n.t)),l()}}}const o=e.j,r=()=>P(e,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,e,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const t=H(this);t.o&&(t.o.map((t=>t())),t.o=void 0)}})()))}componentOnReady(){return H(this).A}};l.F=t[0],r.includes(s)||u.get(s)||(n.push(s),u.define(s,U(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),m=!1,d.length?d.map((t=>t.connectedCallback())):o.jmp((()=>y=setTimeout(A,30)))},q=new WeakMap,H=t=>q.get(t),V=(t,e)=>q.set(e.i=t,e),_=(t,e)=>{const n={t:0,v:t,k:e,N:new Map};return n.A=new Promise((t=>n.O=t)),t["s-p"]=[],t["s-rc"]=[],i(t,n,e.T),q.set(t,n)},z=(t,e)=>e in t,B=(t,e)=>(0,console.error)(t,e),D=new Map,G=t=>{const e=t.h.replace(/-/g,"_"),n=t.F,l=D.get(n);return l?l[e]:import(`./${n}.entry.js`).then((t=>(D.set(n,t),t[e])),B)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},I=new Map,J=[],K=[],Q=(t,e)=>l=>{t.push(l),n||(n=!0,e&&4&o.t?Z(Y):o.raf(Y))},X=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){B(t)}t.length=0},Y=()=>{X(J),X(K),(n=J.length>0)&&o.raf(Y)},Z=t=>r().then(t),tt=Q(K,!0);export{W as b,k as c,y as h,r as p,V as r}