@everymatrix/lottery-banner 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/cjs/helper-count-down_2.cjs.entry.js +172 -0
  2. package/dist/cjs/{index-7e1b19dd.js → index-21014502.js} +26 -5
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/{lottery-banner-c3bceca9.js → lottery-banner-c5020b47.js} +25 -297
  6. package/dist/cjs/lottery-banner.cjs.js +2 -2
  7. package/dist/collection/collection-manifest.json +8 -1
  8. package/dist/collection/components/lottery-banner/lottery-banner.css +4 -0
  9. package/dist/collection/components/lottery-banner/lottery-banner.js +25 -26
  10. package/dist/esm/helper-count-down_2.entry.js +168 -0
  11. package/dist/esm/{index-472357af.js → index-fd1b34f8.js} +26 -5
  12. package/dist/esm/index.js +2 -2
  13. package/dist/esm/loader.js +3 -3
  14. package/dist/esm/{lottery-banner-8d9a42d1.js → lottery-banner-a9eb5657.js} +22 -298
  15. package/dist/esm/lottery-banner.js +3 -3
  16. package/dist/lottery-banner/helper-count-down_2.entry.js +1 -0
  17. package/dist/lottery-banner/index-fd1b34f8.js +2 -0
  18. package/dist/lottery-banner/index.esm.js +1 -1
  19. package/dist/lottery-banner/lottery-banner-a9eb5657.js +1 -0
  20. package/dist/lottery-banner/lottery-banner.esm.js +1 -1
  21. package/dist/types/components/lottery-banner/lottery-banner.d.ts +7 -9
  22. package/dist/types/components.d.ts +3 -3
  23. package/package.json +1 -1
  24. package/dist/cjs/lottery-banner.cjs.entry.js +0 -10
  25. package/dist/esm/lottery-banner.entry.js +0 -2
  26. package/dist/lottery-banner/index-472357af.js +0 -2
  27. package/dist/lottery-banner/lottery-banner-8d9a42d1.js +0 -1
  28. package/dist/lottery-banner/lottery-banner.entry.js +0 -1
