@everymatrix/lottery-banner 0.7.3 → 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,172 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-21014502.js');
6
+ const lotteryBanner = require('./lottery-banner-c5020b47.js');
7
+
8
+ 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}";
9
+ const HelperCountDownStyle0 = helperCountDownCss;
10
+
11
+ const HelperCountDown = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.countDownChange = index.createEvent(this, "countDownChange", 7);
15
+ this.countDownFinish = index.createEvent(this, "countDownFinish", 7);
16
+ this.value = undefined;
17
+ this.format = 'HH:mm:ss';
18
+ this.prefix = undefined;
19
+ this.suffix = undefined;
20
+ this.mbSource = undefined;
21
+ this.clientStyling = undefined;
22
+ this.clientStylingUrl = undefined;
23
+ this.endTime = undefined;
24
+ this.timeObj = {
25
+ day: { str: '00', unit: '' },
26
+ hour: { str: '00', unit: '' },
27
+ minute: { str: '00', unit: '' },
28
+ second: { str: '00', unit: '' }
29
+ };
30
+ }
31
+ handleClientStylingChange(newValue, oldValue) {
32
+ if (newValue != oldValue) {
33
+ lotteryBanner.setClientStyling(this.stylingContainer, this.clientStyling);
34
+ }
35
+ }
36
+ handleClientStylingUrlChange(newValue, oldValue) {
37
+ if (newValue != oldValue) {
38
+ lotteryBanner.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
39
+ }
40
+ }
41
+ handleMbSourceChange(newValue, oldValue) {
42
+ if (newValue != oldValue) {
43
+ lotteryBanner.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
44
+ }
45
+ }
46
+ handleValueChange(newValue) {
47
+ this.setEndTime(newValue);
48
+ if (newValue) {
49
+ this.startCountDown();
50
+ }
51
+ else {
52
+ this.clearCountDown();
53
+ }
54
+ }
55
+ componentDidLoad() {
56
+ if (this.stylingContainer) {
57
+ if (this.mbSource)
58
+ lotteryBanner.setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
59
+ if (this.clientStyling)
60
+ lotteryBanner.setClientStyling(this.stylingContainer, this.clientStyling);
61
+ if (this.clientStylingUrl)
62
+ lotteryBanner.setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
63
+ }
64
+ this.setEndTime(this.value);
65
+ if (this.value)
66
+ this.startCountDown();
67
+ }
68
+ setEndTime(value) {
69
+ if (typeof value === 'string') {
70
+ // If it's a string, parse it and get the milliseconds
71
+ const time = lotteryBanner.parseISO(value).getTime();
72
+ this.endTime = isNaN(time) ? null : time;
73
+ }
74
+ else {
75
+ // If it's a number, use it directly
76
+ this.endTime = value;
77
+ }
78
+ }
79
+ disconnectedCallback() {
80
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
81
+ this.clearCountDown();
82
+ }
83
+ startCountDown() {
84
+ this.clearCountDown();
85
+ this.tick();
86
+ this.timer = setInterval(() => {
87
+ this.tick();
88
+ }, 1000);
89
+ }
90
+ clearCountDown() {
91
+ if (this.timer) {
92
+ clearInterval(this.timer);
93
+ this.timer = null;
94
+ }
95
+ }
96
+ tick() {
97
+ if (!this.endTime)
98
+ return;
99
+ let leftTime = this.endTime - Date.now();
100
+ if (leftTime <= 0) {
101
+ leftTime = 0;
102
+ this.clearCountDown();
103
+ this.countDownFinish.emit();
104
+ }
105
+ const d = Math.floor(leftTime / (1000 * 60 * 60 * 24));
106
+ const h = Math.floor((leftTime / (1000 * 60 * 60)) % 24);
107
+ const m = Math.floor((leftTime / 1000 / 60) % 60);
108
+ const s = Math.floor((leftTime / 1000) % 60);
109
+ const pad = (n) => (n < 10 ? `0${n}` : `${n}`);
110
+ this.timeObj = {
111
+ day: { str: pad(d), unit: 'd' },
112
+ hour: { str: pad(h), unit: 'h' },
113
+ minute: { str: pad(m), unit: 'm' },
114
+ second: { str: pad(s), unit: 's' }
115
+ };
116
+ const formatTime = this.getFormatTime();
117
+ this.countDownChange.emit({ leftTime, formatTime, legalTime: formatTime });
118
+ }
119
+ getFormatTime() {
120
+ return this.format
121
+ .replace('DD', this.timeObj.day.str)
122
+ .replace('HH', this.timeObj.hour.str)
123
+ .replace('mm', this.timeObj.minute.str)
124
+ .replace('ss', this.timeObj.second.str);
125
+ }
126
+ renderItems() {
127
+ const regex = /(DD|HH|mm|ss)|([\s\S]+?)(?=(DD|HH|mm|ss)|$)/g;
128
+ const items = [];
129
+ let match;
130
+ while ((match = regex.exec(this.format)) !== null) {
131
+ if (match[1]) {
132
+ let val = '';
133
+ switch (match[1]) {
134
+ case 'DD':
135
+ val = this.timeObj.day.str;
136
+ break;
137
+ case 'HH':
138
+ val = this.timeObj.hour.str;
139
+ break;
140
+ case 'mm':
141
+ val = this.timeObj.minute.str;
142
+ break;
143
+ case 'ss':
144
+ val = this.timeObj.second.str;
145
+ break;
146
+ }
147
+ items.push({ val, unit: '' });
148
+ }
149
+ else if (match[2]) {
150
+ if (items.length > 0) {
151
+ items[items.length - 1].unit = match[2];
152
+ }
153
+ }
154
+ }
155
+ return items.map((item, index$1) => {
156
+ return (index.h("div", { key: index$1 + item.unit, class: "helper-count-down-item", part: "item" }, index.h("div", { class: "helper-count-down-item-num" }, item.val), index.h("div", { class: "helper-count-down-item-unit" }, item.unit)));
157
+ });
158
+ }
159
+ render() {
160
+ return (index.h("div", { key: 'b360412e045020b5ac0263c6ca56458f31eedb2c', class: "helper-count-down-container", ref: (el) => (this.stylingContainer = el) }, index.h("slot", { key: 'c72bed87fba869c842407b04e0cbfe038e5b7ea8' }), this.prefix && index.h("div", { key: '8d3ba9d60577421f81bae7bc76f52a774b17e1fe', class: "helper-count-down-prefix" }, this.prefix), index.h("div", { key: '187edf3b8eb6de85efe1a748fd8ef47a68e19611', class: "helper-count-down-values", part: "values" }, this.renderItems()), this.suffix && index.h("div", { key: '3a8e5d9561ecd3f52eff423bd43c8b60a261a17c', class: "helper-count-down-suffix" }, this.suffix)));
161
+ }
162
+ static get watchers() { return {
163
+ "clientStyling": ["handleClientStylingChange"],
164
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
165
+ "mbSource": ["handleMbSourceChange"],
166
+ "value": ["handleValueChange"]
167
+ }; }
168
+ };
169
+ HelperCountDown.style = HelperCountDownStyle0;
170
+
171
+ exports.lottery_banner = lotteryBanner.LotteryBanner;
172
+ exports.helper_count_down = HelperCountDown;
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'lottery-banner';
24
- 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 };
24
+ 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 };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
@@ -71,10 +71,10 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
71
71
  }
