@everymatrix/mini-games-lobby 1.52.6 → 1.53.10

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.
@@ -21,19 +21,23 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'mini-games-lobby';
24
- const BUILD = /* mini-games-lobby */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, 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: false, 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: false, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: false, vdomXlink: false, watchCallback: true };
24
+ const BUILD = /* mini-games-lobby */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, 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, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: false, propString: true, reflect: false, 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: false, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: false, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
- Stencil Client Platform v4.22.3 | MIT Licensed | https://stenciljs.com
27
+ Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
28
28
  */
29
29
  var __defProp = Object.defineProperty;
30
30
  var __export = (target, all) => {
31
31
  for (var name in all)
32
32
  __defProp(target, name, { get: all[name], enumerable: true });
33
33
  };
34
+
35
+ // src/client/client-host-ref.ts
34
36
  var hostRefs = /* @__PURE__ */ new WeakMap();
35
37
  var getHostRef = (ref) => hostRefs.get(ref);
36
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
38
+ var registerInstance = (lazyInstance, hostRef) => {
39
+ hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
40
+ };
37
41
  var registerHost = (hostElement, cmpMeta) => {
38
42
  const hostRef = {
39
43
  $flags$: 0,
@@ -46,7 +50,8 @@ var registerHost = (hostElement, cmpMeta) => {
46
50
  hostElement["s-p"] = [];
47
51
  hostElement["s-rc"] = [];
48
52
  }
49
- return hostRefs.set(hostElement, hostRef);
53
+ const ref = hostRefs.set(hostElement, hostRef);
54
+ return ref;
50
55
  };
51
56
  var isMemberInElement = (elm, memberName) => memberName in elm;
52
57
  var consoleError = (e, el) => (0, console.error)(e, el);
@@ -83,16 +88,22 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
83
88
  /* webpackExclude: /\.system\.entry\.js$/ */
84
89
  /* webpackMode: "lazy" */
85
90
  `./${bundleId}.entry.js${""}`
86
- )); }).then((importedModule) => {
87
- {
88
- cmpModules.set(bundleId, importedModule);
91
+ )); }).then(
92
+ (importedModule) => {
93
+ {
94
+ cmpModules.set(bundleId, importedModule);
95
+ }
96
+ return importedModule[exportName];
97
+ },
98
+ (e) => {
99
+ consoleError(e, hostRef.$hostElement$);
89
100
  }
90
- return importedModule[exportName];
91
- }, consoleError);
101
+ );
92
102
  };
93
103
 
94
104
  // src/client/client-style.ts
95
105
  var styles = /* @__PURE__ */ new Map();
106
+ var HYDRATED_STYLE_ID = "sty-id";
96
107
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
97
108
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
98
109
  var win = typeof window !== "undefined" ? window : {};
@@ -150,12 +161,6 @@ var flush = () => {
150
161
  };
151
162
  var nextTick = (cb) => promiseResolve().then(cb);
152
163
  var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
153
-
154
- // src/utils/constants.ts
155
- var EMPTY_OBJ = {};
156
-
157
- // src/utils/helpers.ts
158
- var isDef = (v) => v != null;
159
164
  var isComplexType = (o) => {
160
165
  o = typeof o;
161
166
  return o === "object" || o === "function";
@@ -369,7 +374,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
369
374
  }