@@ -0,0 +1,168 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-fd1b34f8.js';
2
+ import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling, p as parseISO } from './lottery-banner-a9eb5657.js';
3
+ export { L as lottery_banner } from './lottery-banner-a9eb5657.js';
4
+
5
+ const helperCountDownCss = ":host{display:block}.helper-count-down-container{display:flex;align-items:center}.helper-count-down-prefix{margin-right:4px}.helper-count-down-suffix{margin-left:4px}.helper-count-down-values{display:flex;align-items:center}.helper-count-down-item{display:flex;align-items:center;justify-content:center}.helper-count-down-item-num{font-variant-numeric:tabular-nums}";
6
+ const HelperCountDownStyle0 = helperCountDownCss;
7
+
8
+ const HelperCountDown = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.countDownChange = createEvent(this, "countDownChange", 7);
12
+ this.countDownFinish = createEvent(this, "countDownFinish", 7);
13
+ this.value = undefined;
14
+ this.format = 'HH:mm:ss';
15
+ this.prefix = undefined;
16
+ this.suffix = undefined;
17
+ this.mbSource = undefined;
18
+ this.clientStyling = undefined;
19
+ this.clientStylingUrl = undefined;
20
+ this.endTime = undefined;
21
+ this.timeObj = {
22
+ day: { str: '00', unit: '' },
23
+ hour: { str: '00', unit: '' },
24
+ minute: { str: '00', unit: '' },
25
+ second: { str: '00', unit: '' }
26
+ };
27
+ }
28
+ handleClientStylingChange(newValue, oldValue) {
29
+ if (newValue != oldValue) {
30
+ setClientStyling(this.stylingContainer, this.clientStyling);
31
+ }
32
+ }
33
+ handleClientStylingUrlChange(newValue, oldValue) {
34
+ if (newValue != oldValue) {
35
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
36
+ }
37
+ }
38
+ handleMbSourceChange(newValue, oldValue) {
39
+ if (newValue != oldValue) {
40
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
41
+ }
42
+ }
43
+ handleValueChange(newValue) {
44
+ this.setEndTime(newValue);
45
+ if (newValue) {
46
+ this.startCountDown();
47
+ }
48
+ else {
49
+ this.clearCountDown();
50
+ }
51
+ }
52
+ componentDidLoad() {
53
+ if (this.stylingContainer) {
54
+ if (this.mbSource)
55
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
56
+ if (this.clientStyling)
57
+ setClientStyling(this.stylingContainer, this.clientStyling);
58
+ if (this.clientStylingUrl)
59
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
60
+ }
61
+ this.setEndTime(this.value);
62
+ if (this.value)
63
+ this.startCountDown();
64
+ }
65
+ setEndTime(value) {
66
+ if (typeof value === 'string') {
67
+ // If it's a string, parse it and get the milliseconds
68
+ const time = parseISO(value).getTime();
69
+ this.endTime = isNaN(time) ? null : time;
70
+ }
71
+ else {
72
+ // If it's a number, use it directly
73
+ this.endTime = value;
74
+ }
75
+ }
76
+ disconnectedCallback() {
77
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
78
+ this.clearCountDown();
79
+ }
80
+ startCountDown() {
81
+ this.clearCountDown();
82
+ this.tick();
83
+ this.timer = setInterval(() => {
84
+ this.tick();
85
+ }, 1000);
86
+ }
87
+ clearCountDown() {
88
+ if (this.timer) {
89
+ clearInterval(this.timer);
90
+ this.timer = null;
91
+ }
92
+ }
93
+ tick() {
94
+ if (!this.endTime)
95
+ return;
96
+ let leftTime = this.endTime - Date.now();
97
+ if (leftTime <= 0) {
98
+ leftTime = 0;
99
+ this.clearCountDown();
100
+ this.countDownFinish.emit();
101
+ }
102
+ const d = Math.floor(leftTime / (1000 * 60 * 60 * 24));
103
+ const h = Math.floor((leftTime / (1000 * 60 * 60)) % 24);
104
+ const m = Math.floor((leftTime / 1000 / 60) % 60);
105
+ const s = Math.floor((leftTime / 1000) % 60);
106
+ const pad = (n) => (n < 10 ? `0${n}` : `${n}`);
107
+ this.timeObj = {
108
+ day: { str: pad(d), unit: 'd' },
109
+ hour: { str: pad(h), unit: 'h' },
110
+ minute: { str: pad(m), unit: 'm' },
111
+ second: { str: pad(s), unit: 's' }
112
+ };
113
+ const formatTime = this.getFormatTime();
114
+ this.countDownChange.emit({ leftTime, formatTime, legalTime: formatTime });
115
+ }
116
+ getFormatTime() {
117
+ return this.format
118
+ .replace('DD', this.timeObj.day.str)
119
+ .replace('HH', this.timeObj.hour.str)
120
+ .replace('mm', this.timeObj.minute.str)
121
+ .replace('ss', this.timeObj.second.str);
122
+ }
123
+ renderItems() {
124
+ const regex = /(DD|HH|mm|ss)|([\s\S]+?)(?=(DD|HH|mm|ss)|$)/g;
125
+ const items = [];
126
+ let match;
127
+ while ((match = regex.exec(this.format)) !== null) {
128
+ if (match[1]) {
129
+ let val = '';
130
+ switch (match[1]) {
131
+ case 'DD':
132
+ val = this.timeObj.day.str;
133
+ break;
134
+ case 'HH':
135
+ val = this.timeObj.hour.str;
136
+ break;
137
+ case 'mm':
138
+ val = this.timeObj.minute.str;
139
+ break;
140
+ case 'ss':
141
+ val = this.timeObj.second.str;
142
+ break;
143
+ }
144
+ items.push({ val, unit: '' });
145
+ }
146
+ else if (match[2]) {
147
+ if (items.length > 0) {
148
+ items[items.length - 1].unit = match[2];
149
+ }
150
+ }
151
+ }
152
+ return items.map((item, index) => {
153
+ return (h("div", { key: index + item.unit, class: "helper-count-down-item", part: "item" }, h("div", { class: "helper-count-down-item-num" }, item.val), h("div", { class: "helper-count-down-item-unit" }, item.unit)));
154
+ });
155
+ }
156
+ render() {
157
+ return (h("div", { key: 'b360412e045020b5ac0263c6ca56458f31eedb2c', class: "helper-count-down-container", ref: (el) => (this.stylingContainer = el) }, h("slot", { key: 'c72bed87fba869c842407b04e0cbfe038e5b7ea8' }), this.prefix && h("div", { key: '8d3ba9d60577421f81bae7bc76f52a774b17e1fe', class: "helper-count-down-prefix" }, this.prefix), h("div", { key: '187edf3b8eb6de85efe1a748fd8ef47a68e19611', class: "helper-count-down-values", part: "values" }, this.renderItems()), this.suffix && h("div", { key: '3a8e5d9561ecd3f52eff423bd43c8b60a261a17c', class: "helper-count-down-suffix" }, this.suffix)));
158
+ }
159
+ static get watchers() { return {
160
+ "clientStyling": ["handleClientStylingChange"],
161
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
162
+ "mbSource": ["handleMbSourceChange"],
163
+ "value": ["handleValueChange"]
164
+ }; }
165
+ };
166
+ HelperCountDown.style = HelperCountDownStyle0;
167
+
168
+ export { HelperCountDown as helper_count_down };
@@ -1,5 +1,5 @@
1
1
  const NAMESPACE = 'lottery-banner';