72
72
  switch(bundleId) {
73
73
 
74
- case 'lottery-banner.cjs':
74
+ case 'helper-count-down_2.cjs':
75
75
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
76
76
  /* webpackMode: "lazy" */
77
- './lottery-banner.cjs.entry.js')); }).then(processMod, consoleError);
77
+ './helper-count-down_2.cjs.entry.js')); }).then(processMod, consoleError);
78
78
  }
79
79
  }
80
80
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
@@ -398,7 +398,7 @@ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
398
398
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
399
399
  if (oldValue !== newValue) {
400
400
  let isProp = isMemberInElement(elm, memberName);
401
- memberName.toLowerCase();
401
+ let ln = memberName.toLowerCase();
402
402
  if (memberName === "class") {
403
403
  const classList = elm.classList;
404
404
  const oldClasses = parseClassList(oldValue);
@@ -409,6 +409,24 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
409
409
  if (newValue) {
410
410
  newValue(elm);
411
411
  }
412
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
413
+ if (memberName[2] === "-") {
414
+ memberName = memberName.slice(3);
415
+ } else if (isMemberInElement(win, ln)) {
416
+ memberName = ln.slice(2);
417
+ } else {
418
+ memberName = ln[2] + memberName.slice(3);
419
+ }
420
+ if (oldValue || newValue) {
421
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
422
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
423
+ if (oldValue) {
424
+ plt.rel(elm, memberName, oldValue, capture);
425
+ }
426
+ if (newValue) {
427
+ plt.ael(elm, memberName, newValue, capture);
428
+ }
429
+ }
412
430
  } else {
413
431
  const isComplex = isComplexType(newValue);
414
432
  if ((isProp || isComplex && newValue !== null) && !isSvg) {
@@ -443,6 +461,8 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
443
461
  };
444
462
  var parseClassListRegex = /\s/;
445
463
  var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
464
+ var CAPTURE_EVENT_SUFFIX = "Capture";
465
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
446
466
 
447
467
  // src/runtime/vdom/update-element.ts
448
468
  var updateElement = (oldVnode, newVnode, isSvgMode2) => {
@@ -629,10 +649,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
629
649
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
630
650
  const oldChildren = oldVNode.$children$;
631
651
  const newChildren = newVNode2.$children$;
652
+ const tag = newVNode2.$tag$;
632
653
  const text = newVNode2.$text$;
633
654
  if (text === null) {
634
655
  {
635
- {
656
+ if (tag === "slot" && !useNativeShadowDom) ; else {
636
657
  updateElement(oldVNode, newVNode2, isSvgMode);
637
658
  }
638
659
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryBanner = require('./lottery-banner-c3bceca9.js');
6
- require('./index-7e1b19dd.js');
5
+ const lotteryBanner = require('./lottery-banner-c5020b47.js');
6
+ require('./index-21014502.js');
7
7
 
8
8
 
9
9
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7e1b19dd.js');
5
+ const index = require('./index-21014502.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["lottery-banner.cjs",[[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);
11
+ return index.bootstrapLazy([["helper-count-down_2.cjs",[[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);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;