370
375
  if (!appliedStyles.has(scopeId2)) {
371
376
  {
372
- styleElm = doc.createElement("style");
377
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
373
378
  styleElm.innerHTML = style;
374
379
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
375
380
  if (nonce != null) {
@@ -379,7 +384,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
379
384
  if (styleContainerNode.nodeName === "HEAD") {
380
385
  const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
381
386
  const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
382
- styleContainerNode.insertBefore(styleElm, referenceNode2);
387
+ styleContainerNode.insertBefore(
388
+ styleElm,
389
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
390
+ );
383
391
  } else if ("host" in styleContainerNode) {
384
392
  if (supportsConstructableStylesheets) {
385
393
  const stylesheet = new CSSStyleSheet();
@@ -429,7 +437,7 @@ var attachStyles = (hostRef) => {
429
437
  endAttachStyles();
430
438
  };
431
439
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
432
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
440
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
433
441
  if (oldValue !== newValue) {
434
442
  let isProp = isMemberInElement(elm, memberName);
435
443
  let ln = memberName.toLowerCase();
@@ -466,7 +474,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
466
474
  elm.setAttribute(memberName, n);
467
475
  }
468
476
  }
469
- } else {
477
+ } else if (elm[memberName] !== newValue) {
470
478
  elm[memberName] = newValue;
471
479
  }
472
480
  } catch (e) {
@@ -491,19 +499,31 @@ var CAPTURE_EVENT_SUFFIX = "Capture";
491
499
  var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
492
500
 
493
501
  // src/runtime/vdom/update-element.ts
494
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
502
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
495
503
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
496
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
497
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
504
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
505
+ const newVnodeAttrs = newVnode.$attrs$ || {};
498
506
  {
499
507
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
500
508
  if (!(memberName in newVnodeAttrs)) {
501
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
509
+ setAccessor(
510
+ elm,
511
+ memberName,
512
+ oldVnodeAttrs[memberName],
513
+ void 0,
514
+ isSvgMode2,
515
+ newVnode.$flags$);
502
516
  }
503
517
  }
504
518
  }
505
519
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
506
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
520
+ setAccessor(
521
+ elm,
522
+ memberName,
523
+ oldVnodeAttrs[memberName],
524
+ newVnodeAttrs[memberName],
525
+ isSvgMode2,
526
+ newVnode.$flags$);
507
527
  }
508
528
  };
509
529
  function sortedAttrNames(attrNames) {
@@ -515,13 +535,10 @@ function sortedAttrNames(attrNames) {
515
535
  attrNames
516
536
  );
517
537
  }
518
-
519
- // src/runtime/vdom/vdom-render.ts
520
- var scopeId;
521
538
  var hostTagName;
522
539
  var useNativeShadowDom = false;
523
540
  var isSvgMode = false;
524
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
541
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
525
542
  const newVNode2 = newParentVNode.$children$[childIndex];
526
543
  let i2 = 0;
527
544
  let elm;
@@ -533,11 +550,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
533
550
  {
534
551
  updateElement(null, newVNode2, isSvgMode);
535
552
  }
536
- const rootNode = elm.getRootNode();
537
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
538
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
539
- elm.classList.add(elm["s-si"] = scopeId);
540
- }
541
553
  if (newVNode2.$children$) {
542
554
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
543
555
  childNode = createElm(oldParentVNode, newVNode2, i2);
@@ -666,6 +678,9 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
666
678
  if (!isInitialRender) {
667
679
  return leftVNode.$key$ === rightVNode.$key$;
668
680
  }
681
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
682
+ leftVNode.$key$ = rightVNode.$key$;
683
+ }
669
684
  return true;
670
685
  }
671
686
  return false;
@@ -693,8 +708,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
693
708
  }
694
709
  };
695
710
  var insertBefore = (parent, newNode, reference) => {
696
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
697
- return inserted;
711
+ {
712
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
713
+ }
698
714
  };
699
715
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
700
716
  const hostElm = hostRef.$hostElement$;
@@ -713,9 +729,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
713
729
  rootVnode.$flags$ |= 4 /* isHost */;
714
730
  hostRef.$vnode$ = rootVnode;
715
731
  rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
716
- {
717
- scopeId = hostElm["s-sc"];
718
- }
719
732
  useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
720
733
  patch(oldVNode, rootVnode, isInitialLoad);
721
734
  };
@@ -723,7 +736,14 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
723
736
  // src/runtime/update-component.ts
724
737
  var attachToAncestor = (hostRef, ancestorComponent) => {
725
738
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
726
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
739
+ const index = ancestorComponent["s-p"].push(
740
+ new Promise(
741
+ (r) => hostRef.$onRenderResolve$ = () => {
742
+ ancestorComponent["s-p"].splice(index - 1, 1);
743
+ r();
744
+ }
745
+ )
746
+ );
727
747
  }
728
748
  };
729
749
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -750,7 +770,7 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
750
770
  let maybePromise;
751
771
  if (isInitialLoad) {
752
772
  {
753
- maybePromise = safeCall(instance, "componentWillLoad");
773
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
754
774
  }
755
775
  }
756
776
  endSchedule();
@@ -824,7 +844,7 @@ var postUpdateComponent = (hostRef) => {
824
844
  addHydratedFlag(elm);
825
845
  }
826
846
  {
827
- safeCall(instance, "componentDidLoad");
847
+ safeCall(instance, "componentDidLoad", void 0, elm);
828
848
  }
829
849
  endPostUpdate();
830
850
  {
@@ -853,12 +873,12 @@ var appDidLoad = (who) => {
853
873
  }
854
874
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
855
875
  };
856
- var safeCall = (instance, method, arg) => {
876
+ var safeCall = (instance, method, arg, elm) => {
857
877
  if (instance && instance[method]) {
858
878
  try {
859
879
  return instance[method](arg);
860
880
  } catch (e) {
861
- consoleError(e);
881
+ consoleError(e, elm);
862
882
  }
863
883
  }
864
884
  return void 0;
@@ -922,15 +942,68 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
922
942
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
923
943
  members.map(([memberName, [memberFlags]]) => {
924
944
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
945
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
946
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
947
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
948
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
949
+ Object.defineProperty(prototype, memberName, {
950
+ get() {
951
+ {
952
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
953
+ return getValue(this, memberName);
954
+ }
955
+ const ref = getHostRef(this);
956
+ const instance = ref ? ref.$lazyInstance$ : prototype;
957
+ if (!instance) return;
958
+ return instance[memberName];
959
+ }
960
+ },
961
+ configurable: true,
962
+ enumerable: true
963
+ });
964
+ }
925
965
  Object.defineProperty(prototype, memberName, {
926
- get() {
927
- return getValue(this, memberName);
928
- },
929
966
  set(newValue) {
930
- setValue(this, memberName, newValue, cmpMeta);
931
- },
932
- configurable: true,
933
- enumerable: true
967
+ const ref = getHostRef(this);
968
+ if (origSetter) {
969
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
970
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
971
+ newValue = ref.$instanceValues$.get(memberName);
972
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
973
+ ref.$instanceValues$.set(memberName, currentValue);
974
+ }
975
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
976
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
977
+ setValue(this, memberName, newValue, cmpMeta);
978
+ return;
979
+ }
980
+ {
981
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
982
+ setValue(this, memberName, newValue, cmpMeta);
983
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
984
+ ref.$onReadyPromise$.then(() => {
985
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
986
+ ref.$lazyInstance$[memberName] = newValue;
987
+ }
988
+ });
989
+ }
990
+ return;
991
+ }
992
+ const setterSetVal = () => {
993
+ const currentValue = ref.$lazyInstance$[memberName];
994
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
995
+ ref.$instanceValues$.set(memberName, currentValue);
996
+ }
997
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
998
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
999
+ };
1000
+ if (ref.$lazyInstance$) {
1001
+ setterSetVal();
1002
+ } else {
1003
+ ref.$onReadyPromise$.then(() => setterSetVal());
1004
+ }
1005
+ }
1006
+ }
934
1007
  });
935
1008
  }
936
1009
  });
@@ -940,7 +1013,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
940
1013
  plt.jmp(() => {
941
1014
  var _a2;
942
1015
  const propName = attrNameToPropName.get(attrName);
943
- if (this.hasOwnProperty(propName)) {
1016
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
944
1017
  newValue = this[propName];
945
1018
  delete this[propName];
946
1019
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -960,7 +1033,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
960
1033
  }
961
1034
  return;
962
1035
  }
963
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1036
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1037
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1038
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
1039
+ this[propName] = newValue;
1040
+ }
964
1041
  });
965
1042
  };
966
1043
  Cstr.observedAttributes = Array.from(
@@ -983,9 +1060,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
983
1060
  let Cstr;
984
1061
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
985
1062
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
986
- const bundleId = cmpMeta.$lazyBundleId$;
987
- if (bundleId) {
988
- const CstrImport = loadModule(cmpMeta);
1063
+ {
1064
+ const CstrImport = loadModule(cmpMeta, hostRef);
989
1065
  if (CstrImport && "then" in CstrImport) {
990
1066
  const endLoad = uniqueTime();
991
1067
  Cstr = await CstrImport;
@@ -1010,7 +1086,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1010
1086
  try {
1011
1087
  new Cstr(hostRef);
1012
1088
  } catch (e) {
1013
- consoleError(e);
1089
+ consoleError(e, elm);
1014
1090
  }
1015
1091
  {
1016
1092
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
@@ -1019,10 +1095,6 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1019
1095
  hostRef.$flags$ |= 128 /* isWatchReady */;
1020
1096
  }
1021
1097
  endNewInstance();
1022
- } else {
1023
- Cstr = elm.constructor;
1024
- const cmpTag = elm.localName;
1025
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1026
1098
  }
1027
1099
  if (Cstr && Cstr.style) {
1028
1100
  let style;
@@ -1045,7 +1117,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1045
1117
  schedule();
1046
1118
  }
1047
1119
  };
1048
- var fireConnectedCallback = (instance) => {
1120
+ var fireConnectedCallback = (instance, elm) => {
1049
1121
  };
1050
1122
 
1051
1123
  // src/runtime/connected-callback.ts
@@ -1085,7 +1157,7 @@ var connectedCallback = (elm) => {
1085
1157
  endConnected();
1086
1158
  }
1087
1159
  };
1088
- var disconnectInstance = (instance) => {
1160
+ var disconnectInstance = (instance, elm) => {
1089
1161
  };
1090
1162
  var disconnectedCallback = async (elm) => {
1091
1163
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -1094,6 +1166,12 @@ var disconnectedCallback = async (elm) => {
1094
1166
  hostRef.$onReadyPromise$.then(() => disconnectInstance());
1095
1167
  }
1096
1168
  }
1169
+ if (rootAppliedStyles.has(elm)) {
1170
+ rootAppliedStyles.delete(elm);
1171
+ }
1172
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1173
+ rootAppliedStyles.delete(elm.shadowRoot);
1174
+ }
1097
1175
  };
1098
1176
 
1099
1177
  // src/runtime/bootstrap-lazy.ts
@@ -1171,6 +1249,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1171
1249
  }
1172
1250
  disconnectedCallback() {
1173
1251
  plt.jmp(() => disconnectedCallback(this));
1252
+ plt.raf(() => {
1253
+ var _a3;
1254
+ const hostRef = getHostRef(this);
1255
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1256
+ delete hostRef.$vnode$.$elm$;
1257
+ }
1258
+ });
1174
1259
  }
1175
1260
  componentOnReady() {
1176
1261
  return getHostRef(this).$onReadyPromise$;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-60aa454b.js');
5
+ const index = require('./index-3ddb25ed.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
@@ -2,7 +2,38 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-60aa454b.js');
5
+ const index = require('./index-3ddb25ed.js');
6
+
7
+ /******************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+
22
+ function __decorate(decorators, target, key, desc) {
23
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ }
28
+
29
+ function __metadata(metadataKey, metadataValue) {
30
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
31
+ }
32
+
33
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
34
+ var e = new Error(message);
35
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
36
+ };
6
37
 
7
38
  const fetcher = async (url) => {
8
39
  let res;
@@ -61,20 +92,154 @@ const Games = ({ text, games, onClickGame }) => (index.h("div", { class: "GamesC
61
92
  index.h("div", { id: "Games" }, games.map((game) => index.h("div", { class: "Game" },
62
93
  index.h("div", Object.assign({ class: "GameImg" }, getProps(game, onClickGame))))))));
63
94
 
95
+ const apply = (proto, lifecycle, run) => {
96
+ const existLifeCycle = proto[lifecycle];
97
+ if (!existLifeCycle) {
98
+ throw new Error('lifecycle ' + lifecycle + ' not defined');
99
+ }
100
+ proto[lifecycle] = function (...args) {
101
+ run.bind(this, ...args).call();
102
+ if (existLifeCycle) {
103
+ return existLifeCycle.bind(this, ...args).call();
104
+ }
105
+ };
106
+ };
107
+
108
+ const translation = {
109
+ en: {
110
+ MiniGames: 'Mini Games',
111
+ },
112
+ 'zh-hk': {
113
+ MiniGames: '小游戲',
114
+ },
115
+ hr: {
116
+ MiniGames: 'Mini igre'
117
+ }
118
+ };
119
+
120
+ const getLocale = (_translations, language) => {
121
+ return _translations[language] || _translations['en'];
122
+ };
123
+ function setLocale() {
124
+ this.locale = getLocale(this.translation, this.language);
125
+ }
126
+ async function setLocaleByUrl(isInit = true) {
127
+ if (this.translationUrl) {
128
+ this.translation = await fetcher(this.translationUrl);
129
+ setLocale.bind(this).call();
130
+ }
131
+ else {
132
+ if (!isInit) {
133
+ this.translation = translation;
134
+ setLocale.bind(this).call();
135
+ }
136
+ }
137
+ }
138
+ const Locale = () => {
139
+ // @ts-ignore
140
+ return (proto, prop) => {
141
+ apply(proto, 'componentWillLoad', async function () {
142
+ this.translation = translation;
143
+ setLocale.bind(this).call();
144
+ setLocaleByUrl.bind(this, true).call();
145
+ });
146
+ // @ts-ignore
147
+ apply(proto, 'componentShouldUpdate', async function (newValue, oldValue, key) {
148
+ if (key === 'language') {
149
+ setLocale.bind(this).call();
150
+ }
151
+ if (key === 'translationUrl') {
152
+ setLocaleByUrl.bind(this, false).call();
153
+ }
154
+ });
155
+ };
156
+ };
157
+
158
+ const fetchText = async (url) => {
159
+ let styleCode;
160
+ try {
161
+ let res = await fetch(url);
162
+ styleCode = await res.text();
163
+ }
164
+ catch (err) {
165
+ console.error('error ', err);
166
+ }
167
+ return styleCode;
168
+ };
169
+ const setStyle = (container, index, styleCode) => {
170
+ const sheet = new CSSStyleSheet();
171
+ styleCode && sheet.insertRule(styleCode);
172
+ try {
173
+ container.adoptedStyleSheets[index] = sheet;
174
+ }
175
+ catch (err) { }
176
+ };
177
+ const getCode = async (url) => {
178
+ let styleCode;
179
+ if (url) {
180
+ styleCode = await fetchText(url);
181
+ }
182
+ return styleCode;
183
+ };
184
+ const setClientStyling = (root, styleCode) => {
185
+ if (!root)
186
+ return;
187
+ setStyle(root, 1, styleCode);
188
+ };
189
+ const setClientStylingUrl = async (root, url) => {
190
+ if (!root)
191
+ return;
192
+ setStyle(root, 2, await getCode(url));
193
+ };
194
+
195
+ const matchStyleProcess = (root, value, key) => {
196
+ switch (key) {
197
+ case 'clientStyling':
198
+ setClientStyling(root, value);
199
+ break;
200
+ case 'clientStylingUrl':
201
+ setClientStylingUrl(root, value);
202
+ break;
203
+ }
204
+ };
205
+ const Style = () => {
206
+ return (proto, prop) => {
207
+ apply(proto, 'componentDidLoad', function () {
208
+ const root = index.getElement(this).shadowRoot;
209
+ matchStyleProcess(root, this[prop], prop);
210
+ });
211
+ // @ts-ignore
212
+ apply(proto, 'componentShouldUpdate', function (newValue, oldValue, key) {
213
+ if (key !== prop)
214
+ return;
215
+ const root = index.getElement(this).shadowRoot;
216
+ matchStyleProcess(root, this[prop], prop);
217
+ });
218
+ };
219
+ };
220
+
64
221
  const miniGamesLobbyCss = ":host{display:block}*{box-sizing:border-box}#LobbyContainer{display:flex;flex-direction:column;flex-grow:1;position:relative}#GameLaunchHeader{align-items:center;display:flex;background:var(--mini-games-header-bg, var(--base-bg, #fff));height:40px;justify-content:space-between;padding:0 15px}#GameLaunchHeader button{border:none;color:inherit;cursor:pointer;outline:0}#GameLaunchHeader .GameIcon--full-screen{margin:0 10px 0 auto}#GameLaunchHeader .GameIcon{background:var(--mini-game-icon-bg, transparent);padding:0}#GamesHeader{align-items:center;display:flex;background:var(--mini-games-header-bg, var(--base-bg, #fff));height:40px;justify-content:space-between;padding:0 15px;color:var(--mini-games-header-color, var(--text, #000))}#GamesHeader button{border:none;color:inherit;cursor:pointer;outline:0}#GamesHeader>div{align-items:center;display:flex}#GamesHeader p{font-weight:600;margin:0 5px}@media (min-width: 340px){#Games{gap:15px;justify-content:center}}#Games{display:inline-flex;flex-wrap:wrap;justify-content:space-between;gap:4px;padding:15px 15px 54px}.Game{width:68px;height:68px;border-radius:50%;box-shadow:0 4px 12px 0 rgba(13, 19, 29, 0.3);cursor:pointer}.GameImg{width:68px;height:68px;background-position:center center;background-size:cover;transition:0.3s}.GameImg:hover{transform:scale(1.5)}";
65
222
  const MiniGamesLobbyStyle0 = miniGamesLobbyCss;
66
223
 
67
224
  const MiniGamesLobby = class {
68
225
  constructor(hostRef) {
69
226
  index.registerInstance(this, hostRef);
70
- this.filter = undefined;
71
- this.session = undefined;
72
- this.endpoint = undefined;
227
+ /**
228
+ * Language of the widget
229
+ */
73
230
  this.language = 'en';
231
+ /**
232
+ * Client custom styling via string
233
+ */
74
234
  this.clientStyling = '';
235
+ /**
236
+ * Client custom styling via url
237
+ */
75
238
  this.clientStylingUrl = '';
239
+ /**
240
+ * translation via url
241
+ */
76
242
  this.translationUrl = '';
77
- this.locale = undefined;
78
243
  this.launchUrl = undefined;
79
244
  this.games = [];
80
245
  }
@@ -113,6 +278,18 @@ const MiniGamesLobby = class {
113
278
  "language": ["updateGames"]
114
279
  }; }
115
280
  };
281
+ __decorate([
282
+ Locale(),
283
+ __metadata("design:type", String)
284
+ ], MiniGamesLobby.prototype, "language", void 0);
285
+ __decorate([
286
+ Style(),
287
+ __metadata("design:type", String)
288
+ ], MiniGamesLobby.prototype, "clientStyling", void 0);
289
+ __decorate([
290
+ Style(),
291
+ __metadata("design:type", String)
292
+ ], MiniGamesLobby.prototype, "clientStylingUrl", void 0);
116
293
  MiniGamesLobby.style = MiniGamesLobbyStyle0;
117
294
 
118
295
  exports.mini_games_lobby = MiniGamesLobby;
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-60aa454b.js');
5
+ const index = require('./index-3ddb25ed.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.25.1 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  var patchBrowser = () => {
12
12
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mini-games-lobby.cjs.js', document.baseURI).href));
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.22.3",
7
+ "version": "4.25.1",
8
8
  "typescriptVersion": "5.5.4"
9
9
  },
10
10
  "collections": [],