2
- const BUILD = /* lottery-banner */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: true };
2
+ const BUILD = /* lottery-banner */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: true };
3
3
 
4
4
  /*
5
5
  Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
@@ -49,10 +49,10 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
49
49
  }
50
50
  switch(bundleId) {
51
51
 
52
- case 'lottery-banner':
52
+ case 'helper-count-down_2':
53
53
  return import(
54
54
  /* webpackMode: "lazy" */
55
- './lottery-banner.entry.js').then(processMod, consoleError);
55
+ './helper-count-down_2.entry.js').then(processMod, consoleError);
56
56
  }
57
57
  }
58
58
  return import(
@@ -376,7 +376,7 @@ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
376
376
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
377
377
  if (oldValue !== newValue) {
378
378
  let isProp = isMemberInElement(elm, memberName);
379
- memberName.toLowerCase();
379
+ let ln = memberName.toLowerCase();
380
380
  if (memberName === "class") {
381
381
  const classList = elm.classList;
382
382
  const oldClasses = parseClassList(oldValue);
@@ -387,6 +387,24 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
387
387
  if (newValue) {
388
388
  newValue(elm);
389
389
  }
390
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
391
+ if (memberName[2] === "-") {
392
+ memberName = memberName.slice(3);
393
+ } else if (isMemberInElement(win, ln)) {
394
+ memberName = ln.slice(2);
395
+ } else {
396
+ memberName = ln[2] + memberName.slice(3);
397
+ }
398
+ if (oldValue || newValue) {
399
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
400
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
401
+ if (oldValue) {
402
+ plt.rel(elm, memberName, oldValue, capture);
403
+ }
404
+ if (newValue) {
405
+ plt.ael(elm, memberName, newValue, capture);
406
+ }
407
+ }
390
408
  } else {
391
409
  const isComplex = isComplexType(newValue);
392
410
  if ((isProp || isComplex && newValue !== null) && !isSvg) {
@@ -421,6 +439,8 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
421
439
  };
422
440
  var parseClassListRegex = /\s/;
423
441
  var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
442
+ var CAPTURE_EVENT_SUFFIX = "Capture";
443
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
424
444
 
425
445
  // src/runtime/vdom/update-element.ts
426
446
  var updateElement = (oldVnode, newVnode, isSvgMode2) => {
@@ -607,10 +627,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
607
627
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
608
628
  const oldChildren = oldVNode.$children$;
609
629
  const newChildren = newVNode2.$children$;
630
+ const tag = newVNode2.$tag$;
610
631
  const text = newVNode2.$text$;
611
632
  if (text === null) {
612
633
  {
613
- {
634
+ if (tag === "slot" && !useNativeShadowDom) ; else {
614
635
  updateElement(oldVNode, newVNode2, isSvgMode);
615
636
  }
616
637
  }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { L as LotteryBanner } from './lottery-banner-8d9a42d1.js';
2
- import './index-472357af.js';
1
+ export { L as LotteryBanner } from './lottery-banner-a9eb5657.js';
2
+ import './index-fd1b34f8.js';
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-472357af.js';
2
- export { s as setNonce } from './index-472357af.js';
1
+ import { b as bootstrapLazy } from './index-fd1b34f8.js';
2
+ export { s as setNonce } from './index-fd1b34f8.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["lottery-banner",[[1,"lottery-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"startTime":[1,"start-time"],"bannerTitle":[1,"banner-title"],"turnover":[1],"layout":[1],"formattedTime":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"startTime":["handleTimeChange"],"stopTime":["handleTimeChange"]}]]]], options);
8
+ return bootstrapLazy([["helper-count-down_2",[[1,"lottery-banner",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"logoUrl":[513,"logo-url"],"stopTime":[1,"stop-time"],"startTime":[1,"start-time"],"bannerTitle":[1,"banner-title"],"turnover":[1],"layout":[1],"isWagerStarted":[32],"formattedStopTime":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"startTime":["handleTimeChange"],"stopTime":["handleTimeChange"]}],[1,"helper-count-down",{"value":[520],"format":[513],"prefix":[513],"suffix":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"endTime":[32],"timeObj":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"value":["handleValueChange"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };